mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
Merge branch 'net-intel-migrate-to-get_rx_ring_count-ethtool-callback'
Breno Leitao says:
====================
net: intel: migrate to .get_rx_ring_count() ethtool callback
This series migrates Intel network drivers to use the new .get_rx_ring_count()
ethtool callback introduced in commit 84eaf4359c ("net: ethtool: add
get_rx_ring_count callback to optimize RX ring queries").
The new callback simplifies the .get_rxnfc() implementation by removing
ETHTOOL_GRXRINGS handling and moving it to a dedicated callback. This provides
a cleaner separation of concerns and aligns these drivers with the modern
ethtool API.
The series updates the following Intel drivers:
- idpf
- igb
- igc
- ixgbevf
- fm10k
====================
Link: https://patch.msgid.link/20251125-gxring_intel-v2-0-f55cd022d28b@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -734,22 +734,11 @@ static int fm10k_get_rssh_fields(struct net_device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fm10k_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
u32 __always_unused *rule_locs)
|
||||
static u32 fm10k_get_rx_ring_count(struct net_device *dev)
|
||||
{
|
||||
struct fm10k_intfc *interface = netdev_priv(dev);
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = interface->num_rx_queues;
|
||||
ret = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return interface->num_rx_queues;
|
||||
}
|
||||
|
||||
static int fm10k_set_rssh_fields(struct net_device *dev,
|
||||
@@ -1160,7 +1149,7 @@ static const struct ethtool_ops fm10k_ethtool_ops = {
|
||||
.set_ringparam = fm10k_set_ringparam,
|
||||
.get_coalesce = fm10k_get_coalesce,
|
||||
.set_coalesce = fm10k_set_coalesce,
|
||||
.get_rxnfc = fm10k_get_rxnfc,
|
||||
.get_rx_ring_count = fm10k_get_rx_ring_count,
|
||||
.get_regs = fm10k_get_regs,
|
||||
.get_regs_len = fm10k_get_regs_len,
|
||||
.self_test = fm10k_self_test,
|
||||
|
||||
@@ -3521,6 +3521,20 @@ no_input_set:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* i40e_get_rx_ring_count - get RX ring count
|
||||
* @netdev: network interface device structure
|
||||
*
|
||||
* Return: number of RX rings.
|
||||
**/
|
||||
static u32 i40e_get_rx_ring_count(struct net_device *netdev)
|
||||
{
|
||||
struct i40e_netdev_priv *np = netdev_priv(netdev);
|
||||
struct i40e_vsi *vsi = np->vsi;
|
||||
|
||||
return vsi->rss_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* i40e_get_rxnfc - command to get RX flow classification rules
|
||||
* @netdev: network interface device structure
|
||||
@@ -3538,10 +3552,6 @@ static int i40e_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = vsi->rss_size;
|
||||
ret = 0;
|
||||
break;
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
cmd->rule_cnt = pf->fdir_pf_active_filters;
|
||||
/* report total rule count */
|
||||
@@ -5819,6 +5829,7 @@ static const struct ethtool_ops i40e_ethtool_ops = {
|
||||
.set_msglevel = i40e_set_msglevel,
|
||||
.get_rxnfc = i40e_get_rxnfc,
|
||||
.set_rxnfc = i40e_set_rxnfc,
|
||||
.get_rx_ring_count = i40e_get_rx_ring_count,
|
||||
.self_test = i40e_diag_test,
|
||||
.get_strings = i40e_get_strings,
|
||||
.get_eee = i40e_get_eee,
|
||||
|
||||
@@ -1638,6 +1638,19 @@ static int iavf_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* iavf_get_rx_ring_count - get RX ring count
|
||||
* @netdev: network interface device structure
|
||||
*
|
||||
* Return: number of RX rings.
|
||||
**/
|
||||
static u32 iavf_get_rx_ring_count(struct net_device *netdev)
|
||||
{
|
||||
struct iavf_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
return adapter->num_active_queues;
|
||||
}
|
||||
|
||||
/**
|
||||
* iavf_get_rxnfc - command to get RX flow classification rules
|
||||
* @netdev: network interface device structure
|
||||
@@ -1653,10 +1666,6 @@ static int iavf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = adapter->num_active_queues;
|
||||
ret = 0;
|
||||
break;
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
if (!(adapter->flags & IAVF_FLAG_FDIR_ENABLED))
|
||||
break;
|
||||
@@ -1866,6 +1875,7 @@ static const struct ethtool_ops iavf_ethtool_ops = {
|
||||
.set_per_queue_coalesce = iavf_set_per_queue_coalesce,
|
||||
.set_rxnfc = iavf_set_rxnfc,
|
||||
.get_rxnfc = iavf_get_rxnfc,
|
||||
.get_rx_ring_count = iavf_get_rx_ring_count,
|
||||
.get_rxfh_indir_size = iavf_get_rxfh_indir_size,
|
||||
.get_rxfh = iavf_get_rxfh,
|
||||
.set_rxfh = iavf_set_rxfh,
|
||||
|
||||
@@ -3083,6 +3083,20 @@ static int ice_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_get_rx_ring_count - get RX ring count
|
||||
* @netdev: network interface device structure
|
||||
*
|
||||
* Return: number of RX rings.
|
||||
*/
|
||||
static u32 ice_get_rx_ring_count(struct net_device *netdev)
|
||||
{
|
||||
struct ice_netdev_priv *np = netdev_priv(netdev);
|
||||
struct ice_vsi *vsi = np->vsi;
|
||||
|
||||
return vsi->rss_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_get_rxnfc - command to get Rx flow classification rules
|
||||
* @netdev: network interface device structure
|
||||
@@ -3103,10 +3117,6 @@ ice_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
|
||||
hw = &vsi->back->hw;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = vsi->rss_size;
|
||||
ret = 0;
|
||||
break;
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
cmd->rule_cnt = hw->fdir_active_fltr;
|
||||
/* report total rule count */
|
||||
@@ -4853,6 +4863,7 @@ static const struct ethtool_ops ice_ethtool_ops = {
|
||||
.get_sset_count = ice_get_sset_count,
|
||||
.get_rxnfc = ice_get_rxnfc,
|
||||
.set_rxnfc = ice_set_rxnfc,
|
||||
.get_rx_ring_count = ice_get_rx_ring_count,
|
||||
.get_ringparam = ice_get_ringparam,
|
||||
.set_ringparam = ice_set_ringparam,
|
||||
.nway_reset = ice_nway_reset,
|
||||
|
||||
@@ -5,6 +5,25 @@
|
||||
#include "idpf_ptp.h"
|
||||
#include "idpf_virtchnl.h"
|
||||
|
||||
/**
|
||||
* idpf_get_rx_ring_count - get RX ring count
|
||||
* @netdev: network interface device structure
|
||||
*
|
||||
* Return: number of RX rings.
|
||||
*/
|
||||
static u32 idpf_get_rx_ring_count(struct net_device *netdev)
|
||||
{
|
||||
struct idpf_vport *vport;
|
||||
u32 num_rxq;
|
||||
|
||||
idpf_vport_ctrl_lock(netdev);
|
||||
vport = idpf_netdev_to_vport(netdev);
|
||||
num_rxq = vport->num_rxq;
|
||||
idpf_vport_ctrl_unlock(netdev);
|
||||
|
||||
return num_rxq;
|
||||
}
|
||||
|
||||
/**
|
||||
* idpf_get_rxnfc - command to get RX flow classification rules
|
||||
* @netdev: network interface device structure
|
||||
@@ -28,9 +47,6 @@ static int idpf_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
|
||||
user_config = &np->adapter->vport_config[np->vport_idx]->user_config;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = vport->num_rxq;
|
||||
break;
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
cmd->rule_cnt = user_config->num_fsteer_fltrs;
|
||||
cmd->data = idpf_fsteer_max_rules(vport);
|
||||
@@ -1757,6 +1773,7 @@ static const struct ethtool_ops idpf_ethtool_ops = {
|
||||
.get_channels = idpf_get_channels,
|
||||
.get_rxnfc = idpf_get_rxnfc,
|
||||
.set_rxnfc = idpf_set_rxnfc,
|
||||
.get_rx_ring_count = idpf_get_rx_ring_count,
|
||||
.get_rxfh_key_size = idpf_get_rxfh_key_size,
|
||||
.get_rxfh_indir_size = idpf_get_rxfh_indir_size,
|
||||
.get_rxfh = idpf_get_rxfh,
|
||||
|
||||
@@ -2541,6 +2541,13 @@ static int igb_get_rxfh_fields(struct net_device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 igb_get_rx_ring_count(struct net_device *dev)
|
||||
{
|
||||
struct igb_adapter *adapter = netdev_priv(dev);
|
||||
|
||||
return adapter->num_rx_queues;
|
||||
}
|
||||
|
||||
static int igb_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
u32 *rule_locs)
|
||||
{
|
||||
@@ -2548,10 +2555,6 @@ static int igb_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = adapter->num_rx_queues;
|
||||
ret = 0;
|
||||
break;
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
cmd->rule_cnt = adapter->nfc_filter_count;
|
||||
ret = 0;
|
||||
@@ -3473,6 +3476,7 @@ static const struct ethtool_ops igb_ethtool_ops = {
|
||||
.get_ts_info = igb_get_ts_info,
|
||||
.get_rxnfc = igb_get_rxnfc,
|
||||
.set_rxnfc = igb_set_rxnfc,
|
||||
.get_rx_ring_count = igb_get_rx_ring_count,
|
||||
.get_eee = igb_get_eee,
|
||||
.set_eee = igb_set_eee,
|
||||
.get_module_info = igb_get_module_info,
|
||||
|
||||
@@ -1091,15 +1091,19 @@ static int igc_ethtool_get_rxfh_fields(struct net_device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 igc_ethtool_get_rx_ring_count(struct net_device *dev)
|
||||
{
|
||||
struct igc_adapter *adapter = netdev_priv(dev);
|
||||
|
||||
return adapter->num_rx_queues;
|
||||
}
|
||||
|
||||
static int igc_ethtool_get_rxnfc(struct net_device *dev,
|
||||
struct ethtool_rxnfc *cmd, u32 *rule_locs)
|
||||
{
|
||||
struct igc_adapter *adapter = netdev_priv(dev);
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = adapter->num_rx_queues;
|
||||
return 0;
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
cmd->rule_cnt = adapter->nfc_rule_count;
|
||||
return 0;
|
||||
@@ -2170,6 +2174,7 @@ static const struct ethtool_ops igc_ethtool_ops = {
|
||||
.set_coalesce = igc_ethtool_set_coalesce,
|
||||
.get_rxnfc = igc_ethtool_get_rxnfc,
|
||||
.set_rxnfc = igc_ethtool_set_rxnfc,
|
||||
.get_rx_ring_count = igc_ethtool_get_rx_ring_count,
|
||||
.get_rxfh_indir_size = igc_ethtool_get_rxfh_indir_size,
|
||||
.get_rxfh = igc_ethtool_get_rxfh,
|
||||
.set_rxfh = igc_ethtool_set_rxfh,
|
||||
|
||||
@@ -867,19 +867,11 @@ static int ixgbevf_set_coalesce(struct net_device *netdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ixgbevf_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
|
||||
u32 *rules __always_unused)
|
||||
static u32 ixgbevf_get_rx_ring_count(struct net_device *dev)
|
||||
{
|
||||
struct ixgbevf_adapter *adapter = netdev_priv(dev);
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
info->data = adapter->num_rx_queues;
|
||||
return 0;
|
||||
default:
|
||||
hw_dbg(&adapter->hw, "Command parameters not supported\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
return adapter->num_rx_queues;
|
||||
}
|
||||
|
||||
static u32 ixgbevf_get_rxfh_indir_size(struct net_device *netdev)
|
||||
@@ -987,7 +979,7 @@ static const struct ethtool_ops ixgbevf_ethtool_ops = {
|
||||
.get_ethtool_stats = ixgbevf_get_ethtool_stats,
|
||||
.get_coalesce = ixgbevf_get_coalesce,
|
||||
.set_coalesce = ixgbevf_set_coalesce,
|
||||
.get_rxnfc = ixgbevf_get_rxnfc,
|
||||
.get_rx_ring_count = ixgbevf_get_rx_ring_count,
|
||||
.get_rxfh_indir_size = ixgbevf_get_rxfh_indir_size,
|
||||
.get_rxfh_key_size = ixgbevf_get_rxfh_key_size,
|
||||
.get_rxfh = ixgbevf_get_rxfh,
|
||||
|
||||
Reference in New Issue
Block a user