[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <43d3415d-9d55-244e-5e32-4ae98ee7a5ba@nvidia.com>
Date: Mon, 20 Feb 2023 19:31:50 +0800
From: Gavin Li <gavinl@...dia.com>
To: Alexander Lobakin <aleksander.lobakin@...el.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, roopa@...dia.com,
eng.alaamohamedsoliman.am@...il.com, bigeasy@...utronix.de,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Roi Dayan <roid@...dia.com>, Maor Dickman <maord@...dia.com>,
Saeed Mahameed <saeedm@...dia.com>
Subject: Re: [PATCH net-next v1 2/3] net/mlx5e: Add helper for
encap_info_equal for tunnels with options
On 2/16/2023 12:56 AM, Alexander Lobakin wrote:
> External email: Use caution opening links or attachments
>
>
> From: Gavin Li <gavinl@...dia.com>
> Date: Wed, 15 Feb 2023 10:54:12 +0800
>
>> On 2/14/2023 11:01 PM, Alexander Lobakin wrote:
>>> External email: Use caution opening links or attachments
>>>
>>>
>>> From: Gavin Li <gavinl@...dia.com>
>>> Date: Tue, 14 Feb 2023 15:41:36 +0200
> [...]
>
>>>> + if (a_has_opts != b_has_opts)
>>>> + return false;
>>>> +
>>>> + /* options stored in memory next to ip_tunnel_info struct */
>>>> + a_info = container_of(a->ip_tun_key, struct ip_tunnel_info, key);
>>>> + b_info = container_of(b->ip_tun_key, struct ip_tunnel_info, key);
>>>> +
>>>> + return a_info->options_len == b_info->options_len &&
>>>> + memcmp(a_info + 1, b_info + 1, a_info->options_len) == 0;
>>> 1. memcmp() is not aligned to the first expr (off-by-one to the right).
>> Options start from "info + 1", see ip_tunnel_info_opts and will use it
>> here to replace the "info+1".
> Nah, I mean the following. Your code:
>
> return a_info->options_len == b_info->options_len &&
> memcmp(a_info + 1, b_info + 1, ...
>
> should be:
>
> return a_info->options_len == b_info->options_len &&
> memcmp(a_info + 1, b_info + 1, ...
>
> 7 spaces instead of a tab to have it aligned to the prev line.
ACK
>
>>> 2. `!expr` is preferred over `expr == 0`.
>> ACK
>>>> +}
>>>> +
>>>> static int cmp_decap_info(struct mlx5e_decap_key *a,
>>>> struct mlx5e_decap_key *b)
>>>> {
>>> [...]
>>>
>>> Thanks,
>>> Olek
> Thanks,
> Olek
Powered by blists - more mailing lists