diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-03-07 17:25:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-08 19:30:06 -0400 |
commit | b79bda3d38ae67940f1740f7e015f284eb551680 (patch) | |
tree | fb927e9867e7a013c4ce142a993458d15ee20cef /net/core/neighbour.c | |
parent | 7d5f41f276b376d567e919530f8b5fd70be25426 (diff) |
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.c | 22 |
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, | |||
2391 | } | 2391 | } |
2392 | EXPORT_SYMBOL(__neigh_for_each_release); | 2392 | EXPORT_SYMBOL(__neigh_for_each_release); |
2393 | 2393 | ||
2394 | int neigh_xmit(int family, struct net_device *dev, | 2394 | int neigh_xmit(int index, struct net_device *dev, |
2395 | const void *addr, struct sk_buff *skb) | 2395 | const void *addr, struct sk_buff *skb) |
2396 | { | 2396 | { |
2397 | int err; | 2397 | int err = -EAFNOSUPPORT; |
2398 | if (family == AF_PACKET) { | 2398 | if (likely(index < NEIGH_NR_TABLES)) { |
2399 | err = dev_hard_header(skb, dev, ntohs(skb->protocol), | ||
2400 | addr, NULL, skb->len); | ||
2401 | if (err < 0) | ||
2402 | goto out_kfree_skb; | ||
2403 | err = dev_queue_xmit(skb); | ||
2404 | } else { | ||
2405 | struct neigh_table *tbl; | 2399 | struct neigh_table *tbl; |
2406 | struct neighbour *neigh; | 2400 | struct neighbour *neigh; |
2407 | 2401 | ||
2408 | err = -ENETDOWN; | 2402 | tbl = neigh_tables[index]; |
2409 | tbl = neigh_find_table(family); | ||
2410 | if (!tbl) | 2403 | if (!tbl) |
2411 | goto out; | 2404 | goto out; |
2412 | neigh = __neigh_lookup_noref(tbl, addr, dev); | 2405 | neigh = __neigh_lookup_noref(tbl, addr, dev); |
@@ -2417,6 +2410,13 @@ int neigh_xmit(int family, struct net_device *dev, | |||
2417 | goto out_kfree_skb; | 2410 | goto out_kfree_skb; |
2418 | err = neigh->output(neigh, skb); | 2411 | err = neigh->output(neigh, skb); |
2419 | } | 2412 | } |
2413 | else if (index == NEIGH_LINK_TABLE) { | ||
2414 | err = dev_hard_header(skb, dev, ntohs(skb->protocol), | ||
2415 | addr, NULL, skb->len); | ||
2416 | if (err < 0) | ||
2417 | goto out_kfree_skb; | ||
2418 | err = dev_queue_xmit(skb); | ||
2419 | } | ||
2420 | out: | 2420 | out: |
2421 | return err; | 2421 | return err; |
2422 | out_kfree_skb: | 2422 | out_kfree_skb: |