DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 18/29] app/testpmd: use VFD APIs on i40e
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: Wenzhuo Lu <wenzhuo.lu@intel.com>

The new VF Daemon (VFD) APIs is implemented on i40e. Change
testpmd code to use them, including VF MAC anti-spoofing,
VF VLAN anti-spoofing, TX loopback, VF VLAN strip, VF VLAN
insert.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/Makefile  |   2 +
 app/test-pmd/cmdline.c | 125 ++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 100 insertions(+), 27 deletions(-)

diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 891b85a..a0c3366 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -58,7 +58,9 @@ SRCS-y += csumonly.c
 SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
+_LDLIBS-y += --whole-archive
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
+_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
 
 CFLAGS_cmdline.o := -D_GNU_SOURCE
 
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ed84d7a..5d2cdc7 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -262,7 +262,6 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"set portlist (x[,y]*)\n"
 			"    Set the list of forwarding ports.\n\n"
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 			"set tx loopback (port_id) (on|off)\n"
 			"    Enable or disable tx loopback.\n\n"
 
@@ -274,7 +273,6 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"set vf mac antispoof (port_id) (vf_id) (on|off).\n"
 			"    Set MAC antispoof for a VF from the PF.\n\n"
-#endif
 
 			"vlan set strip (on|off) (port_id)\n"
 			"    Set the VLAN strip on a port.\n\n"
@@ -282,7 +280,6 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"vlan set stripq (on|off) (port_id,queue_id)\n"
 			"    Set the VLAN strip for a queue on a port.\n\n"
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 			"set vf vlan stripq (port_id) (vf_id) (on|off)\n"
 			"    Set the VLAN strip for all queues in a pool for a VF from the PF.\n\n"
 
@@ -291,7 +288,6 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
 			"    Set VLAN antispoof for a VF from the PF.\n\n"
-#endif
 
 			"vlan set filter (on|off) (port_id)\n"
 			"    Set the VLAN filter on a port.\n\n"
@@ -386,10 +382,8 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"mac_addr add port (port_id) vf (vf_id) (mac_address)\n"
 			"    Add a MAC address for a VF on the port.\n\n"
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 			"set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)\n"
 			"    Set the MAC address for a VF from the PF.\n\n"
-#endif
 
 			"set port (port_id) uta (mac_address|all) (on|off)\n"
 			"    Add/Remove a or all unicast hash filter(s)"
@@ -6614,7 +6608,6 @@ cmdline_parse_inst_t cmd_set_vf_macvlan_filter = {
 	},
 };
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 /* *** CONFIGURE VF TRAFFIC CONTROL *** */
 struct cmd_set_vf_traffic {
 	cmdline_fixed_string_t set;
@@ -6675,9 +6668,7 @@ cmdline_parse_inst_t cmd_set_vf_traffic = {
 		NULL,
 	},
 };
-#endif
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 /* *** CONFIGURE VF RECEIVE MODE *** */
 struct cmd_set_vf_rxmode {
 	cmdline_fixed_string_t set;
@@ -6759,7 +6750,6 @@ cmdline_parse_inst_t cmd_set_vf_rxmode = {
 		NULL,
 	},
 };
-#endif
 
 /* *** ADD MAC ADDRESS FILTER FOR A VF OF A PORT *** */
 struct cmd_vf_mac_addr_result {
@@ -6826,7 +6816,6 @@ cmdline_parse_inst_t cmd_vf_mac_addr_filter = {
 	},
 };
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 /* *** ADD/REMOVE A VLAN IDENTIFIER TO/FROM A PORT VLAN RX FILTER *** */
 struct cmd_vf_rx_vlan_filter {
 	cmdline_fixed_string_t rx_vlan;
@@ -6889,7 +6878,6 @@ cmdline_parse_inst_t cmd_vf_rxvlan_filter = {
 		NULL,
 	},
 };
-#endif
 
 /* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */
 struct cmd_queue_rate_limit_result {
@@ -6958,7 +6946,6 @@ cmdline_parse_inst_t cmd_queue_rate_limit = {
 	},
 };
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 /* *** SET RATE LIMIT FOR A VF OF A PORT *** */
 struct cmd_vf_rate_limit_result {
 	cmdline_fixed_string_t set;
@@ -7037,7 +7024,6 @@ cmdline_parse_inst_t cmd_vf_rate_limit = {
 		NULL,
 	},
 };
-#endif
 
 /* *** ADD TUNNEL FILTER OF A PORT *** */
 struct cmd_tunnel_filter_result {
@@ -10808,7 +10794,6 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
 		NULL,
 	},
 };
-#ifdef RTE_LIBRTE_IXGBE_PMD
 
 /* vf vlan anti spoof configuration */
 
@@ -10862,9 +10847,22 @@ cmd_set_vf_vlan_anti_spoof_parsed(
 	struct cmd_vf_vlan_anti_spoof_result *res = parsed_result;
 	int ret = 0;
 	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	struct rte_eth_dev_info dev_info;
+
+	memset(&dev_info, 0, sizeof(dev_info));
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
+		ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id,
+							   res->vf_id,
+							   is_on);
+	else if (strstr(dev_info.driver_name, "i40e") != NULL)
+		ret = rte_pmd_i40e_set_vf_vlan_anti_spoof(res->port_id,
+							  res->vf_id,
+							  is_on);
+	else
+		ret = -ENOTSUP;
 
-	ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, res->vf_id,
-			is_on);
 	switch (ret) {
 	case 0:
 		break;
@@ -10874,6 +10872,9 @@ cmd_set_vf_vlan_anti_spoof_parsed(
 	case -ENODEV:
 		printf("invalid port_id %d\n", res->port_id);
 		break;
+	case -ENOTSUP:
+		printf("function not implemented\n");
+		break;
 	default:
 		printf("programming error: (%s)\n", strerror(-ret));
 	}
@@ -10947,9 +10948,22 @@ cmd_set_vf_mac_anti_spoof_parsed(
 	struct cmd_vf_mac_anti_spoof_result *res = parsed_result;
 	int ret;
 	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	struct rte_eth_dev_info dev_info;
+
+	memset(&dev_info, 0, sizeof(dev_info));
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
+		ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id,
+							  res->vf_id,
+							  is_on);
+	else if (strstr(dev_info.driver_name, "i40e") != NULL)
+		ret = rte_pmd_i40e_set_vf_mac_anti_spoof(res->port_id,
+							 res->vf_id,
+							 is_on);
+	else
+		ret = -ENOTSUP;
 
-	ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id, res->vf_id,
-			is_on);
 	switch (ret) {
 	case 0:
 		break;
@@ -10959,6 +10973,9 @@ cmd_set_vf_mac_anti_spoof_parsed(
 	case -ENODEV:
 		printf("invalid port_id %d\n", res->port_id);
 		break;
+	case -ENOTSUP:
+		printf("function not implemented\n");
+		break;
 	default:
 		printf("programming error: (%s)\n", strerror(-ret));
 	}
@@ -11032,8 +11049,20 @@ cmd_set_vf_vlan_stripq_parsed(
 	struct cmd_vf_vlan_stripq_result *res = parsed_result;
 	int ret = 0;
 	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	struct rte_eth_dev_info dev_info;
+
+	memset(&dev_info, 0, sizeof(dev_info));
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
+		ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id,
+						       res->vf_id, is_on);
+	else if (strstr(dev_info.driver_name, "i40e") != NULL)
+		ret = rte_pmd_i40e_set_vf_vlan_stripq(res->port_id,
+						      res->vf_id, is_on);
+	else
+		ret = -ENOTSUP;
 
-	ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id, res->vf_id, is_on);
 	switch (ret) {
 	case 0:
 		break;
@@ -11115,8 +11144,20 @@ cmd_set_vf_vlan_insert_parsed(
 {
 	struct cmd_vf_vlan_insert_result *res = parsed_result;
 	int ret;
+	struct rte_eth_dev_info dev_info;
+
+	memset(&dev_info, 0, sizeof(dev_info));
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
+		ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id,
+					       res->vlan_id);
+	else if (strstr(dev_info.driver_name, "i40e") != NULL)
+		ret = rte_pmd_i40e_set_vf_vlan_insert(res->port_id, res->vf_id,
+						      res->vlan_id);
+	else
+		ret = -ENOTSUP;
 
-	ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, res->vlan_id);
 	switch (ret) {
 	case 0:
 		break;
@@ -11126,6 +11167,9 @@ cmd_set_vf_vlan_insert_parsed(
 	case -ENODEV:
 		printf("invalid port_id %d\n", res->port_id);
 		break;
+	case -ENOTSUP:
+		printf("function not implemented\n");
+		break;
 	default:
 		printf("programming error: (%s)\n", strerror(-ret));
 	}
@@ -11189,8 +11233,18 @@ cmd_set_tx_loopback_parsed(
 	struct cmd_tx_loopback_result *res = parsed_result;
 	int ret;
 	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	struct rte_eth_dev_info dev_info;
+
+	memset(&dev_info, 0, sizeof(dev_info));
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
+		ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
+	else if (strstr(dev_info.driver_name, "i40e") != NULL)
+		ret = rte_pmd_i40e_set_tx_loopback(res->port_id, is_on);
+	else
+		ret = -ENOTSUP;
 
-	ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
 	switch (ret) {
 	case 0:
 		break;
@@ -11200,6 +11254,9 @@ cmd_set_tx_loopback_parsed(
 	case -ENODEV:
 		printf("invalid port_id %d\n", res->port_id);
 		break;
+	case -ENOTSUP:
+		printf("function not implemented\n");
+		break;
 	default:
 		printf("programming error: (%s)\n", strerror(-ret));
 	}
@@ -11277,6 +11334,9 @@ cmd_set_all_queues_drop_en_parsed(
 	case -ENODEV:
 		printf("invalid port_id %d\n", res->port_id);
 		break;
+	case -ENOTSUP:
+		printf("function not implemented\n");
+		break;
 	default:
 		printf("programming error: (%s)\n", strerror(-ret));
 	}
@@ -11432,10 +11492,21 @@ cmd_set_vf_mac_addr_parsed(
 	__attribute__((unused)) void *data)
 {
 	struct cmd_set_vf_mac_addr_result *res = parsed_result;
+	struct rte_eth_dev_info dev_info;
 	int ret;
 
-	ret = rte_pmd_ixgbe_set_vf_mac_addr(res->port_id, res->vf_id,
-			&res->mac_addr);
+	memset(&dev_info, 0, sizeof(dev_info));
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
+		ret = rte_pmd_ixgbe_set_vf_mac_addr(res->port_id, res->vf_id,
+				&res->mac_addr);
+	else if (strstr(dev_info.driver_name, "i40e") != NULL)
+		ret = rte_pmd_i40e_set_vf_mac_addr(res->port_id, res->vf_id,
+				&res->mac_addr);
+	else
+		ret = -ENOTSUP;
+
 	switch (ret) {
 	case 0:
 		break;
@@ -11445,6 +11516,9 @@ cmd_set_vf_mac_addr_parsed(
 	case -ENODEV:
 		printf("invalid port_id %d\n", res->port_id);
 		break;
+	case -ENOTSUP:
+		printf("function not implemented\n");
+		break;
 	default:
 		printf("programming error: (%s)\n", strerror(-ret));
 	}
@@ -11465,7 +11539,6 @@ cmdline_parse_inst_t cmd_set_vf_mac_addr = {
 		NULL,
 	},
 };
-#endif
 
 /* ******************************************************************************** */
 
@@ -11619,7 +11692,6 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_config_e_tag_forwarding_en_dis,
 	(cmdline_parse_inst_t *)&cmd_config_e_tag_filter_add,
 	(cmdline_parse_inst_t *)&cmd_config_e_tag_filter_del,
-#ifdef RTE_LIBRTE_IXGBE_PMD
 	(cmdline_parse_inst_t *)&cmd_set_vf_vlan_anti_spoof,
 	(cmdline_parse_inst_t *)&cmd_set_vf_mac_anti_spoof,
 	(cmdline_parse_inst_t *)&cmd_set_vf_vlan_stripq,
@@ -11632,7 +11704,6 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_vf_traffic,
 	(cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
 	(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
-#endif
 	NULL,
 };
 
-- 
2.9.3

^ permalink raw reply related

* [PATCH v4 19/29] app/testpmd: use unicast promiscuous mode on i40e
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: Wenzhuo Lu <wenzhuo.lu@intel.com>

Add testpmd CLI to set VF unicast promiscuous mode on i40e.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 app/test-pmd/cmdline.c                      | 86 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  9 +++
 2 files changed, 95 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5d2cdc7..f45d55c 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -395,6 +395,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"set allmulti (port_id|all) (on|off)\n"
 			"    Set the allmulti mode on port_id, or all.\n\n"
 
+			"set vf promisc (port_id) (vf_id) (on|off)\n"
+			"    Set unicast promiscuous mode for a VF from the PF.\n\n"
+
 			"set flow_ctrl rx (on|off) tx (on|off) (high_water)"
 			" (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd"
 			" (on|off) autoneg (on|off) (port_id)\n"
@@ -11540,6 +11543,88 @@ cmdline_parse_inst_t cmd_set_vf_mac_addr = {
 	},
 };
 
+/* VF unicast promiscuous mode configuration */
+
+/* Common result structure for VF unicast promiscuous mode */
+struct cmd_vf_promisc_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t vf;
+	cmdline_fixed_string_t promisc;
+	uint8_t port_id;
+	uint32_t vf_id;
+	cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for VF unicast promiscuous mode enable disable */
+cmdline_parse_token_string_t cmd_vf_promisc_set =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_promisc_result,
+		 set, "set");
+cmdline_parse_token_string_t cmd_vf_promisc_vf =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_promisc_result,
+		 vf, "vf");
+cmdline_parse_token_string_t cmd_vf_promisc_promisc =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_promisc_result,
+		 promisc, "promisc");
+cmdline_parse_token_num_t cmd_vf_promisc_port_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_promisc_result,
+		 port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_promisc_vf_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_promisc_result,
+		 vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_promisc_on_off =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_promisc_result,
+		 on_off, "on#off");
+
+static void
+cmd_set_vf_promisc_parsed(
+	void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_vf_promisc_result *res = parsed_result;
+	int ret = 0;
+	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	ret = rte_pmd_i40e_set_vf_unicast_promisc(res->port_id,
+						  res->vf_id, is_on);
+	switch (ret) {
+	case 0:
+		break;
+	case -EINVAL:
+		printf("invalid vf_id %d\n", res->vf_id);
+		break;
+	case -ENODEV:
+		printf("invalid port_id %d\n", res->port_id);
+		break;
+	default:
+		printf("programming error: (%s)\n", strerror(-ret));
+	}
+}
+
+cmdline_parse_inst_t cmd_set_vf_promisc = {
+	.f = cmd_set_vf_promisc_parsed,
+	.data = NULL,
+	.help_str = "set vf unicast promiscuous mode for a VF from PF",
+	.tokens = {
+		(void *)&cmd_vf_promisc_set,
+		(void *)&cmd_vf_promisc_vf,
+		(void *)&cmd_vf_promisc_promisc,
+		(void *)&cmd_vf_promisc_port_id,
+		(void *)&cmd_vf_promisc_vf_id,
+		(void *)&cmd_vf_promisc_on_off,
+		NULL,
+	},
+};
+
 /* ******************************************************************************** */
 
 /* list of instructions */
@@ -11704,6 +11789,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_vf_traffic,
 	(cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
 	(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
+	(cmdline_parse_inst_t *)&cmd_set_vf_promisc,
 	NULL,
 };
 
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f1c269a..2b18c66 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -820,6 +820,15 @@ Set the allmulti mode for a port or for all ports::
 
 Same as the ifconfig (8) option. Controls how multicast packets are handled.
 
+set promisc (for VF)
+~~~~~~~~~~~~~~~~~~~~
+
+Set the unicast promiscuous mode for a VF from PF.
+It's supported by Intel i40e NICs now.
+In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
+
+   testpmd> set vf promisc (port_id) (vf_id) (on|off)
+
 set flow_ctrl rx
 ~~~~~~~~~~~~~~~~
 
-- 
2.9.3

^ permalink raw reply related

* [PATCH v4 20/29] app/testpmd: use multicast promiscuous mode on i40e
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: Wenzhuo Lu <wenzhuo.lu@intel.com>

Add testpmd CLI to set VF multicast promiscuous mode on i40e.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 app/test-pmd/cmdline.c                      | 86 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  9 +++
 2 files changed, 95 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f45d55c..1685888 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -398,6 +398,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"set vf promisc (port_id) (vf_id) (on|off)\n"
 			"    Set unicast promiscuous mode for a VF from the PF.\n\n"
 
+			"set vf allmulti (port_id) (vf_id) (on|off)\n"
+			"    Set multicast promiscuous mode for a VF from the PF.\n\n"
+
 			"set flow_ctrl rx (on|off) tx (on|off) (high_water)"
 			" (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd"
 			" (on|off) autoneg (on|off) (port_id)\n"
@@ -11625,6 +11628,88 @@ cmdline_parse_inst_t cmd_set_vf_promisc = {
 	},
 };
 
+/* VF multicast promiscuous mode configuration */
+
+/* Common result structure for VF multicast promiscuous mode */
+struct cmd_vf_allmulti_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t vf;
+	cmdline_fixed_string_t allmulti;
+	uint8_t port_id;
+	uint32_t vf_id;
+	cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for VF multicast promiscuous mode enable disable */
+cmdline_parse_token_string_t cmd_vf_allmulti_set =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_allmulti_result,
+		 set, "set");
+cmdline_parse_token_string_t cmd_vf_allmulti_vf =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_allmulti_result,
+		 vf, "vf");
+cmdline_parse_token_string_t cmd_vf_allmulti_allmulti =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_allmulti_result,
+		 allmulti, "allmulti");
+cmdline_parse_token_num_t cmd_vf_allmulti_port_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_allmulti_result,
+		 port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_allmulti_vf_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_vf_allmulti_result,
+		 vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_allmulti_on_off =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_vf_allmulti_result,
+		 on_off, "on#off");
+
+static void
+cmd_set_vf_allmulti_parsed(
+	void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_vf_allmulti_result *res = parsed_result;
+	int ret = 0;
+	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	ret = rte_pmd_i40e_set_vf_multicast_promisc(res->port_id,
+						    res->vf_id, is_on);
+	switch (ret) {
+	case 0:
+		break;
+	case -EINVAL:
+		printf("invalid vf_id %d\n", res->vf_id);
+		break;
+	case -ENODEV:
+		printf("invalid port_id %d\n", res->port_id);
+		break;
+	default:
+		printf("programming error: (%s)\n", strerror(-ret));
+	}
+}
+
+cmdline_parse_inst_t cmd_set_vf_allmulti = {
+	.f = cmd_set_vf_allmulti_parsed,
+	.data = NULL,
+	.help_str = "set vf multicast promiscuous for a VF from PF",
+	.tokens = {
+		(void *)&cmd_vf_allmulti_set,
+		(void *)&cmd_vf_allmulti_vf,
+		(void *)&cmd_vf_allmulti_allmulti,
+		(void *)&cmd_vf_allmulti_port_id,
+		(void *)&cmd_vf_allmulti_vf_id,
+		(void *)&cmd_vf_allmulti_on_off,
+		NULL,
+	},
+};
+
 /* ******************************************************************************** */
 
 /* list of instructions */
@@ -11790,6 +11875,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
 	(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
 	(cmdline_parse_inst_t *)&cmd_set_vf_promisc,
+	(cmdline_parse_inst_t *)&cmd_set_vf_allmulti,
 	NULL,
 };
 
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 2b18c66..45c5902 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -829,6 +829,15 @@ In promiscuous mode packets are not dropped if they aren't for the specified MAC
 
    testpmd> set vf promisc (port_id) (vf_id) (on|off)
 
+set allmulticast (for VF)
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set the multicast promiscuous mode for a VF from PF.
+It's supported by Intel i40e NICs now.
+In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
+
+   testpmd> set vf allmulti (port_id) (vf_id) (on|off)
+
 set flow_ctrl rx
 ~~~~~~~~~~~~~~~~
 
-- 
2.9.3

^ permalink raw reply related

* [PATCH v4 21/29] app/testpmd: add command to test VF broadcast mode on i40e
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: Bernard Iremonger <bernard.iremonger@intel.com>

Add command to call rte_pmd_i40e_set_vf_broadcast.
Add set vf broadcast in testpmd_funcs.rst file.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/cmdline.c                      | 85 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  7 +++
 2 files changed, 92 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 1685888..fab20e8 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -274,6 +274,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"set vf mac antispoof (port_id) (vf_id) (on|off).\n"
 			"    Set MAC antispoof for a VF from the PF.\n\n"
 
+			"set vf broadcast (port_id) (vf_id) (on|off)\n"
+			"    Set VF broadcast for a VF from the PF.\n\n"
+
 			"vlan set strip (on|off) (port_id)\n"
 			"    Set the VLAN strip on a port.\n\n"
 
@@ -11710,6 +11713,87 @@ cmdline_parse_inst_t cmd_set_vf_allmulti = {
 	},
 };
 
+/* vf broadcast mode configuration */
+
+/* Common result structure for vf broadcast */
+struct cmd_set_vf_broadcast_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t vf;
+	cmdline_fixed_string_t broadcast;
+	uint8_t port_id;
+	uint16_t vf_id;
+	cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf broadcast enable disable */
+cmdline_parse_token_string_t cmd_set_vf_broadcast_set =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_vf_broadcast_result,
+		 set, "set");
+cmdline_parse_token_string_t cmd_set_vf_broadcast_vf =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_vf_broadcast_result,
+		 vf, "vf");
+cmdline_parse_token_string_t cmd_set_vf_broadcast_broadcast =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_vf_broadcast_result,
+		 broadcast, "broadcast");
+cmdline_parse_token_num_t cmd_set_vf_broadcast_port_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_set_vf_broadcast_result,
+		 port_id, UINT8);
+cmdline_parse_token_num_t cmd_set_vf_broadcast_vf_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_set_vf_broadcast_result,
+		 vf_id, UINT16);
+cmdline_parse_token_string_t cmd_set_vf_broadcast_on_off =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_vf_broadcast_result,
+		 on_off, "on#off");
+
+static void
+cmd_set_vf_broadcast_parsed(
+	void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_set_vf_broadcast_result *res = parsed_result;
+	int ret;
+	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	ret = rte_pmd_i40e_set_vf_broadcast(res->port_id, res->vf_id, is_on);
+	switch (ret) {
+	case 0:
+		break;
+	case -EINVAL:
+		printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+		break;
+	case -ENODEV:
+		printf("invalid port_id %d\n", res->port_id);
+		break;
+	default:
+		printf("programming error: (%s)\n", strerror(-ret));
+	}
+}
+
+cmdline_parse_inst_t cmd_set_vf_broadcast = {
+	.f = cmd_set_vf_broadcast_parsed,
+	.data = NULL,
+	.help_str = "set vf broadcast port_id vf_id on|off",
+	.tokens = {
+		(void *)&cmd_set_vf_broadcast_set,
+		(void *)&cmd_set_vf_broadcast_vf,
+		(void *)&cmd_set_vf_broadcast_broadcast,
+		(void *)&cmd_set_vf_broadcast_port_id,
+		(void *)&cmd_set_vf_broadcast_vf_id,
+		(void *)&cmd_set_vf_broadcast_on_off,
+		NULL,
+	},
+};
+
 /* ******************************************************************************** */
 
 /* list of instructions */
@@ -11876,6 +11960,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
 	(cmdline_parse_inst_t *)&cmd_set_vf_promisc,
 	(cmdline_parse_inst_t *)&cmd_set_vf_allmulti,
+	(cmdline_parse_inst_t *)&cmd_set_vf_broadcast,
 	NULL,
 };
 
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 45c5902..823db7e 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -507,6 +507,13 @@ Set mac antispoof for a VF from the PF::
 
    testpmd> set vf mac antispoof  (port_id) (vf_id) (on|off)
 
+set broadcast mode (for VF)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set broadcast mode for a VF from the PF::
+
+   testpmd> set vf broadcast (port_id) (vf_id) (on|off)
+
 vlan set strip
 ~~~~~~~~~~~~~~
 
-- 
2.9.3

^ permalink raw reply related

* [PATCH v4 22/29] app/testpmd: add command to test VF VLAN tag on i40e
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: Bernard Iremonger <bernard.iremonger@intel.com>

command is: set vf vlan tag port_id vf_id on|off

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/cmdline.c                      | 91 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  7 +++
 2 files changed, 98 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index fab20e8..3e36334 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -292,6 +292,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
 			"    Set VLAN antispoof for a VF from the PF.\n\n"
 
+			"set vf vlan tag (port_id) (vf_id) (on|off)\n"
+			"    Set VLAN tag for a VF from the PF.\n\n"
+
 			"vlan set filter (on|off) (port_id)\n"
 			"    Set the VLAN filter on a port.\n\n"
 
@@ -11794,6 +11797,93 @@ cmdline_parse_inst_t cmd_set_vf_broadcast = {
 	},
 };
 
+/* vf vlan tag configuration */
+
+/* Common result structure for vf vlan tag */
+struct cmd_set_vf_vlan_tag_result {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t vf;
+	cmdline_fixed_string_t vlan;
+	cmdline_fixed_string_t tag;
+	uint8_t port_id;
+	uint16_t vf_id;
+	cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf vlan tag enable disable */
+cmdline_parse_token_string_t cmd_set_vf_vlan_tag_set =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_vf_vlan_tag_result,
+		 set, "set");
+cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vf =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_vf_vlan_tag_result,
+		 vf, "vf");
+cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vlan =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_vf_vlan_tag_result,
+		 vlan, "vlan");
+cmdline_parse_token_string_t cmd_set_vf_vlan_tag_tag =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_vf_vlan_tag_result,
+		 tag, "tag");
+cmdline_parse_token_num_t cmd_set_vf_vlan_tag_port_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_set_vf_vlan_tag_result,
+		 port_id, UINT8);
+cmdline_parse_token_num_t cmd_set_vf_vlan_tag_vf_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_set_vf_vlan_tag_result,
+		 vf_id, UINT16);
+cmdline_parse_token_string_t cmd_set_vf_vlan_tag_on_off =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_vf_vlan_tag_result,
+		 on_off, "on#off");
+
+static void
+cmd_set_vf_vlan_tag_parsed(
+	void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_set_vf_vlan_tag_result *res = parsed_result;
+	int ret;
+	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+	ret = rte_pmd_i40e_set_vf_vlan_tag(res->port_id, res->vf_id, is_on);
+	switch (ret) {
+	case 0:
+		break;
+	case -EINVAL:
+		printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+		break;
+	case -ENODEV:
+		printf("invalid port_id %d\n", res->port_id);
+		break;
+	default:
+		printf("programming error: (%s)\n", strerror(-ret));
+	}
+}
+
+cmdline_parse_inst_t cmd_set_vf_vlan_tag = {
+	.f = cmd_set_vf_vlan_tag_parsed,
+	.data = NULL,
+	.help_str = "set vf vlan tag port_id vf_id on|off",
+	.tokens = {
+		(void *)&cmd_set_vf_vlan_tag_set,
+		(void *)&cmd_set_vf_vlan_tag_vf,
+		(void *)&cmd_set_vf_vlan_tag_vlan,
+		(void *)&cmd_set_vf_vlan_tag_tag,
+		(void *)&cmd_set_vf_vlan_tag_port_id,
+		(void *)&cmd_set_vf_vlan_tag_vf_id,
+		(void *)&cmd_set_vf_vlan_tag_on_off,
+		NULL,
+	},
+};
+
 /* ******************************************************************************** */
 
 /* list of instructions */
@@ -11961,6 +12051,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_vf_promisc,
 	(cmdline_parse_inst_t *)&cmd_set_vf_allmulti,
 	(cmdline_parse_inst_t *)&cmd_set_vf_broadcast,
+	(cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag,
 	NULL,
 };
 
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 823db7e..84805af 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -542,6 +542,13 @@ Set VLAN insert for a VF from the PF::
 
    testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
 
+vlan set tag (for VF)
+~~~~~~~~~~~~~~~~~~~~~
+
+Set VLAN tag for a VF from the PF::
+
+   testpmd> set vf vlan tag (port_id) (vf_id) (on|off)
+
 vlan set antispoof (for VF)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.9.3

^ permalink raw reply related

* [PATCH v4 23/29] app/testpmd: handle i40e in VF VLAN filter command
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: Bernard Iremonger <bernard.iremonger@intel.com>

modify set_vf_rx_vlan function to handle the i40e PMD.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/config.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index fc0424a..c5da9b1 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -92,6 +92,9 @@
 #include <rte_ethdev.h>
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
+#ifdef RTE_LIBRTE_I40E_PMD
+#include <rte_pmd_i40e.h>
+#endif
 #ifdef RTE_LIBRTE_IXGBE_PMD
 #include <rte_pmd_ixgbe.h>
 #endif
@@ -2353,12 +2356,22 @@ void
 set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)
 {
 	int diag;
+	struct rte_eth_dev_info dev_info;
+
+	rte_eth_dev_info_get(port_id, &dev_info);
 
-	diag = rte_pmd_ixgbe_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
+#ifdef RTE_LIBRTE_I40E_PMD
+	if (strstr(dev_info.driver_name, "i40e") != NULL)
+		diag = rte_pmd_i40e_set_vf_vlan_filter(port_id, vlan_id,
+						       vf_mask, on);
+	else
+#endif
+		diag = rte_pmd_ixgbe_set_vf_vlan_filter(port_id, vlan_id,
+						      vf_mask, on);
 
 	if (diag == 0)
 		return;
-	printf("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed "
+	printf("rte_pmd_xxx_set_vf_vlan_filter for port_id=%d failed "
 	       "diag=%d\n", port_id, diag);
 }
 #endif
-- 
2.9.3

^ permalink raw reply related

* [PATCH v4 24/29] net/i40e: change version number to support Linux VF
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>

i40e PF host only support to work with DPDK VF driver, Linux
VF driver is not supported. This change will enhance in version
number returned.

Current version info returned won't be able to be recognized
by Linux VF driver, change to values that both DPDK VF and Linux
driver can recognize.

The expense is original DPDK host specific feature like
CFG_VLAN_PVID and CONFIG_VSI_QUEUES_EXT will not available.

DPDK VF also can't identify host driver by version number returned.
It always assume talking with Linux PF.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
 drivers/net/i40e/i40e_pf.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 2bc3355..0f582ed 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -279,8 +279,19 @@ i40e_pf_host_process_cmd_version(struct i40e_pf_vf *vf, bool b_op)
 {
 	struct i40e_virtchnl_version_info info;
 
-	info.major = I40E_DPDK_VERSION_MAJOR;
-	info.minor = I40E_DPDK_VERSION_MINOR;
+	/* Respond like a Linux PF host in order to support both DPDK VF and
+	 * Linux VF driver. The expense is original DPDK host specific feature
+	 * like CFG_VLAN_PVID and CONFIG_VSI_QUEUES_EXT will not available.
+	 *
+	 * DPDK VF also can't identify host driver by version number returned.
+	 * It always assume talking with Linux PF.
+	 *
+	 * TODO:
+	 * Discuss with Linux driver maintainer if possible to carry more info
+	 * in this function to identify it's Linux or DPDK host.
+	 */
+	info.major = I40E_VIRTCHNL_VERSION_MAJOR;
+	info.minor = I40E_VIRTCHNL_VERSION_MINOR_NO_VF_CAPS;
 
 	if (b_op)
 		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
-- 
2.9.3

^ permalink raw reply related

* [PATCH v4 25/29] net/i40e: return correct VSI id
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>

PF host didn't return correct VSI id to VF.
This change fix it.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
 drivers/net/i40e/i40e_pf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 0f582ed..8319c2c 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -351,8 +351,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, bool b_op)
 
 	/* Change below setting if PF host can support more VSIs for VF */
 	vf_res->vsi_res[0].vsi_type = I40E_VSI_SRIOV;
-	/* As assume Vf only has single VSI now, always return 0 */
-	vf_res->vsi_res[0].vsi_id = 0;
+	vf_res->vsi_res[0].vsi_id = vf->vsi->vsi_id;
 	vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps;
 	ether_addr_copy(&vf->mac_addr,
 		(struct ether_addr *)vf_res->vsi_res[0].default_mac_addr);
-- 
2.9.3

^ permalink raw reply related

* [PATCH v4 26/29] net/i40e: parse more VF parameter and configure
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>

When VF requested to configure TX queue, a few parameters are
missed to be configured in PF host. This change have more
fields parsed and configured for TX context.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
 drivers/net/i40e/i40e_pf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 8319c2c..1ad5ed1 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -422,10 +422,12 @@ i40e_pf_host_hmc_config_txq(struct i40e_hw *hw,
 
 	/* clear the context structure first */
 	memset(&tx_ctx, 0, sizeof(tx_ctx));
-	tx_ctx.new_context = 1;
 	tx_ctx.base = txq->dma_ring_addr / I40E_QUEUE_BASE_ADDR_UNIT;
 	tx_ctx.qlen = txq->ring_len;
 	tx_ctx.rdylist = rte_le_to_cpu_16(vf->vsi->info.qs_handle[0]);
+	tx_ctx.head_wb_ena = txq->headwb_enabled;
+	tx_ctx.head_wb_addr = txq->dma_headwb_addr;
+
 	err = i40e_clear_lan_tx_queue_context(hw, abs_queue_id);
 	if (err != I40E_SUCCESS)
 		return err;
-- 
2.9.3

^ permalink raw reply related

* [PATCH v4 27/29] net/i40e: support Linux VF to configure IRQ link list
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>

i40e PF host only support to work with DPDK VF driver, Linux
VF driver is not supported. This change will enhance in
configuring IRQ link list.

This Change will identify VF client by number of vector
requested. DPDK VF will ask only single one while Linux VF
will request at least 2. It will have different configuration
for different clients. DPDK VF will be configured to link all
queue together, while Linux VF will be configured per request.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
 drivers/net/i40e/i40e_pf.c | 151 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 138 insertions(+), 13 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 1ad5ed1..71e6a3f 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -585,14 +585,116 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,
 	return ret;
 }
 
+static void
+i40e_pf_config_irq_link_list(struct i40e_pf_vf *vf,
+			     struct i40e_virtchnl_vector_map *vvm)
+{
+	uint64_t linklistmap = 0, tempmap;
+	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
+	uint16_t qid;
+	bool b_first_q = true;
+	enum i40e_queue_type qtype;
+	uint16_t vector_id;
+	uint32_t reg, reg_idx;
+	uint16_t itr_idx = 0, i;
+
+	vector_id = vvm->vector_id;
+	/* setup the head */
+	if (!vector_id)
+		reg_idx = I40E_VPINT_LNKLST0(vf->vf_idx);
+	else
+		reg_idx = I40E_VPINT_LNKLSTN(
+		((hw->func_caps.num_msix_vectors_vf - 1) * vf->vf_idx)
+		+ (vector_id - 1));
+
+	if (vvm->rxq_map == 0 && vvm->txq_map == 0) {
+		I40E_WRITE_REG(hw, reg_idx,
+			       I40E_VPINT_LNKLST0_FIRSTQ_INDX_MASK);
+		goto cfg_irq_done;
+	}
+
+	/* sort all rx and tx queues */
+	tempmap = vvm->rxq_map;
+	for (i = 0; i < sizeof(vvm->rxq_map) * 8; i++) {
+		if (tempmap & 0x1)
+			linklistmap |= (1 << (2 * i));
+		tempmap >>= 1;
+	}
+
+	tempmap = vvm->txq_map;
+	for (i = 0; i < sizeof(vvm->txq_map) * 8; i++) {
+		if (tempmap & 0x1)
+			linklistmap |= (1 << (2 * i + 1));
+		tempmap >>= 1;
+	}
+
+	/* Link all rx and tx queues into a chained list */
+	tempmap = linklistmap;
+	i = 0;
+	b_first_q = true;
+	do {
+		if (tempmap & 0x1) {
+			qtype = (enum i40e_queue_type)(i % 2);
+			qid = vf->vsi->base_queue + i / 2;
+			if (b_first_q) {
+				/* This is header */
+				b_first_q = false;
+				reg = ((qtype <<
+				I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT)
+				| qid);
+			} else {
+				/* element in the link list */
+				reg = (vector_id) |
+				(qtype << I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT) |
+				(qid << I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT) |
+				BIT(I40E_QINT_RQCTL_CAUSE_ENA_SHIFT) |
+				(itr_idx << I40E_QINT_RQCTL_ITR_INDX_SHIFT);
+			}
+			I40E_WRITE_REG(hw, reg_idx, reg);
+			/* find next register to program */
+			switch (qtype) {
+			case I40E_QUEUE_TYPE_RX:
+				reg_idx = I40E_QINT_RQCTL(qid);
+				itr_idx = vvm->rxitr_idx;
+				break;
+			case I40E_QUEUE_TYPE_TX:
+				reg_idx = I40E_QINT_TQCTL(qid);
+				itr_idx = vvm->txitr_idx;
+				break;
+			default:
+				break;
+			}
+		}
+		i++;
+		tempmap >>= 1;
+	} while (tempmap);
+
+	/* Terminate the link list */
+	reg = (vector_id) |
+		(0 << I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT) |
+		(0x7FF << I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT) |
+		BIT(I40E_QINT_RQCTL_CAUSE_ENA_SHIFT) |
+		(itr_idx << I40E_QINT_RQCTL_ITR_INDX_SHIFT);
+	I40E_WRITE_REG(hw, reg_idx, reg);
+
+cfg_irq_done:
+	I40E_WRITE_FLUSH(hw);
+}
+
 static int
 i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf,
 					uint8_t *msg, uint16_t msglen,
 					bool b_op)
 {
 	int ret = I40E_SUCCESS;
+	struct i40e_pf *pf = vf->pf;
+	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	struct i40e_virtchnl_irq_map_info *irqmap =
 	    (struct i40e_virtchnl_irq_map_info *)msg;
+	struct i40e_virtchnl_vector_map *map;
+	int i;
+	uint16_t vector_id;
+	unsigned long qbit_max;
 
 	if (!b_op) {
 		i40e_pf_host_send_msg_to_vf(
@@ -608,23 +710,46 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf,
 		goto send_msg;
 	}
 
-	/* Assume VF only have 1 vector to bind all queues */
-	if (irqmap->num_vectors != 1) {
-		PMD_DRV_LOG(ERR, "DKDK host only support 1 vector");
-		ret = I40E_ERR_PARAM;
+	/* PF host will support both DPDK VF or Linux VF driver, identify by
+	 * number of vectors requested.
+	 */
+
+	/* DPDK VF only requires single vector */
+	if (irqmap->num_vectors == 1) {
+		/* This MSIX intr store the intr in VF range */
+		vf->vsi->msix_intr = irqmap->vecmap[0].vector_id;
+		vf->vsi->nb_msix = irqmap->num_vectors;
+		vf->vsi->nb_used_qps = vf->vsi->nb_qps;
+
+		/* Don't care how the TX/RX queue mapping with this vector.
+		 * Link all VF RX queues together. Only did mapping work.
+		 * VF can disable/enable the intr by itself.
+		 */
+		i40e_vsi_queues_bind_intr(vf->vsi);
 		goto send_msg;
 	}
 
-	/* This MSIX intr store the intr in VF range */
-	vf->vsi->msix_intr = irqmap->vecmap[0].vector_id;
-	vf->vsi->nb_msix = irqmap->num_vectors;
-	vf->vsi->nb_used_qps = vf->vsi->nb_qps;
+	/* Then, it's Linux VF driver */
+	qbit_max = 1 << pf->vf_nb_qp_max;
+	for (i = 0; i < irqmap->num_vectors; i++) {
+		map = &irqmap->vecmap[i];
+
+		vector_id = map->vector_id;
+		/* validate msg params */
+		if (vector_id >= hw->func_caps.num_msix_vectors_vf) {
+			ret = I40E_ERR_PARAM;
+			goto send_msg;
+		}
+
+		if ((map->rxq_map < qbit_max) && (map->txq_map < qbit_max)) {
+			i40e_pf_config_irq_link_list(vf, map);
+		} else {
+			/* configured queue size excceed limit */
+			ret = I40E_ERR_PARAM;
+			goto send_msg;
+		}
+	}
 
-	/* Don't care how the TX/RX queue mapping with this vector.
-	 * Link all VF RX queues together. Only did mapping work.
-	 * VF can disable/enable the intr by itself.
-	 */
-	i40e_vsi_queues_bind_intr(vf->vsi);
 send_msg:
 	i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP,
 							ret, NULL, 0);
-- 
2.9.3

^ permalink raw reply related

* [PATCH v4 28/29] net/i40e: enhance in sanity check of MAC
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>

When VF sends request to add a new MAC address, PF host
will check if it's a non-zero or unicast address, or it
will return with error. In fact, VF still can set multicast
address. This change remove to check if it's a unicast
address.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
 drivers/net/i40e/i40e_pf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 71e6a3f..79f4295 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -890,8 +890,8 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,
 		mac = (struct ether_addr *)(addr_list->list[i].addr);
 		(void)rte_memcpy(&filter.mac_addr, mac, ETHER_ADDR_LEN);
 		filter.filter_type = RTE_MACVLAN_PERFECT_MATCH;
-		if(!is_valid_assigned_ether_addr(mac) ||
-			i40e_vsi_add_mac(vf->vsi, &filter)) {
+		if (is_zero_ether_addr(mac) ||
+		    i40e_vsi_add_mac(vf->vsi, &filter)) {
 			ret = I40E_ERR_INVALID_MAC_ADDR;
 			goto send_msg;
 		}
-- 
2.9.3

^ permalink raw reply related

* [PATCH v4 29/29] net/i40e: set/clear VF stats from PF
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: Qi Zhang <qi.z.zhang@intel.com>

This patch add support to get/clear VF statistics
from PF side.
Two APIs are added:
rte_pmd_i40e_get_vf_stats.
rte_pmd_i40e_reset_vf_stats.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 76 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 41 +++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  2 +
 3 files changed, 119 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 5ee010e..080eff2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10462,3 +10462,79 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_get_vf_stats(uint8_t port,
+			  uint16_t vf_id,
+			  struct rte_eth_stats *stats)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_vsi *vsi;
+	int ret = 0;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (vf_id >= dev_info.max_vfs)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	if (vf_id > pf->vf_num - 1 || !pf->vfs) {
+		PMD_DRV_LOG(ERR, "Invalid argument.");
+		return -EINVAL;
+	}
+
+	vsi = pf->vfs[vf_id].vsi;
+	i40e_update_vsi_stats(vsi);
+
+	stats->ipackets = vsi->eth_stats.rx_unicast +
+			vsi->eth_stats.rx_multicast +
+			vsi->eth_stats.rx_broadcast;
+	stats->opackets = vsi->eth_stats.tx_unicast +
+			vsi->eth_stats.tx_multicast +
+			vsi->eth_stats.tx_broadcast;
+	stats->ibytes   = vsi->eth_stats.rx_bytes;
+	stats->obytes   = vsi->eth_stats.tx_bytes;
+	stats->ierrors  = vsi->eth_stats.rx_discards;
+	stats->oerrors  = vsi->eth_stats.tx_errors + vsi->eth_stats.tx_discards;
+
+	return ret;
+}
+
+int
+rte_pmd_i40e_reset_vf_stats(uint8_t port,
+			    uint16_t vf_id)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_vsi *vsi;
+	int ret = 0;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (vf_id >= dev_info.max_vfs)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	if (vf_id > pf->vf_num - 1 || !pf->vfs) {
+		PMD_DRV_LOG(ERR, "Invalid argument.");
+		return -EINVAL;
+	}
+
+	vsi = pf->vfs[vf_id].vsi;
+
+	vsi->offset_loaded = false;
+	i40e_update_vsi_stats(vsi);
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 96cda89..2bda36d 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -284,4 +284,45 @@ int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
 int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
 				    uint64_t vf_mask, uint8_t on);
 
+/**
+ * Get VF's statistics
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf_id
+ *    VF on which to get.
+ * @param stats
+ *    A pointer to a structure of type *rte_eth_stats* to be filled with
+ *    the values of device counters for the following set of statistics:
+ *   - *ipackets* with the total of successfully received packets.
+ *   - *opackets* with the total of successfully transmitted packets.
+ *   - *ibytes*   with the total of successfully received bytes.
+ *   - *obytes*   with the total of successfully transmitted bytes.
+ *   - *ierrors*  with the total of erroneous received packets.
+ *   - *oerrors*  with the total of failed transmitted packets.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+
+int rte_pmd_i40e_get_vf_stats(uint8_t port,
+			      uint16_t vf_id,
+			      struct rte_eth_stats *stats);
+
+/**
+ * Clear VF's statistics
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf_id
+ *    VF on which to get.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_reset_vf_stats(uint8_t port,
+				uint16_t vf_id);
+
 #endif /* _PMD_I40E_H_ */
diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e/rte_pmd_i40e_version.map
index 818ff9c..e4dff0b 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -18,5 +18,7 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_broadcast;
 	rte_pmd_i40e_set_vf_vlan_tag;
 	rte_pmd_i40e_set_vf_vlan_filter;
+	rte_pmd_i40e_get_vf_stats;
+	rte_pmd_i40e_reset_vf_stats;
 
 } DPDK_2.0;
-- 
2.9.3

^ permalink raw reply related

* Re: [PATCH v4 00/29] Support VFD and DPDK PF + kernel VF on i40e
From: Vincent Jardin @ 2016-12-16 14:45 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: Jingjing Wu, Helin Zhang
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

I do not see test to validate that the PF userland will look like a Linux 
PF. I am getting concerned that it is a bad solution since we have 
two/three PF mailboxes which may not be consistent: Linux, DPDK, VMware.

Le 16 décembre 2016 3:39:36 PM Ferruh Yigit <ferruh.yigit@intel.com> a écrit :

> 1, VF Daemon (VFD)
> VFD is an idea to control all the VFs from PF.
> As we need to support the scenario kernel PF + DPDK VF,
> DPDK follows the interface between kernel PF + kernel VF.
> We don't want to introduce too many new messages between PF and VF.
> So this patch set adds some new APIs to control VFs directly from PF.
> The new APIs include,
> 1) set VF MAC anti-spoofing
> 2) set VF VLAN anti-spoofing
> 3) set TX loopback
> 4) set VF unicast promiscuous mode
> 5) set VF multicast promiscuous mode
> 6) set VF MTU
> 7) get/reset VF stats
> 8) set VF MAC address
> 9) set VF VLAN stripping
> 10) VF VLAN insertion
> 12) set VF broadcast mode
> 12) set VF VLAN tag
> 13) set VF VLAN filter
> VFD also includes VF to PF mailbox message management by APP.
> When PF receives mailbox messages from VF, PF should call the callback 
> provided by APP to know if they're permitted to be processed.
>
> 2, Implement VF MAC address setting on VF.
>
> 3, Support the scenario DPDK PF + kernel VF.
>
> v4:
> - rebase on latest next-net
> - move patch 10/29 testpmd part to patch 18/29
>
> v3:
> - fix issue that VF does not work for i40e
> - remove patch for VDMq receive mode init
> - move get/reset VF stats API into rte_pmd_i40
>
> v2:
> - fix the compile issues.
> - fix the checkpatch warning and typo.
> - update the commit log of some patches.
> - fix the invalid port ID issue of testpmd.
>
>
> Bernard Iremonger (7):
>   net/i40e: add set VF VLAN insert function
>   net/i40e: set VF broadcast mode from PF
>   net/i40e: set VF VLAN tag from PF
>   net/i40e: set VF VLAN filter from PF
>   app/testpmd: add command to test VF broadcast mode on i40e
>   app/testpmd: add command to test VF VLAN tag on i40e
>   app/testpmd: handle i40e in VF VLAN filter command
>
> Chen Jing D(Mark) (6):
>   net/i40e: add VF VLAN strip func
>   net/i40e: change version number to support Linux VF
>   net/i40e: return correct VSI id
>   net/i40e: parse more VF parameter and configure
>   net/i40e: support Linux VF to configure IRQ link list
>   net/i40e: enhance in sanity check of MAC
>
> Ferruh Yigit (3):
>   net/i40e: set VF MAC from PF support
>   net/i40e: set VF MAC from VF support
>   net/i40e: fix VF MAC address assignment
>
> Qi Zhang (3):
>   net/i40e: enable VF MTU change
>   net/i40e: fix VF reset flow
>   net/i40e: set/clear VF stats from PF
>
> Wenzhuo Lu (10):
>   net/i40e: support link status notification
>   net/i40e: add callback to user on VF to PF mbox msg
>   net/i40e: set VF MAC anti-spoofing from PF
>   net/i40e: set VF VLAN anti-spoofing from PF
>   net/i40e: set Tx loopback from PF
>   net/i40e: set VF unicast promisc mode from PF
>   net/i40e: set VF multicast promisc mode from PF
>   app/testpmd: use VFD APIs on i40e
>   app/testpmd: use unicast promiscuous mode on i40e
>   app/testpmd: use multicast promiscuous mode on i40e
>
>  app/test-pmd/Makefile                       |   2 +
>  app/test-pmd/cmdline.c                      | 473 +++++++++++++++-
>  app/test-pmd/config.c                       |  17 +-
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  32 ++
>  drivers/net/i40e/Makefile                   |   4 +-
>  drivers/net/i40e/i40e_ethdev.c              | 847 +++++++++++++++++++++++++++-
>  drivers/net/i40e/i40e_ethdev.h              |   5 +-
>  drivers/net/i40e/i40e_ethdev_vf.c           |  82 ++-
>  drivers/net/i40e/i40e_pf.c                  | 417 ++++++++++++--
>  drivers/net/i40e/i40e_pf.h                  |   9 +-
>  drivers/net/i40e/rte_pmd_i40e.h             | 328 +++++++++++
>  drivers/net/i40e/rte_pmd_i40e_version.map   |  20 +
>  12 files changed, 2129 insertions(+), 107 deletions(-)
>  create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
>
> --
> 2.9.3
>

^ permalink raw reply

* Re: ConnectX4 100GbE - Compilation problem
From: george.dit @ 2016-12-16 14:45 UTC (permalink / raw)
  To: Georgios Katsikas, dev
In-Reply-To: <CAN9HtFBQfi_VEOgvUPzAH6GGEkOmgJuEO6pwpjwaX4ivqewr=w@mail.gmail.com>

Hi all,

I am coming back to you regarding the Mellanox Connectx4 100Gbps DPDK
driver.
We exchanged some e-mails last summer and I managed to compile the
DPDK-based Mellanox driver using DPDK 16.07 on top of Ubuntu server
16.04.01.

A few days ago, I installed a fresh Ubuntu server 16.04.1 on my machine and
attempted to re-install DPDK.
This time, DPDK does not compile because of the following error:
\== Build drivers/net/mlx5
  CC mlx5.o
In file included from /opt/dpdk/drivers/net/mlx5/mlx5.h:67:0,
                 from /opt/dpdk/drivers/net/mlx5/mlx5.c:66:
/opt/dpdk/drivers/net/mlx5/mlx5_rxtx.h:46:32: fatal error:
infiniband/mlx5_hw.h: No such file or directory
compilation terminated.
/opt/dpdk/mk/internal/rte.compile-pre.mk:138: recipe for target 'mlx5.o'
failed
make[6]: *** [mlx5.o] Error 1
/opt/dpdk/mk/rte.subdir.mk:61: recipe for target 'mlx5' failed
make[5]: *** [mlx5] Error 2
/opt/dpdk/mk/rte.subdir.mk:61: recipe for target 'net' failed
make[4]: *** [net] Error 2
/opt/dpdk/mk/rte.sdkbuild.mk:78: recipe for target 'drivers' failed
make[3]: *** [drivers] Error 2
/opt/dpdk/mk/rte.sdkroot.mk:126: recipe for target 'all' failed
make[2]: *** [all] Error 2
/opt/dpdk/mk/rte.sdkinstall.mk:85: recipe for target 'pre_install' failed
make[1]: *** [pre_install] Error 2
/opt/dpdk/mk/rte.sdkroot.mk:101: recipe for target 'install' failed
make: *** [install] Error 2
[ ERROR] [      CheckStatus] Command make install failed

I tried 2 different kernels (4.4 and 4.8) both compiled from sources and I
also tried 3 different DPDk versions (16.04/07/11) but they all get stuck
to this point.
The way I configure DPDK is via config/common_base, where I set
CONFIG_RTE_LIBRTE_MLX5_PMD=y.
The file infiniband/mlx5_hw.h does not exist in my system although I have
installed libmlx5.

Do you know why does this happen now?

Thanks in advance and best regards,
Georgios

On Thu, Aug 18, 2016 at 7:35 PM, <george.dit@gmail.com> wrote:

> Hi Adrien,
>
> Thanks for the prompt reply!
> You are right, I didn't go via the DPDK route, in the hope that Mellanox
> will provide the exact source and configuration.
> DPDK 16.07 from dpdk.org works like a charm and my NIC is in PMD mode,
> thanks a lot for your guidance!
>
> Best regards,
> Georgios
>
> On Thu, Aug 18, 2016 at 6:05 PM, Adrien Mazarguil <
> adrien.mazarguil@6wind.com> wrote:
>
>> Hi George,
>>
>> On Thu, Aug 18, 2016 at 05:41:38PM +0200, george.dit@gmail.com wrote:
>> > Hi,
>> >
>> > I have a single port Mellanox ConnectX 4 100GbE NIC and I want to test
>> its
>> > Rx/Tx capabilites  using DPDK.
>> > My system runs a Linux kernel 4.4 compiled from sources.
>> >
>> > I found the PMD driver for this NIC as provided by Mellanox here
>> > <http://www.mellanox.com/page/products_dyn?product_family=20
>> 9&mtag=pmd_for_dpdk>
>> > .
>> > Following this
>> > <http://www.mellanox.com/related-docs/prod_software/MLNX_
>> DPDK_Quick_Start_Guide_v2.2_2.7.pdf>
>> > guideline, I put my NIC in Ethernet mode, configured the 3 options
>> > regarding mlx5 in the config/common_linuxapp file and applied 'make
>> install
>> > T=x86_64-native-linuxapp-gcc'.
>>
>> Please note this is a third party package maintained by Mellanox,
>> therefore
>> this mailing list is not the right place to discuss related errors, unless
>> they can be reproduced with a version downloaded from dpdk.org.
>>
>> > Then, I stumbled upon a compilation problem in the mlx4 module.
>> > The compiler's output is as follows:
>> >
>> > == Build drivers/net/mlx4
>> >   CC mlx4.o
>> > In file included from /usr/include/linux/if.h:31:0,
>> >                  from /opt/MLNX_DPDK_2.2_2.7/drivers
>> /net/mlx4/mlx4.c:57:
>> > /usr/include/linux/hdlc/ioctl.h:73:14: error: ‘IFNAMSIZ’ undeclared
>> here
>> > (not in a function)
>> >   char master[IFNAMSIZ]; /* Name of master FRAD device */
>> >               ^
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:612:53: error: ‘struct
>> > ifreq’ declared inside parameter list [-Werror]
>> >  priv_ifreq(const struct priv *priv, int req, struct ifreq *ifr)
>> >                                                      ^
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:612:53: error: its
>> scope is
>> > only this definition or declaration, which is probably not what you want
>> > [-Werror]
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c: In function
>> ‘priv_ifreq’:
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:619:32: error:
>> dereferencing
>> > pointer to incomplete type ‘struct ifreq’
>> >   if (priv_get_ifname(priv, &ifr->ifr_name) == 0)
>> >                                 ^
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c: In function
>> ‘rxq_setup’:
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:3735:29: error: unused
>> > parameter ‘inactive’ [-Werror=unused-parameter]
>> >     unsigned int socket, int inactive, const struct rte_eth_rxconf
>> *conf,
>> >                              ^
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c: In function
>> > ‘mlx4_link_update_unlocked’:
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:4712:15: error: storage
>> size
>> > of ‘ifr’ isn’t known
>> >   struct ifreq ifr;
>> >                ^
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:4724:43: error: ‘IFF_UP’
>> > undeclared (first use in this function)
>> >   dev_link.link_status = ((ifr.ifr_flags & IFF_UP) &&
>> >                                            ^
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:4724:43: note: each
>> > undeclared identifier is reported only once for each function it
>> appears in
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:4725:22: error:
>> > ‘IFF_RUNNING’ undeclared (first use in this function)
>> >      (ifr.ifr_flags & IFF_RUNNING));
>> >                       ^
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:4712:15: error: unused
>> > variable ‘ifr’ [-Werror=unused-variable]
>> >   struct ifreq ifr;
>> >                ^
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c: In function
>> > ‘mlx4_dev_get_flow_ctrl’:
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:4880:15: error: storage
>> size
>> > of ‘ifr’ isn’t known
>> >   struct ifreq ifr;
>> >                ^
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:4880:15: error: unused
>> > variable ‘ifr’ [-Werror=unused-variable]
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c: In function
>> > ‘mlx4_dev_set_flow_ctrl’:
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:4930:15: error: storage
>> size
>> > of ‘ifr’ isn’t known
>> >   struct ifreq ifr;
>> >                ^
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:4930:15: error: unused
>> > variable ‘ifr’ [-Werror=unused-variable]
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c: In function
>> ‘priv_get_mac’:
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:5184:15: error: storage
>> size
>> > of ‘request’ isn’t known
>> >   struct ifreq request;
>> >                ^
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:5184:15: error: unused
>> > variable ‘request’ [-Werror=unused-variable]
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c: In function
>> > ‘mlx4_pci_devinit’:
>> > /opt/MLNX_DPDK_2.2_2.7/drivers/net/mlx4/mlx4.c:5725:25: error: ‘IFF_UP’
>> > undeclared (first use in this function)
>> >    priv_set_flags(priv, ~IFF_UP, IFF_UP);
>> >                          ^
>> > cc1: all warnings being treated as errors
>> > /opt/MLNX_DPDK_2.2_2.7/mk/internal/rte.compile-pre.mk:126: recipe for
>> > target 'mlx4.o' failed
>> >
>> > Iwould appreciate any suggestions and guidance.
>>
>> Well fortunately these errors are also present in v2.2.0 and should have
>> been addressed since v16.07 by the following commit:
>>
>>  http://dpdk.org/browse/dpdk/commit/?id=d06c608c013c36711e7a
>> 693b3fece68a93ae4369
>>
>> You can either upgrade to v16.07, back-port this commit yourself or wait
>> for
>> an update from Mellanox.
>>
>> --
>> Adrien Mazarguil
>> 6WIND
>>
>
>
>
> --
>    Georgios Katsikas
>    Ph.D. Student and Research Assistant
>    Network Systems Lab (NSL)
>
>
>
>        *E-Mail:*  george <george.katsikas@imdea.org>.dit@gmail.com
>    *Web Site:*  http://www.di.uoa.gr/~katsikas/
> <http://people.networks.imdea.org/~george_katsikas/index.html>
>



-- 
   Georgios Katsikas
   Ph.D. Student and Research Assistant
   Network Systems Lab (NSL)



       *E-Mail:*  george <george.katsikas@imdea.org>.dit@gmail.com
   *Web Site:*  http://www.di.uoa.gr/~katsikas/
<http://people.networks.imdea.org/~george_katsikas/index.html>

^ permalink raw reply

* [RFC] cryptodev: enable BPI+ for Cablelabs DOCSIS security spec
From: Trahe, Fiona @ 2016-12-16 15:07 UTC (permalink / raw)
  To: dev@dpdk.org
  Cc: De Lara Guarch, Pablo, Griffin, John, Ryan, Brendan, Trahe, Fiona,
	Jain, Deepak K, O'Hanlon, Michael A

Proposal to extend the DPDK cryptodev API to enable processing of packets according to the Baseline Privacy Interface Plus (BPI+) Specification described in the security specification of the Cablelabs Data-over-Cable Service Interface Specification (DOCSIS).

Brief summary of BPI+ symmetric cryptography requirements:
BPI+ cryptography uses a block cipher (AES-CBC/DES-CBC) to encrypt/decrypt all the whole blocks in the packet. However the data length is not always a block-multiple, so where there is a final block less than the full block size this residual block requires special handling using AES-CFB/DES-CFB mode. Similar special handling is specified where there is only one block, smaller than the block size for the cipher. See spec for further details.
https://apps.cablelabs.com/specification/docsis-3-1-security-specification/

Proposal:
Add new elements in the enum rte_crypto_cipher_algorithm.
Note elements of this enum are actually a combination of an algorithm (AES, 3DES, etc) and mode (CBC, CTR, etc). The new DOCSISBPI mode is used to convey to the PMD that the mode applied should be the specific combination of CBC and CFB required by the DOCSIS Baseline Privacy Plus Spec.
There are no other API changes needed.

The API patch is below. 
Thoughts?


diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h
index d694723..92fa568 100644
--- a/lib/librte_cryptodev/rte_crypto_sym.h
+++ b/lib/librte_cryptodev/rte_crypto_sym.h
@@ -105,6 +105,15 @@ enum rte_crypto_cipher_algorithm {
       RTE_CRYPTO_CIPHER_DES_CBC,
       /**< DES algorithm in CBC mode */

+       RTE_CRYPTO_CIPHER_DES_DOCSISBPI,
+       /**< DES algorithm using modes required by DOCSIS Baseline Privacy Plus Spec. */
+
+       RTE_CRYPTO_CIPHER_AES_DOCSISBPI,
+       /**< AES algorithm using modes required by DOCSIS Baseline Privacy Plus Spec.  */
+
        RTE_CRYPTO_CIPHER_LIST_END
};

^ permalink raw reply related

* Re: [PATCH v2] crypto/qat: fix to avoid buffer overwrite in OOP case
From: De Lara Guarch, Pablo @ 2016-12-16 15:11 UTC (permalink / raw)
  To: Griffin, John, Trahe, Fiona, dev@dpdk.org; +Cc: Trahe, Fiona, stable@dpdk.org
In-Reply-To: <B35B4DC4161C394FB0B7D8F7C232B73C4D323707@irsmsx105.ger.corp.intel.com>



> -----Original Message-----
> From: Griffin, John
> Sent: Friday, December 16, 2016 11:21 AM
> To: Trahe, Fiona; dev@dpdk.org
> Cc: De Lara Guarch, Pablo; Trahe, Fiona; stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2] crypto/qat: fix to avoid buffer overwrite
> in OOP case
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fiona Trahe
> > Sent: Friday, December 9, 2016 3:39 PM
> > To: dev@dpdk.org
> > Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Trahe, Fiona
> > <fiona.trahe@intel.com>; stable@dpdk.org
> > Subject: [dpdk-dev] [PATCH v2] crypto/qat: fix to avoid buffer overwrite in
> > OOP case
> >
> > In out-of-place operation, data is DMAed from source mbuf to destination
> > mbuf. To avoid header data in dest mbuf being overwritten, the minimal
> data-
> > set should be DMAed.
> >
> > Fixes: 39e0bee48e81 ("crypto/qat: rework request builder for
> > performance")
> >
> > Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
> Acked-by: John Griffin <john.griffin@intel.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo

^ permalink raw reply

* Re: [PATCH] crypto/openssl: fix extra bytes being written at end of data
From: De Lara Guarch, Pablo @ 2016-12-16 15:12 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Azarewicz, PiotrX T; +Cc: dev@dpdk.org, stable@dpdk.org
In-Reply-To: <E115CCD9D858EF4F90C690B0DCB4D897476B2519@IRSMSX108.ger.corp.intel.com>



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch,
> Pablo
> Sent: Friday, December 16, 2016 10:30 AM
> To: Azarewicz, PiotrX T
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] crypto/openssl: fix extra bytes being
> written at end of data
> 
> 
> 
> > -----Original Message-----
> > From: Azarewicz, PiotrX T
> > Sent: Wednesday, December 07, 2016 10:46 AM
> > To: De Lara Guarch, Pablo
> > Cc: dev@dpdk.org; stable@dpdk.org
> > Subject: [PATCH] crypto/openssl: fix extra bytes being written at end of
> > data
> >
> > Extra bytes are being written at end of data while process standard
> > openssl cipher encryption. This behaviour is unexpected.
> >
> > This patch disable the padding feature in openssl library, which is
> > causing the problem.
> >
> > Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library")
> >
> > Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo

^ permalink raw reply

* [PATCH] performance-thread: add software packet type parsing
From: Tomasz Kulasek @ 2016-12-16 15:15 UTC (permalink / raw)
  To: dev

Last changes in Niantic and Fortville NIC drivers causes that
vector Rx path is chosen by default in l3fwd-thread application.
This path doesn't support propagation of hw packet type recognition
to the packet_type field in mbuf, and packets cannot be classified
properly.

The approach to solve this problem is similar to the commit: 71a7e2424e07
("examples/l3fwd: fix using packet type blindly").

To use sw packet analizer, new command line option "--parse-ptype" is
introduced.

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
---
 doc/guides/sample_app_ug/performance_thread.rst |    4 +
 examples/performance-thread/l3fwd-thread/main.c |  100 ++++++++++++++++++++++-
 2 files changed, 101 insertions(+), 3 deletions(-)

diff --git a/doc/guides/sample_app_ug/performance_thread.rst b/doc/guides/sample_app_ug/performance_thread.rst
index d7d9b08..0a655af 100644
--- a/doc/guides/sample_app_ug/performance_thread.rst
+++ b/doc/guides/sample_app_ug/performance_thread.rst
@@ -107,6 +107,7 @@ The application has a number of command line options::
         --tx(lcore,thread)[,(lcore,thread)]
         [--enable-jumbo] [--max-pkt-len PKTLEN]]  [--no-numa]
         [--hash-entry-num] [--ipv6] [--no-lthreads] [--stat-lcore lcore]
+        [--parse-ptype]
 
 Where:
 
@@ -142,6 +143,9 @@ Where:
 * ``--stat-lcore``: optional, run CPU load stats collector on the specified
   lcore.
 
+* ``--parse-ptype:`` optional, set to use software to analyze packet type.
+  Without this option, hardware will check the packet type.
+
 The parameters of the ``--rx`` and ``--tx`` options are:
 
 * ``--rx`` parameters
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index fdc90b2..336f88c 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -90,6 +90,64 @@
 #define APP_LOOKUP_METHOD             APP_LOOKUP_LPM
 #endif
 
+static int
+check_ptype(int portid)
+{
+	int i, ret;
+	int ipv4 = 0, ipv6 = 0;
+
+	ret = rte_eth_dev_get_supported_ptypes(portid, RTE_PTYPE_L3_MASK, NULL,
+			0);
+	if (ret <= 0)
+		return 0;
+
+	uint32_t ptypes[ret];
+
+	ret = rte_eth_dev_get_supported_ptypes(portid, RTE_PTYPE_L3_MASK,
+			ptypes, ret);
+	for (i = 0; i < ret; ++i) {
+		if (ptypes[i] & RTE_PTYPE_L3_IPV4)
+			ipv4 = 1;
+		if (ptypes[i] & RTE_PTYPE_L3_IPV6)
+			ipv6 = 1;
+	}
+
+	if (ipv4 && ipv6)
+		return 1;
+
+	return 0;
+}
+
+static inline void
+parse_ptype(struct rte_mbuf *m)
+{
+	struct ether_hdr *eth_hdr;
+	uint32_t packet_type = RTE_PTYPE_UNKNOWN;
+	uint16_t ether_type;
+
+	eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+	ether_type = eth_hdr->ether_type;
+	if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4))
+		packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
+	else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6))
+		packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;
+
+	m->packet_type = packet_type;
+}
+
+static uint16_t
+cb_parse_ptype(__rte_unused uint8_t port, __rte_unused uint16_t queue,
+		struct rte_mbuf *pkts[], uint16_t nb_pkts,
+		__rte_unused uint16_t max_pkts, __rte_unused void *user_param)
+{
+	unsigned int i;
+
+	for (i = 0; i < nb_pkts; i++)
+		parse_ptype(pkts[i]);
+
+	return nb_pkts;
+}
+
 /*
  *  When set to zero, simple forwaring path is eanbled.
  *  When set to one, optimized forwarding path is enabled.
@@ -170,8 +228,9 @@
 
 /* mask of enabled ports */
 static uint32_t enabled_port_mask;
-static int promiscuous_on; /**< $et in promiscuous mode off by default. */
+static int promiscuous_on; /**< Set in promiscuous mode off by default. */
 static int numa_on = 1;    /**< NUMA is enabled by default. */
+static int parse_ptype_on;
 
 #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH)
 static int ipv6;           /**< ipv6 is false by default. */
@@ -2610,6 +2669,7 @@ static inline __attribute__((always_inline)) uint16_t
 		"  [--rx (port,queue,lcore,thread)[,(port,queue,lcore,thread]]"
 		"  [--tx (lcore,thread)[,(lcore,thread]]"
 		"  [--enable-jumbo [--max-pkt-len PKTLEN]]\n"
+		"  [--parse-ptype]\n\n"
 		"  -p PORTMASK: hexadecimal bitmask of ports to configure\n"
 		"  -P : enable promiscuous mode\n"
 		"  --rx (port,queue,lcore,thread): rx queues configuration\n"
@@ -2621,7 +2681,8 @@ static inline __attribute__((always_inline)) uint16_t
 		"  --enable-jumbo: enable jumbo frame"
 		" which max packet len is PKTLEN in decimal (64-9600)\n"
 		"  --hash-entry-num: specify the hash entry number in hexadecimal to be setup\n"
-		"  --no-lthreads: turn off lthread model\n",
+		"  --no-lthreads: turn off lthread model\n"
+		"  --parse-ptype: set to use software to analyze packet type\n\n",
 		prgname);
 }
 
@@ -2840,6 +2901,7 @@ static int parse_max_pkt_len(const char *pktlen)
 #define CMD_LINE_OPT_ENABLE_JUMBO "enable-jumbo"
 #define CMD_LINE_OPT_HASH_ENTRY_NUM "hash-entry-num"
 #define CMD_LINE_OPT_NO_LTHREADS "no-lthreads"
+#define CMD_LINE_OPT_PARSE_PTYPE "parse-ptype"
 
 /* Parse the argument given in the command line of the application */
 static int
@@ -2859,6 +2921,7 @@ static int parse_max_pkt_len(const char *pktlen)
 		{CMD_LINE_OPT_ENABLE_JUMBO, 0, 0, 0},
 		{CMD_LINE_OPT_HASH_ENTRY_NUM, 1, 0, 0},
 		{CMD_LINE_OPT_NO_LTHREADS, 0, 0, 0},
+		{CMD_LINE_OPT_PARSE_PTYPE, 0, 0, 0},
 		{NULL, 0, 0, 0}
 	};
 
@@ -2935,6 +2998,12 @@ static int parse_max_pkt_len(const char *pktlen)
 				lthreads_on = 0;
 			}
 
+			if (!strncmp(lgopts[option_index].name, CMD_LINE_OPT_PARSE_PTYPE,
+					sizeof(CMD_LINE_OPT_PARSE_PTYPE))) {
+				printf("software packet type parsing enabled\n");
+				parse_ptype_on = 1;
+			}
+
 			if (!strncmp(lgopts[option_index].name, CMD_LINE_OPT_ENABLE_JUMBO,
 				sizeof(CMD_LINE_OPT_ENABLE_JUMBO))) {
 				struct option lenopts = {"max-pkt-len", required_argument, 0,
@@ -3623,6 +3692,31 @@ static void convert_ipv6_5tuple(struct ipv6_5tuple *key1,
 			rte_eth_promiscuous_enable(portid);
 	}
 
+	for (i = 0; i < n_rx_thread; i++) {
+		lcore_id = rx_thread[i].conf.lcore_id;
+		if (rte_lcore_is_enabled(lcore_id) == 0)
+			continue;
+
+		/* check if hw packet type is supported */
+		for (queue = 0; queue < rx_thread[i].n_rx_queue; ++queue) {
+			portid = rx_thread[i].rx_queue_list[queue].port_id;
+			queueid = rx_thread[i].rx_queue_list[queue].queue_id;
+
+			if (parse_ptype_on) {
+				if (!rte_eth_add_rx_callback(portid, queueid,
+						cb_parse_ptype, NULL))
+					rte_exit(EXIT_FAILURE,
+						"Failed to add rx callback: "
+						"port=%d\n", portid);
+			} else if (!check_ptype(portid))
+				rte_exit(EXIT_FAILURE,
+					"Port %d cannot parse packet type.\n\n"
+					"Please add --parse-ptype to use sw "
+					"packet type analyzer.\n\n",
+					portid);
+		}
+	}
+
 	check_all_ports_link_status((uint8_t)nb_ports, enabled_port_mask);
 
 	if (lthreads_on) {
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH 12/22] app/testpmd: add rte_flow item spec handler
From: Adrien Mazarguil @ 2016-12-16 15:25 UTC (permalink / raw)
  To: Xing, Beilei
  Cc: Pei, Yulong, dev@dpdk.org, Thomas Monjalon, De Lara Guarch, Pablo,
	Olivier Matz
In-Reply-To: <94479800C636CB44BD422CB454846E01315717A4@SHSMSX101.ccr.corp.intel.com>

Hi Beilei,

On Fri, Dec 16, 2016 at 12:22:52PM +0000, Xing, Beilei wrote:
> Thanks Adrien.
> 
> I have two questions:
> 1.  when I set " / vlan tci fix 10" with testpmd, I find the mask of tci is 0xFFFF.
>      Actually tci includes PRI, CFI, and Vlan_id which holds 12 bits, so is it possible
>      to set the mask to 0xFFF? 
>      Our driver will check the mask only covers vlan_id instead of the whole tci.

Right, I'll work on a method to do that. TCI remains 16 bit either way so
the current approach remains accurate, although not convenient because a
10 bit mask must be specified manually.

This change won't be included in v2 though.

> 2. When we test destroy function, we find the pointer provided to PMD is NULL
>     instead of the pointer PMD returned to RTE during creating flow. Could you
>     please have double check? Thanks.

There is indeed a bug [1]. It is fixed in v2.

Thanks.

 [1] http://dpdk.org/ml/archives/dev/2016-November/050435.html

-- 
Adrien Mazarguil
6WIND

^ permalink raw reply

* Re: [PATCH v12 0/6] add Tx preparation
From: Ananyev, Konstantin @ 2016-12-16 15:27 UTC (permalink / raw)
  To: Jan Medala
  Cc: Yigit, Ferruh, Thomas Monjalon, Harish Patil, dev@dpdk.org,
	Rahul Lakkireddy, Stephen Hurd, Jakub Palider, John Daley,
	Adrien Mazarguil, Alejandro Lucero, Rasesh Mody, Jacob, Jerin,
	Yuanhan Liu, Kulasek, TomaszX, olivier.matz@6wind.com, Yong Wang,
	evgenys@amazon.com, netanel@amazon.com
In-Reply-To: <CANw_3ZcDDjXQ-SF+S2PhQxU3SwR57brc3F=7dYio5OFW=AQ8SQ@mail.gmail.com>

Hi Jan,


​>Hello,
​

>>Is there any update on that subject?

​>At this point we need to have only pseudo-header checksum for TSO. Maybe there will be new requirements, but that's something I cannot predict at this point.

Ok great, then we'll add a patch for ENA for v14, unless you guys would like to do it yourself.
​
 
>>So it seems that standard pseudo-header checksum calculation should be enough.
>>Is that correct?

​>Yes, this will be enough at this point.
>We also need to deliver a fix for issue we found during investigation of tx_prep() API.

Not sure what you are talking about...
Is that some separate issue not related directly to tx_prepare()?

Thanks
Konstantin


^ permalink raw reply

* [PATCH v3] vmxnet3: fix Rx deadlock
From: Stefan Puiu @ 2016-12-16 15:36 UTC (permalink / raw)
  To: dev; +Cc: yongwang, mac_leehk, Stefan Puiu
In-Reply-To: <1481530874-8660-1-git-send-email-stefan.puiu@gmail.com>

Our use case is that we have an app that needs to keep mbufs around
for a while. We've seen cases when calling vmxnet3_post_rx_bufs() from
vmxet3_recv_pkts(), it might not succeed to add any mbufs to any RX
descriptors (where it returns -err). Since there are no mbufs that the
virtual hardware can use, no packets will be received after this; the
driver won't refill the mbuf after this so it gets stuck in this
state. I call this a deadlock for lack of a better term - the virtual
HW waits for free mbufs, while the app waits for the hardware to
notify it for data (by flipping the generation bit on the used Rx
descriptors). Note that after this, the app can't recover.

This fix is a rework of this patch by Marco Lee:
http://dpdk.org/dev/patchwork/patch/6575/. I had to forward port
it, address review comments and also reverted the allocation
failure handling to the first version of the patch
(http://dpdk.org/ml/archives/dev/2015-July/022079.html), since
that's the only approach that seems to work, and seems to be what
other drivers are doing (I checked ixgbe and em). Reusing the mbuf
that's getting passed to the application doesn't seem to make
sense, and it was causing weird issues in our app. Also, reusing
rxm without checking if it's NULL could cause the code to crash.
---
v3:
* rework description after review, explain how HW signal receipt of
  packets

v2:
* address review comments, reworded description a bit

 drivers/net/vmxnet3/vmxnet3_rxtx.c | 39 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 37 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index b109168..93db10f 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -518,6 +518,32 @@
 	return nb_tx;
 }
 
+static inline void
+vmxnet3_renew_desc(vmxnet3_rx_queue_t *rxq, uint8_t ring_id,
+		   struct rte_mbuf *mbuf)
+{
+	uint32_t val = 0;
+	struct vmxnet3_cmd_ring *ring = &rxq->cmd_ring[ring_id];
+	struct Vmxnet3_RxDesc *rxd =
+		(struct Vmxnet3_RxDesc *)(ring->base + ring->next2fill);
+	vmxnet3_buf_info_t *buf_info = &ring->buf_info[ring->next2fill];
+
+	if (ring_id == 0)
+		val = VMXNET3_RXD_BTYPE_HEAD;
+	else
+		val = VMXNET3_RXD_BTYPE_BODY;
+
+	buf_info->m = mbuf;
+	buf_info->len = (uint16_t)(mbuf->buf_len - RTE_PKTMBUF_HEADROOM);
+	buf_info->bufPA = rte_mbuf_data_dma_addr_default(mbuf);
+
+	rxd->addr = buf_info->bufPA;
+	rxd->btype = val;
+	rxd->len = buf_info->len;
+	rxd->gen = ring->gen;
+
+	vmxnet3_cmd_ring_adv_next2fill(ring);
+}
 /*
  *  Allocates mbufs and clusters. Post rx descriptors with buffer details
  *  so that device can receive packets in those buffers.
@@ -657,9 +683,18 @@
 	}
 
 	while (rcd->gen == rxq->comp_ring.gen) {
+		struct rte_mbuf *newm;
+
 		if (nb_rx >= nb_pkts)
 			break;
 
+		newm = rte_mbuf_raw_alloc(rxq->mp);
+		if (unlikely(newm == NULL)) {
+			PMD_RX_LOG(ERR, "Error allocating mbuf");
+			rxq->stats.rx_buf_alloc_failure++;
+			break;
+		}
+
 		idx = rcd->rxdIdx;
 		ring_idx = (uint8_t)((rcd->rqID == rxq->qid1) ? 0 : 1);
 		rxd = (Vmxnet3_RxDesc *)rxq->cmd_ring[ring_idx].base + idx;
@@ -759,8 +794,8 @@
 		VMXNET3_INC_RING_IDX_ONLY(rxq->cmd_ring[ring_idx].next2comp,
 					  rxq->cmd_ring[ring_idx].size);
 
-		/* It's time to allocate some new buf and renew descriptors */
-		vmxnet3_post_rx_bufs(rxq, ring_idx);
+		/* It's time to renew descriptors */
+		vmxnet3_renew_desc(rxq, ring_idx, newm);
 		if (unlikely(rxq->shared->ctrl.updateRxProd)) {
 			VMXNET3_WRITE_BAR0_REG(hw, rxprod_reg[ring_idx] + (rxq->queue_id * VMXNET3_REG_ALIGN),
 					       rxq->cmd_ring[ring_idx].next2fill);
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH v12 0/6] add Tx preparation
From: Jan Mędala @ 2016-12-16 15:37 UTC (permalink / raw)
  To: Ananyev, Konstantin
  Cc: Yigit, Ferruh, Thomas Monjalon, Harish Patil, dev@dpdk.org,
	Rahul Lakkireddy, Stephen Hurd, Jakub Palider, John Daley,
	Adrien Mazarguil, Alejandro Lucero, Rasesh Mody, Jacob, Jerin,
	Yuanhan Liu, Kulasek, TomaszX, olivier.matz@6wind.com, Yong Wang,
	evgenys@amazon.com, netanel@amazon.com
In-Reply-To: <2601191342CEEE43887BDE71AB9772583F0F0865@irsmsx105.ger.corp.intel.com>

>
> ​>At this point we need to have only pseudo-header checksum for TSO. Maybe
> there will be new requirements, but that's something I cannot predict at
> this point.
>
> Ok great, then we'll add a patch for ENA for v14, unless you guys would
> like to do it yourself.
> ​

​That'd be great!​

>We also need to deliver a fix for issue we found during investigation of
> tx_prep() API.
>
> Not sure what you are talking about...
> Is that some separate issue not related directly to tx_prepare()?
>

​Yes, this is something not related, but came up during investigation of
tx_prepare(), so this is an additional benefit of this topic :-)​

​Thanks
Jan

^ permalink raw reply

* Re: [PATCH v1] doc: add details of sub-trees and maintainers
From: Bruce Richardson @ 2016-12-16 16:19 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: John McNamara, dev
In-Reply-To: <7087089.fklzjh68XY@xps13>

On Tue, Dec 06, 2016 at 06:32:37PM +0100, Thomas Monjalon wrote:
> Thanks for documenting the process, John.
> 
> 2016-12-02 16:44, John McNamara:
> > +The role of the component maintainers is to:
> > +
> 
> I would add:
> * Coordinate how improvements and fixes are done.
> 
> > +* Review patches for the component or delegate the review.
> > +  This should be done, ideally, within 1-2 weeks of submission to the mailing list.
> > +* Add an ``acked-by`` to patches, or patchsets, that they agree are ready for committing to a tree.
> 
> I do not understand "that they agree are ready"
> 
> > +Component maintainers can be added or removed by submitting a patch to the ``MAINTAINERS`` file.
> > +Maintainers should have demonstrated a reasonable level of contributions to the component area or to a similar area.
> 
> I suggest "a reasonable level of contributions or reviews for the component area".
> 
> > +This should be confirmed by an ``ack`` from an established contributor.
> > +There can be more than one component maintainer if desired.
> > +
> > +The role of the tree maintainers is to:
> > +
> > +* Maintain the overall quality of their tree.
> > +  This can entail additional review, compilation checks or other tests deemed necessary by the maintainer.
> > +* Commit reviewed patches.
> 
> We need to explain that a tree maintainer rely on component maintainers
> and also on any contributor doing a review. However he does not give
> the same credit to everyone. It is a matter of trust.
> When a not (yet) trusted contributor gives an opinion, it may need
> more checks or opinions.
> 
> > +* Prepare the tree for integration.
> 
> They are responsibles of the pace, giving time for reviews and tests while releasing in time.
> 
> > +Tree maintainers can be added or removed by submitting a patch to the ``MAINTAINERS`` file.
> > +The proposer should justify the need for a new sub-tree and should have demonstrated a sufficient level of contributions in the area or to a similar area.
> > +This should be confirmed by 3 ``acks`` from established contributors.
> 
> In practice, people do not give acks because it is obvious.
> I think there is no need to add the 3 acks rule because of the line below.
> 

I would suggest that for new trees we just look for an ack from an
existing tree maintainer.

> > +Disagreements on trees or maintainers can be brought to the Technical Steering Committee.
> 
> Its name is still the "Technical Board".
> 
> > +Tree backup maintainers, when required, can be selected from the active tree maintainers.
> > +This can be agreed and coordinated by the tree maintainers.
> 
> OK, thanks

I would suggest a slightly different policy here - given that
maintainers of subtrees may not be fully familiar with the details of
other subtree. However, they should have a reasonable high-level view of
the project. Therefore I suggest:

* the backup maintainer for the master tree should be selected from the
  existing subtree maintainers from the project.
* the backup maintainer for a sub-tree should be selected from among the
  component maintainers within that subtree.

Having things this way would ensure that the maintenance of the master
tree is always done by someone familiar with maintaining trees, while
also at the same time having a way to allow others get familiar with
maintaining trees by taking a stint as backup sub-tree maintainer. It
also should ensure that e.g. the net tree committer is always someone
familiar with NIC PMDs.

/Bruce

^ permalink raw reply

* Re: [PATCH 3/3] driver: vHost support to free consumed buffers
From: Stephen Hemminger @ 2016-12-16 16:24 UTC (permalink / raw)
  To: Billy McFall; +Cc: thomas.monjalon, wenzhuo.lu, dev
In-Reply-To: <20161216124851.2640-4-bmcfall@redhat.com>

On Fri, 16 Dec 2016 07:48:51 -0500
Billy McFall <bmcfall@redhat.com> wrote:

> Add support to the vHostdriver for the new API to force free consumed
> buffers on TX ring. vHost does not cache the mbufs so there is no work
> to do.
> 
> Signed-off-by: Billy McFall <bmcfall@redhat.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index 766d4ef..6493d56 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -939,6 +939,16 @@ eth_queue_release(void *q)
>  }
>  
>  static int
> +eth_tx_done_cleanup(void *txq __rte_unused, uint32_t free_cnt __rte_unused)
> +{
> +	/*
> +	 * vHost does not hang onto mbuf. eth_vhost_tx() copies packet data
> +	 * and releases mbuf, so nothing to cleanup.
> +	 */
> +	return 0;
> +}
> +
> +static int
>  eth_link_update(struct rte_eth_dev *dev __rte_unused,
>  		int wait_to_complete __rte_unused)
>  {
> @@ -979,6 +989,7 @@ static const struct eth_dev_ops ops = {
>  	.tx_queue_setup = eth_tx_queue_setup,
>  	.rx_queue_release = eth_queue_release,
>  	.tx_queue_release = eth_queue_release,
> +	.tx_done_cleanup = eth_tx_done_cleanup,
>  	.link_update = eth_link_update,
>  	.stats_get = eth_stats_get,
>  	.stats_reset = eth_stats_reset,

Rather than having to change every drive, why not make this the default
behavior?

^ permalink raw reply

* [PATCH v2 00/25] Generic flow API (rte_flow)
From: Adrien Mazarguil @ 2016-12-16 16:24 UTC (permalink / raw)
  To: dev
In-Reply-To: <cover.1479309719.git.adrien.mazarguil@6wind.com>

As previously discussed in RFC v1 [1], RFC v2 [2], with changes
described in [3] (also pasted below), here is the first non-draft series
for this new API.

Its capabilities are so generic that its name had to be vague, it may be
called "Generic flow API", "Generic flow interface" (possibly shortened
as "GFI") to refer to the name of the new filter type, or "rte_flow" from
the prefix used for its public symbols. I personally favor the latter.

While it is currently meant to supersede existing filter types in order for
all PMDs to expose a common filtering/classification interface, it may
eventually evolve to cover the following ideas as well:

- Rx/Tx offloads configuration through automatic offloads for specific
  packets, e.g. performing checksum on TCP packets could be expressed with
  an egress rule with a TCP pattern and a kind of checksum action.

- RSS configuration (already defined actually). Could be global or per rule
  depending on hardware capabilities.

- Switching configuration for devices with many physical ports; rules doing
  both ingress and egress could even be used to completely bypass software
  if supported by hardware.

 [1] http://dpdk.org/ml/archives/dev/2016-July/043365.html
 [2] http://dpdk.org/ml/archives/dev/2016-August/045383.html
 [3] http://dpdk.org/ml/archives/dev/2016-November/050044.html

Changes since v1 series:

- Added programmer's guide documentation for rte_flow.

- Added depreciation notice for the legacy API.

- Documented testpmd flow command.

- Fixed missing rte_flow_flush symbol in rte_ether_version.map.

- Cleaned up API documentation in rte_flow.h.

- Replaced "min/max" parameters with "num" in struct rte_flow_item_any, to
  align behavior with other item definitions.

- Fixed "type" (EtherType) size in struct rte_flow_item_eth.

- Renamed "queues" to "num" in struct rte_flow_action_rss.

- Fixed missing const in rte_flow_error_set() prototype definition.

- Fixed testpmd flow create command that did not save the rte_flow object
  pointer, causing crashes.

- Hopefully fixed all the remaining ICC/clang errors.

- Replaced testpmd flow command's "fix" token with "is" for clarity.

Changes since RFC v2:

- New separate VLAN pattern item (previously part of the ETH definition),
  found to be much more convenient.

- Removed useless "any" field from VF pattern item, the same effect can be
  achieved by not providing a specification structure.

- Replaced bit-fields from the VXLAN pattern item to avoid endianness
  conversion issues on 24-bit fields.

- Updated struct rte_flow_item with a new "last" field to create inclusive
  ranges. They are defined as the interval between (spec & mask) and
  (last & mask). All three parameters are optional.

- Renamed ID action MARK.

- Renamed "queue" fields in actions QUEUE and DUP to "index".

- "rss_conf" field in RSS action is now const.

- VF action now uses a 32 bit ID like its pattern item counterpart.

- Removed redundant struct rte_flow_pattern, API functions now expect
  struct
  rte_flow_item lists terminated by END items.

- Replaced struct rte_flow_actions for the same reason, with struct
  rte_flow_action lists terminated by END actions.

- Error types (enum rte_flow_error_type) have been updated and the cause
  pointer in struct rte_flow_error is now const.

- Function prototypes (rte_flow_create, rte_flow_validate) have also been
  updated for clarity.

Additions:

- Public wrapper functions rte_flow_{validate|create|destroy|flush|query}
  are now implemented in rte_flow.c, with their symbols exported and
  versioned. Related filter type RTE_ETH_FILTER_GENERIC has been added.

- A separate header (rte_flow_driver.h) has been added for driver-side
  functionality, in particular struct rte_flow_ops which contains PMD
  callbacks returned by RTE_ETH_FILTER_GENERIC query.

- testpmd now exposes most of this API through the new "flow" command.

What remains to be done:

- Using endian-aware integer types (rte_beX_t) where necessary for clarity.

- API documentation (based on RFC).

- testpmd flow command documentation (although context-aware command
  completion should already help quite a bit in this regard).

- A few pattern item / action properties cannot be configured yet
  (e.g. rss_conf parameter for RSS action) and a few completions
  (e.g. possible queue IDs) should be added.

Adrien Mazarguil (25):
  ethdev: introduce generic flow API
  doc: add rte_flow prog guide
  doc: announce depreciation of legacy filter types
  cmdline: add support for dynamic tokens
  cmdline: add alignment constraint
  app/testpmd: implement basic support for rte_flow
  app/testpmd: add flow command
  app/testpmd: add rte_flow integer support
  app/testpmd: add flow list command
  app/testpmd: add flow flush command
  app/testpmd: add flow destroy command
  app/testpmd: add flow validate/create commands
  app/testpmd: add flow query command
  app/testpmd: add rte_flow item spec handler
  app/testpmd: add rte_flow item spec prefix length
  app/testpmd: add rte_flow bit-field support
  app/testpmd: add item any to flow command
  app/testpmd: add various items to flow command
  app/testpmd: add item raw to flow command
  app/testpmd: add items eth/vlan to flow command
  app/testpmd: add items ipv4/ipv6 to flow command
  app/testpmd: add L4 items to flow command
  app/testpmd: add various actions to flow command
  app/testpmd: add queue actions to flow command
  doc: describe testpmd flow command

 MAINTAINERS                                 |    4 +
 app/test-pmd/Makefile                       |    1 +
 app/test-pmd/cmdline.c                      |   32 +
 app/test-pmd/cmdline_flow.c                 | 2575 ++++++++++++++++++++++
 app/test-pmd/config.c                       |  485 ++++
 app/test-pmd/csumonly.c                     |    1 +
 app/test-pmd/flowgen.c                      |    1 +
 app/test-pmd/icmpecho.c                     |    1 +
 app/test-pmd/ieee1588fwd.c                  |    1 +
 app/test-pmd/iofwd.c                        |    1 +
 app/test-pmd/macfwd.c                       |    1 +
 app/test-pmd/macswap.c                      |    1 +
 app/test-pmd/parameters.c                   |    1 +
 app/test-pmd/rxonly.c                       |    1 +
 app/test-pmd/testpmd.c                      |    6 +
 app/test-pmd/testpmd.h                      |   27 +
 app/test-pmd/txonly.c                       |    1 +
 doc/api/doxy-api-index.md                   |    2 +
 doc/guides/prog_guide/index.rst             |    1 +
 doc/guides/prog_guide/rte_flow.rst          | 1853 ++++++++++++++++
 doc/guides/rel_notes/deprecation.rst        |    7 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  612 +++++
 lib/librte_cmdline/cmdline_parse.c          |   67 +-
 lib/librte_cmdline/cmdline_parse.h          |   21 +
 lib/librte_ether/Makefile                   |    3 +
 lib/librte_ether/rte_eth_ctrl.h             |    1 +
 lib/librte_ether/rte_ether_version.map      |   11 +
 lib/librte_ether/rte_flow.c                 |  159 ++
 lib/librte_ether/rte_flow.h                 |  942 ++++++++
 lib/librte_ether/rte_flow_driver.h          |  181 ++
 30 files changed, 6991 insertions(+), 9 deletions(-)
 create mode 100644 app/test-pmd/cmdline_flow.c
 create mode 100644 doc/guides/prog_guide/rte_flow.rst
 create mode 100644 lib/librte_ether/rte_flow.c
 create mode 100644 lib/librte_ether/rte_flow.h
 create mode 100644 lib/librte_ether/rte_flow_driver.h

-- 
2.1.4

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox