[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220315114127.7c9bb48d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Tue, 15 Mar 2022 11:41:27 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Meng Tang <tangmeng@...ontech.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: tulip: de4x5: Optimize if branch in
de4x5_parse_params
On Tue, 15 Mar 2022 15:49:52 +0800 Meng Tang wrote:
> In the de4x5_parse_params, 'if (strstr(p, "BNC_AUI"))' condition and
> 'if (strstr(p, "BNC_AUI"))' condition are both execute the statement
> 'lp->params.autosense = BNC', these two conditions can be combined.
>
> In addition, in the current code logic, when p = "BNC", the judgments
> need to be executed four times. In order to simplify the execution
> process and keep the original code design, I used the statement which
> is 'if (strstr(p, "BNC") || strstr(p, "BNC_AUI"))' to deal with it,
> after that once 'strstr(p, "BNC")' is established, we no longer need
> to judge whether 'strstr(p, "BNC_AUI")' is true(not NULL).
>
> In this way, we can execute the judgment statement one time less.
>
> Signed-off-by: Meng Tang <tangmeng@...ontech.com>
This is ancient code, let's leave it be.
Powered by blists - more mailing lists