lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231225165653.GH5962@kernel.org>
Date: Mon, 25 Dec 2023 16:56:53 +0000
From: Simon Horman <horms@...nel.org>
To: Michael Chan <michael.chan@...adcom.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, pavan.chebbi@...adcom.com,
	andrew.gospodarek@...adcom.com
Subject: Re: [PATCH net-next v2 06/13] bnxt_en: Add
 bnxt_lookup_ntp_filter_from_idx() function

On Fri, Dec 22, 2023 at 08:22:03PM -0800, Michael Chan wrote:
> Add the helper function to look up the ntuple filter from the
> hash index and use it in bnxt_rx_flow_steer().  The helper function
> will also be used by user defined ntuple filters in the next
> patches.
> 
> Reviewed-by: Andy Gospodarek <andrew.gospodarek@...adcom.com>
> Reviewed-by: Pavan Chebbi <pavan.chebbi@...adcom.com>
> Signed-off-by: Michael Chan <michael.chan@...adcom.com>
> ---
>  drivers/net/ethernet/broadcom/bnxt/bnxt.c | 26 +++++++++++++++++------
>  1 file changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index e9b382832a14..7027391316e5 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -13899,6 +13899,21 @@ static bool bnxt_fltr_match(struct bnxt_ntuple_filter *f1,
>  	return false;
>  }
>  
> +static struct bnxt_ntuple_filter *
> +bnxt_lookup_ntp_filter_from_idx(struct bnxt *bp,
> +				struct bnxt_ntuple_filter *fltr, u32 idx)
> +{
> +	struct bnxt_ntuple_filter *f;
> +	struct hlist_head *head;
> +
> +	head = &bp->ntp_fltr_hash_tbl[idx];
> +	hlist_for_each_entry_rcu(f, head, base.hash) {
> +		if (bnxt_fltr_match(f, fltr))
> +			return f;
> +	}
> +	return NULL;
> +}
> +
>  static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
>  			      u16 rxq_index, u32 flow_id)
>  {
> @@ -13963,12 +13978,11 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
>  	idx = bnxt_get_ntp_filter_idx(bp, fkeys, skb);
>  	head = &bp->ntp_fltr_hash_tbl[idx];
>  	rcu_read_lock();
> -	hlist_for_each_entry_rcu(fltr, head, base.hash) {
> -		if (bnxt_fltr_match(fltr, new_fltr)) {
> -			rc = fltr->base.sw_id;
> -			rcu_read_unlock();
> -			goto err_free;
> -		}
> +	fltr = bnxt_lookup_ntp_filter_from_idx(bp, new_fltr, idx);
> +	if (fltr) {
> +		rcu_read_unlock();
> +		rc = fltr->base.sw_id;

Hi Michael,

prior to this patch rc was set inside the RCU read-side critical section,
now it is outside. Is that intentional?

> +		goto err_free;
>  	}
>  	rcu_read_unlock();
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ