On 01.02.2024 04:33, Takeru Hayasaka wrote: > Following the addition of new GTP RSS hash options to ethtool.h, this patch > implements the corresponding RSS settings for GTP packets in the Intel ice > driver. It enables users to configure RSS for GTP-U and GTP-C traffic over IPv4 > and IPv6, utilizing the newly defined hash options. > > The implementation covers the handling of gtpu(4|6), gtpc(4|6), gtpc(4|6)t, > gtpu(4|6)e, gtpu(4|6)u, and gtpu(4|6)d traffic, providing enhanced load > distribution for GTP traffic across multiple processing units. Reviewed-by: Marcin Szycik <marcin.szycik@xxxxxxxxxxxxxxx> > Signed-off-by: Takeru Hayasaka <hayatake396@xxxxxxxxx> > --- > .../device_drivers/ethernet/intel/ice.rst | 21 ++++- > drivers/net/ethernet/intel/ice/ice_ethtool.c | 82 +++++++++++++++++++ > drivers/net/ethernet/intel/ice/ice_flow.h | 31 +++++-- > drivers/net/ethernet/intel/ice/ice_lib.c | 37 +++++++++ > 4 files changed, 162 insertions(+), 9 deletions(-) > > diff --git a/Documentation/networking/device_drivers/ethernet/intel/ice.rst b/Documentation/networking/device_drivers/ethernet/intel/ice.rst > index 5038e54586af..934752f675ba 100644 > --- a/Documentation/networking/device_drivers/ethernet/intel/ice.rst > +++ b/Documentation/networking/device_drivers/ethernet/intel/ice.rst > @@ -368,15 +368,28 @@ more options for Receive Side Scaling (RSS) hash byte configuration. > # ethtool -N <ethX> rx-flow-hash <type> <option> > > Where <type> is: > - tcp4 signifying TCP over IPv4 > - udp4 signifying UDP over IPv4 > - tcp6 signifying TCP over IPv6 > - udp6 signifying UDP over IPv6 > + tcp4 signifying TCP over IPv4 > + udp4 signifying UDP over IPv4 > + gtpc4 signifying GTP-C over IPv4 > + gtpc4t signifying GTP-C (include TEID) over IPv4 > + gtpu4 signifying GTP-U over IPV4 > + gtpu4e signifying GTP-U and Extension Header over IPV4 > + gtpu4u signifying GTP-U PSC Uplink over IPV4 > + gtpu4d signifying GTP-U PSC Downlink over IPV4 > + tcp6 signifying TCP over IPv6 > + udp6 signifying UDP over IPv6 > + gtpc6 signifying GTP-C over IPv6 > + gtpc6t signifying GTP-C (include TEID) over IPv6 > + gtpu6 signifying GTP-U over IPV6 > + gtpu6e signifying GTP-U and Extension Header over IPV6 > + gtpu6u signifying GTP-U PSC Uplink over IPV6 > + gtpu6d signifying GTP-U PSC Downlink over IPV6 > And <option> is one or more of: > s Hash on the IP source address of the Rx packet. > d Hash on the IP destination address of the Rx packet. > f Hash on bytes 0 and 1 of the Layer 4 header of the Rx packet. > n Hash on bytes 2 and 3 of the Layer 4 header of the Rx packet. > + e Hash on GTP Packet on TEID (4bytes) of the Rx packet. > > > Accelerated Receive Flow Steering (aRFS) > diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c > index a19b06f18e40..d0e05032f464 100644 > --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c > +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c > @@ -2486,6 +2486,24 @@ static u32 ice_parse_hdrs(struct ethtool_rxnfc *nfc) > case SCTP_V4_FLOW: > hdrs |= ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4; > break; > + case GTPU_V4_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPU_IP | ICE_FLOW_SEG_HDR_IPV4; > + break; > + case GTPC_V4_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPC | ICE_FLOW_SEG_HDR_IPV4; > + break; > + case GTPC_TEID_V4_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPC_TEID | ICE_FLOW_SEG_HDR_IPV4; > + break; > + case GTPU_EH_V4_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPU_EH | ICE_FLOW_SEG_HDR_IPV4; > + break; > + case GTPU_UL_V4_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPU_UP | ICE_FLOW_SEG_HDR_IPV4; > + break; > + case GTPU_DL_V4_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPU_DWN | ICE_FLOW_SEG_HDR_IPV4; > + break; > case TCP_V6_FLOW: > hdrs |= ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6; > break; > @@ -2495,6 +2513,24 @@ static u32 ice_parse_hdrs(struct ethtool_rxnfc *nfc) > case SCTP_V6_FLOW: > hdrs |= ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV6; > break; > + case GTPU_V6_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPU_IP | ICE_FLOW_SEG_HDR_IPV6; > + break; > + case GTPC_V6_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPC | ICE_FLOW_SEG_HDR_IPV6; > + break; > + case GTPC_TEID_V6_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPC_TEID | ICE_FLOW_SEG_HDR_IPV6; > + break; > + case GTPU_EH_V6_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPU_EH | ICE_FLOW_SEG_HDR_IPV6; > + break; > + case GTPU_UL_V6_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPU_UP | ICE_FLOW_SEG_HDR_IPV6; > + break; > + case GTPU_DL_V6_FLOW: > + hdrs |= ICE_FLOW_SEG_HDR_GTPU_DWN | ICE_FLOW_SEG_HDR_IPV6; > + break; > default: > break; > } > @@ -2518,6 +2554,12 @@ static u64 ice_parse_hash_flds(struct ethtool_rxnfc *nfc, bool symm) > case TCP_V4_FLOW: > case UDP_V4_FLOW: > case SCTP_V4_FLOW: > + case GTPU_V4_FLOW: > + case GTPC_V4_FLOW: > + case GTPC_TEID_V4_FLOW: > + case GTPU_EH_V4_FLOW: > + case GTPU_UL_V4_FLOW: > + case GTPU_DL_V4_FLOW: > if (nfc->data & RXH_IP_SRC) > hfld |= ICE_FLOW_HASH_FLD_IPV4_SA; > if (nfc->data & RXH_IP_DST) > @@ -2526,6 +2568,12 @@ static u64 ice_parse_hash_flds(struct ethtool_rxnfc *nfc, bool symm) > case TCP_V6_FLOW: > case UDP_V6_FLOW: > case SCTP_V6_FLOW: > + case GTPU_V6_FLOW: > + case GTPC_V6_FLOW: > + case GTPC_TEID_V6_FLOW: > + case GTPU_EH_V6_FLOW: > + case GTPU_UL_V6_FLOW: > + case GTPU_DL_V6_FLOW: > if (nfc->data & RXH_IP_SRC) > hfld |= ICE_FLOW_HASH_FLD_IPV6_SA; > if (nfc->data & RXH_IP_DST) > @@ -2564,6 +2612,33 @@ static u64 ice_parse_hash_flds(struct ethtool_rxnfc *nfc, bool symm) > } > } > > + if (nfc->data & RXH_GTP_TEID) { > + switch (nfc->flow_type) { > + case GTPC_TEID_V4_FLOW: > + case GTPC_TEID_V6_FLOW: > + hfld |= ICE_FLOW_HASH_FLD_GTPC_TEID; > + break; > + case GTPU_V4_FLOW: > + case GTPU_V6_FLOW: > + hfld |= ICE_FLOW_HASH_FLD_GTPU_IP_TEID; > + break; > + case GTPU_EH_V4_FLOW: > + case GTPU_EH_V6_FLOW: > + hfld |= ICE_FLOW_HASH_FLD_GTPU_EH_TEID; > + break; > + case GTPU_UL_V4_FLOW: > + case GTPU_UL_V6_FLOW: > + hfld |= ICE_FLOW_HASH_FLD_GTPU_UP_TEID; > + break; > + case GTPU_DL_V4_FLOW: > + case GTPU_DL_V6_FLOW: > + hfld |= ICE_FLOW_HASH_FLD_GTPU_DWN_TEID; > + break; > + default: > + break; > + } > + } > + > return hfld; > } > > @@ -2676,6 +2751,13 @@ ice_get_rss_hash_opt(struct ice_vsi *vsi, struct ethtool_rxnfc *nfc) > hash_flds & ICE_FLOW_HASH_FLD_UDP_DST_PORT || > hash_flds & ICE_FLOW_HASH_FLD_SCTP_DST_PORT) > nfc->data |= (u64)RXH_L4_B_2_3; > + > + if (hash_flds & ICE_FLOW_HASH_FLD_GTPC_TEID || > + hash_flds & ICE_FLOW_HASH_FLD_GTPU_IP_TEID || > + hash_flds & ICE_FLOW_HASH_FLD_GTPU_EH_TEID || > + hash_flds & ICE_FLOW_HASH_FLD_GTPU_UP_TEID || > + hash_flds & ICE_FLOW_HASH_FLD_GTPU_DWN_TEID) > + nfc->data |= (u64)RXH_GTP_TEID; > } > > /** > diff --git a/drivers/net/ethernet/intel/ice/ice_flow.h b/drivers/net/ethernet/intel/ice/ice_flow.h > index ff82915ab497..2fd2e0cb483d 100644 > --- a/drivers/net/ethernet/intel/ice/ice_flow.h > +++ b/drivers/net/ethernet/intel/ice/ice_flow.h > @@ -37,13 +37,13 @@ > #define ICE_HASH_SCTP_IPV4 (ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_SCTP_PORT) > #define ICE_HASH_SCTP_IPV6 (ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_SCTP_PORT) > > -#define ICE_FLOW_HASH_GTP_TEID \ > +#define ICE_FLOW_HASH_GTP_C_TEID \ > (BIT_ULL(ICE_FLOW_FIELD_IDX_GTPC_TEID)) > > -#define ICE_FLOW_HASH_GTP_IPV4_TEID \ > - (ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_GTP_TEID) > -#define ICE_FLOW_HASH_GTP_IPV6_TEID \ > - (ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_GTP_TEID) > +#define ICE_FLOW_HASH_GTP_C_IPV4_TEID \ > + (ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_GTP_C_TEID) > +#define ICE_FLOW_HASH_GTP_C_IPV6_TEID \ > + (ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_GTP_C_TEID) > > #define ICE_FLOW_HASH_GTP_U_TEID \ > (BIT_ULL(ICE_FLOW_FIELD_IDX_GTPU_IP_TEID)) > @@ -66,6 +66,20 @@ > (ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_GTP_U_EH_TEID | \ > ICE_FLOW_HASH_GTP_U_EH_QFI) > > +#define ICE_FLOW_HASH_GTP_U_UP \ > + (BIT_ULL(ICE_FLOW_FIELD_IDX_GTPU_UP_TEID)) > +#define ICE_FLOW_HASH_GTP_U_DWN \ > + (BIT_ULL(ICE_FLOW_FIELD_IDX_GTPU_DWN_TEID)) > + > +#define ICE_FLOW_HASH_GTP_U_IPV4_UP \ > + (ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_GTP_U_UP) > +#define ICE_FLOW_HASH_GTP_U_IPV6_UP \ > + (ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_GTP_U_UP) > +#define ICE_FLOW_HASH_GTP_U_IPV4_DWN \ > + (ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_GTP_U_DWN) > +#define ICE_FLOW_HASH_GTP_U_IPV6_DWN \ > + (ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_GTP_U_DWN) > + > #define ICE_FLOW_HASH_PPPOE_SESS_ID \ > (BIT_ULL(ICE_FLOW_FIELD_IDX_PPPOE_SESS_ID)) > > @@ -242,6 +256,13 @@ enum ice_flow_field { > #define ICE_FLOW_HASH_FLD_SCTP_DST_PORT \ > BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT) > > +#define ICE_FLOW_HASH_FLD_GTPC_TEID BIT_ULL(ICE_FLOW_FIELD_IDX_GTPC_TEID) > +#define ICE_FLOW_HASH_FLD_GTPU_IP_TEID BIT_ULL(ICE_FLOW_FIELD_IDX_GTPU_IP_TEID) > +#define ICE_FLOW_HASH_FLD_GTPU_EH_TEID BIT_ULL(ICE_FLOW_FIELD_IDX_GTPU_EH_TEID) > +#define ICE_FLOW_HASH_FLD_GTPU_UP_TEID BIT_ULL(ICE_FLOW_FIELD_IDX_GTPU_UP_TEID) > +#define ICE_FLOW_HASH_FLD_GTPU_DWN_TEID \ > + BIT_ULL(ICE_FLOW_FIELD_IDX_GTPU_DWN_TEID) > + > /* Flow headers and fields for AVF support */ > enum ice_flow_avf_hdr_field { > /* Values 0 - 28 are reserved for future use */ > diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c > index 9be724291ef8..3c4282019570 100644 > --- a/drivers/net/ethernet/intel/ice/ice_lib.c > +++ b/drivers/net/ethernet/intel/ice/ice_lib.c > @@ -1618,6 +1618,25 @@ static const struct ice_rss_hash_cfg default_rss_cfgs[] = { > */ > {ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4, > ICE_HASH_SCTP_IPV4, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpc4 with input set IPv4 src/dst */ > + {ICE_FLOW_SEG_HDR_GTPC | ICE_FLOW_SEG_HDR_IPV4, > + ICE_FLOW_HASH_IPV4, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpc4t with input set IPv4 src/dst */ > + {ICE_FLOW_SEG_HDR_GTPC_TEID | ICE_FLOW_SEG_HDR_IPV4, > + ICE_FLOW_HASH_GTP_C_IPV4_TEID, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpu4 with input set IPv4 src/dst */ > + {ICE_FLOW_SEG_HDR_GTPU_IP | ICE_FLOW_SEG_HDR_IPV4, > + ICE_FLOW_HASH_GTP_U_IPV4_TEID, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpu4e with input set IPv4 src/dst */ > + {ICE_FLOW_SEG_HDR_GTPU_EH | ICE_FLOW_SEG_HDR_IPV4, > + ICE_FLOW_HASH_GTP_U_IPV4_EH, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpu4u with input set IPv4 src/dst */ > + { ICE_FLOW_SEG_HDR_GTPU_UP | ICE_FLOW_SEG_HDR_IPV4, > + ICE_FLOW_HASH_GTP_U_IPV4_UP, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpu4d with input set IPv4 src/dst */ > + {ICE_FLOW_SEG_HDR_GTPU_DWN | ICE_FLOW_SEG_HDR_IPV4, > + ICE_FLOW_HASH_GTP_U_IPV4_DWN, ICE_RSS_OUTER_HEADERS, false}, > + > /* configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst */ > {ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6, > ICE_HASH_TCP_IPV6, ICE_RSS_ANY_HEADERS, false}, > @@ -1632,6 +1651,24 @@ static const struct ice_rss_hash_cfg default_rss_cfgs[] = { > /* configure RSS for IPSEC ESP SPI with input set MAC_IPV4_SPI */ > {ICE_FLOW_SEG_HDR_ESP, > ICE_FLOW_HASH_ESP_SPI, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpc6 with input set IPv6 src/dst */ > + {ICE_FLOW_SEG_HDR_GTPC | ICE_FLOW_SEG_HDR_IPV6, > + ICE_FLOW_HASH_IPV6, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpc6t with input set IPv6 src/dst */ > + {ICE_FLOW_SEG_HDR_GTPC_TEID | ICE_FLOW_SEG_HDR_IPV6, > + ICE_FLOW_HASH_GTP_C_IPV6_TEID, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpu6 with input set IPv6 src/dst */ > + {ICE_FLOW_SEG_HDR_GTPU_IP | ICE_FLOW_SEG_HDR_IPV6, > + ICE_FLOW_HASH_GTP_U_IPV6_TEID, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpu6e with input set IPv6 src/dst */ > + {ICE_FLOW_SEG_HDR_GTPU_EH | ICE_FLOW_SEG_HDR_IPV6, > + ICE_FLOW_HASH_GTP_U_IPV6_EH, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpu6u with input set IPv6 src/dst */ > + { ICE_FLOW_SEG_HDR_GTPU_UP | ICE_FLOW_SEG_HDR_IPV6, > + ICE_FLOW_HASH_GTP_U_IPV6_UP, ICE_RSS_OUTER_HEADERS, false}, > + /* configure RSS for gtpu6d with input set IPv6 src/dst */ > + {ICE_FLOW_SEG_HDR_GTPU_DWN | ICE_FLOW_SEG_HDR_IPV6, > + ICE_FLOW_HASH_GTP_U_IPV6_DWN, ICE_RSS_OUTER_HEADERS, false}, > }; > > /**