Skip to content

Commit ee908d0

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Add new BNXT_FLTR_INSERTED flag to bnxt_filter_base struct.
Change the unused flag to BNXT_FLTR_INSERTED. To prepare for multiple pathways that an ntuple filter can be deleted, we add this flag. These filter structures can be retreived from the RCU hash table but only the caller that sees that the BNXT_FLTR_INSERTED flag is set can delete the filter structure and clear the flag under spinlock. Reviewed-by: Vasundhara Volam <[email protected]> Reviewed-by: Andy Gospodarek <[email protected]> Reviewed-by: Pavan Chebbi <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cb5bdd2 commit ee908d0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5343,6 +5343,10 @@ void bnxt_del_l2_filter(struct bnxt *bp, struct bnxt_l2_filter *fltr)
53435343
if (!atomic_dec_and_test(&fltr->refcnt))
53445344
return;
53455345
spin_lock_bh(&bp->ntp_fltr_lock);
5346+
if (!test_and_clear_bit(BNXT_FLTR_INSERTED, &fltr->base.state)) {
5347+
spin_unlock_bh(&bp->ntp_fltr_lock);
5348+
return;
5349+
}
53465350
hlist_del_rcu(&fltr->base.hash);
53475351
if (fltr->base.flags) {
53485352
clear_bit(fltr->base.sw_id, bp->ntp_fltr_bmap);
@@ -5489,6 +5493,7 @@ static int bnxt_init_l2_filter(struct bnxt *bp, struct bnxt_l2_filter *fltr,
54895493
}
54905494
head = &bp->l2_fltr_hash_tbl[idx];
54915495
hlist_add_head_rcu(&fltr->base.hash, head);
5496+
set_bit(BNXT_FLTR_INSERTED, &fltr->base.state);
54925497
atomic_set(&fltr->refcnt, 1);
54935498
return 0;
54945499
}
@@ -14000,6 +14005,7 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
1400014005
new_fltr->base.type = BNXT_FLTR_TYPE_NTUPLE;
1400114006
new_fltr->base.flags = BNXT_ACT_RING_DST;
1400214007
hlist_add_head_rcu(&new_fltr->base.hash, head);
14008+
set_bit(BNXT_FLTR_INSERTED, &new_fltr->base.state);
1400314009
bp->ntp_fltr_count++;
1400414010
spin_unlock_bh(&bp->ntp_fltr_lock);
1400514011

@@ -14046,6 +14052,10 @@ static void bnxt_cfg_ntp_filters(struct bnxt *bp)
1404614052

1404714053
if (del) {
1404814054
spin_lock_bh(&bp->ntp_fltr_lock);
14055+
if (!test_and_clear_bit(BNXT_FLTR_INSERTED, &fltr->base.state)) {
14056+
spin_unlock_bh(&bp->ntp_fltr_lock);
14057+
continue;
14058+
}
1404914059
hlist_del_rcu(&fltr->base.hash);
1405014060
bp->ntp_fltr_count--;
1405114061
spin_unlock_bh(&bp->ntp_fltr_lock);

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ struct bnxt_filter_base {
13481348
u16 vf_idx;
13491349
unsigned long state;
13501350
#define BNXT_FLTR_VALID 0
1351-
#define BNXT_FLTR_UPDATE 1
1351+
#define BNXT_FLTR_INSERTED 1
13521352

13531353
struct rcu_head rcu;
13541354
};

0 commit comments

Comments
 (0)