mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 18:49:22 -04:00
Merge branch 'eth-migrate-to-new-rxfh-callbacks-get-only-drivers'
Jakub Kicinski says: ==================== eth: migrate to new RXFH callbacks (get-only drivers) Migrate the drivers which only implement ETHTOOL_GRXFH to the recently added dedicated .get_rxfh_fields ethtool callback. v1: https://lore.kernel.org/20250613005409.3544529-1-kuba@kernel.org ==================== Link: https://patch.msgid.link/20250614180638.4166766-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -1730,6 +1730,60 @@ static int cxgb4_ntuple_get_filter(struct net_device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cxgb4_get_rxfh_fields(struct net_device *dev,
|
||||
struct ethtool_rxfh_fields *info)
|
||||
{
|
||||
const struct port_info *pi = netdev_priv(dev);
|
||||
unsigned int v = pi->rss_mode;
|
||||
|
||||
info->data = 0;
|
||||
switch (info->flow_type) {
|
||||
case TCP_V4_FLOW:
|
||||
if (v & FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST |
|
||||
RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
else if (v & FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case UDP_V4_FLOW:
|
||||
if ((v & FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN_F) &&
|
||||
(v & FW_RSS_VI_CONFIG_CMD_UDPEN_F))
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST |
|
||||
RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
else if (v & FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case SCTP_V4_FLOW:
|
||||
case AH_ESP_V4_FLOW:
|
||||
case IPV4_FLOW:
|
||||
if (v & FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case TCP_V6_FLOW:
|
||||
if (v & FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST |
|
||||
RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
else if (v & FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case UDP_V6_FLOW:
|
||||
if ((v & FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN_F) &&
|
||||
(v & FW_RSS_VI_CONFIG_CMD_UDPEN_F))
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST |
|
||||
RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
else if (v & FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case SCTP_V6_FLOW:
|
||||
case AH_ESP_V6_FLOW:
|
||||
case IPV6_FLOW:
|
||||
if (v & FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
|
||||
u32 *rules)
|
||||
{
|
||||
@@ -1739,56 +1793,6 @@ static int get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
|
||||
int ret = 0;
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_GRXFH: {
|
||||
unsigned int v = pi->rss_mode;
|
||||
|
||||
info->data = 0;
|
||||
switch (info->flow_type) {
|
||||
case TCP_V4_FLOW:
|
||||
if (v & FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST |
|
||||
RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
else if (v & FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case UDP_V4_FLOW:
|
||||
if ((v & FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN_F) &&
|
||||
(v & FW_RSS_VI_CONFIG_CMD_UDPEN_F))
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST |
|
||||
RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
else if (v & FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case SCTP_V4_FLOW:
|
||||
case AH_ESP_V4_FLOW:
|
||||
case IPV4_FLOW:
|
||||
if (v & FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case TCP_V6_FLOW:
|
||||
if (v & FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST |
|
||||
RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
else if (v & FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case UDP_V6_FLOW:
|
||||
if ((v & FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN_F) &&
|
||||
(v & FW_RSS_VI_CONFIG_CMD_UDPEN_F))
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST |
|
||||
RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
else if (v & FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case SCTP_V6_FLOW:
|
||||
case AH_ESP_V6_FLOW:
|
||||
case IPV6_FLOW:
|
||||
if (v & FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F)
|
||||
info->data = RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case ETHTOOL_GRXRINGS:
|
||||
info->data = pi->nqsets;
|
||||
return 0;
|
||||
@@ -2199,6 +2203,7 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
|
||||
.get_rxfh_indir_size = get_rss_table_size,
|
||||
.get_rxfh = get_rss_table,
|
||||
.set_rxfh = set_rss_table,
|
||||
.get_rxfh_fields = cxgb4_get_rxfh_fields,
|
||||
.self_test = cxgb4_self_test,
|
||||
.flash_device = set_flash,
|
||||
.get_ts_info = get_ts_info,
|
||||
|
||||
@@ -528,8 +528,10 @@ static int enic_grxclsrule(struct enic *enic, struct ethtool_rxnfc *cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int enic_get_rx_flow_hash(struct enic *enic, struct ethtool_rxnfc *cmd)
|
||||
static int enic_get_rx_flow_hash(struct net_device *dev,
|
||||
struct ethtool_rxfh_fields *cmd)
|
||||
{
|
||||
struct enic *enic = netdev_priv(dev);
|
||||
u8 rss_hash_type = 0;
|
||||
cmd->data = 0;
|
||||
|
||||
@@ -597,9 +599,6 @@ static int enic_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
ret = enic_grxclsrule(enic, cmd);
|
||||
spin_unlock_bh(&enic->rfs_h.lock);
|
||||
break;
|
||||
case ETHTOOL_GRXFH:
|
||||
ret = enic_get_rx_flow_hash(enic, cmd);
|
||||
break;
|
||||
default:
|
||||
ret = -EOPNOTSUPP;
|
||||
break;
|
||||
@@ -693,6 +692,7 @@ static const struct ethtool_ops enic_ethtool_ops = {
|
||||
.get_rxfh_key_size = enic_get_rxfh_key_size,
|
||||
.get_rxfh = enic_get_rxfh,
|
||||
.set_rxfh = enic_set_rxfh,
|
||||
.get_rxfh_fields = enic_get_rx_flow_hash,
|
||||
.get_link_ksettings = enic_get_ksettings,
|
||||
.get_ts_info = enic_get_ts_info,
|
||||
.get_channels = enic_get_channels,
|
||||
|
||||
@@ -467,7 +467,8 @@ static void enetc_get_rmon_stats(struct net_device *ndev,
|
||||
#define ENETC_RSSHASH_L3 (RXH_L2DA | RXH_VLAN | RXH_L3_PROTO | RXH_IP_SRC | \
|
||||
RXH_IP_DST)
|
||||
#define ENETC_RSSHASH_L4 (ENETC_RSSHASH_L3 | RXH_L4_B_0_1 | RXH_L4_B_2_3)
|
||||
static int enetc_get_rsshash(struct ethtool_rxnfc *rxnfc)
|
||||
static int enetc_get_rxfh_fields(struct net_device *netdev,
|
||||
struct ethtool_rxfh_fields *rxnfc)
|
||||
{
|
||||
static const u32 rsshash[] = {
|
||||
[TCP_V4_FLOW] = ENETC_RSSHASH_L4,
|
||||
@@ -584,9 +585,6 @@ static int enetc_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *rxnfc,
|
||||
case ETHTOOL_GRXRINGS:
|
||||
rxnfc->data = priv->num_rx_rings;
|
||||
break;
|
||||
case ETHTOOL_GRXFH:
|
||||
/* get RSS hash config */
|
||||
return enetc_get_rsshash(rxnfc);
|
||||
case ETHTOOL_GRXCLSRLCNT:
|
||||
/* total number of entries */
|
||||
rxnfc->data = priv->si->num_fs_entries;
|
||||
@@ -639,8 +637,6 @@ static int enetc4_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *rxnfc
|
||||
case ETHTOOL_GRXRINGS:
|
||||
rxnfc->data = priv->num_rx_rings;
|
||||
break;
|
||||
case ETHTOOL_GRXFH:
|
||||
return enetc_get_rsshash(rxnfc);
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
@@ -1228,6 +1224,7 @@ const struct ethtool_ops enetc_pf_ethtool_ops = {
|
||||
.get_rxfh_indir_size = enetc_get_rxfh_indir_size,
|
||||
.get_rxfh = enetc_get_rxfh,
|
||||
.set_rxfh = enetc_set_rxfh,
|
||||
.get_rxfh_fields = enetc_get_rxfh_fields,
|
||||
.get_ringparam = enetc_get_ringparam,
|
||||
.get_coalesce = enetc_get_coalesce,
|
||||
.set_coalesce = enetc_set_coalesce,
|
||||
@@ -1258,6 +1255,7 @@ const struct ethtool_ops enetc_vf_ethtool_ops = {
|
||||
.get_rxfh_indir_size = enetc_get_rxfh_indir_size,
|
||||
.get_rxfh = enetc_get_rxfh,
|
||||
.set_rxfh = enetc_set_rxfh,
|
||||
.get_rxfh_fields = enetc_get_rxfh_fields,
|
||||
.get_ringparam = enetc_get_ringparam,
|
||||
.get_coalesce = enetc_get_coalesce,
|
||||
.set_coalesce = enetc_set_coalesce,
|
||||
@@ -1284,6 +1282,7 @@ const struct ethtool_ops enetc4_pf_ethtool_ops = {
|
||||
.get_rxfh_indir_size = enetc_get_rxfh_indir_size,
|
||||
.get_rxfh = enetc_get_rxfh,
|
||||
.set_rxfh = enetc_set_rxfh,
|
||||
.get_rxfh_fields = enetc_get_rxfh_fields,
|
||||
};
|
||||
|
||||
void enetc_set_ethtool_ops(struct net_device *ndev)
|
||||
|
||||
@@ -2096,54 +2096,47 @@ static void e1000_get_strings(struct net_device __always_unused *netdev,
|
||||
}
|
||||
}
|
||||
|
||||
static int e1000_get_rxnfc(struct net_device *netdev,
|
||||
struct ethtool_rxnfc *info,
|
||||
u32 __always_unused *rule_locs)
|
||||
static int e1000_get_rxfh_fields(struct net_device *netdev,
|
||||
struct ethtool_rxfh_fields *info)
|
||||
{
|
||||
struct e1000_adapter *adapter = netdev_priv(netdev);
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
u32 mrqc;
|
||||
|
||||
info->data = 0;
|
||||
|
||||
switch (info->cmd) {
|
||||
case ETHTOOL_GRXFH: {
|
||||
struct e1000_adapter *adapter = netdev_priv(netdev);
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
u32 mrqc;
|
||||
mrqc = er32(MRQC);
|
||||
|
||||
mrqc = er32(MRQC);
|
||||
|
||||
if (!(mrqc & E1000_MRQC_RSS_FIELD_MASK))
|
||||
return 0;
|
||||
|
||||
switch (info->flow_type) {
|
||||
case TCP_V4_FLOW:
|
||||
if (mrqc & E1000_MRQC_RSS_FIELD_IPV4_TCP)
|
||||
info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case UDP_V4_FLOW:
|
||||
case SCTP_V4_FLOW:
|
||||
case AH_ESP_V4_FLOW:
|
||||
case IPV4_FLOW:
|
||||
if (mrqc & E1000_MRQC_RSS_FIELD_IPV4)
|
||||
info->data |= RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case TCP_V6_FLOW:
|
||||
if (mrqc & E1000_MRQC_RSS_FIELD_IPV6_TCP)
|
||||
info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case UDP_V6_FLOW:
|
||||
case SCTP_V6_FLOW:
|
||||
case AH_ESP_V6_FLOW:
|
||||
case IPV6_FLOW:
|
||||
if (mrqc & E1000_MRQC_RSS_FIELD_IPV6)
|
||||
info->data |= RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!(mrqc & E1000_MRQC_RSS_FIELD_MASK))
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (info->flow_type) {
|
||||
case TCP_V4_FLOW:
|
||||
if (mrqc & E1000_MRQC_RSS_FIELD_IPV4_TCP)
|
||||
info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case UDP_V4_FLOW:
|
||||
case SCTP_V4_FLOW:
|
||||
case AH_ESP_V4_FLOW:
|
||||
case IPV4_FLOW:
|
||||
if (mrqc & E1000_MRQC_RSS_FIELD_IPV4)
|
||||
info->data |= RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case TCP_V6_FLOW:
|
||||
if (mrqc & E1000_MRQC_RSS_FIELD_IPV6_TCP)
|
||||
info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case UDP_V6_FLOW:
|
||||
case SCTP_V6_FLOW:
|
||||
case AH_ESP_V6_FLOW:
|
||||
case IPV6_FLOW:
|
||||
if (mrqc & E1000_MRQC_RSS_FIELD_IPV6)
|
||||
info->data |= RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int e1000e_get_eee(struct net_device *netdev, struct ethtool_keee *edata)
|
||||
@@ -2352,7 +2345,7 @@ static const struct ethtool_ops e1000_ethtool_ops = {
|
||||
.get_sset_count = e1000e_get_sset_count,
|
||||
.get_coalesce = e1000_get_coalesce,
|
||||
.set_coalesce = e1000_set_coalesce,
|
||||
.get_rxnfc = e1000_get_rxnfc,
|
||||
.get_rxfh_fields = e1000_get_rxfh_fields,
|
||||
.get_ts_info = e1000e_get_ts_info,
|
||||
.get_eee = e1000e_get_eee,
|
||||
.set_eee = e1000e_set_eee,
|
||||
|
||||
@@ -913,23 +913,29 @@ static int lan743x_ethtool_get_sset_count(struct net_device *netdev, int sset)
|
||||
}
|
||||
}
|
||||
|
||||
static int lan743x_ethtool_get_rxfh_fields(struct net_device *netdev,
|
||||
struct ethtool_rxfh_fields *fields)
|
||||
{
|
||||
fields->data = 0;
|
||||
|
||||
switch (fields->flow_type) {
|
||||
case TCP_V4_FLOW:case UDP_V4_FLOW:
|
||||
case TCP_V6_FLOW:case UDP_V6_FLOW:
|
||||
fields->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case IPV4_FLOW: case IPV6_FLOW:
|
||||
fields->data |= RXH_IP_SRC | RXH_IP_DST;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lan743x_ethtool_get_rxnfc(struct net_device *netdev,
|
||||
struct ethtool_rxnfc *rxnfc,
|
||||
u32 *rule_locs)
|
||||
{
|
||||
switch (rxnfc->cmd) {
|
||||
case ETHTOOL_GRXFH:
|
||||
rxnfc->data = 0;
|
||||
switch (rxnfc->flow_type) {
|
||||
case TCP_V4_FLOW:case UDP_V4_FLOW:
|
||||
case TCP_V6_FLOW:case UDP_V6_FLOW:
|
||||
rxnfc->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case IPV4_FLOW: case IPV6_FLOW:
|
||||
rxnfc->data |= RXH_IP_SRC | RXH_IP_DST;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case ETHTOOL_GRXRINGS:
|
||||
rxnfc->data = LAN743X_USED_RX_CHANNELS;
|
||||
return 0;
|
||||
@@ -1368,6 +1374,7 @@ const struct ethtool_ops lan743x_ethtool_ops = {
|
||||
.get_rxfh_indir_size = lan743x_ethtool_get_rxfh_indir_size,
|
||||
.get_rxfh = lan743x_ethtool_get_rxfh,
|
||||
.set_rxfh = lan743x_ethtool_set_rxfh,
|
||||
.get_rxfh_fields = lan743x_ethtool_get_rxfh_fields,
|
||||
.get_ts_info = lan743x_ethtool_get_ts_info,
|
||||
.get_eee = lan743x_ethtool_get_eee,
|
||||
.set_eee = lan743x_ethtool_set_eee,
|
||||
|
||||
Reference in New Issue
Block a user