* [dpdk-dev] [PATCH 01/31] net/i40e: support link status notification
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 02/31] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
` (39 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 13085fb..de7f384 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 67778ba..fda1454 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"
@@ -9735,3 +9736,30 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 @@
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 02/31] net/i40e: add callback to user on VF to PF mbox msg
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 01/31] net/i40e: support link status notification Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 03/31] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
` (38 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 03/31] net/i40e: set VF MAC anti-spoofing from PF
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 01/31] net/i40e: support link status notification Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 02/31] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 04/31] net/i40e: set VF VLAN " Wenzhuo Lu
` (37 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 fda1454..0821734 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9763,3 +9763,66 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 04/31] net/i40e: set VF VLAN anti-spoofing from PF
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (2 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 03/31] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 05/31] net/i40e: set TX loopback " Wenzhuo Lu
` (36 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 0821734..ec863b9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4418,6 +4418,7 @@ struct i40e_vsi *
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 @@ struct i40e_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;
+ }
}
/**
@@ -9826,3 +9845,96 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 05/31] net/i40e: set TX loopback from PF
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (3 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 04/31] net/i40e: set VF VLAN " Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 11:22 ` Ferruh Yigit
2016-12-02 0:11 ` [dpdk-dev] [PATCH 06/31] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
` (35 subsequent siblings)
40 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 ec863b9..9fe9672 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9938,3 +9938,222 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 -ENOSYS;
+ }
+
+ /* 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 05/31] net/i40e: set TX loopback from PF
2016-12-02 0:11 ` [dpdk-dev] [PATCH 05/31] net/i40e: set TX loopback " Wenzhuo Lu
@ 2016-12-02 11:22 ` Ferruh Yigit
0 siblings, 0 replies; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-02 11:22 UTC (permalink / raw)
To: Wenzhuo Lu, dev
On 12/2/2016 12:11 AM, Wenzhuo Lu wrote:
> 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 ec863b9..9fe9672 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -9938,3 +9938,222 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
<...>
> +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 -ENOSYS;
Checkpatch complains about ENOSYS usage:
WARNING:ENOSYS: ENOSYS means 'invalid syscall nr' and nothing else
What is intended error code here?
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 06/31] net/i40e: set VF unicast promisc mode from PF
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (4 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 05/31] net/i40e: set TX loopback " Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 11:24 ` Ferruh Yigit
2016-12-02 0:11 ` [dpdk-dev] [PATCH 07/31] net/i40e: set VF multicast " Wenzhuo Lu
` (34 subsequent siblings)
40 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
Support enabling/disabling VF unicast promicscuous 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 9fe9672..3aaa07d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10157,3 +10157,39 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 07/31] net/i40e: set VF multicast promisc mode from PF
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (5 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 06/31] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 11:24 ` Ferruh Yigit
2016-12-02 0:11 ` [dpdk-dev] [PATCH 08/31] net/i40e: enable VF MTU change Wenzhuo Lu
` (33 subsequent siblings)
40 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
Support enabling/disabling VF multicast promicscuous 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 3aaa07d..728061d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10193,3 +10193,39 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 08/31] net/i40e: enable VF MTU change
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (6 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 07/31] net/i40e: set VF multicast " Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 09/31] rte: add APIs for VF stats get/reset Wenzhuo Lu
` (32 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: 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 aa306d6..262c4c1 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 @@ struct rte_i40evf_xstats_name_off {
.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,
};
/*
@@ -2635,3 +2637,34 @@ static int i40evf_dev_xstats_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;
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 09/31] rte: add APIs for VF stats get/reset
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (7 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 08/31] net/i40e: enable VF MTU change Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 10/31] net/i40e: implement ops " Wenzhuo Lu
` (31 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
This patch add below two APIs so that VF statistics
can be get/clear from PF side.
rte_eth_vf_stats_get.
rte_eth_vf_stats_reset.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
lib/librte_ether/rte_ethdev.c | 47 +++++++++++++++++++++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.h | 47 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 94 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index fde8112..03b4edf 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3270,3 +3270,50 @@ int rte_eth_dev_bypass_init(uint8_t port_id)
-ENOTSUP);
return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, mask, en);
}
+
+int
+rte_eth_vf_stats_get(uint8_t port_id,
+ uint16_t vf,
+ struct rte_eth_stats *stats)
+{
+ struct rte_eth_dev *dev;
+ struct rte_eth_dev_info dev_info;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+ dev = &rte_eth_devices[port_id];
+ rte_eth_dev_info_get(port_id, &dev_info);
+
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vf_stats_get, -ENOTSUP);
+
+ if (vf >= dev_info.max_vfs) {
+ RTE_PMD_DEBUG_TRACE("Get VF Stats:port %d: "
+ "invalid vf id=%d\n", port_id, vf);
+ return -EINVAL;
+ }
+
+ return (*dev->dev_ops->vf_stats_get)(dev, vf, stats);
+}
+
+int
+rte_eth_vf_stats_reset(uint8_t port_id,
+ uint16_t vf)
+{
+ struct rte_eth_dev *dev;
+ struct rte_eth_dev_info dev_info;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+ dev = &rte_eth_devices[port_id];
+ rte_eth_dev_info_get(port_id, &dev_info);
+
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vf_stats_reset, -ENOTSUP);
+
+ if (vf >= dev_info.max_vfs) {
+ RTE_PMD_DEBUG_TRACE("Reset VF Stats:port %d: "
+ "invalid vf id=%d\n", port_id, vf);
+ return -EINVAL;
+ }
+
+ return (*dev->dev_ops->vf_stats_reset)(dev, vf);
+}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9678179..8b564ee 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1271,6 +1271,15 @@ typedef int (*eth_set_vf_vlan_filter_t)(struct rte_eth_dev *dev,
uint8_t vlan_on);
/**< @internal Set VF VLAN pool filter */
+typedef int (*eth_vf_stats_get)(struct rte_eth_dev *dev,
+ uint16_t vf,
+ struct rte_eth_stats *stats);
+/**< @internal Get VF statistics */
+
+typedef int (*eth_vf_stats_reset)(struct rte_eth_dev *dev,
+ uint16_t vf);
+/**< @internal Clear VF statistics */
+
typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
uint16_t queue_idx,
uint16_t tx_rate);
@@ -1483,6 +1492,8 @@ struct eth_dev_ops {
eth_set_vf_rx_t set_vf_rx; /**< enable/disable a VF receive */
eth_set_vf_tx_t set_vf_tx; /**< enable/disable a VF transmit */
eth_set_vf_vlan_filter_t set_vf_vlan_filter; /**< Set VF VLAN filter */
+ eth_vf_stats_get vf_stats_get; /**< Get VF's statistics */
+ eth_vf_stats_reset vf_stats_reset; /**< Reset VF's statistics */
/** Add UDP tunnel port. */
eth_udp_tunnel_port_add_t udp_tunnel_port_add;
/** Del UDP tunnel port. */
@@ -4379,6 +4390,42 @@ int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
*/
int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+/**
+ * Get VF's statistics
+ *
+ * @param port_id
+ * pointer to port identifier of the device
+ * @param vf
+ * VF id
+ * @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
+ * Zero if successful. Non-zero otherwise.
+ */
+int rte_eth_vf_stats_get(uint8_t port_id,
+ uint16_t vf,
+ struct rte_eth_stats *stats);
+
+/**
+ * Clear VF's statistics
+ *
+ * @param port_id
+ * pointer to port identifier of the device
+ * @param vf
+ * vf id
+ * @return
+ * Zero if successful. Non-zero otherwise.
+ */
+int rte_eth_vf_stats_reset(uint8_t port_id,
+ uint16_t vf);
+
#ifdef __cplusplus
}
#endif
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 10/31] net/i40e: implement ops for VF stats get/reset
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (8 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 09/31] rte: add APIs for VF stats get/reset Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 11/31] net/i40e: fix VF reset flow Wenzhuo Lu
` (30 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
This patch implement vf_stats_get and vf_stats_reset ops for i40e.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 64 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 728061d..319080e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -462,6 +462,13 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
static int i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
+static int i40e_vf_stats_get(struct rte_eth_dev *dev,
+ uint16_t vf,
+ struct rte_eth_stats *stats);
+
+static int i40e_vf_stats_reset(struct rte_eth_dev *dev,
+ uint16_t vf);
+
static const struct rte_pci_id pci_id_i40e_map[] = {
{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_SFP_XL710) },
{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_QEMU) },
@@ -554,6 +561,8 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
.get_eeprom = i40e_get_eeprom,
.mac_addr_set = i40e_set_default_mac_addr,
.mtu_set = i40e_dev_mtu_set,
+ .vf_stats_get = i40e_vf_stats_get,
+ .vf_stats_reset = i40e_vf_stats_reset,
};
/* store statistics names and its offset in stats structure */
@@ -10229,3 +10238,58 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+static int
+i40e_vf_stats_get(struct rte_eth_dev *dev,
+ uint16_t vf,
+ struct rte_eth_stats *stats)
+{
+ struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct i40e_vsi *vsi;
+
+ int ret = 0;
+
+ if (pf->vf_num <= vf) {
+ PMD_DRV_LOG(ERR, "Invalid VF id %d\n", vf);
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf].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;
+}
+
+static int
+i40e_vf_stats_reset(struct rte_eth_dev *dev,
+ uint16_t vf)
+{
+ struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct i40e_vsi *vsi;
+
+ int ret = 0;
+
+ if (pf->vf_num <= vf) {
+ PMD_DRV_LOG(ERR, "Invalid VF id %d\n", vf);
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf].vsi;
+
+ vsi->offset_loaded = false;
+ i40e_update_vsi_stats(vsi);
+
+ return ret;
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 11/31] net/i40e: fix VF reset flow
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (9 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 10/31] net/i40e: implement ops " Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 11:24 ` Ferruh Yigit
2016-12-02 0:11 ` [dpdk-dev] [PATCH 12/31] net/i40e: set VF MAC from PF support Wenzhuo Lu
` (29 subsequent siblings)
40 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 uneccessary enum
for vfr state.
Fixes: 4861cde46116 ("i40e: new poll mode driver")
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 @@
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 @@
}
/* 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 @@
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 {
/*
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 11/31] net/i40e: fix VF reset flow
2016-12-02 0:11 ` [dpdk-dev] [PATCH 11/31] net/i40e: fix VF reset flow Wenzhuo Lu
@ 2016-12-02 11:24 ` Ferruh Yigit
0 siblings, 0 replies; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-02 11:24 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Qi Zhang
On 12/2/2016 12:11 AM, Wenzhuo Lu wrote:
> 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 uneccessary enum
s/uneccessary/unnecessary
> for vfr state.
>
> Fixes: 4861cde46116 ("i40e: new poll mode driver")
>
missing cc, yes this is very new J
CC: stable@dpdk.org
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 12/31] net/i40e: set VF MAC from PF support
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (10 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 11/31] net/i40e: fix VF reset flow Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 11:23 ` Ferruh Yigit
2016-12-02 0:11 ` [dpdk-dev] [PATCH 13/31] net/i40e: set VF MAC from VF support Wenzhuo Lu
` (28 subsequent siblings)
40 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
Support setting VF MAC address from PF.
User can call the API on PF to set a speific VF's
MAC address.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
app/test/Makefile | 8 +++
app/test/test_pmd_i40e.c | 96 +++++++++++++++++++++++++++++++
drivers/net/i40e/i40e_ethdev.c | 42 ++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 2 +
5 files changed, 167 insertions(+)
create mode 100644 app/test/test_pmd_i40e.c
diff --git a/app/test/Makefile b/app/test/Makefile
index 5be023a..b3f6ecb 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -199,6 +199,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
+SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += test_pmd_i40e.c
+
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
@@ -228,6 +230,12 @@ endif
endif
endif
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
+LDLIBS += -lrte_pmd_i40e
+endif
+endif
+
ifeq ($(CONFIG_RTE_APP_TEST_RESOURCE_TAR),y)
LDLIBS += -larchive
endif
diff --git a/app/test/test_pmd_i40e.c b/app/test/test_pmd_i40e.c
new file mode 100644
index 0000000..c901e89
--- /dev/null
+++ b/app/test/test_pmd_i40e.c
@@ -0,0 +1,96 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * 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.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <inttypes.h>
+
+#include <rte_pmd_i40e.h>
+#include <rte_ethdev.h>
+
+#include "test.h"
+
+#define I40E_DRV_NAME "net_i40e"
+
+static struct ether_addr mac_addr = {
+ { 0xAA, 0xBB, 0xCC, 0xDD, 0x00, 0x00 }
+};
+
+static const int max_vfs = 3;
+
+static int
+test_i40e(void)
+{
+ struct rte_eth_dev_info dev_info;
+ struct ether_addr current_mac_addr;
+ uint8_t nb_ports;
+ uint8_t port;
+ int ret = 0;
+ int i;
+
+ nb_ports = rte_eth_dev_count();
+ printf("nb_ports=%d\n", nb_ports);
+
+ for (port = 0; port < nb_ports; port++) {
+ rte_eth_dev_info_get(port, &dev_info);
+
+ printf("%d: %s\n", port, dev_info.driver_name);
+
+ if (strcmp(dev_info.driver_name, I40E_DRV_NAME))
+ continue;
+
+ rte_eth_macaddr_get(port, ¤t_mac_addr);
+
+ printf("%d: mac address:", port);
+ for (i = 0; i < ETHER_ADDR_LEN - 1; i++)
+ printf("%x:", current_mac_addr.addr_bytes[i]);
+ printf("%x\n", current_mac_addr.addr_bytes[ETHER_ADDR_LEN - 1]);
+
+ for (i = 0; i < max_vfs; i++) {
+ if (i >= dev_info.max_vfs)
+ break;
+
+ mac_addr.addr_bytes[ETHER_ADDR_LEN - 2] = port + 1;
+ mac_addr.addr_bytes[ETHER_ADDR_LEN - 1] = i + 1;
+
+ ret = rte_pmd_i40e_set_vf_mac_addr(port, i, &mac_addr);
+ printf("port:%d vf:%d set mac %s\n",
+ port, i, ret ? "failed" : "succeed");
+ }
+ }
+
+ return 0;
+}
+
+REGISTER_TEST_COMMAND(i40e_autotest, test_i40e);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 319080e..bfc9169 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10293,3 +10293,45 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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);
+
+ i40e_pf_host_vf_reset(vf, 1);
+
+ return 0;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 9091520..ca5e05a 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 reset the vf.
+ *
+ * @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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 13/31] net/i40e: set VF MAC from VF support
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (11 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 12/31] net/i40e: set VF MAC from PF support Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 14/31] net/i40e: fix VF MAC address assignment Wenzhuo Lu
` (27 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
Support changing VF default MAC address.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/i40e/i40e_ethdev.h | 4 +++-
drivers/net/i40e/i40e_ethdev_vf.c | 48 +++++++++++++++++++++++++++++++++------
2 files changed, 44 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 262c4c1..cc2d03c 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 @@ struct rte_i40evf_xstats_name_off {
.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,15 @@ struct rte_i40evf_xstats_name_off {
}
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 +926,17 @@ struct rte_i40evf_xstats_name_off {
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)
{
@@ -1261,10 +1271,12 @@ static int i40evf_dev_xstats_get(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) {
@@ -2668,3 +2680,25 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
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);
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 14/31] net/i40e: fix VF MAC address assignment
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (12 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 13/31] net/i40e: set VF MAC from VF support Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 11:24 ` Ferruh Yigit
2016-12-02 0:11 ` [dpdk-dev] [PATCH 15/31] net/i40e: add VF vlan strip func Wenzhuo Lu
` (26 subsequent siblings)
40 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
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 cc2d03c..3b9a673 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1193,7 +1193,6 @@ static int i40evf_dev_xstats_get(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 @@ static int i40evf_dev_xstats_get(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) {
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 15/31] net/i40e: add VF vlan strip func
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (13 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 14/31] net/i40e: fix VF MAC address assignment Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 11:25 ` Ferruh Yigit
2016-12-02 0:11 ` [dpdk-dev] [PATCH 16/31] net/i40e: add set VF VLAN insert function Wenzhuo Lu
` (25 subsequent siblings)
40 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 | 20 ++++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index bfc9169..b1d483b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10335,3 +10335,29 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 ca5e05a..043ae62 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -187,4 +187,24 @@ 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.
+ * - (-ENOTSUP) if hardware doesn't support this feature.
+ * - (-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_ */
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 16/31] net/i40e: add set VF VLAN insert function
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (14 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 15/31] net/i40e: add VF vlan strip func Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 0:11 ` [dpdk-dev] [PATCH 17/31] net/i40e: set VF broadcast mode from PF Wenzhuo Lu
` (24 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 b1d483b..a1aa469 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10361,3 +10361,56 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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)
+ return -EINVAL;
+
+ if (vlan_id > 4095)
+ 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 043ae62..8867e9c 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -207,4 +207,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 64ba93a..b55a7ca 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_insert;
} DPDK_2.0;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 17/31] net/i40e: set VF broadcast mode from PF
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (15 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 16/31] net/i40e: add set VF VLAN insert function Wenzhuo Lu
@ 2016-12-02 0:11 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 18/31] net/i40e: set VF VLAN tag " Wenzhuo Lu
` (23 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:11 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 18 +++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 62 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a1aa469..ef67e4b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10414,3 +10414,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)
+ 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 8867e9c..3e7ecb7 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -226,4 +226,22 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
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 b55a7ca..2998daf 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_insert;
+ rte_pmd_i40e_set_vf_broadcast;
} DPDK_2.0;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 18/31] net/i40e: set VF VLAN tag from PF
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (16 preceding siblings ...)
2016-12-02 0:11 ` [dpdk-dev] [PATCH 17/31] net/i40e: set VF broadcast mode from PF Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 19/31] net/i40e: set VF VLAN filter " Wenzhuo Lu
` (22 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 ef67e4b..9a80237 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10457,3 +10457,62 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id, uint8_t on)
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 3e7ecb7..0b245da 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 2998daf..672316b 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_insert;
rte_pmd_i40e_set_vf_broadcast;
+ rte_pmd_i40e_set_vf_vlan_tag;
} DPDK_2.0;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 19/31] net/i40e: set VF VLAN filter from PF
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (17 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 18/31] net/i40e: set VF VLAN tag " Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 20/31] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
` (21 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 50 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 22 ++++++++++++++
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 9a80237..61735fb 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10516,3 +10516,53 @@ 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 = 0;
+
+ 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;
+ 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 0b245da..1ce9513 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_vlan_insert(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 672316b..ba7d922 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_insert;
rte_pmd_i40e_set_vf_broadcast;
rte_pmd_i40e_set_vf_vlan_tag;
+ rte_pmd_i40e_set_vf_vlan_filter;
} DPDK_2.0;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 20/31] app/testpmd: use VFD APIs on i40e
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (18 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 19/31] net/i40e: set VF VLAN filter " Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 11:22 ` Ferruh Yigit
2016-12-13 16:57 ` Ferruh Yigit
2016-12-02 0:12 ` [dpdk-dev] [PATCH 21/31] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
` (20 subsequent siblings)
40 siblings, 2 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark), Bernard Iremonger
The new VF Daemon (VFD) APIs is implemented on i40e. Change
testpmd code to use them, inlcuding 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/cmdline.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 85 insertions(+), 7 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 63b55dc..1284d6c 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;
@@ -10806,9 +10809,22 @@ struct cmd_vf_vlan_anti_spoof_result {
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 = -ENOSYS;
- ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, res->vf_id,
- is_on);
switch (ret) {
case 0:
break;
@@ -10818,6 +10834,9 @@ struct cmd_vf_vlan_anti_spoof_result {
case -ENODEV:
printf("invalid port_id %d\n", res->port_id);
break;
+ case -ENOSYS:
+ printf("function not implemented\n");
+ break;
default:
printf("programming error: (%s)\n", strerror(-ret));
}
@@ -10891,9 +10910,22 @@ struct cmd_vf_mac_anti_spoof_result {
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 = -ENOSYS;
- ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id, res->vf_id,
- is_on);
switch (ret) {
case 0:
break;
@@ -10903,6 +10935,9 @@ struct cmd_vf_mac_anti_spoof_result {
case -ENODEV:
printf("invalid port_id %d\n", res->port_id);
break;
+ case -ENOSYS:
+ printf("function not implemented\n");
+ break;
default:
printf("programming error: (%s)\n", strerror(-ret));
}
@@ -10976,8 +11011,20 @@ struct cmd_vf_vlan_stripq_result {
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 = -ENOSYS;
- ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id, res->vf_id, is_on);
switch (ret) {
case 0:
break;
@@ -10987,6 +11034,9 @@ struct cmd_vf_vlan_stripq_result {
case -ENODEV:
printf("invalid port_id %d\n", res->port_id);
break;
+ case -ENOSYS:
+ printf("function not implemented\n");
+ break;
default:
printf("programming error: (%s)\n", strerror(-ret));
}
@@ -11059,8 +11109,20 @@ struct cmd_vf_vlan_insert_result {
{
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 = -ENOSYS;
- ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, res->vlan_id);
switch (ret) {
case 0:
break;
@@ -11070,6 +11132,9 @@ struct cmd_vf_vlan_insert_result {
case -ENODEV:
printf("invalid port_id %d\n", res->port_id);
break;
+ case -ENOSYS:
+ printf("function not implemented\n");
+ break;
default:
printf("programming error: (%s)\n", strerror(-ret));
}
@@ -11133,8 +11198,18 @@ struct cmd_tx_loopback_result {
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 = -ENOSYS;
- ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
switch (ret) {
case 0:
break;
@@ -11144,6 +11219,9 @@ struct cmd_tx_loopback_result {
case -ENODEV:
printf("invalid port_id %d\n", res->port_id);
break;
+ case -ENOSYS:
+ printf("function not implemented\n");
+ break;
default:
printf("programming error: (%s)\n", strerror(-ret));
}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 20/31] app/testpmd: use VFD APIs on i40e
2016-12-02 0:12 ` [dpdk-dev] [PATCH 20/31] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2016-12-02 11:22 ` Ferruh Yigit
2016-12-13 16:57 ` Ferruh Yigit
1 sibling, 0 replies; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-02 11:22 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Chen Jing D(Mark), Bernard Iremonger
On 12/2/2016 12:12 AM, Wenzhuo Lu wrote:
> The new VF Daemon (VFD) APIs is implemented on i40e. Change
> testpmd code to use them, inlcuding VF MAC anti-spoofing,
s/inlcuding/including
> 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>
> ---
For shared library compilation, i40e library should be linked against,
this requires testpmd Makefile modification [1], otherwise throwing
compiler error [2].
[1]
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 891b85a..87cbaf9 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -59,6 +59,7 @@ SRCS-y += icmpecho.c
SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
+_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
[2]
cmdline.o: In function `cmd_set_vf_vlan_anti_spoof_parsed':
.../app/test-pmd/cmdline.c:(.text+0x76dc): undefined reference to
`rte_pmd_i40e_set_vf_vlan_anti_spoof'
cmdline.o: In function `cmd_set_vf_mac_anti_spoof_parsed':
.../app/test-pmd/cmdline.c:(.text+0x7854): undefined reference to
`rte_pmd_i40e_set_vf_mac_anti_spoof'
cmdline.o: In function `cmd_set_vf_vlan_stripq_parsed':
.../app/test-pmd/cmdline.c:(.text+0x79d4): undefined reference to
`rte_pmd_i40e_set_vf_vlan_stripq'
cmdline.o: In function `cmd_set_vf_vlan_insert_parsed':
.../app/test-pmd/cmdline.c:(.text+0x7b1e): undefined reference to
`rte_pmd_i40e_set_vf_vlan_insert'
cmdline.o: In function `cmd_set_tx_loopback_parsed':
.../app/test-pmd/cmdline.c:(.text+0x7c94): undefined reference to
`rte_pmd_i40e_set_tx_loopback'
cmdline.o: In function `cmd_set_vf_unicast_promisc_parsed':
.../app/test-pmd/cmdline.c:(.text+0x7f44): undefined reference to
`rte_pmd_i40e_set_vf_unicast_promisc'
cmdline.o: In function `cmd_set_vf_multicast_promisc_parsed':
.../app/test-pmd/cmdline.c:(.text+0x7fe4): undefined reference to
`rte_pmd_i40e_set_vf_multicast_promisc'
cmdline.o: In function `cmd_set_vf_broadcast_parsed':
.../app/test-pmd/cmdline.c:(.text+0x8086): undefined reference to
`rte_pmd_i40e_set_vf_broadcast'
cmdline.o: In function `cmd_set_vf_vlan_tag_parsed':
.../app/test-pmd/cmdline.c:(.text+0x8146): undefined reference to
`rte_pmd_i40e_set_vf_vlan_tag'
config.o: In function `set_vf_rx_vlan':
.../app/test-pmd/config.c:(.text+0x518d): undefined reference to
`rte_pmd_i40e_set_vf_vlan_filter'
clang-3.8: error: linker command failed with exit code 1 (use -v to see
invocation)
> app/test-pmd/cmdline.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 85 insertions(+), 7 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 63b55dc..1284d6c 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;
> @@ -10806,9 +10809,22 @@ struct cmd_vf_vlan_anti_spoof_result {
> 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 = -ENOSYS;
Same checkpatch warning, for all ENOSYS usage,
WARNING:ENOSYS: ENOSYS means 'invalid syscall nr' and nothing else
If the intention is not matching error type, we may change it.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 20/31] app/testpmd: use VFD APIs on i40e
2016-12-02 0:12 ` [dpdk-dev] [PATCH 20/31] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
2016-12-02 11:22 ` Ferruh Yigit
@ 2016-12-13 16:57 ` Ferruh Yigit
2016-12-14 0:44 ` Lu, Wenzhuo
1 sibling, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-13 16:57 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Chen Jing D(Mark), Bernard Iremonger
On 12/2/2016 12:12 AM, Wenzhuo Lu wrote:
> The new VF Daemon (VFD) APIs is implemented on i40e. Change
> testpmd code to use them, inlcuding 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/cmdline.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 85 insertions(+), 7 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 63b55dc..1284d6c 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
<...>
> @@ -11059,8 +11109,20 @@ struct cmd_vf_vlan_insert_result {
> {
> 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);
This code is within "#ifdef RTE_LIBRTE_IXGBE_PMD", so i40e check can
fail if IXGBE_PMD disabled, need to update surrounding ifdef.
Same for rest.
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 20/31] app/testpmd: use VFD APIs on i40e
2016-12-13 16:57 ` Ferruh Yigit
@ 2016-12-14 0:44 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2016-12-14 0:44 UTC (permalink / raw)
To: Yigit, Ferruh, dev; +Cc: Chen, Jing D, Iremonger, Bernard
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 14, 2016 12:57 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Chen, Jing D; Iremonger, Bernard
> Subject: Re: [dpdk-dev] [PATCH 20/31] app/testpmd: use VFD APIs on i40e
>
> On 12/2/2016 12:12 AM, Wenzhuo Lu wrote:
> > The new VF Daemon (VFD) APIs is implemented on i40e. Change testpmd
> > code to use them, inlcuding 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/cmdline.c | 92
> > ++++++++++++++++++++++++++++++++++++++++++++++----
> > 1 file changed, 85 insertions(+), 7 deletions(-)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > 63b55dc..1284d6c 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> <...>
> > @@ -11059,8 +11109,20 @@ struct cmd_vf_vlan_insert_result { {
> > 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);
>
> This code is within "#ifdef RTE_LIBRTE_IXGBE_PMD", so i40e check can fail if
> IXGBE_PMD disabled, need to update surrounding ifdef.
>
> Same for rest.
Yes, will handle it. Thanks.
>
> <...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 21/31] app/testpmd: use unicast promiscuous mode on i40e
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (19 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 20/31] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 22/31] app/testpmd: use multicast " Wenzhuo Lu
` (19 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 89 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 +++
2 files changed, 97 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 1284d6c..3c0bb77 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -404,6 +404,11 @@ 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"
+#ifdef RTE_LIBRTE_I40E_PMD
+ "set vf unicast-promisc (port_id) (vf_id) (on|off)\n"
+ " Set unicast promiscuous mode for a VF from the PF.\n\n"
+#endif
+
"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"
@@ -11489,6 +11494,87 @@ struct cmd_set_vf_mac_addr_result {
};
#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+/* VF unicast promiscuous mode configuration */
+
+/* Common result structure for VF unicast promiscuous mode */
+struct cmd_vf_unicast_promisc_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t vf;
+ cmdline_fixed_string_t unicast_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_unicast_promisc_set =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ set, "set");
+cmdline_parse_token_string_t cmd_vf_unicast_promisc_vf =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ vf, "vf");
+cmdline_parse_token_string_t cmd_vf_unicast_promisc_unicast_promisc =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ unicast_promisc, "unicast-promisc");
+cmdline_parse_token_num_t cmd_vf_unicast_promisc_port_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_unicast_promisc_vf_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_unicast_promisc_on_off =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ on_off, "on#off");
+
+static void
+cmd_set_vf_unicast_promisc_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_vf_unicast_promisc_result *res = parsed_result;
+ int ret = 0;
+ int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+ 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_unicast_promisc = {
+ .f = cmd_set_vf_unicast_promisc_parsed,
+ .data = NULL,
+ .help_str = "set vf unicast promiscuous port_id vf_id on|off",
+ .tokens = {
+ (void *)&cmd_vf_unicast_promisc_set,
+ (void *)&cmd_vf_unicast_promisc_vf,
+ (void *)&cmd_vf_unicast_promisc_unicast_promisc,
+ (void *)&cmd_vf_unicast_promisc_port_id,
+ (void *)&cmd_vf_unicast_promisc_vf_id,
+ (void *)&cmd_vf_unicast_promisc_on_off,
+ NULL,
+ },
+};
+#endif
+
/* ******************************************************************************** */
/* list of instructions */
@@ -11655,6 +11741,9 @@ struct cmd_set_vf_mac_addr_result {
(cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en,
(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ (cmdline_parse_inst_t *)&cmd_set_vf_unicast_promisc,
+#endif
NULL,
};
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f1c269a..e17e3d5 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -820,6 +820,14 @@ Set the allmulti mode for a port or for all ports::
Same as the ifconfig (8) option. Controls how multicast packets are handled.
+set unicast promisc (for VF)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set the unicast promiscuous mode for a VF from PF.
+In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
+
+ testpmd> set vf unicast-promisc (port_id) (vf_id) (on|off)
+
set flow_ctrl rx
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 22/31] app/testpmd: use multicast promiscuous mode on i40e
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (20 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 21/31] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 23/31] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
` (18 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 83 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 +++
2 files changed, 91 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 3c0bb77..fa60086 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -407,6 +407,9 @@ static void cmd_help_long_parsed(void *parsed_result,
#ifdef RTE_LIBRTE_I40E_PMD
"set vf unicast-promisc (port_id) (vf_id) (on|off)\n"
" Set unicast promiscuous mode for a VF from the PF.\n\n"
+
+ "set vf multicast-promisc (port_id) (vf_id) (on|off)\n"
+ " Set multicast promiscuous mode for a VF from the PF.\n\n"
#endif
"set flow_ctrl rx (on|off) tx (on|off) (high_water)"
@@ -11573,6 +11576,85 @@ struct cmd_vf_unicast_promisc_result {
NULL,
},
};
+
+/* VF multicast promiscuous mode configuration */
+
+/* Common result structure for VF multicast promiscuous mode */
+struct cmd_vf_multicast_promisc_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t vf;
+ cmdline_fixed_string_t multicast_promisc;
+ 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_multicast_promisc_set =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ set, "set");
+cmdline_parse_token_string_t cmd_vf_multicast_promisc_vf =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ vf, "vf");
+cmdline_parse_token_string_t cmd_vf_multicast_promisc_multicast_promisc =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ multicast_promisc, "multicast-promisc");
+cmdline_parse_token_num_t cmd_vf_multicast_promisc_port_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_multicast_promisc_vf_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_multicast_promisc_on_off =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ on_off, "on#off");
+
+static void
+cmd_set_vf_multicast_promisc_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_vf_multicast_promisc_result *res = parsed_result;
+ int ret = 0;
+ int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+ 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_multicast_promisc = {
+ .f = cmd_set_vf_multicast_promisc_parsed,
+ .data = NULL,
+ .help_str = "set vf multicast promiscuous port_id vf_id on|off",
+ .tokens = {
+ (void *)&cmd_vf_multicast_promisc_set,
+ (void *)&cmd_vf_multicast_promisc_vf,
+ (void *)&cmd_vf_multicast_promisc_multicast_promisc,
+ (void *)&cmd_vf_multicast_promisc_port_id,
+ (void *)&cmd_vf_multicast_promisc_vf_id,
+ (void *)&cmd_vf_multicast_promisc_on_off,
+ NULL,
+ },
+};
#endif
/* ******************************************************************************** */
@@ -11743,6 +11825,7 @@ struct cmd_vf_unicast_promisc_result {
#endif
#ifdef RTE_LIBRTE_I40E_PMD
(cmdline_parse_inst_t *)&cmd_set_vf_unicast_promisc,
+ (cmdline_parse_inst_t *)&cmd_set_vf_multicast_promisc,
#endif
NULL,
};
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index e17e3d5..e1545b7 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -828,6 +828,14 @@ In promiscuous mode packets are not dropped if they aren't for the specified MAC
testpmd> set vf unicast-promisc (port_id) (vf_id) (on|off)
+set multicast promisc (for VF)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set the multicast promiscuous mode for a VF from PF.
+In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
+
+ testpmd> set vf multicast-promisc (port_id) (vf_id) (on|off)
+
set flow_ctrl rx
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 23/31] app/testpmd: add command to test VF broadcast mode on i40e
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (21 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 22/31] app/testpmd: use multicast " Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 24/31] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
` (17 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 84 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++
2 files changed, 91 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index fa60086..56d275b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -279,6 +279,11 @@ static void cmd_help_long_parsed(void *parsed_result,
" Set MAC antispoof for a VF from the PF.\n\n"
#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ "set vf broadcast (port_id) (vf_id) (on|off)\n"
+ " Set VF broadcast 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"
@@ -11655,6 +11660,84 @@ struct cmd_vf_multicast_promisc_result {
NULL,
},
};
+
+/* 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;
+
+ 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,
+ },
+};
#endif
/* ******************************************************************************** */
@@ -11826,6 +11909,7 @@ struct cmd_vf_multicast_promisc_result {
#ifdef RTE_LIBRTE_I40E_PMD
(cmdline_parse_inst_t *)&cmd_set_vf_unicast_promisc,
(cmdline_parse_inst_t *)&cmd_set_vf_multicast_promisc,
+ (cmdline_parse_inst_t *)&cmd_set_vf_broadcast,
#endif
NULL,
};
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index e1545b7..525d0df 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
~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 24/31] app/testpmd: add command to test VF VLAN tag on i40e
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (22 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 23/31] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 25/31] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
` (16 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 90 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++
2 files changed, 97 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 56d275b..9135e45 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -301,6 +301,11 @@ static void cmd_help_long_parsed(void *parsed_result,
" Set VLAN antispoof for a VF from the PF.\n\n"
#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ "set vf vlan tag (port_id) (vf_id) (on|off)\n"
+ " Set VLAN tag 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"
@@ -11738,6 +11743,90 @@ struct cmd_set_vf_broadcast_result {
NULL,
},
};
+
+/* 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;
+
+ 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,
+ },
+};
#endif
/* ******************************************************************************** */
@@ -11910,6 +11999,7 @@ struct cmd_set_vf_broadcast_result {
(cmdline_parse_inst_t *)&cmd_set_vf_unicast_promisc,
(cmdline_parse_inst_t *)&cmd_set_vf_multicast_promisc,
(cmdline_parse_inst_t *)&cmd_set_vf_broadcast,
+ (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag,
#endif
NULL,
};
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 525d0df..cffcac8 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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 25/31] app/testpmd: handle i40e in VF VLAN filter command
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (23 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 24/31] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 26/31] app/testpmd: initialize receive mode for VMDq Wenzhuo Lu
` (15 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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, 16 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 36c47ab..0368dc6 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
#include "testpmd.h"
@@ -2349,12 +2352,24 @@ struct igb_ring_desc_16_bytes {
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;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
if (vlan_id_is_invalid(vlan_id))
return;
- diag = rte_eth_dev_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
+
+ rte_eth_dev_info_get(port_id, &dev_info);
+
+#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_eth_dev_set_vf_vlan_filter(port_id, vlan_id,
+ vf_mask, on);
+
if (diag == 0)
return;
printf("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed "
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 26/31] app/testpmd: initialize receive mode for VMDq
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (24 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 25/31] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 27/31] net/i40e: change version number to support Linux VF Wenzhuo Lu
` (14 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
Initialise VMDq in the init_port_config function in a similar
way to how it is done in the VMDq sample application.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
app/test-pmd/testpmd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index a0332c2..c0c8f60 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1842,9 +1842,12 @@ struct pmd_test_command {
ETH_MQ_RX_VMDQ_RSS;
else
port->dev_conf.rxmode.mq_mode =
- ETH_MQ_RX_NONE;
+ ETH_MQ_RX_VMDQ_ONLY;
port->dev_conf.txmode.mq_mode = ETH_MQ_TX_NONE;
+
+ port->dev_conf.rx_adv_conf.vmdq_rx_conf.nb_queue_pools =
+ ETH_8_POOLS;
}
rxtx_port_config(port);
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 27/31] net/i40e: change version number to support Linux VF
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (25 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 26/31] app/testpmd: initialize receive mode for VMDq Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 28/31] net/i40e: return correct vsi_id Wenzhuo Lu
` (13 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 @@
{
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,
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 28/31] net/i40e: return correct vsi_id
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (26 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 27/31] net/i40e: change version number to support Linux VF Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 29/31] net/i40e: parse more VF parameter and configure Wenzhuo Lu
` (12 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 @@
/* 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);
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 29/31] net/i40e: parse more VF parameter and configure
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (27 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 28/31] net/i40e: return correct vsi_id Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 0:12 ` [dpdk-dev] [PATCH 30/31] net/i40e: support Linux VF to configure IRQ link list Wenzhuo Lu
` (11 subsequent siblings)
40 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 @@
/* 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 30/31] net/i40e: support Linux VF to configure IRQ link list
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (28 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 29/31] net/i40e: parse more VF parameter and configure Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 11:25 ` Ferruh Yigit
2016-12-02 0:12 ` [dpdk-dev] [PATCH 31/31] i40e: enhance in sanity check of mac Wenzhuo Lu
` (10 subsequent siblings)
40 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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..4b0da75 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -585,14 +585,116 @@
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 = 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 @@
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);
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 30/31] net/i40e: support Linux VF to configure IRQ link list
2016-12-02 0:12 ` [dpdk-dev] [PATCH 30/31] net/i40e: support Linux VF to configure IRQ link list Wenzhuo Lu
@ 2016-12-02 11:25 ` Ferruh Yigit
2016-12-05 3:02 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-02 11:25 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Chen Jing D(Mark)
On 12/2/2016 12:12 AM, Wenzhuo Lu wrote:
> 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..4b0da75 100644
> --- a/drivers/net/i40e/i40e_pf.c
> +++ b/drivers/net/i40e/i40e_pf.c
> @@ -585,14 +585,116 @@
> 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 = i % 2;
This cause ICC compilation error:
.../app/test-pmd/cmdline.c:(.text+0x79d4): undefined reference to
`rte_pmd_i40e_set_vf_vlan_stripq'
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 30/31] net/i40e: support Linux VF to configure IRQ link list
2016-12-02 11:25 ` Ferruh Yigit
@ 2016-12-05 3:02 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2016-12-05 3:02 UTC (permalink / raw)
To: Yigit, Ferruh, dev; +Cc: Chen, Jing D, Iremonger, Bernard
Hi Ferruh,
Thanks for the comments!
Hi Ferruh, Jing, Bernard,
As they're not functionality issues. Most of them are compile and typo issues. I'll fix them and send a V2.
Best regards
Wenzhuo Lu
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH 31/31] i40e: enhance in sanity check of mac
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (29 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 30/31] net/i40e: support Linux VF to configure IRQ link list Wenzhuo Lu
@ 2016-12-02 0:12 ` Wenzhuo Lu
2016-12-02 11:23 ` Ferruh Yigit
2016-12-02 8:59 ` [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Andrew Rybchenko
` (9 subsequent siblings)
40 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-02 0:12 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
When VF sends request to add a new mac address, PF host
will check if it's a non-zero or uncast 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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 4b0da75..c9cca1e 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -890,7 +890,7 @@
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) ||
+ if(is_zero_ether_addr(mac) ||
i40e_vsi_add_mac(vf->vsi, &filter)) {
ret = I40E_ERR_INVALID_MAC_ADDR;
goto send_msg;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 31/31] i40e: enhance in sanity check of mac
2016-12-02 0:12 ` [dpdk-dev] [PATCH 31/31] i40e: enhance in sanity check of mac Wenzhuo Lu
@ 2016-12-02 11:23 ` Ferruh Yigit
0 siblings, 0 replies; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-02 11:23 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Chen Jing D(Mark)
On 12/2/2016 12:12 AM, Wenzhuo Lu wrote:
> When VF sends request to add a new mac address, PF host
> will check if it's a non-zero or uncast 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>
> ---
commit subject tag should be: "net/i40e:", and MAC is uppercase.
> drivers/net/i40e/i40e_pf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
> index 4b0da75..c9cca1e 100644
> --- a/drivers/net/i40e/i40e_pf.c
> +++ b/drivers/net/i40e/i40e_pf.c
> @@ -890,7 +890,7 @@
> 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) ||
> + if(is_zero_ether_addr(mac) ||
checkpatch warning:
ERROR:SPACING: space required before the open parenthesis '('
> i40e_vsi_add_mac(vf->vsi, &filter)) {
> ret = I40E_ERR_INVALID_MAC_ADDR;
> goto send_msg;
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (30 preceding siblings ...)
2016-12-02 0:12 ` [dpdk-dev] [PATCH 31/31] i40e: enhance in sanity check of mac Wenzhuo Lu
@ 2016-12-02 8:59 ` Andrew Rybchenko
2016-12-02 10:58 ` Iremonger, Bernard
2016-12-02 14:16 ` Thomas Monjalon
` (8 subsequent siblings)
40 siblings, 1 reply; 367+ messages in thread
From: Andrew Rybchenko @ 2016-12-02 8:59 UTC (permalink / raw)
To: Wenzhuo Lu, dev
On 12/02/2016 03:11 AM, Wenzhuo Lu 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.
The patch series adds i40e-specific API functions for VF control (advertise link
status change, MAC anti-spoofing, VLAN anti-spoofing, promiscuous mode, MAC change,
VLAN controls), but RTE API is added to get VF stats. I'm wondering why.
Corresponding patches do not explain why i40e-specific API is added instead of
generic RTE API. IMHO, it is hardly convenient for applications.
(I guess it was a discussion and decision, but I've failed to find in the archive).
Andrew.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e
2016-12-02 8:59 ` [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Andrew Rybchenko
@ 2016-12-02 10:58 ` Iremonger, Bernard
2016-12-02 11:28 ` Iremonger, Bernard
2016-12-02 12:09 ` Andrew Rybchenko
0 siblings, 2 replies; 367+ messages in thread
From: Iremonger, Bernard @ 2016-12-02 10:58 UTC (permalink / raw)
To: Andrew Rybchenko, Lu, Wenzhuo, dev
Hi Andrew,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andrew Rybchenko
> Sent: Friday, December 2, 2016 9:00 AM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF
> on i40e
>
> On 12/02/2016 03:11 AM, Wenzhuo Lu 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.
>
> The patch series adds i40e-specific API functions for VF control (advertise link
> status change, MAC anti-spoofing, VLAN anti-spoofing, promiscuous mode,
> MAC change, VLAN controls), but RTE API is added to get VF stats. I'm
> wondering why.
> Corresponding patches do not explain why i40e-specific API is added instead
> of generic RTE API. IMHO, it is hardly convenient for applications.
> (I guess it was a discussion and decision, but I've failed to find in the archive).
>
> Andrew.
There was a discussion previously in DPDK 16.11 about this approach being used for the ixgbe PMD.
I have attached the email thread.
Regards,
Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e
2016-12-02 10:58 ` Iremonger, Bernard
@ 2016-12-02 11:28 ` Iremonger, Bernard
2016-12-02 12:09 ` Andrew Rybchenko
1 sibling, 0 replies; 367+ messages in thread
From: Iremonger, Bernard @ 2016-12-02 11:28 UTC (permalink / raw)
To: Iremonger, Bernard, Andrew Rybchenko, Lu, Wenzhuo, dev
Hi Andrew,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Iremonger, Bernard
> Sent: Friday, December 2, 2016 10:59 AM
> To: Andrew Rybchenko <arybchenko@solarflare.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF
> on i40e
>
> Hi Andrew,
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andrew
> Rybchenko
> > Sent: Friday, December 2, 2016 9:00 AM
> > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel
> > VF on i40e
> >
> > On 12/02/2016 03:11 AM, Wenzhuo Lu 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.
> >
> > The patch series adds i40e-specific API functions for VF control
> > (advertise link status change, MAC anti-spoofing, VLAN anti-spoofing,
> > promiscuous mode, MAC change, VLAN controls), but RTE API is added to
> > get VF stats. I'm wondering why.
> > Corresponding patches do not explain why i40e-specific API is added
> > instead of generic RTE API. IMHO, it is hardly convenient for applications.
> > (I guess it was a discussion and decision, but I've failed to find in the
> archive).
> >
> > Andrew.
>
> There was a discussion previously in DPDK 16.11 about this approach being
> used for the ixgbe PMD.
> I have attached the email thread.
>
> Regards,
>
> Bernard.
The attached email did not get through for some reason. Here is a link to the email archive.
http://dpdk.org/ml/archives/dev/2016-September/047786.html
Regards,
Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e
2016-12-02 10:58 ` Iremonger, Bernard
2016-12-02 11:28 ` Iremonger, Bernard
@ 2016-12-02 12:09 ` Andrew Rybchenko
1 sibling, 0 replies; 367+ messages in thread
From: Andrew Rybchenko @ 2016-12-02 12:09 UTC (permalink / raw)
To: Iremonger, Bernard, Lu, Wenzhuo, dev
Hi Bernard,
On 12/02/2016 01:58 PM, Iremonger, Bernard wrote:
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andrew Rybchenko
>> Sent: Friday, December 2, 2016 9:00 AM
>> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF
>> on i40e
>>
>> On 12/02/2016 03:11 AM, Wenzhuo Lu 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.
>> The patch series adds i40e-specific API functions for VF control (advertise link
>> status change, MAC anti-spoofing, VLAN anti-spoofing, promiscuous mode,
>> MAC change, VLAN controls), but RTE API is added to get VF stats. I'm
>> wondering why.
>> Corresponding patches do not explain why i40e-specific API is added instead
>> of generic RTE API. IMHO, it is hardly convenient for applications.
>> (I guess it was a discussion and decision, but I've failed to find in the archive).
>>
>> Andrew.
> There was a discussion previously in DPDK 16.11 about this approach being used for the ixgbe PMD.
> I have attached the email thread.
Many thanks. I see that it is a staging area waiting for a later
generalization.
Andrew.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (31 preceding siblings ...)
2016-12-02 8:59 ` [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Andrew Rybchenko
@ 2016-12-02 14:16 ` Thomas Monjalon
2016-12-02 14:25 ` Iremonger, Bernard
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (7 subsequent siblings)
40 siblings, 1 reply; 367+ messages in thread
From: Thomas Monjalon @ 2016-12-02 14:16 UTC (permalink / raw)
To: wenzhuo.lu, bernard.iremonger, ferruh.yigit; +Cc: dev
Do you agree to copy the remaining VF-specific functions from the
generic ethdev API to ixgbe in 17.02?
After a deprecation notice, we could remove them from the generic API in 17.05.
So we will have a consistent status in 17.05 regarding VF functions.
After some time (and experience) we will be able to discuss wether
we need something more to access to these specific features.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e
2016-12-02 14:16 ` Thomas Monjalon
@ 2016-12-02 14:25 ` Iremonger, Bernard
2016-12-02 14:33 ` Thomas Monjalon
0 siblings, 1 reply; 367+ messages in thread
From: Iremonger, Bernard @ 2016-12-02 14:25 UTC (permalink / raw)
To: Thomas Monjalon, Lu, Wenzhuo, Yigit, Ferruh; +Cc: dev
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Friday, December 2, 2016 2:16 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF
> on i40e
>
> Do you agree to copy the remaining VF-specific functions from the generic
> ethdev API to ixgbe in 17.02?
> After a deprecation notice, we could remove them from the generic API in
> 17.05.
> So we will have a consistent status in 17.05 regarding VF functions.
>
> After some time (and experience) we will be able to discuss wether we need
> something more to access to these specific features.
I had intended to copy the remaining VF-specific functions from the generic ethdev API to ixgbe in 17.02 and a deprecation notice was sent in 16.11.
This work was parked in order work on the VF-specfic functionsfor the i40e. Is it ok to submit patches for this work after the V1 deadline (today)?
Regards,
Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e
2016-12-02 14:25 ` Iremonger, Bernard
@ 2016-12-02 14:33 ` Thomas Monjalon
0 siblings, 0 replies; 367+ messages in thread
From: Thomas Monjalon @ 2016-12-02 14:33 UTC (permalink / raw)
To: Iremonger, Bernard; +Cc: Lu, Wenzhuo, Yigit, Ferruh, dev
2016-12-02 14:25, Iremonger, Bernard:
> Hi Thomas,
>
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> >
> > Do you agree to copy the remaining VF-specific functions from the generic
> > ethdev API to ixgbe in 17.02?
> > After a deprecation notice, we could remove them from the generic API in
> > 17.05.
> > So we will have a consistent status in 17.05 regarding VF functions.
> >
> > After some time (and experience) we will be able to discuss wether we need
> > something more to access to these specific features.
>
> I had intended to copy the remaining VF-specific functions from the generic ethdev API to ixgbe in 17.02 and a deprecation notice was sent in 16.11.
>
> This work was parked in order work on the VF-specfic functionsfor the i40e. Is it ok to submit patches for this work after the V1 deadline (today)?
Yes, it is a kind of cleanup and it has been discussed earlier.
So yes you can submit it later. Sooner is better though :)
Thanks
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 00/32] Support VFD and DPDK PF + kernel VF on i40e
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (32 preceding siblings ...)
2016-12-02 14:16 ` Thomas Monjalon
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 01/32] net/i40e: support link status notification Wenzhuo Lu
` (31 more replies)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (6 subsequent siblings)
40 siblings, 32 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev
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.
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 (8):
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
app/testpmd: initialize receive mode for VMDq
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 (4):
net/i40e: enable VF MTU change
rte: add APIs for VF stats get/reset
net/i40e: implement ops for VF stats get/reset
net/i40e: fix VF reset flow
Wenzhuo Lu (11):
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/testpmd: fix invalid port ID
app/test-pmd/Makefile | 1 +
app/test-pmd/cmdline.c | 474 +++++++++++++++-
app/test-pmd/config.c | 17 +-
app/test-pmd/testpmd.c | 5 +-
app/test/Makefile | 8 +
app/test/test_pmd_i40e.c | 96 ++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 30 +
drivers/net/i40e/Makefile | 4 +-
drivers/net/i40e/i40e_ethdev.c | 835 +++++++++++++++++++++++++++-
drivers/net/i40e/i40e_ethdev.h | 5 +-
drivers/net/i40e/i40e_ethdev_vf.c | 81 ++-
drivers/net/i40e/i40e_pf.c | 417 ++++++++++++--
drivers/net/i40e/i40e_pf.h | 9 +-
drivers/net/i40e/rte_pmd_i40e.h | 287 ++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 18 +
lib/librte_ether/rte_ethdev.c | 47 ++
lib/librte_ether/rte_ethdev.h | 47 ++
17 files changed, 2294 insertions(+), 87 deletions(-)
create mode 100644 app/test/test_pmd_i40e.c
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 01/32] net/i40e: support link status notification
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 02/32] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
` (30 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 13085fb..de7f384 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 67778ba..fda1454 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"
@@ -9735,3 +9736,30 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 @@
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 02/32] net/i40e: add callback to user on VF to PF mbox msg
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 01/32] net/i40e: support link status notification Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 12:44 ` Ferruh Yigit
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 03/32] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
` (29 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 02/32] net/i40e: add callback to user on VF to PF mbox msg
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 02/32] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
@ 2016-12-07 12:44 ` Ferruh Yigit
2016-12-20 8:49 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 12:44 UTC (permalink / raw)
To: Wenzhuo Lu, dev
On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> 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 @@
> }
>
> 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));
Even I40E_NOT_SUPPORTED returned to the VF, it seems VF is ignoring this
value, is it something should be fixed as part of this patch?
This path is a little complex, I may be missing something but stack
trace is:
VF:
i40evf_check_api_version()
i40evf_execute_vf_cmd(vfd_cmd_info arg)
i40e_aq_send_msg_to_pf(arg->op, retval, arg->in_msg)
desc <- op, retval
msg_in <- arg_in_msg
i40e_asq_send_command(desc, msg_in)
PF:
i40e_pf_host_handle_vf_msg(op, msg_in)
i40e_pf_host_process_cmd_version()
i40e_pf_host_send_msg_to_vf(op, retval, msg_out)
i40e_aq_send_msg_to_vf(op, retval, msg_out)
desc <- op, retval
i40e_asq_send_command(desc, msg_out)
VF:
data <- arg->out_xxx
i40evf_read_pfmsg(data)
event <- data->out_msg
op <-
retval <-
i40e_clean_arq_element(event)
event->desc <- desc
event->msg <- msg_out
data->result = retval <----------------
return 0;
ver = arg->out_msg
return 0;
So, as far as I can see I40E_NOT_SUPPORTED is somewhere in the stack but
not reached to the final VF function, is this OK?
> }
>
> static int
> @@ -292,13 +302,20 @@
> }
>
> 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 @@
> 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 @@
> 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 @@
> 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 @@
> 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 @@
>
> 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 @@
> 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 @@
> 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 @@
> 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 @@
> 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 @@
> 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 @@
>
> 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 @@
> 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 @@
> 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 @@
> 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 @@
> 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 @@
> 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 @@
> }
>
> 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 @@
> 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 @@
> 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 @@
> 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 @@
> 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;
> + }
> +
Is the reason you just not do [1], because final function requires valid
buffers? Can it be an option to fix them?
[1]
if (!b_op) {
i40e_pf_host_send_msg_to_vf(vf, opcode, I40E_NOT_SUPPORTED, NULL, 0);
}
> 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 @@
> 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
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 02/32] net/i40e: add callback to user on VF to PF mbox msg
2016-12-07 12:44 ` Ferruh Yigit
@ 2016-12-20 8:49 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2016-12-20 8:49 UTC (permalink / raw)
To: Yigit, Ferruh, dev
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 8:45 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 02/32] net/i40e: add callback to user on VF to
> PF mbox msg
>
> On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> > 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 @@
> > }
> >
> > 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));
>
> Even I40E_NOT_SUPPORTED returned to the VF, it seems VF is ignoring this
> value, is it something should be fixed as part of this patch?
>
> This path is a little complex, I may be missing something but stack trace is:
>
> VF:
> i40evf_check_api_version()
> i40evf_execute_vf_cmd(vfd_cmd_info arg)
> i40e_aq_send_msg_to_pf(arg->op, retval, arg->in_msg)
> desc <- op, retval
> msg_in <- arg_in_msg
> i40e_asq_send_command(desc, msg_in)
>
> PF:
> i40e_pf_host_handle_vf_msg(op, msg_in)
> i40e_pf_host_process_cmd_version()
> i40e_pf_host_send_msg_to_vf(op, retval, msg_out)
> i40e_aq_send_msg_to_vf(op, retval, msg_out)
> desc <- op, retval
> i40e_asq_send_command(desc, msg_out)
>
> VF:
> data <- arg->out_xxx
> i40evf_read_pfmsg(data)
> event <- data->out_msg
> op <-
> retval <-
> i40e_clean_arq_element(event)
> event->desc <- desc
> event->msg <- msg_out
> data->result = retval <----------------
> return 0;
> ver = arg->out_msg
> return 0;
>
>
> So, as far as I can see I40E_NOT_SUPPORTED is somewhere in the stack but not
> reached to the final VF function, is this OK?
I think it's a bug in the existing code. It's forgotten to check the ' data->result ' . I will send a separate patch to fix it.
>
>
> > }
> >
> > static int
> > @@ -292,13 +302,20 @@
> > }
> >
> > 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 @@
> > 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 @@
> > 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 @@
> > 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 @@
> > 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 @@
> >
> > 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 @@
> > 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 @@
> > 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
> > @@
> > 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
> > @@ 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
> > @@
> > 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 @@
> >
> > 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 @@
> > 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 @@
> > 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 @@
> > 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 @@
> > 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 @@
> > 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 @@
> > }
> >
> > 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 @@
> > 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 @@
> > 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 @@
> > 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 @@
> > 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;
> > + }
> > +
>
> Is the reason you just not do [1], because final function requires valid buffers?
> Can it be an option to fix them?
I thought about doing [1], but the problem is we cannot use NULL for all kinds of messages. For some messages NULL will break them, so have to handle them case by case.
>
> [1]
> if (!b_op) {
> i40e_pf_host_send_msg_to_vf(vf, opcode, I40E_NOT_SUPPORTED,
> NULL, 0); }
>
> > 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 @@
> > 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
> >
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 03/32] net/i40e: set VF MAC anti-spoofing from PF
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 01/32] net/i40e: support link status notification Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 02/32] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 04/32] net/i40e: set VF VLAN " Wenzhuo Lu
` (28 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 fda1454..0821734 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9763,3 +9763,66 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 04/32] net/i40e: set VF VLAN anti-spoofing from PF
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (2 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 03/32] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 05/32] net/i40e: set TX loopback " Wenzhuo Lu
` (27 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 0821734..ec863b9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4418,6 +4418,7 @@ struct i40e_vsi *
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 @@ struct i40e_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;
+ }
}
/**
@@ -9826,3 +9845,96 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 05/32] net/i40e: set TX loopback from PF
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (3 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 04/32] net/i40e: set VF VLAN " Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 13:04 ` Ferruh Yigit
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 06/32] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
` (26 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 ec863b9..8bd0d70 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9938,3 +9938,222 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 05/32] net/i40e: set TX loopback from PF
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 05/32] net/i40e: set TX loopback " Wenzhuo Lu
@ 2016-12-07 13:04 ` Ferruh Yigit
2016-12-20 8:16 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 13:04 UTC (permalink / raw)
To: Wenzhuo Lu, dev
On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> 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 ec863b9..8bd0d70 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -9938,3 +9938,222 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
>
> 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;
> + }
<----
This part is now duplicated in a few functions, does it make sense to
make it separate function, in the first patch it appeared 3/32 ?
> +
> + /* 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;
We can add these alphabetically.
This may not worth to create a new version of the patch itself, but can
be fixed if a new version already required..
> } DPDK_2.0;
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 05/32] net/i40e: set TX loopback from PF
2016-12-07 13:04 ` Ferruh Yigit
@ 2016-12-20 8:16 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2016-12-20 8:16 UTC (permalink / raw)
To: Yigit, Ferruh, dev
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 9:05 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 05/32] net/i40e: set TX loopback from PF
>
> On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> > 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 ec863b9..8bd0d70 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -9938,3 +9938,222 @@ static void i40e_set_default_mac_addr(struct
> > rte_eth_dev *dev,
> >
> > 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;
> > + }
>
> <----
>
> This part is now duplicated in a few functions, does it make sense to make it
> separate function, in the first patch it appeared 3/32 ?
There's already a function 'i40e_aq_update_vsi_params'. The duplicate code is for preparing the parameter for the functions. It looks bad to me if we add a function for that.
>
> > +
> > + /* 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;
>
> We can add these alphabetically.
> This may not worth to create a new version of the patch itself, but can be fixed
> if a new version already required..
Yes, will do it.
>
> > } DPDK_2.0;
> >
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 06/32] net/i40e: set VF unicast promisc mode from PF
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (4 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 05/32] net/i40e: set TX loopback " Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 07/32] net/i40e: set VF multicast " Wenzhuo Lu
` (25 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 8bd0d70..18ac2f0 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10157,3 +10157,39 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 07/32] net/i40e: set VF multicast promisc mode from PF
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (5 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 06/32] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 08/32] net/i40e: enable VF MTU change Wenzhuo Lu
` (24 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 18ac2f0..88ff6aa 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10193,3 +10193,39 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 08/32] net/i40e: enable VF MTU change
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (6 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 07/32] net/i40e: set VF multicast " Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 09/32] rte: add APIs for VF stats get/reset Wenzhuo Lu
` (23 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: 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 aa306d6..262c4c1 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 @@ struct rte_i40evf_xstats_name_off {
.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,
};
/*
@@ -2635,3 +2637,34 @@ static int i40evf_dev_xstats_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;
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 09/32] rte: add APIs for VF stats get/reset
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (7 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 08/32] net/i40e: enable VF MTU change Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 13:52 ` Ferruh Yigit
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 10/32] net/i40e: implement ops " Wenzhuo Lu
` (22 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
This patch add below two APIs so that VF statistics
can be get/clear from PF side.
rte_eth_vf_stats_get.
rte_eth_vf_stats_reset.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
lib/librte_ether/rte_ethdev.c | 47 +++++++++++++++++++++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.h | 47 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 94 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index fde8112..03b4edf 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3270,3 +3270,50 @@ int rte_eth_dev_bypass_init(uint8_t port_id)
-ENOTSUP);
return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, mask, en);
}
+
+int
+rte_eth_vf_stats_get(uint8_t port_id,
+ uint16_t vf,
+ struct rte_eth_stats *stats)
+{
+ struct rte_eth_dev *dev;
+ struct rte_eth_dev_info dev_info;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+ dev = &rte_eth_devices[port_id];
+ rte_eth_dev_info_get(port_id, &dev_info);
+
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vf_stats_get, -ENOTSUP);
+
+ if (vf >= dev_info.max_vfs) {
+ RTE_PMD_DEBUG_TRACE("Get VF Stats:port %d: "
+ "invalid vf id=%d\n", port_id, vf);
+ return -EINVAL;
+ }
+
+ return (*dev->dev_ops->vf_stats_get)(dev, vf, stats);
+}
+
+int
+rte_eth_vf_stats_reset(uint8_t port_id,
+ uint16_t vf)
+{
+ struct rte_eth_dev *dev;
+ struct rte_eth_dev_info dev_info;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+ dev = &rte_eth_devices[port_id];
+ rte_eth_dev_info_get(port_id, &dev_info);
+
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vf_stats_reset, -ENOTSUP);
+
+ if (vf >= dev_info.max_vfs) {
+ RTE_PMD_DEBUG_TRACE("Reset VF Stats:port %d: "
+ "invalid vf id=%d\n", port_id, vf);
+ return -EINVAL;
+ }
+
+ return (*dev->dev_ops->vf_stats_reset)(dev, vf);
+}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9678179..8b564ee 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1271,6 +1271,15 @@ typedef int (*eth_set_vf_vlan_filter_t)(struct rte_eth_dev *dev,
uint8_t vlan_on);
/**< @internal Set VF VLAN pool filter */
+typedef int (*eth_vf_stats_get)(struct rte_eth_dev *dev,
+ uint16_t vf,
+ struct rte_eth_stats *stats);
+/**< @internal Get VF statistics */
+
+typedef int (*eth_vf_stats_reset)(struct rte_eth_dev *dev,
+ uint16_t vf);
+/**< @internal Clear VF statistics */
+
typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
uint16_t queue_idx,
uint16_t tx_rate);
@@ -1483,6 +1492,8 @@ struct eth_dev_ops {
eth_set_vf_rx_t set_vf_rx; /**< enable/disable a VF receive */
eth_set_vf_tx_t set_vf_tx; /**< enable/disable a VF transmit */
eth_set_vf_vlan_filter_t set_vf_vlan_filter; /**< Set VF VLAN filter */
+ eth_vf_stats_get vf_stats_get; /**< Get VF's statistics */
+ eth_vf_stats_reset vf_stats_reset; /**< Reset VF's statistics */
/** Add UDP tunnel port. */
eth_udp_tunnel_port_add_t udp_tunnel_port_add;
/** Del UDP tunnel port. */
@@ -4379,6 +4390,42 @@ int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
*/
int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+/**
+ * Get VF's statistics
+ *
+ * @param port_id
+ * pointer to port identifier of the device
+ * @param vf
+ * VF id
+ * @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
+ * Zero if successful. Non-zero otherwise.
+ */
+int rte_eth_vf_stats_get(uint8_t port_id,
+ uint16_t vf,
+ struct rte_eth_stats *stats);
+
+/**
+ * Clear VF's statistics
+ *
+ * @param port_id
+ * pointer to port identifier of the device
+ * @param vf
+ * vf id
+ * @return
+ * Zero if successful. Non-zero otherwise.
+ */
+int rte_eth_vf_stats_reset(uint8_t port_id,
+ uint16_t vf);
+
#ifdef __cplusplus
}
#endif
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 09/32] rte: add APIs for VF stats get/reset
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 09/32] rte: add APIs for VF stats get/reset Wenzhuo Lu
@ 2016-12-07 13:52 ` Ferruh Yigit
2016-12-08 3:23 ` Zhang, Qi Z
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 13:52 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Qi Zhang, Thomas Monjalon
On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> This patch add below two APIs so that VF statistics
> can be get/clear from PF side.
> rte_eth_vf_stats_get.
> rte_eth_vf_stats_reset.
patch subject can have " ... from PF" both to be consistent with other
patches and to clarify what it does: add APIS to get/reset VF stats from PF?
>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
<...>
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 9678179..8b564ee 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -1271,6 +1271,15 @@ typedef int (*eth_set_vf_vlan_filter_t)(struct rte_eth_dev *dev,
> uint8_t vlan_on);
> /**< @internal Set VF VLAN pool filter */
>
> +typedef int (*eth_vf_stats_get)(struct rte_eth_dev *dev,
> + uint16_t vf,
> + struct rte_eth_stats *stats);
> +/**< @internal Get VF statistics */
> +
> +typedef int (*eth_vf_stats_reset)(struct rte_eth_dev *dev,
> + uint16_t vf);
> +/**< @internal Clear VF statistics */
> +
> typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
> uint16_t queue_idx,
> uint16_t tx_rate);
> @@ -1483,6 +1492,8 @@ struct eth_dev_ops {
> eth_set_vf_rx_t set_vf_rx; /**< enable/disable a VF receive */
> eth_set_vf_tx_t set_vf_tx; /**< enable/disable a VF transmit */
> eth_set_vf_vlan_filter_t set_vf_vlan_filter; /**< Set VF VLAN filter */
> + eth_vf_stats_get vf_stats_get; /**< Get VF's statistics */
> + eth_vf_stats_reset vf_stats_reset; /**< Reset VF's statistics */
Do we really want to add more ops to the eth_dev_ops?
Although vf_stats_get & vf_stats_reset sounds generic, why not implement
these first in PMD specific manner, and more PMDs implement these, move
to the generic eth_dev_ops layer?
CC: Thomas
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 09/32] rte: add APIs for VF stats get/reset
2016-12-07 13:52 ` Ferruh Yigit
@ 2016-12-08 3:23 ` Zhang, Qi Z
0 siblings, 0 replies; 367+ messages in thread
From: Zhang, Qi Z @ 2016-12-08 3:23 UTC (permalink / raw)
To: Yigit, Ferruh, Lu, Wenzhuo, dev; +Cc: Thomas Monjalon
Hi Ferruh:
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 9:52 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Thomas Monjalon
> <thomas.monjalon@6wind.com>
> Subject: Re: [dpdk-dev] [PATCH v2 09/32] rte: add APIs for VF stats get/reset
>
> On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> > This patch add below two APIs so that VF statistics can be get/clear
> > from PF side.
> > rte_eth_vf_stats_get.
> > rte_eth_vf_stats_reset.
>
> patch subject can have " ... from PF" both to be consistent with other patches
> and to clarify what it does: add APIS to get/reset VF stats from PF?
>
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > ---
>
> <...>
>
> > diff --git a/lib/librte_ether/rte_ethdev.h
> > b/lib/librte_ether/rte_ethdev.h index 9678179..8b564ee 100644
> > --- a/lib/librte_ether/rte_ethdev.h
> > +++ b/lib/librte_ether/rte_ethdev.h
> > @@ -1271,6 +1271,15 @@ typedef int (*eth_set_vf_vlan_filter_t)(struct
> rte_eth_dev *dev,
> > uint8_t vlan_on);
> > /**< @internal Set VF VLAN pool filter */
> >
> > +typedef int (*eth_vf_stats_get)(struct rte_eth_dev *dev,
> > + uint16_t vf,
> > + struct rte_eth_stats *stats);
> > +/**< @internal Get VF statistics */
> > +
> > +typedef int (*eth_vf_stats_reset)(struct rte_eth_dev *dev,
> > + uint16_t vf);
> > +/**< @internal Clear VF statistics */
> > +
> > typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
> > uint16_t queue_idx,
> > uint16_t tx_rate);
> > @@ -1483,6 +1492,8 @@ struct eth_dev_ops {
> > eth_set_vf_rx_t set_vf_rx; /**< enable/disable a VF
> receive */
> > eth_set_vf_tx_t set_vf_tx; /**< enable/disable a VF
> transmit */
> > eth_set_vf_vlan_filter_t set_vf_vlan_filter; /**< Set VF VLAN filter */
> > + eth_vf_stats_get vf_stats_get; /**< Get VF's statistics */
> > + eth_vf_stats_reset vf_stats_reset; /**< Reset VF's statistics */
>
> Do we really want to add more ops to the eth_dev_ops?
>
> Although vf_stats_get & vf_stats_reset sounds generic, why not implement
> these first in PMD specific manner, and more PMDs implement these, move to
> the generic eth_dev_ops layer?
OK, will move to rte_pmd_i40 APIs.
> CC: Thomas
>
> <...>
Thanks
Qi
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 10/32] net/i40e: implement ops for VF stats get/reset
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (8 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 09/32] rte: add APIs for VF stats get/reset Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 13:59 ` Ferruh Yigit
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 11/32] net/i40e: fix VF reset flow Wenzhuo Lu
` (21 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
This patch implement vf_stats_get and vf_stats_reset ops for i40e.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 64 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 88ff6aa..5c9d6d1 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -462,6 +462,13 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
static int i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
+static int i40e_vf_stats_get(struct rte_eth_dev *dev,
+ uint16_t vf,
+ struct rte_eth_stats *stats);
+
+static int i40e_vf_stats_reset(struct rte_eth_dev *dev,
+ uint16_t vf);
+
static const struct rte_pci_id pci_id_i40e_map[] = {
{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_SFP_XL710) },
{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_QEMU) },
@@ -554,6 +561,8 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
.get_eeprom = i40e_get_eeprom,
.mac_addr_set = i40e_set_default_mac_addr,
.mtu_set = i40e_dev_mtu_set,
+ .vf_stats_get = i40e_vf_stats_get,
+ .vf_stats_reset = i40e_vf_stats_reset,
};
/* store statistics names and its offset in stats structure */
@@ -10229,3 +10238,58 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+static int
+i40e_vf_stats_get(struct rte_eth_dev *dev,
+ uint16_t vf,
+ struct rte_eth_stats *stats)
+{
+ struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct i40e_vsi *vsi;
+
+ int ret = 0;
+
+ if (pf->vf_num <= vf) {
+ PMD_DRV_LOG(ERR, "Invalid VF id %d\n", vf);
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf].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;
+}
+
+static int
+i40e_vf_stats_reset(struct rte_eth_dev *dev,
+ uint16_t vf)
+{
+ struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct i40e_vsi *vsi;
+
+ int ret = 0;
+
+ if (pf->vf_num <= vf) {
+ PMD_DRV_LOG(ERR, "Invalid VF id %d\n", vf);
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf].vsi;
+
+ vsi->offset_loaded = false;
+ i40e_update_vsi_stats(vsi);
+
+ return ret;
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 10/32] net/i40e: implement ops for VF stats get/reset
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 10/32] net/i40e: implement ops " Wenzhuo Lu
@ 2016-12-07 13:59 ` Ferruh Yigit
0 siblings, 0 replies; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 13:59 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Qi Zhang
On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> This patch implement vf_stats_get and vf_stats_reset ops for i40e.
>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
<...>
> +static int
> +i40e_vf_stats_get(struct rte_eth_dev *dev,
> + uint16_t vf,
> + struct rte_eth_stats *stats)
> +{
> + struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> + struct i40e_vsi *vsi;
> +
> + int ret = 0;
> +
> + if (pf->vf_num <= vf) {
> + PMD_DRV_LOG(ERR, "Invalid VF id %d\n", vf);
> + return -EINVAL;
> + }
Do we need following check as it has been done in prev patches:
+ rte_eth_dev_info_get(port, &dev_info);
+
+ if (vf_id >= dev_info.max_vfs)
+ return -EINVAL;
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 11/32] net/i40e: fix VF reset flow
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (9 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 10/32] net/i40e: implement ops " Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 12/32] net/i40e: set VF MAC from PF support Wenzhuo Lu
` (20 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: stable, Qi Zhang
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 @@
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 @@
}
/* 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 @@
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 {
/*
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 12/32] net/i40e: set VF MAC from PF support
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (10 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 11/32] net/i40e: fix VF reset flow Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 14:29 ` Ferruh Yigit
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 13/32] net/i40e: set VF MAC from VF support Wenzhuo Lu
` (19 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
Support setting VF MAC address from PF.
User can call the API on PF to set a specific
VF's MAC address.
This will reset the VF.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
app/test/Makefile | 8 +++
app/test/test_pmd_i40e.c | 96 +++++++++++++++++++++++++++++++
drivers/net/i40e/i40e_ethdev.c | 42 ++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 2 +
5 files changed, 167 insertions(+)
create mode 100644 app/test/test_pmd_i40e.c
diff --git a/app/test/Makefile b/app/test/Makefile
index 5be023a..b3f6ecb 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -199,6 +199,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
+SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += test_pmd_i40e.c
+
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
@@ -228,6 +230,12 @@ endif
endif
endif
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
+LDLIBS += -lrte_pmd_i40e
+endif
+endif
+
ifeq ($(CONFIG_RTE_APP_TEST_RESOURCE_TAR),y)
LDLIBS += -larchive
endif
diff --git a/app/test/test_pmd_i40e.c b/app/test/test_pmd_i40e.c
new file mode 100644
index 0000000..c901e89
--- /dev/null
+++ b/app/test/test_pmd_i40e.c
@@ -0,0 +1,96 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * 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.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <inttypes.h>
+
+#include <rte_pmd_i40e.h>
+#include <rte_ethdev.h>
+
+#include "test.h"
+
+#define I40E_DRV_NAME "net_i40e"
+
+static struct ether_addr mac_addr = {
+ { 0xAA, 0xBB, 0xCC, 0xDD, 0x00, 0x00 }
+};
+
+static const int max_vfs = 3;
+
+static int
+test_i40e(void)
+{
+ struct rte_eth_dev_info dev_info;
+ struct ether_addr current_mac_addr;
+ uint8_t nb_ports;
+ uint8_t port;
+ int ret = 0;
+ int i;
+
+ nb_ports = rte_eth_dev_count();
+ printf("nb_ports=%d\n", nb_ports);
+
+ for (port = 0; port < nb_ports; port++) {
+ rte_eth_dev_info_get(port, &dev_info);
+
+ printf("%d: %s\n", port, dev_info.driver_name);
+
+ if (strcmp(dev_info.driver_name, I40E_DRV_NAME))
+ continue;
+
+ rte_eth_macaddr_get(port, ¤t_mac_addr);
+
+ printf("%d: mac address:", port);
+ for (i = 0; i < ETHER_ADDR_LEN - 1; i++)
+ printf("%x:", current_mac_addr.addr_bytes[i]);
+ printf("%x\n", current_mac_addr.addr_bytes[ETHER_ADDR_LEN - 1]);
+
+ for (i = 0; i < max_vfs; i++) {
+ if (i >= dev_info.max_vfs)
+ break;
+
+ mac_addr.addr_bytes[ETHER_ADDR_LEN - 2] = port + 1;
+ mac_addr.addr_bytes[ETHER_ADDR_LEN - 1] = i + 1;
+
+ ret = rte_pmd_i40e_set_vf_mac_addr(port, i, &mac_addr);
+ printf("port:%d vf:%d set mac %s\n",
+ port, i, ret ? "failed" : "succeed");
+ }
+ }
+
+ return 0;
+}
+
+REGISTER_TEST_COMMAND(i40e_autotest, test_i40e);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 5c9d6d1..832995a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10293,3 +10293,45 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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);
+
+ i40e_pf_host_vf_reset(vf, 1);
+
+ return 0;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 9091520..ca5e05a 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 reset the vf.
+ *
+ * @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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 12/32] net/i40e: set VF MAC from PF support
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 12/32] net/i40e: set VF MAC from PF support Wenzhuo Lu
@ 2016-12-07 14:29 ` Ferruh Yigit
2016-12-08 1:01 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 14:29 UTC (permalink / raw)
To: Wenzhuo Lu, dev
On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> Support setting VF MAC address from PF.
> User can call the API on PF to set a specific
> VF's MAC address.
>
> This will reset the VF.
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
<...>
>
> +/**
> + * Set the VF MAC address.
> + *
> + * This will reset the vf.
It may be good if I add a comment that this also will remove all
existing mac filters. Same to commit log perhaps.
> + *
> + * @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);
> +
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 12/32] net/i40e: set VF MAC from PF support
2016-12-07 14:29 ` Ferruh Yigit
@ 2016-12-08 1:01 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2016-12-08 1:01 UTC (permalink / raw)
To: Yigit, Ferruh, dev
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 10:30 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: Re: [PATCH v2 12/32] net/i40e: set VF MAC from PF support
>
> On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> > Support setting VF MAC address from PF.
> > User can call the API on PF to set a specific VF's MAC address.
> >
> > This will reset the VF.
> >
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> > ---
>
> <...>
>
> >
> > +/**
> > + * Set the VF MAC address.
> > + *
> > + * This will reset the vf.
>
> It may be good if I add a comment that this also will remove all existing mac
> filters. Same to commit log perhaps.
Agree. Please:)
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 13/32] net/i40e: set VF MAC from VF support
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (11 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 12/32] net/i40e: set VF MAC from PF support Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 14/32] net/i40e: fix VF MAC address assignment Wenzhuo Lu
` (18 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
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 | 48 +++++++++++++++++++++++++++++++++------
2 files changed, 44 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 262c4c1..cc2d03c 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 @@ struct rte_i40evf_xstats_name_off {
.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,15 @@ struct rte_i40evf_xstats_name_off {
}
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 +926,17 @@ struct rte_i40evf_xstats_name_off {
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)
{
@@ -1261,10 +1271,12 @@ static int i40evf_dev_xstats_get(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) {
@@ -2668,3 +2680,25 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
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);
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 14/32] net/i40e: fix VF MAC address assignment
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (12 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 13/32] net/i40e: set VF MAC from VF support Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func Wenzhuo Lu
` (17 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: stable, Ferruh Yigit
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 cc2d03c..3b9a673 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1193,7 +1193,6 @@ static int i40evf_dev_xstats_get(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 @@ static int i40evf_dev_xstats_get(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) {
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (13 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 14/32] net/i40e: fix VF MAC address assignment Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 14:18 ` Ferruh Yigit
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 16/32] net/i40e: add set VF VLAN insert function Wenzhuo Lu
` (16 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 | 20 ++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 47 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 832995a..253209b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10335,3 +10335,29 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 ca5e05a..043ae62 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -187,4 +187,24 @@ 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.
+ * - (-ENOTSUP) if hardware doesn't support this feature.
+ * - (-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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func Wenzhuo Lu
@ 2016-12-07 14:18 ` Ferruh Yigit
2016-12-08 9:10 ` Chen, Jing D
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 14:18 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Chen Jing D(Mark)
On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> 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>
> ---
<...>
> +
> +/* 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
if vd_if is valid, can vsi be NULL? If so this check may be required in
some prev patches too.
> + return -EINVAL;
> +}
> diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
> index ca5e05a..043ae62 100644
> --- a/drivers/net/i40e/rte_pmd_i40e.h
> +++ b/drivers/net/i40e/rte_pmd_i40e.h
> @@ -187,4 +187,24 @@ 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.
> + * - (-ENOTSUP) if hardware doesn't support this feature.
Is this error type returned?
> + * - (-ENODEV) if *port* invalid.
> + * - (-EINVAL) if bad parameter.
> + */
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func
2016-12-07 14:18 ` Ferruh Yigit
@ 2016-12-08 9:10 ` Chen, Jing D
2016-12-08 10:43 ` Ferruh Yigit
0 siblings, 1 reply; 367+ messages in thread
From: Chen, Jing D @ 2016-12-08 9:10 UTC (permalink / raw)
To: Yigit, Ferruh, Lu, Wenzhuo, dev
HI, Ferruh,
Best Regards,
Mark
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 07, 2016 10:18 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Chen, Jing D <jing.d.chen@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func
>
> On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> > 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>
> > ---
>
> <...>
>
> > +
> > +/* 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
>
> if vd_if is valid, can vsi be NULL? If so this check may be required in
> some prev patches too.
It's a little impossible. This sanity check just make the code stronger.
>
> > + return -EINVAL;
> > +}
> > diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
> > index ca5e05a..043ae62 100644
> > --- a/drivers/net/i40e/rte_pmd_i40e.h
> > +++ b/drivers/net/i40e/rte_pmd_i40e.h
> > @@ -187,4 +187,24 @@ 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.
> > + * - (-ENOTSUP) if hardware doesn't support this feature.
>
> Is this error type returned?
Good catch. Only -EINVAL and -ENODEV would be returned.
>
> > + * - (-ENODEV) if *port* invalid.
> > + * - (-EINVAL) if bad parameter.
> > + */
> <...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func
2016-12-08 9:10 ` Chen, Jing D
@ 2016-12-08 10:43 ` Ferruh Yigit
2016-12-09 3:07 ` Chen, Jing D
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-08 10:43 UTC (permalink / raw)
To: Chen, Jing D, Lu, Wenzhuo, dev
On 12/8/2016 9:10 AM, Chen, Jing D wrote:
> HI, Ferruh,
>
> Best Regards,
> Mark
>
>
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Wednesday, December 07, 2016 10:18 PM
>> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
>> Cc: Chen, Jing D <jing.d.chen@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func
>>
>> On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
>>> 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>
>>> ---
>>
>> <...>
>>
>>> +
>>> +/* 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
>>
>> if vd_if is valid, can vsi be NULL? If so this check may be required in
>> some prev patches too.
>
> It's a little impossible. This sanity check just make the code stronger.
>
If it is impossible, do you agree to remove this? And if this can be
possible we must update other patches, almost all other patches assume
this can't be NULL.
>>
>>> + return -EINVAL;
>>> +}
>>> diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
>>> index ca5e05a..043ae62 100644
>>> --- a/drivers/net/i40e/rte_pmd_i40e.h
>>> +++ b/drivers/net/i40e/rte_pmd_i40e.h
>>> @@ -187,4 +187,24 @@ 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.
>>> + * - (-ENOTSUP) if hardware doesn't support this feature.
>>
>> Is this error type returned?
>
> Good catch. Only -EINVAL and -ENODEV would be returned.
>
>>
>>> + * - (-ENODEV) if *port* invalid.
>>> + * - (-EINVAL) if bad parameter.
>>> + */
>> <...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func
2016-12-08 10:43 ` Ferruh Yigit
@ 2016-12-09 3:07 ` Chen, Jing D
0 siblings, 0 replies; 367+ messages in thread
From: Chen, Jing D @ 2016-12-09 3:07 UTC (permalink / raw)
To: Yigit, Ferruh, Lu, Wenzhuo, dev
Hi, Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Thursday, December 08, 2016 6:43 PM
> To: Chen, Jing D <jing.d.chen@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>;
> dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func
>
> On 12/8/2016 9:10 AM, Chen, Jing D wrote:
> > HI, Ferruh,
> >
> > Best Regards,
> > Mark
> >
> >
> >> -----Original Message-----
> >> From: Yigit, Ferruh
> >> Sent: Wednesday, December 07, 2016 10:18 PM
> >> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> >> Cc: Chen, Jing D <jing.d.chen@intel.com>
> >> Subject: Re: [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func
> >>
> >> On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> >>> 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>
> >>> ---
> >>
> >> <...>
> >>
> >>> +
> >>> +/* 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
> >>
> >> if vd_if is valid, can vsi be NULL? If so this check may be required in
> >> some prev patches too.
> >
> > It's a little impossible. This sanity check just make the code stronger.
> >
>
> If it is impossible, do you agree to remove this? And if this can be
> possible we must update other patches, almost all other patches assume
> this can't be NULL.
I'll recommend other patches to add it, too.
The reason is we can't image if there is some code change have impact in
future, the necessary sanity check in slow patch make code stronger.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 16/32] net/i40e: add set VF VLAN insert function
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (14 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 15/32] net/i40e: add VF vlan strip func Wenzhuo Lu
@ 2016-12-07 3:31 ` Wenzhuo Lu
2016-12-07 14:26 ` Ferruh Yigit
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 17/32] net/i40e: set VF broadcast mode from PF Wenzhuo Lu
` (15 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 253209b..c571d8b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10361,3 +10361,56 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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)
+ return -EINVAL;
+
+ if (vlan_id > 4095)
+ 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 043ae62..8867e9c 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -207,4 +207,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 16/32] net/i40e: add set VF VLAN insert function
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 16/32] net/i40e: add set VF VLAN insert function Wenzhuo Lu
@ 2016-12-07 14:26 ` Ferruh Yigit
2016-12-07 14:42 ` Ferruh Yigit
2016-12-07 17:36 ` Iremonger, Bernard
0 siblings, 2 replies; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 14:26 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Bernard Iremonger
On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> Support inserting VF VLAN id from PF.
> User can call the API on PF to insert a VLAN id to a
> specific VF.
Same comment with prev patch, does it make sense to insert " from PF" to
patch title?
>
> 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 253209b..c571d8b 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -10361,3 +10361,56 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
> 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)
This check was [1] in prev patches:
[1]
if (vf_id > pf->vf_num - 1 || !pf->vfs)
> + return -EINVAL;
> +
> + if (vlan_id > 4095)
Can there be any define in base driver for this? Or ETH_VLAN_ID_MAX perhaps?
> + 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");
<-----
If Wenzhuo prefers to extract this part into a function, it can be
re-used here too.
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 16/32] net/i40e: add set VF VLAN insert function
2016-12-07 14:26 ` Ferruh Yigit
@ 2016-12-07 14:42 ` Ferruh Yigit
2016-12-07 17:36 ` Iremonger, Bernard
1 sibling, 0 replies; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 14:42 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Bernard Iremonger
On 12/7/2016 2:26 PM, Ferruh Yigit wrote:
> On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
>> Support inserting VF VLAN id from PF.
>> User can call the API on PF to insert a VLAN id to a
>> specific VF.
>
> Same comment with prev patch, does it make sense to insert " from PF" to
> patch title?
>
>>
>> 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 253209b..c571d8b 100644
>> --- a/drivers/net/i40e/i40e_ethdev.c
>> +++ b/drivers/net/i40e/i40e_ethdev.c
>> @@ -10361,3 +10361,56 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
>> 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)
>
> This check was [1] in prev patches:
> [1]
> if (vf_id > pf->vf_num - 1 || !pf->vfs)
>
>> + return -EINVAL;
>> +
>> + if (vlan_id > 4095)
>
> Can there be any define in base driver for this? Or ETH_VLAN_ID_MAX perhaps?
Answer was in next patches, it seems we have two options (which is bad)
lib/librte_net/rte_ether.h
#define ETHER_MAX_VLAN_ID 4095 /**< Maximum VLAN ID. */
lib/librte_ether/rte_ethdev.h
#define ETH_VLAN_ID_MAX 0x0FFF /**< VLAN ID is in lower 12 bits*/
>
>> + 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");
> <-----
>
> If Wenzhuo prefers to extract this part into a function, it can be
> re-used here too.
>
> <...>
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 16/32] net/i40e: add set VF VLAN insert function
2016-12-07 14:26 ` Ferruh Yigit
2016-12-07 14:42 ` Ferruh Yigit
@ 2016-12-07 17:36 ` Iremonger, Bernard
1 sibling, 0 replies; 367+ messages in thread
From: Iremonger, Bernard @ 2016-12-07 17:36 UTC (permalink / raw)
To: Yigit, Ferruh, Lu, Wenzhuo, dev
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 2:26 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 16/32] net/i40e: add set VF VLAN insert
> function
>
> On 12/7/2016 3:31 AM, Wenzhuo Lu wrote:
> > Support inserting VF VLAN id from PF.
> > User can call the API on PF to insert a VLAN id to a specific VF.
>
> Same comment with prev patch, does it make sense to insert " from PF" to
> patch title?
Consistency in the patch titles makes sense.
"set VF VLAN filter from PF" might be better.
> >
> > 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 253209b..c571d8b 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -10361,3 +10361,56 @@ static void i40e_set_default_mac_addr(struct
> rte_eth_dev *dev,
> > 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)
if (vf_id >= pf->vf_num)
would be better.
> This check was [1] in prev patches:
> [1]
> if (vf_id > pf->vf_num - 1 || !pf->vfs)
if (vf_id >= pf->vf_num || !pf->vfs)
would be better.
>
> > + return -EINVAL;
> > +
> > + if (vlan_id > 4095)
>
> Can there be any define in base driver for this? Or ETH_VLAN_ID_MAX
> perhaps?
ETHER_MAX_VLAN_ID in rte_ether.h should be used .
> > + 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");
> <-----
>
> If Wenzhuo prefers to extract this part into a function, it can be re-used here
> too.
>
> <...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 17/32] net/i40e: set VF broadcast mode from PF
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (15 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 16/32] net/i40e: add set VF VLAN insert function Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 14:32 ` Ferruh Yigit
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 18/32] net/i40e: set VF VLAN tag " Wenzhuo Lu
` (14 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 18 +++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 62 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index c571d8b..10be00c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10414,3 +10414,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)
+ 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 8867e9c..3e7ecb7 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -226,4 +226,22 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 17/32] net/i40e: set VF broadcast mode from PF
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 17/32] net/i40e: set VF broadcast mode from PF Wenzhuo Lu
@ 2016-12-07 14:32 ` Ferruh Yigit
2016-12-13 14:35 ` Iremonger, Bernard
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 14:32 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Bernard Iremonger
On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> 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>
<...>
> +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)
if (vf_id > pf->vf_num - 1 || !pf->vfs)
> + return -EINVAL;
> +
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 17/32] net/i40e: set VF broadcast mode from PF
2016-12-07 14:32 ` Ferruh Yigit
@ 2016-12-13 14:35 ` Iremonger, Bernard
0 siblings, 0 replies; 367+ messages in thread
From: Iremonger, Bernard @ 2016-12-13 14:35 UTC (permalink / raw)
To: Yigit, Ferruh, Lu, Wenzhuo, dev
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 2:33 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 17/32] net/i40e: set VF broadcast mode
> from PF
>
> On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> > 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>
>
> <...>
>
> > +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)
>
> if (vf_id > pf->vf_num - 1 || !pf->vfs)
if (vf_id >= pf->vf_num || !pf->vfs)
might be better.
>
> > + return -EINVAL;
> > +
>
> <...>
Regards,
Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 18/32] net/i40e: set VF VLAN tag from PF
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (16 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 17/32] net/i40e: set VF broadcast mode from PF Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 19/32] net/i40e: set VF VLAN filter " Wenzhuo Lu
` (13 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 10be00c..601e933 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10457,3 +10457,62 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id, uint8_t on)
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 3e7ecb7..0b245da 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 19/32] net/i40e: set VF VLAN filter from PF
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (17 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 18/32] net/i40e: set VF VLAN tag " Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 14:46 ` Ferruh Yigit
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 20/32] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
` (12 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 50 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 22 ++++++++++++++
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 601e933..bc96698 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10516,3 +10516,53 @@ 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 = 0;
+
+ 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;
+ 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 0b245da..1ce9513 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_vlan_insert(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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 19/32] net/i40e: set VF VLAN filter from PF
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 19/32] net/i40e: set VF VLAN filter " Wenzhuo Lu
@ 2016-12-07 14:46 ` Ferruh Yigit
2016-12-07 17:41 ` Iremonger, Bernard
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 14:46 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Bernard Iremonger
On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> 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 | 50 +++++++++++++++++++++++++++++++
> drivers/net/i40e/rte_pmd_i40e.h | 22 ++++++++++++++
> 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 601e933..bc96698 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -10516,3 +10516,53 @@ 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)
> +{
<...>
> +
> + for (pool_idx = 0;
> + pool_idx < ETH_64_POOLS && pool_idx < pf->nb_cfg_vmdq_vsi;
> + 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);
Since loop not break on error, this will only log the last one, if the
error is in the middle, it is missed.
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 19/32] net/i40e: set VF VLAN filter from PF
2016-12-07 14:46 ` Ferruh Yigit
@ 2016-12-07 17:41 ` Iremonger, Bernard
0 siblings, 0 replies; 367+ messages in thread
From: Iremonger, Bernard @ 2016-12-07 17:41 UTC (permalink / raw)
To: Yigit, Ferruh, Lu, Wenzhuo, dev
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 2:46 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 19/32] net/i40e: set VF VLAN filter from
> PF
>
> On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> > 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 | 50
> +++++++++++++++++++++++++++++++
> > drivers/net/i40e/rte_pmd_i40e.h | 22 ++++++++++++++
> > 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 601e933..bc96698 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -10516,3 +10516,53 @@ 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) {
> <...>
> > +
> > + for (pool_idx = 0;
> > + pool_idx < ETH_64_POOLS && pool_idx < pf->nb_cfg_vmdq_vsi;
> > + 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);
>
> Since loop not break on error, this will only log the last one, if the error is in
> the middle, it is missed.
It would be better to break out of the loop on error.
>
> <...>
Regards,
Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 20/32] app/testpmd: use VFD APIs on i40e
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (18 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 19/32] net/i40e: set VF VLAN filter " Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 21/32] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
` (11 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark), Bernard Iremonger
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 | 1 +
app/test-pmd/cmdline.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 86 insertions(+), 7 deletions(-)
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 891b85a..87cbaf9 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -59,6 +59,7 @@ SRCS-y += icmpecho.c
SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
_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 63b55dc..12126ce 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;
@@ -10806,9 +10809,22 @@ struct cmd_vf_vlan_anti_spoof_result {
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;
@@ -10818,6 +10834,9 @@ struct cmd_vf_vlan_anti_spoof_result {
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));
}
@@ -10891,9 +10910,22 @@ struct cmd_vf_mac_anti_spoof_result {
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;
@@ -10903,6 +10935,9 @@ struct cmd_vf_mac_anti_spoof_result {
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));
}
@@ -10976,8 +11011,20 @@ struct cmd_vf_vlan_stripq_result {
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;
@@ -10987,6 +11034,9 @@ struct cmd_vf_vlan_stripq_result {
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));
}
@@ -11059,8 +11109,20 @@ struct cmd_vf_vlan_insert_result {
{
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;
@@ -11070,6 +11132,9 @@ struct cmd_vf_vlan_insert_result {
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));
}
@@ -11133,8 +11198,18 @@ struct cmd_tx_loopback_result {
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;
@@ -11144,6 +11219,9 @@ struct cmd_tx_loopback_result {
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));
}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 21/32] app/testpmd: use unicast promiscuous mode on i40e
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (19 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 20/32] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 14:59 ` Ferruh Yigit
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 22/32] app/testpmd: use multicast " Wenzhuo Lu
` (10 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 8 +++
2 files changed, 100 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 12126ce..d39712e 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -404,6 +404,11 @@ 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"
+#ifdef RTE_LIBRTE_I40E_PMD
+ "set vf unicast-promisc (port_id) (vf_id) (on|off)\n"
+ " Set unicast promiscuous mode for a VF from the PF.\n\n"
+#endif
+
"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"
@@ -11489,6 +11494,90 @@ struct cmd_set_vf_mac_addr_result {
};
#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+/* VF unicast promiscuous mode configuration */
+
+/* Common result structure for VF unicast promiscuous mode */
+struct cmd_vf_unicast_promisc_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t vf;
+ cmdline_fixed_string_t unicast_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_unicast_promisc_set =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ set, "set");
+cmdline_parse_token_string_t cmd_vf_unicast_promisc_vf =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ vf, "vf");
+cmdline_parse_token_string_t cmd_vf_unicast_promisc_unicast_promisc =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ unicast_promisc, "unicast-promisc");
+cmdline_parse_token_num_t cmd_vf_unicast_promisc_port_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_unicast_promisc_vf_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_unicast_promisc_on_off =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_unicast_promisc_result,
+ on_off, "on#off");
+
+static void
+cmd_set_vf_unicast_promisc_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_vf_unicast_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_unicast_promisc = {
+ .f = cmd_set_vf_unicast_promisc_parsed,
+ .data = NULL,
+ .help_str = "set vf unicast promiscuous port_id vf_id on|off",
+ .tokens = {
+ (void *)&cmd_vf_unicast_promisc_set,
+ (void *)&cmd_vf_unicast_promisc_vf,
+ (void *)&cmd_vf_unicast_promisc_unicast_promisc,
+ (void *)&cmd_vf_unicast_promisc_port_id,
+ (void *)&cmd_vf_unicast_promisc_vf_id,
+ (void *)&cmd_vf_unicast_promisc_on_off,
+ NULL,
+ },
+};
+#endif
+
/* ******************************************************************************** */
/* list of instructions */
@@ -11655,6 +11744,9 @@ struct cmd_set_vf_mac_addr_result {
(cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en,
(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ (cmdline_parse_inst_t *)&cmd_set_vf_unicast_promisc,
+#endif
NULL,
};
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f1c269a..e17e3d5 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -820,6 +820,14 @@ Set the allmulti mode for a port or for all ports::
Same as the ifconfig (8) option. Controls how multicast packets are handled.
+set unicast promisc (for VF)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set the unicast promiscuous mode for a VF from PF.
+In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
+
+ testpmd> set vf unicast-promisc (port_id) (vf_id) (on|off)
+
set flow_ctrl rx
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 21/32] app/testpmd: use unicast promiscuous mode on i40e
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 21/32] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
@ 2016-12-07 14:59 ` Ferruh Yigit
2016-12-13 1:49 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 14:59 UTC (permalink / raw)
To: Wenzhuo Lu, dev
On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> 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 | 8 +++
> 2 files changed, 100 insertions(+)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 12126ce..d39712e 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -404,6 +404,11 @@ 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"
>
> +#ifdef RTE_LIBRTE_I40E_PMD
> + "set vf unicast-promisc (port_id) (vf_id) (on|off)\n"
Previous usages are all "promisc" instead of "unicals-promisc". Is this
to promisc mode for multicast packets? If so testpmd calls them
"allmulti" I guess, so they won't cause trouble.
Can we keep using command: "promisc"?
<...>
> +
> +cmdline_parse_inst_t cmd_set_vf_unicast_promisc = {
> + .f = cmd_set_vf_unicast_promisc_parsed,
> + .data = NULL,
> + .help_str = "set vf unicast promiscuous port_id vf_id on|off",
Can you please differentiate the keyword and variable by wrapping
variables with <>? Like:
"set vf unicast-promiscuous <port_id> <vf_id> on|off"
<...>
>
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index f1c269a..e17e3d5 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -820,6 +820,14 @@ Set the allmulti mode for a port or for all ports::
>
> Same as the ifconfig (8) option. Controls how multicast packets are handled.
>
> +set unicast promisc (for VF)
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Should we mention this is PMD specific feature and only enabled with
some PMDs?
> +
> +Set the unicast promiscuous mode for a VF from PF.
> +In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
> +
> + testpmd> set vf unicast-promisc (port_id) (vf_id) (on|off)
> +
> set flow_ctrl rx
> ~~~~~~~~~~~~~~~~
>
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 21/32] app/testpmd: use unicast promiscuous mode on i40e
2016-12-07 14:59 ` Ferruh Yigit
@ 2016-12-13 1:49 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2016-12-13 1:49 UTC (permalink / raw)
To: Yigit, Ferruh, dev
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 11:00 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 21/32] app/testpmd: use unicast promiscuous
> mode on i40e
>
> On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> > 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 | 8 +++
> > 2 files changed, 100 insertions(+)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > 12126ce..d39712e 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -404,6 +404,11 @@ 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"
> >
> > +#ifdef RTE_LIBRTE_I40E_PMD
> > + "set vf unicast-promisc (port_id) (vf_id) (on|off)\n"
>
> Previous usages are all "promisc" instead of "unicals-promisc". Is this to promisc
> mode for multicast packets? If so testpmd calls them "allmulti" I guess, so they
> won't cause trouble.
>
> Can we keep using command: "promisc"?
Yes, I'll change it.
>
> <...>
>
> > +
> > +cmdline_parse_inst_t cmd_set_vf_unicast_promisc = {
> > + .f = cmd_set_vf_unicast_promisc_parsed,
> > + .data = NULL,
> > + .help_str = "set vf unicast promiscuous port_id vf_id on|off",
>
> Can you please differentiate the keyword and variable by wrapping variables
> with <>? Like:
> "set vf unicast-promiscuous <port_id> <vf_id> on|off"
The existing style is not adding the '<>'. But this help string is not good, it looks like CLI but not help. I'll change it.
>
> <...>
>
> >
> > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > index f1c269a..e17e3d5 100644
> > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > @@ -820,6 +820,14 @@ Set the allmulti mode for a port or for all ports::
> >
> > Same as the ifconfig (8) option. Controls how multicast packets are handled.
> >
> > +set unicast promisc (for VF)
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Should we mention this is PMD specific feature and only enabled with some
> PMDs?
Yes. Will add more explanation.
>
> > +
> > +Set the unicast promiscuous mode for a VF from PF.
> > +In promiscuous mode packets are not dropped if they aren't for the specified
> MAC address::
> > +
> > + testpmd> set vf unicast-promisc (port_id) (vf_id) (on|off)
> > +
> > set flow_ctrl rx
> > ~~~~~~~~~~~~~~~~
> >
> >
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 22/32] app/testpmd: use multicast promiscuous mode on i40e
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (20 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 21/32] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 15:01 ` Ferruh Yigit
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 23/32] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
` (9 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 8 +++
2 files changed, 94 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index d39712e..7e7a016 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -407,6 +407,9 @@ static void cmd_help_long_parsed(void *parsed_result,
#ifdef RTE_LIBRTE_I40E_PMD
"set vf unicast-promisc (port_id) (vf_id) (on|off)\n"
" Set unicast promiscuous mode for a VF from the PF.\n\n"
+
+ "set vf multicast-promisc (port_id) (vf_id) (on|off)\n"
+ " Set multicast promiscuous mode for a VF from the PF.\n\n"
#endif
"set flow_ctrl rx (on|off) tx (on|off) (high_water)"
@@ -11576,6 +11579,88 @@ struct cmd_vf_unicast_promisc_result {
NULL,
},
};
+
+/* VF multicast promiscuous mode configuration */
+
+/* Common result structure for VF multicast promiscuous mode */
+struct cmd_vf_multicast_promisc_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t vf;
+ cmdline_fixed_string_t multicast_promisc;
+ 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_multicast_promisc_set =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ set, "set");
+cmdline_parse_token_string_t cmd_vf_multicast_promisc_vf =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ vf, "vf");
+cmdline_parse_token_string_t cmd_vf_multicast_promisc_multicast_promisc =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ multicast_promisc, "multicast-promisc");
+cmdline_parse_token_num_t cmd_vf_multicast_promisc_port_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_multicast_promisc_vf_id =
+ TOKEN_NUM_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_multicast_promisc_on_off =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_multicast_promisc_result,
+ on_off, "on#off");
+
+static void
+cmd_set_vf_multicast_promisc_parsed(
+ void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_vf_multicast_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_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_multicast_promisc = {
+ .f = cmd_set_vf_multicast_promisc_parsed,
+ .data = NULL,
+ .help_str = "set vf multicast promiscuous port_id vf_id on|off",
+ .tokens = {
+ (void *)&cmd_vf_multicast_promisc_set,
+ (void *)&cmd_vf_multicast_promisc_vf,
+ (void *)&cmd_vf_multicast_promisc_multicast_promisc,
+ (void *)&cmd_vf_multicast_promisc_port_id,
+ (void *)&cmd_vf_multicast_promisc_vf_id,
+ (void *)&cmd_vf_multicast_promisc_on_off,
+ NULL,
+ },
+};
#endif
/* ******************************************************************************** */
@@ -11746,6 +11831,7 @@ struct cmd_vf_unicast_promisc_result {
#endif
#ifdef RTE_LIBRTE_I40E_PMD
(cmdline_parse_inst_t *)&cmd_set_vf_unicast_promisc,
+ (cmdline_parse_inst_t *)&cmd_set_vf_multicast_promisc,
#endif
NULL,
};
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index e17e3d5..e1545b7 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -828,6 +828,14 @@ In promiscuous mode packets are not dropped if they aren't for the specified MAC
testpmd> set vf unicast-promisc (port_id) (vf_id) (on|off)
+set multicast promisc (for VF)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set the multicast promiscuous mode for a VF from PF.
+In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
+
+ testpmd> set vf multicast-promisc (port_id) (vf_id) (on|off)
+
set flow_ctrl rx
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 22/32] app/testpmd: use multicast promiscuous mode on i40e
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 22/32] app/testpmd: use multicast " Wenzhuo Lu
@ 2016-12-07 15:01 ` Ferruh Yigit
2016-12-13 1:45 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 15:01 UTC (permalink / raw)
To: Wenzhuo Lu, dev
On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> 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 | 8 +++
> 2 files changed, 94 insertions(+)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index d39712e..7e7a016 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -407,6 +407,9 @@ static void cmd_help_long_parsed(void *parsed_result,
> #ifdef RTE_LIBRTE_I40E_PMD
> "set vf unicast-promisc (port_id) (vf_id) (on|off)\n"
> " Set unicast promiscuous mode for a VF from the PF.\n\n"
> +
> + "set vf multicast-promisc (port_id) (vf_id) (on|off)\n"
> + " Set multicast promiscuous mode for a VF from the PF.\n\n"
Why not "allmulti" instead of multicast-promisc?
Also same comments as previous patch for help_str and documentation.
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 22/32] app/testpmd: use multicast promiscuous mode on i40e
2016-12-07 15:01 ` Ferruh Yigit
@ 2016-12-13 1:45 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2016-12-13 1:45 UTC (permalink / raw)
To: Yigit, Ferruh, dev
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 11:02 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 22/32] app/testpmd: use multicast
> promiscuous mode on i40e
>
> On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> > 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 | 8 +++
> > 2 files changed, 94 insertions(+)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > d39712e..7e7a016 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -407,6 +407,9 @@ static void cmd_help_long_parsed(void
> > *parsed_result, #ifdef RTE_LIBRTE_I40E_PMD
> > "set vf unicast-promisc (port_id) (vf_id) (on|off)\n"
> > " Set unicast promiscuous mode for a VF from the
> PF.\n\n"
> > +
> > + "set vf multicast-promisc (port_id) (vf_id) (on|off)\n"
> > + " Set multicast promiscuous mode for a VF from the
> PF.\n\n"
>
> Why not "allmulti" instead of multicast-promisc?
>
> Also same comments as previous patch for help_str and documentation.
Sorry for the late. You're right, I should not change the word. Will send a V3.
>
> <...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 23/32] app/testpmd: add command to test VF broadcast mode on i40e
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (21 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 22/32] app/testpmd: use multicast " Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 24/32] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
` (8 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 87 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++
2 files changed, 94 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 7e7a016..2c663c3 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -279,6 +279,11 @@ static void cmd_help_long_parsed(void *parsed_result,
" Set MAC antispoof for a VF from the PF.\n\n"
#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ "set vf broadcast (port_id) (vf_id) (on|off)\n"
+ " Set VF broadcast 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"
@@ -11661,6 +11666,87 @@ struct cmd_vf_multicast_promisc_result {
NULL,
},
};
+
+/* 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,
+ },
+};
#endif
/* ******************************************************************************** */
@@ -11832,6 +11918,7 @@ struct cmd_vf_multicast_promisc_result {
#ifdef RTE_LIBRTE_I40E_PMD
(cmdline_parse_inst_t *)&cmd_set_vf_unicast_promisc,
(cmdline_parse_inst_t *)&cmd_set_vf_multicast_promisc,
+ (cmdline_parse_inst_t *)&cmd_set_vf_broadcast,
#endif
NULL,
};
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index e1545b7..525d0df 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
~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 24/32] app/testpmd: add command to test VF VLAN tag on i40e
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (22 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 23/32] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 25/32] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
` (7 subsequent siblings)
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++
2 files changed, 100 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 2c663c3..e1a7e02 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -301,6 +301,11 @@ static void cmd_help_long_parsed(void *parsed_result,
" Set VLAN antispoof for a VF from the PF.\n\n"
#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ "set vf vlan tag (port_id) (vf_id) (on|off)\n"
+ " Set VLAN tag 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"
@@ -11747,6 +11752,93 @@ struct cmd_set_vf_broadcast_result {
NULL,
},
};
+
+/* 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,
+ },
+};
#endif
/* ******************************************************************************** */
@@ -11919,6 +12011,7 @@ struct cmd_set_vf_broadcast_result {
(cmdline_parse_inst_t *)&cmd_set_vf_unicast_promisc,
(cmdline_parse_inst_t *)&cmd_set_vf_multicast_promisc,
(cmdline_parse_inst_t *)&cmd_set_vf_broadcast,
+ (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag,
#endif
NULL,
};
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 525d0df..cffcac8 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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 25/32] app/testpmd: handle i40e in VF VLAN filter command
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (23 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 24/32] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-13 13:40 ` Ferruh Yigit
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 26/32] app/testpmd: initialize receive mode for VMDq Wenzhuo Lu
` (6 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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, 16 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 36c47ab..0368dc6 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
#include "testpmd.h"
@@ -2349,12 +2352,24 @@ struct igb_ring_desc_16_bytes {
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;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
if (vlan_id_is_invalid(vlan_id))
return;
- diag = rte_eth_dev_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
+
+ rte_eth_dev_info_get(port_id, &dev_info);
+
+#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_eth_dev_set_vf_vlan_filter(port_id, vlan_id,
+ vf_mask, on);
+
if (diag == 0)
return;
printf("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed "
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 25/32] app/testpmd: handle i40e in VF VLAN filter command
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 25/32] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
@ 2016-12-13 13:40 ` Ferruh Yigit
2016-12-14 0:42 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-13 13:40 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Bernard Iremonger
Hi Wenzhuo,
On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> modify set_vf_rx_vlan function to handle the i40e PMD.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
Latest applied patches [1] conflict with some testpmd patches of this
patchset.
Can you please rebase this patchset on top of the latest next-net?
[1]
http://dpdk.org/dev/patchwork/patch/17896 - 17902
Thanks,
ferruh
> app/test-pmd/config.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 36c47ab..0368dc6 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
>
> #include "testpmd.h"
>
> @@ -2349,12 +2352,24 @@ struct igb_ring_desc_16_bytes {
> 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;
>
> if (port_id_is_invalid(port_id, ENABLED_WARN))
> return;
> if (vlan_id_is_invalid(vlan_id))
> return;
> - diag = rte_eth_dev_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on);
> +
> + rte_eth_dev_info_get(port_id, &dev_info);
> +
> +#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_eth_dev_set_vf_vlan_filter(port_id, vlan_id,
> + vf_mask, on);
> +
> if (diag == 0)
> return;
> printf("rte_eth_dev_set_vf_vlan_filter for port_id=%d failed "
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 25/32] app/testpmd: handle i40e in VF VLAN filter command
2016-12-13 13:40 ` Ferruh Yigit
@ 2016-12-14 0:42 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2016-12-14 0:42 UTC (permalink / raw)
To: Yigit, Ferruh, dev; +Cc: Iremonger, Bernard
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, December 13, 2016 9:41 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Iremonger, Bernard
> Subject: Re: [dpdk-dev] [PATCH v2 25/32] app/testpmd: handle i40e in VF VLAN
> filter command
>
> Hi Wenzhuo,
>
> On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> > modify set_vf_rx_vlan function to handle the i40e PMD.
> >
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > ---
>
> Latest applied patches [1] conflict with some testpmd patches of this patchset.
>
> Can you please rebase this patchset on top of the latest next-net?
Sure, we'll rework this series of patches based on the newest next-net.
>
> [1]
> http://dpdk.org/dev/patchwork/patch/17896 - 17902
>
> Thanks,
> ferruh
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 26/32] app/testpmd: initialize receive mode for VMDq
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (24 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 25/32] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 15:06 ` Ferruh Yigit
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 27/32] net/i40e: change version number to support Linux VF Wenzhuo Lu
` (5 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
Initialise VMDq in the init_port_config function in a similar
way to how it is done in the VMDq sample application.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
app/test-pmd/testpmd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index a0332c2..c0c8f60 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1842,9 +1842,12 @@ struct pmd_test_command {
ETH_MQ_RX_VMDQ_RSS;
else
port->dev_conf.rxmode.mq_mode =
- ETH_MQ_RX_NONE;
+ ETH_MQ_RX_VMDQ_ONLY;
port->dev_conf.txmode.mq_mode = ETH_MQ_TX_NONE;
+
+ port->dev_conf.rx_adv_conf.vmdq_rx_conf.nb_queue_pools =
+ ETH_8_POOLS;
}
rxtx_port_config(port);
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 26/32] app/testpmd: initialize receive mode for VMDq
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 26/32] app/testpmd: initialize receive mode for VMDq Wenzhuo Lu
@ 2016-12-07 15:06 ` Ferruh Yigit
2016-12-07 17:00 ` Iremonger, Bernard
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 15:06 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Bernard Iremonger
On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> Initialise VMDq in the init_port_config function in a similar
> way to how it is done in the VMDq sample application.
What is the effect of doing existing initialization?
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 26/32] app/testpmd: initialize receive mode for VMDq
2016-12-07 15:06 ` Ferruh Yigit
@ 2016-12-07 17:00 ` Iremonger, Bernard
0 siblings, 0 replies; 367+ messages in thread
From: Iremonger, Bernard @ 2016-12-07 17:00 UTC (permalink / raw)
To: Yigit, Ferruh, Lu, Wenzhuo, dev
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 3:07 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 26/32] app/testpmd: initialize receive
> mode for VMDq
>
> On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> > Initialise VMDq in the init_port_config function in a similar way to
> > how it is done in the VMDq sample application.
>
> What is the effect of doing existing initialization?
This patch results in the function i40e_vmdq_setup() function being called in i40e_ethdev.c at
Line 1307: ret = i40e_vmdq_setup(dev);
We are seeing unexpected side effects from this patch.
It will be dropped from the v3 of this patch set, pending further investigation.
Regards,
Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 27/32] net/i40e: change version number to support Linux VF
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (25 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 26/32] app/testpmd: initialize receive mode for VMDq Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 15:13 ` Ferruh Yigit
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 28/32] net/i40e: return correct vsi_id Wenzhuo Lu
` (4 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 @@
{
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,
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 27/32] net/i40e: change version number to support Linux VF
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 27/32] net/i40e: change version number to support Linux VF Wenzhuo Lu
@ 2016-12-07 15:13 ` Ferruh Yigit
2016-12-08 9:14 ` Chen, Jing D
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 15:13 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Chen Jing D(Mark)
On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> 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.
I guess you mention from following code [1], should it be also updated
to prevent it giving wrong information:
[1] i40e_ethdev_vf.c
if (vf->version_major == I40E_DPDK_VERSION_MAJOR)
PMD_DRV_LOG(INFO, "Peer is DPDK PF host");
else if ((vf->version_major == I40E_VIRTCHNL_VERSION_MAJOR) &&
(vf->version_minor <= I40E_VIRTCHNL_VERSION_MINOR))
PMD_DRV_LOG(INFO, "Peer is Linux PF host");
else {
>
> Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
> ---
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 27/32] net/i40e: change version number to support Linux VF
2016-12-07 15:13 ` Ferruh Yigit
@ 2016-12-08 9:14 ` Chen, Jing D
0 siblings, 0 replies; 367+ messages in thread
From: Chen, Jing D @ 2016-12-08 9:14 UTC (permalink / raw)
To: Yigit, Ferruh, Lu, Wenzhuo, dev
Hi, Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 07, 2016 11:14 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Chen, Jing D <jing.d.chen@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 27/32] net/i40e: change version number to
> support Linux VF
>
> On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> > 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.
>
> I guess you mention from following code [1], should it be also updated
> to prevent it giving wrong information:
I'd like to update it into some docs.
>
> [1] i40e_ethdev_vf.c
> if (vf->version_major == I40E_DPDK_VERSION_MAJOR)
> PMD_DRV_LOG(INFO, "Peer is DPDK PF host");
> else if ((vf->version_major == I40E_VIRTCHNL_VERSION_MAJOR) &&
> (vf->version_minor <= I40E_VIRTCHNL_VERSION_MINOR))
> PMD_DRV_LOG(INFO, "Peer is Linux PF host");
> else {
>
> >
> > Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
> > ---
>
> <...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 28/32] net/i40e: return correct vsi_id
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (26 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 27/32] net/i40e: change version number to support Linux VF Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 15:16 ` Ferruh Yigit
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 29/32] net/i40e: parse more VF parameter and configure Wenzhuo Lu
` (3 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 @@
/* 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);
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 28/32] net/i40e: return correct vsi_id
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 28/32] net/i40e: return correct vsi_id Wenzhuo Lu
@ 2016-12-07 15:16 ` Ferruh Yigit
2016-12-07 15:34 ` Chen, Jing D
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 15:16 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Chen Jing D(Mark)
On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> PF host didn't return correct VSI id to VF.
> This change fix it.
This looks like a fix for current code,
can you please update commit title and log to reflect the fix?
>
> 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 @@
>
> /* 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);
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 28/32] net/i40e: return correct vsi_id
2016-12-07 15:16 ` Ferruh Yigit
@ 2016-12-07 15:34 ` Chen, Jing D
0 siblings, 0 replies; 367+ messages in thread
From: Chen, Jing D @ 2016-12-07 15:34 UTC (permalink / raw)
To: Yigit, Ferruh, Lu, Wenzhuo, dev
Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 11:16 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Chen, Jing D <jing.d.chen@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 28/32] net/i40e: return correct vsi_id
>
> On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> > PF host didn't return correct VSI id to VF.
> > This change fix it.
>
> This looks like a fix for current code,
> can you please update commit title and log to reflect the fix?
>
This is similar patch to support Linux VF client. DPDK VF client needn't
Vsi ID.
> >
> > 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 @@
> >
> > /* 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);
> >
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 29/32] net/i40e: parse more VF parameter and configure
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (27 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 28/32] net/i40e: return correct vsi_id Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 15:18 ` Ferruh Yigit
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 30/32] net/i40e: support Linux VF to configure IRQ link list Wenzhuo Lu
` (2 subsequent siblings)
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 @@
/* 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 29/32] net/i40e: parse more VF parameter and configure
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 29/32] net/i40e: parse more VF parameter and configure Wenzhuo Lu
@ 2016-12-07 15:18 ` Ferruh Yigit
2016-12-07 15:32 ` Chen, Jing D
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 15:18 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Chen Jing D(Mark)
On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> 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.
What is the effect of missing Tx paramters configured?
If this cause a bug, this patch should be a fix.
>
> 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 @@
>
> /* 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;
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 29/32] net/i40e: parse more VF parameter and configure
2016-12-07 15:18 ` Ferruh Yigit
@ 2016-12-07 15:32 ` Chen, Jing D
0 siblings, 0 replies; 367+ messages in thread
From: Chen, Jing D @ 2016-12-07 15:32 UTC (permalink / raw)
To: Yigit, Ferruh, Lu, Wenzhuo, dev
Hi, Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 11:19 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Chen, Jing D <jing.d.chen@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 29/32] net/i40e: parse more VF parameter
> and configure
>
> On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> > 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.
>
> What is the effect of missing Tx paramters configured?
>
> If this cause a bug, this patch should be a fix.
>
This need to analyze case by case. If PF driver is serving a DPDK VF client,
the missing part is OK. If serving a Linux VF client, the missing part will
cause some unexpected TX queue behaviors.
So, this is an enhancement to support Linux VF client.
> >
> > 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 @@
> >
> > /* 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;
> >
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 30/32] net/i40e: support Linux VF to configure IRQ link list
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (28 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 29/32] net/i40e: parse more VF parameter and configure Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 31/32] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 32/32] app/testpmd: fix invalid port ID Wenzhuo Lu
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 @@
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 @@
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);
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 31/32] net/i40e: enhance in sanity check of MAC
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (29 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 30/32] net/i40e: support Linux VF to configure IRQ link list Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 32/32] app/testpmd: fix invalid port ID Wenzhuo Lu
31 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 @@
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;
}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v2 32/32] app/testpmd: fix invalid port ID
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
` (30 preceding siblings ...)
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 31/32] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
@ 2016-12-07 3:32 ` Wenzhuo Lu
2016-12-07 15:48 ` Ferruh Yigit
31 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark)
Some CLIs don't check the input port ID, it
may cause segmentation fault (core dumped).
Fixes: 425781ff5afe ("app/testpmd: add ixgbe VF management")
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
app/test-pmd/cmdline.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index e1a7e02..be0c424 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -10829,6 +10829,9 @@ struct cmd_vf_vlan_anti_spoof_result {
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;
+
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(res->port_id, &dev_info);
@@ -10930,6 +10933,9 @@ struct cmd_vf_mac_anti_spoof_result {
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;
+
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(res->port_id, &dev_info);
@@ -11031,6 +11037,9 @@ struct cmd_vf_vlan_stripq_result {
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;
+
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(res->port_id, &dev_info);
@@ -11129,6 +11138,9 @@ struct cmd_vf_vlan_insert_result {
int ret;
struct rte_eth_dev_info dev_info;
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(res->port_id, &dev_info);
@@ -11218,6 +11230,9 @@ struct cmd_tx_loopback_result {
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;
+
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(res->port_id, &dev_info);
@@ -11307,6 +11322,9 @@ struct cmd_all_queues_drop_en_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_ixgbe_set_all_queues_drop_en(res->port_id, is_on);
switch (ret) {
case 0:
@@ -11390,6 +11408,9 @@ struct cmd_vf_split_drop_en_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_ixgbe_set_vf_split_drop_en(res->port_id, res->vf_id,
is_on);
switch (ret) {
@@ -11474,6 +11495,9 @@ struct cmd_set_vf_mac_addr_result {
struct cmd_set_vf_mac_addr_result *res = parsed_result;
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);
switch (ret) {
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 32/32] app/testpmd: fix invalid port ID
2016-12-07 3:32 ` [dpdk-dev] [PATCH v2 32/32] app/testpmd: fix invalid port ID Wenzhuo Lu
@ 2016-12-07 15:48 ` Ferruh Yigit
2016-12-08 0:49 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-07 15:48 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Chen Jing D(Mark)
On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> Some CLIs don't check the input port ID, it
> may cause segmentation fault (core dumped).
Are these functions (that we are adding extra check) added with this
patchset? If so why not add these checks where function implemented.
If these functions are already implemented before this patchset, this
patch can be standalone patch, instead of being part of this patchset,
and can be before this patchset so that it can be easily backported to
stable trees.
>
> Fixes: 425781ff5afe ("app/testpmd: add ixgbe VF management")
>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
> ---
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v2 32/32] app/testpmd: fix invalid port ID
2016-12-07 15:48 ` Ferruh Yigit
@ 2016-12-08 0:49 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2016-12-08 0:49 UTC (permalink / raw)
To: Yigit, Ferruh, dev; +Cc: Chen, Jing D
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, December 7, 2016 11:49 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Chen, Jing D
> Subject: Re: [dpdk-dev] [PATCH v2 32/32] app/testpmd: fix invalid port ID
>
> On 12/7/2016 3:32 AM, Wenzhuo Lu wrote:
> > Some CLIs don't check the input port ID, it may cause segmentation
> > fault (core dumped).
>
> Are these functions (that we are adding extra check) added with this patchset? If
> so why not add these checks where function implemented.
>
> If these functions are already implemented before this patchset, this patch can
> be standalone patch, instead of being part of this patchset, and can be before
> this patchset so that it can be easily backported to stable trees.
This patch is for the existing code. I think you're right. I'll remove it from this patch set and send an isolate patch for it.
>
> >
> > Fixes: 425781ff5afe ("app/testpmd: add ixgbe VF management")
> >
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
> > ---
>
> <...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (33 preceding siblings ...)
2016-12-07 3:31 ` [dpdk-dev] [PATCH v2 00/32] " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 01/25] net/i40e: support link status notification Wenzhuo Lu
` (24 more replies)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (5 subsequent siblings)
40 siblings, 25 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev
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.
v6:
- remove the support of DPDK PF + kernel VF. Will create a new patch set for it.
- reword the tittles of some patches.
- add sanity check for vsi, and other minor change.
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: set VF VLAN insertion from PF
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) (2):
net/i40e: set VF VLAN strip from PF
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 | 3 +
app/test-pmd/cmdline.c | 569 ++++++++++++++++--
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 | 867 +++++++++++++++++++++++++++-
drivers/net/i40e/i40e_ethdev.h | 5 +-
drivers/net/i40e/i40e_ethdev_vf.c | 82 ++-
drivers/net/i40e/i40e_pf.c | 244 ++++++--
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, 2066 insertions(+), 112 deletions(-)
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 01/25] net/i40e: support link status notification
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 02/25] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
` (23 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 @@
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 02/25] net/i40e: add callback to user on VF to PF mbox msg
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 01/25] net/i40e: support link status notification Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 03/25] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
` (22 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 03/25] net/i40e: set VF MAC anti-spoofing from PF
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 01/25] net/i40e: support link status notification Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 02/25] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 04/25] net/i40e: set VF VLAN " Wenzhuo Lu
` (21 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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..68c07de 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9723,3 +9723,66 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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_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;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ /* 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 04/25] net/i40e: set VF VLAN anti-spoofing from PF
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (2 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 03/25] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 05/25] net/i40e: set Tx loopback " Wenzhuo Lu
` (20 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 68c07de..bcc59b2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4418,6 +4418,7 @@ struct i40e_vsi *
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 @@ struct i40e_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 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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_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;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ /* 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 05/25] net/i40e: set Tx loopback from PF
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (3 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 04/25] net/i40e: set VF VLAN " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 06/25] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
` (19 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 222 ++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 16 +++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 239 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index bcc59b2..a5d6d05 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9898,3 +9898,225 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+
+ if (!vsi)
+ return -EINVAL;
+
+ 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 06/25] net/i40e: set VF unicast promisc mode from PF
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (4 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 05/25] net/i40e: set Tx loopback " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 07/25] net/i40e: set VF multicast " Wenzhuo Lu
` (18 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 39 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 59 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a5d6d05..3d7ee03 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10120,3 +10120,42 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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_vsi *vsi;
+ 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;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_unicast_promiscuous(hw, 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 07/25] net/i40e: set VF multicast promisc mode from PF
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (5 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 06/25] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 08/25] net/i40e: enable VF MTU change Wenzhuo Lu
` (17 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 39 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 59 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 3d7ee03..9d050c8 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10159,3 +10159,42 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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_vsi *vsi;
+ 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;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_multicast_promiscuous(hw, 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 08/25] net/i40e: enable VF MTU change
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (6 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 07/25] net/i40e: set VF multicast " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 09/25] net/i40e: fix VF reset flow Wenzhuo Lu
` (16 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: 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 @@ struct rte_i40evf_xstats_name_off {
.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 @@ static int i40evf_dev_xstats_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;
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 09/25] net/i40e: fix VF reset flow
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (7 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 08/25] net/i40e: enable VF MTU change Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 10/25] net/i40e: set VF MAC from PF support Wenzhuo Lu
` (15 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: stable, Qi Zhang
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 @@
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 @@
}
/* 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 @@
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 {
/*
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 10/25] net/i40e: set VF MAC from PF support
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (8 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 09/25] net/i40e: fix VF reset flow Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 11/25] net/i40e: set VF MAC from VF support Wenzhuo Lu
` (14 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
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 | 42 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 62 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 9d050c8..758b574 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10198,3 +10198,45 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ if (!vsi)
+ return -EINVAL;
+
+ 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 11/25] net/i40e: set VF MAC from VF support
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (9 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 10/25] net/i40e: set VF MAC from PF support Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 12/25] net/i40e: fix VF MAC address assignment Wenzhuo Lu
` (13 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
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 @@ struct rte_i40evf_xstats_name_off {
.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 @@ struct rte_i40evf_xstats_name_off {
}
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 @@ struct rte_i40evf_xstats_name_off {
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 @@ static int i40evf_dev_xstats_get(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 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
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);
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 12/25] net/i40e: fix VF MAC address assignment
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (10 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 11/25] net/i40e: set VF MAC from VF support Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 13/25] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
` (12 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: stable, Ferruh Yigit
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 @@ static int i40evf_dev_xstats_get(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 @@ static int i40evf_dev_xstats_get(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) {
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 13/25] net/i40e: set VF VLAN strip from PF
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (11 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 12/25] net/i40e: fix VF MAC address assignment Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 14/25] net/i40e: set VF VLAN insertion " Wenzhuo Lu
` (11 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 758b574..7ab1c93 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10240,3 +10240,29 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 14/25] net/i40e: set VF VLAN insertion from PF
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (12 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 13/25] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 15/25] net/i40e: set VF broadcast mode " Wenzhuo Lu
` (10 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 7ab1c93..d6373b7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10266,3 +10266,56 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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_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;
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 15/25] net/i40e: set VF broadcast mode from PF
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (13 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 14/25] net/i40e: set VF VLAN insertion " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 16/25] net/i40e: set VF VLAN tag " Wenzhuo Lu
` (9 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 47 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 67 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d6373b7..3abf796 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10319,3 +10319,50 @@ 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_vsi *vsi;
+ 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;
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_broadcast(hw, 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..6baf21b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -225,4 +225,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 16/25] net/i40e: set VF VLAN tag from PF
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (14 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 15/25] net/i40e: set VF broadcast mode " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 17/25] net/i40e: set VF VLAN filter " Wenzhuo Lu
` (8 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 3abf796..228277b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10366,3 +10366,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_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 || !pf->vfs)
+ return -EINVAL;
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ 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 6baf21b..4fdddef 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 17/25] net/i40e: set VF VLAN filter from PF
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (15 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 16/25] net/i40e: set VF VLAN tag " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 18/25] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
` (7 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 228277b..1a33964 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10425,3 +10425,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 4fdddef..b71bba6 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 18/25] app/testpmd: use VFD APIs on i40e
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (16 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 17/25] net/i40e: set VF VLAN filter " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 19/25] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
` (6 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark), Bernard Iremonger
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 | 3 +
app/test-pmd/cmdline.c | 154 +++++++++++++++++++++++++++++++++++++++----------
2 files changed, 126 insertions(+), 31 deletions(-)
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 891b85a..66bd38a 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -58,7 +58,10 @@ SRCS-y += csumonly.c
SRCS-y += icmpecho.c
SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
+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
+endif
CFLAGS_cmdline.o := -D_GNU_SOURCE
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ed84d7a..9a44b4f 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 @@ struct 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 @@ struct cmd_config_e_tag_result {
NULL,
},
};
-#ifdef RTE_LIBRTE_IXGBE_PMD
/* vf vlan anti spoof configuration */
@@ -10860,11 +10856,24 @@ struct cmd_vf_vlan_anti_spoof_result {
__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 +10883,9 @@ struct cmd_vf_vlan_anti_spoof_result {
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 +10957,24 @@ struct cmd_vf_mac_anti_spoof_result {
__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 +10984,9 @@ struct cmd_vf_mac_anti_spoof_result {
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 +11058,24 @@ struct cmd_vf_vlan_stripq_result {
__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 +11156,22 @@ struct cmd_vf_vlan_insert_result {
__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 +11181,9 @@ struct cmd_vf_vlan_insert_result {
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 +11245,22 @@ struct cmd_tx_loopback_result {
__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 +11270,9 @@ struct cmd_tx_loopback_result {
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 +11292,7 @@ struct cmd_tx_loopback_result {
},
};
+#ifdef RTE_LIBRTE_IXGBE_PMD
/* all queues drop enable configuration */
/* Common result structure for all queues drop enable */
@@ -11277,6 +11351,9 @@ struct cmd_all_queues_drop_en_result {
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 +11458,7 @@ struct cmd_vf_split_drop_en_result {
NULL,
},
};
+#endif
/* vf mac address configuration */
@@ -11432,10 +11510,22 @@ struct cmd_set_vf_mac_addr_result {
__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 +11535,9 @@ struct cmd_set_vf_mac_addr_result {
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 +11558,6 @@ struct cmd_set_vf_mac_addr_result {
NULL,
},
};
-#endif
/* ******************************************************************************** */
@@ -11619,20 +11711,20 @@ struct cmd_set_vf_mac_addr_result {
(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,
};
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 19/25] app/testpmd: use unicast promiscuous mode on i40e
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (17 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 18/25] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 20/25] app/testpmd: use multicast " Wenzhuo Lu
` (5 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 102 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 9a44b4f..affe9d1 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"
@@ -11559,6 +11562,95 @@ struct cmd_set_vf_mac_addr_result {
},
};
+/* 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 */
@@ -11725,6 +11817,7 @@ struct cmd_set_vf_mac_addr_result {
(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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 20/25] app/testpmd: use multicast promiscuous mode on i40e
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (18 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 19/25] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 21/25] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
` (4 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 102 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index affe9d1..19eb338 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"
@@ -11651,6 +11654,95 @@ struct cmd_vf_promisc_result {
},
};
+/* 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 */
@@ -11818,6 +11910,7 @@ struct cmd_vf_promisc_result {
#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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 21/25] app/testpmd: add command to test VF broadcast mode on i40e
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (19 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 20/25] app/testpmd: use multicast " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 22/25] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
` (3 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 92 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++
2 files changed, 99 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 19eb338..7c62e65 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"
@@ -11743,6 +11746,94 @@ struct cmd_vf_allmulti_result {
},
};
+/* 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 */
@@ -11911,6 +12002,7 @@ struct cmd_vf_allmulti_result {
(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
~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 22/25] app/testpmd: add command to test VF VLAN tag on i40e
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (20 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 21/25] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 23/25] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
` (2 subsequent siblings)
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 98 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++
2 files changed, 105 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 7c62e65..e46b1fe 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"
@@ -11834,6 +11837,100 @@ struct cmd_set_vf_broadcast_result {
},
};
+/* 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 */
@@ -12003,6 +12100,7 @@ struct cmd_set_vf_broadcast_result {
(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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 23/25] app/testpmd: handle i40e in VF VLAN filter command
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (21 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 22/25] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-22 10:57 ` Ferruh Yigit
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 24/25] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 25/25] net/i40e: set/clear VF stats from PF Wenzhuo Lu
24 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
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 | 41 ++++++++++++++++++++++++++++++++++-------
app/test-pmd/config.c | 13 -------------
app/test-pmd/testpmd.h | 2 --
3 files changed, 34 insertions(+), 22 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index e46b1fe..85fc8fb 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6835,7 +6835,6 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result,
},
};
-#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,40 @@ struct cmd_vf_rx_vlan_filter {
__attribute__((unused)) void *data)
{
struct cmd_vf_rx_vlan_filter *res = parsed_result;
+ int ret = -ENOTSUP;
- 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_unused int is_add = (strcmp(res->what, "add") == 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_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 +6926,6 @@ struct cmd_vf_rx_vlan_filter {
NULL,
},
};
-#endif
/* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */
struct cmd_queue_rate_limit_result {
@@ -12093,9 +12120,9 @@ struct cmd_set_vf_vlan_tag_result {
(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 @@ struct igb_ring_desc_16_bytes {
"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,
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v6 23/25] app/testpmd: handle i40e in VF VLAN filter command
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 23/25] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
@ 2016-12-22 10:57 ` Ferruh Yigit
2016-12-22 14:47 ` Iremonger, Bernard
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2016-12-22 10:57 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Bernard Iremonger
On 12/21/2016 6:34 AM, Wenzhuo Lu wrote:
> modify set_vf_rx_vlan function to handle the i40e PMD.
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
<...>
> +
> + switch (ret) {
> + case 0:
> + break;
> + case -EINVAL:
> + printf("invalid vlan_id %d or vf_mask %lu\n",
To fix 32bit compilation:
printf("invalid vlan_id %d or vf_mask %"PRIu64"\n",
<...>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v6 23/25] app/testpmd: handle i40e in VF VLAN filter command
2016-12-22 10:57 ` Ferruh Yigit
@ 2016-12-22 14:47 ` Iremonger, Bernard
0 siblings, 0 replies; 367+ messages in thread
From: Iremonger, Bernard @ 2016-12-22 14:47 UTC (permalink / raw)
To: Yigit, Ferruh, Lu, Wenzhuo, dev
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Thursday, December 22, 2016 10:57 AM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v6 23/25] app/testpmd: handle i40e in VF
> VLAN filter command
>
> On 12/21/2016 6:34 AM, Wenzhuo Lu wrote:
> > modify set_vf_rx_vlan function to handle the i40e PMD.
> >
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > ---
>
> <...>
>
> > +
> > + switch (ret) {
> > + case 0:
> > + break;
> > + case -EINVAL:
> > + printf("invalid vlan_id %d or vf_mask %lu\n",
>
> To fix 32bit compilation:
> printf("invalid vlan_id %d or vf_mask %"PRIu64"\n",
>
>
> <...>
I will fix this in v7.
Regards,
Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 24/25] net/i40e: enhance in sanity check of MAC
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (22 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 23/25] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 25/25] net/i40e: set/clear VF stats from PF Wenzhuo Lu
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
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 2bc3355..09f44b0 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -753,8 +753,8 @@
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;
}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v6 25/25] net/i40e: set/clear VF stats from PF
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
` (23 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 24/25] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
@ 2016-12-21 6:34 ` Wenzhuo Lu
24 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2016-12-21 6:34 UTC (permalink / raw)
To: dev; +Cc: 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 | 81 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 41 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 2 +
3 files changed, 124 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 1a33964..3f386bc 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10477,3 +10477,84 @@ 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;
+ if (!vsi)
+ return -EINVAL;
+
+ 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;
+ if (!vsi)
+ return -EINVAL;
+
+ 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 b71bba6..f17e35e 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_broadcast(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (34 preceding siblings ...)
2016-12-21 6:34 ` [dpdk-dev] [PATCH v6 00/25] Support VFD on i40e Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 01/27] net/i40e: support link status notification Wenzhuo Lu
` (26 more replies)
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (4 subsequent siblings)
40 siblings, 27 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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.
v7:
- fix 32 bit compile error in patch 23.
- add new patches to configure VMDq.
v6:
- remove the support of DPDK PF + kernel VF. Will create a new patch set for it.
- reword the tittles of some patches.
- add sanity check for vsi, and other minor change.
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 (9):
net/i40e: set VF VLAN insertion from PF
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
net/i40e: fix segmentation fault in close
app/testpmd: add command to configure VMDq
Chen Jing D(Mark) (2):
net/i40e: set VF VLAN strip from PF
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 | 3 +
app/test-pmd/cmdline.c | 629 ++++++++++++++++++--
app/test-pmd/config.c | 13 -
app/test-pmd/testpmd.c | 126 ++++
app/test-pmd/testpmd.h | 3 +-
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 39 ++
drivers/net/i40e/Makefile | 4 +-
drivers/net/i40e/i40e_ethdev.c | 874 +++++++++++++++++++++++++++-
drivers/net/i40e/i40e_ethdev.h | 5 +-
drivers/net/i40e/i40e_ethdev_vf.c | 82 ++-
drivers/net/i40e/i40e_pf.c | 244 ++++++--
drivers/net/i40e/i40e_pf.h | 9 +-
drivers/net/i40e/rte_pmd_i40e.h | 328 +++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 20 +
14 files changed, 2266 insertions(+), 113 deletions(-)
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 01/27] net/i40e: support link status notification
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-05 5:58 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 02/27] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
` (25 subsequent siblings)
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 @@
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 01/27] net/i40e: support link status notification
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 01/27] net/i40e: support link status notification Wenzhuo Lu
@ 2017-01-05 5:58 ` Wu, Jingjing
2017-01-05 6:23 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-05 5:58 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:54 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: [dpdk-dev] [PATCH v7 01/27] net/i40e: support link status notification
>
> 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 @@ static void i40e_set_default_mac_addr(struct
> rte_eth_dev *dev,
>
> 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) {
How about
if (!pf->vfs || vf > pf->vf_num - 1) {
because if vf_num is 0, the pf->vfs will be NULL.
Thanks
Jingjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 01/27] net/i40e: support link status notification
2017-01-05 5:58 ` Wu, Jingjing
@ 2017-01-05 6:23 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-05 6:23 UTC (permalink / raw)
To: Wu, Jingjing, dev
Hi Jingjing,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Thursday, January 5, 2017 1:58 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Lu, Wenzhuo
> Subject: RE: [dpdk-dev] [PATCH v7 01/27] net/i40e: support link status
> notification
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 3, 2017 2:54 PM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > Subject: [dpdk-dev] [PATCH v7 01/27] net/i40e: support link status
> > notification
> >
> > 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 @@ static void i40e_set_default_mac_addr(struct
> > rte_eth_dev *dev,
> >
> > 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) {
> How about
> if (!pf->vfs || vf > pf->vf_num - 1) {
> because if vf_num is 0, the pf->vfs will be NULL.
Thanks for the comments.
As the number can be 0, how about change the code to?
if (vf >= pf->vf_num || !pf->vfs) {
>
> Thanks
> Jingjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 02/27] net/i40e: add callback to user on VF to PF mbox msg
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 01/27] net/i40e: support link status notification Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-05 6:18 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
` (24 subsequent siblings)
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 02/27] net/i40e: add callback to user on VF to PF mbox msg
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 02/27] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
@ 2017-01-05 6:18 ` Wu, Jingjing
0 siblings, 0 replies; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-05 6:18 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:54 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: [dpdk-dev] [PATCH v7 02/27] net/i40e: add callback to user on VF to PF
> mbox msg
>
> 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>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 01/27] net/i40e: support link status notification Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 02/27] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-05 6:42 ` Wu, Jingjing
2017-01-06 0:33 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN " Wenzhuo Lu
` (23 subsequent siblings)
26 siblings, 2 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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..68c07de 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9723,3 +9723,66 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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_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;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ /* 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
@ 2017-01-05 6:42 ` Wu, Jingjing
2017-01-05 6:46 ` Lu, Wenzhuo
2017-01-06 0:33 ` Wu, Jingjing
1 sibling, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-05 6:42 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:54 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing from
> PF
>
> 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..68c07de 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -9723,3 +9723,66 @@ static void i40e_set_default_mac_addr(struct
> rte_eth_dev *dev,
>
> 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_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);
> +
Why need to call rte_eth_dev_info_get in driver?
> + if (vf_id >= dev_info.max_vfs)
> + return -EINVAL;
> +
Vf_id is already be checked by below, even I prefer :
if (vf_id > pf->vf_num - 1 || !pf->vfs)
to be
if (!pf->vfs || vf_id > pf->vf_num - 1)
or if (!pf->vfs || vf_id >= pf->vf_num)
> + pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> +
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing from PF
2017-01-05 6:42 ` Wu, Jingjing
@ 2017-01-05 6:46 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-05 6:46 UTC (permalink / raw)
To: Wu, Jingjing, dev
Hi Jingjing,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Thursday, January 5, 2017 2:42 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Lu, Wenzhuo
> Subject: RE: [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing
> from PF
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 3, 2017 2:54 PM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > Subject: [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC
> > anti-spoofing from PF
> >
> > 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..68c07de 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -9723,3 +9723,66 @@ static void i40e_set_default_mac_addr(struct
> > rte_eth_dev *dev,
> >
> > 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_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);
> > +
> Why need to call rte_eth_dev_info_get in driver?
>
> > + if (vf_id >= dev_info.max_vfs)
> > + return -EINVAL;
> > +
>
> Vf_id is already be checked by below, even I prefer :
> if (vf_id > pf->vf_num - 1 || !pf->vfs)
> to be
> if (!pf->vfs || vf_id > pf->vf_num - 1) or if (!pf->vfs || vf_id >= pf->vf_num)
Agree, I'll remove the max_vfs check.
>
> > + pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> > +
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
2017-01-05 6:42 ` Wu, Jingjing
@ 2017-01-06 0:33 ` Wu, Jingjing
2017-01-06 8:54 ` Lu, Wenzhuo
1 sibling, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-06 0:33 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo
> +
> + 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");
If fails, will you revert the info in vsi struct?
> +
> + return ret;
Please return eth dev lib error code, but not I40E_XXX
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing from PF
2017-01-06 0:33 ` Wu, Jingjing
@ 2017-01-06 8:54 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-06 8:54 UTC (permalink / raw)
To: Wu, Jingjing, dev
Hi Jingjing,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, January 6, 2017 8:33 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Lu, Wenzhuo
> Subject: RE: [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing
> from PF
>
> > +
> > + 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");
>
> If fails, will you revert the info in vsi struct?
Will not. Just leverage the existing behavior. I think it has some good side as user should not try it again and again if not success.
>
> > +
> > + return ret;
>
> Please return eth dev lib error code, but not I40E_XXX
Yes, will change it.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN anti-spoofing from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (2 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 03/27] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-05 8:52 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 05/27] net/i40e: set Tx loopback " Wenzhuo Lu
` (22 subsequent siblings)
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 68c07de..bcc59b2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4418,6 +4418,7 @@ struct i40e_vsi *
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 @@ struct i40e_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 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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_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;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ /* 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN anti-spoofing from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN " Wenzhuo Lu
@ 2017-01-05 8:52 ` Wu, Jingjing
2017-01-06 3:00 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-05 8:52 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:54 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN anti-spoofing from
> PF
>
> 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 68c07de..bcc59b2 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -4418,6 +4418,7 @@ struct i40e_vsi *
> 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 @@ struct i40e_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;
> + }
> }
>
The function i40e_set_vlan_filter is used to store the vlan info
in vsi structure. I think it will be better to move the hardware vlan filter handling
to i40e_vsi_add_vlan who called the i40e_set_vlan_filter function to let the
code more easy to maintain.
Thanks
Jingjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN anti-spoofing from PF
2017-01-05 8:52 ` Wu, Jingjing
@ 2017-01-06 3:00 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-06 3:00 UTC (permalink / raw)
To: Wu, Jingjing, dev
Hi Jingjing,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Thursday, January 5, 2017 4:52 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Lu, Wenzhuo
> Subject: RE: [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN anti-spoofing
> from PF
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 3, 2017 2:54 PM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > Subject: [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN
> > anti-spoofing from PF
> >
> > 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 68c07de..bcc59b2 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -4418,6 +4418,7 @@ struct i40e_vsi *
> > 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 @@ struct i40e_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;
> > + }
> > }
> >
> The function i40e_set_vlan_filter is used to store the vlan info in vsi structure. I
> think it will be better to move the hardware vlan filter handling to
> i40e_vsi_add_vlan who called the i40e_set_vlan_filter function to let the code
> more easy to maintain.
Thanks for the suggestion. I'll split it to 2 functions, one for storing, the other for HW setting.
>
>
> Thanks
> Jingjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 05/27] net/i40e: set Tx loopback from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (3 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 04/27] net/i40e: set VF VLAN " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-06 0:32 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 06/27] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
` (21 subsequent siblings)
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 222 ++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 16 +++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 239 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index bcc59b2..a5d6d05 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9898,3 +9898,225 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+
+ if (!vsi)
+ return -EINVAL;
+
+ 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 05/27] net/i40e: set Tx loopback from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 05/27] net/i40e: set Tx loopback " Wenzhuo Lu
@ 2017-01-06 0:32 ` Wu, Jingjing
2017-01-06 3:25 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-06 0:32 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo
Is the Tx lookback meaning as VEB mode ore VEPA mode?
If so, how about change the API's name to set_switch_mode?
Another comment is: you removed all mac vlan filters before changing
The mode, and restore them after changing. How about vlan filters? The
Patch for vlan anti-spoof enables it, correct?
Thanks
JIngjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 05/27] net/i40e: set Tx loopback from PF
2017-01-06 0:32 ` Wu, Jingjing
@ 2017-01-06 3:25 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-06 3:25 UTC (permalink / raw)
To: Wu, Jingjing, dev
Hi Jingjing,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, January 6, 2017 8:33 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Lu, Wenzhuo
> Subject: RE: [dpdk-dev] [PATCH v7 05/27] net/i40e: set Tx loopback from PF
>
> Is the Tx lookback meaning as VEB mode ore VEPA mode?
> If so, how about change the API's name to set_switch_mode?
Yes. It means changing the switch mode between VEB and VEPA.
As ixgbe is already using this name. Better to keep it now. We can consider changing both of them later.
>
> Another comment is: you removed all mac vlan filters before changing The
> mode, and restore them after changing. How about vlan filters? The Patch for
> vlan anti-spoof enables it, correct?
Yes, the vlan table is operated when setting vlan anti-spoofing. Better to do the same thing for it here.
>
> Thanks
> JIngjing
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 06/27] net/i40e: set VF unicast promisc mode from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (4 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 05/27] net/i40e: set Tx loopback " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-06 0:32 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 07/27] net/i40e: set VF multicast " Wenzhuo Lu
` (20 subsequent siblings)
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 39 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 59 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a5d6d05..3d7ee03 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10120,3 +10120,42 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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_vsi *vsi;
+ 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;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_unicast_promiscuous(hw, 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 06/27] net/i40e: set VF unicast promisc mode from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 06/27] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
@ 2017-01-06 0:32 ` Wu, Jingjing
2017-01-06 5:01 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-06 0:32 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:54 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: [dpdk-dev] [PATCH v7 06/27] net/i40e: set VF unicast promisc mode
> from PF
>
> 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 | 39
> +++++++++++++++++++++++++++++++
> drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++
> drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
> 3 files changed, 59 insertions(+)
>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index a5d6d05..3d7ee03 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -10120,3 +10120,42 @@ static void i40e_set_default_mac_addr(struct
> rte_eth_dev *dev,
>
> 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_vsi *vsi;
> + 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;
> + }
Same comments as previous patches.
> + vsi = pf->vfs[vf_id].vsi;
> + if (!vsi)
> + return -EINVAL;
> +
> + hw = I40E_VSI_TO_HW(vsi);
> +
> + ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
> + on, NULL, true);
> + if (ret != I40E_SUCCESS)
> + PMD_DRV_LOG(ERR, "Failed to set unicast promiscuous mode");
> +
> + return ret;
ret is the error code defined in i40e driver, please use the error code in eth dev lib.
Thanks
Jingjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 06/27] net/i40e: set VF unicast promisc mode from PF
2017-01-06 0:32 ` Wu, Jingjing
@ 2017-01-06 5:01 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-06 5:01 UTC (permalink / raw)
To: Wu, Jingjing, dev
Hi Jingjing,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, January 6, 2017 8:32 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Lu, Wenzhuo
> Subject: RE: [dpdk-dev] [PATCH v7 06/27] net/i40e: set VF unicast promisc
> mode from PF
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 3, 2017 2:54 PM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > Subject: [dpdk-dev] [PATCH v7 06/27] net/i40e: set VF unicast promisc
> > mode from PF
> >
> > 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 | 39
> > +++++++++++++++++++++++++++++++
> > drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++
> > drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
> > 3 files changed, 59 insertions(+)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index a5d6d05..3d7ee03 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -10120,3 +10120,42 @@ static void i40e_set_default_mac_addr(struct
> > rte_eth_dev *dev,
> >
> > 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_vsi *vsi;
> > + 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;
> > + }
> Same comments as previous patches.
Thanks, will change it.
>
> > + vsi = pf->vfs[vf_id].vsi;
> > + if (!vsi)
> > + return -EINVAL;
> > +
> > + hw = I40E_VSI_TO_HW(vsi);
> > +
> > + ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
> > + on, NULL, true);
> > + if (ret != I40E_SUCCESS)
> > + PMD_DRV_LOG(ERR, "Failed to set unicast promiscuous
> mode");
> > +
> > + return ret;
> ret is the error code defined in i40e driver, please use the error code in eth dev
> lib.
Thanks. Will change it to the right error code.
>
> Thanks
> Jingjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 07/27] net/i40e: set VF multicast promisc mode from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (5 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 06/27] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 08/27] net/i40e: enable VF MTU change Wenzhuo Lu
` (19 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 39 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 59 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 3d7ee03..9d050c8 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10159,3 +10159,42 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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_vsi *vsi;
+ 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;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_multicast_promiscuous(hw, 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 08/27] net/i40e: enable VF MTU change
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (6 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 07/27] net/i40e: set VF multicast " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 09/27] net/i40e: fix VF reset flow Wenzhuo Lu
` (18 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 @@ struct rte_i40evf_xstats_name_off {
.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 @@ static int i40evf_dev_xstats_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;
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 09/27] net/i40e: fix VF reset flow
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (7 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 08/27] net/i40e: enable VF MTU change Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 10/27] net/i40e: set VF MAC from PF support Wenzhuo Lu
` (17 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang, stable
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 @@
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 @@
}
/* 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 @@
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 {
/*
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 10/27] net/i40e: set VF MAC from PF support
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (8 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 09/27] net/i40e: fix VF reset flow Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-06 0:32 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 11/27] net/i40e: set VF MAC from VF support Wenzhuo Lu
` (16 subsequent siblings)
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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>
---
drivers/net/i40e/i40e_ethdev.c | 42 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 62 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 9d050c8..758b574 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10198,3 +10198,45 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ if (!vsi)
+ return -EINVAL;
+
+ 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 10/27] net/i40e: set VF MAC from PF support
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 10/27] net/i40e: set VF MAC from PF support Wenzhuo Lu
@ 2017-01-06 0:32 ` Wu, Jingjing
2017-01-06 12:07 ` Ferruh Yigit
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-06 0:32 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Yigit, Ferruh
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:55 PM
> To: dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: [dpdk-dev] [PATCH v7 10/27] net/i40e: set VF MAC from PF support
>
> 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>
> ---
> drivers/net/i40e/i40e_ethdev.c | 42
> +++++++++++++++++++++++++++++++
> drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++
> drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
> 3 files changed, 62 insertions(+)
>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 9d050c8..758b574 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -10198,3 +10198,45 @@ static void i40e_set_default_mac_addr(struct
> rte_eth_dev *dev,
>
> 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;
> + if (!vsi)
> + return -EINVAL;
> +
> + ether_addr_copy(mac_addr, &vf->mac_addr);
Only store the mac address in vf struct?
Are you supposing the API is called before VF is initialized? If so, it's better to comment it.
Thanks
Jingjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 10/27] net/i40e: set VF MAC from PF support
2017-01-06 0:32 ` Wu, Jingjing
@ 2017-01-06 12:07 ` Ferruh Yigit
0 siblings, 0 replies; 367+ messages in thread
From: Ferruh Yigit @ 2017-01-06 12:07 UTC (permalink / raw)
To: Wu, Jingjing, Lu, Wenzhuo, dev
On 1/6/2017 12:32 AM, Wu, Jingjing wrote:
>
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
>> Sent: Tuesday, January 3, 2017 2:55 PM
>> To: dev@dpdk.org
>> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>
>> Subject: [dpdk-dev] [PATCH v7 10/27] net/i40e: set VF MAC from PF support
>>
>> 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>
>> ---
>> drivers/net/i40e/i40e_ethdev.c | 42
>> +++++++++++++++++++++++++++++++
>> drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++
>> drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
>> 3 files changed, 62 insertions(+)
>>
>> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
>> index 9d050c8..758b574 100644
>> --- a/drivers/net/i40e/i40e_ethdev.c
>> +++ b/drivers/net/i40e/i40e_ethdev.c
>> @@ -10198,3 +10198,45 @@ static void i40e_set_default_mac_addr(struct
>> rte_eth_dev *dev,
>>
>> 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;
>> + if (!vsi)
>> + return -EINVAL;
>> +
>> + ether_addr_copy(mac_addr, &vf->mac_addr);
>
> Only store the mac address in vf struct?
> Are you supposing the API is called before VF is initialized?
Yes.
PF should set the VF MAC before VF initialized.
If PF sets the VF MAC after VF already initialized, new MAC address
won't be effective until next VF initialization.
> If so, it's better to comment it.
Good idea, I will.
>
> Thanks
> Jingjing
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 11/27] net/i40e: set VF MAC from VF support
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (9 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 10/27] net/i40e: set VF MAC from PF support Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 12/27] net/i40e: fix VF MAC address assignment Wenzhuo Lu
` (15 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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 @@ struct rte_i40evf_xstats_name_off {
.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 @@ struct rte_i40evf_xstats_name_off {
}
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 @@ struct rte_i40evf_xstats_name_off {
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 @@ static int i40evf_dev_xstats_get(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 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
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);
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 12/27] net/i40e: fix VF MAC address assignment
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (10 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 11/27] net/i40e: set VF MAC from VF support Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 13/27] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
` (14 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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 @@ static int i40evf_dev_xstats_get(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 @@ static int i40evf_dev_xstats_get(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) {
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 13/27] net/i40e: set VF VLAN strip from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (11 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 12/27] net/i40e: fix VF MAC address assignment Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion " Wenzhuo Lu
` (13 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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 758b574..7ab1c93 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10240,3 +10240,29 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (12 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 13/27] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-06 0:33 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 15/27] net/i40e: set VF broadcast mode " Wenzhuo Lu
` (12 subsequent siblings)
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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 | 56 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 76 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7ab1c93..31c387d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10266,3 +10266,59 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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_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;
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+ vsi->info.pvid = vlan_id;
+ if (vlan_id > 0)
+ vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID;
+ else
+ vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_INSERT_PVID;
+
+ 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion " Wenzhuo Lu
@ 2017-01-06 0:33 ` Wu, Jingjing
2017-01-06 8:20 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-06 0:33 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Iremonger, Bernard
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:55 PM
> To: dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion from PF
>
> 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 | 56
> +++++++++++++++++++++++++++++++
> drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++
> drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
> 3 files changed, 76 insertions(+)
>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 7ab1c93..31c387d 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -10266,3 +10266,59 @@ static void i40e_set_default_mac_addr(struct
> rte_eth_dev *dev,
> 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_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);
It looks dev_info is not used in this function.
> + 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;
> +
> + vsi = pf->vfs[vf_id].vsi;
> + if (!vsi)
> + return -EINVAL;
> +
> + vsi->info.valid_sections =
> cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
> + vsi->info.pvid = vlan_id;
> + if (vlan_id > 0)
> + vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID;
> + else
> + vsi->info.port_vlan_flags &=
> ~I40E_AQ_VSI_PVLAN_INSERT_PVID;
So, Pvid is used here for insert. Does it has any relationship with vlan anti-spoof patch?
If so, it's better to consider how to deal with that.
Thanks
Jingjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion from PF
2017-01-06 0:33 ` Wu, Jingjing
@ 2017-01-06 8:20 ` Lu, Wenzhuo
2017-01-06 11:28 ` Iremonger, Bernard
0 siblings, 1 reply; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-06 8:20 UTC (permalink / raw)
To: Wu, Jingjing, dev; +Cc: Iremonger, Bernard
Hi Jingjing, Bernard,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, January 6, 2017 8:33 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Iremonger, Bernard
> Subject: RE: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion from
> PF
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 3, 2017 2:55 PM
> > To: dev@dpdk.org
> > Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> > Subject: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion
> > from PF
> >
> > 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 | 56
> > +++++++++++++++++++++++++++++++
> > drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++
> > drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
> > 3 files changed, 76 insertions(+)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index 7ab1c93..31c387d 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -10266,3 +10266,59 @@ static void i40e_set_default_mac_addr(struct
> > rte_eth_dev *dev,
> > 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_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);
>
> It looks dev_info is not used in this function.
I'll delete it.
>
> > + 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;
> > +
> > + vsi = pf->vfs[vf_id].vsi;
> > + if (!vsi)
> > + return -EINVAL;
> > +
> > + vsi->info.valid_sections =
> > cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
> > + vsi->info.pvid = vlan_id;
> > + if (vlan_id > 0)
> > + vsi->info.port_vlan_flags |=
> I40E_AQ_VSI_PVLAN_INSERT_PVID;
> > + else
> > + vsi->info.port_vlan_flags &=
> > ~I40E_AQ_VSI_PVLAN_INSERT_PVID;
> So, Pvid is used here for insert. Does it has any relationship with vlan anti-
> spoof patch?
> If so, it's better to consider how to deal with that.
It's vlan insertion not filtering. So I think not related.
>
> Thanks
> Jingjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion from PF
2017-01-06 8:20 ` Lu, Wenzhuo
@ 2017-01-06 11:28 ` Iremonger, Bernard
2017-01-09 0:32 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Iremonger, Bernard @ 2017-01-06 11:28 UTC (permalink / raw)
To: Lu, Wenzhuo, Wu, Jingjing, dev
Hi Jinqjing, Wenzhuo,
> -----Original Message-----
> From: Lu, Wenzhuo
> Sent: Friday, January 6, 2017 8:20 AM
> To: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion
> from PF
>
> Hi Jingjing, Bernard,
>
>
> > -----Original Message-----
> > From: Wu, Jingjing
> > Sent: Friday, January 6, 2017 8:33 AM
> > To: Lu, Wenzhuo; dev@dpdk.org
> > Cc: Iremonger, Bernard
> > Subject: RE: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN
> > insertion from PF
> >
> >
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > > Sent: Tuesday, January 3, 2017 2:55 PM
> > > To: dev@dpdk.org
> > > Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> > > Subject: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion
> > > from PF
> > >
> > > 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 | 56
> > > +++++++++++++++++++++++++++++++
> > > drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++
> > > drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
> > > 3 files changed, 76 insertions(+)
> > >
> > > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > > b/drivers/net/i40e/i40e_ethdev.c index 7ab1c93..31c387d 100644
> > > --- a/drivers/net/i40e/i40e_ethdev.c
> > > +++ b/drivers/net/i40e/i40e_ethdev.c
> > > @@ -10266,3 +10266,59 @@ static void
> > > i40e_set_default_mac_addr(struct rte_eth_dev *dev,
> > > 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_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);
> >
> > It looks dev_info is not used in this function.
> I'll delete it.
It was intended to use dev_info have a check on max_vfs.
if (vf_id >= dev_info.max_vfs)
return -EINVAL;
Should this check be added instead of deleting 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;
> > > +
> > > + vsi = pf->vfs[vf_id].vsi;
> > > + if (!vsi)
> > > + return -EINVAL;
> > > +
> > > + vsi->info.valid_sections =
> > > cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
> > > + vsi->info.pvid = vlan_id;
> > > + if (vlan_id > 0)
> > > + vsi->info.port_vlan_flags |=
> > I40E_AQ_VSI_PVLAN_INSERT_PVID;
> > > + else
> > > + vsi->info.port_vlan_flags &=
> > > ~I40E_AQ_VSI_PVLAN_INSERT_PVID;
> > So, Pvid is used here for insert. Does it has any relationship with
> > vlan anti- spoof patch?
> > If so, it's better to consider how to deal with that.
> It's vlan insertion not filtering. So I think not related.
>
> >
> > Thanks
> > Jingjing
Regards,
Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion from PF
2017-01-06 11:28 ` Iremonger, Bernard
@ 2017-01-09 0:32 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-09 0:32 UTC (permalink / raw)
To: Iremonger, Bernard, Wu, Jingjing, dev
Hi Bernard,
> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Friday, January 6, 2017 7:29 PM
> To: Lu, Wenzhuo; Wu, Jingjing; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion from
> PF
>
> Hi Jinqjing, Wenzhuo,
>
> > -----Original Message-----
> > From: Lu, Wenzhuo
> > Sent: Friday, January 6, 2017 8:20 AM
> > To: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org
> > Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> > Subject: RE: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN
> > insertion from PF
> >
> > Hi Jingjing, Bernard,
> >
> >
> > > -----Original Message-----
> > > From: Wu, Jingjing
> > > Sent: Friday, January 6, 2017 8:33 AM
> > > To: Lu, Wenzhuo; dev@dpdk.org
> > > Cc: Iremonger, Bernard
> > > Subject: RE: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN
> > > insertion from PF
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > > > Sent: Tuesday, January 3, 2017 2:55 PM
> > > > To: dev@dpdk.org
> > > > Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> > > > Subject: [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN
> > > > insertion from PF
> > > >
> > > > 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 | 56
> > > > +++++++++++++++++++++++++++++++
> > > > drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++
> > > > drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
> > > > 3 files changed, 76 insertions(+)
> > > >
> > > > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > > > b/drivers/net/i40e/i40e_ethdev.c index 7ab1c93..31c387d 100644
> > > > --- a/drivers/net/i40e/i40e_ethdev.c
> > > > +++ b/drivers/net/i40e/i40e_ethdev.c
> > > > @@ -10266,3 +10266,59 @@ static void
> > > > i40e_set_default_mac_addr(struct rte_eth_dev *dev,
> > > > 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_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);
> > >
> > > It looks dev_info is not used in this function.
> > I'll delete it.
>
> It was intended to use dev_info have a check on max_vfs.
>
> if (vf_id >= dev_info.max_vfs)
> return -EINVAL;
>
> Should this check be added instead of deleting dev_info ?
It's not wrong to check it. But we don't think this check is necessary because there's the check below, "vf_id >= pf->vf_num".
>
> > >
> > > > + 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;
> > > > +
> > > > + vsi = pf->vfs[vf_id].vsi;
> > > > + if (!vsi)
> > > > + return -EINVAL;
> > > > +
> > > > + vsi->info.valid_sections =
> > > > cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
> > > > + vsi->info.pvid = vlan_id;
> > > > + if (vlan_id > 0)
> > > > + vsi->info.port_vlan_flags |=
> > > I40E_AQ_VSI_PVLAN_INSERT_PVID;
> > > > + else
> > > > + vsi->info.port_vlan_flags &=
> > > > ~I40E_AQ_VSI_PVLAN_INSERT_PVID;
> > > So, Pvid is used here for insert. Does it has any relationship with
> > > vlan anti- spoof patch?
> > > If so, it's better to consider how to deal with that.
> > It's vlan insertion not filtering. So I think not related.
> >
> > >
> > > Thanks
> > > Jingjing
>
> Regards,
>
> Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 15/27] net/i40e: set VF broadcast mode from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (13 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 14/27] net/i40e: set VF VLAN insertion " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 16/27] net/i40e: set VF VLAN tag " Wenzhuo Lu
` (11 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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 | 47 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 67 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 31c387d..8340937 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10322,3 +10322,50 @@ 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_vsi *vsi;
+ 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;
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_broadcast(hw, 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..6baf21b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -225,4 +225,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 16/27] net/i40e: set VF VLAN tag from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (14 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 15/27] net/i40e: set VF broadcast mode " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 17/27] net/i40e: set VF VLAN filter " Wenzhuo Lu
` (10 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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 8340937..4d2fb20 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10369,3 +10369,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_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 || !pf->vfs)
+ return -EINVAL;
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi)
+ return -EINVAL;
+
+ 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 6baf21b..4fdddef 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 17/27] net/i40e: set VF VLAN filter from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (15 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 16/27] net/i40e: set VF VLAN tag " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-06 0:36 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 18/27] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
` (9 subsequent siblings)
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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 4d2fb20..47e03d6 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10428,3 +10428,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 4fdddef..b71bba6 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 17/27] net/i40e: set VF VLAN filter from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 17/27] net/i40e: set VF VLAN filter " Wenzhuo Lu
@ 2017-01-06 0:36 ` Wu, Jingjing
2017-01-06 11:38 ` Iremonger, Bernard
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-06 0:36 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Iremonger, Bernard
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:55 PM
> To: dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: [dpdk-dev] [PATCH v7 17/27] net/i40e: set VF VLAN filter from PF
>
> 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 4d2fb20..47e03d6 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -10428,3 +10428,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);
> + }
> + }
The head is saying "set VF VLAN filter", why do you deal with VMDQ VSIs?
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 17/27] net/i40e: set VF VLAN filter from PF
2017-01-06 0:36 ` Wu, Jingjing
@ 2017-01-06 11:38 ` Iremonger, Bernard
0 siblings, 0 replies; 367+ messages in thread
From: Iremonger, Bernard @ 2017-01-06 11:38 UTC (permalink / raw)
To: Wu, Jingjing, Lu, Wenzhuo, dev
Hi Jinqjing,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, January 6, 2017 12:37 AM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v7 17/27] net/i40e: set VF VLAN filter from
> PF
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 3, 2017 2:55 PM
> > To: dev@dpdk.org
> > Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> > Subject: [dpdk-dev] [PATCH v7 17/27] net/i40e: set VF VLAN filter from
> > PF
> >
> > 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 4d2fb20..47e03d6 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -10428,3 +10428,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);
> > + }
> > + }
>
> The head is saying "set VF VLAN filter", why do you deal with VMDQ VSIs?
This API is modelled on the rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id, uint64_t vf_mask, uint8_t on) which seems to use VMDq. More investigation is needed here.
Regards,
Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 18/27] app/testpmd: use VFD APIs on i40e
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (16 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 17/27] net/i40e: set VF VLAN filter " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-06 1:16 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 19/27] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
` (8 subsequent siblings)
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark), Bernard Iremonger
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 | 3 +
app/test-pmd/cmdline.c | 154 +++++++++++++++++++++++++++++++++++++++----------
2 files changed, 126 insertions(+), 31 deletions(-)
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 891b85a..66bd38a 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -58,7 +58,10 @@ SRCS-y += csumonly.c
SRCS-y += icmpecho.c
SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
+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
+endif
CFLAGS_cmdline.o := -D_GNU_SOURCE
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ed84d7a..9a44b4f 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 @@ struct 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 @@ struct cmd_config_e_tag_result {
NULL,
},
};
-#ifdef RTE_LIBRTE_IXGBE_PMD
/* vf vlan anti spoof configuration */
@@ -10860,11 +10856,24 @@ struct cmd_vf_vlan_anti_spoof_result {
__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 +10883,9 @@ struct cmd_vf_vlan_anti_spoof_result {
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 +10957,24 @@ struct cmd_vf_mac_anti_spoof_result {
__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 +10984,9 @@ struct cmd_vf_mac_anti_spoof_result {
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 +11058,24 @@ struct cmd_vf_vlan_stripq_result {
__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 +11156,22 @@ struct cmd_vf_vlan_insert_result {
__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 +11181,9 @@ struct cmd_vf_vlan_insert_result {
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 +11245,22 @@ struct cmd_tx_loopback_result {
__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 +11270,9 @@ struct cmd_tx_loopback_result {
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 +11292,7 @@ struct cmd_tx_loopback_result {
},
};
+#ifdef RTE_LIBRTE_IXGBE_PMD
/* all queues drop enable configuration */
/* Common result structure for all queues drop enable */
@@ -11277,6 +11351,9 @@ struct cmd_all_queues_drop_en_result {
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 +11458,7 @@ struct cmd_vf_split_drop_en_result {
NULL,
},
};
+#endif
/* vf mac address configuration */
@@ -11432,10 +11510,22 @@ struct cmd_set_vf_mac_addr_result {
__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 +11535,9 @@ struct cmd_set_vf_mac_addr_result {
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 +11558,6 @@ struct cmd_set_vf_mac_addr_result {
NULL,
},
};
-#endif
/* ******************************************************************************** */
@@ -11619,20 +11711,20 @@ struct cmd_set_vf_mac_addr_result {
(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,
};
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 18/27] app/testpmd: use VFD APIs on i40e
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 18/27] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2017-01-06 1:16 ` Wu, Jingjing
2017-01-06 7:23 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-06 1:16 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo, Chen, Jing D, Iremonger, Bernard
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:55 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Chen, Jing D
> <jing.d.chen@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: [dpdk-dev] [PATCH v7 18/27] app/testpmd: use VFD APIs on i40e
>
> 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 | 3 +
> app/test-pmd/cmdline.c | 154 +++++++++++++++++++++++++++++++++++++++-
> ---------
> 2 files changed, 126 insertions(+), 31 deletions(-)
>
> diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile index
> 891b85a..66bd38a 100644
> --- a/app/test-pmd/Makefile
> +++ b/app/test-pmd/Makefile
> @@ -58,7 +58,10 @@ SRCS-y += csumonly.c
> SRCS-y += icmpecho.c
> SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
>
> +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 endif
>
> CFLAGS_cmdline.o := -D_GNU_SOURCE
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> ed84d7a..9a44b4f 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
How about use
#if defined(RTE_LIBRTE_IXGBE_PMD) || defined (RTE_LIBRTE_I40E_PMD)
but not remove it, because this command only works for ixgbe and i40e 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
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 18/27] app/testpmd: use VFD APIs on i40e
2017-01-06 1:16 ` Wu, Jingjing
@ 2017-01-06 7:23 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-06 7:23 UTC (permalink / raw)
To: Wu, Jingjing, dev; +Cc: Chen, Jing D, Iremonger, Bernard
Hi Jingjing,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, January 6, 2017 9:16 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Lu, Wenzhuo; Chen, Jing D; Iremonger, Bernard
> Subject: RE: [dpdk-dev] [PATCH v7 18/27] app/testpmd: use VFD APIs on i40e
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 3, 2017 2:55 PM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Chen, Jing D
> > <jing.d.chen@intel.com>; Iremonger, Bernard
> > <bernard.iremonger@intel.com>
> > Subject: [dpdk-dev] [PATCH v7 18/27] app/testpmd: use VFD APIs on i40e
> >
> > 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 | 3 +
> > app/test-pmd/cmdline.c | 154
> +++++++++++++++++++++++++++++++++++++++-
> > ---------
> > 2 files changed, 126 insertions(+), 31 deletions(-)
> >
> > diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile index
> > 891b85a..66bd38a 100644
> > --- a/app/test-pmd/Makefile
> > +++ b/app/test-pmd/Makefile
> > @@ -58,7 +58,10 @@ SRCS-y += csumonly.c SRCS-y += icmpecho.c
> > SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
> >
> > +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 endif
> >
> > CFLAGS_cmdline.o := -D_GNU_SOURCE
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > ed84d7a..9a44b4f 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
>
> How about use
> #if defined(RTE_LIBRTE_IXGBE_PMD) || defined (RTE_LIBRTE_I40E_PMD) but
> not remove it, because this command only works for ixgbe and i40e pmd.
It's on purpose. Just like regular CLIs, we show them no matter NIC supports it or not. We will check when processing CLIs.
>
> > "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
> >
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 19/27] app/testpmd: use unicast promiscuous mode on i40e
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (17 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 18/27] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-06 1:21 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 20/27] app/testpmd: use multicast " Wenzhuo Lu
` (7 subsequent siblings)
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 102 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 9a44b4f..affe9d1 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"
@@ -11559,6 +11562,95 @@ struct cmd_set_vf_mac_addr_result {
},
};
+/* 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 */
@@ -11725,6 +11817,7 @@ struct cmd_set_vf_mac_addr_result {
(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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 19/27] app/testpmd: use unicast promiscuous mode on i40e
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 19/27] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
@ 2017-01-06 1:21 ` Wu, Jingjing
2017-01-06 7:25 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-06 1:21 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Lu, Wenzhuo
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:55 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: [dpdk-dev] [PATCH v7 19/27] app/testpmd: use unicast promiscuous
> mode on i40e
>
> 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 | 93 +++++++++++++++++++++++++++++
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
> 2 files changed, 102 insertions(+)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 9a44b4f..affe9d1 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"
> @@ -11559,6 +11562,95 @@ struct cmd_set_vf_mac_addr_result {
> },
> };
>
> +/* 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
> +
It's better to wrap the command by +#ifdef RTE_LIBRTE_I40E_PMD #endif
Or at least, need to check if the port is handled i40e pmd.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 19/27] app/testpmd: use unicast promiscuous mode on i40e
2017-01-06 1:21 ` Wu, Jingjing
@ 2017-01-06 7:25 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-06 7:25 UTC (permalink / raw)
To: Wu, Jingjing, dev
Hi Jingjing,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, January 6, 2017 9:22 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Lu, Wenzhuo
> Subject: RE: [dpdk-dev] [PATCH v7 19/27] app/testpmd: use unicast
> promiscuous mode on i40e
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 3, 2017 2:55 PM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > Subject: [dpdk-dev] [PATCH v7 19/27] app/testpmd: use unicast
> > promiscuous mode on i40e
> >
> > 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 | 93 +++++++++++++++++++++++++++++
> > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
> > 2 files changed, 102 insertions(+)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > 9a44b4f..affe9d1 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"
> > @@ -11559,6 +11562,95 @@ struct cmd_set_vf_mac_addr_result {
> > },
> > };
> >
> > +/* 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
> > +
>
> It's better to wrap the command by +#ifdef RTE_LIBRTE_I40E_PMD #endif Or
> at least, need to check if the port is handled i40e pmd.
Yes, I'll add the check.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 20/27] app/testpmd: use multicast promiscuous mode on i40e
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (18 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 19/27] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 21/27] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
` (6 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 102 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index affe9d1..19eb338 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"
@@ -11651,6 +11654,95 @@ struct cmd_vf_promisc_result {
},
};
+/* 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 */
@@ -11818,6 +11910,7 @@ struct cmd_vf_promisc_result {
#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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 21/27] app/testpmd: add command to test VF broadcast mode on i40e
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (19 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 20/27] app/testpmd: use multicast " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 22/27] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
` (5 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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 | 92 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++
2 files changed, 99 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 19eb338..7c62e65 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"
@@ -11743,6 +11746,94 @@ struct cmd_vf_allmulti_result {
},
};
+/* 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 */
@@ -11911,6 +12002,7 @@ struct cmd_vf_allmulti_result {
(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
~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 22/27] app/testpmd: add command to test VF VLAN tag on i40e
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (20 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 21/27] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 23/27] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
` (4 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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 | 98 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++
2 files changed, 105 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 7c62e65..e46b1fe 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"
@@ -11834,6 +11837,100 @@ struct cmd_set_vf_broadcast_result {
},
};
+/* 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 */
@@ -12003,6 +12100,7 @@ struct cmd_set_vf_broadcast_result {
(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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 23/27] app/testpmd: handle i40e in VF VLAN filter command
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (21 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 22/27] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 24/27] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
` (3 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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/cmdline.c | 41 ++++++++++++++++++++++++++++++++++-------
app/test-pmd/config.c | 13 -------------
app/test-pmd/testpmd.h | 2 --
3 files changed, 34 insertions(+), 22 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index e46b1fe..a20c2c0 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6835,7 +6835,6 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result,
},
};
-#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,40 @@ struct cmd_vf_rx_vlan_filter {
__attribute__((unused)) void *data)
{
struct cmd_vf_rx_vlan_filter *res = parsed_result;
+ int ret = -ENOTSUP;
- 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_unused int is_add = (strcmp(res->what, "add") == 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_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 %"PRIu64"\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 +6926,6 @@ struct cmd_vf_rx_vlan_filter {
NULL,
},
};
-#endif
/* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */
struct cmd_queue_rate_limit_result {
@@ -12093,9 +12120,9 @@ struct cmd_set_vf_vlan_tag_result {
(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 @@ struct igb_ring_desc_16_bytes {
"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,
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 24/27] net/i40e: enhance in sanity check of MAC
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (22 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 23/27] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats from PF Wenzhuo Lu
` (2 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: 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 2bc3355..09f44b0 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -753,8 +753,8 @@
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;
}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (23 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 24/27] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-06 1:25 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault in close Wenzhuo Lu
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 27/27] app/testpmd: add command to configure VMDq Wenzhuo Lu
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 | 81 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 41 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 2 +
3 files changed, 124 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 47e03d6..be45cfa 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10480,3 +10480,84 @@ 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;
+ if (!vsi)
+ return -EINVAL;
+
+ 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;
+ if (!vsi)
+ return -EINVAL;
+
+ 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 b71bba6..f17e35e 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_broadcast(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats from PF
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats from PF Wenzhuo Lu
@ 2017-01-06 1:25 ` Wu, Jingjing
2017-01-06 8:01 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-06 1:25 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Zhang, Qi Z
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:55 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats from PF
>
> 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 | 81
> +++++++++++++++++++++++++++++++
> drivers/net/i40e/rte_pmd_i40e.h | 41 ++++++++++++++++
> drivers/net/i40e/rte_pmd_i40e_version.map | 2 +
> 3 files changed, 124 insertions(+)
>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 47e03d6..be45cfa 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -10480,3 +10480,84 @@ 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;
> + if (!vsi)
> + return -EINVAL;
> +
> + 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;
It looks ret is not changed in this func at all.
> +}
> +
> +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;
> + if (!vsi)
> + return -EINVAL;
> +
> + vsi->offset_loaded = false;
> + i40e_update_vsi_stats(vsi);
> +
> + return ret;
Same comment as above.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats from PF
2017-01-06 1:25 ` Wu, Jingjing
@ 2017-01-06 8:01 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-06 8:01 UTC (permalink / raw)
To: Wu, Jingjing, dev; +Cc: Zhang, Qi Z
Hi Jingjing, Qi,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, January 6, 2017 9:25 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Zhang, Qi Z
> Subject: RE: [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats from PF
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 3, 2017 2:55 PM
> > To: dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Subject: [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats from
> > PF
> >
> > 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 | 81
> > +++++++++++++++++++++++++++++++
> > drivers/net/i40e/rte_pmd_i40e.h | 41 ++++++++++++++++
> > drivers/net/i40e/rte_pmd_i40e_version.map | 2 +
> > 3 files changed, 124 insertions(+)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index 47e03d6..be45cfa 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -10480,3 +10480,84 @@ 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;
> > + if (!vsi)
> > + return -EINVAL;
> > +
> > + 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;
>
> It looks ret is not changed in this func at all.
>
> > +}
> > +
> > +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;
> > + if (!vsi)
> > + return -EINVAL;
> > +
> > + vsi->offset_loaded = false;
> > + i40e_update_vsi_stats(vsi);
> > +
> > + return ret;
> Same comment as above.
I'll change it to 'return 0'. The same as above.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault in close
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (24 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats from PF Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
2017-01-06 1:29 ` Wu, Jingjing
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 27/27] app/testpmd: add command to configure VMDq Wenzhuo Lu
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger, stable
From: Bernard Iremonger <bernard.iremonger@intel.com>
The vsi's have already been released, so the second call to
i40e_vsi_release results in a segmentation fault.
The second call to i40e_vsi_release has been removed.
Fixes: 3cb446b4aeb2 ("i40e: free vmdq vsi when closing")
CC: stable@dpdk.org
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index be45cfa..0b7c366 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1882,7 +1882,6 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw *hw)
i40e_vsi_release(pf->main_vsi);
for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
- i40e_vsi_release(pf->vmdq[i].vsi);
pf->vmdq[i].vsi = NULL;
}
@@ -4137,6 +4136,9 @@ enum i40e_status_code
if (!vsi)
return I40E_SUCCESS;
+ if (!vsi->adapter)
+ return I40E_ERR_BAD_PTR;
+
user_param = vsi->user_param;
pf = I40E_VSI_TO_PF(vsi);
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault in close
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault in close Wenzhuo Lu
@ 2017-01-06 1:29 ` Wu, Jingjing
2017-01-06 12:00 ` Iremonger, Bernard
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-06 1:29 UTC (permalink / raw)
To: Lu, Wenzhuo, dev; +Cc: Iremonger, Bernard, stable
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:55 PM
> To: dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault in close
>
> From: Bernard Iremonger <bernard.iremonger@intel.com>
>
> The vsi's have already been released, so the second call to i40e_vsi_release
> results in a segmentation fault.
> The second call to i40e_vsi_release has been removed.
Where is the first call to release vmdq vsi?
Thanks
Jingjing
>
> Fixes: 3cb446b4aeb2 ("i40e: free vmdq vsi when closing")
>
> CC: stable@dpdk.org
>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> ---
> drivers/net/i40e/i40e_ethdev.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index be45cfa..0b7c366 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -1882,7 +1882,6 @@ static inline void i40e_GLQF_reg_init(struct i40e_hw
> *hw)
> i40e_vsi_release(pf->main_vsi);
>
> for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
> - i40e_vsi_release(pf->vmdq[i].vsi);
> pf->vmdq[i].vsi = NULL;
> }
>
> @@ -4137,6 +4136,9 @@ enum i40e_status_code
> if (!vsi)
> return I40E_SUCCESS;
>
> + if (!vsi->adapter)
> + return I40E_ERR_BAD_PTR;
> +
> user_param = vsi->user_param;
>
> pf = I40E_VSI_TO_PF(vsi);
> --
> 1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault in close
2017-01-06 1:29 ` Wu, Jingjing
@ 2017-01-06 12:00 ` Iremonger, Bernard
2017-01-09 9:44 ` Wu, Jingjing
0 siblings, 1 reply; 367+ messages in thread
From: Iremonger, Bernard @ 2017-01-06 12:00 UTC (permalink / raw)
To: Wu, Jingjing, Lu, Wenzhuo, dev; +Cc: stable
Hi Jingjing,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, January 6, 2017 1:29 AM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>; stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault in
> close
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, January 3, 2017 2:55 PM
> > To: dev@dpdk.org
> > Cc: Iremonger, Bernard <bernard.iremonger@intel.com>;
> stable@dpdk.org
> > Subject: [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault
> > in close
> >
> > From: Bernard Iremonger <bernard.iremonger@intel.com>
> >
> > The vsi's have already been released, so the second call to
> > i40e_vsi_release results in a segmentation fault.
> > The second call to i40e_vsi_release has been removed.
> Where is the first call to release vmdq vsi?
All of the VSI's are released in the call to i40e_vsi_release(pf->main_vsi) at line 1895.
This function is recursive and release all the VSI's.
There is still a VSI address in pf->vmdq[i].vsi but calling
i40e_vsi_release(pf->vmdq[i].vsi);
Results in a segmentation fault.
>
> Thanks
> Jingjing
> >
> > Fixes: 3cb446b4aeb2 ("i40e: free vmdq vsi when closing")
> >
> > CC: stable@dpdk.org
> >
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > ---
> > drivers/net/i40e/i40e_ethdev.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index be45cfa..0b7c366 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -1882,7 +1882,6 @@ static inline void i40e_GLQF_reg_init(struct
> > i40e_hw
> > *hw)
> > i40e_vsi_release(pf->main_vsi);
> >
> > for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
> > - i40e_vsi_release(pf->vmdq[i].vsi);
> > pf->vmdq[i].vsi = NULL;
> > }
> >
> > @@ -4137,6 +4136,9 @@ enum i40e_status_code
> > if (!vsi)
> > return I40E_SUCCESS;
> >
> > + if (!vsi->adapter)
> > + return I40E_ERR_BAD_PTR;
> > +
> > user_param = vsi->user_param;
> >
> > pf = I40E_VSI_TO_PF(vsi);
> > --
> > 1.9.3
Regards,
Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault in close
2017-01-06 12:00 ` Iremonger, Bernard
@ 2017-01-09 9:44 ` Wu, Jingjing
2017-01-09 9:50 ` Iremonger, Bernard
0 siblings, 1 reply; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-09 9:44 UTC (permalink / raw)
To: Iremonger, Bernard, Lu, Wenzhuo, dev; +Cc: stable
>
> All of the VSI's are released in the call to i40e_vsi_release(pf->main_vsi) at line
> 1895.
> This function is recursive and release all the VSI's.
>
> There is still a VSI address in pf->vmdq[i].vsi but calling i40e_vsi_release(pf-
> >vmdq[i].vsi);
> Results in a segmentation fault.
>
Thanks for the clarification.
You are correct. What I prefer is to move the code to release vmdq vsis to
before the i40e_vsi_release(pf->main_vsi);
What do you think?
Thanks
Jingjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault in close
2017-01-09 9:44 ` Wu, Jingjing
@ 2017-01-09 9:50 ` Iremonger, Bernard
0 siblings, 0 replies; 367+ messages in thread
From: Iremonger, Bernard @ 2017-01-09 9:50 UTC (permalink / raw)
To: Wu, Jingjing, Lu, Wenzhuo, dev; +Cc: stable
Hi Jingjing,
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Monday, January 9, 2017 9:44 AM
> To: Iremonger, Bernard <bernard.iremonger@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault in
> close
>
> >
> > All of the VSI's are released in the call to
> > i40e_vsi_release(pf->main_vsi) at line 1895.
> > This function is recursive and release all the VSI's.
> >
> > There is still a VSI address in pf->vmdq[i].vsi but calling
> > i40e_vsi_release(pf-
> > >vmdq[i].vsi);
> > Results in a segmentation fault.
> >
> Thanks for the clarification.
>
> You are correct. What I prefer is to move the code to release vmdq vsis to
> before the i40e_vsi_release(pf->main_vsi);
>
> What do you think?
>
> Thanks
> Jingjing
I will test it and see what happens.
Regards,
Bernard.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v7 27/27] app/testpmd: add command to configure VMDq
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
` (25 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 26/27] net/i40e: fix segmentation fault in close Wenzhuo Lu
@ 2017-01-03 6:54 ` Wenzhuo Lu
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
From: Bernard Iremonger <bernard.iremonger@intel.com>
Add the following command to configure VMDq:
port config <port> vmdq
Add new command to testpmd user guide.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
app/test-pmd/cmdline.c | 60 +++++++++++++
app/test-pmd/testpmd.c | 126 ++++++++++++++++++++++++++++
app/test-pmd/testpmd.h | 1 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++
4 files changed, 194 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a20c2c0..12c814c 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -614,6 +614,9 @@ static void cmd_help_long_parsed(void *parsed_result,
" pfc (on|off)\n"
" Set the DCB mode.\n\n"
+ "port config (port_id) vmdq\n"
+ " Configure VMDq.\n\n"
+
"port config all burst (value)\n"
" Set the number of packets per burst.\n\n"
@@ -2280,6 +2283,62 @@ struct cmd_config_dcb {
},
};
+/* *** Configure VMDq *** */
+struct cmd_config_vmdq {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t config;
+ uint8_t port_id;
+ cmdline_fixed_string_t vmdq;
+};
+
+static void
+cmd_config_vmdq_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_config_vmdq *res = parsed_result;
+ portid_t port_id = res->port_id;
+ struct rte_port *port;
+ int ret;
+
+ port = &ports[port_id];
+ /** Check if the port is not started **/
+ if (port->port_status != RTE_PORT_STOPPED) {
+ printf("Please stop port %d first\n", port_id);
+ return;
+ }
+
+ ret = init_port_vmdq_config(port_id);
+ if (ret != 0) {
+ printf("Cannot initialize network ports.\n");
+ return;
+ }
+
+ cmd_reconfig_device_queue(port_id, 0, 1);
+}
+
+cmdline_parse_token_string_t cmd_config_vmdq_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_vmdq, port, "port");
+cmdline_parse_token_string_t cmd_config_vmdq_config =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_vmdq, config, "config");
+cmdline_parse_token_num_t cmd_config_vmdq_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_config_vmdq, port_id, UINT8);
+cmdline_parse_token_string_t cmd_config_vmdq_vmdq =
+ TOKEN_STRING_INITIALIZER(struct cmd_config_vmdq, vmdq, "vmdq");
+
+cmdline_parse_inst_t cmd_config_vmdq = {
+ .f = cmd_config_vmdq_parsed,
+ .data = NULL,
+ .help_str = "port config <port-id> vmdq",
+ .tokens = {
+ (void *)&cmd_config_vmdq_port,
+ (void *)&cmd_config_vmdq_config,
+ (void *)&cmd_config_vmdq_port_id,
+ (void *)&cmd_config_vmdq_vmdq,
+ NULL,
+ },
+};
+
/* *** configure number of packets per burst *** */
struct cmd_config_burst {
cmdline_fixed_string_t port;
@@ -12032,6 +12091,7 @@ struct cmd_set_vf_vlan_tag_result {
(cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg,
(cmdline_parse_inst_t *)&cmd_priority_flow_control_set,
(cmdline_parse_inst_t *)&cmd_config_dcb,
+ (cmdline_parse_inst_t *)&cmd_config_vmdq,
(cmdline_parse_inst_t *)&cmd_read_reg,
(cmdline_parse_inst_t *)&cmd_read_reg_bit_field,
(cmdline_parse_inst_t *)&cmd_read_reg_bit,
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index a0332c2..48923fd 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -195,6 +195,34 @@ struct fwd_engine * fwd_engines[] = {
queueid_t nb_rxq = 1; /**< Number of RX queues per port. */
queueid_t nb_txq = 1; /**< Number of TX queues per port. */
+static const struct rte_eth_conf vmdq_conf_default = {
+ .rxmode = {
+ .mq_mode = ETH_MQ_RX_VMDQ_ONLY,
+ .split_hdr_size = 0,
+ .header_split = 0, /**< Header Split disabled */
+ .hw_ip_checksum = 0, /**< IP checksum offload disabled */
+ .hw_vlan_filter = 0, /**< VLAN filtering disabled */
+ .jumbo_frame = 0, /**< Jumbo Frame Support disabled */
+ },
+
+ .txmode = {
+ .mq_mode = ETH_MQ_TX_NONE,
+ },
+ .rx_adv_conf = {
+ /*
+ * should be overridden separately in code with
+ * appropriate values
+ */
+ .vmdq_rx_conf = {
+ .nb_queue_pools = ETH_8_POOLS,
+ .enable_default_pool = 0,
+ .default_pool = 0,
+ .nb_pool_maps = 0,
+ .pool_map = {{0, 0},},
+ },
+ },
+};
+
/*
* Configurable number of RX/TX ring descriptors.
*/
@@ -1889,6 +1917,104 @@ uint8_t port_is_bonding_slave(portid_t slave_pid)
24, 25, 26, 27, 28, 29, 30, 31
};
+const uint16_t num_vlans = RTE_DIM(vlan_tags);
+static uint16_t num_pf_queues, num_vmdq_queues;
+static uint16_t vmdq_pool_base, vmdq_queue_base;
+/* number of pools (if user does not specify any, 8 by default */
+static uint32_t num_queues = 8;
+static uint32_t num_pools = 8;
+
+/**
+ * Builds up the correct configuration for vmdq based on the vlan tags array
+ * given above, and determine the queue number and pool map number according to
+ * valid pool number
+ */
+static int
+get_eth_vmdq_conf(struct rte_eth_conf *eth_conf, uint32_t num_pools)
+{
+ struct rte_eth_vmdq_rx_conf conf;
+ unsigned i;
+
+ conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
+ conf.nb_pool_maps = num_pools;
+ conf.enable_default_pool = 0;
+ conf.default_pool = 0; /* set explicit value, even if not used */
+
+ for (i = 0; i < conf.nb_pool_maps; i++) {
+ conf.pool_map[i].vlan_id = vlan_tags[i];
+ conf.pool_map[i].pools = (1UL << (i % num_pools));
+ }
+
+ (void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf)));
+ (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf,
+ sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf)));
+ return 0;
+}
+
+/**
+ * Configures VMDq for a given port using global settings.
+ */
+int
+init_port_vmdq_config(uint8_t port)
+{
+ struct rte_eth_dev_info dev_info;
+ struct rte_eth_conf port_conf;
+ uint16_t rx_queues, tx_queues;
+ int retval;
+ uint16_t queues_per_pool;
+ uint32_t max_nb_pools;
+
+ if (port >= rte_eth_dev_count())
+ return -1;
+ /**
+ * The max pool number from dev_info will be used to validate the pool
+ * number.
+ */
+ rte_eth_dev_info_get(port, &dev_info);
+ max_nb_pools = (uint32_t)dev_info.max_vmdq_pools;
+ /**
+ * We allow to process part of VMDQ pools specified by num_pools in
+ * command line.
+ */
+ if (num_pools > max_nb_pools) {
+ printf("num_pools %d >max_nb_pools %d\n",
+ num_pools, max_nb_pools);
+ return -1;
+ }
+
+ retval = get_eth_vmdq_conf(&port_conf, num_pools);
+ if (retval < 0)
+ return retval;
+
+ /*
+ * NIC queues are divided into pf queues and vmdq queues.
+ */
+ /* There is assumption here all ports have the same configuration! */
+ num_pf_queues = dev_info.max_rx_queues - dev_info.vmdq_queue_num;
+ queues_per_pool = dev_info.vmdq_queue_num / dev_info.max_vmdq_pools;
+ num_vmdq_queues = num_pools * queues_per_pool;
+ num_queues = num_pf_queues + num_vmdq_queues;
+ vmdq_queue_base = dev_info.vmdq_queue_base;
+ vmdq_pool_base = dev_info.vmdq_pool_base;
+
+ printf("pf queue num: %u, configured vmdq pool num: %u,"
+ " each vmdq pool has %u queues\n",
+ num_pf_queues, num_pools, queues_per_pool);
+ printf("vmdq queue base: %d pool base %d\n",
+ vmdq_queue_base, vmdq_pool_base);
+
+ /*
+ * All queues including pf queues are setup.
+ * This is because VMDQ queues doesn't always start from zero, and the
+ * PMD layer doesn't support selectively initialising part of rx/tx
+ * queues.
+ */
+ rx_queues = (uint16_t)dev_info.max_rx_queues;
+ tx_queues = (uint16_t)dev_info.max_tx_queues;
+ retval = rte_eth_dev_configure(port, rx_queues, tx_queues, &port_conf);
+ return retval;
+}
+
static int
get_eth_dcb_conf(struct rte_eth_conf *eth_conf,
enum dcb_mode_enable dcb_mode,
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 5d104bd..05ab9fc 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -553,6 +553,7 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,
int init_port_dcb_config(portid_t pid, enum dcb_mode_enable dcb_mode,
enum rte_eth_nb_tcs num_tcs,
uint8_t pfc_en);
+int init_port_vmdq_config(uint8_t port);
int start_port(portid_t pid);
void stop_port(portid_t pid);
void close_port(portid_t pid);
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 84805af..dd5c029 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1406,6 +1406,13 @@ Set the DCB mode for an individual port::
The traffic class should be 4 or 8.
+port config - VMDq
+~~~~~~~~~~~~~~~~~~
+
+Configure VMDq for an individual port::
+
+ testpmd> port config (port_id) vmdq
+
port config - Burst
~~~~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (35 preceding siblings ...)
2017-01-03 6:54 ` [dpdk-dev] [PATCH v7 00/27] Support VFD on i40e Wenzhuo Lu
@ 2017-01-10 7:15 ` Wenzhuo Lu
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 01/25] net/i40e: support link status notification Wenzhuo Lu
` (25 more replies)
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (3 subsequent siblings)
40 siblings, 26 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:15 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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.
v8:
- remove unnecessary VF check.
- add more debug logs.
- split VMDq related code to a separate patch set.
- some minor change.
v7:
- fix 32 bit compile error in patch 23.
- add new patches to configure VMDq.
v6:
- remove the support of DPDK PF + kernel VF. Will create a new patch set for it.
- reword the tittles of some patches.
- add sanity check for vsi, and other minor change.
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: set VF VLAN insertion from PF
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) (2):
net/i40e: set VF VLAN strip from PF
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 | 3 +
app/test-pmd/cmdline.c | 587 ++++++++++++++++--
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 | 921 +++++++++++++++++++++++++++-
drivers/net/i40e/i40e_ethdev.h | 5 +-
drivers/net/i40e/i40e_ethdev_vf.c | 82 ++-
drivers/net/i40e/i40e_pf.c | 244 ++++++--
drivers/net/i40e/i40e_pf.h | 9 +-
drivers/net/i40e/rte_pmd_i40e.h | 332 ++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 20 +
13 files changed, 2139 insertions(+), 115 deletions(-)
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 01/25] net/i40e: support link status notification
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
@ 2017-01-10 7:15 ` Wenzhuo Lu
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 02/25] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
` (24 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:15 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 23 ++++++++++++
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, 96 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..4e54e92 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-2017 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..a13d96b 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,25 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+int
+rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
+{
+ struct rte_eth_dev *dev;
+ struct i40e_pf *pf;
+
+ 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 >= pf->vf_num || !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..f606c2a 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-2017 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -897,7 +897,7 @@
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..47a9c34 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-2017 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..8391347
--- /dev/null
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -0,0 +1,58 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright (c) 2017 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 02/25] net/i40e: add callback to user on VF to PF mbox msg
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 01/25] net/i40e: support link status notification Wenzhuo Lu
@ 2017-01-10 7:15 ` Wenzhuo Lu
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 03/25] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
` (23 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:15 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 f606c2a..5c58424 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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 8391347..8fed94c 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
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 03/25] net/i40e: set VF MAC anti-spoofing from PF
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 01/25] net/i40e: support link status notification Wenzhuo Lu
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 02/25] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
@ 2017-01-10 7:15 ` Wenzhuo Lu
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 04/25] net/i40e: set VF VLAN " Wenzhuo Lu
` (22 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:15 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 62 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 82 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a13d96b..eba5168 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9718,3 +9718,65 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ 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];
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ /* 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) {
+ ret = -ENOTSUP;
+ 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 8fed94c..95519aa 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 04/25] net/i40e: set VF VLAN anti-spoofing from PF
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (2 preceding siblings ...)
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 03/25] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
@ 2017-01-10 7:15 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 05/25] net/i40e: set Tx loopback " Wenzhuo Lu
` (21 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:15 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 137 ++++++++++++++++++++++++++++--
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, 153 insertions(+), 5 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index eba5168..3d126a1 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4418,6 +4418,7 @@ struct i40e_vsi *
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 :
@@ -5757,14 +5758,11 @@ struct i40e_vsi *
}
static void
-i40e_set_vlan_filter(struct i40e_vsi *vsi,
- uint16_t vlan_id, bool on)
+i40e_store_vlan_filter(struct i40e_vsi *vsi,
+ uint16_t vlan_id, bool on)
{
uint32_t vid_idx, vid_bit;
- if (vlan_id > ETH_VLAN_ID_MAX)
- return;
-
vid_idx = I40E_VFTA_IDX(vlan_id);
vid_bit = I40E_VFTA_BIT(vlan_id);
@@ -5774,6 +5772,38 @@ struct i40e_vsi *
vsi->vfta[vid_idx] &= ~vid_bit;
}
+static void
+i40e_set_vlan_filter(struct i40e_vsi *vsi,
+ uint16_t vlan_id, bool on)
+{
+ 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;
+
+ i40e_store_vlan_filter(vsi, vlan_id, on);
+
+ if (!vsi->vlan_anti_spoof_on || !vlan_id)
+ return;
+
+ vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
+
+ if (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");
+ } else {
+ 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");
+ }
+}
+
/**
* Find all vlan options for specific mac addr,
* return with actual vlan found.
@@ -9780,3 +9810,100 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ if (!vlan_id)
+ continue;
+
+ 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 i40e_pf *pf;
+ 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];
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ /* 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) {
+ PMD_DRV_LOG(ERR, "Failed to remove VLAN filters.");
+ return -ENOTSUP;
+ }
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 95519aa..9546c84 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 05/25] net/i40e: set Tx loopback from PF
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (3 preceding siblings ...)
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 04/25] net/i40e: set VF VLAN " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 06/25] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
` (20 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 238 ++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 16 ++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 255 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 3d126a1..1c02db7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9907,3 +9907,241 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ void *temp;
+
+ /* remove all the MACs */
+ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+ 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;
+ void *temp;
+
+ /* restore all the MACs */
+ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+ 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;
+
+ if (!vsi)
+ return -EINVAL;
+
+ 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 MAC and VLAN first */
+ ret = i40e_vsi_rm_mac_filter(vsi);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to remove MAC filters.");
+ return ret;
+ }
+ if (vsi->vlan_anti_spoof_on) {
+ ret = i40e_add_rm_all_vlan_filter(vsi, 0);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to remove VLAN filters.");
+ 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 MAC and VLAN back */
+ ret = i40e_vsi_restore_mac_filter(vsi);
+ if (ret)
+ return ret;
+ if (vsi->vlan_anti_spoof_on) {
+ ret = i40e_add_rm_all_vlan_filter(vsi, 1);
+ 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 -ENOTSUP;
+
+ /* setup TX loopback for all the VFs */
+ if (!pf->vfs) {
+ /* if no VF, do nothing. */
+ return 0;
+ }
+
+ 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 -ENOTSUP;
+ }
+
+ return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 9546c84..be99121 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 06/25] net/i40e: set VF unicast promisc mode from PF
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (4 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 05/25] net/i40e: set Tx loopback " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 07/25] net/i40e: set VF multicast " Wenzhuo Lu
` (19 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 38 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 58 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 1c02db7..175d9e0 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10145,3 +10145,41 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ 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);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
+ on, NULL, true);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 be99121..4fecbf1 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 07/25] net/i40e: set VF multicast promisc mode from PF
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (5 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 06/25] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 08/25] net/i40e: enable VF MTU change Wenzhuo Lu
` (18 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 38 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 58 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 175d9e0..bd4b710 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10183,3 +10183,41 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ 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);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,
+ on, NULL);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 4fecbf1..88e0c94 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 08/25] net/i40e: enable VF MTU change
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (6 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 07/25] net/i40e: set VF multicast " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 09/25] net/i40e: fix VF reset flow Wenzhuo Lu
` (17 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 @@ struct rte_i40evf_xstats_name_off {
.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 @@ static int i40evf_dev_xstats_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;
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 09/25] net/i40e: fix VF reset flow
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (7 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 08/25] net/i40e: enable VF MTU change Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 10/25] net/i40e: set VF MAC from PF support Wenzhuo Lu
` (16 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang, stable
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 5c58424..8a6733c 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -139,7 +139,7 @@
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 @@
}
/* 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 @@
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 47a9c34..b4c2287 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 {
/*
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 10/25] net/i40e: set VF MAC from PF support
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (8 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 09/25] net/i40e: fix VF reset flow Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 11/25] net/i40e: set VF MAC from VF support Wenzhuo Lu
` (15 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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.
PF should set MAC address before VF initialized,
if PF sets the MAC address after VF initialized,
new MAC address won't be effective until VF
reinitialized.
This will remove all existing MAC filters.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 39 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 23 ++++++++++++++++++
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 bd4b710..0467f3e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10221,3 +10221,42 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+int
+rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+ struct ether_addr *mac_addr)
+{
+ 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];
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs)
+ return -EINVAL;
+
+ vf = &pf->vfs[vf_id];
+ vsi = vf->vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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 88e0c94..639426b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -168,4 +168,27 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
uint16_t vf_id,
uint8_t on);
+/**
+ * Set the VF MAC address.
+ *
+ * PF should set MAC address before VF initialized, if PF sets the MAC
+ * address after VF initialized, new MAC address won't be effective until
+ * VF reinitialize.
+ *
+ * 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 11/25] net/i40e: set VF MAC from VF support
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (9 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 10/25] net/i40e: set VF MAC from PF support Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 12/25] net/i40e: fix VF MAC address assignment Wenzhuo Lu
` (14 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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 @@ struct rte_i40evf_xstats_name_off {
.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 @@ struct rte_i40evf_xstats_name_off {
}
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 @@ struct rte_i40evf_xstats_name_off {
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 @@ static int i40evf_dev_xstats_get(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 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
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);
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 12/25] net/i40e: fix VF MAC address assignment
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (10 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 11/25] net/i40e: set VF MAC from VF support Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 13/25] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
` (13 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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 @@ static int i40evf_dev_xstats_get(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 @@ static int i40evf_dev_xstats_get(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) {
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 13/25] net/i40e: set VF VLAN strip from PF
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (11 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 12/25] net/i40e: fix VF MAC address assignment Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 14/25] net/i40e: set VF VLAN insertion " Wenzhuo Lu
` (12 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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 | 33 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 53 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 0467f3e..4851978 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10260,3 +10260,36 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ 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);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+
+ if (!vsi)
+ return -EINVAL;
+
+ ret = i40e_vsi_config_vlan_stripping(vsi, !!on);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ PMD_DRV_LOG(ERR, "Failed to set VLAN stripping!");
+ }
+
+ return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 639426b..7eed7e6 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -191,4 +191,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 14/25] net/i40e: set VF VLAN insertion from PF
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (12 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 13/25] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 15/25] net/i40e: set VF broadcast mode " Wenzhuo Lu
` (11 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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 | 62 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 82 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4851978..c173a1c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10293,3 +10293,65 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ struct i40e_vsi *vsi;
+ struct i40e_vsi_context ctxt;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ if (vlan_id > ETHER_MAX_VLAN_ID) {
+ PMD_DRV_LOG(ERR, "Invalid VLAN ID.");
+ return -EINVAL;
+ }
+
+ dev = &rte_eth_devices[port];
+
+ 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) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+ vsi->info.pvid = vlan_id;
+ if (vlan_id > 0)
+ vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID;
+ else
+ vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_INSERT_PVID;
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 7eed7e6..555e77d 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -210,4 +210,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 15/25] net/i40e: set VF broadcast mode from PF
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (13 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 14/25] net/i40e: set VF VLAN insertion " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 16/25] net/i40e: set VF VLAN tag " Wenzhuo Lu
` (10 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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 | 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 c173a1c..396ecd6 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10355,3 +10355,56 @@ 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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on should be 0 or 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) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_broadcast(hw, vsi->seid, on, NULL);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 555e77d..14a9618 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -229,4 +229,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 16/25] net/i40e: set VF VLAN tag from PF
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (14 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 15/25] net/i40e: set VF broadcast mode " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 17/25] net/i40e: set VF VLAN filter " Wenzhuo Lu
` (9 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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 | 65 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 18 +++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 84 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 396ecd6..d8bdd17 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10408,3 +10408,68 @@ 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 i40e_pf *pf;
+ 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];
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on should be 0 or 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 14a9618..5c1b89b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -248,4 +248,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 17/25] net/i40e: set VF VLAN filter from PF
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (15 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 16/25] net/i40e: set VF VLAN tag " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 18/25] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
` (8 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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 | 60 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 22 ++++++++++++
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 d8bdd17..321be86 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10473,3 +10473,63 @@ 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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ uint16_t vf_idx;
+ int ret = I40E_SUCCESS;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (vlan_id > ETHER_MAX_VLAN_ID) {
+ PMD_DRV_LOG(ERR, "Invalid VLAN ID.");
+ return -EINVAL;
+ }
+
+ if (vf_mask == 0) {
+ PMD_DRV_LOG(ERR, "No VF.");
+ return -EINVAL;
+ }
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on is should be 0 or 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ for (vf_idx = 0; vf_idx < 64 && ret == I40E_SUCCESS; vf_idx++) {
+ if (vf_mask & ((uint64_t)(1ULL << vf_idx))) {
+ if (on)
+ ret = i40e_vsi_add_vlan(pf->vfs[vf_idx].vsi,
+ vlan_id);
+ else
+ ret = i40e_vsi_delete_vlan(pf->vfs[vf_idx].vsi,
+ vlan_id);
+ }
+ }
+
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 5c1b89b..b79abc7 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -266,4 +266,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) 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 18/25] app/testpmd: use VFD APIs on i40e
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (16 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 17/25] net/i40e: set VF VLAN filter " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 11:29 ` Ferruh Yigit
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 19/25] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
` (7 subsequent siblings)
25 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark), Bernard Iremonger
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 | 3 +
app/test-pmd/cmdline.c | 154 +++++++++++++++++++++++++++++++++++++++----------
2 files changed, 126 insertions(+), 31 deletions(-)
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 891b85a..66bd38a 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -58,7 +58,10 @@ SRCS-y += csumonly.c
SRCS-y += icmpecho.c
SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
+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
+endif
CFLAGS_cmdline.o := -D_GNU_SOURCE
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ed84d7a..9a44b4f 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 @@ struct 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 @@ struct cmd_config_e_tag_result {
NULL,
},
};
-#ifdef RTE_LIBRTE_IXGBE_PMD
/* vf vlan anti spoof configuration */
@@ -10860,11 +10856,24 @@ struct cmd_vf_vlan_anti_spoof_result {
__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 +10883,9 @@ struct cmd_vf_vlan_anti_spoof_result {
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 +10957,24 @@ struct cmd_vf_mac_anti_spoof_result {
__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 +10984,9 @@ struct cmd_vf_mac_anti_spoof_result {
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 +11058,24 @@ struct cmd_vf_vlan_stripq_result {
__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 +11156,22 @@ struct cmd_vf_vlan_insert_result {
__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 +11181,9 @@ struct cmd_vf_vlan_insert_result {
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 +11245,22 @@ struct cmd_tx_loopback_result {
__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 +11270,9 @@ struct cmd_tx_loopback_result {
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 +11292,7 @@ struct cmd_tx_loopback_result {
},
};
+#ifdef RTE_LIBRTE_IXGBE_PMD
/* all queues drop enable configuration */
/* Common result structure for all queues drop enable */
@@ -11277,6 +11351,9 @@ struct cmd_all_queues_drop_en_result {
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 +11458,7 @@ struct cmd_vf_split_drop_en_result {
NULL,
},
};
+#endif
/* vf mac address configuration */
@@ -11432,10 +11510,22 @@ struct cmd_set_vf_mac_addr_result {
__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 +11535,9 @@ struct cmd_set_vf_mac_addr_result {
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 +11558,6 @@ struct cmd_set_vf_mac_addr_result {
NULL,
},
};
-#endif
/* ******************************************************************************** */
@@ -11619,20 +11711,20 @@ struct cmd_set_vf_mac_addr_result {
(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,
};
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 18/25] app/testpmd: use VFD APIs on i40e
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 18/25] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2017-01-10 11:29 ` Ferruh Yigit
2017-01-10 20:08 ` Ferruh Yigit
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2017-01-10 11:29 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Chen Jing D(Mark), Bernard Iremonger
On 1/10/2017 7:16 AM, Wenzhuo Lu wrote:
> 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>
> ---
<...>
> +#ifdef RTE_LIBRTE_IXGBE_PMD
Within this ifdef, there is following call:
ret = rte_pmd_ixgbe_set_all_queues_drop_en(res->port_id, is_on);
It is not safe to make that call directly, port should be verified first
if it is ixgbe port, as done in other functions.
> /* all queues drop enable configuration */
>
> /* Common result structure for all queues drop enable */
> @@ -11277,6 +11351,9 @@ struct cmd_all_queues_drop_en_result {
> 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 +11458,7 @@ struct cmd_vf_split_drop_en_result {
> NULL,
> },
> };
> +#endif
>
<...>
> @@ -11619,20 +11711,20 @@ struct cmd_set_vf_mac_addr_result {
> (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
Overall, since port will be verified within the function, why not remove
this ifdef completely?
So all functions will be visible to everyone, but only the PMDs support
it will be called, others will return "not supported", as done in some
functions supports bot i40e and ixgbe pmd specific APIs.
> (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,
> };
>
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 18/25] app/testpmd: use VFD APIs on i40e
2017-01-10 11:29 ` Ferruh Yigit
@ 2017-01-10 20:08 ` Ferruh Yigit
2017-01-11 1:27 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2017-01-10 20:08 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Chen Jing D(Mark), Bernard Iremonger
On 1/10/2017 11:29 AM, Ferruh Yigit wrote:
> On 1/10/2017 7:16 AM, Wenzhuo Lu wrote:
>> 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>
>> ---
>
> <...>
>
>> +#ifdef RTE_LIBRTE_IXGBE_PMD
>
> Within this ifdef, there is following call:
>
> ret = rte_pmd_ixgbe_set_all_queues_drop_en(res->port_id, is_on);
>
> It is not safe to make that call directly, port should be verified first
> if it is ixgbe port, as done in other functions.
With a second thought, although this part is not correct, it is out of
this patches scope, because it concerns ixgbe related part. So below
comment also become invalid.
Wenzhuo,
What do you think not changing this patch, but fixing this in a separate
patch?
Thanks,
ferruh
>
>> /* all queues drop enable configuration */
>>
>> /* Common result structure for all queues drop enable */
>> @@ -11277,6 +11351,9 @@ struct cmd_all_queues_drop_en_result {
>> 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 +11458,7 @@ struct cmd_vf_split_drop_en_result {
>> NULL,
>> },
>> };
>> +#endif
>>
>
> <...>
>
>> @@ -11619,20 +11711,20 @@ struct cmd_set_vf_mac_addr_result {
>> (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
>
> Overall, since port will be verified within the function, why not remove
> this ifdef completely?
>
> So all functions will be visible to everyone, but only the PMDs support
> it will be called, others will return "not supported", as done in some
> functions supports bot i40e and ixgbe pmd specific APIs.
>
>> (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,
>> };
>>
>>
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 18/25] app/testpmd: use VFD APIs on i40e
2017-01-10 20:08 ` Ferruh Yigit
@ 2017-01-11 1:27 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-11 1:27 UTC (permalink / raw)
To: Yigit, Ferruh, dev; +Cc: Chen, Jing D, Iremonger, Bernard
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, January 11, 2017 4:09 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Cc: Chen, Jing D; Iremonger, Bernard
> Subject: Re: [dpdk-dev] [PATCH v8 18/25] app/testpmd: use VFD APIs on i40e
>
> On 1/10/2017 11:29 AM, Ferruh Yigit wrote:
> > On 1/10/2017 7:16 AM, Wenzhuo Lu wrote:
> >> 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>
> >> ---
> >
> > <...>
> >
> >> +#ifdef RTE_LIBRTE_IXGBE_PMD
> >
> > Within this ifdef, there is following call:
> >
> > ret = rte_pmd_ixgbe_set_all_queues_drop_en(res->port_id, is_on);
> >
> > It is not safe to make that call directly, port should be verified
> > first if it is ixgbe port, as done in other functions.
>
> With a second thought, although this part is not correct, it is out of this
> patches scope, because it concerns ixgbe related part. So below comment also
> become invalid.
>
> Wenzhuo,
>
> What do you think not changing this patch, but fixing this in a separate patch?
Agree. I'll not change this patch but fix this issue with a separate patch.
>
> Thanks,
> ferruh
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 19/25] app/testpmd: use unicast promiscuous mode on i40e
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (17 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 18/25] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 20/25] app/testpmd: use multicast " Wenzhuo Lu
` (6 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 97 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 106 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 9a44b4f..cc177a6 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"
@@ -11559,6 +11562,99 @@ struct cmd_set_vf_mac_addr_result {
},
};
+/* 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;
+ struct rte_eth_dev_info dev_info;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (strstr(dev_info.driver_name, "i40e") != NULL)
+ 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 */
@@ -11725,6 +11821,7 @@ struct cmd_set_vf_mac_addr_result {
(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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 20/25] app/testpmd: use multicast promiscuous mode on i40e
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (18 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 19/25] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 21/25] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
` (5 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 97 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 106 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index cc177a6..c5f5134 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"
@@ -11655,6 +11658,99 @@ struct cmd_vf_promisc_result {
},
};
+/* 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;
+ struct rte_eth_dev_info dev_info;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (strstr(dev_info.driver_name, "i40e") != NULL)
+ 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 */
@@ -11822,6 +11918,7 @@ struct cmd_vf_promisc_result {
#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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 21/25] app/testpmd: add command to test VF broadcast mode on i40e
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (19 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 20/25] app/testpmd: use multicast " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 22/25] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
` (4 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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 | 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 c5f5134..a860228 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"
@@ -11751,6 +11754,99 @@ struct cmd_vf_allmulti_result {
},
};
+/* 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;
+ struct rte_eth_dev_info dev_info;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (strstr(dev_info.driver_name, "i40e") != NULL)
+ 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 */
@@ -11919,6 +12015,7 @@ struct cmd_vf_allmulti_result {
(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
~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 22/25] app/testpmd: add command to test VF VLAN tag on i40e
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (20 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 21/25] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 23/25] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
` (3 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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 | 103 ++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++
2 files changed, 110 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a860228..2402d1d 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"
@@ -11847,6 +11850,105 @@ struct cmd_set_vf_broadcast_result {
},
};
+/* 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;
+ struct rte_eth_dev_info dev_info;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (strstr(dev_info.driver_name, "i40e") != NULL)
+ 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 */
@@ -12016,6 +12118,7 @@ struct cmd_set_vf_broadcast_result {
(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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 23/25] app/testpmd: handle i40e in VF VLAN filter command
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (21 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 22/25] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 24/25] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
` (2 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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/cmdline.c | 41 ++++++++++++++++++++++++++++++++++-------
app/test-pmd/config.c | 13 -------------
app/test-pmd/testpmd.h | 2 --
3 files changed, 34 insertions(+), 22 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 2402d1d..107c808 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6835,7 +6835,6 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result,
},
};
-#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,40 @@ struct cmd_vf_rx_vlan_filter {
__attribute__((unused)) void *data)
{
struct cmd_vf_rx_vlan_filter *res = parsed_result;
+ int ret = -ENOTSUP;
- 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_unused int is_add = (strcmp(res->what, "add") == 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_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 %"PRIu64"\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 +6926,6 @@ struct cmd_vf_rx_vlan_filter {
NULL,
},
};
-#endif
/* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */
struct cmd_queue_rate_limit_result {
@@ -12111,9 +12138,9 @@ struct cmd_set_vf_vlan_tag_result {
(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 @@ struct igb_ring_desc_16_bytes {
"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,
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 24/25] net/i40e: enhance in sanity check of MAC
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (22 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 23/25] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 25/25] net/i40e: set/clear VF stats from PF Wenzhuo Lu
2017-01-10 13:24 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Zhang, Helin
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: 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 8a6733c..263e843 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -753,8 +753,8 @@
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;
}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v8 25/25] net/i40e: set/clear VF stats from PF
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (23 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 24/25] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
@ 2017-01-10 7:16 ` Wenzhuo Lu
2017-01-10 13:24 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Zhang, Helin
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-10 7:16 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 | 73 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 41 +++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 2 +
3 files changed, 116 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 321be86..b9bad3c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10533,3 +10533,76 @@ 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 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 || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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 0;
+}
+
+int
+rte_pmd_i40e_reset_vf_stats(uint8_t port,
+ uint16_t vf_id)
+{
+ 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 || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ vsi->offset_loaded = false;
+ i40e_update_vsi_stats(vsi);
+
+ return 0;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index b79abc7..94eecfc 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -288,4 +288,45 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
` (24 preceding siblings ...)
2017-01-10 7:16 ` [dpdk-dev] [PATCH v8 25/25] net/i40e: set/clear VF stats from PF Wenzhuo Lu
@ 2017-01-10 13:24 ` Zhang, Helin
2017-01-10 20:23 ` Vincent Jardin
25 siblings, 1 reply; 367+ messages in thread
From: Zhang, Helin @ 2017-01-10 13:24 UTC (permalink / raw)
To: Lu, Wenzhuo, dev
Cc: Lu, Wenzhuo, 'JOSHI, KAUSTUBH', 'DANIELS, EDWARD',
'ZELEZNIAK, ALEX'
Acked-by: Helin Zhang <helin.zhang@intel.com>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 10, 2017 3:16 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo
> Subject: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
>
> 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.
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-10 13:24 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Zhang, Helin
@ 2017-01-10 20:23 ` Vincent Jardin
2017-01-10 21:32 ` Ferruh Yigit
2017-01-11 2:59 ` JOSHI, KAUSTUBH (KAUSTUBH)
0 siblings, 2 replies; 367+ messages in thread
From: Vincent Jardin @ 2017-01-10 20:23 UTC (permalink / raw)
To: Zhang, Helin, Lu, Wenzhuo, dev
Cc: Lu, Wenzhuo, 'JOSHI, KAUSTUBH', 'DANIELS, EDWARD',
'ZELEZNIAK, ALEX'
Nope. First one needs to assess if DPDK should be intensively used to
become a PF knowing Linux can do the jobs. Linux kernel community does not
like the forking of Kernel drivers, I tend to agree that we should not keep
duplicating options that can be solved with the Linux kernel.
Best regards,
Vincent
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-10 20:23 ` Vincent Jardin
@ 2017-01-10 21:32 ` Ferruh Yigit
2017-01-11 13:14 ` Vincent JARDIN
2017-01-11 2:59 ` JOSHI, KAUSTUBH (KAUSTUBH)
1 sibling, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2017-01-10 21:32 UTC (permalink / raw)
To: Vincent Jardin, Zhang, Helin, Lu, Wenzhuo, dev
Cc: 'JOSHI, KAUSTUBH', 'DANIELS, EDWARD',
'ZELEZNIAK, ALEX'
Hi Vincent,
On 1/10/2017 8:23 PM, Vincent Jardin wrote:
> Nope. First one needs to assess if DPDK should be intensively used to
> become a PF knowing Linux can do the jobs. Linux kernel community does not
> like the forking of Kernel drivers, I tend to agree that we should not keep
> duplicating options that can be solved with the Linux kernel.
This patchset split into two, mainly because of your comment, and this
one has nothing specific to Linux VF.
Is there any specific piece of this patchset that cause concern?
What do you think to continue high level DPDK PF discussion in mail
thread for other pathset? So that we can continue to work on this one.
Thanks,
ferruh
>
> Best regards,
> Vincent
>
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-10 21:32 ` Ferruh Yigit
@ 2017-01-11 13:14 ` Vincent JARDIN
2017-01-11 14:53 ` Ferruh Yigit
` (2 more replies)
0 siblings, 3 replies; 367+ messages in thread
From: Vincent JARDIN @ 2017-01-11 13:14 UTC (permalink / raw)
To: Ferruh Yigit, Zhang, Helin, Lu, Wenzhuo, dev
Cc: 'JOSHI, KAUSTUBH', 'DANIELS, EDWARD',
'ZELEZNIAK, ALEX'
Le 10/01/2017 à 22:32, Ferruh Yigit a écrit :
> What do you think to continue high level DPDK PF discussion in mail
> thread for other pathset? So that we can continue to work on this one.
First, we need to assess or not if it makes sense to go toward Linux
kernel or DPDK based PF. If Linux kernel is used, then DPDK does not
need VFD related modifications.
VFD demonstrates that there are some needs of features, but it pushes
the new path of a fork of PF drivers.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-11 13:14 ` Vincent JARDIN
@ 2017-01-11 14:53 ` Ferruh Yigit
2017-01-11 15:19 ` Wu, Jingjing
2017-01-12 3:21 ` Lu, Wenzhuo
2 siblings, 0 replies; 367+ messages in thread
From: Ferruh Yigit @ 2017-01-11 14:53 UTC (permalink / raw)
To: Vincent JARDIN, Zhang, Helin, Lu, Wenzhuo, dev
Cc: 'JOSHI, KAUSTUBH', 'DANIELS, EDWARD',
'ZELEZNIAK, ALEX'
On 1/11/2017 1:14 PM, Vincent JARDIN wrote:
> Le 10/01/2017 à 22:32, Ferruh Yigit a écrit :
>> What do you think to continue high level DPDK PF discussion in mail
>> thread for other pathset? So that we can continue to work on this one.
>
> First, we need to assess or not if it makes sense to go toward Linux
> kernel or DPDK based PF. If Linux kernel is used, then DPDK does not
> need VFD related modifications.
DPDK PF <--> DPDK VF is already supported. This patchset is not
introducing it.
This patchset adds more PF <-> VF communication to a specific driver,
and this is done in PMD specific way, so update is limited to PMD.
>From my scope, this patchset looks good.
And how assessment can be done, with which quorum, can it be done in a
way without blocking the patchset?
>
> VFD demonstrates that there are some needs of features, but it pushes
> the new path of a fork of PF drivers.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-11 13:14 ` Vincent JARDIN
2017-01-11 14:53 ` Ferruh Yigit
@ 2017-01-11 15:19 ` Wu, Jingjing
2017-01-12 3:21 ` Lu, Wenzhuo
2 siblings, 0 replies; 367+ messages in thread
From: Wu, Jingjing @ 2017-01-11 15:19 UTC (permalink / raw)
To: Vincent JARDIN, Yigit, Ferruh, Zhang, Helin, Lu, Wenzhuo, dev
Cc: 'JOSHI, KAUSTUBH', 'DANIELS, EDWARD',
'ZELEZNIAK, ALEX'
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Vincent JARDIN
> Sent: Wednesday, January 11, 2017 9:14 PM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>; Zhang, Helin
> <helin.zhang@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>;
> dev@dpdk.org
> Cc: 'JOSHI, KAUSTUBH' <kaustubh@research.att.com>; 'DANIELS, EDWARD'
> <daniels@research.att.com>; 'ZELEZNIAK, ALEX' <az5157@att.com>
> Subject: Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
>
> Le 10/01/2017 à 22:32, Ferruh Yigit a écrit :
> > What do you think to continue high level DPDK PF discussion in mail
> > thread for other pathset? So that we can continue to work on this one.
>
> First, we need to assess or not if it makes sense to go toward Linux kernel or
> DPDK based PF. If Linux kernel is used, then DPDK does not need VFD related
> modifications.
>
> VFD demonstrates that there are some needs of features, but it pushes the new
> path of a fork of PF drivers.
DPDK PF working with DPDK VF is not new scenario at all. It was already supported.
This patchset just adds more features from my view.
Even if DPDK PF supports Kernel VF, it is a way to make VF and PF's driver low coupling.
User can define their scenario flexibly. I don't what is the reason to object that.
Thanks
Jingjing
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-11 13:14 ` Vincent JARDIN
2017-01-11 14:53 ` Ferruh Yigit
2017-01-11 15:19 ` Wu, Jingjing
@ 2017-01-12 3:21 ` Lu, Wenzhuo
2 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-12 3:21 UTC (permalink / raw)
To: Vincent JARDIN, Yigit, Ferruh, Zhang, Helin, dev
Cc: 'JOSHI, KAUSTUBH', 'DANIELS, EDWARD',
'ZELEZNIAK, ALEX',
Chen, Jing D
Hi Vincent,
> -----Original Message-----
> From: Vincent JARDIN [mailto:vincent.jardin@6wind.com]
> Sent: Wednesday, January 11, 2017 9:14 PM
> To: Yigit, Ferruh; Zhang, Helin; Lu, Wenzhuo; dev@dpdk.org
> Cc: 'JOSHI, KAUSTUBH'; 'DANIELS, EDWARD'; 'ZELEZNIAK, ALEX'
> Subject: Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
>
> Le 10/01/2017 à 22:32, Ferruh Yigit a écrit :
> > What do you think to continue high level DPDK PF discussion in mail
> > thread for other pathset? So that we can continue to work on this one.
>
> First, we need to assess or not if it makes sense to go toward Linux kernel or
> DPDK based PF. If Linux kernel is used, then DPDK does not need VFD related
> modifications.
>
> VFD demonstrates that there are some needs of features, but it pushes the
> new path of a fork of PF drivers.
We're not sure if we want to change and maintain a totally new DPDK PF either.
So, we only change PMD code and not expose it to abstraction layer. It can only be used by some users who have the needs.
It's experimental and comes from the users' requirement. If it's good enough and accepted by other NICs, we can expose it.
If it's not good, it still can be a choice before Linux kernel provides.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-10 20:23 ` Vincent Jardin
2017-01-10 21:32 ` Ferruh Yigit
@ 2017-01-11 2:59 ` JOSHI, KAUSTUBH (KAUSTUBH)
2017-01-11 11:03 ` Vincent Jardin
1 sibling, 1 reply; 367+ messages in thread
From: JOSHI, KAUSTUBH (KAUSTUBH) @ 2017-01-11 2:59 UTC (permalink / raw)
To: Vincent Jardin
Cc: Zhang, Helin, Lu, Wenzhuo, dev, DANIELS, EDWARD S (EDWARD),
ZELEZNIAK, ALEX
Hi Vincent,
Greetings! Jumping into this debate a bit late, but let me share our point of view based on how we are using this code within AT&T for our NFV cloud.
Actually, we first started with trying to do the configuration within the kernel drivers as you suggest, but quickly realized that besides the practical problem of kernel upstreaming being a much more arduous road (which can be overcome), the bigger problem was that there is no standardization in the configuration interfaces for the NICs in the kernel community. So different drivers do things differently and expose different settings, and no forum exists to drive towards such standardization. This was leading to vendors have to maintain patched versions of drivers for doing PF configuration, which is not a desirable situation.
So, to build a portable (to multiple NICs) SRIOV VF manager like VFd, DPDK seemed like a good a forum with some hope for driving towards a standard set of interfaces and without having to worry about a lot of legacy baggage and old hardware. Especially since DPDK already takes on the role of configuring NICs for the data plane functions anyway - both PF and VF drivers will have to be included for data plane usage anyway - we viewed that adding VF config options will not cause any forking, but simply flush out the DPDK drivers and their interfaces to be more complete. These APIs could be optional, so new vendors aren’t obligated to add them.
Furthermore, allowing VF config using the DPDK PF driver also has the side benefit of allowing a complete SRIOV system (both VF and PF) to be built entirely with DPDK, also making version alignment easier.
We started with Niantic, which already had PF and VF drivers, and things have worked out very well with it. However, we would like VFd to be a multi-NIC vendor agnostic VF management tool, which is why we’ve been asking for making the PF config APIs richer.
Regards
KJ
> On Jan 10, 2017, at 3:23 PM, Vincent Jardin <vincent.jardin@6wind.com> wrote:
>
> Nope. First one needs to assess if DPDK should be intensively used to become a PF knowing Linux can do the jobs. Linux kernel community does not like the forking of Kernel drivers, I tend to agree that we should not keep duplicating options that can be solved with the Linux kernel.
>
> Best regards,
> Vincent
>
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-11 2:59 ` JOSHI, KAUSTUBH (KAUSTUBH)
@ 2017-01-11 11:03 ` Vincent Jardin
2017-01-11 14:32 ` Zhang, Helin
2017-01-11 14:49 ` JOSHI, KAUSTUBH (KAUSTUBH)
0 siblings, 2 replies; 367+ messages in thread
From: Vincent Jardin @ 2017-01-11 11:03 UTC (permalink / raw)
To: JOSHI, KAUSTUBH (KAUSTUBH)
Cc: Zhang, Helin, Lu, Wenzhuo, dev, DANIELS, EDWARD S (EDWARD),
ZELEZNIAK, ALEX
Please can you list the gaps of the Kernel API?
Thank you,
Vincent
Le 11 janvier 2017 3:59:45 AM "JOSHI, KAUSTUBH (KAUSTUBH)"
<kaustubh@research.att.com> a écrit :
> Hi Vincent,
>
> Greetings! Jumping into this debate a bit late, but let me share our point
> of view based on how we are using this code within AT&T for our NFV cloud.
>
> Actually, we first started with trying to do the configuration within the
> kernel drivers as you suggest, but quickly realized that besides the
> practical problem of kernel upstreaming being a much more arduous road
> (which can be overcome), the bigger problem was that there is no
> standardization in the configuration interfaces for the NICs in the kernel
> community. So different drivers do things differently and expose different
> settings, and no forum exists to drive towards such standardization. This
> was leading to vendors have to maintain patched versions of drivers for
> doing PF configuration, which is not a desirable situation.
>
> So, to build a portable (to multiple NICs) SRIOV VF manager like VFd, DPDK
> seemed like a good a forum with some hope for driving towards a standard
> set of interfaces and without having to worry about a lot of legacy baggage
> and old hardware. Especially since DPDK already takes on the role of
> configuring NICs for the data plane functions anyway - both PF and VF
> drivers will have to be included for data plane usage anyway - we viewed
> that adding VF config options will not cause any forking, but simply flush
> out the DPDK drivers and their interfaces to be more complete. These APIs
> could be optional, so new vendors aren’t obligated to add them.
>
> Furthermore, allowing VF config using the DPDK PF driver also has the side
> benefit of allowing a complete SRIOV system (both VF and PF) to be built
> entirely with DPDK, also making version alignment easier.
>
> We started with Niantic, which already had PF and VF drivers, and things
> have worked out very well with it. However, we would like VFd to be a
> multi-NIC vendor agnostic VF management tool, which is why we’ve been
> asking for making the PF config APIs richer.
>
> Regards
>
> KJ
>
>
>> On Jan 10, 2017, at 3:23 PM, Vincent Jardin <vincent.jardin@6wind.com> wrote:
>>
>> Nope. First one needs to assess if DPDK should be intensively used to
>> become a PF knowing Linux can do the jobs. Linux kernel community does not
>> like the forking of Kernel drivers, I tend to agree that we should not keep
>> duplicating options that can be solved with the Linux kernel.
>>
>> Best regards,
>> Vincent
>>
>>
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-11 11:03 ` Vincent Jardin
@ 2017-01-11 14:32 ` Zhang, Helin
2017-01-11 14:49 ` JOSHI, KAUSTUBH (KAUSTUBH)
1 sibling, 0 replies; 367+ messages in thread
From: Zhang, Helin @ 2017-01-11 14:32 UTC (permalink / raw)
To: Vincent Jardin, JOSHI, KAUSTUBH (KAUSTUBH)
Cc: Lu, Wenzhuo, dev, DANIELS, EDWARD S (EDWARD), ZELEZNIAK, ALEX
> -----Original Message-----
> From: Vincent Jardin [mailto:vincent.jardin@6wind.com]
> Sent: Wednesday, January 11, 2017 7:04 PM
> To: JOSHI, KAUSTUBH (KAUSTUBH)
> Cc: Zhang, Helin; Lu, Wenzhuo; dev@dpdk.org; DANIELS, EDWARD S
> (EDWARD); ZELEZNIAK, ALEX
> Subject: Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
>
> Please can you list the gaps of the Kernel API?
>
> Thank you,
> Vincent
>
>
> Le 11 janvier 2017 3:59:45 AM "JOSHI, KAUSTUBH (KAUSTUBH)"
> <kaustubh@research.att.com> a écrit :
>
> > Hi Vincent,
> >
> > Greetings! Jumping into this debate a bit late, but let me share our
> > point of view based on how we are using this code within AT&T for our NFV
> cloud.
> >
> > Actually, we first started with trying to do the configuration within
> > the kernel drivers as you suggest, but quickly realized that besides
> > the practical problem of kernel upstreaming being a much more arduous
> > road (which can be overcome), the bigger problem was that there is no
> > standardization in the configuration interfaces for the NICs in the
> > kernel community. So different drivers do things differently and
> > expose different settings, and no forum exists to drive towards such
> > standardization. This was leading to vendors have to maintain patched
> > versions of drivers for doing PF configuration, which is not a desirable
> situation.
> >
> > So, to build a portable (to multiple NICs) SRIOV VF manager like VFd,
> > DPDK seemed like a good a forum with some hope for driving towards a
> > standard set of interfaces and without having to worry about a lot of
> > legacy baggage and old hardware. Especially since DPDK already takes
> > on the role of configuring NICs for the data plane functions anyway -
> > both PF and VF drivers will have to be included for data plane usage
> > anyway - we viewed that adding VF config options will not cause any
> > forking, but simply flush out the DPDK drivers and their interfaces to
> > be more complete. These APIs could be optional, so new vendors aren’t
> obligated to add them.
> >
> > Furthermore, allowing VF config using the DPDK PF driver also has the
> > side benefit of allowing a complete SRIOV system (both VF and PF) to
> > be built entirely with DPDK, also making version alignment easier.
> >
> > We started with Niantic, which already had PF and VF drivers, and
> > things have worked out very well with it. However, we would like VFd
> > to be a multi-NIC vendor agnostic VF management tool, which is why
> > we’ve been asking for making the PF config APIs richer.
> >
> > Regards
> >
> > KJ
> >
> >
> >> On Jan 10, 2017, at 3:23 PM, Vincent Jardin <vincent.jardin@6wind.com>
> wrote:
> >>
> >> Nope. First one needs to assess if DPDK should be intensively used to
> >> become a PF knowing Linux can do the jobs. Linux kernel community
> >> does not like the forking of Kernel drivers, I tend to agree that we
> >> should not keep duplicating options that can be solved with the Linux
> kernel.
As a PF host driver is not new to DPDK. From very early igb and ixgbe were
developed to be a PF host driver, then i40e.
In addition, I guess Linux kernel community does not like entire DPDK at all.
For now, the VFD features is added in the PMD itself, which does not require
all PMD to enable that.
I'd suggest to treat it as an experiment feature to keep it in the specifical PMD,
until it is popular enough and mature enough, then we can think about adding
it to ethdev layer as generic features for all PMDs.
This type of feature can help to address the real needs of at&t, who is the
pioneer of this feature. Having a real user of a feaure might be a good
reason to try this way.
Regards,
Helin
> >>
> >> Best regards,
> >> Vincent
> >>
> >>
> >
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-11 11:03 ` Vincent Jardin
2017-01-11 14:32 ` Zhang, Helin
@ 2017-01-11 14:49 ` JOSHI, KAUSTUBH (KAUSTUBH)
2017-01-11 14:51 ` JOSHI, KAUSTUBH (KAUSTUBH)
1 sibling, 1 reply; 367+ messages in thread
From: JOSHI, KAUSTUBH (KAUSTUBH) @ 2017-01-11 14:49 UTC (permalink / raw)
To: Vincent Jardin
Cc: Zhang, Helin, Lu, Wenzhuo, dev, DANIELS, EDWARD S (EDWARD),
ZELEZNIAK, ALEX
When Alex from our team started working on Niantic last year, the following were the list of gaps in the kernel drivers we had a need to fill:
Direct traffic to VF based on more than one outer VLAN tags
Optionally strip on ingress (to PF) and insert on egress VLAN tag
Disable/enable MAC and VLAN anti spoofing separately
Mirror traffic from one VF to the other
Enable/Disable local switching per VF
Collect statistics per VF pkts/octets in/out
Enable/disable Mcast/unknown unicast per VF
Manage up to 8 TC per VF with one strict priority queue
Manage per VF per TC bandwidth allocations
Manage LACP status visibility to the VFs (for NIC teaming using SRIOV)
Most of these are VF management functions, and there is no standardized way to do VF management in the kernel drivers. Besides, most of the use-cases around SRIOV need DPDK in the VF anyway (so the target communities are aligned) and the PF DPDK driver for ixgbe already existed, so it made sense to add them there - no forking of the PF driver was involved and there is no additional duplicate code.
Cheers
KJ
On Jan 11, 2017, at 6:03 AM, Vincent Jardin <vincent.jardin@6wind.com<mailto:vincent.jardin@6wind.com>> wrote:
Please can you list the gaps of the Kernel API?
Thank you,
Vincent
Le 11 janvier 2017 3:59:45 AM "JOSHI, KAUSTUBH (KAUSTUBH)" <kaustubh@research.att.com<mailto:kaustubh@research.att.com>> a écrit :
Hi Vincent,
Greetings! Jumping into this debate a bit late, but let me share our point of view based on how we are using this code within AT&T for our NFV cloud.
Actually, we first started with trying to do the configuration within the kernel drivers as you suggest, but quickly realized that besides the practical problem of kernel upstreaming being a much more arduous road (which can be overcome), the bigger problem was that there is no standardization in the configuration interfaces for the NICs in the kernel community. So different drivers do things differently and expose different settings, and no forum exists to drive towards such standardization. This was leading to vendors have to maintain patched versions of drivers for doing PF configuration, which is not a desirable situation.
So, to build a portable (to multiple NICs) SRIOV VF manager like VFd, DPDK seemed like a good a forum with some hope for driving towards a standard set of interfaces and without having to worry about a lot of legacy baggage and old hardware. Especially since DPDK already takes on the role of configuring NICs for the data plane functions anyway - both PF and VF drivers will have to be included for data plane usage anyway - we viewed that adding VF config options will not cause any forking, but simply flush out the DPDK drivers and their interfaces to be more complete. These APIs could be optional, so new vendors aren’t obligated to add them.
Furthermore, allowing VF config using the DPDK PF driver also has the side benefit of allowing a complete SRIOV system (both VF and PF) to be built entirely with DPDK, also making version alignment easier.
We started with Niantic, which already had PF and VF drivers, and things have worked out very well with it. However, we would like VFd to be a multi-NIC vendor agnostic VF management tool, which is why we’ve been asking for making the PF config APIs richer.
Regards
KJ
On Jan 10, 2017, at 3:23 PM, Vincent Jardin <vincent.jardin@6wind.com<mailto:vincent.jardin@6wind.com>> wrote:
Nope. First one needs to assess if DPDK should be intensively used to become a PF knowing Linux can do the jobs. Linux kernel community does not like the forking of Kernel drivers, I tend to agree that we should not keep duplicating options that can be solved with the Linux kernel.
Best regards,
Vincent
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-11 14:49 ` JOSHI, KAUSTUBH (KAUSTUBH)
@ 2017-01-11 14:51 ` JOSHI, KAUSTUBH (KAUSTUBH)
2017-01-13 23:10 ` John Fastabend
0 siblings, 1 reply; 367+ messages in thread
From: JOSHI, KAUSTUBH (KAUSTUBH) @ 2017-01-11 14:51 UTC (permalink / raw)
To: Vincent Jardin
Cc: Zhang, Helin, Lu, Wenzhuo, dev, DANIELS, EDWARD S (EDWARD),
ZELEZNIAK, ALEX
Also, the kernel drivers have no concept of passing VF messages to upstream "decision making” (or policy enforcement) software like VFd.
On Jan 11, 2017, at 9:49 AM, Kaustubh Joshi <kaustubh@research.att.com<mailto:kaustubh@research.att.com>> wrote:
When Alex from our team started working on Niantic last year, the following were the list of gaps in the kernel drivers we had a need to fill:
Direct traffic to VF based on more than one outer VLAN tags
Optionally strip on ingress (to PF) and insert on egress VLAN tag
Disable/enable MAC and VLAN anti spoofing separately
Mirror traffic from one VF to the other
Enable/Disable local switching per VF
Collect statistics per VF pkts/octets in/out
Enable/disable Mcast/unknown unicast per VF
Manage up to 8 TC per VF with one strict priority queue
Manage per VF per TC bandwidth allocations
Manage LACP status visibility to the VFs (for NIC teaming using SRIOV)
Most of these are VF management functions, and there is no standardized way to do VF management in the kernel drivers. Besides, most of the use-cases around SRIOV need DPDK in the VF anyway (so the target communities are aligned) and the PF DPDK driver for ixgbe already existed, so it made sense to add them there - no forking of the PF driver was involved and there is no additional duplicate code.
Cheers
KJ
On Jan 11, 2017, at 6:03 AM, Vincent Jardin <vincent.jardin@6wind.com<mailto:vincent.jardin@6wind.com>> wrote:
Please can you list the gaps of the Kernel API?
Thank you,
Vincent
Le 11 janvier 2017 3:59:45 AM "JOSHI, KAUSTUBH (KAUSTUBH)" <kaustubh@research.att.com<mailto:kaustubh@research.att.com>> a écrit :
Hi Vincent,
Greetings! Jumping into this debate a bit late, but let me share our point of view based on how we are using this code within AT&T for our NFV cloud.
Actually, we first started with trying to do the configuration within the kernel drivers as you suggest, but quickly realized that besides the practical problem of kernel upstreaming being a much more arduous road (which can be overcome), the bigger problem was that there is no standardization in the configuration interfaces for the NICs in the kernel community. So different drivers do things differently and expose different settings, and no forum exists to drive towards such standardization. This was leading to vendors have to maintain patched versions of drivers for doing PF configuration, which is not a desirable situation.
So, to build a portable (to multiple NICs) SRIOV VF manager like VFd, DPDK seemed like a good a forum with some hope for driving towards a standard set of interfaces and without having to worry about a lot of legacy baggage and old hardware. Especially since DPDK already takes on the role of configuring NICs for the data plane functions anyway - both PF and VF drivers will have to be included for data plane usage anyway - we viewed that adding VF config options will not cause any forking, but simply flush out the DPDK drivers and their interfaces to be more complete. These APIs could be optional, so new vendors aren’t obligated to add them.
Furthermore, allowing VF config using the DPDK PF driver also has the side benefit of allowing a complete SRIOV system (both VF and PF) to be built entirely with DPDK, also making version alignment easier.
We started with Niantic, which already had PF and VF drivers, and things have worked out very well with it. However, we would like VFd to be a multi-NIC vendor agnostic VF management tool, which is why we’ve been asking for making the PF config APIs richer.
Regards
KJ
On Jan 10, 2017, at 3:23 PM, Vincent Jardin <vincent.jardin@6wind.com<mailto:vincent.jardin@6wind.com>> wrote:
Nope. First one needs to assess if DPDK should be intensively used to become a PF knowing Linux can do the jobs. Linux kernel community does not like the forking of Kernel drivers, I tend to agree that we should not keep duplicating options that can be solved with the Linux kernel.
Best regards,
Vincent
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e
2017-01-11 14:51 ` JOSHI, KAUSTUBH (KAUSTUBH)
@ 2017-01-13 23:10 ` John Fastabend
0 siblings, 0 replies; 367+ messages in thread
From: John Fastabend @ 2017-01-13 23:10 UTC (permalink / raw)
To: JOSHI, KAUSTUBH (KAUSTUBH), Vincent Jardin
Cc: Zhang, Helin, Lu, Wenzhuo, dev, DANIELS, EDWARD S (EDWARD),
ZELEZNIAK, ALEX
On 17-01-11 06:51 AM, JOSHI, KAUSTUBH (KAUSTUBH) wrote:
> Also, the kernel drivers have no concept of passing VF messages to upstream "decision making” (or policy enforcement) software like VFd.
>
> On Jan 11, 2017, at 9:49 AM, Kaustubh Joshi <kaustubh@research.att.com<mailto:kaustubh@research.att.com>> wrote:
>
> When Alex from our team started working on Niantic last year, the following were the list of gaps in the kernel drivers we had a need to fill:
>
Thanks for the list its nice to see concrete examples. I can
provide latest upstream status for what its worth.
> Direct traffic to VF based on more than one outer VLAN tags
Kernel supports this but ixgbe/i40e drivers need to pull in code to
enable it.
> Optionally strip on ingress (to PF) and insert on egress VLAN tag
This is just a PVID per VF right? This should be working now on
ixgbe I would have to check though.
> Disable/enable MAC and VLAN anti spoofing separately
Needs kernel patch.
> Mirror traffic from one VF to the other
Kernel supports this but driver is missing feature.
> Enable/Disable local switching per VF
Local switching? I'm guessing this means you want all traffic to
go to network regardless of MAC/etc. A sort of per port VEPA mode?
> Collect statistics per VF pkts/octets in/out
Under development.
> Enable/disable Mcast/unknown unicast per VF
Under development.
> Manage up to 8 TC per VF with one strict priority queue
> Manage per VF per TC bandwidth allocations
Needs kernel patch.
> Manage LACP status visibility to the VFs (for NIC teaming using SRIOV)
I've not even thought to do this yet so its a good catch.
>
> Most of these are VF management functions, and there is no standardized way to do VF management in the kernel drivers. Besides, most of the use-cases around SRIOV need DPDK in the VF anyway (so the target communities are aligned) and the PF DPDK driver for ixgbe already existed, so it made sense to add them there - no forking of the PF driver was involved and there is no additional duplicate code.
>
So I wont argue against we already have DPDK and VFs are DPDK and
updating is a problem per other email. But I think we can at least
get kernel support for the above.
Thanks,
John
> Cheers
>
> KJ
>
>
> On Jan 11, 2017, at 6:03 AM, Vincent Jardin <vincent.jardin@6wind.com<mailto:vincent.jardin@6wind.com>> wrote:
>
> Please can you list the gaps of the Kernel API?
>
> Thank you,
> Vincent
>
>
> Le 11 janvier 2017 3:59:45 AM "JOSHI, KAUSTUBH (KAUSTUBH)" <kaustubh@research.att.com<mailto:kaustubh@research.att.com>> a écrit :
>
> Hi Vincent,
>
> Greetings! Jumping into this debate a bit late, but let me share our point of view based on how we are using this code within AT&T for our NFV cloud.
>
> Actually, we first started with trying to do the configuration within the kernel drivers as you suggest, but quickly realized that besides the practical problem of kernel upstreaming being a much more arduous road (which can be overcome), the bigger problem was that there is no standardization in the configuration interfaces for the NICs in the kernel community. So different drivers do things differently and expose different settings, and no forum exists to drive towards such standardization. This was leading to vendors have to maintain patched versions of drivers for doing PF configuration, which is not a desirable situation.
>
> So, to build a portable (to multiple NICs) SRIOV VF manager like VFd, DPDK seemed like a good a forum with some hope for driving towards a standard set of interfaces and without having to worry about a lot of legacy baggage and old hardware. Especially since DPDK already takes on the role of configuring NICs for the data plane functions anyway - both PF and VF drivers will have to be included for data plane usage anyway - we viewed that adding VF config options will not cause any forking, but simply flush out the DPDK drivers and their interfaces to be more complete. These APIs could be optional, so new vendors aren’t obligated to add them.
>
> Furthermore, allowing VF config using the DPDK PF driver also has the side benefit of allowing a complete SRIOV system (both VF and PF) to be built entirely with DPDK, also making version alignment easier.
>
> We started with Niantic, which already had PF and VF drivers, and things have worked out very well with it. However, we would like VFd to be a multi-NIC vendor agnostic VF management tool, which is why we’ve been asking for making the PF config APIs richer.
>
> Regards
>
> KJ
>
>
> On Jan 10, 2017, at 3:23 PM, Vincent Jardin <vincent.jardin@6wind.com<mailto:vincent.jardin@6wind.com>> wrote:
>
> Nope. First one needs to assess if DPDK should be intensively used to become a PF knowing Linux can do the jobs. Linux kernel community does not like the forking of Kernel drivers, I tend to agree that we should not keep duplicating options that can be solved with the Linux kernel.
>
> Best regards,
> Vincent
>
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (36 preceding siblings ...)
2017-01-10 7:15 ` [dpdk-dev] [PATCH v8 00/25] Support VFD on i40e Wenzhuo Lu
@ 2017-01-13 6:52 ` Wenzhuo Lu
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 01/26] net/i40e: support link status notification Wenzhuo Lu
` (26 more replies)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (2 subsequent siblings)
40 siblings, 27 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:52 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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
13) set VF VLAN tag
14) 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.
Please aware VFD is an EXPERIMENTAL feature, it can be changed or even
removed without prior notice.
2, Implement VF MAC address setting on VF.
v9:
- upadte the doc and announce VFD is an experimental feature.
v8:
- remove unnecessary VF check.
- add more debug logs.
- split VMDq related code to a separate patch set.
- some minor change.
v7:
- fix 32 bit compile error in patch 23.
- add new patches to configure VMDq.
v6:
- remove the support of DPDK PF + kernel VF. Will create a new patch set for it.
- reword the tittles of some patches.
- add sanity check for vsi, and other minor change.
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: set VF VLAN insertion from PF
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) (2):
net/i40e: set VF VLAN strip from PF
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 (11):
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
doc: update doc for VFD
MAINTAINERS | 1 +
app/test-pmd/Makefile | 3 +
app/test-pmd/cmdline.c | 587 ++++++++++++++++--
app/test-pmd/config.c | 13 -
app/test-pmd/testpmd.h | 2 -
doc/guides/nics/i40e.rst | 1 +
doc/guides/rel_notes/release_17_02.rst | 29 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 32 +
drivers/net/i40e/Makefile | 4 +-
drivers/net/i40e/i40e_ethdev.c | 921 +++++++++++++++++++++++++++-
drivers/net/i40e/i40e_ethdev.h | 5 +-
drivers/net/i40e/i40e_ethdev_vf.c | 82 ++-
drivers/net/i40e/i40e_pf.c | 244 ++++++--
drivers/net/i40e/i40e_pf.h | 9 +-
drivers/net/i40e/rte_pmd_i40e.h | 335 ++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 20 +
16 files changed, 2173 insertions(+), 115 deletions(-)
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
Series-Acked-by: Helin Zhang <helin.zhang@intel.com>
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 01/26] net/i40e: support link status notification
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
@ 2017-01-13 6:52 ` Wenzhuo Lu
2017-01-15 23:35 ` Vincent JARDIN
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 02/26] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
` (25 subsequent siblings)
26 siblings, 1 reply; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:52 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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>
---
MAINTAINERS | 1 +
drivers/net/i40e/Makefile | 4 +-
drivers/net/i40e/i40e_ethdev.c | 23 ++++++++++++
drivers/net/i40e/i40e_pf.c | 4 +-
drivers/net/i40e/i40e_pf.h | 4 +-
drivers/net/i40e/rte_pmd_i40e.h | 61 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 7 ++++
7 files changed, 100 insertions(+), 4 deletions(-)
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 32d41b0..9531ff7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -328,6 +328,7 @@ Intel i40e
M: Helin Zhang <helin.zhang@intel.com>
M: Jingjing Wu <jingjing.wu@intel.com>
F: drivers/net/i40e/
+F: drivers/net/i40e/rte_pmd_i40e.h - EXPERIMENTAL
F: doc/guides/nics/i40e.rst
F: doc/guides/nics/intel_vf.rst
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 66997b6..4e54e92 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-2017 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..a13d96b 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,25 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+int
+rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
+{
+ struct rte_eth_dev *dev;
+ struct i40e_pf *pf;
+
+ 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 >= pf->vf_num || !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..f606c2a 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-2017 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -897,7 +897,7 @@
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..47a9c34 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-2017 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..da79585
--- /dev/null
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -0,0 +1,61 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright (c) 2017 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.
+ */
+
+#ifndef _PMD_I40E_H_
+#define _PMD_I40E_H_
+
+/**
+ * @file rte_pmd_i40e.h
+ *
+ * i40e PMD specific functions.
+ *
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ */
+
+#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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v9 01/26] net/i40e: support link status notification
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 01/26] net/i40e: support link status notification Wenzhuo Lu
@ 2017-01-15 23:35 ` Vincent JARDIN
2017-01-16 0:42 ` Lu, Wenzhuo
0 siblings, 1 reply; 367+ messages in thread
From: Vincent JARDIN @ 2017-01-15 23:35 UTC (permalink / raw)
To: Wenzhuo Lu; +Cc: dev
Le 13/01/2017 à 07:52, Wenzhuo Lu a écrit :
> + * @b EXPERIMENTAL: this API may change without prior notice
a minor comment here:
+ including be removed.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v9 01/26] net/i40e: support link status notification
2017-01-15 23:35 ` Vincent JARDIN
@ 2017-01-16 0:42 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-16 0:42 UTC (permalink / raw)
To: Vincent JARDIN; +Cc: dev
Hi Vincent,
> -----Original Message-----
> From: Vincent JARDIN [mailto:vincent.jardin@6wind.com]
> Sent: Monday, January 16, 2017 7:35 AM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v9 01/26] net/i40e: support link status
> notification
>
> Le 13/01/2017 à 07:52, Wenzhuo Lu a écrit :
> > + * @b EXPERIMENTAL: this API may change without prior notice
>
> a minor comment here:
> + including be removed.
Sure, will add it.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 02/26] net/i40e: add callback to user on VF to PF mbox msg
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 01/26] net/i40e: support link status notification Wenzhuo Lu
@ 2017-01-13 6:52 ` Wenzhuo Lu
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 03/26] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
` (24 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:52 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 f606c2a..5c58424 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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 da79585..84c9291 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -45,6 +45,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
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 03/26] net/i40e: set VF MAC anti-spoofing from PF
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 01/26] net/i40e: support link status notification Wenzhuo Lu
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 02/26] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
@ 2017-01-13 6:52 ` Wenzhuo Lu
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 04/26] net/i40e: set VF VLAN " Wenzhuo Lu
` (23 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:52 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 62 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 82 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a13d96b..eba5168 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9718,3 +9718,65 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ 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];
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ /* 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) {
+ ret = -ENOTSUP;
+ 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 84c9291..d13736f 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -79,4 +79,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 04/26] net/i40e: set VF VLAN anti-spoofing from PF
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (2 preceding siblings ...)
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 03/26] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
@ 2017-01-13 6:52 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 05/26] net/i40e: set Tx loopback " Wenzhuo Lu
` (22 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:52 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 137 ++++++++++++++++++++++++++++--
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, 153 insertions(+), 5 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index eba5168..3d126a1 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4418,6 +4418,7 @@ struct i40e_vsi *
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 :
@@ -5757,14 +5758,11 @@ struct i40e_vsi *
}
static void
-i40e_set_vlan_filter(struct i40e_vsi *vsi,
- uint16_t vlan_id, bool on)
+i40e_store_vlan_filter(struct i40e_vsi *vsi,
+ uint16_t vlan_id, bool on)
{
uint32_t vid_idx, vid_bit;
- if (vlan_id > ETH_VLAN_ID_MAX)
- return;
-
vid_idx = I40E_VFTA_IDX(vlan_id);
vid_bit = I40E_VFTA_BIT(vlan_id);
@@ -5774,6 +5772,38 @@ struct i40e_vsi *
vsi->vfta[vid_idx] &= ~vid_bit;
}
+static void
+i40e_set_vlan_filter(struct i40e_vsi *vsi,
+ uint16_t vlan_id, bool on)
+{
+ 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;
+
+ i40e_store_vlan_filter(vsi, vlan_id, on);
+
+ if (!vsi->vlan_anti_spoof_on || !vlan_id)
+ return;
+
+ vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
+
+ if (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");
+ } else {
+ 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");
+ }
+}
+
/**
* Find all vlan options for specific mac addr,
* return with actual vlan found.
@@ -9780,3 +9810,100 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ if (!vlan_id)
+ continue;
+
+ 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 i40e_pf *pf;
+ 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];
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ /* 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) {
+ PMD_DRV_LOG(ERR, "Failed to remove VLAN filters.");
+ return -ENOTSUP;
+ }
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 d13736f..849eb47 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -98,4 +98,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 05/26] net/i40e: set Tx loopback from PF
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (3 preceding siblings ...)
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 04/26] net/i40e: set VF VLAN " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 06/26] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
` (21 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 238 ++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 16 ++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 255 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 3d126a1..1c02db7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -9907,3 +9907,241 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ void *temp;
+
+ /* remove all the MACs */
+ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+ 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;
+ void *temp;
+
+ /* restore all the MACs */
+ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+ 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;
+
+ if (!vsi)
+ return -EINVAL;
+
+ 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 MAC and VLAN first */
+ ret = i40e_vsi_rm_mac_filter(vsi);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to remove MAC filters.");
+ return ret;
+ }
+ if (vsi->vlan_anti_spoof_on) {
+ ret = i40e_add_rm_all_vlan_filter(vsi, 0);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to remove VLAN filters.");
+ 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 MAC and VLAN back */
+ ret = i40e_vsi_restore_mac_filter(vsi);
+ if (ret)
+ return ret;
+ if (vsi->vlan_anti_spoof_on) {
+ ret = i40e_add_rm_all_vlan_filter(vsi, 1);
+ 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 -ENOTSUP;
+
+ /* setup TX loopback for all the VFs */
+ if (!pf->vfs) {
+ /* if no VF, do nothing. */
+ return 0;
+ }
+
+ 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 -ENOTSUP;
+ }
+
+ return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 849eb47..8befb06 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -117,4 +117,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 06/26] net/i40e: set VF unicast promisc mode from PF
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (4 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 05/26] net/i40e: set Tx loopback " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 07/26] net/i40e: set VF multicast " Wenzhuo Lu
` (20 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 38 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 58 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 1c02db7..175d9e0 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10145,3 +10145,41 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ 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);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
+ on, NULL, true);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 8befb06..1f9d3b4 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -133,4 +133,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 07/26] net/i40e: set VF multicast promisc mode from PF
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (5 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 06/26] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 08/26] net/i40e: enable VF MTU change Wenzhuo Lu
` (19 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 38 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 58 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 175d9e0..bd4b710 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10183,3 +10183,41 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ 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);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,
+ on, NULL);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 1f9d3b4..f8aa1f8 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -152,4 +152,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 08/26] net/i40e: enable VF MTU change
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (6 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 07/26] net/i40e: set VF multicast " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 09/26] net/i40e: fix VF reset flow Wenzhuo Lu
` (18 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 @@ struct rte_i40evf_xstats_name_off {
.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 @@ static int i40evf_dev_xstats_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;
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 09/26] net/i40e: fix VF reset flow
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (7 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 08/26] net/i40e: enable VF MTU change Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 10/26] net/i40e: set VF MAC from PF support Wenzhuo Lu
` (17 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang, stable
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 5c58424..8a6733c 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -139,7 +139,7 @@
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 @@
}
/* 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 @@
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 47a9c34..b4c2287 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 {
/*
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 10/26] net/i40e: set VF MAC from PF support
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (8 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 09/26] net/i40e: fix VF reset flow Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 11/26] net/i40e: set VF MAC from VF support Wenzhuo Lu
` (16 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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.
PF should set MAC address before VF initialized,
if PF sets the MAC address after VF initialized,
new MAC address won't be effective until VF
reinitialized.
This will remove all existing MAC filters.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 39 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 23 ++++++++++++++++++
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 bd4b710..0467f3e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10221,3 +10221,42 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+int
+rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+ struct ether_addr *mac_addr)
+{
+ 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];
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs)
+ return -EINVAL;
+
+ vf = &pf->vfs[vf_id];
+ vsi = vf->vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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 f8aa1f8..38f6030 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -171,4 +171,27 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
uint16_t vf_id,
uint8_t on);
+/**
+ * Set the VF MAC address.
+ *
+ * PF should set MAC address before VF initialized, if PF sets the MAC
+ * address after VF initialized, new MAC address won't be effective until
+ * VF reinitialize.
+ *
+ * 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 11/26] net/i40e: set VF MAC from VF support
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (9 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 10/26] net/i40e: set VF MAC from PF support Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 12/26] net/i40e: fix VF MAC address assignment Wenzhuo Lu
` (15 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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 @@ struct rte_i40evf_xstats_name_off {
.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 @@ struct rte_i40evf_xstats_name_off {
}
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 @@ struct rte_i40evf_xstats_name_off {
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 @@ static int i40evf_dev_xstats_get(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 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
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);
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 12/26] net/i40e: fix VF MAC address assignment
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (10 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 11/26] net/i40e: set VF MAC from VF support Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 13/26] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
` (14 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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 @@ static int i40evf_dev_xstats_get(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 @@ static int i40evf_dev_xstats_get(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) {
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 13/26] net/i40e: set VF VLAN strip from PF
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (11 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 12/26] net/i40e: fix VF MAC address assignment Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 14/26] net/i40e: set VF VLAN insertion " Wenzhuo Lu
` (13 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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 | 33 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 53 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 0467f3e..4851978 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10260,3 +10260,36 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ 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);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+
+ if (!vsi)
+ return -EINVAL;
+
+ ret = i40e_vsi_config_vlan_stripping(vsi, !!on);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ PMD_DRV_LOG(ERR, "Failed to set VLAN stripping!");
+ }
+
+ return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 38f6030..a13354f 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -194,4 +194,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 14/26] net/i40e: set VF VLAN insertion from PF
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (12 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 13/26] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 15/26] net/i40e: set VF broadcast mode " Wenzhuo Lu
` (12 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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 | 62 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 82 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4851978..c173a1c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10293,3 +10293,65 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ struct i40e_vsi *vsi;
+ struct i40e_vsi_context ctxt;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ if (vlan_id > ETHER_MAX_VLAN_ID) {
+ PMD_DRV_LOG(ERR, "Invalid VLAN ID.");
+ return -EINVAL;
+ }
+
+ dev = &rte_eth_devices[port];
+
+ 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) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+ vsi->info.pvid = vlan_id;
+ if (vlan_id > 0)
+ vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID;
+ else
+ vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_INSERT_PVID;
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 a13354f..ce89ffa 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -213,4 +213,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 15/26] net/i40e: set VF broadcast mode from PF
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (13 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 14/26] net/i40e: set VF VLAN insertion " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 16/26] net/i40e: set VF VLAN tag " Wenzhuo Lu
` (11 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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 | 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 c173a1c..396ecd6 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10355,3 +10355,56 @@ 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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on should be 0 or 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) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_broadcast(hw, vsi->seid, on, NULL);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 ce89ffa..1acb524 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -232,4 +232,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 16/26] net/i40e: set VF VLAN tag from PF
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (14 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 15/26] net/i40e: set VF broadcast mode " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 17/26] net/i40e: set VF VLAN filter " Wenzhuo Lu
` (10 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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 | 65 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 18 +++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 84 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 396ecd6..d8bdd17 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10408,3 +10408,68 @@ 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 i40e_pf *pf;
+ 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];
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on should be 0 or 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 1acb524..17a9bfd 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -251,4 +251,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 17/26] net/i40e: set VF VLAN filter from PF
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (15 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 16/26] net/i40e: set VF VLAN tag " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 18/26] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
` (9 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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 | 60 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 22 ++++++++++++
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 d8bdd17..321be86 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10473,3 +10473,63 @@ 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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ uint16_t vf_idx;
+ int ret = I40E_SUCCESS;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (vlan_id > ETHER_MAX_VLAN_ID) {
+ PMD_DRV_LOG(ERR, "Invalid VLAN ID.");
+ return -EINVAL;
+ }
+
+ if (vf_mask == 0) {
+ PMD_DRV_LOG(ERR, "No VF.");
+ return -EINVAL;
+ }
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on is should be 0 or 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ for (vf_idx = 0; vf_idx < 64 && ret == I40E_SUCCESS; vf_idx++) {
+ if (vf_mask & ((uint64_t)(1ULL << vf_idx))) {
+ if (on)
+ ret = i40e_vsi_add_vlan(pf->vfs[vf_idx].vsi,
+ vlan_id);
+ else
+ ret = i40e_vsi_delete_vlan(pf->vfs[vf_idx].vsi,
+ vlan_id);
+ }
+ }
+
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 17a9bfd..bd03966 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -269,4 +269,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) 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 18/26] app/testpmd: use VFD APIs on i40e
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (16 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 17/26] net/i40e: set VF VLAN filter " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 19/26] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
` (8 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark), Bernard Iremonger
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 | 3 +
app/test-pmd/cmdline.c | 154 +++++++++++++++++++++++++++++++++++++++----------
2 files changed, 126 insertions(+), 31 deletions(-)
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 891b85a..66bd38a 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -58,7 +58,10 @@ SRCS-y += csumonly.c
SRCS-y += icmpecho.c
SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
+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
+endif
CFLAGS_cmdline.o := -D_GNU_SOURCE
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ed84d7a..9a44b4f 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 @@ struct 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 @@ struct cmd_config_e_tag_result {
NULL,
},
};
-#ifdef RTE_LIBRTE_IXGBE_PMD
/* vf vlan anti spoof configuration */
@@ -10860,11 +10856,24 @@ struct cmd_vf_vlan_anti_spoof_result {
__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 +10883,9 @@ struct cmd_vf_vlan_anti_spoof_result {
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 +10957,24 @@ struct cmd_vf_mac_anti_spoof_result {
__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 +10984,9 @@ struct cmd_vf_mac_anti_spoof_result {
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 +11058,24 @@ struct cmd_vf_vlan_stripq_result {
__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 +11156,22 @@ struct cmd_vf_vlan_insert_result {
__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 +11181,9 @@ struct cmd_vf_vlan_insert_result {
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 +11245,22 @@ struct cmd_tx_loopback_result {
__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 +11270,9 @@ struct cmd_tx_loopback_result {
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 +11292,7 @@ struct cmd_tx_loopback_result {
},
};
+#ifdef RTE_LIBRTE_IXGBE_PMD
/* all queues drop enable configuration */
/* Common result structure for all queues drop enable */
@@ -11277,6 +11351,9 @@ struct cmd_all_queues_drop_en_result {
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 +11458,7 @@ struct cmd_vf_split_drop_en_result {
NULL,
},
};
+#endif
/* vf mac address configuration */
@@ -11432,10 +11510,22 @@ struct cmd_set_vf_mac_addr_result {
__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 +11535,9 @@ struct cmd_set_vf_mac_addr_result {
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 +11558,6 @@ struct cmd_set_vf_mac_addr_result {
NULL,
},
};
-#endif
/* ******************************************************************************** */
@@ -11619,20 +11711,20 @@ struct cmd_set_vf_mac_addr_result {
(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,
};
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 19/26] app/testpmd: use unicast promiscuous mode on i40e
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (17 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 18/26] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 20/26] app/testpmd: use multicast " Wenzhuo Lu
` (7 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 97 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 106 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 9a44b4f..cc177a6 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"
@@ -11559,6 +11562,99 @@ struct cmd_set_vf_mac_addr_result {
},
};
+/* 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;
+ struct rte_eth_dev_info dev_info;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (strstr(dev_info.driver_name, "i40e") != NULL)
+ 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 */
@@ -11725,6 +11821,7 @@ struct cmd_set_vf_mac_addr_result {
(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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 20/26] app/testpmd: use multicast promiscuous mode on i40e
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (18 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 19/26] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 21/26] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
` (6 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 97 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 106 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index cc177a6..c5f5134 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"
@@ -11655,6 +11658,99 @@ struct cmd_vf_promisc_result {
},
};
+/* 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;
+ struct rte_eth_dev_info dev_info;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (strstr(dev_info.driver_name, "i40e") != NULL)
+ 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 */
@@ -11822,6 +11918,7 @@ struct cmd_vf_promisc_result {
#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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 21/26] app/testpmd: add command to test VF broadcast mode on i40e
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (19 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 20/26] app/testpmd: use multicast " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 22/26] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
` (5 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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 | 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 c5f5134..a860228 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"
@@ -11751,6 +11754,99 @@ struct cmd_vf_allmulti_result {
},
};
+/* 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;
+ struct rte_eth_dev_info dev_info;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (strstr(dev_info.driver_name, "i40e") != NULL)
+ 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 */
@@ -11919,6 +12015,7 @@ struct cmd_vf_allmulti_result {
(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
~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 22/26] app/testpmd: add command to test VF VLAN tag on i40e
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (20 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 21/26] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 23/26] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
` (4 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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 | 103 ++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++
2 files changed, 110 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a860228..2402d1d 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"
@@ -11847,6 +11850,105 @@ struct cmd_set_vf_broadcast_result {
},
};
+/* 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;
+ struct rte_eth_dev_info dev_info;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ rte_eth_dev_info_get(res->port_id, &dev_info);
+
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (strstr(dev_info.driver_name, "i40e") != NULL)
+ 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 */
@@ -12016,6 +12118,7 @@ struct cmd_set_vf_broadcast_result {
(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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 23/26] app/testpmd: handle i40e in VF VLAN filter command
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (21 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 22/26] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 24/26] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
` (3 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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/cmdline.c | 41 ++++++++++++++++++++++++++++++++++-------
app/test-pmd/config.c | 13 -------------
app/test-pmd/testpmd.h | 2 --
3 files changed, 34 insertions(+), 22 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 2402d1d..107c808 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6835,7 +6835,6 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result,
},
};
-#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,40 @@ struct cmd_vf_rx_vlan_filter {
__attribute__((unused)) void *data)
{
struct cmd_vf_rx_vlan_filter *res = parsed_result;
+ int ret = -ENOTSUP;
- 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_unused int is_add = (strcmp(res->what, "add") == 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_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 %"PRIu64"\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 +6926,6 @@ struct cmd_vf_rx_vlan_filter {
NULL,
},
};
-#endif
/* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */
struct cmd_queue_rate_limit_result {
@@ -12111,9 +12138,9 @@ struct cmd_set_vf_vlan_tag_result {
(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 @@ struct igb_ring_desc_16_bytes {
"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,
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 24/26] net/i40e: enhance in sanity check of MAC
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (22 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 23/26] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 25/26] net/i40e: set/clear VF stats from PF Wenzhuo Lu
` (2 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: 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 8a6733c..263e843 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -753,8 +753,8 @@
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;
}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 25/26] net/i40e: set/clear VF stats from PF
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (23 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 24/26] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 26/26] doc: update doc for VFD Wenzhuo Lu
2017-01-13 18:32 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Ferruh Yigit
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 | 73 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 41 +++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 2 +
3 files changed, 116 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 321be86..b9bad3c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10533,3 +10533,76 @@ 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 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 || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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 0;
+}
+
+int
+rte_pmd_i40e_reset_vf_stats(uint8_t port,
+ uint16_t vf_id)
+{
+ 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 || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ vsi->offset_loaded = false;
+ i40e_update_vsi_stats(vsi);
+
+ return 0;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index bd03966..298c710 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -291,4 +291,45 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v9 26/26] doc: update doc for VFD
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (24 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 25/26] net/i40e: set/clear VF stats from PF Wenzhuo Lu
@ 2017-01-13 6:53 ` Wenzhuo Lu
2017-01-13 18:32 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Ferruh Yigit
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-13 6:53 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
Update the NIC doc and release note.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
doc/guides/nics/i40e.rst | 1 +
doc/guides/rel_notes/release_17_02.rst | 29 +++++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst
index 5780268..dde59bf 100644
--- a/doc/guides/nics/i40e.rst
+++ b/doc/guides/nics/i40e.rst
@@ -64,6 +64,7 @@ Features of the I40E PMD are:
- SR-IOV VF
- Hot plug
- IEEE1588/802.1AS timestamping
+- VF Daemon (VFD) - EXPERIMENTAL
Prerequisites
diff --git a/doc/guides/rel_notes/release_17_02.rst b/doc/guides/rel_notes/release_17_02.rst
index cf11f6f..1326e6a 100644
--- a/doc/guides/rel_notes/release_17_02.rst
+++ b/doc/guides/rel_notes/release_17_02.rst
@@ -47,6 +47,35 @@ New Features
A new network PMD which supports Solarflare SFN7xxx and SFN8xxx family
of 10/40 Gbps adapters has been added.
+* **Added VF Daemon (VFD) on i40e. - EXPERIMENTAL**
+
+ This's an experimental feature to enhance the capability of DPDK PF as many
+ VF management features are not supported by kernel driver PF.
+ Some new private APIs are implemented in PMD without abstrction layer.
+ They can be used directly by some users who have the need.
+
+ The new APIs to control VFs directly from PF 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
+ 13) set VF VLAN tag
+ 14) 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.
+
+ As an experimental feature, please aware it can be changed even removed
+ without prior notice.
+
+
Resolved Issues
---------------
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (25 preceding siblings ...)
2017-01-13 6:53 ` [dpdk-dev] [PATCH v9 26/26] doc: update doc for VFD Wenzhuo Lu
@ 2017-01-13 18:32 ` Ferruh Yigit
2017-01-15 23:52 ` Vincent JARDIN
26 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2017-01-13 18:32 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Vincent JARDIN, Zhang, Helin
On 1/13/2017 6:52 AM, Wenzhuo Lu 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
> 13) set VF VLAN tag
> 14) 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.
>
> Please aware VFD is an EXPERIMENTAL feature, it can be changed or even
> removed without prior notice.
>
So new version sent with a experimental tag, this can provide some
flexibility to the feature until proper DPDK PF discussion concluded.
Is there any objection to the patchset with experimental tag?
Hi Vincent,
Can this be interim solution until your concerns addressed?
If so, I will proceed working on getting patch into next-net.
Thanks,
ferruh
<...>
> Series-Acked-by: Helin Zhang <helin.zhang@intel.com>
>
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL
2017-01-13 18:32 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Ferruh Yigit
@ 2017-01-15 23:52 ` Vincent JARDIN
0 siblings, 0 replies; 367+ messages in thread
From: Vincent JARDIN @ 2017-01-15 23:52 UTC (permalink / raw)
To: Ferruh Yigit, Wenzhuo Lu, dev; +Cc: Zhang, Helin, John Fastabend
Le 13/01/2017 à 19:32, Ferruh Yigit a écrit :
>> Please aware VFD is an EXPERIMENTAL feature, it can be changed or even
>> removed without prior notice.
>>
> So new version sent with a experimental tag, this can provide some
> flexibility to the feature until proper DPDK PF discussion concluded.
>
> Is there any objection to the patchset with experimental tag?
>
> Hi Vincent,
>
> Can this be interim solution until your concerns addressed?
>
> If so, I will proceed working on getting patch into next-net.
>
I agree that the experimental status is a better option. It shall remain
experimental till both:
a- we agree that DPDK could be used as a PF, which I do not believe
is a good option, it has been argued within previous email, but let's
keep thinking about it ;
b- assuming a-, the kernel includes exactly the same definition of
messages+features for its PF.
The VF messages and PF messages shall remain with the experimental
status for any x message that is not supported by the kernel's PF.
The PF side of the DPDK implementation may be removed some days.
Series-Acked-By: Vincent Jardin <vincent.jardin@6wind.com>
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 00/26] Support VFD on i40e - EXPERIMENTAL
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (37 preceding siblings ...)
2017-01-13 6:52 ` [dpdk-dev] [PATCH v9 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 01/26] net/i40e: support link status notification Wenzhuo Lu
` (25 more replies)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
40 siblings, 26 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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
13) set VF VLAN tag
14) 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.
Please aware VFD is an EXPERIMENTAL feature, it can be changed,
or even removed, without prior notice.
2, Implement VF MAC address setting on VF.
v10:
- some minor change of the doc and comments.
- add the NIC check in the private APIs.
v9:
- upadte the doc and announce VFD is an experimental feature.
v8:
- remove unnecessary VF check.
- add more debug logs.
- split VMDq related code to a separate patch set.
- some minor change.
v7:
- fix 32 bit compile error in patch 23.
- add new patches to configure VMDq.
v6:
- remove the support of DPDK PF + kernel VF. Will create a new patch set for it.
- reword the tittles of some patches.
- add sanity check for vsi, and other minor change.
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: set VF VLAN insertion from PF
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) (2):
net/i40e: set VF VLAN strip from PF
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 (11):
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
doc: update doc for VFD
MAINTAINERS | 1 +
app/test-pmd/Makefile | 1 +
app/test-pmd/cmdline.c | 550 ++++++++++++++--
app/test-pmd/config.c | 13 -
app/test-pmd/testpmd.h | 2 -
doc/guides/nics/i40e.rst | 1 +
doc/guides/rel_notes/release_17_02.rst | 29 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 32 +
drivers/net/i40e/Makefile | 4 +-
drivers/net/i40e/i40e_ethdev.c | 976 +++++++++++++++++++++++++++-
drivers/net/i40e/i40e_ethdev.h | 5 +-
drivers/net/i40e/i40e_ethdev_vf.c | 82 ++-
drivers/net/i40e/i40e_pf.c | 244 +++++--
drivers/net/i40e/i40e_pf.h | 9 +-
drivers/net/i40e/rte_pmd_i40e.h | 335 ++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 20 +
16 files changed, 2189 insertions(+), 115 deletions(-)
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
Series-Acked-by: Helin Zhang <helin.zhang@intel.com>
Series-Acked-By: Vincent Jardin <vincent.jardin@6wind.com>
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 01/26] net/i40e: support link status notification
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 02/26] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
` (24 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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>
---
MAINTAINERS | 1 +
drivers/net/i40e/Makefile | 4 +-
drivers/net/i40e/i40e_ethdev.c | 38 +++++++++++++++++++
drivers/net/i40e/i40e_pf.c | 4 +-
drivers/net/i40e/i40e_pf.h | 4 +-
drivers/net/i40e/rte_pmd_i40e.h | 61 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 7 ++++
7 files changed, 115 insertions(+), 4 deletions(-)
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 2f3639f..aa1f261 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -332,6 +332,7 @@ Intel i40e
M: Helin Zhang <helin.zhang@intel.com>
M: Jingjing Wu <jingjing.wu@intel.com>
F: drivers/net/i40e/
+F: drivers/net/i40e/rte_pmd_i40e.h - EXPERIMENTAL
F: doc/guides/nics/i40e.rst
F: doc/guides/nics/intel_vf.rst
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 89bd85a..94482cf 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-2017 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -112,6 +112,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 4b148bf..58f9dfa 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -63,6 +63,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"
@@ -10188,3 +10189,40 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
i40e_tunnel_filter_restore(pf);
i40e_fdir_filter_restore(pf);
}
+
+static int
+is_i40e_pmd(const char *driver_name)
+{
+ if (!strstr(driver_name, "i40e"))
+ return -ENOTSUP;
+
+ if (strstr(driver_name, "i40e_vf"))
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
+{
+ struct rte_eth_dev *dev;
+ struct i40e_pf *pf;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf >= pf->vf_num || !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..f606c2a 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-2017 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -897,7 +897,7 @@
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..47a9c34 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-2017 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..46ba60c
--- /dev/null
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -0,0 +1,61 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright (c) 2017 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.
+ */
+
+#ifndef _PMD_I40E_H_
+#define _PMD_I40E_H_
+
+/**
+ * @file rte_pmd_i40e.h
+ *
+ * i40e PMD specific functions.
+ *
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ */
+
+#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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 02/26] net/i40e: add callback to user on VF to PF mbox msg
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 01/26] net/i40e: support link status notification Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 03/26] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
` (23 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 f606c2a..5c58424 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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 46ba60c..afa3761 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -45,6 +45,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
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 03/26] net/i40e: set VF MAC anti-spoofing from PF
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 01/26] net/i40e: support link status notification Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 02/26] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 04/26] net/i40e: set VF VLAN " Wenzhuo Lu
` (22 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 65 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 85 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 58f9dfa..fb45c42 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10226,3 +10226,68 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ /* 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) {
+ ret = -ENOTSUP;
+ 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 afa3761..11d1c2b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -79,4 +79,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 04/26] net/i40e: set VF VLAN anti-spoofing from PF
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (2 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 03/26] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 05/26] net/i40e: set Tx loopback " Wenzhuo Lu
` (21 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 140 ++++++++++++++++++++++++++++--
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, 156 insertions(+), 5 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index fb45c42..97217f9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4625,6 +4625,7 @@ struct i40e_vsi *
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 :
@@ -5966,14 +5967,11 @@ struct i40e_vsi *
}
static void
-i40e_set_vlan_filter(struct i40e_vsi *vsi,
- uint16_t vlan_id, bool on)
+i40e_store_vlan_filter(struct i40e_vsi *vsi,
+ uint16_t vlan_id, bool on)
{
uint32_t vid_idx, vid_bit;
- if (vlan_id > ETH_VLAN_ID_MAX)
- return;
-
vid_idx = I40E_VFTA_IDX(vlan_id);
vid_bit = I40E_VFTA_BIT(vlan_id);
@@ -5983,6 +5981,38 @@ struct i40e_vsi *
vsi->vfta[vid_idx] &= ~vid_bit;
}
+static void
+i40e_set_vlan_filter(struct i40e_vsi *vsi,
+ uint16_t vlan_id, bool on)
+{
+ 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;
+
+ i40e_store_vlan_filter(vsi, vlan_id, on);
+
+ if (!vsi->vlan_anti_spoof_on || !vlan_id)
+ return;
+
+ vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
+
+ if (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");
+ } else {
+ 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");
+ }
+}
+
/**
* Find all vlan options for specific mac addr,
* return with actual vlan found.
@@ -10291,3 +10321,103 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ if (!vlan_id)
+ continue;
+
+ 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 i40e_pf *pf;
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ /* 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) {
+ PMD_DRV_LOG(ERR, "Failed to remove VLAN filters.");
+ return -ENOTSUP;
+ }
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 c9fda15..797e892 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -361,6 +361,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 11d1c2b..be6e704 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -98,4 +98,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 05/26] net/i40e: set Tx loopback from PF
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (3 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 04/26] net/i40e: set VF VLAN " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 06/26] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
` (20 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 241 ++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 16 ++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 258 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 97217f9..4576ca2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10421,3 +10421,244 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ void *temp;
+
+ /* remove all the MACs */
+ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+ 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;
+ void *temp;
+
+ /* restore all the MACs */
+ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+ 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;
+
+ if (!vsi)
+ return -EINVAL;
+
+ 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 MAC and VLAN first */
+ ret = i40e_vsi_rm_mac_filter(vsi);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to remove MAC filters.");
+ return ret;
+ }
+ if (vsi->vlan_anti_spoof_on) {
+ ret = i40e_add_rm_all_vlan_filter(vsi, 0);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to remove VLAN filters.");
+ 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 MAC and VLAN back */
+ ret = i40e_vsi_restore_mac_filter(vsi);
+ if (ret)
+ return ret;
+ if (vsi->vlan_anti_spoof_on) {
+ ret = i40e_add_rm_all_vlan_filter(vsi, 1);
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ 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 -ENOTSUP;
+
+ /* setup TX loopback for all the VFs */
+ if (!pf->vfs) {
+ /* if no VF, do nothing. */
+ return 0;
+ }
+
+ 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 -ENOTSUP;
+ }
+
+ return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index be6e704..14fce97 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -117,4 +117,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 06/26] net/i40e: set VF unicast promisc mode from PF
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (4 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 05/26] net/i40e: set Tx loopback " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 07/26] net/i40e: set VF multicast " Wenzhuo Lu
` (19 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 41 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 61 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4576ca2..824597c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10662,3 +10662,44 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
+ on, NULL, true);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 14fce97..4027200 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -133,4 +133,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 07/26] net/i40e: set VF multicast promisc mode from PF
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (5 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 06/26] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 08/26] net/i40e: enable VF MTU change Wenzhuo Lu
` (18 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 41 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 61 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 824597c..3b78c57 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10703,3 +10703,44 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,
+ on, NULL);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 4027200..cdd8bc8 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -152,4 +152,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 08/26] net/i40e: enable VF MTU change
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (6 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 07/26] net/i40e: set VF multicast " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 09/26] net/i40e: fix VF reset flow Wenzhuo Lu
` (17 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 f50ac2d..b292d1d 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 @@ struct rte_i40evf_xstats_name_off {
.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,
};
/*
@@ -2653,3 +2655,34 @@ static int i40evf_dev_xstats_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;
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 09/26] net/i40e: fix VF reset flow
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (7 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 08/26] net/i40e: enable VF MTU change Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 10/26] net/i40e: set VF MAC from PF support Wenzhuo Lu
` (16 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang, stable
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 5c58424..8a6733c 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -139,7 +139,7 @@
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 @@
}
/* 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 @@
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 47a9c34..b4c2287 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 {
/*
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 10/26] net/i40e: set VF MAC from PF support
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (8 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 09/26] net/i40e: fix VF reset flow Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 11/26] net/i40e: set VF MAC from VF support Wenzhuo Lu
` (15 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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.
PF should set MAC address before VF initialized,
if PF sets the MAC address after VF initialized,
new MAC address won't be effective until VF
reinitialized.
This will remove all existing MAC filters.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 42 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 23 +++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 66 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 3b78c57..489b818 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10744,3 +10744,45 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+int
+rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+ struct ether_addr *mac_addr)
+{
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs)
+ return -EINVAL;
+
+ vf = &pf->vfs[vf_id];
+ vsi = vf->vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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 cdd8bc8..bc44247 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -171,4 +171,27 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
uint16_t vf_id,
uint8_t on);
+/**
+ * Set the VF MAC address.
+ *
+ * PF should set MAC address before VF initialized, if PF sets the MAC
+ * address after VF initialized, new MAC address won't be effective until
+ * VF reinitialize.
+ *
+ * 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 11/26] net/i40e: set VF MAC from VF support
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (9 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 10/26] net/i40e: set VF MAC from PF support Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 12/26] net/i40e: fix VF MAC address assignment Wenzhuo Lu
` (14 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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 797e892..9e2f7a2 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -128,6 +128,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 | \
@@ -136,7 +137,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 b292d1d..a9a8bb4 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 @@ struct rte_i40evf_xstats_name_off {
.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,
};
/*
@@ -890,19 +893,16 @@ struct rte_i40evf_xstats_name_off {
}
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],
@@ -929,6 +929,17 @@ struct rte_i40evf_xstats_name_off {
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)
{
@@ -1262,10 +1273,12 @@ static int i40evf_dev_xstats_get(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) {
@@ -2686,3 +2699,25 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
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);
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 12/26] net/i40e: fix VF MAC address assignment
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (10 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 11/26] net/i40e: set VF MAC from VF support Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 13/26] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
` (13 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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 a9a8bb4..17a035c 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1195,7 +1195,6 @@ static int i40evf_dev_xstats_get(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);
@@ -1272,13 +1271,10 @@ static int i40evf_dev_xstats_get(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) {
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 13/26] net/i40e: set VF VLAN strip from PF
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (11 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 12/26] net/i40e: fix VF MAC address assignment Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 14/26] net/i40e: set VF VLAN insertion " Wenzhuo Lu
` (12 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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 | 37 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 57 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 489b818..04f2465 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10786,3 +10786,40 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+
+ if (!vsi)
+ return -EINVAL;
+
+ ret = i40e_vsi_config_vlan_stripping(vsi, !!on);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ PMD_DRV_LOG(ERR, "Failed to set VLAN stripping!");
+ }
+
+ return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index bc44247..09ca088 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -194,4 +194,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 14/26] net/i40e: set VF VLAN insertion from PF
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (12 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 13/26] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 15/26] net/i40e: set VF broadcast mode " Wenzhuo Lu
` (11 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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 | 65 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 85 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 04f2465..670f74a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10823,3 +10823,68 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ struct i40e_vsi *vsi;
+ struct i40e_vsi_context ctxt;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ if (vlan_id > ETHER_MAX_VLAN_ID) {
+ PMD_DRV_LOG(ERR, "Invalid VLAN ID.");
+ return -EINVAL;
+ }
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ 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) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+ vsi->info.pvid = vlan_id;
+ if (vlan_id > 0)
+ vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID;
+ else
+ vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_INSERT_PVID;
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 09ca088..6dff242 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -213,4 +213,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 15/26] net/i40e: set VF broadcast mode from PF
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (13 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 14/26] net/i40e: set VF VLAN insertion " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 16/26] net/i40e: set VF VLAN tag " Wenzhuo Lu
` (10 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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 | 56 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 76 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 670f74a..1ff58d7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10888,3 +10888,59 @@ 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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on should be 0 or 1.");
+ return -EINVAL;
+ }
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ hw = I40E_PF_TO_HW(pf);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_broadcast(hw, vsi->seid, on, NULL);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 6dff242..f4a6bf5 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -232,4 +232,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 16/26] net/i40e: set VF VLAN tag from PF
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (14 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 15/26] net/i40e: set VF broadcast mode " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 17/26] net/i40e: set VF VLAN filter " Wenzhuo Lu
` (9 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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 | 68 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 18 ++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 87 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 1ff58d7..63c7d5d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10944,3 +10944,71 @@ 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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ struct i40e_vsi *vsi;
+ struct i40e_vsi_context ctxt;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on should be 0 or 1.");
+ return -EINVAL;
+ }
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 f4a6bf5..c97c1d1 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -251,4 +251,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 17/26] net/i40e: set VF VLAN filter from PF
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (15 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 16/26] net/i40e: set VF VLAN tag " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 18/26] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
` (8 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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 | 63 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 22 +++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 86 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 63c7d5d..b084c39 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11012,3 +11012,66 @@ 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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ uint16_t vf_idx;
+ int ret = I40E_SUCCESS;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ if (vlan_id > ETHER_MAX_VLAN_ID) {
+ PMD_DRV_LOG(ERR, "Invalid VLAN ID.");
+ return -EINVAL;
+ }
+
+ if (vf_mask == 0) {
+ PMD_DRV_LOG(ERR, "No VF.");
+ return -EINVAL;
+ }
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on is should be 0 or 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ for (vf_idx = 0; vf_idx < 64 && ret == I40E_SUCCESS; vf_idx++) {
+ if (vf_mask & ((uint64_t)(1ULL << vf_idx))) {
+ if (on)
+ ret = i40e_vsi_add_vlan(pf->vfs[vf_idx].vsi,
+ vlan_id);
+ else
+ ret = i40e_vsi_delete_vlan(pf->vfs[vf_idx].vsi,
+ vlan_id);
+ }
+ }
+
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 c97c1d1..2c87029 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -269,4 +269,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) 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 18/26] app/testpmd: use VFD APIs on i40e
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (16 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 17/26] net/i40e: set VF VLAN filter " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 19/26] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
` (7 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark), Bernard Iremonger
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 | 1 +
app/test-pmd/cmdline.c | 136 ++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 106 insertions(+), 31 deletions(-)
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 050663a..a1500bb 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -61,6 +61,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
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
endif
CFLAGS_cmdline.o := -D_GNU_SOURCE
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 4e8b0d8..fdb7cf5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -91,6 +91,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;
@@ -263,19 +266,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"
@@ -283,7 +286,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"
@@ -292,7 +294,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"
@@ -387,10 +388,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)"
@@ -6703,9 +6702,7 @@ struct 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;
@@ -10839,7 +10836,6 @@ struct cmd_config_e_tag_result {
NULL,
},
};
-#ifdef RTE_LIBRTE_IXGBE_PMD
/* vf vlan anti spoof configuration */
@@ -10891,11 +10887,21 @@ struct cmd_vf_vlan_anti_spoof_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id,
+ res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -10905,6 +10911,9 @@ struct cmd_vf_vlan_anti_spoof_result {
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));
}
@@ -10976,11 +10985,21 @@ struct cmd_vf_mac_anti_spoof_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id,
+ res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -10990,6 +11009,9 @@ struct cmd_vf_mac_anti_spoof_result {
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));
}
@@ -11061,10 +11083,21 @@ struct cmd_vf_vlan_stripq_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id,
+ res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11145,9 +11178,19 @@ struct cmd_vf_vlan_insert_result {
__attribute__((unused)) void *data)
{
struct cmd_vf_vlan_insert_result *res = parsed_result;
- int ret;
+ int ret = -ENOTSUP;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id,
+ res->vlan_id);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11157,6 +11200,9 @@ struct cmd_vf_vlan_insert_result {
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));
}
@@ -11218,10 +11264,19 @@ struct cmd_tx_loopback_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11231,6 +11286,9 @@ struct cmd_tx_loopback_result {
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));
}
@@ -11250,6 +11308,7 @@ struct cmd_tx_loopback_result {
},
};
+#ifdef RTE_LIBRTE_IXGBE_PMD
/* all queues drop enable configuration */
/* Common result structure for all queues drop enable */
@@ -11308,6 +11367,9 @@ struct cmd_all_queues_drop_en_result {
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));
}
@@ -11412,6 +11474,7 @@ struct cmd_vf_split_drop_en_result {
NULL,
},
};
+#endif
/* vf mac address configuration */
@@ -11463,10 +11526,19 @@ struct cmd_set_vf_mac_addr_result {
__attribute__((unused)) void *data)
{
struct cmd_set_vf_mac_addr_result *res = parsed_result;
- int ret;
+ int ret = -ENOTSUP;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_mac_addr(res->port_id, res->vf_id,
+ &res->mac_addr);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11476,6 +11548,9 @@ struct cmd_set_vf_mac_addr_result {
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));
}
@@ -11496,7 +11571,6 @@ struct cmd_set_vf_mac_addr_result {
NULL,
},
};
-#endif
/* ******************************************************************************** */
@@ -11651,20 +11725,20 @@ struct cmd_set_vf_mac_addr_result {
(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,
};
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 19/26] app/testpmd: use unicast promiscuous mode on i40e
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (17 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 18/26] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 20/26] app/testpmd: use multicast " Wenzhuo Lu
` (6 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 102 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index fdb7cf5..ed15589 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 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"
@@ -11572,6 +11575,95 @@ struct cmd_set_vf_mac_addr_result {
},
};
+/* 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 */
@@ -11739,6 +11831,7 @@ struct cmd_set_vf_mac_addr_result {
(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 c611dc5..b988dc8 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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 20/26] app/testpmd: use multicast promiscuous mode on i40e
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (18 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 19/26] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 21/26] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
` (5 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 102 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ed15589..709a30a 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -404,6 +404,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"
@@ -11664,6 +11667,95 @@ struct cmd_vf_promisc_result {
},
};
+/* 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 */
@@ -11832,6 +11924,7 @@ struct cmd_vf_promisc_result {
#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 b988dc8..3acc853 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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 21/26] app/testpmd: add command to test VF broadcast mode on i40e
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (19 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 20/26] app/testpmd: use multicast " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 22/26] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
` (4 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++
2 files changed, 100 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 709a30a..c435ede 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -280,6 +280,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"
@@ -11756,6 +11759,95 @@ struct cmd_vf_allmulti_result {
},
};
+/* 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 */
@@ -11925,6 +12017,7 @@ struct cmd_vf_allmulti_result {
(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 3acc853..1e73e29 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
~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 22/26] app/testpmd: add command to test VF VLAN tag on i40e
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (20 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 21/26] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 23/26] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
` (3 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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 | 99 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++
2 files changed, 106 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index c435ede..1500170 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -298,6 +298,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"
@@ -11848,6 +11851,101 @@ struct cmd_set_vf_broadcast_result {
},
};
+/* 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 */
@@ -12018,6 +12116,7 @@ struct cmd_set_vf_broadcast_result {
(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 1e73e29..709c3d5 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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 23/26] app/testpmd: handle i40e in VF VLAN filter command
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (21 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 22/26] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 24/26] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
` (2 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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/cmdline.c | 38 +++++++++++++++++++++++++++++++-------
app/test-pmd/config.c | 13 -------------
app/test-pmd/testpmd.h | 2 --
3 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 1500170..22fcbcb 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6863,7 +6863,6 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result,
},
};
-#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;
@@ -6881,11 +6880,37 @@ struct cmd_vf_rx_vlan_filter {
__attribute__((unused)) void *data)
{
struct cmd_vf_rx_vlan_filter *res = parsed_result;
+ int ret = -ENOTSUP;
- 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_unused int is_add = (strcmp(res->what, "add") == 0) ? 1 : 0;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ 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 (ret == -ENOTSUP)
+ 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 %"PRIu64"\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 =
@@ -6926,7 +6951,6 @@ struct cmd_vf_rx_vlan_filter {
NULL,
},
};
-#endif
/* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */
struct cmd_queue_rate_limit_result {
@@ -12109,9 +12133,9 @@ struct cmd_set_vf_vlan_tag_result {
(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 11a930d..5834498 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2846,19 +2846,6 @@ struct igb_ring_desc_16_bytes {
"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 22ce2d6..87153d7 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -598,8 +598,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,
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 24/26] net/i40e: enhance in sanity check of MAC
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (22 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 23/26] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 25/26] net/i40e: set/clear VF stats from PF Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 26/26] doc: update doc for VFD Wenzhuo Lu
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: 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 8a6733c..263e843 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -753,8 +753,8 @@
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;
}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 25/26] net/i40e: set/clear VF stats from PF
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (23 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 24/26] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 26/26] doc: update doc for VFD Wenzhuo Lu
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 | 79 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 41 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 2 +
3 files changed, 122 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index b084c39..f92f148 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11075,3 +11075,82 @@ 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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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 0;
+}
+
+int
+rte_pmd_i40e_reset_vf_stats(uint8_t port,
+ uint16_t vf_id)
+{
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ vsi->offset_loaded = false;
+ i40e_update_vsi_stats(vsi);
+
+ return 0;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 2c87029..f4bd0fd 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -291,4 +291,45 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v10 26/26] doc: update doc for VFD
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
` (24 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 25/26] net/i40e: set/clear VF stats from PF Wenzhuo Lu
@ 2017-01-16 5:51 ` Wenzhuo Lu
2017-01-16 7:36 ` Vincent JARDIN
2017-01-16 10:05 ` Thomas Monjalon
25 siblings, 2 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-16 5:51 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
Update the NIC doc and release note.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
doc/guides/nics/i40e.rst | 1 +
doc/guides/rel_notes/release_17_02.rst | 29 +++++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst
index 0cc9268..1245ecf 100644
--- a/doc/guides/nics/i40e.rst
+++ b/doc/guides/nics/i40e.rst
@@ -64,6 +64,7 @@ Features of the I40E PMD are:
- SR-IOV VF
- Hot plug
- IEEE1588/802.1AS timestamping
+- VF Daemon (VFD) - EXPERIMENTAL
Prerequisites
diff --git a/doc/guides/rel_notes/release_17_02.rst b/doc/guides/rel_notes/release_17_02.rst
index 5762d3f..92e6822 100644
--- a/doc/guides/rel_notes/release_17_02.rst
+++ b/doc/guides/rel_notes/release_17_02.rst
@@ -66,6 +66,35 @@ New Features
Support for Mellanox ConnectX-5 family of 10/25/40/50/100 Gbps adapters
has been added to the existing mlx5 PMD.
+* **Added VF Daemon (VFD) on i40e. - EXPERIMENTAL**
+
+ This's an EXPERIMENTAL feature to enhance the capability of DPDK PF as many
+ VF management features are not supported by kernel PF driver.
+ Some new private APIs are implemented in PMD without abstrction layer.
+ They can be used directly by some users who have the need.
+
+ The new APIs to control VFs directly from PF 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
+ 13) set VF VLAN tag
+ 14) 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.
+
+ As an EXPERIMENTAL feature, please aware it can be changed or even
+ removed without prior notice.
+
+
Resolved Issues
---------------
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v10 26/26] doc: update doc for VFD
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 26/26] doc: update doc for VFD Wenzhuo Lu
@ 2017-01-16 7:36 ` Vincent JARDIN
2017-01-16 10:05 ` Thomas Monjalon
1 sibling, 0 replies; 367+ messages in thread
From: Vincent JARDIN @ 2017-01-16 7:36 UTC (permalink / raw)
To: Wenzhuo Lu, dev; +Cc: Ferruh Yigit, Fastabend, John R
Le 16/01/2017 à 06:51, Wenzhuo Lu a écrit :
> + As an EXPERIMENTAL feature, please aware it can be changed or even
> + removed without prior notice.
thank you.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v10 26/26] doc: update doc for VFD
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 26/26] doc: update doc for VFD Wenzhuo Lu
2017-01-16 7:36 ` Vincent JARDIN
@ 2017-01-16 10:05 ` Thomas Monjalon
2017-01-17 0:35 ` Lu, Wenzhuo
1 sibling, 1 reply; 367+ messages in thread
From: Thomas Monjalon @ 2017-01-16 10:05 UTC (permalink / raw)
To: Wenzhuo Lu; +Cc: dev
2017-01-16 13:51, Wenzhuo Lu:
> --- a/doc/guides/rel_notes/release_17_02.rst
> +++ b/doc/guides/rel_notes/release_17_02.rst
> @@ -66,6 +66,35 @@ New Features
> Support for Mellanox ConnectX-5 family of 10/25/40/50/100 Gbps adapters
> has been added to the existing mlx5 PMD.
>
> +* **Added VF Daemon (VFD) on i40e. - EXPERIMENTAL**
> +
> + This's an EXPERIMENTAL feature to enhance the capability of DPDK PF as many
> + VF management features are not supported by kernel PF driver.
> + Some new private APIs are implemented in PMD without abstrction layer.
Typo in abstrction
> + They can be used directly by some users who have the need.
> +
> + The new APIs to control VFs directly from PF 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
> + 13) set VF VLAN tag
> + 14) 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.
> +
> + As an EXPERIMENTAL feature, please aware it can be changed or even
> + removed without prior notice.
It is good to explain things in the release notes, but not sufficient.
We must explain the DPDK position about PF/VF in the design doc:
http://dpdk.org/doc/guides/contributing/design.html
It is important to explain that the primary goal of DPDK is to provide
a userland dataplane. Managing VF from a PF driver is a control plane
feature and we generally rely on the kernel for that.
So we continue adding some PF features in DPDK as experimental functions
but they must be implemented in the kernel with the same messaging interface.
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v10 26/26] doc: update doc for VFD
2017-01-16 10:05 ` Thomas Monjalon
@ 2017-01-17 0:35 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-17 0:35 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Monday, January 16, 2017 6:05 PM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v10 26/26] doc: update doc for VFD
>
> 2017-01-16 13:51, Wenzhuo Lu:
> > --- a/doc/guides/rel_notes/release_17_02.rst
> > +++ b/doc/guides/rel_notes/release_17_02.rst
> > @@ -66,6 +66,35 @@ New Features
> > Support for Mellanox ConnectX-5 family of 10/25/40/50/100 Gbps adapters
> > has been added to the existing mlx5 PMD.
> >
> > +* **Added VF Daemon (VFD) on i40e. - EXPERIMENTAL**
> > +
> > + This's an EXPERIMENTAL feature to enhance the capability of DPDK PF
> > + as many VF management features are not supported by kernel PF driver.
> > + Some new private APIs are implemented in PMD without abstrction layer.
>
> Typo in abstrction
>
> > + They can be used directly by some users who have the need.
> > +
> > + The new APIs to control VFs directly from PF 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
> > + 13) set VF VLAN tag
> > + 14) 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.
> > +
> > + As an EXPERIMENTAL feature, please aware it can be changed or even
> > + removed without prior notice.
>
> It is good to explain things in the release notes, but not sufficient.
> We must explain the DPDK position about PF/VF in the design doc:
> http://dpdk.org/doc/guides/contributing/design.html
>
> It is important to explain that the primary goal of DPDK is to provide a
> userland dataplane. Managing VF from a PF driver is a control plane feature
> and we generally rely on the kernel for that.
> So we continue adding some PF features in DPDK as experimental functions
> but they must be implemented in the kernel with the same messaging
> interface.
Sure. Will update the doc with a v11.
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (38 preceding siblings ...)
2017-01-16 5:51 ` [dpdk-dev] [PATCH v10 " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 01/26] net/i40e: support link status notification Wenzhuo Lu
` (25 more replies)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
40 siblings, 26 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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
13) set VF VLAN tag
14) 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.
Please aware VFD is an EXPERIMENTAL feature, it can be changed,
or even removed, without prior notice.
2, Implement VF MAC address setting on VF.
v11:
- update the design doc.
- rebased on the newest next-net.
v10:
- some minor change of the doc and comments.
- add the NIC check in the private APIs.
v9:
- upadte the doc and announce VFD is an experimental feature.
v8:
- remove unnecessary VF check.
- add more debug logs.
- split VMDq related code to a separate patch set.
- some minor change.
v7:
- fix 32 bit compile error in patch 23.
- add new patches to configure VMDq.
v6:
- remove the support of DPDK PF + kernel VF. Will create a new patch set for it.
- reword the tittles of some patches.
- add sanity check for vsi, and other minor change.
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: set VF VLAN insertion from PF
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) (2):
net/i40e: set VF VLAN strip from PF
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 (11):
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
doc: update doc for VFD
MAINTAINERS | 1 +
app/test-pmd/Makefile | 1 +
app/test-pmd/cmdline.c | 552 +++++++++++++++-
app/test-pmd/config.c | 13 -
app/test-pmd/testpmd.h | 2 -
doc/guides/contributing/design.rst | 14 +
doc/guides/nics/i40e.rst | 1 +
doc/guides/rel_notes/release_17_02.rst | 29 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 32 +
drivers/net/i40e/Makefile | 4 +-
drivers/net/i40e/i40e_ethdev.c | 976 +++++++++++++++++++++++++++-
drivers/net/i40e/i40e_ethdev.h | 5 +-
drivers/net/i40e/i40e_ethdev_vf.c | 82 ++-
drivers/net/i40e/i40e_pf.c | 244 +++++--
drivers/net/i40e/i40e_pf.h | 9 +-
drivers/net/i40e/rte_pmd_i40e.h | 335 ++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 20 +
17 files changed, 2206 insertions(+), 114 deletions(-)
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
Series-Acked-by: Helin Zhang <helin.zhang@intel.com>
Series-Acked-By: Vincent Jardin <vincent.jardin@6wind.com>
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 01/26] net/i40e: support link status notification
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 02/26] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
` (24 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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>
---
MAINTAINERS | 1 +
drivers/net/i40e/Makefile | 4 +-
drivers/net/i40e/i40e_ethdev.c | 38 +++++++++++++++++++
drivers/net/i40e/i40e_pf.c | 4 +-
drivers/net/i40e/i40e_pf.h | 4 +-
drivers/net/i40e/rte_pmd_i40e.h | 61 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 7 ++++
7 files changed, 115 insertions(+), 4 deletions(-)
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 2f3639f..aa1f261 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -332,6 +332,7 @@ Intel i40e
M: Helin Zhang <helin.zhang@intel.com>
M: Jingjing Wu <jingjing.wu@intel.com>
F: drivers/net/i40e/
+F: drivers/net/i40e/rte_pmd_i40e.h - EXPERIMENTAL
F: doc/guides/nics/i40e.rst
F: doc/guides/nics/intel_vf.rst
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 89bd85a..94482cf 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-2017 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -112,6 +112,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 4b148bf..58f9dfa 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -63,6 +63,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"
@@ -10188,3 +10189,40 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
i40e_tunnel_filter_restore(pf);
i40e_fdir_filter_restore(pf);
}
+
+static int
+is_i40e_pmd(const char *driver_name)
+{
+ if (!strstr(driver_name, "i40e"))
+ return -ENOTSUP;
+
+ if (strstr(driver_name, "i40e_vf"))
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
+{
+ struct rte_eth_dev *dev;
+ struct i40e_pf *pf;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf >= pf->vf_num || !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..f606c2a 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-2017 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -897,7 +897,7 @@
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..47a9c34 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-2017 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..46ba60c
--- /dev/null
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -0,0 +1,61 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright (c) 2017 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.
+ */
+
+#ifndef _PMD_I40E_H_
+#define _PMD_I40E_H_
+
+/**
+ * @file rte_pmd_i40e.h
+ *
+ * i40e PMD specific functions.
+ *
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ */
+
+#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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 02/26] net/i40e: add callback to user on VF to PF mbox msg
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 01/26] net/i40e: support link status notification Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 03/26] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
` (23 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 f606c2a..5c58424 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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 46ba60c..afa3761 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -45,6 +45,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
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 03/26] net/i40e: set VF MAC anti-spoofing from PF
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 01/26] net/i40e: support link status notification Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 02/26] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 04/26] net/i40e: set VF VLAN " Wenzhuo Lu
` (22 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 65 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 85 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 58f9dfa..fb45c42 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10226,3 +10226,68 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ /* 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) {
+ ret = -ENOTSUP;
+ 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 afa3761..11d1c2b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -79,4 +79,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 04/26] net/i40e: set VF VLAN anti-spoofing from PF
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (2 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 03/26] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 05/26] net/i40e: set Tx loopback " Wenzhuo Lu
` (21 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 140 ++++++++++++++++++++++++++++--
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, 156 insertions(+), 5 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index fb45c42..97217f9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4625,6 +4625,7 @@ struct i40e_vsi *
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 :
@@ -5966,14 +5967,11 @@ struct i40e_vsi *
}
static void
-i40e_set_vlan_filter(struct i40e_vsi *vsi,
- uint16_t vlan_id, bool on)
+i40e_store_vlan_filter(struct i40e_vsi *vsi,
+ uint16_t vlan_id, bool on)
{
uint32_t vid_idx, vid_bit;
- if (vlan_id > ETH_VLAN_ID_MAX)
- return;
-
vid_idx = I40E_VFTA_IDX(vlan_id);
vid_bit = I40E_VFTA_BIT(vlan_id);
@@ -5983,6 +5981,38 @@ struct i40e_vsi *
vsi->vfta[vid_idx] &= ~vid_bit;
}
+static void
+i40e_set_vlan_filter(struct i40e_vsi *vsi,
+ uint16_t vlan_id, bool on)
+{
+ 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;
+
+ i40e_store_vlan_filter(vsi, vlan_id, on);
+
+ if (!vsi->vlan_anti_spoof_on || !vlan_id)
+ return;
+
+ vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
+
+ if (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");
+ } else {
+ 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");
+ }
+}
+
/**
* Find all vlan options for specific mac addr,
* return with actual vlan found.
@@ -10291,3 +10321,103 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ if (!vlan_id)
+ continue;
+
+ 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 i40e_pf *pf;
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ /* 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) {
+ PMD_DRV_LOG(ERR, "Failed to remove VLAN filters.");
+ return -ENOTSUP;
+ }
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 c9fda15..797e892 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -361,6 +361,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 11d1c2b..be6e704 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -98,4 +98,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 05/26] net/i40e: set Tx loopback from PF
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (3 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 04/26] net/i40e: set VF VLAN " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 06/26] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
` (20 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 241 ++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 16 ++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 258 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 97217f9..4576ca2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10421,3 +10421,244 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ void *temp;
+
+ /* remove all the MACs */
+ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+ 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;
+ void *temp;
+
+ /* restore all the MACs */
+ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+ 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;
+
+ if (!vsi)
+ return -EINVAL;
+
+ 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 MAC and VLAN first */
+ ret = i40e_vsi_rm_mac_filter(vsi);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to remove MAC filters.");
+ return ret;
+ }
+ if (vsi->vlan_anti_spoof_on) {
+ ret = i40e_add_rm_all_vlan_filter(vsi, 0);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to remove VLAN filters.");
+ 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 MAC and VLAN back */
+ ret = i40e_vsi_restore_mac_filter(vsi);
+ if (ret)
+ return ret;
+ if (vsi->vlan_anti_spoof_on) {
+ ret = i40e_add_rm_all_vlan_filter(vsi, 1);
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ 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 -ENOTSUP;
+
+ /* setup TX loopback for all the VFs */
+ if (!pf->vfs) {
+ /* if no VF, do nothing. */
+ return 0;
+ }
+
+ 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 -ENOTSUP;
+ }
+
+ return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index be6e704..14fce97 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -117,4 +117,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 06/26] net/i40e: set VF unicast promisc mode from PF
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (4 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 05/26] net/i40e: set Tx loopback " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 07/26] net/i40e: set VF multicast " Wenzhuo Lu
` (19 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 41 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 61 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4576ca2..824597c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10662,3 +10662,44 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
+ on, NULL, true);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 14fce97..4027200 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -133,4 +133,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 07/26] net/i40e: set VF multicast promisc mode from PF
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (5 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 06/26] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 08/26] net/i40e: enable VF MTU change Wenzhuo Lu
` (18 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 41 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 61 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 824597c..3b78c57 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10703,3 +10703,44 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,
+ on, NULL);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 4027200..cdd8bc8 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -152,4 +152,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 08/26] net/i40e: enable VF MTU change
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (6 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 07/26] net/i40e: set VF multicast " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 09/26] net/i40e: fix VF reset flow Wenzhuo Lu
` (17 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 f50ac2d..b292d1d 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 @@ struct rte_i40evf_xstats_name_off {
.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,
};
/*
@@ -2653,3 +2655,34 @@ static int i40evf_dev_xstats_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;
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 09/26] net/i40e: fix VF reset flow
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (7 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 08/26] net/i40e: enable VF MTU change Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 10/26] net/i40e: set VF MAC from PF support Wenzhuo Lu
` (16 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang, stable
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 5c58424..8a6733c 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -139,7 +139,7 @@
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 @@
}
/* 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 @@
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 47a9c34..b4c2287 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 {
/*
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 10/26] net/i40e: set VF MAC from PF support
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (8 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 09/26] net/i40e: fix VF reset flow Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 11/26] net/i40e: set VF MAC from VF support Wenzhuo Lu
` (15 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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.
PF should set MAC address before VF initialized,
if PF sets the MAC address after VF initialized,
new MAC address won't be effective until VF
reinitialized.
This will remove all existing MAC filters.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 42 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 23 +++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 66 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 3b78c57..489b818 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10744,3 +10744,45 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+int
+rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+ struct ether_addr *mac_addr)
+{
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs)
+ return -EINVAL;
+
+ vf = &pf->vfs[vf_id];
+ vsi = vf->vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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 cdd8bc8..bc44247 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -171,4 +171,27 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
uint16_t vf_id,
uint8_t on);
+/**
+ * Set the VF MAC address.
+ *
+ * PF should set MAC address before VF initialized, if PF sets the MAC
+ * address after VF initialized, new MAC address won't be effective until
+ * VF reinitialize.
+ *
+ * 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 11/26] net/i40e: set VF MAC from VF support
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (9 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 10/26] net/i40e: set VF MAC from PF support Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 12/26] net/i40e: fix VF MAC address assignment Wenzhuo Lu
` (14 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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 797e892..9e2f7a2 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -128,6 +128,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 | \
@@ -136,7 +137,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 b292d1d..a9a8bb4 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 @@ struct rte_i40evf_xstats_name_off {
.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,
};
/*
@@ -890,19 +893,16 @@ struct rte_i40evf_xstats_name_off {
}
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],
@@ -929,6 +929,17 @@ struct rte_i40evf_xstats_name_off {
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)
{
@@ -1262,10 +1273,12 @@ static int i40evf_dev_xstats_get(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) {
@@ -2686,3 +2699,25 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
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);
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 12/26] net/i40e: fix VF MAC address assignment
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (10 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 11/26] net/i40e: set VF MAC from VF support Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 13/26] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
` (13 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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 a9a8bb4..17a035c 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1195,7 +1195,6 @@ static int i40evf_dev_xstats_get(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);
@@ -1272,13 +1271,10 @@ static int i40evf_dev_xstats_get(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) {
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 13/26] net/i40e: set VF VLAN strip from PF
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (11 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 12/26] net/i40e: fix VF MAC address assignment Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 14/26] net/i40e: set VF VLAN insertion " Wenzhuo Lu
` (12 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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 | 37 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 57 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 489b818..04f2465 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10786,3 +10786,40 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+
+ if (!vsi)
+ return -EINVAL;
+
+ ret = i40e_vsi_config_vlan_stripping(vsi, !!on);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ PMD_DRV_LOG(ERR, "Failed to set VLAN stripping!");
+ }
+
+ return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index bc44247..09ca088 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -194,4 +194,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 14/26] net/i40e: set VF VLAN insertion from PF
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (12 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 13/26] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 15/26] net/i40e: set VF broadcast mode " Wenzhuo Lu
` (11 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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 | 65 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 85 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 04f2465..670f74a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10823,3 +10823,68 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ struct i40e_vsi *vsi;
+ struct i40e_vsi_context ctxt;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ if (vlan_id > ETHER_MAX_VLAN_ID) {
+ PMD_DRV_LOG(ERR, "Invalid VLAN ID.");
+ return -EINVAL;
+ }
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ 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) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+ vsi->info.pvid = vlan_id;
+ if (vlan_id > 0)
+ vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID;
+ else
+ vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_INSERT_PVID;
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 09ca088..6dff242 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -213,4 +213,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 15/26] net/i40e: set VF broadcast mode from PF
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (13 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 14/26] net/i40e: set VF VLAN insertion " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 16/26] net/i40e: set VF VLAN tag " Wenzhuo Lu
` (10 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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 | 56 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 76 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 670f74a..1ff58d7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10888,3 +10888,59 @@ 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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on should be 0 or 1.");
+ return -EINVAL;
+ }
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ hw = I40E_PF_TO_HW(pf);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_broadcast(hw, vsi->seid, on, NULL);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 6dff242..f4a6bf5 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -232,4 +232,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 16/26] net/i40e: set VF VLAN tag from PF
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (14 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 15/26] net/i40e: set VF broadcast mode " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 17/26] net/i40e: set VF VLAN filter " Wenzhuo Lu
` (9 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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 | 68 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 18 ++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 87 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 1ff58d7..63c7d5d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10944,3 +10944,71 @@ 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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ struct i40e_vsi *vsi;
+ struct i40e_vsi_context ctxt;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on should be 0 or 1.");
+ return -EINVAL;
+ }
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 f4a6bf5..c97c1d1 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -251,4 +251,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 17/26] net/i40e: set VF VLAN filter from PF
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (15 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 16/26] net/i40e: set VF VLAN tag " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 18/26] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
` (8 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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 | 63 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 22 +++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 86 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 63c7d5d..b084c39 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11012,3 +11012,66 @@ 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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ uint16_t vf_idx;
+ int ret = I40E_SUCCESS;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ if (vlan_id > ETHER_MAX_VLAN_ID) {
+ PMD_DRV_LOG(ERR, "Invalid VLAN ID.");
+ return -EINVAL;
+ }
+
+ if (vf_mask == 0) {
+ PMD_DRV_LOG(ERR, "No VF.");
+ return -EINVAL;
+ }
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on is should be 0 or 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ for (vf_idx = 0; vf_idx < 64 && ret == I40E_SUCCESS; vf_idx++) {
+ if (vf_mask & ((uint64_t)(1ULL << vf_idx))) {
+ if (on)
+ ret = i40e_vsi_add_vlan(pf->vfs[vf_idx].vsi,
+ vlan_id);
+ else
+ ret = i40e_vsi_delete_vlan(pf->vfs[vf_idx].vsi,
+ vlan_id);
+ }
+ }
+
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 c97c1d1..2c87029 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -269,4 +269,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) 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 18/26] app/testpmd: use VFD APIs on i40e
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (16 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 17/26] net/i40e: set VF VLAN filter " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 19/26] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
` (7 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark), Bernard Iremonger
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 | 1 +
app/test-pmd/cmdline.c | 136 ++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 108 insertions(+), 29 deletions(-)
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 050663a..a1500bb 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -61,6 +61,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
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
endif
CFLAGS_cmdline.o := -D_GNU_SOURCE
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0c0f74e..641f028 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -91,6 +91,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;
@@ -263,19 +266,21 @@ 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"
+#ifdef RTE_LIBRTE_IXGBE_PMD
"set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)\n"
" Enable MACsec offload.\n\n"
@@ -295,7 +300,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"
@@ -304,7 +308,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"
@@ -399,10 +402,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)"
@@ -6715,9 +6716,7 @@ struct 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;
@@ -10851,7 +10850,6 @@ struct cmd_config_e_tag_result {
NULL,
},
};
-#ifdef RTE_LIBRTE_IXGBE_PMD
/* vf vlan anti spoof configuration */
@@ -10903,11 +10901,21 @@ struct cmd_vf_vlan_anti_spoof_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id,
+ res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -10917,6 +10925,9 @@ struct cmd_vf_vlan_anti_spoof_result {
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));
}
@@ -10988,11 +10999,21 @@ struct cmd_vf_mac_anti_spoof_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id,
+ res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11002,6 +11023,9 @@ struct cmd_vf_mac_anti_spoof_result {
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));
}
@@ -11073,10 +11097,21 @@ struct cmd_vf_vlan_stripq_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id,
+ res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11157,9 +11192,19 @@ struct cmd_vf_vlan_insert_result {
__attribute__((unused)) void *data)
{
struct cmd_vf_vlan_insert_result *res = parsed_result;
- int ret;
+ int ret = -ENOTSUP;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id,
+ res->vlan_id);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11169,6 +11214,9 @@ struct cmd_vf_vlan_insert_result {
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));
}
@@ -11230,10 +11278,19 @@ struct cmd_tx_loopback_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11243,6 +11300,9 @@ struct cmd_tx_loopback_result {
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));
}
@@ -11262,6 +11322,7 @@ struct cmd_tx_loopback_result {
},
};
+#ifdef RTE_LIBRTE_IXGBE_PMD
/* all queues drop enable configuration */
/* Common result structure for all queues drop enable */
@@ -11320,6 +11381,9 @@ struct cmd_all_queues_drop_en_result {
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));
}
@@ -11424,6 +11488,7 @@ struct cmd_vf_split_drop_en_result {
NULL,
},
};
+#endif
/* vf mac address configuration */
@@ -11475,10 +11540,19 @@ struct cmd_set_vf_mac_addr_result {
__attribute__((unused)) void *data)
{
struct cmd_set_vf_mac_addr_result *res = parsed_result;
- int ret;
+ int ret = -ENOTSUP;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_mac_addr(res->port_id, res->vf_id,
+ &res->mac_addr);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11488,6 +11562,9 @@ struct cmd_set_vf_mac_addr_result {
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));
}
@@ -11509,6 +11586,7 @@ struct cmd_set_vf_mac_addr_result {
},
};
+#ifdef RTE_LIBRTE_IXGBE_PMD
/* MACsec configuration */
/* Common result structure for MACsec offload enable */
@@ -12036,15 +12114,14 @@ struct cmd_macsec_sa_result {
(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_macsec_offload_on,
(cmdline_parse_inst_t *)&cmd_set_macsec_offload_off,
(cmdline_parse_inst_t *)&cmd_set_macsec_sc,
@@ -12054,6 +12131,7 @@ struct cmd_macsec_sa_result {
(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,
};
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 19/26] app/testpmd: use unicast promiscuous mode on i40e
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (17 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 18/26] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 20/26] app/testpmd: use multicast " Wenzhuo Lu
` (6 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 102 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 641f028..b74a812 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -415,6 +415,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"
@@ -11961,6 +11964,95 @@ struct cmd_macsec_sa_result {
};
#endif
+/* 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 */
@@ -12132,6 +12224,7 @@ struct cmd_macsec_sa_result {
(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 e3222c0..436bfca 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -852,6 +852,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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 20/26] app/testpmd: use multicast promiscuous mode on i40e
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (18 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 19/26] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 21/26] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
` (5 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 102 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b74a812..8daaa74 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -418,6 +418,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"
@@ -12053,6 +12056,95 @@ struct cmd_vf_promisc_result {
},
};
+/* 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 */
@@ -12225,6 +12317,7 @@ struct cmd_vf_promisc_result {
#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 436bfca..e9bab80 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -861,6 +861,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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 21/26] app/testpmd: add command to test VF broadcast mode on i40e
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (19 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 20/26] app/testpmd: use multicast " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 22/26] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
` (4 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++
2 files changed, 100 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 8daaa74..320213b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -294,6 +294,9 @@ static void cmd_help_long_parsed(void *parsed_result,
" Configure MACsec secure association (SA).\n\n"
#endif
+ "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"
@@ -12145,6 +12148,95 @@ struct cmd_vf_allmulti_result {
},
};
+/* 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 */
@@ -12318,6 +12410,7 @@ struct cmd_vf_allmulti_result {
(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 e9bab80..59e34b4 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -539,6 +539,13 @@ Configure MACsec secure association (SA)::
The IDX value must be 0 or 1.
Check the NIC Datasheet for hardware limits.
+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
~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 22/26] app/testpmd: add command to test VF VLAN tag on i40e
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (20 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 21/26] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 23/26] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
` (3 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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 | 99 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++
2 files changed, 106 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 320213b..e3e815e 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -312,6 +312,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"
@@ -12237,6 +12240,101 @@ struct cmd_set_vf_broadcast_result {
},
};
+/* 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 */
@@ -12411,6 +12509,7 @@ struct cmd_set_vf_broadcast_result {
(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 59e34b4..60f30bb 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -574,6 +574,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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 23/26] app/testpmd: handle i40e in VF VLAN filter command
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (21 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 22/26] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 24/26] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
` (2 subsequent siblings)
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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/cmdline.c | 38 +++++++++++++++++++++++++++++++-------
app/test-pmd/config.c | 13 -------------
app/test-pmd/testpmd.h | 2 --
3 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index e3e815e..3abc147 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6877,7 +6877,6 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result,
},
};
-#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;
@@ -6895,11 +6894,37 @@ struct cmd_vf_rx_vlan_filter {
__attribute__((unused)) void *data)
{
struct cmd_vf_rx_vlan_filter *res = parsed_result;
+ int ret = -ENOTSUP;
- 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_unused int is_add = (strcmp(res->what, "add") == 0) ? 1 : 0;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ 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 (ret == -ENOTSUP)
+ 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 %"PRIu64"\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 =
@@ -6940,7 +6965,6 @@ struct cmd_vf_rx_vlan_filter {
NULL,
},
};
-#endif
/* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */
struct cmd_queue_rate_limit_result {
@@ -12502,9 +12526,9 @@ struct cmd_set_vf_vlan_tag_result {
(cmdline_parse_inst_t *)&cmd_set_macsec_sa,
(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 11a930d..5834498 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2846,19 +2846,6 @@ struct igb_ring_desc_16_bytes {
"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 0a9a1af..ee59460 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -600,8 +600,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,
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 24/26] net/i40e: enhance in sanity check of MAC
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (22 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 23/26] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 25/26] net/i40e: set/clear VF stats from PF Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 26/26] doc: update doc for VFD Wenzhuo Lu
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: 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 8a6733c..263e843 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -753,8 +753,8 @@
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;
}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 25/26] net/i40e: set/clear VF stats from PF
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (23 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 24/26] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 26/26] doc: update doc for VFD Wenzhuo Lu
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 | 79 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 41 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 2 +
3 files changed, 122 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index b084c39..f92f148 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11075,3 +11075,82 @@ 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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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 0;
+}
+
+int
+rte_pmd_i40e_reset_vf_stats(uint8_t port,
+ uint16_t vf_id)
+{
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ vsi->offset_loaded = false;
+ i40e_update_vsi_stats(vsi);
+
+ return 0;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 2c87029..f4bd0fd 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -291,4 +291,45 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v11 26/26] doc: update doc for VFD
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (24 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 25/26] net/i40e: set/clear VF stats from PF Wenzhuo Lu
@ 2017-01-17 2:28 ` Wenzhuo Lu
25 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 2:28 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
Update the doc and release note.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
doc/guides/contributing/design.rst | 14 ++++++++++++++
doc/guides/nics/i40e.rst | 1 +
doc/guides/rel_notes/release_17_02.rst | 29 +++++++++++++++++++++++++++++
3 files changed, 44 insertions(+)
diff --git a/doc/guides/contributing/design.rst b/doc/guides/contributing/design.rst
index bac3d1b..73650b2 100644
--- a/doc/guides/contributing/design.rst
+++ b/doc/guides/contributing/design.rst
@@ -158,3 +158,17 @@ cache bandwidth, memory bandwidth, etc) that depends on:
branches are usually required. When processing a burst of packets that have been
validated for header integrity, counting the number of bits set in a bitmask
might be needed.
+
+PF and VF Considerations
+------------------------
+
+The primary goal of DPDK is to provide a Userspace dataplane. Managing VFs from
+a PF driver is a control plane feature and developers should generally rely on
+the Linux Kernel for that.
+
+The primary goal should be to work with the Linux Kernel community to get the
+required functionality upstream. PF functionality should only be added to DPDK
+for testing and prototyping purposes while the kernel work is ongoing. It should
+also be marked with an "EXPERIMENTAL" tag. If the upstream path is rejected by
+the Linux Kernel community then a case can be made to maintain the PF
+functionality in DPDK without the EXPERIMENTAL tag.
diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst
index 0cc9268..1245ecf 100644
--- a/doc/guides/nics/i40e.rst
+++ b/doc/guides/nics/i40e.rst
@@ -64,6 +64,7 @@ Features of the I40E PMD are:
- SR-IOV VF
- Hot plug
- IEEE1588/802.1AS timestamping
+- VF Daemon (VFD) - EXPERIMENTAL
Prerequisites
diff --git a/doc/guides/rel_notes/release_17_02.rst b/doc/guides/rel_notes/release_17_02.rst
index aa90e59..f7e9f86 100644
--- a/doc/guides/rel_notes/release_17_02.rst
+++ b/doc/guides/rel_notes/release_17_02.rst
@@ -71,6 +71,35 @@ New Features
Support for Mellanox ConnectX-5 family of 10/25/40/50/100 Gbps adapters
has been added to the existing mlx5 PMD.
+* **Added VF Daemon (VFD) on i40e. - EXPERIMENTAL**
+
+ This's an EXPERIMENTAL feature to enhance the capability of DPDK PF as many
+ VF management features are not supported by kernel PF driver.
+ Some new private APIs are implemented in PMD without abstrction layer.
+ They can be used directly by some users who have the need.
+
+ The new APIs to control VFs directly from PF 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
+ 13) set VF VLAN tag
+ 14) 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.
+
+ As an EXPERIMENTAL feature, please aware it can be changed or even
+ removed without prior notice.
+
+
Resolved Issues
---------------
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL
2016-12-02 0:11 [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e Wenzhuo Lu
` (39 preceding siblings ...)
2017-01-17 2:28 ` [dpdk-dev] [PATCH v11 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 01/26] net/i40e: support link status notification Wenzhuo Lu
` (26 more replies)
40 siblings, 27 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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
13) set VF VLAN tag
14) 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.
Please aware VFD is an EXPERIMENTAL feature, it can be changed,
or even removed, without prior notice.
2, Implement VF MAC address setting on VF.
v12:
- reword the doc.
v11:
- update the design doc.
- rebased on the newest next-net.
v10:
- some minor change of the doc and comments.
- add the NIC check in the private APIs.
v9:
- upadte the doc and announce VFD is an experimental feature.
v8:
- remove unnecessary VF check.
- add more debug logs.
- split VMDq related code to a separate patch set.
- some minor change.
v7:
- fix 32 bit compile error in patch 23.
- add new patches to configure VMDq.
v6:
- remove the support of DPDK PF + kernel VF. Will create a new patch set for it.
- reword the tittles of some patches.
- add sanity check for vsi, and other minor change.
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: set VF VLAN insertion from PF
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) (2):
net/i40e: set VF VLAN strip from PF
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 (11):
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
doc: update doc for VFD
MAINTAINERS | 1 +
app/test-pmd/Makefile | 1 +
app/test-pmd/cmdline.c | 552 +++++++++++++++-
app/test-pmd/config.c | 13 -
app/test-pmd/testpmd.h | 2 -
doc/guides/contributing/design.rst | 14 +
doc/guides/nics/i40e.rst | 1 +
doc/guides/rel_notes/release_17_02.rst | 29 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 32 +
drivers/net/i40e/Makefile | 4 +-
drivers/net/i40e/i40e_ethdev.c | 976 +++++++++++++++++++++++++++-
drivers/net/i40e/i40e_ethdev.h | 5 +-
drivers/net/i40e/i40e_ethdev_vf.c | 82 ++-
drivers/net/i40e/i40e_pf.c | 244 +++++--
drivers/net/i40e/i40e_pf.h | 9 +-
drivers/net/i40e/rte_pmd_i40e.h | 335 ++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 20 +
17 files changed, 2206 insertions(+), 114 deletions(-)
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
Series-Acked-by: Helin Zhang <helin.zhang@intel.com>
Series-Acked-By: Vincent Jardin <vincent.jardin@6wind.com>
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 01/26] net/i40e: support link status notification
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 02/26] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
` (25 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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>
---
MAINTAINERS | 1 +
drivers/net/i40e/Makefile | 4 +-
drivers/net/i40e/i40e_ethdev.c | 38 +++++++++++++++++++
drivers/net/i40e/i40e_pf.c | 4 +-
drivers/net/i40e/i40e_pf.h | 4 +-
drivers/net/i40e/rte_pmd_i40e.h | 61 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 7 ++++
7 files changed, 115 insertions(+), 4 deletions(-)
create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 2f3639f..aa1f261 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -332,6 +332,7 @@ Intel i40e
M: Helin Zhang <helin.zhang@intel.com>
M: Jingjing Wu <jingjing.wu@intel.com>
F: drivers/net/i40e/
+F: drivers/net/i40e/rte_pmd_i40e.h - EXPERIMENTAL
F: doc/guides/nics/i40e.rst
F: doc/guides/nics/intel_vf.rst
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 89bd85a..94482cf 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-2017 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -112,6 +112,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 4b148bf..58f9dfa 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -63,6 +63,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"
@@ -10188,3 +10189,40 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
i40e_tunnel_filter_restore(pf);
i40e_fdir_filter_restore(pf);
}
+
+static int
+is_i40e_pmd(const char *driver_name)
+{
+ if (!strstr(driver_name, "i40e"))
+ return -ENOTSUP;
+
+ if (strstr(driver_name, "i40e_vf"))
+ return -ENOTSUP;
+
+ return 0;
+}
+
+int
+rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)
+{
+ struct rte_eth_dev *dev;
+ struct i40e_pf *pf;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf >= pf->vf_num || !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..f606c2a 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-2017 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -897,7 +897,7 @@
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..47a9c34 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-2017 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..46ba60c
--- /dev/null
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -0,0 +1,61 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright (c) 2017 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.
+ */
+
+#ifndef _PMD_I40E_H_
+#define _PMD_I40E_H_
+
+/**
+ * @file rte_pmd_i40e.h
+ *
+ * i40e PMD specific functions.
+ *
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ */
+
+#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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 02/26] net/i40e: add callback to user on VF to PF mbox msg
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 01/26] net/i40e: support link status notification Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 03/26] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
` (24 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 f606c2a..5c58424 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 @@
}
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 46ba60c..afa3761 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -45,6 +45,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
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 03/26] net/i40e: set VF MAC anti-spoofing from PF
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 01/26] net/i40e: support link status notification Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 02/26] net/i40e: add callback to user on VF to PF mbox msg Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 04/26] net/i40e: set VF VLAN " Wenzhuo Lu
` (23 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 65 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 85 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 58f9dfa..fb45c42 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10226,3 +10226,68 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ /* 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) {
+ ret = -ENOTSUP;
+ 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 afa3761..11d1c2b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -79,4 +79,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 04/26] net/i40e: set VF VLAN anti-spoofing from PF
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (2 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 03/26] net/i40e: set VF MAC anti-spoofing from PF Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 05/26] net/i40e: set Tx loopback " Wenzhuo Lu
` (22 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 140 ++++++++++++++++++++++++++++--
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, 156 insertions(+), 5 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index fb45c42..97217f9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4625,6 +4625,7 @@ struct i40e_vsi *
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 :
@@ -5966,14 +5967,11 @@ struct i40e_vsi *
}
static void
-i40e_set_vlan_filter(struct i40e_vsi *vsi,
- uint16_t vlan_id, bool on)
+i40e_store_vlan_filter(struct i40e_vsi *vsi,
+ uint16_t vlan_id, bool on)
{
uint32_t vid_idx, vid_bit;
- if (vlan_id > ETH_VLAN_ID_MAX)
- return;
-
vid_idx = I40E_VFTA_IDX(vlan_id);
vid_bit = I40E_VFTA_BIT(vlan_id);
@@ -5983,6 +5981,38 @@ struct i40e_vsi *
vsi->vfta[vid_idx] &= ~vid_bit;
}
+static void
+i40e_set_vlan_filter(struct i40e_vsi *vsi,
+ uint16_t vlan_id, bool on)
+{
+ 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;
+
+ i40e_store_vlan_filter(vsi, vlan_id, on);
+
+ if (!vsi->vlan_anti_spoof_on || !vlan_id)
+ return;
+
+ vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
+
+ if (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");
+ } else {
+ 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");
+ }
+}
+
/**
* Find all vlan options for specific mac addr,
* return with actual vlan found.
@@ -10291,3 +10321,103 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ if (!vlan_id)
+ continue;
+
+ 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 i40e_pf *pf;
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ /* 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) {
+ PMD_DRV_LOG(ERR, "Failed to remove VLAN filters.");
+ return -ENOTSUP;
+ }
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 c9fda15..797e892 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -361,6 +361,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 11d1c2b..be6e704 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -98,4 +98,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 05/26] net/i40e: set Tx loopback from PF
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (3 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 04/26] net/i40e: set VF VLAN " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 06/26] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
` (21 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 241 ++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 16 ++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 258 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 97217f9..4576ca2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10421,3 +10421,244 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ void *temp;
+
+ /* remove all the MACs */
+ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+ 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;
+ void *temp;
+
+ /* restore all the MACs */
+ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) {
+ 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;
+
+ if (!vsi)
+ return -EINVAL;
+
+ 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 MAC and VLAN first */
+ ret = i40e_vsi_rm_mac_filter(vsi);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to remove MAC filters.");
+ return ret;
+ }
+ if (vsi->vlan_anti_spoof_on) {
+ ret = i40e_add_rm_all_vlan_filter(vsi, 0);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to remove VLAN filters.");
+ 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 MAC and VLAN back */
+ ret = i40e_vsi_restore_mac_filter(vsi);
+ if (ret)
+ return ret;
+ if (vsi->vlan_anti_spoof_on) {
+ ret = i40e_add_rm_all_vlan_filter(vsi, 1);
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ 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 -ENOTSUP;
+
+ /* setup TX loopback for all the VFs */
+ if (!pf->vfs) {
+ /* if no VF, do nothing. */
+ return 0;
+ }
+
+ 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 -ENOTSUP;
+ }
+
+ return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index be6e704..14fce97 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -117,4 +117,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 06/26] net/i40e: set VF unicast promisc mode from PF
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (4 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 05/26] net/i40e: set Tx loopback " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 07/26] net/i40e: set VF multicast " Wenzhuo Lu
` (20 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 41 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 61 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4576ca2..824597c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10662,3 +10662,44 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
+ on, NULL, true);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 14fce97..4027200 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -133,4 +133,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 07/26] net/i40e: set VF multicast promisc mode from PF
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (5 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 06/26] net/i40e: set VF unicast promisc mode " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 08/26] net/i40e: enable VF MTU change Wenzhuo Lu
` (19 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 41 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 61 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 824597c..3b78c57 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10703,3 +10703,44 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,
+ on, NULL);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 4027200..cdd8bc8 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -152,4 +152,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 08/26] net/i40e: enable VF MTU change
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (6 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 07/26] net/i40e: set VF multicast " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 09/26] net/i40e: fix VF reset flow Wenzhuo Lu
` (18 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 f50ac2d..b292d1d 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 @@ struct rte_i40evf_xstats_name_off {
.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,
};
/*
@@ -2653,3 +2655,34 @@ static int i40evf_dev_xstats_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;
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 09/26] net/i40e: fix VF reset flow
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (7 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 08/26] net/i40e: enable VF MTU change Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 10/26] net/i40e: set VF MAC from PF support Wenzhuo Lu
` (17 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang, stable
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 5c58424..8a6733c 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -139,7 +139,7 @@
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 @@
}
/* 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 @@
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 47a9c34..b4c2287 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 {
/*
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 10/26] net/i40e: set VF MAC from PF support
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (8 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 09/26] net/i40e: fix VF reset flow Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 11/26] net/i40e: set VF MAC from VF support Wenzhuo Lu
` (16 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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.
PF should set MAC address before VF initialized,
if PF sets the MAC address after VF initialized,
new MAC address won't be effective until VF
reinitialized.
This will remove all existing MAC filters.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 42 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 23 +++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 66 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 3b78c57..489b818 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10744,3 +10744,45 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+int
+rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
+ struct ether_addr *mac_addr)
+{
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs)
+ return -EINVAL;
+
+ vf = &pf->vfs[vf_id];
+ vsi = vf->vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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 cdd8bc8..bc44247 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -171,4 +171,27 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
uint16_t vf_id,
uint8_t on);
+/**
+ * Set the VF MAC address.
+ *
+ * PF should set MAC address before VF initialized, if PF sets the MAC
+ * address after VF initialized, new MAC address won't be effective until
+ * VF reinitialize.
+ *
+ * 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 11/26] net/i40e: set VF MAC from VF support
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (9 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 10/26] net/i40e: set VF MAC from PF support Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 12/26] net/i40e: fix VF MAC address assignment Wenzhuo Lu
` (15 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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 797e892..9e2f7a2 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -128,6 +128,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 | \
@@ -136,7 +137,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 b292d1d..a9a8bb4 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 @@ struct rte_i40evf_xstats_name_off {
.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,
};
/*
@@ -890,19 +893,16 @@ struct rte_i40evf_xstats_name_off {
}
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],
@@ -929,6 +929,17 @@ struct rte_i40evf_xstats_name_off {
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)
{
@@ -1262,10 +1273,12 @@ static int i40evf_dev_xstats_get(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) {
@@ -2686,3 +2699,25 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
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);
+}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 12/26] net/i40e: fix VF MAC address assignment
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (10 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 11/26] net/i40e: set VF MAC from VF support Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 13/26] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
` (14 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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 a9a8bb4..17a035c 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1195,7 +1195,6 @@ static int i40evf_dev_xstats_get(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);
@@ -1272,13 +1271,10 @@ static int i40evf_dev_xstats_get(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) {
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 13/26] net/i40e: set VF VLAN strip from PF
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (11 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 12/26] net/i40e: fix VF MAC address assignment Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 14/26] net/i40e: set VF VLAN insertion " Wenzhuo Lu
` (13 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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 | 37 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 57 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 489b818..04f2465 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10786,3 +10786,40 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
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;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid argument.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+
+ if (!vsi)
+ return -EINVAL;
+
+ ret = i40e_vsi_config_vlan_stripping(vsi, !!on);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ PMD_DRV_LOG(ERR, "Failed to set VLAN stripping!");
+ }
+
+ return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index bc44247..09ca088 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -194,4 +194,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 14/26] net/i40e: set VF VLAN insertion from PF
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (12 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 13/26] net/i40e: set VF VLAN strip from PF Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 15/26] net/i40e: set VF broadcast mode " Wenzhuo Lu
` (12 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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 | 65 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 85 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 04f2465..670f74a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10823,3 +10823,68 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
return ret;
}
+
+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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ struct i40e_vsi *vsi;
+ struct i40e_vsi_context ctxt;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ if (vlan_id > ETHER_MAX_VLAN_ID) {
+ PMD_DRV_LOG(ERR, "Invalid VLAN ID.");
+ return -EINVAL;
+ }
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ 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) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+ vsi->info.pvid = vlan_id;
+ if (vlan_id > 0)
+ vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID;
+ else
+ vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_INSERT_PVID;
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 09ca088..6dff242 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -213,4 +213,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 15/26] net/i40e: set VF broadcast mode from PF
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (13 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 14/26] net/i40e: set VF VLAN insertion " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 16/26] net/i40e: set VF VLAN tag " Wenzhuo Lu
` (11 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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 | 56 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 76 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 670f74a..1ff58d7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10888,3 +10888,59 @@ 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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_hw *hw;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on should be 0 or 1.");
+ return -EINVAL;
+ }
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ hw = I40E_PF_TO_HW(pf);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ hw = I40E_VSI_TO_HW(vsi);
+
+ ret = i40e_aq_set_vsi_broadcast(hw, vsi->seid, on, NULL);
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 6dff242..f4a6bf5 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -232,4 +232,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 16/26] net/i40e: set VF VLAN tag from PF
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (14 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 15/26] net/i40e: set VF broadcast mode " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 17/26] net/i40e: set VF VLAN filter " Wenzhuo Lu
` (10 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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 | 68 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 18 ++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 87 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 1ff58d7..63c7d5d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10944,3 +10944,71 @@ 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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ struct i40e_vsi *vsi;
+ struct i40e_vsi_context ctxt;
+ int ret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on should be 0 or 1.");
+ return -EINVAL;
+ }
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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) {
+ ret = -ENOTSUP;
+ 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 f4a6bf5..c97c1d1 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -251,4 +251,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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 17/26] net/i40e: set VF VLAN filter from PF
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (15 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 16/26] net/i40e: set VF VLAN tag " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 18/26] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
` (9 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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 | 63 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 22 +++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 86 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 63c7d5d..b084c39 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11012,3 +11012,66 @@ 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 i40e_pf *pf;
+ struct i40e_hw *hw;
+ uint16_t vf_idx;
+ int ret = I40E_SUCCESS;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ if (vlan_id > ETHER_MAX_VLAN_ID) {
+ PMD_DRV_LOG(ERR, "Invalid VLAN ID.");
+ return -EINVAL;
+ }
+
+ if (vf_mask == 0) {
+ PMD_DRV_LOG(ERR, "No VF.");
+ return -EINVAL;
+ }
+
+ if (on > 1) {
+ PMD_DRV_LOG(ERR, "on is should be 0 or 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) {
+ PMD_DRV_LOG(ERR, "SRIOV is not enabled or no queue.");
+ return -ENODEV;
+ }
+
+ for (vf_idx = 0; vf_idx < 64 && ret == I40E_SUCCESS; vf_idx++) {
+ if (vf_mask & ((uint64_t)(1ULL << vf_idx))) {
+ if (on)
+ ret = i40e_vsi_add_vlan(pf->vfs[vf_idx].vsi,
+ vlan_id);
+ else
+ ret = i40e_vsi_delete_vlan(pf->vfs[vf_idx].vsi,
+ vlan_id);
+ }
+ }
+
+ if (ret != I40E_SUCCESS) {
+ ret = -ENOTSUP;
+ 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 c97c1d1..2c87029 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -269,4 +269,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) 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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 18/26] app/testpmd: use VFD APIs on i40e
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (16 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 17/26] net/i40e: set VF VLAN filter " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 19/26] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
` (8 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark), Bernard Iremonger
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 | 1 +
app/test-pmd/cmdline.c | 136 ++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 108 insertions(+), 29 deletions(-)
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 050663a..a1500bb 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -61,6 +61,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
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
endif
CFLAGS_cmdline.o := -D_GNU_SOURCE
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0c0f74e..641f028 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -91,6 +91,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;
@@ -263,19 +266,21 @@ 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"
+#ifdef RTE_LIBRTE_IXGBE_PMD
"set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)\n"
" Enable MACsec offload.\n\n"
@@ -295,7 +300,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"
@@ -304,7 +308,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"
@@ -399,10 +402,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)"
@@ -6715,9 +6716,7 @@ struct 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;
@@ -10851,7 +10850,6 @@ struct cmd_config_e_tag_result {
NULL,
},
};
-#ifdef RTE_LIBRTE_IXGBE_PMD
/* vf vlan anti spoof configuration */
@@ -10903,11 +10901,21 @@ struct cmd_vf_vlan_anti_spoof_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id,
+ res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -10917,6 +10925,9 @@ struct cmd_vf_vlan_anti_spoof_result {
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));
}
@@ -10988,11 +10999,21 @@ struct cmd_vf_mac_anti_spoof_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id,
+ res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11002,6 +11023,9 @@ struct cmd_vf_mac_anti_spoof_result {
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));
}
@@ -11073,10 +11097,21 @@ struct cmd_vf_vlan_stripq_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id,
+ res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11157,9 +11192,19 @@ struct cmd_vf_vlan_insert_result {
__attribute__((unused)) void *data)
{
struct cmd_vf_vlan_insert_result *res = parsed_result;
- int ret;
+ int ret = -ENOTSUP;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id,
+ res->vlan_id);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11169,6 +11214,9 @@ struct cmd_vf_vlan_insert_result {
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));
}
@@ -11230,10 +11278,19 @@ struct cmd_tx_loopback_result {
__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;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11243,6 +11300,9 @@ struct cmd_tx_loopback_result {
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));
}
@@ -11262,6 +11322,7 @@ struct cmd_tx_loopback_result {
},
};
+#ifdef RTE_LIBRTE_IXGBE_PMD
/* all queues drop enable configuration */
/* Common result structure for all queues drop enable */
@@ -11320,6 +11381,9 @@ struct cmd_all_queues_drop_en_result {
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));
}
@@ -11424,6 +11488,7 @@ struct cmd_vf_split_drop_en_result {
NULL,
},
};
+#endif
/* vf mac address configuration */
@@ -11475,10 +11540,19 @@ struct cmd_set_vf_mac_addr_result {
__attribute__((unused)) void *data)
{
struct cmd_set_vf_mac_addr_result *res = parsed_result;
- int ret;
+ int ret = -ENOTSUP;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_ixgbe_set_vf_mac_addr(res->port_id, res->vf_id,
+ &res->mac_addr);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (ret == -ENOTSUP)
+ 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;
@@ -11488,6 +11562,9 @@ struct cmd_set_vf_mac_addr_result {
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));
}
@@ -11509,6 +11586,7 @@ struct cmd_set_vf_mac_addr_result {
},
};
+#ifdef RTE_LIBRTE_IXGBE_PMD
/* MACsec configuration */
/* Common result structure for MACsec offload enable */
@@ -12036,15 +12114,14 @@ struct cmd_macsec_sa_result {
(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_macsec_offload_on,
(cmdline_parse_inst_t *)&cmd_set_macsec_offload_off,
(cmdline_parse_inst_t *)&cmd_set_macsec_sc,
@@ -12054,6 +12131,7 @@ struct cmd_macsec_sa_result {
(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,
};
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 19/26] app/testpmd: use unicast promiscuous mode on i40e
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (17 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 18/26] app/testpmd: use VFD APIs on i40e Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 20/26] app/testpmd: use multicast " Wenzhuo Lu
` (7 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 102 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 641f028..b74a812 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -415,6 +415,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"
@@ -11961,6 +11964,95 @@ struct cmd_macsec_sa_result {
};
#endif
+/* 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 */
@@ -12132,6 +12224,7 @@ struct cmd_macsec_sa_result {
(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 e3222c0..436bfca 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -852,6 +852,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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 20/26] app/testpmd: use multicast promiscuous mode on i40e
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (18 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 19/26] app/testpmd: use unicast promiscuous mode " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 21/26] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
` (6 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
2 files changed, 102 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b74a812..8daaa74 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -418,6 +418,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"
@@ -12053,6 +12056,95 @@ struct cmd_vf_promisc_result {
},
};
+/* 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 */
@@ -12225,6 +12317,7 @@ struct cmd_vf_promisc_result {
#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 436bfca..e9bab80 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -861,6 +861,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
~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 21/26] app/testpmd: add command to test VF broadcast mode on i40e
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (19 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 20/26] app/testpmd: use multicast " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 22/26] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
` (5 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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 | 93 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++
2 files changed, 100 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 8daaa74..320213b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -294,6 +294,9 @@ static void cmd_help_long_parsed(void *parsed_result,
" Configure MACsec secure association (SA).\n\n"
#endif
+ "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"
@@ -12145,6 +12148,95 @@ struct cmd_vf_allmulti_result {
},
};
+/* 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 */
@@ -12318,6 +12410,7 @@ struct cmd_vf_allmulti_result {
(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 e9bab80..59e34b4 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -539,6 +539,13 @@ Configure MACsec secure association (SA)::
The IDX value must be 0 or 1.
Check the NIC Datasheet for hardware limits.
+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
~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 22/26] app/testpmd: add command to test VF VLAN tag on i40e
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (20 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 21/26] app/testpmd: add command to test VF broadcast " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 23/26] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
` (4 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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 | 99 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++
2 files changed, 106 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 320213b..e3e815e 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -312,6 +312,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"
@@ -12237,6 +12240,101 @@ struct cmd_set_vf_broadcast_result {
},
};
+/* 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 */
@@ -12411,6 +12509,7 @@ struct cmd_set_vf_broadcast_result {
(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 59e34b4..60f30bb 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -574,6 +574,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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 23/26] app/testpmd: handle i40e in VF VLAN filter command
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (21 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 22/26] app/testpmd: add command to test VF VLAN tag " Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 24/26] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
` (3 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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/cmdline.c | 38 +++++++++++++++++++++++++++++++-------
app/test-pmd/config.c | 13 -------------
app/test-pmd/testpmd.h | 2 --
3 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index e3e815e..3abc147 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6877,7 +6877,6 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result,
},
};
-#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;
@@ -6895,11 +6894,37 @@ struct cmd_vf_rx_vlan_filter {
__attribute__((unused)) void *data)
{
struct cmd_vf_rx_vlan_filter *res = parsed_result;
+ int ret = -ENOTSUP;
- 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_unused int is_add = (strcmp(res->what, "add") == 0) ? 1 : 0;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (ret == -ENOTSUP)
+ 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 (ret == -ENOTSUP)
+ 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 %"PRIu64"\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 =
@@ -6940,7 +6965,6 @@ struct cmd_vf_rx_vlan_filter {
NULL,
},
};
-#endif
/* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */
struct cmd_queue_rate_limit_result {
@@ -12502,9 +12526,9 @@ struct cmd_set_vf_vlan_tag_result {
(cmdline_parse_inst_t *)&cmd_set_macsec_sa,
(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 11a930d..5834498 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2846,19 +2846,6 @@ struct igb_ring_desc_16_bytes {
"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 0a9a1af..ee59460 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -600,8 +600,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,
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 24/26] net/i40e: enhance in sanity check of MAC
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (22 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 23/26] app/testpmd: handle i40e in VF VLAN filter command Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 25/26] net/i40e: set/clear VF stats from PF Wenzhuo Lu
` (2 subsequent siblings)
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: 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 8a6733c..263e843 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -753,8 +753,8 @@
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;
}
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 25/26] net/i40e: set/clear VF stats from PF
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (23 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 24/26] net/i40e: enhance in sanity check of MAC Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 26/26] doc: update doc for VFD Wenzhuo Lu
2017-01-17 13:10 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Ferruh Yigit
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
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 | 79 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 41 ++++++++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 2 +
3 files changed, 122 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index b084c39..f92f148 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11075,3 +11075,82 @@ 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 i40e_pf *pf;
+ struct i40e_vsi *vsi;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ 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 0;
+}
+
+int
+rte_pmd_i40e_reset_vf_stats(uint8_t port,
+ uint16_t vf_id)
+{
+ 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];
+
+ if (is_i40e_pmd(dev->data->drv_name))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+ vsi->offset_loaded = false;
+ i40e_update_vsi_stats(vsi);
+
+ return 0;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 2c87029..f4bd0fd 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -291,4 +291,45 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
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;
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* [dpdk-dev] [PATCH v12 26/26] doc: update doc for VFD
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (24 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 25/26] net/i40e: set/clear VF stats from PF Wenzhuo Lu
@ 2017-01-17 8:45 ` Wenzhuo Lu
2017-01-17 13:10 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Ferruh Yigit
26 siblings, 0 replies; 367+ messages in thread
From: Wenzhuo Lu @ 2017-01-17 8:45 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
Update the doc and release note.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
doc/guides/contributing/design.rst | 14 ++++++++++++++
doc/guides/nics/i40e.rst | 1 +
doc/guides/rel_notes/release_17_02.rst | 29 +++++++++++++++++++++++++++++
3 files changed, 44 insertions(+)
diff --git a/doc/guides/contributing/design.rst b/doc/guides/contributing/design.rst
index bac3d1b..88d3a43 100644
--- a/doc/guides/contributing/design.rst
+++ b/doc/guides/contributing/design.rst
@@ -158,3 +158,17 @@ cache bandwidth, memory bandwidth, etc) that depends on:
branches are usually required. When processing a burst of packets that have been
validated for header integrity, counting the number of bits set in a bitmask
might be needed.
+
+PF and VF Considerations
+------------------------
+
+The primary goal of DPDK is to provide a userspace dataplane. Managing VFs from
+a PF driver is a control plane feature and developers should generally rely on
+the Linux Kernel for that.
+
+Developers should work with the Linux Kernel community to get the required
+functionality upstream. PF functionality should only be added to DPDK for
+testing and prototyping purposes while the kernel work is ongoing. It should
+also be marked with an "EXPERIMENTAL" tag. If the functionality isn't
+upstreamable then a case can be made to maintain the PF functionality in DPDK
+without the EXPERIMENTAL tag.
diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst
index 0cc9268..1245ecf 100644
--- a/doc/guides/nics/i40e.rst
+++ b/doc/guides/nics/i40e.rst
@@ -64,6 +64,7 @@ Features of the I40E PMD are:
- SR-IOV VF
- Hot plug
- IEEE1588/802.1AS timestamping
+- VF Daemon (VFD) - EXPERIMENTAL
Prerequisites
diff --git a/doc/guides/rel_notes/release_17_02.rst b/doc/guides/rel_notes/release_17_02.rst
index aa90e59..f7e9f86 100644
--- a/doc/guides/rel_notes/release_17_02.rst
+++ b/doc/guides/rel_notes/release_17_02.rst
@@ -71,6 +71,35 @@ New Features
Support for Mellanox ConnectX-5 family of 10/25/40/50/100 Gbps adapters
has been added to the existing mlx5 PMD.
+* **Added VF Daemon (VFD) on i40e. - EXPERIMENTAL**
+
+ This's an EXPERIMENTAL feature to enhance the capability of DPDK PF as many
+ VF management features are not supported by kernel PF driver.
+ Some new private APIs are implemented in PMD without abstrction layer.
+ They can be used directly by some users who have the need.
+
+ The new APIs to control VFs directly from PF 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
+ 13) set VF VLAN tag
+ 14) 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.
+
+ As an EXPERIMENTAL feature, please aware it can be changed or even
+ removed without prior notice.
+
+
Resolved Issues
---------------
--
1.9.3
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Wenzhuo Lu
` (25 preceding siblings ...)
2017-01-17 8:45 ` [dpdk-dev] [PATCH v12 26/26] doc: update doc for VFD Wenzhuo Lu
@ 2017-01-17 13:10 ` Ferruh Yigit
2017-01-18 0:59 ` Lu, Wenzhuo
26 siblings, 1 reply; 367+ messages in thread
From: Ferruh Yigit @ 2017-01-17 13:10 UTC (permalink / raw)
To: Wenzhuo Lu, dev
On 1/17/2017 8:45 AM, Wenzhuo Lu wrote:
<...>
> Bernard Iremonger (7):
> net/i40e: set VF VLAN insertion from PF
> 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) (2):
> net/i40e: set VF VLAN strip from PF
> 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 (11):
> 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
> doc: update doc for VFD
>
<...>
>
> Series-Acked-by: Helin Zhang <helin.zhang@intel.com>
> Series-Acked-By: Vincent Jardin <vincent.jardin@6wind.com>
Series applied to dpdk-next-net/master, thanks.
Following minor updates applied [1], mostly cosmetic updates, please
check the updates:
[1]
===
- [dpdk-dev,v12,18/26] app/testpmd: use VFD APIs on i40e
cmd_set_vf_vlan_stripq_parsed(), cover -ENOTSUP return case
- [dpdk-dev,v12,19/26] app/testpmd: use unicast promiscuous mode on i40e
cmd_set_vf_promisc, update .help_str
- [dpdk-dev,v12,20/26] app/testpmd: use multicast promiscuous mode on i40e
cmd_set_vf_allmulti, update .help_str
- [dpdk-dev,v12,21/26] app/testpmd: add command to test VF broadcast
mode on i40e
cmd_set_vf_broadcast, update .help_str
- [dpdk-dev,v12,22/26] app/testpmd: add command to test VF VLAN tag on i40e
cmd_set_vf_vlan_tag, update .help_str
^ permalink raw reply [flat|nested] 367+ messages in thread
* Re: [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL
2017-01-17 13:10 ` [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e - EXPERIMENTAL Ferruh Yigit
@ 2017-01-18 0:59 ` Lu, Wenzhuo
0 siblings, 0 replies; 367+ messages in thread
From: Lu, Wenzhuo @ 2017-01-18 0:59 UTC (permalink / raw)
To: Yigit, Ferruh, dev
Hi Ferruh,
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, January 17, 2017 9:10 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v12 00/26] Support VFD on i40e -
> EXPERIMENTAL
>
> On 1/17/2017 8:45 AM, Wenzhuo Lu wrote:
> <...>
> > Bernard Iremonger (7):
> > net/i40e: set VF VLAN insertion from PF
> > 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) (2):
> > net/i40e: set VF VLAN strip from PF
> > 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 (11):
> > 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
> > doc: update doc for VFD
> >
>
> <...>
>
> >
> > Series-Acked-by: Helin Zhang <helin.zhang@intel.com>
> > Series-Acked-By: Vincent Jardin <vincent.jardin@6wind.com>
>
> Series applied to dpdk-next-net/master, thanks.
>
>
>
>
> Following minor updates applied [1], mostly cosmetic updates, please check
> the updates:
>
> [1]
> ===
> - [dpdk-dev,v12,18/26] app/testpmd: use VFD APIs on i40e
> cmd_set_vf_vlan_stripq_parsed(), cover -ENOTSUP return case
>
> - [dpdk-dev,v12,19/26] app/testpmd: use unicast promiscuous mode on i40e
> cmd_set_vf_promisc, update .help_str
>
> - [dpdk-dev,v12,20/26] app/testpmd: use multicast promiscuous mode on i40e
> cmd_set_vf_allmulti, update .help_str
>
> - [dpdk-dev,v12,21/26] app/testpmd: add command to test VF broadcast mode
> on i40e cmd_set_vf_broadcast, update .help_str
>
> - [dpdk-dev,v12,22/26] app/testpmd: add command to test VF VLAN tag on
> i40e cmd_set_vf_vlan_tag, update .help_str
Thanks for applying these patches, and also for the updates!
^ permalink raw reply [flat|nested] 367+ messages in thread