DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/4] extend flow director to support VF filtering in i40e driver
@ 2015-09-22  3:45 Jingjing Wu
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 1/4] ethdev: extend struct to support flow director in VFs Jingjing Wu
                   ` (4 more replies)
  0 siblings, 5 replies; 33+ messages in thread
From: Jingjing Wu @ 2015-09-22  3:45 UTC (permalink / raw)
  To: dev

This patch set extends flow director to VF filtering in i40e driver.

Jingjing Wu (4):
  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 and remove related ABI deprecation

 app/test-pmd/cmdline.c                      | 41 ++++++++++++++++++++++++++---
 doc/guides/rel_notes/deprecation.rst        |  4 ---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 ++++-----
 drivers/net/i40e/i40e_ethdev.c              |  4 +--
 drivers/net/i40e/i40e_fdir.c                | 15 ++++++++---
 lib/librte_ether/rte_eth_ctrl.h             |  2 ++
 6 files changed, 59 insertions(+), 19 deletions(-)

-- 
2.4.0

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

* [dpdk-dev] [PATCH 1/4] ethdev: extend struct to support flow director in VFs
  2015-09-22  3:45 [dpdk-dev] [PATCH 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
@ 2015-09-22  3:45 ` Jingjing Wu
  2015-10-27  7:52   ` Zhang, Helin
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 2/4] i40e: extend flow diretcor to support filtering " Jingjing Wu
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 33+ messages in thread
From: Jingjing Wu @ 2015-09-22  3:45 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 26b7b33..403e6b8 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -398,6 +398,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*/
 };
 
 /**
-- 
2.4.0

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

* [dpdk-dev] [PATCH 2/4] i40e: extend flow diretcor to support filtering in VFs
  2015-09-22  3:45 [dpdk-dev] [PATCH 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 1/4] ethdev: extend struct to support flow director in VFs Jingjing Wu
@ 2015-09-22  3:45 ` Jingjing Wu
  2015-10-27  7:52   ` Zhang, Helin
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 3/4] testpmd: extend commands Jingjing Wu
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 33+ messages in thread
From: Jingjing Wu @ 2015-09-22  3:45 UTC (permalink / raw)
  To: dev

This patch extends flow director to filtering in VFs.
It also corrects to disable interrupt on queues when stop device.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_fdir.c   | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2dd9fdc..b3207e3 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1031,8 +1031,8 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	}
 
 	if (pf->fdir.fdir_vsi) {
-		i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi);
-		i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
+		i40e_vsi_queues_unbind_intr(pf->fdir.fdir_vsi);
+		i40e_vsi_disable_queues_intr(pf->fdir.fdir_vsi);
 	}
 	/* Clear all queues and release memory */
 	i40e_dev_clear_queues(dev);
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index c9ce98f..73a69c9 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1022,6 +1022,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);
 
@@ -1061,7 +1066,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.");
@@ -1083,9 +1088,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);
 
-- 
2.4.0

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

* [dpdk-dev] [PATCH 3/4] testpmd: extend commands
  2015-09-22  3:45 [dpdk-dev] [PATCH 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 1/4] ethdev: extend struct to support flow director in VFs Jingjing Wu
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 2/4] i40e: extend flow diretcor to support filtering " Jingjing Wu
@ 2015-09-22  3:45 ` Jingjing Wu
  2015-10-27  7:53   ` Zhang, Helin
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 4/4] doc: extend commands in testpmd and remove related ABI deprecation Jingjing Wu
  2015-10-28  8:41 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
  4 siblings, 1 reply; 33+ messages in thread
From: Jingjing Wu @ 2015-09-22  3:45 UTC (permalink / raw)
  To: dev

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

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

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0f8f48f..22476f5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -631,7 +631,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)"
@@ -639,7 +640,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)"
@@ -648,13 +650,13 @@ 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)"
-			" 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 l2 payload type flow director filter.\n\n"
 
 			"flush_flow_director (port_id)\n"
@@ -7742,6 +7744,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;
@@ -7848,6 +7851,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);
@@ -7941,6 +7946,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;
@@ -8020,6 +8046,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");
@@ -8052,6 +8081,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,
@@ -8081,6 +8111,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,
@@ -8112,6 +8143,7 @@ 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,
@@ -8135,6 +8167,7 @@ cmdline_parse_inst_t cmd_add_del_l2_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,
-- 
2.4.0

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

* [dpdk-dev] [PATCH 4/4] doc: extend commands in testpmd and remove related ABI deprecation
  2015-09-22  3:45 [dpdk-dev] [PATCH 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
                   ` (2 preceding siblings ...)
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 3/4] testpmd: extend commands Jingjing Wu
@ 2015-09-22  3:45 ` Jingjing Wu
  2015-10-27  7:54   ` Zhang, Helin
  2015-10-28  8:41 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
  4 siblings, 1 reply; 33+ messages in thread
From: Jingjing Wu @ 2015-09-22  3:45 UTC (permalink / raw)
  To: dev

Modify the doc about flow director commands to support filtering in VFs.
Remove related ABI deprecation.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 doc/guides/rel_notes/deprecation.rst        |  4 ----
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 ++++++------
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index fffad80..e1a35b9 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -24,10 +24,6 @@ Deprecation Notices
   Structures: rte_fdir_*, rte_eth_fdir.
   Enums: rte_l4type, rte_iptype.
 
-* ABI changes are planned for struct rte_eth_fdir_flow_ext in order to support
-  flow director filtering in VF. The release 2.1 does not contain these ABI
-  changes, but release 2.2 will, and no backwards compatibility is planned.
-
 * ABI changes are planned for struct rte_eth_fdir_filter and
   rte_eth_fdir_masks in order to support new flow director modes,
   MAC VLAN and Cloud, on x550. The MAC VLAN mode means the MAC and
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index aa77a91..9a0d18a 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1624,30 +1624,30 @@ 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)
 
 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)
+ether (ethertype) 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:
 
 .. 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
 ~~~~~~~~~~~~~~~~~~~
-- 
2.4.0

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

* Re: [dpdk-dev] [PATCH 1/4] ethdev: extend struct to support flow director in VFs
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 1/4] ethdev: extend struct to support flow director in VFs Jingjing Wu
@ 2015-10-27  7:52   ` Zhang, Helin
  0 siblings, 0 replies; 33+ messages in thread
From: Zhang, Helin @ 2015-10-27  7:52 UTC (permalink / raw)
  To: Wu, Jingjing, dev



> -----Original Message-----
> From: Wu, Jingjing
> Sent: Tuesday, September 22, 2015 11:46 AM
> To: dev@dpdk.org
> Cc: Wu, Jingjing; Zhang, Helin; Lu, Wenzhuo; Xu, HuilongX
> Subject: [PATCH 1/4] ethdev: extend struct to support flow director in VFs
> 
> This patch extends struct rte_eth_fdir_flow_ext to support flow director in VFs.
> 
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

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

* Re: [dpdk-dev] [PATCH 2/4] i40e: extend flow diretcor to support filtering in VFs
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 2/4] i40e: extend flow diretcor to support filtering " Jingjing Wu
@ 2015-10-27  7:52   ` Zhang, Helin
  0 siblings, 0 replies; 33+ messages in thread
From: Zhang, Helin @ 2015-10-27  7:52 UTC (permalink / raw)
  To: Wu, Jingjing, dev



> -----Original Message-----
> From: Wu, Jingjing
> Sent: Tuesday, September 22, 2015 11:46 AM
> To: dev@dpdk.org
> Cc: Wu, Jingjing; Zhang, Helin; Lu, Wenzhuo; Xu, HuilongX
> Subject: [PATCH 2/4] i40e: extend flow diretcor to support filtering in VFs
> 
> This patch extends flow director to filtering in VFs.
> It also corrects to disable interrupt on queues when stop device.
> 
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

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

* Re: [dpdk-dev] [PATCH 3/4] testpmd: extend commands
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 3/4] testpmd: extend commands Jingjing Wu
@ 2015-10-27  7:53   ` Zhang, Helin
  0 siblings, 0 replies; 33+ messages in thread
From: Zhang, Helin @ 2015-10-27  7:53 UTC (permalink / raw)
  To: Wu, Jingjing, dev



> -----Original Message-----
> From: Wu, Jingjing
> Sent: Tuesday, September 22, 2015 11:46 AM
> To: dev@dpdk.org
> Cc: Wu, Jingjing; Zhang, Helin; Lu, Wenzhuo; Xu, HuilongX
> Subject: [PATCH 3/4] testpmd: extend commands
> 
> This patch extends commands to support filtering in VFs of flow director.
> 
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

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

* Re: [dpdk-dev] [PATCH 4/4] doc: extend commands in testpmd and remove related ABI deprecation
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 4/4] doc: extend commands in testpmd and remove related ABI deprecation Jingjing Wu
@ 2015-10-27  7:54   ` Zhang, Helin
  2015-10-27  9:35     ` Thomas Monjalon
  0 siblings, 1 reply; 33+ messages in thread
From: Zhang, Helin @ 2015-10-27  7:54 UTC (permalink / raw)
  To: Wu, Jingjing, dev

I am not sure if doc udpated here is what we expected or not.
Any guidance on this from ABI experts?

Regards,
Helin

> -----Original Message-----
> From: Wu, Jingjing
> Sent: Tuesday, September 22, 2015 11:46 AM
> To: dev@dpdk.org
> Cc: Wu, Jingjing; Zhang, Helin; Lu, Wenzhuo; Xu, HuilongX
> Subject: [PATCH 4/4] doc: extend commands in testpmd and remove related ABI
> deprecation
> 
> Modify the doc about flow director commands to support filtering in VFs.
> Remove related ABI deprecation.
> 
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
> ---
>  doc/guides/rel_notes/deprecation.rst        |  4 ----
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 ++++++------
>  2 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/deprecation.rst
> b/doc/guides/rel_notes/deprecation.rst
> index fffad80..e1a35b9 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -24,10 +24,6 @@ Deprecation Notices
>    Structures: rte_fdir_*, rte_eth_fdir.
>    Enums: rte_l4type, rte_iptype.
> 
> -* ABI changes are planned for struct rte_eth_fdir_flow_ext in order to support
> -  flow director filtering in VF. The release 2.1 does not contain these ABI
> -  changes, but release 2.2 will, and no backwards compatibility is planned.
> -
>  * ABI changes are planned for struct rte_eth_fdir_filter and
>    rte_eth_fdir_masks in order to support new flow director modes,
>    MAC VLAN and Cloud, on x550. The MAC VLAN mode means the MAC and
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index aa77a91..9a0d18a 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -1624,30 +1624,30 @@ 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)
> 
>  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)
> +ether (ethertype) 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:
> 
>  .. 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
>  ~~~~~~~~~~~~~~~~~~~
> --
> 2.4.0

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

* Re: [dpdk-dev] [PATCH 4/4] doc: extend commands in testpmd and remove related ABI deprecation
  2015-10-27  7:54   ` Zhang, Helin
@ 2015-10-27  9:35     ` Thomas Monjalon
  2015-10-28  2:06       ` Wu, Jingjing
  0 siblings, 1 reply; 33+ messages in thread
From: Thomas Monjalon @ 2015-10-27  9:35 UTC (permalink / raw)
  To: Zhang, Helin; +Cc: dev

2015-10-27 07:54, Zhang, Helin:
> I am not sure if doc udpated here is what we expected or not.
> Any guidance on this from ABI experts?
[...]
> >  doc/guides/rel_notes/deprecation.rst        |  4 ----
> >  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 ++++++------

The deprecation should be removed in the patch changing the code.
And the release notes must be updated at the same time.
Thanks for the catch Helin.

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

* Re: [dpdk-dev] [PATCH 4/4] doc: extend commands in testpmd and remove related ABI deprecation
  2015-10-27  9:35     ` Thomas Monjalon
@ 2015-10-28  2:06       ` Wu, Jingjing
  0 siblings, 0 replies; 33+ messages in thread
From: Wu, Jingjing @ 2015-10-28  2:06 UTC (permalink / raw)
  To: Thomas Monjalon, Zhang, Helin; +Cc: dev

Thanks helin and Thomas
I will update the release notes too.

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, October 27, 2015 5:36 PM
> To: Zhang, Helin
> Cc: dev@dpdk.org; Wu, Jingjing
> Subject: Re: [dpdk-dev] [PATCH 4/4] doc: extend commands in testpmd and
> remove related ABI deprecation
> 
> 2015-10-27 07:54, Zhang, Helin:
> > I am not sure if doc udpated here is what we expected or not.
> > Any guidance on this from ABI experts?
> [...]
> > >  doc/guides/rel_notes/deprecation.rst        |  4 ----
> > >  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 ++++++------
> 
> The deprecation should be removed in the patch changing the code.
> And the release notes must be updated at the same time.
> Thanks for the catch Helin.

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

* [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver
  2015-09-22  3:45 [dpdk-dev] [PATCH 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
                   ` (3 preceding siblings ...)
  2015-09-22  3:45 ` [dpdk-dev] [PATCH 4/4] doc: extend commands in testpmd and remove related ABI deprecation Jingjing Wu
@ 2015-10-28  8:41 ` Jingjing Wu
  2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 1/4] ethdev: extend struct to support flow director in VFs Jingjing Wu
                     ` (5 more replies)
  4 siblings, 6 replies; 33+ messages in thread
From: Jingjing Wu @ 2015-10-28  8:41 UTC (permalink / raw)
  To: dev; +Cc: yulong.pei

This patch set extends flow director to VF filtering in i40e driver.

v2 change:
 - rework the doc, including release notes and testpmd guide

Jingjing Wu (4):
  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 and remove related ABI deprecation

 app/test-pmd/cmdline.c                      | 41 ++++++++++++++++++++++++++---
 doc/guides/rel_notes/deprecation.rst        |  4 ---
 doc/guides/rel_notes/release_2_2.rst        |  2 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++++++-----
 drivers/net/i40e/i40e_ethdev.c              |  4 +--
 drivers/net/i40e/i40e_fdir.c                | 15 ++++++++---
 lib/librte_ether/rte_eth_ctrl.h             |  2 ++
 7 files changed, 64 insertions(+), 19 deletions(-)

-- 
2.4.0

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

* [dpdk-dev] [PATCH v2 1/4] ethdev: extend struct to support flow director in VFs
  2015-10-28  8:41 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
@ 2015-10-28  8:41   ` Jingjing Wu
  2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 2/4] i40e: extend flow diretcor to support filtering " Jingjing Wu
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 33+ messages in thread
From: Jingjing Wu @ 2015-10-28  8:41 UTC (permalink / raw)
  To: dev; +Cc: yulong.pei

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 26b7b33..403e6b8 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -398,6 +398,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*/
 };
 
 /**
-- 
2.4.0

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

* [dpdk-dev] [PATCH v2 2/4] i40e: extend flow diretcor to support filtering in VFs
  2015-10-28  8:41 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
  2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 1/4] ethdev: extend struct to support flow director in VFs Jingjing Wu
@ 2015-10-28  8:41   ` Jingjing Wu
  2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 3/4] testpmd: extend commands Jingjing Wu
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 33+ messages in thread
From: Jingjing Wu @ 2015-10-28  8:41 UTC (permalink / raw)
  To: dev; +Cc: yulong.pei

This patch extends flow director to filtering in VFs.
It also corrects to disable interrupt on queues when stop device.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_fdir.c   | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2dd9fdc..b3207e3 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1031,8 +1031,8 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	}
 
 	if (pf->fdir.fdir_vsi) {
-		i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi);
-		i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
+		i40e_vsi_queues_unbind_intr(pf->fdir.fdir_vsi);
+		i40e_vsi_disable_queues_intr(pf->fdir.fdir_vsi);
 	}
 	/* Clear all queues and release memory */
 	i40e_dev_clear_queues(dev);
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index c9ce98f..73a69c9 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1022,6 +1022,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);
 
@@ -1061,7 +1066,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.");
@@ -1083,9 +1088,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);
 
-- 
2.4.0

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

* [dpdk-dev] [PATCH v2 3/4] testpmd: extend commands
  2015-10-28  8:41 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
  2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 1/4] ethdev: extend struct to support flow director in VFs Jingjing Wu
  2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 2/4] i40e: extend flow diretcor to support filtering " Jingjing Wu
@ 2015-10-28  8:41   ` Jingjing Wu
  2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 4/4] doc: extend commands in testpmd and update release note Jingjing Wu
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 33+ messages in thread
From: Jingjing Wu @ 2015-10-28  8:41 UTC (permalink / raw)
  To: dev; +Cc: yulong.pei

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

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

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0f8f48f..22476f5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -631,7 +631,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)"
@@ -639,7 +640,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)"
@@ -648,13 +650,13 @@ 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)"
-			" 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 l2 payload type flow director filter.\n\n"
 
 			"flush_flow_director (port_id)\n"
@@ -7742,6 +7744,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;
@@ -7848,6 +7851,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);
@@ -7941,6 +7946,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;
@@ -8020,6 +8046,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");
@@ -8052,6 +8081,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,
@@ -8081,6 +8111,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,
@@ -8112,6 +8143,7 @@ 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,
@@ -8135,6 +8167,7 @@ cmdline_parse_inst_t cmd_add_del_l2_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,
-- 
2.4.0

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

* [dpdk-dev] [PATCH v2 4/4] doc: extend commands in testpmd and update release note
  2015-10-28  8:41 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
                     ` (2 preceding siblings ...)
  2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 3/4] testpmd: extend commands Jingjing Wu
@ 2015-10-28  8:41   ` Jingjing Wu
  2015-10-30  7:42   ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Zhang, Helin
  2015-10-31 16:24   ` [dpdk-dev] [PATCH v3 0/3] " Jingjing Wu
  5 siblings, 0 replies; 33+ messages in thread
From: Jingjing Wu @ 2015-10-28  8:41 UTC (permalink / raw)
  To: dev; +Cc: yulong.pei

Modify the doc about flow director commands to support filtering in VFs.
Remove related ABI deprecation.
update release note.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 doc/guides/rel_notes/deprecation.rst        |  4 ----
 doc/guides/rel_notes/release_2_2.rst        |  2 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 +++++++++------
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index a391ff0..cd2b80c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -17,10 +17,6 @@ Deprecation Notices
   imissed, ibadcrc, ibadlen, imcasts, fdirmatch, fdirmiss,
   tx_pause_xon, rx_pause_xon, tx_pause_xoff, rx_pause_xoff
 
-* ABI changes are planned for struct rte_eth_fdir_flow_ext in order to support
-  flow director filtering in VF. The release 2.1 does not contain these ABI
-  changes, but release 2.2 will, and no backwards compatibility is planned.
-
 * ABI changes are planned for struct rte_eth_fdir_filter and
   rte_eth_fdir_masks in order to support new flow director modes,
   MAC VLAN and Cloud, on x550. The MAC VLAN mode means the MAC and
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index de6916e..d934776 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -124,6 +124,8 @@ ABI Changes
 * librte_cfgfile: Allow longer names and values by increasing the constants
   CFG_NAME_LEN and CFG_VALUE_LEN to 64 and 256 respectively.
 
+* The rte_eth_fdir_flow_ext structure is changed. New fields are added to
+  support flow director filtering in VF.
 
 Shared Library Versions
 -----------------------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 71d831b..eae5249 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1644,14 +1644,16 @@ Different NICs may have different capabilities, command show port fdir (port_id)
                         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)
+                        (drop|fwd) queue pf|vf(vf_id) (queue_id) \
+                        fd_id (fd_id_value)
 
    flow_director_filter (port_id) (add|del|update) \
                         flow (ipv4-sctp|ipv6-sctp) \
@@ -1659,21 +1661,22 @@ Different NICs may have different capabilities, command show port fdir (port_id)
                         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)
+                        pf|vf(vf_id) 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)
+                        (drop|fwd) pf|vf(vf_id) queue (queue_id)
+                        fd_id (fd_id_value)
 
 For example, to add an ipv4-udp flow type filter::
 
    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
+            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::
 
    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
+             dst 2.2.2.5 vlan 0x1 flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
 
 flush_flow_director
 ~~~~~~~~~~~~~~~~~~~
-- 
2.4.0

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

* Re: [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver
  2015-10-28  8:41 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
                     ` (3 preceding siblings ...)
  2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 4/4] doc: extend commands in testpmd and update release note Jingjing Wu
@ 2015-10-30  7:42   ` Zhang, Helin
  2015-10-31 16:24   ` [dpdk-dev] [PATCH v3 0/3] " Jingjing Wu
  5 siblings, 0 replies; 33+ messages in thread
From: Zhang, Helin @ 2015-10-30  7:42 UTC (permalink / raw)
  To: Wu, Jingjing, dev



> -----Original Message-----
> From: Wu, Jingjing
> Sent: Wednesday, October 28, 2015 4:41 PM
> To: dev@dpdk.org
> Cc: Wu, Jingjing; Zhang, Helin; Pei, Yulong
> Subject: [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver
> 
> This patch set extends flow director to VF filtering in i40e driver.
> 
> v2 change:
>  - rework the doc, including release notes and testpmd guide
> 
> Jingjing Wu (4):
>   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 and remove related ABI deprecation
> 
>  app/test-pmd/cmdline.c                      | 41
> ++++++++++++++++++++++++++---
>  doc/guides/rel_notes/deprecation.rst        |  4 ---
>  doc/guides/rel_notes/release_2_2.rst        |  2 ++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++++++-----
>  drivers/net/i40e/i40e_ethdev.c              |  4 +--
>  drivers/net/i40e/i40e_fdir.c                | 15 ++++++++---
>  lib/librte_ether/rte_eth_ctrl.h             |  2 ++
>  7 files changed, 64 insertions(+), 19 deletions(-)
> 
> --
> 2.4.0

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

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

* [dpdk-dev] [PATCH v3 0/3] extend flow director to support VF filtering in i40e driver
  2015-10-28  8:41 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
                     ` (4 preceding siblings ...)
  2015-10-30  7:42   ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Zhang, Helin
@ 2015-10-31 16:24   ` Jingjing Wu
  2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs Jingjing Wu
                       ` (4 more replies)
  5 siblings, 5 replies; 33+ messages in thread
From: Jingjing Wu @ 2015-10-31 16:24 UTC (permalink / raw)
  To: dev

This patch set extends flow director to VF filtering in i40e driver.

v2 change:
 - rework the doc, including release notes and testpmd guide

v3 change:
 - rebase doc update to the same commit with code change

Jingjing Wu (3):
  ethdev: extend struct to support flow director in VFs
  i40e: extend flow diretcor to support filtering in VFs
  testpmd: extend commands

 app/test-pmd/cmdline.c                      | 41 ++++++++++++++++++++++++++---
 doc/guides/rel_notes/deprecation.rst        |  4 ---
 doc/guides/rel_notes/release_2_2.rst        |  5 ++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++++++-----
 drivers/net/i40e/i40e_ethdev.c              |  4 +--
 drivers/net/i40e/i40e_fdir.c                | 15 ++++++++---
 lib/librte_ether/rte_eth_ctrl.h             |  2 ++
 7 files changed, 67 insertions(+), 19 deletions(-)

-- 
2.4.0

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

* [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs
  2015-10-31 16:24   ` [dpdk-dev] [PATCH v3 0/3] " Jingjing Wu
@ 2015-10-31 16:24     ` Jingjing Wu
  2015-11-01 14:27       ` Thomas Monjalon
  2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 2/3] i40e: extend flow diretcor to support filtering " Jingjing Wu
                       ` (3 subsequent siblings)
  4 siblings, 1 reply; 33+ messages in thread
From: Jingjing Wu @ 2015-10-31 16:24 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>
---
 doc/guides/rel_notes/deprecation.rst | 4 ----
 doc/guides/rel_notes/release_2_2.rst | 3 +++
 lib/librte_ether/rte_eth_ctrl.h      | 2 ++
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index a391ff0..cd2b80c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -17,10 +17,6 @@ Deprecation Notices
   imissed, ibadcrc, ibadlen, imcasts, fdirmatch, fdirmiss,
   tx_pause_xon, rx_pause_xon, tx_pause_xoff, rx_pause_xoff
 
-* ABI changes are planned for struct rte_eth_fdir_flow_ext in order to support
-  flow director filtering in VF. The release 2.1 does not contain these ABI
-  changes, but release 2.2 will, and no backwards compatibility is planned.
-
 * ABI changes are planned for struct rte_eth_fdir_filter and
   rte_eth_fdir_masks in order to support new flow director modes,
   MAC VLAN and Cloud, on x550. The MAC VLAN mode means the MAC and
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index 116162e..8ca3872 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -164,6 +164,9 @@ ABI Changes
 * librte_cfgfile: Allow longer names and values by increasing the constants
   CFG_NAME_LEN and CFG_VALUE_LEN to 64 and 256 respectively.
 
+* The rte_eth_fdir_flow_ext structure is changed. New fields are added to
+  support flow director filtering in VF.
+
 
 Shared Library Versions
 -----------------------
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 770c76c..3f86094 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -426,6 +426,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*/
 };
 
 /**
-- 
2.4.0

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

* [dpdk-dev] [PATCH v3 2/3] i40e: extend flow diretcor to support filtering in VFs
  2015-10-31 16:24   ` [dpdk-dev] [PATCH v3 0/3] " Jingjing Wu
  2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs Jingjing Wu
@ 2015-10-31 16:24     ` Jingjing Wu
  2015-11-01 14:28       ` Thomas Monjalon
  2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 3/3] testpmd: extend commands Jingjing Wu
                       ` (2 subsequent siblings)
  4 siblings, 1 reply; 33+ messages in thread
From: Jingjing Wu @ 2015-10-31 16:24 UTC (permalink / raw)
  To: dev

This patch extends flow director to filtering in VFs.
It also corrects to disable interrupt on queues when stop device.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 doc/guides/rel_notes/release_2_2.rst |  2 ++
 drivers/net/i40e/i40e_ethdev.c       |  4 ++--
 drivers/net/i40e/i40e_fdir.c         | 15 ++++++++++++---
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index 8ca3872..908be5c 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -22,6 +22,8 @@ New Features
 
 * **Added i40e flow control support.**
 
+* **Added i40e flow director support in VF.**
+
 * **Added fm10k TSO support for both PF and VF.**
 
 * **New NIC Boulder Rapid support.**
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 016838a..b69c689 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1095,8 +1095,8 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 	}
 
 	if (pf->fdir.fdir_vsi) {
-		i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi);
-		i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
+		i40e_vsi_queues_unbind_intr(pf->fdir.fdir_vsi);
+		i40e_vsi_disable_queues_intr(pf->fdir.fdir_vsi);
 	}
 	/* Clear all queues and release memory */
 	i40e_dev_clear_queues(dev);
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index c9ce98f..73a69c9 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1022,6 +1022,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);
 
@@ -1061,7 +1066,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.");
@@ -1083,9 +1088,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);
 
-- 
2.4.0

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

* [dpdk-dev] [PATCH v3 3/3] testpmd: extend commands
  2015-10-31 16:24   ` [dpdk-dev] [PATCH v3 0/3] " Jingjing Wu
  2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs Jingjing Wu
  2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 2/3] i40e: extend flow diretcor to support filtering " Jingjing Wu
@ 2015-10-31 16:24     ` Jingjing Wu
  2015-11-01 14:45       ` Thomas Monjalon
  2015-11-01 14:22     ` [dpdk-dev] [PATCH v3 0/3] extend flow director to support VF filtering in i40e driver Thomas Monjalon
  2015-11-04  3:29     ` [dpdk-dev] [PATCH v4 0/3] extend flow drector " Jingjing Wu
  4 siblings, 1 reply; 33+ messages in thread
From: Jingjing Wu @ 2015-10-31 16:24 UTC (permalink / raw)
  To: dev

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

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 app/test-pmd/cmdline.c                      | 41 ++++++++++++++++++++++++++---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++++++-----
 2 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b3c36f3..7824d5c 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -631,7 +631,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)"
@@ -639,7 +640,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)"
@@ -648,13 +650,13 @@ 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)"
-			" 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 l2 payload type flow director filter.\n\n"
 
 			"flush_flow_director (port_id)\n"
@@ -7744,6 +7746,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;
@@ -7876,6 +7879,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);
@@ -8002,6 +8007,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;
@@ -8081,6 +8107,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");
@@ -8146,6 +8175,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,
@@ -8177,6 +8207,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,
@@ -8210,6 +8241,7 @@ 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,
@@ -8235,6 +8267,7 @@ cmdline_parse_inst_t cmd_add_del_l2_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,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 71d831b..eae5249 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1644,14 +1644,16 @@ Different NICs may have different capabilities, command show port fdir (port_id)
                         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)
+                        (drop|fwd) queue pf|vf(vf_id) (queue_id) \
+                        fd_id (fd_id_value)
 
    flow_director_filter (port_id) (add|del|update) \
                         flow (ipv4-sctp|ipv6-sctp) \
@@ -1659,21 +1661,22 @@ Different NICs may have different capabilities, command show port fdir (port_id)
                         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)
+                        pf|vf(vf_id) 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)
+                        (drop|fwd) pf|vf(vf_id) queue (queue_id)
+                        fd_id (fd_id_value)
 
 For example, to add an ipv4-udp flow type filter::
 
    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
+            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::
 
    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
+             dst 2.2.2.5 vlan 0x1 flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
 
 flush_flow_director
 ~~~~~~~~~~~~~~~~~~~
-- 
2.4.0

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

* Re: [dpdk-dev] [PATCH v3 0/3] extend flow director to support VF filtering in i40e driver
  2015-10-31 16:24   ` [dpdk-dev] [PATCH v3 0/3] " Jingjing Wu
                       ` (2 preceding siblings ...)
  2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 3/3] testpmd: extend commands Jingjing Wu
@ 2015-11-01 14:22     ` Thomas Monjalon
  2015-11-04  3:29     ` [dpdk-dev] [PATCH v4 0/3] extend flow drector " Jingjing Wu
  4 siblings, 0 replies; 33+ messages in thread
From: Thomas Monjalon @ 2015-11-01 14:22 UTC (permalink / raw)
  To: Jingjing Wu; +Cc: dev

2015-11-01 00:24, Jingjing Wu:
> This patch set extends flow director to VF filtering in i40e driver.
> 
> v2 change:
>  - rework the doc, including release notes and testpmd guide
> 
> v3 change:
>  - rebase doc update to the same commit with code change
> 
> Jingjing Wu (3):
>   ethdev: extend struct to support flow director in VFs
>   i40e: extend flow diretcor to support filtering in VFs
>   testpmd: extend commands
> 
>  app/test-pmd/cmdline.c                      | 41 ++++++++++++++++++++++++++---
>  doc/guides/rel_notes/deprecation.rst        |  4 ---
>  doc/guides/rel_notes/release_2_2.rst        |  5 ++++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++++++-----
>  drivers/net/i40e/i40e_ethdev.c              |  4 +--
>  drivers/net/i40e/i40e_fdir.c                | 15 ++++++++---
>  lib/librte_ether/rte_eth_ctrl.h             |  2 ++

It is a perfect example of how docs must be updated with the code changes.
Unfortunately, I have some comments in the API.

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

* Re: [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs
  2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs Jingjing Wu
@ 2015-11-01 14:27       ` Thomas Monjalon
  2015-11-01 14:33         ` Wu, Jingjing
  0 siblings, 1 reply; 33+ messages in thread
From: Thomas Monjalon @ 2015-11-01 14:27 UTC (permalink / raw)
  To: Jingjing Wu; +Cc: dev

2015-11-01 00:24, Jingjing Wu:
> This patch extends struct rte_eth_fdir_flow_ext to support flow
> director in VFs.
[...]
> --- a/lib/librte_ether/rte_eth_ctrl.h
> +++ b/lib/librte_ether/rte_eth_ctrl.h
> @@ -426,6 +426,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*/
>  };

Why adding these parameters in an input struct?
Shouldn't it be in rte_eth_fdir_action along with rx_queue?

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

* Re: [dpdk-dev] [PATCH v3 2/3] i40e: extend flow diretcor to support filtering in VFs
  2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 2/3] i40e: extend flow diretcor to support filtering " Jingjing Wu
@ 2015-11-01 14:28       ` Thomas Monjalon
  0 siblings, 0 replies; 33+ messages in thread
From: Thomas Monjalon @ 2015-11-01 14:28 UTC (permalink / raw)
  To: Jingjing Wu; +Cc: dev

2015-11-01 00:24, Jingjing Wu:
> This patch extends flow director to filtering in VFs.
> It also corrects to disable interrupt on queues when stop device.

It should be in a separate patch.

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

* Re: [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs
  2015-11-01 14:27       ` Thomas Monjalon
@ 2015-11-01 14:33         ` Wu, Jingjing
  2015-11-01 14:55           ` Thomas Monjalon
  0 siblings, 1 reply; 33+ messages in thread
From: Wu, Jingjing @ 2015-11-01 14:33 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

Hi, Thomas


> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Sunday, November 1, 2015 10:28 PM
> To: Wu, Jingjing
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs
> 
> 2015-11-01 00:24, Jingjing Wu:
> > This patch extends struct rte_eth_fdir_flow_ext to support flow
> > director in VFs.
> [...]
> > --- a/lib/librte_ether/rte_eth_ctrl.h
> > +++ b/lib/librte_ether/rte_eth_ctrl.h
> > @@ -426,6 +426,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*/
> >  };
> 
> Why adding these parameters in an input struct?
> Shouldn't it be in rte_eth_fdir_action along with rx_queue?
Thanks for your comments. The reason of adding these in input is because this is input but not action.
The patch is to support Flow director works in VF, then direct packets to the rx_queue (belong this vf) 
which defined in action, but not direct packets to VF.

Thanks
Jingjing

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

* Re: [dpdk-dev] [PATCH v3 3/3] testpmd: extend commands
  2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 3/3] testpmd: extend commands Jingjing Wu
@ 2015-11-01 14:45       ` Thomas Monjalon
  0 siblings, 0 replies; 33+ messages in thread
From: Thomas Monjalon @ 2015-11-01 14:45 UTC (permalink / raw)
  To: Jingjing Wu; +Cc: dev

2015-11-01 00:24, Jingjing Wu:
> This patch extends commands to support filtering in VFs of flow director.
[...]
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> -			" (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"

Is it possible to avoid setting "pf" and make it an implicit default?

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

* Re: [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs
  2015-11-01 14:33         ` Wu, Jingjing
@ 2015-11-01 14:55           ` Thomas Monjalon
  2015-11-02  5:24             ` Wu, Jingjing
  0 siblings, 1 reply; 33+ messages in thread
From: Thomas Monjalon @ 2015-11-01 14:55 UTC (permalink / raw)
  To: Wu, Jingjing; +Cc: dev

2015-11-01 14:33, Wu, Jingjing:
> Hi, Thomas
> 
> 
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > Sent: Sunday, November 1, 2015 10:28 PM
> > To: Wu, Jingjing
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs
> > 
> > 2015-11-01 00:24, Jingjing Wu:
> > > This patch extends struct rte_eth_fdir_flow_ext to support flow
> > > director in VFs.
> > [...]
> > > --- a/lib/librte_ether/rte_eth_ctrl.h
> > > +++ b/lib/librte_ether/rte_eth_ctrl.h
> > > @@ -426,6 +426,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*/
> > >  };
> > 
> > Why adding these parameters in an input struct?
> > Shouldn't it be in rte_eth_fdir_action along with rx_queue?
> Thanks for your comments. The reason of adding these in input is because this is input but not action.
> The patch is to support Flow director works in VF, then direct packets to the rx_queue (belong this vf) 
> which defined in action, but not direct packets to VF.

Oh!
>From the VM, using
rte_eth_dev_filter_ctrl(port_id, filter_type, filter_op, arg)
it can be deduced from the VF device, no?
Is the use case to define a VF flow director outside of the VM?

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

* Re: [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs
  2015-11-01 14:55           ` Thomas Monjalon
@ 2015-11-02  5:24             ` Wu, Jingjing
  0 siblings, 0 replies; 33+ messages in thread
From: Wu, Jingjing @ 2015-11-02  5:24 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

> 
> Oh!
> From the VM, using
> rte_eth_dev_filter_ctrl(port_id, filter_type, filter_op, arg)
> it can be deduced from the VF device, no?
> Is the use case to define a VF flow director outside of the VM?

Yes, if VM can configure through rte_eth_dev_filter_ctrl, it will be better.
But flow director can only be programed on PF, and currently there is no such
virtual channel between PF and VF in share code. Due to the principle aligned
with i40e kernel driver develop, we cannot add new virtual channel by ourselves.
So I did it this way on DPDK when DPDK using as PF driver.

Thanks
Jingjing

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

* [dpdk-dev] [PATCH v4 0/3] extend flow drector to support VF filtering in i40e driver
  2015-10-31 16:24   ` [dpdk-dev] [PATCH v3 0/3] " Jingjing Wu
                       ` (3 preceding siblings ...)
  2015-11-01 14:22     ` [dpdk-dev] [PATCH v3 0/3] extend flow director to support VF filtering in i40e driver Thomas Monjalon
@ 2015-11-04  3:29     ` Jingjing Wu
  2015-11-04  3:29       ` [dpdk-dev] [PATCH v4 1/3] ethdev: extend struct to support flow director in VFs Jingjing Wu
                         ` (3 more replies)
  4 siblings, 4 replies; 33+ messages in thread
From: Jingjing Wu @ 2015-11-04  3:29 UTC (permalink / raw)
  To: dev

This patch set extends flow director to VF filtering in i40e driver.

v2 change:
 - rework the doc, including release notes and testpmd guide

v3 change:
 - rebase doc update to the same commit with code change

v4 change:
 - remove the fix of disable interrupt on queues when stop device
   from this patch set

Jingjing Wu (3):
  ethdev: extend struct to support flow director in VFs
  i40e: extend flow diretcor to support filtering in VFs
  testpmd: extend commands

 app/test-pmd/cmdline.c                      | 41 ++++++++++++++++++++++++++---
 doc/guides/rel_notes/deprecation.rst        |  4 ---
 doc/guides/rel_notes/release_2_2.rst        |  5 ++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++++++-----
 drivers/net/i40e/i40e_fdir.c                | 15 ++++++++---
 lib/librte_ether/rte_eth_ctrl.h             |  2 ++
 6 files changed, 65 insertions(+), 17 deletions(-)

-- 
2.4.0

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

* [dpdk-dev] [PATCH v4 1/3] ethdev: extend struct to support flow director in VFs
  2015-11-04  3:29     ` [dpdk-dev] [PATCH v4 0/3] extend flow drector " Jingjing Wu
@ 2015-11-04  3:29       ` Jingjing Wu
  2015-11-04  3:29       ` [dpdk-dev] [PATCH v4 2/3] i40e: extend flow diretcor to support filtering " Jingjing Wu
                         ` (2 subsequent siblings)
  3 siblings, 0 replies; 33+ messages in thread
From: Jingjing Wu @ 2015-11-04  3:29 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>
---
 doc/guides/rel_notes/deprecation.rst | 4 ----
 doc/guides/rel_notes/release_2_2.rst | 3 +++
 lib/librte_ether/rte_eth_ctrl.h      | 2 ++
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 730c3b7..9fdd25c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -12,10 +12,6 @@ Deprecation Notices
   ibadcrc, ibadlen, imcasts, fdirmatch, fdirmiss,
   tx_pause_xon, rx_pause_xon, tx_pause_xoff, rx_pause_xoff
 
-* ABI changes are planned for struct rte_eth_fdir_flow_ext in order to support
-  flow director filtering in VF. The release 2.1 does not contain these ABI
-  changes, but release 2.2 will, and no backwards compatibility is planned.
-
 * ABI changes are planned for struct rte_eth_fdir_filter and
   rte_eth_fdir_masks in order to support new flow director modes,
   MAC VLAN and Cloud, on x550. The MAC VLAN mode means the MAC and
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index ca8471b..7d2c2bb 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -240,6 +240,9 @@ ABI Changes
 * librte_cfgfile: Allow longer names and values by increasing the constants
   CFG_NAME_LEN and CFG_VALUE_LEN to 64 and 256 respectively.
 
+* The rte_eth_fdir_flow_ext structure is changed. New fields are added to
+  support flow director filtering in VF.
+
 
 Shared Library Versions
 -----------------------
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index f71669c..228183e 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -523,6 +523,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*/
 };
 
 /**
-- 
2.4.0

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

* [dpdk-dev] [PATCH v4 2/3] i40e: extend flow diretcor to support filtering in VFs
  2015-11-04  3:29     ` [dpdk-dev] [PATCH v4 0/3] extend flow drector " Jingjing Wu
  2015-11-04  3:29       ` [dpdk-dev] [PATCH v4 1/3] ethdev: extend struct to support flow director in VFs Jingjing Wu
@ 2015-11-04  3:29       ` Jingjing Wu
  2015-11-04  3:29       ` [dpdk-dev] [PATCH v4 3/3] testpmd: extend commands Jingjing Wu
  2015-11-04 12:41       ` [dpdk-dev] [PATCH v4 0/3] extend flow drector to support VF filtering in i40e driver Thomas Monjalon
  3 siblings, 0 replies; 33+ messages in thread
From: Jingjing Wu @ 2015-11-04  3:29 UTC (permalink / raw)
  To: dev

This patch extends flow director to filtering in VFs.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 doc/guides/rel_notes/release_2_2.rst |  2 ++
 drivers/net/i40e/i40e_fdir.c         | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index 7d2c2bb..69b3d9a 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -57,6 +57,8 @@ New Features
 
 * **Added fm10k vector RX/TX.**
 
+* **Added i40e flow director support in VF.**
+
 * **Added fm10k TSO support for both PF and VF.**
 
 * **Added fm10k VMDQ support.**
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index ba18c9d..0b45bd9 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1022,6 +1022,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);
 
@@ -1061,7 +1066,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.");
@@ -1083,9 +1088,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);
 
-- 
2.4.0

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

* [dpdk-dev] [PATCH v4 3/3] testpmd: extend commands
  2015-11-04  3:29     ` [dpdk-dev] [PATCH v4 0/3] extend flow drector " Jingjing Wu
  2015-11-04  3:29       ` [dpdk-dev] [PATCH v4 1/3] ethdev: extend struct to support flow director in VFs Jingjing Wu
  2015-11-04  3:29       ` [dpdk-dev] [PATCH v4 2/3] i40e: extend flow diretcor to support filtering " Jingjing Wu
@ 2015-11-04  3:29       ` Jingjing Wu
  2015-11-04 12:41       ` [dpdk-dev] [PATCH v4 0/3] extend flow drector to support VF filtering in i40e driver Thomas Monjalon
  3 siblings, 0 replies; 33+ messages in thread
From: Jingjing Wu @ 2015-11-04  3:29 UTC (permalink / raw)
  To: dev

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

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 app/test-pmd/cmdline.c                      | 41 ++++++++++++++++++++++++++---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++++++-----
 2 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 1018379..c637198 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -633,7 +633,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)"
@@ -641,7 +642,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)"
@@ -650,13 +652,13 @@ 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)"
-			" 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 l2 payload type flow director filter.\n\n"
 
 			"flush_flow_director (port_id)\n"
@@ -7911,6 +7913,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;
@@ -8043,6 +8046,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);
@@ -8169,6 +8174,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;
@@ -8248,6 +8274,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");
@@ -8313,6 +8342,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,
@@ -8344,6 +8374,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,
@@ -8377,6 +8408,7 @@ 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,
@@ -8402,6 +8434,7 @@ cmdline_parse_inst_t cmd_add_del_l2_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,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 957f889..4fb1e0b 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1646,14 +1646,16 @@ Different NICs may have different capabilities, command show port fdir (port_id)
                         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)
+                        (drop|fwd) queue pf|vf(vf_id) (queue_id) \
+                        fd_id (fd_id_value)
 
    flow_director_filter (port_id) (add|del|update) \
                         flow (ipv4-sctp|ipv6-sctp) \
@@ -1661,21 +1663,22 @@ Different NICs may have different capabilities, command show port fdir (port_id)
                         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)
+                        pf|vf(vf_id) 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)
+                        (drop|fwd) pf|vf(vf_id) queue (queue_id)
+                        fd_id (fd_id_value)
 
 For example, to add an ipv4-udp flow type filter::
 
    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
+            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::
 
    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
+             dst 2.2.2.5 vlan 0x1 flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
 
 flush_flow_director
 ~~~~~~~~~~~~~~~~~~~
-- 
2.4.0

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

* Re: [dpdk-dev] [PATCH v4 0/3] extend flow drector to support VF filtering in i40e driver
  2015-11-04  3:29     ` [dpdk-dev] [PATCH v4 0/3] extend flow drector " Jingjing Wu
                         ` (2 preceding siblings ...)
  2015-11-04  3:29       ` [dpdk-dev] [PATCH v4 3/3] testpmd: extend commands Jingjing Wu
@ 2015-11-04 12:41       ` Thomas Monjalon
  3 siblings, 0 replies; 33+ messages in thread
From: Thomas Monjalon @ 2015-11-04 12:41 UTC (permalink / raw)
  To: Jingjing Wu; +Cc: dev

2015-11-04 11:29, Jingjing Wu:
> This patch set extends flow director to VF filtering in i40e driver.
> 
> v2 change:
>  - rework the doc, including release notes and testpmd guide
> 
> v3 change:
>  - rebase doc update to the same commit with code change
> 
> v4 change:
>  - remove the fix of disable interrupt on queues when stop device
>    from this patch set
> 
> Jingjing Wu (3):
>   ethdev: extend struct to support flow director in VFs
>   i40e: extend flow diretcor to support filtering in VFs
>   testpmd: extend commands

Applied, thanks

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

end of thread, other threads:[~2015-11-04 12:42 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-22  3:45 [dpdk-dev] [PATCH 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
2015-09-22  3:45 ` [dpdk-dev] [PATCH 1/4] ethdev: extend struct to support flow director in VFs Jingjing Wu
2015-10-27  7:52   ` Zhang, Helin
2015-09-22  3:45 ` [dpdk-dev] [PATCH 2/4] i40e: extend flow diretcor to support filtering " Jingjing Wu
2015-10-27  7:52   ` Zhang, Helin
2015-09-22  3:45 ` [dpdk-dev] [PATCH 3/4] testpmd: extend commands Jingjing Wu
2015-10-27  7:53   ` Zhang, Helin
2015-09-22  3:45 ` [dpdk-dev] [PATCH 4/4] doc: extend commands in testpmd and remove related ABI deprecation Jingjing Wu
2015-10-27  7:54   ` Zhang, Helin
2015-10-27  9:35     ` Thomas Monjalon
2015-10-28  2:06       ` Wu, Jingjing
2015-10-28  8:41 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Jingjing Wu
2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 1/4] ethdev: extend struct to support flow director in VFs Jingjing Wu
2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 2/4] i40e: extend flow diretcor to support filtering " Jingjing Wu
2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 3/4] testpmd: extend commands Jingjing Wu
2015-10-28  8:41   ` [dpdk-dev] [PATCH v2 4/4] doc: extend commands in testpmd and update release note Jingjing Wu
2015-10-30  7:42   ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support VF filtering in i40e driver Zhang, Helin
2015-10-31 16:24   ` [dpdk-dev] [PATCH v3 0/3] " Jingjing Wu
2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs Jingjing Wu
2015-11-01 14:27       ` Thomas Monjalon
2015-11-01 14:33         ` Wu, Jingjing
2015-11-01 14:55           ` Thomas Monjalon
2015-11-02  5:24             ` Wu, Jingjing
2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 2/3] i40e: extend flow diretcor to support filtering " Jingjing Wu
2015-11-01 14:28       ` Thomas Monjalon
2015-10-31 16:24     ` [dpdk-dev] [PATCH v3 3/3] testpmd: extend commands Jingjing Wu
2015-11-01 14:45       ` Thomas Monjalon
2015-11-01 14:22     ` [dpdk-dev] [PATCH v3 0/3] extend flow director to support VF filtering in i40e driver Thomas Monjalon
2015-11-04  3:29     ` [dpdk-dev] [PATCH v4 0/3] extend flow drector " Jingjing Wu
2015-11-04  3:29       ` [dpdk-dev] [PATCH v4 1/3] ethdev: extend struct to support flow director in VFs Jingjing Wu
2015-11-04  3:29       ` [dpdk-dev] [PATCH v4 2/3] i40e: extend flow diretcor to support filtering " Jingjing Wu
2015-11-04  3:29       ` [dpdk-dev] [PATCH v4 3/3] testpmd: extend commands Jingjing Wu
2015-11-04 12:41       ` [dpdk-dev] [PATCH v4 0/3] extend flow drector to support VF filtering in i40e driver 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).