DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver
@ 2015-05-11  3:46 Jingjing Wu
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 1/6] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
                   ` (7 more replies)
  0 siblings, 8 replies; 18+ messages in thread
From: Jingjing Wu @ 2015-05-11  3:46 UTC (permalink / raw)
  To: dev

This patch set extends flow director to support L2_paylod type and VF filtering in i40e driver.

Jingjing Wu (6):
  ethdev: add struct rte_eth_l2_flow to support l2_payload flow type
  i40e: extend flow diretcor to support l2_payload flow type
  ethdev: extend struct to support flow director in VFs
  i40e: extend flow diretcor to support filtering in VFs
  testpmd: extend commands
  doc: extend commands in testpmd

 app/test-pmd/cmdline.c                      | 87 +++++++++++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++---
 lib/librte_ether/rte_eth_ctrl.h             | 10 ++++
 lib/librte_pmd_i40e/i40e_fdir.c             | 39 +++++++++++--
 4 files changed, 132 insertions(+), 19 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH 1/6] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type
  2015-05-11  3:46 [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Jingjing Wu
@ 2015-05-11  3:46 ` Jingjing Wu
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 2/6] i40e: extend flow diretcor " Jingjing Wu
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Jingjing Wu @ 2015-05-11  3:46 UTC (permalink / raw)
  To: dev

This patch adds a new struct rte_eth_l2_flow to support l2_payload flow type

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 lib/librte_ether/rte_eth_ctrl.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 498fc85..0e30dd9 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -298,6 +298,13 @@ struct rte_eth_tunnel_filter_conf {
 #define RTE_ETH_FDIR_MAX_FLEXLEN         16 /** < Max length of flexbytes. */
 
 /**
+ * A structure used to define the input for L2 flow
+ */
+struct rte_eth_l2_flow {
+	uint16_t ether_type;          /**< Ether type to match */
+};
+
+/**
  * A structure used to define the input for IPV4 flow
  */
 struct rte_eth_ipv4_flow {
@@ -369,6 +376,7 @@ struct rte_eth_sctpv6_flow {
  * An union contains the inputs for all types of flow
  */
 union rte_eth_fdir_flow {
+	struct rte_eth_l2_flow     l2_flow;
 	struct rte_eth_udpv4_flow  udp4_flow;
 	struct rte_eth_tcpv4_flow  tcp4_flow;
 	struct rte_eth_sctpv4_flow sctp4_flow;
-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH 2/6] i40e: extend flow diretcor to support l2_payload flow type
  2015-05-11  3:46 [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Jingjing Wu
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 1/6] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
@ 2015-05-11  3:46 ` Jingjing Wu
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 3/6] ethdev: extend struct to support flow director in VFs Jingjing Wu
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Jingjing Wu @ 2015-05-11  3:46 UTC (permalink / raw)
  To: dev

This patch extends flow diretcor to support l2_payload flow
type in i40e driver.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 lib/librte_pmd_i40e/i40e_fdir.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c
index 7b68c78..27c2102 100644
--- a/lib/librte_pmd_i40e/i40e_fdir.c
+++ b/lib/librte_pmd_i40e/i40e_fdir.c
@@ -44,6 +44,7 @@
 #include <rte_log.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
+#include <rte_arp.h>
 #include <rte_ip.h>
 #include <rte_udp.h>
 #include <rte_tcp.h>
@@ -104,7 +105,8 @@
 	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_UDP) | \
 	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_TCP) | \
 	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) | \
-	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER))
+	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) | \
+	(1 << RTE_ETH_FLOW_L2_PAYLOAD))
 
 #define I40E_FLEX_WORD_MASK(off) (0x80 >> (off))
 
@@ -366,7 +368,9 @@ i40e_init_flx_pld(struct i40e_pf *pf)
 
 	/* initialize the masks */
 	for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
-	     pctype <= I40E_FILTER_PCTYPE_FRAG_IPV6; pctype++) {
+	     pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++) {
+		if (!I40E_VALID_PCTYPE((enum i40e_filter_pctype)pctype))
+			continue;
 		pf->fdir.flex_mask[pctype].word_mask = 0;
 		I40E_WRITE_REG(hw, I40E_PRTQF_FD_FLXINSET(pctype), 0);
 		for (i = 0; i < I40E_FDIR_BITMASK_NUM_WORD; i++) {
@@ -704,6 +708,9 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input,
 	};
 
 	switch (fdir_input->flow_type) {
+	case RTE_ETH_FLOW_L2_PAYLOAD:
+		ether->ether_type = fdir_input->flow.l2_flow.ether_type;
+		break;
 	case RTE_ETH_FLOW_NONFRAG_IPV4_TCP:
 	case RTE_ETH_FLOW_NONFRAG_IPV4_UDP:
 	case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP:
@@ -866,6 +873,17 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 			  sizeof(struct ipv6_hdr);
 		set_idx = I40E_FLXPLD_L3_IDX;
 		break;
+	case RTE_ETH_FLOW_L2_PAYLOAD:
+		payload = raw_pkt + sizeof(struct ether_hdr);
+		/*
+		 * ARP packet is a special case on which the payload
+		 * starts after the whole ARP header
+		 */
+		if (fdir_input->flow.l2_flow.ether_type ==
+				rte_cpu_to_be_16(ETHER_TYPE_ARP))
+			payload += sizeof(struct arp_hdr);
+		set_idx = I40E_FLXPLD_L2_IDX;
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "unknown flow type %u.", fdir_input->flow_type);
 		return -EINVAL;
@@ -1218,7 +1236,7 @@ i40e_fdir_info_get_flex_mask(struct i40e_pf *pf,
 	uint16_t off_bytes, mask_tmp;
 
 	for (i = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
-	     i <= I40E_FILTER_PCTYPE_FRAG_IPV6;
+	     i <= I40E_FILTER_PCTYPE_L2_PAYLOAD;
 	     i++) {
 		mask =  &pf->fdir.flex_mask[i];
 		if (!I40E_VALID_PCTYPE((enum i40e_filter_pctype)i))
-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH 3/6] ethdev: extend struct to support flow director in VFs
  2015-05-11  3:46 [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Jingjing Wu
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 1/6] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 2/6] i40e: extend flow diretcor " Jingjing Wu
@ 2015-05-11  3:46 ` Jingjing Wu
  2015-06-12 16:45   ` Thomas Monjalon
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 4/6] i40e: extend flow diretcor to support filtering " Jingjing Wu
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Jingjing Wu @ 2015-05-11  3:46 UTC (permalink / raw)
  To: dev

This patch extends struct rte_eth_fdir_flow_ext to support flow
director in VFs.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 lib/librte_ether/rte_eth_ctrl.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 0e30dd9..601a4d3 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -394,6 +394,8 @@ struct rte_eth_fdir_flow_ext {
 	uint16_t vlan_tci;
 	uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
 	/**< It is filled by the flexible payload to match. */
+	uint8_t is_vf;   /**< 1 for VF, 0 for port dev */
+	uint16_t dst_id; /**< VF ID, available when is_vf is 1*/
 };
 
 /**
-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH 4/6] i40e: extend flow diretcor to support filtering in VFs
  2015-05-11  3:46 [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Jingjing Wu
                   ` (2 preceding siblings ...)
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 3/6] ethdev: extend struct to support flow director in VFs Jingjing Wu
@ 2015-05-11  3:46 ` Jingjing Wu
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 5/6] testpmd: extend commands Jingjing Wu
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Jingjing Wu @ 2015-05-11  3:46 UTC (permalink / raw)
  To: dev

This patch extends flow diretcor to filterting in VFs.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 lib/librte_pmd_i40e/i40e_fdir.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c
index 27c2102..2f4c247 100644
--- a/lib/librte_pmd_i40e/i40e_fdir.c
+++ b/lib/librte_pmd_i40e/i40e_fdir.c
@@ -1008,6 +1008,11 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
 		PMD_DRV_LOG(ERR, "Invalid queue ID");
 		return -EINVAL;
 	}
+	if (filter->input.flow_ext.is_vf &&
+		filter->input.flow_ext.dst_id >= pf->vf_num) {
+		PMD_DRV_LOG(ERR, "Invalid VF ID");
+		return -EINVAL;
+	}
 
 	memset(pkt, 0, I40E_FDIR_PKT_LEN);
 
@@ -1047,7 +1052,7 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
 	volatile struct i40e_tx_desc *txdp;
 	volatile struct i40e_filter_program_desc *fdirdp;
 	uint32_t td_cmd;
-	uint16_t i;
+	uint16_t vsi_id, i;
 	uint8_t dest;
 
 	PMD_DRV_LOG(INFO, "filling filter programming descriptor.");
@@ -1069,9 +1074,13 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
 					  I40E_TXD_FLTR_QW0_PCTYPE_SHIFT) &
 					  I40E_TXD_FLTR_QW0_PCTYPE_MASK);
 
-	/* Use LAN VSI Id by default */
+	if (filter->input.flow_ext.is_vf)
+		vsi_id = pf->vfs[filter->input.flow_ext.dst_id].vsi->vsi_id;
+	else
+		/* Use LAN VSI Id by default */
+		vsi_id = pf->main_vsi->vsi_id;
 	fdirdp->qindex_flex_ptype_vsi |=
-		rte_cpu_to_le_32((pf->main_vsi->vsi_id <<
+		rte_cpu_to_le_32((vsi_id <<
 				  I40E_TXD_FLTR_QW0_DEST_VSI_SHIFT) &
 				  I40E_TXD_FLTR_QW0_DEST_VSI_MASK);
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH 5/6] testpmd: extend commands
  2015-05-11  3:46 [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Jingjing Wu
                   ` (3 preceding siblings ...)
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 4/6] i40e: extend flow diretcor to support filtering " Jingjing Wu
@ 2015-05-11  3:46 ` Jingjing Wu
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 6/6] doc: extend commands in testpmd Jingjing Wu
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Jingjing Wu @ 2015-05-11  3:46 UTC (permalink / raw)
  To: dev

This patch extends commands to support l2_payload flow type
and filtering in VFs of flow director.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 app/test-pmd/cmdline.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 81 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f01db2a..438e948 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -632,7 +632,8 @@ static void cmd_help_long_parsed(void *parsed_result,
 			" flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)"
 			" src (src_ip_address) dst (dst_ip_address)"
 			" vlan (vlan_value) flexbytes (flexbytes_value)"
-			" (drop|fwd) queue (queue_id) fd_id (fd_id_value)\n"
+			" (drop|fwd) pf|vf(vf_id) queue (queue_id)"
+			" fd_id (fd_id_value)\n"
 			"    Add/Del an IP type flow director filter.\n\n"
 
 			"flow_director_filter (port_id) (add|del|update)"
@@ -640,7 +641,8 @@ static void cmd_help_long_parsed(void *parsed_result,
 			" src (src_ip_address) (src_port)"
 			" dst (dst_ip_address) (dst_port)"
 			" vlan (vlan_value) flexbytes (flexbytes_value)"
-			" (drop|fwd) queue (queue_id) fd_id (fd_id_value)\n"
+			" (drop|fwd) pf|vf(vf_id)queue (queue_id)"
+			" fd_id (fd_id_value)\n"
 			"    Add/Del an UDP/TCP type flow director filter.\n\n"
 
 			"flow_director_filter (port_id) (add|del|update)"
@@ -649,9 +651,15 @@ static void cmd_help_long_parsed(void *parsed_result,
 			" dst (dst_ip_address) (dst_port)"
 			" tag (verification_tag) vlan (vlan_value)"
 			" flexbytes (flexbytes_value) (drop|fwd)"
-			" queue (queue_id) fd_id (fd_id_value)\n"
+			" pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n"
 			"    Add/Del a SCTP type flow director filter.\n\n"
 
+			"flow_director_filter (port_id) (add|del|update)"
+			" flow l2_payload ether (ethertype)"
+			" flexbytes (flexbytes_value) (drop|fwd)"
+			" pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n"
+			"    Add/Del a l2 payload type flow director filter.\n\n"
+
 			"flush_flow_director (port_id)\n"
 			"    Flush all flow director entries of a device.\n\n"
 
@@ -662,7 +670,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"flow_director_flex_mask (port_id)"
 			" flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|"
-			"ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|all)"
+			"ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|l2_payload|all)"
 			" (mask)\n"
 			"    Configure mask of flex payload.\n\n"
 
@@ -7653,6 +7661,8 @@ struct cmd_flow_director_result {
 	cmdline_fixed_string_t ops;
 	cmdline_fixed_string_t flow;
 	cmdline_fixed_string_t flow_type;
+	cmdline_fixed_string_t ether;
+	uint16_t ether_type;
 	cmdline_fixed_string_t src;
 	cmdline_ipaddr_t ip_src;
 	uint16_t port_src;
@@ -7665,6 +7675,7 @@ struct cmd_flow_director_result {
 	uint16_t vlan_value;
 	cmdline_fixed_string_t flexbytes;
 	cmdline_fixed_string_t flexbytes_value;
+	cmdline_fixed_string_t pf_vf;
 	cmdline_fixed_string_t drop;
 	cmdline_fixed_string_t queue;
 	uint16_t  queue_id;
@@ -7771,6 +7782,8 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 	struct cmd_flow_director_result *res = parsed_result;
 	struct rte_eth_fdir_filter entry;
 	uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
+	char *end;
+	unsigned long vf_id;
 	int ret = 0;
 
 	ret = rte_eth_dev_filter_supported(res->port_id, RTE_ETH_FILTER_FDIR);
@@ -7837,6 +7850,10 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 		entry.input.flow.sctp6_flow.verify_tag =
 				rte_cpu_to_be_32(res->verify_tag_value);
 		break;
+	case RTE_ETH_FLOW_L2_PAYLOAD:
+		entry.input.flow.l2_flow.ether_type =
+			rte_cpu_to_be_16(res->ether_type);
+		break;
 	default:
 		printf("invalid parameter.\n");
 		return;
@@ -7852,6 +7869,27 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 		entry.action.behavior = RTE_ETH_FDIR_REJECT;
 	else
 		entry.action.behavior = RTE_ETH_FDIR_ACCEPT;
+
+	if (!strcmp(res->pf_vf, "pf"))
+		entry.input.flow_ext.is_vf = 0;
+	else if (!strncmp(res->pf_vf, "vf", 2)) {
+		struct rte_eth_dev_info dev_info;
+
+		memset(&dev_info, 0, sizeof(dev_info));
+		rte_eth_dev_info_get(res->port_id, &dev_info);
+		errno = 0;
+		vf_id = strtoul(res->pf_vf + 2, &end, 10);
+		if (errno != 0 || *end != '\0' || vf_id >= dev_info.max_vfs) {
+			printf("invalid parameter %s.\n", res->pf_vf);
+			return;
+		}
+		entry.input.flow_ext.is_vf = 1;
+		entry.input.flow_ext.dst_id = (uint16_t)vf_id;
+	} else {
+		printf("invalid parameter %s.\n", res->pf_vf);
+		return;
+	}
+
 	/* set to report FD ID by default */
 	entry.action.report_status = RTE_ETH_FDIR_REPORT_ID;
 	entry.action.rx_queue = res->queue_id;
@@ -7885,7 +7923,13 @@ cmdline_parse_token_string_t cmd_flow_director_flow =
 cmdline_parse_token_string_t cmd_flow_director_flow_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
 		flow_type, "ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
-		"ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp");
+		"ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#l2_payload");
+cmdline_parse_token_string_t cmd_flow_director_ether =
+	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+				 ether, "ether");
+cmdline_parse_token_num_t cmd_flow_director_ether_type =
+	TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+			      ether_type, UINT16);
 cmdline_parse_token_string_t cmd_flow_director_src =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
 				 src, "src");
@@ -7925,6 +7969,9 @@ cmdline_parse_token_string_t cmd_flow_director_flexbytes_value =
 cmdline_parse_token_string_t cmd_flow_director_drop =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
 				 drop, "drop#fwd");
+cmdline_parse_token_string_t cmd_flow_director_pf_vf =
+	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+			      pf_vf, NULL);
 cmdline_parse_token_string_t cmd_flow_director_queue =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
 				 queue, "queue");
@@ -7957,6 +8004,7 @@ cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
 		(void *)&cmd_flow_director_flexbytes,
 		(void *)&cmd_flow_director_flexbytes_value,
 		(void *)&cmd_flow_director_drop,
+		(void *)&cmd_flow_director_pf_vf,
 		(void *)&cmd_flow_director_queue,
 		(void *)&cmd_flow_director_queue_id,
 		(void *)&cmd_flow_director_fd_id,
@@ -7986,6 +8034,7 @@ cmdline_parse_inst_t cmd_add_del_udp_flow_director = {
 		(void *)&cmd_flow_director_flexbytes,
 		(void *)&cmd_flow_director_flexbytes_value,
 		(void *)&cmd_flow_director_drop,
+		(void *)&cmd_flow_director_pf_vf,
 		(void *)&cmd_flow_director_queue,
 		(void *)&cmd_flow_director_queue_id,
 		(void *)&cmd_flow_director_fd_id,
@@ -8017,6 +8066,31 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
 		(void *)&cmd_flow_director_flexbytes,
 		(void *)&cmd_flow_director_flexbytes_value,
 		(void *)&cmd_flow_director_drop,
+		(void *)&cmd_flow_director_pf_vf,
+		(void *)&cmd_flow_director_queue,
+		(void *)&cmd_flow_director_queue_id,
+		(void *)&cmd_flow_director_fd_id,
+		(void *)&cmd_flow_director_fd_id_value,
+		NULL,
+	},
+};
+
+cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
+	.f = cmd_flow_director_filter_parsed,
+	.data = NULL,
+	.help_str = "add or delete a L2 flow director entry on NIC",
+	.tokens = {
+		(void *)&cmd_flow_director_filter,
+		(void *)&cmd_flow_director_port_id,
+		(void *)&cmd_flow_director_ops,
+		(void *)&cmd_flow_director_flow,
+		(void *)&cmd_flow_director_flow_type,
+		(void *)&cmd_flow_director_ether,
+		(void *)&cmd_flow_director_ether_type,
+		(void *)&cmd_flow_director_flexbytes,
+		(void *)&cmd_flow_director_flexbytes_value,
+		(void *)&cmd_flow_director_drop,
+		(void *)&cmd_flow_director_pf_vf,
 		(void *)&cmd_flow_director_queue,
 		(void *)&cmd_flow_director_queue_id,
 		(void *)&cmd_flow_director_fd_id,
@@ -8278,7 +8352,7 @@ cmdline_parse_token_string_t cmd_flow_director_flexmask_flow =
 cmdline_parse_token_string_t cmd_flow_director_flexmask_flow_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,
 		flow_type, "none#ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
-		"ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#all");
+		"ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#l2_payload#all");
 cmdline_parse_token_string_t cmd_flow_director_flexmask_mask =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,
 				 mask, NULL);
@@ -8854,6 +8928,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_add_del_ip_flow_director,
 	(cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director,
 	(cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director,
+	(cmdline_parse_inst_t *)&cmd_add_del_l2_flow_director,
 	(cmdline_parse_inst_t *)&cmd_flush_flow_director,
 	(cmdline_parse_inst_t *)&cmd_set_flow_director_mask,
 	(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_mask,
-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH 6/6] doc: extend commands in testpmd
  2015-05-11  3:46 [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Jingjing Wu
                   ` (4 preceding siblings ...)
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 5/6] testpmd: extend commands Jingjing Wu
@ 2015-05-11  3:46 ` Jingjing Wu
  2015-06-02  7:33 ` [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Zhang, Helin
  2015-06-16  3:43 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Jingjing Wu
  7 siblings, 0 replies; 18+ messages in thread
From: Jingjing Wu @ 2015-05-11  3:46 UTC (permalink / raw)
  To: dev

Modify the doc about flow director commands to support l2_payload
flow type and filtering in VFs.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 761172e..3d56097 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1527,27 +1527,28 @@ Different NICs may have different capabilities, command show port fdir (port_id)
 
 flow_director_filter (port_id) (add|del|update) flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)
 src (src_ip_address) dst (dst_ip_address) vlan (vlan_value) flexbytes (flexbytes_value)
-(drop|fwd) queue (queue_id) fd_id (fd_id_value)
+(drop|fwd) pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)
 
 flow_director_filter (port_id) (add|del|update) flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp)
 src (src_ip_address) (src_port) dst (dst_ip_address) (dst_port) vlan (vlan_value)
-flexbytes (flexbytes_value) (drop|fwd) queue (queue_id) fd_id (fd_id_value)
+flexbytes (flexbytes_value) (drop|fwd) pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)
 
 flow_director_filter (port_id) (add|del|update) flow (ipv4-sctp|ipv6-sctp)
 src (src_ip_address) (src_port) dst (dst_ip_address) (dst_port) tag (verification_tag)
-vlan (vlan_value) flexbytes (flexbytes_value) (drop|fwd) queue (queue_id) fd_id (fd_id_value)
+vlan (vlan_value) flexbytes (flexbytes_value) (drop|fwd) pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)
 
-For example, to add an ipv4-udp flow type filter:
+flow_director_filter (port_id) (add|del|update) flow l2_payload
+ether (ethertype) flexbytes (flexbytes_value) (drop|fwd) pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)
 
 .. code-block:: console
 
-    testpmd> flow_director_filter 0 add flow ipv4-udp src 2.2.2.3 32 dst 2.2.2.5 33 vlan 0x1 flexbytes (0x88,0x48) fwd queue 1 fd_id 1
+    testpmd> flow_director_filter 0 add flow ipv4-udp src 2.2.2.3 32 dst 2.2.2.5 33 vlan 0x1 flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
 
 For example, add an ipv4-other flow type filter:
 
 .. code-block:: console
 
-    testpmd> flow_director_filter 0 add flow ipv4-other src 2.2.2.3 dst 2.2.2.5 vlan 0x1 flexbytes (0x88,0x48) fwd queue 1 fd_id 1
+    testpmd> flow_director_filter 0 add flow ipv4-other src 2.2.2.3 dst 2.2.2.5 vlan 0x1 flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
 
 flush_flow_director
 ~~~~~~~~~~~~~~~~~~~
@@ -1582,7 +1583,7 @@ flow_director_flex_mask
 set masks of flow director's flexible payload based on certain flow type:
 
 flow_director_flex_mask (port_id) flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|
-ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|all) (mask)
+ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|l2_payload|all) (mask)
 
 Example, to set flow director's flex mask for all flow type on port 0:
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver
  2015-05-11  3:46 [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Jingjing Wu
                   ` (5 preceding siblings ...)
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 6/6] doc: extend commands in testpmd Jingjing Wu
@ 2015-06-02  7:33 ` Zhang, Helin
  2015-06-16  3:43 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Jingjing Wu
  7 siblings, 0 replies; 18+ messages in thread
From: Zhang, Helin @ 2015-06-02  7:33 UTC (permalink / raw)
  To: Wu, Jingjing, dev

Acked-by: Helin Zhang <helin.zhang@intel.com>

> -----Original Message-----
> From: Wu, Jingjing
> Sent: Monday, May 11, 2015 11:46 AM
> To: dev@dpdk.org
> Cc: Wu, Jingjing; Zhang, Helin; Cao, Min; Liu, Jijiang
> Subject: [PATCH 0/6] extend flow director to support L2_paylod type and VF
> filtering in i40e driver
> 
> This patch set extends flow director to support L2_paylod type and VF filtering in
> i40e driver.
> 
> Jingjing Wu (6):
>   ethdev: add struct rte_eth_l2_flow to support l2_payload flow type
>   i40e: extend flow diretcor to support l2_payload flow type
>   ethdev: extend struct to support flow director in VFs
>   i40e: extend flow diretcor to support filtering in VFs
>   testpmd: extend commands
>   doc: extend commands in testpmd
> 
>  app/test-pmd/cmdline.c                      | 87
> +++++++++++++++++++++++++++--
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++---
>  lib/librte_ether/rte_eth_ctrl.h             | 10 ++++
>  lib/librte_pmd_i40e/i40e_fdir.c             | 39 +++++++++++--
>  4 files changed, 132 insertions(+), 19 deletions(-)
> 
> --
> 1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH 3/6] ethdev: extend struct to support flow director in VFs
  2015-05-11  3:46 ` [dpdk-dev] [PATCH 3/6] ethdev: extend struct to support flow director in VFs Jingjing Wu
@ 2015-06-12 16:45   ` Thomas Monjalon
  2015-06-15  7:14     ` Wu, Jingjing
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Monjalon @ 2015-06-12 16:45 UTC (permalink / raw)
  To: Jingjing Wu; +Cc: dev, neil.horman

2015-05-11 11:46, Jingjing Wu:
> This patch extends struct rte_eth_fdir_flow_ext to support flow
> director in VFs.
> 
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>

> --- a/lib/librte_ether/rte_eth_ctrl.h
> +++ b/lib/librte_ether/rte_eth_ctrl.h
> @@ -394,6 +394,8 @@ struct rte_eth_fdir_flow_ext {
>  	uint16_t vlan_tci;
>  	uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
>  	/**< It is filled by the flexible payload to match. */
> +	uint8_t is_vf;   /**< 1 for VF, 0 for port dev */
> +	uint16_t dst_id; /**< VF ID, available when is_vf is 1*/
>  };

Isn't it breaking the ABI?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH 3/6] ethdev: extend struct to support flow director in VFs
  2015-06-12 16:45   ` Thomas Monjalon
@ 2015-06-15  7:14     ` Wu, Jingjing
  0 siblings, 0 replies; 18+ messages in thread
From: Wu, Jingjing @ 2015-06-15  7:14 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, neil.horman



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Saturday, June 13, 2015 12:45 AM
> To: Wu, Jingjing
> Cc: dev@dpdk.org; neil.horman@tuxdriver.com
> Subject: Re: [dpdk-dev] [PATCH 3/6] ethdev: extend struct to support flow
> director in VFs
> 
> 2015-05-11 11:46, Jingjing Wu:
> > This patch extends struct rte_eth_fdir_flow_ext to support flow
> > director in VFs.
> >
> > Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
> 
> > --- a/lib/librte_ether/rte_eth_ctrl.h
> > +++ b/lib/librte_ether/rte_eth_ctrl.h
> > @@ -394,6 +394,8 @@ struct rte_eth_fdir_flow_ext {
> >  	uint16_t vlan_tci;
> >  	uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
> >  	/**< It is filled by the flexible payload to match. */
> > +	uint8_t is_vf;   /**< 1 for VF, 0 for port dev */
> > +	uint16_t dst_id; /**< VF ID, available when is_vf is 1*/
> >  };
> 
> Isn't it breaking the ABI?

Yes, it is breaking the ABI. Will consider how to avoid that.

Thanks
Jingjing

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type
  2015-05-11  3:46 [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Jingjing Wu
                   ` (6 preceding siblings ...)
  2015-06-02  7:33 ` [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Zhang, Helin
@ 2015-06-16  3:43 ` Jingjing Wu
  2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
                     ` (5 more replies)
  7 siblings, 6 replies; 18+ messages in thread
From: Jingjing Wu @ 2015-06-16  3:43 UTC (permalink / raw)
  To: dev

This patch set extends flow director to support L2_paylod type in i40e driver.
 
v2 change:
 - remove the flow director VF filtering from this patch to avoid breaking ABI.

Jingjing Wu (4):
  ethdev: add struct rte_eth_l2_flow to support l2_payload flow type
  i40e: extend flow diretcor to support l2_payload flow type
  testpmd: extend commands
  doc: extend commands in testpmd

 app/test-pmd/cmdline.c                      | 48 +++++++++++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  5 ++-
 drivers/net/i40e/i40e_fdir.c                | 24 +++++++++++++--
 lib/librte_ether/rte_eth_ctrl.h             |  8 +++++
 4 files changed, 78 insertions(+), 7 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH v2 1/4] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type
  2015-06-16  3:43 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Jingjing Wu
@ 2015-06-16  3:43   ` Jingjing Wu
  2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 2/4] i40e: extend flow diretcor " Jingjing Wu
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Jingjing Wu @ 2015-06-16  3:43 UTC (permalink / raw)
  To: dev

This patch adds a new struct rte_eth_l2_flow to support l2_payload flow type

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 lib/librte_ether/rte_eth_ctrl.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 498fc85..0e30dd9 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -298,6 +298,13 @@ struct rte_eth_tunnel_filter_conf {
 #define RTE_ETH_FDIR_MAX_FLEXLEN         16 /** < Max length of flexbytes. */
 
 /**
+ * A structure used to define the input for L2 flow
+ */
+struct rte_eth_l2_flow {
+	uint16_t ether_type;          /**< Ether type to match */
+};
+
+/**
  * A structure used to define the input for IPV4 flow
  */
 struct rte_eth_ipv4_flow {
@@ -369,6 +376,7 @@ struct rte_eth_sctpv6_flow {
  * An union contains the inputs for all types of flow
  */
 union rte_eth_fdir_flow {
+	struct rte_eth_l2_flow     l2_flow;
 	struct rte_eth_udpv4_flow  udp4_flow;
 	struct rte_eth_tcpv4_flow  tcp4_flow;
 	struct rte_eth_sctpv4_flow sctp4_flow;
-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH v2 2/4] i40e: extend flow diretcor to support l2_payload flow type
  2015-06-16  3:43 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Jingjing Wu
  2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
@ 2015-06-16  3:43   ` Jingjing Wu
  2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 3/4] testpmd: extend commands Jingjing Wu
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Jingjing Wu @ 2015-06-16  3:43 UTC (permalink / raw)
  To: dev

This patch extends flow diretcor to support l2_payload flow
type in i40e driver.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/i40e_fdir.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 4bf98d0..8b81ca3 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -44,6 +44,7 @@
 #include <rte_log.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
+#include <rte_arp.h>
 #include <rte_ip.h>
 #include <rte_udp.h>
 #include <rte_tcp.h>
@@ -104,7 +105,8 @@
 	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_UDP) | \
 	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_TCP) | \
 	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) | \
-	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER))
+	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) | \
+	(1 << RTE_ETH_FLOW_L2_PAYLOAD))
 
 #define I40E_FLEX_WORD_MASK(off) (0x80 >> (off))
 
@@ -366,7 +368,9 @@ i40e_init_flx_pld(struct i40e_pf *pf)
 
 	/* initialize the masks */
 	for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
-	     pctype <= I40E_FILTER_PCTYPE_FRAG_IPV6; pctype++) {
+	     pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++) {
+		if (!I40E_VALID_PCTYPE((enum i40e_filter_pctype)pctype))
+			continue;
 		pf->fdir.flex_mask[pctype].word_mask = 0;
 		I40E_WRITE_REG(hw, I40E_PRTQF_FD_FLXINSET(pctype), 0);
 		for (i = 0; i < I40E_FDIR_BITMASK_NUM_WORD; i++) {
@@ -704,6 +708,9 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input,
 	};
 
 	switch (fdir_input->flow_type) {
+	case RTE_ETH_FLOW_L2_PAYLOAD:
+		ether->ether_type = fdir_input->flow.l2_flow.ether_type;
+		break;
 	case RTE_ETH_FLOW_NONFRAG_IPV4_TCP:
 	case RTE_ETH_FLOW_NONFRAG_IPV4_UDP:
 	case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP:
@@ -866,6 +873,17 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 			  sizeof(struct ipv6_hdr);
 		set_idx = I40E_FLXPLD_L3_IDX;
 		break;
+	case RTE_ETH_FLOW_L2_PAYLOAD:
+		payload = raw_pkt + sizeof(struct ether_hdr);
+		/*
+		 * ARP packet is a special case on which the payload
+		 * starts after the whole ARP header
+		 */
+		if (fdir_input->flow.l2_flow.ether_type ==
+				rte_cpu_to_be_16(ETHER_TYPE_ARP))
+			payload += sizeof(struct arp_hdr);
+		set_idx = I40E_FLXPLD_L2_IDX;
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "unknown flow type %u.", fdir_input->flow_type);
 		return -EINVAL;
@@ -1218,7 +1236,7 @@ i40e_fdir_info_get_flex_mask(struct i40e_pf *pf,
 	uint16_t off_bytes, mask_tmp;
 
 	for (i = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
-	     i <= I40E_FILTER_PCTYPE_FRAG_IPV6;
+	     i <= I40E_FILTER_PCTYPE_L2_PAYLOAD;
 	     i++) {
 		mask =  &pf->fdir.flex_mask[i];
 		if (!I40E_VALID_PCTYPE((enum i40e_filter_pctype)i))
-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH v2 3/4] testpmd: extend commands
  2015-06-16  3:43 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Jingjing Wu
  2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
  2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 2/4] i40e: extend flow diretcor " Jingjing Wu
@ 2015-06-16  3:43   ` Jingjing Wu
  2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 4/4] doc: extend commands in testpmd Jingjing Wu
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Jingjing Wu @ 2015-06-16  3:43 UTC (permalink / raw)
  To: dev

This patch extends flow director commands to support l2_payload flow type.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 app/test-pmd/cmdline.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f01db2a..9659464 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -652,6 +652,12 @@ static void cmd_help_long_parsed(void *parsed_result,
 			" queue (queue_id) fd_id (fd_id_value)\n"
 			"    Add/Del a SCTP type flow director filter.\n\n"
 
+			"flow_director_filter (port_id) (add|del|update)"
+			" flow l2_payload ether (ethertype)"
+			" flexbytes (flexbytes_value) (drop|fwd)"
+			" queue (queue_id) fd_id (fd_id_value)\n"
+			"    Add/Del a l2 payload type flow director filter.\n\n"
+
 			"flush_flow_director (port_id)\n"
 			"    Flush all flow director entries of a device.\n\n"
 
@@ -662,7 +668,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"flow_director_flex_mask (port_id)"
 			" flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|"
-			"ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|all)"
+			"ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|l2_payload|all)"
 			" (mask)\n"
 			"    Configure mask of flex payload.\n\n"
 
@@ -7653,6 +7659,8 @@ struct cmd_flow_director_result {
 	cmdline_fixed_string_t ops;
 	cmdline_fixed_string_t flow;
 	cmdline_fixed_string_t flow_type;
+	cmdline_fixed_string_t ether;
+	uint16_t ether_type;
 	cmdline_fixed_string_t src;
 	cmdline_ipaddr_t ip_src;
 	uint16_t port_src;
@@ -7837,6 +7845,10 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 		entry.input.flow.sctp6_flow.verify_tag =
 				rte_cpu_to_be_32(res->verify_tag_value);
 		break;
+	case RTE_ETH_FLOW_L2_PAYLOAD:
+		entry.input.flow.l2_flow.ether_type =
+			rte_cpu_to_be_16(res->ether_type);
+		break;
 	default:
 		printf("invalid parameter.\n");
 		return;
@@ -7885,7 +7897,13 @@ cmdline_parse_token_string_t cmd_flow_director_flow =
 cmdline_parse_token_string_t cmd_flow_director_flow_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
 		flow_type, "ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
-		"ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp");
+		"ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#l2_payload");
+cmdline_parse_token_string_t cmd_flow_director_ether =
+	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+				 ether, "ether");
+cmdline_parse_token_num_t cmd_flow_director_ether_type =
+	TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+			      ether_type, UINT16);
 cmdline_parse_token_string_t cmd_flow_director_src =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
 				 src, "src");
@@ -8025,6 +8043,29 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
 	},
 };
 
+cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
+	.f = cmd_flow_director_filter_parsed,
+	.data = NULL,
+	.help_str = "add or delete a L2 flow director entry on NIC",
+	.tokens = {
+		(void *)&cmd_flow_director_filter,
+		(void *)&cmd_flow_director_port_id,
+		(void *)&cmd_flow_director_ops,
+		(void *)&cmd_flow_director_flow,
+		(void *)&cmd_flow_director_flow_type,
+		(void *)&cmd_flow_director_ether,
+		(void *)&cmd_flow_director_ether_type,
+		(void *)&cmd_flow_director_flexbytes,
+		(void *)&cmd_flow_director_flexbytes_value,
+		(void *)&cmd_flow_director_drop,
+		(void *)&cmd_flow_director_queue,
+		(void *)&cmd_flow_director_queue_id,
+		(void *)&cmd_flow_director_fd_id,
+		(void *)&cmd_flow_director_fd_id_value,
+		NULL,
+	},
+};
+
 struct cmd_flush_flow_director_result {
 	cmdline_fixed_string_t flush_flow_director;
 	uint8_t port_id;
@@ -8278,7 +8319,7 @@ cmdline_parse_token_string_t cmd_flow_director_flexmask_flow =
 cmdline_parse_token_string_t cmd_flow_director_flexmask_flow_type =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,
 		flow_type, "none#ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
-		"ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#all");
+		"ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#l2_payload#all");
 cmdline_parse_token_string_t cmd_flow_director_flexmask_mask =
 	TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,
 				 mask, NULL);
@@ -8854,6 +8895,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_add_del_ip_flow_director,
 	(cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director,
 	(cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director,
+	(cmdline_parse_inst_t *)&cmd_add_del_l2_flow_director,
 	(cmdline_parse_inst_t *)&cmd_flush_flow_director,
 	(cmdline_parse_inst_t *)&cmd_set_flow_director_mask,
 	(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_mask,
-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH v2 4/4] doc: extend commands in testpmd
  2015-06-16  3:43 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Jingjing Wu
                     ` (2 preceding siblings ...)
  2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 3/4] testpmd: extend commands Jingjing Wu
@ 2015-06-16  3:43   ` Jingjing Wu
  2015-06-26  2:26   ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Xu, HuilongX
  2015-06-26  3:14   ` Zhang, Helin
  5 siblings, 0 replies; 18+ messages in thread
From: Jingjing Wu @ 2015-06-16  3:43 UTC (permalink / raw)
  To: dev

Modify the doc about flow director commands to support l2_payload flow type.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 761172e..9aa5397 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1537,6 +1537,9 @@ flow_director_filter (port_id) (add|del|update) flow (ipv4-sctp|ipv6-sctp)
 src (src_ip_address) (src_port) dst (dst_ip_address) (dst_port) tag (verification_tag)
 vlan (vlan_value) flexbytes (flexbytes_value) (drop|fwd) queue (queue_id) fd_id (fd_id_value)
 
+flow_director_filter (port_id) (add|del|update) flow l2_payload
+ether (ethertype) flexbytes (flexbytes_value) (drop|fwd) queue (queue_id) fd_id (fd_id_value)
+
 For example, to add an ipv4-udp flow type filter:
 
 .. code-block:: console
@@ -1582,7 +1585,7 @@ flow_director_flex_mask
 set masks of flow director's flexible payload based on certain flow type:
 
 flow_director_flex_mask (port_id) flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|
-ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|all) (mask)
+ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|l2_payload|all) (mask)
 
 Example, to set flow director's flex mask for all flow type on port 0:
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type
  2015-06-16  3:43 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Jingjing Wu
                     ` (3 preceding siblings ...)
  2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 4/4] doc: extend commands in testpmd Jingjing Wu
@ 2015-06-26  2:26   ` Xu, HuilongX
  2015-06-26  3:14   ` Zhang, Helin
  5 siblings, 0 replies; 18+ messages in thread
From: Xu, HuilongX @ 2015-06-26  2:26 UTC (permalink / raw)
  To: Wu, Jingjing, dev

Tested-by:huilong,xu <huilongx.xu@intel.com>
Os: 3.11.10-301.fc20.x86_64
Gcc: gcc version 4.8.3 20140911 (Red Hat 4.8.3-7) (GCC)
Package: d2c08067240baf27f2447bf4981b9ab58ce74d35 + l2payload patch
NIC: Intel Corporation Ethernet Controller XL710 for 40GbE QSFP+ [8086:1583]
Test case Summary: 1 case passed
Test sets:
1. build dpdk with x86_64 gcc target 
2. set hugpage and bind igb_uio to Fortville nic 
3. ./testpmd -c ffff -n 4 -- -I --portmask=0x3 --disable-rss --rxq=2 --txq=2 --nbcores=8 --pkt-filter-mode=perfect
4. exec testpmd cmdline
    a) set verbose 1
    b) set fwd rxonly
    c) flow_director_filter 0 add flow l2_payload ether 0x0806 flexbytes () fwd queue 1 fd 1
    d) start
5. send a arp package to port 0
6. testpmd print port 0 queue 1 received a pachage

  
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Tuesday, June 16, 2015 11:44 AM
> To: dev@dpdk.org
> Cc: Wu, Jingjing; Zhang, Helin; Xu, HuilongX
> Subject: [PATCH v2 0/4] extend flow director to support L2_paylod type
> 
> This patch set extends flow director to support L2_paylod type in i40e
> driver.
> 
> v2 change:
>  - remove the flow director VF filtering from this patch to avoid breaking
> ABI.
> 
> Jingjing Wu (4):
>   ethdev: add struct rte_eth_l2_flow to support l2_payload flow type
>   i40e: extend flow diretcor to support l2_payload flow type
>   testpmd: extend commands
>   doc: extend commands in testpmd
> 
>  app/test-pmd/cmdline.c                      | 48
> +++++++++++++++++++++++++++--
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  5 ++-
>  drivers/net/i40e/i40e_fdir.c                | 24 +++++++++++++--
>  lib/librte_ether/rte_eth_ctrl.h             |  8 +++++
>  4 files changed, 78 insertions(+), 7 deletions(-)
> 
> --
> 1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type
  2015-06-16  3:43 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Jingjing Wu
                     ` (4 preceding siblings ...)
  2015-06-26  2:26   ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Xu, HuilongX
@ 2015-06-26  3:14   ` Zhang, Helin
  2015-07-07 21:24     ` Thomas Monjalon
  5 siblings, 1 reply; 18+ messages in thread
From: Zhang, Helin @ 2015-06-26  3:14 UTC (permalink / raw)
  To: Wu, Jingjing, dev



> -----Original Message-----
> From: Wu, Jingjing
> Sent: Tuesday, June 16, 2015 11:44 AM
> To: dev@dpdk.org
> Cc: Wu, Jingjing; Zhang, Helin; Xu, HuilongX
> Subject: [PATCH v2 0/4] extend flow director to support L2_paylod type
> 
> This patch set extends flow director to support L2_paylod type in i40e driver.
> 
> v2 change:
>  - remove the flow director VF filtering from this patch to avoid breaking ABI.
> 
> Jingjing Wu (4):
>   ethdev: add struct rte_eth_l2_flow to support l2_payload flow type
>   i40e: extend flow diretcor to support l2_payload flow type
>   testpmd: extend commands
>   doc: extend commands in testpmd
> 
>  app/test-pmd/cmdline.c                      | 48
> +++++++++++++++++++++++++++--
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  5 ++-
>  drivers/net/i40e/i40e_fdir.c                | 24 +++++++++++++--
>  lib/librte_ether/rte_eth_ctrl.h             |  8 +++++
>  4 files changed, 78 insertions(+), 7 deletions(-)
Acked-by: Helin Zhang <helin.zhang@intel.com>


> 
> --
> 1.9.3

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type
  2015-06-26  3:14   ` Zhang, Helin
@ 2015-07-07 21:24     ` Thomas Monjalon
  0 siblings, 0 replies; 18+ messages in thread
From: Thomas Monjalon @ 2015-07-07 21:24 UTC (permalink / raw)
  To: Wu, Jingjing; +Cc: dev

> > This patch set extends flow director to support L2_paylod type in i40e driver.
> > 
> > v2 change:
> >  - remove the flow director VF filtering from this patch to avoid breaking ABI.
> > 
> > Jingjing Wu (4):
> >   ethdev: add struct rte_eth_l2_flow to support l2_payload flow type
> >   i40e: extend flow diretcor to support l2_payload flow type
> >   testpmd: extend commands
> >   doc: extend commands in testpmd
> 
> Acked-by: Helin Zhang <helin.zhang@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-07-07 21:26 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-11  3:46 [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Jingjing Wu
2015-05-11  3:46 ` [dpdk-dev] [PATCH 1/6] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
2015-05-11  3:46 ` [dpdk-dev] [PATCH 2/6] i40e: extend flow diretcor " Jingjing Wu
2015-05-11  3:46 ` [dpdk-dev] [PATCH 3/6] ethdev: extend struct to support flow director in VFs Jingjing Wu
2015-06-12 16:45   ` Thomas Monjalon
2015-06-15  7:14     ` Wu, Jingjing
2015-05-11  3:46 ` [dpdk-dev] [PATCH 4/6] i40e: extend flow diretcor to support filtering " Jingjing Wu
2015-05-11  3:46 ` [dpdk-dev] [PATCH 5/6] testpmd: extend commands Jingjing Wu
2015-05-11  3:46 ` [dpdk-dev] [PATCH 6/6] doc: extend commands in testpmd Jingjing Wu
2015-06-02  7:33 ` [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Zhang, Helin
2015-06-16  3:43 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Jingjing Wu
2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 2/4] i40e: extend flow diretcor " Jingjing Wu
2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 3/4] testpmd: extend commands Jingjing Wu
2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 4/4] doc: extend commands in testpmd Jingjing Wu
2015-06-26  2:26   ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Xu, HuilongX
2015-06-26  3:14   ` Zhang, Helin
2015-07-07 21:24     ` Thomas Monjalon

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).