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>
This commit is contained in:
parent
47ec132a40
commit
b23b5455b6
4 changed files with 7 additions and 29 deletions
|
@ -254,7 +254,6 @@ struct netdev_hw_addr_list {
|
||||||
struct hh_cache {
|
struct hh_cache {
|
||||||
u16 hh_len;
|
u16 hh_len;
|
||||||
u16 __pad;
|
u16 __pad;
|
||||||
int (*hh_output)(struct sk_buff *skb);
|
|
||||||
seqlock_t hh_lock;
|
seqlock_t hh_lock;
|
||||||
|
|
||||||
/* cached hardware header; allow for machine alignment needs. */
|
/* cached hardware header; allow for machine alignment needs. */
|
||||||
|
|
|
@ -340,13 +340,13 @@ static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb)
|
||||||
} while (read_seqretry(&hh->hh_lock, seq));
|
} while (read_seqretry(&hh->hh_lock, seq));
|
||||||
|
|
||||||
skb_push(skb, hh_len);
|
skb_push(skb, hh_len);
|
||||||
return hh->hh_output(skb);
|
return dev_queue_xmit(skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int neigh_output(struct neighbour *n, struct sk_buff *skb)
|
static inline int neigh_output(struct neighbour *n, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct hh_cache *hh = &n->hh;
|
struct hh_cache *hh = &n->hh;
|
||||||
if (hh->hh_len)
|
if ((n->nud_state & NUD_CONNECTED) && hh->hh_len)
|
||||||
return neigh_hh_output(hh, skb);
|
return neigh_hh_output(hh, skb);
|
||||||
else
|
else
|
||||||
return n->output(skb);
|
return n->output(skb);
|
||||||
|
|
|
@ -720,15 +720,9 @@ EXPORT_SYMBOL(neigh_destroy);
|
||||||
*/
|
*/
|
||||||
static void neigh_suspect(struct neighbour *neigh)
|
static void neigh_suspect(struct neighbour *neigh)
|
||||||
{
|
{
|
||||||
struct hh_cache *hh;
|
|
||||||
|
|
||||||
NEIGH_PRINTK2("neigh %p is suspected.\n", neigh);
|
NEIGH_PRINTK2("neigh %p is suspected.\n", neigh);
|
||||||
|
|
||||||
neigh->output = neigh->ops->output;
|
neigh->output = neigh->ops->output;
|
||||||
|
|
||||||
hh = &neigh->hh;
|
|
||||||
if (hh->hh_len)
|
|
||||||
hh->hh_output = neigh->ops->output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Neighbour state is OK;
|
/* Neighbour state is OK;
|
||||||
|
@ -738,15 +732,9 @@ static void neigh_suspect(struct neighbour *neigh)
|
||||||
*/
|
*/
|
||||||
static void neigh_connect(struct neighbour *neigh)
|
static void neigh_connect(struct neighbour *neigh)
|
||||||
{
|
{
|
||||||
struct hh_cache *hh;
|
|
||||||
|
|
||||||
NEIGH_PRINTK2("neigh %p is connected.\n", neigh);
|
NEIGH_PRINTK2("neigh %p is connected.\n", neigh);
|
||||||
|
|
||||||
neigh->output = neigh->ops->connected_output;
|
neigh->output = neigh->ops->connected_output;
|
||||||
|
|
||||||
hh = &neigh->hh;
|
|
||||||
if (hh->hh_len)
|
|
||||||
hh->hh_output = dev_queue_xmit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void neigh_periodic_work(struct work_struct *work)
|
static void neigh_periodic_work(struct work_struct *work)
|
||||||
|
@ -1215,18 +1203,9 @@ static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst)
|
||||||
/* Only one thread can come in here and initialize the
|
/* Only one thread can come in here and initialize the
|
||||||
* hh_cache entry.
|
* hh_cache entry.
|
||||||
*/
|
*/
|
||||||
if (hh->hh_len)
|
if (!hh->hh_len)
|
||||||
goto end;
|
dev->header_ops->cache(n, hh, prot);
|
||||||
|
|
||||||
if (dev->header_ops->cache(n, hh, prot))
|
|
||||||
goto end;
|
|
||||||
|
|
||||||
if (n->nud_state & NUD_CONNECTED)
|
|
||||||
hh->hh_output = dev_queue_xmit;
|
|
||||||
else
|
|
||||||
hh->hh_output = n->ops->output;
|
|
||||||
|
|
||||||
end:
|
|
||||||
write_unlock_bh(&n->lock);
|
write_unlock_bh(&n->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -427,9 +427,9 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
|
||||||
dst_metric(&r->dst, RTAX_RTTVAR)),
|
dst_metric(&r->dst, RTAX_RTTVAR)),
|
||||||
r->rt_key_tos,
|
r->rt_key_tos,
|
||||||
-1,
|
-1,
|
||||||
(r->dst.neighbour ?
|
(r->dst.neighbour &&
|
||||||
(r->dst.neighbour->hh.hh_output ==
|
(r->dst.neighbour->nud_state & NUD_CONNECTED)) ?
|
||||||
dev_queue_xmit) : 0),
|
1 : 0,
|
||||||
r->rt_spec_dst, &len);
|
r->rt_spec_dst, &len);
|
||||||
|
|
||||||
seq_printf(seq, "%*s\n", 127 - len, "");
|
seq_printf(seq, "%*s\n", 127 - len, "");
|
||||||
|
|
Loading…
Add table
Reference in a new issue