[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE4R7bCV1+oA8i52i8g=+yEwsoApcAQq5-WeTxgN40v-ai7y+A@mail.gmail.com>
Date: Sat, 21 Feb 2015 22:28:26 -0800
From: Scott Feldman <sfeldma@...il.com>
To: David Miller <davem@...emloft.net>
Cc: Netdev <netdev@...r.kernel.org>
Subject: Re: ARP resolving for switch drivers
On Sat, Feb 21, 2015 at 10:11 PM, David Miller <davem@...emloft.net> wrote:
>
> Scott I looked into the current state of affairs and you should
> be able to use generic infrastructure to resolve a neighbour
> entry and even trigger the state machine.
>
> For ipv4:
>
> n = __ipv4_neigh_lookup(dev, ip_addr);
> if (!n)
> n = neigh_create(&arp_tbl, &ip_addr, dev, true);
> if (!n)
> goto error;
>
> if (!(n->nud_state & NUD_VALID))
> neigh_event_send(n, NULL);
> else
> memcpy(&hw_entry->mac_addr, n->ha, dev_addr_len);
>
> If you have to take the neigh_event_send() path, you have to wait for
> the notifier to be invoked. And in the notifier you can fetch the
> MAC address.
Perfect! I'll give this a try shortly and test and report back.
(Trying to beat down some remaining L2 issues first).
I saw similar code in IB, but I don't understand the IB use-case.
> You shouldn't have to hand craft ARP requests and listen for responses
> or anything like that.
Thanks Dave.
-scott
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists