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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220720151347.3875809-1-alexandr.lobakin@intel.com>
Date:   Wed, 20 Jul 2022 17:13:47 +0200
From:   Alexander Lobakin <alexandr.lobakin@...el.com>
To:     "shenjian (K)" <shenjian15@...wei.com>
Cc:     Alexander Lobakin <alexandr.lobakin@...el.com>,
        davem@...emloft.net, kuba@...nel.org, andrew@...n.ch,
        ecree.xilinx@...il.com, hkallweit1@...il.com, saeed@...nel.org,
        leon@...nel.org, netdev@...r.kernel.org, linuxarm@...neuler.org,
        lipeng321@...wei.com,
        Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
        Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
Subject: Re: [RFCv6 PATCH net-next 02/19] net: replace general features macroes with global netdev_features variables

From: shenjian (K) <shenjian15@...wei.com>
Date: Wed, 20 Apr 2022 17:54:13 +0800

> 在 2022/4/19 22:49, Alexander Lobakin 写道:
> > From: Jian Shen <shenjian15@...wei.com>
> > Date: Tue, 19 Apr 2022 10:21:49 +0800
> >
> >> There are many netdev_features bits group used in kernel. The definition
> >> will be illegal when using feature bit more than 64. Replace these macroes
> >> with global netdev_features variables, initialize them when netdev module
> >> init.
> >>
> >> Signed-off-by: Jian Shen <shenjian15@...wei.com>
> >> ---
> >>   drivers/net/wireguard/device.c  |  10 +-
> >>   include/linux/netdev_features.h | 102 +++++++++-----
> >>   net/core/Makefile               |   2 +-
> >>   net/core/dev.c                  |  87 ++++++++++++
> >>   net/core/netdev_features.c      | 241 ++++++++++++++++++++++++++++++++
> >>   5 files changed, 400 insertions(+), 42 deletions(-)
> >>   create mode 100644 net/core/netdev_features.c
> >>
> > --- 8< ---
> >
> >> diff --git a/net/core/dev.c b/net/core/dev.c
> >> index 4d6b57752eee..85bb418e8ef1 100644
> >> --- a/net/core/dev.c
> >> +++ b/net/core/dev.c
> >> @@ -146,6 +146,7 @@
> >>   #include <linux/sctp.h>
> >>   #include <net/udp_tunnel.h>
> >>   #include <linux/net_namespace.h>
> >> +#include <linux/netdev_features_helper.h>
> >>   #include <linux/indirect_call_wrapper.h>
> >>   #include <net/devlink.h>
> >>   #include <linux/pm_runtime.h>
> >> @@ -11255,6 +11256,90 @@ static struct pernet_operations __net_initdata default_device_ops = {
> >>   	.exit_batch = default_device_exit_batch,
> >>   };
> >>   
> >> +static void netdev_features_init(void)
> > It is an initialization function, so it must be marked as __init.
> right, I will add it, thanks!
> 
> >> +{
> >> +	netdev_features_t features;
> >> +
> >> +	netdev_features_set_array(&netif_f_never_change_feature_set,
> >> +				  &netdev_never_change_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_gso_feature_set_mask,
> > I'm not sure it does make sense to have an empty newline between
> > each call. I'd leave newlines only between the "regular" blocks
> > and the "multi-call" blocks, I mean, stuff like VLAN, GSO and
> > @netdev_ethtool_features.
> At first, I added empty newline per call for the it used three lines.
> Now the new call just use two lines, I will remove some unnecessary
> blank lines.
> 
> Thanks!

(sorry for the triple mail, at first References got screwed, then
 encoding =\)

I see no news regarding the conversion since the end of April, maybe
I could pick it and finish if nobody objects? I'll preserve the
original authorship for sure.

> 
> >> +				  &netdev_gso_features_mask);
> >> +
> >> +	netdev_features_set_array(&netif_f_ip_csum_feature_set,
> >> +				  &netdev_ip_csum_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_csum_feature_set_mask,
> >> +				  &netdev_csum_features_mask);
> >> +
> >> +	netdev_features_set_array(&netif_f_general_tso_feature_set,
> >> +				  &netdev_general_tso_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_all_tso_feature_set,
> >> +				  &netdev_all_tso_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_tso_ecn_feature_set,
> >> +				  &netdev_tso_ecn_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_all_fcoe_feature_set,
> >> +				  &netdev_all_fcoe_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_gso_soft_feature_set,
> >> +				  &netdev_gso_software_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_one_for_all_feature_set,
> >> +				  &netdev_one_for_all_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_all_for_all_feature_set,
> >> +				  &netdev_all_for_all_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_upper_disables_feature_set,
> >> +				  &netdev_upper_disable_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_soft_feature_set,
> >> +				  &netdev_soft_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_soft_off_feature_set,
> >> +				  &netdev_soft_off_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_rx_vlan_feature_set,
> >> +				  &netdev_rx_vlan_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_tx_vlan_feature_set,
> >> +				  &netdev_tx_vlan_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_vlan_filter_feature_set,
> >> +				  &netdev_vlan_filter_features);
> >> +
> >> +	netdev_all_vlan_features = netdev_rx_vlan_features;
> >> +	netdev_features_set(&netdev_all_vlan_features, netdev_tx_vlan_features);
> >> +	netdev_features_set(&netdev_all_vlan_features,
> >> +			    netdev_vlan_filter_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_ctag_vlan_feature_set,
> >> +				  &netdev_ctag_vlan_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_stag_vlan_feature_set,
> >> +				  &netdev_stag_vlan_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_gso_encap_feature_set,
> >> +				  &netdev_gso_encap_all_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_xfrm_feature_set,
> >> +				  &netdev_xfrm_features);
> >> +
> >> +	netdev_features_set_array(&netif_f_tls_feature_set,
> >> +				  &netdev_tls_features);
> >> +
> >> +	netdev_csum_gso_features_mask =
> >> +		netdev_features_or(netdev_gso_software_features,
> >> +				   netdev_csum_features_mask);
> >> +
> >> +	netdev_features_fill(&features);
> >> +	netdev_ethtool_features =
> >> +		netdev_features_andnot(features, netdev_never_change_features);
> >> +}
> >> +
> >>   /*
> >>    *	Initialize the DEV module. At boot time this walks the device list and
> >>    *	unhooks any devices that fail to initialise (normally hardware not
> > --- 8< ---
> >
> >> -- 
> >> 2.33.0
> > Thanks,
> > Al
> >
> > .
> >

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ