public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Gavin Li <gavinl@nvidia.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <roopa@nvidia.com>,
	<eng.alaamohamedsoliman.am@gmail.com>, <bigeasy@linutronix.de>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Roi Dayan <roid@nvidia.com>, Maor Dickman <maord@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: Re: [PATCH net-next v1 2/3] net/mlx5e: Add helper for encap_info_equal for tunnels with options
Date: Wed, 15 Feb 2023 17:56:07 +0100	[thread overview]
Message-ID: <85172e19-5344-bc30-e6a4-aa39dba3b50b@intel.com> (raw)
In-Reply-To: <40a616a5-f350-2ac1-eda1-7e4c777ed487@nvidia.com>

From: Gavin Li <gavinl@nvidia.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@nvidia.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.

>> 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

  reply	other threads:[~2023-02-15 16:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14 13:41 [PATCH net-next v1 0/3] net/mlx5e: Add GBP VxLAN HW offload support Gavin Li
2023-02-14 13:41 ` [PATCH net-next v1 1/3] vxlan: Expose helper vxlan_build_gbp_hdr Gavin Li
2023-02-14 14:56   ` Alexander Lobakin
2023-02-15  8:26     ` Gavin Li
2023-02-14 13:41 ` [PATCH net-next v1 2/3] net/mlx5e: Add helper for encap_info_equal for tunnels with options Gavin Li
2023-02-14 15:01   ` Alexander Lobakin
2023-02-15  2:54     ` Gavin Li
2023-02-15 16:56       ` Alexander Lobakin [this message]
2023-02-20 11:31         ` Gavin Li
2023-02-14 13:41 ` [PATCH net-next v1 3/3] net/mlx5e: TC, Add support for VxLAN GBP encap/decap flows offload Gavin Li
2023-02-14 15:26   ` Alexander Lobakin
2023-02-15  2:50     ` Gavin Li
2023-02-15 16:53       ` Alexander Lobakin
2023-02-15  3:36     ` Gavin Li
2023-02-15  8:30       ` Gavin Li
2023-02-15 17:01         ` Alexander Lobakin
2023-02-16  8:40           ` Gavin Li
2023-02-16 15:19             ` Alexander Lobakin
2023-02-17  2:43               ` Gavin Li
2023-02-15 16:57       ` Alexander Lobakin

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=85172e19-5344-bc30-e6a4-aa39dba3b50b@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eng.alaamohamedsoliman.am@gmail.com \
    --cc=gavinl@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maord@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=roid@nvidia.com \
    --cc=roopa@nvidia.com \
    --cc=saeedm@nvidia.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