[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <39238ffc-45d8-4f10-a9be-0e4e572f9c7c@kernel.org>
Date: Sun, 7 Jan 2024 18:24:24 -0700
From: David Ahern <dsahern@...nel.org>
To: Zhengchao Shao <shaozhengchao@...wei.com>, netdev@...r.kernel.org,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com
Cc: weiyongjun1@...wei.com, yuehaibing@...wei.com
Subject: Re: [PATCH net-next] fib: rules: use memcmp to simplify code in
rule_exists
On 1/7/24 6:11 PM, Zhengchao Shao wrote:
> In the fib_rule structure, the member variables 'pref' to 'oifname' are
> consecutive. In addition, the newly generated rule uses kzalloc to
> allocate memory, and all allocated memory is initialized to 0. Therefore,
> the comparison of two fib_rule structures from 'pref' to 'oifname' can be
> simplified into the comparison of continuous memory.
>
> Signed-off-by: Zhengchao Shao <shaozhengchao@...wei.com>
> ---
> net/core/fib_rules.c | 18 +++++-------------
> 1 file changed, 5 insertions(+), 13 deletions(-)
>
This is control path, and I think the readability of the existing code
is better.
Powered by blists - more mailing lists