From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: Jian Shen <shenjian15@huawei.com>
Cc: Alexander Lobakin <alexandr.lobakin@intel.com>,
davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch,
ecree.xilinx@gmail.com, hkallweit1@gmail.com, saeed@kernel.org,
leon@kernel.org, netdev@vger.kernel.org, linuxarm@openeuler.org,
lipeng321@huawei.com
Subject: Re: [RFCv6 PATCH net-next 02/19] net: replace general features macroes with global netdev_features variables
Date: Tue, 19 Apr 2022 16:49:44 +0200 [thread overview]
Message-ID: <20220419144944.1665016-1-alexandr.lobakin@intel.com> (raw)
In-Reply-To: <20220419022206.36381-3-shenjian15@huawei.com>
From: Jian Shen <shenjian15@huawei.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@huawei.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.
> +{
> + 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.
> + &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
next prev parent reply other threads:[~2022-04-19 14:53 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-19 2:21 [RFCv6 PATCH net-next 00/19] net: extend the type of netdev_features_t to bitmap Jian Shen
2022-04-19 2:21 ` [RFCv6 PATCH net-next 01/19] net: introduce operation helpers for netdev features Jian Shen
2022-04-19 14:40 ` Alexander Lobakin
2022-04-20 9:24 ` shenjian (K)
2022-04-19 2:21 ` [RFCv6 PATCH net-next 02/19] net: replace general features macroes with global netdev_features variables Jian Shen
2022-04-19 14:49 ` Alexander Lobakin [this message]
2022-04-20 9:54 ` shenjian (K)
2022-07-20 15:09 ` Alexander Lobakin
2022-07-21 1:15 ` shenjian (K)
2022-07-21 14:57 ` Alexander Lobakin
2022-07-21 15:21 ` shenjian (K)
2022-07-20 15:10 ` Alexander Lobakin
2022-07-20 15:13 ` Alexander Lobakin
2022-04-19 2:21 ` [RFCv6 PATCH net-next 03/19] net: replace multiple feature bits with netdev features array Jian Shen
2022-04-19 2:21 ` [RFCv6 PATCH net-next 04/19] net: sfc: replace const features initialization " Jian Shen
2022-04-19 2:21 ` [RFCv6 PATCH net-next 05/19] net: simplify the netdev features expression Jian Shen
2022-04-19 2:21 ` [RFCv6 PATCH net-next 06/19] net: adjust variables definition for netdev_features_t Jian Shen
2022-04-19 2:21 ` [RFCv6 PATCH net-next 07/19] net: use netdev_feature_add helpers Jian Shen
2022-04-19 2:21 ` [RFCv6 PATCH net-next 08/19] net: use netdev_features_or helpers Jian Shen
2022-04-19 2:21 ` [RFCv6 PATCH net-next 09/19] net: use netdev_features_xor helpers Jian Shen
2022-04-19 2:21 ` [RFCv6 PATCH net-next 10/19] net: use netdev_feature_del helpers Jian Shen
2022-04-19 2:21 ` [RFCv6 PATCH net-next 11/19] net: use netdev_features_andnot helpers Jian Shen
2022-04-19 2:21 ` [RFCv6 PATCH net-next 12/19] net: use netdev_feature_test helpers Jian Shen
2022-04-19 2:22 ` [RFCv6 PATCH net-next 13/19] net: use netdev_features_intersects helpers Jian Shen
2022-04-19 2:22 ` [RFCv6 PATCH net-next 14/19] net: use netdev_features_and helpers Jian Shen
2022-04-19 2:22 ` [RFCv6 PATCH net-next 15/19] net: use netdev_features_subset helpers Jian Shen
2022-04-19 2:22 ` [RFCv6 PATCH net-next 16/19] net: use netdev_features_equal helpers Jian Shen
2022-04-19 2:22 ` [RFCv6 PATCH net-next 17/19] net: use netdev_features_copy helpers Jian Shen
2022-04-19 2:22 ` [RFCv6 PATCH net-next 18/19] net: use netdev_xxx_features helpers Jian Shen
2022-04-19 2:22 ` [RFCv6 PATCH net-next 19/19] net: redefine the prototype of netdev_features_t Jian Shen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220419144944.1665016-1-alexandr.lobakin@intel.com \
--to=alexandr.lobakin@intel.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linuxarm@openeuler.org \
--cc=lipeng321@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=saeed@kernel.org \
--cc=shenjian15@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox