Skip to contentSkip to conversation

net/i40e: ESP support

PATCH Superseded Bernard Iremonger 7 participants 134 messages Dec 10, 2019 – Jan 21, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

cover net/i40e: ESP support

Add support for ESP flows to testpmd.
Improve debug information in testpmd and the i40e PMD. Process ESP flows on the i40e Flow Director and RSS.

Bernard Iremonger (9):
app/testpmd: parse flow command line for ESP
app/testpmd: dump Rx and Tx mbuf
net/i40e: improve RSS debug
net/i40e: handle ESP tunnel
net/i40e: process ESP flows
net/i40e: display Flow Director packet
librte_ethdev: add ESP and AH flow types to RSS
doc: release note for ESP
doc: update i40e user guide

 app/test-pmd/cmdline_flow.c            |  37 ++++++++-
 app/test-pmd/config.c                  |   2 +-
 app/test-pmd/util.c                    |   1 +
 doc/guides/nics/i40e.rst               |   4 +-
 doc/guides/rel_notes/release_20_02.rst |   9 ++
 drivers/net/i40e/i40e_ethdev.c         |  52 +++++++++++-
 drivers/net/i40e/i40e_ethdev.h         |  25 ++++++
 drivers/net/i40e/i40e_fdir.c           | 148 ++++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c           | 113 ++++++++++++++++++++++++-
 drivers/net/i40e/rte_pmd_i40e.c        |   3 +-
 lib/librte_ethdev/rte_ethdev.h         |  29 ++++++-
 11 files changed, 400 insertions(+), 23 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/9 app/testpmd: parse flow command line for ESP

add ITEM_ESP
add ITEM_ESP_SPI
add debug to cmdline_flow.c
improve debug in config.c

---
 app/test-pmd/cmdline_flow.c | 37 ++++++++++++++++++++++++++++++++++---
 app/test-pmd/config.c       |  2 +-
 2 files changed, 35 insertions(+), 4 deletions(-)
app/test-pmd/cmdline_flow.c +34 -3
index 99dade7..f1b0610 100644
@@ -213,6 +213,8 @@ enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_ESP,
+	ITEM_ESP_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_ESP,
 	END_SET,
 	ZERO,
 };
@@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
 	ZERO,
 };
 
+static const enum index item_esp[] = {
+	ITEM_ESP_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag, index)),
 	},
+	[ITEM_ESP] = {
+		.name = "esp",
+		.help = "match ESP header",
+		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+		.next = NEXT(item_esp),
+		.call = parse_vc,
+	},
+	[ITEM_ESP_SPI] = {
+		.name = "spi",
+		.help = "security policy index",
+		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+				hdr.spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,
 static void
 cmd_flow_parsed(const struct buffer *in)
 {
+	printf("Flow command line parsed successfully for command=%d.\n",
+			in->command);
+
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr,
@@ -6230,14 +6256,15 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_GTP:
 		mask = &rte_flow_item_gtp_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_ESP:
-		mask = &rte_flow_item_esp_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 		mask = &rte_flow_item_gtp_psc_mask;
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		mask = &rte_flow_item_esp_mask;
+		break;
 	default:
 		break;
 	}
@@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			size = sizeof(struct rte_flow_item_geneve);
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			size = sizeof(struct rte_flow_item_esp);
+			proto = 0x32;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
app/test-pmd/config.c +1 -1
index d599682..2753ec5 100644
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("Caught error type %d (%s): %s%s: %s\n",
+	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n", __func__,
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
 					error->cause), buf) : "",
Signature · 1 line
2.7.4
#2 lore raw

Re: [dpdk-dev] [PATCH 1/9] app/testpmd: parse flow command line for ESP

Hi Bernard,

Quoted 80 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Bernard Iremonger
Sent: Tuesday, December 10, 2019 2:57 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH 1/9] app/testpmd: parse flow command line for ESP

add ITEM_ESP
add ITEM_ESP_SPI
add debug to cmdline_flow.c
improve debug in config.c

---
 app/test-pmd/cmdline_flow.c | 37
++++++++++++++++++++++++++++++++++---
 app/test-pmd/config.c       |  2 +-
 2 files changed, 35 insertions(+), 4 deletions(-)
app/test-pmd/cmdline_flow.c +23 -0
index 99dade7..f1b0610 100644
@@ -213,6 +213,8 @@ enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_ESP,
+	ITEM_ESP_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_ESP,
 	END_SET,
 	ZERO,
 };
@@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
 	ZERO,
 };
 
+static const enum index item_esp[] = {
+	ITEM_ESP_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag,
 index)),
 	},
+	[ITEM_ESP] = {
+		.name = "esp",
+		.help = "match ESP header",
+		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+		.next = NEXT(item_esp),
+		.call = parse_vc,
+	},
+	[ITEM_ESP_SPI] = {
+		.name = "spi",
+		.help = "security policy index",
+		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED),
 item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+				hdr.spi)),
+	},
 	/* Validate/create actions. */
app/test-pmd/cmdline_flow.c +0 -0
 	[ACTIONS] = {
 		.name = "actions",

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t **hdr, · line 6081

Quoted 7 lines
app/test-pmd/cmdline_flow.c +3 -0
@@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,
 static void
 cmd_flow_parsed(const struct buffer *in)
 {
+	printf("Flow command line parsed successfully for
 command=%d.\n",
+			in->command);
+

Why did you add the printf? Debug?

Quoted 39 lines
app/test-pmd/cmdline_flow.c +0 -0
 	switch (in->command) {
 	case VALIDATE:
app/test-pmd/cmdline_flow.c +4 -3
 		port_flow_validate(in->port, &in->args.vc.attr,
@@ -6230,14 +6256,15 @@ flow_item_default_mask(const struct
 rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_GTP:
 		mask = &rte_flow_item_gtp_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_ESP:
-		mask = &rte_flow_item_esp_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 		mask = &rte_flow_item_gtp_psc_mask;
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		mask = &rte_flow_item_esp_mask;
+		break;
 	default:
 		break;
app/test-pmd/cmdline_flow.c +4 -0
 	}
@@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			size = sizeof(struct rte_flow_item_geneve);
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			size = sizeof(struct rte_flow_item_esp);
+			proto = 0x32;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
app/test-pmd/config.c +0 -0
index d599682..2753ec5 100644

app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1307

Quoted 6 lines
app/test-pmd/config.c +1 -1
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("Caught error type %d (%s): %s%s: %s\n",
+	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n",
 __func__,

I don't think this change is relevant for this commit.

Quoted 5 lines
app/test-pmd/config.c +0 -0
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",

error->cause), buf) : "",
--
2.7.4

Thanks,
Ori

#3 lore raw

Re: [dpdk-dev] [PATCH 1/9] app/testpmd: parse flow command line for ESP

Hi Ori,

<snip>

Quoted 121 lines
Quoted 50 lines

Subject: [dpdk-dev] [PATCH 1/9] app/testpmd: parse flow command line for ESP

add ITEM_ESP
add ITEM_ESP_SPI
add debug to cmdline_flow.c
improve debug in config.c

---
 app/test-pmd/cmdline_flow.c | 37
++++++++++++++++++++++++++++++++++---
 app/test-pmd/config.c       |  2 +-
 2 files changed, 35 insertions(+), 4 deletions(-)
app/test-pmd/cmdline_flow.c +9 -0
index 99dade7..f1b0610 100644
@@ -213,6 +213,8 @@ enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_ESP,
+	ITEM_ESP_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_ESP,
 	END_SET,
 	ZERO,
 };
@@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
 	ZERO,
 };
 
+static const enum index item_esp[] = {
+	ITEM_ESP_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,

app/test-pmd/cmdline_flow.c static const struct token token_list[] = { · line 2603

Quoted 2 lines
app/test-pmd/cmdline_flow.c +0 -0
@@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag,

index)),

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t

Quoted 20 lines
app/test-pmd/cmdline_flow.c +14 -0
 	},
+	[ITEM_ESP] = {
+		.name = "esp",
+		.help = "match ESP header",
+		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+		.next = NEXT(item_esp),
+		.call = parse_vc,
+	},
+	[ITEM_ESP_SPI] = {
+		.name = "spi",
+		.help = "security policy index",
+		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED),
 item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+				hdr.spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
app/test-pmd/cmdline_flow.c +0 -0
 		.name = "actions",
@@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t

**hdr,

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t · line 6079

Quoted 5 lines
app/test-pmd/cmdline_flow.c +3 -0
 static void  cmd_flow_parsed(const struct buffer *in)  {
+	printf("Flow command line parsed successfully for
 command=%d.\n",
+			in->command);
+

Why did you add the printf? Debug?

app/test-pmd/config.c port_flow_complain(struct rte_flow_error

Quoted 38 lines
app/test-pmd/cmdline_flow.c +9 -3
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr, @@ -6230,14
+6256,15 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_GTP:
 		mask = &rte_flow_item_gtp_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_ESP:
-		mask = &rte_flow_item_esp_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 		mask = &rte_flow_item_gtp_psc_mask;
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		mask = &rte_flow_item_esp_mask;
+		break;
 	default:
 		break;
 	}
@@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			size = sizeof(struct rte_flow_item_geneve);
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			size = sizeof(struct rte_flow_item_esp);
+			proto = 0x32;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
app/test-pmd/config.c index renamed from app/test-pmd/config.c +0 -0

d599682..2753ec5 100644

app/test-pmd/config.c +0 -0
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error

*error)

Quoted 8 lines

app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error)

Quoted 6 lines
app/test-pmd/config.c +1 -1
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("Caught error type %d (%s): %s%s: %s\n",
+	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n",
 __func__,

I don't think this change is relevant for this commit.

This is useful information to have when testing/debugging. I will move it to a separate patch.

Quoted 9 lines
Quoted 6 lines
app/test-pmd/config.c +0 -0
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",

error->cause), buf) : "",
--
2.7.4

Thanks,
Ori

Regards,

Bernard.

#4 lore raw

PATCH 2/9 app/testpmd: dump Rx and Tx mbuf

In reply to Bernard Iremonger

add call to rte_pktmbuf_dump() in dump_pkt_burst in util.c

---
 app/test-pmd/util.c | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/util.c +1 -0
index b514be5..bf03873 100644
@@ -158,6 +158,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 		printf("  ol_flags: %s\n", buf);
 		if (rte_mbuf_check(mb, 1, &reason) < 0)
 			printf("INVALID mbuf: %s\n", reason);
+		rte_pktmbuf_dump(stdout, pkts[i], pkts[i]->data_len);
 	}
 }
 
Signature · 1 line
2.7.4
#5 lore raw

PATCH 3/9 net/i40e: improve RSS debug

In reply to Bernard Iremonger

improve RSS debug in i40e_ethdev.c

---
 drivers/net/i40e/i40e_ethdev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +6 -2
index 5999c96..5f1cf8a 100644
@@ -8679,7 +8679,9 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 			num);
 
 	if (num == 0) {
-		PMD_INIT_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_INIT_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
@@ -12840,7 +12842,9 @@ i40e_config_rss_filter(struct i40e_pf *pf,
 			num);
 
 	if (num == 0) {
-		PMD_DRV_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_DRV_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
Signature · 1 line
2.7.4
#6 lore raw

PATCH 4/9 net/i40e: handle ESP tunnel

In reply to Bernard Iremonger

handle ESP tunnel in rte_pmd_i40e.c

---
 drivers/net/i40e/rte_pmd_i40e.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/rte_pmd_i40e.c +2 -1
index fdcb1a4..b987346 100644
@@ -2172,7 +2172,8 @@ static int check_invalid_pkt_type(uint32_t pkt_type)
 	    tnl != RTE_PTYPE_TUNNEL_GRENAT &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPC &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPU &&
-	    tnl != RTE_PTYPE_TUNNEL_L2TP)
+	    tnl != RTE_PTYPE_TUNNEL_L2TP &&
+	    tnl != RTE_PTYPE_TUNNEL_ESP)
 		return -1;
 
 	if (il2 &&
Signature · 1 line
2.7.4
#7 lore raw

PATCH 5/9 net/i40e: process ESP flows

In reply to Bernard Iremonger

Process ESP flows on Flow Director and RSS.

add eth/ipv4/esp and eth/ipv6/esp patterns add eth/ipv4/udp/esp and eth/ipv6/esp/udp patterns update i40e_flow_parse_fdir_filter()
add fill_ip6_head()
add oip_type in filter
add is_udp in filter
use tenant_id in filter for spi
handle ESP and AH pctypes in ESP-AH profile update customized code for ESP

---
 drivers/net/i40e/i40e_ethdev.c |  44 ++++++++++++-
 drivers/net/i40e/i40e_ethdev.h |  25 +++++++
 drivers/net/i40e/i40e_fdir.c   | 144 ++++++++++++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c   | 113 +++++++++++++++++++++++++++++++-
 4 files changed, 313 insertions(+), 13 deletions(-)
drivers/net/i40e/i40e_ethdev.c +43 -1
index 5f1cf8a..a462eba 100644
@@ -1106,6 +1106,7 @@ i40e_init_customized_info(struct i40e_pf *pf)
 	}
 
 	pf->gtp_support = false;
+	pf->esp_support = false;
 }
 
 void
@@ -12337,6 +12338,7 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			}
 		}
 		name[strlen(name) - 1] = '\0';
+		PMD_DRV_LOG(INFO, "name = %s\n", name);
 		if (!strcmp(name, "GTPC"))
 			new_pctype =
 				i40e_find_customized_pctype(pf,
@@ -12353,6 +12355,30 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			new_pctype =
 				i40e_find_customized_pctype(pf,
 						      I40E_CUSTOMIZED_GTPU);
+		else if (!strcmp(name, "IPV4_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+		else if (!strcmp(name, "IPV6_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		else if (!strcmp(name, "IPV4_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+		else if (!strcmp(name, "IPV6_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+		else if (!strcmp(name, "IPV4_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV4);
+		else if (!strcmp(name, "IPV6_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV6);
 		if (new_pctype) {
 			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD) {
 				new_pctype->pctype = pctype_value;
@@ -12448,6 +12474,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					continue;
 				memset(name, 0, sizeof(name));
 				strcpy(name, proto[n].name);
+				PMD_DRV_LOG(INFO, "name = %s\n", name);
 				if (!strncasecmp(name, "PPPOE", 5))
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_L2_ETHER_PPPOE;
@@ -12541,6 +12568,10 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GTPU;
 					in_tunnel = true;
+				} else if (!strncasecmp(name, "ESP", 3)) {
+					ptype_mapping[i].sw_ptype |=
+						RTE_PTYPE_TUNNEL_ESP;
+					in_tunnel = true;
 				} else if (!strncasecmp(name, "GRENAT", 6)) {
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GRENAT;
@@ -12560,7 +12591,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 	ret = rte_pmd_i40e_ptype_mapping_update(port_id, ptype_mapping,
 						ptype_num, 0);
 	if (ret)
-		PMD_DRV_LOG(ERR, "Failed to update mapping table.");
+		PMD_DRV_LOG(ERR, "Failed to update ptype mapping table.");
 
 	rte_free(ptype_mapping);
 	rte_free(ptype);
@@ -12625,6 +12656,17 @@ i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg,
 		}
 	}
 
+	/* Check if ESP is supported. */
+	for (i = 0; i < proto_num; i++) {
+		if (!strncmp(proto[i].name, "ESP", 3)) {
+			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD)
+				pf->esp_support = true;
+			else
+				pf->esp_support = false;
+			break;
+		}
+	}
+
 	/* Update customized pctype info */
 	ret = i40e_update_customized_pctype(dev, pkg, pkg_size,
 					    proto_num, proto, op);
drivers/net/i40e/i40e_ethdev.h +25 -0
index 295ad59..3566056 100644
@@ -501,6 +501,18 @@ struct i40e_gtp_ipv6_flow {
 	struct rte_eth_ipv6_flow ip6;
 };
 
+/* A structure used to define the input for ESP IPV4 flow */
+struct i40e_esp_ipv4_flow {
+	struct rte_eth_udpv4_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 flow */
+struct i40e_esp_ipv6_flow {
+	struct rte_eth_udpv6_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
 /* A structure used to define the input for raw type flow */
 struct i40e_raw_flow {
 	uint16_t pctype;
@@ -526,6 +538,8 @@ union i40e_fdir_flow {
 	struct i40e_gtp_ipv4_flow  gtp_ipv4_flow;
 	struct i40e_gtp_ipv6_flow  gtp_ipv6_flow;
 	struct i40e_raw_flow       raw_flow;
+	struct i40e_esp_ipv4_flow  esp_ipv4_flow;
+	struct i40e_esp_ipv6_flow  esp_ipv6_flow;
 };
 
 enum i40e_fdir_ip_type {
@@ -542,8 +556,10 @@ struct i40e_fdir_flow_ext {
 	uint16_t dst_id; /* VF ID, available when is_vf is 1*/
 	bool inner_ip;   /* If there is inner ip */
 	enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
+	enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
 	bool customized_pctype; /* If customized pctype is used */
 	bool pkt_template; /* If raw packet template is used */
+	bool is_udp; /* ipv4|ipv6 udp flow */
 };
 
 /* A structure used to define the input for a flow director filter entry */
@@ -769,6 +785,8 @@ enum i40e_tunnel_type {
 	I40E_TUNNEL_TYPE_QINQ,
 	I40E_TUNNEL_TYPE_GTPC,
 	I40E_TUNNEL_TYPE_GTPU,
+	I40E_TUNNEL_TYPE_ESPoUDP,
+	I40E_TUNNEL_TYPE_ESPoIP,
 	I40E_TUNNEL_TYPE_MAX,
 };
 
@@ -897,6 +915,12 @@ enum i40e_new_pctype {
 	I40E_CUSTOMIZED_GTPU_IPV4,
 	I40E_CUSTOMIZED_GTPU_IPV6,
 	I40E_CUSTOMIZED_GTPU,
+	I40E_CUSTOMIZED_ESP_IPV4,
+	I40E_CUSTOMIZED_ESP_IPV6,
+	I40E_CUSTOMIZED_ESP_IPV4_UDP,
+	I40E_CUSTOMIZED_ESP_IPV6_UDP,
+	I40E_CUSTOMIZED_AH_IPV4,
+	I40E_CUSTOMIZED_AH_IPV6,
 	I40E_CUSTOMIZED_MAX,
 };
 
@@ -1001,6 +1025,7 @@ struct i40e_pf {
 
 	/* Dynamic Device Personalization */
 	bool gtp_support; /* 1 - support GTP-C and GTP-U */
+	bool esp_support; /* 1 - support ESP SPI */
 	/* customer customized pctype */
 	struct i40e_customized_pctype customized_pctype[I40E_CUSTOMIZED_MAX];
 	/* Switch Domain Id */
drivers/net/i40e/i40e_fdir.c +135 -9

188 lines not on this page · raw message

drivers/net/i40e/i40e_flow.c +110 -3

183 lines not on this page · raw message

Signature · 1 line
2.7.4
#8 lore raw

PATCH 6/9 net/i40e: display Flow Director packet

In reply to Bernard Iremonger

call rte_hexdump in i40e_flow_fdir_construct_pkt() in i40e_fdir.c

---
 drivers/net/i40e/i40e_fdir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_fdir.c +3 -1
index d58cee9..08cbbf6 100644
@@ -21,6 +21,7 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_hexdump.h>
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -803,6 +804,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input,
 			    fdir_input->flow_type);
 		return -1;
 	}
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return len;
 }
 
@@ -952,7 +954,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return 0;
 }
 
Signature · 1 line
2.7.4
#9 lore raw

PATCH 7/9 librte_ethdev: add ESP and AH flow types to RSS

In reply to Bernard Iremonger

Add flow types for the following PCTYPE's in the DDP ipsec profile:
14: IPV6 ESP
15: IPV4 ESP
16: IPV6 AH
17: IPV4 AH
18: IPV6 UDP ESP
19: IPV4 UDP ESP

Add the following RSS macros for IPsec:
ETH_RSS_ESP
ETH_RSS_AH
ETH_RSS_IPSEC

---
 lib/librte_ethdev/rte_ethdev.h | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
lib/librte_ethdev/rte_ethdev.h +28 -1
index 18a9def..39c89cb 100644
@@ -484,7 +484,13 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based flow */
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_IPV4_AH            24 /**< IPv4 AH protocol based flow */
+#define RTE_ETH_FLOW_IPV4_ESP           25 /**< IPv4 ESP protocol based flow */
+#define RTE_ETH_FLOW_IPV4_UDP_ESP       26 /**< IPv4 UDP ESP proto based flow */
+#define RTE_ETH_FLOW_IPV6_AH            27 /**< IPv6 AH protocol based flow */
+#define RTE_ETH_FLOW_IPV6_ESP           28 /**< IPv6 ESP protocol based flow */
+#define RTE_ETH_FLOW_IPV6_UDP_ESP       29 /**< IPv6 UDP ESP proto based flow */
+#define RTE_ETH_FLOW_MAX                30
 
 /*
  * Below macros are defined for RSS offload types, they can be used to
@@ -511,6 +517,13 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
+#define ETH_RSS_IPV4_AH            (1ULL << 24)
+#define ETH_RSS_IPV4_ESP           (1ULL << 25)
+#define ETH_RSS_IPV4_UDP_ESP       (1ULL << 26)
+#define ETH_RSS_IPV6_AH            (1ULL << 27)
+#define ETH_RSS_IPV6_ESP           (1ULL << 28)
+#define ETH_RSS_IPV6_UDP_ESP       (1ULL << 29)
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -571,6 +584,20 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_AH ( \
+	ETH_RSS_IPV4_AH | \
+	ETH_RSS_IPV6_AH)
+
+#define ETH_RSS_ESP ( \
+	ETH_RSS_IPV4_ESP | \
+	ETH_RSS_IPV6_ESP | \
+	ETH_RSS_IPV4_UDP_ESP | \
+	ETH_RSS_IPV6_UDP_ESP)
+
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
Signature · 1 line
2.7.4
#10 lore raw

Re: [dpdk-dev] [PATCH 7/9] librte_ethdev: add ESP and AH flow types to RSS

Quoted 8 lines · On Tue, 10 Dec 2019 12:57:10 +0000 Bernard Iremonger…

Add flow types for the following PCTYPE's in the DDP ipsec profile:
14: IPV6 ESP
15: IPV4 ESP
16: IPV6 AH
17: IPV4 AH
18: IPV6 UDP ESP
19: IPV4 UDP ESP

Quoted 7 lines

Add the following RSS macros for IPsec:
ETH_RSS_ESP
ETH_RSS_AH
ETH_RSS_IPSEC

The addition of additional flow matching is good but rte_flow still has problems.
1. There is little to know documentation about the semantics. What happens with the N*M combinations of possible flow rules, what is accepted and what does hardware do?
2. Mellanox, Intel, and Broadcom keep adding hardware match rules but there is no corresponding baseline in software. The SW flow classifier now is a trivial exercise that only matches tuples; it does not have any of the complex semantics of the rest of rte_flow.

If this were a standards body, it would be rejected.

Sorry to pick on this patch, but at some point the base infrastructure needs fixing before allowing more dog piling on of features.

#11 lore raw

PATCH 8/9 doc: release note for ESP

In reply to Bernard Iremonger

Release note for ESP support on the i40e PMD.
Release note for ESP support on testpmd.

---
 doc/guides/rel_notes/release_20_02.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
doc/guides/rel_notes/release_20_02.rst +9 -0
index 0eaa45a..367c980 100644
@@ -56,6 +56,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated i40e driver to support ESP.**
+
+  Updated the i40e PMD to support ESP-AH supporting profiles which can be
+  programmed by the dynamic device personalization (DDP) process.
+
+* **Updated testpmd to support ESP flows.**
+
+  Added support for ESP rte_flow patterns to the testpmd application.
+
 
 Removed Items
 -------------
Signature · 1 line
2.7.4
#12 lore raw

PATCH 9/9 doc: update i40e user guide

In reply to Bernard Iremonger

Update the i40e user guide with ESP information.

---
 doc/guides/nics/i40e.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
doc/guides/nics/i40e.rst +3 -1
index 38acf59..5cf34d9 100644
@@ -457,7 +457,7 @@ which is used to configure hardware by downloading a profile to support
 protocols/filters which are not supported by default. The DDP
 functionality requires a NIC firmware version of 6.0 or greater.
 
-Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP,
+Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP/ESP,
 steering can be used with rte_flow API.
 
 GTPv1 package is released, and it can be downloaded from
@@ -466,6 +466,8 @@ https://downloadcenter.intel.com/download/27587.
 PPPoE package is released, and it can be downloaded from
 https://downloadcenter.intel.com/download/28040.
 
+ESP-AH package is not released yet.
+
 Load a profile which supports GTP and store backup profile:
 
 .. code-block:: console
Signature · 1 line
2.7.4
#13 lore raw

v2 cover net/i40e: ESP support

In reply to Bernard Iremonger

Add support for ESP flows to testpmd.
Improve debug information in testpmd and the i40e PMD. Process ESP flows on the i40e Flow Director and RSS.

Changes in V2:
--------------
Moved change in app/test-pmd/config.c to a seperate patch. Added extra parameter to fill_ip6_head() in i40e_fdir.c
set is_udp to false in i40e_flow_fdir_get_pctype_value() in i40e_flow.c

Bernard Iremonger (10):
app/testpmd: parse flow command line for ESP app/testpmd: improve debug code
app/testpmd: dump Rx and Tx mbuf
net/i40e: improve RSS debug
net/i40e: handle ESP tunnel
net/i40e: process ESP flows
net/i40e: display Flow Director packet
librte_ethdev: add ESP and AH flow types to RSS
doc: release note for ESP
doc: update i40e user guide

 app/test-pmd/cmdline_flow.c            |  37 ++++++++-
 app/test-pmd/config.c                  |   2 +-
 app/test-pmd/util.c                    |   1 +
 doc/guides/nics/i40e.rst               |   4 +-
 doc/guides/rel_notes/release_20_02.rst |   9 ++
 drivers/net/i40e/i40e_ethdev.c         |  52 +++++++++++-
 drivers/net/i40e/i40e_ethdev.h         |  25 ++++++
 drivers/net/i40e/i40e_fdir.c           | 146 ++++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c           | 119 ++++++++++++++++++++++++++-
 drivers/net/i40e/rte_pmd_i40e.c        |   3 +-
 lib/librte_ethdev/rte_ethdev.h         |  29 ++++++-
 11 files changed, 404 insertions(+), 23 deletions(-)
Signature · 1 line
2.7.4
#14 lore raw

v3 cover net/i40e: ESP support

Add support for ESP flows to testpmd.
Improve debug information in testpmd and the i40e PMD. Process ESP flows on the i40e Flow Director and RSS.

Changes in V3:
-------------
Added i40e_flow_set_filter_spi() function in i40e_flow.c Set UDP destination port to 4500 for ESP in i40e_ethdev.h Split flow structures into 4 instead of 2 in i40e_ethdev.h Dropped extra printf from commandline_flow.c

Changes in V2:
--------------
Moved change in app/test-pmd/config.c to a seperate patch. Added extra parameter to fill_ip6_head() in i40e_fdir.c
set is_udp to false in i40e_flow_fdir_get_pctype_value() in i40e_flow.c

Bernard Iremonger (9):
app/testpmd: parse flow command line for ESP app/testpmd: dump Rx and Tx mbuf
net/i40e: improve RSS debug
net/i40e: handle ESP tunnel
net/i40e: process ESP flows
net/i40e: display Flow Director packet
librte_ethdev: add ESP and AH flow types to RSS
doc: release note for ESP
doc: update i40e user guide

 app/test-pmd/cmdline_flow.c            |   4 +-
 app/test-pmd/util.c                    |   1 +
 doc/guides/nics/i40e.rst               |   4 +-
 doc/guides/rel_notes/release_20_02.rst |   9 +++
 drivers/net/i40e/i40e_ethdev.c         |  52 ++++++++++++-
 drivers/net/i40e/i40e_ethdev.h         |  38 ++++++++++
 drivers/net/i40e/i40e_fdir.c           | 132 +++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c           | 135 ++++++++++++++++++++++++++++++++-
 drivers/net/i40e/rte_pmd_i40e.c        |   3 +-
 lib/librte_ethdev/rte_ethdev.h         |  29 ++++++-
 10 files changed, 385 insertions(+), 22 deletions(-)
Signature · 1 line
2.7.4
#15 lore raw

v4 cover net/i40e: ESP support

Add support for ESP flows to testpmd.
Improve debug information in testpmd and the i40e PMD. Process ESP flows on the i40e Flow Director and RSS.

Changes in V4:
-------------
Add extra patch for testpmd
Add extra patch for config
Split v3 patch "net/i40e: process ESP flows" into 4 patches

Changes in V3:
-------------
Added i40e_flow_set_filter_spi() function in i40e_flow.c Set UDP destination port to 4500 for ESP in i40e_ethdev.h Split flow structures into 4 instead of 2 in i40e_ethdev.h Dropped extra printf from commandline_flow.c

Changes in V2:
--------------
Moved change in app/test-pmd/config.c to a seperate patch. Added extra parameter to fill_ip6_head() in i40e_fdir.c
set is_udp to false in i40e_flow_fdir_get_pctype_value() in i40e_flow.c

Bernard Iremonger (14):
app/testpmd: parse flow command line for ESP app/testpmd: improve debug
app/testpmd: dump Rx and Tx mbuf
net/i40e: improve RSS debug
net/i40e: handle ESP tunnel
net/i40e: support ipsec-ah profile
net/i40e: support ESP in customised code net/i40e: support ESP flows
net/i40e: support ESP in Flow Director
config: add debug to I40E Flow Director net/i40e: display Flow Director packet
librte_ethdev: add ESP and AH flow types to RSS
doc: release note for ESP
doc: update i40e user guide

 app/test-pmd/cmdline_flow.c            |   4 +-
 app/test-pmd/util.c                    |   1 +
 config/common_base                     |   1 +
 doc/guides/nics/i40e.rst               |   4 +-
 doc/guides/rel_notes/release_20_02.rst |   9 +++
 drivers/net/i40e/i40e_ethdev.c         |  52 ++++++++++++-
 drivers/net/i40e/i40e_ethdev.h         |  38 +++++++++
 drivers/net/i40e/i40e_fdir.c           | 138 ++++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c           | 135 +++++++++++++++++++++++++++++++-
 drivers/net/i40e/rte_pmd_i40e.c        |   3 +-
 lib/librte_ethdev/rte_ethdev.h         |  29 ++++++-
 11 files changed, 392 insertions(+), 22 deletions(-)
Signature · 1 line
2.7.4
#16 lore raw

v5 cover net/i40e: ESP support

Add support for ESP flows to testpmd.
Improve debug information in testpmd and the i40e PMD. Process ESP flows on the i40e Flow Director and RSS.

Changes in V5:
-------------
Rebase to latest master branch
Update 0012-librte_ethdev-add-ESP-and-AH-flow-types-to-RSS.patch

Changes in V4:
-------------
Add extra patch for testpmd
Add extra patch for config
Split v3 patch "net/i40e: process ESP flows" into 4 patches

Changes in V3:
-------------
Added i40e_flow_set_filter_spi() function in i40e_flow.c Set UDP destination port to 4500 for ESP in i40e_ethdev.h Split flow structures into 4 instead of 2 in i40e_ethdev.h Dropped extra printf from commandline_flow.c

Changes in V2:
--------------
Moved change in app/test-pmd/config.c to a seperate patch. Added extra parameter to fill_ip6_head() in i40e_fdir.c
set is_udp to false in i40e_flow_fdir_get_pctype_value() in i40e_flow.c

Bernard Iremonger (14):
app/testpmd: parse flow command line for ESP app/testpmd: improve debug
app/testpmd: dump Rx and Tx mbuf
net/i40e: improve RSS debug
net/i40e: handle ESP tunnel
net/i40e: support ipsec-ah profile
net/i40e: support ESP in customised code net/i40e: support ESP flows
net/i40e: support ESP in Flow Director
config: add debug to I40E Flow Director net/i40e: display Flow Director packet
librte_ethdev: add ESP and AH flow types to RSS
doc: release note for ESP
doc: update i40e user guide

 app/test-pmd/cmdline_flow.c            |   4 +-
 app/test-pmd/util.c                    |   1 +
 config/common_base                     |   1 +
 doc/guides/nics/i40e.rst               |   4 +-
 doc/guides/rel_notes/release_20_02.rst |   9 +++
 drivers/net/i40e/i40e_ethdev.c         |  52 ++++++++++++-
 drivers/net/i40e/i40e_ethdev.h         |  38 +++++++++
 drivers/net/i40e/i40e_fdir.c           | 138 ++++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c           | 135 +++++++++++++++++++++++++++++++-
 drivers/net/i40e/rte_pmd_i40e.c        |   3 +-
 lib/librte_ethdev/rte_ethdev.h         |  14 +++-
 11 files changed, 377 insertions(+), 22 deletions(-)
Signature · 1 line
2.7.4
Acked-by on the v5 series
#17 lore raw
Quoted 71 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Tuesday, January 14, 2020 9:55 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v5 00/14] net/i40e: ESP support

Add support for ESP flows to testpmd.
Improve debug information in testpmd and the i40e PMD. Process ESP flows on the i40e Flow Director and RSS.

Changes in V5:
-------------
Rebase to latest master branch
Update 0012-librte_ethdev-add-ESP-and-AH-flow-types-to-RSS.patch

Changes in V4:
-------------
Add extra patch for testpmd
Add extra patch for config
Split v3 patch "net/i40e: process ESP flows" into 4 patches

Changes in V3:
-------------
Added i40e_flow_set_filter_spi() function in i40e_flow.c Set UDP destination port to 4500 for ESP in i40e_ethdev.h Split flow structures into 4 instead of 2 in i40e_ethdev.h Dropped extra printf from commandline_flow.c

Changes in V2:
--------------
Moved change in app/test-pmd/config.c to a seperate patch.
Added extra parameter to fill_ip6_head() in i40e_fdir.c set is_udp to false in i40e_flow_fdir_get_pctype_value() in i40e_flow.c

Bernard Iremonger (14):
app/testpmd: parse flow command line for ESP
app/testpmd: improve debug
app/testpmd: dump Rx and Tx mbuf
net/i40e: improve RSS debug
net/i40e: handle ESP tunnel
net/i40e: support ipsec-ah profile
net/i40e: support ESP in customised code
net/i40e: support ESP flows
net/i40e: support ESP in Flow Director
config: add debug to I40E Flow Director
net/i40e: display Flow Director packet
librte_ethdev: add ESP and AH flow types to RSS
doc: release note for ESP
doc: update i40e user guide

 app/test-pmd/cmdline_flow.c            |   4 +-
 app/test-pmd/util.c                    |   1 +
 config/common_base                     |   1 +
 doc/guides/nics/i40e.rst               |   4 +-
 doc/guides/rel_notes/release_20_02.rst |   9 +++
 drivers/net/i40e/i40e_ethdev.c         |  52 ++++++++++++-
 drivers/net/i40e/i40e_ethdev.h         |  38 +++++++++
 drivers/net/i40e/i40e_fdir.c           | 138
++++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c           | 135
+++++++++++++++++++++++++++++++-
 drivers/net/i40e/rte_pmd_i40e.c        |   3 +-
 lib/librte_ethdev/rte_ethdev.h         |  14 +++-
 11 files changed, 377 insertions(+), 22 deletions(-)
Quoted 2 lines

--
2.7.4

For patch 4/14 - patch 14/14

Except minor capture on patch 7/14 and patch 12/14

#18 lore raw

PATCH v5 1/14 app/testpmd: parse flow command line for ESP

In reply to Bernard Iremonger

add ITEM_ESP
add ITEM_ESP_SPI

---
 app/test-pmd/cmdline_flow.c | 4 +---
 app/test-pmd/config.c       | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
app/test-pmd/cmdline_flow.c +1 -3
index 9643148..9c6edb8 100644
@@ -6075,9 +6075,6 @@ cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,
 static void
 cmd_flow_parsed(const struct buffer *in)
 {
-	printf("Flow command line parsed successfully for command=%d.\n",
-			in->command);
-
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr,
@@ -6261,6 +6258,7 @@ flow_item_default_mask(const struct rte_flow_item *item)
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
app/test-pmd/config.c +1 -1
index 2753ec5..d599682 100644
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n", __func__,
+	printf("Caught error type %d (%s): %s%s: %s\n",
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
 					error->cause), buf) : "",
Signature · 1 line
2.7.4
#19 lore raw

Re: [dpdk-dev] [PATCH v5 01/14] app/testpmd: parse flow command line for ESP

Quoted 15 lines · Bernard Iremonger

add ITEM_ESP
add ITEM_ESP_SPI

---
 app/test-pmd/cmdline_flow.c | 4 +---
 app/test-pmd/config.c       | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
app/test-pmd/cmdline_flow.c +0 -0
index 9643148..9c6edb8 100644

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t **hdr, · line 6080

Quoted 6 lines
app/test-pmd/cmdline_flow.c +0 -3
@@ -6075,9 +6075,6 @@ cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,
 static void
 cmd_flow_parsed(const struct buffer *in)
 {
-	printf("Flow command line parsed successfully for command=%d.\n",
-			in->command);
-

Hi Bernard,

Is this patchset depends another, or can there be something went wrong here, I can't find these lines removed also it is not really clear what this patchset does.

Quoted 25 lines
app/test-pmd/cmdline_flow.c +1 -0
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr,
@@ -6261,6 +6258,7 @@ flow_item_default_mask(const struct rte_flow_item *item)
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
app/test-pmd/config.c +1 -1
index 2753ec5..d599682 100644
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n", __func__,
+	printf("Caught error type %d (%s): %s%s: %s\n",
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
 					error->cause), buf) : "",
#20 lore raw

Re: [dpdk-dev] [PATCH v5 01/14] app/testpmd: parse flow command line for ESP

Hi Ferruh,

Quoted 31 lines

-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Tuesday, January 14, 2020 7:04 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 01/14] app/testpmd: parse flow command line for ESP

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t

Quoted 15 lines · Bernard Iremonger

add ITEM_ESP
add ITEM_ESP_SPI

---
 app/test-pmd/cmdline_flow.c | 4 +---
 app/test-pmd/config.c       | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
app/test-pmd/cmdline_flow.c +0 -0
index 9643148..9c6edb8 100644
@@ -6075,9 +6075,6 @@ cmd_flow_tok(cmdline_parse_token_hdr_t

**hdr,

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t · line 6076

Quoted 2 lines
app/test-pmd/cmdline_flow.c +0 -1
 static void  cmd_flow_parsed(const struct buffer *in)  {
-	printf("Flow command line parsed successfully for

command=%d.\n",

Quoted 8 lines

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t **hdr, · line 6080

Quoted 2 lines
app/test-pmd/cmdline_flow.c +0 -2
-			in->command);
-

Hi Bernard,

Is this patchset depends another, or can there be something went wrong here, I can't find these lines removed also it is not really clear what this patchset does.

Something has gone wrong here.
I will investigate.

Quoted 24 lines

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,

Quoted 4 lines
app/test-pmd/cmdline_flow.c +0 -0
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr, @@ -6261,6

+6258,7

app/test-pmd/config.c port_flow_complain(struct rte_flow_error

Quoted 13 lines
app/test-pmd/cmdline_flow.c +0 -0
 @@ flow_item_default_mask(const struct rte_flow_item *item)
 		break;
app/test-pmd/cmdline_flow.c +1 -0
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
app/test-pmd/config.c index renamed from app/test-pmd/config.c +0 -0

2753ec5..d599682 100644

app/test-pmd/config.c +0 -0
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error

*error)

app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error)

Quoted 4 lines
app/test-pmd/config.c +0 -1
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n",

__func__,

Quoted 5 lines

app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error) · line 1309

Quoted 5 lines
app/test-pmd/config.c +1 -0
+	printf("Caught error type %d (%s): %s%s: %s\n",
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
 					error->cause), buf) : "",

Regards,

Bernard

#21 lore raw

v6 cover net/i40e: ESP support

In reply to Bernard Iremonger

Changes in V6:
-------------
Rebase to latest master branch
Fixed patch 0001-app-testpmd-parse-flow-command-line-for-ESP.patch Dropped the following v5 patch due to ABI breakage:
0012-librte_ethdev-add-ESP-and-AH-flow-types-to-RSS.patch

Changes in V5:
-------------
Rebase to latest master branch
Update 0012-librte_ethdev-add-ESP-and-AH-flow-types-to-RSS.patch

Changes in V4:
-------------
Add extra patch for testpmd
Add extra patch for config
Split v3 patch "net/i40e: process ESP flows" into 4 patches

Changes in V3:
-------------
Added i40e_flow_set_filter_spi() function in i40e_flow.c Set UDP destination port to 4500 for ESP in i40e_ethdev.h Split flow structures into 4 instead of 2 in i40e_ethdev.h Dropped extra printf from commandline_flow.c

Changes in V2:
--------------
Moved change in app/test-pmd/config.c to a seperate patch. Added extra parameter to fill_ip6_head() in i40e_fdir.c
set is_udp to false in i40e_flow_fdir_get_pctype_value() in i40e_flow.c

Bernard Iremonger (13):
app/testpmd: parse flow command line for ESP app/testpmd: improve debug
app/testpmd: dump Rx and Tx mbuf
net/i40e: improve RSS debug
net/i40e: handle ESP tunnel
net/i40e: support ipsec-ah profile
net/i40e: support ESP in customized code net/i40e: support ESP flows
net/i40e: support ESP in Flow Director
config: add debug to I40E Flow Director net/i40e: display Flow Director packet
doc: release note for ESP
doc: update i40e user guide

 app/test-pmd/cmdline_flow.c            |  34 +++++++-
 app/test-pmd/config.c                  |   2 +-
 app/test-pmd/util.c                    |   1 +
 config/common_base                     |   1 +
 doc/guides/nics/i40e.rst               |   4 +-
 doc/guides/rel_notes/release_20_02.rst |   9 +++
 drivers/net/i40e/i40e_ethdev.c         |  52 ++++++++++++-
 drivers/net/i40e/i40e_ethdev.h         |  38 +++++++++
 drivers/net/i40e/i40e_fdir.c           | 138 ++++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c           | 135 +++++++++++++++++++++++++++++++-
 drivers/net/i40e/rte_pmd_i40e.c        |   3 +-
 11 files changed, 395 insertions(+), 22 deletions(-)
Signature · 1 line
2.7.4
#22 lore raw

v7 cover net/i40e: ESP support

Add support for ESP flows to testpmd.
Improve debug information in testpmd and the i40e PMD. Process ESP flows on the i40e Flow Director.

Changes in V7:
-------------
Dropped the following debug patch from v6 patchset 0003-app-testpmd-dump-Rx-and-Tx-mbuf.patch Included release notes and doc patches in feature patches.

Changes in V6:
-------------
Rebase to latest master branch
Fixed patch 0001-app-testpmd-parse-flow-command-line-for-ESP.patch Dropped the following v5 patch due to ABI breakage:
0012-librte_ethdev-add-ESP-and-AH-flow-types-to-RSS.patch

Changes in V5:
-------------
Rebase to latest master branch
Update 0012-librte_ethdev-add-ESP-and-AH-flow-types-to-RSS.patch

Changes in V4:
-------------
Add extra patch for testpmd
Add extra patch for config
Split v3 patch "net/i40e: process ESP flows" into 4 patches

Changes in V3:
-------------
Added i40e_flow_set_filter_spi() function in i40e_flow.c Set UDP destination port to 4500 for ESP in i40e_ethdev.h Split flow structures into 4 instead of 2 in i40e_ethdev.h Dropped extra printf from commandline_flow.c

Changes in V2:
--------------
Moved change in app/test-pmd/config.c to a seperate patch. Added extra parameter to fill_ip6_head() in i40e_fdir.c
set is_udp to false in i40e_flow_fdir_get_pctype_value() in i40e_flow.c Bernard Iremonger (10):
app/testpmd: parse flow command line for ESP
app/testpmd: improve debug
net/i40e: improve RSS debug
net/i40e: handle ESP tunnel
net/i40e: support ipsec-ah profile
net/i40e: support ESP in customized code
net/i40e: support ESP flows
net/i40e: support ESP in Flow Director
config: add debug to I40E Flow Director
net/i40e: display Flow Director packet

 app/test-pmd/cmdline_flow.c                 |  34 ++++++-
 app/test-pmd/config.c                       |   2 +-
 config/common_base                          |   1 +
 doc/guides/nics/i40e.rst                    |   4 +-
 doc/guides/rel_notes/release_20_02.rst      |  10 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  14 +++
 drivers/net/i40e/i40e_ethdev.c              |  52 ++++++++++-
 drivers/net/i40e/i40e_ethdev.h              |  38 ++++++++
 drivers/net/i40e/i40e_fdir.c                | 138 ++++++++++++++++++++++++++--
 drivers/net/i40e/i40e_flow.c                | 135 ++++++++++++++++++++++++++-
 drivers/net/i40e/rte_pmd_i40e.c             |   3 +-
 11 files changed, 409 insertions(+), 22 deletions(-)
Signature · 1 line
2.7.4
#23 lore raw
Quoted 35 lines · Bernard Iremonger

Add support for ESP flows to testpmd.
Improve debug information in testpmd and the i40e PMD. Process ESP flows on the i40e Flow Director.

Changes in V7:
-------------
Dropped the following debug patch from v6 patchset 0003-app-testpmd-dump-Rx-and-Tx-mbuf.patch Included release notes and doc patches in feature patches.

Changes in V6:
-------------
Rebase to latest master branch
Fixed patch 0001-app-testpmd-parse-flow-command-line-for-ESP.patch Dropped the following v5 patch due to ABI breakage:
0012-librte_ethdev-add-ESP-and-AH-flow-types-to-RSS.patch

Changes in V5:
-------------
Rebase to latest master branch
Update 0012-librte_ethdev-add-ESP-and-AH-flow-types-to-RSS.patch

Changes in V4:
-------------
Add extra patch for testpmd
Add extra patch for config
Split v3 patch "net/i40e: process ESP flows" into 4 patches

Changes in V3:
-------------
Added i40e_flow_set_filter_spi() function in i40e_flow.c Set UDP destination port to 4500 for ESP in i40e_ethdev.h Split flow structures into 4 instead of 2 in i40e_ethdev.h Dropped extra printf from commandline_flow.c

Quoted 16 lines

Changes in V2:
--------------
Moved change in app/test-pmd/config.c to a seperate patch. Added extra parameter to fill_ip6_head() in i40e_fdir.c
set is_udp to false in i40e_flow_fdir_get_pctype_value() in i40e_flow.c Bernard Iremonger (10):
app/testpmd: parse flow command line for ESP
app/testpmd: improve debug
net/i40e: improve RSS debug
net/i40e: handle ESP tunnel
net/i40e: support ipsec-ah profile
net/i40e: support ESP in customized code
net/i40e: support ESP flows
net/i40e: support ESP in Flow Director
config: add debug to I40E Flow Director
net/i40e: display Flow Director packet

Series applied to dpdk-next-net/master, thanks.

(Except 9/10 & 10/10, they are dropped while merging.)

Series wasn't rebased on next-net, I had to resolve conflict almost in all patches, can you please validate the result in next-net?

#24 lore raw

Hi Ferruh,

Quoted 63 lines

-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Thursday, January 16, 2020 5:43 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v7 00/10] net/i40e: ESP support

Quoted 35 lines · Bernard Iremonger

Add support for ESP flows to testpmd.
Improve debug information in testpmd and the i40e PMD. Process ESP flows on the i40e Flow Director.

Changes in V7:
-------------
Dropped the following debug patch from v6 patchset 0003-app-testpmd-dump-Rx-and-Tx-mbuf.patch Included release notes and doc patches in feature patches.

Changes in V6:
-------------
Rebase to latest master branch
Fixed patch 0001-app-testpmd-parse-flow-command-line-for-ESP.patch Dropped the following v5 patch due to ABI breakage:
0012-librte_ethdev-add-ESP-and-AH-flow-types-to-RSS.patch

Changes in V5:
-------------
Rebase to latest master branch
Update 0012-librte_ethdev-add-ESP-and-AH-flow-types-to-RSS.patch

Changes in V4:
-------------
Add extra patch for testpmd
Add extra patch for config
Split v3 patch "net/i40e: process ESP flows" into 4 patches

Changes in V3:
-------------
Added i40e_flow_set_filter_spi() function in i40e_flow.c Set UDP destination port to 4500 for ESP in i40e_ethdev.h Split flow structures into 4 instead of 2 in i40e_ethdev.h Dropped extra printf from commandline_flow.c

Quoted 16 lines

Changes in V2:
--------------
Moved change in app/test-pmd/config.c to a seperate patch. Added extra parameter to fill_ip6_head() in i40e_fdir.c set is_udp to false in i40e_flow_fdir_get_pctype_value() in i40e_flow.c Bernard Iremonger (10):
app/testpmd: parse flow command line for ESP app/testpmd: improve debug
net/i40e: improve RSS debug
net/i40e: handle ESP tunnel
net/i40e: support ipsec-ah profile
net/i40e: support ESP in customized code
net/i40e: support ESP flows
net/i40e: support ESP in Flow Director
config: add debug to I40E Flow Director
net/i40e: display Flow Director packet

Quoted 6 lines

Series applied to dpdk-next-net/master, thanks.

(Except 9/10 & 10/10, they are dropped while merging.)

Series wasn't rebased on next-net, I had to resolve conflict almost in all patches, can you please validate the result in next-net?

I have tested the merged result in DPDK 20.02-rc1.
I found an issue with i40e_fdir.c, I have sent a patch to fix the issue.

Regards,

Bernard.

#25 lore raw

PATCH v7 1/10 app/testpmd: parse flow command line for ESP

In reply to Bernard Iremonger

add ITEM_ESP
add ITEM_ESP_SPI
update release notes for testpmd changes
add sample ESP rules in testpmd guide

---
 app/test-pmd/cmdline_flow.c                 | 34 ++++++++++++++++++++++++++---
 doc/guides/rel_notes/release_20_02.rst      |  4 ++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 14 ++++++++++++
 3 files changed, 49 insertions(+), 3 deletions(-)
app/test-pmd/cmdline_flow.c +31 -3
index 99dade7..9c6edb8 100644
@@ -213,6 +213,8 @@ enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_ESP,
+	ITEM_ESP_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_ESP,
 	END_SET,
 	ZERO,
 };
@@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
 	ZERO,
 };
 
+static const enum index item_esp[] = {
+	ITEM_ESP_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag, index)),
 	},
+	[ITEM_ESP] = {
+		.name = "esp",
+		.help = "match ESP header",
+		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+		.next = NEXT(item_esp),
+		.call = parse_vc,
+	},
+	[ITEM_ESP_SPI] = {
+		.name = "spi",
+		.help = "security policy index",
+		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+				hdr.spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6230,14 +6253,15 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_GTP:
 		mask = &rte_flow_item_gtp_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_ESP:
-		mask = &rte_flow_item_esp_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 		mask = &rte_flow_item_gtp_psc_mask;
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		mask = &rte_flow_item_esp_mask;
+		break;
 	default:
 		break;
 	}
@@ -6327,6 +6351,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			size = sizeof(struct rte_flow_item_geneve);
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			size = sizeof(struct rte_flow_item_esp);
+			proto = 0x32;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
doc/guides/rel_notes/release_20_02.rst +4 -0
index 0eaa45a..057b7ee 100644
@@ -56,6 +56,10 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated testpmd to support ESP flows.**
+
+  Added support for ESP rte_flow patterns to the testpmd application.
+
 
 Removed Items
 -------------
doc/guides/testpmd_app_ug/testpmd_funcs.rst +14 -0
index 73ef0b4..fe84fa4 100644
@@ -4751,6 +4751,20 @@ Decapsulating VxLAN::
  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 /
         end actions raw_decap / queue index 0 / end
 
+Sample ESP rules
+~~~~~~~~~~~~~~~~
+
+ESP rules can be created by the following commands::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / esp spi is 1 / end actions
+        queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / esp spi is 1 / end
+        actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / esp spi is 1 / end actions
+        queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
+        actions queue index 3 / end
+
 BPF Functions
 --------------
 
Signature · 1 line
2.7.4
#26 lore raw

PATCH v7 2/10 app/testpmd: improve debug

In reply to Bernard Iremonger

print function name in port_flow_complain()

---
 app/test-pmd/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/config.c +1 -1
index d599682..2753ec5 100644
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("Caught error type %d (%s): %s%s: %s\n",
+	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n", __func__,
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
 					error->cause), buf) : "",
Signature · 1 line
2.7.4
Acked-by on v7 2/10
#27 lore raw

Re: [dpdk-dev] [PATCH v7 02/10] app/testpmd: improve debug

Quoted 14 lines

print function name in port_flow_complain()

---
 app/test-pmd/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/config.c +0 -0
index d599682..2753ec5 100644

app/test-pmd/config.c port_flow_complain(struct rte_flow_error *error)

Quoted 9 lines
app/test-pmd/config.c +1 -2
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("Caught error type %d (%s): %s%s: %s\n",
+	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n", __func__,
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
 					error->cause), buf) : "",
--
Quoted 1 line

2.7.4

#28 lore raw

PATCH v7 3/10 net/i40e: improve RSS debug

In reply to Bernard Iremonger

improve RSS debug in i40e_ethdev.c

---
 drivers/net/i40e/i40e_ethdev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +6 -2
index 5999c96..5f1cf8a 100644
@@ -8679,7 +8679,9 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 			num);
 
 	if (num == 0) {
-		PMD_INIT_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_INIT_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
@@ -12840,7 +12842,9 @@ i40e_config_rss_filter(struct i40e_pf *pf,
 			num);
 
 	if (num == 0) {
-		PMD_DRV_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_DRV_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
Signature · 1 line
2.7.4
#29 lore raw

PATCH v7 4/10 net/i40e: handle ESP tunnel

In reply to Bernard Iremonger

handle ESP tunnel in rte_pmd_i40e.c

---
 drivers/net/i40e/rte_pmd_i40e.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/rte_pmd_i40e.c +2 -1
index fdcb1a4..b987346 100644
@@ -2172,7 +2172,8 @@ static int check_invalid_pkt_type(uint32_t pkt_type)
 	    tnl != RTE_PTYPE_TUNNEL_GRENAT &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPC &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPU &&
-	    tnl != RTE_PTYPE_TUNNEL_L2TP)
+	    tnl != RTE_PTYPE_TUNNEL_L2TP &&
+	    tnl != RTE_PTYPE_TUNNEL_ESP)
 		return -1;
 
 	if (il2 &&
Signature · 1 line
2.7.4
#30 lore raw

PATCH v7 5/10 net/i40e: support ipsec-ah profile

In reply to Bernard Iremonger

Add flow structures for the following patterns in i40e_ethdev files:
eth/ipv4/esp
eth/ipv6/esp
eth/ipv4/udp/esp
eth/ipv6/esp/udp

add oip_type in filter
add is_udp in filter
use tenant_id in filter for spi

---
 drivers/net/i40e/i40e_ethdev.h | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
drivers/net/i40e/i40e_ethdev.h +38 -0
index 295ad59..792a047 100644
@@ -501,6 +501,29 @@ struct i40e_gtp_ipv6_flow {
 	struct rte_eth_ipv6_flow ip6;
 };
 
+/* A structure used to define the input for ESP IPV4 flow */
+struct i40e_esp_ipv4_flow {
+	struct rte_eth_ipv4_flow ipv4;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 flow */
+struct i40e_esp_ipv6_flow {
+	struct rte_eth_ipv6_flow ipv6;
+	uint32_t spi;	/* SPI in big endian. */
+};
+/* A structure used to define the input for ESP IPV4 UDP flow */
+struct i40e_esp_ipv4_udp_flow {
+	struct rte_eth_udpv4_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 UDP flow */
+struct i40e_esp_ipv6_udp_flow {
+	struct rte_eth_udpv6_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
 /* A structure used to define the input for raw type flow */
 struct i40e_raw_flow {
 	uint16_t pctype;
@@ -526,6 +549,10 @@ union i40e_fdir_flow {
 	struct i40e_gtp_ipv4_flow  gtp_ipv4_flow;
 	struct i40e_gtp_ipv6_flow  gtp_ipv6_flow;
 	struct i40e_raw_flow       raw_flow;
+	struct i40e_esp_ipv4_flow  esp_ipv4_flow;
+	struct i40e_esp_ipv6_flow  esp_ipv6_flow;
+	struct i40e_esp_ipv4_udp_flow  esp_ipv4_udp_flow;
+	struct i40e_esp_ipv6_udp_flow  esp_ipv6_udp_flow;
 };
 
 enum i40e_fdir_ip_type {
@@ -542,8 +569,10 @@ struct i40e_fdir_flow_ext {
 	uint16_t dst_id; /* VF ID, available when is_vf is 1*/
 	bool inner_ip;   /* If there is inner ip */
 	enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
+	enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
 	bool customized_pctype; /* If customized pctype is used */
 	bool pkt_template; /* If raw packet template is used */
+	bool is_udp; /* ipv4|ipv6 udp flow */
 };
 
 /* A structure used to define the input for a flow director filter entry */
@@ -769,6 +798,8 @@ enum i40e_tunnel_type {
 	I40E_TUNNEL_TYPE_QINQ,
 	I40E_TUNNEL_TYPE_GTPC,
 	I40E_TUNNEL_TYPE_GTPU,
+	I40E_TUNNEL_TYPE_ESPoUDP,
+	I40E_TUNNEL_TYPE_ESPoIP,
 	I40E_TUNNEL_TYPE_MAX,
 };
 
@@ -897,6 +928,12 @@ enum i40e_new_pctype {
 	I40E_CUSTOMIZED_GTPU_IPV4,
 	I40E_CUSTOMIZED_GTPU_IPV6,
 	I40E_CUSTOMIZED_GTPU,
+	I40E_CUSTOMIZED_ESP_IPV4,
+	I40E_CUSTOMIZED_ESP_IPV6,
+	I40E_CUSTOMIZED_ESP_IPV4_UDP,
+	I40E_CUSTOMIZED_ESP_IPV6_UDP,
+	I40E_CUSTOMIZED_AH_IPV4,
+	I40E_CUSTOMIZED_AH_IPV6,
 	I40E_CUSTOMIZED_MAX,
 };
 
@@ -1001,6 +1038,7 @@ struct i40e_pf {
 
 	/* Dynamic Device Personalization */
 	bool gtp_support; /* 1 - support GTP-C and GTP-U */
+	bool esp_support; /* 1 - support ESP SPI */
 	/* customer customized pctype */
 	struct i40e_customized_pctype customized_pctype[I40E_CUSTOMIZED_MAX];
 	/* Switch Domain Id */
Signature · 1 line
2.7.4
#31 lore raw

PATCH v7 6/10 net/i40e: support ESP in customized code

In reply to Bernard Iremonger

update customized code for ESP

---
 drivers/net/i40e/i40e_ethdev.c | 44 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev.c +43 -1
index 5f1cf8a..a462eba 100644
@@ -1106,6 +1106,7 @@ i40e_init_customized_info(struct i40e_pf *pf)
 	}
 
 	pf->gtp_support = false;
+	pf->esp_support = false;
 }
 
 void
@@ -12337,6 +12338,7 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			}
 		}
 		name[strlen(name) - 1] = '\0';
+		PMD_DRV_LOG(INFO, "name = %s\n", name);
 		if (!strcmp(name, "GTPC"))
 			new_pctype =
 				i40e_find_customized_pctype(pf,
@@ -12353,6 +12355,30 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			new_pctype =
 				i40e_find_customized_pctype(pf,
 						      I40E_CUSTOMIZED_GTPU);
+		else if (!strcmp(name, "IPV4_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+		else if (!strcmp(name, "IPV6_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		else if (!strcmp(name, "IPV4_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+		else if (!strcmp(name, "IPV6_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+		else if (!strcmp(name, "IPV4_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV4);
+		else if (!strcmp(name, "IPV6_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV6);
 		if (new_pctype) {
 			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD) {
 				new_pctype->pctype = pctype_value;
@@ -12448,6 +12474,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					continue;
 				memset(name, 0, sizeof(name));
 				strcpy(name, proto[n].name);
+				PMD_DRV_LOG(INFO, "name = %s\n", name);
 				if (!strncasecmp(name, "PPPOE", 5))
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_L2_ETHER_PPPOE;
@@ -12541,6 +12568,10 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GTPU;
 					in_tunnel = true;
+				} else if (!strncasecmp(name, "ESP", 3)) {
+					ptype_mapping[i].sw_ptype |=
+						RTE_PTYPE_TUNNEL_ESP;
+					in_tunnel = true;
 				} else if (!strncasecmp(name, "GRENAT", 6)) {
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GRENAT;
@@ -12560,7 +12591,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 	ret = rte_pmd_i40e_ptype_mapping_update(port_id, ptype_mapping,
 						ptype_num, 0);
 	if (ret)
-		PMD_DRV_LOG(ERR, "Failed to update mapping table.");
+		PMD_DRV_LOG(ERR, "Failed to update ptype mapping table.");
 
 	rte_free(ptype_mapping);
 	rte_free(ptype);
@@ -12625,6 +12656,17 @@ i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg,
 		}
 	}
 
+	/* Check if ESP is supported. */
+	for (i = 0; i < proto_num; i++) {
+		if (!strncmp(proto[i].name, "ESP", 3)) {
+			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD)
+				pf->esp_support = true;
+			else
+				pf->esp_support = false;
+			break;
+		}
+	}
+
 	/* Update customized pctype info */
 	ret = i40e_update_customized_pctype(dev, pkg, pkg_size,
 					    proto_num, proto, op);
Signature · 1 line
2.7.4
#32 lore raw

PATCH v7 7/10 net/i40e: support ESP flows

In reply to Bernard Iremonger

add eth/ipv4/esp and eth/ipv6/esp patterns add eth/ipv4/udp/esp and eth/ipv6/esp/udp patterns update i40e_flow_parse_fdir_filter()
add i40e_flow_set_filter_spi()

---
 drivers/net/i40e/i40e_flow.c | 135 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 132 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_flow.c +132 -3
index 6102103..c585d8b 100644
@@ -110,8 +110,7 @@ static int i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,
 static int i40e_flow_flush_fdir_filter(struct i40e_pf *pf);
 static int i40e_flow_flush_ethertype_filter(struct i40e_pf *pf);
 static int i40e_flow_flush_tunnel_filter(struct i40e_pf *pf);
-static int
-i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
+static int i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
 static int
 i40e_flow_parse_qinq_filter(struct rte_eth_dev *dev,
 			      const struct rte_flow_attr *attr,
@@ -1615,6 +1614,36 @@ static enum rte_flow_item_type pattern_qinq_1[] = {
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
+static enum rte_flow_item_type pattern_fdir_ipv4_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv4_udp_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_udp_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
 static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	/* Ethertype */
 	{ pattern_ethertype, i40e_flow_parse_ethertype_filter },
@@ -1628,6 +1657,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	{ pattern_fdir_ipv4_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_udp_esp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_udp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_tcp, i40e_flow_parse_fdir_filter },
@@ -1636,6 +1667,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	{ pattern_fdir_ipv6_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_udp_esp, i40e_flow_parse_fdir_filter },
 	/* FDIR - support default flow type with flexible payload */
 	{ pattern_fdir_ethertype_raw_1, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ethertype_raw_2, i40e_flow_parse_fdir_filter },
@@ -2420,6 +2453,28 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,
 			cus_pctype = i40e_find_customized_pctype(pf,
 						 I40E_CUSTOMIZED_GTPU_IPV6);
 		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		if (!filter->input.flow_ext.is_udp) {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+			else if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		} else {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+			else if (filter->input.flow_ext.oip_type ==
+					I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+			filter->input.flow_ext.is_udp = false;
+		}
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "Unsupported item type");
 		break;
@@ -2431,6 +2486,30 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,
 	return I40E_FILTER_PCTYPE_INVALID;
 }
 
+static void
+i40e_flow_set_filter_spi(struct i40e_fdir_filter_conf *filter,
+	const struct rte_flow_item_esp *esp_spec)
+{
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV4) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv4_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv4_flow.spi =
+				esp_spec->hdr.spi;
+	}
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV6) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv6_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv6_flow.spi =
+				esp_spec->hdr.spi;
+	}
+}
+
 /* 1. Last in item should be NULL as range is not supported.
  * 2. Supported patterns: refer to array i40e_supported_patterns.
  * 3. Default supported flow type and input set: refer to array
@@ -2459,6 +2538,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 	const struct rte_flow_item_udp *udp_spec, *udp_mask;
 	const struct rte_flow_item_sctp *sctp_spec, *sctp_mask;
 	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_esp *esp_spec, *esp_mask;
 	const struct rte_flow_item_raw *raw_spec, *raw_mask;
 	const struct rte_flow_item_vf *vf_spec;
 
@@ -2654,10 +2734,18 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 					ipv4_spec->hdr.src_addr;
 				filter->input.flow.ip4_flow.dst_ip =
 					ipv4_spec->hdr.dst_addr;
+
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;
 			} else if (!ipv4_spec && !ipv4_mask && !outer_ip) {
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV4;
+			} else if (!ipv4_spec && !ipv4_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;
 			} else if ((ipv4_spec || ipv4_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2716,6 +2804,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				filter->input.flow.ipv6_flow.hop_limits =
 					ipv6_spec->hdr.hop_limits;
 
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
+
 				rte_memcpy(filter->input.flow.ipv6_flow.src_ip,
 					   ipv6_spec->hdr.src_addr, 16);
 				rte_memcpy(filter->input.flow.ipv6_flow.dst_ip,
@@ -2729,6 +2821,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV6;
+			} else if (!ipv6_spec && !ipv6_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
 			} else if ((ipv6_spec || ipv6_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2828,7 +2924,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 						udp_spec->hdr.dst_port;
 				}
 			}
-
+			filter->input.flow_ext.is_udp = true;
 			layer_idx = I40E_FLXPLD_L4_IDX;
 
 			break;
@@ -2863,6 +2959,39 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				cus_proto = item_type;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			if (!pf->esp_support) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Unsupported ESP protocol");
+				return -rte_errno;
+			}
+
+			esp_spec = item->spec;
+			esp_mask = item->mask;
+
+			if (!esp_spec || !esp_mask) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ESP item");
+				return -rte_errno;
+			}
+
+			if (esp_spec && esp_mask) {
+				if (esp_mask->hdr.spi != UINT32_MAX) {
+					rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ESP mask");
+					return -rte_errno;
+				}
+				i40e_flow_set_filter_spi(filter, esp_spec);
+				filter->input.flow_ext.customized_pctype = true;
+				cus_proto = item_type;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_SCTP:
 			sctp_spec = item->spec;
 			sctp_mask = item->mask;
Signature · 1 line
2.7.4
#33 lore raw

PATCH v7 8/10 net/i40e: support ESP in Flow Director

In reply to Bernard Iremonger

add fill_ip6_head()
hardcode udp destination port to 4500
handle ESP and AH pctypes in ESP-AH profile
update the i40e user guide with ESP information.
update release notes for i40e changes

---
 doc/guides/nics/i40e.rst               |   4 +-
 doc/guides/rel_notes/release_20_02.rst |   6 ++
 drivers/net/i40e/i40e_fdir.c           | 126 ++++++++++++++++++++++++++++++---
 3 files changed, 127 insertions(+), 9 deletions(-)
doc/guides/nics/i40e.rst +3 -1
index 38acf59..5cf34d9 100644
@@ -457,7 +457,7 @@ which is used to configure hardware by downloading a profile to support
 protocols/filters which are not supported by default. The DDP
 functionality requires a NIC firmware version of 6.0 or greater.
 
-Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP,
+Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP/ESP,
 steering can be used with rte_flow API.
 
 GTPv1 package is released, and it can be downloaded from
@@ -466,6 +466,8 @@ https://downloadcenter.intel.com/download/27587.
 PPPoE package is released, and it can be downloaded from
 https://downloadcenter.intel.com/download/28040.
 
+ESP-AH package is not released yet.
+
 Load a profile which supports GTP and store backup profile:
 
 .. code-block:: console
doc/guides/rel_notes/release_20_02.rst +6 -0
index 057b7ee..cd4f6eb 100644
@@ -60,6 +60,12 @@ New Features
 
   Added support for ESP rte_flow patterns to the testpmd application.
 
+* **Updated i40e driver to support ESP.**
+
+  Updated the i40e PMD to support ESP-AH supporting profiles which can be
+  programmed by the dynamic device personalization (DDP) process.
+
+
 
 Removed Items
 -------------
drivers/net/i40e/i40e_fdir.c +118 -8

170 lines not on this page · raw message

Signature · 1 line
2.7.4
#34 lore raw

PATCH v7 9/10 config: add debug to I40E Flow Director

In reply to Bernard Iremonger

add CONFIG_RTE_LIBRTE_I40E_DEBUG_FD to config/common_base file

---
 config/common_base | 1 +
 1 file changed, 1 insertion(+)
config/common_base +1 -0
index 7dec7ed..7a76c26 100644
@@ -305,6 +305,7 @@ CONFIG_RTE_LIBRTE_I40E_PMD=y
 CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX_FREE=n
+CONFIG_RTE_LIBRTE_I40E_DEBUG_FD=y
 CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y
 CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=y
 CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n
Signature · 1 line
2.7.4
#35 lore raw

PATCH v7 10/10 net/i40e: display Flow Director packet

In reply to Bernard Iremonger

include rte_config.h in i40e_fdir.c
In debug mode call rte_hexdump in i40e_flow_fdir_construct_pkt() and in i40e_fdir_construct_pkt()

---
 drivers/net/i40e/i40e_fdir.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_fdir.c +10 -2
index 5f85703..67bb28c 100644
@@ -21,6 +21,10 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_config.h>
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+#include <rte_hexdump.h>
+#endif
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -954,7 +958,9 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len);
+#endif
 	return 0;
 }
 
@@ -1415,7 +1421,9 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len);
+#endif
 	return 0;
 }
 
Signature · 1 line
2.7.4
#36 lore raw

PATCH v6 1/13 app/testpmd: parse flow command line for ESP

In reply to Bernard Iremonger

add ITEM_ESP
add ITEM_ESP_SPI

---
 app/test-pmd/cmdline_flow.c | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)
app/test-pmd/cmdline_flow.c +31 -3
index 99dade7..9c6edb8 100644
@@ -213,6 +213,8 @@ enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_ESP,
+	ITEM_ESP_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_ESP,
 	END_SET,
 	ZERO,
 };
@@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
 	ZERO,
 };
 
+static const enum index item_esp[] = {
+	ITEM_ESP_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag, index)),
 	},
+	[ITEM_ESP] = {
+		.name = "esp",
+		.help = "match ESP header",
+		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+		.next = NEXT(item_esp),
+		.call = parse_vc,
+	},
+	[ITEM_ESP_SPI] = {
+		.name = "spi",
+		.help = "security policy index",
+		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+				hdr.spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6230,14 +6253,15 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_GTP:
 		mask = &rte_flow_item_gtp_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_ESP:
-		mask = &rte_flow_item_esp_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 		mask = &rte_flow_item_gtp_psc_mask;
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		mask = &rte_flow_item_esp_mask;
+		break;
 	default:
 		break;
 	}
@@ -6327,6 +6351,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			size = sizeof(struct rte_flow_item_geneve);
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			size = sizeof(struct rte_flow_item_esp);
+			proto = 0x32;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
Signature · 1 line
2.7.4
#37 lore raw

PATCH v6 2/13 app/testpmd: improve debug

In reply to Bernard Iremonger

print function name in port_flow_complain()

---
 app/test-pmd/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/config.c +1 -1
index d599682..2753ec5 100644
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("Caught error type %d (%s): %s%s: %s\n",
+	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n", __func__,
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
 					error->cause), buf) : "",
Signature · 1 line
2.7.4
#38 lore raw

PATCH v6 3/13 app/testpmd: dump Rx and Tx mbuf

In reply to Bernard Iremonger

add call to rte_pktmbuf_dump() in dump_pkt_burst in util.c

---
 app/test-pmd/util.c | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/util.c +1 -0
index b514be5..bf03873 100644
@@ -158,6 +158,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 		printf("  ol_flags: %s\n", buf);
 		if (rte_mbuf_check(mb, 1, &reason) < 0)
 			printf("INVALID mbuf: %s\n", reason);
+		rte_pktmbuf_dump(stdout, pkts[i], pkts[i]->data_len);
 	}
 }
 
Signature · 1 line
2.7.4
#39 lore raw

Re: [dpdk-dev] [PATCH v6 03/13] app/testpmd: dump Rx and Tx mbuf

Quoted 13 lines · Bernard Iremonger

add call to rte_pktmbuf_dump() in dump_pkt_burst in util.c

---
 app/test-pmd/util.c | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/util.c +0 -0
index b514be5..bf03873 100644

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], · line 164

Quoted 7 lines
app/test-pmd/util.c +1 -0
@@ -158,6 +158,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 		printf("  ol_flags: %s\n", buf);
 		if (rte_mbuf_check(mb, 1, &reason) < 0)
 			printf("INVALID mbuf: %s\n", reason);
+		rte_pktmbuf_dump(stdout, pkts[i], pkts[i]->data_len);
 	}
 }
 

I am not sure about this change, 'dump_pkt_burst' is good for debugging and getting the packet metadata, but having mbuf dump for each packet can make it very verbose and harder to use.
If there is a need for it, can we add it with another command? like verbose value 0,1,2,3 defines the dump_pkt_burst level, why not add a new level to dump mbuf?

#40 lore raw

Re: [dpdk-dev] [PATCH v6 03/13] app/testpmd: dump Rx and Tx mbuf

Hi Ferruh,

Quoted 25 lines

-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Wednesday, January 15, 2020 4:29 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v6 03/13] app/testpmd: dump Rx and Tx mbuf

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t queue,

Quoted 12 lines · Bernard Iremonger

add call to rte_pktmbuf_dump() in dump_pkt_burst in util.c

---
 app/test-pmd/util.c | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/util.c index renamed from app/test-pmd/util.c +0 -0

b514be5..bf03873 100644

app/test-pmd/util.c +0 -0
@@ -158,6 +158,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue,

struct rte_mbuf *pkts[],

Quoted 15 lines

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], · line 164

Quoted 8 lines
app/test-pmd/util.c +1 -0
 		printf("  ol_flags: %s\n", buf);
 		if (rte_mbuf_check(mb, 1, &reason) < 0)
 			printf("INVALID mbuf: %s\n", reason);
+		rte_pktmbuf_dump(stdout, pkts[i], pkts[i]->data_len);
 	}
 }
 

I am not sure about this change, 'dump_pkt_burst' is good for debugging and getting the packet metadata, but having mbuf dump for each packet can make it very verbose and harder to use.
If there is a need for it, can we add it with another command? like verbose value 0,1,2,3 defines the dump_pkt_burst level, why not add a new level to dump mbuf?

This is only printed for verbose levels 1 (rx) and 3 (rx+tx). Normally used for debugging a small number or burst of packets. If you think it is too verbose I can live without this patch.

Regards,

Bernard.

#41 lore raw

PATCH v6 4/13 net/i40e: improve RSS debug

In reply to Bernard Iremonger

improve RSS debug in i40e_ethdev.c

---
 drivers/net/i40e/i40e_ethdev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +6 -2
index 5999c96..5f1cf8a 100644
@@ -8679,7 +8679,9 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 			num);
 
 	if (num == 0) {
-		PMD_INIT_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_INIT_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
@@ -12840,7 +12842,9 @@ i40e_config_rss_filter(struct i40e_pf *pf,
 			num);
 
 	if (num == 0) {
-		PMD_DRV_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_DRV_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
Signature · 1 line
2.7.4
#42 lore raw

PATCH v6 5/13 net/i40e: handle ESP tunnel

In reply to Bernard Iremonger

handle ESP tunnel in rte_pmd_i40e.c

---
 drivers/net/i40e/rte_pmd_i40e.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/rte_pmd_i40e.c +2 -1
index fdcb1a4..b987346 100644
@@ -2172,7 +2172,8 @@ static int check_invalid_pkt_type(uint32_t pkt_type)
 	    tnl != RTE_PTYPE_TUNNEL_GRENAT &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPC &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPU &&
-	    tnl != RTE_PTYPE_TUNNEL_L2TP)
+	    tnl != RTE_PTYPE_TUNNEL_L2TP &&
+	    tnl != RTE_PTYPE_TUNNEL_ESP)
 		return -1;
 
 	if (il2 &&
Signature · 1 line
2.7.4
#43 lore raw

PATCH v6 6/13 net/i40e: support ipsec-ah profile

In reply to Bernard Iremonger

Add flow structures for the following patterns in i40e_ethdev files:
eth/ipv4/esp
eth/ipv6/esp
eth/ipv4/udp/esp
eth/ipv6/esp/udp

add oip_type in filter
add is_udp in filter
use tenant_id in filter for spi

---
 drivers/net/i40e/i40e_ethdev.h | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
drivers/net/i40e/i40e_ethdev.h +38 -0
index 295ad59..792a047 100644
@@ -501,6 +501,29 @@ struct i40e_gtp_ipv6_flow {
 	struct rte_eth_ipv6_flow ip6;
 };
 
+/* A structure used to define the input for ESP IPV4 flow */
+struct i40e_esp_ipv4_flow {
+	struct rte_eth_ipv4_flow ipv4;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 flow */
+struct i40e_esp_ipv6_flow {
+	struct rte_eth_ipv6_flow ipv6;
+	uint32_t spi;	/* SPI in big endian. */
+};
+/* A structure used to define the input for ESP IPV4 UDP flow */
+struct i40e_esp_ipv4_udp_flow {
+	struct rte_eth_udpv4_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 UDP flow */
+struct i40e_esp_ipv6_udp_flow {
+	struct rte_eth_udpv6_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
 /* A structure used to define the input for raw type flow */
 struct i40e_raw_flow {
 	uint16_t pctype;
@@ -526,6 +549,10 @@ union i40e_fdir_flow {
 	struct i40e_gtp_ipv4_flow  gtp_ipv4_flow;
 	struct i40e_gtp_ipv6_flow  gtp_ipv6_flow;
 	struct i40e_raw_flow       raw_flow;
+	struct i40e_esp_ipv4_flow  esp_ipv4_flow;
+	struct i40e_esp_ipv6_flow  esp_ipv6_flow;
+	struct i40e_esp_ipv4_udp_flow  esp_ipv4_udp_flow;
+	struct i40e_esp_ipv6_udp_flow  esp_ipv6_udp_flow;
 };
 
 enum i40e_fdir_ip_type {
@@ -542,8 +569,10 @@ struct i40e_fdir_flow_ext {
 	uint16_t dst_id; /* VF ID, available when is_vf is 1*/
 	bool inner_ip;   /* If there is inner ip */
 	enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
+	enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
 	bool customized_pctype; /* If customized pctype is used */
 	bool pkt_template; /* If raw packet template is used */
+	bool is_udp; /* ipv4|ipv6 udp flow */
 };
 
 /* A structure used to define the input for a flow director filter entry */
@@ -769,6 +798,8 @@ enum i40e_tunnel_type {
 	I40E_TUNNEL_TYPE_QINQ,
 	I40E_TUNNEL_TYPE_GTPC,
 	I40E_TUNNEL_TYPE_GTPU,
+	I40E_TUNNEL_TYPE_ESPoUDP,
+	I40E_TUNNEL_TYPE_ESPoIP,
 	I40E_TUNNEL_TYPE_MAX,
 };
 
@@ -897,6 +928,12 @@ enum i40e_new_pctype {
 	I40E_CUSTOMIZED_GTPU_IPV4,
 	I40E_CUSTOMIZED_GTPU_IPV6,
 	I40E_CUSTOMIZED_GTPU,
+	I40E_CUSTOMIZED_ESP_IPV4,
+	I40E_CUSTOMIZED_ESP_IPV6,
+	I40E_CUSTOMIZED_ESP_IPV4_UDP,
+	I40E_CUSTOMIZED_ESP_IPV6_UDP,
+	I40E_CUSTOMIZED_AH_IPV4,
+	I40E_CUSTOMIZED_AH_IPV6,
 	I40E_CUSTOMIZED_MAX,
 };
 
@@ -1001,6 +1038,7 @@ struct i40e_pf {
 
 	/* Dynamic Device Personalization */
 	bool gtp_support; /* 1 - support GTP-C and GTP-U */
+	bool esp_support; /* 1 - support ESP SPI */
 	/* customer customized pctype */
 	struct i40e_customized_pctype customized_pctype[I40E_CUSTOMIZED_MAX];
 	/* Switch Domain Id */
Signature · 1 line
2.7.4
#44 lore raw

PATCH v6 7/13 net/i40e: support ESP in customized code

In reply to Bernard Iremonger

update customized code for ESP

---
 drivers/net/i40e/i40e_ethdev.c | 44 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev.c +43 -1
index 5f1cf8a..a462eba 100644
@@ -1106,6 +1106,7 @@ i40e_init_customized_info(struct i40e_pf *pf)
 	}
 
 	pf->gtp_support = false;
+	pf->esp_support = false;
 }
 
 void
@@ -12337,6 +12338,7 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			}
 		}
 		name[strlen(name) - 1] = '\0';
+		PMD_DRV_LOG(INFO, "name = %s\n", name);
 		if (!strcmp(name, "GTPC"))
 			new_pctype =
 				i40e_find_customized_pctype(pf,
@@ -12353,6 +12355,30 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			new_pctype =
 				i40e_find_customized_pctype(pf,
 						      I40E_CUSTOMIZED_GTPU);
+		else if (!strcmp(name, "IPV4_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+		else if (!strcmp(name, "IPV6_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		else if (!strcmp(name, "IPV4_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+		else if (!strcmp(name, "IPV6_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+		else if (!strcmp(name, "IPV4_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV4);
+		else if (!strcmp(name, "IPV6_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV6);
 		if (new_pctype) {
 			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD) {
 				new_pctype->pctype = pctype_value;
@@ -12448,6 +12474,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					continue;
 				memset(name, 0, sizeof(name));
 				strcpy(name, proto[n].name);
+				PMD_DRV_LOG(INFO, "name = %s\n", name);
 				if (!strncasecmp(name, "PPPOE", 5))
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_L2_ETHER_PPPOE;
@@ -12541,6 +12568,10 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GTPU;
 					in_tunnel = true;
+				} else if (!strncasecmp(name, "ESP", 3)) {
+					ptype_mapping[i].sw_ptype |=
+						RTE_PTYPE_TUNNEL_ESP;
+					in_tunnel = true;
 				} else if (!strncasecmp(name, "GRENAT", 6)) {
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GRENAT;
@@ -12560,7 +12591,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 	ret = rte_pmd_i40e_ptype_mapping_update(port_id, ptype_mapping,
 						ptype_num, 0);
 	if (ret)
-		PMD_DRV_LOG(ERR, "Failed to update mapping table.");
+		PMD_DRV_LOG(ERR, "Failed to update ptype mapping table.");
 
 	rte_free(ptype_mapping);
 	rte_free(ptype);
@@ -12625,6 +12656,17 @@ i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg,
 		}
 	}
 
+	/* Check if ESP is supported. */
+	for (i = 0; i < proto_num; i++) {
+		if (!strncmp(proto[i].name, "ESP", 3)) {
+			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD)
+				pf->esp_support = true;
+			else
+				pf->esp_support = false;
+			break;
+		}
+	}
+
 	/* Update customized pctype info */
 	ret = i40e_update_customized_pctype(dev, pkg, pkg_size,
 					    proto_num, proto, op);
Signature · 1 line
2.7.4
#45 lore raw

PATCH v6 8/13 net/i40e: support ESP flows

In reply to Bernard Iremonger

add eth/ipv4/esp and eth/ipv6/esp patterns add eth/ipv4/udp/esp and eth/ipv6/esp/udp patterns update i40e_flow_parse_fdir_filter()
add i40e_flow_set_filter_spi()

---
 drivers/net/i40e/i40e_flow.c | 135 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 132 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_flow.c +132 -3
index 6102103..c585d8b 100644
@@ -110,8 +110,7 @@ static int i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,
 static int i40e_flow_flush_fdir_filter(struct i40e_pf *pf);
 static int i40e_flow_flush_ethertype_filter(struct i40e_pf *pf);
 static int i40e_flow_flush_tunnel_filter(struct i40e_pf *pf);
-static int
-i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
+static int i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
 static int
 i40e_flow_parse_qinq_filter(struct rte_eth_dev *dev,
 			      const struct rte_flow_attr *attr,
@@ -1615,6 +1614,36 @@ static enum rte_flow_item_type pattern_qinq_1[] = {
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
+static enum rte_flow_item_type pattern_fdir_ipv4_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv4_udp_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_udp_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
 static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	/* Ethertype */
 	{ pattern_ethertype, i40e_flow_parse_ethertype_filter },
@@ -1628,6 +1657,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	{ pattern_fdir_ipv4_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_udp_esp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_udp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_tcp, i40e_flow_parse_fdir_filter },
@@ -1636,6 +1667,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	{ pattern_fdir_ipv6_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_udp_esp, i40e_flow_parse_fdir_filter },
 	/* FDIR - support default flow type with flexible payload */
 	{ pattern_fdir_ethertype_raw_1, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ethertype_raw_2, i40e_flow_parse_fdir_filter },
@@ -2420,6 +2453,28 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,
 			cus_pctype = i40e_find_customized_pctype(pf,
 						 I40E_CUSTOMIZED_GTPU_IPV6);
 		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		if (!filter->input.flow_ext.is_udp) {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+			else if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		} else {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+			else if (filter->input.flow_ext.oip_type ==
+					I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+			filter->input.flow_ext.is_udp = false;
+		}
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "Unsupported item type");
 		break;
@@ -2431,6 +2486,30 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,
 	return I40E_FILTER_PCTYPE_INVALID;
 }
 
+static void
+i40e_flow_set_filter_spi(struct i40e_fdir_filter_conf *filter,
+	const struct rte_flow_item_esp *esp_spec)
+{
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV4) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv4_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv4_flow.spi =
+				esp_spec->hdr.spi;
+	}
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV6) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv6_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv6_flow.spi =
+				esp_spec->hdr.spi;
+	}
+}
+
 /* 1. Last in item should be NULL as range is not supported.
  * 2. Supported patterns: refer to array i40e_supported_patterns.
  * 3. Default supported flow type and input set: refer to array
@@ -2459,6 +2538,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 	const struct rte_flow_item_udp *udp_spec, *udp_mask;
 	const struct rte_flow_item_sctp *sctp_spec, *sctp_mask;
 	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_esp *esp_spec, *esp_mask;
 	const struct rte_flow_item_raw *raw_spec, *raw_mask;
 	const struct rte_flow_item_vf *vf_spec;
 
@@ -2654,10 +2734,18 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 					ipv4_spec->hdr.src_addr;
 				filter->input.flow.ip4_flow.dst_ip =
 					ipv4_spec->hdr.dst_addr;
+
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;
 			} else if (!ipv4_spec && !ipv4_mask && !outer_ip) {
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV4;
+			} else if (!ipv4_spec && !ipv4_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;
 			} else if ((ipv4_spec || ipv4_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2716,6 +2804,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				filter->input.flow.ipv6_flow.hop_limits =
 					ipv6_spec->hdr.hop_limits;
 
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
+
 				rte_memcpy(filter->input.flow.ipv6_flow.src_ip,
 					   ipv6_spec->hdr.src_addr, 16);
 				rte_memcpy(filter->input.flow.ipv6_flow.dst_ip,
@@ -2729,6 +2821,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV6;
+			} else if (!ipv6_spec && !ipv6_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
 			} else if ((ipv6_spec || ipv6_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2828,7 +2924,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 						udp_spec->hdr.dst_port;
 				}
 			}
-
+			filter->input.flow_ext.is_udp = true;
 			layer_idx = I40E_FLXPLD_L4_IDX;
 
 			break;
@@ -2863,6 +2959,39 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				cus_proto = item_type;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			if (!pf->esp_support) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Unsupported ESP protocol");
+				return -rte_errno;
+			}
+
+			esp_spec = item->spec;
+			esp_mask = item->mask;
+
+			if (!esp_spec || !esp_mask) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ESP item");
+				return -rte_errno;
+			}
+
+			if (esp_spec && esp_mask) {
+				if (esp_mask->hdr.spi != UINT32_MAX) {
+					rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ESP mask");
+					return -rte_errno;
+				}
+				i40e_flow_set_filter_spi(filter, esp_spec);
+				filter->input.flow_ext.customized_pctype = true;
+				cus_proto = item_type;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_SCTP:
 			sctp_spec = item->spec;
 			sctp_mask = item->mask;
Signature · 1 line
2.7.4
#46 lore raw

PATCH v6 9/13 net/i40e: support ESP in Flow Director

In reply to Bernard Iremonger

add fill_ip6_head()
hardcode udp destination port to 4500
handle ESP and AH pctypes in ESP-AH profile

---
 drivers/net/i40e/i40e_fdir.c | 126 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 118 insertions(+), 8 deletions(-)
drivers/net/i40e/i40e_fdir.c +118 -8
index dee007d..5f85703 100644
@@ -54,6 +54,8 @@
 #define I40E_FDIR_GTP_MSG_TYPE_0X01         0x01
 #define I40E_FDIR_GTP_MSG_TYPE_0XFF         0xFF
 
+#define I40E_FDIR_ESP_DST_PORT              4500
+
 /* Wait time for fdir filter programming */
 #define I40E_FDIR_MAX_WAIT_US 10000
 
@@ -971,6 +973,37 @@ i40e_flow_fdir_find_customized_pctype(struct i40e_pf *pf, uint8_t pctype)
 }
 
 static inline int
+fill_ip6_head(const struct i40e_fdir_input *fdir_input, unsigned char *raw_pkt,
+		uint8_t next_proto, uint8_t len, uint16_t *ether_type)
+{
+	struct rte_ipv6_hdr *ip6;
+
+	ip6 = (struct rte_ipv6_hdr *)raw_pkt;
+
+	*ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
+	ip6->vtc_flow = rte_cpu_to_be_32(I40E_FDIR_IPv6_DEFAULT_VTC_FLOW |
+		(fdir_input->flow.ipv6_flow.tc << I40E_FDIR_IPv6_TC_OFFSET));
+	ip6->payload_len = rte_cpu_to_be_16(I40E_FDIR_IPv6_PAYLOAD_LEN);
+	ip6->proto = fdir_input->flow.ipv6_flow.proto ?
+		fdir_input->flow.ipv6_flow.proto : next_proto;
+	ip6->hop_limits = fdir_input->flow.ipv6_flow.hop_limits ?
+		fdir_input->flow.ipv6_flow.hop_limits :
+		I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS;
+	/**
+	 * The source and destination fields in the transmitted packet
+	 * need to be presented in a reversed order with respect
+	 * to the expected received packets.
+	 */
+	rte_memcpy(&ip6->src_addr, &fdir_input->flow.ipv6_flow.dst_ip,
+		IPV6_ADDR_LEN);
+	rte_memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip,
+		IPV6_ADDR_LEN);
+	len += sizeof(struct rte_ipv6_hdr);
+
+	return len;
+}
+
+static inline int
 i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 				const struct i40e_fdir_input *fdir_input,
 				unsigned char *raw_pkt,
@@ -1045,16 +1078,29 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 		ip->src_addr = fdir_input->flow.ip4_flow.dst_ip;
 		ip->dst_addr = fdir_input->flow.ip4_flow.src_ip;
 
-		if (!is_customized_pctype)
+		if (!is_customized_pctype) {
 			ip->next_proto_id = fdir_input->flow.ip4_flow.proto ?
 				fdir_input->flow.ip4_flow.proto :
 				next_proto[fdir_input->pctype];
-		else if (cus_pctype->index == I40E_CUSTOMIZED_GTPC ||
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_GTPC ||
 			 cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4 ||
 			 cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 ||
-			 cus_pctype->index == I40E_CUSTOMIZED_GTPU)
+			 cus_pctype->index == I40E_CUSTOMIZED_GTPU) {
 			ip->next_proto_id = IPPROTO_UDP;
-		len += sizeof(struct rte_ipv4_hdr);
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4) {
+			ip->next_proto_id = IPPROTO_ESP;
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4_UDP) {
+			ip->next_proto_id = IPPROTO_UDP;
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6)
+			len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_ESP,
+					len, ether_type);
+		else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6_UDP)
+			len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_UDP,
+					len, ether_type);
 	} else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP ||
 		   pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP ||
 		   pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP ||
@@ -1088,8 +1134,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 			   IPV6_ADDR_LEN);
 		len += sizeof(struct rte_ipv6_hdr);
 	} else {
-		PMD_DRV_LOG(ERR, "unknown pctype %u.",
-			    fdir_input->pctype);
+		PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype);
 		return -1;
 	}
 
@@ -1115,6 +1160,10 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 	struct rte_flow_item_gtp *gtp;
 	struct rte_ipv4_hdr *gtp_ipv4;
 	struct rte_ipv6_hdr *gtp_ipv6;
+	struct rte_flow_item_esp *esp;
+	struct rte_ipv4_hdr *esp_ipv4;
+	struct rte_ipv6_hdr *esp_ipv6;
+
 	uint8_t size, dst = 0;
 	uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/
 	int len;
@@ -1285,10 +1334,71 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 			} else
 				payload = (unsigned char *)gtp +
 					sizeof(struct rte_flow_item_gtp);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4 ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6 ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4_UDP ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6_UDP) {
+			if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4) {
+				esp_ipv4 = (struct rte_ipv4_hdr *)
+					(raw_pkt + len);
+				esp = (struct rte_flow_item_esp *)esp_ipv4;
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv4_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV4_UDP) {
+				esp_ipv4 = (struct rte_ipv4_hdr *)
+					(raw_pkt + len);
+				udp = (struct rte_udp_hdr *)esp_ipv4;
+				udp->dst_port = rte_cpu_to_be_16
+					(I40E_FDIR_ESP_DST_PORT);
+
+				udp->dgram_len = rte_cpu_to_be_16
+						(I40E_FDIR_UDP_DEFAULT_LEN);
+				esp = (struct rte_flow_item_esp *)
+					((unsigned char *)esp_ipv4 +
+						sizeof(struct rte_udp_hdr));
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv4_udp_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_udp_hdr) +
+						sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV6) {
+				esp_ipv6 = (struct rte_ipv6_hdr *)
+					(raw_pkt + len);
+				esp = (struct rte_flow_item_esp *)esp_ipv6;
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv6_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV6_UDP) {
+				esp_ipv6 = (struct rte_ipv6_hdr *)
+					(raw_pkt + len);
+				udp = (struct rte_udp_hdr *)esp_ipv6;
+				udp->dst_port =	rte_cpu_to_be_16
+					(I40E_FDIR_ESP_DST_PORT);
+
+				udp->dgram_len = rte_cpu_to_be_16
+					(I40E_FDIR_UDP_DEFAULT_LEN);
+				esp = (struct rte_flow_item_esp *)
+					((unsigned char *)esp_ipv6 +
+						sizeof(struct rte_udp_hdr));
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv6_udp_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_udp_hdr) +
+						sizeof(struct rte_esp_hdr);
+			}
 		}
 	} else {
-		PMD_DRV_LOG(ERR, "unknown pctype %u.",
-			    fdir_input->pctype);
+		PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype);
 		return -1;
 	}
 
Signature · 1 line
2.7.4
#47 lore raw

PATCH v6 10/13 config: add debug to I40E Flow Director

In reply to Bernard Iremonger

add CONFIG_RTE_LIBRTE_I40E_DEBUG_FD to config/common_base file

---
 config/common_base | 1 +
 1 file changed, 1 insertion(+)
config/common_base +1 -0
index 7dec7ed..7a76c26 100644
@@ -305,6 +305,7 @@ CONFIG_RTE_LIBRTE_I40E_PMD=y
 CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX_FREE=n
+CONFIG_RTE_LIBRTE_I40E_DEBUG_FD=y
 CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y
 CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=y
 CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n
Signature · 1 line
2.7.4
#48 lore raw

Re: [dpdk-dev] [PATCH v6 10/13] config: add debug to I40E Flow Director

Quoted 13 lines · Bernard Iremonger

add CONFIG_RTE_LIBRTE_I40E_DEBUG_FD to config/common_base file

---
 config/common_base | 1 +
 1 file changed, 1 insertion(+)
config/common_base +0 -0
index 7dec7ed..7a76c26 100644

config/common_base CONFIG_RTE_LIBRTE_I40E_PMD=y · line 311

Quoted 7 lines
config/common_base +1 -0
@@ -305,6 +305,7 @@ CONFIG_RTE_LIBRTE_I40E_PMD=y
 CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX_FREE=n
+CONFIG_RTE_LIBRTE_I40E_DEBUG_FD=y
 CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y
 CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=y
 CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n

Hi Bernard,

If the dynamic log won't make in time, what do you think dropping the RTE_LIBRTE_I40E_DEBUG_FD patches for now, it seems it is only for debug, and do the dynamic log support incremental later?

#49 lore raw

Re: [dpdk-dev] [PATCH v6 10/13] config: add debug to I40E Flow Director

Hi Ferruh,

Quoted 33 lines

-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Wednesday, January 15, 2020 4:18 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v6 10/13] config: add debug to I40E Flow Director

Quoted 12 lines · Bernard Iremonger

add CONFIG_RTE_LIBRTE_I40E_DEBUG_FD to config/common_base file

---
 config/common_base | 1 +
 1 file changed, 1 insertion(+)
config/common_base index renamed from config/common_base +0 -0

7dec7ed..7a76c26 100644

config/common_base +0 -0
@@ -305,6 +305,7 @@ CONFIG_RTE_LIBRTE_I40E_PMD=y
Quoted 1 line

CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=n

CONFIG_RTE_LIBRTE_I40E_DEBUG_TX=n

Quoted 6 lines

CONFIG_RTE_LIBRTE_I40E_DEBUG_TX_FREE=n
+CONFIG_RTE_LIBRTE_I40E_DEBUG_FD=y
CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y
CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=y
CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n

Quoted 5 lines

Hi Bernard,

If the dynamic log won't make in time, what do you think dropping the RTE_LIBRTE_I40E_DEBUG_FD patches for now, it seems it is only for debug, and do the dynamic log support incremental later?

I have had a look at the existing rte_log() support in the i40e code in i40e_logs.h and i40e_ethdev.c (line 403 +) and lines 12930 + The RTE_LIBRTE_I40E_DEBUG_XXX macros are used so this change to config/common_base is needed for dynamic logging too.

The PMD_RX_LOG() seems to only do a printf () which is not what I want.

I would like to keep these two patches which have been acked in the v5 patchset.

I will continue with the dynamic logging after the merge if that is allowed.

Regards,

Bernard

#50 lore raw

Re: [dpdk-dev] [PATCH v6 10/13] config: add debug to I40E Flow Director

Quoted 35 lines · Bernard

Hi Ferruh,

Quoted 33 lines

-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Wednesday, January 15, 2020 4:18 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v6 10/13] config: add debug to I40E Flow Director

Quoted 12 lines · Bernard Iremonger

add CONFIG_RTE_LIBRTE_I40E_DEBUG_FD to config/common_base file

---
 config/common_base | 1 +
 1 file changed, 1 insertion(+)
config/common_base index renamed from config/common_base +0 -0

7dec7ed..7a76c26 100644

config/common_base +0 -0
@@ -305,6 +305,7 @@ CONFIG_RTE_LIBRTE_I40E_PMD=y
Quoted 1 line

CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=n

CONFIG_RTE_LIBRTE_I40E_DEBUG_TX=n

Quoted 6 lines

CONFIG_RTE_LIBRTE_I40E_DEBUG_TX_FREE=n
+CONFIG_RTE_LIBRTE_I40E_DEBUG_FD=y
CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y
CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=y
CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n

Quoted 8 lines
Quoted 5 lines

Hi Bernard,

If the dynamic log won't make in time, what do you think dropping the RTE_LIBRTE_I40E_DEBUG_FD patches for now, it seems it is only for debug, and do the dynamic log support incremental later?

I have had a look at the existing rte_log() support in the i40e code in i40e_logs.h and i40e_ethdev.c (line 403 +) and lines 12930 + The RTE_LIBRTE_I40E_DEBUG_XXX macros are used so this change to config/common_base is needed for dynamic logging too.

These are for datapath, unfortunately we don't have any other option for datapath.

I saw v7 is sent, let me continue to process it dropping this bit.

Thanks,
ferruh

Quoted 13 lines

The PMD_RX_LOG() seems to only do a printf () which is not what I want.

I would like to keep these two patches which have been acked in the v5 patchset.

I will continue with the dynamic logging after the merge if that is allowed.

Regards,

Bernard

#51 lore raw

PATCH v6 11/13 net/i40e: display Flow Director packet

In reply to Bernard Iremonger

include rte_config.h in i40e_fdir.c
In debug mode call rte_hexdump in i40e_flow_fdir_construct_pkt() and in i40e_fdir_construct_pkt()

---
 drivers/net/i40e/i40e_fdir.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_fdir.c +10 -2
index 5f85703..67bb28c 100644
@@ -21,6 +21,10 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_config.h>
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+#include <rte_hexdump.h>
+#endif
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -954,7 +958,9 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len);
+#endif
 	return 0;
 }
 
@@ -1415,7 +1421,9 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len);
+#endif
 	return 0;
 }
 
Signature · 1 line
2.7.4
#52 lore raw

PATCH v6 12/13 doc: release note for ESP

In reply to Bernard Iremonger

Release note for ESP support on the i40e PMD.
Release note for ESP support on testpmd.

---
 doc/guides/rel_notes/release_20_02.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
doc/guides/rel_notes/release_20_02.rst +9 -0
index 0eaa45a..367c980 100644
@@ -56,6 +56,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated i40e driver to support ESP.**
+
+  Updated the i40e PMD to support ESP-AH supporting profiles which can be
+  programmed by the dynamic device personalization (DDP) process.
+
+* **Updated testpmd to support ESP flows.**
+
+  Added support for ESP rte_flow patterns to the testpmd application.
+
 
 Removed Items
 -------------
Signature · 1 line
2.7.4
#53 lore raw

Re: [dpdk-dev] [PATCH v6 12/13] doc: release note for ESP

Quoted 19 lines · Bernard Iremonger

Release note for ESP support on the i40e PMD.
Release note for ESP support on testpmd.

---
 doc/guides/rel_notes/release_20_02.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
doc/guides/rel_notes/release_20_02.rst +2 -0
index 0eaa45a..367c980 100644
@@ -56,6 +56,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated i40e driver to support ESP.**
+

doc/guides/rel_notes/release_20_02.rst New Features · line 70

Quoted 10 lines
doc/guides/rel_notes/release_20_02.rst +7 -0
+  Updated the i40e PMD to support ESP-AH supporting profiles which can be
+  programmed by the dynamic device personalization (DDP) process.
+
+* **Updated testpmd to support ESP flows.**
+
+  Added support for ESP rte_flow patterns to the testpmd application.
+
 
 Removed Items
 -------------

Hi Bernard,

Can you please distribute the documentation update to the patch that actually adds the feature? If the future is in multiple patches, you can put the documentation into the last patch completes the feature. Same for 13/13.

#54 lore raw

Re: [dpdk-dev] [PATCH v6 12/13] doc: release note for ESP

Hi Ferruh,

Quoted 46 lines

-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Wednesday, January 15, 2020 4:21 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v6 12/13] doc: release note for ESP

Quoted 14 lines · Bernard Iremonger

Release note for ESP support on the i40e PMD.
Release note for ESP support on testpmd.

---
 doc/guides/rel_notes/release_20_02.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
doc/guides/rel_notes/release_20_02.rst +0 -0
index 0eaa45a..367c980 100644

doc/guides/rel_notes/release_20_02.rst New Features · line 57

Quoted 2 lines
doc/guides/rel_notes/release_20_02.rst +0 -0
@@ -56,6 +56,15 @@ New Features
      Also, make sure to start the actual text at the margin.
 

=========================================================

doc/guides/rel_notes/release_20_02.rst New Features

Quoted 5 lines
doc/guides/rel_notes/release_20_02.rst +4 -0
+* **Updated i40e driver to support ESP.**
+
+  Updated the i40e PMD to support ESP-AH supporting profiles which
+ can be  programmed by the dynamic device personalization (DDP)

process.

doc/guides/rel_notes/release_20_02.rst New Features

Quoted 9 lines
doc/guides/rel_notes/release_20_02.rst +5 -0
+
+* **Updated testpmd to support ESP flows.**
+
+  Added support for ESP rte_flow patterns to the testpmd application.
+
 
 Removed Items
 -------------
 

Hi Bernard,

Quoted 3 lines

Can you please distribute the documentation update to the patch that actually adds the feature? If the future is in multiple patches, you can put the documentation into the last patch completes the feature. Same for 13/13.

There are actually two features here one for testpmd and the other for the i40e so the release note should be split. Can the doc patches be updated after the merge?

Regards,

Bernard.

#55 lore raw

PATCH v6 13/13 doc: update i40e user guide

In reply to Bernard Iremonger

Update the i40e user guide with ESP information.

---
 doc/guides/nics/i40e.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
doc/guides/nics/i40e.rst +3 -1
index 38acf59..5cf34d9 100644
@@ -457,7 +457,7 @@ which is used to configure hardware by downloading a profile to support
 protocols/filters which are not supported by default. The DDP
 functionality requires a NIC firmware version of 6.0 or greater.
 
-Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP,
+Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP/ESP,
 steering can be used with rte_flow API.
 
 GTPv1 package is released, and it can be downloaded from
@@ -466,6 +466,8 @@ https://downloadcenter.intel.com/download/27587.
 PPPoE package is released, and it can be downloaded from
 https://downloadcenter.intel.com/download/28040.
 
+ESP-AH package is not released yet.
+
 Load a profile which supports GTP and store backup profile:
 
 .. code-block:: console
Signature · 1 line
2.7.4
#56 lore raw

PATCH v5 2/14 app/testpmd: improve debug

In reply to Bernard Iremonger

print function name in port_flow_complain()

---
 app/test-pmd/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/config.c +1 -1
index d599682..2753ec5 100644
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("Caught error type %d (%s): %s%s: %s\n",
+	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n", __func__,
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
 					error->cause), buf) : "",
Signature · 1 line
2.7.4
#57 lore raw

PATCH v5 3/14 app/testpmd: dump Rx and Tx mbuf

In reply to Bernard Iremonger

add call to rte_pktmbuf_dump() in dump_pkt_burst in util.c

---
 app/test-pmd/util.c | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/util.c +1 -0
index b514be5..bf03873 100644
@@ -158,6 +158,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 		printf("  ol_flags: %s\n", buf);
 		if (rte_mbuf_check(mb, 1, &reason) < 0)
 			printf("INVALID mbuf: %s\n", reason);
+		rte_pktmbuf_dump(stdout, pkts[i], pkts[i]->data_len);
 	}
 }
 
Signature · 1 line
2.7.4
#58 lore raw

PATCH v5 4/14 net/i40e: improve RSS debug

In reply to Bernard Iremonger

improve RSS debug in i40e_ethdev.c

---
 drivers/net/i40e/i40e_ethdev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +6 -2
index 5999c96..5f1cf8a 100644
@@ -8679,7 +8679,9 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 			num);
 
 	if (num == 0) {
-		PMD_INIT_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_INIT_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
@@ -12840,7 +12842,9 @@ i40e_config_rss_filter(struct i40e_pf *pf,
 			num);
 
 	if (num == 0) {
-		PMD_DRV_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_DRV_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
Signature · 1 line
2.7.4
#59 lore raw

PATCH v5 5/14 net/i40e: handle ESP tunnel

In reply to Bernard Iremonger

handle ESP tunnel in rte_pmd_i40e.c

---
 drivers/net/i40e/rte_pmd_i40e.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/rte_pmd_i40e.c +2 -1
index fdcb1a4..b987346 100644
@@ -2172,7 +2172,8 @@ static int check_invalid_pkt_type(uint32_t pkt_type)
 	    tnl != RTE_PTYPE_TUNNEL_GRENAT &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPC &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPU &&
-	    tnl != RTE_PTYPE_TUNNEL_L2TP)
+	    tnl != RTE_PTYPE_TUNNEL_L2TP &&
+	    tnl != RTE_PTYPE_TUNNEL_ESP)
 		return -1;
 
 	if (il2 &&
Signature · 1 line
2.7.4
#60 lore raw

PATCH v5 6/14 net/i40e: support ipsec-ah profile

In reply to Bernard Iremonger

Add flow structures for the following patterns in i40e_ethdev files:
eth/ipv4/esp
eth/ipv6/esp
eth/ipv4/udp/esp
eth/ipv6/esp/udp

add oip_type in filter
add is_udp in filter
use tenant_id in filter for spi

---
 drivers/net/i40e/i40e_ethdev.h | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
drivers/net/i40e/i40e_ethdev.h +38 -0
index 295ad59..792a047 100644
@@ -501,6 +501,29 @@ struct i40e_gtp_ipv6_flow {
 	struct rte_eth_ipv6_flow ip6;
 };
 
+/* A structure used to define the input for ESP IPV4 flow */
+struct i40e_esp_ipv4_flow {
+	struct rte_eth_ipv4_flow ipv4;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 flow */
+struct i40e_esp_ipv6_flow {
+	struct rte_eth_ipv6_flow ipv6;
+	uint32_t spi;	/* SPI in big endian. */
+};
+/* A structure used to define the input for ESP IPV4 UDP flow */
+struct i40e_esp_ipv4_udp_flow {
+	struct rte_eth_udpv4_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 UDP flow */
+struct i40e_esp_ipv6_udp_flow {
+	struct rte_eth_udpv6_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
 /* A structure used to define the input for raw type flow */
 struct i40e_raw_flow {
 	uint16_t pctype;
@@ -526,6 +549,10 @@ union i40e_fdir_flow {
 	struct i40e_gtp_ipv4_flow  gtp_ipv4_flow;
 	struct i40e_gtp_ipv6_flow  gtp_ipv6_flow;
 	struct i40e_raw_flow       raw_flow;
+	struct i40e_esp_ipv4_flow  esp_ipv4_flow;
+	struct i40e_esp_ipv6_flow  esp_ipv6_flow;
+	struct i40e_esp_ipv4_udp_flow  esp_ipv4_udp_flow;
+	struct i40e_esp_ipv6_udp_flow  esp_ipv6_udp_flow;
 };
 
 enum i40e_fdir_ip_type {
@@ -542,8 +569,10 @@ struct i40e_fdir_flow_ext {
 	uint16_t dst_id; /* VF ID, available when is_vf is 1*/
 	bool inner_ip;   /* If there is inner ip */
 	enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
+	enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
 	bool customized_pctype; /* If customized pctype is used */
 	bool pkt_template; /* If raw packet template is used */
+	bool is_udp; /* ipv4|ipv6 udp flow */
 };
 
 /* A structure used to define the input for a flow director filter entry */
@@ -769,6 +798,8 @@ enum i40e_tunnel_type {
 	I40E_TUNNEL_TYPE_QINQ,
 	I40E_TUNNEL_TYPE_GTPC,
 	I40E_TUNNEL_TYPE_GTPU,
+	I40E_TUNNEL_TYPE_ESPoUDP,
+	I40E_TUNNEL_TYPE_ESPoIP,
 	I40E_TUNNEL_TYPE_MAX,
 };
 
@@ -897,6 +928,12 @@ enum i40e_new_pctype {
 	I40E_CUSTOMIZED_GTPU_IPV4,
 	I40E_CUSTOMIZED_GTPU_IPV6,
 	I40E_CUSTOMIZED_GTPU,
+	I40E_CUSTOMIZED_ESP_IPV4,
+	I40E_CUSTOMIZED_ESP_IPV6,
+	I40E_CUSTOMIZED_ESP_IPV4_UDP,
+	I40E_CUSTOMIZED_ESP_IPV6_UDP,
+	I40E_CUSTOMIZED_AH_IPV4,
+	I40E_CUSTOMIZED_AH_IPV6,
 	I40E_CUSTOMIZED_MAX,
 };
 
@@ -1001,6 +1038,7 @@ struct i40e_pf {
 
 	/* Dynamic Device Personalization */
 	bool gtp_support; /* 1 - support GTP-C and GTP-U */
+	bool esp_support; /* 1 - support ESP SPI */
 	/* customer customized pctype */
 	struct i40e_customized_pctype customized_pctype[I40E_CUSTOMIZED_MAX];
 	/* Switch Domain Id */
Signature · 1 line
2.7.4
#61 lore raw

PATCH v5 7/14 net/i40e: support ESP in customised code

In reply to Bernard Iremonger

update customized code for ESP

---
 drivers/net/i40e/i40e_ethdev.c | 44 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev.c +43 -1
index 5f1cf8a..a462eba 100644
@@ -1106,6 +1106,7 @@ i40e_init_customized_info(struct i40e_pf *pf)
 	}
 
 	pf->gtp_support = false;
+	pf->esp_support = false;
 }
 
 void
@@ -12337,6 +12338,7 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			}
 		}
 		name[strlen(name) - 1] = '\0';
+		PMD_DRV_LOG(INFO, "name = %s\n", name);
 		if (!strcmp(name, "GTPC"))
 			new_pctype =
 				i40e_find_customized_pctype(pf,
@@ -12353,6 +12355,30 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			new_pctype =
 				i40e_find_customized_pctype(pf,
 						      I40E_CUSTOMIZED_GTPU);
+		else if (!strcmp(name, "IPV4_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+		else if (!strcmp(name, "IPV6_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		else if (!strcmp(name, "IPV4_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+		else if (!strcmp(name, "IPV6_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+		else if (!strcmp(name, "IPV4_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV4);
+		else if (!strcmp(name, "IPV6_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV6);
 		if (new_pctype) {
 			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD) {
 				new_pctype->pctype = pctype_value;
@@ -12448,6 +12474,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					continue;
 				memset(name, 0, sizeof(name));
 				strcpy(name, proto[n].name);
+				PMD_DRV_LOG(INFO, "name = %s\n", name);
 				if (!strncasecmp(name, "PPPOE", 5))
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_L2_ETHER_PPPOE;
@@ -12541,6 +12568,10 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GTPU;
 					in_tunnel = true;
+				} else if (!strncasecmp(name, "ESP", 3)) {
+					ptype_mapping[i].sw_ptype |=
+						RTE_PTYPE_TUNNEL_ESP;
+					in_tunnel = true;
 				} else if (!strncasecmp(name, "GRENAT", 6)) {
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GRENAT;
@@ -12560,7 +12591,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 	ret = rte_pmd_i40e_ptype_mapping_update(port_id, ptype_mapping,
 						ptype_num, 0);
 	if (ret)
-		PMD_DRV_LOG(ERR, "Failed to update mapping table.");
+		PMD_DRV_LOG(ERR, "Failed to update ptype mapping table.");
 
 	rte_free(ptype_mapping);
 	rte_free(ptype);
@@ -12625,6 +12656,17 @@ i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg,
 		}
 	}
 
+	/* Check if ESP is supported. */
+	for (i = 0; i < proto_num; i++) {
+		if (!strncmp(proto[i].name, "ESP", 3)) {
+			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD)
+				pf->esp_support = true;
+			else
+				pf->esp_support = false;
+			break;
+		}
+	}
+
 	/* Update customized pctype info */
 	ret = i40e_update_customized_pctype(dev, pkg, pkg_size,
 					    proto_num, proto, op);
Signature · 1 line
2.7.4
Acked-by on v5 7/14
#62 lore raw

Re: [dpdk-dev] [PATCH v5 07/14] net/i40e: support ESP in customised code

Quoted 11 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Tuesday, January 14, 2020 9:55 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v5 07/14] net/i40e: support ESP in customised code

s/customised/customized

Quoted 4 lines

update customized code for ESP

#63 lore raw

PATCH v5 8/14 net/i40e: support ESP flows

In reply to Bernard Iremonger

add eth/ipv4/esp and eth/ipv6/esp patterns add eth/ipv4/udp/esp and eth/ipv6/esp/udp patterns update i40e_flow_parse_fdir_filter()
add i40e_flow_set_filter_spi()

---
 drivers/net/i40e/i40e_flow.c | 135 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 132 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_flow.c +132 -3
index 6102103..c585d8b 100644
@@ -110,8 +110,7 @@ static int i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,
 static int i40e_flow_flush_fdir_filter(struct i40e_pf *pf);
 static int i40e_flow_flush_ethertype_filter(struct i40e_pf *pf);
 static int i40e_flow_flush_tunnel_filter(struct i40e_pf *pf);
-static int
-i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
+static int i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
 static int
 i40e_flow_parse_qinq_filter(struct rte_eth_dev *dev,
 			      const struct rte_flow_attr *attr,
@@ -1615,6 +1614,36 @@ static enum rte_flow_item_type pattern_qinq_1[] = {
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
+static enum rte_flow_item_type pattern_fdir_ipv4_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv4_udp_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_udp_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
 static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	/* Ethertype */
 	{ pattern_ethertype, i40e_flow_parse_ethertype_filter },
@@ -1628,6 +1657,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	{ pattern_fdir_ipv4_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_udp_esp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_udp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_tcp, i40e_flow_parse_fdir_filter },
@@ -1636,6 +1667,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	{ pattern_fdir_ipv6_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_udp_esp, i40e_flow_parse_fdir_filter },
 	/* FDIR - support default flow type with flexible payload */
 	{ pattern_fdir_ethertype_raw_1, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ethertype_raw_2, i40e_flow_parse_fdir_filter },
@@ -2420,6 +2453,28 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,
 			cus_pctype = i40e_find_customized_pctype(pf,
 						 I40E_CUSTOMIZED_GTPU_IPV6);
 		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		if (!filter->input.flow_ext.is_udp) {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+			else if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		} else {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+			else if (filter->input.flow_ext.oip_type ==
+					I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+			filter->input.flow_ext.is_udp = false;
+		}
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "Unsupported item type");
 		break;
@@ -2431,6 +2486,30 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,
 	return I40E_FILTER_PCTYPE_INVALID;
 }
 
+static void
+i40e_flow_set_filter_spi(struct i40e_fdir_filter_conf *filter,
+	const struct rte_flow_item_esp *esp_spec)
+{
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV4) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv4_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv4_flow.spi =
+				esp_spec->hdr.spi;
+	}
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV6) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv6_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv6_flow.spi =
+				esp_spec->hdr.spi;
+	}
+}
+
 /* 1. Last in item should be NULL as range is not supported.
  * 2. Supported patterns: refer to array i40e_supported_patterns.
  * 3. Default supported flow type and input set: refer to array
@@ -2459,6 +2538,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 	const struct rte_flow_item_udp *udp_spec, *udp_mask;
 	const struct rte_flow_item_sctp *sctp_spec, *sctp_mask;
 	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_esp *esp_spec, *esp_mask;
 	const struct rte_flow_item_raw *raw_spec, *raw_mask;
 	const struct rte_flow_item_vf *vf_spec;
 
@@ -2654,10 +2734,18 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 					ipv4_spec->hdr.src_addr;
 				filter->input.flow.ip4_flow.dst_ip =
 					ipv4_spec->hdr.dst_addr;
+
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;
 			} else if (!ipv4_spec && !ipv4_mask && !outer_ip) {
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV4;
+			} else if (!ipv4_spec && !ipv4_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;
 			} else if ((ipv4_spec || ipv4_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2716,6 +2804,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				filter->input.flow.ipv6_flow.hop_limits =
 					ipv6_spec->hdr.hop_limits;
 
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
+
 				rte_memcpy(filter->input.flow.ipv6_flow.src_ip,
 					   ipv6_spec->hdr.src_addr, 16);
 				rte_memcpy(filter->input.flow.ipv6_flow.dst_ip,
@@ -2729,6 +2821,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV6;
+			} else if (!ipv6_spec && !ipv6_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
 			} else if ((ipv6_spec || ipv6_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2828,7 +2924,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 						udp_spec->hdr.dst_port;
 				}
 			}
-
+			filter->input.flow_ext.is_udp = true;
 			layer_idx = I40E_FLXPLD_L4_IDX;
 
 			break;
@@ -2863,6 +2959,39 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				cus_proto = item_type;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			if (!pf->esp_support) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Unsupported ESP protocol");
+				return -rte_errno;
+			}
+
+			esp_spec = item->spec;
+			esp_mask = item->mask;
+
+			if (!esp_spec || !esp_mask) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ESP item");
+				return -rte_errno;
+			}
+
+			if (esp_spec && esp_mask) {
+				if (esp_mask->hdr.spi != UINT32_MAX) {
+					rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ESP mask");
+					return -rte_errno;
+				}
+				i40e_flow_set_filter_spi(filter, esp_spec);
+				filter->input.flow_ext.customized_pctype = true;
+				cus_proto = item_type;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_SCTP:
 			sctp_spec = item->spec;
 			sctp_mask = item->mask;
Signature · 1 line
2.7.4
#64 lore raw

PATCH v5 9/14 net/i40e: support ESP in Flow Director

In reply to Bernard Iremonger

add fill_ip6_head()
hardcode udp destination port to 4500
handle ESP and AH pctypes in ESP-AH profile

---
 drivers/net/i40e/i40e_fdir.c | 126 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 118 insertions(+), 8 deletions(-)
drivers/net/i40e/i40e_fdir.c +118 -8
index dee007d..5f85703 100644
@@ -54,6 +54,8 @@
 #define I40E_FDIR_GTP_MSG_TYPE_0X01         0x01
 #define I40E_FDIR_GTP_MSG_TYPE_0XFF         0xFF
 
+#define I40E_FDIR_ESP_DST_PORT              4500
+
 /* Wait time for fdir filter programming */
 #define I40E_FDIR_MAX_WAIT_US 10000
 
@@ -971,6 +973,37 @@ i40e_flow_fdir_find_customized_pctype(struct i40e_pf *pf, uint8_t pctype)
 }
 
 static inline int
+fill_ip6_head(const struct i40e_fdir_input *fdir_input, unsigned char *raw_pkt,
+		uint8_t next_proto, uint8_t len, uint16_t *ether_type)
+{
+	struct rte_ipv6_hdr *ip6;
+
+	ip6 = (struct rte_ipv6_hdr *)raw_pkt;
+
+	*ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
+	ip6->vtc_flow = rte_cpu_to_be_32(I40E_FDIR_IPv6_DEFAULT_VTC_FLOW |
+		(fdir_input->flow.ipv6_flow.tc << I40E_FDIR_IPv6_TC_OFFSET));
+	ip6->payload_len = rte_cpu_to_be_16(I40E_FDIR_IPv6_PAYLOAD_LEN);
+	ip6->proto = fdir_input->flow.ipv6_flow.proto ?
+		fdir_input->flow.ipv6_flow.proto : next_proto;
+	ip6->hop_limits = fdir_input->flow.ipv6_flow.hop_limits ?
+		fdir_input->flow.ipv6_flow.hop_limits :
+		I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS;
+	/**
+	 * The source and destination fields in the transmitted packet
+	 * need to be presented in a reversed order with respect
+	 * to the expected received packets.
+	 */
+	rte_memcpy(&ip6->src_addr, &fdir_input->flow.ipv6_flow.dst_ip,
+		IPV6_ADDR_LEN);
+	rte_memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip,
+		IPV6_ADDR_LEN);
+	len += sizeof(struct rte_ipv6_hdr);
+
+	return len;
+}
+
+static inline int
 i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 				const struct i40e_fdir_input *fdir_input,
 				unsigned char *raw_pkt,
@@ -1045,16 +1078,29 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 		ip->src_addr = fdir_input->flow.ip4_flow.dst_ip;
 		ip->dst_addr = fdir_input->flow.ip4_flow.src_ip;
 
-		if (!is_customized_pctype)
+		if (!is_customized_pctype) {
 			ip->next_proto_id = fdir_input->flow.ip4_flow.proto ?
 				fdir_input->flow.ip4_flow.proto :
 				next_proto[fdir_input->pctype];
-		else if (cus_pctype->index == I40E_CUSTOMIZED_GTPC ||
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_GTPC ||
 			 cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4 ||
 			 cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 ||
-			 cus_pctype->index == I40E_CUSTOMIZED_GTPU)
+			 cus_pctype->index == I40E_CUSTOMIZED_GTPU) {
 			ip->next_proto_id = IPPROTO_UDP;
-		len += sizeof(struct rte_ipv4_hdr);
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4) {
+			ip->next_proto_id = IPPROTO_ESP;
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4_UDP) {
+			ip->next_proto_id = IPPROTO_UDP;
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6)
+			len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_ESP,
+					len, ether_type);
+		else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6_UDP)
+			len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_UDP,
+					len, ether_type);
 	} else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP ||
 		   pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP ||
 		   pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP ||
@@ -1088,8 +1134,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 			   IPV6_ADDR_LEN);
 		len += sizeof(struct rte_ipv6_hdr);
 	} else {
-		PMD_DRV_LOG(ERR, "unknown pctype %u.",
-			    fdir_input->pctype);
+		PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype);
 		return -1;
 	}
 
@@ -1115,6 +1160,10 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 	struct rte_flow_item_gtp *gtp;
 	struct rte_ipv4_hdr *gtp_ipv4;
 	struct rte_ipv6_hdr *gtp_ipv6;
+	struct rte_flow_item_esp *esp;
+	struct rte_ipv4_hdr *esp_ipv4;
+	struct rte_ipv6_hdr *esp_ipv6;
+
 	uint8_t size, dst = 0;
 	uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/
 	int len;
@@ -1285,10 +1334,71 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 			} else
 				payload = (unsigned char *)gtp +
 					sizeof(struct rte_flow_item_gtp);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4 ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6 ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4_UDP ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6_UDP) {
+			if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4) {
+				esp_ipv4 = (struct rte_ipv4_hdr *)
+					(raw_pkt + len);
+				esp = (struct rte_flow_item_esp *)esp_ipv4;
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv4_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV4_UDP) {
+				esp_ipv4 = (struct rte_ipv4_hdr *)
+					(raw_pkt + len);
+				udp = (struct rte_udp_hdr *)esp_ipv4;
+				udp->dst_port = rte_cpu_to_be_16
+					(I40E_FDIR_ESP_DST_PORT);
+
+				udp->dgram_len = rte_cpu_to_be_16
+						(I40E_FDIR_UDP_DEFAULT_LEN);
+				esp = (struct rte_flow_item_esp *)
+					((unsigned char *)esp_ipv4 +
+						sizeof(struct rte_udp_hdr));
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv4_udp_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_udp_hdr) +
+						sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV6) {
+				esp_ipv6 = (struct rte_ipv6_hdr *)
+					(raw_pkt + len);
+				esp = (struct rte_flow_item_esp *)esp_ipv6;
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv6_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV6_UDP) {
+				esp_ipv6 = (struct rte_ipv6_hdr *)
+					(raw_pkt + len);
+				udp = (struct rte_udp_hdr *)esp_ipv6;
+				udp->dst_port =	rte_cpu_to_be_16
+					(I40E_FDIR_ESP_DST_PORT);
+
+				udp->dgram_len = rte_cpu_to_be_16
+					(I40E_FDIR_UDP_DEFAULT_LEN);
+				esp = (struct rte_flow_item_esp *)
+					((unsigned char *)esp_ipv6 +
+						sizeof(struct rte_udp_hdr));
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv6_udp_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_udp_hdr) +
+						sizeof(struct rte_esp_hdr);
+			}
 		}
 	} else {
-		PMD_DRV_LOG(ERR, "unknown pctype %u.",
-			    fdir_input->pctype);
+		PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype);
 		return -1;
 	}
 
Signature · 1 line
2.7.4
#65 lore raw

PATCH v5 10/14 config: add debug to I40E Flow Director

In reply to Bernard Iremonger

add CONFIG_RTE_LIBRTE_I40E_DEBUG_FD to config/common_base file

---
 config/common_base | 1 +
 1 file changed, 1 insertion(+)
config/common_base +1 -0
index 7dec7ed..7a76c26 100644
@@ -305,6 +305,7 @@ CONFIG_RTE_LIBRTE_I40E_PMD=y
 CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX_FREE=n
+CONFIG_RTE_LIBRTE_I40E_DEBUG_FD=y
 CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y
 CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=y
 CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n
Signature · 1 line
2.7.4
#66 lore raw

PATCH v5 11/14 net/i40e: display Flow Director packet

In reply to Bernard Iremonger

include rte_config.h in i40e_fdir.c
In debug mode call rte_hexdump in i40e_flow_fdir_construct_pkt() and in i40e_fdir_construct_pkt()

---
 drivers/net/i40e/i40e_fdir.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_fdir.c +10 -2
index 5f85703..67bb28c 100644
@@ -21,6 +21,10 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_config.h>
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+#include <rte_hexdump.h>
+#endif
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -954,7 +958,9 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len);
+#endif
 	return 0;
 }
 
@@ -1415,7 +1421,9 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len);
+#endif
 	return 0;
 }
 
Signature · 1 line
2.7.4
#67 lore raw

Re: [dpdk-dev] [PATCH v5 11/14] net/i40e: display Flow Director packet

Quoted 37 lines · Bernard Iremonger

include rte_config.h in i40e_fdir.c
In debug mode call rte_hexdump in i40e_flow_fdir_construct_pkt() and in i40e_fdir_construct_pkt()

---
 drivers/net/i40e/i40e_fdir.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_fdir.c +7 -1
index 5f85703..67bb28c 100644
@@ -21,6 +21,10 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_config.h>
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+#include <rte_hexdump.h>
+#endif
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -954,7 +958,9 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len);
+#endif
 	return 0;
 }
 

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, · line 1429

Quoted 10 lines
drivers/net/i40e/i40e_fdir.c +3 -1
@@ -1415,7 +1421,9 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len);
+#endif
 	return 0;
 }
 

Hi Bernard,

These are not data path functions, right? If so instead of adding new config option, can we add dynamic debugging for it?

#68 lore raw

Re: [dpdk-dev] [PATCH v5 11/14] net/i40e: display Flow Director packet

Hi Ferruh,

Quoted 60 lines

-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Tuesday, January 14, 2020 6:53 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 11/14] net/i40e: display Flow Director packet

Quoted 36 lines · Bernard Iremonger

include rte_config.h in i40e_fdir.c
In debug mode call rte_hexdump in i40e_flow_fdir_construct_pkt() and in i40e_fdir_construct_pkt()

---
 drivers/net/i40e/i40e_fdir.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index 5f85703..67bb28c 100644

drivers/net/i40e/i40e_fdir.c +6 -1
@@ -21,6 +21,10 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_config.h>
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+#include <rte_hexdump.h>
+#endif
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -954,7 +958,9 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len); #endif
 	return 0;
 }
 

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, · line 1428

Quoted 9 lines
drivers/net/i40e/i40e_fdir.c +2 -1
@@ -1415,7 +1421,9 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len); #endif
 	return 0;
 }
 

Hi Bernard,

Quoted 1 line

These are not data path functions, right?

This code is only used when adding flow rules, so not in data path.

If so instead of adding new config option, can we add dynamic debugging for it?
Adding new config option seems ok to me, why change to dynamic debugging?

Regards,

Bernard

#69 lore raw

Re: [dpdk-dev] [PATCH v5 11/14] net/i40e: display Flow Director packet

Quoted 62 lines · Bernard

Hi Ferruh,

Quoted 60 lines

-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Tuesday, January 14, 2020 6:53 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 11/14] net/i40e: display Flow Director packet

Quoted 36 lines · Bernard Iremonger

include rte_config.h in i40e_fdir.c
In debug mode call rte_hexdump in i40e_flow_fdir_construct_pkt() and in i40e_fdir_construct_pkt()

---
 drivers/net/i40e/i40e_fdir.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index 5f85703..67bb28c 100644

drivers/net/i40e/i40e_fdir.c +6 -1
@@ -21,6 +21,10 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_config.h>
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+#include <rte_hexdump.h>
+#endif
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -954,7 +958,9 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
  &fdir_input->flow_ext.flexbytes[dst],
  size * sizeof(uint16_t));
 }
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+rte_hexdump(stdout, NULL, raw_pkt, len); #endif
 return 0;
 }
 

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, · line 1428

Quoted 9 lines
drivers/net/i40e/i40e_fdir.c +2 -1
@@ -1415,7 +1421,9 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
  &fdir_input->flow_ext.flexbytes[dst],
  size * sizeof(uint16_t));
 }
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+rte_hexdump(stdout, NULL, raw_pkt, len); #endif
 return 0;
 }
 

Hi Bernard,

Quoted 6 lines
Quoted 1 line

These are not data path functions, right?

This code is only used when adding flow rules, so not in data path.

If so instead of adding new config option, can we add dynamic debugging for it?
Adding new config option seems ok to me, why change to dynamic debugging?

Compile time options are OK for developer but bad for deployment, when you are deploying your product you have to disable this config option, and on the target platform there if a problem occurs there won't be any way to enable the debug to see what is happening.
So it is useful only on the machine that you are both compiling and running application, even that case it is a trouble to terminate application, re-compile it and run again, most probably same loop again to turn off the debug back.

Also it is bad for testing, if you want to do the all code path, someone needs to test both enabling and disabling this config option. If not, it is possible by time enabling this config option even won't compile and nobody will detect it.

Since we already have dynamic log support, why not add a new logtype, lets say "pmd.net.i40e.fd" and have ability to enable/disable it without terminating app?

#70 lore raw

Re: [dpdk-dev] [PATCH v5 11/14] net/i40e: display Flow Director packet

Hi Ferruh

<snip>

Quoted 70 lines
Quoted 38 lines
Quoted 38 lines

Subject: Re: [dpdk-dev] [PATCH v5 11/14] net/i40e: display Flow Director packet

Quoted 34 lines · Bernard Iremonger

include rte_config.h in i40e_fdir.c
In debug mode call rte_hexdump in i40e_flow_fdir_construct_pkt() and in i40e_fdir_construct_pkt()

---
 drivers/net/i40e/i40e_fdir.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index 5f85703..67bb28c 100644

drivers/net/i40e/i40e_fdir.c +6 -1
@@ -21,6 +21,10 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_config.h>
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+#include <rte_hexdump.h>
+#endif
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -954,7 +958,9 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
  &fdir_input->flow_ext.flexbytes[dst],
  size * sizeof(uint16_t));
 }
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+rte_hexdump(stdout, NULL, raw_pkt, len); #endif
 return 0;
 }
 
Quoted 1 line
Quoted 1 line

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf

Quoted 1 line
drivers/net/i40e/i40e_fdir.c +0 -0
@@ -1415,7 +1421,9 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf

*pf,

Quoted 13 lines
Quoted 13 lines

drivers/net/i40e/i40e_fdir.c i40e_fdir_construct_pkt(struct i40e_pf *pf, · line 966

Quoted 10 lines
drivers/net/i40e/i40e_fdir.c +2 -1
  &fdir_input->flow_ext.flexbytes[dst],
  size * sizeof(uint16_t));
 }
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+rte_hexdump(stdout, NULL, raw_pkt, len); #endif
 return 0;
 }
 

Hi Bernard,

Quoted 4 lines
Quoted 1 line

These are not data path functions, right?

This code is only used when adding flow rules, so not in data path.

If so instead of adding new config option, can we add dynamic debugging

for it?

Quoted 1 line

Adding new config option seems ok to me, why change to dynamic

debugging?

Quoted 1 line

Compile time options are OK for developer but bad for deployment, when you are deploying your product you have to disable this config option, and on the target platform there if a problem occurs there won't be any way to enable the debug to see what is happening.
So it is useful only on the machine that you are both compiling and running application, even that case it is a trouble to terminate application, re-compile it and run again, most probably same loop again to turn off the debug back.

Quoted 9 lines

Also it is bad for testing, if you want to do the all code path, someone needs to test both enabling and disabling this config option. If not, it is possible by time enabling this config option even won't compile and nobody will detect it.

Since we already have dynamic log support, why not add a new logtype, lets say "pmd.net.i40e.fd" and have ability to enable/disable it without terminating app?

This patch has already been acked by Qi Zhang, the I40e PMD maintainer.
The logtype for example "pmd.net.i40e.fd" also require CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=y in config/common_base.

Given that today is the merge deadline, I would like to leave this patch as is in the v6 patchset.

Regards,

Bernard.

#71 lore raw

Re: [dpdk-dev] [PATCH v5 11/14] net/i40e: display Flow Director packet

In reply to Bernard Iremonger
Quoted 26 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Tuesday, January 14, 2020 9:55 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v5 11/14] net/i40e: display Flow Director packet

include rte_config.h in i40e_fdir.c
In debug mode call rte_hexdump in i40e_flow_fdir_construct_pkt() and in i40e_fdir_construct_pkt()

---
 drivers/net/i40e/i40e_fdir.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_fdir.c index renamed from drivers/net/i40e/i40e_fdir.c +0 -0

5f85703..67bb28c 100644

drivers/net/i40e/i40e_fdir.c line 25

Quoted 5 lines
drivers/net/i40e/i40e_fdir.c +2 -0
@@ -21,6 +21,10 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_config.h>
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD

Seems RTE_LIBRTE_I40E_DEBUG_FD need to be defined in config/common_base Like RTE_LIBRTE_I40E_DEBUG_RX

Quoted 27 lines
drivers/net/i40e/i40e_fdir.c +6 -3
+#include <rte_hexdump.h>
+#endif
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -954,7 +958,9 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len); #endif
 	return 0;
 }
 
@@ -1415,7 +1421,9 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len); #endif
 	return 0;
 }
 
--

2.7.4

Acked-by
#72 lore raw

Re: [dpdk-dev] [PATCH v5 11/14] net/i40e: display Flow Director packet

Quoted 34 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Wednesday, January 15, 2020 8:20 AM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: RE: [PATCH v5 11/14] net/i40e: display Flow Director packet

Quoted 21 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Tuesday, January 14, 2020 9:55 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v5 11/14] net/i40e: display Flow Director packet

include rte_config.h in i40e_fdir.c
In debug mode call rte_hexdump in i40e_flow_fdir_construct_pkt() and in
i40e_fdir_construct_pkt()

---
 drivers/net/i40e/i40e_fdir.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/net/i40e/i40e_fdir.c line 25

Quoted 10 lines
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index 5f85703..67bb28c 100644

drivers/net/i40e/i40e_fdir.c +2 -0
@@ -21,6 +21,10 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_config.h>
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD

Seems RTE_LIBRTE_I40E_DEBUG_FD need to be defined in config/common_base Like RTE_LIBRTE_I40E_DEBUG_RX

Sorry, didn't see its already in patch 10/14
So

#73 lore raw

Re: [dpdk-dev] [PATCH v5 11/14] net/i40e: display Flow Director packet

In reply to Zhang, Qi Z

Hi Qi,

<snip>

Quoted 12 lines
Quoted 12 lines

Subject: [PATCH v5 11/14] net/i40e: display Flow Director packet

include rte_config.h in i40e_fdir.c
In debug mode call rte_hexdump in i40e_flow_fdir_construct_pkt() and in
i40e_fdir_construct_pkt()

---
 drivers/net/i40e/i40e_fdir.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/net/i40e/i40e_fdir.c line 25

Quoted 10 lines
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index 5f85703..67bb28c 100644

drivers/net/i40e/i40e_fdir.c +2 -0
@@ -21,6 +21,10 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_config.h>
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD

Seems RTE_LIBRTE_I40E_DEBUG_FD need to be defined in config/common_base Like RTE_LIBRTE_I40E_DEBUG_RX

It is defined in config/common_base in previous patch [v5,10/14] config: add debug to I40E Flow Director

Maybe patches 10 and 11 should be squashed

Quoted 26 lines
Quoted 26 lines
drivers/net/i40e/i40e_fdir.c +6 -2
+#include <rte_hexdump.h>
+#endif
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -954,7 +958,9 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len); #endif
 	return 0;
 }
 
@@ -1415,7 +1421,9 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len); #endif
 	return 0;
 }
 
Quoted 3 lines
Quoted 2 lines

--
2.7.4

Regards,

Bernard.

#74 lore raw

PATCH v5 12/14 librte_ethdev: add ESP and AH flow types to RSS

In reply to Bernard Iremonger

Add macros for the following protocols in the DDP esp-ah profile:
ESP
AH

Add the following RSS macro for IPsec:
ETH_RSS_IPSEC

---
 lib/librte_ethdev/rte_ethdev.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
lib/librte_ethdev/rte_ethdev.h +13 -1
index 18a9def..208ec90 100644
@@ -484,7 +484,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based flow */
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_AH                 24 /**< AH protocol based flow */
+#define RTE_ETH_FLOW_ESP                25 /**< ESP protocol based flow */
+#define RTE_ETH_FLOW_MAX                26
 
 /*
  * Below macros are defined for RSS offload types, they can be used to
@@ -511,6 +513,12 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
+#define ETH_RSS_AH                 (1ULL << 24)
+#define ETH_RSS_ESP                (1ULL << 25)
+
+
+
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -571,6 +579,10 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
Signature · 1 line
2.7.4
#75 lore raw

Re: [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Quoted 8 lines · Bernard Iremonger

Add macros for the following protocols in the DDP esp-ah profile:
ESP
AH

Add the following RSS macro for IPsec:
ETH_RSS_IPSEC

+Ori and other ethdev maintainers.

Ori, can you please check this patch?

Quoted 44 lines
---
 lib/librte_ethdev/rte_ethdev.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
lib/librte_ethdev/rte_ethdev.h +13 -1
index 18a9def..208ec90 100644
@@ -484,7 +484,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based flow */
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_AH                 24 /**< AH protocol based flow */
+#define RTE_ETH_FLOW_ESP                25 /**< ESP protocol based flow */
+#define RTE_ETH_FLOW_MAX                26
 
 /*
  * Below macros are defined for RSS offload types, they can be used to
@@ -511,6 +513,12 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
+#define ETH_RSS_AH                 (1ULL << 24)
+#define ETH_RSS_ESP                (1ULL << 25)
+
+
+
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -571,6 +579,10 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
#76 lore raw

Re: [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Quoted 18 lines · Ferruh Yigit
Quoted 8 lines · Bernard Iremonger

Add macros for the following protocols in the DDP esp-ah profile:
ESP
AH

Add the following RSS macro for IPsec:
ETH_RSS_IPSEC

+Ori and other ethdev maintainers.

Ori, can you please check this patch?

Quoted 4 lines
---
 lib/librte_ethdev/rte_ethdev.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Quoted 12 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 489

Quoted 12 lines
lib/librte_ethdev/rte_ethdev.h +3 -1
index 18a9def..208ec90 100644
@@ -484,7 +484,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based flow */
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_AH                 24 /**< AH protocol based flow */
+#define RTE_ETH_FLOW_ESP                25 /**< ESP protocol based flow */
+#define RTE_ETH_FLOW_MAX                26

Isn't changing RTE_ETH_FLOW_MAX value breaking ABI? Is v20.11 target release of the patch?

Quoted 28 lines
Quoted 28 lines
lib/librte_ethdev/rte_ethdev.h +10 -0
 /*
  * Below macros are defined for RSS offload types, they can be used to
@@ -511,6 +513,12 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
+#define ETH_RSS_AH                 (1ULL << 24)
+#define ETH_RSS_ESP                (1ULL << 25)
+
+
+
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -571,6 +579,10 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
#77 lore raw

Re: [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Quoted 19 lines · Andrew Rybchenko
Quoted 18 lines · Ferruh Yigit
Quoted 8 lines · Bernard Iremonger

Add macros for the following protocols in the DDP esp-ah profile:
ESP
AH

Add the following RSS macro for IPsec:
ETH_RSS_IPSEC

+Ori and other ethdev maintainers.

Ori, can you please check this patch?

Quoted 4 lines
---
 lib/librte_ethdev/rte_ethdev.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
index 18a9def..208ec90 100644
Quoted 8 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 489

Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +3 -1
@@ -484,7 +484,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based flow */
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_AH                 24 /**< AH protocol based flow */
+#define RTE_ETH_FLOW_ESP                25 /**< ESP protocol based flow */
+#define RTE_ETH_FLOW_MAX                26

Isn't changing RTE_ETH_FLOW_MAX value breaking ABI? Is v20.11 target release of the patch?

I can't see how this can cause an ABI break, unless the 'RTE_ETH_FLOW_MAX' value used as size of an array in the middle of a struct.
There is 'struct rte_eth_fdir_flex_conf' but the array is at the end there, so it should be OK, unless that struct is not in the middle of another struct.

And there are values calculated from 'RTE_ETH_FLOW_MAX', like 'RTE_FLOW_MASK_ARRAY_SIZE', same concern applies there, it very hard to follow.

Bernard,

Can you please run the ABI version script to be sure this is not breaking the ABI?

Quoted 30 lines
Quoted 29 lines
Quoted 29 lines
lib/librte_ethdev/rte_ethdev.h +10 -0
 /*
  * Below macros are defined for RSS offload types, they can be used to
@@ -511,6 +513,12 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
+#define ETH_RSS_AH                 (1ULL << 24)
+#define ETH_RSS_ESP                (1ULL << 25)
+
+
+
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -571,6 +579,10 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
#78 lore raw

Re: [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Quoted 33 lines · Ferruh Yigit
Quoted 18 lines · Andrew Rybchenko
Quoted 17 lines · Ferruh Yigit
Quoted 8 lines · Bernard Iremonger

Add macros for the following protocols in the DDP esp-ah profile:
ESP
AH

Add the following RSS macro for IPsec:
ETH_RSS_IPSEC

+Ori and other ethdev maintainers.

Ori, can you please check this patch?

Quoted 4 lines
---
 lib/librte_ethdev/rte_ethdev.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
index 18a9def..208ec90 100644
Quoted 8 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 489

Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +3 -1
@@ -484,7 +484,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based flow */
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_AH                 24 /**< AH protocol based flow */
+#define RTE_ETH_FLOW_ESP                25 /**< ESP protocol based flow */
+#define RTE_ETH_FLOW_MAX                26

Isn't changing RTE_ETH_FLOW_MAX value breaking ABI? Is v20.11 target release of the patch?

Quoted 4 lines

I can't see how this can cause an ABI break, unless the 'RTE_ETH_FLOW_MAX' value used as size of an array in the middle of a struct.
There is 'struct rte_eth_fdir_flex_conf' but the array is at the end there, so it should be OK, unless that struct is not in the middle of another struct.

rte_eth_fdir_flex_conf -> rte_fdir_conf -> rte_eth_conf (in the middle)

Quoted 36 lines

And there are values calculated from 'RTE_ETH_FLOW_MAX', like 'RTE_FLOW_MASK_ARRAY_SIZE', same concern applies there, it very hard to follow.

Bernard,

Can you please run the ABI version script to be sure this is not breaking the ABI?

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
lib/librte_ethdev/rte_ethdev.h +10 -0
 /*
  * Below macros are defined for RSS offload types, they can be used to
@@ -511,6 +513,12 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
+#define ETH_RSS_AH                 (1ULL << 24)
+#define ETH_RSS_ESP                (1ULL << 25)
+
+
+
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -571,6 +579,10 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
#79 lore raw

Re: [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Quoted 34 lines · Andrew Rybchenko
Quoted 33 lines · Ferruh Yigit
Quoted 32 lines · Andrew Rybchenko
Quoted 17 lines · Ferruh Yigit
Quoted 8 lines · Bernard Iremonger

Add macros for the following protocols in the DDP esp-ah profile:
ESP
AH

Add the following RSS macro for IPsec:
ETH_RSS_IPSEC

+Ori and other ethdev maintainers.

Ori, can you please check this patch?

Quoted 4 lines
---
 lib/librte_ethdev/rte_ethdev.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Quoted 12 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 489

Quoted 12 lines
lib/librte_ethdev/rte_ethdev.h +3 -1
index 18a9def..208ec90 100644
@@ -484,7 +484,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based flow */
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_AH                 24 /**< AH protocol based flow */
+#define RTE_ETH_FLOW_ESP                25 /**< ESP protocol based flow */
+#define RTE_ETH_FLOW_MAX                26

Isn't changing RTE_ETH_FLOW_MAX value breaking ABI? Is v20.11 target release of the patch?

Quoted 6 lines
Quoted 4 lines

I can't see how this can cause an ABI break, unless the 'RTE_ETH_FLOW_MAX' value used as size of an array in the middle of a struct.
There is 'struct rte_eth_fdir_flex_conf' but the array is at the end there, so it should be OK, unless that struct is not in the middle of another struct.

rte_eth_fdir_flex_conf -> rte_fdir_conf -> rte_eth_conf (in the middle)

Yes, this looks like an ABI break and this is very annoying not able to even add a new RTE_FLOW type.

We need to find a proper way to handle this, at first glance I can see stop using _MAX macros for the array size can work and perhaps we can use another big enough hardcoded value for all similar array size. Any other option?

But we can do this on 20.11, we need a solution until that time.

Quoted 38 lines
Quoted 37 lines

And there are values calculated from 'RTE_ETH_FLOW_MAX', like 'RTE_FLOW_MASK_ARRAY_SIZE', same concern applies there, it very hard to follow.

Bernard,

Can you please run the ABI version script to be sure this is not breaking the ABI?

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
lib/librte_ethdev/rte_ethdev.h +10 -0
 /*
  * Below macros are defined for RSS offload types, they can be used to
@@ -511,6 +513,12 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
+#define ETH_RSS_AH                 (1ULL << 24)
+#define ETH_RSS_ESP                (1ULL << 25)
+
+
+
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -571,6 +579,10 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
#80 lore raw

Re: [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Hi Ferruh,

<snip>

Quoted 56 lines

Subject: Re: [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Quoted 20 lines · Andrew Rybchenko
Quoted 19 lines · Ferruh Yigit
Quoted 18 lines · Andrew Rybchenko
Quoted 17 lines · Ferruh Yigit
Quoted 8 lines · Bernard Iremonger

Add macros for the following protocols in the DDP esp-ah profile:
ESP
AH

Add the following RSS macro for IPsec:
ETH_RSS_IPSEC

+Ori and other ethdev maintainers.

Ori, can you please check this patch?

Quoted 4 lines
---
 lib/librte_ethdev/rte_ethdev.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 484

Quoted 6 lines
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_ethdev.h index 18a9def..208ec90 100644

lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -484,7 +484,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol

based flow */

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 485

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE

protocol based flow */

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 486

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based

flow */

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 487

Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_AH                 24 /**< AH protocol based flow

*/

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 488

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1 -0
+#define RTE_ETH_FLOW_ESP                25 /**< ESP protocol based

flow */

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 489

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1 -0
+#define RTE_ETH_FLOW_MAX                26

Isn't changing RTE_ETH_FLOW_MAX value breaking ABI? Is v20.11 target release of the patch?

I can't see how this can cause an ABI break, unless the 'RTE_ETH_FLOW_MAX' value used as size of an array in the middle of a

struct.

Quoted 2 lines
Quoted 2 lines

There is 'struct rte_eth_fdir_flex_conf' but the array is at the end there, so it should be OK, unless that struct is not in the middle of another

struct.

Quoted 3 lines

rte_eth_fdir_flex_conf -> rte_fdir_conf -> rte_eth_conf (in the middle)

Yes, this looks like an ABI break and this is very annoying not able to even add a new RTE_FLOW type.

Quoted 6 lines

We need to find a proper way to handle this, at first glance I can see stop using _MAX macros for the array size can work and perhaps we can use another big enough hardcoded value for all similar array size. Any other option?

But we can do this on 20.11, we need a solution until that time.

This patch is required to handle RSS for the esp-ah.pkg DDP profile, it does not affect the i40e FD and testpmd changes in this patch set. The esp-ah.pkg DDP profile is not released yet.

Given that the merge deadline is today, I propose to drop this patch from the v6 patch set.

Quoted 41 lines
Quoted 4 lines
Quoted 4 lines

And there are values calculated from 'RTE_ETH_FLOW_MAX', like 'RTE_FLOW_MASK_ARRAY_SIZE', same concern applies there, it very hard

to follow.

Quoted 4 lines
Quoted 4 lines

Bernard,

Can you please run the ABI version script to be sure this is not breaking

the ABI?

Quoted 31 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
 /*
  * Below macros are defined for RSS offload types, they can be
 used to @@ -511,6 +513,12 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
lib/librte_ethdev/rte_ethdev.h +6 -0
+#define ETH_RSS_AH                 (1ULL << 24)
+#define ETH_RSS_ESP                (1ULL << 25)
+
+
+
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_*

for @@ -571,6 +579,10 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)

lib/librte_ethdev/rte_ethdev.h +4 -0
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \

Regards,

Bernard.

#81 lore raw

Re: [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Quoted 65 lines · Bernard

Hi Ferruh,

<snip>

Quoted 61 lines

Subject: Re: [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Quoted 20 lines · Andrew Rybchenko
Quoted 19 lines · Ferruh Yigit
Quoted 18 lines · Andrew Rybchenko
Quoted 17 lines · Ferruh Yigit
Quoted 8 lines · Bernard Iremonger

Add macros for the following protocols in the DDP esp-ah profile:
ESP
AH

Add the following RSS macro for IPsec:
ETH_RSS_IPSEC

+Ori and other ethdev maintainers.

Ori, can you please check this patch?

Quoted 4 lines
---
 lib/librte_ethdev/rte_ethdev.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 484

Quoted 6 lines
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_ethdev.h index 18a9def..208ec90 100644

lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -484,7 +484,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol

based flow */

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 485

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE

protocol based flow */

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 486

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based

flow */

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 487

Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_AH                 24 /**< AH protocol based flow

*/

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 488

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1 -0
+#define RTE_ETH_FLOW_ESP                25 /**< ESP protocol based

flow */

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 489

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1 -0
+#define RTE_ETH_FLOW_MAX                26

Isn't changing RTE_ETH_FLOW_MAX value breaking ABI? Is v20.11 target release of the patch?

I can't see how this can cause an ABI break, unless the 'RTE_ETH_FLOW_MAX' value used as size of an array in the middle of a

struct.

Quoted 2 lines
Quoted 2 lines

There is 'struct rte_eth_fdir_flex_conf' but the array is at the end there, so it should be OK, unless that struct is not in the middle of another

struct.

Quoted 3 lines

rte_eth_fdir_flex_conf -> rte_fdir_conf -> rte_eth_conf (in the middle)

Yes, this looks like an ABI break and this is very annoying not able to even add a new RTE_FLOW type.

We need to find a proper way to handle this, at first glance I can see stop using _MAX macros for the array size can work and perhaps we can use another big enough hardcoded value for all similar array size. Any other option?

Quoted 6 lines
Quoted 1 line

But we can do this on 20.11, we need a solution until that time.

This patch is required to handle RSS for the esp-ah.pkg DDP profile, it does not affect the i40e FD and testpmd changes in this patch set. The esp-ah.pkg DDP profile is not released yet.

Given that the merge deadline is today, I propose to drop this patch from the v6 patch set.

+1, if it can be separated, better to do it to not block rest of the work.

Quoted 46 lines
Quoted 42 lines
Quoted 5 lines
Quoted 5 lines

And there are values calculated from 'RTE_ETH_FLOW_MAX', like 'RTE_FLOW_MASK_ARRAY_SIZE', same concern applies there, it very hard

to follow.

Quoted 4 lines
Quoted 4 lines

Bernard,

Can you please run the ABI version script to be sure this is not breaking

the ABI?

Quoted 31 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
 /*
  * Below macros are defined for RSS offload types, they can be
 used to @@ -511,6 +513,12 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
lib/librte_ethdev/rte_ethdev.h +6 -0
+#define ETH_RSS_AH                 (1ULL << 24)
+#define ETH_RSS_ESP                (1ULL << 25)
+
+
+
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_*

for @@ -571,6 +579,10 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
ETH_RSS_NONFRAG_IPV4_SCTP | \
ETH_RSS_NONFRAG_IPV6_SCTP)

lib/librte_ethdev/rte_ethdev.h +4 -0
+#define ETH_RSS_IPSEC ( \
+ETH_RSS_AH | \
+ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 ETH_RSS_VXLAN  | \
 ETH_RSS_GENEVE | \

Regards,

Bernard.

Reviewed-by on v5 12/14
#82 lore raw

Re: [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

In reply to Bernard Iremonger
Quoted 44 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Tuesday, January 14, 2020 9:55 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Add macros for the following protocols in the DDP esp-ah profile:
ESP
AH

Add the following RSS macro for IPsec:
ETH_RSS_IPSEC

---
 lib/librte_ethdev/rte_ethdev.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
lib/librte_ethdev/rte_ethdev.h +0 -0
index 18a9def..208ec90 100644
@@ -484,7 +484,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol

based flow */
#define RTE_ETH_FLOW_VXLAN_GPE 22 /**< VXLAN-GPE
protocol based flow */
#define RTE_ETH_FLOW_GTPU 23 /**< GTPU protocol
based flow */

lib/librte_ethdev/rte_ethdev.h +1 -1
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_AH                 24 /**< AH protocol based

flow */
+#define RTE_ETH_FLOW_ESP 25 /**< ESP protocol based
flow */

lib/librte_ethdev/rte_ethdev.h +1 -0
+#define RTE_ETH_FLOW_MAX                26
 
 /*
  * Below macros are defined for RSS offload types, they can be used to @@

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 521

Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +6 -1
-511,6 +513,12 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
+#define ETH_RSS_AH                 (1ULL << 24)
+#define ETH_RSS_ESP                (1ULL << 25)
+
+
+
+

Empty lines need to be removed

Quoted 16 lines

/*
* We use the following macros to combine with above ETH_RSS_* for @@
-571,6 +579,10 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)

lib/librte_ethdev/rte_ethdev.h +4 -1
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
--

2.7.4

#83 lore raw

Re: [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Hi Qi,

<snip>

Quoted 49 lines
Quoted 40 lines

Subject: [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS

Add macros for the following protocols in the DDP esp-ah profile:
ESP
AH

Add the following RSS macro for IPsec:
ETH_RSS_IPSEC

---
 lib/librte_ethdev/rte_ethdev.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_ethdev.h index 18a9def..208ec90 100644

lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -484,7 +484,9 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol

based flow */
#define RTE_ETH_FLOW_VXLAN_GPE 22 /**< VXLAN-GPE
protocol based flow */
#define RTE_ETH_FLOW_GTPU 23 /**< GTPU protocol
based flow */

lib/librte_ethdev/rte_ethdev.h +1 -1
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_AH                 24 /**< AH protocol based

flow */
+#define RTE_ETH_FLOW_ESP 25 /**< ESP protocol based
flow */
+#define RTE_ETH_FLOW_MAX 26

/*
* Below macros are defined for RSS offload types, they can be used
to @@
-511,6 +513,12 @@ struct rte_eth_rss_conf {

 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)

lib/librte_ethdev/rte_ethdev.h struct rte_eth_rss_conf { · line 521

Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h +6 -0
+#define ETH_RSS_AH                 (1ULL << 24)
+#define ETH_RSS_ESP                (1ULL << 25)
+
+
+
+

Empty lines need to be removed

Quoted 1 line

I will remove in v6 patch.
Can I carry forward your Reviewed-by: ?

Quoted 7 lines
Quoted 7 lines

/*
* We use the following macros to combine with above ETH_RSS_* for @@
-571,6 +579,10 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)

lib/librte_ethdev/rte_ethdev.h +0 -0
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
Quoted 10 lines
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.h +4 -1
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
--

2.7.4

Regards,

Bernard.

#84 lore raw

PATCH v5 13/14 doc: release note for ESP

In reply to Bernard Iremonger

Release note for ESP support on the i40e PMD.
Release note for ESP support on testpmd.

---
 doc/guides/rel_notes/release_20_02.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
doc/guides/rel_notes/release_20_02.rst +9 -0
index 0eaa45a..367c980 100644
@@ -56,6 +56,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated i40e driver to support ESP.**
+
+  Updated the i40e PMD to support ESP-AH supporting profiles which can be
+  programmed by the dynamic device personalization (DDP) process.
+
+* **Updated testpmd to support ESP flows.**
+
+  Added support for ESP rte_flow patterns to the testpmd application.
+
 
 Removed Items
 -------------
Signature · 1 line
2.7.4
#85 lore raw

PATCH v5 14/14 doc: update i40e user guide

In reply to Bernard Iremonger

Update the i40e user guide with ESP information.

---
 doc/guides/nics/i40e.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
doc/guides/nics/i40e.rst +3 -1
index 38acf59..5cf34d9 100644
@@ -457,7 +457,7 @@ which is used to configure hardware by downloading a profile to support
 protocols/filters which are not supported by default. The DDP
 functionality requires a NIC firmware version of 6.0 or greater.
 
-Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP,
+Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP/ESP,
 steering can be used with rte_flow API.
 
 GTPv1 package is released, and it can be downloaded from
@@ -466,6 +466,8 @@ https://downloadcenter.intel.com/download/27587.
 PPPoE package is released, and it can be downloaded from
 https://downloadcenter.intel.com/download/28040.
 
+ESP-AH package is not released yet.
+
 Load a profile which supports GTP and store backup profile:
 
 .. code-block:: console
Signature · 1 line
2.7.4
#86 lore raw

PATCH v4 1/14 app/testpmd: parse flow command line for ESP

In reply to Bernard Iremonger

add ITEM_ESP
add ITEM_ESP_SPI

---
 app/test-pmd/cmdline_flow.c | 4 +---
 app/test-pmd/config.c       | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
app/test-pmd/cmdline_flow.c +1 -3
index 9643148..9c6edb8 100644
@@ -6075,9 +6075,6 @@ cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,
 static void
 cmd_flow_parsed(const struct buffer *in)
 {
-	printf("Flow command line parsed successfully for command=%d.\n",
-			in->command);
-
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr,
@@ -6261,6 +6258,7 @@ flow_item_default_mask(const struct rte_flow_item *item)
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
app/test-pmd/config.c +1 -1
index 2753ec5..d599682 100644
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n", __func__,
+	printf("Caught error type %d (%s): %s%s: %s\n",
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
 					error->cause), buf) : "",
Signature · 1 line
2.7.4
#87 lore raw

PATCH v4 2/14 app/testpmd: improve debug

In reply to Bernard Iremonger

print function name in port_flow_complain()

---
 app/test-pmd/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/config.c +1 -1
index d599682..2753ec5 100644
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("Caught error type %d (%s): %s%s: %s\n",
+	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n", __func__,
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
 					error->cause), buf) : "",
Signature · 1 line
2.7.4
#88 lore raw

PATCH v4 3/14 app/testpmd: dump Rx and Tx mbuf

In reply to Bernard Iremonger

add call to rte_pktmbuf_dump() in dump_pkt_burst in util.c

---
 app/test-pmd/util.c | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/util.c +1 -0
index b514be5..bf03873 100644
@@ -158,6 +158,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 		printf("  ol_flags: %s\n", buf);
 		if (rte_mbuf_check(mb, 1, &reason) < 0)
 			printf("INVALID mbuf: %s\n", reason);
+		rte_pktmbuf_dump(stdout, pkts[i], pkts[i]->data_len);
 	}
 }
 
Signature · 1 line
2.7.4
#89 lore raw

PATCH v4 4/14 net/i40e: improve RSS debug

In reply to Bernard Iremonger

improve RSS debug in i40e_ethdev.c

---
 drivers/net/i40e/i40e_ethdev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +6 -2
index 5999c96..5f1cf8a 100644
@@ -8679,7 +8679,9 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 			num);
 
 	if (num == 0) {
-		PMD_INIT_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_INIT_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
@@ -12840,7 +12842,9 @@ i40e_config_rss_filter(struct i40e_pf *pf,
 			num);
 
 	if (num == 0) {
-		PMD_DRV_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_DRV_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
Signature · 1 line
2.7.4
#90 lore raw

PATCH v4 5/14 net/i40e: handle ESP tunnel

In reply to Bernard Iremonger

handle ESP tunnel in rte_pmd_i40e.c

---
 drivers/net/i40e/rte_pmd_i40e.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/rte_pmd_i40e.c +2 -1
index fdcb1a4..b987346 100644
@@ -2172,7 +2172,8 @@ static int check_invalid_pkt_type(uint32_t pkt_type)
 	    tnl != RTE_PTYPE_TUNNEL_GRENAT &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPC &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPU &&
-	    tnl != RTE_PTYPE_TUNNEL_L2TP)
+	    tnl != RTE_PTYPE_TUNNEL_L2TP &&
+	    tnl != RTE_PTYPE_TUNNEL_ESP)
 		return -1;
 
 	if (il2 &&
Signature · 1 line
2.7.4
#91 lore raw

PATCH v4 6/14 net/i40e: support ipsec-ah profile

In reply to Bernard Iremonger

Add flow structures for the following patterns in i40e_ethdev files:
eth/ipv4/esp
eth/ipv6/esp
eth/ipv4/udp/esp
eth/ipv6/esp/udp

add oip_type in filter
add is_udp in filter
use tenant_id in filter for spi

---
 drivers/net/i40e/i40e_ethdev.h | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
drivers/net/i40e/i40e_ethdev.h +38 -0
index 295ad59..792a047 100644
@@ -501,6 +501,29 @@ struct i40e_gtp_ipv6_flow {
 	struct rte_eth_ipv6_flow ip6;
 };
 
+/* A structure used to define the input for ESP IPV4 flow */
+struct i40e_esp_ipv4_flow {
+	struct rte_eth_ipv4_flow ipv4;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 flow */
+struct i40e_esp_ipv6_flow {
+	struct rte_eth_ipv6_flow ipv6;
+	uint32_t spi;	/* SPI in big endian. */
+};
+/* A structure used to define the input for ESP IPV4 UDP flow */
+struct i40e_esp_ipv4_udp_flow {
+	struct rte_eth_udpv4_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 UDP flow */
+struct i40e_esp_ipv6_udp_flow {
+	struct rte_eth_udpv6_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
 /* A structure used to define the input for raw type flow */
 struct i40e_raw_flow {
 	uint16_t pctype;
@@ -526,6 +549,10 @@ union i40e_fdir_flow {
 	struct i40e_gtp_ipv4_flow  gtp_ipv4_flow;
 	struct i40e_gtp_ipv6_flow  gtp_ipv6_flow;
 	struct i40e_raw_flow       raw_flow;
+	struct i40e_esp_ipv4_flow  esp_ipv4_flow;
+	struct i40e_esp_ipv6_flow  esp_ipv6_flow;
+	struct i40e_esp_ipv4_udp_flow  esp_ipv4_udp_flow;
+	struct i40e_esp_ipv6_udp_flow  esp_ipv6_udp_flow;
 };
 
 enum i40e_fdir_ip_type {
@@ -542,8 +569,10 @@ struct i40e_fdir_flow_ext {
 	uint16_t dst_id; /* VF ID, available when is_vf is 1*/
 	bool inner_ip;   /* If there is inner ip */
 	enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
+	enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
 	bool customized_pctype; /* If customized pctype is used */
 	bool pkt_template; /* If raw packet template is used */
+	bool is_udp; /* ipv4|ipv6 udp flow */
 };
 
 /* A structure used to define the input for a flow director filter entry */
@@ -769,6 +798,8 @@ enum i40e_tunnel_type {
 	I40E_TUNNEL_TYPE_QINQ,
 	I40E_TUNNEL_TYPE_GTPC,
 	I40E_TUNNEL_TYPE_GTPU,
+	I40E_TUNNEL_TYPE_ESPoUDP,
+	I40E_TUNNEL_TYPE_ESPoIP,
 	I40E_TUNNEL_TYPE_MAX,
 };
 
@@ -897,6 +928,12 @@ enum i40e_new_pctype {
 	I40E_CUSTOMIZED_GTPU_IPV4,
 	I40E_CUSTOMIZED_GTPU_IPV6,
 	I40E_CUSTOMIZED_GTPU,
+	I40E_CUSTOMIZED_ESP_IPV4,
+	I40E_CUSTOMIZED_ESP_IPV6,
+	I40E_CUSTOMIZED_ESP_IPV4_UDP,
+	I40E_CUSTOMIZED_ESP_IPV6_UDP,
+	I40E_CUSTOMIZED_AH_IPV4,
+	I40E_CUSTOMIZED_AH_IPV6,
 	I40E_CUSTOMIZED_MAX,
 };
 
@@ -1001,6 +1038,7 @@ struct i40e_pf {
 
 	/* Dynamic Device Personalization */
 	bool gtp_support; /* 1 - support GTP-C and GTP-U */
+	bool esp_support; /* 1 - support ESP SPI */
 	/* customer customized pctype */
 	struct i40e_customized_pctype customized_pctype[I40E_CUSTOMIZED_MAX];
 	/* Switch Domain Id */
Signature · 1 line
2.7.4
#92 lore raw

PATCH v4 7/14 net/i40e: support ESP in customised code

In reply to Bernard Iremonger

update customized code for ESP

---
 drivers/net/i40e/i40e_ethdev.c | 44 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev.c +43 -1
index 5f1cf8a..a462eba 100644
@@ -1106,6 +1106,7 @@ i40e_init_customized_info(struct i40e_pf *pf)
 	}
 
 	pf->gtp_support = false;
+	pf->esp_support = false;
 }
 
 void
@@ -12337,6 +12338,7 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			}
 		}
 		name[strlen(name) - 1] = '\0';
+		PMD_DRV_LOG(INFO, "name = %s\n", name);
 		if (!strcmp(name, "GTPC"))
 			new_pctype =
 				i40e_find_customized_pctype(pf,
@@ -12353,6 +12355,30 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			new_pctype =
 				i40e_find_customized_pctype(pf,
 						      I40E_CUSTOMIZED_GTPU);
+		else if (!strcmp(name, "IPV4_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+		else if (!strcmp(name, "IPV6_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		else if (!strcmp(name, "IPV4_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+		else if (!strcmp(name, "IPV6_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+		else if (!strcmp(name, "IPV4_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV4);
+		else if (!strcmp(name, "IPV6_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV6);
 		if (new_pctype) {
 			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD) {
 				new_pctype->pctype = pctype_value;
@@ -12448,6 +12474,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					continue;
 				memset(name, 0, sizeof(name));
 				strcpy(name, proto[n].name);
+				PMD_DRV_LOG(INFO, "name = %s\n", name);
 				if (!strncasecmp(name, "PPPOE", 5))
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_L2_ETHER_PPPOE;
@@ -12541,6 +12568,10 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GTPU;
 					in_tunnel = true;
+				} else if (!strncasecmp(name, "ESP", 3)) {
+					ptype_mapping[i].sw_ptype |=
+						RTE_PTYPE_TUNNEL_ESP;
+					in_tunnel = true;
 				} else if (!strncasecmp(name, "GRENAT", 6)) {
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GRENAT;
@@ -12560,7 +12591,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 	ret = rte_pmd_i40e_ptype_mapping_update(port_id, ptype_mapping,
 						ptype_num, 0);
 	if (ret)
-		PMD_DRV_LOG(ERR, "Failed to update mapping table.");
+		PMD_DRV_LOG(ERR, "Failed to update ptype mapping table.");
 
 	rte_free(ptype_mapping);
 	rte_free(ptype);
@@ -12625,6 +12656,17 @@ i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg,
 		}
 	}
 
+	/* Check if ESP is supported. */
+	for (i = 0; i < proto_num; i++) {
+		if (!strncmp(proto[i].name, "ESP", 3)) {
+			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD)
+				pf->esp_support = true;
+			else
+				pf->esp_support = false;
+			break;
+		}
+	}
+
 	/* Update customized pctype info */
 	ret = i40e_update_customized_pctype(dev, pkg, pkg_size,
 					    proto_num, proto, op);
Signature · 1 line
2.7.4
#93 lore raw

PATCH v4 8/14 net/i40e: support ESP flows

In reply to Bernard Iremonger

add eth/ipv4/esp and eth/ipv6/esp patterns add eth/ipv4/udp/esp and eth/ipv6/esp/udp patterns update i40e_flow_parse_fdir_filter()
add i40e_flow_set_filter_spi()

---
 drivers/net/i40e/i40e_flow.c | 135 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 132 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_flow.c +132 -3
index 6102103..c585d8b 100644
@@ -110,8 +110,7 @@ static int i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,
 static int i40e_flow_flush_fdir_filter(struct i40e_pf *pf);
 static int i40e_flow_flush_ethertype_filter(struct i40e_pf *pf);
 static int i40e_flow_flush_tunnel_filter(struct i40e_pf *pf);
-static int
-i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
+static int i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
 static int
 i40e_flow_parse_qinq_filter(struct rte_eth_dev *dev,
 			      const struct rte_flow_attr *attr,
@@ -1615,6 +1614,36 @@ static enum rte_flow_item_type pattern_qinq_1[] = {
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
+static enum rte_flow_item_type pattern_fdir_ipv4_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv4_udp_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_udp_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
 static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	/* Ethertype */
 	{ pattern_ethertype, i40e_flow_parse_ethertype_filter },
@@ -1628,6 +1657,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	{ pattern_fdir_ipv4_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_udp_esp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_udp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_tcp, i40e_flow_parse_fdir_filter },
@@ -1636,6 +1667,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	{ pattern_fdir_ipv6_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_udp_esp, i40e_flow_parse_fdir_filter },
 	/* FDIR - support default flow type with flexible payload */
 	{ pattern_fdir_ethertype_raw_1, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ethertype_raw_2, i40e_flow_parse_fdir_filter },
@@ -2420,6 +2453,28 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,
 			cus_pctype = i40e_find_customized_pctype(pf,
 						 I40E_CUSTOMIZED_GTPU_IPV6);
 		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		if (!filter->input.flow_ext.is_udp) {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+			else if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		} else {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+			else if (filter->input.flow_ext.oip_type ==
+					I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+			filter->input.flow_ext.is_udp = false;
+		}
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "Unsupported item type");
 		break;
@@ -2431,6 +2486,30 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,
 	return I40E_FILTER_PCTYPE_INVALID;
 }
 
+static void
+i40e_flow_set_filter_spi(struct i40e_fdir_filter_conf *filter,
+	const struct rte_flow_item_esp *esp_spec)
+{
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV4) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv4_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv4_flow.spi =
+				esp_spec->hdr.spi;
+	}
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV6) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv6_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv6_flow.spi =
+				esp_spec->hdr.spi;
+	}
+}
+
 /* 1. Last in item should be NULL as range is not supported.
  * 2. Supported patterns: refer to array i40e_supported_patterns.
  * 3. Default supported flow type and input set: refer to array
@@ -2459,6 +2538,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 	const struct rte_flow_item_udp *udp_spec, *udp_mask;
 	const struct rte_flow_item_sctp *sctp_spec, *sctp_mask;
 	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_esp *esp_spec, *esp_mask;
 	const struct rte_flow_item_raw *raw_spec, *raw_mask;
 	const struct rte_flow_item_vf *vf_spec;
 
@@ -2654,10 +2734,18 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 					ipv4_spec->hdr.src_addr;
 				filter->input.flow.ip4_flow.dst_ip =
 					ipv4_spec->hdr.dst_addr;
+
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;
 			} else if (!ipv4_spec && !ipv4_mask && !outer_ip) {
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV4;
+			} else if (!ipv4_spec && !ipv4_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;
 			} else if ((ipv4_spec || ipv4_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2716,6 +2804,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				filter->input.flow.ipv6_flow.hop_limits =
 					ipv6_spec->hdr.hop_limits;
 
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
+
 				rte_memcpy(filter->input.flow.ipv6_flow.src_ip,
 					   ipv6_spec->hdr.src_addr, 16);
 				rte_memcpy(filter->input.flow.ipv6_flow.dst_ip,
@@ -2729,6 +2821,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV6;
+			} else if (!ipv6_spec && !ipv6_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
 			} else if ((ipv6_spec || ipv6_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2828,7 +2924,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 						udp_spec->hdr.dst_port;
 				}
 			}
-
+			filter->input.flow_ext.is_udp = true;
 			layer_idx = I40E_FLXPLD_L4_IDX;
 
 			break;
@@ -2863,6 +2959,39 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				cus_proto = item_type;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			if (!pf->esp_support) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Unsupported ESP protocol");
+				return -rte_errno;
+			}
+
+			esp_spec = item->spec;
+			esp_mask = item->mask;
+
+			if (!esp_spec || !esp_mask) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ESP item");
+				return -rte_errno;
+			}
+
+			if (esp_spec && esp_mask) {
+				if (esp_mask->hdr.spi != UINT32_MAX) {
+					rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ESP mask");
+					return -rte_errno;
+				}
+				i40e_flow_set_filter_spi(filter, esp_spec);
+				filter->input.flow_ext.customized_pctype = true;
+				cus_proto = item_type;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_SCTP:
 			sctp_spec = item->spec;
 			sctp_mask = item->mask;
Signature · 1 line
2.7.4
#94 lore raw

PATCH v4 9/14 net/i40e: support ESP in Flow Director

In reply to Bernard Iremonger

add fill_ip6_head()
hardcode udp destination port to 4500
handle ESP and AH pctypes in ESP-AH profile

---
 drivers/net/i40e/i40e_fdir.c | 126 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 118 insertions(+), 8 deletions(-)
drivers/net/i40e/i40e_fdir.c +118 -8
index dee007d..5f85703 100644
@@ -54,6 +54,8 @@
 #define I40E_FDIR_GTP_MSG_TYPE_0X01         0x01
 #define I40E_FDIR_GTP_MSG_TYPE_0XFF         0xFF
 
+#define I40E_FDIR_ESP_DST_PORT              4500
+
 /* Wait time for fdir filter programming */
 #define I40E_FDIR_MAX_WAIT_US 10000
 
@@ -971,6 +973,37 @@ i40e_flow_fdir_find_customized_pctype(struct i40e_pf *pf, uint8_t pctype)
 }
 
 static inline int
+fill_ip6_head(const struct i40e_fdir_input *fdir_input, unsigned char *raw_pkt,
+		uint8_t next_proto, uint8_t len, uint16_t *ether_type)
+{
+	struct rte_ipv6_hdr *ip6;
+
+	ip6 = (struct rte_ipv6_hdr *)raw_pkt;
+
+	*ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
+	ip6->vtc_flow = rte_cpu_to_be_32(I40E_FDIR_IPv6_DEFAULT_VTC_FLOW |
+		(fdir_input->flow.ipv6_flow.tc << I40E_FDIR_IPv6_TC_OFFSET));
+	ip6->payload_len = rte_cpu_to_be_16(I40E_FDIR_IPv6_PAYLOAD_LEN);
+	ip6->proto = fdir_input->flow.ipv6_flow.proto ?
+		fdir_input->flow.ipv6_flow.proto : next_proto;
+	ip6->hop_limits = fdir_input->flow.ipv6_flow.hop_limits ?
+		fdir_input->flow.ipv6_flow.hop_limits :
+		I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS;
+	/**
+	 * The source and destination fields in the transmitted packet
+	 * need to be presented in a reversed order with respect
+	 * to the expected received packets.
+	 */
+	rte_memcpy(&ip6->src_addr, &fdir_input->flow.ipv6_flow.dst_ip,
+		IPV6_ADDR_LEN);
+	rte_memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip,
+		IPV6_ADDR_LEN);
+	len += sizeof(struct rte_ipv6_hdr);
+
+	return len;
+}
+
+static inline int
 i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 				const struct i40e_fdir_input *fdir_input,
 				unsigned char *raw_pkt,
@@ -1045,16 +1078,29 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 		ip->src_addr = fdir_input->flow.ip4_flow.dst_ip;
 		ip->dst_addr = fdir_input->flow.ip4_flow.src_ip;
 
-		if (!is_customized_pctype)
+		if (!is_customized_pctype) {
 			ip->next_proto_id = fdir_input->flow.ip4_flow.proto ?
 				fdir_input->flow.ip4_flow.proto :
 				next_proto[fdir_input->pctype];
-		else if (cus_pctype->index == I40E_CUSTOMIZED_GTPC ||
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_GTPC ||
 			 cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4 ||
 			 cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 ||
-			 cus_pctype->index == I40E_CUSTOMIZED_GTPU)
+			 cus_pctype->index == I40E_CUSTOMIZED_GTPU) {
 			ip->next_proto_id = IPPROTO_UDP;
-		len += sizeof(struct rte_ipv4_hdr);
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4) {
+			ip->next_proto_id = IPPROTO_ESP;
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4_UDP) {
+			ip->next_proto_id = IPPROTO_UDP;
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6)
+			len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_ESP,
+					len, ether_type);
+		else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6_UDP)
+			len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_UDP,
+					len, ether_type);
 	} else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP ||
 		   pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP ||
 		   pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP ||
@@ -1088,8 +1134,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 			   IPV6_ADDR_LEN);
 		len += sizeof(struct rte_ipv6_hdr);
 	} else {
-		PMD_DRV_LOG(ERR, "unknown pctype %u.",
-			    fdir_input->pctype);
+		PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype);
 		return -1;
 	}
 
@@ -1115,6 +1160,10 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 	struct rte_flow_item_gtp *gtp;
 	struct rte_ipv4_hdr *gtp_ipv4;
 	struct rte_ipv6_hdr *gtp_ipv6;
+	struct rte_flow_item_esp *esp;
+	struct rte_ipv4_hdr *esp_ipv4;
+	struct rte_ipv6_hdr *esp_ipv6;
+
 	uint8_t size, dst = 0;
 	uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/
 	int len;
@@ -1285,10 +1334,71 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 			} else
 				payload = (unsigned char *)gtp +
 					sizeof(struct rte_flow_item_gtp);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4 ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6 ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4_UDP ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6_UDP) {
+			if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4) {
+				esp_ipv4 = (struct rte_ipv4_hdr *)
+					(raw_pkt + len);
+				esp = (struct rte_flow_item_esp *)esp_ipv4;
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv4_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV4_UDP) {
+				esp_ipv4 = (struct rte_ipv4_hdr *)
+					(raw_pkt + len);
+				udp = (struct rte_udp_hdr *)esp_ipv4;
+				udp->dst_port = rte_cpu_to_be_16
+					(I40E_FDIR_ESP_DST_PORT);
+
+				udp->dgram_len = rte_cpu_to_be_16
+						(I40E_FDIR_UDP_DEFAULT_LEN);
+				esp = (struct rte_flow_item_esp *)
+					((unsigned char *)esp_ipv4 +
+						sizeof(struct rte_udp_hdr));
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv4_udp_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_udp_hdr) +
+						sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV6) {
+				esp_ipv6 = (struct rte_ipv6_hdr *)
+					(raw_pkt + len);
+				esp = (struct rte_flow_item_esp *)esp_ipv6;
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv6_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV6_UDP) {
+				esp_ipv6 = (struct rte_ipv6_hdr *)
+					(raw_pkt + len);
+				udp = (struct rte_udp_hdr *)esp_ipv6;
+				udp->dst_port =	rte_cpu_to_be_16
+					(I40E_FDIR_ESP_DST_PORT);
+
+				udp->dgram_len = rte_cpu_to_be_16
+					(I40E_FDIR_UDP_DEFAULT_LEN);
+				esp = (struct rte_flow_item_esp *)
+					((unsigned char *)esp_ipv6 +
+						sizeof(struct rte_udp_hdr));
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv6_udp_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_udp_hdr) +
+						sizeof(struct rte_esp_hdr);
+			}
 		}
 	} else {
-		PMD_DRV_LOG(ERR, "unknown pctype %u.",
-			    fdir_input->pctype);
+		PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype);
 		return -1;
 	}
 
Signature · 1 line
2.7.4
#95 lore raw

PATCH v4 10/14 config: add debug to I40E Flow Director

In reply to Bernard Iremonger

add CONFIG_RTE_LIBRTE_I40E_DEBUG_FD to config/common_base file

---
 config/common_base | 1 +
 1 file changed, 1 insertion(+)
config/common_base +1 -0
index 7dec7ed..7a76c26 100644
@@ -305,6 +305,7 @@ CONFIG_RTE_LIBRTE_I40E_PMD=y
 CONFIG_RTE_LIBRTE_I40E_DEBUG_RX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_I40E_DEBUG_TX_FREE=n
+CONFIG_RTE_LIBRTE_I40E_DEBUG_FD=y
 CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y
 CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=y
 CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n
Signature · 1 line
2.7.4
#96 lore raw

PATCH v4 11/14 net/i40e: display Flow Director packet

In reply to Bernard Iremonger

include rte_config.h in i40e_fdir.c
In debug mode call rte_hexdump in i40e_flow_fdir_construct_pkt() and in i40e_fdir_construct_pkt()

---
 drivers/net/i40e/i40e_fdir.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_fdir.c +10 -2
index 5f85703..67bb28c 100644
@@ -21,6 +21,10 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_config.h>
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+#include <rte_hexdump.h>
+#endif
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -954,7 +958,9 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len);
+#endif
 	return 0;
 }
 
@@ -1415,7 +1421,9 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+#ifdef RTE_LIBRTE_I40E_DEBUG_FD
+	rte_hexdump(stdout, NULL, raw_pkt, len);
+#endif
 	return 0;
 }
 
Signature · 1 line
2.7.4
#97 lore raw

PATCH v4 12/14 librte_ethdev: add ESP and AH flow types to RSS

In reply to Bernard Iremonger

Add flow types for the following PCTYPE's in the DDP ipsec profile:
14: IPV6 ESP
15: IPV4 ESP
16: IPV6 AH
17: IPV4 AH
18: IPV6 UDP ESP
19: IPV4 UDP ESP

Add the following RSS macros for IPsec:
ETH_RSS_ESP
ETH_RSS_AH
ETH_RSS_IPSEC

---
 lib/librte_ethdev/rte_ethdev.h | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
lib/librte_ethdev/rte_ethdev.h +28 -1
index 18a9def..39c89cb 100644
@@ -484,7 +484,13 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based flow */
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_IPV4_AH            24 /**< IPv4 AH protocol based flow */
+#define RTE_ETH_FLOW_IPV4_ESP           25 /**< IPv4 ESP protocol based flow */
+#define RTE_ETH_FLOW_IPV4_UDP_ESP       26 /**< IPv4 UDP ESP proto based flow */
+#define RTE_ETH_FLOW_IPV6_AH            27 /**< IPv6 AH protocol based flow */
+#define RTE_ETH_FLOW_IPV6_ESP           28 /**< IPv6 ESP protocol based flow */
+#define RTE_ETH_FLOW_IPV6_UDP_ESP       29 /**< IPv6 UDP ESP proto based flow */
+#define RTE_ETH_FLOW_MAX                30
 
 /*
  * Below macros are defined for RSS offload types, they can be used to
@@ -511,6 +517,13 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
+#define ETH_RSS_IPV4_AH            (1ULL << 24)
+#define ETH_RSS_IPV4_ESP           (1ULL << 25)
+#define ETH_RSS_IPV4_UDP_ESP       (1ULL << 26)
+#define ETH_RSS_IPV6_AH            (1ULL << 27)
+#define ETH_RSS_IPV6_ESP           (1ULL << 28)
+#define ETH_RSS_IPV6_UDP_ESP       (1ULL << 29)
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -571,6 +584,20 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_AH ( \
+	ETH_RSS_IPV4_AH | \
+	ETH_RSS_IPV6_AH)
+
+#define ETH_RSS_ESP ( \
+	ETH_RSS_IPV4_ESP | \
+	ETH_RSS_IPV6_ESP | \
+	ETH_RSS_IPV4_UDP_ESP | \
+	ETH_RSS_IPV6_UDP_ESP)
+
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
Signature · 1 line
2.7.4
#98 lore raw

PATCH v4 13/14 doc: release note for ESP

In reply to Bernard Iremonger

Release note for ESP support on the i40e PMD.
Release note for ESP support on testpmd.

---
 doc/guides/rel_notes/release_20_02.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
doc/guides/rel_notes/release_20_02.rst +9 -0
index 0eaa45a..367c980 100644
@@ -56,6 +56,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated i40e driver to support ESP.**
+
+  Updated the i40e PMD to support ESP-AH supporting profiles which can be
+  programmed by the dynamic device personalization (DDP) process.
+
+* **Updated testpmd to support ESP flows.**
+
+  Added support for ESP rte_flow patterns to the testpmd application.
+
 
 Removed Items
 -------------
Signature · 1 line
2.7.4
#99 lore raw

PATCH v4 14/14 doc: update i40e user guide

In reply to Bernard Iremonger

Update the i40e user guide with ESP information.

---
 doc/guides/nics/i40e.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
doc/guides/nics/i40e.rst +3 -1
index 38acf59..5cf34d9 100644
@@ -457,7 +457,7 @@ which is used to configure hardware by downloading a profile to support
 protocols/filters which are not supported by default. The DDP
 functionality requires a NIC firmware version of 6.0 or greater.
 
-Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP,
+Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP/ESP,
 steering can be used with rte_flow API.
 
 GTPv1 package is released, and it can be downloaded from
@@ -466,6 +466,8 @@ https://downloadcenter.intel.com/download/27587.
 PPPoE package is released, and it can be downloaded from
 https://downloadcenter.intel.com/download/28040.
 
+ESP-AH package is not released yet.
+
 Load a profile which supports GTP and store backup profile:
 
 .. code-block:: console
Signature · 1 line
2.7.4
#100 lore raw

PATCH v3 1/9 app/testpmd: parse flow command line for ESP

In reply to Bernard Iremonger

add ITEM_ESP
add ITEM_ESP_SPI
add debug to cmdline_flow.c

---
 app/test-pmd/cmdline_flow.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
app/test-pmd/cmdline_flow.c +1 -3
index 9643148..9c6edb8 100644
@@ -6075,9 +6075,6 @@ cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,
 static void
 cmd_flow_parsed(const struct buffer *in)
 {
-	printf("Flow command line parsed successfully for command=%d.\n",
-			in->command);
-
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr,
@@ -6261,6 +6258,7 @@ flow_item_default_mask(const struct rte_flow_item *item)
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
Signature · 1 line
2.7.4
#101 lore raw

PATCH v3 2/9 app/testpmd: dump Rx and Tx mbuf

In reply to Bernard Iremonger

add call to rte_pktmbuf_dump() in dump_pkt_burst in util.c

---
 app/test-pmd/util.c | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/util.c +1 -0
index b514be5..bf03873 100644
@@ -158,6 +158,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 		printf("  ol_flags: %s\n", buf);
 		if (rte_mbuf_check(mb, 1, &reason) < 0)
 			printf("INVALID mbuf: %s\n", reason);
+		rte_pktmbuf_dump(stdout, pkts[i], pkts[i]->data_len);
 	}
 }
 
Signature · 1 line
2.7.4
#102 lore raw

PATCH v3 3/9 net/i40e: improve RSS debug

In reply to Bernard Iremonger

improve RSS debug in i40e_ethdev.c

---
 drivers/net/i40e/i40e_ethdev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +6 -2
index 5999c96..5f1cf8a 100644
@@ -8679,7 +8679,9 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 			num);
 
 	if (num == 0) {
-		PMD_INIT_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_INIT_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
@@ -12840,7 +12842,9 @@ i40e_config_rss_filter(struct i40e_pf *pf,
 			num);
 
 	if (num == 0) {
-		PMD_DRV_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_DRV_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
Signature · 1 line
2.7.4
Acked-by on v3 3/9
#103 lore raw

Re: [dpdk-dev] [PATCH v3 3/9] net/i40e: improve RSS debug

Quoted 12 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Thursday, January 9, 2020 8:16 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v3 3/9] net/i40e: improve RSS debug

Quoted 3 lines

improve RSS debug in i40e_ethdev.c

#104 lore raw

PATCH v3 4/9 net/i40e: handle ESP tunnel

In reply to Bernard Iremonger

handle ESP tunnel in rte_pmd_i40e.c

---
 drivers/net/i40e/rte_pmd_i40e.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/rte_pmd_i40e.c +2 -1
index fdcb1a4..b987346 100644
@@ -2172,7 +2172,8 @@ static int check_invalid_pkt_type(uint32_t pkt_type)
 	    tnl != RTE_PTYPE_TUNNEL_GRENAT &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPC &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPU &&
-	    tnl != RTE_PTYPE_TUNNEL_L2TP)
+	    tnl != RTE_PTYPE_TUNNEL_L2TP &&
+	    tnl != RTE_PTYPE_TUNNEL_ESP)
 		return -1;
 
 	if (il2 &&
Signature · 1 line
2.7.4
#105 lore raw

Re: [dpdk-dev] [PATCH v3 4/9] net/i40e: handle ESP tunnel

Hi Bernard:

Quoted 11 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Thursday, January 9, 2020 8:16 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v3 4/9] net/i40e: handle ESP tunnel

handle ESP tunnel in rte_pmd_i40e.c

Not sure if this should be part of the patch that enable the DDP that support ESP packet type, or at least it should be the one after that patch?

Regards
Qi

Quoted 22 lines
---
 drivers/net/i40e/rte_pmd_i40e.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/rte_pmd_i40e.c +2 -2
index fdcb1a4..b987346 100644
@@ -2172,7 +2172,8 @@ static int check_invalid_pkt_type(uint32_t pkt_type)
 	    tnl != RTE_PTYPE_TUNNEL_GRENAT &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPC &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPU &&
-	    tnl != RTE_PTYPE_TUNNEL_L2TP)
+	    tnl != RTE_PTYPE_TUNNEL_L2TP &&
+	    tnl != RTE_PTYPE_TUNNEL_ESP)
 		return -1;
 
 	if (il2 &&
--

2.7.4

#106 lore raw

Re: [dpdk-dev] [PATCH v3 4/9] net/i40e: handle ESP tunnel

Hi Qi,

Quoted 22 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Thursday, January 9, 2020 2:09 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: RE: [PATCH v3 4/9] net/i40e: handle ESP tunnel

Hi Bernard:

Quoted 11 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Thursday, January 9, 2020 8:16 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v3 4/9] net/i40e: handle ESP tunnel

Quoted 4 lines
Quoted 1 line

handle ESP tunnel in rte_pmd_i40e.c

Not sure if this should be part of the patch that enable the DDP that
support ESP packet type, or at least it should be the one after that patch?

I think it is ok to be in a separate patch (easier to review). The patch set may need to be reordered.

Quoted 23 lines

Regards
Qi

drivers/net/i40e/rte_pmd_i40e.c static int check_invalid_pkt_type(uint32_t

Quoted 11 lines
---
 drivers/net/i40e/rte_pmd_i40e.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/i40e/rte_pmd_i40e.c index fdcb1a4..b987346 100644

drivers/net/i40e/rte_pmd_i40e.c +0 -0
@@ -2172,7 +2172,8 @@ static int check_invalid_pkt_type(uint32_t

pkt_type)

Quoted 8 lines
drivers/net/i40e/rte_pmd_i40e.c +2 -1
 	    tnl != RTE_PTYPE_TUNNEL_GRENAT &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPC &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPU &&
-	    tnl != RTE_PTYPE_TUNNEL_L2TP)
+	    tnl != RTE_PTYPE_TUNNEL_L2TP &&
+	    tnl != RTE_PTYPE_TUNNEL_ESP)
 		return -1;
 
Quoted 4 lines
Quoted 3 lines
drivers/net/i40e/rte_pmd_i40e.c +0 -1
 	if (il2 &&
--

2.7.4

Thanks for review.

Regards,

Bernard.

#107 lore raw

PATCH v3 5/9 net/i40e: process ESP flows

In reply to Bernard Iremonger

Process ESP flows on Flow Director and RSS.

add eth/ipv4/esp and eth/ipv6/esp patterns add eth/ipv4/udp/esp and eth/ipv6/esp/udp patterns add flow structures for above patterns update i40e_flow_parse_fdir_filter()
add i40e_flow_set_filter_spi()
add fill_ip6_head()
add oip_type in filter
add is_udp in filter
use tenant_id in filter for spi
handle ESP and AH pctypes in ESP-AH profile update customized code for ESP
hardcode udp destination port to 4500

---
 drivers/net/i40e/i40e_ethdev.c |  44 +++++++++++++-
 drivers/net/i40e/i40e_ethdev.h |  38 ++++++++++++
 drivers/net/i40e/i40e_fdir.c   | 128 +++++++++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c   | 135 ++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 332 insertions(+), 13 deletions(-)
drivers/net/i40e/i40e_ethdev.c +43 -1
index 5f1cf8a..a462eba 100644
@@ -1106,6 +1106,7 @@ i40e_init_customized_info(struct i40e_pf *pf)
 	}
 
 	pf->gtp_support = false;
+	pf->esp_support = false;
 }
 
 void
@@ -12337,6 +12338,7 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			}
 		}
 		name[strlen(name) - 1] = '\0';
+		PMD_DRV_LOG(INFO, "name = %s\n", name);
 		if (!strcmp(name, "GTPC"))
 			new_pctype =
 				i40e_find_customized_pctype(pf,
@@ -12353,6 +12355,30 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			new_pctype =
 				i40e_find_customized_pctype(pf,
 						      I40E_CUSTOMIZED_GTPU);
+		else if (!strcmp(name, "IPV4_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+		else if (!strcmp(name, "IPV6_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		else if (!strcmp(name, "IPV4_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+		else if (!strcmp(name, "IPV6_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+		else if (!strcmp(name, "IPV4_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV4);
+		else if (!strcmp(name, "IPV6_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV6);
 		if (new_pctype) {
 			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD) {
 				new_pctype->pctype = pctype_value;
@@ -12448,6 +12474,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					continue;
 				memset(name, 0, sizeof(name));
 				strcpy(name, proto[n].name);
+				PMD_DRV_LOG(INFO, "name = %s\n", name);
 				if (!strncasecmp(name, "PPPOE", 5))
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_L2_ETHER_PPPOE;
@@ -12541,6 +12568,10 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GTPU;
 					in_tunnel = true;
+				} else if (!strncasecmp(name, "ESP", 3)) {
+					ptype_mapping[i].sw_ptype |=
+						RTE_PTYPE_TUNNEL_ESP;
+					in_tunnel = true;
 				} else if (!strncasecmp(name, "GRENAT", 6)) {
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GRENAT;
@@ -12560,7 +12591,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 	ret = rte_pmd_i40e_ptype_mapping_update(port_id, ptype_mapping,
 						ptype_num, 0);
 	if (ret)
-		PMD_DRV_LOG(ERR, "Failed to update mapping table.");
+		PMD_DRV_LOG(ERR, "Failed to update ptype mapping table.");
 
 	rte_free(ptype_mapping);
 	rte_free(ptype);
@@ -12625,6 +12656,17 @@ i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg,
 		}
 	}
 
+	/* Check if ESP is supported. */
+	for (i = 0; i < proto_num; i++) {
+		if (!strncmp(proto[i].name, "ESP", 3)) {
+			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD)
+				pf->esp_support = true;
+			else
+				pf->esp_support = false;
+			break;
+		}
+	}
+
 	/* Update customized pctype info */
 	ret = i40e_update_customized_pctype(dev, pkg, pkg_size,
 					    proto_num, proto, op);
drivers/net/i40e/i40e_ethdev.h +38 -0
index 295ad59..792a047 100644
@@ -501,6 +501,29 @@ struct i40e_gtp_ipv6_flow {
 	struct rte_eth_ipv6_flow ip6;
 };
 
+/* A structure used to define the input for ESP IPV4 flow */
+struct i40e_esp_ipv4_flow {
+	struct rte_eth_ipv4_flow ipv4;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 flow */
+struct i40e_esp_ipv6_flow {
+	struct rte_eth_ipv6_flow ipv6;
+	uint32_t spi;	/* SPI in big endian. */
+};
+/* A structure used to define the input for ESP IPV4 UDP flow */
+struct i40e_esp_ipv4_udp_flow {
+	struct rte_eth_udpv4_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 UDP flow */
+struct i40e_esp_ipv6_udp_flow {
+	struct rte_eth_udpv6_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
 /* A structure used to define the input for raw type flow */
 struct i40e_raw_flow {
 	uint16_t pctype;
@@ -526,6 +549,10 @@ union i40e_fdir_flow {
 	struct i40e_gtp_ipv4_flow  gtp_ipv4_flow;
 	struct i40e_gtp_ipv6_flow  gtp_ipv6_flow;
 	struct i40e_raw_flow       raw_flow;
+	struct i40e_esp_ipv4_flow  esp_ipv4_flow;
+	struct i40e_esp_ipv6_flow  esp_ipv6_flow;
+	struct i40e_esp_ipv4_udp_flow  esp_ipv4_udp_flow;
+	struct i40e_esp_ipv6_udp_flow  esp_ipv6_udp_flow;
 };
 
 enum i40e_fdir_ip_type {
@@ -542,8 +569,10 @@ struct i40e_fdir_flow_ext {
 	uint16_t dst_id; /* VF ID, available when is_vf is 1*/
 	bool inner_ip;   /* If there is inner ip */
 	enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
+	enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
 	bool customized_pctype; /* If customized pctype is used */
 	bool pkt_template; /* If raw packet template is used */
+	bool is_udp; /* ipv4|ipv6 udp flow */
 };
 
 /* A structure used to define the input for a flow director filter entry */
@@ -769,6 +798,8 @@ enum i40e_tunnel_type {
 	I40E_TUNNEL_TYPE_QINQ,
 	I40E_TUNNEL_TYPE_GTPC,
 	I40E_TUNNEL_TYPE_GTPU,
+	I40E_TUNNEL_TYPE_ESPoUDP,
+	I40E_TUNNEL_TYPE_ESPoIP,
 	I40E_TUNNEL_TYPE_MAX,
 };
 
@@ -897,6 +928,12 @@ enum i40e_new_pctype {
 	I40E_CUSTOMIZED_GTPU_IPV4,
 	I40E_CUSTOMIZED_GTPU_IPV6,
 	I40E_CUSTOMIZED_GTPU,
+	I40E_CUSTOMIZED_ESP_IPV4,
+	I40E_CUSTOMIZED_ESP_IPV6,
+	I40E_CUSTOMIZED_ESP_IPV4_UDP,
+	I40E_CUSTOMIZED_ESP_IPV6_UDP,
+	I40E_CUSTOMIZED_AH_IPV4,
+	I40E_CUSTOMIZED_AH_IPV6,
 	I40E_CUSTOMIZED_MAX,
 };
 
@@ -1001,6 +1038,7 @@ struct i40e_pf {
 
 	/* Dynamic Device Personalization */
 	bool gtp_support; /* 1 - support GTP-C and GTP-U */
+	bool esp_support; /* 1 - support ESP SPI */
 	/* customer customized pctype */
 	struct i40e_customized_pctype customized_pctype[I40E_CUSTOMIZED_MAX];
 	/* Switch Domain Id */
drivers/net/i40e/i40e_fdir.c +119 -9

178 lines not on this page · raw message

drivers/net/i40e/i40e_flow.c +132 -3

211 lines not on this page · raw message

Signature · 1 line
2.7.4
#108 lore raw

Re: [dpdk-dev] [PATCH v3 5/9] net/i40e: process ESP flows

Hi Bernard:

Quoted 10 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Thursday, January 9, 2020 8:17 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v3 5/9] net/i40e: process ESP flows

Quoted 8 lines

Process ESP flows on Flow Director and RSS.

add eth/ipv4/esp and eth/ipv6/esp patterns add eth/ipv4/udp/esp and eth/ipv6/esp/udp patterns add flow structures for above patterns update i40e_flow_parse_fdir_filter() add i40e_flow_set_filter_spi() add fill_ip6_head() add oip_type in filter add is_udp in filter use tenant_id in filter for spi handle ESP and AH pctypes in ESP-AH profile update customized code for ESP hardcode udp destination port to 4500

Looks like the patch could be separate into 3 parts for easy review.

One is for the DDP package process, (rte_pmd_i40e_process_ddp_package -> i40e_update_customized_info -> i40e_update_customized_pctype One is for fdir related - training packet construction .. etc.
And one for adding all rte_flow parser

Regards
Qi

Quoted 625 lines
---
 drivers/net/i40e/i40e_ethdev.c |  44 +++++++++++++-
drivers/net/i40e/i40e_ethdev.h |  38 ++++++++++++
 drivers/net/i40e/i40e_fdir.c   | 128
+++++++++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c   | 135
++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 332 insertions(+), 13 deletions(-)
drivers/net/i40e/i40e_ethdev.c +2 -0
index 5f1cf8a..a462eba 100644
@@ -1106,6 +1106,7 @@ i40e_init_customized_info(struct i40e_pf *pf)
 	}
 
 	pf->gtp_support = false;
+	pf->esp_support = false;
 }
 
 void
@@ -12337,6 +12338,7 @@ i40e_update_customized_pctype(struct
 rte_eth_dev *dev, uint8_t *pkg,
 			}
 		}
 		name[strlen(name) - 1] = '\0';
+		PMD_DRV_LOG(INFO, "name = %s\n", name);
 		if (!strcmp(name, "GTPC"))
 			new_pctype =
drivers/net/i40e/i40e_ethdev.c +24 -0
 				i40e_find_customized_pctype(pf,
@@ -12353,6 +12355,30 @@ i40e_update_customized_pctype(struct
 rte_eth_dev *dev, uint8_t *pkg,
 			new_pctype =
 				i40e_find_customized_pctype(pf,
 						      I40E_CUSTOMIZED_GTPU);
+		else if (!strcmp(name, "IPV4_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+		else if (!strcmp(name, "IPV6_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		else if (!strcmp(name, "IPV4_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+		else if (!strcmp(name, "IPV6_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+		else if (!strcmp(name, "IPV4_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV4);
+		else if (!strcmp(name, "IPV6_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV6);
 		if (new_pctype) {
 			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD) {
drivers/net/i40e/i40e_ethdev.c +1 -0
 				new_pctype->pctype = pctype_value;
@@ -12448,6 +12474,7 @@ i40e_update_customized_ptype(struct
 rte_eth_dev *dev, uint8_t *pkg,
 					continue;
 				memset(name, 0, sizeof(name));
 				strcpy(name, proto[n].name);
+				PMD_DRV_LOG(INFO, "name = %s\n", name);
 				if (!strncasecmp(name, "PPPOE", 5))
 					ptype_mapping[i].sw_ptype |=
drivers/net/i40e/i40e_ethdev.c +4 -0
 						RTE_PTYPE_L2_ETHER_PPPOE;
@@ -12541,6 +12568,10 @@ i40e_update_customized_ptype(struct
 rte_eth_dev *dev, uint8_t *pkg,
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GTPU;
 					in_tunnel = true;
+				} else if (!strncasecmp(name, "ESP", 3)) {
+					ptype_mapping[i].sw_ptype |=
+						RTE_PTYPE_TUNNEL_ESP;
+					in_tunnel = true;
 				} else if (!strncasecmp(name, "GRENAT", 6)) {
 					ptype_mapping[i].sw_ptype |=
drivers/net/i40e/i40e_ethdev.c +1 -1
 						RTE_PTYPE_TUNNEL_GRENAT;
@@ -12560,7 +12591,7 @@ i40e_update_customized_ptype(struct
 rte_eth_dev *dev, uint8_t *pkg,
 	ret = rte_pmd_i40e_ptype_mapping_update(port_id, ptype_mapping,
 						ptype_num, 0);
 	if (ret)
-		PMD_DRV_LOG(ERR, "Failed to update mapping table.");
+		PMD_DRV_LOG(ERR, "Failed to update ptype mapping table.");
 
 	rte_free(ptype_mapping);
drivers/net/i40e/i40e_ethdev.c +11 -0
 	rte_free(ptype);
@@ -12625,6 +12656,17 @@ i40e_update_customized_info(struct
 rte_eth_dev *dev, uint8_t *pkg,
 		}
 	}
 
+	/* Check if ESP is supported. */
+	for (i = 0; i < proto_num; i++) {
+		if (!strncmp(proto[i].name, "ESP", 3)) {
+			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD)
+				pf->esp_support = true;
+			else
+				pf->esp_support = false;
+			break;
+		}
+	}
+
 	/* Update customized pctype info */
 	ret = i40e_update_customized_pctype(dev, pkg, pkg_size,
drivers/net/i40e/i40e_ethdev.c +0 -0
 					    proto_num, proto, op);
drivers/net/i40e/i40e_ethdev.h +38 -1
index 295ad59..792a047 100644
@@ -501,6 +501,29 @@ struct i40e_gtp_ipv6_flow {
 	struct rte_eth_ipv6_flow ip6;
 };
 
+/* A structure used to define the input for ESP IPV4 flow */ struct
+i40e_esp_ipv4_flow {
+	struct rte_eth_ipv4_flow ipv4;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 flow */ struct
+i40e_esp_ipv6_flow {
+	struct rte_eth_ipv6_flow ipv6;
+	uint32_t spi;	/* SPI in big endian. */
+};
+/* A structure used to define the input for ESP IPV4 UDP flow */ struct
+i40e_esp_ipv4_udp_flow {
+	struct rte_eth_udpv4_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 UDP flow */ struct
+i40e_esp_ipv6_udp_flow {
+	struct rte_eth_udpv6_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
 /* A structure used to define the input for raw type flow */  struct
 i40e_raw_flow {
 	uint16_t pctype;
@@ -526,6 +549,10 @@ union i40e_fdir_flow {
 	struct i40e_gtp_ipv4_flow  gtp_ipv4_flow;
 	struct i40e_gtp_ipv6_flow  gtp_ipv6_flow;
 	struct i40e_raw_flow       raw_flow;
+	struct i40e_esp_ipv4_flow  esp_ipv4_flow;
+	struct i40e_esp_ipv6_flow  esp_ipv6_flow;
+	struct i40e_esp_ipv4_udp_flow  esp_ipv4_udp_flow;
+	struct i40e_esp_ipv6_udp_flow  esp_ipv6_udp_flow;
 };
 
 enum i40e_fdir_ip_type {
@@ -542,8 +569,10 @@ struct i40e_fdir_flow_ext {
 	uint16_t dst_id; /* VF ID, available when is_vf is 1*/
 	bool inner_ip;   /* If there is inner ip */
 	enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
+	enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
 	bool customized_pctype; /* If customized pctype is used */
 	bool pkt_template; /* If raw packet template is used */
+	bool is_udp; /* ipv4|ipv6 udp flow */
 };
 
 /* A structure used to define the input for a flow director filter entry */ @@
-769,6 +798,8 @@ enum i40e_tunnel_type {
 	I40E_TUNNEL_TYPE_QINQ,
 	I40E_TUNNEL_TYPE_GTPC,
 	I40E_TUNNEL_TYPE_GTPU,
+	I40E_TUNNEL_TYPE_ESPoUDP,
+	I40E_TUNNEL_TYPE_ESPoIP,
 	I40E_TUNNEL_TYPE_MAX,
 };
@@ -897,6 +928,12 @@ enum i40e_new_pctype {
 	I40E_CUSTOMIZED_GTPU_IPV4,
 	I40E_CUSTOMIZED_GTPU_IPV6,
 	I40E_CUSTOMIZED_GTPU,
+	I40E_CUSTOMIZED_ESP_IPV4,
+	I40E_CUSTOMIZED_ESP_IPV6,
+	I40E_CUSTOMIZED_ESP_IPV4_UDP,
+	I40E_CUSTOMIZED_ESP_IPV6_UDP,
+	I40E_CUSTOMIZED_AH_IPV4,
+	I40E_CUSTOMIZED_AH_IPV6,
 	I40E_CUSTOMIZED_MAX,
 };
 
@@ -1001,6 +1038,7 @@ struct i40e_pf {
 
 	/* Dynamic Device Personalization */
 	bool gtp_support; /* 1 - support GTP-C and GTP-U */
+	bool esp_support; /* 1 - support ESP SPI */
 	/* customer customized pctype */
 	struct i40e_customized_pctype
 customized_pctype[I40E_CUSTOMIZED_MAX];
drivers/net/i40e/i40e_ethdev.h +0 -0
 	/* Switch Domain Id */
drivers/net/i40e/i40e_fdir.c index renamed from drivers/net/i40e/i40e_fdir.c +0 -0

dee007d..3fa6297 100644

drivers/net/i40e/i40e_fdir.c +2 -0
@@ -54,6 +54,8 @@
 #define I40E_FDIR_GTP_MSG_TYPE_0X01         0x01
 #define I40E_FDIR_GTP_MSG_TYPE_0XFF         0xFF
 
+#define I40E_FDIR_ESP_DST_PORT              4500
+
 /* Wait time for fdir filter programming */  #define

I40E_FDIR_MAX_WAIT_US 10000

drivers/net/i40e/i40e_fdir.c +8 -0
@@ -971,6 +973,37 @@ i40e_flow_fdir_find_customized_pctype(struct
 i40e_pf *pf, uint8_t pctype)  }
 
 static inline int
+fill_ip6_head(const struct i40e_fdir_input *fdir_input, unsigned char
 *raw_pkt,
+		uint8_t next_proto, uint8_t len, uint16_t *ether_type) {
+	struct rte_ipv6_hdr *ip6;
+
+	ip6 = (struct rte_ipv6_hdr *)raw_pkt;
+
+	*ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
+	ip6->vtc_flow = rte_cpu_to_be_32(I40E_FDIR_IPv6_DEFAULT_VTC_FLOW

|

drivers/net/i40e/i40e_fdir.c +39 -4
+		(fdir_input->flow.ipv6_flow.tc << I40E_FDIR_IPv6_TC_OFFSET));
+	ip6->payload_len = rte_cpu_to_be_16(I40E_FDIR_IPv6_PAYLOAD_LEN);
+	ip6->proto = fdir_input->flow.ipv6_flow.proto ?
+		fdir_input->flow.ipv6_flow.proto : next_proto;
+	ip6->hop_limits = fdir_input->flow.ipv6_flow.hop_limits ?
+		fdir_input->flow.ipv6_flow.hop_limits :
+		I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS;
+	/**
+	 * The source and destination fields in the transmitted packet
+	 * need to be presented in a reversed order with respect
+	 * to the expected received packets.
+	 */
+	rte_memcpy(&ip6->src_addr, &fdir_input->flow.ipv6_flow.dst_ip,
+		IPV6_ADDR_LEN);
+	rte_memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip,
+		IPV6_ADDR_LEN);
+	len += sizeof(struct rte_ipv6_hdr);
+
+	return len;
+}
+
+static inline int
 i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 				const struct i40e_fdir_input *fdir_input,
 				unsigned char *raw_pkt,
@@ -1045,16 +1078,29 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf
 *pf,
 		ip->src_addr = fdir_input->flow.ip4_flow.dst_ip;
 		ip->dst_addr = fdir_input->flow.ip4_flow.src_ip;
 
-		if (!is_customized_pctype)
+		if (!is_customized_pctype) {
 			ip->next_proto_id = fdir_input->flow.ip4_flow.proto ?
 				fdir_input->flow.ip4_flow.proto :
 				next_proto[fdir_input->pctype];
-		else if (cus_pctype->index == I40E_CUSTOMIZED_GTPC ||
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_GTPC ||
 			 cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4 ||
 			 cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 ||
-			 cus_pctype->index == I40E_CUSTOMIZED_GTPU)
+			 cus_pctype->index == I40E_CUSTOMIZED_GTPU) {
 			ip->next_proto_id = IPPROTO_UDP;
-		len += sizeof(struct rte_ipv4_hdr);
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4) {
+			ip->next_proto_id = IPPROTO_ESP;
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4_UDP) {
+			ip->next_proto_id = IPPROTO_UDP;
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6)
+			len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_ESP,
+					len, ether_type);
+		else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6_UDP)
+			len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_UDP,
+					len, ether_type);
 	} else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP ||
 		   pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP ||
drivers/net/i40e/i40e_fdir.c +69 -6
 		   pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP || @@
-1088,8 +1134,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 			   IPV6_ADDR_LEN);
 		len += sizeof(struct rte_ipv6_hdr);
 	} else {
-		PMD_DRV_LOG(ERR, "unknown pctype %u.",
-			    fdir_input->pctype);
+		PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype);
 		return -1;
 	}
@@ -1115,6 +1160,10 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 	struct rte_flow_item_gtp *gtp;
 	struct rte_ipv4_hdr *gtp_ipv4;
 	struct rte_ipv6_hdr *gtp_ipv6;
+	struct rte_flow_item_esp *esp;
+	struct rte_ipv4_hdr *esp_ipv4;
+	struct rte_ipv6_hdr *esp_ipv6;
+
 	uint8_t size, dst = 0;
 	uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/
 	int len;
@@ -1285,10 +1334,71 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 			} else
 				payload = (unsigned char *)gtp +
 					sizeof(struct rte_flow_item_gtp);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4 ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6 ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4_UDP ||
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6_UDP) {
+			if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4) {
+				esp_ipv4 = (struct rte_ipv4_hdr *)
+					(raw_pkt + len);
+				esp = (struct rte_flow_item_esp *)esp_ipv4;
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv4_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV4_UDP) {
+				esp_ipv4 = (struct rte_ipv4_hdr *)
+					(raw_pkt + len);
+				udp = (struct rte_udp_hdr *)esp_ipv4;
+				udp->dst_port = rte_cpu_to_be_16
+					(I40E_FDIR_ESP_DST_PORT);
+
+				udp->dgram_len = rte_cpu_to_be_16
+						(I40E_FDIR_UDP_DEFAULT_LEN);
+				esp = (struct rte_flow_item_esp *)
+					((unsigned char *)esp_ipv4 +
+						sizeof(struct rte_udp_hdr));
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv4_udp_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_udp_hdr) +
+						sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV6) {
+				esp_ipv6 = (struct rte_ipv6_hdr *)
+					(raw_pkt + len);
+				esp = (struct rte_flow_item_esp *)esp_ipv6;
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv6_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV6_UDP) {
+				esp_ipv6 = (struct rte_ipv6_hdr *)
+					(raw_pkt + len);
+				udp = (struct rte_udp_hdr *)esp_ipv6;
+				udp->dst_port =	rte_cpu_to_be_16
+					(I40E_FDIR_ESP_DST_PORT);
+
+				udp->dgram_len = rte_cpu_to_be_16
+					(I40E_FDIR_UDP_DEFAULT_LEN);
+				esp = (struct rte_flow_item_esp *)
+					((unsigned char *)esp_ipv6 +
+						sizeof(struct rte_udp_hdr));
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv6_udp_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_udp_hdr) +
+						sizeof(struct rte_esp_hdr);
+			}
 		}
 	} else {
-		PMD_DRV_LOG(ERR, "unknown pctype %u.",
-			    fdir_input->pctype);
+		PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype);
 		return -1;
 	}
 
@@ -1305,7 +1415,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return 0;
 }
 
drivers/net/i40e/i40e_flow.c index renamed from drivers/net/i40e/i40e_flow.c +0 -0

6102103..c585d8b 100644

drivers/net/i40e/i40e_flow.c +0 -0
@@ -110,8 +110,7 @@ static int i40e_flow_destroy_tunnel_filter(struct

i40e_pf *pf, static int i40e_flow_flush_fdir_filter(struct i40e_pf *pf); static int i40e_flow_flush_ethertype_filter(struct i40e_pf *pf); static int i40e_flow_flush_tunnel_filter(struct i40e_pf *pf); -static int

drivers/net/i40e/i40e_flow.c +1 -1
-i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
+static int i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
 static int
 i40e_flow_parse_qinq_filter(struct rte_eth_dev *dev,
 			      const struct rte_flow_attr *attr, @@ -1615,6 +1614,36

@@ static enum rte_flow_item_type pattern_qinq_1[] = {

drivers/net/i40e/i40e_flow.c +91 -1
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
+static enum rte_flow_item_type pattern_fdir_ipv4_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv4_udp_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_udp_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
 static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	/* Ethertype */
 	{ pattern_ethertype, i40e_flow_parse_ethertype_filter }, @@ -1628,6
+1657,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	{ pattern_fdir_ipv4_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_udp_esp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_udp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_tcp, i40e_flow_parse_fdir_filter }, @@ -1636,6
+1667,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	{ pattern_fdir_ipv6_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_udp_esp, i40e_flow_parse_fdir_filter },
 	/* FDIR - support default flow type with flexible payload */
 	{ pattern_fdir_ethertype_raw_1, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ethertype_raw_2, i40e_flow_parse_fdir_filter }, @@
-2420,6 +2453,28 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,
 			cus_pctype = i40e_find_customized_pctype(pf,
 						 I40E_CUSTOMIZED_GTPU_IPV6);
 		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		if (!filter->input.flow_ext.is_udp) {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+			else if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		} else {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+			else if (filter->input.flow_ext.oip_type ==
+					I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype = i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+			filter->input.flow_ext.is_udp = false;
+		}
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "Unsupported item type");
 		break;
@@ -2431,6 +2486,30 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf
 *pf,
 	return I40E_FILTER_PCTYPE_INVALID;
 }
 
+static void
+i40e_flow_set_filter_spi(struct i40e_fdir_filter_conf *filter,
+	const struct rte_flow_item_esp *esp_spec) {
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV4) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv4_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv4_flow.spi =
+				esp_spec->hdr.spi;
+	}
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV6) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv6_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv6_flow.spi =
+				esp_spec->hdr.spi;
+	}
+}
+
 /* 1. Last in item should be NULL as range is not supported.
  * 2. Supported patterns: refer to array i40e_supported_patterns.
  * 3. Default supported flow type and input set: refer to array @@ -2459,6
+2538,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 	const struct rte_flow_item_udp *udp_spec, *udp_mask;
 	const struct rte_flow_item_sctp *sctp_spec, *sctp_mask;
 	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_esp *esp_spec, *esp_mask;
 	const struct rte_flow_item_raw *raw_spec, *raw_mask;
 	const struct rte_flow_item_vf *vf_spec;
@@ -2654,10 +2734,18 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev
 *dev,
 					ipv4_spec->hdr.src_addr;
 				filter->input.flow.ip4_flow.dst_ip =
 					ipv4_spec->hdr.dst_addr;
+
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;
 			} else if (!ipv4_spec && !ipv4_mask && !outer_ip) {
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV4;
+			} else if (!ipv4_spec && !ipv4_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;
 			} else if ((ipv4_spec || ipv4_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,
drivers/net/i40e/i40e_flow.c +4 -0
 						   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2716,6 +2804,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev
 *dev,
 				filter->input.flow.ipv6_flow.hop_limits =
 					ipv6_spec->hdr.hop_limits;
 
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
+
 				rte_memcpy(filter->input.flow.ipv6_flow.src_ip,
 					   ipv6_spec->hdr.src_addr, 16);
drivers/net/i40e/i40e_flow.c +4 -0
 				rte_memcpy(filter->input.flow.ipv6_flow.dst_ip,
@@ -2729,6 +2821,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev
 *dev,
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV6;
+			} else if (!ipv6_spec && !ipv6_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
 			} else if ((ipv6_spec || ipv6_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,
drivers/net/i40e/i40e_flow.c +1 -1
 						   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -2828,7 +2924,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev
 *dev,
 						udp_spec->hdr.dst_port;
 				}
 			}
-
+			filter->input.flow_ext.is_udp = true;
 			layer_idx = I40E_FLXPLD_L4_IDX;
 
drivers/net/i40e/i40e_flow.c +33 -0
 			break;
@@ -2863,6 +2959,39 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev
 *dev,
 				cus_proto = item_type;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			if (!pf->esp_support) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Unsupported ESP protocol");
+				return -rte_errno;
+			}
+
+			esp_spec = item->spec;
+			esp_mask = item->mask;
+
+			if (!esp_spec || !esp_mask) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ESP item");
+				return -rte_errno;
+			}
+
+			if (esp_spec && esp_mask) {
+				if (esp_mask->hdr.spi != UINT32_MAX) {
+					rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ESP mask");
+					return -rte_errno;
+				}
+				i40e_flow_set_filter_spi(filter, esp_spec);
+				filter->input.flow_ext.customized_pctype = true;
+				cus_proto = item_type;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_SCTP:
 			sctp_spec = item->spec;

sctp_mask = item->mask;
--
2.7.4

#109 lore raw

Re: [dpdk-dev] [PATCH v3 5/9] net/i40e: process ESP flows

Hi Qi,

Quoted 36 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Thursday, January 9, 2020 2:01 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: RE: [PATCH v3 5/9] net/i40e: process ESP flows

Hi Bernard:

Quoted 13 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Thursday, January 9, 2020 8:17 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v3 5/9] net/i40e: process ESP flows

Process ESP flows on Flow Director and RSS.

Quoted 8 lines

add eth/ipv4/esp and eth/ipv6/esp patterns add eth/ipv4/udp/esp and eth/ipv6/esp/udp patterns add flow structures for above patterns update
i40e_flow_parse_fdir_filter() add i40e_flow_set_filter_spi() add fill_ip6_head() add oip_type in filter add is_udp in filter use tenant_id in filter for spi handle ESP and AH pctypes in ESP-AH profile update customized code for ESP hardcode udp destination port to 4500

Looks like the patch could be separate into 3 parts for easy review.

Quoted 7 lines

One is for the DDP package process, (rte_pmd_i40e_process_ddp_package -

Quoted 1 line

i40e_update_customized_info -> i40e_update_customized_pctype One is

for fdir related - training packet construction .. etc. And one for adding all rte_flow parser

Regards
Qi

I have refactored this patch into 4 patches in the v4 patchset.

Quoted 685 lines
Quoted 34 lines
---
 drivers/net/i40e/i40e_ethdev.c |  44 +++++++++++++-
drivers/net/i40e/i40e_ethdev.h |  38 ++++++++++++
 drivers/net/i40e/i40e_fdir.c   | 128
+++++++++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c   | 135
++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 332 insertions(+), 13 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 5f1cf8a..a462eba 100644

drivers/net/i40e/i40e_ethdev.c +2 -0
@@ -1106,6 +1106,7 @@ i40e_init_customized_info(struct i40e_pf *pf)
 	}
 
 	pf->gtp_support = false;
+	pf->esp_support = false;
 }
 
 void
@@ -12337,6 +12338,7 @@ i40e_update_customized_pctype(struct
 rte_eth_dev *dev, uint8_t *pkg,
 			}
 		}
 		name[strlen(name) - 1] = '\0';
+		PMD_DRV_LOG(INFO, "name = %s\n", name);
 		if (!strcmp(name, "GTPC"))
 			new_pctype =
drivers/net/i40e/i40e_ethdev.c +0 -0
 				i40e_find_customized_pctype(pf,

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_pctype(struct · line 12358

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
@@ -12353,6 +12355,30 @@ i40e_update_customized_pctype(struct
 rte_eth_dev *dev, uint8_t *pkg,
 			new_pctype =
 				i40e_find_customized_pctype(pf,
 

I40E_CUSTOMIZED_GTPU);

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +4 -0
+		else if (!strcmp(name, "IPV4_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+
	I40E_CUSTOMIZED_ESP_IPV4);

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +4 -0
+		else if (!strcmp(name, "IPV6_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+
	I40E_CUSTOMIZED_ESP_IPV6);

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +4 -0
+		else if (!strcmp(name, "IPV4_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+
	I40E_CUSTOMIZED_ESP_IPV4_UDP);

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +4 -0
+		else if (!strcmp(name, "IPV6_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+
	I40E_CUSTOMIZED_ESP_IPV6_UDP);

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +4 -0
+		else if (!strcmp(name, "IPV4_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+
	I40E_CUSTOMIZED_AH_IPV4);

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +4 -0
+		else if (!strcmp(name, "IPV6_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+
	I40E_CUSTOMIZED_AH_IPV6);
Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
 		if (new_pctype) {
 			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD) {

new_pctype->pctype = pctype_value; @@ -

12448,6 +12474,7 @@

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,

Quoted 6 lines

i40e_update_customized_ptype(struct
rte_eth_dev *dev, uint8_t *pkg,

drivers/net/i40e/i40e_ethdev.c +1 -0
 					continue;
 				memset(name, 0, sizeof(name));
 				strcpy(name, proto[n].name);
+				PMD_DRV_LOG(INFO, "name = %s\n",

name);

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg, · line 12479

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
 				if (!strncasecmp(name, "PPPOE", 5))
 					ptype_mapping[i].sw_ptype |=
	RTE_PTYPE_L2_ETHER_PPPOE;

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_ptype(struct · line 12577

Quoted 12 lines
drivers/net/i40e/i40e_ethdev.c +4 -0
@@ -12541,6 +12568,10 @@ i40e_update_customized_ptype(struct
 rte_eth_dev *dev, uint8_t *pkg,
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GTPU;
 					in_tunnel = true;
+				} else if (!strncasecmp(name, "ESP", 3)) {
+					ptype_mapping[i].sw_ptype |=
+						RTE_PTYPE_TUNNEL_ESP;
+					in_tunnel = true;
 				} else if (!strncasecmp(name, "GRENAT", 6)) {
 					ptype_mapping[i].sw_ptype |=
	RTE_PTYPE_TUNNEL_GRENAT;

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_ptype(struct · line 12592

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
@@ -12560,7 +12591,7 @@ i40e_update_customized_ptype(struct
 rte_eth_dev *dev, uint8_t *pkg,
 	ret = rte_pmd_i40e_ptype_mapping_update(port_id,

ptype_mapping,

drivers/net/i40e/i40e_ethdev.c i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +1 -1
 						ptype_num, 0);
 	if (ret)
-		PMD_DRV_LOG(ERR, "Failed to update mapping table.");
+		PMD_DRV_LOG(ERR, "Failed to update ptype mapping

table.");

Quoted 127 lines
drivers/net/i40e/i40e_ethdev.c +11 -0
 	rte_free(ptype_mapping);
 	rte_free(ptype);
@@ -12625,6 +12656,17 @@ i40e_update_customized_info(struct
 rte_eth_dev *dev, uint8_t *pkg,
 		}
 	}
 
+	/* Check if ESP is supported. */
+	for (i = 0; i < proto_num; i++) {
+		if (!strncmp(proto[i].name, "ESP", 3)) {
+			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD)
+				pf->esp_support = true;
+			else
+				pf->esp_support = false;
+			break;
+		}
+	}
+
 	/* Update customized pctype info */
 	ret = i40e_update_customized_pctype(dev, pkg, pkg_size,
drivers/net/i40e/i40e_ethdev.c +0 -0
 					    proto_num, proto, op);
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.h index 295ad59..792a047 100644

drivers/net/i40e/i40e_ethdev.h +29 -0
@@ -501,6 +501,29 @@ struct i40e_gtp_ipv6_flow {
 	struct rte_eth_ipv6_flow ip6;
 };
 
+/* A structure used to define the input for ESP IPV4 flow */ struct
+i40e_esp_ipv4_flow {
+	struct rte_eth_ipv4_flow ipv4;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 flow */ struct
+i40e_esp_ipv6_flow {
+	struct rte_eth_ipv6_flow ipv6;
+	uint32_t spi;	/* SPI in big endian. */
+};
+/* A structure used to define the input for ESP IPV4 UDP flow */
+struct i40e_esp_ipv4_udp_flow {
+	struct rte_eth_udpv4_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 UDP flow */
+struct i40e_esp_ipv6_udp_flow {
+	struct rte_eth_udpv6_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
 /* A structure used to define the input for raw type flow */  struct
 i40e_raw_flow {
 	uint16_t pctype;
@@ -526,6 +549,10 @@ union i40e_fdir_flow {
 	struct i40e_gtp_ipv4_flow  gtp_ipv4_flow;
 	struct i40e_gtp_ipv6_flow  gtp_ipv6_flow;
 	struct i40e_raw_flow       raw_flow;
+	struct i40e_esp_ipv4_flow  esp_ipv4_flow;
+	struct i40e_esp_ipv6_flow  esp_ipv6_flow;
+	struct i40e_esp_ipv4_udp_flow  esp_ipv4_udp_flow;
+	struct i40e_esp_ipv6_udp_flow  esp_ipv6_udp_flow;
 };
 
 enum i40e_fdir_ip_type {
@@ -542,8 +569,10 @@ struct i40e_fdir_flow_ext {
 	uint16_t dst_id; /* VF ID, available when is_vf is 1*/
 	bool inner_ip;   /* If there is inner ip */
 	enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
+	enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
 	bool customized_pctype; /* If customized pctype is used */
 	bool pkt_template; /* If raw packet template is used */
+	bool is_udp; /* ipv4|ipv6 udp flow */
 };
 
 /* A structure used to define the input for a flow director filter

entry */ @@
-769,6 +798,8 @@ enum i40e_tunnel_type {

drivers/net/i40e/i40e_ethdev.h +9 -0
 	I40E_TUNNEL_TYPE_QINQ,
 	I40E_TUNNEL_TYPE_GTPC,
 	I40E_TUNNEL_TYPE_GTPU,
+	I40E_TUNNEL_TYPE_ESPoUDP,
+	I40E_TUNNEL_TYPE_ESPoIP,
 	I40E_TUNNEL_TYPE_MAX,
 };
@@ -897,6 +928,12 @@ enum i40e_new_pctype {
 	I40E_CUSTOMIZED_GTPU_IPV4,
 	I40E_CUSTOMIZED_GTPU_IPV6,
 	I40E_CUSTOMIZED_GTPU,
+	I40E_CUSTOMIZED_ESP_IPV4,
+	I40E_CUSTOMIZED_ESP_IPV6,
+	I40E_CUSTOMIZED_ESP_IPV4_UDP,
+	I40E_CUSTOMIZED_ESP_IPV6_UDP,
+	I40E_CUSTOMIZED_AH_IPV4,
+	I40E_CUSTOMIZED_AH_IPV6,
 	I40E_CUSTOMIZED_MAX,
 };
 
@@ -1001,6 +1038,7 @@ struct i40e_pf {
 
 	/* Dynamic Device Personalization */
 	bool gtp_support; /* 1 - support GTP-C and GTP-U */
+	bool esp_support; /* 1 - support ESP SPI */
 	/* customer customized pctype */
 	struct i40e_customized_pctype
 customized_pctype[I40E_CUSTOMIZED_MAX];
drivers/net/i40e/i40e_ethdev.h +0 -0
 	/* Switch Domain Id */
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index
dee007d..3fa6297 100644

drivers/net/i40e/i40e_fdir.c +2 -0
@@ -54,6 +54,8 @@
 #define I40E_FDIR_GTP_MSG_TYPE_0X01         0x01
 #define I40E_FDIR_GTP_MSG_TYPE_0XFF         0xFF
 
+#define I40E_FDIR_ESP_DST_PORT              4500
+
 /* Wait time for fdir filter programming */  #define

I40E_FDIR_MAX_WAIT_US 10000

drivers/net/i40e/i40e_fdir.c +0 -0
@@ -971,6 +973,37 @@ i40e_flow_fdir_find_customized_pctype(struct
 i40e_pf *pf, uint8_t pctype)  }
 

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_find_customized_pctype(struct · line 984

Quoted 10 lines
drivers/net/i40e/i40e_fdir.c +8 -0
 static inline int
+fill_ip6_head(const struct i40e_fdir_input *fdir_input, unsigned char
 *raw_pkt,
+		uint8_t next_proto, uint8_t len, uint16_t *ether_type) {
+	struct rte_ipv6_hdr *ip6;
+
+	ip6 = (struct rte_ipv6_hdr *)raw_pkt;
+
+	*ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
+	ip6->vtc_flow =

rte_cpu_to_be_32(I40E_FDIR_IPv6_DEFAULT_VTC_FLOW

drivers/net/i40e/i40e_fdir.c

Quoted 2 lines

|

drivers/net/i40e/i40e_fdir.c +1 -0
+		(fdir_input->flow.ipv6_flow.tc <<

I40E_FDIR_IPv6_TC_OFFSET));

drivers/net/i40e/i40e_fdir.c

Quoted 1 line
drivers/net/i40e/i40e_fdir.c +1 -0
+	ip6->payload_len =

rte_cpu_to_be_16(I40E_FDIR_IPv6_PAYLOAD_LEN);

Quoted 24 lines
drivers/net/i40e/i40e_fdir.c +20 -0
+	ip6->proto = fdir_input->flow.ipv6_flow.proto ?
+		fdir_input->flow.ipv6_flow.proto : next_proto;
+	ip6->hop_limits = fdir_input->flow.ipv6_flow.hop_limits ?
+		fdir_input->flow.ipv6_flow.hop_limits :
+		I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS;
+	/**
+	 * The source and destination fields in the transmitted packet
+	 * need to be presented in a reversed order with respect
+	 * to the expected received packets.
+	 */
+	rte_memcpy(&ip6->src_addr, &fdir_input->flow.ipv6_flow.dst_ip,
+		IPV6_ADDR_LEN);
+	rte_memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip,
+		IPV6_ADDR_LEN);
+	len += sizeof(struct rte_ipv6_hdr);
+
+	return len;
+}
+
+static inline int
 i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 				const struct i40e_fdir_input *fdir_input,
 				unsigned char *raw_pkt,

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf · line 1083

Quoted 7 lines
drivers/net/i40e/i40e_fdir.c +1 -1
@@ -1045,16 +1078,29 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf
 *pf,
 		ip->src_addr = fdir_input->flow.ip4_flow.dst_ip;
 		ip->dst_addr = fdir_input->flow.ip4_flow.src_ip;
 
-		if (!is_customized_pctype)
+		if (!is_customized_pctype) {
 			ip->next_proto_id = fdir_input->flow.ip4_flow.proto

?

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,

Quoted 6 lines
drivers/net/i40e/i40e_fdir.c +2 -1
 				fdir_input->flow.ip4_flow.proto :
 				next_proto[fdir_input->pctype];
-		else if (cus_pctype->index == I40E_CUSTOMIZED_GTPC ||
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_GTPC ||
 			 cus_pctype->index ==

I40E_CUSTOMIZED_GTPU_IPV4 ||

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf · line 1089

Quoted 1 line
drivers/net/i40e/i40e_fdir.c +0 -0
 			 cus_pctype->index ==

I40E_CUSTOMIZED_GTPU_IPV6 ||

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,

Quoted 6 lines
drivers/net/i40e/i40e_fdir.c +3 -2
-			 cus_pctype->index == I40E_CUSTOMIZED_GTPU)
+			 cus_pctype->index == I40E_CUSTOMIZED_GTPU) {
 			ip->next_proto_id = IPPROTO_UDP;
-		len += sizeof(struct rte_ipv4_hdr);
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index ==

I40E_CUSTOMIZED_ESP_IPV4) {

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,

Quoted 3 lines
drivers/net/i40e/i40e_fdir.c +3 -0
+			ip->next_proto_id = IPPROTO_ESP;
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index ==

I40E_CUSTOMIZED_ESP_IPV4_UDP) {

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,

Quoted 3 lines
drivers/net/i40e/i40e_fdir.c +3 -0
+			ip->next_proto_id = IPPROTO_UDP;
+			len += sizeof(struct rte_ipv4_hdr);
+		} else if (cus_pctype->index ==

I40E_CUSTOMIZED_ESP_IPV6)

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf · line 1100

Quoted 1 line
drivers/net/i40e/i40e_fdir.c +1 -0
+			len = fill_ip6_head(fdir_input, raw_pkt,

IPPROTO_ESP,

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf · line 1102

Quoted 2 lines
drivers/net/i40e/i40e_fdir.c +2 -0
+					len, ether_type);
+		else if (cus_pctype->index ==

I40E_CUSTOMIZED_ESP_IPV6_UDP)

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf · line 1103

Quoted 1 line
drivers/net/i40e/i40e_fdir.c +1 -0
+			len = fill_ip6_head(fdir_input, raw_pkt,

IPPROTO_UDP,

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf

Quoted 16 lines
drivers/net/i40e/i40e_fdir.c +1 -0
+					len, ether_type);
 	} else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP ||
 		   pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP ||
drivers/net/i40e/i40e_fdir.c +1 -3
 		   pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP || @@
-1088,8 +1134,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf,
 			   IPV6_ADDR_LEN);
 		len += sizeof(struct rte_ipv6_hdr);
 	} else {
-		PMD_DRV_LOG(ERR, "unknown pctype %u.",
-			    fdir_input->pctype);
+		PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input-

pctype);

drivers/net/i40e/i40e_fdir.c +0 -0
 		return -1;
 	}
@@ -1115,6 +1160,10 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf

*pf,

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,

Quoted 9 lines
drivers/net/i40e/i40e_fdir.c +4 -0
 	struct rte_flow_item_gtp *gtp;
 	struct rte_ipv4_hdr *gtp_ipv4;
 	struct rte_ipv6_hdr *gtp_ipv6;
+	struct rte_flow_item_esp *esp;
+	struct rte_ipv4_hdr *esp_ipv4;
+	struct rte_ipv6_hdr *esp_ipv6;
+
 	uint8_t size, dst = 0;
 	uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by

default*/

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf

Quoted 2 lines
drivers/net/i40e/i40e_fdir.c +0 -0
 	int len;
@@ -1285,10 +1334,71 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf

*pf,

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,

Quoted 4 lines
drivers/net/i40e/i40e_fdir.c +1 -0
 			} else
 				payload = (unsigned char *)gtp +
 					sizeof(struct rte_flow_item_gtp);
+		} else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV4

||

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf · line 1338

Quoted 1 line
drivers/net/i40e/i40e_fdir.c +1 -0
+			cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6

||

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf · line 1339

Quoted 1 line
drivers/net/i40e/i40e_fdir.c +1 -0
+			cus_pctype->index ==

I40E_CUSTOMIZED_ESP_IPV4_UDP ||

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf · line 1340

Quoted 1 line
drivers/net/i40e/i40e_fdir.c +1 -0
+			cus_pctype->index ==

I40E_CUSTOMIZED_ESP_IPV6_UDP) {

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf · line 1341

Quoted 1 line
drivers/net/i40e/i40e_fdir.c +1 -0
+			if (cus_pctype->index ==

I40E_CUSTOMIZED_ESP_IPV4) {

Quoted 8 lines
drivers/net/i40e/i40e_fdir.c +8 -0
+				esp_ipv4 = (struct rte_ipv4_hdr *)
+					(raw_pkt + len);
+				esp = (struct rte_flow_item_esp *)esp_ipv4;
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv4_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_esp_hdr);

drivers/net/i40e/i40e_fdir.c i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, · line 1386

Quoted 10 lines
drivers/net/i40e/i40e_fdir.c +10 -0
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV4_UDP) {
+				esp_ipv4 = (struct rte_ipv4_hdr *)
+					(raw_pkt + len);
+				udp = (struct rte_udp_hdr *)esp_ipv4;
+				udp->dst_port = rte_cpu_to_be_16
+					(I40E_FDIR_ESP_DST_PORT);
+
+				udp->dgram_len = rte_cpu_to_be_16
+
	(I40E_FDIR_UDP_DEFAULT_LEN);
Quoted 67 lines
drivers/net/i40e/i40e_fdir.c +40 -2
+				esp = (struct rte_flow_item_esp *)
+					((unsigned char *)esp_ipv4 +
+						sizeof(struct rte_udp_hdr));
+				esp->hdr.spi =
+					fdir_input-
 flow.esp_ipv4_udp_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_udp_hdr) +
+						sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV6) {
+				esp_ipv6 = (struct rte_ipv6_hdr *)
+					(raw_pkt + len);
+				esp = (struct rte_flow_item_esp *)esp_ipv6;
+				esp->hdr.spi =
+					fdir_input->flow.esp_ipv6_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_esp_hdr);
+			} else if (cus_pctype->index ==
+					I40E_CUSTOMIZED_ESP_IPV6_UDP) {
+				esp_ipv6 = (struct rte_ipv6_hdr *)
+					(raw_pkt + len);
+				udp = (struct rte_udp_hdr *)esp_ipv6;
+				udp->dst_port =	rte_cpu_to_be_16
+					(I40E_FDIR_ESP_DST_PORT);
+
+				udp->dgram_len = rte_cpu_to_be_16
+					(I40E_FDIR_UDP_DEFAULT_LEN);
+				esp = (struct rte_flow_item_esp *)
+					((unsigned char *)esp_ipv6 +
+						sizeof(struct rte_udp_hdr));
+				esp->hdr.spi =
+					fdir_input-
 flow.esp_ipv6_udp_flow.spi;
+				payload = (unsigned char *)esp +
+					sizeof(struct rte_esp_hdr);
+				len += sizeof(struct rte_udp_hdr) +
+						sizeof(struct rte_esp_hdr);
+			}
 		}
 	} else {
-		PMD_DRV_LOG(ERR, "unknown pctype %u.",
-			    fdir_input->pctype);
+		PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input-
 pctype);
drivers/net/i40e/i40e_fdir.c +1 -1
 		return -1;
 	}
@@ -1305,7 +1415,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return 0;
 }
 
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_flow.c index 6102103..c585d8b 100644

drivers/net/i40e/i40e_flow.c +0 -0
@@ -110,8 +110,7 @@ static int i40e_flow_destroy_tunnel_filter(struct

i40e_pf *pf, static int i40e_flow_flush_fdir_filter(struct i40e_pf *pf); static int i40e_flow_flush_ethertype_filter(struct i40e_pf *pf); static int i40e_flow_flush_tunnel_filter(struct i40e_pf *pf);

drivers/net/i40e/i40e_flow.c static int i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,

Quoted 5 lines
drivers/net/i40e/i40e_flow.c +1 -1
-static int -i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
+static int i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
 static int
 i40e_flow_parse_qinq_filter(struct rte_eth_dev *dev,
 			      const struct rte_flow_attr *attr, @@ -1615,6

+1614,36 @@

Quoted 27 lines

static enum rte_flow_item_type pattern_qinq_1[] = {

drivers/net/i40e/i40e_flow.c +23 -0
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
+static enum rte_flow_item_type pattern_fdir_ipv4_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv4_udp_esp[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_fdir_ipv6_udp_esp[] = {

drivers/net/i40e/i40e_flow.c static enum rte_flow_item_type pattern_qinq_1[] = {

Quoted 10 lines
drivers/net/i40e/i40e_flow.c +7 -0
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_ESP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
 static struct i40e_valid_pattern i40e_supported_patterns[] = {
 	/* Ethertype */
 	{ pattern_ethertype, i40e_flow_parse_ethertype_filter }, @@ -

1628,6

Quoted 13 lines

+1657,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[] += {

drivers/net/i40e/i40e_flow.c +4 -0
 	{ pattern_fdir_ipv4_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv4_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv4_udp_esp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_udp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_tcp, i40e_flow_parse_fdir_filter }, @@ -1636,6
+1667,8 @@ static struct i40e_valid_pattern i40e_supported_patterns[]
+= {

drivers/net/i40e/i40e_flow.c

Quoted 10 lines
drivers/net/i40e/i40e_flow.c +2 -1
 	{ pattern_fdir_ipv6_gtpu, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv4, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_gtpu_ipv6, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_esp, i40e_flow_parse_fdir_filter },
+	{ pattern_fdir_ipv6_udp_esp, i40e_flow_parse_fdir_filter },
 	/* FDIR - support default flow type with flexible payload */
 	{ pattern_fdir_ethertype_raw_1, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ethertype_raw_2, i40e_flow_parse_fdir_filter }, @@
-2420,6 +2453,28 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,
 			cus_pctype = i40e_find_customized_pctype(pf,

I40E_CUSTOMIZED_GTPU_IPV6);

drivers/net/i40e/i40e_flow.c i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,

Quoted 6 lines
drivers/net/i40e/i40e_flow.c +5 -0
 		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		if (!filter->input.flow_ext.is_udp) {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype =

i40e_find_customized_pctype(pf,

Quoted 1 line

+

	I40E_CUSTOMIZED_ESP_IPV4);

drivers/net/i40e/i40e_flow.c i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,

Quoted 3 lines
drivers/net/i40e/i40e_flow.c +3 -0
+			else if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype =

i40e_find_customized_pctype(pf,

Quoted 1 line

+

	I40E_CUSTOMIZED_ESP_IPV6);

drivers/net/i40e/i40e_flow.c i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,

Quoted 4 lines
drivers/net/i40e/i40e_flow.c +4 -0
+		} else {
+			if (filter->input.flow_ext.oip_type ==
+				I40E_FDIR_IPTYPE_IPV4)
+				cus_pctype =

i40e_find_customized_pctype(pf,

Quoted 1 line

+

	I40E_CUSTOMIZED_ESP_IPV4_UDP);

drivers/net/i40e/i40e_flow.c i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,

Quoted 3 lines
drivers/net/i40e/i40e_flow.c +3 -0
+			else if (filter->input.flow_ext.oip_type ==
+					I40E_FDIR_IPTYPE_IPV6)
+				cus_pctype =

i40e_find_customized_pctype(pf,

Quoted 1 line

+

	I40E_CUSTOMIZED_ESP_IPV6_UDP);
Quoted 56 lines
drivers/net/i40e/i40e_flow.c +32 -1
+			filter->input.flow_ext.is_udp = false;
+		}
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "Unsupported item type");
 		break;
@@ -2431,6 +2486,30 @@ i40e_flow_fdir_get_pctype_value(struct i40e_pf
 *pf,
 	return I40E_FILTER_PCTYPE_INVALID;
 }
 
+static void
+i40e_flow_set_filter_spi(struct i40e_fdir_filter_conf *filter,
+	const struct rte_flow_item_esp *esp_spec) {
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV4) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv4_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv4_flow.spi =
+				esp_spec->hdr.spi;
+	}
+	if (filter->input.flow_ext.oip_type ==
+		I40E_FDIR_IPTYPE_IPV6) {
+		if (filter->input.flow_ext.is_udp)
+			filter->input.flow.esp_ipv6_udp_flow.spi =
+				esp_spec->hdr.spi;
+		else
+			filter->input.flow.esp_ipv6_flow.spi =
+				esp_spec->hdr.spi;
+	}
+}
+
 /* 1. Last in item should be NULL as range is not supported.
  * 2. Supported patterns: refer to array i40e_supported_patterns.
  * 3. Default supported flow type and input set: refer to array @@
-2459,6
+2538,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 	const struct rte_flow_item_udp *udp_spec, *udp_mask;
 	const struct rte_flow_item_sctp *sctp_spec, *sctp_mask;
 	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_esp *esp_spec, *esp_mask;
 	const struct rte_flow_item_raw *raw_spec, *raw_mask;
 	const struct rte_flow_item_vf *vf_spec;
@@ -2654,10 +2734,18 @@ i40e_flow_parse_fdir_pattern(struct
 rte_eth_dev *dev,
 					ipv4_spec->hdr.src_addr;
 				filter->input.flow.ip4_flow.dst_ip =
 					ipv4_spec->hdr.dst_addr;
+
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct · line 2751

Quoted 10 lines
drivers/net/i40e/i40e_flow.c +4 -0
 			} else if (!ipv4_spec && !ipv4_mask && !outer_ip) {
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV4;
+			} else if (!ipv4_spec && !ipv4_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV4;
 			} else if ((ipv4_spec || ipv4_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,

RTE_FLOW_ERROR_TYPE_ITEM,

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct

Quoted 1 line
drivers/net/i40e/i40e_flow.c +0 -0
@@ -2716,6 +2804,10 @@ i40e_flow_parse_fdir_pattern(struct

rte_eth_dev

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct

Quoted 14 lines
drivers/net/i40e/i40e_flow.c +4 -0
 *dev,
 				filter->input.flow.ipv6_flow.hop_limits =
 					ipv6_spec->hdr.hop_limits;
 
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
+
 				rte_memcpy(filter-
 input.flow.ipv6_flow.src_ip,
drivers/net/i40e/i40e_flow.c +0 -0
 					   ipv6_spec->hdr.src_addr, 16);
 				rte_memcpy(filter-

input.flow.ipv6_flow.dst_ip,

drivers/net/i40e/i40e_flow.c +0 -0
@@ -2729,6 +2821,10 @@ i40e_flow_parse_fdir_pattern(struct

rte_eth_dev

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, · line 2829

Quoted 11 lines
drivers/net/i40e/i40e_flow.c +4 -0
 *dev,
 				filter->input.flow_ext.inner_ip = true;
 				filter->input.flow_ext.iip_type =
 					I40E_FDIR_IPTYPE_IPV6;
+			} else if (!ipv6_spec && !ipv6_mask && outer_ip) {
+				filter->input.flow_ext.inner_ip = false;
+				filter->input.flow_ext.oip_type =
+					I40E_FDIR_IPTYPE_IPV6;
 			} else if ((ipv6_spec || ipv6_mask) && !outer_ip) {
 				rte_flow_error_set(error, EINVAL,

RTE_FLOW_ERROR_TYPE_ITEM,

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct

Quoted 1 line
drivers/net/i40e/i40e_flow.c +0 -0
@@ -2828,7 +2924,7 @@ i40e_flow_parse_fdir_pattern(struct

rte_eth_dev

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct

Quoted 10 lines
drivers/net/i40e/i40e_flow.c +1 -1
 *dev,
 						udp_spec->hdr.dst_port;
 				}
 			}
-
+			filter->input.flow_ext.is_udp = true;
 			layer_idx = I40E_FLXPLD_L4_IDX;
 
drivers/net/i40e/i40e_flow.c +0 -0
 			break;
@@ -2863,6 +2959,39 @@ i40e_flow_parse_fdir_pattern(struct

rte_eth_dev

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, · line 2970

Quoted 8 lines
drivers/net/i40e/i40e_flow.c +4 -0
 *dev,
 				cus_proto = item_type;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			if (!pf->esp_support) {
+				rte_flow_error_set(error, EINVAL,
+

RTE_FLOW_ERROR_TYPE_ITEM,

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct · line 2968

Quoted 2 lines
drivers/net/i40e/i40e_flow.c +2 -0
+						   item,
+						   "Unsupported ESP

protocol");

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, · line 2981

Quoted 9 lines
drivers/net/i40e/i40e_flow.c +9 -0
+				return -rte_errno;
+			}
+
+			esp_spec = item->spec;
+			esp_mask = item->mask;
+
+			if (!esp_spec || !esp_mask) {
+				rte_flow_error_set(error, EINVAL,
+

RTE_FLOW_ERROR_TYPE_ITEM,

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,

Quoted 9 lines
drivers/net/i40e/i40e_flow.c +9 -0
+						   item,
+						   "Invalid ESP item");
+				return -rte_errno;
+			}
+
+			if (esp_spec && esp_mask) {
+				if (esp_mask->hdr.spi != UINT32_MAX) {
+					rte_flow_error_set(error, EINVAL,
+

RTE_FLOW_ERROR_TYPE_ITEM,

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,

Quoted 6 lines
drivers/net/i40e/i40e_flow.c +6 -0
+						   item,
+						   "Invalid ESP mask");
+					return -rte_errno;
+				}
+				i40e_flow_set_filter_spi(filter, esp_spec);
+				filter->input.flow_ext.customized_pctype =

true;

Quoted 9 lines
Quoted 8 lines
drivers/net/i40e/i40e_flow.c +3 -0
+				cus_proto = item_type;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_SCTP:
 			sctp_spec = item->spec;

sctp_mask = item->mask;
--
2.7.4

Regards,

Bernard.

#110 lore raw

PATCH v3 6/9 net/i40e: display Flow Director packet

In reply to Bernard Iremonger

call rte_hexdump in i40e_flow_fdir_construct_pkt() in i40e_fdir.c

---
 drivers/net/i40e/i40e_fdir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_fdir.c +3 -1
index 3fa6297..78329d2 100644
@@ -21,6 +21,7 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_hexdump.h>
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -805,6 +806,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input,
 			    fdir_input->flow_type);
 		return -1;
 	}
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return len;
 }
 
@@ -954,7 +956,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return 0;
 }
 
Signature · 1 line
2.7.4
#111 lore raw

Re: [dpdk-dev] [PATCH v3 6/9] net/i40e: display Flow Director packet

Hi Bernard:

Quoted 30 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Thursday, January 9, 2020 8:17 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v3 6/9] net/i40e: display Flow Director packet

call rte_hexdump in i40e_flow_fdir_construct_pkt() in i40e_fdir.c

---
 drivers/net/i40e/i40e_fdir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_fdir.c index renamed from drivers/net/i40e/i40e_fdir.c +0 -0

3fa6297..78329d2 100644

drivers/net/i40e/i40e_fdir.c +1 -0
@@ -21,6 +21,7 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_hexdump.h>
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"

drivers/net/i40e/i40e_fdir.c i40e_fdir_fill_eth_ip_head(const struct · line 810

Quoted 5 lines
drivers/net/i40e/i40e_fdir.c +1 -0
@@ -805,6 +806,7 @@ i40e_fdir_fill_eth_ip_head(const struct
 rte_eth_fdir_input *fdir_input,
 			    fdir_input->flow_type);
 		return -1;
 	}
+	rte_hexdump(stdout, NULL, raw_pkt, len);

Why we need this? Does this just for debug?

Regards
Qi

Quoted 14 lines
drivers/net/i40e/i40e_fdir.c +1 -2
 	return len;
 }
@@ -954,7 +956,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return 0;
 }
 
--

2.7.4

#112 lore raw

Re: [dpdk-dev] [PATCH v3 6/9] net/i40e: display Flow Director packet

Hi Qi,

Quoted 41 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Thursday, January 9, 2020 12:44 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: RE: [PATCH v3 6/9] net/i40e: display Flow Director packet

Hi Bernard:

Quoted 29 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Thursday, January 9, 2020 8:17 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v3 6/9] net/i40e: display Flow Director packet

call rte_hexdump in i40e_flow_fdir_construct_pkt() in i40e_fdir.c

---
 drivers/net/i40e/i40e_fdir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index
3fa6297..78329d2 100644

drivers/net/i40e/i40e_fdir.c +1 -0
@@ -21,6 +21,7 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_hexdump.h>
 
Quoted 10 lines

drivers/net/i40e/i40e_fdir.c i40e_fdir_fill_eth_ip_head(const struct · line 810

Quoted 8 lines
drivers/net/i40e/i40e_fdir.c +1 -0
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -805,6 +806,7 @@ i40e_fdir_fill_eth_ip_head(const struct
 rte_eth_fdir_input *fdir_input,
 			    fdir_input->flow_type);
 		return -1;
 	}
+	rte_hexdump(stdout, NULL, raw_pkt, len);

Why we need this? Does this just for debug?

Useful to see the packet constructed by this function, otherwise no visibility on what is happening. Needed for debug.

Quoted 16 lines

Regards
Qi

Quoted 12 lines
drivers/net/i40e/i40e_fdir.c +1 -1
 	return len;
 }
@@ -954,7 +956,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return 0;
 }
 
Quoted 3 lines
Quoted 2 lines

--
2.7.4

Regards,

Bernard.

#113 lore raw

Re: [dpdk-dev] [PATCH v3 6/9] net/i40e: display Flow Director packet

Quoted 67 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Thursday, January 9, 2020 10:03 PM
To: Zhang, Qi Z <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: RE: [PATCH v3 6/9] net/i40e: display Flow Director packet

Hi Qi,

Quoted 42 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Thursday, January 9, 2020 12:44 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: RE: [PATCH v3 6/9] net/i40e: display Flow Director packet

Hi Bernard:

Quoted 29 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Thursday, January 9, 2020 8:17 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v3 6/9] net/i40e: display Flow Director packet

call rte_hexdump in i40e_flow_fdir_construct_pkt() in i40e_fdir.c

---
 drivers/net/i40e/i40e_fdir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index
3fa6297..78329d2 100644

drivers/net/i40e/i40e_fdir.c +1 -0
@@ -21,6 +21,7 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_hexdump.h>
 
Quoted 10 lines

drivers/net/i40e/i40e_fdir.c i40e_fdir_fill_eth_ip_head(const struct · line 810

Quoted 8 lines
drivers/net/i40e/i40e_fdir.c +1 -0
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -805,6 +806,7 @@ i40e_fdir_fill_eth_ip_head(const struct
 rte_eth_fdir_input *fdir_input,
     fdir_input->flow_type);
 return -1;
 }
+rte_hexdump(stdout, NULL, raw_pkt, len);

Why we need this? Does this just for debug?

Quoted 3 lines

Useful to see the packet constructed by this function, otherwise no visibility on what is happening.
Needed for debug.

But this may flush the screen if we create 1000 rules by script and it impact the rule programming performance, should this code only be called when debug mode is enabled?

Quoted 25 lines
Quoted 17 lines

Regards
Qi

Quoted 12 lines
drivers/net/i40e/i40e_fdir.c +1 -1
 return len;
 }
@@ -954,7 +956,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
  &fdir_input->flow_ext.flexbytes[dst],
  size * sizeof(uint16_t));
 }
-
+rte_hexdump(stdout, NULL, raw_pkt, len);
 return 0;
 }
 
Quoted 3 lines
Quoted 2 lines

--
2.7.4

Regards,

Bernard.

#114 lore raw

Re: [dpdk-dev] [PATCH v3 6/9] net/i40e: display Flow Director packet

Hi Qi,

<snip>

Quoted 45 lines
Quoted 45 lines
Quoted 44 lines

Subject: RE: [PATCH v3 6/9] net/i40e: display Flow Director packet

Hi Bernard:

Quoted 33 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Thursday, January 9, 2020 8:17 PM
To: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>; Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>
Subject: [PATCH v3 6/9] net/i40e: display Flow Director packet

call rte_hexdump in i40e_flow_fdir_construct_pkt() in i40e_fdir.c

---
 drivers/net/i40e/i40e_fdir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index
3fa6297..78329d2 100644

drivers/net/i40e/i40e_fdir.c +1 -0
@@ -21,6 +21,7 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_hexdump.h>
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"

drivers/net/i40e/i40e_fdir.c i40e_fdir_fill_eth_ip_head(const struct · line 810

Quoted 5 lines
drivers/net/i40e/i40e_fdir.c +1 -0
@@ -805,6 +806,7 @@ i40e_fdir_fill_eth_ip_head(const struct
 rte_eth_fdir_input *fdir_input,
     fdir_input->flow_type);
 return -1;
 }
+rte_hexdump(stdout, NULL, raw_pkt, len);

Why we need this? Does this just for debug?

Quoted 7 lines
Quoted 3 lines

Useful to see the packet constructed by this function, otherwise no visibility on what is happening.
Needed for debug.

But this may flush the screen if we create 1000 rules by script and it impact the rule programming performance, should this code only be called when debug mode is enabled?

Yes, probably better to call in debug mode only.
Will change in v4 patchset.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

Regards
Qi

Quoted 12 lines
drivers/net/i40e/i40e_fdir.c +1 -1
 return len;
 }
@@ -954,7 +956,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
  &fdir_input->flow_ext.flexbytes[dst],
  size * sizeof(uint16_t));
 }
-
+rte_hexdump(stdout, NULL, raw_pkt, len);
 return 0;
 }
 
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

--
2.7.4

Regards,

Bernard.

#115 lore raw

Re: [dpdk-dev] [PATCH v3 6/9] net/i40e: display Flow Director packet

In reply to Iremonger, Bernard
Quoted 32 lines
Quoted 21 lines
Quoted 21 lines

call rte_hexdump in i40e_flow_fdir_construct_pkt() in i40e_fdir.c

---
 drivers/net/i40e/i40e_fdir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index
3fa6297..78329d2 100644

drivers/net/i40e/i40e_fdir.c +1 -0
@@ -21,6 +21,7 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_hexdump.h>
 
Quoted 10 lines

drivers/net/i40e/i40e_fdir.c i40e_fdir_fill_eth_ip_head(const struct · line 810

Quoted 8 lines
drivers/net/i40e/i40e_fdir.c +1 -0
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -805,6 +806,7 @@ i40e_fdir_fill_eth_ip_head(const struct
 rte_eth_fdir_input *fdir_input,
 			    fdir_input->flow_type);
 		return -1;
 	}
+	rte_hexdump(stdout, NULL, raw_pkt, len);

Why we need this? Does this just for debug?

Quoted 2 lines

Useful to see the packet constructed by this function, otherwise no visibility on what is happening. Needed for debug.

Then it probably should be called only when some debug option is enabled (either at complie or runtime)?

Quoted 24 lines
Quoted 17 lines

Regards
Qi

Quoted 12 lines
drivers/net/i40e/i40e_fdir.c +1 -1
 	return len;
 }
@@ -954,7 +956,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return 0;
 }
 
Quoted 3 lines
Quoted 2 lines

--
2.7.4

Regards,

Bernard.

#116 lore raw

Re: [dpdk-dev] [PATCH v3 6/9] net/i40e: display Flow Director packet

Hi Konstantin,

Quoted 42 lines

-----Original Message-----
From: Ananyev, Konstantin <[email protected]>
Sent: Thursday, January 9, 2020 11:08 PM
To: Iremonger, Bernard <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Doherty, Declan <[email protected]>
Cc: Byrne, Stephen1 <[email protected]>; Zhang, Helin <[email protected]>
Subject: RE: [PATCH v3 6/9] net/i40e: display Flow Director packet

Quoted 30 lines
Quoted 29 lines
Quoted 22 lines

call rte_hexdump in i40e_flow_fdir_construct_pkt() in i40e_fdir.c

---
 drivers/net/i40e/i40e_fdir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index
3fa6297..78329d2 100644

drivers/net/i40e/i40e_fdir.c +1 -0
@@ -21,6 +21,7 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_hexdump.h>
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"

drivers/net/i40e/i40e_fdir.c i40e_fdir_fill_eth_ip_head(const struct · line 810

Quoted 5 lines
drivers/net/i40e/i40e_fdir.c +1 -0
@@ -805,6 +806,7 @@ i40e_fdir_fill_eth_ip_head(const struct
 rte_eth_fdir_input *fdir_input,
 			    fdir_input->flow_type);
 		return -1;
 	}
+	rte_hexdump(stdout, NULL, raw_pkt, len);

Why we need this? Does this just for debug?

Quoted 6 lines
Quoted 1 line

Useful to see the packet constructed by this function, otherwise no

visibility on what is happening.

Quoted 1 line

Needed for debug.

Then it probably should be called only when some debug option is enabled (either at complie or runtime)?

Responded already to Qi that I will call in debug mode in v4 patchset. I think compile time should be enough.

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

Regards
Qi

Quoted 12 lines
drivers/net/i40e/i40e_fdir.c +1 -1
 	return len;
 }
@@ -954,7 +956,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return 0;
 }
 
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

--
2.7.4

Regards,

Bernard.

#117 lore raw

PATCH v3 7/9 librte_ethdev: add ESP and AH flow types to RSS

In reply to Bernard Iremonger

Add flow types for the following PCTYPE's in the DDP ipsec profile:
14: IPV6 ESP
15: IPV4 ESP
16: IPV6 AH
17: IPV4 AH
18: IPV6 UDP ESP
19: IPV4 UDP ESP

Add the following RSS macros for IPsec:
ETH_RSS_ESP
ETH_RSS_AH
ETH_RSS_IPSEC

---
 lib/librte_ethdev/rte_ethdev.h | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
lib/librte_ethdev/rte_ethdev.h +28 -1
index 18a9def..39c89cb 100644
@@ -484,7 +484,13 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based flow */
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_IPV4_AH            24 /**< IPv4 AH protocol based flow */
+#define RTE_ETH_FLOW_IPV4_ESP           25 /**< IPv4 ESP protocol based flow */
+#define RTE_ETH_FLOW_IPV4_UDP_ESP       26 /**< IPv4 UDP ESP proto based flow */
+#define RTE_ETH_FLOW_IPV6_AH            27 /**< IPv6 AH protocol based flow */
+#define RTE_ETH_FLOW_IPV6_ESP           28 /**< IPv6 ESP protocol based flow */
+#define RTE_ETH_FLOW_IPV6_UDP_ESP       29 /**< IPv6 UDP ESP proto based flow */
+#define RTE_ETH_FLOW_MAX                30
 
 /*
  * Below macros are defined for RSS offload types, they can be used to
@@ -511,6 +517,13 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
+#define ETH_RSS_IPV4_AH            (1ULL << 24)
+#define ETH_RSS_IPV4_ESP           (1ULL << 25)
+#define ETH_RSS_IPV4_UDP_ESP       (1ULL << 26)
+#define ETH_RSS_IPV6_AH            (1ULL << 27)
+#define ETH_RSS_IPV6_ESP           (1ULL << 28)
+#define ETH_RSS_IPV6_UDP_ESP       (1ULL << 29)
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -571,6 +584,20 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_AH ( \
+	ETH_RSS_IPV4_AH | \
+	ETH_RSS_IPV6_AH)
+
+#define ETH_RSS_ESP ( \
+	ETH_RSS_IPV4_ESP | \
+	ETH_RSS_IPV6_ESP | \
+	ETH_RSS_IPV4_UDP_ESP | \
+	ETH_RSS_IPV6_UDP_ESP)
+
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
Signature · 1 line
2.7.4
#118 lore raw

PATCH v3 8/9 doc: release note for ESP

In reply to Bernard Iremonger

Release note for ESP support on the i40e PMD.
Release note for ESP support on testpmd.

---
 doc/guides/rel_notes/release_20_02.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
doc/guides/rel_notes/release_20_02.rst +9 -0
index 0eaa45a..367c980 100644
@@ -56,6 +56,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated i40e driver to support ESP.**
+
+  Updated the i40e PMD to support ESP-AH supporting profiles which can be
+  programmed by the dynamic device personalization (DDP) process.
+
+* **Updated testpmd to support ESP flows.**
+
+  Added support for ESP rte_flow patterns to the testpmd application.
+
 
 Removed Items
 -------------
Signature · 1 line
2.7.4
#119 lore raw

PATCH v3 9/9 doc: update i40e user guide

In reply to Bernard Iremonger

Update the i40e user guide with ESP information.

---
 doc/guides/nics/i40e.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
doc/guides/nics/i40e.rst +3 -1
index 38acf59..5cf34d9 100644
@@ -457,7 +457,7 @@ which is used to configure hardware by downloading a profile to support
 protocols/filters which are not supported by default. The DDP
 functionality requires a NIC firmware version of 6.0 or greater.
 
-Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP,
+Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP/ESP,
 steering can be used with rte_flow API.
 
 GTPv1 package is released, and it can be downloaded from
@@ -466,6 +466,8 @@ https://downloadcenter.intel.com/download/27587.
 PPPoE package is released, and it can be downloaded from
 https://downloadcenter.intel.com/download/28040.
 
+ESP-AH package is not released yet.
+
 Load a profile which supports GTP and store backup profile:
 
 .. code-block:: console
Signature · 1 line
2.7.4
#120 lore raw

PATCH v2 1/10 app/testpmd: parse flow command line for ESP

In reply to Bernard Iremonger

add ITEM_ESP
add ITEM_ESP_SPI
add debug to cmdline_flow.c

---
 app/test-pmd/cmdline_flow.c | 37 ++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)
app/test-pmd/cmdline_flow.c +34 -3
index 99dade7..f1b0610 100644
@@ -213,6 +213,8 @@ enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_ESP,
+	ITEM_ESP_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_ESP,
 	END_SET,
 	ZERO,
 };
@@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
 	ZERO,
 };
 
+static const enum index item_esp[] = {
+	ITEM_ESP_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag, index)),
 	},
+	[ITEM_ESP] = {
+		.name = "esp",
+		.help = "match ESP header",
+		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+		.next = NEXT(item_esp),
+		.call = parse_vc,
+	},
+	[ITEM_ESP_SPI] = {
+		.name = "spi",
+		.help = "security policy index",
+		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+				hdr.spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,
 static void
 cmd_flow_parsed(const struct buffer *in)
 {
+	printf("Flow command line parsed successfully for command=%d.\n",
+			in->command);
+
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr,
@@ -6230,14 +6256,15 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_GTP:
 		mask = &rte_flow_item_gtp_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_ESP:
-		mask = &rte_flow_item_esp_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 		mask = &rte_flow_item_gtp_psc_mask;
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		mask = &rte_flow_item_esp_mask;
+		break;
 	default:
 		break;
 	}
@@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			size = sizeof(struct rte_flow_item_geneve);
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			size = sizeof(struct rte_flow_item_esp);
+			proto = 0x32;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
Signature · 1 line
2.7.4
#121 lore raw

Re: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP

Hi just small comment inside.
Thanks,
Ori

Quoted 77 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Bernard Iremonger
Sent: Tuesday, December 17, 2019 12:16 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP

add ITEM_ESP
add ITEM_ESP_SPI
add debug to cmdline_flow.c

---
 app/test-pmd/cmdline_flow.c | 37
++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)
app/test-pmd/cmdline_flow.c +23 -0
index 99dade7..f1b0610 100644
@@ -213,6 +213,8 @@ enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_ESP,
+	ITEM_ESP_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_ESP,
 	END_SET,
 	ZERO,
 };
@@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
 	ZERO,
 };
 
+static const enum index item_esp[] = {
+	ITEM_ESP_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag,
 index)),
 	},
+	[ITEM_ESP] = {
+		.name = "esp",
+		.help = "match ESP header",
+		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+		.next = NEXT(item_esp),
+		.call = parse_vc,
+	},
+	[ITEM_ESP_SPI] = {
+		.name = "spi",
+		.help = "security policy index",
+		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED),
 item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+				hdr.spi)),
+	},
 	/* Validate/create actions. */
app/test-pmd/cmdline_flow.c +0 -0
 	[ACTIONS] = {
 		.name = "actions",

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t **hdr, · line 6081

Quoted 7 lines
app/test-pmd/cmdline_flow.c +3 -0
@@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,
 static void
 cmd_flow_parsed(const struct buffer *in)
 {
+	printf("Flow command line parsed successfully for
 command=%d.\n",
+			in->command);
+

Why adding this printf?

Quoted 36 lines
app/test-pmd/cmdline_flow.c +0 -0
 	switch (in->command) {
 	case VALIDATE:
app/test-pmd/cmdline_flow.c +4 -3
 		port_flow_validate(in->port, &in->args.vc.attr,
@@ -6230,14 +6256,15 @@ flow_item_default_mask(const struct
 rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_GTP:
 		mask = &rte_flow_item_gtp_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_ESP:
-		mask = &rte_flow_item_esp_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 		mask = &rte_flow_item_gtp_psc_mask;
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		mask = &rte_flow_item_esp_mask;
+		break;
 	default:
 		break;
app/test-pmd/cmdline_flow.c +4 -1
 	}
@@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			size = sizeof(struct rte_flow_item_geneve);
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
+			size = sizeof(struct rte_flow_item_esp);
+			proto = 0x32;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
--

2.7.4

#122 lore raw

Re: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP

Hi Ori,

Thanks for the review.

<snip>

Quoted 85 lines

Subject: RE: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP

Hi just small comment inside.
Thanks,
Ori

Quoted 54 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Bernard Iremonger
Sent: Tuesday, December 17, 2019 12:16 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP

add ITEM_ESP
add ITEM_ESP_SPI
add debug to cmdline_flow.c

---
 app/test-pmd/cmdline_flow.c | 37
++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)
app/test-pmd/cmdline_flow.c +9 -0
index 99dade7..f1b0610 100644
@@ -213,6 +213,8 @@ enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_ESP,
+	ITEM_ESP_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_ESP,
 	END_SET,
 	ZERO,
 };
@@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
 	ZERO,
 };
 
+static const enum index item_esp[] = {
+	ITEM_ESP_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,

app/test-pmd/cmdline_flow.c static const struct token token_list[] = { · line 2603

Quoted 2 lines
app/test-pmd/cmdline_flow.c +0 -0
@@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag,

index)),

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t

Quoted 20 lines
app/test-pmd/cmdline_flow.c +14 -0
 	},
+	[ITEM_ESP] = {
+		.name = "esp",
+		.help = "match ESP header",
+		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+		.next = NEXT(item_esp),
+		.call = parse_vc,
+	},
+	[ITEM_ESP_SPI] = {
+		.name = "spi",
+		.help = "security policy index",
+		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED),
 item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+				hdr.spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
app/test-pmd/cmdline_flow.c +0 -0
 		.name = "actions",
@@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t

**hdr,

Quoted 7 lines

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t · line 6079

Quoted 5 lines
app/test-pmd/cmdline_flow.c +3 -0
 static void  cmd_flow_parsed(const struct buffer *in)  {
+	printf("Flow command line parsed successfully for
 command=%d.\n",
+			in->command);
+

Why adding this printf?

It is useful to know that the parsing of the flow command line is successful before going into the PMD code. I will remove in the v3 if you think it is too verbose.

Quoted 28 lines
Quoted 28 lines
app/test-pmd/cmdline_flow.c +6 -3
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr, @@ -6230,14
+6256,15 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_GTP:
 		mask = &rte_flow_item_gtp_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_ESP:
-		mask = &rte_flow_item_esp_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 		mask = &rte_flow_item_gtp_psc_mask;
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		mask = &rte_flow_item_esp_mask;
+		break;
 	default:
 		break;
 	}
@@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			size = sizeof(struct rte_flow_item_geneve);
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
Quoted 8 lines
Quoted 8 lines
app/test-pmd/cmdline_flow.c +3 -1
+			size = sizeof(struct rte_flow_item_esp);
+			proto = 0x32;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
--

2.7.4

Regards,

Bernard.

#123 lore raw

Re: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP

Hi,

Quoted 111 lines

-----Original Message-----
From: Iremonger, Bernard <[email protected]>
Sent: Wednesday, January 8, 2020 6:17 PM
To: Ori Kam <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Doherty, Declan <[email protected]>
Cc: Ananyev, Konstantin <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP

Hi Ori,

Thanks for the review.

<snip>

Quoted 14 lines

Subject: RE: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP

Hi just small comment inside.
Thanks,
Ori

Quoted 7 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Bernard Iremonger
Sent: Tuesday, December 17, 2019 12:16 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow

command

Quoted 6 lines
Quoted 6 lines

line for ESP

add ITEM_ESP
add ITEM_ESP_SPI
add debug to cmdline_flow.c

Quoted 7 lines

app/test-

Quoted 7 lines
---
 app/test-pmd/cmdline_flow.c | 37
++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)
app/test- renamed from app/test-pmd/cmdline_flow.c +0 -0

pmd/cmdline_flow.c

Quoted 58 lines
Quoted 34 lines

index 99dade7..f1b0610 100644

app/test-pmd/cmdline_flow.c +9 -0
@@ -213,6 +213,8 @@ enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_ESP,
+	ITEM_ESP_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_ESP,
 	END_SET,
 	ZERO,
 };
@@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
 	ZERO,
 };
 
+static const enum index item_esp[] = {
+	ITEM_ESP_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,

app/test-pmd/cmdline_flow.c static const struct token token_list[] = { · line 2603

Quoted 2 lines
app/test-pmd/cmdline_flow.c +0 -0
@@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag,

index)),

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t

Quoted 20 lines
app/test-pmd/cmdline_flow.c +14 -0
 	},
+	[ITEM_ESP] = {
+		.name = "esp",
+		.help = "match ESP header",
+		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+		.next = NEXT(item_esp),
+		.call = parse_vc,
+	},
+	[ITEM_ESP_SPI] = {
+		.name = "spi",
+		.help = "security policy index",
+		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED),
 item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+				hdr.spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
app/test-pmd/cmdline_flow.c +0 -0
 		.name = "actions",
@@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t

**hdr,

Quoted 7 lines

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t · line 6079

Quoted 5 lines
app/test-pmd/cmdline_flow.c +3 -0
 static void  cmd_flow_parsed(const struct buffer *in)  {
+	printf("Flow command line parsed successfully for
 command=%d.\n",
+			in->command);
+

Why adding this printf?

Quoted 4 lines

It is useful to know that the parsing of the flow command line is successful before going into the PMD code.
I will remove in the v3 if you think it is too verbose.

I think it is to verbose, due to the fact that in normal case the parsing will succeed, Which means there will be a lot of print (In our testing we can have more then 200K commands). So I prefer to remove it, but if you think it is critical you can use the verbose_level with high value. If you remove it feel free to add my ack on v3.

Quoted 41 lines
Quoted 5 lines

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,

Quoted 5 lines
app/test-pmd/cmdline_flow.c +1 -0
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr, @@ -6230,14
+6256,15 @@ flow_item_default_mask(const struct rte_flow_item

*item)

Quoted 23 lines
Quoted 23 lines
app/test-pmd/cmdline_flow.c +5 -3
 	case RTE_FLOW_ITEM_TYPE_GTP:
 		mask = &rte_flow_item_gtp_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_ESP:
-		mask = &rte_flow_item_esp_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 		mask = &rte_flow_item_gtp_psc_mask;
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		mask = &rte_flow_item_esp_mask;
+		break;
 	default:
 		break;
 	}
@@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer *in)
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			size = sizeof(struct rte_flow_item_geneve);
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
Quoted 8 lines
Quoted 8 lines
app/test-pmd/cmdline_flow.c +3 -1
+			size = sizeof(struct rte_flow_item_esp);
+			proto = 0x32;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
--

2.7.4

Regards,

Bernard.

#124 lore raw

Re: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP

Hi Ori,

<snip>

Quoted 109 lines
Quoted 104 lines

Subject: RE: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP

Hi Ori,

Thanks for the review.

<snip>

Quoted 14 lines

Subject: RE: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP

Hi just small comment inside.
Thanks,
Ori

Quoted 7 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Bernard Iremonger
Sent: Tuesday, December 17, 2019 12:16 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow

command

Quoted 6 lines
Quoted 6 lines

line for ESP

add ITEM_ESP
add ITEM_ESP_SPI
add debug to cmdline_flow.c

Quoted 7 lines

app/test-

Quoted 7 lines
---
 app/test-pmd/cmdline_flow.c | 37
++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)
app/test- renamed from app/test-pmd/cmdline_flow.c +0 -0

pmd/cmdline_flow.c

Quoted 58 lines
Quoted 34 lines

index 99dade7..f1b0610 100644

app/test-pmd/cmdline_flow.c +9 -0
@@ -213,6 +213,8 @@ enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_ESP,
+	ITEM_ESP_SPI,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_ESP,
 	END_SET,
 	ZERO,
 };
@@ -1017,6 +1020,12 @@ static const enum index item_higig2[] = {
 	ZERO,
 };
 
+static const enum index item_esp[] = {
+	ITEM_ESP_SPI,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,

app/test-pmd/cmdline_flow.c static const struct token token_list[] = { · line 2603

Quoted 2 lines
app/test-pmd/cmdline_flow.c +0 -0
@@ -2593,6 +2602,20 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag,

index)),

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t

Quoted 20 lines
app/test-pmd/cmdline_flow.c +14 -0
 	},
+	[ITEM_ESP] = {
+		.name = "esp",
+		.help = "match ESP header",
+		.priv = PRIV_ITEM(ESP, sizeof(struct rte_flow_item_esp)),
+		.next = NEXT(item_esp),
+		.call = parse_vc,
+	},
+	[ITEM_ESP_SPI] = {
+		.name = "spi",
+		.help = "security policy index",
+		.next = NEXT(item_esp, NEXT_ENTRY(UNSIGNED),
 item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
+				hdr.spi)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
app/test-pmd/cmdline_flow.c +0 -0
 		.name = "actions",
@@ -6052,6 +6075,9 @@ cmd_flow_tok(cmdline_parse_token_hdr_t

**hdr,

Quoted 7 lines

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t · line 6079

Quoted 5 lines
app/test-pmd/cmdline_flow.c +3 -0
 static void  cmd_flow_parsed(const struct buffer *in)  {
+	printf("Flow command line parsed successfully for
 command=%d.\n",
+			in->command);
+

Why adding this printf?

Quoted 4 lines

It is useful to know that the parsing of the flow command line is successful before going into the PMD code.
I will remove in the v3 if you think it is too verbose.

Quoted 6 lines

I think it is to verbose, due to the fact that in normal case the parsing will succeed, Which means there will be a lot of print (In our testing we can have more then 200K commands).
So I prefer to remove it, but if you think it is critical you can use the verbose_level with high value.
If you remove it feel free to add my ack on v3.

I will remove it and add your ack in v3.

Quoted 26 lines
Quoted 17 lines
Quoted 5 lines

app/test-pmd/cmdline_flow.c cmd_flow_tok(cmdline_parse_token_hdr_t **hdr,

Quoted 5 lines
app/test-pmd/cmdline_flow.c +1 -0
 	switch (in->command) {
 	case VALIDATE:
 		port_flow_validate(in->port, &in->args.vc.attr, @@ -6230,14
+6256,15 @@ flow_item_default_mask(const struct rte_flow_item

*item)

Quoted 11 lines
Quoted 11 lines
app/test-pmd/cmdline_flow.c +0 -3
 	case RTE_FLOW_ITEM_TYPE_GTP:
 		mask = &rte_flow_item_gtp_mask;
 		break;
-	case RTE_FLOW_ITEM_TYPE_ESP:
-		mask = &rte_flow_item_esp_mask;
-		break;
 	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 		mask = &rte_flow_item_gtp_psc_mask;
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
Quoted 8 lines
Quoted 8 lines

app/test-pmd/cmdline_flow.c cmd_set_raw_parsed(const struct buffer

Quoted 8 lines
app/test-pmd/cmdline_flow.c +4 -0
+		break;
+	case RTE_FLOW_ITEM_TYPE_ESP:
+		mask = &rte_flow_item_esp_mask;
+		break;
 	default:
 		break;
 	}
@@ -6327,6 +6354,10 @@ cmd_set_raw_parsed(const struct buffer

*in)

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
app/test-pmd/cmdline_flow.c +1 -0
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			size = sizeof(struct rte_flow_item_geneve);
 			break;
+		case RTE_FLOW_ITEM_TYPE_ESP:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
app/test-pmd/cmdline_flow.c +3 -1
+			size = sizeof(struct rte_flow_item_esp);
+			proto = 0x32;
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
--

2.7.4

Regards,

Bernard.

#125 lore raw

PATCH v2 2/10 app/testpmd: improve debug code

In reply to Bernard Iremonger

improve debug code in config.c

---
 app/test-pmd/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/config.c +1 -1
index d599682..2753ec5 100644
@@ -1303,7 +1303,7 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("Caught error type %d (%s): %s%s: %s\n",
+	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n", __func__,
 	       error->type, errstr,
 	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
 					error->cause), buf) : "",
Signature · 1 line
2.7.4
#126 lore raw

PATCH v2 3/10 app/testpmd: dump Rx and Tx mbuf

In reply to Bernard Iremonger

add call to rte_pktmbuf_dump() in dump_pkt_burst in util.c

---
 app/test-pmd/util.c | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/util.c +1 -0
index b514be5..bf03873 100644
@@ -158,6 +158,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 		printf("  ol_flags: %s\n", buf);
 		if (rte_mbuf_check(mb, 1, &reason) < 0)
 			printf("INVALID mbuf: %s\n", reason);
+		rte_pktmbuf_dump(stdout, pkts[i], pkts[i]->data_len);
 	}
 }
 
Signature · 1 line
2.7.4
#127 lore raw

PATCH v2 4/10 net/i40e: improve RSS debug

In reply to Bernard Iremonger

improve RSS debug in i40e_ethdev.c

---
 drivers/net/i40e/i40e_ethdev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +6 -2
index 5999c96..5f1cf8a 100644
@@ -8679,7 +8679,9 @@ i40e_pf_config_rss(struct i40e_pf *pf)
 			num);
 
 	if (num == 0) {
-		PMD_INIT_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_INIT_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
@@ -12840,7 +12842,9 @@ i40e_config_rss_filter(struct i40e_pf *pf,
 			num);
 
 	if (num == 0) {
-		PMD_DRV_LOG(ERR, "No PF queues are configured to enable RSS");
+		PMD_DRV_LOG(ERR,
+			"No PF queues are configured to enable RSS for port %u",
+			pf->dev_data->port_id);
 		return -ENOTSUP;
 	}
 
Signature · 1 line
2.7.4
#128 lore raw

PATCH v2 5/10 net/i40e: handle ESP tunnel

In reply to Bernard Iremonger

handle ESP tunnel in rte_pmd_i40e.c

---
 drivers/net/i40e/rte_pmd_i40e.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/rte_pmd_i40e.c +2 -1
index fdcb1a4..b987346 100644
@@ -2172,7 +2172,8 @@ static int check_invalid_pkt_type(uint32_t pkt_type)
 	    tnl != RTE_PTYPE_TUNNEL_GRENAT &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPC &&
 	    tnl != RTE_PTYPE_TUNNEL_GTPU &&
-	    tnl != RTE_PTYPE_TUNNEL_L2TP)
+	    tnl != RTE_PTYPE_TUNNEL_L2TP &&
+	    tnl != RTE_PTYPE_TUNNEL_ESP)
 		return -1;
 
 	if (il2 &&
Signature · 1 line
2.7.4
#129 lore raw

PATCH v2 6/10 net/i40e: process ESP flows

In reply to Bernard Iremonger

Process ESP flows on Flow Director and RSS.

add eth/ipv4/esp and eth/ipv6/esp patterns add eth/ipv4/udp/esp and eth/ipv6/esp/udp patterns update i40e_flow_parse_fdir_filter()
add fill_ip6_head()
add oip_type in filter
add is_udp in filter
use tenant_id in filter for spi
handle ESP and AH pctypes in ESP-AH profile update customized code for ESP

---
 drivers/net/i40e/i40e_ethdev.c |  44 ++++++++++++-
 drivers/net/i40e/i40e_ethdev.h |  25 ++++++++
 drivers/net/i40e/i40e_fdir.c   | 142 ++++++++++++++++++++++++++++++++++++++---
 drivers/net/i40e/i40e_flow.c   | 119 +++++++++++++++++++++++++++++++++-
 4 files changed, 317 insertions(+), 13 deletions(-)
drivers/net/i40e/i40e_ethdev.c +43 -1
index 5f1cf8a..a462eba 100644
@@ -1106,6 +1106,7 @@ i40e_init_customized_info(struct i40e_pf *pf)
 	}
 
 	pf->gtp_support = false;
+	pf->esp_support = false;
 }
 
 void
@@ -12337,6 +12338,7 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			}
 		}
 		name[strlen(name) - 1] = '\0';
+		PMD_DRV_LOG(INFO, "name = %s\n", name);
 		if (!strcmp(name, "GTPC"))
 			new_pctype =
 				i40e_find_customized_pctype(pf,
@@ -12353,6 +12355,30 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg,
 			new_pctype =
 				i40e_find_customized_pctype(pf,
 						      I40E_CUSTOMIZED_GTPU);
+		else if (!strcmp(name, "IPV4_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4);
+		else if (!strcmp(name, "IPV6_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6);
+		else if (!strcmp(name, "IPV4_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV4_UDP);
+		else if (!strcmp(name, "IPV6_UDP_ESP"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_ESP_IPV6_UDP);
+		else if (!strcmp(name, "IPV4_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV4);
+		else if (!strcmp(name, "IPV6_AH"))
+			new_pctype =
+				i40e_find_customized_pctype(pf,
+						I40E_CUSTOMIZED_AH_IPV6);
 		if (new_pctype) {
 			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD) {
 				new_pctype->pctype = pctype_value;
@@ -12448,6 +12474,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					continue;
 				memset(name, 0, sizeof(name));
 				strcpy(name, proto[n].name);
+				PMD_DRV_LOG(INFO, "name = %s\n", name);
 				if (!strncasecmp(name, "PPPOE", 5))
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_L2_ETHER_PPPOE;
@@ -12541,6 +12568,10 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GTPU;
 					in_tunnel = true;
+				} else if (!strncasecmp(name, "ESP", 3)) {
+					ptype_mapping[i].sw_ptype |=
+						RTE_PTYPE_TUNNEL_ESP;
+					in_tunnel = true;
 				} else if (!strncasecmp(name, "GRENAT", 6)) {
 					ptype_mapping[i].sw_ptype |=
 						RTE_PTYPE_TUNNEL_GRENAT;
@@ -12560,7 +12591,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg,
 	ret = rte_pmd_i40e_ptype_mapping_update(port_id, ptype_mapping,
 						ptype_num, 0);
 	if (ret)
-		PMD_DRV_LOG(ERR, "Failed to update mapping table.");
+		PMD_DRV_LOG(ERR, "Failed to update ptype mapping table.");
 
 	rte_free(ptype_mapping);
 	rte_free(ptype);
@@ -12625,6 +12656,17 @@ i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg,
 		}
 	}
 
+	/* Check if ESP is supported. */
+	for (i = 0; i < proto_num; i++) {
+		if (!strncmp(proto[i].name, "ESP", 3)) {
+			if (op == RTE_PMD_I40E_PKG_OP_WR_ADD)
+				pf->esp_support = true;
+			else
+				pf->esp_support = false;
+			break;
+		}
+	}
+
 	/* Update customized pctype info */
 	ret = i40e_update_customized_pctype(dev, pkg, pkg_size,
 					    proto_num, proto, op);
drivers/net/i40e/i40e_ethdev.h +25 -0
index 295ad59..3566056 100644
@@ -501,6 +501,18 @@ struct i40e_gtp_ipv6_flow {
 	struct rte_eth_ipv6_flow ip6;
 };
 
+/* A structure used to define the input for ESP IPV4 flow */
+struct i40e_esp_ipv4_flow {
+	struct rte_eth_udpv4_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
+/* A structure used to define the input for ESP IPV6 flow */
+struct i40e_esp_ipv6_flow {
+	struct rte_eth_udpv6_flow udp;
+	uint32_t spi;	/* SPI in big endian. */
+};
+
 /* A structure used to define the input for raw type flow */
 struct i40e_raw_flow {
 	uint16_t pctype;
@@ -526,6 +538,8 @@ union i40e_fdir_flow {
 	struct i40e_gtp_ipv4_flow  gtp_ipv4_flow;
 	struct i40e_gtp_ipv6_flow  gtp_ipv6_flow;
 	struct i40e_raw_flow       raw_flow;
+	struct i40e_esp_ipv4_flow  esp_ipv4_flow;
+	struct i40e_esp_ipv6_flow  esp_ipv6_flow;
 };
 
 enum i40e_fdir_ip_type {
@@ -542,8 +556,10 @@ struct i40e_fdir_flow_ext {
 	uint16_t dst_id; /* VF ID, available when is_vf is 1*/
 	bool inner_ip;   /* If there is inner ip */
 	enum i40e_fdir_ip_type iip_type; /* ip type for inner ip */
+	enum i40e_fdir_ip_type oip_type; /* ip type for outer ip */
 	bool customized_pctype; /* If customized pctype is used */
 	bool pkt_template; /* If raw packet template is used */
+	bool is_udp; /* ipv4|ipv6 udp flow */
 };
 
 /* A structure used to define the input for a flow director filter entry */
@@ -769,6 +785,8 @@ enum i40e_tunnel_type {
 	I40E_TUNNEL_TYPE_QINQ,
 	I40E_TUNNEL_TYPE_GTPC,
 	I40E_TUNNEL_TYPE_GTPU,
+	I40E_TUNNEL_TYPE_ESPoUDP,
+	I40E_TUNNEL_TYPE_ESPoIP,
 	I40E_TUNNEL_TYPE_MAX,
 };
 
@@ -897,6 +915,12 @@ enum i40e_new_pctype {
 	I40E_CUSTOMIZED_GTPU_IPV4,
 	I40E_CUSTOMIZED_GTPU_IPV6,
 	I40E_CUSTOMIZED_GTPU,
+	I40E_CUSTOMIZED_ESP_IPV4,
+	I40E_CUSTOMIZED_ESP_IPV6,
+	I40E_CUSTOMIZED_ESP_IPV4_UDP,
+	I40E_CUSTOMIZED_ESP_IPV6_UDP,
+	I40E_CUSTOMIZED_AH_IPV4,
+	I40E_CUSTOMIZED_AH_IPV6,
 	I40E_CUSTOMIZED_MAX,
 };
 
@@ -1001,6 +1025,7 @@ struct i40e_pf {
 
 	/* Dynamic Device Personalization */
 	bool gtp_support; /* 1 - support GTP-C and GTP-U */
+	bool esp_support; /* 1 - support ESP SPI */
 	/* customer customized pctype */
 	struct i40e_customized_pctype customized_pctype[I40E_CUSTOMIZED_MAX];
 	/* Switch Domain Id */
drivers/net/i40e/i40e_fdir.c +133 -9

186 lines not on this page · raw message

drivers/net/i40e/i40e_flow.c +116 -3

189 lines not on this page · raw message

Signature · 1 line
2.7.4
#130 lore raw

PATCH v2 7/10 net/i40e: display Flow Director packet

In reply to Bernard Iremonger

call rte_hexdump in i40e_flow_fdir_construct_pkt() in i40e_fdir.c

---
 drivers/net/i40e/i40e_fdir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_fdir.c +3 -1
index 410e5e7..7e70cab 100644
@@ -21,6 +21,7 @@
 #include <rte_tcp.h>
 #include <rte_sctp.h>
 #include <rte_hash_crc.h>
+#include <rte_hexdump.h>
 
 #include "i40e_logs.h"
 #include "base/i40e_type.h"
@@ -803,6 +804,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input,
 			    fdir_input->flow_type);
 		return -1;
 	}
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return len;
 }
 
@@ -952,7 +954,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 				 &fdir_input->flow_ext.flexbytes[dst],
 				 size * sizeof(uint16_t));
 	}
-
+	rte_hexdump(stdout, NULL, raw_pkt, len);
 	return 0;
 }
 
Signature · 1 line
2.7.4
#131 lore raw

PATCH v2 8/10 librte_ethdev: add ESP and AH flow types to RSS

In reply to Bernard Iremonger

Add flow types for the following PCTYPE's in the DDP ipsec profile:
14: IPV6 ESP
15: IPV4 ESP
16: IPV6 AH
17: IPV4 AH
18: IPV6 UDP ESP
19: IPV4 UDP ESP

Add the following RSS macros for IPsec:
ETH_RSS_ESP
ETH_RSS_AH
ETH_RSS_IPSEC

---
 lib/librte_ethdev/rte_ethdev.h | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
lib/librte_ethdev/rte_ethdev.h +28 -1
index 18a9def..39c89cb 100644
@@ -484,7 +484,13 @@ struct rte_eth_rss_conf {
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
 #define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
 #define RTE_ETH_FLOW_GTPU               23 /**< GTPU protocol based flow */
-#define RTE_ETH_FLOW_MAX                24
+#define RTE_ETH_FLOW_IPV4_AH            24 /**< IPv4 AH protocol based flow */
+#define RTE_ETH_FLOW_IPV4_ESP           25 /**< IPv4 ESP protocol based flow */
+#define RTE_ETH_FLOW_IPV4_UDP_ESP       26 /**< IPv4 UDP ESP proto based flow */
+#define RTE_ETH_FLOW_IPV6_AH            27 /**< IPv6 AH protocol based flow */
+#define RTE_ETH_FLOW_IPV6_ESP           28 /**< IPv6 ESP protocol based flow */
+#define RTE_ETH_FLOW_IPV6_UDP_ESP       29 /**< IPv6 UDP ESP proto based flow */
+#define RTE_ETH_FLOW_MAX                30
 
 /*
  * Below macros are defined for RSS offload types, they can be used to
@@ -511,6 +517,13 @@ struct rte_eth_rss_conf {
 #define ETH_RSS_GENEVE             (1ULL << 20)
 #define ETH_RSS_NVGRE              (1ULL << 21)
 #define ETH_RSS_GTPU               (1ULL << 23)
+#define ETH_RSS_IPV4_AH            (1ULL << 24)
+#define ETH_RSS_IPV4_ESP           (1ULL << 25)
+#define ETH_RSS_IPV4_UDP_ESP       (1ULL << 26)
+#define ETH_RSS_IPV6_AH            (1ULL << 27)
+#define ETH_RSS_IPV6_ESP           (1ULL << 28)
+#define ETH_RSS_IPV6_UDP_ESP       (1ULL << 29)
+
 
 /*
  * We use the following macros to combine with above ETH_RSS_* for
@@ -571,6 +584,20 @@ rte_eth_rss_hf_refine(uint64_t rss_hf)
 	ETH_RSS_NONFRAG_IPV4_SCTP | \
 	ETH_RSS_NONFRAG_IPV6_SCTP)
 
+#define ETH_RSS_AH ( \
+	ETH_RSS_IPV4_AH | \
+	ETH_RSS_IPV6_AH)
+
+#define ETH_RSS_ESP ( \
+	ETH_RSS_IPV4_ESP | \
+	ETH_RSS_IPV6_ESP | \
+	ETH_RSS_IPV4_UDP_ESP | \
+	ETH_RSS_IPV6_UDP_ESP)
+
+#define ETH_RSS_IPSEC ( \
+	ETH_RSS_AH | \
+	ETH_RSS_ESP)
+
 #define ETH_RSS_TUNNEL ( \
 	ETH_RSS_VXLAN  | \
 	ETH_RSS_GENEVE | \
Signature · 1 line
2.7.4
#132 lore raw

PATCH v2 9/10 doc: release note for ESP

In reply to Bernard Iremonger

Release note for ESP support on the i40e PMD.
Release note for ESP support on testpmd.

---
 doc/guides/rel_notes/release_20_02.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
doc/guides/rel_notes/release_20_02.rst +9 -0
index 0eaa45a..367c980 100644
@@ -56,6 +56,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Updated i40e driver to support ESP.**
+
+  Updated the i40e PMD to support ESP-AH supporting profiles which can be
+  programmed by the dynamic device personalization (DDP) process.
+
+* **Updated testpmd to support ESP flows.**
+
+  Added support for ESP rte_flow patterns to the testpmd application.
+
 
 Removed Items
 -------------
Signature · 1 line
2.7.4
#133 lore raw

PATCH v2 10/10 doc: update i40e user guide

In reply to Bernard Iremonger

Update the i40e user guide with ESP information.

---
 doc/guides/nics/i40e.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
doc/guides/nics/i40e.rst +3 -1
index 38acf59..5cf34d9 100644
@@ -457,7 +457,7 @@ which is used to configure hardware by downloading a profile to support
 protocols/filters which are not supported by default. The DDP
 functionality requires a NIC firmware version of 6.0 or greater.
 
-Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP,
+Current implementation supports GTP-C/GTP-U/PPPoE/PPPoL2TP/ESP,
 steering can be used with rte_flow API.
 
 GTPv1 package is released, and it can be downloaded from
@@ -466,6 +466,8 @@ https://downloadcenter.intel.com/download/27587.
 PPPoE package is released, and it can be downloaded from
 https://downloadcenter.intel.com/download/28040.
 
+ESP-AH package is not released yet.
+
 Load a profile which supports GTP and store backup profile:
 
 .. code-block:: console
Signature · 1 line
2.7.4