mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
Merge branch 'net-convert-drivers-to-get_rx_ring_count-last-part'
Breno Leitao says:
====================
net: convert drivers to .get_rx_ring_count (last part)
Commit 84eaf4359c ("net: ethtool: add get_rx_ring_count callback to
optimize RX ring queries") added specific support for GRXRINGS callback,
simplifying .get_rxnfc.
Remove the handling of GRXRINGS in .get_rxnfc() by moving it to the new
.get_rx_ring_count().
This simplifies the RX ring count retrieval and aligns the following
drivers with the new ethtool API for querying RX ring parameters.
* sfc
* ionic
* sfc/siena
* sfc/ef100
* fbnic
* mana
* nfp
* atlantic
* benet (this is v2 in fact, where v1 had some discussions that
required a v2). See link [0]
Link: https://lore.kernel.org/all/20260119094514.5b12a097@kernel.org/ [0]
This is covering the last drivers, and as soon as this lands, I will
change the ethtool framework to avoid calling .get_rx_ring_count for
ETHTOOL_GRXRINGS, simplifying the ethtool core framework.
====================
Link: https://patch.msgid.link/20260122-grxring_big_v4-v2-0-94dbe4dcaa10@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
8811df1dd4
|
|
@ -500,20 +500,25 @@ static int aq_ethtool_set_rss(struct net_device *netdev,
|
|||
return err;
|
||||
}
|
||||
|
||||
static u32 aq_ethtool_get_rx_ring_count(struct net_device *ndev)
|
||||
{
|
||||
struct aq_nic_cfg_s *cfg;
|
||||
struct aq_nic_s *aq_nic;
|
||||
|
||||
aq_nic = netdev_priv(ndev);
|
||||
cfg = aq_nic_get_cfg(aq_nic);
|
||||
|
||||
return cfg->vecs;
|
||||
}
|
||||
|
||||
static int aq_ethtool_get_rxnfc(struct net_device *ndev,
|
||||
struct ethtool_rxnfc *cmd,
|
||||
u32 *rule_locs)
|
||||
{
|
||||
struct aq_nic_s *aq_nic = netdev_priv(ndev);
|
||||
struct aq_nic_cfg_s *cfg;
|
||||
int err = 0;
|
||||
|
||||
cfg = aq_nic_get_cfg(aq_nic);
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = cfg->vecs;
|
||||
break;
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
cmd->rule_cnt = aq_get_rxnfc_count_all_rules(aq_nic);
|
||||
break;
|
||||
|
|
@ -1072,6 +1077,7 @@ const struct ethtool_ops aq_ethtool_ops = {
|
|||
.set_rxfh = aq_ethtool_set_rss,
|
||||
.get_rxnfc = aq_ethtool_get_rxnfc,
|
||||
.set_rxnfc = aq_ethtool_set_rxnfc,
|
||||
.get_rx_ring_count = aq_ethtool_get_rx_ring_count,
|
||||
.get_msglevel = aq_get_msg_level,
|
||||
.set_msglevel = aq_set_msg_level,
|
||||
.get_sset_count = aq_ethtool_get_sset_count,
|
||||
|
|
|
|||
|
|
@ -1073,6 +1073,13 @@ static void be_set_msg_level(struct net_device *netdev, u32 level)
|
|||
adapter->msg_enable = level;
|
||||
}
|
||||
|
||||
static u32 be_get_rx_ring_count(struct net_device *netdev)
|
||||
{
|
||||
struct be_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
return adapter->num_rx_qs;
|
||||
}
|
||||
|
||||
static int be_get_rxfh_fields(struct net_device *netdev,
|
||||
struct ethtool_rxfh_fields *cmd)
|
||||
{
|
||||
|
|
@ -1117,28 +1124,6 @@ static int be_get_rxfh_fields(struct net_device *netdev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
|
||||
u32 *rule_locs)
|
||||
{
|
||||
struct be_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
if (!be_multi_rxq(adapter)) {
|
||||
dev_info(&adapter->pdev->dev,
|
||||
"ethtool::get_rxnfc: RX flow hashing is disabled\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = adapter->num_rx_qs;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int be_set_rxfh_fields(struct net_device *netdev,
|
||||
const struct ethtool_rxfh_fields *cmd,
|
||||
struct netlink_ext_ack *extack)
|
||||
|
|
@ -1293,6 +1278,12 @@ static int be_set_rxfh(struct net_device *netdev,
|
|||
u8 *hkey = rxfh->key;
|
||||
u8 rsstable[RSS_INDIR_TABLE_LEN];
|
||||
|
||||
if (!be_multi_rxq(adapter)) {
|
||||
dev_info(&adapter->pdev->dev,
|
||||
"ethtool::set_rxfh: RX flow hashing is disabled\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* We do not allow change in unsupported parameters */
|
||||
if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
|
||||
rxfh->hfunc != ETH_RSS_HASH_TOP)
|
||||
|
|
@ -1441,7 +1432,7 @@ const struct ethtool_ops be_ethtool_ops = {
|
|||
.get_ethtool_stats = be_get_ethtool_stats,
|
||||
.flash_device = be_do_flash,
|
||||
.self_test = be_self_test,
|
||||
.get_rxnfc = be_get_rxnfc,
|
||||
.get_rx_ring_count = be_get_rx_ring_count,
|
||||
.get_rxfh_fields = be_get_rxfh_fields,
|
||||
.set_rxfh_fields = be_set_rxfh_fields,
|
||||
.get_rxfh_indir_size = be_get_rxfh_indir_size,
|
||||
|
|
|
|||
|
|
@ -825,6 +825,13 @@ static int fbnic_get_cls_rule(struct fbnic_net *fbn, struct ethtool_rxnfc *cmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static u32 fbnic_get_rx_ring_count(struct net_device *netdev)
|
||||
{
|
||||
struct fbnic_net *fbn = netdev_priv(netdev);
|
||||
|
||||
return fbn->num_rx_queues;
|
||||
}
|
||||
|
||||
static int fbnic_get_rxnfc(struct net_device *netdev,
|
||||
struct ethtool_rxnfc *cmd, u32 *rule_locs)
|
||||
{
|
||||
|
|
@ -833,10 +840,6 @@ static int fbnic_get_rxnfc(struct net_device *netdev,
|
|||
u32 special = 0;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = fbn->num_rx_queues;
|
||||
ret = 0;
|
||||
break;
|
||||
case ETHTOOL_GRXCLSRULE:
|
||||
ret = fbnic_get_cls_rule(fbn, cmd);
|
||||
break;
|
||||
|
|
@ -1895,6 +1898,7 @@ static const struct ethtool_ops fbnic_ethtool_ops = {
|
|||
.get_sset_count = fbnic_get_sset_count,
|
||||
.get_rxnfc = fbnic_get_rxnfc,
|
||||
.set_rxnfc = fbnic_set_rxnfc,
|
||||
.get_rx_ring_count = fbnic_get_rx_ring_count,
|
||||
.get_rxfh_key_size = fbnic_get_rxfh_key_size,
|
||||
.get_rxfh_indir_size = fbnic_get_rxfh_indir_size,
|
||||
.get_rxfh = fbnic_get_rxfh,
|
||||
|
|
|
|||
|
|
@ -282,18 +282,11 @@ static void mana_get_ethtool_stats(struct net_device *ndev,
|
|||
}
|
||||
}
|
||||
|
||||
static int mana_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *cmd,
|
||||
u32 *rules)
|
||||
static u32 mana_get_rx_ring_count(struct net_device *ndev)
|
||||
{
|
||||
struct mana_port_context *apc = netdev_priv(ndev);
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = apc->num_queues;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
return apc->num_queues;
|
||||
}
|
||||
|
||||
static u32 mana_get_rxfh_key_size(struct net_device *ndev)
|
||||
|
|
@ -520,7 +513,7 @@ const struct ethtool_ops mana_ethtool_ops = {
|
|||
.get_ethtool_stats = mana_get_ethtool_stats,
|
||||
.get_sset_count = mana_get_sset_count,
|
||||
.get_strings = mana_get_strings,
|
||||
.get_rxnfc = mana_get_rxnfc,
|
||||
.get_rx_ring_count = mana_get_rx_ring_count,
|
||||
.get_rxfh_key_size = mana_get_rxfh_key_size,
|
||||
.get_rxfh_indir_size = mana_rss_indir_size,
|
||||
.get_rxfh = mana_get_rxfh,
|
||||
|
|
|
|||
|
|
@ -1435,15 +1435,19 @@ static int nfp_net_get_fs_loc(struct nfp_net *nn, u32 *rule_locs)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static u32 nfp_net_get_rx_ring_count(struct net_device *netdev)
|
||||
{
|
||||
struct nfp_net *nn = netdev_priv(netdev);
|
||||
|
||||
return nn->dp.num_rx_rings;
|
||||
}
|
||||
|
||||
static int nfp_net_get_rxnfc(struct net_device *netdev,
|
||||
struct ethtool_rxnfc *cmd, u32 *rule_locs)
|
||||
{
|
||||
struct nfp_net *nn = netdev_priv(netdev);
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = nn->dp.num_rx_rings;
|
||||
return 0;
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
cmd->rule_cnt = nn->fs.count;
|
||||
return 0;
|
||||
|
|
@ -2501,6 +2505,7 @@ static const struct ethtool_ops nfp_net_ethtool_ops = {
|
|||
.get_sset_count = nfp_net_get_sset_count,
|
||||
.get_rxnfc = nfp_net_get_rxnfc,
|
||||
.set_rxnfc = nfp_net_set_rxnfc,
|
||||
.get_rx_ring_count = nfp_net_get_rx_ring_count,
|
||||
.get_rxfh_indir_size = nfp_net_get_rxfh_indir_size,
|
||||
.get_rxfh_key_size = nfp_net_get_rxfh_key_size,
|
||||
.get_rxfh = nfp_net_get_rxfh,
|
||||
|
|
|
|||
|
|
@ -843,23 +843,11 @@ static int ionic_set_channels(struct net_device *netdev,
|
|||
return err;
|
||||
}
|
||||
|
||||
static int ionic_get_rxnfc(struct net_device *netdev,
|
||||
struct ethtool_rxnfc *info, u32 *rules)
|
||||
static u32 ionic_get_rx_ring_count(struct net_device *netdev)
|
||||
{
|
||||
struct ionic_lif *lif = netdev_priv(netdev);
|
||||
int err = 0;
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
info->data = lif->nxqs;
|
||||
break;
|
||||
default:
|
||||
netdev_dbg(netdev, "Command parameter %d is not supported\n",
|
||||
info->cmd);
|
||||
err = -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
return err;
|
||||
return lif->nxqs;
|
||||
}
|
||||
|
||||
static u32 ionic_get_rxfh_indir_size(struct net_device *netdev)
|
||||
|
|
@ -1152,7 +1140,7 @@ static const struct ethtool_ops ionic_ethtool_ops = {
|
|||
.get_strings = ionic_get_strings,
|
||||
.get_ethtool_stats = ionic_get_stats,
|
||||
.get_sset_count = ionic_get_sset_count,
|
||||
.get_rxnfc = ionic_get_rxnfc,
|
||||
.get_rx_ring_count = ionic_get_rx_ring_count,
|
||||
.get_rxfh_indir_size = ionic_get_rxfh_indir_size,
|
||||
.get_rxfh_key_size = ionic_get_rxfh_key_size,
|
||||
.get_rxfh = ionic_get_rxfh,
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ const struct ethtool_ops ef100_ethtool_ops = {
|
|||
.get_ethtool_stats = efx_ethtool_get_stats,
|
||||
.get_rxnfc = efx_ethtool_get_rxnfc,
|
||||
.set_rxnfc = efx_ethtool_set_rxnfc,
|
||||
.get_rx_ring_count = efx_ethtool_get_rx_ring_count,
|
||||
.reset = efx_ethtool_reset,
|
||||
|
||||
.get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size,
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@ const struct ethtool_ops efx_ethtool_ops = {
|
|||
.reset = efx_ethtool_reset,
|
||||
.get_rxnfc = efx_ethtool_get_rxnfc,
|
||||
.set_rxnfc = efx_ethtool_set_rxnfc,
|
||||
.get_rx_ring_count = efx_ethtool_get_rx_ring_count,
|
||||
.get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size,
|
||||
.get_rxfh_key_size = efx_ethtool_get_rxfh_key_size,
|
||||
.rxfh_per_ctx_fields = true,
|
||||
|
|
|
|||
|
|
@ -850,6 +850,13 @@ int efx_ethtool_get_rxfh_fields(struct net_device *net_dev,
|
|||
return rc;
|
||||
}
|
||||
|
||||
u32 efx_ethtool_get_rx_ring_count(struct net_device *net_dev)
|
||||
{
|
||||
struct efx_nic *efx = efx_netdev_priv(net_dev);
|
||||
|
||||
return efx->n_rx_channels;
|
||||
}
|
||||
|
||||
int efx_ethtool_get_rxnfc(struct net_device *net_dev,
|
||||
struct ethtool_rxnfc *info, u32 *rule_locs)
|
||||
{
|
||||
|
|
@ -858,10 +865,6 @@ int efx_ethtool_get_rxnfc(struct net_device *net_dev,
|
|||
s32 rc = 0;
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
info->data = efx->n_rx_channels;
|
||||
return 0;
|
||||
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
info->data = efx_filter_get_rx_id_limit(efx);
|
||||
if (info->data == 0)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ int efx_ethtool_set_fecparam(struct net_device *net_dev,
|
|||
struct ethtool_fecparam *fecparam);
|
||||
int efx_ethtool_get_rxnfc(struct net_device *net_dev,
|
||||
struct ethtool_rxnfc *info, u32 *rule_locs);
|
||||
u32 efx_ethtool_get_rx_ring_count(struct net_device *net_dev);
|
||||
int efx_ethtool_set_rxnfc(struct net_device *net_dev,
|
||||
struct ethtool_rxnfc *info);
|
||||
u32 efx_ethtool_get_rxfh_indir_size(struct net_device *net_dev);
|
||||
|
|
|
|||
|
|
@ -974,6 +974,13 @@ ef4_ethtool_get_rxfh_fields(struct net_device *net_dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static u32 ef4_ethtool_get_rx_ring_count(struct net_device *net_dev)
|
||||
{
|
||||
struct ef4_nic *efx = netdev_priv(net_dev);
|
||||
|
||||
return efx->n_rx_channels;
|
||||
}
|
||||
|
||||
static int
|
||||
ef4_ethtool_get_rxnfc(struct net_device *net_dev,
|
||||
struct ethtool_rxnfc *info, u32 *rule_locs)
|
||||
|
|
@ -981,10 +988,6 @@ ef4_ethtool_get_rxnfc(struct net_device *net_dev,
|
|||
struct ef4_nic *efx = netdev_priv(net_dev);
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
info->data = efx->n_rx_channels;
|
||||
return 0;
|
||||
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
info->data = ef4_filter_get_rx_id_limit(efx);
|
||||
if (info->data == 0)
|
||||
|
|
@ -1348,6 +1351,7 @@ const struct ethtool_ops ef4_ethtool_ops = {
|
|||
.reset = ef4_ethtool_reset,
|
||||
.get_rxnfc = ef4_ethtool_get_rxnfc,
|
||||
.set_rxnfc = ef4_ethtool_set_rxnfc,
|
||||
.get_rx_ring_count = ef4_ethtool_get_rx_ring_count,
|
||||
.get_rxfh_indir_size = ef4_ethtool_get_rxfh_indir_size,
|
||||
.get_rxfh = ef4_ethtool_get_rxfh,
|
||||
.set_rxfh = ef4_ethtool_set_rxfh,
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@ const struct ethtool_ops efx_siena_ethtool_ops = {
|
|||
.reset = efx_siena_ethtool_reset,
|
||||
.get_rxnfc = efx_siena_ethtool_get_rxnfc,
|
||||
.set_rxnfc = efx_siena_ethtool_set_rxnfc,
|
||||
.get_rx_ring_count = efx_siena_ethtool_get_rx_ring_count,
|
||||
.get_rxfh_indir_size = efx_siena_ethtool_get_rxfh_indir_size,
|
||||
.get_rxfh_key_size = efx_siena_ethtool_get_rxfh_key_size,
|
||||
.get_rxfh = efx_siena_ethtool_get_rxfh,
|
||||
|
|
|
|||
|
|
@ -841,6 +841,13 @@ int efx_siena_ethtool_get_rxfh_fields(struct net_device *net_dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
u32 efx_siena_ethtool_get_rx_ring_count(struct net_device *net_dev)
|
||||
{
|
||||
struct efx_nic *efx = netdev_priv(net_dev);
|
||||
|
||||
return efx->n_rx_channels;
|
||||
}
|
||||
|
||||
int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev,
|
||||
struct ethtool_rxnfc *info, u32 *rule_locs)
|
||||
{
|
||||
|
|
@ -849,10 +856,6 @@ int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev,
|
|||
s32 rc = 0;
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
info->data = efx->n_rx_channels;
|
||||
return 0;
|
||||
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
info->data = efx_filter_get_rx_id_limit(efx);
|
||||
if (info->data == 0)
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ int efx_siena_ethtool_set_fecparam(struct net_device *net_dev,
|
|||
struct ethtool_fecparam *fecparam);
|
||||
int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev,
|
||||
struct ethtool_rxnfc *info, u32 *rule_locs);
|
||||
u32 efx_siena_ethtool_get_rx_ring_count(struct net_device *net_dev);
|
||||
int efx_siena_ethtool_set_rxnfc(struct net_device *net_dev,
|
||||
struct ethtool_rxnfc *info);
|
||||
u32 efx_siena_ethtool_get_rxfh_indir_size(struct net_device *net_dev);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user