* Re: [PATCH 1/2] ethdev: fix name index in xstats Api
From: Remy Horton @ 2017-01-03 10:03 UTC (permalink / raw)
To: Olivier Matz, dev, thomas.monjalon; +Cc: stable
In-Reply-To: <1481881454-17382-1-git-send-email-olivier.matz@6wind.com>
Been away, hence the somewhat late review..
On 16/12/2016 09:44, Olivier Matz wrote:
[..]
> Today, each 'id' returned by rte_eth_xstats_get() is equal to the index
> in the returned array, making this value useless. It also prevents a
> driver from having different indexes for names and value, like in the
> example below:
My original intention was to give free reign over what id numbers are
used, but for reasons I've now forgotten the implementation ended up
making everything sequential.
> CC: stable@dpdk.org
> Fixes: bd6aa172cf35 ("ethdev: fetch extended statistics with integer ids")
>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Remy Horton <remy.horton@intel.com>
^ permalink raw reply
* Re: [PATCH v3 1/4] ethdev: add firmware information get
From: Yang, Qiming @ 2017-01-03 9:05 UTC (permalink / raw)
To: Yigit, Ferruh; +Cc: dev@dpdk.org, Horton, Remy, Thomas Monjalon
In-Reply-To: <10603884.vrshqR2O82@xps13>
Hi, Ferruh
Please see the question below. In my opinion, etrack_id is just a name used to define the ID of one NIC.
In kernel version ethtool, it will print this ID in the line of firmware verison.
I know what is etrack_id mean, but I really don't know why this named etrack_id.
Can you explain this question?
-----Original Message-----
From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
Sent: Tuesday, January 3, 2017 4:40 PM
To: Yang, Qiming <qiming.yang@intel.com>
Subject: Re: [PATCH v3 1/4] ethdev: add firmware information get
Please reply below the question and on the mailing list.
You'll have to explain why this name etrack_id.
2017-01-03 03:28, Yang, Qiming:
> Hi, Thomas
> etrack_id is not a terminology, it's decided by me.
> Which is store the unique number of the firmware.
> firmware-version: 5.04 0x800024ca
> 800024ca is the etrack_id of this NIC.
>
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Monday, January 2, 2017 11:39 PM
> To: Yang, Qiming <qiming.yang@intel.com>
> Cc: dev@dpdk.org; Horton, Remy <remy.horton@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [PATCH v3 1/4] ethdev: add firmware information get
>
> 2016-12-27 20:30, Qiming Yang:
> > /**
> > + * Retrieve the firmware version of a device.
> > + *
> > + * @param port_id
> > + * The port identifier of the device.
> > + * @param fw_major
> > + * A array pointer to store the major firmware version of a device.
> > + * @param fw_minor
> > + * A array pointer to store the minor firmware version of a device.
> > + * @param fw_patch
> > + * A array pointer to store the firmware patch number of a device.
> > + * @param etrack_id
> > + * A array pointer to store the nvm version of a device.
> > + */
> > +void rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major,
> > + uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id);
>
> I have a reserve about the naming etrack_id.
> Please could you point to a document explaining this ID?
> Is it known outside of Intel?
^ permalink raw reply
* Re: [PATCH v3 2/2] net/vhost: emulate device start/stop behavior
From: Yuanhan Liu @ 2017-01-03 8:29 UTC (permalink / raw)
To: Charles (Chas) Williams; +Cc: dev, mtetsuyah
In-Reply-To: <1483297317-20315-2-git-send-email-ciwillia@brocade.com>
On Sun, Jan 01, 2017 at 02:01:57PM -0500, Charles (Chas) Williams wrote:
> .dev_start()/.dev_stop() roughly corresponds to the local device's
> port being up or down. This is different from the remote client being
> connected which is roughtly link up or down. Emulate the behavior by
> separately tracking the local start/stop state to determine if we should
> allow packets to be queued to the remote client.
>
> Signed-off-by: Chas Williams <ciwillia@brocade.com>
> ---
> drivers/net/vhost/rte_eth_vhost.c | 65 ++++++++++++++++++++++++++++++++-------
> 1 file changed, 54 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index 6b11e40..d5a4540 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -100,7 +100,8 @@ struct vhost_stats {
>
> struct vhost_queue {
> int vid;
> - rte_atomic32_t allow_queuing;
> + rte_atomic32_t connected;
> + rte_atomic32_t ready;
> rte_atomic32_t while_queuing;
> struct pmd_internal *internal;
> struct rte_mempool *mb_pool;
> @@ -383,18 +384,25 @@ vhost_update_packet_xstats(struct vhost_queue *vq,
> }
> }
>
> +static inline bool
> +queuing_stopped(struct vhost_queue *r)
> +{
> + return unlikely(rte_atomic32_read(&r->connected) == 0 ||
> + rte_atomic32_read(&r->ready) == 0);
> +}
That's one more check comparing to the old code, meaning a bit more
expensive than before.
I think we could maintain the same effort by:
- introduce per-device "started" flag: set/unset on dev_start/stop,
respectively.
- introduce per-device "dev_attached" flag: set/unset on
new/destory_device(), respectively.
On update of each flag, setting "allow_queuing" properly.
Okay to you?
--yliu
^ permalink raw reply
* Re: [PATCH v3 16/33] drivers/pool/dpaa2: adding hw offloaded mempool
From: Hemant Agrawal @ 2017-01-03 8:22 UTC (permalink / raw)
To: Santosh Shukla, Shreyansh Jain
Cc: dev, thomas.monjalon, bruce.richardson, john.mcnamara,
ferruh.yigit, jerin.jacob
In-Reply-To: <20161229070807.GA7823@santosh-Latitude-E5530-non-vPro>
On 12/29/2016 12:38 PM, Santosh Shukla wrote:
> Hi Shreyansh,
>
> On Thu, Dec 29, 2016 at 10:46:35AM +0530, Shreyansh Jain wrote:
>> From: Hemant Agrawal <hemant.agrawal@nxp.com>
>>
>> Adding NXP DPAA2 architecture specific mempool support
>> Each mempool instance is represented by a DPBP object
>> from the FSL-MC bus.
>>
>> This patch also registers a dpaa2 type MEMPOOL OPS
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> ---
>> config/common_base | 1 +
>> config/defconfig_arm64-dpaa2-linuxapp-gcc | 4 +
>> drivers/Makefile | 1 +
>> drivers/bus/fslmc/Makefile | 2 +
>> drivers/bus/fslmc/fslmc_vfio.c | 9 +-
>> drivers/bus/fslmc/fslmc_vfio.h | 2 +
>> drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 137 +++++++++
>> drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 19 ++
>> drivers/bus/fslmc/rte_pmd_fslmcbus_version.map | 2 +
>> drivers/common/Makefile | 3 +
>> drivers/pool/Makefile | 38 +++
>> drivers/pool/dpaa2/Makefile | 67 +++++
>> drivers/pool/dpaa2/dpaa2_hw_mempool.c | 339 ++++++++++++++++++++++
>> drivers/pool/dpaa2/dpaa2_hw_mempool.h | 95 ++++++
>> drivers/pool/dpaa2/rte_pmd_dpaa2_pool_version.map | 8 +
>> mk/rte.app.mk | 1 +
>> 16 files changed, 727 insertions(+), 1 deletion(-)
>> create mode 100644 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
>> create mode 100644 drivers/pool/Makefile
>> create mode 100644 drivers/pool/dpaa2/Makefile
>> create mode 100644 drivers/pool/dpaa2/dpaa2_hw_mempool.c
>> create mode 100644 drivers/pool/dpaa2/dpaa2_hw_mempool.h
>> create mode 100644 drivers/pool/dpaa2/rte_pmd_dpaa2_pool_version.map
>>
>> diff --git a/config/common_base b/config/common_base
>> index d605e85..493811f 100644
>> --- a/config/common_base
>> +++ b/config/common_base
>> @@ -276,6 +276,7 @@ CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_MBOX=n
>> # Compile Support Libraries for NXP DPAA2
>> #
>> CONFIG_RTE_LIBRTE_DPAA2_COMMON=n
>> +CONFIG_RTE_LIBRTE_DPAA2_POOL=n
>>
>> #
>> # Compile NXP DPAA2 FSL-MC Bus
>> diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc
>> index d3bc9d8..7665912 100644
>> --- a/config/defconfig_arm64-dpaa2-linuxapp-gcc
>> +++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc
>> @@ -42,10 +42,14 @@ CONFIG_RTE_ARCH_ARM_TUNE="cortex-a57+fp+simd"
>> CONFIG_RTE_MAX_LCORE=8
>> CONFIG_RTE_MAX_NUMA_NODES=1
>>
>> +CONFIG_RTE_PKTMBUF_HEADROOM=256
>> +
>> #
>> # Compile Support Libraries for DPAA2
>> #
>> CONFIG_RTE_LIBRTE_DPAA2_COMMON=y
>> +CONFIG_RTE_LIBRTE_DPAA2_POOL=n
>> +CONFIG_RTE_MBUF_DEFAULT_MEMPOOL_OPS="dpaa2"
>>
>> #
>> # Compile NXP DPAA2 FSL-MC Bus
>> diff --git a/drivers/Makefile b/drivers/Makefile
>> index bdae63b..9fd268e 100644
>> --- a/drivers/Makefile
>> +++ b/drivers/Makefile
>> @@ -33,6 +33,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
>>
>> DIRS-y += common
>> DIRS-y += bus
>> +DIRS-y += pool
>> DIRS-y += net
>> DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
>>
>> diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile
>> index 1b815dd..35f30ad 100644
>> --- a/drivers/bus/fslmc/Makefile
>> +++ b/drivers/bus/fslmc/Makefile
>> @@ -47,6 +47,7 @@ CFLAGS += "-Wno-strict-aliasing"
>> CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc
>> CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc
>> CFLAGS += -I$(RTE_SDK)/drivers/common/dpaa2/qbman/include
>> +CFLAGS += -I$(RTE_SDK)/drivers/pool/dpaa2
>> CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
>>
>> # versioning export map
>> @@ -63,6 +64,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \
>> mc/mc_sys.c
>>
>> SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += portal/dpaa2_hw_dpio.c
>> +SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += portal/dpaa2_hw_dpbp.c
>> SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc_vfio.c
>> SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc_bus.c
>>
>> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
>> index ed0a8b9..4e47ec8 100644
>> --- a/drivers/bus/fslmc/fslmc_vfio.c
>> +++ b/drivers/bus/fslmc/fslmc_vfio.c
>> @@ -268,7 +268,7 @@ int fslmc_vfio_process_group(struct rte_bus *bus)
>> char path[PATH_MAX];
>> int64_t v_addr;
>> int ndev_count;
>> - int dpio_count = 0;
>> + int dpio_count = 0, dpbp_count = 0;
>> struct fslmc_vfio_group *group = &vfio_groups[0];
>> static int process_once;
>>
>> @@ -418,6 +418,11 @@ int fslmc_vfio_process_group(struct rte_bus *bus)
>> if (!ret)
>> dpio_count++;
>> }
>> + if (!strcmp(object_type, "dpbp")) {
>> + ret = dpaa2_create_dpbp_device(object_id);
>> + if (!ret)
>> + dpbp_count++;
>> + }
>> }
>> closedir(d);
>>
>> @@ -425,6 +430,8 @@ int fslmc_vfio_process_group(struct rte_bus *bus)
>> if (ret)
>> FSLMC_VFIO_LOG(DEBUG, "Error in affining qbman swp %d", ret);
>>
>> + FSLMC_VFIO_LOG(DEBUG, "DPAA2: Added dpbp_count = %d dpio_count=%d\n",
>> + dpbp_count, dpio_count);
>> return 0;
>>
>> FAILURE:
>> diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h
>> index e89d980..9bf69d4 100644
>> --- a/drivers/bus/fslmc/fslmc_vfio.h
>> +++ b/drivers/bus/fslmc/fslmc_vfio.h
>> @@ -76,4 +76,6 @@ int dpaa2_create_dpio_device(struct fslmc_vfio_device *vdev,
>> struct vfio_device_info *obj_info,
>> int object_id);
>>
>> +int dpaa2_create_dpbp_device(int dpbp_id);
>> +
>> #endif /* _FSLMC_VFIO_H_ */
>> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
>> new file mode 100644
>> index 0000000..16d5b24
>> --- /dev/null
>> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
>> @@ -0,0 +1,137 @@
>> +/*-
>> + * BSD LICENSE
>> + *
>> + * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
>> + * 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 Freescale Semiconductor, Inc 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 <unistd.h>
>> +#include <stdio.h>
>> +#include <sys/types.h>
>> +#include <string.h>
>> +#include <stdlib.h>
>> +#include <fcntl.h>
>> +#include <errno.h>
>> +
>> +#include <rte_malloc.h>
>> +#include <rte_memcpy.h>
>> +#include <rte_string_fns.h>
>> +#include <rte_cycles.h>
>> +#include <rte_kvargs.h>
>> +#include <rte_dev.h>
>> +#include <rte_ethdev.h>
>> +
>> +#include <fslmc_logs.h>
>> +#include <fslmc_vfio.h>
>> +#include <mc/fsl_dpbp.h>
>> +#include "portal/dpaa2_hw_pvt.h"
>> +#include "portal/dpaa2_hw_dpio.h"
>> +
>> +TAILQ_HEAD(dpbp_device_list, dpaa2_dpbp_dev);
>> +static struct dpbp_device_list *dpbp_dev_list; /*!< DPBP device list */
>> +
>> +int
>> +dpaa2_create_dpbp_device(
>> + int dpbp_id)
>> +{
>> + struct dpaa2_dpbp_dev *dpbp_node;
>> + int ret;
>> +
>> + if (!dpbp_dev_list) {
>> + dpbp_dev_list = malloc(sizeof(struct dpbp_device_list));
>> + if (!dpbp_dev_list) {
>> + PMD_INIT_LOG(ERR, "Memory alloc failed in DPBP list\n");
>> + return -1;
>> + }
>> + /* Initialize the DPBP List */
>> + TAILQ_INIT(dpbp_dev_list);
>> + }
>> +
>> + /* Allocate DPAA2 dpbp handle */
>> + dpbp_node = (struct dpaa2_dpbp_dev *)
>> + malloc(sizeof(struct dpaa2_dpbp_dev));
>> + if (!dpbp_node) {
>> + PMD_INIT_LOG(ERR, "Memory allocation failed for DPBP Device");
>> + return -1;
>> + }
>> +
>> + /* Open the dpbp object */
>> + dpbp_node->dpbp.regs = mcp_ptr_list[MC_PORTAL_INDEX];
>> + ret = dpbp_open(&dpbp_node->dpbp,
>> + CMD_PRI_LOW, dpbp_id, &dpbp_node->token);
>> + if (ret) {
>> + PMD_INIT_LOG(ERR, "Resource alloc failure with err code: %d",
>> + ret);
>> + free(dpbp_node);
>> + return -1;
>> + }
>> +
>> + /* Clean the device first */
>> + ret = dpbp_reset(&dpbp_node->dpbp, CMD_PRI_LOW, dpbp_node->token);
>> + if (ret) {
>> + PMD_INIT_LOG(ERR, "Failure cleaning dpbp device with"
>> + " error code %d\n", ret);
>> + return -1;
>> + }
>> +
>> + dpbp_node->dpbp_id = dpbp_id;
>> + rte_atomic16_init(&dpbp_node->in_use);
>> +
>> + TAILQ_INSERT_HEAD(dpbp_dev_list, dpbp_node, next);
>> +
>> + PMD_INIT_LOG(DEBUG, "Buffer pool resource initialized %d", dpbp_id);
>> +
>> + return 0;
>> +}
>> +
>> +struct dpaa2_dpbp_dev *dpaa2_alloc_dpbp_dev(void)
>> +{
>> + struct dpaa2_dpbp_dev *dpbp_dev = NULL;
>> +
>> + /* Get DPBP dev handle from list using index */
>> + TAILQ_FOREACH(dpbp_dev, dpbp_dev_list, next) {
>> + if (dpbp_dev && rte_atomic16_test_and_set(&dpbp_dev->in_use))
>> + break;
>> + }
>> +
>> + return dpbp_dev;
>> +}
>> +
>> +void dpaa2_free_dpbp_dev(struct dpaa2_dpbp_dev *dpbp)
>> +{
>> + struct dpaa2_dpbp_dev *dpbp_dev = NULL;
>> +
>> + /* Match DPBP handle and mark it free */
>> + TAILQ_FOREACH(dpbp_dev, dpbp_dev_list, next) {
>> + if (dpbp_dev == dpbp) {
>> + rte_atomic16_dec(&dpbp_dev->in_use);
>> + return;
>> + }
>> + }
>> +}
>> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
>> index ef3eb71..3b846a0 100644
>> --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
>> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
>> @@ -41,6 +41,13 @@
>> #define MC_PORTAL_INDEX 0
>> #define NUM_DPIO_REGIONS 2
>>
>> +#define MEMPOOL_F_HW_PKT_POOL 0x8000 /**< mpool flag to check offloaded pool */
>> +
>> +/* Maximum release/acquire from QBMAN */
>> +#define DPAA2_MBUF_MAX_ACQ_REL 7
>> +
>> +#define MAX_BPID 256
>> +
>> struct dpaa2_dpio_dev {
>> TAILQ_ENTRY(dpaa2_dpio_dev) next;
>> /**< Pointer to Next device instance */
>> @@ -63,6 +70,18 @@ struct dpaa2_dpio_dev {
>> int32_t hw_id; /**< An unique ID of this DPIO device instance */
>> };
>>
>> +struct dpaa2_dpbp_dev {
>> + TAILQ_ENTRY(dpaa2_dpbp_dev) next;
>> + /**< Pointer to Next device instance */
>> + struct fsl_mc_io dpbp; /** handle to DPBP portal object */
>> + uint16_t token;
>> + rte_atomic16_t in_use;
>> + uint32_t dpbp_id; /*HW ID for DPBP object */
>> +};
>> +
>> /*! Global MCP list */
>> extern void *(*mcp_ptr_list);
>> +struct dpaa2_dpbp_dev *dpaa2_alloc_dpbp_dev(void);
>> +void dpaa2_free_dpbp_dev(struct dpaa2_dpbp_dev *dpbp);
>> +
>> #endif
>> diff --git a/drivers/bus/fslmc/rte_pmd_fslmcbus_version.map b/drivers/bus/fslmc/rte_pmd_fslmcbus_version.map
>> index 4236377..76029b9 100644
>> --- a/drivers/bus/fslmc/rte_pmd_fslmcbus_version.map
>> +++ b/drivers/bus/fslmc/rte_pmd_fslmcbus_version.map
>> @@ -2,6 +2,8 @@ DPDK_17.02 {
>> global:
>>
>> dpaa2_affine_qbman_swp;
>> + dpaa2_alloc_dpbp_dev;
>> + dpaa2_free_dpbp_dev;
>> dpbp_disable;
>> dpbp_enable;
>> dpbp_get_attributes;
>> diff --git a/drivers/common/Makefile b/drivers/common/Makefile
>> index 434280f..0a6d8db 100644
>> --- a/drivers/common/Makefile
>> +++ b/drivers/common/Makefile
>> @@ -34,6 +34,9 @@ include $(RTE_SDK)/mk/rte.vars.mk
>> CONFIG_RTE_LIBRTE_DPAA2_COMMON = $(CONFIG_RTE_LIBRTE_DPAA2_PMD)
>>
>> ifneq ($(CONFIG_RTE_LIBRTE_DPAA2_COMMON),y)
>> +CONFIG_RTE_LIBRTE_DPAA2_COMMON = $(CONFIG_RTE_LIBRTE_DPAA2_POOL)
>> +endif
>> +ifneq ($(CONFIG_RTE_LIBRTE_DPAA2_COMMON),y)
>> CONFIG_RTE_LIBRTE_DPAA2_COMMON = $(CONFIG_RTE_LIBRTE_FSLMC_BUS)
>> endif
>>
>> diff --git a/drivers/pool/Makefile b/drivers/pool/Makefile
>> new file mode 100644
>> index 0000000..4325edd
>> --- /dev/null
>> +++ b/drivers/pool/Makefile
>> @@ -0,0 +1,38 @@
>> +# BSD LICENSE
>> +#
>> +# Copyright(c) 2016 NXP. 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 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
>> +
>> +CONFIG_RTE_LIBRTE_DPAA2_POOL = $(CONFIG_RTE_LIBRTE_DPAA2_PMD)
>> +
>> +DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += dpaa2
>> +
>> +include $(RTE_SDK)/mk/rte.subdir.mk
>> diff --git a/drivers/pool/dpaa2/Makefile b/drivers/pool/dpaa2/Makefile
>> new file mode 100644
>> index 0000000..9494756
>> --- /dev/null
>> +++ b/drivers/pool/dpaa2/Makefile
>> @@ -0,0 +1,67 @@
>> +# BSD LICENSE
>> +#
>> +# Copyright(c) 2016 NXP. 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 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_pool.a
>> +
>> +ifeq ($(CONFIG_RTE_LIBRTE_DPAA2_DEBUG_INIT),y)
>> +CFLAGS += -O0 -g
>> +CFLAGS += "-Wno-error"
>> +else
>> +CFLAGS += -O3
>> +CFLAGS += $(WERROR_FLAGS)
>> +endif
>> +
>> +CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc
>> +CFLAGS += -I$(RTE_SDK)/drivers/common/dpaa2/qbman/include
>> +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
>> +
>> +# versioning export map
>> +EXPORT_MAP := rte_pmd_dpaa2_pool_version.map
>> +
>> +# Lbrary version
>> +LIBABIVER := 1
>> +
>> +# all source are stored in SRCS-y
>> +#
>> +SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += dpaa2_hw_mempool.c
>> +
>> +# library dependencies
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += lib/librte_eal
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += lib/librte_mempool
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += lib/librte_pmd_dpaa2_qbman
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_COMMON) += lib/librte_pmd_fslmcbus
>> +
>> +include $(RTE_SDK)/mk/rte.lib.mk
>> diff --git a/drivers/pool/dpaa2/dpaa2_hw_mempool.c b/drivers/pool/dpaa2/dpaa2_hw_mempool.c
>> new file mode 100644
>> index 0000000..f36e909
>> --- /dev/null
>> +++ b/drivers/pool/dpaa2/dpaa2_hw_mempool.c
>> @@ -0,0 +1,339 @@
>> +/*-
>> + * BSD LICENSE
>> + *
>> + * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
>> + * 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 Freescale Semiconductor, Inc 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 <unistd.h>
>> +#include <stdio.h>
>> +#include <sys/types.h>
>> +#include <string.h>
>> +#include <stdlib.h>
>> +#include <fcntl.h>
>> +#include <errno.h>
>> +
>> +#include <rte_mbuf.h>
>> +#include <rte_ethdev.h>
>> +#include <rte_malloc.h>
>> +#include <rte_memcpy.h>
>> +#include <rte_string_fns.h>
>> +#include <rte_cycles.h>
>> +#include <rte_kvargs.h>
>> +#include <rte_dev.h>
>> +#include <rte_ethdev.h>
>> +
>> +#include <fslmc_logs.h>
>> +#include <mc/fsl_dpbp.h>
>> +#include <portal/dpaa2_hw_pvt.h>
>> +#include <portal/dpaa2_hw_dpio.h>
>> +#include "dpaa2_hw_mempool.h"
>> +
>> +struct dpaa2_bp_info bpid_info[MAX_BPID];
>> +static struct dpaa2_bp_list *h_bp_list;
>> +
>> +static int
>> +hw_mbuf_create_pool(struct rte_mempool *mp)
>> +{
>> + struct dpaa2_bp_list *bp_list;
>> + struct dpaa2_dpbp_dev *avail_dpbp;
>> + struct dpbp_attr dpbp_attr;
>> + uint32_t bpid;
>> + int ret;
>> +
>> + avail_dpbp = dpaa2_alloc_dpbp_dev();
>> +
>> + if (!avail_dpbp) {
>> + PMD_DRV_LOG(ERR, "DPAA2 resources not available");
>> + return -1;
>> + }
>> +
>> + if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
>> + ret = dpaa2_affine_qbman_swp();
>> + if (ret) {
>> + RTE_LOG(ERR, PMD, "Failure in affining portal\n");
>> + return 0;
>> + }
>> + }
>> +
>> + ret = dpbp_enable(&avail_dpbp->dpbp, CMD_PRI_LOW, avail_dpbp->token);
>> + if (ret != 0) {
>> + PMD_INIT_LOG(ERR, "Resource enable failure with"
>> + " err code: %d\n", ret);
>> + return -1;
>> + }
>> +
>> + ret = dpbp_get_attributes(&avail_dpbp->dpbp, CMD_PRI_LOW,
>> + avail_dpbp->token, &dpbp_attr);
>> + if (ret != 0) {
>> + PMD_INIT_LOG(ERR, "Resource read failure with"
>> + " err code: %d\n", ret);
>> + ret = dpbp_disable(&avail_dpbp->dpbp, CMD_PRI_LOW,
>> + avail_dpbp->token);
>> + return -1;
>> + }
>> +
>> + /* Allocate the bp_list which will be added into global_bp_list */
>> + bp_list = (struct dpaa2_bp_list *)malloc(sizeof(struct dpaa2_bp_list));
>> + if (!bp_list) {
>> + PMD_INIT_LOG(ERR, "No heap memory available");
>> + return -1;
>> + }
>> +
>> + /* Set parameters of buffer pool list */
>> + bp_list->buf_pool.num_bufs = mp->size;
>> + bp_list->buf_pool.size = mp->elt_size
>> + - sizeof(struct rte_mbuf) - rte_pktmbuf_priv_size(mp);
>> + bp_list->buf_pool.bpid = dpbp_attr.bpid;
>> + bp_list->buf_pool.h_bpool_mem = NULL;
>
> I am guessing that vfio-platform takes care of allocating memory to bman for
> buffer management (Beside mapping the platform resource) Or bman hw internally
> takes care and return a bpid handle to the application, right. Thus you don;t
> care for allocating mz area for this mempool.
>
No, that is not the case.
vfio-fsl-mc bus only manages the dpbp pools (mainly pool ids) for dpaa2
platform.
dpaa2_bp_list and buffer memory are all managed by the driver.
>> + bp_list->buf_pool.mp = mp;
>> + bp_list->buf_pool.dpbp_node = avail_dpbp;
>> + bp_list->next = h_bp_list;
>> +
>> + bpid = dpbp_attr.bpid;
>> +
>> +
>> + bpid_info[bpid].meta_data_size = sizeof(struct rte_mbuf)
>> + + rte_pktmbuf_priv_size(mp);
>> + bpid_info[bpid].bp_list = bp_list;
>> + bpid_info[bpid].bpid = bpid;
>> +
>> + mp->pool_data = (void *)&bpid_info[bpid];
>> +
>> + PMD_INIT_LOG(DEBUG, "BP List created for bpid =%d", dpbp_attr.bpid);
>> +
>> + h_bp_list = bp_list;
>> + /* Identification for our offloaded pool_data structure
>> + */
>> + mp->flags |= MEMPOOL_F_HW_PKT_POOL;
>> + return 0;
>> +}
>> +
>> +static void
>> +hw_mbuf_free_pool(struct rte_mempool *mp)
>> +{
>> + struct dpaa2_bp_info *bpinfo;
>> + struct dpaa2_bp_list *bp;
>> + struct dpaa2_dpbp_dev *dpbp_node;
>> +
>> + if (!mp->pool_data) {
>> + PMD_DRV_LOG(ERR, "Not a valid dpaa22 pool");
>> + return;
>> + }
>> +
>> + bpinfo = (struct dpaa2_bp_info *)mp->pool_data;
>> + bp = bpinfo->bp_list;
>> + dpbp_node = bp->buf_pool.dpbp_node;
>> +
>> + dpbp_disable(&(dpbp_node->dpbp), CMD_PRI_LOW, dpbp_node->token);
>> +
>> + if (h_bp_list == bp) {
>> + h_bp_list = h_bp_list->next;
>> + } else { /* if it is not the first node */
>> + struct dpaa2_bp_list *prev = h_bp_list, *temp;
>> + temp = h_bp_list->next;
>> + while (temp) {
>> + if (temp == bp) {
>> + prev->next = temp->next;
>> + free(bp);
>
> why not use rte_free()?
I see that rte_free/alloc are mostly for dmable memory or for
portability, which is not required here.
>
>> + break;
>> + }
>> + prev = temp;
>> + temp = temp->next;
>> + }
>> + }
>> +
>> + dpaa2_free_dpbp_dev(dpbp_node);
>> +}
>> +
>> +static
>> +void dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
>> + void * const *obj_table,
>> + uint32_t bpid,
>> + uint32_t meta_data_size,
>> + int count)
>> +{
>> + struct qbman_release_desc releasedesc;
>> + struct qbman_swp *swp;
>> + int ret;
>> + int i, n;
>> + uint64_t bufs[DPAA2_MBUF_MAX_ACQ_REL];
>> +
>> + if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
>> + ret = dpaa2_affine_qbman_swp();
>> + if (ret != 0) {
>> + RTE_LOG(ERR, PMD, "Failed to allocate IO portal");
>> + return;
>> + }
>> + }
>> + swp = DPAA2_PER_LCORE_PORTAL;
>> +
>> + /* Create a release descriptor required for releasing
>> + * buffers into QBMAN
>> + */
>> + qbman_release_desc_clear(&releasedesc);
>> + qbman_release_desc_set_bpid(&releasedesc, bpid);
>> +
>> + n = count % DPAA2_MBUF_MAX_ACQ_REL;
>> +
>> + /* convert mbuf to buffers for the remainder*/
>> + for (i = 0; i < n ; i++)
>> + bufs[i] = (uint64_t)obj_table[i] + meta_data_size;
>> +
>> + /* feed them to bman*/
>> + do {
>> + ret = qbman_swp_release(swp, &releasedesc, bufs, n);
>> + } while (ret == -EBUSY);
>> +
>> + /* if there are more buffers to free */
>> + while (n < count) {
>> + /* convert mbuf to buffers */
>> + for (i = 0; i < DPAA2_MBUF_MAX_ACQ_REL; i++)
>> + bufs[i] = (uint64_t)obj_table[n + i] + meta_data_size;
>> +
>> + do {
>> + ret = qbman_swp_release(swp, &releasedesc, bufs,
>> + DPAA2_MBUF_MAX_ACQ_REL);
>> + } while (ret == -EBUSY);
>> + n += DPAA2_MBUF_MAX_ACQ_REL;
>> + }
>> +}
>> +
>> +int hw_mbuf_alloc_bulk(struct rte_mempool *pool,
>> + void **obj_table, unsigned int count)
>> +{
>> +#ifdef RTE_LIBRTE_DPAA2_DEBUG_DRIVER
>> + static int alloc;
>> +#endif
>> + struct qbman_swp *swp;
>> + uint32_t mbuf_size;
>> + uint16_t bpid;
>> + uint64_t bufs[DPAA2_MBUF_MAX_ACQ_REL];
>> + int i, ret;
>> + unsigned int n = 0;
>> + struct dpaa2_bp_info *bp_info;
>> +
>> + bp_info = mempool_to_bpinfo(pool);
>> +
>> + if (!(bp_info->bp_list)) {
>> + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n");
>> + return -2;
>> + }
>> +
>> + bpid = bp_info->bpid;
>> +
>> + if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
>> + ret = dpaa2_affine_qbman_swp();
>> + if (ret != 0) {
>> + RTE_LOG(ERR, PMD, "Failed to allocate IO portal");
>> + return -1;
>> + }
>> + }
>> + swp = DPAA2_PER_LCORE_PORTAL;
>> +
>> + mbuf_size = sizeof(struct rte_mbuf) + rte_pktmbuf_priv_size(pool);
>> +
>> + while (n < count) {
>> + /* Acquire is all-or-nothing, so we drain in 7s,
>> + * then the remainder.
>> + */
>> + if ((count - n) > DPAA2_MBUF_MAX_ACQ_REL) {
>> + ret = qbman_swp_acquire(swp, bpid, bufs,
>> + DPAA2_MBUF_MAX_ACQ_REL);
>> + } else {
>> + ret = qbman_swp_acquire(swp, bpid, bufs,
>> + count - n);
>> + }
>> + /* In case of less than requested number of buffers available
>> + * in pool, qbman_swp_acquire returns 0
>> + */
>> + if (ret <= 0) {
>> + PMD_TX_LOG(ERR, "Buffer acquire failed with"
>> + " err code: %d", ret);
>> + /* The API expect the exact number of requested bufs */
>> + /* Releasing all buffers allocated */
>> + dpaa2_mbuf_release(pool, obj_table, bpid,
>> + bp_info->meta_data_size, n);
>> + return -1;
>> + }
>> + /* assigning mbuf from the acquired objects */
>> + for (i = 0; (i < ret) && bufs[i]; i++) {
>> + /* TODO-errata - observed that bufs may be null
>> + * i.e. first buffer is valid,
>> + * remaining 6 buffers may be null
>> + */
>> + obj_table[n] = (struct rte_mbuf *)(bufs[i] - mbuf_size);
>> + rte_mbuf_refcnt_set((struct rte_mbuf *)obj_table[n], 0);
>> + PMD_TX_LOG(DEBUG, "Acquired %p address %p from BMAN",
>> + (void *)bufs[i], (void *)obj_table[n]);
>> + n++;
>> + }
>> + }
>> +
>> +#ifdef RTE_LIBRTE_DPAA2_DEBUG_DRIVER
>> + alloc += n;
>> + PMD_TX_LOG(DEBUG, "Total = %d , req = %d done = %d",
>> + alloc, count, n);
>> +#endif
>> + return 0;
>> +}
>> +
>> +static int
>> +hw_mbuf_free_bulk(struct rte_mempool *pool,
>> + void * const *obj_table, unsigned int n)
>> +{
>> + struct dpaa2_bp_info *bp_info;
>> +
>> + bp_info = mempool_to_bpinfo(pool);
>> + if (!(bp_info->bp_list)) {
>> + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured");
>> + return -1;
>> + }
>> + dpaa2_mbuf_release(pool, obj_table, bp_info->bpid,
>> + bp_info->meta_data_size, n);
>> +
>> + return 0;
>> +}
>> +
>> +static unsigned
>> +hw_mbuf_get_count(const struct rte_mempool *mp __rte_unused)
>> +{
>> + return 0;
>> +}
>> +
>> +struct rte_mempool_ops dpaa2_mpool_ops = {
>> + .name = "dpaa2",
>> + .alloc = hw_mbuf_create_pool,
>> + .free = hw_mbuf_free_pool,
>> + .enqueue = hw_mbuf_free_bulk,
>> + .dequeue = hw_mbuf_alloc_bulk,
>> + .get_count = hw_mbuf_get_count,
>> +};
>> +
>> +MEMPOOL_REGISTER_OPS(dpaa2_mpool_ops);
>> diff --git a/drivers/pool/dpaa2/dpaa2_hw_mempool.h b/drivers/pool/dpaa2/dpaa2_hw_mempool.h
>> new file mode 100644
>> index 0000000..2cd2564
>> --- /dev/null
>> +++ b/drivers/pool/dpaa2/dpaa2_hw_mempool.h
>> @@ -0,0 +1,95 @@
>> +/*-
>> + * BSD LICENSE
>> + *
>> + * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
>> + * 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 Freescale Semiconductor, Inc 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 _DPAA2_HW_DPBP_H_
>> +#define _DPAA2_HW_DPBP_H_
>> +
>> +#define DPAA2_MAX_BUF_POOLS 8
>> +
>> +struct buf_pool_cfg {
>> + void *addr; /*!< The address from where DPAA2 will carve out the
>> + * buffers. 'addr' should be 'NULL' if user wants
>> + * to create buffers from the memory which user
>> + * asked DPAA2 to reserve during 'nadk init'
>> + */
>> + phys_addr_t phys_addr; /*!< corresponding physical address
>> + * of the memory provided in addr
>> + */
>> + uint32_t num; /*!< number of buffers */
>> + uint32_t size; /*!< size of each buffer. 'size' should include
>> + * any headroom to be reserved and alignment
>> + */
>> + uint16_t align; /*!< Buffer alignment (in bytes) */
>> + uint16_t bpid; /*!< The buffer pool id. This will be filled
>> + *in by DPAA2 for each buffer pool
>> + */
>> +};
>> +
>> +struct buf_pool {
>> + uint32_t size;
>> + uint32_t num_bufs;
>> + uint16_t bpid;
>> + uint8_t *h_bpool_mem;
>> + struct rte_mempool *mp;
>> + struct dpaa2_dpbp_dev *dpbp_node;
>> +};
>> +
>> +/*!
>> + * Buffer pool list configuration structure. User need to give DPAA2 the
>> + * valid number of 'num_buf_pools'.
>> + */
>> +struct dpaa2_bp_list_cfg {
>> + struct buf_pool_cfg buf_pool; /* Configuration of each buffer pool*/
>> +};
>> +
>
> isn't dpaa2_bp_list_cfg{} thus buf_pool_cfg{} redundant? I couldn't find
> struct used in this patch Or perhaps someother patch using them, If so then
> pl. ignore my comment.
>
Your comment is right, they are reduntant. we will clean it up, if we
are spinning a new version.
>> +struct dpaa2_bp_list {
>> + struct dpaa2_bp_list *next;
>> + struct rte_mempool *mp;
>> + struct buf_pool buf_pool;
>> +};
>> +
>> +struct dpaa2_bp_info {
>> + uint32_t meta_data_size;
>> + uint32_t bpid;
>> + struct dpaa2_bp_list *bp_list;
>> +};
>> +
>> +#define mempool_to_bpinfo(mp) ((struct dpaa2_bp_info *)(mp)->pool_data)
>> +#define mempool_to_bpid(mp) ((mempool_to_bpinfo(mp))->bpid)
>> +
>> +extern struct dpaa2_bp_info bpid_info[MAX_BPID];
>> +
>> +int hw_mbuf_alloc_bulk(struct rte_mempool *pool,
>> + void **obj_table, unsigned int count);
>> +
>> +#endif /* _DPAA2_HW_DPBP_H_ */
>> diff --git a/drivers/pool/dpaa2/rte_pmd_dpaa2_pool_version.map b/drivers/pool/dpaa2/rte_pmd_dpaa2_pool_version.map
>> new file mode 100644
>> index 0000000..289ab10
>> --- /dev/null
>> +++ b/drivers/pool/dpaa2/rte_pmd_dpaa2_pool_version.map
>> @@ -0,0 +1,8 @@
>> +DPDK_17.02 {
>> + global:
>> +
>> + bpid_info;
>> + hw_mbuf_alloc_bulk;
>> +
>> + local: *;
>> +};
>> diff --git a/mk/rte.app.mk b/mk/rte.app.mk
>> index 438fa2c..1bfb804 100644
>> --- a/mk/rte.app.mk
>> +++ b/mk/rte.app.mk
>> @@ -112,6 +112,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += -lrte_pmd_cxgbe
>> ifeq ($(CONFIG_RTE_LIBRTE_DPAA2_COMMON),y)
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += -lrte_pmd_dpaa2
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += -lrte_pmd_dpaa2_qbman
>> +_LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += -lrte_pmd_dpaa2_pool
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += -lrte_pmd_fslmcbus
>> endif
>> _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000
>> --
>> 2.7.4
>>
>
^ permalink raw reply
* Re: [PATCH v3 1/2] net/vhost: create datagram sockets immediately
From: Yuanhan Liu @ 2017-01-03 8:22 UTC (permalink / raw)
To: Charles (Chas) Williams; +Cc: dev, mtetsuyah
In-Reply-To: <1483297317-20315-1-git-send-email-ciwillia@brocade.com>
On Sun, Jan 01, 2017 at 02:01:56PM -0500, Charles (Chas) Williams wrote:
> If you create a vhost server device, it doesn't create the actual datagram
> socket until you call .dev_start(). If you call .dev_stop() is also
> deletes those sockets. For QEMU clients, this is a problem since QEMU
> doesn't know how to re-attach to datagram sockets that have gone away.
>
> To work around this, register and unregister the datagram sockets during
I will not call it's a "workaround", instead, it's a "fix" to me.
> device creation and removal.
>
> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
>
> Signed-off-by: Chas Williams <ciwillia@brocade.com>
> ---
> drivers/net/vhost/rte_eth_vhost.c | 43 ++++++++++++++++-----------------------
> 1 file changed, 17 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index 60b0f51..6b11e40 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -114,8 +114,6 @@ struct pmd_internal {
> char *iface_name;
> uint16_t max_queues;
> uint64_t flags;
I think the "flags" could also be dropped in this patch: no user any
more.
--yliu
^ permalink raw reply
* Re: [PATCH 2/2] vhost: start vhost servers once
From: Yuanhan Liu @ 2017-01-03 8:16 UTC (permalink / raw)
To: Charles (Chas) Williams; +Cc: dev, mtetsuyah
In-Reply-To: <be570b9e-8fe4-7b45-2598-9a44cd0fedf2@brocade.com>
On Fri, Dec 30, 2016 at 04:26:27PM -0500, Charles (Chas) Williams wrote:
>
>
> On 12/29/2016 10:15 PM, Yuanhan Liu wrote:
> >On Thu, Dec 29, 2016 at 10:58:11AM -0500, Charles (Chas) Williams wrote:
> >>On 12/29/2016 03:52 AM, Yuanhan Liu wrote:
> >>>On Wed, Dec 28, 2016 at 04:10:52PM -0500, Charles (Chas) Williams wrote:
> >>>>Start a vhost server once during devinit instead of during device start
> >>>>and stop. Some vhost clients, QEMU, don't re-attaching to sockets when
> >>>>the vhost server is stopped and later started. Preserve existing behavior
> >>>>for vhost clients.
> >>>
> >>>I didn't quite get the idea what you are going to fix.
> >>
> >>The issue I am trying to fix is QEMU interaction when DPDK's vhost is
> >>acting as a server to QEMU vhost clients. If you create a vhost server
> >>device, it doesn't create the actual datagram socket until you call
> >>.dev_start(). If you call .dev_stop() is also deletes those sockets.
> >>For QEMU, this is a problem since QEMU doesn't know how to re-attach to
> >>datagram sockets that have gone away.
> >
> >Thanks! And I'd appreciate it if you could have written the commit log
> >this way firstly.
> >
> >>.dev_start()/.dev_stop() seems to roughly means link up and link down
> >>so I understand why you might want to add/remove the datagram sockets.
> >>However, in practice, this doesn't seem to make much sense for a DPDK
> >>vhost server.
> >
> >Agree.
> >
> >>This doesn't seem like the right way to indicate link
> >>status to vhost clients.
> >>
> >>It seems like it would just be easier to do this for both clients and
> >>servers, but I don't know why it was done this way originally so I
> >>choose to keep the client behavior.
> >
> >I don't think there are any differences between DPDK acting as client or
> >server. To me, the right logic seems to be (for both DPDK as server and
> >client).
> >
> >For register,
> >- register the vhost socket at probe stage (either at rte_pmd_vhost_probe
> > or at eth_dev_vhost_create).
> >- start the vhost session right after the register when we haven't started
> > it before.
> >
> >For unregister,
> >- invoke rte_vhost_driver_unregister() at rte_pmd_vhost_remove().
>
> OK. This will be much easier than what I submitted.
Good.
>
> >For dev_start/stop,
> >- set allow_queuing to 1/0 for start/stop, respectively.
>
> Unfortunately, I don't think this will work. new_device() doesn't happen
> until a client connects. allow_queueing seems to be following the status
> of the "wire" as it where. .dev_start()/.dev_stop() is the link of local
> port connected to the wire (administratively up or down as it where).
>
> .dev_start() can happen before new_device() and attempting to RX for a
> client that doesn't exist doesn't seem like a good idea.
Right.
> Perhaps another
> flag that follows dev_started, but for the queues?
I will comment it on your v3 patches.
--yliu
^ permalink raw reply
* [PATCH 4/4] net/i40e: support Linux VF to configure IRQ link list
From: Chen Jing D(Mark) @ 2017-01-03 0:59 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, vincent.jardin, jingjing.wu, Chen Jing D(Mark)
In-Reply-To: <1483405159-9237-1-git-send-email-jing.d.chen@intel.com>
i40e PF host only support to work with DPDK VF driver, Linux
VF driver is not supported. This change will enhance in
configuring IRQ link list.
This Change will identify VF client by number of vector
requested. DPDK VF will ask only single one while Linux VF
will request at least 2. It will have different configuration
for different clients. DPDK VF will be configured to link all
queue together, while Linux VF will be configured per request.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
drivers/net/i40e/i40e_pf.c | 151 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 138 insertions(+), 13 deletions(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 75c5f03..eee5e85 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -552,13 +552,115 @@
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)
{
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 (msg == NULL || msglen < sizeof(struct i40e_virtchnl_irq_map_info)) {
PMD_DRV_LOG(ERR, "buffer too short");
@@ -566,23 +668,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.7.7.6
^ permalink raw reply related
* [PATCH 3/4] net/i40e: parse more VF parameter and configure
From: Chen Jing D(Mark) @ 2017-01-03 0:59 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, vincent.jardin, jingjing.wu, Chen Jing D(Mark)
In-Reply-To: <1483405159-9237-1-git-send-email-jing.d.chen@intel.com>
When VF requested to configure TX queue, a few parameters are
missed to be configured in PF host. This change have more
fields parsed and configured for TX context.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
drivers/net/i40e/i40e_pf.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 5314d9f..75c5f03 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -406,10 +406,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.7.7.6
^ permalink raw reply related
* [PATCH 2/4] net/i40e: return correct VSI id
From: Chen Jing D(Mark) @ 2017-01-03 0:59 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, vincent.jardin, jingjing.wu, Chen Jing D(Mark)
In-Reply-To: <1483405159-9237-1-git-send-email-jing.d.chen@intel.com>
PF host didn't return correct VSI id to VF.
This change fix it.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
drivers/net/i40e/i40e_pf.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 229f71a..5314d9f 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -335,8 +335,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.7.7.6
^ permalink raw reply related
* [PATCH 1/4] net/i40e: change version number to support Linux VF
From: Chen Jing D(Mark) @ 2017-01-03 0:59 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, vincent.jardin, jingjing.wu, Chen Jing D(Mark)
In-Reply-To: <1483405159-9237-1-git-send-email-jing.d.chen@intel.com>
i40e PF host only support to work with DPDK VF driver, Linux
VF driver is not supported. This change will enhance in version
number returned.
Current version info returned won't be able to be recognized
by Linux VF driver, change to values that both DPDK VF and Linux
driver can recognize.
The expense is original DPDK host specific feature like
CFG_VLAN_PVID and CONFIG_VSI_QUEUES_EXT will not available.
DPDK VF also can't identify host driver by version number returned.
It always assume talking with Linux PF.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
drivers/net/i40e/i40e_pf.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 97b8ecc..229f71a 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -278,8 +278,20 @@
{
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;
+
i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
I40E_SUCCESS, (uint8_t *)&info, sizeof(info));
}
--
1.7.7.6
^ permalink raw reply related
* [PATCH 0/4] enhancement to i40e PF host driver
From: Chen Jing D(Mark) @ 2017-01-03 0:59 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, vincent.jardin, jingjing.wu, Chen Jing D(Mark)
Current PF host driver can serve DPDK VF well, but the
implementation is not complete to support Linux VF,
even both DPDK VF and Linux VF use same API set.
This patch set made below changes:
1. Make an enhancement on interface to serve VF, so
both Linux and DPDK VF can be well served.
2. Change API version number so both DPDK and Linux
VF can recognize and select proper command and
data structure to request service. But the
sacrifice is DPDK VF can't identify host driver
(Linux or DPDK) and extended function provided
in DPDK PF host driver can't be used.
This situation will change after negotiate with
Linux maintainer to provide a better mechanism
to identify both PF and VF function.
Chen Jing D(Mark) (4):
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
drivers/net/i40e/i40e_pf.c | 174 +++++++++++++++++++++++++++++++++++++++-----
1 files changed, 156 insertions(+), 18 deletions(-)
--
1.7.7.6
^ permalink raw reply
* Re: [PATCH v2 14/29] eal/arm64: change barrier definitions to macros
From: Jianbo Liu @ 2017-01-03 7:55 UTC (permalink / raw)
To: Jerin Jacob
Cc: dev, Ananyev, Konstantin, Thomas Monjalon, Bruce Richardson,
Jan Viktorin, Santosh Shukla
In-Reply-To: <1482832175-27199-15-git-send-email-jerin.jacob@caviumnetworks.com>
On 27 December 2016 at 17:49, Jerin Jacob
<jerin.jacob@caviumnetworks.com> wrote:
> Change rte_?wb definitions to macros in order to
use rte_*mb?
> keep consistent with other barrier definitions in
> the file.
>
> Suggested-by: Jianbo Liu <jianbo.liu@linaro.org>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
> .../common/include/arch/arm/rte_atomic_64.h | 36 ++--------------------
> 1 file changed, 3 insertions(+), 33 deletions(-)
>
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
> index ef0efc7..dc3a0f3 100644
> --- a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
> +++ b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
> @@ -46,41 +46,11 @@ extern "C" {
> #define dsb(opt) { asm volatile("dsb " #opt : : : "memory"); }
> #define dmb(opt) { asm volatile("dmb " #opt : : : "memory"); }
>
> -/**
> - * General memory barrier.
> - *
> - * Guarantees that the LOAD and STORE operations generated before the
> - * barrier occur before the LOAD and STORE operations generated after.
> - * This function is architecture dependent.
> - */
> -static inline void rte_mb(void)
> -{
> - dsb(sy);
> -}
> +#define rte_mb() dsb(sy)
>
> -/**
> - * Write memory barrier.
> - *
> - * Guarantees that the STORE operations generated before the barrier
> - * occur before the STORE operations generated after.
> - * This function is architecture dependent.
> - */
> -static inline void rte_wmb(void)
> -{
> - dsb(st);
> -}
> +#define rte_wmb() dsb(st)
>
> -/**
> - * Read memory barrier.
> - *
> - * Guarantees that the LOAD operations generated before the barrier
> - * occur before the LOAD operations generated after.
> - * This function is architecture dependent.
> - */
How about keep the comments for all these macros?
> -static inline void rte_rmb(void)
> -{
> - dsb(ld);
> -}
> +#define rte_rmb() dsb(ld)
>
> #define rte_smp_mb() dmb(ish)
>
> --
> 2.5.5
>
^ permalink raw reply
* Re: [PATCH v2 09/29] eal/arm64: define I/O device memory barriers for arm64
From: Jianbo Liu @ 2017-01-03 7:48 UTC (permalink / raw)
To: Jerin Jacob
Cc: dev, Ananyev, Konstantin, Thomas Monjalon, Bruce Richardson,
Jan Viktorin, Santosh Shukla
In-Reply-To: <1482832175-27199-10-git-send-email-jerin.jacob@caviumnetworks.com>
On 27 December 2016 at 17:49, Jerin Jacob
<jerin.jacob@caviumnetworks.com> wrote:
> CC: Jianbo Liu <jianbo.liu@linaro.org>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
> lib/librte_eal/common/include/arch/arm/rte_atomic_64.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
> index 78ebea2..ef0efc7 100644
> --- a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
> +++ b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
> @@ -88,6 +88,12 @@ static inline void rte_rmb(void)
>
> #define rte_smp_rmb() dmb(ishld)
>
> +#define rte_io_mb() rte_mb()
> +
> +#define rte_io_wmb() rte_wmb()
> +
> +#define rte_io_rmb() rte_rmb()
> +
I think it's better to use outer shareable dmb for io barrier, instead of dsb.
^ permalink raw reply
* Re: [PATCH v2 07/29] eal/arm64: fix memory barrier definition for arm64
From: Jianbo Liu @ 2017-01-03 7:40 UTC (permalink / raw)
To: Jerin Jacob
Cc: dev, Ananyev, Konstantin, Thomas Monjalon, Bruce Richardson,
Jan Viktorin, Santosh Shukla, stable
In-Reply-To: <1482832175-27199-8-git-send-email-jerin.jacob@caviumnetworks.com>
On 27 December 2016 at 17:49, Jerin Jacob
<jerin.jacob@caviumnetworks.com> wrote:
> dsb instruction based barrier is used for non smp
> version of memory barrier.
>
> Fixes: d708f01b7102 ("eal/arm: add atomic operations for ARMv8")
>
> CC: Jianbo Liu <jianbo.liu@linaro.org>
> CC: stable@dpdk.org
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
> lib/librte_eal/common/include/arch/arm/rte_atomic_64.h | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
> index d854aac..bc7de64 100644
> --- a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
> +++ b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
> @@ -43,7 +43,8 @@ extern "C" {
>
> #include "generic/rte_atomic.h"
>
> -#define dmb(opt) do { asm volatile("dmb " #opt : : : "memory"); } while (0)
> +#define dsb(opt) { asm volatile("dsb " #opt : : : "memory"); }
> +#define dmb(opt) { asm volatile("dmb " #opt : : : "memory"); }
>
> /**
> * General memory barrier.
> @@ -54,7 +55,7 @@ extern "C" {
> */
> static inline void rte_mb(void)
> {
> - dmb(ish);
> + dsb(sy);
> }
>
> /**
> @@ -66,7 +67,7 @@ static inline void rte_mb(void)
> */
> static inline void rte_wmb(void)
> {
> - dmb(ishst);
> + dsb(st);
> }
>
> /**
> @@ -78,7 +79,7 @@ static inline void rte_wmb(void)
> */
> static inline void rte_rmb(void)
> {
> - dmb(ishld);
> + dsb(ld);
> }
>
> #define rte_smp_mb() rte_mb()
> --
> 2.5.5
>
Acked-by: Jianbo Liu <jianbo.liu@linaro.org>
^ permalink raw reply
* Re: reassembly app doesn't send pkt
From: 陆秋文 @ 2017-01-03 7:34 UTC (permalink / raw)
To: Victor Detoni; +Cc: dev
In-Reply-To: <CANpwN=uK9OWn=Kpzoos9_EZRFrWVz8Z+9qm09yK8hiALuTOEpQ@mail.gmail.com>
Hi,
I have the same problem using 82599. When I sent a mbuf with multi-segment,
the 82599 driver's tx_burst fuction
will return 0, which means no packet sent.
I have no solution. Some 82599 NICs can send these packet successfully, but
some will fail.
?? I think this problem may related to vendor or firmware.
2016-11-12 21:29 GMT+08:00 Victor Detoni <victordetoni@gmail.com>:
> Hi,
>
> When I test ip_reassembly app on vmxnet3 nic works fine, but when I change
> to the nics 82599ES 10-Gigabit SFI/SFP+, it stop to send the packet
> "reassembled" on tx nic.
>
> when I remove the code bellow on rte_ipv4_reassembly.c source code, it
> sends pkt but truncated.
>
> rte_pktmbuf_chain(fp->frags[IP_FIRST_FRAG_IDX].mb, m);
>
> Anybody has some tip? I printed all functions like send_single_packet and
> send_burst and it seems Ok, when I compare ping pkt and udp frag pkt.
>
^ permalink raw reply
* Deadlock in rte_mempool using multi-process shared memory
From: 陆秋文 @ 2017-01-03 7:10 UTC (permalink / raw)
To: dev
Hi,
I have some process running in DPDK which uses DPDK multi-process feature
to communicate. Master process captures packets from NIC and put them to a
ring buffer, which is shared between master and slave process. Sometimes,
slave process use rte_pktmbuf_alloc() to alloc pktmbuf from the shared
mempool, and send to master process by a ring buffer.
However, when slave process exit by accident(recv a SIGTERM signal), the
thread in slave process which using the shared mempool(such as calling
rte_pktmbuf_alloc()) may cause wrong state in a few cases, and other thread
use the mempool may fall into deadlock. like this:
static inline int __attribute__((always_inline))
__rte_ring_mc_do_dequeue(struct rte_ring *r, void **obj_table,
unsigned n, enum rte_ring_queue_behavior behavior)
{
.................
/*
* If there are other dequeues in progress that preceded us,
* we need to wait for them to complete
*/
while (unlikely(r->cons.tail != cons_head)) { ============ this
condition cannot be satisfied forever.
rte_pause(); ============
thread may spin at this line.
/* Set RTE_RING_PAUSE_REP_COUNT to avoid spin too long waiting
* for other thread finish. It gives pre-empted thread a chance
* to proceed and finish with ring dequeue operation. */
if (RTE_RING_PAUSE_REP_COUNT &&
++rep == RTE_RING_PAUSE_REP_COUNT) {
rep = 0;
sched_yield();
}
}
__RING_STAT_ADD(r, deq_success, n);
r->cons.tail = cons_next;
.......................
}
I tried to enable RTE_RING_PAUSE_REP_COUNT, but it has no effect.
What I can do? Thanks a lot!
Qiuwen
2017/1/3
^ permalink raw reply
* Re: [PATCH v2 8/9] examples/l3fwd: add parse-ptype option
From: Yuanhan Liu @ 2017-01-03 6:59 UTC (permalink / raw)
To: Tan, Jianfeng; +Cc: dev@dpdk.org, stephen@networkplumber.org, Thomas Monjalon
In-Reply-To: <ED26CBA2FAD1BF48A8719AEF02201E3651102F09@SHSMSX103.ccr.corp.intel.com>
On Fri, Dec 30, 2016 at 07:30:19AM +0000, Tan, Jianfeng wrote:
> Hi,
>
> > -----Original Message-----
> > From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> > Sent: Friday, December 30, 2016 2:40 PM
> > To: Tan, Jianfeng
> > Cc: dev@dpdk.org; stephen@networkplumber.org
> > Subject: Re: [PATCH v2 8/9] examples/l3fwd: add parse-ptype option
> >
> > On Thu, Dec 29, 2016 at 07:30:42AM +0000, Jianfeng Tan wrote:
> > > To support those devices that do not provide packet type info when
> > > receiving packets, add a new option, --parse-ptype, to analyze
> > > packet type in the Rx callback.
> >
> > I think this would be needed for all PMD drivers don't have the PTYPE
> > support. For these, --parse-ptype looks like a mandatory option in
> > the l3fwd example. I didn't find such option given in your test guide
> > though, which is weird. Mistake?
>
> Oops, my fault, it should be used with this option. As I just cared about if packets are received, instead of what types of packets are received, so I missed that. I'll fix it.
>
> >
> > Besides that, is there a way to query whether a PMD supports PTYPE
> > or not?
>
> Yes, we have API rte_eth_dev_get_supported_ptypes() to do that. This patch is to emulate the commit 71a7e2424e07 ("examples/l3fwd: fix using packet type blindly").
>
> As we talked offline, I'll leverage this API to query if device support needed ptypes, if not, register callback to analysis ptypes. This avoids to use another option.
...
> But for record, this also leads to un-consistent behavior with l3fwd.
Yes, and I think we should keep it consistent to l3fwd and all its
variants. Just think it this way: those variants don't do that will
not work with virtio PMD (and others don't have the PTYPE support).
That said, you could split this patch set to two sets: one for
adding the support of virtio interrupt, another one for fixing the
l3fwd (and its variants) for some PMDs don't have PTYPE support.
OTOH, that's the typical issue we will meet when we make same code
multiple copies, one for demonstrating one specific feature (or
something like that): it's a bit painful if we need change something
common in all copies.
--yliu
^ permalink raw reply
* [PATCH v7 27/27] app/testpmd: add command to configure VMDq
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1483426488-117332-1-git-send-email-wenzhuo.lu@intel.com>
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 related
* [PATCH v7 25/27] net/i40e: set/clear VF stats from PF
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Qi Zhang
In-Reply-To: <1483426488-117332-1-git-send-email-wenzhuo.lu@intel.com>
From: Qi Zhang <qi.z.zhang@intel.com>
This patch add support to get/clear VF statistics
from PF side.
Two APIs are added:
rte_pmd_i40e_get_vf_stats.
rte_pmd_i40e_reset_vf_stats.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 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 related
* [PATCH v7 24/27] net/i40e: enhance in sanity check of MAC
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Chen Jing D(Mark)
In-Reply-To: <1483426488-117332-1-git-send-email-wenzhuo.lu@intel.com>
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
When VF sends request to add a new MAC address, PF host
will check if it's a non-zero or unicast address, or it
will return with error. In fact, VF still can set multicast
address. This change remove to check if it's a unicast
address.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
drivers/net/i40e/i40e_pf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 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 related
* [PATCH v7 23/27] app/testpmd: handle i40e in VF VLAN filter command
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1483426488-117332-1-git-send-email-wenzhuo.lu@intel.com>
From: Bernard Iremonger <bernard.iremonger@intel.com>
modify set_vf_rx_vlan function to handle the i40e PMD.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
app/test-pmd/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 related
* [PATCH v7 22/27] app/testpmd: add command to test VF VLAN tag on i40e
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1483426488-117332-1-git-send-email-wenzhuo.lu@intel.com>
From: Bernard Iremonger <bernard.iremonger@intel.com>
command is: set vf vlan tag port_id vf_id on|off
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
app/test-pmd/cmdline.c | 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 related
* [PATCH v7 19/27] app/testpmd: use unicast promiscuous mode on i40e
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
In-Reply-To: <1483426488-117332-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 | 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 related
* [PATCH v7 21/27] app/testpmd: add command to test VF broadcast mode on i40e
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Bernard Iremonger
In-Reply-To: <1483426488-117332-1-git-send-email-wenzhuo.lu@intel.com>
From: Bernard Iremonger <bernard.iremonger@intel.com>
Add command to call rte_pmd_i40e_set_vf_broadcast.
Add set vf broadcast in testpmd_funcs.rst file.
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
app/test-pmd/cmdline.c | 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 related
* [PATCH v7 20/27] app/testpmd: use multicast promiscuous mode on i40e
From: Wenzhuo Lu @ 2017-01-03 6:54 UTC (permalink / raw)
To: dev; +Cc: Wenzhuo Lu
In-Reply-To: <1483426488-117332-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 | 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 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