mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 5/5] net: Pass network device to net_answer_arp()
Date: Fri, 15 Jul 2016 09:23:09 +0200	[thread overview]
Message-ID: <1468567389-28169-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1468567389-28169-1-git-send-email-s.hauer@pengutronix.de>

The caller already has the correct network device, so pass it
to net_answer_arp() rather than using eth_get_current() there.
This is a step towards making a global current network device
unnecessary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 net/net.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/net.c b/net/net.c
index e5bd9bb..df1d677 100644
--- a/net/net.c
+++ b/net/net.c
@@ -379,11 +379,10 @@ int net_icmp_send(struct net_connection *con, int len)
 	return net_ip_send(con, sizeof(struct icmphdr) + len);
 }
 
-static int net_answer_arp(unsigned char *pkt, int len)
+static int net_answer_arp(struct eth_device *edev, unsigned char *pkt, int len)
 {
 	struct arprequest *arp = (struct arprequest *)(pkt + ETHER_HDR_SIZE);
 	struct ethernet *et = (struct ethernet *)pkt;
-	struct eth_device *edev = eth_get_current();
 	unsigned char *packet;
 	int ret;
 
@@ -453,7 +452,7 @@ static int net_handle_arp(struct eth_device *edev, unsigned char *pkt, int len)
 
 	switch (ntohs(arp->ar_op)) {
 	case ARPOP_REQUEST:
-		return net_answer_arp(pkt, len);
+		return net_answer_arp(edev, pkt, len);
 	case ARPOP_REPLY:
 		arp_handler(arp);
 		return 1;
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2016-07-15  7:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15  7:23 [PATCH 1/5] net: usb: use minimum timeout when polling for new packets Sascha Hauer
2016-07-15  7:23 ` [PATCH 2/5] net: eth: open correct edev in eth_check_open Sascha Hauer
2016-07-15  7:23 ` [PATCH 3/5] net: introduce for_each_netdev iterator Sascha Hauer
2016-07-15  7:23 ` [PATCH 4/5] net: eth: add name to struct eth_device Sascha Hauer
2016-07-15  7:23 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1468567389-28169-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox