在 2022/8/11 19:05, Alexander Lobakin 写道:
From: "shenjian (K)" <shenjian15@huawei.com>
Date: Wed, 10 Aug 2022 20:01:15 +0800
quoted
在 2022/8/10 17:58, Alexander Lobakin 写道:
quoted
From: Jian Shen <shenjian15@huawei.com>
Date: Wed, 10 Aug 2022 11:05:50 +0800
quoted
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@huawei.com>
---
[...]
quoted
quoted
quoted
@@ -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
quoted
quoted
quoted
+{
+ 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.
quoted
quoted
quoted
+
+ 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'
quoted
quoted
quoted
+ netdev_features_set_array(&netif_f_all_for_all_feature_set,
+ &netdev_all_for_all_features);
[...]
quoted
quoted
quoted
-- >> 2.33.0
Thanks,
Olek
.
Thank,
Jian
Thanks,
Olek
.
Thanks,
Jian