[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220918094336.28958-21-shenjian15@huawei.com>
Date: Sun, 18 Sep 2022 09:43:01 +0000
From: Jian Shen <shenjian15@...wei.com>
To: <davem@...emloft.net>, <kuba@...nel.org>, <ecree.xilinx@...il.com>,
<andrew@...n.ch>, <hkallweit1@...il.com>,
<alexandr.lobakin@...el.com>, <saeed@...nel.org>, <leon@...nel.org>
CC: <netdev@...r.kernel.org>, <linuxarm@...wei.com>
Subject: [RFCv8 PATCH net-next 20/55] net: mlxsw: adjust input parameter for function mlxsw_sp_handle_feature
The function mlxsw_sp_handle_feature() use NETIF_F_XXX as input
parameter directly, change it to use NETIF_F_XXX_BIT, for all
the NETIF_F_XXX macroes will be removed later.
Signed-off-by: Jian Shen <shenjian15@...wei.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 72aa22236ffa..702edcfa25a3 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1217,27 +1217,27 @@ typedef int (*mlxsw_sp_feature_handler)(struct net_device *dev, bool enable);
static int mlxsw_sp_handle_feature(struct net_device *dev,
netdev_features_t wanted_features,
- netdev_features_t feature,
+ int feature_bit,
mlxsw_sp_feature_handler feature_handler)
{
netdev_features_t changes = wanted_features ^ dev->features;
- bool enable = !!(wanted_features & feature);
+ bool enable = netdev_feature_test(feature_bit, wanted_features);
int err;
- if (!(changes & feature))
+ if (!netdev_feature_test(feature_bit, changes))
return 0;
err = feature_handler(dev, enable);
if (err) {
- netdev_err(dev, "%s feature %pNF failed, err %d\n",
- enable ? "Enable" : "Disable", &feature, err);
+ netdev_err(dev, "%s feature bit %d failed, err %d\n",
+ enable ? "Enable" : "Disable", feature_bit, err);
return err;
}
if (enable)
- dev->features |= feature;
+ netdev_active_feature_add(dev, feature_bit);
else
- dev->features &= ~feature;
+ netdev_active_feature_del(dev, feature_bit);
return 0;
}
@@ -1247,9 +1247,9 @@ static int mlxsw_sp_set_features(struct net_device *dev,
netdev_features_t oper_features = dev->features;
int err = 0;
- err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_HW_TC,
+ err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_HW_TC_BIT,
mlxsw_sp_feature_hw_tc);
- err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_LOOPBACK,
+ err |= mlxsw_sp_handle_feature(dev, features, NETIF_F_LOOPBACK_BIT,
mlxsw_sp_feature_loopback);
if (err) {
--
2.33.0
Powered by blists - more mailing lists