lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 27 Jul 2022 18:09:12 +0000
From:   "Kuruvinakunnel, George" <george.kuruvinakunnel@...el.com>
To:     "Fijalkowski, Maciej" <maciej.fijalkowski@...el.com>,
        "intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "john.fastabend@...il.com" <john.fastabend@...il.com>,
        "Gerasymenko, Anatolii" <anatolii.gerasymenko@...el.com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "Karlsson, Magnus" <magnus.karlsson@...el.com>
Subject: RE: [Intel-wired-lan] [PATCH intel-next 1/2] ice: compress branches
 in ice_set_features()

> From: Intel-wired-lan <intel-wired-lan-bounces@...osl.org> On Behalf Of Maciej
> Fijalkowski
> Sent: Thursday, July 7, 2022 3:47 PM
> To: intel-wired-lan@...ts.osuosl.org
> Cc: netdev@...r.kernel.org; john.fastabend@...il.com; Gerasymenko, Anatolii
> <anatolii.gerasymenko@...el.com>; kuba@...nel.org; davem@...emloft.net;
> Karlsson, Magnus <magnus.karlsson@...el.com>
> Subject: [Intel-wired-lan] [PATCH intel-next 1/2] ice: compress branches in
> ice_set_features()
> 
> Instead of rather verbose comparison of current netdev->features bits vs the
> incoming ones from user, let us compress them by a helper features set that will be
> the result of netdev->features XOR features. This way, current, extensive branches:
> 
> 	if (features & NETIF_F_BIT && !(netdev->features & NETIF_F_BIT))
> 		set_feature(true);
> 	else if (!(features & NETIF_F_BIT) && netdev->features & NETIF_F_BIT)
> 		set_feature(false);
> 
> can become:
> 
> 	netdev_features_t changed = netdev->features ^ features;
> 
> 	if (changed & NETIF_F_BIT)
> 		set_feature(!!(features & NETIF_F_BIT));
> 
> This is nothing new as currently several other drivers use this approach, which I find
> much more convenient.
> 
> Acked-by: John Fastabend <john.fastabend@...il.com>
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 40 +++++++++++------------
>  1 file changed, 19 insertions(+), 21 deletions(-)
> 

Tested-by: George Kuruvinakunnel <george.kuruvinakunnel@...el.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ