[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <056F72F0353D1A56+962a801c-5f9f-4aec-b0f9-ae917f0c55af@uniontech.com>
Date: Thu, 13 Mar 2025 16:52:46 +0800
From: WangYuli <wangyuli@...ontech.com>
To: Ido Schimmel <idosch@...dia.com>
Cc: andrew+netdev@...n.ch, chenlinxuan@...ontech.com, czj2441@....com,
davem@...emloft.net, edumazet@...gle.com, guanwentao@...ontech.com,
kuba@...nel.org, linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
niecheng1@...ontech.com, pabeni@...hat.com, petrm@...dia.com,
zhanjun@...ontech.com
Subject: Re: [PATCH net 1/2] mlxsw: spectrum_acl_bloom_filter: Expand
chunk_key_offsets[chunk_index]
Hi Ido Schimme,
On 2025/3/12 21:20, Ido Schimmel wrote:
> I'm not sure why the fix suppresses the warning when the warning is
> about the destination buffer and the fix is about the source. Can you
> check if the below helps? It removes the parameterization from
> __mlxsw_sp_acl_bf_key_encode() and instead splits it to two variants.
>
> 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..3e1e4be72da2 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
> @@ -110,7 +110,6 @@ static const u16 mlxsw_sp2_acl_bf_crc16_tab[256] = {
> * +-----------+----------+-----------------------------------+
> */
>
> -#define MLXSW_SP4_BLOOM_CHUNK_PAD_BYTES 0
> #define MLXSW_SP4_BLOOM_CHUNK_KEY_BYTES 18
> #define MLXSW_SP4_BLOOM_KEY_CHUNK_BYTES 20
>
> @@ -229,10 +228,9 @@ static u16 mlxsw_sp2_acl_bf_crc(const u8 *buffer, size_t len)
> }
>
> static void
> -__mlxsw_sp_acl_bf_key_encode(struct mlxsw_sp_acl_atcam_region *aregion,
> - struct mlxsw_sp_acl_atcam_entry *aentry,
> - char *output, u8 *len, u8 max_chunks, u8 pad_bytes,
> - u8 key_offset, u8 chunk_key_len, u8 chunk_len)
> +mlxsw_sp2_acl_bf_key_encode(struct mlxsw_sp_acl_atcam_region *aregion,
> + struct mlxsw_sp_acl_atcam_entry *aentry,
> + char *output, u8 *len)
> {
> struct mlxsw_afk_key_info *key_info = aregion->region->key_info;
> u8 chunk_index, chunk_count, block_count;
> @@ -243,30 +241,17 @@ __mlxsw_sp_acl_bf_key_encode(struct mlxsw_sp_acl_atcam_region *aregion,
> chunk_count = 1 + ((block_count - 1) >> 2);
> erp_region_id = cpu_to_be16(aentry->ht_key.erp_id |
> (aregion->region->id << 4));
> - for (chunk_index = max_chunks - chunk_count; chunk_index < max_chunks;
> - chunk_index++) {
> - memset(chunk, 0, pad_bytes);
> - memcpy(chunk + pad_bytes, &erp_region_id,
> + for (chunk_index = MLXSW_BLOOM_KEY_CHUNKS - chunk_count;
> + chunk_index < MLXSW_BLOOM_KEY_CHUNKS; chunk_index++) {
> + memset(chunk, 0, MLXSW_SP2_BLOOM_CHUNK_PAD_BYTES);
> + memcpy(chunk + MLXSW_SP2_BLOOM_CHUNK_PAD_BYTES, &erp_region_id,
> sizeof(erp_region_id));
> - memcpy(chunk + key_offset,
> + memcpy(chunk + MLXSW_SP2_BLOOM_CHUNK_KEY_OFFSET,
> &aentry->ht_key.enc_key[chunk_key_offsets[chunk_index]],
> - chunk_key_len);
> - chunk += chunk_len;
> + MLXSW_SP2_BLOOM_CHUNK_KEY_BYTES);
> + chunk += MLXSW_SP2_BLOOM_KEY_CHUNK_BYTES;
> }
> - *len = chunk_count * chunk_len;
> -}
> -
> -static void
> -mlxsw_sp2_acl_bf_key_encode(struct mlxsw_sp_acl_atcam_region *aregion,
> - struct mlxsw_sp_acl_atcam_entry *aentry,
> - char *output, u8 *len)
> -{
> - __mlxsw_sp_acl_bf_key_encode(aregion, aentry, output, len,
> - MLXSW_BLOOM_KEY_CHUNKS,
> - MLXSW_SP2_BLOOM_CHUNK_PAD_BYTES,
> - MLXSW_SP2_BLOOM_CHUNK_KEY_OFFSET,
> - MLXSW_SP2_BLOOM_CHUNK_KEY_BYTES,
> - MLXSW_SP2_BLOOM_KEY_CHUNK_BYTES);
> + *len = chunk_count * MLXSW_SP2_BLOOM_KEY_CHUNK_BYTES;
> }
>
> static unsigned int
> @@ -375,15 +360,24 @@ mlxsw_sp4_acl_bf_key_encode(struct mlxsw_sp_acl_atcam_region *aregion,
> char *output, u8 *len)
> {
> struct mlxsw_afk_key_info *key_info = aregion->region->key_info;
> - u8 block_count = mlxsw_afk_key_info_blocks_count_get(key_info);
> - u8 chunk_count = 1 + ((block_count - 1) >> 2);
> -
> - __mlxsw_sp_acl_bf_key_encode(aregion, aentry, output, len,
> - MLXSW_BLOOM_KEY_CHUNKS,
> - MLXSW_SP4_BLOOM_CHUNK_PAD_BYTES,
> - MLXSW_SP4_BLOOM_CHUNK_KEY_OFFSET,
> - MLXSW_SP4_BLOOM_CHUNK_KEY_BYTES,
> - MLXSW_SP4_BLOOM_KEY_CHUNK_BYTES);
> + u8 chunk_index, chunk_count, block_count;
> + char *chunk = output;
> + __be16 erp_region_id;
> +
> + block_count = mlxsw_afk_key_info_blocks_count_get(key_info);
> + chunk_count = 1 + ((block_count - 1) >> 2);
> + erp_region_id = cpu_to_be16(aentry->ht_key.erp_id |
> + (aregion->region->id << 4));
> + for (chunk_index = MLXSW_BLOOM_KEY_CHUNKS - chunk_count;
> + chunk_index < MLXSW_BLOOM_KEY_CHUNKS; chunk_index++) {
> + memcpy(chunk, &erp_region_id, sizeof(erp_region_id));
> + memcpy(chunk + MLXSW_SP4_BLOOM_CHUNK_KEY_OFFSET,
> + &aentry->ht_key.enc_key[chunk_key_offsets[chunk_index]],
> + MLXSW_SP4_BLOOM_CHUNK_KEY_BYTES);
> + chunk += MLXSW_SP4_BLOOM_KEY_CHUNK_BYTES;
> + }
> + *len = chunk_count * MLXSW_SP4_BLOOM_KEY_CHUNK_BYTES;
> +
> mlxsw_sp4_bf_key_shift_chunks(chunk_count, output);
> }
>
Sadly, it would appear your modifications haven't taken effect.
The same error output is still present.
I can also detail how to reproduce the error. You can verify this via
LLVM cross-compilation using the [1] config on any computer.
[1].
https://github.com/deepin-community/kernel/blob/linux-6.6.y/arch/s390/configs/deepin_s390x_z13_defconfig
The command I've been employing is:
make ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- CC="ccache clang"
-j$(nproc)
Thanks,
--
WangYuli
Download attachment "OpenPGP_0xC5DA1F3046F40BEE.asc" of type "application/pgp-keys" (633 bytes)
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (237 bytes)
Powered by blists - more mailing lists