Commit e795d092 authored by Tom Tucker's avatar Tom Tucker Committed by David S. Miller

[NET] infiniband: Cleanup ib_addr module to use the netevents

Signed-off-by: default avatarTom Tucker <tom@opengridcomputing.com>
Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8d71740c
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <net/arp.h> #include <net/arp.h>
#include <net/neighbour.h> #include <net/neighbour.h>
#include <net/route.h> #include <net/route.h>
#include <net/netevent.h>
#include <rdma/ib_addr.h> #include <rdma/ib_addr.h>
MODULE_AUTHOR("Sean Hefty"); MODULE_AUTHOR("Sean Hefty");
...@@ -326,25 +327,22 @@ void rdma_addr_cancel(struct rdma_dev_addr *addr) ...@@ -326,25 +327,22 @@ void rdma_addr_cancel(struct rdma_dev_addr *addr)
} }
EXPORT_SYMBOL(rdma_addr_cancel); EXPORT_SYMBOL(rdma_addr_cancel);
static int addr_arp_recv(struct sk_buff *skb, struct net_device *dev, static int netevent_callback(struct notifier_block *self, unsigned long event,
struct packet_type *pkt, struct net_device *orig_dev) void *ctx)
{ {
struct arphdr *arp_hdr; if (event == NETEVENT_NEIGH_UPDATE) {
struct neighbour *neigh = ctx;
arp_hdr = (struct arphdr *) skb->nh.raw; if (neigh->dev->type == ARPHRD_INFINIBAND &&
(neigh->nud_state & NUD_VALID)) {
if (arp_hdr->ar_op == htons(ARPOP_REQUEST) || set_timeout(jiffies);
arp_hdr->ar_op == htons(ARPOP_REPLY)) }
set_timeout(jiffies); }
kfree_skb(skb);
return 0; return 0;
} }
static struct packet_type addr_arp = { static struct notifier_block nb = {
.type = __constant_htons(ETH_P_ARP), .notifier_call = netevent_callback
.func = addr_arp_recv,
.af_packet_priv = (void*) 1,
}; };
static int addr_init(void) static int addr_init(void)
...@@ -353,13 +351,13 @@ static int addr_init(void) ...@@ -353,13 +351,13 @@ static int addr_init(void)
if (!addr_wq) if (!addr_wq)
return -ENOMEM; return -ENOMEM;
dev_add_pack(&addr_arp); register_netevent_notifier(&nb);
return 0; return 0;
} }
static void addr_cleanup(void) static void addr_cleanup(void)
{ {
dev_remove_pack(&addr_arp); unregister_netevent_notifier(&nb);
destroy_workqueue(addr_wq); destroy_workqueue(addr_wq);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment