Skip to content

Commit c7fcd26

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ice: set max queues in alloc_etherdev_mqs()
When allocating netdevice using alloc_etherdev_mqs() the maximum supported queues number should be passed. The vsi->alloc_txq/rxq is storing current number of queues, not the maximum ones. Use the same function for getting max Tx and Rx queues which is used during ethtool -l call to set maximum number of queues during netdev allocation. Reproduction steps: $ethtool -l $pf # says current 16, max 64 $ethtool -S $pf # fine $ethtool -L $pf combined 40 # crash [491187.472594] Call Trace: [491187.472829] <TASK> [491187.473067] netif_set_xps_queue+0x26/0x40 [491187.473305] ice_vsi_cfg_txq+0x265/0x3d0 [ice] [491187.473619] ice_vsi_cfg_lan_txqs+0x68/0xa0 [ice] [491187.473918] ice_vsi_cfg_lan+0x2b/0xa0 [ice] [491187.474202] ice_vsi_open+0x71/0x170 [ice] [491187.474484] ice_vsi_recfg_qs+0x17f/0x230 [ice] [491187.474759] ? dev_get_min_mp_channel_count+0xab/0xd0 [491187.474987] ice_set_channels+0x185/0x3d0 [ice] [491187.475278] ethnl_set_channels+0x26f/0x340 Fixes: ee13aa1 ("ice: use netif_get_num_default_rss_queues()") Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: Michal Swiatkowski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Paul Menzel <[email protected]> Tested-by: Alexander Nowlin <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent bc0151c commit c7fcd26

3 files changed

Lines changed: 24 additions & 20 deletions

File tree

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,28 @@ static inline void ice_tx_xsk_pool(struct ice_vsi *vsi, u16 qid)
839839
WRITE_ONCE(ring->xsk_pool, ice_get_xp_from_qid(vsi, qid));
840840
}
841841

842+
/**
843+
* ice_get_max_txq - return the maximum number of Tx queues for in a PF
844+
* @pf: PF structure
845+
*
846+
* Return: maximum number of Tx queues
847+
*/
848+
static inline int ice_get_max_txq(struct ice_pf *pf)
849+
{
850+
return min(num_online_cpus(), pf->hw.func_caps.common_cap.num_txq);
851+
}
852+
853+
/**
854+
* ice_get_max_rxq - return the maximum number of Rx queues for in a PF
855+
* @pf: PF structure
856+
*
857+
* Return: maximum number of Rx queues
858+
*/
859+
static inline int ice_get_max_rxq(struct ice_pf *pf)
860+
{
861+
return min(num_online_cpus(), pf->hw.func_caps.common_cap.num_rxq);
862+
}
863+
842864
/**
843865
* ice_get_main_vsi - Get the PF VSI
844866
* @pf: PF instance

drivers/net/ethernet/intel/ice/ice_ethtool.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3773,24 +3773,6 @@ ice_get_ts_info(struct net_device *dev, struct kernel_ethtool_ts_info *info)
37733773
return 0;
37743774
}
37753775

3776-
/**
3777-
* ice_get_max_txq - return the maximum number of Tx queues for in a PF
3778-
* @pf: PF structure
3779-
*/
3780-
static int ice_get_max_txq(struct ice_pf *pf)
3781-
{
3782-
return min(num_online_cpus(), pf->hw.func_caps.common_cap.num_txq);
3783-
}
3784-
3785-
/**
3786-
* ice_get_max_rxq - return the maximum number of Rx queues for in a PF
3787-
* @pf: PF structure
3788-
*/
3789-
static int ice_get_max_rxq(struct ice_pf *pf)
3790-
{
3791-
return min(num_online_cpus(), pf->hw.func_caps.common_cap.num_rxq);
3792-
}
3793-
37943776
/**
37953777
* ice_get_combined_cnt - return the current number of combined channels
37963778
* @vsi: PF VSI pointer

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4699,8 +4699,8 @@ static int ice_cfg_netdev(struct ice_vsi *vsi)
46994699
struct net_device *netdev;
47004700
u8 mac_addr[ETH_ALEN];
47014701

4702-
netdev = alloc_etherdev_mqs(sizeof(*np), vsi->alloc_txq,
4703-
vsi->alloc_rxq);
4702+
netdev = alloc_etherdev_mqs(sizeof(*np), ice_get_max_txq(vsi->back),
4703+
ice_get_max_rxq(vsi->back));
47044704
if (!netdev)
47054705
return -ENOMEM;
47064706

0 commit comments

Comments
 (0)