Skip to content

Commit

Permalink
cxgb4/l2t: Simplify 't4_l2e_free()' and '_t4_l2e_free()'
Browse files Browse the repository at this point in the history
Use '__skb_queue_purge()' instead of re-implementing it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Christophe JAILLET authored and David S. Miller committed Oct 31, 2019
1 parent d86784f commit d74361d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/net/ethernet/chelsio/cxgb4/l2t.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,13 @@ static struct l2t_entry *find_or_alloc_l2e(struct l2t_data *d, u16 vlan,
static void _t4_l2e_free(struct l2t_entry *e)
{
struct l2t_data *d;
struct sk_buff *skb;

if (atomic_read(&e->refcnt) == 0) { /* hasn't been recycled */
if (e->neigh) {
neigh_release(e->neigh);
e->neigh = NULL;
}
while ((skb = __skb_dequeue(&e->arpq)) != NULL)
kfree_skb(skb);
__skb_queue_purge(&e->arpq);
}

d = container_of(e, struct l2t_data, l2tab[e->idx]);
Expand All @@ -370,16 +368,14 @@ static void _t4_l2e_free(struct l2t_entry *e)
static void t4_l2e_free(struct l2t_entry *e)
{
struct l2t_data *d;
struct sk_buff *skb;

spin_lock_bh(&e->lock);
if (atomic_read(&e->refcnt) == 0) { /* hasn't been recycled */
if (e->neigh) {
neigh_release(e->neigh);
e->neigh = NULL;
}
while ((skb = __skb_dequeue(&e->arpq)) != NULL)
kfree_skb(skb);
__skb_queue_purge(&e->arpq);
}
spin_unlock_bh(&e->lock);

Expand Down

0 comments on commit d74361d

Please sign in to comment.