[ofa-general][RFC] IPv6 support for RDMA CM

Roland Dreier rdreier at cisco.com
Wed Jul 30 10:03:18 PDT 2008


 > Rather than exporting nd_tbl I think it would make more sense to
 > uninline ndisc_get_neigh() and export that.

FWIW, the patch below shrinks the kernel code somewhat:

add/remove: 1/0 grow/shrink: 1/5 up/down: 81/-217 (-136)
function                                     old     new   delta
ndisc_get_neigh                                -      76     +76
ipv6_add_addr                                644     649      +5
ip6_mc_msfilter                              665     663      -2
tcp_sendmsg                                 2558    2550      -8
icmp6_dst_alloc                              332     284     -48
rt6_alloc_cow                                266     201     -65
addrconf_dst_alloc                           433     339     -94

and I don't think ndisc_get_neigh() is on any fast path.  So this is
probably a good approach.

diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index a01b7c4..e39e5c0 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -138,15 +138,7 @@ int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name,
 extern void 			inet6_ifinfo_notify(int event,
 						    struct inet6_dev *idev);
 
-static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, const struct in6_addr *addr)
-{
-
-	if (dev)
-		return __neigh_lookup(&nd_tbl, addr, dev, 1);
-
-	return NULL;
-}
-
+struct neighbour *ndisc_get_neigh(struct net_device *dev, const struct in6_addr *addr);
 
 #endif /* __KERNEL__ */
 
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index beb48e3..1789b4c 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1593,6 +1593,15 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
 		in6_dev_put(idev);
 }
 
+struct neighbour *ndisc_get_neigh(struct net_device *dev, const struct in6_addr *addr)
+{
+
+	if (dev)
+		return __neigh_lookup(&nd_tbl, addr, dev, 1);
+
+	return NULL;
+}
+
 static void pndisc_redo(struct sk_buff *skb)
 {
 	ndisc_recv_ns(skb);



More information about the general mailing list