From: Paolo Abeni <pabeni@redhat.com>
To: WangYuli <wangyuli@uniontech.com>
Cc: andrew+netdev@lunn.ch, chenlinxuan@uniontech.com,
czj2441@163.com, davem@davemloft.net, edumazet@google.com,
guanwentao@uniontech.com, idosch@nvidia.com, kuba@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
niecheng1@uniontech.com, petrm@nvidia.com, zhanjun@uniontech.com
Subject: Re: [PATCH net 1/2] mlxsw: spectrum_acl_bloom_filter: Expand chunk_key_offsets[chunk_index]
Date: Thu, 13 Mar 2025 14:54:30 +0100 [thread overview]
Message-ID: <ff90d3b5-d9c2-4439-ae0a-71edc9865ad2@redhat.com> (raw)
In-Reply-To: <78951564F9FEA017+20250311141701.1626533-1-wangyuli@uniontech.com>
On 3/11/25 3:17 PM, WangYuli wrote:
> .../mlxsw/spectrum_acl_bloom_filter.c | 39 ++++++++++++-------
> 1 file changed, 25 insertions(+), 14 deletions(-)
>
> 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..96105bab680b 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
> @@ -203,17 +203,6 @@ static const u8 mlxsw_sp4_acl_bf_crc6_tab[256] = {
> 0x2f, 0x02, 0x18, 0x35, 0x2c, 0x01, 0x1b, 0x36,
> };
>
> -/* Each chunk contains 4 key blocks. Chunk 2 uses key blocks 11-8,
> - * and we need to populate it with 4 key blocks copied from the entry encoded
> - * key. The original keys layout is same for Spectrum-{2,3,4}.
> - * Since the encoded key contains a 2 bytes padding, key block 11 starts at
> - * offset 2. block 7 that is used in chunk 1 starts at offset 20 as 4 key blocks
> - * take 18 bytes. See 'MLXSW_SP2_AFK_BLOCK_LAYOUT' for more details.
> - * 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 u16 mlxsw_sp2_acl_bf_crc16_byte(u16 crc, u8 c)
> {
> return (crc << 8) ^ mlxsw_sp2_acl_bf_crc16_tab[(crc >> 8) ^ c];
> @@ -237,6 +226,7 @@ __mlxsw_sp_acl_bf_key_encode(struct mlxsw_sp_acl_atcam_region *aregion,
> struct mlxsw_afk_key_info *key_info = aregion->region->key_info;
> u8 chunk_index, chunk_count, block_count;
> char *chunk = output;
> + char *enc_key_src_ptr;
Please respect the reverse christmas tree order (same in the next patch)
> __be16 erp_region_id;
>
> block_count = mlxsw_afk_key_info_blocks_count_get(key_info);
> @@ -248,9 +238,30 @@ __mlxsw_sp_acl_bf_key_encode(struct mlxsw_sp_acl_atcam_region *aregion,
> 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);
Please try instead explicitly cap-ing the loop to the expected
boundaries (0-3)
Thanks,
Paolo
next prev parent reply other threads:[~2025-03-13 13:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-11 14:10 [PATCH net 0/2] mlxsw: spectrum_acl_bloom_filter: Fix compilation warning on s390x WangYuli
2025-03-11 14:17 ` [PATCH net 1/2] mlxsw: spectrum_acl_bloom_filter: Expand chunk_key_offsets[chunk_index] WangYuli
2025-03-12 13:20 ` Ido Schimmel
2025-03-13 8:52 ` WangYuli
2025-03-13 13:52 ` Paolo Abeni
2025-03-13 15:25 ` Ido Schimmel
2025-03-13 16:10 ` WangYuli
2025-03-13 19:41 ` Ido Schimmel
2025-03-14 18:10 ` WangYuli
2025-03-13 13:54 ` Paolo Abeni [this message]
2025-03-11 14:17 ` [PATCH net 2/2] mlxsw: spectrum_acl_bloom_filter: Type block_count to u32 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=ff90d3b5-d9c2-4439-ae0a-71edc9865ad2@redhat.com \
--to=pabeni@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=chenlinxuan@uniontech.com \
--cc=czj2441@163.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=guanwentao@uniontech.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=niecheng1@uniontech.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
all inboxes | Powered by JetHome®