Skip to content

Commit f48eea3

Browse files
committed
iavf: add RSS support for GTP protocol via ethtool
This patch extends the iavf driver to support Receive Side Scaling (RSS) configuration for GTP (GPRS Tunneling Protocol) flows using ethtool. The implementation introduces new RSS flow segment headers and hash field definitions for various GTP encapsulations, including: - GTPC - GTPU (IP, Extension Header, Uplink, Downlink) - TEID-based hashing The ethtool interface is updated to parse and apply these new flow types and hash fields, enabling fine-grained traffic distribution for GTP-based mobile workloads. This enhancement improves performance and scalability for virtualized network functions (VNFs) and user plane functions (UPFs) in 5G and LTE deployments. Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
1 parent 61baee2 commit f48eea3

4 files changed

Lines changed: 155 additions & 1 deletion

File tree

drivers/net/ethernet/intel/iavf/iavf_adv_rss.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,38 @@ iavf_fill_adv_rss_sctp_hdr(struct virtchnl_proto_hdr *hdr, u64 hash_flds)
9090
VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, SCTP, DST_PORT);
9191
}
9292

93+
/**
94+
* iavf_fill_adv_rss_gtpeh_hdr - fill the GTP-EH RSS protocol header
95+
* @hdr: the virtchnl message protocol header data structure
96+
* @hash_flds: the RSS configuration protocol hash fields
97+
*/
98+
static int
99+
iavf_fill_adv_rss_gtp_hdr(struct virtchnl_proto_hdrs *proto_hdrs, u32 packet_hdrs, u64 hash_flds)
100+
{
101+
struct virtchnl_proto_hdr *hdr;
102+
103+
hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++];
104+
switch (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_GTP) {
105+
case IAVF_ADV_RSS_FLOW_SEG_HDR_GTPC:
106+
VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GTPC);
107+
break;
108+
case IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_EH:
109+
VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GTPU_EH);
110+
break;
111+
case IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_UP:
112+
VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GTPU_EH_PDU_UP);
113+
break;
114+
case IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_DWN:
115+
VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GTPU_EH_PDU_DWN);
116+
break;
117+
default:
118+
return -EINVAL;
119+
120+
}
121+
122+
return 0;
123+
}
124+
93125
/**
94126
* iavf_fill_adv_rss_cfg_msg - fill the RSS configuration into virtchnl message
95127
* @rss_cfg: the virtchnl message to be filled with RSS configuration setting
@@ -125,6 +157,10 @@ iavf_fill_adv_rss_cfg_msg(struct virtchnl_rss_cfg *rss_cfg,
125157
return -EINVAL;
126158
}
127159

160+
if(packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_GTP) {
161+
return iavf_fill_adv_rss_gtp_hdr(proto_hdrs, packet_hdrs, hash_flds);
162+
}
163+
128164
hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++];
129165
switch (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_L4) {
130166
case IAVF_ADV_RSS_FLOW_SEG_HDR_TCP:
@@ -186,6 +222,8 @@ iavf_print_adv_rss_cfg(struct iavf_adapter *adapter, struct iavf_adv_rss *rss,
186222
proto = "UDP";
187223
else if (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP)
188224
proto = "SCTP";
225+
else if (packet_hdrs & IAVF_ADV_RSS_FLOW_SEG_HDR_GTP)
226+
proto = "GTP";
189227
else
190228
return;
191229

@@ -211,6 +249,16 @@ iavf_print_adv_rss_cfg(struct iavf_adapter *adapter, struct iavf_adv_rss *rss,
211249
IAVF_ADV_RSS_HASH_FLD_UDP_DST_PORT |
212250
IAVF_ADV_RSS_HASH_FLD_SCTP_DST_PORT))
213251
strcat(hash_opt, "dst port,");
252+
if (hash_flds & IAVF_ADV_RSS_HASH_FLD_GTPC_TEID)
253+
strcat(hash_opt, "gtp-c,");
254+
if (hash_flds & IAVF_ADV_RSS_HASH_FLD_GTPU_IP_TEID)
255+
strcat(hash_opt, "gtp-u ip,");
256+
if (hash_flds & IAVF_ADV_RSS_HASH_FLD_GTPU_EH_TEID)
257+
strcat(hash_opt, "gtp-u ext,");
258+
if (hash_flds & IAVF_ADV_RSS_HASH_FLD_GTPU_UP_TEID)
259+
strcat(hash_opt, "gtp-u ul,");
260+
if (hash_flds & IAVF_ADV_RSS_HASH_FLD_GTPU_DWN_TEID)
261+
strcat(hash_opt, "gtp-u dl,");
214262

215263
if (!action)
216264
action = "";

drivers/net/ethernet/intel/iavf/iavf_adv_rss.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ enum iavf_adv_rss_flow_seg_hdr {
2222
IAVF_ADV_RSS_FLOW_SEG_HDR_TCP = 0x00000004,
2323
IAVF_ADV_RSS_FLOW_SEG_HDR_UDP = 0x00000008,
2424
IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP = 0x00000010,
25+
/* RESERVED */
26+
IAVF_ADV_RSS_FLOW_SEG_HDR_GTPC = 0x00000400,
27+
IAVF_ADV_RSS_FLOW_SEG_HDR_GTPC_TEID = 0x00000800,
28+
IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_IP = 0x00001000,
29+
IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_EH = 0x00002000,
30+
IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_DWN = 0x00004000,
31+
IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_UP = 0x00008000,
2532
};
2633

2734
#define IAVF_ADV_RSS_FLOW_SEG_HDR_L3 \
@@ -33,6 +40,14 @@ enum iavf_adv_rss_flow_seg_hdr {
3340
IAVF_ADV_RSS_FLOW_SEG_HDR_UDP | \
3441
IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP)
3542

43+
#define IAVF_ADV_RSS_FLOW_SEG_HDR_GTP \
44+
(IAVF_ADV_RSS_FLOW_SEG_HDR_GTPC | \
45+
IAVF_ADV_RSS_FLOW_SEG_HDR_GTPC_TEID| \
46+
IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_IP| \
47+
IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_EH| \
48+
IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_DWN| \
49+
IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_UP)
50+
3651
enum iavf_adv_rss_flow_field {
3752
/* L3 */
3853
IAVF_ADV_RSS_FLOW_FIELD_IDX_IPV4_SA,
@@ -46,6 +61,17 @@ enum iavf_adv_rss_flow_field {
4661
IAVF_ADV_RSS_FLOW_FIELD_IDX_UDP_DST_PORT,
4762
IAVF_ADV_RSS_FLOW_FIELD_IDX_SCTP_SRC_PORT,
4863
IAVF_ADV_RSS_FLOW_FIELD_IDX_SCTP_DST_PORT,
64+
/* GTPC_TEID */
65+
IAVF_ADV_RSS_FLOW_FIELD_IDX_GTPC_TEID,
66+
/* GTPU_IP */
67+
IAVF_ADV_RSS_FLOW_FIELD_IDX_GTPU_IP_TEID,
68+
/* GTPU_EH */
69+
IAVF_ADV_RSS_FLOW_FIELD_IDX_GTPU_EH_TEID,
70+
IAVF_ADV_RSS_FLOW_FIELD_IDX_GTPU_EH_QFI,
71+
/* GTPU_UP */
72+
IAVF_ADV_RSS_FLOW_FIELD_IDX_GTPU_UP_TEID,
73+
/* GTPU_DWN */
74+
IAVF_ADV_RSS_FLOW_FIELD_IDX_GTPU_DWN_TEID,
4975

5076
/* The total number of enums must not exceed 64 */
5177
IAVF_ADV_RSS_FLOW_FIELD_IDX_MAX
@@ -72,6 +98,12 @@ enum iavf_adv_rss_flow_field {
7298
BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_SCTP_SRC_PORT)
7399
#define IAVF_ADV_RSS_HASH_FLD_SCTP_DST_PORT \
74100
BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_SCTP_DST_PORT)
101+
#define IAVF_ADV_RSS_HASH_FLD_GTPC_TEID BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_GTPC_TEID)
102+
#define IAVF_ADV_RSS_HASH_FLD_GTPU_IP_TEID BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_GTPU_IP_TEID)
103+
#define IAVF_ADV_RSS_HASH_FLD_GTPU_EH_TEID BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_GTPU_EH_TEID)
104+
#define IAVF_ADV_RSS_HASH_FLD_GTPU_UP_TEID BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_GTPU_UP_TEID)
105+
#define IAVF_ADV_RSS_HASH_FLD_GTPU_DWN_TEID \
106+
BIT_ULL(IAVF_ADV_RSS_FLOW_FIELD_IDX_GTPU_DWN_TEID)
75107

76108
/* bookkeeping of advanced RSS configuration */
77109
struct iavf_adv_rss {

drivers/net/ethernet/intel/iavf/iavf_ethtool.c

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,42 @@ static u32 iavf_adv_rss_parse_hdrs(struct ethtool_rxnfc *cmd)
13491349
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_SCTP |
13501350
IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6;
13511351
break;
1352+
case GTPU_V4_FLOW:
1353+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_IP | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4;
1354+
break;
1355+
case GTPC_V4_FLOW:
1356+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPC | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4;
1357+
break;
1358+
case GTPC_TEID_V4_FLOW:
1359+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPC_TEID | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4;
1360+
break;
1361+
case GTPU_EH_V4_FLOW:
1362+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_EH | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4;
1363+
break;
1364+
case GTPU_UL_V4_FLOW:
1365+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_UP | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4;
1366+
break;
1367+
case GTPU_DL_V4_FLOW:
1368+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_DWN | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV4;
1369+
break;
1370+
case GTPU_V6_FLOW:
1371+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_IP | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6;
1372+
break;
1373+
case GTPC_V6_FLOW:
1374+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPC | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6;
1375+
break;
1376+
case GTPC_TEID_V6_FLOW:
1377+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPC_TEID | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6;
1378+
break;
1379+
case GTPU_EH_V6_FLOW:
1380+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_EH | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6;
1381+
break;
1382+
case GTPU_UL_V6_FLOW:
1383+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_UP | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6;
1384+
break;
1385+
case GTPU_DL_V6_FLOW:
1386+
hdrs |= IAVF_ADV_RSS_FLOW_SEG_HDR_GTPU_DWN | IAVF_ADV_RSS_FLOW_SEG_HDR_IPV6;
1387+
break;
13521388
default:
13531389
break;
13541390
}
@@ -1373,6 +1409,12 @@ static u64 iavf_adv_rss_parse_hash_flds(struct ethtool_rxnfc *cmd, bool symm)
13731409
case TCP_V4_FLOW:
13741410
case UDP_V4_FLOW:
13751411
case SCTP_V4_FLOW:
1412+
case GTPU_V4_FLOW:
1413+
case GTPC_V4_FLOW:
1414+
case GTPC_TEID_V4_FLOW:
1415+
case GTPU_EH_V4_FLOW:
1416+
case GTPU_UL_V4_FLOW:
1417+
case GTPU_DL_V4_FLOW:
13761418
if (cmd->data & RXH_IP_SRC)
13771419
hfld |= IAVF_ADV_RSS_HASH_FLD_IPV4_SA;
13781420
if (cmd->data & RXH_IP_DST)
@@ -1381,6 +1423,12 @@ static u64 iavf_adv_rss_parse_hash_flds(struct ethtool_rxnfc *cmd, bool symm)
13811423
case TCP_V6_FLOW:
13821424
case UDP_V6_FLOW:
13831425
case SCTP_V6_FLOW:
1426+
case GTPU_V6_FLOW:
1427+
case GTPC_V6_FLOW:
1428+
case GTPC_TEID_V6_FLOW:
1429+
case GTPU_EH_V6_FLOW:
1430+
case GTPU_UL_V6_FLOW:
1431+
case GTPU_DL_V6_FLOW:
13841432
if (cmd->data & RXH_IP_SRC)
13851433
hfld |= IAVF_ADV_RSS_HASH_FLD_IPV6_SA;
13861434
if (cmd->data & RXH_IP_DST)
@@ -1418,6 +1466,32 @@ static u64 iavf_adv_rss_parse_hash_flds(struct ethtool_rxnfc *cmd, bool symm)
14181466
break;
14191467
}
14201468
}
1469+
if (cmd->data & RXH_GTP_TEID) {
1470+
switch (cmd->flow_type) {
1471+
case GTPC_TEID_V4_FLOW:
1472+
case GTPC_TEID_V6_FLOW:
1473+
hfld |= IAVF_ADV_RSS_HASH_FLD_GTPC_TEID;
1474+
break;
1475+
case GTPU_V4_FLOW:
1476+
case GTPU_V6_FLOW:
1477+
hfld |= IAVF_ADV_RSS_HASH_FLD_GTPU_IP_TEID;
1478+
break;
1479+
case GTPU_EH_V4_FLOW:
1480+
case GTPU_EH_V6_FLOW:
1481+
hfld |= IAVF_ADV_RSS_HASH_FLD_GTPU_EH_TEID;
1482+
break;
1483+
case GTPU_UL_V4_FLOW:
1484+
case GTPU_UL_V6_FLOW:
1485+
hfld |= IAVF_ADV_RSS_HASH_FLD_GTPU_UP_TEID;
1486+
break;
1487+
case GTPU_DL_V4_FLOW:
1488+
case GTPU_DL_V6_FLOW:
1489+
hfld |= IAVF_ADV_RSS_HASH_FLD_GTPU_DWN_TEID;
1490+
break;
1491+
default:
1492+
break;
1493+
}
1494+
}
14211495

14221496
return hfld;
14231497
}

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static int iavf_check_reset_complete(struct iavf_hw *hw);
2020

2121
char iavf_driver_name[] = "iavf";
2222
static const char iavf_driver_string[] =
23-
"Intel(R) Ethernet Adaptive Virtual Function Network Driver";
23+
"Intel(R) Ethernet Adaptive Virtual Function Network Driver +GTP-Uv15";
2424

2525
static const char iavf_copyright[] =
2626
"Copyright (c) 2013 - 2018 Intel Corporation.";

0 commit comments

Comments
 (0)