Commit b23b5455b6458920179a1f27513ce42e70d11f37

Authored by David S. Miller
1 parent 47ec132a40

neigh: Kill hh_cache->hh_output

It's just taking on one of two possible values, either
neigh_ops->output or dev_queue_xmit().  And this is purely depending
upon whether nud_state has NUD_CONNECTED set or not.

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 4 changed files with 7 additions and 29 deletions Side-by-side Diff

include/linux/netdevice.h
... ... @@ -254,7 +254,6 @@
254 254 struct hh_cache {
255 255 u16 hh_len;
256 256 u16 __pad;
257   - int (*hh_output)(struct sk_buff *skb);
258 257 seqlock_t hh_lock;
259 258  
260 259 /* cached hardware header; allow for machine alignment needs. */
include/net/neighbour.h
... ... @@ -340,13 +340,13 @@
340 340 } while (read_seqretry(&hh->hh_lock, seq));
341 341  
342 342 skb_push(skb, hh_len);
343   - return hh->hh_output(skb);
  343 + return dev_queue_xmit(skb);
344 344 }
345 345  
346 346 static inline int neigh_output(struct neighbour *n, struct sk_buff *skb)
347 347 {
348 348 struct hh_cache *hh = &n->hh;
349   - if (hh->hh_len)
  349 + if ((n->nud_state & NUD_CONNECTED) && hh->hh_len)
350 350 return neigh_hh_output(hh, skb);
351 351 else
352 352 return n->output(skb);
net/core/neighbour.c
... ... @@ -720,15 +720,9 @@
720 720 */
721 721 static void neigh_suspect(struct neighbour *neigh)
722 722 {
723   - struct hh_cache *hh;
724   -
725 723 NEIGH_PRINTK2("neigh %p is suspected.\n", neigh);
726 724  
727 725 neigh->output = neigh->ops->output;
728   -
729   - hh = &neigh->hh;
730   - if (hh->hh_len)
731   - hh->hh_output = neigh->ops->output;
732 726 }
733 727  
734 728 /* Neighbour state is OK;
735 729  
... ... @@ -738,15 +732,9 @@
738 732 */
739 733 static void neigh_connect(struct neighbour *neigh)
740 734 {
741   - struct hh_cache *hh;
742   -
743 735 NEIGH_PRINTK2("neigh %p is connected.\n", neigh);
744 736  
745 737 neigh->output = neigh->ops->connected_output;
746   -
747   - hh = &neigh->hh;
748   - if (hh->hh_len)
749   - hh->hh_output = dev_queue_xmit;
750 738 }
751 739  
752 740 static void neigh_periodic_work(struct work_struct *work)
753 741  
... ... @@ -1215,18 +1203,9 @@
1215 1203 /* Only one thread can come in here and initialize the
1216 1204 * hh_cache entry.
1217 1205 */
1218   - if (hh->hh_len)
1219   - goto end;
  1206 + if (!hh->hh_len)
  1207 + dev->header_ops->cache(n, hh, prot);
1220 1208  
1221   - if (dev->header_ops->cache(n, hh, prot))
1222   - goto end;
1223   -
1224   - if (n->nud_state & NUD_CONNECTED)
1225   - hh->hh_output = dev_queue_xmit;
1226   - else
1227   - hh->hh_output = n->ops->output;
1228   -
1229   -end:
1230 1209 write_unlock_bh(&n->lock);
1231 1210 }
1232 1211  
... ... @@ -427,9 +427,9 @@
427 427 dst_metric(&r->dst, RTAX_RTTVAR)),
428 428 r->rt_key_tos,
429 429 -1,
430   - (r->dst.neighbour ?
431   - (r->dst.neighbour->hh.hh_output ==
432   - dev_queue_xmit) : 0),
  430 + (r->dst.neighbour &&
  431 + (r->dst.neighbour->nud_state & NUD_CONNECTED)) ?
  432 + 1 : 0,
433 433 r->rt_spec_dst, &len);
434 434  
435 435 seq_printf(seq, "%*s\n", 127 - len, "");