* Re: [PATCH 11/32] net/dpaa2: add dpaa2 vfio support
From: Hemant Agrawal @ 2016-12-07 7:00 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, bruce.richardson, shreyansh.jain
In-Reply-To: <4516168.6vIN5TbTdY@xps13>
On 12/7/2016 2:34 AM, Thomas Monjalon wrote:
> 2016-12-04 23:47, Hemant Agrawal:
>> Add support for using VFIO for dpaa2 based fsl-mc bus.
>
> Why do we need so much special code for interfacing VFIO on fsl-mc?
> Can you reuse some code from EAL VFIO?
>
fsl-mc VFIO scans the objects. So, it is slightly different.
Even though I have tried to minimize changes and re-use the code from
EAL VFIO. It is still refactoring work, which we will take up little later.
^ permalink raw reply
* Re: [PATCH 10/32] net/dpaa2: introducing dpaa2 bus driver for fsl-mc bus
From: Hemant Agrawal @ 2016-12-07 6:57 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: thomas.monjalon, bruce.richardson, shreyansh.jain
In-Reply-To: <5858af6b-8fba-02f0-9a1d-0210ef113920@intel.com>
On 12/7/2016 1:19 AM, Ferruh Yigit wrote:
> On 12/4/2016 6:17 PM, Hemant Agrawal wrote:
>> The DPAA2 bus driver is a rte_bus driver which scans the fsl-mc bus.
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>> drivers/net/Makefile | 2 +-
>> drivers/net/dpaa2/Makefile | 60 ++++++++++++++
>> drivers/net/dpaa2/dpaa2_bus.c | 99 +++++++++++++++++++++++
>> drivers/net/dpaa2/rte_dpaa2.h | 121 ++++++++++++++++++++++++++++
>> drivers/net/dpaa2/rte_pmd_dpaa2_version.map | 4 +
>> mk/rte.app.mk | 1 +
>> 6 files changed, 286 insertions(+), 1 deletion(-)
>> create mode 100644 drivers/net/dpaa2/Makefile
>> create mode 100644 drivers/net/dpaa2/dpaa2_bus.c
>> create mode 100644 drivers/net/dpaa2/rte_dpaa2.h
>> create mode 100644 drivers/net/dpaa2/rte_pmd_dpaa2_version.map
>>
>> diff --git a/drivers/net/Makefile b/drivers/net/Makefile
>> index bc93230..2bcf67b 100644
>> --- a/drivers/net/Makefile
>> +++ b/drivers/net/Makefile
>> @@ -55,7 +55,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += thunderx
>> DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
>> DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
>> DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
>> -
>> +DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2
>
> Add as alphabetically sorted manner please.
>
>> ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y)
>> DIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += vhost
>> endif # $(CONFIG_RTE_LIBRTE_VHOST)
>> diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile
>> new file mode 100644
>> index 0000000..a99ce22
>> --- /dev/null
>> +++ b/drivers/net/dpaa2/Makefile
>> @@ -0,0 +1,60 @@
>> +# BSD LICENSE
>> +#
>> +# Copyright (c) 2016 NXP. 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 NXP 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 $(RTE_SDK)/mk/rte.vars.mk
>> +
>> +#
>> +# library name
>> +#
>> +LIB = librte_pmd_dpaa2.a
>> +
>> +CFLAGS += -O3
>> +CFLAGS += $(WERROR_FLAGS)
>> +
>> +CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
>> +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/
>> +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
>
> Last two shouldn't be required.
>
>> +
>> +# versioning export map
>> +EXPORT_MAP := rte_pmd_dpaa2_version.map
>> +
>> +# library version
>> +LIBABIVER := 1
>> +
>> +
>> +# Interfaces with DPDK
>> +SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_bus.c
>> +
>> +# library dependencies
>> +DEPDIRS-y += lib/librte_eal
>> +DEPDIRS-y += drivers/common/dpaa/mc
>> +DEPDIRS-y += drivers/common/dpaa/qbman
>
> Again for consistency, DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) +=
>
agree, will fix it in v2
>> +
>> +include $(RTE_SDK)/mk/rte.lib.mk
>> diff --git a/drivers/net/dpaa2/dpaa2_bus.c b/drivers/net/dpaa2/dpaa2_bus.c
>> new file mode 100644
>> index 0000000..571066c
>> --- /dev/null
>> +++ b/drivers/net/dpaa2/dpaa2_bus.c
>> @@ -0,0 +1,99 @@
>> +/*-
>> + * BSD LICENSE
>> + *
>> + * Copyright (c) 2016 NXP. 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 NXP 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 <string.h>
>> +#include <dirent.h>
>> +
>> +#include <rte_log.h>
>> +#include <rte_bus.h>
>> +#include <rte_dpaa2.h>
>> +#include <rte_eal_memconfig.h>
>> +#include <rte_malloc.h>
>> +#include <rte_devargs.h>
>> +#include <rte_memcpy.h>
>> +#include <rte_ethdev.h>
>> +
>> +#include "eal_filesystem.h"
>> +#include "eal_private.h"
>> +
>> +void
>> +rte_dpaa2_register(struct rte_dpaa2_driver *driver)
>> +{
>> + struct rte_bus *bus;
>> +
>> + bus = rte_eal_get_bus("dpaa2");
>> + if (!bus) {
>> + RTE_LOG(ERR, EAL, "DPAA2 bus not registered\n");
>> + return;
>> + }
>> +
>> + rte_eal_bus_add_driver(bus, &driver->driver);
>> +}
>> +
>> +void
>> +rte_dpaa2_unregister(struct rte_dpaa2_driver *driver)
>> +{
>> + struct rte_bus *bus;
>> +
>> + bus = driver->driver.bus;
>> + if (!bus) {
>> + RTE_LOG(ERR, EAL, "Unable to find bus for device\n");
>> + return;
>> + }
>> +
>> + rte_eal_bus_remove_driver(&driver->driver);
>> +}
>> +
>> +int rte_dpaa2_probe(struct rte_driver *driver __rte_unused,
>> + struct rte_device *device __rte_unused)
>> +{
>> + return 0;
>> +}
>> +
>> +int rte_dpaa2_scan(struct rte_bus *bus_d __rte_unused)
>> +{
>> + return 0;
>> +}
>> +
>> +int rte_dpaa2_match(struct rte_driver *driver __rte_unused,
>> + struct rte_device *device __rte_unused)
>> +{
>> + return 0;
>> +}
>> +
>> +struct rte_bus dpaa2_bus = {
>> + .scan = rte_dpaa2_scan,
>> + .match = rte_dpaa2_match,
>> + .probe = rte_dpaa2_probe,
>> +};
>> +
>> +RTE_REGISTER_BUS(dpaa2, dpaa2_bus);
>> diff --git a/drivers/net/dpaa2/rte_dpaa2.h b/drivers/net/dpaa2/rte_dpaa2.h
>> new file mode 100644
>> index 0000000..b36eed8
>> --- /dev/null
>> +++ b/drivers/net/dpaa2/rte_dpaa2.h
>> @@ -0,0 +1,121 @@
>> +/*-
>> + * BSD LICENSE
>> + *
>> + * Copyright (c) 2016 NXP. 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 NXP 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 _RTE_DPAA2_H_
>> +#define _RTE_DPAA2_H_
>> +
>> +/**
>> + * @file
>> + *
>> + * RTE DPAA2 Interface
>> + */
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +#include <stdio.h>
>> +#include <stdlib.h>
>> +#include <limits.h>
>> +#include <errno.h>
>> +#include <sys/queue.h>
>> +#include <stdint.h>
>> +#include <inttypes.h>
>> +
>> +#include <rte_debug.h>
>> +#include <rte_interrupts.h>
>> +#include <rte_dev.h>
>> +
>> +
>> +struct rte_dpaa2_driver;
>> +/**
>> + * A structure describing a DPAA2 device.
>> + */
>> +struct rte_dpaa2_device {
>> + TAILQ_ENTRY(rte_dpaa2_device) next; /**< Next probed DPAA2 device. */
>> + struct rte_device device; /**< Inherit core device */
>> + uint16_t dev_type; /**< Device Type */
>> + uint16_t object_id; /**< DPAA2 Object ID */
>> + struct rte_intr_handle intr_handle; /**< Interrupt handle */
>> + struct rte_dpaa2_driver *driver; /**< Associated driver */
>> +};
>> +
>> +/**
>> + * A structure describing a DPAA2 driver.
>> + */
>> +struct rte_dpaa2_driver {
>> + TAILQ_ENTRY(rte_dpaa2_driver) next; /**< Next in list. */
>> + struct rte_driver driver; /**< Inherit core driver. */
>> + uint32_t drv_flags; /**< Flags contolling handling of device. */
>> +};
>> +
>> +/**
>> + * Register a DPAA2 driver.
>> + *
>> + * @param driver
>> + * A pointer to a rte_dpaa2_driver structure describing the driver
>> + * to be registered.
>> + */
>> +void rte_dpaa2_register(struct rte_dpaa2_driver *driver);
>> +
>> +/**
>> + * Unregister a DPAA2 driver.
>> + *
>> + * @param driver
>> + * A pointer to a rte_dpaa2_driver structure describing the driver
>> + * to be unregistered.
>> + */
>> +void rte_dpaa2_unregister(struct rte_dpaa2_driver *driver);
>> +
>> +/**
>> + *
>> + */
>> +int rte_dpaa2_probe(struct rte_driver *driver, struct rte_device *device);
>> +int rte_dpaa2_match(struct rte_driver *driver, struct rte_device *device);
>> +int rte_dpaa2_scan(struct rte_bus *bus);
>
> Shouldn't these functions be static?
agree, will fix it in v2
>
>> +
>> +/** Helper for DPAA2 device registration from driver (eth, crypto) instance */
>> +#define RTE_PMD_REGISTER_DPAA2(nm, dpaa2_drv) \
>> +RTE_INIT(dpaa2initfn_ ##nm); \
>> +static void dpaa2initfn_ ##nm(void) \
>> +{\
>> + (dpaa2_drv).driver.name = RTE_STR(nm);\
>> + rte_dpaa2_register(&dpaa2_drv); \
>> +} \
>> +RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
>> +
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _RTE_DPAA2_H_ */
>> diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
>> new file mode 100644
>> index 0000000..31eca32
>> --- /dev/null
>> +++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
>> @@ -0,0 +1,4 @@
>> +DPDK_17.02 {
>> +
>> + local: *;
>> +};
>> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
>> index f75f0e2..9e1c17c 100644
>> --- a/mk/rte.app.mk
>> +++ b/mk/rte.app.mk
>> @@ -101,6 +101,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile
>>
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt -lxenstore
>> +_LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += -lrte_pmd_dpaa2 -ldpaa2_mc -ldpaa2_qbman
>
> This should go within no shared library case (below), in a sorted manner
> please.
>
ok, will fix it in v2
> btw, for shared compilation, PMDs loaded dynamically, as plugins. For
> dpaa case, there will be multiple libraries, not if it will work with
> multiple -d params for each lib, it worth testing.
>
I will look into it.
>>
>> ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
>> # plugins (link only if static libraries)
>>
>
>
^ permalink raw reply
* Re: [PATCH 09/32] lib/ether: add rte_device in rte_eth_dev
From: Hemant Agrawal @ 2016-12-07 6:41 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: thomas.monjalon, bruce.richardson, shreyansh.jain
In-Reply-To: <dcc47c4e-7388-bd61-2d67-0376270e8693@intel.com>
On 12/7/2016 1:18 AM, Ferruh Yigit wrote:
> On 12/4/2016 6:17 PM, Hemant Agrawal wrote:
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>> lib/librte_ether/rte_ethdev.h | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
>> index 3c45a1f..6f5673f 100644
>> --- a/lib/librte_ether/rte_ethdev.h
>> +++ b/lib/librte_ether/rte_ethdev.h
>> @@ -1626,6 +1626,7 @@ struct rte_eth_dev {
>> eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function. */
>> eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */
>> struct rte_eth_dev_data *data; /**< Pointer to device data */
>> + struct rte_device *device;
>
> I believe this change should not be part of a PMD patchset. This change
> is more generic than the PMD.
>
> Won't Shreyansh's patch already do this?
I agree that this patch is not a fit for this PMD patchset, Shreyansh's
patch is not yet doing it. He will be taking care of it next.
So till Shreyansh provide the support, we need it.
>
>> const struct eth_driver *driver;/**< Driver for this device */
>> const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
>> struct rte_pci_device *pci_dev; /**< PCI info. supplied by probing */
>>
>
>
^ permalink raw reply
* Re: [PATCH 1/8] drivers/common/dpaa2: Run time assembler for Descriptor formation
From: Akhil Goyal @ 2016-12-07 6:24 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev@dpdk.org, declan.doherty@intel.com,
pablo.de.lara.guarch@intel.com, Hemant Agrawal, Horia Geantă
In-Reply-To: <5589636.gHNnFhEcxp@xps13>
-----Original Message-----
From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
Sent: Wednesday, December 07, 2016 1:53 AM
To: Akhil Goyal <akhil.goyal@nxp.com>; Horia Geantă <horia.geanta@nxp.com>
Cc: dev@dpdk.org; declan.doherty@intel.com; pablo.de.lara.guarch@intel.com; Hemant Agrawal <hemant.agrawal@nxp.com>
Subject: Re: [PATCH 1/8] drivers/common/dpaa2: Run time assembler for Descriptor formation
2016-12-05 18:25, Akhil Goyal:
> FLib is a library which helps in making the descriptors which is
> understood by NXP's SEC hardware.
> This patch provides header files for command words which can be used
> for descritptor formation.
It seems this code is old. Does it exist as a standalone library somewhere?
Where was it hosted before duplicating it in DPDK?
Why do you want to have a common directory drivers/common/dpaa2/flib instead of a sub-directory in the crypto driver?
[Akhil] This is not really a library. This is a set of header files which is required for compilation. We have 2 other cypto drivers (for different platforms viz: Non-DPAA and DPAA1_QORIQ) which uses the same flib. So we put it in common directory. We plan to send patches for other drivers in the upcoming releases.
^ permalink raw reply
* Re: [PATCH] vhost: optimize vhost memcpy
From: Wang, Zhihong @ 2016-12-07 6:11 UTC (permalink / raw)
To: Yuanhan Liu; +Cc: dev@dpdk.org, Thomas Monjalon
In-Reply-To: <20161205103709.GL24403@yliu-dev.sh.intel.com>
> -----Original Message-----
> From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> Sent: Monday, December 5, 2016 6:37 PM
> To: Wang, Zhihong <zhihong.wang@intel.com>
> Cc: dev@dpdk.org; Thomas Monjalon <thomas.monjalon@6wind.com>
> Subject: Re: [PATCH] vhost: optimize vhost memcpy
>
> On Mon, Dec 05, 2016 at 10:27:00AM +0000, Wang, Zhihong wrote:
> > > I like this function a lot, since it's really simple and straightforward!
> > > Moreover, it performs better.
> > >
> > > But, I don't quite like how this function is proposed:
> > >
> > > - rte_movX are more like internal help functions that should be used only
> > > in corresponding rte_memcpy.h file.
> > >
> > > - It's a good optimization, however, it will not benefit for other use
> > > cases, though vhost is the most typical case here.
> > >
> > > - The optimization proves to be good for X86, but think there is no
> > > guarantee it may behave well for other platforms, say ARM.
> > >
> > > I still would suggest you to go this way: move this function into x86's
> > > rte_memcpy.h and call it when the data is well aligned.
> >
> >
> > Do you mean to add something like rte_memcpy_aligned() in
> > lib/librte_eal/common/include/generic/rte_memcpy.h?
>
> Yes, but this one is not supposed to be exported as a public API.
> It should be called inside rte_memcpy (when data is well aligned).
> In this way, only rte_memcpy is exposed, and nothing else should
> be changed.
Yes I agree this is a better way to introduce this patch, I'll send out v2.
>
> --yliu
> >
> > I thought of this way before, and didn't choose it because it requires
> > changes in eal. But it would be a clean solution, I'd certainly like
> > to implement it this way if people are okay with it.
> >
> >
> > Thanks
> > Zhihong
> >
> >
> > >
> > > --yliu
^ permalink raw reply
* [PATCH v2 32/32] app/testpmd: fix invalid port ID
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark)
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
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 related
* [PATCH v2 31/32] net/i40e: enhance in sanity check of MAC
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
When VF sends request to add a new MAC address, PF host
will check if it's a non-zero or unicast address, or it
will return with error. In fact, VF still can set multicast
address. This change remove to check if it's a unicast
address.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
drivers/net/i40e/i40e_pf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 71e6a3f..79f4295 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -890,8 +890,8 @@
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 related
* [PATCH v2 30/32] net/i40e: support Linux VF to configure IRQ link list
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
i40e PF host only support to work with DPDK VF driver, Linux
VF driver is not supported. This change will enhance in
configuring IRQ link list.
This Change will identify VF client by number of vector
requested. DPDK VF will ask only single one while Linux VF
will request at least 2. It will have different configuration
for different clients. DPDK VF will be configured to link all
queue together, while Linux VF will be configured per request.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
drivers/net/i40e/i40e_pf.c | 151 +++++++++++++++++++++++++++++++++++++++++----
1 file changed, 138 insertions(+), 13 deletions(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 1ad5ed1..71e6a3f 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -585,14 +585,116 @@
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 related
* [PATCH v2 29/32] net/i40e: parse more VF parameter and configure
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
When VF requested to configure TX queue, a few parameters are
missed to be configured in PF host. This change have more
fields parsed and configured for TX context.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
drivers/net/i40e/i40e_pf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 8319c2c..1ad5ed1 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -422,10 +422,12 @@
/* 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 related
* [PATCH v2 28/32] net/i40e: return correct vsi_id
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
PF host didn't return correct VSI id to VF.
This change fix it.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
drivers/net/i40e/i40e_pf.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 0f582ed..8319c2c 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -351,8 +351,7 @@
/* 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 related
* [PATCH v2 25/32] app/testpmd: handle i40e in VF VLAN filter command
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
modify set_vf_rx_vlan function to handle the i40e PMD.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
app/test-pmd/config.c | 17 ++++++++++++++++-
1 file changed, 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 related
* [PATCH v2 27/32] net/i40e: change version number to support Linux VF
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
i40e PF host only support to work with DPDK VF driver, Linux
VF driver is not supported. This change will enhance in version
number returned.
Current version info returned won't be able to be recognized
by Linux VF driver, change to values that both DPDK VF and Linux
driver can recognize.
The expense is original DPDK host specific feature like
CFG_VLAN_PVID and CONFIG_VSI_QUEUES_EXT will not available.
DPDK VF also can't identify host driver by version number returned.
It always assume talking with Linux PF.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
drivers/net/i40e/i40e_pf.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 2bc3355..0f582ed 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -279,8 +279,19 @@
{
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 related
* [PATCH v2 26/32] app/testpmd: initialize receive mode for VMDq
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
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 related
* [PATCH v2 24/32] app/testpmd: add command to test VF VLAN tag on i40e
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@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 | 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 related
* [PATCH v2 23/32] app/testpmd: add command to test VF broadcast mode on i40e
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@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 | 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 related
* [PATCH v2 22/32] app/testpmd: use multicast promiscuous mode on i40e
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
Add testpmd CLI to set VF multicast promiscuous mode on i40e.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/cmdline.c | 86 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 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 related
* [PATCH v2 21/32] app/testpmd: use unicast promiscuous mode on i40e
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
Add testpmd CLI to set VF unicast promiscuous mode on i40e.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/cmdline.c | 92 +++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 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 related
* [PATCH v2 20/32] app/testpmd: use VFD APIs on i40e
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu, Chen Jing D(Mark), Bernard Iremonger
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
The new VF Daemon (VFD) APIs is implemented on i40e. Change
testpmd code to use them, including VF MAC anti-spoofing,
VF VLAN anti-spoofing, TX loopback, VF VLAN strip, VF VLAN
insert.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
app/test-pmd/Makefile | 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 related
* [PATCH v2 19/32] net/i40e: set VF VLAN filter from PF
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@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 | 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 related
* [PATCH v2 18/32] net/i40e: set VF VLAN tag from PF
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@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 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 related
* [PATCH v2 17/32] net/i40e: set VF broadcast mode from PF
From: Wenzhuo Lu @ 2016-12-07 3:32 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
Support enabling/disabling VF broadcast mode from PF.
User can call the API on PF to enable/disable a specific
VF's broadcast mode.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 43 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 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 related
* [PATCH v2 16/32] net/i40e: add set VF VLAN insert function
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com>
Support inserting VF VLAN id from PF.
User can call the API on PF to insert a VLAN id to a
specific VF.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 53 +++++++++++++++++++++++++++++++
drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++
drivers/net/i40e/rte_pmd_i40e_version.map | 1 +
3 files changed, 73 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 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 related
* [PATCH v2 15/32] net/i40e: add VF vlan strip func
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@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 | 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 related
* [PATCH v2 13/32] net/i40e: set VF MAC from VF support
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@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 | 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 related
* [PATCH v2 12/32] net/i40e: set VF MAC from PF support
From: Wenzhuo Lu @ 2016-12-07 3:31 UTC (permalink / raw)
To: dev; +Cc: Ferruh Yigit
In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@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 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 related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox