[PATCH 5/5] net: Pass network device to net_answer_arp()

Sascha Hauer s.hauer at pengutronix.de
Fri Jul 15 00:23:09 PDT 2016


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 at 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




More information about the barebox mailing list