eth: sfc: siena: migrate to new RXFH callbacks

Migrate to new callbacks added by commit 9bb00786fc ("net: ethtool:
add dedicated callbacks for getting and setting rxfh fields").
This driver's RXFH config is read only / fixed so the conversion
is purely factoring out the handling into a helper.

Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
Link: https://patch.msgid.link/20250618203823.1336156-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2025-06-18 13:38:15 -07:00
parent 80ec96cb24
commit c58b9d1829
3 changed files with 43 additions and 37 deletions

View File

@ -264,6 +264,7 @@ const struct ethtool_ops efx_siena_ethtool_ops = {
.get_rxfh_key_size = efx_siena_ethtool_get_rxfh_key_size,
.get_rxfh = efx_siena_ethtool_get_rxfh,
.set_rxfh = efx_siena_ethtool_set_rxfh,
.get_rxfh_fields = efx_siena_ethtool_get_rxfh_fields,
.get_ts_info = efx_ethtool_get_ts_info,
.get_module_info = efx_siena_ethtool_get_module_info,
.get_module_eeprom = efx_siena_ethtool_get_module_eeprom,

View File

@ -801,6 +801,46 @@ static int efx_ethtool_get_class_rule(struct efx_nic *efx,
return rc;
}
int efx_siena_ethtool_get_rxfh_fields(struct net_device *net_dev,
struct ethtool_rxfh_fields *info)
{
struct efx_nic *efx = netdev_priv(net_dev);
__u64 data;
data = 0;
if (!efx_rss_active(&efx->rss_context)) /* No RSS */
goto out_setdata;
switch (info->flow_type) {
case UDP_V4_FLOW:
case UDP_V6_FLOW:
if (efx->rss_context.rx_hash_udp_4tuple)
data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 |
RXH_IP_SRC | RXH_IP_DST);
else
data = RXH_IP_SRC | RXH_IP_DST;
break;
case TCP_V4_FLOW:
case TCP_V6_FLOW:
data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 |
RXH_IP_SRC | RXH_IP_DST);
break;
case SCTP_V4_FLOW:
case SCTP_V6_FLOW:
case AH_ESP_V4_FLOW:
case AH_ESP_V6_FLOW:
case IPV4_FLOW:
case IPV6_FLOW:
data = RXH_IP_SRC | RXH_IP_DST;
break;
default:
break;
}
out_setdata:
info->data = data;
return 0;
}
int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev,
struct ethtool_rxnfc *info, u32 *rule_locs)
{
@ -813,43 +853,6 @@ int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev,
info->data = efx->n_rx_channels;
return 0;
case ETHTOOL_GRXFH: {
__u64 data;
data = 0;
if (!efx_rss_active(&efx->rss_context)) /* No RSS */
goto out_setdata;
switch (info->flow_type) {
case UDP_V4_FLOW:
case UDP_V6_FLOW:
if (efx->rss_context.rx_hash_udp_4tuple)
data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 |
RXH_IP_SRC | RXH_IP_DST);
else
data = RXH_IP_SRC | RXH_IP_DST;
break;
case TCP_V4_FLOW:
case TCP_V6_FLOW:
data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 |
RXH_IP_SRC | RXH_IP_DST);
break;
case SCTP_V4_FLOW:
case SCTP_V6_FLOW:
case AH_ESP_V4_FLOW:
case AH_ESP_V6_FLOW:
case IPV4_FLOW:
case IPV6_FLOW:
data = RXH_IP_SRC | RXH_IP_DST;
break;
default:
break;
}
out_setdata:
info->data = data;
return rc;
}
case ETHTOOL_GRXCLSRLCNT:
info->data = efx_filter_get_rx_id_limit(efx);
if (info->data == 0)

View File

@ -46,6 +46,8 @@ int efx_siena_ethtool_get_rxfh(struct net_device *net_dev,
int efx_siena_ethtool_set_rxfh(struct net_device *net_dev,
struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack);
int efx_siena_ethtool_get_rxfh_fields(struct net_device *net_dev,
struct ethtool_rxfh_fields *info);
int efx_siena_ethtool_reset(struct net_device *net_dev, u32 *flags);
int efx_siena_ethtool_get_module_eeprom(struct net_device *net_dev,
struct ethtool_eeprom *ee,