|
@@ -124,7 +124,7 @@ static bool neigh_del(struct neighbour *n, __u8 state,
|
|
|
bool retval = false;
|
|
|
|
|
|
write_lock(&n->lock);
|
|
|
- if (atomic_read(&n->refcnt) == 1 && !(n->nud_state & state)) {
|
|
|
+ if (refcount_read(&n->refcnt) == 1 && !(n->nud_state & state)) {
|
|
|
struct neighbour *neigh;
|
|
|
|
|
|
neigh = rcu_dereference_protected(n->next,
|
|
@@ -254,7 +254,7 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev)
|
|
|
neigh_del_timer(n);
|
|
|
n->dead = 1;
|
|
|
|
|
|
- if (atomic_read(&n->refcnt) != 1) {
|
|
|
+ if (refcount_read(&n->refcnt) != 1) {
|
|
|
/* The most unpleasant situation.
|
|
|
We must destroy neighbour entry,
|
|
|
but someone still uses it.
|
|
@@ -335,7 +335,7 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl, struct net_device
|
|
|
|
|
|
NEIGH_CACHE_STAT_INC(tbl, allocs);
|
|
|
n->tbl = tbl;
|
|
|
- atomic_set(&n->refcnt, 1);
|
|
|
+ refcount_set(&n->refcnt, 1);
|
|
|
n->dead = 1;
|
|
|
out:
|
|
|
return n;
|
|
@@ -444,7 +444,7 @@ struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey,
|
|
|
rcu_read_lock_bh();
|
|
|
n = __neigh_lookup_noref(tbl, pkey, dev);
|
|
|
if (n) {
|
|
|
- if (!atomic_inc_not_zero(&n->refcnt))
|
|
|
+ if (!refcount_inc_not_zero(&n->refcnt))
|
|
|
n = NULL;
|
|
|
NEIGH_CACHE_STAT_INC(tbl, hits);
|
|
|
}
|
|
@@ -473,7 +473,7 @@ struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net,
|
|
|
n = rcu_dereference_bh(n->next)) {
|
|
|
if (!memcmp(n->primary_key, pkey, key_len) &&
|
|
|
net_eq(dev_net(n->dev), net)) {
|
|
|
- if (!atomic_inc_not_zero(&n->refcnt))
|
|
|
+ if (!refcount_inc_not_zero(&n->refcnt))
|
|
|
n = NULL;
|
|
|
NEIGH_CACHE_STAT_INC(tbl, hits);
|
|
|
break;
|
|
@@ -821,7 +821,7 @@ static void neigh_periodic_work(struct work_struct *work)
|
|
|
if (time_before(n->used, n->confirmed))
|
|
|
n->used = n->confirmed;
|
|
|
|
|
|
- if (atomic_read(&n->refcnt) == 1 &&
|
|
|
+ if (refcount_read(&n->refcnt) == 1 &&
|
|
|
(state == NUD_FAILED ||
|
|
|
time_after(jiffies, n->used + NEIGH_VAR(n->parms, GC_STALETIME)))) {
|
|
|
*np = n->next;
|
|
@@ -2234,7 +2234,7 @@ static int neigh_fill_info(struct sk_buff *skb, struct neighbour *neigh,
|
|
|
ci.ndm_used = jiffies_to_clock_t(now - neigh->used);
|
|
|
ci.ndm_confirmed = jiffies_to_clock_t(now - neigh->confirmed);
|
|
|
ci.ndm_updated = jiffies_to_clock_t(now - neigh->updated);
|
|
|
- ci.ndm_refcnt = atomic_read(&neigh->refcnt) - 1;
|
|
|
+ ci.ndm_refcnt = refcount_read(&neigh->refcnt) - 1;
|
|
|
read_unlock_bh(&neigh->lock);
|
|
|
|
|
|
if (nla_put_u32(skb, NDA_PROBES, atomic_read(&neigh->probes)) ||
|