Patch "ice: Interpret .set_channels() input differently" has been added to the 6.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ice: Interpret .set_channels() input differently

to the 6.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ice-interpret-.set_channels-input-differently.patch
and it can be found in the queue-6.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3649c0398131430be99b7ed070c84a376d5790fc
Author: Larysa Zaremba <larysa.zaremba@xxxxxxxxx>
Date:   Tue May 21 12:39:53 2024 -0700

    ice: Interpret .set_channels() input differently
    
    [ Upstream commit 05d6f442f31f901d27dbc64fd504a8ec7d5013de ]
    
    A bug occurs because a safety check guarding AF_XDP-related queues in
    ethnl_set_channels(), does not trigger. This happens, because kernel and
    ice driver interpret the ethtool command differently.
    
    How the bug occurs:
    1. ethtool -l <IFNAME> -> combined: 40
    2. Attach AF_XDP to queue 30
    3. ethtool -L <IFNAME> rx 15 tx 15
       combined number is not specified, so command becomes {rx_count = 15,
       tx_count = 15, combined_count = 40}.
    4. ethnl_set_channels checks, if there are any AF_XDP of queues from the
       new (combined_count + rx_count) to the old one, so from 55 to 40, check
       does not trigger.
    5. ice interprets `rx 15 tx 15` as 15 combined channels and deletes the
       queue that AF_XDP is attached to.
    
    Interpret the command in a way that is more consistent with ethtool
    manual [0] (--show-channels and --set-channels).
    
    Considering that in the ice driver only the difference between RX and TX
    queues forms dedicated channels, change the correct way to set number of
    channels to:
    
    ethtool -L <IFNAME> combined 10 /* For symmetric queues */
    ethtool -L <IFNAME> combined 8 tx 2 rx 0 /* For asymmetric queues */
    
    [0] https://man7.org/linux/man-pages/man8/ethtool.8.html
    
    Fixes: 87324e747fde ("ice: Implement ethtool ops for channels")
    Reviewed-by: Michal Swiatkowski <michal.swiatkowski@xxxxxxxxxxxxxxx>
    Signed-off-by: Larysa Zaremba <larysa.zaremba@xxxxxxxxx>
    Tested-by: Chandan Kumar Rout <chandanx.rout@xxxxxxxxx>
    Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@xxxxxxxxx>
    Acked-by: Maciej Fijalkowski <maciej.fijalkowski@xxxxxxxxx>
    Signed-off-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 78b833b3e1d7e..62c8205fcebae 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -3593,7 +3593,6 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
 	struct ice_pf *pf = vsi->back;
 	int new_rx = 0, new_tx = 0;
 	bool locked = false;
-	u32 curr_combined;
 	int ret = 0;
 
 	/* do not support changing channels in Safe Mode */
@@ -3615,22 +3614,8 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
 		return -EOPNOTSUPP;
 	}
 
-	curr_combined = ice_get_combined_cnt(vsi);
-
-	/* these checks are for cases where user didn't specify a particular
-	 * value on cmd line but we get non-zero value anyway via
-	 * get_channels(); look at ethtool.c in ethtool repository (the user
-	 * space part), particularly, do_schannels() routine
-	 */
-	if (ch->rx_count == vsi->num_rxq - curr_combined)
-		ch->rx_count = 0;
-	if (ch->tx_count == vsi->num_txq - curr_combined)
-		ch->tx_count = 0;
-	if (ch->combined_count == curr_combined)
-		ch->combined_count = 0;
-
-	if (!(ch->combined_count || (ch->rx_count && ch->tx_count))) {
-		netdev_err(dev, "Please specify at least 1 Rx and 1 Tx channel\n");
+	if (ch->rx_count && ch->tx_count) {
+		netdev_err(dev, "Dedicated RX or TX channels cannot be used simultaneously\n");
 		return -EINVAL;
 	}
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux