aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/neighbour.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2015-03-07 16:25:56 -0600
committerDavid S. Miller <davem@davemloft.net>2015-03-08 19:30:06 -0400
commitb79bda3d38ae67940f1740f7e015f284eb551680 (patch)
treefb927e9867e7a013c4ce142a993458d15ee20cef /net/core/neighbour.c
parentmpls: Fix the openvswitch select of NET_MPLS_GSO (diff)
downloadlinux-dev-b79bda3d38ae67940f1740f7e015f284eb551680.tar.xz
linux-dev-b79bda3d38ae67940f1740f7e015f284eb551680.zip
neigh: Use neigh table index for neigh_packet_xmit
Remove a little bit of unnecessary work when transmitting a packet with neigh_packet_xmit. Use the neighbour table index not the address family as a parameter. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/neighbour.c')
-rw-r--r--net/core/neighbour.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index cffaf00561e7..ad07990e943d 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2391,22 +2391,15 @@ void __neigh_for_each_release(struct neigh_table *tbl,
}
EXPORT_SYMBOL(__neigh_for_each_release);
-int neigh_xmit(int family, struct net_device *dev,
+int neigh_xmit(int index, struct net_device *dev,
const void *addr, struct sk_buff *skb)
{
- int err;
- if (family == AF_PACKET) {
- err = dev_hard_header(skb, dev, ntohs(skb->protocol),
- addr, NULL, skb->len);
- if (err < 0)
- goto out_kfree_skb;
- err = dev_queue_xmit(skb);
- } else {
+ int err = -EAFNOSUPPORT;
+ if (likely(index < NEIGH_NR_TABLES)) {
struct neigh_table *tbl;
struct neighbour *neigh;
- err = -ENETDOWN;
- tbl = neigh_find_table(family);
+ tbl = neigh_tables[index];
if (!tbl)
goto out;
neigh = __neigh_lookup_noref(tbl, addr, dev);
@@ -2417,6 +2410,13 @@ int neigh_xmit(int family, struct net_device *dev,
goto out_kfree_skb;
err = neigh->output(neigh, skb);
}
+ else if (index == NEIGH_LINK_TABLE) {
+ err = dev_hard_header(skb, dev, ntohs(skb->protocol),
+ addr, NULL, skb->len);
+ if (err < 0)
+ goto out_kfree_skb;
+ err = dev_queue_xmit(skb);
+ }
out:
return err;
out_kfree_skb: