diff options
author | Tom Tucker <tom@opengridcomputing.com> | 2006-07-30 23:44:19 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-08-02 16:38:22 -0400 |
commit | e795d092507d571d66f2ec98d3efdc7dd284bf80 (patch) | |
tree | 8aef64627d88b738575f66073681228b3f69df26 /drivers/infiniband/core | |
parent | 8d71740c56a9058acc4378504a356d543ff1308b (diff) |
[NET] infiniband: Cleanup ib_addr module to use the netevents
Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/addr.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index d294bbc42f09..1205e8027829 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <net/arp.h> | 35 | #include <net/arp.h> |
36 | #include <net/neighbour.h> | 36 | #include <net/neighbour.h> |
37 | #include <net/route.h> | 37 | #include <net/route.h> |
38 | #include <net/netevent.h> | ||
38 | #include <rdma/ib_addr.h> | 39 | #include <rdma/ib_addr.h> |
39 | 40 | ||
40 | MODULE_AUTHOR("Sean Hefty"); | 41 | MODULE_AUTHOR("Sean Hefty"); |
@@ -326,25 +327,22 @@ void rdma_addr_cancel(struct rdma_dev_addr *addr) | |||
326 | } | 327 | } |
327 | EXPORT_SYMBOL(rdma_addr_cancel); | 328 | EXPORT_SYMBOL(rdma_addr_cancel); |
328 | 329 | ||
329 | static int addr_arp_recv(struct sk_buff *skb, struct net_device *dev, | 330 | static int netevent_callback(struct notifier_block *self, unsigned long event, |
330 | struct packet_type *pkt, struct net_device *orig_dev) | 331 | void *ctx) |
331 | { | 332 | { |
332 | struct arphdr *arp_hdr; | 333 | if (event == NETEVENT_NEIGH_UPDATE) { |
334 | struct neighbour *neigh = ctx; | ||
333 | 335 | ||
334 | arp_hdr = (struct arphdr *) skb->nh.raw; | 336 | if (neigh->dev->type == ARPHRD_INFINIBAND && |
335 | 337 | (neigh->nud_state & NUD_VALID)) { | |
336 | if (arp_hdr->ar_op == htons(ARPOP_REQUEST) || | 338 | set_timeout(jiffies); |
337 | arp_hdr->ar_op == htons(ARPOP_REPLY)) | 339 | } |
338 | set_timeout(jiffies); | 340 | } |
339 | |||
340 | kfree_skb(skb); | ||
341 | return 0; | 341 | return 0; |
342 | } | 342 | } |
343 | 343 | ||
344 | static struct packet_type addr_arp = { | 344 | static struct notifier_block nb = { |
345 | .type = __constant_htons(ETH_P_ARP), | 345 | .notifier_call = netevent_callback |
346 | .func = addr_arp_recv, | ||
347 | .af_packet_priv = (void*) 1, | ||
348 | }; | 346 | }; |
349 | 347 | ||
350 | static int addr_init(void) | 348 | static int addr_init(void) |
@@ -353,13 +351,13 @@ static int addr_init(void) | |||
353 | if (!addr_wq) | 351 | if (!addr_wq) |
354 | return -ENOMEM; | 352 | return -ENOMEM; |
355 | 353 | ||
356 | dev_add_pack(&addr_arp); | 354 | register_netevent_notifier(&nb); |
357 | return 0; | 355 | return 0; |
358 | } | 356 | } |
359 | 357 | ||
360 | static void addr_cleanup(void) | 358 | static void addr_cleanup(void) |
361 | { | 359 | { |
362 | dev_remove_pack(&addr_arp); | 360 | unregister_netevent_notifier(&nb); |
363 | destroy_workqueue(addr_wq); | 361 | destroy_workqueue(addr_wq); |
364 | } | 362 | } |
365 | 363 | ||