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-some-drivers-to-new-rxfh-callbacks'
Jakub Kicinski says: ==================== eth: migrate some 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/20250617014555.434790-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -721,9 +721,11 @@ static u16 ena_flow_data_to_flow_hash(u32 hash_fields)
|
||||
return data;
|
||||
}
|
||||
|
||||
static int ena_get_rss_hash(struct ena_com_dev *ena_dev,
|
||||
struct ethtool_rxnfc *cmd)
|
||||
static int ena_get_rxfh_fields(struct net_device *netdev,
|
||||
struct ethtool_rxfh_fields *cmd)
|
||||
{
|
||||
struct ena_adapter *adapter = netdev_priv(netdev);
|
||||
struct ena_com_dev *ena_dev = adapter->ena_dev;
|
||||
enum ena_admin_flow_hash_proto proto;
|
||||
u16 hash_fields;
|
||||
int rc;
|
||||
@@ -772,9 +774,12 @@ static int ena_get_rss_hash(struct ena_com_dev *ena_dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ena_set_rss_hash(struct ena_com_dev *ena_dev,
|
||||
struct ethtool_rxnfc *cmd)
|
||||
static int ena_set_rxfh_fields(struct net_device *netdev,
|
||||
const struct ethtool_rxfh_fields *cmd,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct ena_adapter *adapter = netdev_priv(netdev);
|
||||
struct ena_com_dev *ena_dev = adapter->ena_dev;
|
||||
enum ena_admin_flow_hash_proto proto;
|
||||
u16 hash_fields;
|
||||
|
||||
@@ -816,26 +821,6 @@ static int ena_set_rss_hash(struct ena_com_dev *ena_dev,
|
||||
return ena_com_fill_hash_ctrl(ena_dev, proto, hash_fields);
|
||||
}
|
||||
|
||||
static int ena_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *info)
|
||||
{
|
||||
struct ena_adapter *adapter = netdev_priv(netdev);
|
||||
int rc = 0;
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_SRXFH:
|
||||
rc = ena_set_rss_hash(adapter->ena_dev, info);
|
||||
break;
|
||||
case ETHTOOL_SRXCLSRLDEL:
|
||||
case ETHTOOL_SRXCLSRLINS:
|
||||
default:
|
||||
netif_err(adapter, drv, netdev,
|
||||
"Command parameter %d is not supported\n", info->cmd);
|
||||
rc = -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int ena_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *info,
|
||||
u32 *rules)
|
||||
{
|
||||
@@ -847,9 +832,6 @@ static int ena_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *info,
|
||||
info->data = adapter->num_io_queues;
|
||||
rc = 0;
|
||||
break;
|
||||
case ETHTOOL_GRXFH:
|
||||
rc = ena_get_rss_hash(adapter->ena_dev, info);
|
||||
break;
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
case ETHTOOL_GRXCLSRULE:
|
||||
case ETHTOOL_GRXCLSRLALL:
|
||||
@@ -1098,11 +1080,12 @@ static const struct ethtool_ops ena_ethtool_ops = {
|
||||
.get_strings = ena_get_ethtool_strings,
|
||||
.get_ethtool_stats = ena_get_ethtool_stats,
|
||||
.get_rxnfc = ena_get_rxnfc,
|
||||
.set_rxnfc = ena_set_rxnfc,
|
||||
.get_rxfh_indir_size = ena_get_rxfh_indir_size,
|
||||
.get_rxfh_key_size = ena_get_rxfh_key_size,
|
||||
.get_rxfh = ena_get_rxfh,
|
||||
.set_rxfh = ena_set_rxfh,
|
||||
.get_rxfh_fields = ena_get_rxfh_fields,
|
||||
.set_rxfh_fields = ena_set_rxfh_fields,
|
||||
.get_channels = ena_get_channels,
|
||||
.set_channels = ena_set_channels,
|
||||
.get_tunable = ena_get_tunable,
|
||||
|
||||
@@ -3318,8 +3318,11 @@ static int bnx2x_set_phys_id(struct net_device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bnx2x_get_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
|
||||
static int bnx2x_get_rxfh_fields(struct net_device *dev,
|
||||
struct ethtool_rxfh_fields *info)
|
||||
{
|
||||
struct bnx2x *bp = netdev_priv(dev);
|
||||
|
||||
switch (info->flow_type) {
|
||||
case TCP_V4_FLOW:
|
||||
case TCP_V6_FLOW:
|
||||
@@ -3361,20 +3364,21 @@ static int bnx2x_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
|
||||
case ETHTOOL_GRXRINGS:
|
||||
info->data = BNX2X_NUM_ETH_QUEUES(bp);
|
||||
return 0;
|
||||
case ETHTOOL_GRXFH:
|
||||
return bnx2x_get_rss_flags(bp, info);
|
||||
default:
|
||||
DP(BNX2X_MSG_ETHTOOL, "Command parameters not supported\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
}
|
||||
|
||||
static int bnx2x_set_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
|
||||
static int bnx2x_set_rxfh_fields(struct net_device *dev,
|
||||
const struct ethtool_rxfh_fields *info,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct bnx2x *bp = netdev_priv(dev);
|
||||
int udp_rss_requested;
|
||||
|
||||
DP(BNX2X_MSG_ETHTOOL,
|
||||
"Set rss flags command parameters: flow type = %d, data = %llu\n",
|
||||
"Set rss flags command parameters: flow type = %d, data = %u\n",
|
||||
info->flow_type, info->data);
|
||||
|
||||
switch (info->flow_type) {
|
||||
@@ -3460,19 +3464,6 @@ static int bnx2x_set_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
|
||||
}
|
||||
}
|
||||
|
||||
static int bnx2x_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info)
|
||||
{
|
||||
struct bnx2x *bp = netdev_priv(dev);
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_SRXFH:
|
||||
return bnx2x_set_rss_flags(bp, info);
|
||||
default:
|
||||
DP(BNX2X_MSG_ETHTOOL, "Command parameters not supported\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
}
|
||||
|
||||
static u32 bnx2x_get_rxfh_indir_size(struct net_device *dev)
|
||||
{
|
||||
return T_ETH_INDIRECTION_TABLE_SIZE;
|
||||
@@ -3684,10 +3675,11 @@ static const struct ethtool_ops bnx2x_ethtool_ops = {
|
||||
.set_phys_id = bnx2x_set_phys_id,
|
||||
.get_ethtool_stats = bnx2x_get_ethtool_stats,
|
||||
.get_rxnfc = bnx2x_get_rxnfc,
|
||||
.set_rxnfc = bnx2x_set_rxnfc,
|
||||
.get_rxfh_indir_size = bnx2x_get_rxfh_indir_size,
|
||||
.get_rxfh = bnx2x_get_rxfh,
|
||||
.set_rxfh = bnx2x_set_rxfh,
|
||||
.get_rxfh_fields = bnx2x_get_rxfh_fields,
|
||||
.set_rxfh_fields = bnx2x_set_rxfh_fields,
|
||||
.get_channels = bnx2x_get_channels,
|
||||
.set_channels = bnx2x_set_channels,
|
||||
.get_module_info = bnx2x_get_module_info,
|
||||
@@ -3711,10 +3703,11 @@ static const struct ethtool_ops bnx2x_vf_ethtool_ops = {
|
||||
.get_strings = bnx2x_get_strings,
|
||||
.get_ethtool_stats = bnx2x_get_ethtool_stats,
|
||||
.get_rxnfc = bnx2x_get_rxnfc,
|
||||
.set_rxnfc = bnx2x_set_rxnfc,
|
||||
.get_rxfh_indir_size = bnx2x_get_rxfh_indir_size,
|
||||
.get_rxfh = bnx2x_get_rxfh,
|
||||
.set_rxfh = bnx2x_set_rxfh,
|
||||
.get_rxfh_fields = bnx2x_get_rxfh_fields,
|
||||
.set_rxfh_fields = bnx2x_set_rxfh_fields,
|
||||
.get_channels = bnx2x_get_channels,
|
||||
.set_channels = bnx2x_set_channels,
|
||||
.get_link_ksettings = bnx2x_get_vf_link_ksettings,
|
||||
|
||||
@@ -1587,8 +1587,11 @@ static u64 get_ethtool_ipv6_rss(struct bnxt *bp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bnxt_grxfh(struct bnxt *bp, struct ethtool_rxnfc *cmd)
|
||||
static int bnxt_get_rxfh_fields(struct net_device *dev,
|
||||
struct ethtool_rxfh_fields *cmd)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
|
||||
cmd->data = 0;
|
||||
switch (cmd->flow_type) {
|
||||
case TCP_V4_FLOW:
|
||||
@@ -1647,10 +1650,15 @@ static int bnxt_grxfh(struct bnxt *bp, struct ethtool_rxnfc *cmd)
|
||||
#define RXH_4TUPLE (RXH_IP_SRC | RXH_IP_DST | RXH_L4_B_0_1 | RXH_L4_B_2_3)
|
||||
#define RXH_2TUPLE (RXH_IP_SRC | RXH_IP_DST)
|
||||
|
||||
static int bnxt_srxfh(struct bnxt *bp, struct ethtool_rxnfc *cmd)
|
||||
static int bnxt_set_rxfh_fields(struct net_device *dev,
|
||||
const struct ethtool_rxfh_fields *cmd,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
u32 rss_hash_cfg = bp->rss_hash_cfg;
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
int tuple, rc = 0;
|
||||
u32 rss_hash_cfg;
|
||||
|
||||
rss_hash_cfg = bp->rss_hash_cfg;
|
||||
|
||||
if (cmd->data == RXH_4TUPLE)
|
||||
tuple = 4;
|
||||
@@ -1768,10 +1776,6 @@ static int bnxt_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
rc = bnxt_grxclsrule(bp, cmd);
|
||||
break;
|
||||
|
||||
case ETHTOOL_GRXFH:
|
||||
rc = bnxt_grxfh(bp, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
rc = -EOPNOTSUPP;
|
||||
break;
|
||||
@@ -1786,10 +1790,6 @@ static int bnxt_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
|
||||
int rc;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_SRXFH:
|
||||
rc = bnxt_srxfh(bp, cmd);
|
||||
break;
|
||||
|
||||
case ETHTOOL_SRXCLSRLINS:
|
||||
rc = bnxt_srxclsrlins(bp, cmd);
|
||||
break;
|
||||
@@ -5521,6 +5521,8 @@ const struct ethtool_ops bnxt_ethtool_ops = {
|
||||
.get_rxfh_key_size = bnxt_get_rxfh_key_size,
|
||||
.get_rxfh = bnxt_get_rxfh,
|
||||
.set_rxfh = bnxt_set_rxfh,
|
||||
.get_rxfh_fields = bnxt_get_rxfh_fields,
|
||||
.set_rxfh_fields = bnxt_set_rxfh_fields,
|
||||
.create_rxfh_context = bnxt_create_rxfh_context,
|
||||
.modify_rxfh_context = bnxt_modify_rxfh_context,
|
||||
.remove_rxfh_context = bnxt_remove_rxfh_context,
|
||||
|
||||
@@ -516,8 +516,8 @@ static int nicvf_set_ringparam(struct net_device *netdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nicvf_get_rss_hash_opts(struct nicvf *nic,
|
||||
struct ethtool_rxnfc *info)
|
||||
static int nicvf_get_rxfh_fields(struct net_device *dev,
|
||||
struct ethtool_rxfh_fields *info)
|
||||
{
|
||||
info->data = 0;
|
||||
|
||||
@@ -552,25 +552,28 @@ static int nicvf_get_rxnfc(struct net_device *dev,
|
||||
info->data = nic->rx_queues;
|
||||
ret = 0;
|
||||
break;
|
||||
case ETHTOOL_GRXFH:
|
||||
return nicvf_get_rss_hash_opts(nic, info);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int nicvf_set_rss_hash_opts(struct nicvf *nic,
|
||||
struct ethtool_rxnfc *info)
|
||||
static int nicvf_set_rxfh_fields(struct net_device *dev,
|
||||
const struct ethtool_rxfh_fields *info,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct nicvf_rss_info *rss = &nic->rss_info;
|
||||
u64 rss_cfg = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG);
|
||||
struct nicvf *nic = netdev_priv(dev);
|
||||
struct nicvf_rss_info *rss;
|
||||
u64 rss_cfg;
|
||||
|
||||
rss = &nic->rss_info;
|
||||
rss_cfg = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG);
|
||||
|
||||
if (!rss->enable)
|
||||
netdev_err(nic->netdev,
|
||||
"RSS is disabled, hash cannot be set\n");
|
||||
|
||||
netdev_info(nic->netdev, "Set RSS flow type = %d, data = %lld\n",
|
||||
netdev_info(nic->netdev, "Set RSS flow type = %d, data = %u\n",
|
||||
info->flow_type, info->data);
|
||||
|
||||
if (!(info->data & RXH_IP_SRC) || !(info->data & RXH_IP_DST))
|
||||
@@ -628,19 +631,6 @@ static int nicvf_set_rss_hash_opts(struct nicvf *nic,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nicvf_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info)
|
||||
{
|
||||
struct nicvf *nic = netdev_priv(dev);
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_SRXFH:
|
||||
return nicvf_set_rss_hash_opts(nic, info);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static u32 nicvf_get_rxfh_key_size(struct net_device *netdev)
|
||||
{
|
||||
return RSS_HASH_KEY_SIZE * sizeof(u64);
|
||||
@@ -872,11 +862,12 @@ static const struct ethtool_ops nicvf_ethtool_ops = {
|
||||
.get_ringparam = nicvf_get_ringparam,
|
||||
.set_ringparam = nicvf_set_ringparam,
|
||||
.get_rxnfc = nicvf_get_rxnfc,
|
||||
.set_rxnfc = nicvf_set_rxnfc,
|
||||
.get_rxfh_key_size = nicvf_get_rxfh_key_size,
|
||||
.get_rxfh_indir_size = nicvf_get_rxfh_indir_size,
|
||||
.get_rxfh = nicvf_get_rxfh,
|
||||
.set_rxfh = nicvf_set_rxfh,
|
||||
.get_rxfh_fields = nicvf_get_rxfh_fields,
|
||||
.set_rxfh_fields = nicvf_set_rxfh_fields,
|
||||
.get_channels = nicvf_get_channels,
|
||||
.set_channels = nicvf_set_channels,
|
||||
.get_pauseparam = nicvf_get_pauseparam,
|
||||
|
||||
@@ -559,10 +559,13 @@ static int otx2_set_coalesce(struct net_device *netdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int otx2_get_rss_hash_opts(struct otx2_nic *pfvf,
|
||||
struct ethtool_rxnfc *nfc)
|
||||
static int otx2_get_rss_hash_opts(struct net_device *dev,
|
||||
struct ethtool_rxfh_fields *nfc)
|
||||
{
|
||||
struct otx2_rss_info *rss = &pfvf->hw.rss_info;
|
||||
struct otx2_nic *pfvf = netdev_priv(dev);
|
||||
struct otx2_rss_info *rss;
|
||||
|
||||
rss = &pfvf->hw.rss_info;
|
||||
|
||||
if (!(rss->flowkey_cfg &
|
||||
(NIX_FLOW_KEY_TYPE_IPV4 | NIX_FLOW_KEY_TYPE_IPV6)))
|
||||
@@ -609,12 +612,17 @@ static int otx2_get_rss_hash_opts(struct otx2_nic *pfvf,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int otx2_set_rss_hash_opts(struct otx2_nic *pfvf,
|
||||
struct ethtool_rxnfc *nfc)
|
||||
static int otx2_set_rss_hash_opts(struct net_device *dev,
|
||||
const struct ethtool_rxfh_fields *nfc,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct otx2_rss_info *rss = &pfvf->hw.rss_info;
|
||||
struct otx2_nic *pfvf = netdev_priv(dev);
|
||||
u32 rxh_l4 = RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
u32 rss_cfg = rss->flowkey_cfg;
|
||||
struct otx2_rss_info *rss;
|
||||
u32 rss_cfg;
|
||||
|
||||
rss = &pfvf->hw.rss_info;
|
||||
rss_cfg = rss->flowkey_cfg;
|
||||
|
||||
if (!rss->enable) {
|
||||
netdev_err(pfvf->netdev,
|
||||
@@ -743,8 +751,6 @@ static int otx2_get_rxnfc(struct net_device *dev,
|
||||
if (netif_running(dev) && ntuple)
|
||||
ret = otx2_get_all_flows(pfvf, nfc, rules);
|
||||
break;
|
||||
case ETHTOOL_GRXFH:
|
||||
return otx2_get_rss_hash_opts(pfvf, nfc);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -759,9 +765,6 @@ static int otx2_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *nfc)
|
||||
|
||||
pfvf->flow_cfg->ntuple = ntuple;
|
||||
switch (nfc->cmd) {
|
||||
case ETHTOOL_SRXFH:
|
||||
ret = otx2_set_rss_hash_opts(pfvf, nfc);
|
||||
break;
|
||||
case ETHTOOL_SRXCLSRLINS:
|
||||
if (netif_running(dev) && ntuple)
|
||||
ret = otx2_add_flow(pfvf, nfc);
|
||||
@@ -1329,6 +1332,8 @@ static const struct ethtool_ops otx2_ethtool_ops = {
|
||||
.get_rxfh_indir_size = otx2_get_rxfh_indir_size,
|
||||
.get_rxfh = otx2_get_rxfh,
|
||||
.set_rxfh = otx2_set_rxfh,
|
||||
.get_rxfh_fields = otx2_get_rss_hash_opts,
|
||||
.set_rxfh_fields = otx2_set_rss_hash_opts,
|
||||
.get_msglevel = otx2_get_msglevel,
|
||||
.set_msglevel = otx2_set_msglevel,
|
||||
.get_pauseparam = otx2_get_pauseparam,
|
||||
@@ -1442,6 +1447,8 @@ static const struct ethtool_ops otx2vf_ethtool_ops = {
|
||||
.get_rxfh_indir_size = otx2_get_rxfh_indir_size,
|
||||
.get_rxfh = otx2_get_rxfh,
|
||||
.set_rxfh = otx2_set_rxfh,
|
||||
.get_rxfh_fields = otx2_get_rss_hash_opts,
|
||||
.set_rxfh_fields = otx2_set_rss_hash_opts,
|
||||
.get_ringparam = otx2_get_ringparam,
|
||||
.set_ringparam = otx2_set_ringparam,
|
||||
.get_coalesce = otx2_get_coalesce,
|
||||
|
||||
Reference in New Issue
Block a user