Commit 1c835c81 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

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: default avatarJakub Kicinski <kuba@kernel.org>
parents b59db45d d8214d0f
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -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();
+11 −10
Original line number Diff line number Diff line
@@ -1345,27 +1345,28 @@ 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;
	if (!fltr_base) {
		rcu_read_unlock();
		return -ENOENT;
	}

	fltr = container_of(fltr_base, struct bnxt_ntuple_filter, base);
	if (!(fltr->base.flags & BNXT_ACT_NO_AGING)) {
		rcu_read_unlock();
		if (!(fltr->base.flags & BNXT_ACT_NO_AGING))
		return -EINVAL;
	}
	rcu_read_unlock();
	bnxt_hwrm_cfa_ntuple_filter_free(bp, fltr);
	bnxt_del_ntp_filter(bp, fltr);
	return 0;
}

	rcu_read_unlock();
	return -ENOENT;
}

static u64 get_ethtool_ipv4_rss(struct bnxt *bp)
{
	if (bp->rss_hash_cfg & VNIC_RSS_CFG_REQ_HASH_TYPE_IPV4)