From 3ceb893ced3d1b06e3992e3b7f395837fe20d021 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Tue, 7 Aug 2012 02:19:56 +0000 Subject: [PATCH] --- yaml --- r: 327391 b: refs/heads/master c: 425f09ab7d1c9da6ca4137dd639cb6fe3f8a88f3 h: refs/heads/master i: 327389: fb8f785e108bfc8f64557ad0ad9505f59c2a93e9 327387: fbd25ec6d7159b56071687c285d28578a1bd218f 327383: 0937c921085cf5e1ccdd32acbe54f62fb5e2d04a 327375: a59f9e2763d8f88948ee866bd0aac3861f38ee78 327359: 721234770a2c4da7be6b58e771bb8722b94dc303 v: v3 --- [refs] | 2 +- trunk/include/net/dst.h | 10 +++++++--- trunk/include/net/neighbour.h | 14 +++++++++----- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 603d5fad37e4..2fa2cc062f69 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e07b94f1352723994d8b588ac5ed8af91bcc9fb6 +refs/heads/master: 425f09ab7d1c9da6ca4137dd639cb6fe3f8a88f3 diff --git a/trunk/include/net/dst.h b/trunk/include/net/dst.h index baf597890064..77f52f7dc823 100644 --- a/trunk/include/net/dst.h +++ b/trunk/include/net/dst.h @@ -396,11 +396,15 @@ static inline void dst_confirm(struct dst_entry *dst) static inline int dst_neigh_output(struct dst_entry *dst, struct neighbour *n, struct sk_buff *skb) { - struct hh_cache *hh; + const struct hh_cache *hh; + + if (dst->pending_confirm) { + unsigned long now = jiffies; - if (unlikely(dst->pending_confirm)) { - n->confirmed = jiffies; dst->pending_confirm = 0; + /* avoid dirtying neighbour */ + if (n->confirmed != now) + n->confirmed = now; } hh = &n->hh; diff --git a/trunk/include/net/neighbour.h b/trunk/include/net/neighbour.h index 344d8988842a..0dab173e27da 100644 --- a/trunk/include/net/neighbour.h +++ b/trunk/include/net/neighbour.h @@ -334,18 +334,22 @@ static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) } #endif -static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) +static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb) { unsigned int seq; int hh_len; do { - int hh_alen; - seq = read_seqbegin(&hh->hh_lock); hh_len = hh->hh_len; - hh_alen = HH_DATA_ALIGN(hh_len); - memcpy(skb->data - hh_alen, hh->hh_data, hh_alen); + if (likely(hh_len <= HH_DATA_MOD)) { + /* this is inlined by gcc */ + memcpy(skb->data - HH_DATA_MOD, hh->hh_data, HH_DATA_MOD); + } else { + int hh_alen = HH_DATA_ALIGN(hh_len); + + memcpy(skb->data - hh_alen, hh->hh_data, hh_alen); + } } while (read_seqretry(&hh->hh_lock, seq)); skb_push(skb, hh_len);