Skip to content

Commit 1c835c8

Browse files
committed
Merge branch 'bnxt_en-ntuple-filter-fixes'
Michael Chan says: ==================== bnxt_en: ntuple filter fixes The first patch is to remove an unneeded variable. The next 2 patches are to release RCU lock correctly after accesing the RCU protected filter structure. Patch 2 also re-arranges the code to look cleaner. ==================== Link: https://lore.kernel.org/r/20240105235439.28282-1-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents b59db45 + d8214d0 commit 1c835c8

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5752,10 +5752,9 @@ static int bnxt_hwrm_set_vnic_filter(struct bnxt *bp, u16 vnic_id, u16 idx,
57525752
return rc;
57535753
}
57545754

5755-
static int bnxt_hwrm_clear_vnic_filter(struct bnxt *bp)
5755+
static void bnxt_hwrm_clear_vnic_filter(struct bnxt *bp)
57565756
{
57575757
u16 i, j, num_of_vnics = 1; /* only vnic 0 supported */
5758-
int rc = 0;
57595758

57605759
/* Any associated ntuple filters will also be cleared by firmware. */
57615760
for (i = 0; i < num_of_vnics; i++) {
@@ -5769,8 +5768,6 @@ static int bnxt_hwrm_clear_vnic_filter(struct bnxt *bp)
57695768
}
57705769
vnic->uc_filter_count = 0;
57715770
}
5772-
5773-
return rc;
57745771
}
57755772

57765773
#define BNXT_DFLT_TUNL_TPA_BMAP \
@@ -14023,8 +14020,8 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
1402314020
rcu_read_lock();
1402414021
fltr = bnxt_lookup_ntp_filter_from_idx(bp, new_fltr, idx);
1402514022
if (fltr) {
14026-
rcu_read_unlock();
1402714023
rc = fltr->base.sw_id;
14024+
rcu_read_unlock();
1402814025
goto err_free;
1402914026
}
1403014027
rcu_read_unlock();

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,25 +1345,26 @@ static int bnxt_srxclsrldel(struct bnxt *bp, struct ethtool_rxnfc *cmd)
13451345
{
13461346
struct ethtool_rx_flow_spec *fs = &cmd->fs;
13471347
struct bnxt_filter_base *fltr_base;
1348+
struct bnxt_ntuple_filter *fltr;
13481349

13491350
rcu_read_lock();
13501351
fltr_base = bnxt_get_one_fltr_rcu(bp, bp->ntp_fltr_hash_tbl,
13511352
BNXT_NTP_FLTR_HASH_SIZE,
13521353
fs->location);
1353-
if (fltr_base) {
1354-
struct bnxt_ntuple_filter *fltr;
1355-
1356-
fltr = container_of(fltr_base, struct bnxt_ntuple_filter, base);
1354+
if (!fltr_base) {
13571355
rcu_read_unlock();
1358-
if (!(fltr->base.flags & BNXT_ACT_NO_AGING))
1359-
return -EINVAL;
1360-
bnxt_hwrm_cfa_ntuple_filter_free(bp, fltr);
1361-
bnxt_del_ntp_filter(bp, fltr);
1362-
return 0;
1356+
return -ENOENT;
13631357
}
13641358

1359+
fltr = container_of(fltr_base, struct bnxt_ntuple_filter, base);
1360+
if (!(fltr->base.flags & BNXT_ACT_NO_AGING)) {
1361+
rcu_read_unlock();
1362+
return -EINVAL;
1363+
}
13651364
rcu_read_unlock();
1366-
return -ENOENT;
1365+
bnxt_hwrm_cfa_ntuple_filter_free(bp, fltr);
1366+
bnxt_del_ntp_filter(bp, fltr);
1367+
return 0;
13671368
}
13681369

13691370
static u64 get_ethtool_ipv4_rss(struct bnxt *bp)

0 commit comments

Comments
 (0)