]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/net/neighbour.h
net: Fix duplicate volatile warning.
[net-next-2.6.git] / include / net / neighbour.h
index a4538d5537047d1bf92e461a6ad89c8f4c90305e..6beb1ffc2b7fcfe9d360717ccde3f70bd8ac0e3d 100644 (file)
@@ -94,8 +94,6 @@ struct neighbour {
        struct neighbour __rcu  *next;
        struct neigh_table      *tbl;
        struct neigh_parms      *parms;
-       struct net_device       *dev;
-       unsigned long           used;
        unsigned long           confirmed;
        unsigned long           updated;
        __u8                    flags;
@@ -103,15 +101,18 @@ struct neighbour {
        __u8                    type;
        __u8                    dead;
        atomic_t                refcnt;
+       struct sk_buff_head     arp_queue;
+       struct timer_list       timer;
+       unsigned long           used;
        atomic_t                probes;
        rwlock_t                lock;
+       seqlock_t               ha_lock;
        unsigned char           ha[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))];
        struct hh_cache         *hh;
        int                     (*output)(struct sk_buff *skb);
-       struct sk_buff_head     arp_queue;
-       struct timer_list       timer;
        const struct neigh_ops  *ops;
        struct rcu_head         rcu;
+       struct net_device       *dev;
        u8                      primary_key[0];
 };
 
@@ -302,7 +303,10 @@ static inline void neigh_confirm(struct neighbour *neigh)
 
 static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
 {
-       neigh->used = jiffies;
+       unsigned long now = jiffies;
+       
+       if (neigh->used != now)
+               neigh->used = now;
        if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE)))
                return __neigh_event_send(neigh, skb);
        return 0;
@@ -373,4 +377,14 @@ struct neighbour_cb {
 
 #define NEIGH_CB(skb)  ((struct neighbour_cb *)(skb)->cb)
 
+static inline void neigh_ha_snapshot(char *dst, const struct neighbour *n,
+                                    const struct net_device *dev)
+{
+       unsigned int seq;
+
+       do {
+               seq = read_seqbegin(&n->ha_lock);
+               memcpy(dst, n->ha, dev->addr_len);
+       } while (read_seqretry(&n->ha_lock, seq));
+}
 #endif