diff mbox series

[RFCv5,net-next,18/20] net: use netdev_set_xxx_features helpers

Message ID 20220324154932.17557-19-shenjian15@huawei.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series net: extend the type of netdev_features_t to bitmap | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count fail Series longer than 15 patches (and no cover letter)
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 499 this patch: 785
netdev/cc_maintainers warning 5 maintainers not CCed: habetsm.xilinx@gmail.com yisen.zhuang@huawei.com edumazet@google.com pabeni@redhat.com salil.mehta@huawei.com
netdev/build_clang fail Errors and warnings before: 873 this patch: 897
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 528 this patch: 561
netdev/checkpatch warning WARNING: line length of 90 exceeds 80 columns WARNING: line length of 92 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

shenjian (K) March 24, 2022, 3:49 p.m. UTC
Replace the direct assignment for features members of netdev
with netdev_set_xxx_features helpers, for the nic drivers are
not supposed to modify netdev_features directly

Signed-off-by: Jian Shen <shenjian15@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |  2 +-
 drivers/net/ethernet/sfc/ef10.c                 |  2 +-
 drivers/net/ethernet/sfc/falcon/efx.c           |  4 ++--
 net/core/dev.c                                  | 11 ++++++-----
 4 files changed, 10 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index a1a6accf8867..1a98e08f0a67 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -2443,7 +2443,7 @@  static int hns3_nic_set_features(struct net_device *netdev,
 			return ret;
 	}
 
-	netdev->active_features = features;
+	netdev_set_active_features(netdev, features);
 	return 0;
 }
 
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 1a92dd1a0462..c07650368952 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -1375,7 +1375,7 @@  static int efx_ef10_init_nic(struct efx_nic *efx)
 		netdev_active_features_direct_or(efx->net_dev,
 						 encap_tso_features);
 	}
-	efx->net_dev->hw_enc_features = hw_enc_features;
+	netdev_set_hw_enc_features(efx->net_dev, hw_enc_features);
 
 	/* don't fail init if RSS setup doesn't work */
 	rc = efx->type->rx_push_rss_config(efx, false,
diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c
index 22ea294a39fa..24993c979312 100644
--- a/drivers/net/ethernet/sfc/falcon/efx.c
+++ b/drivers/net/ethernet/sfc/falcon/efx.c
@@ -2924,8 +2924,8 @@  static int ef4_pci_probe(struct pci_dev *pci_dev,
 	/* Mask for features that also apply to VLAN devices */
 	netdev_vlan_features_set_array(net_dev, efx_vlan_features_array,
 				       ARRAY_SIZE(efx_vlan_features_array));
-	net_dev->hw_features = netdev_active_features_andnot(net_dev,
-							     efx->fixed_features);
+	netdev_set_hw_features(net_dev,
+			       netdev_active_features_andnot(net_dev, efx->fixed_features));
 
 	/* Disable VLAN filtering by default.  It may be enforced if
 	 * the feature is fixed (i.e. VLAN filters are required to
diff --git a/net/core/dev.c b/net/core/dev.c
index 57409f97feb1..62bfe12b69d9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -9655,7 +9655,7 @@  int __netdev_update_features(struct net_device *dev)
 			 * but *after* calling udp_tunnel_drop_rx_info.
 			 */
 			if (netdev_features_test_bit(NETIF_F_RX_UDP_TUNNEL_PORT_BIT, features)) {
-				dev->active_features = features;
+				netdev_set_active_features(dev, features);
 				udp_tunnel_get_rx_info(dev);
 			} else {
 				udp_tunnel_drop_rx_info(dev);
@@ -9664,7 +9664,7 @@  int __netdev_update_features(struct net_device *dev)
 
 		if (netdev_features_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, diff)) {
 			if (netdev_features_test_bit(NETIF_F_HW_VLAN_CTAG_FILTER_BIT, features)) {
-				dev->active_features = features;
+				netdev_set_active_features(dev, features);
 				err |= vlan_get_rx_ctag_filter_info(dev);
 			} else {
 				vlan_drop_rx_ctag_filter_info(dev);
@@ -9673,14 +9673,14 @@  int __netdev_update_features(struct net_device *dev)
 
 		if (netdev_features_test_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, diff)) {
 			if (netdev_features_test_bit(NETIF_F_HW_VLAN_STAG_FILTER_BIT, features)) {
-				dev->active_features = features;
+				netdev_set_active_features(dev, features);
 				err |= vlan_get_rx_stag_filter_info(dev);
 			} else {
 				vlan_drop_rx_stag_filter_info(dev);
 			}
 		}
 
-		dev->active_features = features;
+		netdev_set_active_features(dev, features);
 	}
 
 	return err < 0 ? 0 : 1;
@@ -9935,7 +9935,8 @@  int register_netdevice(struct net_device *dev)
 					   NETIF_F_RX_UDP_TUNNEL_PORT_BIT);
 	}
 
-	dev->wanted_features = netdev_active_features_and(dev, dev->hw_enc_features);
+	netdev_set_wanted_features(dev,
+				   netdev_active_features_and(dev, dev->hw_enc_features));
 
 	if (!(dev->flags & IFF_LOOPBACK))
 		netdev_hw_features_set_bit(dev, NETIF_F_NOCACHE_COPY_BIT);