From: Bernard Iremonger <bernard.iremonger@intel.com>
To: dev@dpdk.org, beilei.xing@intel.com, qi.z.zhang@intel.com,
declan.doherty@intel.com
Cc: stephen1.byrne@intel.com, konstantin.ananyev@intel.com,
bernard.iremonger@intel.com
Subject: [dpdk-dev] [PATCH 5/9] net/i40e: process ESP flows
Date: Tue, 10 Dec 2019 12:57:08 +0000 [thread overview]
Message-ID: <1575982632-23059-6-git-send-email-bernard.iremonger@intel.com> (raw)
In-Reply-To: <1575982632-23059-1-git-send-email-bernard.iremonger@intel.com>
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
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
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(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 5f1cf8a..a462eba 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -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);
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 295ad59..3566056 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -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 */
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index dee007d..d58cee9 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -971,6 +971,39 @@ 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)
+{
+ struct rte_ipv6_hdr *ip6;
+ uint16_t *ether_type;
+
+ ip6 = (struct rte_ipv6_hdr *)raw_pkt;
+ ether_type = (uint16_t *)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);
+ else if (cus_pctype->index == I40E_CUSTOMIZED_ESP_IPV6_UDP)
+ len = fill_ip6_head(fdir_input, raw_pkt, IPPROTO_UDP,
+ len);
} 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,87 @@ 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;
+ /**
+ * The source and destination fields in
+ * the transmitted packet need to be
+ * presented in a reversed order with
+ * respect to the expected received
+ * packets.
+ */
+ udp->src_port =
+ fdir_input->flow.udp4_flow.dst_port;
+ udp->dst_port =
+ fdir_input->flow.udp4_flow.src_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_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;
+ /**
+ * The source and destination fields in
+ * the transmitted packet need to be
+ * presented in a reversed order with
+ * respect to the expected received
+ * packets.
+ */
+ udp->src_port =
+ fdir_input->flow.udp6_flow.dst_port;
+ udp->dst_port =
+ fdir_input->flow.udp6_flow.src_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_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 +1431,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;
}
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 6102103..f814798 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -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,27 @@ 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);
+ }
+ break;
default:
PMD_DRV_LOG(ERR, "Unsupported item type");
break;
@@ -2459,6 +2513,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 +2709,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 +2779,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 +2796,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 +2899,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 +2934,42 @@ 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;
+ }
+ filter->input.flow.esp_ipv4_flow.spi =
+ esp_spec->hdr.spi;
+ filter->input.flow.esp_ipv6_flow.spi =
+ esp_spec->hdr.spi;
+ 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
next prev parent reply other threads:[~2019-12-10 12:58 UTC|newest]
Thread overview: 134+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 12:57 [dpdk-dev] [PATCH 0/9] net/i40e: ESP support Bernard Iremonger
2019-12-10 12:57 ` [dpdk-dev] [PATCH 1/9] app/testpmd: parse flow command line for ESP Bernard Iremonger
2019-12-10 21:12 ` Ori Kam
2019-12-11 9:24 ` Iremonger, Bernard
2019-12-10 12:57 ` [dpdk-dev] [PATCH 2/9] app/testpmd: dump Rx and Tx mbuf Bernard Iremonger
2019-12-10 12:57 ` [dpdk-dev] [PATCH 3/9] net/i40e: improve RSS debug Bernard Iremonger
2019-12-10 12:57 ` [dpdk-dev] [PATCH 4/9] net/i40e: handle ESP tunnel Bernard Iremonger
2019-12-10 12:57 ` Bernard Iremonger [this message]
2019-12-10 12:57 ` [dpdk-dev] [PATCH 6/9] net/i40e: display Flow Director packet Bernard Iremonger
2019-12-10 12:57 ` [dpdk-dev] [PATCH 7/9] librte_ethdev: add ESP and AH flow types to RSS Bernard Iremonger
2019-12-10 18:27 ` Stephen Hemminger
2019-12-10 12:57 ` [dpdk-dev] [PATCH 8/9] doc: release note for ESP Bernard Iremonger
2019-12-10 12:57 ` [dpdk-dev] [PATCH 9/9] doc: update i40e user guide Bernard Iremonger
2019-12-17 10:15 ` [dpdk-dev] [PATCH v2 00/10] net/i40e: ESP support Bernard Iremonger
2020-01-09 12:16 ` [dpdk-dev] [PATCH v3 0/9] " Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 00/14] " Bernard Iremonger
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 " Bernard Iremonger
2020-01-15 1:47 ` Zhang, Qi Z
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 01/14] app/testpmd: parse flow command line for ESP Bernard Iremonger
2020-01-14 19:03 ` Ferruh Yigit
2020-01-15 9:08 ` Iremonger, Bernard
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 00/13] net/i40e: ESP support Bernard Iremonger
2020-01-16 12:44 ` [dpdk-dev] [PATCH v7 00/10] " Bernard Iremonger
2020-01-16 17:42 ` Ferruh Yigit
2020-01-21 16:10 ` Iremonger, Bernard
2020-01-16 12:44 ` [dpdk-dev] [PATCH v7 01/10] app/testpmd: parse flow command line for ESP Bernard Iremonger
2020-01-16 12:44 ` [dpdk-dev] [PATCH v7 02/10] app/testpmd: improve debug Bernard Iremonger
2020-01-16 13:46 ` Ananyev, Konstantin
2020-01-16 12:44 ` [dpdk-dev] [PATCH v7 03/10] net/i40e: improve RSS debug Bernard Iremonger
2020-01-16 12:44 ` [dpdk-dev] [PATCH v7 04/10] net/i40e: handle ESP tunnel Bernard Iremonger
2020-01-16 12:44 ` [dpdk-dev] [PATCH v7 05/10] net/i40e: support ipsec-ah profile Bernard Iremonger
2020-01-16 12:44 ` [dpdk-dev] [PATCH v7 06/10] net/i40e: support ESP in customized code Bernard Iremonger
2020-01-16 12:44 ` [dpdk-dev] [PATCH v7 07/10] net/i40e: support ESP flows Bernard Iremonger
2020-01-16 12:44 ` [dpdk-dev] [PATCH v7 08/10] net/i40e: support ESP in Flow Director Bernard Iremonger
2020-01-16 12:44 ` [dpdk-dev] [PATCH v7 09/10] config: add debug to I40E " Bernard Iremonger
2020-01-16 12:44 ` [dpdk-dev] [PATCH v7 10/10] net/i40e: display Flow Director packet Bernard Iremonger
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 01/13] app/testpmd: parse flow command line for ESP Bernard Iremonger
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 02/13] app/testpmd: improve debug Bernard Iremonger
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 03/13] app/testpmd: dump Rx and Tx mbuf Bernard Iremonger
2020-01-15 16:28 ` Ferruh Yigit
2020-01-15 16:52 ` Iremonger, Bernard
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 04/13] net/i40e: improve RSS debug Bernard Iremonger
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 05/13] net/i40e: handle ESP tunnel Bernard Iremonger
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 06/13] net/i40e: support ipsec-ah profile Bernard Iremonger
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 07/13] net/i40e: support ESP in customized code Bernard Iremonger
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 08/13] net/i40e: support ESP flows Bernard Iremonger
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 09/13] net/i40e: support ESP in Flow Director Bernard Iremonger
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 10/13] config: add debug to I40E " Bernard Iremonger
2020-01-15 16:17 ` Ferruh Yigit
2020-01-15 17:26 ` Iremonger, Bernard
2020-01-16 15:38 ` Ferruh Yigit
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 11/13] net/i40e: display Flow Director packet Bernard Iremonger
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 12/13] doc: release note for ESP Bernard Iremonger
2020-01-15 16:20 ` Ferruh Yigit
2020-01-15 16:58 ` Iremonger, Bernard
2020-01-15 15:53 ` [dpdk-dev] [PATCH v6 13/13] doc: update i40e user guide Bernard Iremonger
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 02/14] app/testpmd: improve debug Bernard Iremonger
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 03/14] app/testpmd: dump Rx and Tx mbuf Bernard Iremonger
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 04/14] net/i40e: improve RSS debug Bernard Iremonger
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 05/14] net/i40e: handle ESP tunnel Bernard Iremonger
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 06/14] net/i40e: support ipsec-ah profile Bernard Iremonger
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 07/14] net/i40e: support ESP in customised code Bernard Iremonger
2020-01-15 1:24 ` Zhang, Qi Z
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 08/14] net/i40e: support ESP flows Bernard Iremonger
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 09/14] net/i40e: support ESP in Flow Director Bernard Iremonger
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 10/14] config: add debug to I40E " Bernard Iremonger
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 11/14] net/i40e: display Flow Director packet Bernard Iremonger
2020-01-14 18:52 ` Ferruh Yigit
2020-01-15 9:18 ` Iremonger, Bernard
2020-01-15 10:58 ` Ferruh Yigit
2020-01-15 15:08 ` Iremonger, Bernard
2020-01-15 0:20 ` Zhang, Qi Z
2020-01-15 1:32 ` Zhang, Qi Z
2020-01-15 9:25 ` Iremonger, Bernard
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 12/14] librte_ethdev: add ESP and AH flow types to RSS Bernard Iremonger
2020-01-14 18:45 ` Ferruh Yigit
2020-01-15 9:13 ` Andrew Rybchenko
2020-01-15 10:44 ` Ferruh Yigit
2020-01-15 10:55 ` Andrew Rybchenko
2020-01-15 12:28 ` Ferruh Yigit
2020-01-15 14:11 ` Iremonger, Bernard
2020-01-15 14:36 ` Ferruh Yigit
2020-01-15 0:13 ` Zhang, Qi Z
2020-01-15 9:41 ` Iremonger, Bernard
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 13/14] doc: release note for ESP Bernard Iremonger
2020-01-14 13:55 ` [dpdk-dev] [PATCH v5 14/14] doc: update i40e user guide Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 01/14] app/testpmd: parse flow command line for ESP Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 02/14] app/testpmd: improve debug Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 03/14] app/testpmd: dump Rx and Tx mbuf Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 04/14] net/i40e: improve RSS debug Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 05/14] net/i40e: handle ESP tunnel Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 06/14] net/i40e: support ipsec-ah profile Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 07/14] net/i40e: support ESP in customised code Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 08/14] net/i40e: support ESP flows Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 09/14] net/i40e: support ESP in Flow Director Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 10/14] config: add debug to I40E " Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 11/14] net/i40e: display Flow Director packet Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 12/14] librte_ethdev: add ESP and AH flow types to RSS Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 13/14] doc: release note for ESP Bernard Iremonger
2020-01-10 15:20 ` [dpdk-dev] [PATCH v4 14/14] doc: update i40e user guide Bernard Iremonger
2020-01-09 12:16 ` [dpdk-dev] [PATCH v3 1/9] app/testpmd: parse flow command line for ESP Bernard Iremonger
2020-01-09 12:16 ` [dpdk-dev] [PATCH v3 2/9] app/testpmd: dump Rx and Tx mbuf Bernard Iremonger
2020-01-09 12:16 ` [dpdk-dev] [PATCH v3 3/9] net/i40e: improve RSS debug Bernard Iremonger
2020-01-09 13:44 ` Zhang, Qi Z
2020-01-09 12:16 ` [dpdk-dev] [PATCH v3 4/9] net/i40e: handle ESP tunnel Bernard Iremonger
2020-01-09 14:08 ` Zhang, Qi Z
2020-01-09 14:21 ` Iremonger, Bernard
2020-01-09 12:16 ` [dpdk-dev] [PATCH v3 5/9] net/i40e: process ESP flows Bernard Iremonger
2020-01-09 14:00 ` Zhang, Qi Z
2020-01-13 11:56 ` Iremonger, Bernard
2020-01-09 12:16 ` [dpdk-dev] [PATCH v3 6/9] net/i40e: display Flow Director packet Bernard Iremonger
2020-01-09 12:44 ` Zhang, Qi Z
2020-01-09 14:02 ` Iremonger, Bernard
2020-01-09 14:11 ` Zhang, Qi Z
2020-01-09 14:30 ` Iremonger, Bernard
2020-01-09 23:07 ` Ananyev, Konstantin
2020-01-10 9:20 ` Iremonger, Bernard
2020-01-09 12:16 ` [dpdk-dev] [PATCH v3 7/9] librte_ethdev: add ESP and AH flow types to RSS Bernard Iremonger
2020-01-09 12:16 ` [dpdk-dev] [PATCH v3 8/9] doc: release note for ESP Bernard Iremonger
2020-01-09 12:16 ` [dpdk-dev] [PATCH v3 9/9] doc: update i40e user guide Bernard Iremonger
2019-12-17 10:15 ` [dpdk-dev] [PATCH v2 01/10] app/testpmd: parse flow command line for ESP Bernard Iremonger
2020-01-08 14:43 ` Ori Kam
2020-01-08 16:16 ` Iremonger, Bernard
2020-01-09 6:29 ` Ori Kam
2020-01-09 9:16 ` Iremonger, Bernard
2019-12-17 10:15 ` [dpdk-dev] [PATCH v2 02/10] app/testpmd: improve debug code Bernard Iremonger
2019-12-17 10:15 ` [dpdk-dev] [PATCH v2 03/10] app/testpmd: dump Rx and Tx mbuf Bernard Iremonger
2019-12-17 10:15 ` [dpdk-dev] [PATCH v2 04/10] net/i40e: improve RSS debug Bernard Iremonger
2019-12-17 10:15 ` [dpdk-dev] [PATCH v2 05/10] net/i40e: handle ESP tunnel Bernard Iremonger
2019-12-17 10:15 ` [dpdk-dev] [PATCH v2 06/10] net/i40e: process ESP flows Bernard Iremonger
2019-12-17 10:15 ` [dpdk-dev] [PATCH v2 07/10] net/i40e: display Flow Director packet Bernard Iremonger
2019-12-17 10:15 ` [dpdk-dev] [PATCH v2 08/10] librte_ethdev: add ESP and AH flow types to RSS Bernard Iremonger
2019-12-17 10:15 ` [dpdk-dev] [PATCH v2 09/10] doc: release note for ESP Bernard Iremonger
2019-12-17 10:15 ` [dpdk-dev] [PATCH v2 10/10] doc: update i40e user guide Bernard Iremonger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1575982632-23059-6-git-send-email-bernard.iremonger@intel.com \
--to=bernard.iremonger@intel.com \
--cc=beilei.xing@intel.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=stephen1.byrne@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).