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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 12 Aug 2022 18:58:29 +0800 From: "shenjian (K)" <shenjian15@...wei.com> To: Alexander Lobakin <alexandr.lobakin@...el.com> CC: <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> Subject: Re: [RFCv7 PATCH net-next 02/36] net: replace general features macroes with global netdev_features variables 在 2022/8/11 19:05, Alexander Lobakin 写道: > From: "shenjian (K)" <shenjian15@...wei.com> > Date: Wed, 10 Aug 2022 20:01:15 +0800 > >> 在 2022/8/10 17:58, Alexander Lobakin 写道: >> > From: Jian Shen <shenjian15@...wei.com> >> > Date: Wed, 10 Aug 2022 11:05:50 +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> >> >> --- > > [...] > >> >> @@ -11362,6 +11363,86 @@ static struct pernet_operations >> __net_initdata default_device_ops = { >> >> .exit_batch = default_device_exit_batch, >> >> }; >> >> >> +static void __init netdev_features_init(void) >> > Given that you're creating a new file dedicated to netdev features, >> > I'd place that initializer there. You can then declare its proto in >> > net/core/dev.h. >> I want to make sure it cann't be called outside net/core/dev.c, for some >> drivers include net/core/dev.h, then they can see it. > > net/core/dev.h is internal, nobody outside net/core/ uses it and > this was its purpose. > All right, will move it netdev_features.c >> >> >> +{ >> >> + netdev_features_t features; >> >> + >> >> + 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_gso_feature_set_mask, >> >> + &netdev_gso_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_gso_encap_feature_set, >> >> + &netdev_gso_encap_all_features); >> >> + >> >> + netdev_csum_gso_features_mask = >> >> + netdev_features_or(netdev_gso_features_mask, >> >> + netdev_csum_features_mask); >> > (I forgot to mention this in 01/36 ._.) >> > >> > As you're converting to bitmaps, you should probably avoid direct >> > assignments. All the bitmap_*() modification functions take a pointer >> > to the destination as a first argument. So it should be >> > >> > netdev_features_or(netdev_features_t *dst, const netdev_features_t >> *src1, >> > const netdev_features_t *src1); >> The netdev_features_t will be convert to a structure which only >> contained >> a feature bitmap. So assginement is ok. > > Yeah I realized it later, probably a good idea. > >> >> >> >> + >> >> + netdev_features_set_array(&netif_f_one_for_all_feature_set, >> >> + &netdev_one_for_all_features); >> > Does it make sense to prefix features and the corresponding sets >> > differently? Why not just 'netdev_' for both of them? >> For all the feature bits are named "NETFI_F_XXX_BIT", > > Right, but then why are netdev_*_features prefixed with 'netdev', > not 'netif_f'? :D Those sets are tied tightly with the feature > structures, so I think they should have the same prefix. I'd go > with 'netdev' for both. > ok, will prefix with 'netdev' >> >> >> >> + netdev_features_set_array(&netif_f_all_for_all_feature_set, >> >> + &netdev_all_for_all_features); > > [...] > >> >> -- >> 2.33.0 >> > Thanks, >> > Olek >> > >> > . >> >> Thank, >> Jian > > Thanks, > Olek > > . > Thanks, Jian
Powered by blists - more mailing lists