]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: wangxun: move ethtool_ops.set_channels into libwx
authorJiawen Wu <jiawenwu@trustnetic.com>
Tue, 7 Apr 2026 02:56:12 +0000 (10:56 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sun, 12 Apr 2026 15:42:28 +0000 (08:42 -0700)
Since function ops wx->setup_tc() is set in txgbe and ngbe,
ethtool_ops.set_channels can be implemented in libwx to reduce
duplicated code.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Link: https://patch.msgid.link/20260407025616.33652-6-jiawenwu@trustnetic.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/wangxun/libwx/wx_ethtool.c
drivers/net/ethernet/wangxun/ngbe/ngbe_ethtool.c
drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c

index 2de1170db8c7e4a4ac13b71967b8b66994202c71..6adb8cbcad1f3fd445339c75dfbefdec1361cf2e 100644 (file)
@@ -555,7 +555,7 @@ int wx_set_channels(struct net_device *dev,
 
        wx->ring_feature[RING_F_RSS].limit = count;
 
-       return 0;
+       return wx->setup_tc(dev, netdev_get_num_tc(dev));
 }
 EXPORT_SYMBOL(wx_set_channels);
 
index 1b76ad897e97e00bf3a50c3b6a027d0505f51f81..b2e191982803263e96528d5a6b94988f436ea23c 100644 (file)
@@ -68,19 +68,6 @@ clear_reset:
        return err;
 }
 
-static int ngbe_set_channels(struct net_device *dev,
-                            struct ethtool_channels *ch)
-{
-       int err;
-
-       err = wx_set_channels(dev, ch);
-       if (err < 0)
-               return err;
-
-       /* use setup TC to update any traffic class queue mapping */
-       return ngbe_setup_tc(dev, netdev_get_num_tc(dev));
-}
-
 static const struct ethtool_ops ngbe_ethtool_ops = {
        .supported_coalesce_params = ETHTOOL_COALESCE_USECS |
                                     ETHTOOL_COALESCE_TX_MAX_FRAMES_IRQ |
@@ -104,7 +91,7 @@ static const struct ethtool_ops ngbe_ethtool_ops = {
        .get_coalesce           = wx_get_coalesce,
        .set_coalesce           = wx_set_coalesce,
        .get_channels           = wx_get_channels,
-       .set_channels           = ngbe_set_channels,
+       .set_channels           = wx_set_channels,
        .get_rxfh_fields        = wx_get_rxfh_fields,
        .set_rxfh_fields        = wx_set_rxfh_fields,
        .get_rxfh_indir_size    = wx_rss_indir_size,
index 46375799d057ecc12ef47c0ec542b233bbe22185..3e32aca7280652084e98b235a8a15f540c976895 100644 (file)
@@ -91,19 +91,6 @@ clear_reset:
        return err;
 }
 
-static int txgbe_set_channels(struct net_device *dev,
-                             struct ethtool_channels *ch)
-{
-       int err;
-
-       err = wx_set_channels(dev, ch);
-       if (err < 0)
-               return err;
-
-       /* use setup TC to update any traffic class queue mapping */
-       return txgbe_setup_tc(dev, netdev_get_num_tc(dev));
-}
-
 static int txgbe_get_ethtool_fdir_entry(struct txgbe *txgbe,
                                        struct ethtool_rxnfc *cmd)
 {
@@ -587,7 +574,7 @@ static const struct ethtool_ops txgbe_ethtool_ops = {
        .get_coalesce           = wx_get_coalesce,
        .set_coalesce           = wx_set_coalesce,
        .get_channels           = wx_get_channels,
-       .set_channels           = txgbe_set_channels,
+       .set_channels           = wx_set_channels,
        .get_rxnfc              = txgbe_get_rxnfc,
        .set_rxnfc              = txgbe_set_rxnfc,
        .get_rx_ring_count      = txgbe_get_rx_ring_count,