Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: WangYuli <wangyuli@uniontech.com>
Cc: petrm@nvidia.com, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	czj2441@163.com, zhanjun@uniontech.com, niecheng1@uniontech.com,
	guanwentao@uniontech.com
Subject: Re: [PATCH net v2] mlxsw: spectrum_acl_bloom_filter: Workaround for some LLVM versions
Date: Tue, 18 Mar 2025 11:09:49 +0200	[thread overview]
Message-ID: <Z9k4XQUDEKPHHI5k@shredder> (raw)
In-Reply-To: <CBD5806B120ADEEE+20250318054803.462085-1-wangyuli@uniontech.com>

On Tue, Mar 18, 2025 at 01:48:03PM +0800, WangYuli wrote:
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
> index a54eedb69a3f..fc8a8cf64ec8 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
> @@ -212,7 +212,22 @@ static const u8 mlxsw_sp4_acl_bf_crc6_tab[256] = {
>   * This array defines key offsets for easy access when copying key blocks from
>   * entry key to Bloom filter chunk.
>   */
> -static const u8 chunk_key_offsets[MLXSW_BLOOM_KEY_CHUNKS] = {2, 20, 38};
> +static char *
> +mlxsw_sp_acl_bf_enc_key_get(struct mlxsw_sp_acl_atcam_entry *aentry,
> +			    u8 chunk_index)
> +{
> +		switch (chunk_index) {

There's an extra indentation level here. It's not present in the patch I
shared.

[1] https://lore.kernel.org/all/Z9M1A8lOuXE4UkyR@shredder/

> +		case 0:
> +			return &aentry->ht_key.enc_key[2];
> +		case 1:
> +			return &aentry->ht_key.enc_key[20];
> +		case 2:
> +			return &aentry->ht_key.enc_key[38];
> +		default:
> +			WARN_ON_ONCE(1);
> +			return &aentry->ht_key.enc_key[0];
> +		}
> +}
>  
>  static u16 mlxsw_sp2_acl_bf_crc16_byte(u16 crc, u8 c)
>  {
> @@ -235,9 +250,10 @@ __mlxsw_sp_acl_bf_key_encode(struct mlxsw_sp_acl_atcam_region *aregion,
>  			     u8 key_offset, u8 chunk_key_len, u8 chunk_len)
>  {
>  	struct mlxsw_afk_key_info *key_info = aregion->region->key_info;
> -	u8 chunk_index, chunk_count, block_count;
> +	u8 chunk_index, chunk_count;
>  	char *chunk = output;
>  	__be16 erp_region_id;
> +	u32 block_count;
>  
>  	block_count = mlxsw_afk_key_info_blocks_count_get(key_info);
>  	chunk_count = 1 + ((block_count - 1) >> 2);
> @@ -245,12 +261,12 @@ __mlxsw_sp_acl_bf_key_encode(struct mlxsw_sp_acl_atcam_region *aregion,
>  				   (aregion->region->id << 4));
>  	for (chunk_index = max_chunks - chunk_count; chunk_index < max_chunks;
>  	     chunk_index++) {
> +		char *enc_key;

Missing blank line here between variable declaration and code (see [1]).

>  		memset(chunk, 0, pad_bytes);
>  		memcpy(chunk + pad_bytes, &erp_region_id,
>  		       sizeof(erp_region_id));
> -		memcpy(chunk + key_offset,
> -		       &aentry->ht_key.enc_key[chunk_key_offsets[chunk_index]],
> -		       chunk_key_len);
> +		enc_key = mlxsw_sp_acl_bf_enc_key_get(aentry, chunk_index);
> +		memcpy(chunk + key_offset, enc_key, chunk_key_len);
>  		chunk += chunk_len;
>  	}
>  	*len = chunk_count * chunk_len;
> -- 
> 2.49.0
> 

  reply	other threads:[~2025-03-18  9:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18  5:48 [PATCH net v2] mlxsw: spectrum_acl_bloom_filter: Workaround for some LLVM versions WangYuli
2025-03-18  9:09 ` Ido Schimmel [this message]
2025-03-18 10:27   ` WangYuli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z9k4XQUDEKPHHI5k@shredder \
    --to=idosch@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=czj2441@163.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=guanwentao@uniontech.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=niecheng1@uniontech.com \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=wangyuli@uniontech.com \
    --cc=zhanjun@uniontech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox