Skip to content

Commit b718c88

Browse files
ecree-solarflaredavem330
authored andcommitted
sfc: report 4-tuple UDP hashing to ethtool, if it's enabled
Signed-off-by: Edward Cree <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a33a4c7 commit b718c88

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

drivers/net/ethernet/sfc/ef10.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,8 +2319,10 @@ static void efx_ef10_set_rss_flags(struct efx_nic *efx, u32 context)
23192319
flags |= RSS_MODE_HASH_PORTS << MC_CMD_RSS_CONTEXT_GET_FLAGS_OUT_UDP_IPV4_RSS_MODE_LBN;
23202320
flags |= RSS_MODE_HASH_PORTS << MC_CMD_RSS_CONTEXT_GET_FLAGS_OUT_UDP_IPV6_RSS_MODE_LBN;
23212321
MCDI_SET_DWORD(inbuf, RSS_CONTEXT_SET_FLAGS_IN_FLAGS, flags);
2322-
efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_SET_FLAGS, inbuf, sizeof(inbuf),
2323-
NULL, 0, NULL);
2322+
if (!efx_mcdi_rpc(efx, MC_CMD_RSS_CONTEXT_SET_FLAGS, inbuf, sizeof(inbuf),
2323+
NULL, 0, NULL))
2324+
/* Succeeded, so UDP 4-tuple is now enabled */
2325+
efx->rx_hash_udp_4tuple = true;
23242326
}
23252327

23262328
static int efx_ef10_alloc_rss_context(struct efx_nic *efx, u32 *context,

drivers/net/ethernet/sfc/ethtool.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -968,20 +968,24 @@ efx_ethtool_get_rxnfc(struct net_device *net_dev,
968968

969969
info->data = 0;
970970
switch (info->flow_type) {
971+
case UDP_V4_FLOW:
972+
if (efx->rx_hash_udp_4tuple)
973+
/* fall through */
971974
case TCP_V4_FLOW:
972-
info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
975+
info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
973976
/* fall through */
974-
case UDP_V4_FLOW:
975977
case SCTP_V4_FLOW:
976978
case AH_ESP_V4_FLOW:
977979
case IPV4_FLOW:
978980
info->data |= RXH_IP_SRC | RXH_IP_DST;
979981
min_revision = EFX_REV_FALCON_B0;
980982
break;
983+
case UDP_V6_FLOW:
984+
if (efx->rx_hash_udp_4tuple)
985+
/* fall through */
981986
case TCP_V6_FLOW:
982-
info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
987+
info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
983988
/* fall through */
984-
case UDP_V6_FLOW:
985989
case SCTP_V6_FLOW:
986990
case AH_ESP_V6_FLOW:
987991
case IPV6_FLOW:

drivers/net/ethernet/sfc/net_driver.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@ struct vfdi_status;
853853
* @rx_hash_key: Toeplitz hash key for RSS
854854
* @rx_indir_table: Indirection table for RSS
855855
* @rx_scatter: Scatter mode enabled for receives
856+
* @rx_hash_udp_4tuple: UDP 4-tuple hashing enabled
856857
* @int_error_count: Number of internal errors seen recently
857858
* @int_error_expire: Time at which error count will be expired
858859
* @irq_soft_enabled: Are IRQs soft-enabled? If not, IRQ handler will
@@ -990,6 +991,7 @@ struct efx_nic {
990991
u8 rx_hash_key[40];
991992
u32 rx_indir_table[128];
992993
bool rx_scatter;
994+
bool rx_hash_udp_4tuple;
993995

994996
unsigned int_error_count;
995997
unsigned long int_error_expire;

0 commit comments

Comments
 (0)