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>
This commit is contained in:
Jakub Kicinski 2024-01-08 19:15:04 -08:00
commit 1c835c81eb
2 changed files with 13 additions and 15 deletions

View File

@ -5752,10 +5752,9 @@ static int bnxt_hwrm_set_vnic_filter(struct bnxt *bp, u16 vnic_id, u16 idx,
return rc;
}
static int bnxt_hwrm_clear_vnic_filter(struct bnxt *bp)
static void bnxt_hwrm_clear_vnic_filter(struct bnxt *bp)
{
u16 i, j, num_of_vnics = 1; /* only vnic 0 supported */
int rc = 0;
/* Any associated ntuple filters will also be cleared by firmware. */
for (i = 0; i < num_of_vnics; i++) {
@ -5769,8 +5768,6 @@ static int bnxt_hwrm_clear_vnic_filter(struct bnxt *bp)
}
vnic->uc_filter_count = 0;
}
return rc;
}
#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,
rcu_read_lock();
fltr = bnxt_lookup_ntp_filter_from_idx(bp, new_fltr, idx);
if (fltr) {
rcu_read_unlock();
rc = fltr->base.sw_id;
rcu_read_unlock();
goto err_free;
}
rcu_read_unlock();

View File

@ -1345,25 +1345,26 @@ static int bnxt_srxclsrldel(struct bnxt *bp, struct ethtool_rxnfc *cmd)
{
struct ethtool_rx_flow_spec *fs = &cmd->fs;
struct bnxt_filter_base *fltr_base;
struct bnxt_ntuple_filter *fltr;
rcu_read_lock();
fltr_base = bnxt_get_one_fltr_rcu(bp, bp->ntp_fltr_hash_tbl,
BNXT_NTP_FLTR_HASH_SIZE,
fs->location);
if (fltr_base) {
struct bnxt_ntuple_filter *fltr;
fltr = container_of(fltr_base, struct bnxt_ntuple_filter, base);
if (!fltr_base) {
rcu_read_unlock();
if (!(fltr->base.flags & BNXT_ACT_NO_AGING))
return -EINVAL;
bnxt_hwrm_cfa_ntuple_filter_free(bp, fltr);
bnxt_del_ntp_filter(bp, fltr);
return 0;
return -ENOENT;
}
fltr = container_of(fltr_base, struct bnxt_ntuple_filter, base);
if (!(fltr->base.flags & BNXT_ACT_NO_AGING)) {
rcu_read_unlock();
return -EINVAL;
}
rcu_read_unlock();
return -ENOENT;
bnxt_hwrm_cfa_ntuple_filter_free(bp, fltr);
bnxt_del_ntp_filter(bp, fltr);
return 0;
}
static u64 get_ethtool_ipv4_rss(struct bnxt *bp)