mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 04:21:03 -04:00
Merge branch 'eth-migrate-more-drivers-to-new-rxfh-callbacks'
Jakub Kicinski says: ==================== eth: migrate more drivers to new RXFH callbacks Migrate a batch of drivers to the recently added dedicated .get_rxfh_fields and .set_rxfh_fields ethtool callbacks. ==================== Link: https://patch.msgid.link/20250617014848.436741-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -263,8 +263,8 @@ static void dpaa_get_strings(struct net_device *net_dev, u32 stringset,
|
||||
ethtool_puts(&data, dpaa_stats_global[i]);
|
||||
}
|
||||
|
||||
static int dpaa_get_hash_opts(struct net_device *dev,
|
||||
struct ethtool_rxnfc *cmd)
|
||||
static int dpaa_get_rxfh_fields(struct net_device *dev,
|
||||
struct ethtool_rxfh_fields *cmd)
|
||||
{
|
||||
struct dpaa_priv *priv = netdev_priv(dev);
|
||||
|
||||
@@ -299,22 +299,6 @@ static int dpaa_get_hash_opts(struct net_device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dpaa_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
u32 *unused)
|
||||
{
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXFH:
|
||||
ret = dpaa_get_hash_opts(dev, cmd);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dpaa_set_hash(struct net_device *net_dev, bool enable)
|
||||
{
|
||||
struct mac_device *mac_dev;
|
||||
@@ -329,8 +313,9 @@ static void dpaa_set_hash(struct net_device *net_dev, bool enable)
|
||||
priv->keygen_in_use = enable;
|
||||
}
|
||||
|
||||
static int dpaa_set_hash_opts(struct net_device *dev,
|
||||
struct ethtool_rxnfc *nfc)
|
||||
static int dpaa_set_rxfh_fields(struct net_device *dev,
|
||||
const struct ethtool_rxfh_fields *nfc,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
@@ -364,21 +349,6 @@ static int dpaa_set_hash_opts(struct net_device *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dpaa_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
|
||||
{
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_SRXFH:
|
||||
ret = dpaa_set_hash_opts(dev, cmd);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dpaa_get_ts_info(struct net_device *net_dev,
|
||||
struct kernel_ethtool_ts_info *info)
|
||||
{
|
||||
@@ -510,8 +480,8 @@ const struct ethtool_ops dpaa_ethtool_ops = {
|
||||
.get_strings = dpaa_get_strings,
|
||||
.get_link_ksettings = dpaa_get_link_ksettings,
|
||||
.set_link_ksettings = dpaa_set_link_ksettings,
|
||||
.get_rxnfc = dpaa_get_rxnfc,
|
||||
.set_rxnfc = dpaa_set_rxnfc,
|
||||
.get_rxfh_fields = dpaa_get_rxfh_fields,
|
||||
.set_rxfh_fields = dpaa_set_rxfh_fields,
|
||||
.get_ts_info = dpaa_get_ts_info,
|
||||
.get_coalesce = dpaa_get_coalesce,
|
||||
.set_coalesce = dpaa_set_coalesce,
|
||||
|
||||
@@ -719,13 +719,6 @@ static int dpaa2_eth_get_rxnfc(struct net_device *net_dev,
|
||||
int i, j = 0;
|
||||
|
||||
switch (rxnfc->cmd) {
|
||||
case ETHTOOL_GRXFH:
|
||||
/* we purposely ignore cmd->flow_type for now, because the
|
||||
* classifier only supports a single set of fields for all
|
||||
* protocols
|
||||
*/
|
||||
rxnfc->data = priv->rx_hash_fields;
|
||||
break;
|
||||
case ETHTOOL_GRXRINGS:
|
||||
rxnfc->data = dpaa2_eth_queue_count(priv);
|
||||
break;
|
||||
@@ -767,11 +760,6 @@ static int dpaa2_eth_set_rxnfc(struct net_device *net_dev,
|
||||
int err = 0;
|
||||
|
||||
switch (rxnfc->cmd) {
|
||||
case ETHTOOL_SRXFH:
|
||||
if ((rxnfc->data & DPAA2_RXH_SUPPORTED) != rxnfc->data)
|
||||
return -EOPNOTSUPP;
|
||||
err = dpaa2_eth_set_hash(net_dev, rxnfc->data);
|
||||
break;
|
||||
case ETHTOOL_SRXCLSRLINS:
|
||||
err = dpaa2_eth_update_cls_rule(net_dev, &rxnfc->fs, rxnfc->fs.location);
|
||||
break;
|
||||
@@ -785,6 +773,28 @@ static int dpaa2_eth_set_rxnfc(struct net_device *net_dev,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int dpaa2_eth_get_rxfh_fields(struct net_device *net_dev,
|
||||
struct ethtool_rxfh_fields *rxnfc)
|
||||
{
|
||||
struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
|
||||
|
||||
/* we purposely ignore cmd->flow_type for now, because the
|
||||
* classifier only supports a single set of fields for all
|
||||
* protocols
|
||||
*/
|
||||
rxnfc->data = priv->rx_hash_fields;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dpaa2_eth_set_rxfh_fields(struct net_device *net_dev,
|
||||
const struct ethtool_rxfh_fields *rxnfc,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
if ((rxnfc->data & DPAA2_RXH_SUPPORTED) != rxnfc->data)
|
||||
return -EOPNOTSUPP;
|
||||
return dpaa2_eth_set_hash(net_dev, rxnfc->data);
|
||||
}
|
||||
|
||||
int dpaa2_phc_index = -1;
|
||||
EXPORT_SYMBOL(dpaa2_phc_index);
|
||||
|
||||
@@ -939,6 +949,8 @@ const struct ethtool_ops dpaa2_ethtool_ops = {
|
||||
.get_strings = dpaa2_eth_get_strings,
|
||||
.get_rxnfc = dpaa2_eth_get_rxnfc,
|
||||
.set_rxnfc = dpaa2_eth_set_rxnfc,
|
||||
.get_rxfh_fields = dpaa2_eth_get_rxfh_fields,
|
||||
.set_rxfh_fields = dpaa2_eth_set_rxfh_fields,
|
||||
.get_ts_info = dpaa2_eth_get_ts_info,
|
||||
.get_tunable = dpaa2_eth_get_tunable,
|
||||
.set_tunable = dpaa2_eth_set_tunable,
|
||||
|
||||
@@ -1618,7 +1618,8 @@ int mvpp22_port_rss_ctx_indir_get(struct mvpp2_port *port, u32 port_ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mvpp2_ethtool_rxfh_set(struct mvpp2_port *port, struct ethtool_rxnfc *info)
|
||||
int mvpp2_ethtool_rxfh_set(struct mvpp2_port *port,
|
||||
const struct ethtool_rxfh_fields *info)
|
||||
{
|
||||
u16 hash_opts = 0;
|
||||
u32 flow_type;
|
||||
@@ -1656,7 +1657,8 @@ int mvpp2_ethtool_rxfh_set(struct mvpp2_port *port, struct ethtool_rxnfc *info)
|
||||
return mvpp2_port_rss_hash_opts_set(port, flow_type, hash_opts);
|
||||
}
|
||||
|
||||
int mvpp2_ethtool_rxfh_get(struct mvpp2_port *port, struct ethtool_rxnfc *info)
|
||||
int mvpp2_ethtool_rxfh_get(struct mvpp2_port *port,
|
||||
struct ethtool_rxfh_fields *info)
|
||||
{
|
||||
unsigned long hash_opts;
|
||||
u32 flow_type;
|
||||
|
||||
@@ -272,8 +272,10 @@ int mvpp22_port_rss_ctx_indir_set(struct mvpp2_port *port, u32 rss_ctx,
|
||||
int mvpp22_port_rss_ctx_indir_get(struct mvpp2_port *port, u32 rss_ctx,
|
||||
u32 *indir);
|
||||
|
||||
int mvpp2_ethtool_rxfh_get(struct mvpp2_port *port, struct ethtool_rxnfc *info);
|
||||
int mvpp2_ethtool_rxfh_set(struct mvpp2_port *port, struct ethtool_rxnfc *info);
|
||||
int mvpp2_ethtool_rxfh_get(struct mvpp2_port *port,
|
||||
struct ethtool_rxfh_fields *info);
|
||||
int mvpp2_ethtool_rxfh_set(struct mvpp2_port *port,
|
||||
const struct ethtool_rxfh_fields *info);
|
||||
|
||||
void mvpp2_cls_init(struct mvpp2 *priv);
|
||||
|
||||
|
||||
@@ -5588,9 +5588,6 @@ static int mvpp2_ethtool_get_rxnfc(struct net_device *dev,
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_GRXFH:
|
||||
ret = mvpp2_ethtool_rxfh_get(port, info);
|
||||
break;
|
||||
case ETHTOOL_GRXRINGS:
|
||||
info->data = port->nrxqs;
|
||||
break;
|
||||
@@ -5628,9 +5625,6 @@ static int mvpp2_ethtool_set_rxnfc(struct net_device *dev,
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_SRXFH:
|
||||
ret = mvpp2_ethtool_rxfh_set(port, info);
|
||||
break;
|
||||
case ETHTOOL_SRXCLSRLINS:
|
||||
ret = mvpp2_ethtool_cls_rule_ins(port, info);
|
||||
break;
|
||||
@@ -5747,6 +5741,29 @@ static int mvpp2_ethtool_set_rxfh(struct net_device *dev,
|
||||
return mvpp2_modify_rxfh_context(dev, NULL, rxfh, extack);
|
||||
}
|
||||
|
||||
static int mvpp2_ethtool_get_rxfh_fields(struct net_device *dev,
|
||||
struct ethtool_rxfh_fields *info)
|
||||
{
|
||||
struct mvpp2_port *port = netdev_priv(dev);
|
||||
|
||||
if (!mvpp22_rss_is_supported(port))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return mvpp2_ethtool_rxfh_get(port, info);
|
||||
}
|
||||
|
||||
static int mvpp2_ethtool_set_rxfh_fields(struct net_device *dev,
|
||||
const struct ethtool_rxfh_fields *info,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct mvpp2_port *port = netdev_priv(dev);
|
||||
|
||||
if (!mvpp22_rss_is_supported(port))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return mvpp2_ethtool_rxfh_set(port, info);
|
||||
}
|
||||
|
||||
static int mvpp2_ethtool_get_eee(struct net_device *dev,
|
||||
struct ethtool_keee *eee)
|
||||
{
|
||||
@@ -5813,6 +5830,8 @@ static const struct ethtool_ops mvpp2_eth_tool_ops = {
|
||||
.get_rxfh_indir_size = mvpp2_ethtool_get_rxfh_indir_size,
|
||||
.get_rxfh = mvpp2_ethtool_get_rxfh,
|
||||
.set_rxfh = mvpp2_ethtool_set_rxfh,
|
||||
.get_rxfh_fields = mvpp2_ethtool_get_rxfh_fields,
|
||||
.set_rxfh_fields = mvpp2_ethtool_set_rxfh_fields,
|
||||
.create_rxfh_context = mvpp2_create_rxfh_context,
|
||||
.modify_rxfh_context = mvpp2_modify_rxfh_context,
|
||||
.remove_rxfh_context = mvpp2_remove_rxfh_context,
|
||||
|
||||
@@ -308,8 +308,8 @@ static int sxgbe_set_coalesce(struct net_device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sxgbe_get_rss_hash_opts(struct sxgbe_priv_data *priv,
|
||||
struct ethtool_rxnfc *cmd)
|
||||
static int sxgbe_get_rxfh_fields(struct net_device *dev,
|
||||
struct ethtool_rxfh_fields *cmd)
|
||||
{
|
||||
cmd->data = 0;
|
||||
|
||||
@@ -344,26 +344,11 @@ static int sxgbe_get_rss_hash_opts(struct sxgbe_priv_data *priv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sxgbe_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
u32 *rule_locs)
|
||||
static int sxgbe_set_rxfh_fields(struct net_device *dev,
|
||||
const struct ethtool_rxfh_fields *cmd,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct sxgbe_priv_data *priv = netdev_priv(dev);
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXFH:
|
||||
ret = sxgbe_get_rss_hash_opts(priv, cmd);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sxgbe_set_rss_hash_opt(struct sxgbe_priv_data *priv,
|
||||
struct ethtool_rxnfc *cmd)
|
||||
{
|
||||
u32 reg_val = 0;
|
||||
|
||||
/* RSS does not support anything other than hashing
|
||||
@@ -421,22 +406,6 @@ static int sxgbe_set_rss_hash_opt(struct sxgbe_priv_data *priv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sxgbe_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
|
||||
{
|
||||
struct sxgbe_priv_data *priv = netdev_priv(dev);
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_SRXFH:
|
||||
ret = sxgbe_set_rss_hash_opt(priv, cmd);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sxgbe_get_regs(struct net_device *dev,
|
||||
struct ethtool_regs *regs, void *space)
|
||||
{
|
||||
@@ -489,8 +458,8 @@ static const struct ethtool_ops sxgbe_ethtool_ops = {
|
||||
.get_channels = sxgbe_get_channels,
|
||||
.get_coalesce = sxgbe_get_coalesce,
|
||||
.set_coalesce = sxgbe_set_coalesce,
|
||||
.get_rxnfc = sxgbe_get_rxnfc,
|
||||
.set_rxnfc = sxgbe_set_rxnfc,
|
||||
.get_rxfh_fields = sxgbe_get_rxfh_fields,
|
||||
.set_rxfh_fields = sxgbe_set_rxfh_fields,
|
||||
.get_regs = sxgbe_get_regs,
|
||||
.get_regs_len = sxgbe_get_regs_len,
|
||||
.get_eee = sxgbe_get_eee,
|
||||
|
||||
@@ -7077,8 +7077,10 @@ static int niu_ethflow_to_flowkey(u64 ethflow, u64 *flow_key)
|
||||
|
||||
}
|
||||
|
||||
static int niu_get_hash_opts(struct niu *np, struct ethtool_rxnfc *nfc)
|
||||
static int niu_get_rxfh_fields(struct net_device *dev,
|
||||
struct ethtool_rxfh_fields *nfc)
|
||||
{
|
||||
struct niu *np = netdev_priv(dev);
|
||||
u64 class;
|
||||
|
||||
nfc->data = 0;
|
||||
@@ -7290,9 +7292,6 @@ static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
int ret = 0;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXFH:
|
||||
ret = niu_get_hash_opts(np, cmd);
|
||||
break;
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = np->num_rx_rings;
|
||||
break;
|
||||
@@ -7313,8 +7312,11 @@ static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int niu_set_hash_opts(struct niu *np, struct ethtool_rxnfc *nfc)
|
||||
static int niu_set_rxfh_fields(struct net_device *dev,
|
||||
const struct ethtool_rxfh_fields *nfc,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct niu *np = netdev_priv(dev);
|
||||
u64 class;
|
||||
u64 flow_key = 0;
|
||||
unsigned long flags;
|
||||
@@ -7656,9 +7658,6 @@ static int niu_set_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
|
||||
int ret = 0;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_SRXFH:
|
||||
ret = niu_set_hash_opts(np, cmd);
|
||||
break;
|
||||
case ETHTOOL_SRXCLSRLINS:
|
||||
ret = niu_add_ethtool_tcam_entry(np, cmd);
|
||||
break;
|
||||
@@ -7912,6 +7911,8 @@ static const struct ethtool_ops niu_ethtool_ops = {
|
||||
.set_phys_id = niu_set_phys_id,
|
||||
.get_rxnfc = niu_get_nfc,
|
||||
.set_rxnfc = niu_set_nfc,
|
||||
.get_rxfh_fields = niu_get_rxfh_fields,
|
||||
.set_rxfh_fields = niu_set_rxfh_fields,
|
||||
.get_link_ksettings = niu_get_link_ksettings,
|
||||
.set_link_ksettings = niu_set_link_ksettings,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user