Skip to contentSkip to conversation

extend flow director to support VF filtering in i40e driver

PATCH Superseded Jingjing Wu 3 participants 33 messages Sep 22, 2015 – Nov 4, 2015 Network drivers

lore
Share & tools
lore
#0 lore raw

cover extend flow director to support VF filtering in i40e driver

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(-)
Signature · 1 line
2.4.0
#1 lore raw

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.

---
 lib/librte_ether/rte_eth_ctrl.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_ether/rte_eth_ctrl.h +2 -0
index 26b7b33..403e6b8 100644
@@ -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*/
 };
 
 /**
Signature · 1 line
2.4.0
#3 lore raw

PATCH 2/4 i40e: extend flow diretcor to support filtering in VFs

In reply to Jingjing Wu

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

---
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_fdir.c   | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)
drivers/net/i40e/i40e_ethdev.c +2 -2
index 2dd9fdc..b3207e3 100644
@@ -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);
drivers/net/i40e/i40e_fdir.c +12 -3
index c9ce98f..73a69c9 100644
@@ -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);
 
Signature · 1 line
2.4.0
#5 lore raw

PATCH 3/4 testpmd: extend commands

In reply to Jingjing Wu

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

---
 app/test-pmd/cmdline.c | 41 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +37 -4
index 0f8f48f..22476f5 100644
@@ -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,
Signature · 1 line
2.4.0
#7 lore raw

PATCH 4/4 doc: extend commands in testpmd and remove related ABI deprecation

In reply to Jingjing Wu

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

---
 doc/guides/rel_notes/deprecation.rst        |  4 ----
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 ++++++------
 2 files changed, 6 insertions(+), 10 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
index fffad80..e1a35b9 100644
@@ -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
doc/guides/testpmd_app_ug/testpmd_funcs.rst +6 -6
index aa77a91..9a0d18a 100644
@@ -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
 ~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.4.0
Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] ethdev: extend struct to support flow director in VFs

In reply to Jingjing Wu
Quoted 9 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Tuesday, September 22, 2015 11:46 AM
To: [email protected]
Cc: Wu, Jingjing; Zhang, Helin; Lu, Wenzhuo; Xu, HuilongX
Subject: [PATCH 1/4] ethdev: extend struct to support flow director in VFs

Quoted 3 lines

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

Acked-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] i40e: extend flow diretcor to support filtering in VFs

In reply to Jingjing Wu
Quoted 9 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Tuesday, September 22, 2015 11:46 AM
To: [email protected]
Cc: Wu, Jingjing; Zhang, Helin; Lu, Wenzhuo; Xu, HuilongX
Subject: [PATCH 2/4] i40e: extend flow diretcor to support filtering in VFs

Quoted 4 lines

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

Acked-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] testpmd: extend commands

In reply to Jingjing Wu
Quoted 9 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Tuesday, September 22, 2015 11:46 AM
To: [email protected]
Cc: Wu, Jingjing; Zhang, Helin; Lu, Wenzhuo; Xu, HuilongX
Subject: [PATCH 3/4] testpmd: extend commands

Quoted 3 lines

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

#8 lore raw

Re: [PATCH 4/4] doc: extend commands in testpmd and remove related ABI deprecation

In reply to Jingjing Wu

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

Regards,
Helin

Quoted 90 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Tuesday, September 22, 2015 11:46 AM
To: [email protected]
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.

---
 doc/guides/rel_notes/deprecation.rst        |  4 ----
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 ++++++------
 2 files changed, 6 insertions(+), 10 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
index fffad80..e1a35b9 100644
@@ -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
doc/guides/testpmd_app_ug/testpmd_funcs.rst +5 -3
index aa77a91..9a0d18a 100644
@@ -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)

doc/guides/testpmd_app_ug/testpmd_funcs.rst +2 -1
+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

doc/guides/testpmd_app_ug/testpmd_funcs.rst +2 -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

#9 lore raw

Re: [PATCH 4/4] doc: extend commands in testpmd and remove related ABI deprecation

2015-10-27 07:54, Zhang, Helin:

Quoted 2 lines

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

[...]

Quoted 2 lines
Quoted 2 lines
 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.

#10 lore raw

Re: [PATCH 4/4] doc: extend commands in testpmd and remove related ABI deprecation

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

Quoted 18 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, October 27, 2015 5:36 PM
To: Zhang, Helin
Cc: [email protected]; 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:

Quoted 2 lines

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

[...]

Quoted 2 lines
Quoted 2 lines
 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.

#11 lore raw

v2 cover extend flow director to support VF filtering in i40e driver

In reply to 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

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(-)
Signature · 1 line
2.4.0
#14 lore raw

PATCH v2 3/4 testpmd: extend commands

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

---
 app/test-pmd/cmdline.c | 41 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +37 -4
index 0f8f48f..22476f5 100644
@@ -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,
Signature · 1 line
2.4.0
#12 lore raw

PATCH v2 1/4 ethdev: extend struct to support flow director in VFs

In reply to Jingjing Wu

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

---
 lib/librte_ether/rte_eth_ctrl.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_ether/rte_eth_ctrl.h +2 -0
index 26b7b33..403e6b8 100644
@@ -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*/
 };
 
 /**
Signature · 1 line
2.4.0
#15 lore raw

PATCH v2 4/4 doc: extend commands in testpmd and update release note

In reply to Jingjing Wu

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

---
 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(-)
doc/guides/rel_notes/deprecation.rst +0 -4
index a391ff0..cd2b80c 100644
@@ -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
doc/guides/rel_notes/release_2_2.rst +2 -0
index de6916e..d934776 100644
@@ -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
 -----------------------
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9 -6
index 71d831b..eae5249 100644
@@ -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
 ~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.4.0
#13 lore raw

PATCH v2 2/4 i40e: extend flow diretcor to support filtering in VFs

In reply to Jingjing Wu

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

---
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_fdir.c   | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)
drivers/net/i40e/i40e_ethdev.c +2 -2
index 2dd9fdc..b3207e3 100644
@@ -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);
drivers/net/i40e/i40e_fdir.c +12 -3
index c9ce98f..73a69c9 100644
@@ -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);
 
Signature · 1 line
2.4.0
Acked-by on the v2 series
#16 lore raw
In reply to Jingjing Wu
Quoted 30 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Wednesday, October 28, 2015 4:41 PM
To: [email protected]
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(-)
Quoted 2 lines

--
2.4.0

#17 lore raw

v3 cover extend flow director to support VF filtering in i40e driver

In reply to 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 ++
 7 files changed, 67 insertions(+), 19 deletions(-)
Signature · 1 line
2.4.0
#18 lore raw

PATCH v3 1/3 ethdev: extend struct to support flow director in VFs

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

---
 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(-)
doc/guides/rel_notes/deprecation.rst +0 -4
index a391ff0..cd2b80c 100644
@@ -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
doc/guides/rel_notes/release_2_2.rst +3 -0
index 116162e..8ca3872 100644
@@ -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
 -----------------------
lib/librte_ether/rte_eth_ctrl.h +2 -0
index 770c76c..3f86094 100644
@@ -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*/
 };
 
 /**
Signature · 1 line
2.4.0
#25 lore raw

PATCH v3 3/3 testpmd: extend commands

In reply to Jingjing Wu

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

---
 app/test-pmd/cmdline.c                      | 41 ++++++++++++++++++++++++++---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++++++-----
 2 files changed, 46 insertions(+), 10 deletions(-)
app/test-pmd/cmdline.c +37 -4
index b3c36f3..7824d5c 100644
@@ -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,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9 -6
index 71d831b..eae5249 100644
@@ -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
 ~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.4.0
#23 lore raw

PATCH v3 2/3 i40e: extend flow diretcor to support filtering in VFs

In reply to Jingjing Wu

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

---
 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(-)
doc/guides/rel_notes/release_2_2.rst +2 -0
index 8ca3872..908be5c 100644
@@ -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.**
drivers/net/i40e/i40e_ethdev.c +2 -2
index 016838a..b69c689 100644
@@ -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);
drivers/net/i40e/i40e_fdir.c +12 -3
index c9ce98f..73a69c9 100644
@@ -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);
 
Signature · 1 line
2.4.0
#27 lore raw
In reply to Jingjing Wu

2015-11-01 00:24, Jingjing Wu:

Quoted 13 lines

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

Quoted 7 lines
 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.

#19 lore raw

Re: [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs

In reply to Jingjing Wu

2015-11-01 00:24, Jingjing Wu:

Quoted 2 lines

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

[...]

lib/librte_ether/rte_eth_ctrl.h struct rte_eth_fdir_flow_ext { · line 431

Quoted 9 lines
lib/librte_ether/rte_eth_ctrl.h +2 -0
@@ -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?

#20 lore raw

Re: [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs

Hi, Thomas

Quoted 11 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Sunday, November 1, 2015 10:28 PM
To: Wu, Jingjing
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs

2015-11-01 00:24, Jingjing Wu:

Quoted 2 lines

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

[...]

Quoted 12 lines

lib/librte_ether/rte_eth_ctrl.h struct rte_eth_fdir_flow_ext { · line 431

Quoted 9 lines
lib/librte_ether/rte_eth_ctrl.h +2 -0
@@ -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

#26 lore raw

Re: [PATCH v3 3/3] testpmd: extend commands

In reply to Jingjing Wu

2015-11-01 00:24, Jingjing Wu:

Quoted 1 line

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

[...]

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result, · line 635

Quoted 5 lines
app/test-pmd/cmdline.c +2 -1
-			" (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?

#21 lore raw

Re: [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs

In reply to Wu, Jingjing

2015-11-01 14:33, Wu, Jingjing:

Quoted 26 lines

Hi, Thomas

Quoted 11 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Sunday, November 1, 2015 10:28 PM
To: Wu, Jingjing
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs

2015-11-01 00:24, Jingjing Wu:

Quoted 2 lines

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

[...]

Quoted 12 lines

lib/librte_ether/rte_eth_ctrl.h struct rte_eth_fdir_flow_ext { · line 431

Quoted 9 lines
lib/librte_ether/rte_eth_ctrl.h +2 -0
@@ -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?

Quoted 3 lines

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!

Quoted 1 line

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?

#24 lore raw

Re: [PATCH v3 2/3] i40e: extend flow diretcor to support filtering in VFs

In reply to Jingjing Wu

2015-11-01 00:24, Jingjing Wu:

Quoted 2 lines

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.

#22 lore raw

Re: [PATCH v3 1/3] ethdev: extend struct to support flow director in VFs

In reply to Thomas Monjalon
Quoted 6 lines

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

#31 lore raw

PATCH v4 3/3 testpmd: extend commands

In reply to Jingjing Wu

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

---
 app/test-pmd/cmdline.c                      | 41 ++++++++++++++++++++++++++---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++++++-----
 2 files changed, 46 insertions(+), 10 deletions(-)
app/test-pmd/cmdline.c +37 -4
index 1018379..c637198 100644
@@ -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,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9 -6
index 957f889..4fb1e0b 100644
@@ -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
 ~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.4.0
#29 lore raw

PATCH v4 1/3 ethdev: extend struct to support flow director in VFs

In reply to Jingjing Wu

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

---
 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(-)
doc/guides/rel_notes/deprecation.rst +0 -4
index 730c3b7..9fdd25c 100644
@@ -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
doc/guides/rel_notes/release_2_2.rst +3 -0
index ca8471b..7d2c2bb 100644
@@ -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
 -----------------------
lib/librte_ether/rte_eth_ctrl.h +2 -0
index f71669c..228183e 100644
@@ -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*/
 };
 
 /**
Signature · 1 line
2.4.0
#28 lore raw

v4 cover extend flow drector to support VF filtering in i40e driver

In reply to 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

 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(-)
Signature · 1 line
2.4.0
#30 lore raw

PATCH v4 2/3 i40e: extend flow diretcor to support filtering in VFs

This patch extends flow director to filtering in VFs.

---
 doc/guides/rel_notes/release_2_2.rst |  2 ++
 drivers/net/i40e/i40e_fdir.c         | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
doc/guides/rel_notes/release_2_2.rst +2 -0
index 7d2c2bb..69b3d9a 100644
@@ -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.**
drivers/net/i40e/i40e_fdir.c +12 -3
index ba18c9d..0b45bd9 100644
@@ -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);
 
Signature · 1 line
2.4.0
#32 lore raw

Re: [PATCH v4 0/3] extend flow drector to support VF filtering in i40e driver

In reply to Jingjing Wu

2015-11-04 11:29, Jingjing Wu:

Quoted 8 lines

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

Quoted 8 lines

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