All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e
@ 2016-12-15 21:04 Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 01/29] net/i40e: support link status notification Qi Zhang
                   ` (30 more replies)
  0 siblings, 31 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:04 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Qi Zhang

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.

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

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

* [PATCH v3 01/29] net/i40e: support link status notification
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
@ 2016-12-15 21:04 ` Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 02/29] net/i40e: add callback to user on VF to PF mbox msg Qi Zhang
                   ` (29 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:04 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Wenzhuo Lu

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

Add an API to expose the ability, that PF can notify VF
when link status changes, to APP.
So if PF APP doesn't want to enable interruption but check
link status by itself, PF APP can let VF know link status
changed.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/Makefile                 |  4 ++-
 drivers/net/i40e/i40e_ethdev.c            | 28 +++++++++++++++
 drivers/net/i40e/i40e_pf.c                |  4 +--
 drivers/net/i40e/i40e_pf.h                |  4 ++-
 drivers/net/i40e/rte_pmd_i40e.h           | 58 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  6 ++++
 6 files changed, 100 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/i40e/rte_pmd_i40e.h

diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 66997b6..a2ef53c 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -1,6 +1,6 @@
 #   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
@@ -111,6 +111,8 @@ ifeq ($(findstring RTE_MACHINE_CPUFLAG_SSE4_1,$(CFLAGS)),)
 CFLAGS_i40e_rxtx_vec_sse.o += -msse4.1
 endif
 
+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h
 
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f42f4ba..fc7e987 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -62,6 +62,7 @@
 #include "i40e_rxtx.h"
 #include "i40e_pf.h"
 #include "i40e_regs.h"
+#include "rte_pmd_i40e.h"
 
 #define ETH_I40E_FLOATING_VEB_ARG	"enable_floating_veb"
 #define ETH_I40E_FLOATING_VEB_LIST_ARG	"floating_veb_list"
@@ -9695,3 +9696,30 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	if (vf > pf->vf_num - 1 || !pf->vfs) {
+		PMD_DRV_LOG(ERR, "Invalid argument.");
+		return -EINVAL;
+	}
+
+	i40e_notify_vf_link_status(dev, &pf->vfs[vf]);
+
+	return 0;
+}
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index ddfc140..f70712b 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.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
@@ -897,7 +897,7 @@ i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,
 	return ret;
 }
 
-static void
+void
 i40e_notify_vf_link_status(struct rte_eth_dev *dev, struct i40e_pf_vf *vf)
 {
 	struct i40e_virtchnl_pf_event event;
diff --git a/drivers/net/i40e/i40e_pf.h b/drivers/net/i40e/i40e_pf.h
index cddc45c..59bf2ee 100644
--- a/drivers/net/i40e/i40e_pf.h
+++ b/drivers/net/i40e/i40e_pf.h
@@ -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
@@ -123,5 +123,7 @@ void i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 				uint8_t *msg, uint16_t msglen);
 int i40e_pf_host_init(struct rte_eth_dev *dev);
 int i40e_pf_host_uninit(struct rte_eth_dev *dev);
+void i40e_notify_vf_link_status(struct rte_eth_dev *dev,
+				struct i40e_pf_vf *vf);
 
 #endif /* _I40E_PF_H_ */
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
new file mode 100644
index 0000000..14852f2
--- /dev/null
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -0,0 +1,58 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright (c) 2016 Intel Corporation. All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file rte_pmd_i40e.h
+ * i40e PMD specific functions.
+ *
+ **/
+
+#ifndef _PMD_I40E_H_
+#define _PMD_I40E_H_
+
+#include <rte_ethdev.h>
+
+/**
+ * Notify VF when PF link status changes.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if *vf* invalid.
+ */
+int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
+
+#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 ef35398..4555446 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -2,3 +2,9 @@ DPDK_2.0 {
 
 	local: *;
 };
+
+DPDK_17.02 {
+	global:
+
+	rte_pmd_i40e_ping_vfs;
+} DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 02/29] net/i40e: add callback to user on VF to PF mbox msg
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 01/29] net/i40e: support link status notification Qi Zhang
@ 2016-12-15 21:04 ` Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 03/29] net/i40e: set VF MAC anti-spoofing from PF Qi Zhang
                   ` (28 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:04 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Wenzhuo Lu

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

The callback asks the user application if it is allowed to
perform the mailbox messages.

If the return value from user is RTE_PMD_I40E_MB_EVENT_PROCEED
then continue. If ACK or NACK, do nothing and send
not_supported to VF.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_pf.c      | 230 ++++++++++++++++++++++++++++++++++------
 drivers/net/i40e/rte_pmd_i40e.h |  21 ++++
 2 files changed, 216 insertions(+), 35 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index f70712b..8b8a14f 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -55,6 +55,7 @@
 #include "i40e_ethdev.h"
 #include "i40e_rxtx.h"
 #include "i40e_pf.h"
+#include "rte_pmd_i40e.h"
 
 #define I40E_CFG_CRCSTRIP_DEFAULT 1
 
@@ -272,14 +273,23 @@ i40e_pf_host_send_msg_to_vf(struct i40e_pf_vf *vf,
 }
 
 static void
-i40e_pf_host_process_cmd_version(struct i40e_pf_vf *vf)
+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;
-	i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
-		I40E_SUCCESS, (uint8_t *)&info, sizeof(info));
+
+	if (b_op)
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
+					    I40E_SUCCESS,
+					    (uint8_t *)&info,
+					    sizeof(info));
+	else
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
+					    I40E_NOT_SUPPORTED,
+					    (uint8_t *)&info,
+					    sizeof(info));
 }
 
 static int
@@ -292,13 +302,20 @@ i40e_pf_host_process_cmd_reset_vf(struct i40e_pf_vf *vf)
 }
 
 static int
-i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf)
+i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, bool b_op)
 {
 	struct i40e_virtchnl_vf_resource *vf_res = NULL;
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	uint32_t len = 0;
 	int ret = I40E_SUCCESS;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(vf,
+					    I40E_VIRTCHNL_OP_GET_VF_RESOURCES,
+					    I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	/* only have 1 VSI by default */
 	len =  sizeof(struct i40e_virtchnl_vf_resource) +
 				I40E_DEFAULT_VF_VSI_NUM *
@@ -423,7 +440,8 @@ i40e_pf_host_hmc_config_txq(struct i40e_hw *hw,
 static int
 i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 					   uint8_t *msg,
-					   uint16_t msglen)
+					   uint16_t msglen,
+					   bool b_op)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	struct i40e_vsi *vsi = vf->vsi;
@@ -432,6 +450,13 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 	struct i40e_virtchnl_queue_pair_info *vc_qpi;
 	int i, ret = I40E_SUCCESS;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(vf,
+					    I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES,
+					    I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (!msg || vc_vqci->num_queue_pairs > vsi->nb_qps ||
 		vc_vqci->num_queue_pairs > I40E_MAX_VSI_QP ||
 		msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqci,
@@ -482,7 +507,8 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,
 					       uint8_t *msg,
-					       uint16_t msglen)
+					       uint16_t msglen,
+					       bool b_op)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	struct i40e_vsi *vsi = vf->vsi;
@@ -491,6 +517,14 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,
 	struct i40e_virtchnl_queue_pair_ext_info *vc_qpei;
 	int i, ret = I40E_SUCCESS;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (!msg || vc_vqcei->num_queue_pairs > vsi->nb_qps ||
 		vc_vqcei->num_queue_pairs > I40E_MAX_VSI_QP ||
 		msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqcei,
@@ -539,12 +573,21 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,
 
 static int
 i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf,
-					uint8_t *msg, uint16_t msglen)
+					uint8_t *msg, uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_irq_map_info *irqmap =
 	    (struct i40e_virtchnl_irq_map_info *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen < sizeof(struct i40e_virtchnl_irq_map_info)) {
 		PMD_DRV_LOG(ERR, "buffer too short");
 		ret = I40E_ERR_PARAM;
@@ -646,12 +689,21 @@ i40e_pf_host_process_cmd_enable_queues(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_disable_queues(struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_queue_select *q_sel =
 		(struct i40e_virtchnl_queue_select *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_DISABLE_QUEUES,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*q_sel)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -669,7 +721,8 @@ i40e_pf_host_process_cmd_disable_queues(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,
 					   uint8_t *msg,
-					   uint16_t msglen)
+					   uint16_t msglen,
+					   bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -678,6 +731,14 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,
 	int i;
 	struct ether_addr *mac;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	memset(&filter, 0 , sizeof(struct i40e_mac_filter_info));
 
 	if (msg == NULL || msglen <= sizeof(*addr_list)) {
@@ -707,7 +768,8 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,
 					   uint8_t *msg,
-					   uint16_t msglen)
+					   uint16_t msglen,
+					   bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -715,6 +777,14 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,
 	int i;
 	struct ether_addr *mac;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen <= sizeof(*addr_list)) {
 		PMD_DRV_LOG(ERR, "delete_ether_address argument too short");
 		ret = I40E_ERR_PARAM;
@@ -739,7 +809,8 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,
 
 static int
 i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
-				uint8_t *msg, uint16_t msglen)
+				uint8_t *msg, uint16_t msglen,
+				bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -747,6 +818,14 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
 	int i;
 	uint16_t *vid;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_ADD_VLAN,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen <= sizeof(*vlan_filter_list)) {
 		PMD_DRV_LOG(ERR, "add_vlan argument too short");
 		ret = I40E_ERR_PARAM;
@@ -771,7 +850,8 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,
 				  uint8_t *msg,
-				  uint16_t msglen)
+				  uint16_t msglen,
+				  bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -779,6 +859,14 @@ i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,
 	int i;
 	uint16_t *vid;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_DEL_VLAN,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen <= sizeof(*vlan_filter_list)) {
 		PMD_DRV_LOG(ERR, "delete_vlan argument too short");
 		ret = I40E_ERR_PARAM;
@@ -803,7 +891,8 @@ static int
 i40e_pf_host_process_cmd_config_promisc_mode(
 					struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_promisc_info *promisc =
@@ -811,6 +900,14 @@ i40e_pf_host_process_cmd_config_promisc_mode(
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	bool unicast = FALSE, multicast = FALSE;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*promisc)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -836,13 +933,20 @@ i40e_pf_host_process_cmd_config_promisc_mode(
 }
 
 static int
-i40e_pf_host_process_cmd_get_stats(struct i40e_pf_vf *vf)
+i40e_pf_host_process_cmd_get_stats(struct i40e_pf_vf *vf, bool b_op)
 {
 	i40e_update_vsi_stats(vf->vsi);
 
-	i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_STATS,
-		I40E_SUCCESS, (uint8_t *)&vf->vsi->eth_stats,
-				sizeof(vf->vsi->eth_stats));
+	if (b_op)
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_STATS,
+					    I40E_SUCCESS,
+					    (uint8_t *)&vf->vsi->eth_stats,
+					    sizeof(vf->vsi->eth_stats));
+	else
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_STATS,
+					    I40E_NOT_SUPPORTED,
+					    (uint8_t *)&vf->vsi->eth_stats,
+					    sizeof(vf->vsi->eth_stats));
 
 	return I40E_SUCCESS;
 }
@@ -851,12 +955,21 @@ static int
 i40e_pf_host_process_cmd_cfg_vlan_offload(
 					struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_vlan_offload_info *offload =
 			(struct i40e_virtchnl_vlan_offload_info *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*offload)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -877,12 +990,21 @@ i40e_pf_host_process_cmd_cfg_vlan_offload(
 static int
 i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_pvid_info  *tpid_info =
 			(struct i40e_virtchnl_pvid_info *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CFG_VLAN_PVID,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*tpid_info)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -923,6 +1045,8 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 	struct i40e_pf_vf *vf;
 	/* AdminQ will pass absolute VF id, transfer to internal vf id */
 	uint16_t vf_id = abs_vf_id - hw->func_caps.vf_base_id;
+	struct rte_pmd_i40e_mb_event_param cb_param;
+	bool b_op = TRUE;
 
 	if (vf_id > pf->vf_num - 1 || !pf->vfs) {
 		PMD_DRV_LOG(ERR, "invalid argument");
@@ -937,10 +1061,35 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 		return;
 	}
 
+	/**
+	 * initialise structure to send to user application
+	 * will return response from user in retval field
+	 */
+	cb_param.retval = RTE_PMD_I40E_MB_EVENT_PROCEED;
+	cb_param.vfid = vf_id;
+	cb_param.msg_type = opcode;
+	cb_param.msg = (void *)msg;
+	cb_param.msglen = msglen;
+
+	/**
+	 * Ask user application if we're allowed to perform those functions.
+	 * If we get cb_param.retval == RTE_PMD_I40E_MB_EVENT_PROCEED,
+	 * then business as usual.
+	 * If RTE_PMD_I40E_MB_EVENT_NOOP_ACK or RTE_PMD_I40E_MB_EVENT_NOOP_NACK,
+	 * do nothing and send not_supported to VF. As PF must send a response
+	 * to VF and ACK/NACK is not defined.
+	 */
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
+	if (cb_param.retval != RTE_PMD_I40E_MB_EVENT_PROCEED) {
+		PMD_DRV_LOG(WARNING, "VF to PF message(%d) is not permitted!",
+			    opcode);
+		b_op = FALSE;
+	}
+
 	switch (opcode) {
 	case I40E_VIRTCHNL_OP_VERSION :
 		PMD_DRV_LOG(INFO, "OP_VERSION received");
-		i40e_pf_host_process_cmd_version(vf);
+		i40e_pf_host_process_cmd_version(vf, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_RESET_VF :
 		PMD_DRV_LOG(INFO, "OP_RESET_VF received");
@@ -948,61 +1097,72 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 		break;
 	case I40E_VIRTCHNL_OP_GET_VF_RESOURCES:
 		PMD_DRV_LOG(INFO, "OP_GET_VF_RESOURCES received");
-		i40e_pf_host_process_cmd_get_vf_resource(vf);
+		i40e_pf_host_process_cmd_get_vf_resource(vf, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_VSI_QUEUES received");
-		i40e_pf_host_process_cmd_config_vsi_queues(vf, msg, msglen);
+		i40e_pf_host_process_cmd_config_vsi_queues(vf, msg,
+							   msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_VSI_QUEUES_EXT received");
 		i40e_pf_host_process_cmd_config_vsi_queues_ext(vf, msg,
-								msglen);
+							       msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_IRQ_MAP received");
-		i40e_pf_host_process_cmd_config_irq_map(vf, msg, msglen);
+		i40e_pf_host_process_cmd_config_irq_map(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_ENABLE_QUEUES:
 		PMD_DRV_LOG(INFO, "OP_ENABLE_QUEUES received");
-		i40e_pf_host_process_cmd_enable_queues(vf, msg, msglen);
-		i40e_notify_vf_link_status(dev, vf);
+		if (b_op) {
+			i40e_pf_host_process_cmd_enable_queues(vf, msg, msglen);
+			i40e_notify_vf_link_status(dev, vf);
+		} else {
+			i40e_pf_host_send_msg_to_vf(
+				vf, I40E_VIRTCHNL_OP_ENABLE_QUEUES,
+				I40E_NOT_SUPPORTED, NULL, 0);
+		}
 		break;
 	case I40E_VIRTCHNL_OP_DISABLE_QUEUES:
 		PMD_DRV_LOG(INFO, "OP_DISABLE_QUEUE received");
-		i40e_pf_host_process_cmd_disable_queues(vf, msg, msglen);
+		i40e_pf_host_process_cmd_disable_queues(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS:
 		PMD_DRV_LOG(INFO, "OP_ADD_ETHER_ADDRESS received");
-		i40e_pf_host_process_cmd_add_ether_address(vf, msg, msglen);
+		i40e_pf_host_process_cmd_add_ether_address(vf, msg,
+							   msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS:
 		PMD_DRV_LOG(INFO, "OP_DEL_ETHER_ADDRESS received");
-		i40e_pf_host_process_cmd_del_ether_address(vf, msg, msglen);
+		i40e_pf_host_process_cmd_del_ether_address(vf, msg,
+							   msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_ADD_VLAN:
 		PMD_DRV_LOG(INFO, "OP_ADD_VLAN received");
-		i40e_pf_host_process_cmd_add_vlan(vf, msg, msglen);
+		i40e_pf_host_process_cmd_add_vlan(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_DEL_VLAN:
 		PMD_DRV_LOG(INFO, "OP_DEL_VLAN received");
-		i40e_pf_host_process_cmd_del_vlan(vf, msg, msglen);
+		i40e_pf_host_process_cmd_del_vlan(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_PROMISCUOUS_MODE received");
-		i40e_pf_host_process_cmd_config_promisc_mode(vf, msg, msglen);
+		i40e_pf_host_process_cmd_config_promisc_mode(vf, msg,
+							     msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_GET_STATS:
 		PMD_DRV_LOG(INFO, "OP_GET_STATS received");
-		i40e_pf_host_process_cmd_get_stats(vf);
+		i40e_pf_host_process_cmd_get_stats(vf, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD:
 		PMD_DRV_LOG(INFO, "OP_CFG_VLAN_OFFLOAD received");
-		i40e_pf_host_process_cmd_cfg_vlan_offload(vf, msg, msglen);
+		i40e_pf_host_process_cmd_cfg_vlan_offload(vf, msg,
+							  msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CFG_VLAN_PVID:
 		PMD_DRV_LOG(INFO, "OP_CFG_VLAN_PVID received");
-		i40e_pf_host_process_cmd_cfg_pvid(vf, msg, msglen);
+		i40e_pf_host_process_cmd_cfg_pvid(vf, msg, msglen, b_op);
 		break;
 	/* Don't add command supported below, which will
 	 * return an error code.
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 14852f2..eb7a72b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -42,6 +42,27 @@
 #include <rte_ethdev.h>
 
 /**
+ * Response sent back to i40e driver from user app after callback
+ */
+enum rte_pmd_i40e_mb_event_rsp {
+	RTE_PMD_I40E_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+	RTE_PMD_I40E_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+	RTE_PMD_I40E_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+	RTE_PMD_I40E_MB_EVENT_MAX       /**< max value of this enum */
+};
+
+/**
+ * Data sent to the user application when the callback is executed.
+ */
+struct rte_pmd_i40e_mb_event_param {
+	uint16_t vfid;     /**< Virtual Function number */
+	uint16_t msg_type; /**< VF to PF message type, see i40e_virtchnl_ops */
+	uint16_t retval;   /**< return value */
+	void *msg;         /**< pointer to message */
+	uint16_t msglen;   /**< length of the message */
+};
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
-- 
2.7.4

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

* [PATCH v3 03/29] net/i40e: set VF MAC anti-spoofing from PF
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 01/29] net/i40e: support link status notification Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 02/29] net/i40e: add callback to user on VF to PF mbox msg Qi Zhang
@ 2016-12-15 21:04 ` Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 04/29] net/i40e: set VF VLAN " Qi Zhang
                   ` (27 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:04 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Wenzhuo Lu

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

Support enabling/disabling VF MAC anti-spoofing from
PF.
User can call the API on PF to enable/disable a specific
VF's MAC anti-spoofing.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 63 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 83 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index fc7e987..c23e6b5 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9723,3 +9723,66 @@ rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
 
 	return 0;
 }
+
+int
+rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	struct i40e_hw *hw;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	/* Check if it has been already on or off */
+	if (vsi->info.valid_sections &
+		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SECURITY_VALID)) {
+		if (on) {
+			if ((vsi->info.sec_flags &
+			     I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK) ==
+			    I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK)
+				return 0; /* already on */
+		} else {
+			if ((vsi->info.sec_flags &
+			     I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK) == 0)
+				return 0; /* already off */
+		}
+	}
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SECURITY_VALID);
+	if (on)
+		vsi->info.sec_flags |= I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK;
+	else
+		vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index eb7a72b..52319cf 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -76,4 +76,23 @@ struct rte_pmd_i40e_mb_event_param {
  */
 int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
 
+/**
+ * Enable/Disable VF MAC anti spoofing.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set MAC anti spoofing.
+ * @param on
+ *    1 - Enable VFs MAC anti spoofing.
+ *    0 - Disable VFs MAC anti spoofing.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
+				       uint16_t vf_id,
+				       uint8_t on);
+
 #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 4555446..30efb08 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -7,4 +7,5 @@ DPDK_17.02 {
 	global:
 
 	rte_pmd_i40e_ping_vfs;
+	rte_pmd_i40e_set_vf_mac_anti_spoof;
 } DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 04/29] net/i40e: set VF VLAN anti-spoofing from PF
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (2 preceding siblings ...)
  2016-12-15 21:04 ` [PATCH v3 03/29] net/i40e: set VF MAC anti-spoofing from PF Qi Zhang
@ 2016-12-15 21:04 ` Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 05/29] net/i40e: set Tx loopback " Qi Zhang
                   ` (26 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:04 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Wenzhuo Lu

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

Support enabling/disabling VF VLAN anti-spoofing from
PF.
User can call the API on PF to enable/disable a specific
VF's VLAN anti-spoofing.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 116 +++++++++++++++++++++++++++++-
 drivers/net/i40e/i40e_ethdev.h            |   1 +
 drivers/net/i40e/rte_pmd_i40e.h           |  19 +++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 4 files changed, 135 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index c23e6b5..77be98b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4418,6 +4418,7 @@ i40e_vsi_setup(struct i40e_pf *pf,
 	vsi->max_macaddrs = I40E_NUM_MACADDR_MAX;
 	vsi->parent_vsi = uplink_vsi ? uplink_vsi : pf->main_vsi;
 	vsi->user_param = user_param;
+	vsi->vlan_anti_spoof_on = 0;
 	/* Allocate queues */
 	switch (vsi->type) {
 	case I40E_VSI_MAIN  :
@@ -5761,17 +5762,35 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi,
 			 uint16_t vlan_id, bool on)
 {
 	uint32_t vid_idx, vid_bit;
+	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
+	struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0};
+	int ret;
 
 	if (vlan_id > ETH_VLAN_ID_MAX)
 		return;
 
 	vid_idx = I40E_VFTA_IDX(vlan_id);
 	vid_bit = I40E_VFTA_BIT(vlan_id);
+	vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
 
-	if (on)
+	if (on) {
+		if (vsi->vlan_anti_spoof_on) {
+			ret = i40e_aq_add_vlan(hw, vsi->seid,
+					       &vlan_data, 1, NULL);
+			if (ret != I40E_SUCCESS)
+				PMD_DRV_LOG(ERR, "Failed to add vlan filter");
+		}
 		vsi->vfta[vid_idx] |= vid_bit;
-	else
+	} else {
+		if (vsi->vlan_anti_spoof_on) {
+			ret = i40e_aq_remove_vlan(hw, vsi->seid,
+						  &vlan_data, 1, NULL);
+			if (ret != I40E_SUCCESS)
+				PMD_DRV_LOG(ERR,
+					    "Failed to remove vlan filter");
+		}
 		vsi->vfta[vid_idx] &= ~vid_bit;
+	}
 }
 
 /**
@@ -9786,3 +9805,96 @@ rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+static int
+i40e_add_rm_all_vlan_filter(struct i40e_vsi *vsi, uint8_t add)
+{
+	uint32_t j, k;
+	uint16_t vlan_id;
+	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
+	struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0};
+	int ret;
+
+	for (j = 0; j < I40E_VFTA_SIZE; j++) {
+		if (!vsi->vfta[j])
+			continue;
+
+		for (k = 0; k < I40E_UINT32_BIT_SIZE; k++) {
+			if (!(vsi->vfta[j] & (1 << k)))
+				continue;
+
+			vlan_id = j * I40E_UINT32_BIT_SIZE + k;
+			vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
+			if (add)
+				ret = i40e_aq_add_vlan(hw, vsi->seid,
+						       &vlan_data, 1, NULL);
+			else
+				ret = i40e_aq_remove_vlan(hw, vsi->seid,
+							  &vlan_data, 1, NULL);
+			if (ret != I40E_SUCCESS) {
+				PMD_DRV_LOG(ERR,
+					    "Failed to add/rm vlan filter");
+				return ret;
+			}
+		}
+	}
+
+	return I40E_SUCCESS;
+}
+
+int
+rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	struct i40e_hw *hw;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	/* Check if it has been already on or off */
+	if (vsi->vlan_anti_spoof_on == on)
+		return 0; /* already on or off */
+
+	vsi->vlan_anti_spoof_on = on;
+	ret = i40e_add_rm_all_vlan_filter(vsi, on);
+	if (ret)
+		return ret;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SECURITY_VALID);
+	if (on)
+		vsi->info.sec_flags |= I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK;
+	else
+		vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 298cef4..0db140b 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -300,6 +300,7 @@ struct i40e_vsi {
 	uint16_t msix_intr; /* The MSIX interrupt binds to VSI */
 	uint16_t nb_msix;   /* The max number of msix vector */
 	uint8_t enabled_tc; /* The traffic class enabled */
+	uint8_t vlan_anti_spoof_on; /* The VLAN anti-spoofing enabled */
 	struct i40e_bw_info bw_info; /* VSI bandwidth information */
 };
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 52319cf..c8736c8 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -95,4 +95,23 @@ int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
 				       uint16_t vf_id,
 				       uint8_t on);
 
+/**
+ * Enable/Disable VF VLAN anti spoofing.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set VLAN anti spoofing.
+ * @param on
+ *    1 - Enable VFs VLAN anti spoofing.
+ *    0 - Disable VFs VLAN anti spoofing.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
+					uint16_t vf_id,
+					uint8_t on);
+
 #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 30efb08..fff6cf9 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -8,4 +8,5 @@ DPDK_17.02 {
 
 	rte_pmd_i40e_ping_vfs;
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
+	rte_pmd_i40e_set_vf_vlan_anti_spoof;
 } DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 05/29] net/i40e: set Tx loopback from PF
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (3 preceding siblings ...)
  2016-12-15 21:04 ` [PATCH v3 04/29] net/i40e: set VF VLAN " Qi Zhang
@ 2016-12-15 21:04 ` Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 06/29] net/i40e: set VF unicast promisc mode " Qi Zhang
                   ` (25 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:04 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Wenzhuo Lu

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

Support enabling/disabling TX loopback from PF.
User can call the API on PF to enable/disable TX loopback
for all the PF and VFs.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 219 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  16 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 3 files changed, 236 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 77be98b..89f5784 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9898,3 +9898,222 @@ rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+static int
+i40e_vsi_rm_mac_filter(struct i40e_vsi *vsi)
+{
+	struct i40e_mac_filter *f;
+	struct i40e_macvlan_filter *mv_f;
+	int i, vlan_num;
+	enum rte_mac_filter_type filter_type;
+	int ret = I40E_SUCCESS;
+
+	/* remove all the MACs */
+	TAILQ_FOREACH(f, &vsi->mac_list, next) {
+		vlan_num = vsi->vlan_num;
+		filter_type = f->mac_info.filter_type;
+		if (filter_type == RTE_MACVLAN_PERFECT_MATCH ||
+		    filter_type == RTE_MACVLAN_HASH_MATCH) {
+			if (vlan_num == 0) {
+				PMD_DRV_LOG(ERR,
+					    "VLAN number shouldn't be 0\n");
+				return I40E_ERR_PARAM;
+			}
+		} else if (filter_type == RTE_MAC_PERFECT_MATCH ||
+			   filter_type == RTE_MAC_HASH_MATCH)
+			vlan_num = 1;
+
+		mv_f = rte_zmalloc("macvlan_data", vlan_num * sizeof(*mv_f), 0);
+		if (!mv_f) {
+			PMD_DRV_LOG(ERR, "failed to allocate memory");
+			return I40E_ERR_NO_MEMORY;
+		}
+
+		for (i = 0; i < vlan_num; i++) {
+			mv_f[i].filter_type = filter_type;
+			(void)rte_memcpy(&mv_f[i].macaddr,
+					 &f->mac_info.mac_addr,
+					 ETH_ADDR_LEN);
+		}
+		if (filter_type == RTE_MACVLAN_PERFECT_MATCH ||
+		    filter_type == RTE_MACVLAN_HASH_MATCH) {
+			ret = i40e_find_all_vlan_for_mac(vsi, mv_f, vlan_num,
+							 &f->mac_info.mac_addr);
+			if (ret != I40E_SUCCESS) {
+				rte_free(mv_f);
+				return ret;
+			}
+		}
+
+		ret = i40e_remove_macvlan_filters(vsi, mv_f, vlan_num);
+		if (ret != I40E_SUCCESS) {
+			rte_free(mv_f);
+			return ret;
+		}
+
+		rte_free(mv_f);
+		ret = I40E_SUCCESS;
+	}
+
+	return ret;
+}
+
+static int
+i40e_vsi_restore_mac_filter(struct i40e_vsi *vsi)
+{
+	struct i40e_mac_filter *f;
+	struct i40e_macvlan_filter *mv_f;
+	int i, vlan_num = 0;
+	int ret = I40E_SUCCESS;
+
+	/* restore all the MACs */
+	TAILQ_FOREACH(f, &vsi->mac_list, next) {
+		if ((f->mac_info.filter_type == RTE_MACVLAN_PERFECT_MATCH) ||
+		    (f->mac_info.filter_type == RTE_MACVLAN_HASH_MATCH)) {
+			/**
+			 * If vlan_num is 0, that's the first time to add mac,
+			 * set mask for vlan_id 0.
+			 */
+			if (vsi->vlan_num == 0) {
+				i40e_set_vlan_filter(vsi, 0, 1);
+				vsi->vlan_num = 1;
+			}
+			vlan_num = vsi->vlan_num;
+		} else if ((f->mac_info.filter_type == RTE_MAC_PERFECT_MATCH) ||
+			   (f->mac_info.filter_type == RTE_MAC_HASH_MATCH))
+			vlan_num = 1;
+
+		mv_f = rte_zmalloc("macvlan_data", vlan_num * sizeof(*mv_f), 0);
+		if (!mv_f) {
+			PMD_DRV_LOG(ERR, "failed to allocate memory");
+			return I40E_ERR_NO_MEMORY;
+		}
+
+		for (i = 0; i < vlan_num; i++) {
+			mv_f[i].filter_type = f->mac_info.filter_type;
+			(void)rte_memcpy(&mv_f[i].macaddr,
+					 &f->mac_info.mac_addr,
+					 ETH_ADDR_LEN);
+		}
+
+		if (f->mac_info.filter_type == RTE_MACVLAN_PERFECT_MATCH ||
+		    f->mac_info.filter_type == RTE_MACVLAN_HASH_MATCH) {
+			ret = i40e_find_all_vlan_for_mac(vsi, mv_f, vlan_num,
+							 &f->mac_info.mac_addr);
+			if (ret != I40E_SUCCESS) {
+				rte_free(mv_f);
+				return ret;
+			}
+		}
+
+		ret = i40e_add_macvlan_filters(vsi, mv_f, vlan_num);
+		if (ret != I40E_SUCCESS) {
+			rte_free(mv_f);
+			return ret;
+		}
+
+		rte_free(mv_f);
+		ret = I40E_SUCCESS;
+	}
+
+	return ret;
+}
+
+static int
+i40e_vsi_set_tx_loopback(struct i40e_vsi *vsi, uint8_t on)
+{
+	struct i40e_vsi_context ctxt;
+	struct i40e_hw *hw;
+	int ret;
+
+	hw = I40E_VSI_TO_HW(vsi);
+
+	/* Use the FW API if FW >= v5.0 */
+	if (hw->aq.fw_maj_ver < 5) {
+		PMD_INIT_LOG(ERR, "FW < v5.0, cannot enable loopback");
+		return -ENOTSUP;
+	}
+
+	/* Check if it has been already on or off */
+	if (vsi->info.valid_sections &
+		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID)) {
+		if (on) {
+			if ((vsi->info.switch_id &
+			     I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB) ==
+			    I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB)
+				return 0; /* already on */
+		} else {
+			if ((vsi->info.switch_id &
+			     I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB) == 0)
+				return 0; /* already off */
+		}
+	}
+
+	/* remove all the MACs first */
+	ret = i40e_vsi_rm_mac_filter(vsi);
+	if (ret)
+		return ret;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);
+	if (on)
+		vsi->info.switch_id |= I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB;
+	else
+		vsi->info.switch_id &= ~I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+		return ret;
+	}
+
+	/* add all the MACs back */
+	ret = i40e_vsi_restore_mac_filter(vsi);
+	if (ret)
+		return ret;
+
+	return ret;
+}
+
+int
+rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	uint16_t vf_id;
+	int ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	/* setup PF TX loopback */
+	vsi = pf->main_vsi;
+	ret = i40e_vsi_set_tx_loopback(vsi, on);
+	if (ret)
+		return ret;
+
+	/* setup TX loopback for all the VFs */
+	if (!pf->vfs) {
+		PMD_DRV_LOG(ERR, "Invalid argument.");
+		return -EINVAL;
+	}
+
+	for (vf_id = 0; vf_id < pf->vf_num; vf_id++) {
+		vf = &pf->vfs[vf_id];
+		vsi = vf->vsi;
+
+		ret = i40e_vsi_set_tx_loopback(vsi, on);
+		if (ret)
+			return ret;
+	}
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index c8736c8..3c65be4 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -114,4 +114,20 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
 					uint16_t vf_id,
 					uint8_t on);
 
+/**
+ * Enable/Disable TX loopback on all the PF and VFs.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param on
+ *    1 - Enable TX loopback.
+ *    0 - Disable TX loopback.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_tx_loopback(uint8_t port,
+				 uint8_t on);
+
 #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 fff6cf9..3da04d3 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -9,4 +9,5 @@ DPDK_17.02 {
 	rte_pmd_i40e_ping_vfs;
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
+	rte_pmd_i40e_set_tx_loopback;
 } DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 06/29] net/i40e: set VF unicast promisc mode from PF
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (4 preceding siblings ...)
  2016-12-15 21:04 ` [PATCH v3 05/29] net/i40e: set Tx loopback " Qi Zhang
@ 2016-12-15 21:04 ` Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 07/29] net/i40e: set VF multicast " Qi Zhang
                   ` (24 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:04 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Wenzhuo Lu

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

Support enabling/disabling VF unicast promiscuous mode from
PF.
User can call the API on PF to enable/disable a specific
VF's unicast promiscuous mode.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 36 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 56 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 89f5784..ffb69a1 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10117,3 +10117,39 @@ rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	hw = I40E_VSI_TO_HW(vf->vsi);
+
+	ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vf->vsi->seid,
+						  on, NULL, true);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set unicast promiscuous mode");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 3c65be4..4c98136 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -130,4 +130,23 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
 int rte_pmd_i40e_set_tx_loopback(uint8_t port,
 				 uint8_t on);
 
+/**
+ * Enable/Disable VF unicast promiscuous mode.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set.
+ * @param on
+ *    1 - Enable.
+ *    0 - Disable.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
+					uint16_t vf_id,
+					uint8_t on);
+
 #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 3da04d3..24b78ce 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -10,4 +10,5 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
 	rte_pmd_i40e_set_tx_loopback;
+	rte_pmd_i40e_set_vf_unicast_promisc;
 } DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 07/29] net/i40e: set VF multicast promisc mode from PF
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (5 preceding siblings ...)
  2016-12-15 21:04 ` [PATCH v3 06/29] net/i40e: set VF unicast promisc mode " Qi Zhang
@ 2016-12-15 21:04 ` Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 08/29] net/i40e: enable VF MTU change Qi Zhang
                   ` (23 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:04 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Wenzhuo Lu

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

Support enabling/disabling VF multicast promiscuous mode from
PF.
User can call the API on PF to enable/disable a specific
VF's multicast promiscuous mode.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 36 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 56 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ffb69a1..e2214bd 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10153,3 +10153,39 @@ rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	hw = I40E_VSI_TO_HW(vf->vsi);
+
+	ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vf->vsi->seid,
+						    on, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set multicast promiscuous mode");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 4c98136..9091520 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -149,4 +149,23 @@ int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
 					uint16_t vf_id,
 					uint8_t on);
 
+/**
+ * Enable/Disable VF multicast promiscuous mode.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set.
+ * @param on
+ *    1 - Enable.
+ *    0 - Disable.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
+					  uint16_t vf_id,
+					  uint8_t on);
+
 #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 24b78ce..08d3028 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -11,4 +11,5 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
 	rte_pmd_i40e_set_tx_loopback;
 	rte_pmd_i40e_set_vf_unicast_promisc;
+	rte_pmd_i40e_set_vf_multicast_promisc;
 } DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 08/29] net/i40e: enable VF MTU change
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (6 preceding siblings ...)
  2016-12-15 21:04 ` [PATCH v3 07/29] net/i40e: set VF multicast " Qi Zhang
@ 2016-12-15 21:04 ` Qi Zhang
  2016-12-15 21:04 ` [PATCH v3 09/29] net/i40e: fix VF reset flow Qi Zhang
                   ` (22 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:04 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Qi Zhang

This patch implement mtu_set ops for i40e VF.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 12da0ec..bce01d0 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -151,6 +151,7 @@ static int i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,
 				      struct rte_eth_rss_conf *rss_conf);
 static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 					struct rte_eth_rss_conf *rss_conf);
+static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 static int
 i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -225,6 +226,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = {
 	.reta_query           = i40evf_dev_rss_reta_query,
 	.rss_hash_update      = i40evf_dev_rss_hash_update,
 	.rss_hash_conf_get    = i40evf_dev_rss_hash_conf_get,
+	.mtu_set              = i40evf_dev_mtu_set,
 };
 
 /*
@@ -2641,3 +2643,34 @@ i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 
 	return 0;
 }
+
+static int
+i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+	struct rte_eth_dev_data *dev_data = vf->dev_data;
+	uint32_t frame_size = mtu + ETHER_HDR_LEN
+			      + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE;
+	int ret = 0;
+
+	/* check if mtu is within the allowed range */
+	if ((mtu < ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX))
+		return -EINVAL;
+
+	/* mtu setting is forbidden if port is start */
+	if (dev_data->dev_started) {
+		PMD_DRV_LOG(ERR,
+			    "port %d must be stopped before configuration\n",
+			    dev_data->port_id);
+		return -EBUSY;
+	}
+
+	if (frame_size > ETHER_MAX_LEN)
+		dev_data->dev_conf.rxmode.jumbo_frame = 1;
+	else
+		dev_data->dev_conf.rxmode.jumbo_frame = 0;
+
+	dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
+
+	return ret;
+}
-- 
2.7.4

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

* [PATCH v3 09/29] net/i40e: fix VF reset flow
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (7 preceding siblings ...)
  2016-12-15 21:04 ` [PATCH v3 08/29] net/i40e: enable VF MTU change Qi Zhang
@ 2016-12-15 21:04 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 10/29] net/i40e: set VF MAC from PF support Qi Zhang
                   ` (21 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:04 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Qi Zhang, stable

Add missing step during VF reset: PF should
set I40E_VFGEN_RSTAT to ACTIVE at end of the
VF reset operation or VF driver may not able
to detect that reset is already completed.
This patch also remove the unnecessary enum
for vfr state.

Fixes: 4861cde46116 ("i40e: new poll mode driver")

CC: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/i40e/i40e_pf.c | 6 ++++--
 drivers/net/i40e/i40e_pf.h | 5 -----
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 8b8a14f..2bc3355 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -139,7 +139,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)
 	abs_vf_id = vf_id + hw->func_caps.vf_base_id;
 
 	/* Notify VF that we are in VFR progress */
-	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_PF_VFR_INPROGRESS);
+	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_VFR_INPROGRESS);
 
 	/*
 	 * If require a SW VF reset, a VFLR interrupt will be generated,
@@ -220,7 +220,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)
 	}
 
 	/* Reset done, Set COMPLETE flag and clear reset bit */
-	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_PF_VFR_COMPLETED);
+	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_VFR_COMPLETED);
 	val = I40E_READ_REG(hw, I40E_VPGEN_VFRTRIG(vf_id));
 	val &= ~I40E_VPGEN_VFRTRIG_VFSWR_MASK;
 	I40E_WRITE_REG(hw, I40E_VPGEN_VFRTRIG(vf_id), val);
@@ -248,6 +248,8 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)
 		return -EFAULT;
 	}
 
+	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_VFR_VFACTIVE);
+
 	return ret;
 }
 
diff --git a/drivers/net/i40e/i40e_pf.h b/drivers/net/i40e/i40e_pf.h
index 59bf2ee..ada398b 100644
--- a/drivers/net/i40e/i40e_pf.h
+++ b/drivers/net/i40e/i40e_pf.h
@@ -48,11 +48,6 @@
 
 #define I40E_DPDK_OFFSET  0x100
 
-enum i40e_pf_vfr_state {
-	I40E_PF_VFR_INPROGRESS = 0,
-	I40E_PF_VFR_COMPLETED = 1,
-};
-
 /* DPDK pf driver specific command to VF */
 enum i40e_virtchnl_ops_dpdk {
 	/*
-- 
2.7.4

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

* [PATCH v3 10/29] net/i40e: set VF MAC from PF support
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (8 preceding siblings ...)
  2016-12-15 21:04 ` [PATCH v3 09/29] net/i40e: fix VF reset flow Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 11/29] net/i40e: set VF MAC from VF support Qi Zhang
                   ` (20 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Ferruh Yigit

From: Ferruh Yigit <ferruh.yigit@intel.com>

Support setting VF MAC address from PF.
User can call the API on PF to set a specific
VF's MAC address.

This will remove all existing MAC filters.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 app/test-pmd/cmdline.c                    | 18 ++++++++++++--
 drivers/net/i40e/i40e_ethdev.c            | 40 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 +++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  2 ++
 4 files changed, 77 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 3b45c32..2028173 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -90,6 +90,9 @@
 #ifdef RTE_LIBRTE_IXGBE_PMD
 #include <rte_pmd_ixgbe.h>
 #endif
+#ifdef RTE_LIBRTE_I40E_PMD
+#include <rte_pmd_i40e.h>
+#endif
 #include "testpmd.h"
 
 static struct cmdline *testpmd_cl;
@@ -11453,13 +11456,24 @@ 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;
 
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
 		return;
 
-	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
+		return;
+
 	switch (ret) {
 	case 0:
 		break;
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index e2214bd..e9bd95b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10189,3 +10189,43 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+			     struct ether_addr *mac_addr)
+{
+	struct rte_eth_dev_info dev_info;
+	struct i40e_mac_filter *f;
+	struct rte_eth_dev *dev;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	struct i40e_pf *pf;
+	void *temp;
+
+	if (i40e_validate_mac_addr((u8 *)mac_addr) != I40E_SUCCESS)
+		return -EINVAL;
+
+	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)
+		return -EINVAL;
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	ether_addr_copy(mac_addr, &vf->mac_addr);
+
+	/* Remove all existing mac */
+	TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp)
+		i40e_vsi_delete_mac(vsi, &f->mac_info.mac_addr);
+
+	return 0;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 9091520..faacbb9 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -168,4 +168,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
 					  uint16_t vf_id,
 					  uint8_t on);
 
+/**
+ * Set the VF MAC address.
+ *
+ * This will remove all existing MAC filters.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param vf_id
+ *   VF id.
+ * @param mac_addr
+ *   VF MAC address.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
+ */
+int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+				 struct ether_addr *mac_addr);
+
 #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 08d3028..64ba93a 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -12,4 +12,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_tx_loopback;
 	rte_pmd_i40e_set_vf_unicast_promisc;
 	rte_pmd_i40e_set_vf_multicast_promisc;
+	rte_pmd_i40e_set_vf_mac_addr;
+
 } DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 11/29] net/i40e: set VF MAC from VF support
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (9 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 10/29] net/i40e: set VF MAC from PF support Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 12/29] net/i40e: fix VF MAC address assignment Qi Zhang
                   ` (19 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Ferruh Yigit

From: Ferruh Yigit <ferruh.yigit@intel.com>

Support changing VF default MAC address.
This function is not supported if PF set the MAC
address for the PF.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/i40e/i40e_ethdev.h    |  4 +++-
 drivers/net/i40e/i40e_ethdev_vf.c | 49 +++++++++++++++++++++++++++++++++------
 2 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 0db140b..b687b0c 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -126,6 +126,7 @@ enum i40e_flxpld_layer_idx {
 #define I40E_FLAG_FDIR                  (1ULL << 6)
 #define I40E_FLAG_VXLAN                 (1ULL << 7)
 #define I40E_FLAG_RSS_AQ_CAPABLE        (1ULL << 8)
+#define I40E_FLAG_VF_MAC_BY_PF          (1ULL << 9)
 #define I40E_FLAG_ALL (I40E_FLAG_RSS | \
 		       I40E_FLAG_DCB | \
 		       I40E_FLAG_VMDQ | \
@@ -134,7 +135,8 @@ enum i40e_flxpld_layer_idx {
 		       I40E_FLAG_HEADER_SPLIT_ENABLED | \
 		       I40E_FLAG_FDIR | \
 		       I40E_FLAG_VXLAN | \
-		       I40E_FLAG_RSS_AQ_CAPABLE)
+		       I40E_FLAG_RSS_AQ_CAPABLE | \
+		       I40E_FLAG_VF_MAC_BY_PF)
 
 #define I40E_RSS_OFFLOAD_ALL ( \
 	ETH_RSS_FRAG_IPV4 | \
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index bce01d0..5016249 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -152,6 +152,8 @@ static int i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,
 static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 					struct rte_eth_rss_conf *rss_conf);
 static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
+static void i40evf_set_default_mac_addr(struct rte_eth_dev *dev,
+					struct ether_addr *mac_addr);
 static int
 i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -227,6 +229,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = {
 	.rss_hash_update      = i40evf_dev_rss_hash_update,
 	.rss_hash_conf_get    = i40evf_dev_rss_hash_conf_get,
 	.mtu_set              = i40evf_dev_mtu_set,
+	.mac_addr_set         = i40evf_set_default_mac_addr,
 };
 
 /*
@@ -888,19 +891,16 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
 }
 
 static void
-i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
+i40evf_del_mac_addr_by_addr(struct rte_eth_dev *dev,
+			    struct ether_addr *addr)
 {
 	struct i40e_virtchnl_ether_addr_list *list;
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-	struct rte_eth_dev_data *data = dev->data;
-	struct ether_addr *addr;
 	uint8_t cmd_buffer[sizeof(struct i40e_virtchnl_ether_addr_list) + \
 			sizeof(struct i40e_virtchnl_ether_addr)];
 	int err;
 	struct vf_cmd_info args;
 
-	addr = &(data->mac_addrs[index]);
-
 	if (i40e_validate_mac_addr(addr->addr_bytes) != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Invalid mac:%x-%x-%x-%x-%x-%x",
 			    addr->addr_bytes[0], addr->addr_bytes[1],
@@ -927,6 +927,17 @@ i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
 	return;
 }
 
+static void
+i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
+{
+	struct rte_eth_dev_data *data = dev->data;
+	struct ether_addr *addr;
+
+	addr = &data->mac_addrs[index];
+
+	i40evf_del_mac_addr_by_addr(dev, addr);
+}
+
 static int
 i40evf_update_stats(struct rte_eth_dev *dev, struct i40e_eth_stats **pstats)
 {
@@ -1260,10 +1271,12 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 
 	/* Store the MAC address configured by host, or generate random one */
 	p_mac_addr = (struct ether_addr *)(vf->vsi_res->default_mac_addr);
-	if (is_valid_assigned_ether_addr(p_mac_addr)) /* Configured by host */
+	if (is_valid_assigned_ether_addr(p_mac_addr)) { /* Configured by host */
 		ether_addr_copy(p_mac_addr, (struct ether_addr *)hw->mac.addr);
-	else
+		vf->flags |= I40E_FLAG_VF_MAC_BY_PF;
+	} else {
 		eth_random_addr(hw->mac.addr); /* Generate a random one */
+	}
 
 	/* If the PF host is not DPDK, set the interval of ITR0 to max*/
 	if (vf->version_major != I40E_DPDK_VERSION_MAJOR) {
@@ -2674,3 +2687,25 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 
 	return ret;
 }
+
+static void
+i40evf_set_default_mac_addr(struct rte_eth_dev *dev,
+			    struct ether_addr *mac_addr)
+{
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+
+	if (!is_valid_assigned_ether_addr(mac_addr)) {
+		PMD_DRV_LOG(ERR, "Tried to set invalid MAC address.");
+		return;
+	}
+
+	if (is_same_ether_addr(mac_addr, dev->data->mac_addrs))
+		return;
+
+	if (vf->flags & I40E_FLAG_VF_MAC_BY_PF)
+		return;
+
+	i40evf_del_mac_addr_by_addr(dev, dev->data->mac_addrs);
+
+	i40evf_add_mac_addr(dev, mac_addr, 0, 0);
+}
-- 
2.7.4

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

* [PATCH v3 12/29] net/i40e: fix VF MAC address assignment
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (10 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 11/29] net/i40e: set VF MAC from VF support Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 13/29] net/i40e: add VF VLAN strip func Qi Zhang
                   ` (18 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Ferruh Yigit, stable

From: Ferruh Yigit <ferruh.yigit@intel.com>

If PF sets vf->mac_addr, in VF initialization hw->mac.addr will be set
to that same value. It is possible to check if PF set a MAC address or
not through the hw->mac.addr variable.

hw->mac.addr set by i40e_vf_parse_hw_config(), call stack is:

In PF side
i40e_pf_host_process_cmd_get_vf_resources()
    eth_addr_copy(vf->mac_addr, vf_res->vsi_res[0].default_mac_address)

In VF sise
i40evf_init_vf()
    i40evf_get_vf_resources()
            i40e_vf_parse_hw_config()
                    memcpy(hw->mac.addr, vsi_res->default_mac_addr)

Updated code is after i40evf_get_vf_resources() and can benefit from
hw->mac.addr variable.

Fixes: 89e6b86384bb ("i40evf: rework MAC address validation")

CC: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 5016249..0977095 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1193,7 +1193,6 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 	int i, err, bufsz;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-	struct ether_addr *p_mac_addr;
 	uint16_t interval =
 		i40e_calc_itr_interval(I40E_QUEUE_ITR_INTERVAL_MAX);
 
@@ -1270,13 +1269,10 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 	vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
 	/* Store the MAC address configured by host, or generate random one */
-	p_mac_addr = (struct ether_addr *)(vf->vsi_res->default_mac_addr);
-	if (is_valid_assigned_ether_addr(p_mac_addr)) { /* Configured by host */
-		ether_addr_copy(p_mac_addr, (struct ether_addr *)hw->mac.addr);
+	if (is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr))
 		vf->flags |= I40E_FLAG_VF_MAC_BY_PF;
-	} else {
+	else
 		eth_random_addr(hw->mac.addr); /* Generate a random one */
-	}
 
 	/* If the PF host is not DPDK, set the interval of ITR0 to max*/
 	if (vf->version_major != I40E_DPDK_VERSION_MAJOR) {
-- 
2.7.4

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

* [PATCH v3 13/29] net/i40e: add VF VLAN strip func
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (11 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 12/29] net/i40e: fix VF MAC address assignment Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 14/29] net/i40e: add set VF VLAN insert function Qi Zhang
                   ` (17 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Chen Jing D(Mark)

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

Add a function to configure vlan strip enable/disable for specific
SRIOV VF device.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 26 ++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 +++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index e9bd95b..ae8d678 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10229,3 +10229,29 @@ rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
 
 	return 0;
 }
+
+/* Set vlan strip on/off for specific VF from host */
+int
+rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct i40e_pf *pf;
+	struct i40e_vsi *vsi;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	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;
+
+	if (vsi)
+		return i40e_vsi_config_vlan_stripping(vsi, !!on);
+	else
+		return -EINVAL;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index faacbb9..cea1192 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -187,4 +187,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
 int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
+/**
+ * Enable/Disable vf vlan strip for all queues in a pool
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param on
+ *    1 - Enable VF's vlan strip on RX queues.
+ *    0 - Disable VF's vlan strip on RX queues.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int
+rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+
 #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 64ba93a..2497b3e 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -13,5 +13,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_unicast_promisc;
 	rte_pmd_i40e_set_vf_multicast_promisc;
 	rte_pmd_i40e_set_vf_mac_addr;
+	rte_pmd_i40e_set_vf_vlan_stripq;
 
 } DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 14/29] net/i40e: add set VF VLAN insert function
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (12 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 13/29] net/i40e: add VF VLAN strip func Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 15/29] net/i40e: set VF broadcast mode from PF Qi Zhang
                   ` (16 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Bernard Iremonger

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

Support inserting VF VLAN id from PF.
User can call the API on PF to insert a VLAN id to a
specific VF.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 53 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 +++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 73 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ae8d678..41663a2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10255,3 +10255,56 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on)
 	else
 		return -EINVAL;
 }
+
+int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
+				    uint16_t vlan_id)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	struct i40e_vsi *vsi;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	hw = I40E_PF_TO_HW(pf);
+
+	/**
+	 * return -ENODEV if SRIOV not enabled, VF number not configured
+	 * or no queue assigned.
+	 */
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 ||
+	    pf->vf_nb_qps == 0)
+		return -ENODEV;
+
+	if (vf_id >= pf->vf_num || !pf->vfs)
+		return -EINVAL;
+
+	if (vlan_id > ETHER_MAX_VLAN_ID)
+		return -EINVAL;
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+	vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID;
+	vsi->info.pvid = vlan_id;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index cea1192..0c364f8 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -206,4 +206,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
 int
 rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
 
+/**
+ * Enable/Disable vf vlan insert
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param vlan_id
+ *    0 - Disable VF's vlan insert.
+ *    n - Enable; n is inserted as the vlan id.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
+				    uint16_t vlan_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 2497b3e..e5e70e9 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -14,5 +14,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_multicast_promisc;
 	rte_pmd_i40e_set_vf_mac_addr;
 	rte_pmd_i40e_set_vf_vlan_stripq;
+	rte_pmd_i40e_set_vf_vlan_insert;
 
 } DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 15/29] net/i40e: set VF broadcast mode from PF
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (13 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 14/29] net/i40e: add set VF VLAN insert function Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 16/29] net/i40e: set VF VLAN tag " Qi Zhang
                   ` (15 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Bernard Iremonger

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

Support enabling/disabling VF broadcast mode from PF.
User can call the API on PF to enable/disable a specific
VF's broadcast mode.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 43 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 63 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 41663a2..a8361df 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10308,3 +10308,46 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
 
 	return ret;
 }
+
+int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
+					uint8_t on) {
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	int ret;
+
+	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;
+
+	if (on > 1)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	hw = I40E_PF_TO_HW(pf);
+
+	if (vf_id >= pf->vf_num || !pf->vfs)
+		return -EINVAL;
+
+	/**
+	 * return -ENODEV if SRIOV not enabled, VF number not configured
+	 * or no queue assigned.
+	 */
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+		return -ENODEV;
+
+	vf = &pf->vfs[vf_id];
+	hw = I40E_VSI_TO_HW(vf->vsi);
+
+	ret = i40e_aq_set_vsi_broadcast(hw, vf->vsi->seid, on, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set VSI broadcast");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 0c364f8..02f7109 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -225,4 +225,23 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
 int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
 				    uint16_t vlan_id);
 
+/**
+ * Enable/Disable vf broadcast mode
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param on
+ *    0 - Disable broadcast.
+ *    1 - Enable broadcast.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
+					uint8_t on);
+
 #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 e5e70e9..76a3ef8 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -15,5 +15,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_mac_addr;
 	rte_pmd_i40e_set_vf_vlan_stripq;
 	rte_pmd_i40e_set_vf_vlan_insert;
+	rte_pmd_i40e_set_vf_broadcast;
 
 } DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 16/29] net/i40e: set VF VLAN tag from PF
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (14 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 15/29] net/i40e: set VF broadcast mode from PF Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 17/29] net/i40e: set VF VLAN filter " Qi Zhang
                   ` (14 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Bernard Iremonger

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

Add rte_pmd_i40e_set_vf_vlan_tag API.
User can call the API on PF to enable/disable a specific
VF's VLAN tag.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 59 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 18 ++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 78 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a8361df..207a62e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10351,3 +10351,62 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
 
 	return ret;
 }
+
+int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	struct i40e_vsi *vsi;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	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;
+
+	if (on > 1)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	hw = I40E_PF_TO_HW(pf);
+
+	/**
+	 * return -ENODEV if SRIOV not enabled, VF number not configured
+	 * or no queue assigned.
+	 */
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+		return -ENODEV;
+
+	if (vf_id >= pf->vf_num)
+		return -EINVAL;
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+	if (on) {
+		vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_TAGGED;
+		vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
+	} else {
+		vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
+		vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_TAGGED;
+	}
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 02f7109..b9bf8d1 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -244,4 +244,22 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
 int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
 					uint8_t on);
 
+/**
+ * Enable/Disable vf vlan tag
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param vlan_id
+ *    0 - Disable VF's vlan tag.
+ *    n - Enable VF's vlan tag.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
+
 #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 76a3ef8..22e2716 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -16,5 +16,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_vlan_stripq;
 	rte_pmd_i40e_set_vf_vlan_insert;
 	rte_pmd_i40e_set_vf_broadcast;
+	rte_pmd_i40e_set_vf_vlan_tag;
 
 } DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 17/29] net/i40e: set VF VLAN filter from PF
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (15 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 16/29] net/i40e: set VF VLAN tag " Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 18/29] app/testpmd: use VFD APIs on i40e Qi Zhang
                   ` (13 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Bernard Iremonger

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

add rte_pmd_i40e_set_vf_vlan_filter API.
User can call the API on PF to enable/disable
a set of VF's VLAN filters.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 52 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 22 +++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 75 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 207a62e..5ee010e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10410,3 +10410,55 @@ int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
+				    uint64_t vf_mask, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	uint16_t pool_idx;
+	int ret = I40E_SUCCESS;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (vlan_id > ETHER_MAX_VLAN_ID)
+		return -EINVAL;
+
+	if (on > 1)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	if ((pf->flags & I40E_FLAG_VMDQ) == 0) {
+		PMD_INIT_LOG(ERR, "Firmware doesn't support VMDQ");
+		return -ENOTSUP;
+	}
+
+	if (!pf->vmdq) {
+		PMD_INIT_LOG(INFO, "VMDQ not configured");
+		return -ENOTSUP;
+	}
+
+	for (pool_idx = 0;
+	     pool_idx < ETH_64_POOLS &&
+	     pool_idx < pf->nb_cfg_vmdq_vsi &&
+	     ret == I40E_SUCCESS;
+	     pool_idx++) {
+		if (vf_mask & ((uint64_t)(1ULL << pool_idx))) {
+			if (on)
+				ret = i40e_vsi_add_vlan(pf->vmdq[pool_idx].vsi,
+							vlan_id);
+			else
+				ret = i40e_vsi_delete_vlan(
+					pf->vmdq[pool_idx].vsi, vlan_id);
+		}
+	}
+
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set VF VLAN filter, on = %d", on);
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index b9bf8d1..96cda89 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -262,4 +262,26 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
  */
 int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
 
+/**
+ * Enable/Disable VF VLAN filter
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vlan_id
+ *    ID specifying VLAN
+ * @param vf_mask
+ *    Mask to filter VF's
+ * @param on
+ *    0 - Disable VF's VLAN filter.
+ *    1 - Enable VF's VLAN filter.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ *   - (-ENOTSUP) VMDq not configured of not supported by firmware.
+ */
+int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
+				    uint64_t vf_mask, uint8_t on);
+
 #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 22e2716..818ff9c 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -17,5 +17,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_vlan_insert;
 	rte_pmd_i40e_set_vf_broadcast;
 	rte_pmd_i40e_set_vf_vlan_tag;
+	rte_pmd_i40e_set_vf_vlan_filter;
 
 } DPDK_2.0;
-- 
2.7.4

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

* [PATCH v3 18/29] app/testpmd: use VFD APIs on i40e
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (16 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 17/29] net/i40e: set VF VLAN filter " Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 19/29] app/testpmd: use unicast promiscuous mode " Qi Zhang
                   ` (12 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Wenzhuo Lu, Chen Jing D, Bernard Iremonger

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 | 107 +++++++++++++++++++++++++++++++++++++------------
 2 files changed, 84 insertions(+), 25 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 2028173..e08edcc 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -265,7 +265,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"
 
@@ -277,7 +276,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"
@@ -285,7 +283,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"
 
@@ -294,7 +291,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"
@@ -389,10 +385,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)"
@@ -6617,7 +6611,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;
@@ -6678,9 +6671,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;
@@ -6762,7 +6753,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 {
@@ -6829,7 +6819,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;
@@ -6892,7 +6881,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 {
@@ -6961,7 +6949,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;
@@ -7040,7 +7027,6 @@ cmdline_parse_inst_t cmd_vf_rate_limit = {
 		NULL,
 	},
 };
-#endif
 
 /* *** ADD TUNNEL FILTER OF A PORT *** */
 struct cmd_tunnel_filter_result {
@@ -10811,7 +10797,6 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
 		NULL,
 	},
 };
-#ifdef RTE_LIBRTE_IXGBE_PMD
 
 /* vf vlan anti spoof configuration */
 
@@ -10865,12 +10850,25 @@ 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;
 
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
 		return;
 
-	ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, res->vf_id,
-			is_on);
+	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;
+
 	switch (ret) {
 	case 0:
 		break;
@@ -10880,6 +10878,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));
 	}
@@ -10953,12 +10954,25 @@ 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;
 
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
 		return;
 
-	ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id, res->vf_id,
-			is_on);
+	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;
+
 	switch (ret) {
 	case 0:
 		break;
@@ -10968,6 +10982,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));
 	}
@@ -11041,11 +11058,23 @@ 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;
 
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
 		return;
 
-	ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id, res->vf_id, is_on);
+	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;
+
 	switch (ret) {
 	case 0:
 		break;
@@ -11055,6 +11084,9 @@ cmd_set_vf_vlan_stripq_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));
 	}
@@ -11127,11 +11159,23 @@ cmd_set_vf_vlan_insert_parsed(
 {
 	struct cmd_vf_vlan_insert_result *res = parsed_result;
 	int ret;
+	struct rte_eth_dev_info dev_info;
 
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
 		return;
 
-	ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, res->vlan_id);
+	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;
+
 	switch (ret) {
 	case 0:
 		break;
@@ -11141,6 +11185,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));
 	}
@@ -11204,11 +11251,21 @@ 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;
 
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
 		return;
 
-	ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
+	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;
+
 	switch (ret) {
 	case 0:
 		break;
@@ -11218,6 +11275,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));
 	}
@@ -11503,7 +11563,6 @@ cmdline_parse_inst_t cmd_set_vf_mac_addr = {
 		NULL,
 	},
 };
-#endif
 
 /* ******************************************************************************** */
 
@@ -11657,7 +11716,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,
@@ -11670,7 +11728,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.7.4

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

* [PATCH v3 19/29] app/testpmd: use unicast promiscuous mode on i40e
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (17 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 18/29] app/testpmd: use VFD APIs on i40e Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 20/29] app/testpmd: use multicast " Qi Zhang
                   ` (11 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Wenzhuo Lu

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 e08edcc..e1c0486 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 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"
@@ -11564,6 +11567,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 */
@@ -11728,6 +11813,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.7.4

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

* [PATCH v3 20/29] app/testpmd: use multicast promiscuous mode on i40e
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (18 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 19/29] app/testpmd: use unicast promiscuous mode " Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 21/29] app/testpmd: add command to test VF broadcast " Qi Zhang
                   ` (10 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Wenzhuo Lu

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 e1c0486..27df75c 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -401,6 +401,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"
@@ -11649,6 +11652,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 */
@@ -11814,6 +11899,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.7.4

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

* [PATCH v3 21/29] app/testpmd: add command to test VF broadcast mode on i40e
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (19 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 20/29] app/testpmd: use multicast " Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 22/29] app/testpmd: add command to test VF VLAN tag " Qi Zhang
                   ` (9 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Bernard Iremonger

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 27df75c..48a6f59 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -277,6 +277,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"
 
@@ -11734,6 +11737,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 */
@@ -11900,6 +11984,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.7.4

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

* [PATCH v3 22/29] app/testpmd: add command to test VF VLAN tag on i40e
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (20 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 21/29] app/testpmd: add command to test VF broadcast " Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 23/29] app/testpmd: handle i40e in VF VLAN filter command Qi Zhang
                   ` (8 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Bernard Iremonger

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 48a6f59..a38ba92 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -295,6 +295,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"
 
@@ -11818,6 +11821,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 */
@@ -11985,6 +12075,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.7.4

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

* [PATCH v3 23/29] app/testpmd: handle i40e in VF VLAN filter command
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (21 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 22/29] app/testpmd: add command to test VF VLAN tag " Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 24/29] net/i40e: change version number to support Linux VF Qi Zhang
                   ` (7 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Bernard Iremonger

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

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

* [PATCH v3 24/29] net/i40e: change version number to support Linux VF
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (22 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 23/29] app/testpmd: handle i40e in VF VLAN filter command Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 25/29] net/i40e: return correct VSI id Qi Zhang
                   ` (6 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Chen Jing D(Mark)

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

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

* [PATCH v3 25/29] net/i40e: return correct VSI id
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (23 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 24/29] net/i40e: change version number to support Linux VF Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 26/29] net/i40e: parse more VF parameter and configure Qi Zhang
                   ` (5 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Chen Jing D(Mark)

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

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

* [PATCH v3 26/29] net/i40e: parse more VF parameter and configure
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (24 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 25/29] net/i40e: return correct VSI id Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 27/29] net/i40e: support Linux VF to configure IRQ link list Qi Zhang
                   ` (4 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Chen Jing D(Mark)

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

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

* [PATCH v3 27/29] net/i40e: support Linux VF to configure IRQ link list
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (25 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 26/29] net/i40e: parse more VF parameter and configure Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 28/29] net/i40e: enhance in sanity check of MAC Qi Zhang
                   ` (3 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Chen Jing D(Mark)

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

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

* [PATCH v3 28/29] net/i40e: enhance in sanity check of MAC
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (26 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 27/29] net/i40e: support Linux VF to configure IRQ link list Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-15 21:05 ` [PATCH v3 29/29] net/i40e: set/clear VF stats from PF Qi Zhang
                   ` (2 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Chen Jing D(Mark)

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

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

* [PATCH v3 29/29] net/i40e: set/clear VF stats from PF
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (27 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 28/29] net/i40e: enhance in sanity check of MAC Qi Zhang
@ 2016-12-15 21:05 ` Qi Zhang
  2016-12-16 14:28 ` [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Ferruh Yigit
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
  30 siblings, 0 replies; 125+ messages in thread
From: Qi Zhang @ 2016-12-15 21:05 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Qi Zhang

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

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

* Re: [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (28 preceding siblings ...)
  2016-12-15 21:05 ` [PATCH v3 29/29] net/i40e: set/clear VF stats from PF Qi Zhang
@ 2016-12-16 14:28 ` Ferruh Yigit
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:28 UTC (permalink / raw)
  To: Qi Zhang, jingjing.wu, helin.zhang; +Cc: dev

On 12/15/2016 9:04 PM, Qi Zhang wrote:
> 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.
> 
> 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
> 
<...>

Hi Qi,

I can't cleanly apply the patchset to the next-net tree, mainly because
of the testpmd conflicts.

I will send a new version of the patchset shortly.

Thanks,
ferruh

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

* [PATCH v4 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
                   ` (29 preceding siblings ...)
  2016-12-16 14:28 ` [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Ferruh Yigit
@ 2016-12-16 14:38 ` Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 01/29] net/i40e: support link status notification Ferruh Yigit
                     ` (30 more replies)
  30 siblings, 31 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:38 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 01/29] net/i40e: support link status notification
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
@ 2016-12-16 14:38   ` Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 02/29] net/i40e: add callback to user on VF to PF mbox msg Ferruh Yigit
                     ` (29 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:38 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Add an API to expose the ability, that PF can notify VF
when link status changes, to APP.
So if PF APP doesn't want to enable interruption but check
link status by itself, PF APP can let VF know link status
changed.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/Makefile                 |  4 ++-
 drivers/net/i40e/i40e_ethdev.c            | 28 +++++++++++++++
 drivers/net/i40e/i40e_pf.c                |  4 +--
 drivers/net/i40e/i40e_pf.h                |  4 ++-
 drivers/net/i40e/rte_pmd_i40e.h           | 58 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  6 ++++
 6 files changed, 100 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/i40e/rte_pmd_i40e.h

diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 66997b6..a2ef53c 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -1,6 +1,6 @@
 #   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
@@ -111,6 +111,8 @@ ifeq ($(findstring RTE_MACHINE_CPUFLAG_SSE4_1,$(CFLAGS)),)
 CFLAGS_i40e_rxtx_vec_sse.o += -msse4.1
 endif
 
+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h
 
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f42f4ba..fc7e987 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -62,6 +62,7 @@
 #include "i40e_rxtx.h"
 #include "i40e_pf.h"
 #include "i40e_regs.h"
+#include "rte_pmd_i40e.h"
 
 #define ETH_I40E_FLOATING_VEB_ARG	"enable_floating_veb"
 #define ETH_I40E_FLOATING_VEB_LIST_ARG	"floating_veb_list"
@@ -9695,3 +9696,30 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	if (vf > pf->vf_num - 1 || !pf->vfs) {
+		PMD_DRV_LOG(ERR, "Invalid argument.");
+		return -EINVAL;
+	}
+
+	i40e_notify_vf_link_status(dev, &pf->vfs[vf]);
+
+	return 0;
+}
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index ddfc140..f70712b 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.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
@@ -897,7 +897,7 @@ i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,
 	return ret;
 }
 
-static void
+void
 i40e_notify_vf_link_status(struct rte_eth_dev *dev, struct i40e_pf_vf *vf)
 {
 	struct i40e_virtchnl_pf_event event;
diff --git a/drivers/net/i40e/i40e_pf.h b/drivers/net/i40e/i40e_pf.h
index cddc45c..59bf2ee 100644
--- a/drivers/net/i40e/i40e_pf.h
+++ b/drivers/net/i40e/i40e_pf.h
@@ -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
@@ -123,5 +123,7 @@ void i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 				uint8_t *msg, uint16_t msglen);
 int i40e_pf_host_init(struct rte_eth_dev *dev);
 int i40e_pf_host_uninit(struct rte_eth_dev *dev);
+void i40e_notify_vf_link_status(struct rte_eth_dev *dev,
+				struct i40e_pf_vf *vf);
 
 #endif /* _I40E_PF_H_ */
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
new file mode 100644
index 0000000..14852f2
--- /dev/null
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -0,0 +1,58 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright (c) 2016 Intel Corporation. All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file rte_pmd_i40e.h
+ * i40e PMD specific functions.
+ *
+ **/
+
+#ifndef _PMD_I40E_H_
+#define _PMD_I40E_H_
+
+#include <rte_ethdev.h>
+
+/**
+ * Notify VF when PF link status changes.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if *vf* invalid.
+ */
+int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
+
+#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 ef35398..4555446 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -2,3 +2,9 @@ DPDK_2.0 {
 
 	local: *;
 };
+
+DPDK_17.02 {
+	global:
+
+	rte_pmd_i40e_ping_vfs;
+} DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 02/29] net/i40e: add callback to user on VF to PF mbox msg
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 01/29] net/i40e: support link status notification Ferruh Yigit
@ 2016-12-16 14:38   ` Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 03/29] net/i40e: set VF MAC anti-spoofing from PF Ferruh Yigit
                     ` (28 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:38 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

The callback asks the user application if it is allowed to
perform the mailbox messages.

If the return value from user is RTE_PMD_I40E_MB_EVENT_PROCEED
then continue. If ACK or NACK, do nothing and send
not_supported to VF.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_pf.c      | 230 ++++++++++++++++++++++++++++++++++------
 drivers/net/i40e/rte_pmd_i40e.h |  21 ++++
 2 files changed, 216 insertions(+), 35 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index f70712b..8b8a14f 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -55,6 +55,7 @@
 #include "i40e_ethdev.h"
 #include "i40e_rxtx.h"
 #include "i40e_pf.h"
+#include "rte_pmd_i40e.h"
 
 #define I40E_CFG_CRCSTRIP_DEFAULT 1
 
@@ -272,14 +273,23 @@ i40e_pf_host_send_msg_to_vf(struct i40e_pf_vf *vf,
 }
 
 static void
-i40e_pf_host_process_cmd_version(struct i40e_pf_vf *vf)
+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;
-	i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
-		I40E_SUCCESS, (uint8_t *)&info, sizeof(info));
+
+	if (b_op)
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
+					    I40E_SUCCESS,
+					    (uint8_t *)&info,
+					    sizeof(info));
+	else
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
+					    I40E_NOT_SUPPORTED,
+					    (uint8_t *)&info,
+					    sizeof(info));
 }
 
 static int
@@ -292,13 +302,20 @@ i40e_pf_host_process_cmd_reset_vf(struct i40e_pf_vf *vf)
 }
 
 static int
-i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf)
+i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, bool b_op)
 {
 	struct i40e_virtchnl_vf_resource *vf_res = NULL;
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	uint32_t len = 0;
 	int ret = I40E_SUCCESS;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(vf,
+					    I40E_VIRTCHNL_OP_GET_VF_RESOURCES,
+					    I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	/* only have 1 VSI by default */
 	len =  sizeof(struct i40e_virtchnl_vf_resource) +
 				I40E_DEFAULT_VF_VSI_NUM *
@@ -423,7 +440,8 @@ i40e_pf_host_hmc_config_txq(struct i40e_hw *hw,
 static int
 i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 					   uint8_t *msg,
-					   uint16_t msglen)
+					   uint16_t msglen,
+					   bool b_op)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	struct i40e_vsi *vsi = vf->vsi;
@@ -432,6 +450,13 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 	struct i40e_virtchnl_queue_pair_info *vc_qpi;
 	int i, ret = I40E_SUCCESS;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(vf,
+					    I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES,
+					    I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (!msg || vc_vqci->num_queue_pairs > vsi->nb_qps ||
 		vc_vqci->num_queue_pairs > I40E_MAX_VSI_QP ||
 		msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqci,
@@ -482,7 +507,8 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,
 					       uint8_t *msg,
-					       uint16_t msglen)
+					       uint16_t msglen,
+					       bool b_op)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	struct i40e_vsi *vsi = vf->vsi;
@@ -491,6 +517,14 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,
 	struct i40e_virtchnl_queue_pair_ext_info *vc_qpei;
 	int i, ret = I40E_SUCCESS;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (!msg || vc_vqcei->num_queue_pairs > vsi->nb_qps ||
 		vc_vqcei->num_queue_pairs > I40E_MAX_VSI_QP ||
 		msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqcei,
@@ -539,12 +573,21 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,
 
 static int
 i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf,
-					uint8_t *msg, uint16_t msglen)
+					uint8_t *msg, uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_irq_map_info *irqmap =
 	    (struct i40e_virtchnl_irq_map_info *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen < sizeof(struct i40e_virtchnl_irq_map_info)) {
 		PMD_DRV_LOG(ERR, "buffer too short");
 		ret = I40E_ERR_PARAM;
@@ -646,12 +689,21 @@ i40e_pf_host_process_cmd_enable_queues(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_disable_queues(struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_queue_select *q_sel =
 		(struct i40e_virtchnl_queue_select *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_DISABLE_QUEUES,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*q_sel)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -669,7 +721,8 @@ i40e_pf_host_process_cmd_disable_queues(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,
 					   uint8_t *msg,
-					   uint16_t msglen)
+					   uint16_t msglen,
+					   bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -678,6 +731,14 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,
 	int i;
 	struct ether_addr *mac;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	memset(&filter, 0 , sizeof(struct i40e_mac_filter_info));
 
 	if (msg == NULL || msglen <= sizeof(*addr_list)) {
@@ -707,7 +768,8 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,
 					   uint8_t *msg,
-					   uint16_t msglen)
+					   uint16_t msglen,
+					   bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -715,6 +777,14 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,
 	int i;
 	struct ether_addr *mac;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen <= sizeof(*addr_list)) {
 		PMD_DRV_LOG(ERR, "delete_ether_address argument too short");
 		ret = I40E_ERR_PARAM;
@@ -739,7 +809,8 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,
 
 static int
 i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
-				uint8_t *msg, uint16_t msglen)
+				uint8_t *msg, uint16_t msglen,
+				bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -747,6 +818,14 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
 	int i;
 	uint16_t *vid;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_ADD_VLAN,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen <= sizeof(*vlan_filter_list)) {
 		PMD_DRV_LOG(ERR, "add_vlan argument too short");
 		ret = I40E_ERR_PARAM;
@@ -771,7 +850,8 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,
 				  uint8_t *msg,
-				  uint16_t msglen)
+				  uint16_t msglen,
+				  bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -779,6 +859,14 @@ i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,
 	int i;
 	uint16_t *vid;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_DEL_VLAN,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen <= sizeof(*vlan_filter_list)) {
 		PMD_DRV_LOG(ERR, "delete_vlan argument too short");
 		ret = I40E_ERR_PARAM;
@@ -803,7 +891,8 @@ static int
 i40e_pf_host_process_cmd_config_promisc_mode(
 					struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_promisc_info *promisc =
@@ -811,6 +900,14 @@ i40e_pf_host_process_cmd_config_promisc_mode(
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	bool unicast = FALSE, multicast = FALSE;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*promisc)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -836,13 +933,20 @@ i40e_pf_host_process_cmd_config_promisc_mode(
 }
 
 static int
-i40e_pf_host_process_cmd_get_stats(struct i40e_pf_vf *vf)
+i40e_pf_host_process_cmd_get_stats(struct i40e_pf_vf *vf, bool b_op)
 {
 	i40e_update_vsi_stats(vf->vsi);
 
-	i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_STATS,
-		I40E_SUCCESS, (uint8_t *)&vf->vsi->eth_stats,
-				sizeof(vf->vsi->eth_stats));
+	if (b_op)
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_STATS,
+					    I40E_SUCCESS,
+					    (uint8_t *)&vf->vsi->eth_stats,
+					    sizeof(vf->vsi->eth_stats));
+	else
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_STATS,
+					    I40E_NOT_SUPPORTED,
+					    (uint8_t *)&vf->vsi->eth_stats,
+					    sizeof(vf->vsi->eth_stats));
 
 	return I40E_SUCCESS;
 }
@@ -851,12 +955,21 @@ static int
 i40e_pf_host_process_cmd_cfg_vlan_offload(
 					struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_vlan_offload_info *offload =
 			(struct i40e_virtchnl_vlan_offload_info *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*offload)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -877,12 +990,21 @@ i40e_pf_host_process_cmd_cfg_vlan_offload(
 static int
 i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_pvid_info  *tpid_info =
 			(struct i40e_virtchnl_pvid_info *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CFG_VLAN_PVID,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*tpid_info)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -923,6 +1045,8 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 	struct i40e_pf_vf *vf;
 	/* AdminQ will pass absolute VF id, transfer to internal vf id */
 	uint16_t vf_id = abs_vf_id - hw->func_caps.vf_base_id;
+	struct rte_pmd_i40e_mb_event_param cb_param;
+	bool b_op = TRUE;
 
 	if (vf_id > pf->vf_num - 1 || !pf->vfs) {
 		PMD_DRV_LOG(ERR, "invalid argument");
@@ -937,10 +1061,35 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 		return;
 	}
 
+	/**
+	 * initialise structure to send to user application
+	 * will return response from user in retval field
+	 */
+	cb_param.retval = RTE_PMD_I40E_MB_EVENT_PROCEED;
+	cb_param.vfid = vf_id;
+	cb_param.msg_type = opcode;
+	cb_param.msg = (void *)msg;
+	cb_param.msglen = msglen;
+
+	/**
+	 * Ask user application if we're allowed to perform those functions.
+	 * If we get cb_param.retval == RTE_PMD_I40E_MB_EVENT_PROCEED,
+	 * then business as usual.
+	 * If RTE_PMD_I40E_MB_EVENT_NOOP_ACK or RTE_PMD_I40E_MB_EVENT_NOOP_NACK,
+	 * do nothing and send not_supported to VF. As PF must send a response
+	 * to VF and ACK/NACK is not defined.
+	 */
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
+	if (cb_param.retval != RTE_PMD_I40E_MB_EVENT_PROCEED) {
+		PMD_DRV_LOG(WARNING, "VF to PF message(%d) is not permitted!",
+			    opcode);
+		b_op = FALSE;
+	}
+
 	switch (opcode) {
 	case I40E_VIRTCHNL_OP_VERSION :
 		PMD_DRV_LOG(INFO, "OP_VERSION received");
-		i40e_pf_host_process_cmd_version(vf);
+		i40e_pf_host_process_cmd_version(vf, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_RESET_VF :
 		PMD_DRV_LOG(INFO, "OP_RESET_VF received");
@@ -948,61 +1097,72 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 		break;
 	case I40E_VIRTCHNL_OP_GET_VF_RESOURCES:
 		PMD_DRV_LOG(INFO, "OP_GET_VF_RESOURCES received");
-		i40e_pf_host_process_cmd_get_vf_resource(vf);
+		i40e_pf_host_process_cmd_get_vf_resource(vf, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_VSI_QUEUES received");
-		i40e_pf_host_process_cmd_config_vsi_queues(vf, msg, msglen);
+		i40e_pf_host_process_cmd_config_vsi_queues(vf, msg,
+							   msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_VSI_QUEUES_EXT received");
 		i40e_pf_host_process_cmd_config_vsi_queues_ext(vf, msg,
-								msglen);
+							       msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_IRQ_MAP received");
-		i40e_pf_host_process_cmd_config_irq_map(vf, msg, msglen);
+		i40e_pf_host_process_cmd_config_irq_map(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_ENABLE_QUEUES:
 		PMD_DRV_LOG(INFO, "OP_ENABLE_QUEUES received");
-		i40e_pf_host_process_cmd_enable_queues(vf, msg, msglen);
-		i40e_notify_vf_link_status(dev, vf);
+		if (b_op) {
+			i40e_pf_host_process_cmd_enable_queues(vf, msg, msglen);
+			i40e_notify_vf_link_status(dev, vf);
+		} else {
+			i40e_pf_host_send_msg_to_vf(
+				vf, I40E_VIRTCHNL_OP_ENABLE_QUEUES,
+				I40E_NOT_SUPPORTED, NULL, 0);
+		}
 		break;
 	case I40E_VIRTCHNL_OP_DISABLE_QUEUES:
 		PMD_DRV_LOG(INFO, "OP_DISABLE_QUEUE received");
-		i40e_pf_host_process_cmd_disable_queues(vf, msg, msglen);
+		i40e_pf_host_process_cmd_disable_queues(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS:
 		PMD_DRV_LOG(INFO, "OP_ADD_ETHER_ADDRESS received");
-		i40e_pf_host_process_cmd_add_ether_address(vf, msg, msglen);
+		i40e_pf_host_process_cmd_add_ether_address(vf, msg,
+							   msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS:
 		PMD_DRV_LOG(INFO, "OP_DEL_ETHER_ADDRESS received");
-		i40e_pf_host_process_cmd_del_ether_address(vf, msg, msglen);
+		i40e_pf_host_process_cmd_del_ether_address(vf, msg,
+							   msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_ADD_VLAN:
 		PMD_DRV_LOG(INFO, "OP_ADD_VLAN received");
-		i40e_pf_host_process_cmd_add_vlan(vf, msg, msglen);
+		i40e_pf_host_process_cmd_add_vlan(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_DEL_VLAN:
 		PMD_DRV_LOG(INFO, "OP_DEL_VLAN received");
-		i40e_pf_host_process_cmd_del_vlan(vf, msg, msglen);
+		i40e_pf_host_process_cmd_del_vlan(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_PROMISCUOUS_MODE received");
-		i40e_pf_host_process_cmd_config_promisc_mode(vf, msg, msglen);
+		i40e_pf_host_process_cmd_config_promisc_mode(vf, msg,
+							     msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_GET_STATS:
 		PMD_DRV_LOG(INFO, "OP_GET_STATS received");
-		i40e_pf_host_process_cmd_get_stats(vf);
+		i40e_pf_host_process_cmd_get_stats(vf, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD:
 		PMD_DRV_LOG(INFO, "OP_CFG_VLAN_OFFLOAD received");
-		i40e_pf_host_process_cmd_cfg_vlan_offload(vf, msg, msglen);
+		i40e_pf_host_process_cmd_cfg_vlan_offload(vf, msg,
+							  msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CFG_VLAN_PVID:
 		PMD_DRV_LOG(INFO, "OP_CFG_VLAN_PVID received");
-		i40e_pf_host_process_cmd_cfg_pvid(vf, msg, msglen);
+		i40e_pf_host_process_cmd_cfg_pvid(vf, msg, msglen, b_op);
 		break;
 	/* Don't add command supported below, which will
 	 * return an error code.
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 14852f2..eb7a72b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -42,6 +42,27 @@
 #include <rte_ethdev.h>
 
 /**
+ * Response sent back to i40e driver from user app after callback
+ */
+enum rte_pmd_i40e_mb_event_rsp {
+	RTE_PMD_I40E_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+	RTE_PMD_I40E_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+	RTE_PMD_I40E_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+	RTE_PMD_I40E_MB_EVENT_MAX       /**< max value of this enum */
+};
+
+/**
+ * Data sent to the user application when the callback is executed.
+ */
+struct rte_pmd_i40e_mb_event_param {
+	uint16_t vfid;     /**< Virtual Function number */
+	uint16_t msg_type; /**< VF to PF message type, see i40e_virtchnl_ops */
+	uint16_t retval;   /**< return value */
+	void *msg;         /**< pointer to message */
+	uint16_t msglen;   /**< length of the message */
+};
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
-- 
2.9.3

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

* [PATCH v4 03/29] net/i40e: set VF MAC anti-spoofing from PF
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 01/29] net/i40e: support link status notification Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 02/29] net/i40e: add callback to user on VF to PF mbox msg Ferruh Yigit
@ 2016-12-16 14:38   ` Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 04/29] net/i40e: set VF VLAN " Ferruh Yigit
                     ` (27 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:38 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling VF MAC anti-spoofing from
PF.
User can call the API on PF to enable/disable a specific
VF's MAC anti-spoofing.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 63 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 83 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index fc7e987..c23e6b5 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9723,3 +9723,66 @@ rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
 
 	return 0;
 }
+
+int
+rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	struct i40e_hw *hw;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	/* Check if it has been already on or off */
+	if (vsi->info.valid_sections &
+		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SECURITY_VALID)) {
+		if (on) {
+			if ((vsi->info.sec_flags &
+			     I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK) ==
+			    I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK)
+				return 0; /* already on */
+		} else {
+			if ((vsi->info.sec_flags &
+			     I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK) == 0)
+				return 0; /* already off */
+		}
+	}
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SECURITY_VALID);
+	if (on)
+		vsi->info.sec_flags |= I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK;
+	else
+		vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index eb7a72b..52319cf 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -76,4 +76,23 @@ struct rte_pmd_i40e_mb_event_param {
  */
 int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
 
+/**
+ * Enable/Disable VF MAC anti spoofing.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set MAC anti spoofing.
+ * @param on
+ *    1 - Enable VFs MAC anti spoofing.
+ *    0 - Disable VFs MAC anti spoofing.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
+				       uint16_t vf_id,
+				       uint8_t on);
+
 #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 4555446..30efb08 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -7,4 +7,5 @@ DPDK_17.02 {
 	global:
 
 	rte_pmd_i40e_ping_vfs;
+	rte_pmd_i40e_set_vf_mac_anti_spoof;
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 04/29] net/i40e: set VF VLAN anti-spoofing from PF
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (2 preceding siblings ...)
  2016-12-16 14:38   ` [PATCH v4 03/29] net/i40e: set VF MAC anti-spoofing from PF Ferruh Yigit
@ 2016-12-16 14:38   ` Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 05/29] net/i40e: set Tx loopback " Ferruh Yigit
                     ` (26 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:38 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling VF VLAN anti-spoofing from
PF.
User can call the API on PF to enable/disable a specific
VF's VLAN anti-spoofing.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 116 +++++++++++++++++++++++++++++-
 drivers/net/i40e/i40e_ethdev.h            |   1 +
 drivers/net/i40e/rte_pmd_i40e.h           |  19 +++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 4 files changed, 135 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index c23e6b5..77be98b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4418,6 +4418,7 @@ i40e_vsi_setup(struct i40e_pf *pf,
 	vsi->max_macaddrs = I40E_NUM_MACADDR_MAX;
 	vsi->parent_vsi = uplink_vsi ? uplink_vsi : pf->main_vsi;
 	vsi->user_param = user_param;
+	vsi->vlan_anti_spoof_on = 0;
 	/* Allocate queues */
 	switch (vsi->type) {
 	case I40E_VSI_MAIN  :
@@ -5761,17 +5762,35 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi,
 			 uint16_t vlan_id, bool on)
 {
 	uint32_t vid_idx, vid_bit;
+	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
+	struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0};
+	int ret;
 
 	if (vlan_id > ETH_VLAN_ID_MAX)
 		return;
 
 	vid_idx = I40E_VFTA_IDX(vlan_id);
 	vid_bit = I40E_VFTA_BIT(vlan_id);
+	vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
 
-	if (on)
+	if (on) {
+		if (vsi->vlan_anti_spoof_on) {
+			ret = i40e_aq_add_vlan(hw, vsi->seid,
+					       &vlan_data, 1, NULL);
+			if (ret != I40E_SUCCESS)
+				PMD_DRV_LOG(ERR, "Failed to add vlan filter");
+		}
 		vsi->vfta[vid_idx] |= vid_bit;
-	else
+	} else {
+		if (vsi->vlan_anti_spoof_on) {
+			ret = i40e_aq_remove_vlan(hw, vsi->seid,
+						  &vlan_data, 1, NULL);
+			if (ret != I40E_SUCCESS)
+				PMD_DRV_LOG(ERR,
+					    "Failed to remove vlan filter");
+		}
 		vsi->vfta[vid_idx] &= ~vid_bit;
+	}
 }
 
 /**
@@ -9786,3 +9805,96 @@ rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+static int
+i40e_add_rm_all_vlan_filter(struct i40e_vsi *vsi, uint8_t add)
+{
+	uint32_t j, k;
+	uint16_t vlan_id;
+	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
+	struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0};
+	int ret;
+
+	for (j = 0; j < I40E_VFTA_SIZE; j++) {
+		if (!vsi->vfta[j])
+			continue;
+
+		for (k = 0; k < I40E_UINT32_BIT_SIZE; k++) {
+			if (!(vsi->vfta[j] & (1 << k)))
+				continue;
+
+			vlan_id = j * I40E_UINT32_BIT_SIZE + k;
+			vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
+			if (add)
+				ret = i40e_aq_add_vlan(hw, vsi->seid,
+						       &vlan_data, 1, NULL);
+			else
+				ret = i40e_aq_remove_vlan(hw, vsi->seid,
+							  &vlan_data, 1, NULL);
+			if (ret != I40E_SUCCESS) {
+				PMD_DRV_LOG(ERR,
+					    "Failed to add/rm vlan filter");
+				return ret;
+			}
+		}
+	}
+
+	return I40E_SUCCESS;
+}
+
+int
+rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	struct i40e_hw *hw;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	/* Check if it has been already on or off */
+	if (vsi->vlan_anti_spoof_on == on)
+		return 0; /* already on or off */
+
+	vsi->vlan_anti_spoof_on = on;
+	ret = i40e_add_rm_all_vlan_filter(vsi, on);
+	if (ret)
+		return ret;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SECURITY_VALID);
+	if (on)
+		vsi->info.sec_flags |= I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK;
+	else
+		vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 298cef4..0db140b 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -300,6 +300,7 @@ struct i40e_vsi {
 	uint16_t msix_intr; /* The MSIX interrupt binds to VSI */
 	uint16_t nb_msix;   /* The max number of msix vector */
 	uint8_t enabled_tc; /* The traffic class enabled */
+	uint8_t vlan_anti_spoof_on; /* The VLAN anti-spoofing enabled */
 	struct i40e_bw_info bw_info; /* VSI bandwidth information */
 };
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 52319cf..c8736c8 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -95,4 +95,23 @@ int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
 				       uint16_t vf_id,
 				       uint8_t on);
 
+/**
+ * Enable/Disable VF VLAN anti spoofing.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set VLAN anti spoofing.
+ * @param on
+ *    1 - Enable VFs VLAN anti spoofing.
+ *    0 - Disable VFs VLAN anti spoofing.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
+					uint16_t vf_id,
+					uint8_t on);
+
 #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 30efb08..fff6cf9 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -8,4 +8,5 @@ DPDK_17.02 {
 
 	rte_pmd_i40e_ping_vfs;
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
+	rte_pmd_i40e_set_vf_vlan_anti_spoof;
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 05/29] net/i40e: set Tx loopback from PF
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (3 preceding siblings ...)
  2016-12-16 14:38   ` [PATCH v4 04/29] net/i40e: set VF VLAN " Ferruh Yigit
@ 2016-12-16 14:38   ` Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 06/29] net/i40e: set VF unicast promisc mode " Ferruh Yigit
                     ` (25 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:38 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling TX loopback from PF.
User can call the API on PF to enable/disable TX loopback
for all the PF and VFs.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 219 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  16 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 3 files changed, 236 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 77be98b..89f5784 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9898,3 +9898,222 @@ rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+static int
+i40e_vsi_rm_mac_filter(struct i40e_vsi *vsi)
+{
+	struct i40e_mac_filter *f;
+	struct i40e_macvlan_filter *mv_f;
+	int i, vlan_num;
+	enum rte_mac_filter_type filter_type;
+	int ret = I40E_SUCCESS;
+
+	/* remove all the MACs */
+	TAILQ_FOREACH(f, &vsi->mac_list, next) {
+		vlan_num = vsi->vlan_num;
+		filter_type = f->mac_info.filter_type;
+		if (filter_type == RTE_MACVLAN_PERFECT_MATCH ||
+		    filter_type == RTE_MACVLAN_HASH_MATCH) {
+			if (vlan_num == 0) {
+				PMD_DRV_LOG(ERR,
+					    "VLAN number shouldn't be 0\n");
+				return I40E_ERR_PARAM;
+			}
+		} else if (filter_type == RTE_MAC_PERFECT_MATCH ||
+			   filter_type == RTE_MAC_HASH_MATCH)
+			vlan_num = 1;
+
+		mv_f = rte_zmalloc("macvlan_data", vlan_num * sizeof(*mv_f), 0);
+		if (!mv_f) {
+			PMD_DRV_LOG(ERR, "failed to allocate memory");
+			return I40E_ERR_NO_MEMORY;
+		}
+
+		for (i = 0; i < vlan_num; i++) {
+			mv_f[i].filter_type = filter_type;
+			(void)rte_memcpy(&mv_f[i].macaddr,
+					 &f->mac_info.mac_addr,
+					 ETH_ADDR_LEN);
+		}
+		if (filter_type == RTE_MACVLAN_PERFECT_MATCH ||
+		    filter_type == RTE_MACVLAN_HASH_MATCH) {
+			ret = i40e_find_all_vlan_for_mac(vsi, mv_f, vlan_num,
+							 &f->mac_info.mac_addr);
+			if (ret != I40E_SUCCESS) {
+				rte_free(mv_f);
+				return ret;
+			}
+		}
+
+		ret = i40e_remove_macvlan_filters(vsi, mv_f, vlan_num);
+		if (ret != I40E_SUCCESS) {
+			rte_free(mv_f);
+			return ret;
+		}
+
+		rte_free(mv_f);
+		ret = I40E_SUCCESS;
+	}
+
+	return ret;
+}
+
+static int
+i40e_vsi_restore_mac_filter(struct i40e_vsi *vsi)
+{
+	struct i40e_mac_filter *f;
+	struct i40e_macvlan_filter *mv_f;
+	int i, vlan_num = 0;
+	int ret = I40E_SUCCESS;
+
+	/* restore all the MACs */
+	TAILQ_FOREACH(f, &vsi->mac_list, next) {
+		if ((f->mac_info.filter_type == RTE_MACVLAN_PERFECT_MATCH) ||
+		    (f->mac_info.filter_type == RTE_MACVLAN_HASH_MATCH)) {
+			/**
+			 * If vlan_num is 0, that's the first time to add mac,
+			 * set mask for vlan_id 0.
+			 */
+			if (vsi->vlan_num == 0) {
+				i40e_set_vlan_filter(vsi, 0, 1);
+				vsi->vlan_num = 1;
+			}
+			vlan_num = vsi->vlan_num;
+		} else if ((f->mac_info.filter_type == RTE_MAC_PERFECT_MATCH) ||
+			   (f->mac_info.filter_type == RTE_MAC_HASH_MATCH))
+			vlan_num = 1;
+
+		mv_f = rte_zmalloc("macvlan_data", vlan_num * sizeof(*mv_f), 0);
+		if (!mv_f) {
+			PMD_DRV_LOG(ERR, "failed to allocate memory");
+			return I40E_ERR_NO_MEMORY;
+		}
+
+		for (i = 0; i < vlan_num; i++) {
+			mv_f[i].filter_type = f->mac_info.filter_type;
+			(void)rte_memcpy(&mv_f[i].macaddr,
+					 &f->mac_info.mac_addr,
+					 ETH_ADDR_LEN);
+		}
+
+		if (f->mac_info.filter_type == RTE_MACVLAN_PERFECT_MATCH ||
+		    f->mac_info.filter_type == RTE_MACVLAN_HASH_MATCH) {
+			ret = i40e_find_all_vlan_for_mac(vsi, mv_f, vlan_num,
+							 &f->mac_info.mac_addr);
+			if (ret != I40E_SUCCESS) {
+				rte_free(mv_f);
+				return ret;
+			}
+		}
+
+		ret = i40e_add_macvlan_filters(vsi, mv_f, vlan_num);
+		if (ret != I40E_SUCCESS) {
+			rte_free(mv_f);
+			return ret;
+		}
+
+		rte_free(mv_f);
+		ret = I40E_SUCCESS;
+	}
+
+	return ret;
+}
+
+static int
+i40e_vsi_set_tx_loopback(struct i40e_vsi *vsi, uint8_t on)
+{
+	struct i40e_vsi_context ctxt;
+	struct i40e_hw *hw;
+	int ret;
+
+	hw = I40E_VSI_TO_HW(vsi);
+
+	/* Use the FW API if FW >= v5.0 */
+	if (hw->aq.fw_maj_ver < 5) {
+		PMD_INIT_LOG(ERR, "FW < v5.0, cannot enable loopback");
+		return -ENOTSUP;
+	}
+
+	/* Check if it has been already on or off */
+	if (vsi->info.valid_sections &
+		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID)) {
+		if (on) {
+			if ((vsi->info.switch_id &
+			     I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB) ==
+			    I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB)
+				return 0; /* already on */
+		} else {
+			if ((vsi->info.switch_id &
+			     I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB) == 0)
+				return 0; /* already off */
+		}
+	}
+
+	/* remove all the MACs first */
+	ret = i40e_vsi_rm_mac_filter(vsi);
+	if (ret)
+		return ret;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);
+	if (on)
+		vsi->info.switch_id |= I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB;
+	else
+		vsi->info.switch_id &= ~I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+		return ret;
+	}
+
+	/* add all the MACs back */
+	ret = i40e_vsi_restore_mac_filter(vsi);
+	if (ret)
+		return ret;
+
+	return ret;
+}
+
+int
+rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	uint16_t vf_id;
+	int ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	/* setup PF TX loopback */
+	vsi = pf->main_vsi;
+	ret = i40e_vsi_set_tx_loopback(vsi, on);
+	if (ret)
+		return ret;
+
+	/* setup TX loopback for all the VFs */
+	if (!pf->vfs) {
+		PMD_DRV_LOG(ERR, "Invalid argument.");
+		return -EINVAL;
+	}
+
+	for (vf_id = 0; vf_id < pf->vf_num; vf_id++) {
+		vf = &pf->vfs[vf_id];
+		vsi = vf->vsi;
+
+		ret = i40e_vsi_set_tx_loopback(vsi, on);
+		if (ret)
+			return ret;
+	}
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index c8736c8..3c65be4 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -114,4 +114,20 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
 					uint16_t vf_id,
 					uint8_t on);
 
+/**
+ * Enable/Disable TX loopback on all the PF and VFs.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param on
+ *    1 - Enable TX loopback.
+ *    0 - Disable TX loopback.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_tx_loopback(uint8_t port,
+				 uint8_t on);
+
 #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 fff6cf9..3da04d3 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -9,4 +9,5 @@ DPDK_17.02 {
 	rte_pmd_i40e_ping_vfs;
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
+	rte_pmd_i40e_set_tx_loopback;
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 06/29] net/i40e: set VF unicast promisc mode from PF
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (4 preceding siblings ...)
  2016-12-16 14:38   ` [PATCH v4 05/29] net/i40e: set Tx loopback " Ferruh Yigit
@ 2016-12-16 14:38   ` Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 07/29] net/i40e: set VF multicast " Ferruh Yigit
                     ` (24 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:38 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling VF unicast promiscuous mode from
PF.
User can call the API on PF to enable/disable a specific
VF's unicast promiscuous mode.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 36 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 56 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 89f5784..ffb69a1 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10117,3 +10117,39 @@ rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	hw = I40E_VSI_TO_HW(vf->vsi);
+
+	ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vf->vsi->seid,
+						  on, NULL, true);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set unicast promiscuous mode");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 3c65be4..4c98136 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -130,4 +130,23 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
 int rte_pmd_i40e_set_tx_loopback(uint8_t port,
 				 uint8_t on);
 
+/**
+ * Enable/Disable VF unicast promiscuous mode.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set.
+ * @param on
+ *    1 - Enable.
+ *    0 - Disable.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
+					uint16_t vf_id,
+					uint8_t on);
+
 #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 3da04d3..24b78ce 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -10,4 +10,5 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
 	rte_pmd_i40e_set_tx_loopback;
+	rte_pmd_i40e_set_vf_unicast_promisc;
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 07/29] net/i40e: set VF multicast promisc mode from PF
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (5 preceding siblings ...)
  2016-12-16 14:38   ` [PATCH v4 06/29] net/i40e: set VF unicast promisc mode " Ferruh Yigit
@ 2016-12-16 14:38   ` Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 08/29] net/i40e: enable VF MTU change Ferruh Yigit
                     ` (23 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:38 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling VF multicast promiscuous mode from
PF.
User can call the API on PF to enable/disable a specific
VF's multicast promiscuous mode.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 36 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 56 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ffb69a1..e2214bd 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10153,3 +10153,39 @@ rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	hw = I40E_VSI_TO_HW(vf->vsi);
+
+	ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vf->vsi->seid,
+						    on, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set multicast promiscuous mode");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 4c98136..9091520 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -149,4 +149,23 @@ int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
 					uint16_t vf_id,
 					uint8_t on);
 
+/**
+ * Enable/Disable VF multicast promiscuous mode.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set.
+ * @param on
+ *    1 - Enable.
+ *    0 - Disable.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
+					  uint16_t vf_id,
+					  uint8_t on);
+
 #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 24b78ce..08d3028 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -11,4 +11,5 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
 	rte_pmd_i40e_set_tx_loopback;
 	rte_pmd_i40e_set_vf_unicast_promisc;
+	rte_pmd_i40e_set_vf_multicast_promisc;
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 08/29] net/i40e: enable VF MTU change
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (6 preceding siblings ...)
  2016-12-16 14:38   ` [PATCH v4 07/29] net/i40e: set VF multicast " Ferruh Yigit
@ 2016-12-16 14:38   ` Ferruh Yigit
  2016-12-16 14:38   ` [PATCH v4 09/29] net/i40e: fix VF reset flow Ferruh Yigit
                     ` (22 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:38 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

This patch implement mtu_set ops for i40e VF.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 12da0ec..bce01d0 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -151,6 +151,7 @@ static int i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,
 				      struct rte_eth_rss_conf *rss_conf);
 static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 					struct rte_eth_rss_conf *rss_conf);
+static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 static int
 i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -225,6 +226,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = {
 	.reta_query           = i40evf_dev_rss_reta_query,
 	.rss_hash_update      = i40evf_dev_rss_hash_update,
 	.rss_hash_conf_get    = i40evf_dev_rss_hash_conf_get,
+	.mtu_set              = i40evf_dev_mtu_set,
 };
 
 /*
@@ -2641,3 +2643,34 @@ i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 
 	return 0;
 }
+
+static int
+i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+	struct rte_eth_dev_data *dev_data = vf->dev_data;
+	uint32_t frame_size = mtu + ETHER_HDR_LEN
+			      + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE;
+	int ret = 0;
+
+	/* check if mtu is within the allowed range */
+	if ((mtu < ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX))
+		return -EINVAL;
+
+	/* mtu setting is forbidden if port is start */
+	if (dev_data->dev_started) {
+		PMD_DRV_LOG(ERR,
+			    "port %d must be stopped before configuration\n",
+			    dev_data->port_id);
+		return -EBUSY;
+	}
+
+	if (frame_size > ETHER_MAX_LEN)
+		dev_data->dev_conf.rxmode.jumbo_frame = 1;
+	else
+		dev_data->dev_conf.rxmode.jumbo_frame = 0;
+
+	dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
+
+	return ret;
+}
-- 
2.9.3

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

* [PATCH v4 09/29] net/i40e: fix VF reset flow
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (7 preceding siblings ...)
  2016-12-16 14:38   ` [PATCH v4 08/29] net/i40e: enable VF MTU change Ferruh Yigit
@ 2016-12-16 14:38   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 10/29] net/i40e: set VF MAC from PF support Ferruh Yigit
                     ` (21 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:38 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Add missing step during VF reset: PF should
set I40E_VFGEN_RSTAT to ACTIVE at end of the
VF reset operation or VF driver may not able
to detect that reset is already completed.
This patch also remove the unnecessary enum
for vfr state.

Fixes: 4861cde46116 ("i40e: new poll mode driver")

CC: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/i40e/i40e_pf.c | 6 ++++--
 drivers/net/i40e/i40e_pf.h | 5 -----
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 8b8a14f..2bc3355 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -139,7 +139,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)
 	abs_vf_id = vf_id + hw->func_caps.vf_base_id;
 
 	/* Notify VF that we are in VFR progress */
-	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_PF_VFR_INPROGRESS);
+	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_VFR_INPROGRESS);
 
 	/*
 	 * If require a SW VF reset, a VFLR interrupt will be generated,
@@ -220,7 +220,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)
 	}
 
 	/* Reset done, Set COMPLETE flag and clear reset bit */
-	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_PF_VFR_COMPLETED);
+	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_VFR_COMPLETED);
 	val = I40E_READ_REG(hw, I40E_VPGEN_VFRTRIG(vf_id));
 	val &= ~I40E_VPGEN_VFRTRIG_VFSWR_MASK;
 	I40E_WRITE_REG(hw, I40E_VPGEN_VFRTRIG(vf_id), val);
@@ -248,6 +248,8 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)
 		return -EFAULT;
 	}
 
+	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_VFR_VFACTIVE);
+
 	return ret;
 }
 
diff --git a/drivers/net/i40e/i40e_pf.h b/drivers/net/i40e/i40e_pf.h
index 59bf2ee..ada398b 100644
--- a/drivers/net/i40e/i40e_pf.h
+++ b/drivers/net/i40e/i40e_pf.h
@@ -48,11 +48,6 @@
 
 #define I40E_DPDK_OFFSET  0x100
 
-enum i40e_pf_vfr_state {
-	I40E_PF_VFR_INPROGRESS = 0,
-	I40E_PF_VFR_COMPLETED = 1,
-};
-
 /* DPDK pf driver specific command to VF */
 enum i40e_virtchnl_ops_dpdk {
 	/*
-- 
2.9.3

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

* [PATCH v4 10/29] net/i40e: set VF MAC from PF support
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (8 preceding siblings ...)
  2016-12-16 14:38   ` [PATCH v4 09/29] net/i40e: fix VF reset flow Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 11/29] net/i40e: set VF MAC from VF support Ferruh Yigit
                     ` (20 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

Support setting VF MAC address from PF.
User can call the API on PF to set a specific
VF's MAC address.

This will remove all existing MAC filters.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 40 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 +++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  2 ++
 3 files changed, 61 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index e2214bd..e9bd95b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10189,3 +10189,43 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+			     struct ether_addr *mac_addr)
+{
+	struct rte_eth_dev_info dev_info;
+	struct i40e_mac_filter *f;
+	struct rte_eth_dev *dev;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	struct i40e_pf *pf;
+	void *temp;
+
+	if (i40e_validate_mac_addr((u8 *)mac_addr) != I40E_SUCCESS)
+		return -EINVAL;
+
+	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)
+		return -EINVAL;
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	ether_addr_copy(mac_addr, &vf->mac_addr);
+
+	/* Remove all existing mac */
+	TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp)
+		i40e_vsi_delete_mac(vsi, &f->mac_info.mac_addr);
+
+	return 0;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 9091520..faacbb9 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -168,4 +168,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
 					  uint16_t vf_id,
 					  uint8_t on);
 
+/**
+ * Set the VF MAC address.
+ *
+ * This will remove all existing MAC filters.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param vf_id
+ *   VF id.
+ * @param mac_addr
+ *   VF MAC address.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
+ */
+int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+				 struct ether_addr *mac_addr);
+
 #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 08d3028..64ba93a 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -12,4 +12,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_tx_loopback;
 	rte_pmd_i40e_set_vf_unicast_promisc;
 	rte_pmd_i40e_set_vf_multicast_promisc;
+	rte_pmd_i40e_set_vf_mac_addr;
+
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 11/29] net/i40e: set VF MAC from VF support
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (9 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 10/29] net/i40e: set VF MAC from PF support Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 12/29] net/i40e: fix VF MAC address assignment Ferruh Yigit
                     ` (19 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

Support changing VF default MAC address.
This function is not supported if PF set the MAC
address for the PF.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/i40e/i40e_ethdev.h    |  4 +++-
 drivers/net/i40e/i40e_ethdev_vf.c | 49 +++++++++++++++++++++++++++++++++------
 2 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 0db140b..b687b0c 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -126,6 +126,7 @@ enum i40e_flxpld_layer_idx {
 #define I40E_FLAG_FDIR                  (1ULL << 6)
 #define I40E_FLAG_VXLAN                 (1ULL << 7)
 #define I40E_FLAG_RSS_AQ_CAPABLE        (1ULL << 8)
+#define I40E_FLAG_VF_MAC_BY_PF          (1ULL << 9)
 #define I40E_FLAG_ALL (I40E_FLAG_RSS | \
 		       I40E_FLAG_DCB | \
 		       I40E_FLAG_VMDQ | \
@@ -134,7 +135,8 @@ enum i40e_flxpld_layer_idx {
 		       I40E_FLAG_HEADER_SPLIT_ENABLED | \
 		       I40E_FLAG_FDIR | \
 		       I40E_FLAG_VXLAN | \
-		       I40E_FLAG_RSS_AQ_CAPABLE)
+		       I40E_FLAG_RSS_AQ_CAPABLE | \
+		       I40E_FLAG_VF_MAC_BY_PF)
 
 #define I40E_RSS_OFFLOAD_ALL ( \
 	ETH_RSS_FRAG_IPV4 | \
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index bce01d0..5016249 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -152,6 +152,8 @@ static int i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,
 static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 					struct rte_eth_rss_conf *rss_conf);
 static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
+static void i40evf_set_default_mac_addr(struct rte_eth_dev *dev,
+					struct ether_addr *mac_addr);
 static int
 i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -227,6 +229,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = {
 	.rss_hash_update      = i40evf_dev_rss_hash_update,
 	.rss_hash_conf_get    = i40evf_dev_rss_hash_conf_get,
 	.mtu_set              = i40evf_dev_mtu_set,
+	.mac_addr_set         = i40evf_set_default_mac_addr,
 };
 
 /*
@@ -888,19 +891,16 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
 }
 
 static void
-i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
+i40evf_del_mac_addr_by_addr(struct rte_eth_dev *dev,
+			    struct ether_addr *addr)
 {
 	struct i40e_virtchnl_ether_addr_list *list;
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-	struct rte_eth_dev_data *data = dev->data;
-	struct ether_addr *addr;
 	uint8_t cmd_buffer[sizeof(struct i40e_virtchnl_ether_addr_list) + \
 			sizeof(struct i40e_virtchnl_ether_addr)];
 	int err;
 	struct vf_cmd_info args;
 
-	addr = &(data->mac_addrs[index]);
-
 	if (i40e_validate_mac_addr(addr->addr_bytes) != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Invalid mac:%x-%x-%x-%x-%x-%x",
 			    addr->addr_bytes[0], addr->addr_bytes[1],
@@ -927,6 +927,17 @@ i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
 	return;
 }
 
+static void
+i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
+{
+	struct rte_eth_dev_data *data = dev->data;
+	struct ether_addr *addr;
+
+	addr = &data->mac_addrs[index];
+
+	i40evf_del_mac_addr_by_addr(dev, addr);
+}
+
 static int
 i40evf_update_stats(struct rte_eth_dev *dev, struct i40e_eth_stats **pstats)
 {
@@ -1260,10 +1271,12 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 
 	/* Store the MAC address configured by host, or generate random one */
 	p_mac_addr = (struct ether_addr *)(vf->vsi_res->default_mac_addr);
-	if (is_valid_assigned_ether_addr(p_mac_addr)) /* Configured by host */
+	if (is_valid_assigned_ether_addr(p_mac_addr)) { /* Configured by host */
 		ether_addr_copy(p_mac_addr, (struct ether_addr *)hw->mac.addr);
-	else
+		vf->flags |= I40E_FLAG_VF_MAC_BY_PF;
+	} else {
 		eth_random_addr(hw->mac.addr); /* Generate a random one */
+	}
 
 	/* If the PF host is not DPDK, set the interval of ITR0 to max*/
 	if (vf->version_major != I40E_DPDK_VERSION_MAJOR) {
@@ -2674,3 +2687,25 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 
 	return ret;
 }
+
+static void
+i40evf_set_default_mac_addr(struct rte_eth_dev *dev,
+			    struct ether_addr *mac_addr)
+{
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+
+	if (!is_valid_assigned_ether_addr(mac_addr)) {
+		PMD_DRV_LOG(ERR, "Tried to set invalid MAC address.");
+		return;
+	}
+
+	if (is_same_ether_addr(mac_addr, dev->data->mac_addrs))
+		return;
+
+	if (vf->flags & I40E_FLAG_VF_MAC_BY_PF)
+		return;
+
+	i40evf_del_mac_addr_by_addr(dev, dev->data->mac_addrs);
+
+	i40evf_add_mac_addr(dev, mac_addr, 0, 0);
+}
-- 
2.9.3

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

* [PATCH v4 12/29] net/i40e: fix VF MAC address assignment
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (10 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 11/29] net/i40e: set VF MAC from VF support Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 13/29] net/i40e: add VF VLAN strip func Ferruh Yigit
                     ` (18 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

If PF sets vf->mac_addr, in VF initialization hw->mac.addr will be set
to that same value. It is possible to check if PF set a MAC address or
not through the hw->mac.addr variable.

hw->mac.addr set by i40e_vf_parse_hw_config(), call stack is:

In PF side
i40e_pf_host_process_cmd_get_vf_resources()
    eth_addr_copy(vf->mac_addr, vf_res->vsi_res[0].default_mac_address)

In VF sise
i40evf_init_vf()
    i40evf_get_vf_resources()
            i40e_vf_parse_hw_config()
                    memcpy(hw->mac.addr, vsi_res->default_mac_addr)

Updated code is after i40evf_get_vf_resources() and can benefit from
hw->mac.addr variable.

Fixes: 89e6b86384bb ("i40evf: rework MAC address validation")

CC: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 5016249..0977095 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1193,7 +1193,6 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 	int i, err, bufsz;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-	struct ether_addr *p_mac_addr;
 	uint16_t interval =
 		i40e_calc_itr_interval(I40E_QUEUE_ITR_INTERVAL_MAX);
 
@@ -1270,13 +1269,10 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 	vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
 	/* Store the MAC address configured by host, or generate random one */
-	p_mac_addr = (struct ether_addr *)(vf->vsi_res->default_mac_addr);
-	if (is_valid_assigned_ether_addr(p_mac_addr)) { /* Configured by host */
-		ether_addr_copy(p_mac_addr, (struct ether_addr *)hw->mac.addr);
+	if (is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr))
 		vf->flags |= I40E_FLAG_VF_MAC_BY_PF;
-	} else {
+	else
 		eth_random_addr(hw->mac.addr); /* Generate a random one */
-	}
 
 	/* If the PF host is not DPDK, set the interval of ITR0 to max*/
 	if (vf->version_major != I40E_DPDK_VERSION_MAJOR) {
-- 
2.9.3

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

* [PATCH v4 13/29] net/i40e: add VF VLAN strip func
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (11 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 12/29] net/i40e: fix VF MAC address assignment Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 14/29] net/i40e: add set VF VLAN insert function Ferruh Yigit
                     ` (17 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Add a function to configure vlan strip enable/disable for specific
SRIOV VF device.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 26 ++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 +++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index e9bd95b..ae8d678 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10229,3 +10229,29 @@ rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
 
 	return 0;
 }
+
+/* Set vlan strip on/off for specific VF from host */
+int
+rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct i40e_pf *pf;
+	struct i40e_vsi *vsi;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	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;
+
+	if (vsi)
+		return i40e_vsi_config_vlan_stripping(vsi, !!on);
+	else
+		return -EINVAL;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index faacbb9..cea1192 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -187,4 +187,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
 int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
+/**
+ * Enable/Disable vf vlan strip for all queues in a pool
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param on
+ *    1 - Enable VF's vlan strip on RX queues.
+ *    0 - Disable VF's vlan strip on RX queues.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int
+rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+
 #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 64ba93a..2497b3e 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -13,5 +13,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_unicast_promisc;
 	rte_pmd_i40e_set_vf_multicast_promisc;
 	rte_pmd_i40e_set_vf_mac_addr;
+	rte_pmd_i40e_set_vf_vlan_stripq;
 
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 14/29] net/i40e: add set VF VLAN insert function
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (12 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 13/29] net/i40e: add VF VLAN strip func Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 15/29] net/i40e: set VF broadcast mode from PF Ferruh Yigit
                     ` (16 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support inserting VF VLAN id from PF.
User can call the API on PF to insert a VLAN id to a
specific VF.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 53 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 +++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 73 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ae8d678..41663a2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10255,3 +10255,56 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on)
 	else
 		return -EINVAL;
 }
+
+int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
+				    uint16_t vlan_id)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	struct i40e_vsi *vsi;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	hw = I40E_PF_TO_HW(pf);
+
+	/**
+	 * return -ENODEV if SRIOV not enabled, VF number not configured
+	 * or no queue assigned.
+	 */
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 ||
+	    pf->vf_nb_qps == 0)
+		return -ENODEV;
+
+	if (vf_id >= pf->vf_num || !pf->vfs)
+		return -EINVAL;
+
+	if (vlan_id > ETHER_MAX_VLAN_ID)
+		return -EINVAL;
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+	vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID;
+	vsi->info.pvid = vlan_id;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index cea1192..0c364f8 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -206,4 +206,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
 int
 rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
 
+/**
+ * Enable/Disable vf vlan insert
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param vlan_id
+ *    0 - Disable VF's vlan insert.
+ *    n - Enable; n is inserted as the vlan id.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
+				    uint16_t vlan_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 2497b3e..e5e70e9 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -14,5 +14,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_multicast_promisc;
 	rte_pmd_i40e_set_vf_mac_addr;
 	rte_pmd_i40e_set_vf_vlan_stripq;
+	rte_pmd_i40e_set_vf_vlan_insert;
 
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 15/29] net/i40e: set VF broadcast mode from PF
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (13 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 14/29] net/i40e: add set VF VLAN insert function Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 16/29] net/i40e: set VF VLAN tag " Ferruh Yigit
                     ` (15 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling VF broadcast mode from PF.
User can call the API on PF to enable/disable a specific
VF's broadcast mode.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 43 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 63 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 41663a2..a8361df 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10308,3 +10308,46 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
 
 	return ret;
 }
+
+int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
+					uint8_t on) {
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	int ret;
+
+	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;
+
+	if (on > 1)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	hw = I40E_PF_TO_HW(pf);
+
+	if (vf_id >= pf->vf_num || !pf->vfs)
+		return -EINVAL;
+
+	/**
+	 * return -ENODEV if SRIOV not enabled, VF number not configured
+	 * or no queue assigned.
+	 */
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+		return -ENODEV;
+
+	vf = &pf->vfs[vf_id];
+	hw = I40E_VSI_TO_HW(vf->vsi);
+
+	ret = i40e_aq_set_vsi_broadcast(hw, vf->vsi->seid, on, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set VSI broadcast");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 0c364f8..02f7109 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -225,4 +225,23 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
 int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
 				    uint16_t vlan_id);
 
+/**
+ * Enable/Disable vf broadcast mode
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param on
+ *    0 - Disable broadcast.
+ *    1 - Enable broadcast.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
+					uint8_t on);
+
 #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 e5e70e9..76a3ef8 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -15,5 +15,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_mac_addr;
 	rte_pmd_i40e_set_vf_vlan_stripq;
 	rte_pmd_i40e_set_vf_vlan_insert;
+	rte_pmd_i40e_set_vf_broadcast;
 
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 16/29] net/i40e: set VF VLAN tag from PF
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (14 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 15/29] net/i40e: set VF broadcast mode from PF Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 17/29] net/i40e: set VF VLAN filter " Ferruh Yigit
                     ` (14 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Add rte_pmd_i40e_set_vf_vlan_tag API.
User can call the API on PF to enable/disable a specific
VF's VLAN tag.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 59 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 18 ++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 78 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a8361df..207a62e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10351,3 +10351,62 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
 
 	return ret;
 }
+
+int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	struct i40e_vsi *vsi;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	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;
+
+	if (on > 1)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	hw = I40E_PF_TO_HW(pf);
+
+	/**
+	 * return -ENODEV if SRIOV not enabled, VF number not configured
+	 * or no queue assigned.
+	 */
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+		return -ENODEV;
+
+	if (vf_id >= pf->vf_num)
+		return -EINVAL;
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+	if (on) {
+		vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_TAGGED;
+		vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
+	} else {
+		vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
+		vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_TAGGED;
+	}
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 02f7109..b9bf8d1 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -244,4 +244,22 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
 int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
 					uint8_t on);
 
+/**
+ * Enable/Disable vf vlan tag
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param vlan_id
+ *    0 - Disable VF's vlan tag.
+ *    n - Enable VF's vlan tag.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
+
 #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 76a3ef8..22e2716 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -16,5 +16,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_vlan_stripq;
 	rte_pmd_i40e_set_vf_vlan_insert;
 	rte_pmd_i40e_set_vf_broadcast;
+	rte_pmd_i40e_set_vf_vlan_tag;
 
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 17/29] net/i40e: set VF VLAN filter from PF
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (15 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 16/29] net/i40e: set VF VLAN tag " Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 18/29] app/testpmd: use VFD APIs on i40e Ferruh Yigit
                     ` (13 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

add rte_pmd_i40e_set_vf_vlan_filter API.
User can call the API on PF to enable/disable
a set of VF's VLAN filters.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 52 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 22 +++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 75 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 207a62e..5ee010e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10410,3 +10410,55 @@ int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
+				    uint64_t vf_mask, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	uint16_t pool_idx;
+	int ret = I40E_SUCCESS;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (vlan_id > ETHER_MAX_VLAN_ID)
+		return -EINVAL;
+
+	if (on > 1)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	if ((pf->flags & I40E_FLAG_VMDQ) == 0) {
+		PMD_INIT_LOG(ERR, "Firmware doesn't support VMDQ");
+		return -ENOTSUP;
+	}
+
+	if (!pf->vmdq) {
+		PMD_INIT_LOG(INFO, "VMDQ not configured");
+		return -ENOTSUP;
+	}
+
+	for (pool_idx = 0;
+	     pool_idx < ETH_64_POOLS &&
+	     pool_idx < pf->nb_cfg_vmdq_vsi &&
+	     ret == I40E_SUCCESS;
+	     pool_idx++) {
+		if (vf_mask & ((uint64_t)(1ULL << pool_idx))) {
+			if (on)
+				ret = i40e_vsi_add_vlan(pf->vmdq[pool_idx].vsi,
+							vlan_id);
+			else
+				ret = i40e_vsi_delete_vlan(
+					pf->vmdq[pool_idx].vsi, vlan_id);
+		}
+	}
+
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set VF VLAN filter, on = %d", on);
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index b9bf8d1..96cda89 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -262,4 +262,26 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
  */
 int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
 
+/**
+ * Enable/Disable VF VLAN filter
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vlan_id
+ *    ID specifying VLAN
+ * @param vf_mask
+ *    Mask to filter VF's
+ * @param on
+ *    0 - Disable VF's VLAN filter.
+ *    1 - Enable VF's VLAN filter.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ *   - (-ENOTSUP) VMDq not configured of not supported by firmware.
+ */
+int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
+				    uint64_t vf_mask, uint8_t on);
+
 #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 22e2716..818ff9c 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -17,5 +17,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_vlan_insert;
 	rte_pmd_i40e_set_vf_broadcast;
 	rte_pmd_i40e_set_vf_vlan_tag;
+	rte_pmd_i40e_set_vf_vlan_filter;
 
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v4 18/29] app/testpmd: use VFD APIs on i40e
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (16 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 17/29] net/i40e: set VF VLAN filter " Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 19/29] app/testpmd: use unicast promiscuous mode " Ferruh Yigit
                     ` (12 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 19/29] app/testpmd: use unicast promiscuous mode on i40e
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (17 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 18/29] app/testpmd: use VFD APIs on i40e Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 20/29] app/testpmd: use multicast " Ferruh Yigit
                     ` (11 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 20/29] app/testpmd: use multicast promiscuous mode on i40e
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (18 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 19/29] app/testpmd: use unicast promiscuous mode " Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 21/29] app/testpmd: add command to test VF broadcast " Ferruh Yigit
                     ` (10 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 21/29] app/testpmd: add command to test VF broadcast mode on i40e
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (19 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 20/29] app/testpmd: use multicast " Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 22/29] app/testpmd: add command to test VF VLAN tag " Ferruh Yigit
                     ` (9 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 22/29] app/testpmd: add command to test VF VLAN tag on i40e
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (20 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 21/29] app/testpmd: add command to test VF broadcast " Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 23/29] app/testpmd: handle i40e in VF VLAN filter command Ferruh Yigit
                     ` (8 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 23/29] app/testpmd: handle i40e in VF VLAN filter command
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (21 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 22/29] app/testpmd: add command to test VF VLAN tag " Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 24/29] net/i40e: change version number to support Linux VF Ferruh Yigit
                     ` (7 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 24/29] net/i40e: change version number to support Linux VF
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (22 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 23/29] app/testpmd: handle i40e in VF VLAN filter command Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 25/29] net/i40e: return correct VSI id Ferruh Yigit
                     ` (6 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 25/29] net/i40e: return correct VSI id
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (23 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 24/29] net/i40e: change version number to support Linux VF Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 26/29] net/i40e: parse more VF parameter and configure Ferruh Yigit
                     ` (5 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 26/29] net/i40e: parse more VF parameter and configure
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (24 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 25/29] net/i40e: return correct VSI id Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 27/29] net/i40e: support Linux VF to configure IRQ link list Ferruh Yigit
                     ` (4 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 27/29] net/i40e: support Linux VF to configure IRQ link list
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (25 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 26/29] net/i40e: parse more VF parameter and configure Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 28/29] net/i40e: enhance in sanity check of MAC Ferruh Yigit
                     ` (3 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 28/29] net/i40e: enhance in sanity check of MAC
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (26 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 27/29] net/i40e: support Linux VF to configure IRQ link list Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:39   ` [PATCH v4 29/29] net/i40e: set/clear VF stats from PF Ferruh Yigit
                     ` (2 subsequent siblings)
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v4 29/29] net/i40e: set/clear VF stats from PF
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (27 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 28/29] net/i40e: enhance in sanity check of MAC Ferruh Yigit
@ 2016-12-16 14:39   ` Ferruh Yigit
  2016-12-16 14:45   ` [PATCH v4 00/29] Support VFD and DPDK PF + kernel VF on i40e Vincent Jardin
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
  30 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 14:39 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* Re: [PATCH v4 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (28 preceding siblings ...)
  2016-12-16 14:39   ` [PATCH v4 29/29] net/i40e: set/clear VF stats from PF Ferruh Yigit
@ 2016-12-16 14:45   ` Vincent Jardin
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
  30 siblings, 0 replies; 125+ messages in thread
From: Vincent Jardin @ 2016-12-16 14:45 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: Jingjing Wu, Helin Zhang

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	[flat|nested] 125+ messages in thread

* [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
                     ` (29 preceding siblings ...)
  2016-12-16 14:45   ` [PATCH v4 00/29] Support VFD and DPDK PF + kernel VF on i40e Vincent Jardin
@ 2016-12-16 19:02   ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 01/29] net/i40e: support link status notification Ferruh Yigit
                       ` (29 more replies)
  30 siblings, 30 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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.

v5:
- fix testpmd build error(s)
- fix i40e vf_rx_vlan
- remove redundant memset on dev_info
- add functions to .map file sorted

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                      | 560 ++++++++++++++++--
 app/test-pmd/config.c                       |  13 -
 app/test-pmd/testpmd.h                      |   2 -
 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 +
 13 files changed, 2191 insertions(+), 130 deletions(-)
 create mode 100644 drivers/net/i40e/rte_pmd_i40e.h

-- 
2.9.3

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

* [PATCH v5 01/29] net/i40e: support link status notification
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 02/29] net/i40e: add callback to user on VF to PF mbox msg Ferruh Yigit
                       ` (28 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Add an API to expose the ability, that PF can notify VF
when link status changes, to APP.
So if PF APP doesn't want to enable interruption but check
link status by itself, PF APP can let VF know link status
changed.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/Makefile                 |  4 ++-
 drivers/net/i40e/i40e_ethdev.c            | 28 +++++++++++++++
 drivers/net/i40e/i40e_pf.c                |  4 +--
 drivers/net/i40e/i40e_pf.h                |  4 ++-
 drivers/net/i40e/rte_pmd_i40e.h           | 58 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  7 ++++
 6 files changed, 101 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/i40e/rte_pmd_i40e.h

diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 66997b6..a2ef53c 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -1,6 +1,6 @@
 #   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
@@ -111,6 +111,8 @@ ifeq ($(findstring RTE_MACHINE_CPUFLAG_SSE4_1,$(CFLAGS)),)
 CFLAGS_i40e_rxtx_vec_sse.o += -msse4.1
 endif
 
+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h
 
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f42f4ba..fc7e987 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -62,6 +62,7 @@
 #include "i40e_rxtx.h"
 #include "i40e_pf.h"
 #include "i40e_regs.h"
+#include "rte_pmd_i40e.h"
 
 #define ETH_I40E_FLOATING_VEB_ARG	"enable_floating_veb"
 #define ETH_I40E_FLOATING_VEB_LIST_ARG	"floating_veb_list"
@@ -9695,3 +9696,30 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (vf >= dev_info.max_vfs)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	if (vf > pf->vf_num - 1 || !pf->vfs) {
+		PMD_DRV_LOG(ERR, "Invalid argument.");
+		return -EINVAL;
+	}
+
+	i40e_notify_vf_link_status(dev, &pf->vfs[vf]);
+
+	return 0;
+}
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index ddfc140..f70712b 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.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
@@ -897,7 +897,7 @@ i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,
 	return ret;
 }
 
-static void
+void
 i40e_notify_vf_link_status(struct rte_eth_dev *dev, struct i40e_pf_vf *vf)
 {
 	struct i40e_virtchnl_pf_event event;
diff --git a/drivers/net/i40e/i40e_pf.h b/drivers/net/i40e/i40e_pf.h
index cddc45c..59bf2ee 100644
--- a/drivers/net/i40e/i40e_pf.h
+++ b/drivers/net/i40e/i40e_pf.h
@@ -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
@@ -123,5 +123,7 @@ void i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 				uint8_t *msg, uint16_t msglen);
 int i40e_pf_host_init(struct rte_eth_dev *dev);
 int i40e_pf_host_uninit(struct rte_eth_dev *dev);
+void i40e_notify_vf_link_status(struct rte_eth_dev *dev,
+				struct i40e_pf_vf *vf);
 
 #endif /* _I40E_PF_H_ */
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
new file mode 100644
index 0000000..14852f2
--- /dev/null
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -0,0 +1,58 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright (c) 2016 Intel Corporation. All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file rte_pmd_i40e.h
+ * i40e PMD specific functions.
+ *
+ **/
+
+#ifndef _PMD_I40E_H_
+#define _PMD_I40E_H_
+
+#include <rte_ethdev.h>
+
+/**
+ * Notify VF when PF link status changes.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if *vf* invalid.
+ */
+int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
+
+#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 ef35398..3c6a192 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -2,3 +2,10 @@ DPDK_2.0 {
 
 	local: *;
 };
+
+DPDK_17.02 {
+	global:
+
+	rte_pmd_i40e_ping_vfs;
+
+} DPDK_2.0;
-- 
2.9.3

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

* [PATCH v5 02/29] net/i40e: add callback to user on VF to PF mbox msg
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 01/29] net/i40e: support link status notification Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 03/29] net/i40e: set VF MAC anti-spoofing from PF Ferruh Yigit
                       ` (27 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

The callback asks the user application if it is allowed to
perform the mailbox messages.

If the return value from user is RTE_PMD_I40E_MB_EVENT_PROCEED
then continue. If ACK or NACK, do nothing and send
not_supported to VF.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_pf.c      | 230 ++++++++++++++++++++++++++++++++++------
 drivers/net/i40e/rte_pmd_i40e.h |  21 ++++
 2 files changed, 216 insertions(+), 35 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index f70712b..8b8a14f 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -55,6 +55,7 @@
 #include "i40e_ethdev.h"
 #include "i40e_rxtx.h"
 #include "i40e_pf.h"
+#include "rte_pmd_i40e.h"
 
 #define I40E_CFG_CRCSTRIP_DEFAULT 1
 
@@ -272,14 +273,23 @@ i40e_pf_host_send_msg_to_vf(struct i40e_pf_vf *vf,
 }
 
 static void
-i40e_pf_host_process_cmd_version(struct i40e_pf_vf *vf)
+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;
-	i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
-		I40E_SUCCESS, (uint8_t *)&info, sizeof(info));
+
+	if (b_op)
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
+					    I40E_SUCCESS,
+					    (uint8_t *)&info,
+					    sizeof(info));
+	else
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
+					    I40E_NOT_SUPPORTED,
+					    (uint8_t *)&info,
+					    sizeof(info));
 }
 
 static int
@@ -292,13 +302,20 @@ i40e_pf_host_process_cmd_reset_vf(struct i40e_pf_vf *vf)
 }
 
 static int
-i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf)
+i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, bool b_op)
 {
 	struct i40e_virtchnl_vf_resource *vf_res = NULL;
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	uint32_t len = 0;
 	int ret = I40E_SUCCESS;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(vf,
+					    I40E_VIRTCHNL_OP_GET_VF_RESOURCES,
+					    I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	/* only have 1 VSI by default */
 	len =  sizeof(struct i40e_virtchnl_vf_resource) +
 				I40E_DEFAULT_VF_VSI_NUM *
@@ -423,7 +440,8 @@ i40e_pf_host_hmc_config_txq(struct i40e_hw *hw,
 static int
 i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 					   uint8_t *msg,
-					   uint16_t msglen)
+					   uint16_t msglen,
+					   bool b_op)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	struct i40e_vsi *vsi = vf->vsi;
@@ -432,6 +450,13 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 	struct i40e_virtchnl_queue_pair_info *vc_qpi;
 	int i, ret = I40E_SUCCESS;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(vf,
+					    I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES,
+					    I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (!msg || vc_vqci->num_queue_pairs > vsi->nb_qps ||
 		vc_vqci->num_queue_pairs > I40E_MAX_VSI_QP ||
 		msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqci,
@@ -482,7 +507,8 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,
 					       uint8_t *msg,
-					       uint16_t msglen)
+					       uint16_t msglen,
+					       bool b_op)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	struct i40e_vsi *vsi = vf->vsi;
@@ -491,6 +517,14 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,
 	struct i40e_virtchnl_queue_pair_ext_info *vc_qpei;
 	int i, ret = I40E_SUCCESS;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (!msg || vc_vqcei->num_queue_pairs > vsi->nb_qps ||
 		vc_vqcei->num_queue_pairs > I40E_MAX_VSI_QP ||
 		msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqcei,
@@ -539,12 +573,21 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,
 
 static int
 i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf,
-					uint8_t *msg, uint16_t msglen)
+					uint8_t *msg, uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_irq_map_info *irqmap =
 	    (struct i40e_virtchnl_irq_map_info *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen < sizeof(struct i40e_virtchnl_irq_map_info)) {
 		PMD_DRV_LOG(ERR, "buffer too short");
 		ret = I40E_ERR_PARAM;
@@ -646,12 +689,21 @@ i40e_pf_host_process_cmd_enable_queues(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_disable_queues(struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_queue_select *q_sel =
 		(struct i40e_virtchnl_queue_select *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_DISABLE_QUEUES,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*q_sel)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -669,7 +721,8 @@ i40e_pf_host_process_cmd_disable_queues(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,
 					   uint8_t *msg,
-					   uint16_t msglen)
+					   uint16_t msglen,
+					   bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -678,6 +731,14 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,
 	int i;
 	struct ether_addr *mac;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	memset(&filter, 0 , sizeof(struct i40e_mac_filter_info));
 
 	if (msg == NULL || msglen <= sizeof(*addr_list)) {
@@ -707,7 +768,8 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,
 					   uint8_t *msg,
-					   uint16_t msglen)
+					   uint16_t msglen,
+					   bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -715,6 +777,14 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,
 	int i;
 	struct ether_addr *mac;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen <= sizeof(*addr_list)) {
 		PMD_DRV_LOG(ERR, "delete_ether_address argument too short");
 		ret = I40E_ERR_PARAM;
@@ -739,7 +809,8 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,
 
 static int
 i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
-				uint8_t *msg, uint16_t msglen)
+				uint8_t *msg, uint16_t msglen,
+				bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -747,6 +818,14 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
 	int i;
 	uint16_t *vid;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_ADD_VLAN,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen <= sizeof(*vlan_filter_list)) {
 		PMD_DRV_LOG(ERR, "add_vlan argument too short");
 		ret = I40E_ERR_PARAM;
@@ -771,7 +850,8 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
 static int
 i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,
 				  uint8_t *msg,
-				  uint16_t msglen)
+				  uint16_t msglen,
+				  bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -779,6 +859,14 @@ i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,
 	int i;
 	uint16_t *vid;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_DEL_VLAN,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen <= sizeof(*vlan_filter_list)) {
 		PMD_DRV_LOG(ERR, "delete_vlan argument too short");
 		ret = I40E_ERR_PARAM;
@@ -803,7 +891,8 @@ static int
 i40e_pf_host_process_cmd_config_promisc_mode(
 					struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_promisc_info *promisc =
@@ -811,6 +900,14 @@ i40e_pf_host_process_cmd_config_promisc_mode(
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	bool unicast = FALSE, multicast = FALSE;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*promisc)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -836,13 +933,20 @@ i40e_pf_host_process_cmd_config_promisc_mode(
 }
 
 static int
-i40e_pf_host_process_cmd_get_stats(struct i40e_pf_vf *vf)
+i40e_pf_host_process_cmd_get_stats(struct i40e_pf_vf *vf, bool b_op)
 {
 	i40e_update_vsi_stats(vf->vsi);
 
-	i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_STATS,
-		I40E_SUCCESS, (uint8_t *)&vf->vsi->eth_stats,
-				sizeof(vf->vsi->eth_stats));
+	if (b_op)
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_STATS,
+					    I40E_SUCCESS,
+					    (uint8_t *)&vf->vsi->eth_stats,
+					    sizeof(vf->vsi->eth_stats));
+	else
+		i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_STATS,
+					    I40E_NOT_SUPPORTED,
+					    (uint8_t *)&vf->vsi->eth_stats,
+					    sizeof(vf->vsi->eth_stats));
 
 	return I40E_SUCCESS;
 }
@@ -851,12 +955,21 @@ static int
 i40e_pf_host_process_cmd_cfg_vlan_offload(
 					struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_vlan_offload_info *offload =
 			(struct i40e_virtchnl_vlan_offload_info *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*offload)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -877,12 +990,21 @@ i40e_pf_host_process_cmd_cfg_vlan_offload(
 static int
 i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,
 					uint8_t *msg,
-					uint16_t msglen)
+					uint16_t msglen,
+					bool b_op)
 {
 	int ret = I40E_SUCCESS;
 	struct i40e_virtchnl_pvid_info  *tpid_info =
 			(struct i40e_virtchnl_pvid_info *)msg;
 
+	if (!b_op) {
+		i40e_pf_host_send_msg_to_vf(
+			vf,
+			I40E_VIRTCHNL_OP_CFG_VLAN_PVID,
+			I40E_NOT_SUPPORTED, NULL, 0);
+		return ret;
+	}
+
 	if (msg == NULL || msglen != sizeof(*tpid_info)) {
 		ret = I40E_ERR_PARAM;
 		goto send_msg;
@@ -923,6 +1045,8 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 	struct i40e_pf_vf *vf;
 	/* AdminQ will pass absolute VF id, transfer to internal vf id */
 	uint16_t vf_id = abs_vf_id - hw->func_caps.vf_base_id;
+	struct rte_pmd_i40e_mb_event_param cb_param;
+	bool b_op = TRUE;
 
 	if (vf_id > pf->vf_num - 1 || !pf->vfs) {
 		PMD_DRV_LOG(ERR, "invalid argument");
@@ -937,10 +1061,35 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 		return;
 	}
 
+	/**
+	 * initialise structure to send to user application
+	 * will return response from user in retval field
+	 */
+	cb_param.retval = RTE_PMD_I40E_MB_EVENT_PROCEED;
+	cb_param.vfid = vf_id;
+	cb_param.msg_type = opcode;
+	cb_param.msg = (void *)msg;
+	cb_param.msglen = msglen;
+
+	/**
+	 * Ask user application if we're allowed to perform those functions.
+	 * If we get cb_param.retval == RTE_PMD_I40E_MB_EVENT_PROCEED,
+	 * then business as usual.
+	 * If RTE_PMD_I40E_MB_EVENT_NOOP_ACK or RTE_PMD_I40E_MB_EVENT_NOOP_NACK,
+	 * do nothing and send not_supported to VF. As PF must send a response
+	 * to VF and ACK/NACK is not defined.
+	 */
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
+	if (cb_param.retval != RTE_PMD_I40E_MB_EVENT_PROCEED) {
+		PMD_DRV_LOG(WARNING, "VF to PF message(%d) is not permitted!",
+			    opcode);
+		b_op = FALSE;
+	}
+
 	switch (opcode) {
 	case I40E_VIRTCHNL_OP_VERSION :
 		PMD_DRV_LOG(INFO, "OP_VERSION received");
-		i40e_pf_host_process_cmd_version(vf);
+		i40e_pf_host_process_cmd_version(vf, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_RESET_VF :
 		PMD_DRV_LOG(INFO, "OP_RESET_VF received");
@@ -948,61 +1097,72 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 		break;
 	case I40E_VIRTCHNL_OP_GET_VF_RESOURCES:
 		PMD_DRV_LOG(INFO, "OP_GET_VF_RESOURCES received");
-		i40e_pf_host_process_cmd_get_vf_resource(vf);
+		i40e_pf_host_process_cmd_get_vf_resource(vf, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_VSI_QUEUES received");
-		i40e_pf_host_process_cmd_config_vsi_queues(vf, msg, msglen);
+		i40e_pf_host_process_cmd_config_vsi_queues(vf, msg,
+							   msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_VSI_QUEUES_EXT received");
 		i40e_pf_host_process_cmd_config_vsi_queues_ext(vf, msg,
-								msglen);
+							       msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_IRQ_MAP received");
-		i40e_pf_host_process_cmd_config_irq_map(vf, msg, msglen);
+		i40e_pf_host_process_cmd_config_irq_map(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_ENABLE_QUEUES:
 		PMD_DRV_LOG(INFO, "OP_ENABLE_QUEUES received");
-		i40e_pf_host_process_cmd_enable_queues(vf, msg, msglen);
-		i40e_notify_vf_link_status(dev, vf);
+		if (b_op) {
+			i40e_pf_host_process_cmd_enable_queues(vf, msg, msglen);
+			i40e_notify_vf_link_status(dev, vf);
+		} else {
+			i40e_pf_host_send_msg_to_vf(
+				vf, I40E_VIRTCHNL_OP_ENABLE_QUEUES,
+				I40E_NOT_SUPPORTED, NULL, 0);
+		}
 		break;
 	case I40E_VIRTCHNL_OP_DISABLE_QUEUES:
 		PMD_DRV_LOG(INFO, "OP_DISABLE_QUEUE received");
-		i40e_pf_host_process_cmd_disable_queues(vf, msg, msglen);
+		i40e_pf_host_process_cmd_disable_queues(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS:
 		PMD_DRV_LOG(INFO, "OP_ADD_ETHER_ADDRESS received");
-		i40e_pf_host_process_cmd_add_ether_address(vf, msg, msglen);
+		i40e_pf_host_process_cmd_add_ether_address(vf, msg,
+							   msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS:
 		PMD_DRV_LOG(INFO, "OP_DEL_ETHER_ADDRESS received");
-		i40e_pf_host_process_cmd_del_ether_address(vf, msg, msglen);
+		i40e_pf_host_process_cmd_del_ether_address(vf, msg,
+							   msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_ADD_VLAN:
 		PMD_DRV_LOG(INFO, "OP_ADD_VLAN received");
-		i40e_pf_host_process_cmd_add_vlan(vf, msg, msglen);
+		i40e_pf_host_process_cmd_add_vlan(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_DEL_VLAN:
 		PMD_DRV_LOG(INFO, "OP_DEL_VLAN received");
-		i40e_pf_host_process_cmd_del_vlan(vf, msg, msglen);
+		i40e_pf_host_process_cmd_del_vlan(vf, msg, msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE:
 		PMD_DRV_LOG(INFO, "OP_CONFIG_PROMISCUOUS_MODE received");
-		i40e_pf_host_process_cmd_config_promisc_mode(vf, msg, msglen);
+		i40e_pf_host_process_cmd_config_promisc_mode(vf, msg,
+							     msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_GET_STATS:
 		PMD_DRV_LOG(INFO, "OP_GET_STATS received");
-		i40e_pf_host_process_cmd_get_stats(vf);
+		i40e_pf_host_process_cmd_get_stats(vf, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD:
 		PMD_DRV_LOG(INFO, "OP_CFG_VLAN_OFFLOAD received");
-		i40e_pf_host_process_cmd_cfg_vlan_offload(vf, msg, msglen);
+		i40e_pf_host_process_cmd_cfg_vlan_offload(vf, msg,
+							  msglen, b_op);
 		break;
 	case I40E_VIRTCHNL_OP_CFG_VLAN_PVID:
 		PMD_DRV_LOG(INFO, "OP_CFG_VLAN_PVID received");
-		i40e_pf_host_process_cmd_cfg_pvid(vf, msg, msglen);
+		i40e_pf_host_process_cmd_cfg_pvid(vf, msg, msglen, b_op);
 		break;
 	/* Don't add command supported below, which will
 	 * return an error code.
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 14852f2..eb7a72b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -42,6 +42,27 @@
 #include <rte_ethdev.h>
 
 /**
+ * Response sent back to i40e driver from user app after callback
+ */
+enum rte_pmd_i40e_mb_event_rsp {
+	RTE_PMD_I40E_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+	RTE_PMD_I40E_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+	RTE_PMD_I40E_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+	RTE_PMD_I40E_MB_EVENT_MAX       /**< max value of this enum */
+};
+
+/**
+ * Data sent to the user application when the callback is executed.
+ */
+struct rte_pmd_i40e_mb_event_param {
+	uint16_t vfid;     /**< Virtual Function number */
+	uint16_t msg_type; /**< VF to PF message type, see i40e_virtchnl_ops */
+	uint16_t retval;   /**< return value */
+	void *msg;         /**< pointer to message */
+	uint16_t msglen;   /**< length of the message */
+};
+
+/**
  * Notify VF when PF link status changes.
  *
  * @param port
-- 
2.9.3

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

* [PATCH v5 03/29] net/i40e: set VF MAC anti-spoofing from PF
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 01/29] net/i40e: support link status notification Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 02/29] net/i40e: add callback to user on VF to PF mbox msg Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 04/29] net/i40e: set VF VLAN " Ferruh Yigit
                       ` (26 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling VF MAC anti-spoofing from
PF.
User can call the API on PF to enable/disable a specific
VF's MAC anti-spoofing.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 63 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 83 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index fc7e987..c23e6b5 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9723,3 +9723,66 @@ rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
 
 	return 0;
 }
+
+int
+rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	struct i40e_hw *hw;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	/* Check if it has been already on or off */
+	if (vsi->info.valid_sections &
+		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SECURITY_VALID)) {
+		if (on) {
+			if ((vsi->info.sec_flags &
+			     I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK) ==
+			    I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK)
+				return 0; /* already on */
+		} else {
+			if ((vsi->info.sec_flags &
+			     I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK) == 0)
+				return 0; /* already off */
+		}
+	}
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SECURITY_VALID);
+	if (on)
+		vsi->info.sec_flags |= I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK;
+	else
+		vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index eb7a72b..52319cf 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -76,4 +76,23 @@ struct rte_pmd_i40e_mb_event_param {
  */
 int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
 
+/**
+ * Enable/Disable VF MAC anti spoofing.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set MAC anti spoofing.
+ * @param on
+ *    1 - Enable VFs MAC anti spoofing.
+ *    0 - Disable VFs MAC anti spoofing.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
+				       uint16_t vf_id,
+				       uint8_t on);
+
 #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 3c6a192..0581209 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -7,5 +7,6 @@ DPDK_17.02 {
 	global:
 
 	rte_pmd_i40e_ping_vfs;
+	rte_pmd_i40e_set_vf_mac_anti_spoof;
 
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v5 04/29] net/i40e: set VF VLAN anti-spoofing from PF
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (2 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 03/29] net/i40e: set VF MAC anti-spoofing from PF Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 05/29] net/i40e: set Tx loopback " Ferruh Yigit
                       ` (25 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling VF VLAN anti-spoofing from
PF.
User can call the API on PF to enable/disable a specific
VF's VLAN anti-spoofing.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 116 +++++++++++++++++++++++++++++-
 drivers/net/i40e/i40e_ethdev.h            |   1 +
 drivers/net/i40e/rte_pmd_i40e.h           |  19 +++++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 4 files changed, 135 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index c23e6b5..77be98b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4418,6 +4418,7 @@ i40e_vsi_setup(struct i40e_pf *pf,
 	vsi->max_macaddrs = I40E_NUM_MACADDR_MAX;
 	vsi->parent_vsi = uplink_vsi ? uplink_vsi : pf->main_vsi;
 	vsi->user_param = user_param;
+	vsi->vlan_anti_spoof_on = 0;
 	/* Allocate queues */
 	switch (vsi->type) {
 	case I40E_VSI_MAIN  :
@@ -5761,17 +5762,35 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi,
 			 uint16_t vlan_id, bool on)
 {
 	uint32_t vid_idx, vid_bit;
+	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
+	struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0};
+	int ret;
 
 	if (vlan_id > ETH_VLAN_ID_MAX)
 		return;
 
 	vid_idx = I40E_VFTA_IDX(vlan_id);
 	vid_bit = I40E_VFTA_BIT(vlan_id);
+	vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
 
-	if (on)
+	if (on) {
+		if (vsi->vlan_anti_spoof_on) {
+			ret = i40e_aq_add_vlan(hw, vsi->seid,
+					       &vlan_data, 1, NULL);
+			if (ret != I40E_SUCCESS)
+				PMD_DRV_LOG(ERR, "Failed to add vlan filter");
+		}
 		vsi->vfta[vid_idx] |= vid_bit;
-	else
+	} else {
+		if (vsi->vlan_anti_spoof_on) {
+			ret = i40e_aq_remove_vlan(hw, vsi->seid,
+						  &vlan_data, 1, NULL);
+			if (ret != I40E_SUCCESS)
+				PMD_DRV_LOG(ERR,
+					    "Failed to remove vlan filter");
+		}
 		vsi->vfta[vid_idx] &= ~vid_bit;
+	}
 }
 
 /**
@@ -9786,3 +9805,96 @@ rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+static int
+i40e_add_rm_all_vlan_filter(struct i40e_vsi *vsi, uint8_t add)
+{
+	uint32_t j, k;
+	uint16_t vlan_id;
+	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
+	struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0};
+	int ret;
+
+	for (j = 0; j < I40E_VFTA_SIZE; j++) {
+		if (!vsi->vfta[j])
+			continue;
+
+		for (k = 0; k < I40E_UINT32_BIT_SIZE; k++) {
+			if (!(vsi->vfta[j] & (1 << k)))
+				continue;
+
+			vlan_id = j * I40E_UINT32_BIT_SIZE + k;
+			vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
+			if (add)
+				ret = i40e_aq_add_vlan(hw, vsi->seid,
+						       &vlan_data, 1, NULL);
+			else
+				ret = i40e_aq_remove_vlan(hw, vsi->seid,
+							  &vlan_data, 1, NULL);
+			if (ret != I40E_SUCCESS) {
+				PMD_DRV_LOG(ERR,
+					    "Failed to add/rm vlan filter");
+				return ret;
+			}
+		}
+	}
+
+	return I40E_SUCCESS;
+}
+
+int
+rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	struct i40e_hw *hw;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	/* Check if it has been already on or off */
+	if (vsi->vlan_anti_spoof_on == on)
+		return 0; /* already on or off */
+
+	vsi->vlan_anti_spoof_on = on;
+	ret = i40e_add_rm_all_vlan_filter(vsi, on);
+	if (ret)
+		return ret;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SECURITY_VALID);
+	if (on)
+		vsi->info.sec_flags |= I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK;
+	else
+		vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 298cef4..0db140b 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -300,6 +300,7 @@ struct i40e_vsi {
 	uint16_t msix_intr; /* The MSIX interrupt binds to VSI */
 	uint16_t nb_msix;   /* The max number of msix vector */
 	uint8_t enabled_tc; /* The traffic class enabled */
+	uint8_t vlan_anti_spoof_on; /* The VLAN anti-spoofing enabled */
 	struct i40e_bw_info bw_info; /* VSI bandwidth information */
 };
 
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 52319cf..c8736c8 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -95,4 +95,23 @@ int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
 				       uint16_t vf_id,
 				       uint8_t on);
 
+/**
+ * Enable/Disable VF VLAN anti spoofing.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set VLAN anti spoofing.
+ * @param on
+ *    1 - Enable VFs VLAN anti spoofing.
+ *    0 - Disable VFs VLAN anti spoofing.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
+					uint16_t vf_id,
+					uint8_t on);
+
 #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 0581209..028f0ef 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -8,5 +8,6 @@ DPDK_17.02 {
 
 	rte_pmd_i40e_ping_vfs;
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
+	rte_pmd_i40e_set_vf_vlan_anti_spoof;
 
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v5 05/29] net/i40e: set Tx loopback from PF
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (3 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 04/29] net/i40e: set VF VLAN " Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 06/29] net/i40e: set VF unicast promisc mode " Ferruh Yigit
                       ` (24 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling TX loopback from PF.
User can call the API on PF to enable/disable TX loopback
for all the PF and VFs.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 219 ++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           |  16 +++
 drivers/net/i40e/rte_pmd_i40e_version.map |   1 +
 3 files changed, 236 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 77be98b..89f5784 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9898,3 +9898,222 @@ rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+static int
+i40e_vsi_rm_mac_filter(struct i40e_vsi *vsi)
+{
+	struct i40e_mac_filter *f;
+	struct i40e_macvlan_filter *mv_f;
+	int i, vlan_num;
+	enum rte_mac_filter_type filter_type;
+	int ret = I40E_SUCCESS;
+
+	/* remove all the MACs */
+	TAILQ_FOREACH(f, &vsi->mac_list, next) {
+		vlan_num = vsi->vlan_num;
+		filter_type = f->mac_info.filter_type;
+		if (filter_type == RTE_MACVLAN_PERFECT_MATCH ||
+		    filter_type == RTE_MACVLAN_HASH_MATCH) {
+			if (vlan_num == 0) {
+				PMD_DRV_LOG(ERR,
+					    "VLAN number shouldn't be 0\n");
+				return I40E_ERR_PARAM;
+			}
+		} else if (filter_type == RTE_MAC_PERFECT_MATCH ||
+			   filter_type == RTE_MAC_HASH_MATCH)
+			vlan_num = 1;
+
+		mv_f = rte_zmalloc("macvlan_data", vlan_num * sizeof(*mv_f), 0);
+		if (!mv_f) {
+			PMD_DRV_LOG(ERR, "failed to allocate memory");
+			return I40E_ERR_NO_MEMORY;
+		}
+
+		for (i = 0; i < vlan_num; i++) {
+			mv_f[i].filter_type = filter_type;
+			(void)rte_memcpy(&mv_f[i].macaddr,
+					 &f->mac_info.mac_addr,
+					 ETH_ADDR_LEN);
+		}
+		if (filter_type == RTE_MACVLAN_PERFECT_MATCH ||
+		    filter_type == RTE_MACVLAN_HASH_MATCH) {
+			ret = i40e_find_all_vlan_for_mac(vsi, mv_f, vlan_num,
+							 &f->mac_info.mac_addr);
+			if (ret != I40E_SUCCESS) {
+				rte_free(mv_f);
+				return ret;
+			}
+		}
+
+		ret = i40e_remove_macvlan_filters(vsi, mv_f, vlan_num);
+		if (ret != I40E_SUCCESS) {
+			rte_free(mv_f);
+			return ret;
+		}
+
+		rte_free(mv_f);
+		ret = I40E_SUCCESS;
+	}
+
+	return ret;
+}
+
+static int
+i40e_vsi_restore_mac_filter(struct i40e_vsi *vsi)
+{
+	struct i40e_mac_filter *f;
+	struct i40e_macvlan_filter *mv_f;
+	int i, vlan_num = 0;
+	int ret = I40E_SUCCESS;
+
+	/* restore all the MACs */
+	TAILQ_FOREACH(f, &vsi->mac_list, next) {
+		if ((f->mac_info.filter_type == RTE_MACVLAN_PERFECT_MATCH) ||
+		    (f->mac_info.filter_type == RTE_MACVLAN_HASH_MATCH)) {
+			/**
+			 * If vlan_num is 0, that's the first time to add mac,
+			 * set mask for vlan_id 0.
+			 */
+			if (vsi->vlan_num == 0) {
+				i40e_set_vlan_filter(vsi, 0, 1);
+				vsi->vlan_num = 1;
+			}
+			vlan_num = vsi->vlan_num;
+		} else if ((f->mac_info.filter_type == RTE_MAC_PERFECT_MATCH) ||
+			   (f->mac_info.filter_type == RTE_MAC_HASH_MATCH))
+			vlan_num = 1;
+
+		mv_f = rte_zmalloc("macvlan_data", vlan_num * sizeof(*mv_f), 0);
+		if (!mv_f) {
+			PMD_DRV_LOG(ERR, "failed to allocate memory");
+			return I40E_ERR_NO_MEMORY;
+		}
+
+		for (i = 0; i < vlan_num; i++) {
+			mv_f[i].filter_type = f->mac_info.filter_type;
+			(void)rte_memcpy(&mv_f[i].macaddr,
+					 &f->mac_info.mac_addr,
+					 ETH_ADDR_LEN);
+		}
+
+		if (f->mac_info.filter_type == RTE_MACVLAN_PERFECT_MATCH ||
+		    f->mac_info.filter_type == RTE_MACVLAN_HASH_MATCH) {
+			ret = i40e_find_all_vlan_for_mac(vsi, mv_f, vlan_num,
+							 &f->mac_info.mac_addr);
+			if (ret != I40E_SUCCESS) {
+				rte_free(mv_f);
+				return ret;
+			}
+		}
+
+		ret = i40e_add_macvlan_filters(vsi, mv_f, vlan_num);
+		if (ret != I40E_SUCCESS) {
+			rte_free(mv_f);
+			return ret;
+		}
+
+		rte_free(mv_f);
+		ret = I40E_SUCCESS;
+	}
+
+	return ret;
+}
+
+static int
+i40e_vsi_set_tx_loopback(struct i40e_vsi *vsi, uint8_t on)
+{
+	struct i40e_vsi_context ctxt;
+	struct i40e_hw *hw;
+	int ret;
+
+	hw = I40E_VSI_TO_HW(vsi);
+
+	/* Use the FW API if FW >= v5.0 */
+	if (hw->aq.fw_maj_ver < 5) {
+		PMD_INIT_LOG(ERR, "FW < v5.0, cannot enable loopback");
+		return -ENOTSUP;
+	}
+
+	/* Check if it has been already on or off */
+	if (vsi->info.valid_sections &
+		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID)) {
+		if (on) {
+			if ((vsi->info.switch_id &
+			     I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB) ==
+			    I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB)
+				return 0; /* already on */
+		} else {
+			if ((vsi->info.switch_id &
+			     I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB) == 0)
+				return 0; /* already off */
+		}
+	}
+
+	/* remove all the MACs first */
+	ret = i40e_vsi_rm_mac_filter(vsi);
+	if (ret)
+		return ret;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);
+	if (on)
+		vsi->info.switch_id |= I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB;
+	else
+		vsi->info.switch_id &= ~I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+		return ret;
+	}
+
+	/* add all the MACs back */
+	ret = i40e_vsi_restore_mac_filter(vsi);
+	if (ret)
+		return ret;
+
+	return ret;
+}
+
+int
+rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	uint16_t vf_id;
+	int ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	/* setup PF TX loopback */
+	vsi = pf->main_vsi;
+	ret = i40e_vsi_set_tx_loopback(vsi, on);
+	if (ret)
+		return ret;
+
+	/* setup TX loopback for all the VFs */
+	if (!pf->vfs) {
+		PMD_DRV_LOG(ERR, "Invalid argument.");
+		return -EINVAL;
+	}
+
+	for (vf_id = 0; vf_id < pf->vf_num; vf_id++) {
+		vf = &pf->vfs[vf_id];
+		vsi = vf->vsi;
+
+		ret = i40e_vsi_set_tx_loopback(vsi, on);
+		if (ret)
+			return ret;
+	}
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index c8736c8..3c65be4 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -114,4 +114,20 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
 					uint16_t vf_id,
 					uint8_t on);
 
+/**
+ * Enable/Disable TX loopback on all the PF and VFs.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param on
+ *    1 - Enable TX loopback.
+ *    0 - Disable TX loopback.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_tx_loopback(uint8_t port,
+				 uint8_t on);
+
 #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 028f0ef..51eda65 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -7,6 +7,7 @@ DPDK_17.02 {
 	global:
 
 	rte_pmd_i40e_ping_vfs;
+	rte_pmd_i40e_set_tx_loopback;
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
 
-- 
2.9.3

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

* [PATCH v5 06/29] net/i40e: set VF unicast promisc mode from PF
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (4 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 05/29] net/i40e: set Tx loopback " Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 07/29] net/i40e: set VF multicast " Ferruh Yigit
                       ` (23 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling VF unicast promiscuous mode from
PF.
User can call the API on PF to enable/disable a specific
VF's unicast promiscuous mode.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 36 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 56 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 89f5784..ffb69a1 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10117,3 +10117,39 @@ rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	hw = I40E_VSI_TO_HW(vf->vsi);
+
+	ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vf->vsi->seid,
+						  on, NULL, true);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set unicast promiscuous mode");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 3c65be4..4c98136 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -130,4 +130,23 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
 int rte_pmd_i40e_set_tx_loopback(uint8_t port,
 				 uint8_t on);
 
+/**
+ * Enable/Disable VF unicast promiscuous mode.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set.
+ * @param on
+ *    1 - Enable.
+ *    0 - Disable.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
+					uint16_t vf_id,
+					uint8_t on);
+
 #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 51eda65..35757a9 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -9,6 +9,7 @@ DPDK_17.02 {
 	rte_pmd_i40e_ping_vfs;
 	rte_pmd_i40e_set_tx_loopback;
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
+	rte_pmd_i40e_set_vf_unicast_promisc;
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
 
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v5 07/29] net/i40e: set VF multicast promisc mode from PF
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (5 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 06/29] net/i40e: set VF unicast promisc mode " Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 08/29] net/i40e: enable VF MTU change Ferruh Yigit
                       ` (22 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling VF multicast promiscuous mode from
PF.
User can call the API on PF to enable/disable a specific
VF's multicast promiscuous mode.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 36 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 56 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ffb69a1..e2214bd 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10153,3 +10153,39 @@ rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	int ret;
+
+	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;
+	}
+
+	vf = &pf->vfs[vf_id];
+	hw = I40E_VSI_TO_HW(vf->vsi);
+
+	ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vf->vsi->seid,
+						    on, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set multicast promiscuous mode");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 4c98136..9091520 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -149,4 +149,23 @@ int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
 					uint16_t vf_id,
 					uint8_t on);
 
+/**
+ * Enable/Disable VF multicast promiscuous mode.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    VF on which to set.
+ * @param on
+ *    1 - Enable.
+ *    0 - Disable.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
+					  uint16_t vf_id,
+					  uint8_t on);
+
 #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 35757a9..32939b2 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -9,6 +9,7 @@ DPDK_17.02 {
 	rte_pmd_i40e_ping_vfs;
 	rte_pmd_i40e_set_tx_loopback;
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
+	rte_pmd_i40e_set_vf_multicast_promisc;
 	rte_pmd_i40e_set_vf_unicast_promisc;
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
 
-- 
2.9.3

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

* [PATCH v5 08/29] net/i40e: enable VF MTU change
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (6 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 07/29] net/i40e: set VF multicast " Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 09/29] net/i40e: fix VF reset flow Ferruh Yigit
                       ` (21 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

This patch implement mtu_set ops for i40e VF.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 12da0ec..bce01d0 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -151,6 +151,7 @@ static int i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,
 				      struct rte_eth_rss_conf *rss_conf);
 static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 					struct rte_eth_rss_conf *rss_conf);
+static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 static int
 i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -225,6 +226,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = {
 	.reta_query           = i40evf_dev_rss_reta_query,
 	.rss_hash_update      = i40evf_dev_rss_hash_update,
 	.rss_hash_conf_get    = i40evf_dev_rss_hash_conf_get,
+	.mtu_set              = i40evf_dev_mtu_set,
 };
 
 /*
@@ -2641,3 +2643,34 @@ i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 
 	return 0;
 }
+
+static int
+i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+	struct rte_eth_dev_data *dev_data = vf->dev_data;
+	uint32_t frame_size = mtu + ETHER_HDR_LEN
+			      + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE;
+	int ret = 0;
+
+	/* check if mtu is within the allowed range */
+	if ((mtu < ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX))
+		return -EINVAL;
+
+	/* mtu setting is forbidden if port is start */
+	if (dev_data->dev_started) {
+		PMD_DRV_LOG(ERR,
+			    "port %d must be stopped before configuration\n",
+			    dev_data->port_id);
+		return -EBUSY;
+	}
+
+	if (frame_size > ETHER_MAX_LEN)
+		dev_data->dev_conf.rxmode.jumbo_frame = 1;
+	else
+		dev_data->dev_conf.rxmode.jumbo_frame = 0;
+
+	dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
+
+	return ret;
+}
-- 
2.9.3

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

* [PATCH v5 09/29] net/i40e: fix VF reset flow
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (7 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 08/29] net/i40e: enable VF MTU change Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 10/29] net/i40e: set VF MAC from PF support Ferruh Yigit
                       ` (20 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Add missing step during VF reset: PF should
set I40E_VFGEN_RSTAT to ACTIVE at end of the
VF reset operation or VF driver may not able
to detect that reset is already completed.
This patch also remove the unnecessary enum
for vfr state.

Fixes: 4861cde46116 ("i40e: new poll mode driver")

CC: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/i40e/i40e_pf.c | 6 ++++--
 drivers/net/i40e/i40e_pf.h | 5 -----
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 8b8a14f..2bc3355 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -139,7 +139,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)
 	abs_vf_id = vf_id + hw->func_caps.vf_base_id;
 
 	/* Notify VF that we are in VFR progress */
-	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_PF_VFR_INPROGRESS);
+	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_VFR_INPROGRESS);
 
 	/*
 	 * If require a SW VF reset, a VFLR interrupt will be generated,
@@ -220,7 +220,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)
 	}
 
 	/* Reset done, Set COMPLETE flag and clear reset bit */
-	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_PF_VFR_COMPLETED);
+	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_VFR_COMPLETED);
 	val = I40E_READ_REG(hw, I40E_VPGEN_VFRTRIG(vf_id));
 	val &= ~I40E_VPGEN_VFRTRIG_VFSWR_MASK;
 	I40E_WRITE_REG(hw, I40E_VPGEN_VFRTRIG(vf_id), val);
@@ -248,6 +248,8 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)
 		return -EFAULT;
 	}
 
+	I40E_WRITE_REG(hw, I40E_VFGEN_RSTAT1(vf_id), I40E_VFR_VFACTIVE);
+
 	return ret;
 }
 
diff --git a/drivers/net/i40e/i40e_pf.h b/drivers/net/i40e/i40e_pf.h
index 59bf2ee..ada398b 100644
--- a/drivers/net/i40e/i40e_pf.h
+++ b/drivers/net/i40e/i40e_pf.h
@@ -48,11 +48,6 @@
 
 #define I40E_DPDK_OFFSET  0x100
 
-enum i40e_pf_vfr_state {
-	I40E_PF_VFR_INPROGRESS = 0,
-	I40E_PF_VFR_COMPLETED = 1,
-};
-
 /* DPDK pf driver specific command to VF */
 enum i40e_virtchnl_ops_dpdk {
 	/*
-- 
2.9.3

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

* [PATCH v5 10/29] net/i40e: set VF MAC from PF support
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (8 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 09/29] net/i40e: fix VF reset flow Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 11/29] net/i40e: set VF MAC from VF support Ferruh Yigit
                       ` (19 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

Support setting VF MAC address from PF.
User can call the API on PF to set a specific
VF's MAC address.

This will remove all existing MAC filters.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 40 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 +++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 60 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index e2214bd..e9bd95b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10189,3 +10189,43 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+int
+rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+			     struct ether_addr *mac_addr)
+{
+	struct rte_eth_dev_info dev_info;
+	struct i40e_mac_filter *f;
+	struct rte_eth_dev *dev;
+	struct i40e_pf_vf *vf;
+	struct i40e_vsi *vsi;
+	struct i40e_pf *pf;
+	void *temp;
+
+	if (i40e_validate_mac_addr((u8 *)mac_addr) != I40E_SUCCESS)
+		return -EINVAL;
+
+	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)
+		return -EINVAL;
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	ether_addr_copy(mac_addr, &vf->mac_addr);
+
+	/* Remove all existing mac */
+	TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp)
+		i40e_vsi_delete_mac(vsi, &f->mac_info.mac_addr);
+
+	return 0;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 9091520..faacbb9 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -168,4 +168,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
 					  uint16_t vf_id,
 					  uint8_t on);
 
+/**
+ * Set the VF MAC address.
+ *
+ * This will remove all existing MAC filters.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param vf_id
+ *   VF id.
+ * @param mac_addr
+ *   VF MAC address.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
+ */
+int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+				 struct ether_addr *mac_addr);
+
 #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 32939b2..2d53b87 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -8,6 +8,7 @@ DPDK_17.02 {
 
 	rte_pmd_i40e_ping_vfs;
 	rte_pmd_i40e_set_tx_loopback;
+	rte_pmd_i40e_set_vf_mac_addr;
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
 	rte_pmd_i40e_set_vf_multicast_promisc;
 	rte_pmd_i40e_set_vf_unicast_promisc;
-- 
2.9.3

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

* [PATCH v5 11/29] net/i40e: set VF MAC from VF support
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (9 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 10/29] net/i40e: set VF MAC from PF support Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 12/29] net/i40e: fix VF MAC address assignment Ferruh Yigit
                       ` (18 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

Support changing VF default MAC address.
This function is not supported if PF set the MAC
address for the PF.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/i40e/i40e_ethdev.h    |  4 +++-
 drivers/net/i40e/i40e_ethdev_vf.c | 49 +++++++++++++++++++++++++++++++++------
 2 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 0db140b..b687b0c 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -126,6 +126,7 @@ enum i40e_flxpld_layer_idx {
 #define I40E_FLAG_FDIR                  (1ULL << 6)
 #define I40E_FLAG_VXLAN                 (1ULL << 7)
 #define I40E_FLAG_RSS_AQ_CAPABLE        (1ULL << 8)
+#define I40E_FLAG_VF_MAC_BY_PF          (1ULL << 9)
 #define I40E_FLAG_ALL (I40E_FLAG_RSS | \
 		       I40E_FLAG_DCB | \
 		       I40E_FLAG_VMDQ | \
@@ -134,7 +135,8 @@ enum i40e_flxpld_layer_idx {
 		       I40E_FLAG_HEADER_SPLIT_ENABLED | \
 		       I40E_FLAG_FDIR | \
 		       I40E_FLAG_VXLAN | \
-		       I40E_FLAG_RSS_AQ_CAPABLE)
+		       I40E_FLAG_RSS_AQ_CAPABLE | \
+		       I40E_FLAG_VF_MAC_BY_PF)
 
 #define I40E_RSS_OFFLOAD_ALL ( \
 	ETH_RSS_FRAG_IPV4 | \
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index bce01d0..5016249 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -152,6 +152,8 @@ static int i40evf_dev_rss_hash_update(struct rte_eth_dev *dev,
 static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 					struct rte_eth_rss_conf *rss_conf);
 static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
+static void i40evf_set_default_mac_addr(struct rte_eth_dev *dev,
+					struct ether_addr *mac_addr);
 static int
 i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -227,6 +229,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = {
 	.rss_hash_update      = i40evf_dev_rss_hash_update,
 	.rss_hash_conf_get    = i40evf_dev_rss_hash_conf_get,
 	.mtu_set              = i40evf_dev_mtu_set,
+	.mac_addr_set         = i40evf_set_default_mac_addr,
 };
 
 /*
@@ -888,19 +891,16 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
 }
 
 static void
-i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
+i40evf_del_mac_addr_by_addr(struct rte_eth_dev *dev,
+			    struct ether_addr *addr)
 {
 	struct i40e_virtchnl_ether_addr_list *list;
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-	struct rte_eth_dev_data *data = dev->data;
-	struct ether_addr *addr;
 	uint8_t cmd_buffer[sizeof(struct i40e_virtchnl_ether_addr_list) + \
 			sizeof(struct i40e_virtchnl_ether_addr)];
 	int err;
 	struct vf_cmd_info args;
 
-	addr = &(data->mac_addrs[index]);
-
 	if (i40e_validate_mac_addr(addr->addr_bytes) != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Invalid mac:%x-%x-%x-%x-%x-%x",
 			    addr->addr_bytes[0], addr->addr_bytes[1],
@@ -927,6 +927,17 @@ i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
 	return;
 }
 
+static void
+i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index)
+{
+	struct rte_eth_dev_data *data = dev->data;
+	struct ether_addr *addr;
+
+	addr = &data->mac_addrs[index];
+
+	i40evf_del_mac_addr_by_addr(dev, addr);
+}
+
 static int
 i40evf_update_stats(struct rte_eth_dev *dev, struct i40e_eth_stats **pstats)
 {
@@ -1260,10 +1271,12 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 
 	/* Store the MAC address configured by host, or generate random one */
 	p_mac_addr = (struct ether_addr *)(vf->vsi_res->default_mac_addr);
-	if (is_valid_assigned_ether_addr(p_mac_addr)) /* Configured by host */
+	if (is_valid_assigned_ether_addr(p_mac_addr)) { /* Configured by host */
 		ether_addr_copy(p_mac_addr, (struct ether_addr *)hw->mac.addr);
-	else
+		vf->flags |= I40E_FLAG_VF_MAC_BY_PF;
+	} else {
 		eth_random_addr(hw->mac.addr); /* Generate a random one */
+	}
 
 	/* If the PF host is not DPDK, set the interval of ITR0 to max*/
 	if (vf->version_major != I40E_DPDK_VERSION_MAJOR) {
@@ -2674,3 +2687,25 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 
 	return ret;
 }
+
+static void
+i40evf_set_default_mac_addr(struct rte_eth_dev *dev,
+			    struct ether_addr *mac_addr)
+{
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+
+	if (!is_valid_assigned_ether_addr(mac_addr)) {
+		PMD_DRV_LOG(ERR, "Tried to set invalid MAC address.");
+		return;
+	}
+
+	if (is_same_ether_addr(mac_addr, dev->data->mac_addrs))
+		return;
+
+	if (vf->flags & I40E_FLAG_VF_MAC_BY_PF)
+		return;
+
+	i40evf_del_mac_addr_by_addr(dev, dev->data->mac_addrs);
+
+	i40evf_add_mac_addr(dev, mac_addr, 0, 0);
+}
-- 
2.9.3

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

* [PATCH v5 12/29] net/i40e: fix VF MAC address assignment
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (10 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 11/29] net/i40e: set VF MAC from VF support Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 13/29] net/i40e: add VF VLAN strip func Ferruh Yigit
                       ` (17 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

If PF sets vf->mac_addr, in VF initialization hw->mac.addr will be set
to that same value. It is possible to check if PF set a MAC address or
not through the hw->mac.addr variable.

hw->mac.addr set by i40e_vf_parse_hw_config(), call stack is:

In PF side
i40e_pf_host_process_cmd_get_vf_resources()
    eth_addr_copy(vf->mac_addr, vf_res->vsi_res[0].default_mac_address)

In VF sise
i40evf_init_vf()
    i40evf_get_vf_resources()
            i40e_vf_parse_hw_config()
                    memcpy(hw->mac.addr, vsi_res->default_mac_addr)

Updated code is after i40evf_get_vf_resources() and can benefit from
hw->mac.addr variable.

Fixes: 89e6b86384bb ("i40evf: rework MAC address validation")

CC: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 5016249..0977095 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1193,7 +1193,6 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 	int i, err, bufsz;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-	struct ether_addr *p_mac_addr;
 	uint16_t interval =
 		i40e_calc_itr_interval(I40E_QUEUE_ITR_INTERVAL_MAX);
 
@@ -1270,13 +1269,10 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 	vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
 	/* Store the MAC address configured by host, or generate random one */
-	p_mac_addr = (struct ether_addr *)(vf->vsi_res->default_mac_addr);
-	if (is_valid_assigned_ether_addr(p_mac_addr)) { /* Configured by host */
-		ether_addr_copy(p_mac_addr, (struct ether_addr *)hw->mac.addr);
+	if (is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr))
 		vf->flags |= I40E_FLAG_VF_MAC_BY_PF;
-	} else {
+	else
 		eth_random_addr(hw->mac.addr); /* Generate a random one */
-	}
 
 	/* If the PF host is not DPDK, set the interval of ITR0 to max*/
 	if (vf->version_major != I40E_DPDK_VERSION_MAJOR) {
-- 
2.9.3

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

* [PATCH v5 13/29] net/i40e: add VF VLAN strip func
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (11 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 12/29] net/i40e: fix VF MAC address assignment Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 14/29] net/i40e: add set VF VLAN insert function Ferruh Yigit
                       ` (16 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Add a function to configure vlan strip enable/disable for specific
SRIOV VF device.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 26 ++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 +++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 46 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index e9bd95b..ae8d678 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10229,3 +10229,29 @@ rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
 
 	return 0;
 }
+
+/* Set vlan strip on/off for specific VF from host */
+int
+rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct i40e_pf *pf;
+	struct i40e_vsi *vsi;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	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;
+
+	if (vsi)
+		return i40e_vsi_config_vlan_stripping(vsi, !!on);
+	else
+		return -EINVAL;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index faacbb9..cea1192 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -187,4 +187,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
 int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
+/**
+ * Enable/Disable vf vlan strip for all queues in a pool
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param on
+ *    1 - Enable VF's vlan strip on RX queues.
+ *    0 - Disable VF's vlan strip on RX queues.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int
+rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+
 #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 2d53b87..d4e7acd 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -13,5 +13,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_multicast_promisc;
 	rte_pmd_i40e_set_vf_unicast_promisc;
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
+	rte_pmd_i40e_set_vf_vlan_stripq;
 
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v5 14/29] net/i40e: add set VF VLAN insert function
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (12 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 13/29] net/i40e: add VF VLAN strip func Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 15/29] net/i40e: set VF broadcast mode from PF Ferruh Yigit
                       ` (15 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support inserting VF VLAN id from PF.
User can call the API on PF to insert a VLAN id to a
specific VF.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 53 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 +++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 73 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ae8d678..41663a2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10255,3 +10255,56 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on)
 	else
 		return -EINVAL;
 }
+
+int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
+				    uint16_t vlan_id)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	struct i40e_vsi *vsi;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	hw = I40E_PF_TO_HW(pf);
+
+	/**
+	 * return -ENODEV if SRIOV not enabled, VF number not configured
+	 * or no queue assigned.
+	 */
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 ||
+	    pf->vf_nb_qps == 0)
+		return -ENODEV;
+
+	if (vf_id >= pf->vf_num || !pf->vfs)
+		return -EINVAL;
+
+	if (vlan_id > ETHER_MAX_VLAN_ID)
+		return -EINVAL;
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+	vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID;
+	vsi->info.pvid = vlan_id;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index cea1192..0c364f8 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -206,4 +206,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
 int
 rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
 
+/**
+ * Enable/Disable vf vlan insert
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param vlan_id
+ *    0 - Disable VF's vlan insert.
+ *    n - Enable; n is inserted as the vlan id.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
+				    uint16_t vlan_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 d4e7acd..d851f6c 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -13,6 +13,7 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_multicast_promisc;
 	rte_pmd_i40e_set_vf_unicast_promisc;
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
+	rte_pmd_i40e_set_vf_vlan_insert;
 	rte_pmd_i40e_set_vf_vlan_stripq;
 
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v5 15/29] net/i40e: set VF broadcast mode from PF
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (13 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 14/29] net/i40e: add set VF VLAN insert function Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 16/29] net/i40e: set VF VLAN tag " Ferruh Yigit
                       ` (14 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Support enabling/disabling VF broadcast mode from PF.
User can call the API on PF to enable/disable a specific
VF's broadcast mode.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 43 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 19 ++++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 63 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 41663a2..a8361df 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10308,3 +10308,46 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
 
 	return ret;
 }
+
+int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
+					uint8_t on) {
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	int ret;
+
+	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;
+
+	if (on > 1)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	hw = I40E_PF_TO_HW(pf);
+
+	if (vf_id >= pf->vf_num || !pf->vfs)
+		return -EINVAL;
+
+	/**
+	 * return -ENODEV if SRIOV not enabled, VF number not configured
+	 * or no queue assigned.
+	 */
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+		return -ENODEV;
+
+	vf = &pf->vfs[vf_id];
+	hw = I40E_VSI_TO_HW(vf->vsi);
+
+	ret = i40e_aq_set_vsi_broadcast(hw, vf->vsi->seid, on, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set VSI broadcast");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 0c364f8..02f7109 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -225,4 +225,23 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
 int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
 				    uint16_t vlan_id);
 
+/**
+ * Enable/Disable vf broadcast mode
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param on
+ *    0 - Disable broadcast.
+ *    1 - Enable broadcast.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
+					uint8_t on);
+
 #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 d851f6c..6a3d77b 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -8,6 +8,7 @@ DPDK_17.02 {
 
 	rte_pmd_i40e_ping_vfs;
 	rte_pmd_i40e_set_tx_loopback;
+	rte_pmd_i40e_set_vf_broadcast;
 	rte_pmd_i40e_set_vf_mac_addr;
 	rte_pmd_i40e_set_vf_mac_anti_spoof;
 	rte_pmd_i40e_set_vf_multicast_promisc;
-- 
2.9.3

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

* [PATCH v5 16/29] net/i40e: set VF VLAN tag from PF
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (14 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 15/29] net/i40e: set VF broadcast mode from PF Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 17/29] net/i40e: set VF VLAN filter " Ferruh Yigit
                       ` (13 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

Add rte_pmd_i40e_set_vf_vlan_tag API.
User can call the API on PF to enable/disable a specific
VF's VLAN tag.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 59 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 18 ++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 78 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a8361df..207a62e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10351,3 +10351,62 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
 
 	return ret;
 }
+
+int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	struct i40e_vsi *vsi;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	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;
+
+	if (on > 1)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	hw = I40E_PF_TO_HW(pf);
+
+	/**
+	 * return -ENODEV if SRIOV not enabled, VF number not configured
+	 * or no queue assigned.
+	 */
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+		return -ENODEV;
+
+	if (vf_id >= pf->vf_num)
+		return -EINVAL;
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+	if (on) {
+		vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_TAGGED;
+		vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
+	} else {
+		vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
+		vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_TAGGED;
+	}
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 02f7109..b9bf8d1 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -244,4 +244,22 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
 int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
 					uint8_t on);
 
+/**
+ * Enable/Disable vf vlan tag
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param vlan_id
+ *    0 - Disable VF's vlan tag.
+ *    n - Enable VF's vlan tag.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
+
 #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 6a3d77b..f0632ff 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -16,5 +16,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
 	rte_pmd_i40e_set_vf_vlan_insert;
 	rte_pmd_i40e_set_vf_vlan_stripq;
+	rte_pmd_i40e_set_vf_vlan_tag;
 
 } DPDK_2.0;
-- 
2.9.3

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

* [PATCH v5 17/29] net/i40e: set VF VLAN filter from PF
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (15 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 16/29] net/i40e: set VF VLAN tag " Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e Ferruh Yigit
                       ` (12 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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

add rte_pmd_i40e_set_vf_vlan_filter API.
User can call the API on PF to enable/disable
a set of VF's VLAN filters.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 52 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 22 +++++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 75 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 207a62e..5ee010e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10410,3 +10410,55 @@ int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on)
 
 	return ret;
 }
+
+int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
+				    uint64_t vf_mask, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	uint16_t pool_idx;
+	int ret = I40E_SUCCESS;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (vlan_id > ETHER_MAX_VLAN_ID)
+		return -EINVAL;
+
+	if (on > 1)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	if ((pf->flags & I40E_FLAG_VMDQ) == 0) {
+		PMD_INIT_LOG(ERR, "Firmware doesn't support VMDQ");
+		return -ENOTSUP;
+	}
+
+	if (!pf->vmdq) {
+		PMD_INIT_LOG(INFO, "VMDQ not configured");
+		return -ENOTSUP;
+	}
+
+	for (pool_idx = 0;
+	     pool_idx < ETH_64_POOLS &&
+	     pool_idx < pf->nb_cfg_vmdq_vsi &&
+	     ret == I40E_SUCCESS;
+	     pool_idx++) {
+		if (vf_mask & ((uint64_t)(1ULL << pool_idx))) {
+			if (on)
+				ret = i40e_vsi_add_vlan(pf->vmdq[pool_idx].vsi,
+							vlan_id);
+			else
+				ret = i40e_vsi_delete_vlan(
+					pf->vmdq[pool_idx].vsi, vlan_id);
+		}
+	}
+
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set VF VLAN filter, on = %d", on);
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index b9bf8d1..96cda89 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -262,4 +262,26 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
  */
 int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
 
+/**
+ * Enable/Disable VF VLAN filter
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vlan_id
+ *    ID specifying VLAN
+ * @param vf_mask
+ *    Mask to filter VF's
+ * @param on
+ *    0 - Disable VF's VLAN filter.
+ *    1 - Enable VF's VLAN filter.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ *   - (-ENOTSUP) VMDq not configured of not supported by firmware.
+ */
+int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
+				    uint64_t vf_mask, uint8_t on);
+
 #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 f0632ff..8ac1bc8 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -14,6 +14,7 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_multicast_promisc;
 	rte_pmd_i40e_set_vf_unicast_promisc;
 	rte_pmd_i40e_set_vf_vlan_anti_spoof;
+	rte_pmd_i40e_set_vf_vlan_filter;
 	rte_pmd_i40e_set_vf_vlan_insert;
 	rte_pmd_i40e_set_vf_vlan_stripq;
 	rte_pmd_i40e_set_vf_vlan_tag;
-- 
2.9.3

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

* [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (16 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 17/29] net/i40e: set VF VLAN filter " Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 20:30       ` Vincent JARDIN
  2016-12-19 17:09       ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 19/29] app/testpmd: use unicast promiscuous mode " Ferruh Yigit
                       ` (11 subsequent siblings)
  29 siblings, 2 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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 | 150 +++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 121 insertions(+), 31 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..3e8f29c 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -90,6 +90,9 @@
 #ifdef RTE_LIBRTE_IXGBE_PMD
 #include <rte_pmd_ixgbe.h>
 #endif
+#ifdef RTE_LIBRTE_I40E_PMD
+#include <rte_pmd_i40e.h>
+#endif
 #include "testpmd.h"
 
 static struct cmdline *testpmd_cl;
@@ -262,19 +265,19 @@ 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"
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
 			"set all queues drop (port_id) (on|off)\n"
 			"    Set drop enable bit for all queues.\n\n"
 
 			"set vf split drop (port_id) (vf_id) (on|off)\n"
 			"    Set split drop enable bit for a VF from the PF.\n\n"
+#endif
 
 			"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 +285,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 +293,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 +387,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)"
@@ -6675,9 +6674,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;
@@ -10808,7 +10805,6 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
 		NULL,
 	},
 };
-#ifdef RTE_LIBRTE_IXGBE_PMD
 
 /* vf vlan anti spoof configuration */
 
@@ -10860,11 +10856,23 @@ cmd_set_vf_vlan_anti_spoof_parsed(
 	__attribute__((unused)) void *data)
 {
 	struct cmd_vf_vlan_anti_spoof_result *res = parsed_result;
-	int ret = 0;
-	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	int ret = -ENOTSUP;
+	__rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	struct rte_eth_dev_info dev_info;
+
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	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);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+	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);
+#endif
 
-	ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, res->vf_id,
-			is_on);
 	switch (ret) {
 	case 0:
 		break;
@@ -10874,6 +10882,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));
 	}
@@ -10945,11 +10956,23 @@ cmd_set_vf_mac_anti_spoof_parsed(
 	__attribute__((unused)) void *data)
 {
 	struct cmd_vf_mac_anti_spoof_result *res = parsed_result;
-	int ret;
-	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	int ret = -ENOTSUP;
+	__rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	struct rte_eth_dev_info dev_info;
+
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	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);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+	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);
+#endif
 
-	ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id, res->vf_id,
-			is_on);
 	switch (ret) {
 	case 0:
 		break;
@@ -10959,6 +10982,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));
 	}
@@ -11030,10 +11056,23 @@ cmd_set_vf_vlan_stripq_parsed(
 	__attribute__((unused)) void *data)
 {
 	struct cmd_vf_vlan_stripq_result *res = parsed_result;
-	int ret = 0;
-	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	int ret = -ENOTSUP;
+	__rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	struct rte_eth_dev_info dev_info;
+
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
+		ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id,
+			res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+	if (strstr(dev_info.driver_name, "i40e") != NULL)
+		ret = rte_pmd_i40e_set_vf_vlan_stripq(res->port_id,
+			res->vf_id, is_on);
+#endif
 
-	ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id, res->vf_id, is_on);
 	switch (ret) {
 	case 0:
 		break;
@@ -11114,9 +11153,22 @@ cmd_set_vf_vlan_insert_parsed(
 	__attribute__((unused)) void *data)
 {
 	struct cmd_vf_vlan_insert_result *res = parsed_result;
-	int ret;
+	int ret = -ENOTSUP;
+	struct rte_eth_dev_info dev_info;
+
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	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);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+	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);
+#endif
 
-	ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, res->vlan_id);
 	switch (ret) {
 	case 0:
 		break;
@@ -11126,6 +11178,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));
 	}
@@ -11187,10 +11242,21 @@ cmd_set_tx_loopback_parsed(
 	__attribute__((unused)) void *data)
 {
 	struct cmd_tx_loopback_result *res = parsed_result;
-	int ret;
-	int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	int ret = -ENOTSUP;
+	__rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+	struct rte_eth_dev_info dev_info;
+
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
+		ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+	if (strstr(dev_info.driver_name, "i40e") != NULL)
+		ret = rte_pmd_i40e_set_tx_loopback(res->port_id, is_on);
+#endif
 
-	ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
 	switch (ret) {
 	case 0:
 		break;
@@ -11200,6 +11266,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));
 	}
@@ -11219,6 +11288,7 @@ cmdline_parse_inst_t cmd_set_tx_loopback = {
 	},
 };
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
 /* all queues drop enable configuration */
 
 /* Common result structure for all queues drop enable */
@@ -11277,6 +11347,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));
 	}
@@ -11381,6 +11454,7 @@ cmdline_parse_inst_t cmd_set_vf_split_drop_en = {
 		NULL,
 	},
 };
+#endif
 
 /* vf mac address configuration */
 
@@ -11432,10 +11506,22 @@ cmd_set_vf_mac_addr_parsed(
 	__attribute__((unused)) void *data)
 {
 	struct cmd_set_vf_mac_addr_result *res = parsed_result;
-	int ret;
+	struct rte_eth_dev_info dev_info;
+	int ret = -ENOTSUP;
+
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	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);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+	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);
+#endif
 
-	ret = rte_pmd_ixgbe_set_vf_mac_addr(res->port_id, res->vf_id,
-			&res->mac_addr);
 	switch (ret) {
 	case 0:
 		break;
@@ -11445,6 +11531,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 +11554,6 @@ cmdline_parse_inst_t cmd_set_vf_mac_addr = {
 		NULL,
 	},
 };
-#endif
 
 /* ******************************************************************************** */
 
@@ -11619,20 +11707,20 @@ 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,
 	(cmdline_parse_inst_t *)&cmd_set_vf_vlan_insert,
 	(cmdline_parse_inst_t *)&cmd_set_tx_loopback,
+#ifdef RTE_LIBRTE_IXGBE_PMD
 	(cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en,
 	(cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en,
-	(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
 	(cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
 	(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
+	(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
 	NULL,
 };
 
-- 
2.9.3

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

* [PATCH v5 19/29] app/testpmd: use unicast promiscuous mode on i40e
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (17 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 20:28       ` Vincent JARDIN
  2016-12-16 19:02     ` [PATCH v5 20/29] app/testpmd: use multicast " Ferruh Yigit
                       ` (10 subsequent siblings)
  29 siblings, 1 reply; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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                      | 92 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  9 +++
 2 files changed, 101 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 3e8f29c..755f5e9 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -400,6 +400,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"
@@ -11555,6 +11558,94 @@ 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 = -ENOTSUP;
+	__rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+	ret = rte_pmd_i40e_set_vf_unicast_promisc(res->port_id,
+			res->vf_id, is_on);
+#endif
+
+	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;
+	case -ENOTSUP:
+		printf("function not implemented\n");
+		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 */
@@ -11721,6 +11812,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
 #endif
 	(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
+	(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	[flat|nested] 125+ messages in thread

* [PATCH v5 20/29] app/testpmd: use multicast promiscuous mode on i40e
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (18 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 19/29] app/testpmd: use unicast promiscuous mode " Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 21/29] app/testpmd: add command to test VF broadcast " Ferruh Yigit
                       ` (9 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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                      | 92 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  9 +++
 2 files changed, 101 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 755f5e9..a9f2d23 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -403,6 +403,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"
@@ -11646,6 +11649,94 @@ 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 = -ENOTSUP;
+	__rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+	ret = rte_pmd_i40e_set_vf_multicast_promisc(res->port_id,
+			res->vf_id, is_on);
+#endif
+
+	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;
+	case -ENOTSUP:
+		printf("function not implemented\n");
+		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 */
@@ -11813,6 +11904,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 #endif
 	(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
 	(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	[flat|nested] 125+ messages in thread

* [PATCH v5 21/29] app/testpmd: add command to test VF broadcast mode on i40e
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (19 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 20/29] app/testpmd: use multicast " Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 22/29] app/testpmd: add command to test VF VLAN tag " Ferruh Yigit
                       ` (8 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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                      | 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 a9f2d23..f431f7e 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -279,6 +279,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"
 
@@ -11737,6 +11740,93 @@ 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 = -ENOTSUP;
+	__rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+	ret = rte_pmd_i40e_set_vf_broadcast(res->port_id, res->vf_id, is_on);
+#endif
+
+	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;
+	case -ENOTSUP:
+		printf("function not implemented\n");
+		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 */
@@ -11905,6 +11995,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
 	(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	[flat|nested] 125+ messages in thread

* [PATCH v5 22/29] app/testpmd: add command to test VF VLAN tag on i40e
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (20 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 21/29] app/testpmd: add command to test VF broadcast " Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 23/29] app/testpmd: handle i40e in VF VLAN filter command Ferruh Yigit
                       ` (7 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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                      | 97 +++++++++++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  7 +++
 2 files changed, 104 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f431f7e..2b17925 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -297,6 +297,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"
 
@@ -11827,6 +11830,99 @@ 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 = -ENOTSUP;
+	__rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+	ret = rte_pmd_i40e_set_vf_vlan_tag(res->port_id, res->vf_id, is_on);
+#endif
+
+	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;
+	case -ENOTSUP:
+		printf("function not implemented\n");
+		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 */
@@ -11996,6 +12092,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	[flat|nested] 125+ messages in thread

* [PATCH v5 23/29] app/testpmd: handle i40e in VF VLAN filter command
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (21 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 22/29] app/testpmd: add command to test VF VLAN tag " Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 20:31       ` Vincent JARDIN
  2016-12-16 19:02     ` [PATCH v5 24/29] net/i40e: change version number to support Linux VF Ferruh Yigit
                       ` (6 subsequent siblings)
  29 siblings, 1 reply; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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/cmdline.c | 40 +++++++++++++++++++++++++++++++++-------
 app/test-pmd/config.c  | 13 -------------
 app/test-pmd/testpmd.h |  2 --
 3 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 2b17925..81273b6 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6835,7 +6835,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;
@@ -6853,11 +6852,39 @@ cmd_vf_rx_vlan_filter_parsed(void *parsed_result,
 			  __attribute__((unused)) void *data)
 {
 	struct cmd_vf_rx_vlan_filter *res = parsed_result;
+	int ret = -ENOTSUP;
+	__rte_unused int is_add = (strcmp(res->what, "add") == 0) ? 1 : 0;
+	struct rte_eth_dev_info dev_info;
 
-	if (!strcmp(res->what, "add"))
-		set_vf_rx_vlan(res->port_id, res->vlan_id,res->vf_mask, 1);
-	else
-		set_vf_rx_vlan(res->port_id, res->vlan_id,res->vf_mask, 0);
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
+		ret = rte_pmd_ixgbe_set_vf_vlan_filter(res->port_id,
+				res->vlan_id, res->vf_mask, is_add);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+	if (strstr(dev_info.driver_name, "i40e") != NULL)
+		ret = rte_pmd_i40e_set_vf_vlan_filter(res->port_id,
+				res->vlan_id, res->vf_mask, is_add);
+#endif
+
+	switch (ret) {
+	case 0:
+		break;
+	case -EINVAL:
+		printf("invalid vlan_id %d or vf_mask %lu\n",
+				res->vlan_id, res->vf_mask);
+		break;
+	case -ENODEV:
+		printf("invalid port_id %d\n", res->port_id);
+		break;
+	case -ENOTSUP:
+		printf("function not implemented or supported\n");
+		break;
+	default:
+		printf("programming error: (%s)\n", strerror(-ret));
+	}
 }
 
 cmdline_parse_token_string_t cmd_vf_rx_vlan_filter_rx_vlan =
@@ -6898,7 +6925,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 {
@@ -12085,9 +12111,9 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en,
 	(cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
 	(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
+	(cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
 	(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
 	(cmdline_parse_inst_t *)&cmd_set_vf_promisc,
 	(cmdline_parse_inst_t *)&cmd_set_vf_allmulti,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index fc0424a..38aa0b9 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2348,19 +2348,6 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
 	       		"diag=%d\n", port_id, diag);
 
 }
-
-void
-set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)
-{
-	int diag;
-
-	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 "
-	       "diag=%d\n", port_id, diag);
-}
 #endif
 
 int
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9c1e703..5d104bd 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -571,8 +571,6 @@ void port_rss_reta_info(portid_t port_id,
 			uint16_t nb_entries);
 
 void set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on);
-void set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id,
-		uint64_t vf_mask, uint8_t on);
 
 int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate);
 int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
-- 
2.9.3

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

* [PATCH v5 24/29] net/i40e: change version number to support Linux VF
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (22 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 23/29] app/testpmd: handle i40e in VF VLAN filter command Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 25/29] net/i40e: return correct VSI id Ferruh Yigit
                       ` (5 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v5 25/29] net/i40e: return correct VSI id
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (23 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 24/29] net/i40e: change version number to support Linux VF Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 26/29] net/i40e: parse more VF parameter and configure Ferruh Yigit
                       ` (4 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v5 26/29] net/i40e: parse more VF parameter and configure
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (24 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 25/29] net/i40e: return correct VSI id Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 27/29] net/i40e: support Linux VF to configure IRQ link list Ferruh Yigit
                       ` (3 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v5 27/29] net/i40e: support Linux VF to configure IRQ link list
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (25 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 26/29] net/i40e: parse more VF parameter and configure Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 28/29] net/i40e: enhance in sanity check of MAC Ferruh Yigit
                       ` (2 subsequent siblings)
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v5 28/29] net/i40e: enhance in sanity check of MAC
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (26 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 27/29] net/i40e: support Linux VF to configure IRQ link list Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-16 19:02     ` [PATCH v5 29/29] net/i40e: set/clear VF stats from PF Ferruh Yigit
  2016-12-16 20:36     ` [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e Vincent JARDIN
  29 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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	[flat|nested] 125+ messages in thread

* [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (27 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 28/29] net/i40e: enhance in sanity check of MAC Ferruh Yigit
@ 2016-12-16 19:02     ` Ferruh Yigit
  2016-12-20 13:24       ` Ferruh Yigit
  2016-12-16 20:36     ` [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e Vincent JARDIN
  29 siblings, 1 reply; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-16 19:02 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu

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 8ac1bc8..7a5d211 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -6,7 +6,9 @@ DPDK_2.0 {
 DPDK_17.02 {
 	global:
 
+	rte_pmd_i40e_get_vf_stats;
 	rte_pmd_i40e_ping_vfs;
+	rte_pmd_i40e_reset_vf_stats;
 	rte_pmd_i40e_set_tx_loopback;
 	rte_pmd_i40e_set_vf_broadcast;
 	rte_pmd_i40e_set_vf_mac_addr;
-- 
2.9.3

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

* Re: [PATCH v5 19/29] app/testpmd: use unicast promiscuous mode on i40e
  2016-12-16 19:02     ` [PATCH v5 19/29] app/testpmd: use unicast promiscuous mode " Ferruh Yigit
@ 2016-12-16 20:28       ` Vincent JARDIN
  2016-12-19 11:05         ` Ferruh Yigit
  0 siblings, 1 reply; 125+ messages in thread
From: Vincent JARDIN @ 2016-12-16 20:28 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: Jingjing Wu, Helin Zhang, Wenzhuo Lu

Le 16/12/2016 à 20:02, Ferruh Yigit a écrit :
> +#ifdef RTE_LIBRTE_I40E_PMD
> +	ret = rte_pmd_i40e_set_vf_unicast_promisc(res->port_id,
> +			res->vf_id, is_on);
> +#endif

Why is an ifdef used here? It won't scale to all PMDs.

I means that you are missing an abstraction layer.

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

* Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
  2016-12-16 19:02     ` [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e Ferruh Yigit
@ 2016-12-16 20:30       ` Vincent JARDIN
  2016-12-19 11:03         ` Ferruh Yigit
  2016-12-19 17:09       ` Ferruh Yigit
  1 sibling, 1 reply; 125+ messages in thread
From: Vincent JARDIN @ 2016-12-16 20:30 UTC (permalink / raw)
  To: Ferruh Yigit, dev
  Cc: Jingjing Wu, Helin Zhang, Wenzhuo Lu, Chen Jing D, Bernard Iremonger

Le 16/12/2016 à 20:02, Ferruh Yigit a écrit :
> +#ifdef RTE_LIBRTE_IXGBE_PMD
>  			"set all queues drop (port_id) (on|off)\n"
>  			"    Set drop enable bit for all queues.\n\n"
>
>  			"set vf split drop (port_id) (vf_id) (on|off)\n"
>  			"    Set split drop enable bit for a VF from the PF.\n\n"
> +#endif

it is not related to i40e. This serie should only be for i40e.

Moreover, it is a strange logic: how will it scale for all PMDs?

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

* Re: [PATCH v5 23/29] app/testpmd: handle i40e in VF VLAN filter command
  2016-12-16 19:02     ` [PATCH v5 23/29] app/testpmd: handle i40e in VF VLAN filter command Ferruh Yigit
@ 2016-12-16 20:31       ` Vincent JARDIN
  2016-12-19 11:13         ` Ferruh Yigit
  0 siblings, 1 reply; 125+ messages in thread
From: Vincent JARDIN @ 2016-12-16 20:31 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: Jingjing Wu, Helin Zhang, Bernard Iremonger

Le 16/12/2016 à 20:02, Ferruh Yigit a écrit :
> +#ifdef RTE_LIBRTE_IXGBE_PMD
> +	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
> +		ret = rte_pmd_ixgbe_set_vf_vlan_filter(res->port_id,
> +				res->vlan_id, res->vf_mask, is_add);
> +#endif
> +#ifdef RTE_LIBRTE_I40E_PMD
> +	if (strstr(dev_info.driver_name, "i40e") != NULL)
> +		ret = rte_pmd_i40e_set_vf_vlan_filter(res->port_id,
> +				res->vlan_id, res->vf_mask, is_add);
> +#endif

That's exactly what we need to avoid, it won't scale to many PMDs.

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
                       ` (28 preceding siblings ...)
  2016-12-16 19:02     ` [PATCH v5 29/29] net/i40e: set/clear VF stats from PF Ferruh Yigit
@ 2016-12-16 20:36     ` Vincent JARDIN
  2016-12-19  9:01       ` Chen, Jing D
  29 siblings, 1 reply; 125+ messages in thread
From: Vincent JARDIN @ 2016-12-16 20:36 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: Jingjing Wu, Helin Zhang

Le 16/12/2016 à 20:02, Ferruh Yigit a écrit :
> As we need to support the scenario kernel PF + DPDK VF,
> DPDK follows the interface between kernel PF + kernel VF.

Please, it has to be proven that DPDK provides the same interface that 
the kernel. It seems insane to duplicate kernel's PF into the DPDK 
without a strong guarantee that it is a strict same behaviour. For instance,
   - what will happen when the DPDK's PF will have a new feature which 
is not into the kernel?
   - what will happen when the Kernel's PF will have a feature with 
different capabilities that the kernel?

Please, make it clear before. Currently, for me it is a nack of this serie.

Thank you,
   Vincent

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-16 20:36     ` [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e Vincent JARDIN
@ 2016-12-19  9:01       ` Chen, Jing D
  2016-12-19 13:20         ` Thomas Monjalon
  0 siblings, 1 reply; 125+ messages in thread
From: Chen, Jing D @ 2016-12-19  9:01 UTC (permalink / raw)
  To: Vincent JARDIN, Yigit, Ferruh, dev; +Cc: Wu, Jingjing, Zhang, Helin

Hi, Vincent,


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Vincent JARDIN
> Sent: Saturday, December 17, 2016 4:36 AM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Helin <helin.zhang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on
> i40e
> 
> Le 16/12/2016 à 20:02, Ferruh Yigit a écrit :
> > As we need to support the scenario kernel PF + DPDK VF,
> > DPDK follows the interface between kernel PF + kernel VF.
> 
> Please, it has to be proven that DPDK provides the same interface that
> the kernel. It seems insane to duplicate kernel's PF into the DPDK
> without a strong guarantee that it is a strict same behaviour. For instance,
>    - what will happen when the DPDK's PF will have a new feature which
> is not into the kernel?
>    - what will happen when the Kernel's PF will have a feature with
> different capabilities that the kernel?
> 
> Please, make it clear before. Currently, for me it is a nack of this serie.
> 
Let me try to explain.
When we DPDK developed i40e drivers several years ago,  we found the API and
data structures defined in shared code for VF and PF device communication can
satisfy DPDK's requirements, so we just followed that API.  At that time, we'll try 
to satisfy 3 scenarios.
1. Linux PF + Linux VF : it's not our scope.
2. Linux PF + DPDK VF: there is no problems observed since we use same API.
3. DPDK PF + DPDK VF: that's fully under control.
The only scenario was not considered is DPDK PF + Linux VF.

Since then, both Linux and DPDK keep developing code. Then, we found it's
necessary to extend VF capability (Like promiscuous mode). It will be hard to
ask Linux PF to support that service considering upstream effort in Linux world.
So, supporting it in scenario of DPDK PF + DPDK VF became best candidate. But 
how can VF identify who is serving it then decide if extended request can be dispatched?
So, DPDK PF will send a special version number for this purpose.

As time passed by, we realized there some use case for DPDK PF + Linux VF and it's not
supported yet. Then, we found our implementation in DPDK PF is not complete since we
only had considered how to serve DPDK VF at that time. So, we need some improvement
on the PF host driver. Besides that, 'send a special version' to VF doesn't work now since
Linux VF can't interpret the version info. So, we behave the same as Linux PF driver with
sacrifice of extended function in DPDK VF. 

Let me summary the chang here.
1. We shared the same interface with Linux driver from beginning. 
2. This change will support both Linux VF and DPDK VF.
3. We'll find a way for DPDK VF identifying who is serving it so it can use extended function
in future release.

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

* Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
  2016-12-16 20:30       ` Vincent JARDIN
@ 2016-12-19 11:03         ` Ferruh Yigit
  2016-12-20 15:19           ` Vincent JARDIN
  0 siblings, 1 reply; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-19 11:03 UTC (permalink / raw)
  To: Vincent JARDIN, dev
  Cc: Jingjing Wu, Helin Zhang, Wenzhuo Lu, Chen Jing D, Bernard Iremonger

On 12/16/2016 8:30 PM, Vincent JARDIN wrote:
> Le 16/12/2016 à 20:02, Ferruh Yigit a écrit :
>> +#ifdef RTE_LIBRTE_IXGBE_PMD
>>  			"set all queues drop (port_id) (on|off)\n"
>>  			"    Set drop enable bit for all queues.\n\n"
>>
>>  			"set vf split drop (port_id) (vf_id) (on|off)\n"
>>  			"    Set split drop enable bit for a VF from the PF.\n\n"
>> +#endif
> 
> it is not related to i40e. This serie should only be for i40e.

Please check the patch a little wider, it doesn't introduce the ifdef,
instead patch narrows down the scope of ifdef [1], because now some
functions are not just for ixgbe, but used both with i40e and ixgbe, so
the ifdef moved into the function itself [2].


[1]
-#ifdef RTE_LIBRTE_IXGBE_PMD
 	"set tx loopback (port_id) (on|off)\n"
 	"    Enable or disable tx loopback.\n\n"

+#ifdef RTE_LIBRTE_IXGBE_PMD
 	"set all queues drop (port_id) (on|off)\n"
 	"    Set drop enable bit for all queues.\n\n"

 	"set vf split drop (port_id) (vf_id) (on|off)\n"
 	"    Set split drop enable bit for a VF from the PF.\n\n"
+#endif

 	"set vf mac antispoof (port_id) (vf_id) (on|off).\n"
 	"    Set MAC antispoof for a VF from the PF.\n\n"
-#endif



[2]
@@ -11187,10 +11242,21 @@ cmd_set_tx_loopback_parsed(
...
+#ifdef RTE_LIBRTE_IXGBE_PMD
+	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
+		ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+	if (strstr(dev_info.driver_name, "i40e") != NULL)
+		ret = rte_pmd_i40e_set_tx_loopback(res->port_id, is_on);
+#endif

> 
> Moreover, it is a strange logic: how will it scale for all PMDs?

It won't.
That is why they are in ifdef.

These are PMD specific APIs, as naming convention shows "rte_pmd_i40e_..."

For the PMD features, which are not generic enough, but hardware is
capable and user may want to benefit from, PMD specific APIs exists.
Instead of these functions bloat the eth_dev layer, and give a fake
sense of abstraction, these APIs moved into PMDs.
And it is always possible to move these into ethdev layer, when multiple
PMDs supports same feature.
I agree this is something that needs to keep an eye on it, and be sure
if an API is generic, move it into eth_dev layer.

The application that use the PMD specific API, needs to be conditionally
compiled because that API may not always exits.

Thanks,
ferruh

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

* Re: [PATCH v5 19/29] app/testpmd: use unicast promiscuous mode on i40e
  2016-12-16 20:28       ` Vincent JARDIN
@ 2016-12-19 11:05         ` Ferruh Yigit
  0 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-19 11:05 UTC (permalink / raw)
  To: Vincent JARDIN, dev; +Cc: Jingjing Wu, Helin Zhang, Wenzhuo Lu

On 12/16/2016 8:28 PM, Vincent JARDIN wrote:
> Le 16/12/2016 à 20:02, Ferruh Yigit a écrit :
>> +#ifdef RTE_LIBRTE_I40E_PMD
>> +	ret = rte_pmd_i40e_set_vf_unicast_promisc(res->port_id,
>> +			res->vf_id, is_on);
>> +#endif
> 
> Why is an ifdef used here? It won't scale to all PMDs.

As explained in previous e-mail, because these are PMD specific APIs.
And it is not expected to scale to all PMDs.

> 
> I means that you are missing an abstraction layer.
> 

Yes, intentionally.

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

* Re: [PATCH v5 23/29] app/testpmd: handle i40e in VF VLAN filter command
  2016-12-16 20:31       ` Vincent JARDIN
@ 2016-12-19 11:13         ` Ferruh Yigit
  0 siblings, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-19 11:13 UTC (permalink / raw)
  To: Vincent JARDIN, dev; +Cc: Jingjing Wu, Helin Zhang, Bernard Iremonger

On 12/16/2016 8:31 PM, Vincent JARDIN wrote:
> Le 16/12/2016 à 20:02, Ferruh Yigit a écrit :
>> +#ifdef RTE_LIBRTE_IXGBE_PMD
>> +	if (strstr(dev_info.driver_name, "ixgbe") != NULL)
>> +		ret = rte_pmd_ixgbe_set_vf_vlan_filter(res->port_id,
>> +				res->vlan_id, res->vf_mask, is_add);
>> +#endif
>> +#ifdef RTE_LIBRTE_I40E_PMD
>> +	if (strstr(dev_info.driver_name, "i40e") != NULL)
>> +		ret = rte_pmd_i40e_set_vf_vlan_filter(res->port_id,
>> +				res->vlan_id, res->vf_mask, is_add);
>> +#endif
> 
> That's exactly what we need to avoid, it won't scale to many PMDs.
> 

For a generic PMD feature, completely agree with you. Application
shouldn't know/worry about underlying hardware. eth_dev layer should be
used.
But above usage is for an application that knows the hardware, and
knowing that it is losing all the benefits of the portability and
explicitly including the PMD header to use those PMD specific APIs.

Thanks,
ferruh

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-19  9:01       ` Chen, Jing D
@ 2016-12-19 13:20         ` Thomas Monjalon
  2016-12-19 13:39           ` Chen, Jing D
  0 siblings, 1 reply; 125+ messages in thread
From: Thomas Monjalon @ 2016-12-19 13:20 UTC (permalink / raw)
  To: Chen, Jing D
  Cc: dev, Vincent JARDIN, Yigit, Ferruh, Wu, Jingjing, Zhang, Helin

2016-12-19 09:01, Chen, Jing D:
> Since then, both Linux and DPDK keep developing code. Then, we found it's
> necessary to extend VF capability (Like promiscuous mode). It will be hard to
> ask Linux PF to support that service considering upstream effort in Linux world.

Please, could you clarify this?
Do you mean you cannot change the Linux driver?

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-19 13:20         ` Thomas Monjalon
@ 2016-12-19 13:39           ` Chen, Jing D
  2016-12-19 13:45             ` Vincent JARDIN
  0 siblings, 1 reply; 125+ messages in thread
From: Chen, Jing D @ 2016-12-19 13:39 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Vincent JARDIN, Yigit, Ferruh, Wu, Jingjing, Zhang, Helin

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Monday, December 19, 2016 9:21 PM
> To: Chen, Jing D <jing.d.chen@intel.com>
> Cc: dev@dpdk.org; Vincent JARDIN <vincent.jardin@6wind.com>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Helin
> <helin.zhang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel
> VF on i40e
> 
> 2016-12-19 09:01, Chen, Jing D:
> > Since then, both Linux and DPDK keep developing code. Then, we found
> > it's necessary to extend VF capability (Like promiscuous mode). It
> > will be hard to ask Linux PF to support that service considering upstream
> effort in Linux world.
> 
> Please, could you clarify this?
> Do you mean you cannot change the Linux driver?

There are 2 things here. One is to add extended functionality into Linux driver,
Another is to have it upstream into kernel world.
The first one can be achieved easier, while later one may be difficult. They will
have concern why VM can have such privilege (like promisc mode). But I need
to check as I know there is some mechanism now to make a VM privileged.

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-19 13:39           ` Chen, Jing D
@ 2016-12-19 13:45             ` Vincent JARDIN
  2016-12-20  4:48               ` Chen, Jing D
  0 siblings, 1 reply; 125+ messages in thread
From: Vincent JARDIN @ 2016-12-19 13:45 UTC (permalink / raw)
  To: Chen, Jing D, Thomas Monjalon
  Cc: dev, Yigit, Ferruh, Wu, Jingjing, Zhang, Helin

Le 19/12/2016 à 14:39, Chen, Jing D a écrit :
> They will
> have concern why VM can have such privilege (like promisc mode). But I need
> to check as I know there is some mechanism now to make a VM privileged.

 From iproute2's man:
<--
trust on|off - trust the specified VF user. This enables that VF user 
can set a specific feature which may impact security and/or performance. 
(e.g. VF multicast promiscuous mode)
-->

So yes, it is possible to get PF features upstream'd into the kernel 
without having a specific PF into DPDK.

best regards,
   Vincent

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

* Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
  2016-12-16 19:02     ` [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e Ferruh Yigit
  2016-12-16 20:30       ` Vincent JARDIN
@ 2016-12-19 17:09       ` Ferruh Yigit
  2016-12-20  1:05         ` Lu, Wenzhuo
  1 sibling, 1 reply; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-19 17:09 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu, Helin Zhang, Wenzhuo Lu, Chen Jing D, Bernard Iremonger

On 12/16/2016 7:02 PM, Ferruh Yigit wrote:
> 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 | 150 +++++++++++++++++++++++++++++++++++++++----------
>  2 files changed, 121 insertions(+), 31 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

Hi Wenzhuo,

Following lines are required for shared library, but I guess above line
required because they cause problem with static library.
So, instead of adding above line, what do you think wrapping below lines
with ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) ?

>  _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
>  
>  CFLAGS_cmdline.o := -D_GNU_SOURCE
>  
<...>

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

* Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
  2016-12-19 17:09       ` Ferruh Yigit
@ 2016-12-20  1:05         ` Lu, Wenzhuo
  0 siblings, 0 replies; 125+ messages in thread
From: Lu, Wenzhuo @ 2016-12-20  1:05 UTC (permalink / raw)
  To: Yigit, Ferruh, dev
  Cc: Wu, Jingjing, Zhang, Helin, Chen, Jing D, Iremonger, Bernard

Hi Ferruh,


> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, December 20, 2016 1:10 AM
> To: dev@dpdk.org
> Cc: Wu, Jingjing; Zhang, Helin; Lu, Wenzhuo; Chen, Jing D; Iremonger, Bernard
> Subject: Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
> 
> On 12/16/2016 7:02 PM, Ferruh Yigit wrote:
> > 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 | 150
> > +++++++++++++++++++++++++++++++++++++++----------
> >  2 files changed, 121 insertions(+), 31 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
> 
> Hi Wenzhuo,
> 
> Following lines are required for shared library, but I guess above line required
> because they cause problem with static library.
> So, instead of adding above line, what do you think wrapping below lines with
> ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) ?
Thanks for your suggestion. It's also a choice. I'll change it.

> 
> >  _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
> > +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
> >
> >  CFLAGS_cmdline.o := -D_GNU_SOURCE
> >
> <...>

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-19 13:45             ` Vincent JARDIN
@ 2016-12-20  4:48               ` Chen, Jing D
  2016-12-20 15:18                 ` Vincent JARDIN
  0 siblings, 1 reply; 125+ messages in thread
From: Chen, Jing D @ 2016-12-20  4:48 UTC (permalink / raw)
  To: Vincent JARDIN, Thomas Monjalon
  Cc: dev, Yigit, Ferruh, Wu, Jingjing, Zhang, Helin

Hi,

> -----Original Message-----
> From: Vincent JARDIN [mailto:vincent.jardin@6wind.com]
> Sent: Monday, December 19, 2016 9:46 PM
> To: Chen, Jing D <jing.d.chen@intel.com>; Thomas Monjalon
> <thomas.monjalon@6wind.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Zhang, Helin <helin.zhang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on
> i40e
> 
> Le 19/12/2016 à 14:39, Chen, Jing D a écrit :
> > They will
> > have concern why VM can have such privilege (like promisc mode). But I need
> > to check as I know there is some mechanism now to make a VM privileged.
> 
>  From iproute2's man:
> <--
> trust on|off - trust the specified VF user. This enables that VF user
> can set a specific feature which may impact security and/or performance.
> (e.g. VF multicast promiscuous mode)
> -->
> 
> So yes, it is possible to get PF features upstream'd into the kernel
> without having a specific PF into DPDK.

That's a collaboration with another team. we'll follow-up that but not guarantee
it will happen.
May I ask if my reply make it clear? Still NAC for this patch?

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

* Re: [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
  2016-12-16 19:02     ` [PATCH v5 29/29] net/i40e: set/clear VF stats from PF Ferruh Yigit
@ 2016-12-20 13:24       ` Ferruh Yigit
  2016-12-20 13:40         ` Iremonger, Bernard
  0 siblings, 1 reply; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-20 13:24 UTC (permalink / raw)
  To: dev; +Cc: Jingjing Wu, Helin Zhang, Qi Zhang, Wenzhuo Lu, Chen, Jing D

On 12/16/2016 7:02 PM, Ferruh Yigit wrote:
> 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>
> ---

<...>

> diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e/rte_pmd_i40e_version.map
> index 8ac1bc8..7a5d211 100644
> --- a/drivers/net/i40e/rte_pmd_i40e_version.map
> +++ b/drivers/net/i40e/rte_pmd_i40e_version.map
> @@ -6,7 +6,9 @@ DPDK_2.0 {
>  DPDK_17.02 {
>  	global:
>  
> +	rte_pmd_i40e_get_vf_stats;
>  	rte_pmd_i40e_ping_vfs;
> +	rte_pmd_i40e_reset_vf_stats;
>  	rte_pmd_i40e_set_tx_loopback;
>  	rte_pmd_i40e_set_vf_broadcast;
>  	rte_pmd_i40e_set_vf_mac_addr;

Hi Wenzhuo, Mark,

I think this is the list of all APIs added with this patchset.

Just a question, what do you think following a logic in API naming as:
<name_space>_<object>_<action> ?

So API names become:
rte_pmd_i40e_tx_loopback_set;
rte_pmd_i40e_vf_broadcast_set;
rte_pmd_i40e_vf_mac_addr_set;
rte_pmd_i40e_vfs_ping;
rte_pmd_i40e_vf_stats_get;
rte_pmd_i40e_vf_stats_reset;


After above rename, rte_pmd_i40e_tx_loopback_set() is not giving a hint
that this is something related to the PF controlling VF, perhaps we can
rename the API ?

Also rte_pmd_i40e_vfs_ping() can become rte_pmd_i40e_vf_ping_all() to be
more consistent about _vf_ usage.

Overall, they can be something like:
rte_pmd_i40e_vf_broadcast_set;
rte_pmd_i40e_vf_mac_addr_set;
rte_pmd_i40e_vf_ping_all;
rte_pmd_i40e_vf_stats_get;
rte_pmd_i40e_vf_stats_reset;
rte_pmd_i40e_vf_tx_loopback_set;

What do you think?


> 

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

* Re: [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
  2016-12-20 13:24       ` Ferruh Yigit
@ 2016-12-20 13:40         ` Iremonger, Bernard
  2016-12-21  0:56           ` Lu, Wenzhuo
  0 siblings, 1 reply; 125+ messages in thread
From: Iremonger, Bernard @ 2016-12-20 13:40 UTC (permalink / raw)
  To: Yigit, Ferruh, dev
  Cc: Wu, Jingjing, Zhang, Helin, Zhang, Qi Z, Lu, Wenzhuo, Chen, Jing D

Hi Ferruh,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Tuesday, December 20, 2016 1:25 PM
> To: dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Helin
> <helin.zhang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; Chen, Jing D <jing.d.chen@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats from
> PF
> 
> On 12/16/2016 7:02 PM, Ferruh Yigit wrote:
> > 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>
> > ---
> 
> <...>
> 
> > diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map
> > b/drivers/net/i40e/rte_pmd_i40e_version.map
> > index 8ac1bc8..7a5d211 100644
> > --- a/drivers/net/i40e/rte_pmd_i40e_version.map
> > +++ b/drivers/net/i40e/rte_pmd_i40e_version.map
> > @@ -6,7 +6,9 @@ DPDK_2.0 {
> >  DPDK_17.02 {
> >  	global:
> >
> > +	rte_pmd_i40e_get_vf_stats;
> >  	rte_pmd_i40e_ping_vfs;
> > +	rte_pmd_i40e_reset_vf_stats;
> >  	rte_pmd_i40e_set_tx_loopback;
> >  	rte_pmd_i40e_set_vf_broadcast;
> >  	rte_pmd_i40e_set_vf_mac_addr;
> 
> Hi Wenzhuo, Mark,
> 
> I think this is the list of all APIs added with this patchset.
> 
> Just a question, what do you think following a logic in API naming as:
> <name_space>_<object>_<action> ?
> 
> So API names become:
> rte_pmd_i40e_tx_loopback_set;
> rte_pmd_i40e_vf_broadcast_set;
> rte_pmd_i40e_vf_mac_addr_set;
> rte_pmd_i40e_vfs_ping;
> rte_pmd_i40e_vf_stats_get;
> rte_pmd_i40e_vf_stats_reset;
> 
> 
> After above rename, rte_pmd_i40e_tx_loopback_set() is not giving a hint
> that this is something related to the PF controlling VF, perhaps we can
> rename the API ?
> 
> Also rte_pmd_i40e_vfs_ping() can become rte_pmd_i40e_vf_ping_all() to
> be more consistent about _vf_ usage.
> 
> Overall, they can be something like:
> rte_pmd_i40e_vf_broadcast_set;
> rte_pmd_i40e_vf_mac_addr_set;
> rte_pmd_i40e_vf_ping_all;
> rte_pmd_i40e_vf_stats_get;
> rte_pmd_i40e_vf_stats_reset;
> rte_pmd_i40e_vf_tx_loopback_set;
> 
> What do you think?
> 

I think the naming should be consistent with what has already been implemented for the ixgbe PMD.
	rte_pmd_ixgbe_set_all_queues_drop_en;
	rte_pmd_ixgbe_set_tx_loopback;
	rte_pmd_ixgbe_set_vf_mac_addr;
	rte_pmd_ixgbe_set_vf_mac_anti_spoof;
	rte_pmd_ixgbe_set_vf_split_drop_en;
	rte_pmd_ixgbe_set_vf_vlan_anti_spoof;
	rte_pmd_ixgbe_set_vf_vlan_insert;
	rte_pmd_ixgbe_set_vf_vlan_stripq;

	rte_pmd_ixgbe_set_vf_rate_limit;
	rte_pmd_ixgbe_set_vf_rx;
	rte_pmd_ixgbe_set_vf_rxmode;
	rte_pmd_ixgbe_set_vf_tx;
	rte_pmd_ixgbe_set_vf_vlan_filter;

Regards,

Bernard.

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-20  4:48               ` Chen, Jing D
@ 2016-12-20 15:18                 ` Vincent JARDIN
  2016-12-20 15:31                   ` Ferruh Yigit
  2016-12-22  8:10                   ` Chen, Jing D
  0 siblings, 2 replies; 125+ messages in thread
From: Vincent JARDIN @ 2016-12-20 15:18 UTC (permalink / raw)
  To: Chen, Jing D, Thomas Monjalon
  Cc: dev, Yigit, Ferruh, Wu, Jingjing, Zhang, Helin

Le 20/12/2016 à 05:48, Chen, Jing D a écrit :
> That's a collaboration with another team. we'll follow-up that but not guarantee
> it will happen.
> May I ask if my reply make it clear? Still NAC for this patch?

Yes still nack, I am not confident with this PF approach since you are 
breaking Linux PF behavior. It does not provide guarantees with PF. 
Something is missing to guarantee the compatibilities.

Thank you,
   Vincent

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

* Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
  2016-12-19 11:03         ` Ferruh Yigit
@ 2016-12-20 15:19           ` Vincent JARDIN
  0 siblings, 0 replies; 125+ messages in thread
From: Vincent JARDIN @ 2016-12-20 15:19 UTC (permalink / raw)
  To: Ferruh Yigit, dev
  Cc: Jingjing Wu, Helin Zhang, Wenzhuo Lu, Chen Jing D, Bernard Iremonger

Le 19/12/2016 à 12:03, Ferruh Yigit a écrit :
> And it is always possible to move these into ethdev layer, when multiple
> PMDs supports same feature.
> I agree this is something that needs to keep an eye on it, and be sure
> if an API is generic, move it into eth_dev layer.

you are right, you have a good point, it is better to try this approach, 
and let's generalize later.

thank you for your comments,
   Vincent

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-20 15:18                 ` Vincent JARDIN
@ 2016-12-20 15:31                   ` Ferruh Yigit
  2016-12-21  0:50                     ` Lu, Wenzhuo
  2016-12-22  8:10                   ` Chen, Jing D
  1 sibling, 1 reply; 125+ messages in thread
From: Ferruh Yigit @ 2016-12-20 15:31 UTC (permalink / raw)
  To: Vincent JARDIN, Chen, Jing D, Thomas Monjalon
  Cc: dev, Wu, Jingjing, Zhang, Helin

On 12/20/2016 3:18 PM, Vincent JARDIN wrote:
> Le 20/12/2016 à 05:48, Chen, Jing D a écrit :
>> That's a collaboration with another team. we'll follow-up that but not guarantee
>> it will happen.
>> May I ask if my reply make it clear? Still NAC for this patch?
> 
> Yes still nack, I am not confident with this PF approach since you are 
> breaking Linux PF behavior. It does not provide guarantees with PF. 
> Something is missing to guarantee the compatibilities.

Hi Vincent, Mark,

What do you think separating the mentioned patch (patch 24/29) from
patchset and submit as a standalone patch, so that it can be discussed
more without blocking the patchset?

Thanks,
ferruh

> 
> Thank you,
>    Vincent
> 

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-20 15:31                   ` Ferruh Yigit
@ 2016-12-21  0:50                     ` Lu, Wenzhuo
  0 siblings, 0 replies; 125+ messages in thread
From: Lu, Wenzhuo @ 2016-12-21  0:50 UTC (permalink / raw)
  To: Yigit, Ferruh, Vincent JARDIN, Chen, Jing D, Thomas Monjalon
  Cc: dev, Wu, Jingjing, Zhang, Helin

Hi all,


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Tuesday, December 20, 2016 11:32 PM
> To: Vincent JARDIN; Chen, Jing D; Thomas Monjalon
> Cc: dev@dpdk.org; Wu, Jingjing; Zhang, Helin
> Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF
> on i40e
> 
> On 12/20/2016 3:18 PM, Vincent JARDIN wrote:
> > Le 20/12/2016 à 05:48, Chen, Jing D a écrit :
> >> That's a collaboration with another team. we'll follow-up that but
> >> not guarantee it will happen.
> >> May I ask if my reply make it clear? Still NAC for this patch?
> >
> > Yes still nack, I am not confident with this PF approach since you are
> > breaking Linux PF behavior. It does not provide guarantees with PF.
> > Something is missing to guarantee the compatibilities.
> 
> Hi Vincent, Mark,
> 
> What do you think separating the mentioned patch (patch 24/29) from patchset
> and submit as a standalone patch, so that it can be discussed more without
> blocking the patchset?
+1 :)

> 
> Thanks,
> ferruh
> 
> >
> > Thank you,
> >    Vincent
> >

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

* Re: [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
  2016-12-20 13:40         ` Iremonger, Bernard
@ 2016-12-21  0:56           ` Lu, Wenzhuo
  2016-12-22 16:38             ` Iremonger, Bernard
  0 siblings, 1 reply; 125+ messages in thread
From: Lu, Wenzhuo @ 2016-12-21  0:56 UTC (permalink / raw)
  To: Iremonger, Bernard, Yigit, Ferruh, dev
  Cc: Wu, Jingjing, Zhang, Helin, Zhang, Qi Z, Chen, Jing D

Hi all,


> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Tuesday, December 20, 2016 9:40 PM
> To: Yigit, Ferruh; dev@dpdk.org
> Cc: Wu, Jingjing; Zhang, Helin; Zhang, Qi Z; Lu, Wenzhuo; Chen, Jing D
> Subject: RE: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
> 
> Hi Ferruh,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> > Sent: Tuesday, December 20, 2016 1:25 PM
> > To: dev@dpdk.org
> > Cc: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Helin
> > <helin.zhang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Lu,
> > Wenzhuo <wenzhuo.lu@intel.com>; Chen, Jing D <jing.d.chen@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats
> > from PF
> >
> > On 12/16/2016 7:02 PM, Ferruh Yigit wrote:
> > > 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>
> > > ---
> >
> > <...>
> >
> > > diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map
> > > b/drivers/net/i40e/rte_pmd_i40e_version.map
> > > index 8ac1bc8..7a5d211 100644
> > > --- a/drivers/net/i40e/rte_pmd_i40e_version.map
> > > +++ b/drivers/net/i40e/rte_pmd_i40e_version.map
> > > @@ -6,7 +6,9 @@ DPDK_2.0 {
> > >  DPDK_17.02 {
> > >  	global:
> > >
> > > +	rte_pmd_i40e_get_vf_stats;
> > >  	rte_pmd_i40e_ping_vfs;
> > > +	rte_pmd_i40e_reset_vf_stats;
> > >  	rte_pmd_i40e_set_tx_loopback;
> > >  	rte_pmd_i40e_set_vf_broadcast;
> > >  	rte_pmd_i40e_set_vf_mac_addr;
> >
> > Hi Wenzhuo, Mark,
> >
> > I think this is the list of all APIs added with this patchset.
> >
> > Just a question, what do you think following a logic in API naming as:
> > <name_space>_<object>_<action> ?
> >
> > So API names become:
> > rte_pmd_i40e_tx_loopback_set;
> > rte_pmd_i40e_vf_broadcast_set;
> > rte_pmd_i40e_vf_mac_addr_set;
> > rte_pmd_i40e_vfs_ping;
> > rte_pmd_i40e_vf_stats_get;
> > rte_pmd_i40e_vf_stats_reset;
> >
> >
> > After above rename, rte_pmd_i40e_tx_loopback_set() is not giving a
> > hint that this is something related to the PF controlling VF, perhaps
> > we can rename the API ?
> >
> > Also rte_pmd_i40e_vfs_ping() can become rte_pmd_i40e_vf_ping_all() to
> > be more consistent about _vf_ usage.
> >
> > Overall, they can be something like:
> > rte_pmd_i40e_vf_broadcast_set;
> > rte_pmd_i40e_vf_mac_addr_set;
> > rte_pmd_i40e_vf_ping_all;
> > rte_pmd_i40e_vf_stats_get;
> > rte_pmd_i40e_vf_stats_reset;
> > rte_pmd_i40e_vf_tx_loopback_set;
> >
> > What do you think?
> >
> 
> I think the naming should be consistent with what has already been implemented
> for the ixgbe PMD.
> 	rte_pmd_ixgbe_set_all_queues_drop_en;
> 	rte_pmd_ixgbe_set_tx_loopback;
> 	rte_pmd_ixgbe_set_vf_mac_addr;
> 	rte_pmd_ixgbe_set_vf_mac_anti_spoof;
> 	rte_pmd_ixgbe_set_vf_split_drop_en;
> 	rte_pmd_ixgbe_set_vf_vlan_anti_spoof;
> 	rte_pmd_ixgbe_set_vf_vlan_insert;
> 	rte_pmd_ixgbe_set_vf_vlan_stripq;
> 
> 	rte_pmd_ixgbe_set_vf_rate_limit;
> 	rte_pmd_ixgbe_set_vf_rx;
> 	rte_pmd_ixgbe_set_vf_rxmode;
> 	rte_pmd_ixgbe_set_vf_tx;
> 	rte_pmd_ixgbe_set_vf_vlan_filter;
So, seems better to use the current names. Rework both ixgbe and i40e's later. Not sure if it'll be counted as the ABI change if we change the ixgbe's name.

> 
> Regards,
> 
> Bernard.

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-20 15:18                 ` Vincent JARDIN
  2016-12-20 15:31                   ` Ferruh Yigit
@ 2016-12-22  8:10                   ` Chen, Jing D
  2016-12-22 13:46                     ` Vincent JARDIN
  1 sibling, 1 reply; 125+ messages in thread
From: Chen, Jing D @ 2016-12-22  8:10 UTC (permalink / raw)
  To: Vincent JARDIN, Thomas Monjalon
  Cc: dev, Yigit, Ferruh, Wu, Jingjing, Zhang, Helin

Hi, Vincent,

> -----Original Message-----
> From: Vincent JARDIN [mailto:vincent.jardin@6wind.com]
> Sent: Tuesday, December 20, 2016 11:19 PM
> To: Chen, Jing D <jing.d.chen@intel.com>; Thomas Monjalon
> <thomas.monjalon@6wind.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Zhang, Helin <helin.zhang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on
> i40e
> 
> Le 20/12/2016 à 05:48, Chen, Jing D a écrit :
> > That's a collaboration with another team. we'll follow-up that but not guarantee
> > it will happen.
> > May I ask if my reply make it clear? Still NAC for this patch?
> 
> Yes still nack, I am not confident with this PF approach since you are
> breaking Linux PF behavior. It does not provide guarantees with PF.
> Something is missing to guarantee the compatibilities.

Let me introduce the rationale of API between PF and VF.

There is a common head file visible to both PF and VF, which includes a set of command
and data structures, which is managed by a version number. Below is an example.

Major_verion=1
Minor_verion=1
enum i40e_virtchnl_ops {
	CMD_GET_VERSION,
	CMD_RESET_VF,
	......
}

struct i40e_virtchnl_version_info {
	u32 major;
	u32 minor;
};
......

So, both PF and VF strictly follow the spec. VF send request with expected command and 
data structures to PF host. PF do sanity check and configure, finally applied to HW. 

As developing the code, it's possible to have multiple version of API occurred with 'major_verion'
or 'minor_version' changed. So, at the initialization stage, VF and PF will use a command 
'CMD_GET_VERSION' to negotiate what language (what version of API) they should use
and setup conversation. 

So, from my perspective, there is no issue here.

In the meanwhile, we have some test models ongoing to validate combination of Linux and 
DPDK drivers for VF and PF. We'll fully support below 4 cases going forward.
1. DPDK PF + DPDK VF 
2. DPDK PF + Linux VF
3. Linux PF + DPDK VF 
4. Linux PF + Linux VF (it's not our scope)

After applied this patch, i've done below test without observing compatibility issue.
1. DPDK PF + DPDK VF (middle of 16.11 and 17.02 code base). PF to support API 1.0 while VF
    to support API 1.1/1.0	
2. DPDK PF + Linux VF 1.5.14. PF to support 1.0, while Linux to support 1.1/1.0

Linux PF + DPDK VF has been tested with 1.0 API long time ago. There is some test activities
ongoing.

Finally, please give strong reasons to support your NAC.

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-22  8:10                   ` Chen, Jing D
@ 2016-12-22 13:46                     ` Vincent JARDIN
  2016-12-26 11:59                       ` Chen, Jing D
  0 siblings, 1 reply; 125+ messages in thread
From: Vincent JARDIN @ 2016-12-22 13:46 UTC (permalink / raw)
  To: Chen, Jing D
  Cc: Thomas Monjalon, dev, Yigit, Ferruh, Wu, Jingjing, Zhang, Helin

Le 22/12/2016 à 09:10, Chen, Jing D a écrit :
> In the meanwhile, we have some test models ongoing to validate combination of Linux and
> DPDK drivers for VF and PF. We'll fully support below 4 cases going forward.
> 1. DPDK PF + DPDK VF
> 2. DPDK PF + Linux VF

+ DPDK PF + FreeBSD VF
+ DPDK PF + Windows VF
+ DPDK PF + OS xyz VF

> 3. Linux PF + DPDK VF
> 4. Linux PF + Linux VF (it's not our scope)

So, you confirm the issue: having DPDK becoming a PF, even if SRIOV 
protocol includes version-ing, it doubles the combinatory cases.

>
> After applied this patch, i've done below test without observing compatibility issue.
> 1. DPDK PF + DPDK VF (middle of 16.11 and 17.02 code base). PF to support API 1.0 while VF
>     to support API 1.1/1.0	
> 2. DPDK PF + Linux VF 1.5.14. PF to support 1.0, while Linux to support 1.1/1.0
>
> Linux PF + DPDK VF has been tested with 1.0 API long time ago. There is some test activities
> ongoing.
>
> Finally, please give strong reasons to support your NAC.

I feel bad because I do recognize the strong and hard work that you have 
done on this PF development, but I feel we need first to assess if DPDK 
should become a PF or not. I know ixgbe did open the path and that they 
are some historical DPDK PF supports in Intel NICs, but before we 
generalize it, we have to make sure we are not turning this DataPlane 
development Kit into a ControlPlane Driver Kit that we are scared to 
upstream into Linux kernel. Even if "DPDK is not Linux", it does not 
mean that Linux should be ignored. In case of DPDK on other OS, same, 
their PF could be extended too.

So currently, yes, I do keep a nack't

Since DPDK PF features can be into Linux PF features too and since Linux 
(and other hypervisors) has already some tools to manage PF (see 
iproute2, etc.), why should we have an other management path with DPDK? 
DPDK is aimed to be a Dataplane Development kit, not a 
management/control plane driver kit.

Assuming you want to use DPDK PF for dataplane feature, that could be OK 
then, using:
   - configure one VF on the hypervisor from Linux's PF, let's name if 
VF_forPFtraffic, see http://dpdk.org/doc/guides/howto/flow_bifurcation.html
   - have no (or few IO)s to the PF's queue
   - assign the traffic to all VF_forPFtraffic's queues of the hypervisor,
   - run DPDK into the hypervisor's VF_forPFtraffic

Doing so, we get the same benefit of running DPDK over PF or running 
DPDK over VF_forPFtraffic, don't we? It is a benefit of:
   http://dpdk.org/doc/guides/howto/flow_bifurcation.html

Thank you,
   Vincent

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

* Re: [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
  2016-12-21  0:56           ` Lu, Wenzhuo
@ 2016-12-22 16:38             ` Iremonger, Bernard
  0 siblings, 0 replies; 125+ messages in thread
From: Iremonger, Bernard @ 2016-12-22 16:38 UTC (permalink / raw)
  To: Lu, Wenzhuo, Yigit, Ferruh, dev
  Cc: Wu, Jingjing, Zhang, Helin, Zhang, Qi Z, Chen, Jing D, Iremonger,
	Bernard



> -----Original Message-----
> From: Lu, Wenzhuo
> Sent: Wednesday, December 21, 2016 12:56 AM
> To: Iremonger, Bernard <bernard.iremonger@intel.com>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Helin
> <helin.zhang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Chen, Jing D
> <jing.d.chen@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
> 
> Hi all,
> 
> 
> > -----Original Message-----
> > From: Iremonger, Bernard
> > Sent: Tuesday, December 20, 2016 9:40 PM
> > To: Yigit, Ferruh; dev@dpdk.org
> > Cc: Wu, Jingjing; Zhang, Helin; Zhang, Qi Z; Lu, Wenzhuo; Chen, Jing D
> > Subject: RE: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats
> > from PF
> >
> > Hi Ferruh,
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> > > Sent: Tuesday, December 20, 2016 1:25 PM
> > > To: dev@dpdk.org
> > > Cc: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Helin
> > > <helin.zhang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Lu,
> > > Wenzhuo <wenzhuo.lu@intel.com>; Chen, Jing D
> <jing.d.chen@intel.com>
> > > Subject: Re: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF
> > > stats from PF
> > >
> > > On 12/16/2016 7:02 PM, Ferruh Yigit wrote:
> > > > 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>
> > > > ---
> > >
> > > <...>
> > >
> > > > diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map
> > > > b/drivers/net/i40e/rte_pmd_i40e_version.map
> > > > index 8ac1bc8..7a5d211 100644
> > > > --- a/drivers/net/i40e/rte_pmd_i40e_version.map
> > > > +++ b/drivers/net/i40e/rte_pmd_i40e_version.map
> > > > @@ -6,7 +6,9 @@ DPDK_2.0 {
> > > >  DPDK_17.02 {
> > > >  	global:
> > > >
> > > > +	rte_pmd_i40e_get_vf_stats;
> > > >  	rte_pmd_i40e_ping_vfs;
> > > > +	rte_pmd_i40e_reset_vf_stats;
> > > >  	rte_pmd_i40e_set_tx_loopback;
> > > >  	rte_pmd_i40e_set_vf_broadcast;
> > > >  	rte_pmd_i40e_set_vf_mac_addr;
> > >
> > > Hi Wenzhuo, Mark,
> > >
> > > I think this is the list of all APIs added with this patchset.
> > >
> > > Just a question, what do you think following a logic in API naming as:
> > > <name_space>_<object>_<action> ?
> > >
> > > So API names become:
> > > rte_pmd_i40e_tx_loopback_set;
> > > rte_pmd_i40e_vf_broadcast_set;
> > > rte_pmd_i40e_vf_mac_addr_set;
> > > rte_pmd_i40e_vfs_ping;
> > > rte_pmd_i40e_vf_stats_get;
> > > rte_pmd_i40e_vf_stats_reset;
> > >
> > >
> > > After above rename, rte_pmd_i40e_tx_loopback_set() is not giving a
> > > hint that this is something related to the PF controlling VF,
> > > perhaps we can rename the API ?
> > >
> > > Also rte_pmd_i40e_vfs_ping() can become rte_pmd_i40e_vf_ping_all()
> > > to be more consistent about _vf_ usage.
> > >
> > > Overall, they can be something like:
> > > rte_pmd_i40e_vf_broadcast_set;
> > > rte_pmd_i40e_vf_mac_addr_set;
> > > rte_pmd_i40e_vf_ping_all;
> > > rte_pmd_i40e_vf_stats_get;
> > > rte_pmd_i40e_vf_stats_reset;
> > > rte_pmd_i40e_vf_tx_loopback_set;
> > >
> > > What do you think?
> > >
> >
> > I think the naming should be consistent with what has already been
> > implemented for the ixgbe PMD.
> > 	rte_pmd_ixgbe_set_all_queues_drop_en;
> > 	rte_pmd_ixgbe_set_tx_loopback;
> > 	rte_pmd_ixgbe_set_vf_mac_addr;
> > 	rte_pmd_ixgbe_set_vf_mac_anti_spoof;
> > 	rte_pmd_ixgbe_set_vf_split_drop_en;
> > 	rte_pmd_ixgbe_set_vf_vlan_anti_spoof;
> > 	rte_pmd_ixgbe_set_vf_vlan_insert;
> > 	rte_pmd_ixgbe_set_vf_vlan_stripq;
> >
> > 	rte_pmd_ixgbe_set_vf_rate_limit;
> > 	rte_pmd_ixgbe_set_vf_rx;
> > 	rte_pmd_ixgbe_set_vf_rxmode;
> > 	rte_pmd_ixgbe_set_vf_tx;
> > 	rte_pmd_ixgbe_set_vf_vlan_filter;
> So, seems better to use the current names. Rework both ixgbe and i40e's
> later. Not sure if it'll be counted as the ABI change if we change the ixgbe's
> name.
> 

A similar naming convention was used originally in the ethdev:
rte_eth_dev_set_vf_rxmode
rte_eth_dev_set_vf_rx
rte_eth_dev_set_vf_tx
rte_eth_dev_set_vf_vlan_filter
rte_eth_dev_set_vf_rate_limit

rte_eth_dev has just been replaced with rte_pmd_<ixgbe|i40e>

Regards,

Bernard.

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-22 13:46                     ` Vincent JARDIN
@ 2016-12-26 11:59                       ` Chen, Jing D
  2017-01-04 21:09                         ` Scott Daniels
  0 siblings, 1 reply; 125+ messages in thread
From: Chen, Jing D @ 2016-12-26 11:59 UTC (permalink / raw)
  To: Vincent JARDIN
  Cc: Thomas Monjalon, dev, Yigit, Ferruh, Wu, Jingjing, Zhang, Helin

Vincent,

Sorry, I missed this reply.

> 
> Le 22/12/2016 à 09:10, Chen, Jing D a écrit :
> > In the meanwhile, we have some test models ongoing to validate
> > combination of Linux and DPDK drivers for VF and PF. We'll fully support
> below 4 cases going forward.
> > 1. DPDK PF + DPDK VF
> > 2. DPDK PF + Linux VF
> 
> + DPDK PF + FreeBSD VF
> + DPDK PF + Windows VF
> + DPDK PF + OS xyz VF
> 

If all drivers follow same API spec, what's the problem here?
What extra DPDK PF effort you observed?

> > 3. Linux PF + DPDK VF
> > 4. Linux PF + Linux VF (it's not our scope)
> 
> So, you confirm the issue: having DPDK becoming a PF, even if SRIOV protocol
> includes version-ing, it doubles the combinatory cases.

If extended functions are needed, the answer is yes.
That's not a big problem, right? I have several workarounds/approaches to
support extended funcs while following original API spec. I can fix it in this
release. In order to have a mature solution, I left it here for further implementation.

> 
> >
> > After applied this patch, i've done below test without observing
> compatibility issue.
> > 1. DPDK PF + DPDK VF (middle of 16.11 and 17.02 code base). PF to support
> API 1.0 while VF
> >     to support API 1.1/1.0
> > 2. DPDK PF + Linux VF 1.5.14. PF to support 1.0, while Linux to
> > support 1.1/1.0
> >
> > Linux PF + DPDK VF has been tested with 1.0 API long time ago. There
> > is some test activities ongoing.
> >
> > Finally, please give strong reasons to support your NAC.
> 
> I feel bad because I do recognize the strong and hard work that you have done
> on this PF development, but I feel we need first to assess if DPDK should
> become a PF or not. I know ixgbe did open the path and that they are some
> historical DPDK PF supports in Intel NICs, but before we generalize it, we have
> to make sure we are not turning this DataPlane development Kit into a
> ControlPlane Driver Kit that we are scared to upstream into Linux kernel. Even
> if "DPDK is not Linux", it does not mean that Linux should be ignored. In case
> of DPDK on other OS, same, their PF could be extended too.
> 

Thanks for the recognition of our work on PF driver. :)

> So currently, yes, I do keep a nack't
> 
> Since DPDK PF features can be into Linux PF features too and since Linux (and
> other hypervisors) has already some tools to manage PF (see iproute2, etc.),
> why should we have an other management path with DPDK?
> DPDK is aimed to be a Dataplane Development kit, not a management/control
> plane driver kit.

Before we debated on Dataplane and ControPlane, can you answer me a question,
why we have generic filter API? Is it a API for dataplane?

I can't imagine that we'll have to say 'you need to use Linux PF' driver when users
want to deploy PF + VF cases. Why we can't provide an alternative option. they are not
exclusive and users can decide which combination is better for them. 
The reason why we developed DPDK PF host driver is we have requirements from
users. Our motivation is simple, there are requirements, we satisfy them.

Sorry, you NACK can't convince me.

> 
> Assuming you want to use DPDK PF for dataplane feature, that could be OK
> then, using:
>    - configure one VF on the hypervisor from Linux's PF, let's name if
> VF_forPFtraffic, see http://dpdk.org/doc/guides/howto/flow_bifurcation.html
>    - have no (or few IO)s to the PF's queue
>    - assign the traffic to all VF_forPFtraffic's queues of the hypervisor,
>    - run DPDK into the hypervisor's VF_forPFtraffic
> 
> Doing so, we get the same benefit of running DPDK over PF or running DPDK
> over VF_forPFtraffic, don't we? It is a benefit of:
>    http://dpdk.org/doc/guides/howto/flow_bifurcation.html
> 
> Thank you,
>    Vincent
> 

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2016-12-26 11:59                       ` Chen, Jing D
@ 2017-01-04 21:09                         ` Scott Daniels
  2017-01-10 13:29                           ` Vincent JARDIN
  0 siblings, 1 reply; 125+ messages in thread
From: Scott Daniels @ 2017-01-04 21:09 UTC (permalink / raw)
  To: dev; +Cc: jing.d.chen at intel.com,vincent.jardin, kaustubh, az5157

 > Vincent,
 >
 > Sorry, I missed this reply.
 >
 >>
 >> Le 22/12/2016 à 09:10, Chen, Jing D a écrit :
 >> > In the meanwhile, we have some test models ongoing to validate
 >> > combination of Linux and DPDK drivers for VF and PF. We'll fully 
support
 >> below 4 cases going forward.
 >> > 1. DPDK PF + DPDK VF
 >> > 2. DPDK PF + Linux VF
 >>
 >> + DPDK PF + FreeBSD VF
 >> + DPDK PF + Windows VF
 >> + DPDK PF + OS xyz VF
 >>
 >
 > If all drivers follow same API spec, what's the problem here?
 > What extra DPDK PF effort you observed?
 >
 >> > 3. Linux PF + DPDK VF
 >> > 4. Linux PF + Linux VF (it's not our scope)
 >>
 >> So, you confirm the issue: having DPDK becoming a PF, even if SRIOV 
protocol
 >> includes version-ing, it doubles the combinatory cases.
 >
 > If extended functions are needed, the answer is yes.
 > That's not a big problem, right? I have several workarounds/approaches to
 > support extended funcs while following original API spec. I can fix 
it in this
 > release. In order to have a mature solution, I left it here for 
further implementation.
 >
 >>
 >> >
 >> > After applied this patch, i've done below test without observing
 >> compatibility issue.
 >> > 1. DPDK PF + DPDK VF (middle of 16.11 and 17.02 code base). PF to 
support
 >> API 1.0 while VF
 >> >     to support API 1.1/1.0
 >> > 2. DPDK PF + Linux VF 1.5.14. PF to support 1.0, while Linux to
 >> > support 1.1/1.0
 >> >
 >> > Linux PF + DPDK VF has been tested with 1.0 API long time ago. There
 >> > is some test activities ongoing.
 >> >
 >> > Finally, please give strong reasons to support your NAC.
 >>
 >> I feel bad because I do recognize the strong and hard work that you 
have done
 >> on this PF development, but I feel we need first to assess if DPDK 
should
 >> become a PF or not. I know ixgbe did open the path and that they are 
some
 >> historical DPDK PF supports in Intel NICs, but before we generalize 
it, we have
 >> to make sure we are not turning this DataPlane development Kit into a
 >> ControlPlane Driver Kit that we are scared to upstream into Linux 
kernel. Even
 >> if "DPDK is not Linux", it does not mean that Linux should be 
ignored. In case
 >> of DPDK on other OS, same, their PF could be extended too.
 >>
 >
 > Thanks for the recognition of our work on PF driver. :)
 >
 >> So currently, yes, I do keep a nack't
 >>
 >> Since DPDK PF features can be into Linux PF features too and since 
Linux (and
 >> other hypervisors) has already some tools to manage PF (see 
iproute2, etc.),
 >> why should we have an other management path with DPDK?
 >> DPDK is aimed to be a Dataplane Development kit, not a 
management/control
 >> plane driver kit.
 >
 > Before we debated on Dataplane and ControPlane, can you answer me a 
question,
 > why we have generic filter API? Is it a API for dataplane?
 >
 > I can't imagine that we'll have to say 'you need to use Linux PF' 
driver when users
 > want to deploy PF + VF cases. Why we can't provide an alternative 
option. they are not
 > exclusive and users can decide which combination is better for them.
 > The reason why we developed DPDK PF host driver is we have 
requirements from
 > users. Our motivation is simple, there are requirements, we satisfy them.
 >
 > Sorry, you NACK can't convince me.
 >
 >>
 >> Assuming you want to use DPDK PF for dataplane feature, that could be OK
 >> then, using:
 >>    - configure one VF on the hypervisor from Linux's PF, let's name if
 >> VF_forPFtraffic, see 
http://dpdk.org/doc/guides/howto/flow_bifurcation.html
 >>    - have no (or few IO)s to the PF's queue
 >>    - assign the traffic to all VF_forPFtraffic's queues of the 
hypervisor,
 >>    - run DPDK into the hypervisor's VF_forPFtraffic
 >>
 >> Doing so, we get the same benefit of running DPDK over PF or running 
DPDK
 >> over VF_forPFtraffic, don't we? It is a benefit of:
 >>    http://dpdk.org/doc/guides/howto/flow_bifurcation.html
 >>
 >> Thank you,
 >>    Vincent
 >>

  With holidays we are a bit late with our thoughts, but would like to
  toss them into the mix.

  The original NAK is understandable, however having the ability to
  configure the PF via DPDK is advantageous for several reasons:

  1) While some functions may be duplicated and/or available from the kernel
  driver, it is often not possible to introduce new kernel drivers into
  production without a large amount of additional testing of the entire
  platform which can cause a significant delay when introducing a DPDK based
  product.  If the PF control is a part of the DPDK environment, then only
  the application needs to pass the operational testing before deployment; a
  much more simple task.

  2) If the driver changes are upstreamed into the kernel proper, the
  difficulty of operational readiness testing increases as a new kernel is
  introduced, and further undermines the ability to quickly and easily
  release a DPDK based application into production.  While the application
  may eventually fall back on driver and/or kernel support, this could be
  years away.

  3) As DPDK is being used to configure the NIC, it just seems to make
  sense, for consistency, that the configuration capabilities should include
  the ability to configure the PF as is proposed.


  We are currently supporting/enhancing one such DPDK application to
  manage PF and VFs of which the VFs are exposed as SR-IOV devices to 
guests:
  https://github.com/att/vfd/wiki.  As new NICs become available the ability
  to transition to them is important to DPDK users.


  Collectively,
  Scott Daniels,
  Alex Zelezniak,
  Kaustubh Joshi

------------------------------------------------------------------------
E. Scott Daniels
Cloud Software Research
AT&T Labs
daniels at research.att.com

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2017-01-04 21:09                         ` Scott Daniels
@ 2017-01-10 13:29                           ` Vincent JARDIN
  2017-01-12  3:47                             ` Chen, Jing D
  0 siblings, 1 reply; 125+ messages in thread
From: Vincent JARDIN @ 2017-01-10 13:29 UTC (permalink / raw)
  To: Scott Daniels, dev; +Cc: kaustubh, az5157, Chen, Jing D

Hi Scott,

Le 04/01/2017 à 22:09, Scott Daniels a écrit :
>  With holidays we are a bit late with our thoughts, but would like to
>  toss them into the mix.

Same, I hope I am not missing emails. I do appreciate your arguments, it 
provides lot of light. See below,

>  The original NAK is understandable, however having the ability to
>  configure the PF via DPDK is advantageous for several reasons:
>
>  1) While some functions may be duplicated and/or available from the kernel
>  driver, it is often not possible to introduce new kernel drivers into
>  production without a large amount of additional testing of the entire
>  platform which can cause a significant delay when introducing a DPDK based
>  product.  If the PF control is a part of the DPDK environment, then only
>  the application needs to pass the operational testing before deployment; a
>  much more simple task.

So we agree: you confirm that your foresee the benefits of using DPDK to 
*bypass the role of the Kernel being the PF* of reference for the 
hypervisor.

>  2) If the driver changes are upstreamed into the kernel proper, the
>  difficulty of operational readiness testing increases as a new kernel is
>  introduced, and further undermines the ability to quickly and easily
>  release a DPDK based application into production.  While the application
>  may eventually fall back on driver and/or kernel support, this could be
>  years away.

I do agree with the benefits of the agilities and the upsides it brings. 
But they are other options to get the same agility without creating a 
fragmentation of PFs.

For example, you do not have to update the whole kernel, you can just 
update the PF kernel module that can be upgraded with the latest needed 
features.

>  3) As DPDK is being used to configure the NIC, it just seems to make
>  sense, for consistency, that the configuration capabilities should include
>  the ability to configure the PF as is proposed.

 From this perspective, the kernel modules are fine for the PF: most 
kernels of hypervisors support it without the need to upgrade their kernels.

To summarize, I understand that you need a flexible way to upgrade PF 
features without touching/changing the kernel. So let's check the kernel 
module option? VFD brings some interesting capabilities, could it be a 
way to push and stimulate the i40e features instead of using DPDK?

   https://sourceforge.net/projects/e1000/files/i40e%20stable/
for instance could be better stimulated.

Best regards,
   Vincent

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2017-01-10 13:29                           ` Vincent JARDIN
@ 2017-01-12  3:47                             ` Chen, Jing D
  2017-01-13 23:04                               ` John Fastabend
  0 siblings, 1 reply; 125+ messages in thread
From: Chen, Jing D @ 2017-01-12  3:47 UTC (permalink / raw)
  To: Vincent JARDIN, Scott Daniels, dev; +Cc: kaustubh, az5157

Hi, Vincent,

> -----Original Message-----
> From: Vincent JARDIN [mailto:vincent.jardin@6wind.com]
> Sent: Tuesday, January 10, 2017 9:30 PM
> To: Scott Daniels <daniels@research.att.com>; dev@dpdk.org
> Cc: kaustubh@research.att.com; az5157@att.com; Chen, Jing D
> <jing.d.chen@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on
> i40e
> 
> Hi Scott,
> 
> Le 04/01/2017 à 22:09, Scott Daniels a écrit :
> >  With holidays we are a bit late with our thoughts, but would like to
> >  toss them into the mix.
> 
> Same, I hope I am not missing emails. I do appreciate your arguments, it
> provides lot of light. See below,
> 
> >  The original NAK is understandable, however having the ability to
> >  configure the PF via DPDK is advantageous for several reasons:
> >
> >  1) While some functions may be duplicated and/or available from the kernel
> >  driver, it is often not possible to introduce new kernel drivers into
> >  production without a large amount of additional testing of the entire
> >  platform which can cause a significant delay when introducing a DPDK based
> >  product.  If the PF control is a part of the DPDK environment, then only
> >  the application needs to pass the operational testing before deployment; a
> >  much more simple task.
> 
> So we agree: you confirm that your foresee the benefits of using DPDK to
> *bypass the role of the Kernel being the PF* of reference for the
> hypervisor.
> 
> >  2) If the driver changes are upstreamed into the kernel proper, the
> >  difficulty of operational readiness testing increases as a new kernel is
> >  introduced, and further undermines the ability to quickly and easily
> >  release a DPDK based application into production.  While the application
> >  may eventually fall back on driver and/or kernel support, this could be
> >  years away.
> 
> I do agree with the benefits of the agilities and the upsides it brings.
> But they are other options to get the same agility without creating a
> fragmentation of PFs.
> 
> For example, you do not have to update the whole kernel, you can just
> update the PF kernel module that can be upgraded with the latest needed
> features.
> 
> >  3) As DPDK is being used to configure the NIC, it just seems to make
> >  sense, for consistency, that the configuration capabilities should include
> >  the ability to configure the PF as is proposed.
> 
>  From this perspective, the kernel modules are fine for the PF: most
> kernels of hypervisors support it without the need to upgrade their kernels.
> 
> To summarize, I understand that you need a flexible way to upgrade PF
> features without touching/changing the kernel. So let's check the kernel
> module option? VFD brings some interesting capabilities, could it be a
> way to push and stimulate the i40e features instead of using DPDK?
> 
>    https://sourceforge.net/projects/e1000/files/i40e%20stable/
> for instance could be better stimulated.

May I ask what if DPDK VF need a new extension function from PF?
Then, we'll have to build kernel community expertise and submit
patch to Linux PF and wait for merge.
Your proposal indicates DPDK community submitters will have to
ask Linux community to authorize if we'll have any requirements
in DPDK VF.
Comparing fragmentation, the extra dependency worry me most.
Can you imagine how long it will be for any VF features gets
ready?  



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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2017-01-12  3:47                             ` Chen, Jing D
@ 2017-01-13 23:04                               ` John Fastabend
  2017-01-13 23:49                                 ` JOSHI, KAUSTUBH  (KAUSTUBH)
  2017-01-16  9:32                                 ` Thomas Monjalon
  0 siblings, 2 replies; 125+ messages in thread
From: John Fastabend @ 2017-01-13 23:04 UTC (permalink / raw)
  To: Chen, Jing D, Vincent JARDIN, Scott Daniels, dev
  Cc: kaustubh, az5157, Fastabend, John R

On 17-01-11 07:47 PM, Chen, Jing D wrote:
> Hi, Vincent,
> 
>> -----Original Message-----
>> From: Vincent JARDIN [mailto:vincent.jardin@6wind.com]
>> Sent: Tuesday, January 10, 2017 9:30 PM
>> To: Scott Daniels <daniels@research.att.com>; dev@dpdk.org
>> Cc: kaustubh@research.att.com; az5157@att.com; Chen, Jing D
>> <jing.d.chen@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on
>> i40e
>>
>> Hi Scott,
>>
>> Le 04/01/2017 à 22:09, Scott Daniels a écrit :
>>>  With holidays we are a bit late with our thoughts, but would like to
>>>  toss them into the mix.
>>
>> Same, I hope I am not missing emails. I do appreciate your arguments, it
>> provides lot of light. See below,
>>
>>>  The original NAK is understandable, however having the ability to
>>>  configure the PF via DPDK is advantageous for several reasons:
>>>
>>>  1) While some functions may be duplicated and/or available from the kernel
>>>  driver, it is often not possible to introduce new kernel drivers into
>>>  production without a large amount of additional testing of the entire
>>>  platform which can cause a significant delay when introducing a DPDK based
>>>  product.  If the PF control is a part of the DPDK environment, then only
>>>  the application needs to pass the operational testing before deployment; a
>>>  much more simple task.
>>
>> So we agree: you confirm that your foresee the benefits of using DPDK to
>> *bypass the role of the Kernel being the PF* of reference for the
>> hypervisor.
>>
>>>  2) If the driver changes are upstreamed into the kernel proper, the
>>>  difficulty of operational readiness testing increases as a new kernel is
>>>  introduced, and further undermines the ability to quickly and easily
>>>  release a DPDK based application into production.  While the application
>>>  may eventually fall back on driver and/or kernel support, this could be
>>>  years away.
>>
>> I do agree with the benefits of the agilities and the upsides it brings.
>> But they are other options to get the same agility without creating a
>> fragmentation of PFs.
>>
>> For example, you do not have to update the whole kernel, you can just
>> update the PF kernel module that can be upgraded with the latest needed
>> features.
>>
>>>  3) As DPDK is being used to configure the NIC, it just seems to make
>>>  sense, for consistency, that the configuration capabilities should include
>>>  the ability to configure the PF as is proposed.
>>
>>  From this perspective, the kernel modules are fine for the PF: most
>> kernels of hypervisors support it without the need to upgrade their kernels.
>>
>> To summarize, I understand that you need a flexible way to upgrade PF
>> features without touching/changing the kernel. So let's check the kernel
>> module option? VFD brings some interesting capabilities, could it be a
>> way to push and stimulate the i40e features instead of using DPDK?
>>
>>    https://sourceforge.net/projects/e1000/files/i40e%20stable/
>> for instance could be better stimulated.
> 

I figured I would weight in with my $0.02.

> May I ask what if DPDK VF need a new extension function from PF?
> Then, we'll have to build kernel community expertise and submit
> patch to Linux PF and wait for merge.

Correct, but it is the same story on DPDK repository as well. Either
way patch must be generated, tested, submitted and wait until it is
merged. At this point I think even the code is very similar sans
style and naming conventions for these types of features.

> Your proposal indicates DPDK community submitters will have to
> ask Linux community to authorize if we'll have any requirements
> in DPDK VF.

I don't think this is really much of a problem in most cases the same
company maintains both DPDK and Linux kernel drivers so hopefully
everyone is aligned.

> Comparing fragmentation, the extra dependency worry me most.
> Can you imagine how long it will be for any VF features gets
> ready?  
> 
> 

The Linux kernel releases every 6-8 weeks roughly depending on the
release. In networking stack land features must be submitted for
that kernel release before the first RC release.

So although there may be benefits to pushing these features into
DPDK vs Linux kernel I don't think actually getting the code in
the kernel is one of them.

To the point above about out of tree drivers. Most vendors do keep
out of tree drivers with the latest features and fixes that can be
supported on older kernels. Unfortunately, many of the interfaces
like the type mentioned here would require kernel updates outside
the drivers to add message handlers and driver callbacks for the
new config messages. So it may not be viable at least unless we
restructure some of the kernel to use out of tree drivers in the
short term.

So I'm sympathetic to argument (1) here. If _not_ updating the
kernel is a hard requirement then we are a bit stuck from using
existing/future Linux features. Further this is sort of a rolling
problem as well. Today we are missing feature X and we add it and
tomorrow we are missing a new feature Y. So if the feature list
is not stable with deployment of new kernels its a bit hard to
see how the Linux kernel PF model works without above mentioned
restructuring.  FWIW traditionally the Linux vendors handled this
backporting for its customers and provide kernel updates using
apt-get/dnf/whatever along with all the sanity testing to ensure
they didn't break something along the way. We are slowly getting
over this with work in BPF and other subsystems but the VF
configuration is still very much hard coded for the moment. I might
try to fix this though as a result of this thread.

Open question for me on this though is the PF in these SRIOV cases
ever being used by DPDK datapath or is it just being leveraged for
configuration with primarily control traffic?

So my take away from this is arguments about its not available in Linux
kernel are not really good ones because its easy enough to add and
get in stable kernels. But if kernel updates are a challenge then
we either need a more robust kernel backporting and out of tree
driver effort _or_ push them directly into PF driver of DPDK. I think
longterm we can fix this in the kernel with some restructuring and
better module updates but in the short term DPDK PMD updates seem
to be the only option.

I do think though if this gets pushed into DPDK PMD we shouldn't let
the PF Linux driver simply not support the new mailbox messages. This
will create one more dependency then I care to worry about. VF<->PF
mailbox should work with any combination of VF and PF as long as
version requirements are met. I think vendor maintainers can
manage this.

I'll comment on the specific features in another email because it
is helpful to have a list in public mailing list with features folks
are interested in. Any chance we could get a page up with a list
of all these and where/when we expect support for them?

Thanks,
John

john.r.fastabend@intel.com

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2017-01-13 23:04                               ` John Fastabend
@ 2017-01-13 23:49                                 ` JOSHI, KAUSTUBH  (KAUSTUBH)
  2017-01-15 23:32                                   ` Vincent JARDIN
  2017-01-16 11:42                                   ` Ferruh Yigit
  2017-01-16  9:32                                 ` Thomas Monjalon
  1 sibling, 2 replies; 125+ messages in thread
From: JOSHI, KAUSTUBH  (KAUSTUBH) @ 2017-01-13 23:49 UTC (permalink / raw)
  To: John Fastabend
  Cc: Chen, Jing D, Vincent JARDIN, DANIELS, EDWARD S (EDWARD),
	dev, ZELEZNIAK, ALEX, Fastabend, John R

John,

Thanks for comments. To answer a specific question you raised:

> Open question for me on this though is the PF in these SRIOV cases
> ever being used by DPDK datapath or is it just being leveraged for
> configuration with primarily control traffic?

In our case, the answer is yes. We intend to use the PF through DPDK to house a high speed packet mirror function for capturing packet traces from VFs (for ops etc). 

However, in theory, this *can* be done through an extra VF as well, so I didn't bring up that particular point as being a deciding factor in this debate. 

> On Jan 13, 2017, at 6:04 PM, John Fastabend <john.fastabend@gmail.com> wrote:
> 
> Open question for me on this though is the PF in these SRIOV cases
> ever being used by DPDK datapath or is it just being leveraged for
> configuration with primarily control traffic?

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2017-01-13 23:49                                 ` JOSHI, KAUSTUBH  (KAUSTUBH)
@ 2017-01-15 23:32                                   ` Vincent JARDIN
  2017-01-16 11:42                                   ` Ferruh Yigit
  1 sibling, 0 replies; 125+ messages in thread
From: Vincent JARDIN @ 2017-01-15 23:32 UTC (permalink / raw)
  To: JOSHI, KAUSTUBH (KAUSTUBH), John Fastabend
  Cc: Chen, Jing D, DANIELS, EDWARD S (EDWARD),
	dev, ZELEZNIAK, ALEX, Fastabend, John R, Ferruh Yigit

Thanks John for the kernel support. I'd like to add one thought on this 
need from Joshi:

> Also, the kernel drivers have no concept of passing VF messages to upstream "decision making” (or policy enforcement) software like VFd.

It shall be possible to define some Netlink or policy management 
messages over the PF, so a userland process can police and provide the 
"decision making" in a standard way that would be generic.

Joshi,

John is confirming that the kernel path is possible. Please, if you see 
other requirements, keep listing them.

Le 14/01/2017 à 00:49, JOSHI, KAUSTUBH  (KAUSTUBH) a écrit :
> However, in theory, this *can* be done through an extra VF as well, so I didn't bring up that particular point as being a deciding factor in this debate.

It remains an important item: it shows that thru the kernel, all 
technical requirements are manageable, including the steering of traffic.

I'll continue the comments on the patch on the v9's thread.
   http://dpdk.org/ml/archives/dev/2017-January/054953.html

Best regards,
   Vincent

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2017-01-13 23:04                               ` John Fastabend
  2017-01-13 23:49                                 ` JOSHI, KAUSTUBH  (KAUSTUBH)
@ 2017-01-16  9:32                                 ` Thomas Monjalon
  1 sibling, 0 replies; 125+ messages in thread
From: Thomas Monjalon @ 2017-01-16  9:32 UTC (permalink / raw)
  To: Fastabend, John R
  Cc: dev, John Fastabend, Chen, Jing D, Vincent JARDIN, Scott Daniels,
	kaustubh, az5157

2017-01-13 15:04, John Fastabend:
> I'll comment on the specific features in another email because it
> is helpful to have a list in public mailing list with features folks
> are interested in. Any chance we could get a page up with a list
> of all these and where/when we expect support for them?

There could be a support matrix of features with each driver (DPDK and Linux)
in this doc:
	http://dpdk.org/doc/guides/nics/intel_vf.html

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

* Re: [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
  2017-01-13 23:49                                 ` JOSHI, KAUSTUBH  (KAUSTUBH)
  2017-01-15 23:32                                   ` Vincent JARDIN
@ 2017-01-16 11:42                                   ` Ferruh Yigit
  1 sibling, 0 replies; 125+ messages in thread
From: Ferruh Yigit @ 2017-01-16 11:42 UTC (permalink / raw)
  To: JOSHI, KAUSTUBH (KAUSTUBH), John Fastabend
  Cc: Chen, Jing D, Vincent JARDIN, DANIELS, EDWARD S (EDWARD),
	dev, ZELEZNIAK, ALEX, Fastabend, John R

On 1/13/2017 11:49 PM, JOSHI, KAUSTUBH  (KAUSTUBH) wrote:
> John,
> 
> Thanks for comments. To answer a specific question you raised:
> 
>> Open question for me on this though is the PF in these SRIOV cases
>> ever being used by DPDK datapath or is it just being leveraged for
>> configuration with primarily control traffic?
> 
> In our case, the answer is yes. We intend to use the PF through DPDK to house a high speed packet mirror function for capturing packet traces from VFs (for ops etc). 
> 
> However, in theory, this *can* be done through an extra VF as well, so I didn't bring up that particular point as being a deciding factor in this debate.

Is it valid use case to run DPDK enabled virtual switch on PF?
I believe this is something you can't move to an extra VF?

> 
>> On Jan 13, 2017, at 6:04 PM, John Fastabend <john.fastabend@gmail.com> wrote:
>>
>> Open question for me on this though is the PF in these SRIOV cases
>> ever being used by DPDK datapath or is it just being leveraged for
>> configuration with primarily control traffic?

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

end of thread, other threads:[~2017-01-16 11:42 UTC | newest]

Thread overview: 125+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-15 21:04 [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
2016-12-15 21:04 ` [PATCH v3 01/29] net/i40e: support link status notification Qi Zhang
2016-12-15 21:04 ` [PATCH v3 02/29] net/i40e: add callback to user on VF to PF mbox msg Qi Zhang
2016-12-15 21:04 ` [PATCH v3 03/29] net/i40e: set VF MAC anti-spoofing from PF Qi Zhang
2016-12-15 21:04 ` [PATCH v3 04/29] net/i40e: set VF VLAN " Qi Zhang
2016-12-15 21:04 ` [PATCH v3 05/29] net/i40e: set Tx loopback " Qi Zhang
2016-12-15 21:04 ` [PATCH v3 06/29] net/i40e: set VF unicast promisc mode " Qi Zhang
2016-12-15 21:04 ` [PATCH v3 07/29] net/i40e: set VF multicast " Qi Zhang
2016-12-15 21:04 ` [PATCH v3 08/29] net/i40e: enable VF MTU change Qi Zhang
2016-12-15 21:04 ` [PATCH v3 09/29] net/i40e: fix VF reset flow Qi Zhang
2016-12-15 21:05 ` [PATCH v3 10/29] net/i40e: set VF MAC from PF support Qi Zhang
2016-12-15 21:05 ` [PATCH v3 11/29] net/i40e: set VF MAC from VF support Qi Zhang
2016-12-15 21:05 ` [PATCH v3 12/29] net/i40e: fix VF MAC address assignment Qi Zhang
2016-12-15 21:05 ` [PATCH v3 13/29] net/i40e: add VF VLAN strip func Qi Zhang
2016-12-15 21:05 ` [PATCH v3 14/29] net/i40e: add set VF VLAN insert function Qi Zhang
2016-12-15 21:05 ` [PATCH v3 15/29] net/i40e: set VF broadcast mode from PF Qi Zhang
2016-12-15 21:05 ` [PATCH v3 16/29] net/i40e: set VF VLAN tag " Qi Zhang
2016-12-15 21:05 ` [PATCH v3 17/29] net/i40e: set VF VLAN filter " Qi Zhang
2016-12-15 21:05 ` [PATCH v3 18/29] app/testpmd: use VFD APIs on i40e Qi Zhang
2016-12-15 21:05 ` [PATCH v3 19/29] app/testpmd: use unicast promiscuous mode " Qi Zhang
2016-12-15 21:05 ` [PATCH v3 20/29] app/testpmd: use multicast " Qi Zhang
2016-12-15 21:05 ` [PATCH v3 21/29] app/testpmd: add command to test VF broadcast " Qi Zhang
2016-12-15 21:05 ` [PATCH v3 22/29] app/testpmd: add command to test VF VLAN tag " Qi Zhang
2016-12-15 21:05 ` [PATCH v3 23/29] app/testpmd: handle i40e in VF VLAN filter command Qi Zhang
2016-12-15 21:05 ` [PATCH v3 24/29] net/i40e: change version number to support Linux VF Qi Zhang
2016-12-15 21:05 ` [PATCH v3 25/29] net/i40e: return correct VSI id Qi Zhang
2016-12-15 21:05 ` [PATCH v3 26/29] net/i40e: parse more VF parameter and configure Qi Zhang
2016-12-15 21:05 ` [PATCH v3 27/29] net/i40e: support Linux VF to configure IRQ link list Qi Zhang
2016-12-15 21:05 ` [PATCH v3 28/29] net/i40e: enhance in sanity check of MAC Qi Zhang
2016-12-15 21:05 ` [PATCH v3 29/29] net/i40e: set/clear VF stats from PF Qi Zhang
2016-12-16 14:28 ` [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Ferruh Yigit
2016-12-16 14:38 ` [PATCH v4 " Ferruh Yigit
2016-12-16 14:38   ` [PATCH v4 01/29] net/i40e: support link status notification Ferruh Yigit
2016-12-16 14:38   ` [PATCH v4 02/29] net/i40e: add callback to user on VF to PF mbox msg Ferruh Yigit
2016-12-16 14:38   ` [PATCH v4 03/29] net/i40e: set VF MAC anti-spoofing from PF Ferruh Yigit
2016-12-16 14:38   ` [PATCH v4 04/29] net/i40e: set VF VLAN " Ferruh Yigit
2016-12-16 14:38   ` [PATCH v4 05/29] net/i40e: set Tx loopback " Ferruh Yigit
2016-12-16 14:38   ` [PATCH v4 06/29] net/i40e: set VF unicast promisc mode " Ferruh Yigit
2016-12-16 14:38   ` [PATCH v4 07/29] net/i40e: set VF multicast " Ferruh Yigit
2016-12-16 14:38   ` [PATCH v4 08/29] net/i40e: enable VF MTU change Ferruh Yigit
2016-12-16 14:38   ` [PATCH v4 09/29] net/i40e: fix VF reset flow Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 10/29] net/i40e: set VF MAC from PF support Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 11/29] net/i40e: set VF MAC from VF support Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 12/29] net/i40e: fix VF MAC address assignment Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 13/29] net/i40e: add VF VLAN strip func Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 14/29] net/i40e: add set VF VLAN insert function Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 15/29] net/i40e: set VF broadcast mode from PF Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 16/29] net/i40e: set VF VLAN tag " Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 17/29] net/i40e: set VF VLAN filter " Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 18/29] app/testpmd: use VFD APIs on i40e Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 19/29] app/testpmd: use unicast promiscuous mode " Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 20/29] app/testpmd: use multicast " Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 21/29] app/testpmd: add command to test VF broadcast " Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 22/29] app/testpmd: add command to test VF VLAN tag " Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 23/29] app/testpmd: handle i40e in VF VLAN filter command Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 24/29] net/i40e: change version number to support Linux VF Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 25/29] net/i40e: return correct VSI id Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 26/29] net/i40e: parse more VF parameter and configure Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 27/29] net/i40e: support Linux VF to configure IRQ link list Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 28/29] net/i40e: enhance in sanity check of MAC Ferruh Yigit
2016-12-16 14:39   ` [PATCH v4 29/29] net/i40e: set/clear VF stats from PF Ferruh Yigit
2016-12-16 14:45   ` [PATCH v4 00/29] Support VFD and DPDK PF + kernel VF on i40e Vincent Jardin
2016-12-16 19:02   ` [PATCH v5 " Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 01/29] net/i40e: support link status notification Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 02/29] net/i40e: add callback to user on VF to PF mbox msg Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 03/29] net/i40e: set VF MAC anti-spoofing from PF Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 04/29] net/i40e: set VF VLAN " Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 05/29] net/i40e: set Tx loopback " Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 06/29] net/i40e: set VF unicast promisc mode " Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 07/29] net/i40e: set VF multicast " Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 08/29] net/i40e: enable VF MTU change Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 09/29] net/i40e: fix VF reset flow Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 10/29] net/i40e: set VF MAC from PF support Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 11/29] net/i40e: set VF MAC from VF support Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 12/29] net/i40e: fix VF MAC address assignment Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 13/29] net/i40e: add VF VLAN strip func Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 14/29] net/i40e: add set VF VLAN insert function Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 15/29] net/i40e: set VF broadcast mode from PF Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 16/29] net/i40e: set VF VLAN tag " Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 17/29] net/i40e: set VF VLAN filter " Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e Ferruh Yigit
2016-12-16 20:30       ` Vincent JARDIN
2016-12-19 11:03         ` Ferruh Yigit
2016-12-20 15:19           ` Vincent JARDIN
2016-12-19 17:09       ` Ferruh Yigit
2016-12-20  1:05         ` Lu, Wenzhuo
2016-12-16 19:02     ` [PATCH v5 19/29] app/testpmd: use unicast promiscuous mode " Ferruh Yigit
2016-12-16 20:28       ` Vincent JARDIN
2016-12-19 11:05         ` Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 20/29] app/testpmd: use multicast " Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 21/29] app/testpmd: add command to test VF broadcast " Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 22/29] app/testpmd: add command to test VF VLAN tag " Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 23/29] app/testpmd: handle i40e in VF VLAN filter command Ferruh Yigit
2016-12-16 20:31       ` Vincent JARDIN
2016-12-19 11:13         ` Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 24/29] net/i40e: change version number to support Linux VF Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 25/29] net/i40e: return correct VSI id Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 26/29] net/i40e: parse more VF parameter and configure Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 27/29] net/i40e: support Linux VF to configure IRQ link list Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 28/29] net/i40e: enhance in sanity check of MAC Ferruh Yigit
2016-12-16 19:02     ` [PATCH v5 29/29] net/i40e: set/clear VF stats from PF Ferruh Yigit
2016-12-20 13:24       ` Ferruh Yigit
2016-12-20 13:40         ` Iremonger, Bernard
2016-12-21  0:56           ` Lu, Wenzhuo
2016-12-22 16:38             ` Iremonger, Bernard
2016-12-16 20:36     ` [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e Vincent JARDIN
2016-12-19  9:01       ` Chen, Jing D
2016-12-19 13:20         ` Thomas Monjalon
2016-12-19 13:39           ` Chen, Jing D
2016-12-19 13:45             ` Vincent JARDIN
2016-12-20  4:48               ` Chen, Jing D
2016-12-20 15:18                 ` Vincent JARDIN
2016-12-20 15:31                   ` Ferruh Yigit
2016-12-21  0:50                     ` Lu, Wenzhuo
2016-12-22  8:10                   ` Chen, Jing D
2016-12-22 13:46                     ` Vincent JARDIN
2016-12-26 11:59                       ` Chen, Jing D
2017-01-04 21:09                         ` Scott Daniels
2017-01-10 13:29                           ` Vincent JARDIN
2017-01-12  3:47                             ` Chen, Jing D
2017-01-13 23:04                               ` John Fastabend
2017-01-13 23:49                                 ` JOSHI, KAUSTUBH  (KAUSTUBH)
2017-01-15 23:32                                   ` Vincent JARDIN
2017-01-16 11:42                                   ` Ferruh Yigit
2017-01-16  9:32                                 ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.