[dpdk-dev] [PATCH v6 1/8] qede: Add maintainers, documentation and license

2016-04-27 Thread Rasesh Mody
> From: Mcnamara, John [mailto:john.mcnamara at intel.com]
> Sent: Tuesday, April 26, 2016 8:50 AM
> 
> Hi,
> 
> Thanks for the documentation.
> 
> In general you should generate and view the Html output to make sure
> everything is okay:
> 
> make doc-guides-html
> firefox build/doc/html/guides/nics/qede.html &
> 
> Other comments below.

Thanks John for your comprehensive feedback on documentation.


[dpdk-dev] [PATCH v6 2/8] qede: Add base driver

2016-04-27 Thread Rasesh Mody
> From: Bruce Richardson [mailto:bruce.richardson at intel.com]
> Sent: Tuesday, April 26, 2016 6:02 AM
> 
> On Mon, Apr 25, 2016 at 10:13:00PM -0700, Rasesh Mody wrote:
> > The base driver is the backend module for the QLogic FastLinQ QL4
> > 25G/40G CNA family of adapters as well as their virtual functions (VF)
> > in SR-IOV context.
> >
> > The purpose of the base module is to:
> >  - provide all the common code that will be shared between the various
> >drivers that would be used with said line of products. Flows such as
> >chip initialization and de-initialization fall under this category.
> >  - abstract the protocol-specific HW & FW components, allowing the
> >protocol drivers to have clean APIs, which are detached in its
> >slowpath configuration from the actual Hardware Software
> Interface(HSI).
> >
> > This patch adds a base module without any protocol-specific bits.
> > I.e., this adds a basic implementation that almost entirely falls
> > under the first category.
> >
> > Signed-off-by: Harish Patil 
> > Signed-off-by: Rasesh Mody 
> > Signed-off-by: Sony Chacko 
> > ---
> 
> 
> 
> > +#
> > +# CLANG VERSION
> > +#
> > +IS_CLANG_GT_362 := $(shell \
> > +   CLANG_MAJOR=`echo | clang -dM -E - 2>/dev/null |
> grep clang_major | cut -d" " -f3`; \
> > +   CLANG_MINOR=`echo | clang -dM -E - 2>/dev/null |
> grep clang_minor | cut -d" " -f3`; \
> > +   CLANG_PATCH=`echo | clang -dM -E - 2>/dev/null |
> grep clang_patch | cut -d" " -f3`; \
> > +   if [ "0$$CLANG_MAJOR" -gt "03" ]; then \
> > +   echo 1; \
> > +   elif [ "0$$CLANG_MAJOR" -eq "03" -a
> "0$$CLANG_MINOR" -gt "06" ]; then \
> > +   echo 1; \
> > +   elif [ "0$$CLANG_MAJOR" -eq "03" -a
> "0$$CLANG_MINOR" -eq "06" -a "0$$CLANG_PATCH" -gt "02" ]; then \
> > +   echo 1; \
> > +   fi)
> > +
> 
> While the clang version seems something that might be generally useful, this
> seems a long way of doing things just to see what compiler warning flag you
> need to set. How about just testing with clang to see if you get an error with
> the new flag or not.

Will address this, thanks.

> 
> For example, on Fedora 23 (clang 3.7):
> 
>   bruce at Fedora:dpdk-next-net$ clang -Wno-shift-negative-value -Werror -E
> - < /dev/null > /dev/null 2>&1
>   bruce at Fedora:dpdk-next-net$ echo $?
>   0
> 
> While the same commands on FreeBSD 10.3 (clang 3.4):
> 
>   bruce at bsd10:~$ clang -Wno-shift-negative-value -Werror -E - < /dev/null >
> /dev/null 2>&1
>   bruce at bsd10:~$ echo $?
>   1
> 
> > +#
> > +# CFLAGS
> > +#
> > +CFLAGS_BASE_DRIVER = -Wno-unused-parameter CFLAGS_BASE_DRIVER
> +=
> > +-Wno-unused-value CFLAGS_BASE_DRIVER += -Wno-sign-compare
> > +CFLAGS_BASE_DRIVER += -Wno-missing-prototypes
> CFLAGS_BASE_DRIVER +=
> > +-Wno-cast-qual CFLAGS_BASE_DRIVER += -Wno-unused-function
> > +CFLAGS_BASE_DRIVER += -Wno-unused-variable CFLAGS_BASE_DRIVER
> +=
> > +-Wno-strict-aliasing CFLAGS_BASE_DRIVER += -Wno-missing-prototypes
> > +CFLAGS_BASE_DRIVER += -Wno-format-nonliteral ifeq
> ($(OS_TYPE),Linux)
> > +ifeq ($(IS_CLANG_GT_362),1) CFLAGS_BASE_DRIVER +=
> > +-Wno-shift-negative-value # Support added after clang 3.6 else
> > +CFLAGS_BASE_DRIVER += -Wno-shift-sign-overflow endif endif
> > +
> 
> 


[dpdk-dev] [PATCH v2] vhost: Fix linkage of vhost PMD

2016-04-27 Thread Tetsuya Mukawa
On 2016/04/26 18:35, Panu Matilainen wrote:
> On 04/26/2016 08:39 AM, Tetsuya Mukawa wrote:
>> Currently, vhost PMD doesn't have linkage for librte_vhost, even though
>> it depends on librte_vhost APIs. This causes a linkage error if below
>> conditions are fulfilled.
>>
>>  - DPDK libraries are compiled as shared libraries.
>>  - DPDK application doesn't link librte_vhost.
>>  - Above application tries to link vhost PMD using '-d' DPDK option.
>>
>> The patch adds linkage for librte_vhost to vhost PMD not to cause an
>> above error.
>>
>> Signed-off-by: Tetsuya Mukawa 
>> Acked-by: Panu Matilainen 
>> ---
>>  drivers/net/vhost/Makefile | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile
>> index f49a69b..30b91a0 100644
>> --- a/drivers/net/vhost/Makefile
>> +++ b/drivers/net/vhost/Makefile
>> @@ -38,6 +38,7 @@ LIB = librte_pmd_vhost.a
>>
>>  CFLAGS += -O3
>>  CFLAGS += $(WERROR_FLAGS)
>> +LDLIBS += -lrte_vhost
>>
>>  EXPORT_MAP := rte_pmd_vhost_version.map
>>
>>
>
> Hmm, turns out this isn't quite enough, simply because its the first
> of its kind (first internal dependency between libraries), at least
> I'm getting:
>
> == Build drivers/net/vhost
> gcc -m64
> -Wl,--version-script=/srv/work/dist/dpdk/dpdk-16.04/drivers/net/vhost/rte_pmd_vhost_version.map
>  -shared rte_eth_vhost.o -lrte_vhost -Wl,-soname,librte_pmd_vhost.so.1
> -o librte_pmd_vhost.so.1
> /usr/bin/ld: cannot find -lrte_vhost
> collect2: error: ld returned 1 exit status
> /srv/work/dist/dpdk/dpdk-16.04/mk/rte.lib.mk:127: recipe for target
> 'librte_pmd_vhost.so.1' failed
>
> So it'll need something like this as a pre-requisite to add the
> internal libraries to the linker path:
>
> diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
> index 8f7e021..f5d7b04 100644
> --- a/mk/rte.lib.mk
> +++ b/mk/rte.lib.mk
> @@ -86,7 +86,7 @@ O_TO_A_DO = @set -e; \
> $(O_TO_A) && \
> echo $(O_TO_A_CMD) > $(call exe2cmd,$(@))
>
> -O_TO_S = $(LD) $(_CPU_LDFLAGS) $(EXTRA_LDFLAGS) -shared $(OBJS-y)
> $(LDLIBS) \
> +O_TO_S = $(LD) -L$(RTE_OUTPUT)/lib $(_CPU_LDFLAGS) $(EXTRA_LDFLAGS)
> -shared $(OBJS-y) $(LDLIBS) \
>  -Wl,-soname,$(LIB) -o $(LIB)
>  O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
>  O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)","  LD $(@)")
>
>
> I can submit an official patch for this later but I'm not exactly
> feeling like the sharpest knife in the drawer today so if somebody
> beats me to it, feel free.
>
> - Panu -

Thanks for catching it.
It seems I've already installed DPDK libraries in /usr/local/lib/. Then
, I could not catch this error.
I've confirmed your solution works fine.

Thanks,
Tetsuya


[dpdk-dev] [PATCH v2] kni: add chained mbufs support

2016-04-27 Thread Zhang, Helin


> -Original Message-
> From: Yigit, Ferruh
> Sent: Tuesday, April 26, 2016 8:38 PM
> To: dev at dpdk.org
> Cc: Zhang, Helin ; Yigit, Ferruh  intel.com>
> Subject: [PATCH v2] kni: add chained mbufs support
> 
> rx_q fifo may have chained mbufs, merge them into single skb before handing to
> the network stack.
> 
> Signed-off-by: Ferruh Yigit 
Acked-by: Helin Zhang 



[dpdk-dev] [PATCH] i40e: Remove redundant fdir forward declarations.

2016-04-27 Thread Zhang, Helin


> -Original Message-
> From: Rosen, Rami
> Sent: Saturday, March 26, 2016 9:32 AM
> To: Zhang, Helin
> Cc: dev at dpdk.org; Rosen, Rami
> Subject: [PATCH] i40e: Remove redundant fdir forward declarations.
> 
> This patch removes several redundant forward declarations in i40e_fdir.c.
> 
> Signed-off-by: Rami Rosen 
Acked-by: Helin Zhang 


[dpdk-dev] [PATCH] virtio: fix modify drv_flags for specific device

2016-04-27 Thread Tan, Jianfeng
Hi,

On 4/26/2016 7:53 PM, David Marchand wrote:
> On Tue, Apr 26, 2016 at 4:24 AM, Jianfeng Tan  
> wrote:
>> Issue: virtio's drv_flags are decided by devices types (modern vs legacy),
>> and which kernel driver is used, and the negotiated features (especially
>> VIRTIO_NET_STATUS) with backend, which makes it possible to multiple
>> virtio devices have different versions of drv_flags, but this variable
>> is currently shared by each virtio device.
>>
>> How to fix: dev_flags is a device-specific variable to store this info.
>>
>> Fixes: da978dfdc43 ("virtio: use port IO to get PCI resource")
>>
>> Reported-by: David Marchand 
>> Suggested-by: David Marchand 
>> Signed-off-by: Jianfeng Tan 
> - ethdev dev_flags is supposed to be filled with
> RTE_ETH_DEV_DETACHABLE, RTE_ETH_DEV_INTR_LSC etc... not pci macros.

Oops, I'll correct it in next version.

>
> - I would have kept the init code as it is until the
> rte_eth_copy_pci_info() step, then sanitise the dev_flags, but this
> might be a matter of taste.
>
Yes, if we keep that until rte_eth_copy_pci_info() step, the drv_flags 
has already been changed.

Besides, I see bnx2x pmd could have similar issue, and the QLogic bnx2x 
maintainers are CCed to confirm.

Thanks,
Jianfeng


[dpdk-dev] [PATCH] virtio: fix modify drv_flags for specific device

2016-04-27 Thread David Marchand
Hello,

On Wed, Apr 27, 2016 at 7:10 AM, Tan, Jianfeng  
wrote:
> Besides, I see bnx2x pmd could have similar issue, and the QLogic bnx2x
> maintainers are CCed to confirm.

Well, a way to detect those kind of issues would be to constify drv_flags.


-- 
David Marchand


[dpdk-dev] [PATCH v2] i40e: dereference before null check

2016-04-27 Thread Zhang, Helin


> -Original Message-
> From: Mrzyglod, DanielX T
> Sent: Tuesday, April 19, 2016 1:13 AM
> To: Chen, Jing D; Wu, Jingjing; Zhang, Helin
> Cc: dev at dpdk.org; Mrzyglod, DanielX T
> Subject: [PATCH v2] i40e: dereference before null check
> 
> Fix issue reported by Coverity.
> Coverity ID 13302:
> There may be a null pointer dereference, or else the comparison against null
> is unnecessary.
> 
> In i40evf_config_vlan_pvid: All paths that lead to this null pointer 
> comparison
> already dereference the pointer earlier
> 
> Fixes: 2b12431b5369 ("i40e: add vlan stripping and insertion to VF")
> 
> Signed-off-by: Daniel Mrzyglod 
Acked-by: Helin Zhang 


[dpdk-dev] [PATCH v2] i40e: dereference before null check

2016-04-27 Thread Wu, Jingjing


> -Original Message-
> From: Mrzyglod, DanielX T
> Sent: Tuesday, April 19, 2016 1:13 AM
> To: Chen, Jing D; Wu, Jingjing; Zhang, Helin
> Cc: dev at dpdk.org; Mrzyglod, DanielX T
> Subject: [PATCH v2] i40e: dereference before null check
> 
> Fix issue reported by Coverity.
> Coverity ID 13302:
> There may be a null pointer dereference, or else the comparison against null
> is unnecessary.
> 
> In i40evf_config_vlan_pvid: All paths that lead to this null pointer 
> comparison
> already dereference the pointer earlier
> 
> Fixes: 2b12431b5369 ("i40e: add vlan stripping and insertion to VF")
> 
> Signed-off-by: Daniel Mrzyglod 
Acked-by: Jingjing Wu 




[dpdk-dev] [dpdk-users] Link Status and Interrupts in 2.2.0

2016-04-27 Thread Thomas Monjalon
2016-04-25 11:49, martin_curran-gray at keysight.com:
> But if the link was "active" when dpdk and my app starts up,
> then no interrupt is generated, which then means that global
> structure is not filled in

You are describing the case of interrupts enabled but never called.
It has been fixed in DPDK 2.0:
http://dpdk.org/commit/99610782

But a race condition has been seen if interrupt fires during
rte_eth_dev_start() call. The decision was to remove link update if
interrupt is enabled (DPDK 2.2):
http://dpdk.org/commit/d5790b03
This "fix" was a bit strange:
- Is it possible to fix the race condition with link_update in the drivers?
- Is it possible to update the link status in dev_start of each driver
without race condition with the interrupt?
- Why calling link_update() from rte_eth_dev_start() in the polling case?

> I saw a submission to the patchwork 7160, dated Sep 24 2015
> but it was marked as not applicable , archived.

It has been re-submitted and applied (hence the problem):
http://dpdk.org/patch/8112


[dpdk-dev] [PATCH] mk: add build-time library directory to linker path

2016-04-27 Thread Panu Matilainen
This is a pre-requisite for adding DT_NEEDED dependencies
between internal libraries.

Signed-off-by: Panu Matilainen 
---
 mk/rte.lib.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index 8f7e021..b420280 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -86,8 +86,8 @@ O_TO_A_DO = @set -e; \
$(O_TO_A) && \
echo $(O_TO_A_CMD) > $(call exe2cmd,$(@))

-O_TO_S = $(LD) $(_CPU_LDFLAGS) $(EXTRA_LDFLAGS) -shared $(OBJS-y) $(LDLIBS) \
--Wl,-soname,$(LIB) -o $(LIB)
+O_TO_S = $(LD) -L$(RTE_OUTPUT)/lib $(_CPU_LDFLAGS) $(EXTRA_LDFLAGS) \
+ -shared $(OBJS-y) $(LDLIBS) -Wl,-soname,$(LIB) -o $(LIB)
 O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
 O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)","  LD $(@)")
 O_TO_S_DO = @set -e; \
-- 
2.5.5



[dpdk-dev] [PATCH v2] eal: out-of-bounds write

2016-04-27 Thread Slawomir Mrozowicz
Fix issue reported by Coverity.

Coverity ID 13282: Out-of-bounds write
overrun-local: Overrunning array mcfg->memseg of 256 44-byte elements
at element index 257 using index j.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Slawomir Mrozowicz 
---
 lib/librte_eal/linuxapp/eal/eal_memory.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c 
b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 5b9132c..715bd52 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -1333,8 +1333,11 @@ rte_eal_hugepage_init(void)

if (new_memseg) {
j += 1;
-   if (j == RTE_MAX_MEMSEG)
+   if (j >= RTE_MAX_MEMSEG) {
+   RTE_LOG(ERR, EAL,
+   "Failed: memseg reached 
RTE_MAX_MEMSEG\n");
break;
+   }

mcfg->memseg[j].phys_addr = hugepage[i].physaddr;
mcfg->memseg[j].addr = hugepage[i].final_va;
-- 
1.9.1



[dpdk-dev] [PATCH] i40e: configure MTU

2016-04-27 Thread Julien Meunier
Hello,

On 04/23/2016 01:26 PM, Beilei Xing wrote:
[...]
> + /* mtu setting is forbidden if port is start */
> + if (dev_data->dev_started) {
> + PMD_DRV_LOG(ERR,
> + "port %d must be stopped before configuration\n",
> + dev_data->port_id);
> + return -EBUSY;
> + }

According to rte_ethdev.h, only 4 return codes are supported for
rte_eth_dev_set_mtu:

* - (0) if successful.
* - (-ENOTSUP) if operation is not supported.
* - (-ENODEV) if *port_id* invalid.
* - (-EINVAL) if *mtu* invalid.

EBUSY should not be returned.

> + for (i = 0; i < dev_data->nb_rx_queues; i++) {
> + rxq = dev_data->rx_queues[i];
> + if (!rxq || !rxq->q_set)
> + continue;
> +
> + dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
> + len = hw->func_caps.rx_buf_chain_len * rxq->rx_buf_len;
> + rxq->max_pkt_len = RTE_MIN(len, frame_size);
> + }
> +
> + ret = i40e_dev_rx_init(pf);
> +
> + return ret;
> +}
> 

Why do want to reconfigure rxq here ? All these operations are already
done when you call i40e_dev_rx_init.
i40e_dev_rx_init => i40e_rx_queue_init (for each queue) =>
i40e_rx_queue_config => redefine rxq->max_pkt_len

Moreover, you should move dev_data->dev_conf.rxmode.max_rx_pkt_len out
of the loop. frame_size is the same for all rx_queues.

-- 
Julien MEUNIER
6WIND


[dpdk-dev] [PATCH] lpm: unchecked return value

2016-04-27 Thread Slawomir Mrozowicz
Fix issue reported by Coverity.

Coverity ID 13205: Unchecked return value
Unchecked return value
check_return: Calling rte_lpm6_add without checking return value
Fixes: 5c510e13a9cb ("lpm: add IPv6 support")

Signed-off-by: Slawomir Mrozowicz 
---
 lib/librte_lpm/rte_lpm6.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
index ba4353c..f4db3fa 100644
--- a/lib/librte_lpm/rte_lpm6.c
+++ b/lib/librte_lpm/rte_lpm6.c
@@ -749,6 +749,7 @@ rte_lpm6_delete(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t 
depth)
int32_t rule_to_delete_index;
uint8_t ip_masked[RTE_LPM6_IPV6_ADDR_SIZE];
unsigned i;
+   int status = 0;

/*
 * Check input arguments.
@@ -790,12 +791,13 @@ rte_lpm6_delete(struct rte_lpm6 *lpm, uint8_t *ip, 
uint8_t depth)
 * Add every rule again (except for the one that was removed from
 * the rules table).
 */
-   for (i = 0; i < lpm->used_rules; i++) {
-   rte_lpm6_add(lpm, lpm->rules_tbl[i].ip, lpm->rules_tbl[i].depth,
-   lpm->rules_tbl[i].next_hop);
+   for (i = 0; i < lpm->used_rules && status >= 0; i++) {
+   status = rte_lpm6_add(
+   lpm, lpm->rules_tbl[i].ip, lpm->rules_tbl[i].depth,
+   lpm->rules_tbl[i].next_hop);
}

-   return 0;
+   return status;
 }

 /*
-- 
1.9.1



[dpdk-dev] [PATCH v2] examples/netmap_compat: fix infinite loop

2016-04-27 Thread Michal Kobylinski
Fix issue reported by Coverity.

Coverity ID 30701: Infinite loop: The loop does not have a normal
termination condition, so will continue until an abnormal condition
arises. In rte_netmap_poll: Infinite loop with unsatisfiable exit
condition.

Fixes: 06371afe394d ("examples/netmap_compat: import netmap
compatibility example")

Signed-off-by: Michal Kobylinski 
---
v2:
- removed braces
- changed return value on -1

 examples/netmap_compat/lib/compat_netmap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/netmap_compat/lib/compat_netmap.c 
b/examples/netmap_compat/lib/compat_netmap.c
index bf1b418..112c551 100644
--- a/examples/netmap_compat/lib/compat_netmap.c
+++ b/examples/netmap_compat/lib/compat_netmap.c
@@ -865,6 +865,9 @@ rte_netmap_poll(struct pollfd *fds, nfds_t nfds, int 
timeout)
uint32_t i, idx, port;
uint32_t want_rx, want_tx;

+   if (timeout > 0)
+   return -1;
+
ret = 0;
do {
for (i = 0; i < nfds; i++) {
-- 
1.9.1



[dpdk-dev] [PATCH v2] eal: fix unchecked return value from library

2016-04-27 Thread Thomas Monjalon
2016-04-22 15:17, Daniel Mrzyglod:
> Fix issue reported by Coverity.
> Coverity ID 13194
> 
> The function returns a value that indicates an error condition. If this
>  is not checked, the error condition may not be handled correctly.
> 
> In pci_vfio_mp_sync_thread: Value returned from a library function is not
> checked for errors before being used. This value may indicate an error 
> condition.
> 
> Fixes: 2f4adfad0a69 ("vfio: add multiprocess support")
> 
> v2:
> Changed ERR to WARNING because it has no real impact on the application
> usability
> 
> Signed-off-by: Daniel Mrzyglod 
> Acked-by: Anatoly Burakov 

Applied, thanks


[dpdk-dev] [PATCH] lpm6: fix assigned value is garbage or undefined

2016-04-27 Thread Daniel Mrzyglod
Fix issue reported by clang scan-build

Value of pointer tbl_next was uninitialized. When function lookup_step()
take else branch it may provide garbage into tbl = tbl_next;

Fixes: 5c510e13a9cb ("lpm: add IPv6 support")

Signed-off-by: Daniel Mrzyglod 
---
 lib/librte_lpm/rte_lpm6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
index ba4353c..32fdba0 100644
--- a/lib/librte_lpm/rte_lpm6.c
+++ b/lib/librte_lpm/rte_lpm6.c
@@ -601,7 +601,7 @@ int
 rte_lpm6_lookup(const struct rte_lpm6 *lpm, uint8_t *ip, uint8_t *next_hop)
 {
const struct rte_lpm6_tbl_entry *tbl;
-   const struct rte_lpm6_tbl_entry *tbl_next;
+   const struct rte_lpm6_tbl_entry *tbl_next = NULL;
int status;
uint8_t first_byte;
uint32_t tbl24_index;
@@ -636,7 +636,7 @@ rte_lpm6_lookup_bulk_func(const struct rte_lpm6 *lpm,
 {
unsigned i;
const struct rte_lpm6_tbl_entry *tbl;
-   const struct rte_lpm6_tbl_entry *tbl_next;
+   const struct rte_lpm6_tbl_entry *tbl_next = NULL;
uint32_t tbl24_index;
uint8_t first_byte, next_hop;
int status;
-- 
2.5.5



[dpdk-dev] [PATCH] app/test_acl: fix division by float zero

2016-04-27 Thread Thomas Monjalon
> > Fix issue reported by Coverity.
> > Coverity ID 13240
> > 
> > This could cause an immediate crash or incorrect computation.
> > 
> > In search_ip5tuples: An expression which may be zero is used
> > as a divisor in floating-point arithmetic.
> > 
> > divide_by_zero: In expression (long double)tm / pkt,
> > division by expression pkt which may be zero has undefined behavior.
> > 
> > Fixes: 26c057ab6c45 ("acl: new test-acl application")
> > 
> > Signed-off-by: Daniel Mrzyglod 
> 
> Acked-by: Konstantin Ananyev 

Applied, thanks


[dpdk-dev] How to bind VM's NIC to OVS

2016-04-27 Thread Vivek Gupta
Hi All

I am testing a scenario where I will receive the traffic on DPDK binded port on 
host machine and will forward that traffic to DPDK binded port of VM machine. 
For this I have done the followings-
1.  Binded eth0 and eth1 of host machine to DPDK
2.  Created the OVS bridge in host machine as below
$OVS_DIR/utilities/ovs-vsctl  add-br ovsbr0 -- set Bridge ovsbr0 
datapath_type=netdev 
$OVS_DIR/utilities/ovs-vsctl  add-port ovsbr0 dpdk0 -- set Interface dpdk0   
type=dpdk 
$OVS_DIR/utilities/ovs-vsctl  add-port ovsbr0 dpdk1 -- set Interface dpdk1   
type=dpdk 

3. Installed the VM and created virtual NIC(eth4, eth5)
4. Binded VM machine NIC to VM's DPDK 

Now I am not able to understand how to attach VM's NIC to OVS?

To solve this I tried below command on HOST MACHINE
$OVS_DIR/utilities/ovs-vsctl  add-port ovsbr0 dpdk4 -- set Interface dpdk4   
type=dpdk 
$OVS_DIR/utilities/ovs-vsctl  add-port ovsbr0 dpdk5 -- set Interface dpdk5   
type=dpdk 

but got error "Cannot get interface dpdk4". I believe this is due to OVS is 
looking in host machine for interface "dpdk4 & dpdk5" although these interface 
are available in VM machine.

Do I need QEMU, if yes then how it will help.

Please suggest.

Thanks & Regards
Vivek Gupta
9971514343


::DISCLAIMER::


The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information 
could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in 
transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on 
the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the 
author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written 
consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please 
delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and 
other defects.





[dpdk-dev] [PATCH v7 0/7] qede: add qede PMD

2016-04-27 Thread Rasesh Mody
Hi Bruce, Thomas,

The v7 series incorporates the following review comments:
 - MAINTAINERS and LICENSE.qede_pmd file changes added to base driver
 - Reworked flags used for clang compilation
 - index.rst, overview.rst and qede.rst changes added to core driver
 - Addressed documentation comments on qede.rst
 - Enable the PMD right after adding core driver, add new features
   thereafter
 - Addressed checkpatch UNSPECIFIED_INT warnings generated by
   checkpatch.pl from kernel v4.6
 - Renamed DBG_STATUS_DATA_DIDNT_TRIGGER to DBG_STATUS_NO_DATA_TRIGGERED
 - Updated subject/commit message of interrupt handling patch to make
   it reader friendly

The patches are generated and tested against latest dpdk based off
of v16.04.

These patches are checked using checkpatch.sh with following
additional ignore option:
   options="$options --ignore=BIT_MACRO,CAMELCASE,"

Please apply!

Rasesh Mody (7):
  qede: add base driver
  qede: add core driver
  qede: enable PMD build
  qede: add L2 support
  qede: add SRIOV support
  qede: add interrupt handling support
  qede: add DCBX support

 MAINTAINERS |7 +
 config/common_base  |   12 +
 doc/guides/nics/index.rst   |1 +
 doc/guides/nics/overview.rst|   84 +-
 doc/guides/nics/qede.rst|  315 +
 drivers/net/Makefile|1 +
 drivers/net/qede/LICENSE.qede_pmd   |   28 +
 drivers/net/qede/Makefile   |   98 +
 drivers/net/qede/base/bcm_osal.c|  181 +
 drivers/net/qede/base/bcm_osal.h|  396 +
 drivers/net/qede/base/common_hsi.h  |  714 ++
 drivers/net/qede/base/ecore.h   |  754 ++
 drivers/net/qede/base/ecore_attn_values.h   |13287 +++
 drivers/net/qede/base/ecore_chain.h |  724 ++
 drivers/net/qede/base/ecore_cxt.c   | 1961 
 drivers/net/qede/base/ecore_cxt.h   |  157 +
 drivers/net/qede/base/ecore_cxt_api.h   |   79 +
 drivers/net/qede/base/ecore_dcbx.c  |  887 ++
 drivers/net/qede/base/ecore_dcbx.h  |   55 +
 drivers/net/qede/base/ecore_dcbx_api.h  |  160 +
 drivers/net/qede/base/ecore_dev.c   | 3597 
 drivers/net/qede/base/ecore_dev_api.h   |  497 +
 drivers/net/qede/base/ecore_gtt_reg_addr.h  |   42 +
 drivers/net/qede/base/ecore_gtt_values.h|   33 +
 drivers/net/qede/base/ecore_hsi_common.h| 1912 
 drivers/net/qede/base/ecore_hsi_eth.h   | 1912 
 drivers/net/qede/base/ecore_hsi_tools.h | 1081 +++
 drivers/net/qede/base/ecore_hw.c|  910 ++
 drivers/net/qede/base/ecore_hw.h|  269 +
 drivers/net/qede/base/ecore_hw_defs.h   |   49 +
 drivers/net/qede/base/ecore_init_fw_funcs.c | 1275 +++
 drivers/net/qede/base/ecore_init_fw_funcs.h |  263 +
 drivers/net/qede/base/ecore_init_ops.c  |  599 ++
 drivers/net/qede/base/ecore_init_ops.h  |  103 +
 drivers/net/qede/base/ecore_int.c   | 2225 +
 drivers/net/qede/base/ecore_int.h   |  234 +
 drivers/net/qede/base/ecore_int_api.h   |  277 +
 drivers/net/qede/base/ecore_iov_api.h   |  933 ++
 drivers/net/qede/base/ecore_iro.h   |  115 +
 drivers/net/qede/base/ecore_iro_values.h|   59 +
 drivers/net/qede/base/ecore_l2.c| 1798 
 drivers/net/qede/base/ecore_l2.h|  151 +
 drivers/net/qede/base/ecore_l2_api.h|  401 +
 drivers/net/qede/base/ecore_mcp.c   | 1932 
 drivers/net/qede/base/ecore_mcp.h   |  304 +
 drivers/net/qede/base/ecore_mcp_api.h   |  611 ++
 drivers/net/qede/base/ecore_proto_if.h  |   28 +
 drivers/net/qede/base/ecore_rt_defs.h   |  446 +
 drivers/net/qede/base/ecore_sp_api.h|   42 +
 drivers/net/qede/base/ecore_sp_commands.c   |  525 ++
 drivers/net/qede/base/ecore_sp_commands.h   |  137 +
 drivers/net/qede/base/ecore_spq.c   |  943 ++
 drivers/net/qede/base/ecore_spq.h   |  284 +
 drivers/net/qede/base/ecore_sriov.c | 3422 +++
 drivers/net/qede/base/ecore_sriov.h |  390 +
 drivers/net/qede/base/ecore_status.h|   30 +
 drivers/net/qede/base/ecore_utils.h |   31 +
 drivers/net/qede/base/ecore_vf.c| 1332 +++
 drivers/net/qede/base/ecore_vf.h|  415 +
 drivers/net/qede/base/ecore_vf_api.h|  200 +
 drivers/net/qede/base/ecore_vfpf_if.h   |  590 ++
 drivers/net/qede/base/eth_common.h  |  526 ++
 drivers/net/qede/base/mcp_public.h  | 1205 +++
 drivers/net/qede/base/nvm_cfg.h |  919 ++
 drivers/net/qede/base/reg_addr.h| 1107 +++
 drivers/net/qede/qede_eth_if.c  |  458 +
 drivers/net/qede/qede_eth_if.h  |  176 +
 drivers/net/qede/qede_ethdev.c  | 1106 +++
 drivers/net/qede/qede_ethdev.h  |  160 +
 drivers/net/qede/qede_if.h  |  164 +
 drivers/net/qede/qede_logs.h

[dpdk-dev] [PATCH v7 2/7] qede: add core driver

2016-04-27 Thread Rasesh Mody
The Qlogic Everest Driver for Ethernet(QEDE) Poll Mode Driver(PMD) is
the DPDK specific module for QLogic FastLinQ QL4 25G/40G CNA family
of adapters as well as their virtual functions (VF) in SR-IOV context.

This patch adds QEDE PMD, which interacts with base driver and
initialises the HW.

This patch content also includes:
 - eth_dev_ops callbacks
 - Rx/Tx support for the driver
 - link default configuration
 - change link property
 - link up/down/update notifications
 - vlan offload and filtering capability
 - device/function/port statistics
 - qede nic guide and updated overview.rst

Note that the follow on commits contain the code for the features mentioned
in documents but not implemented in this patch.

Signed-off-by: Harish Patil 
Signed-off-by: Rasesh Mody 
Signed-off-by: Sony Chacko 
---
 MAINTAINERS   |1 +
 doc/guides/nics/index.rst |1 +
 doc/guides/nics/overview.rst  |   84 +-
 doc/guides/nics/qede.rst  |  315 
 drivers/net/qede/Makefile |   12 +
 drivers/net/qede/qede_eth_if.h|  176 +
 drivers/net/qede/qede_ethdev.c| 1028 +
 drivers/net/qede/qede_ethdev.h|  159 
 drivers/net/qede/qede_if.h|  155 
 drivers/net/qede/qede_logs.h  |   90 +++
 drivers/net/qede/qede_main.c  |  545 +
 drivers/net/qede/qede_rxtx.c  | 1192 +
 drivers/net/qede/qede_rxtx.h  |  179 +
 drivers/net/qede/rte_pmd_qede_version.map |4 +
 14 files changed, 3899 insertions(+), 42 deletions(-)
 create mode 100644 doc/guides/nics/qede.rst
 create mode 100644 drivers/net/qede/qede_eth_if.h
 create mode 100644 drivers/net/qede/qede_ethdev.c
 create mode 100644 drivers/net/qede/qede_ethdev.h
 create mode 100644 drivers/net/qede/qede_if.h
 create mode 100644 drivers/net/qede/qede_logs.h
 create mode 100644 drivers/net/qede/qede_main.c
 create mode 100644 drivers/net/qede/qede_rxtx.c
 create mode 100644 drivers/net/qede/qede_rxtx.h
 create mode 100644 drivers/net/qede/rte_pmd_qede_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index b673cc7..ba4053a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -337,6 +337,7 @@ M: Harish Patil 
 M: Rasesh Mody 
 M: Sony Chacko 
 F: drivers/net/qede/
+F: doc/guides/nics/qede.rst

 RedHat virtio
 M: Huawei Xie 
diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index 769f677..0b13698 100644
--- a/doc/guides/nics/index.rst
+++ b/doc/guides/nics/index.rst
@@ -48,6 +48,7 @@ Network Interface Controller Drivers
 mlx4
 mlx5
 nfp
+qede
 szedata2
 virtio
 vhost
diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst
index f08039e..a309752 100644
--- a/doc/guides/nics/overview.rst
+++ b/doc/guides/nics/overview.rst
@@ -74,40 +74,40 @@ Most of these differences are summarized below.

 .. table:: Features availability in networking drivers

-    = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = = = = = =
-   Feature  a b b b c e e e i i i i i i i i i i f f f f m m m n n 
p r s v v v v x
-f n n o x 1 n n 4 4 4 4 g g x x x x m m m m l l p f u 
c i z h i i m e
-p x x n g 0 a i 0 0 0 0 b b g g g g 1 1 1 1 x x i p l 
a n e o r r x n
-a 2 2 d b 0   c e e e e   v b b b b 0 0 0 0 4 5 p   l 
p g d s t t n v
-c x x i e 0   . v v   f e e e e k k k k e  
   a t i i e i
-k   v n   . f f   . v v   . v v
   t   o o t r
-e   f g   .   .   . f f   . f f
   a . 3 t
-t v   v   v   v   v   v
   2 v
-  e   e   e   e   e   e
 e
-  c   c   c   c   c   c
 c
-    = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = = = = = =
+    = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = = = = = = = =
+   Feature  a b b b c e e e i i i i i i i i i i f f f f m m m n n 
p q q r s v v v v x
+f n n o x 1 n n 4 4 4 4 g g x x x x m m m m l l p f u 
c e e i z h i i m e
+p x x n g 0 a i 0 0 0 0 b b g g g g 1 1 1 1 x x i p l 
a d d n e o r r x n
+a 2 2 d b 0   c e e e e   v b b b b 0 0 0 0 4 5 p   l 
p e e g d s t t n v
+c x x i e 0   . v v   f e e e e k k k k e  
   v   a t i i e i
+k   v n   . f f   . v v   . v v
   f   t   o o t r
+e   f g   .   .   . f f   . f f
   a . 3 t
+   

[dpdk-dev] [PATCH v7 3/7] qede: enable PMD build

2016-04-27 Thread Rasesh Mody
This patch enables the QEDE PMD build.

Signed-off-by: Harish Patil 
Signed-off-by: Rasesh Mody 
Signed-off-by: Sony Chacko 
---
 config/common_base   |   12 
 drivers/net/Makefile |1 +
 mk/rte.app.mk|2 ++
 3 files changed, 15 insertions(+)

diff --git a/config/common_base b/config/common_base
index 1a54e4c..1db9f35 100644
--- a/config/common_base
+++ b/config/common_base
@@ -297,6 +297,18 @@ CONFIG_RTE_LIBRTE_PMD_BOND=y
 CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB=n
 CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB_L1=n

+# QLogic 25G/40G PMD
+#
+CONFIG_RTE_LIBRTE_QEDE_PMD=y
+CONFIG_RTE_LIBRTE_QEDE_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_QEDE_DEBUG_INFO=n
+CONFIG_RTE_LIBRTE_QEDE_DEBUG_DRV=n
+CONFIG_RTE_LIBRTE_QEDE_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_QEDE_DEBUG_RX=n
+#Provides abs path/name of the firmware file.
+#Empty string denotes driver will use default firmware
+CONFIG_RTE_LIBRTE_QEDE_FW=""
+
 #
 # Compile software PMD backed by AF_PACKET sockets (Linux only)
 #
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 3386a67..6ba7658 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -47,6 +47,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += mpipe
 DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap
+DIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += szedata2
 DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index c66e491..7f364d3 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -101,6 +101,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2)   += -lsze2
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT)+= -lxenstore
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD)  += -lgxio
 _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD)+= -lm
+_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD)   += -lz
 # QAT / AESNI GCM PMDs are dependent on libcrypto (from openssl)
 # for calculating HMAC precomputes
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_QAT),y)
@@ -147,6 +148,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD)  += 
-lrte_pmd_mpipe
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING)   += -lrte_pmd_ring
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)   += -lrte_pmd_pcap
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET)  += -lrte_pmd_af_packet
+_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD)   += -lrte_pmd_qede
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL)   += -lrte_pmd_null

 ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y)
-- 
1.7.10.3



[dpdk-dev] [PATCH v7 4/7] qede: add L2 support

2016-04-27 Thread Rasesh Mody
This patch adds the features to supports configuration of various Layer 2
elements, such as channels and filtering options.

Signed-off-by: Harish Patil 
Signed-off-by: Rasesh Mody 
Signed-off-by: Sony Chacko 
---
 drivers/net/qede/Makefile|2 +
 drivers/net/qede/base/ecore_chain.h  |6 +
 drivers/net/qede/base/ecore_l2.c | 1608 ++
 drivers/net/qede/base/ecore_l2.h |  101 +++
 drivers/net/qede/base/ecore_l2_api.h |  401 +
 drivers/net/qede/qede_eth_if.c   |  458 ++
 drivers/net/qede/qede_eth_if.h   |2 +-
 drivers/net/qede/qede_ethdev.c   |   18 +
 drivers/net/qede/qede_ethdev.h   |1 +
 drivers/net/qede/qede_if.h   |9 +
 drivers/net/qede/qede_main.c |2 +
 drivers/net/qede/qede_rxtx.c |  192 
 12 files changed, 2799 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/qede/base/ecore_l2.c
 create mode 100644 drivers/net/qede/base/ecore_l2.h
 create mode 100644 drivers/net/qede/base/ecore_l2_api.h
 create mode 100644 drivers/net/qede/qede_eth_if.c

diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 75e0d29..8ccf7cb 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -74,6 +74,7 @@ $(foreach obj, $(BASE_DRIVER_OBJS), $(eval 
CFLAGS+=$(CFLAGS_BASE_DRIVER)))
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_hw.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_cxt.c
+SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_l2.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_sp_commands.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_init_fw_funcs.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_spq.c
@@ -82,6 +83,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_mcp.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_int.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/bcm_osal.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_eth_if.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_rxtx.c

diff --git a/drivers/net/qede/base/ecore_chain.h 
b/drivers/net/qede/base/ecore_chain.h
index 98bbffc..c573449 100644
--- a/drivers/net/qede/base/ecore_chain.h
+++ b/drivers/net/qede/base/ecore_chain.h
@@ -251,6 +251,12 @@ static OSAL_INLINE u32 ecore_chain_get_page_cnt(struct 
ecore_chain *p_chain)
return p_chain->page_cnt;
 }

+static OSAL_INLINE
+dma_addr_t ecore_chain_get_pbl_phys(struct ecore_chain *p_chain)
+{
+   return p_chain->pbl.p_phys_table;
+}
+
 /**
  * @brief ecore_chain_advance_page -
  *
diff --git a/drivers/net/qede/base/ecore_l2.c b/drivers/net/qede/base/ecore_l2.c
new file mode 100644
index 000..88e9087
--- /dev/null
+++ b/drivers/net/qede/base/ecore_l2.c
@@ -0,0 +1,1608 @@
+/*
+ * Copyright (c) 2016 QLogic Corporation.
+ * All rights reserved.
+ * www.qlogic.com
+ *
+ * See LICENSE.qede_pmd for copyright and licensing details.
+ */
+
+#include "bcm_osal.h"
+
+#include "ecore.h"
+#include "ecore_status.h"
+#include "ecore_hsi_eth.h"
+#include "ecore_chain.h"
+#include "ecore_spq.h"
+#include "ecore_init_fw_funcs.h"
+#include "ecore_cxt.h"
+#include "ecore_l2.h"
+#include "ecore_sp_commands.h"
+#include "ecore_gtt_reg_addr.h"
+#include "ecore_iro.h"
+#include "reg_addr.h"
+#include "ecore_int.h"
+#include "ecore_hw.h"
+#include "ecore_mcp.h"
+
+#define ECORE_MAX_SGES_NUM 16
+#define CRC32_POLY 0x1edc6f41
+
+enum _ecore_status_t
+ecore_sp_eth_vport_start(struct ecore_hwfn *p_hwfn,
+struct ecore_sp_vport_start_params *p_params)
+{
+   struct vport_start_ramrod_data *p_ramrod = OSAL_NULL;
+   struct ecore_spq_entry *p_ent = OSAL_NULL;
+   enum _ecore_status_t rc = ECORE_NOTIMPL;
+   struct ecore_sp_init_data init_data;
+   u8 abs_vport_id = 0;
+   u16 rx_mode = 0;
+
+   rc = ecore_fw_vport(p_hwfn, p_params->vport_id, &abs_vport_id);
+   if (rc != ECORE_SUCCESS)
+   return rc;
+
+   /* Get SPQ entry */
+   OSAL_MEMSET(&init_data, 0, sizeof(init_data));
+   init_data.cid = ecore_spq_get_cid(p_hwfn);
+   init_data.opaque_fid = p_params->opaque_fid;
+   init_data.comp_mode = ECORE_SPQ_MODE_EBLOCK;
+
+   rc = ecore_sp_init_request(p_hwfn, &p_ent,
+  ETH_RAMROD_VPORT_START,
+  PROTOCOLID_ETH, &init_data);
+   if (rc != ECORE_SUCCESS)
+   return rc;
+
+   p_ramrod = &p_ent->ramrod.vport_start;
+   p_ramrod->vport_id = abs_vport_id;
+
+   p_ramrod->mtu = OSAL_CPU_TO_LE16(p_params->mtu);
+   p_ramrod->inner_vlan_removal_en = p_params->remove_inner_vlan;
+   p_ramrod->handle_ptp_pkts = p_params->handle_ptp_pkts;
+   p_ramrod->drop_ttl0_en = p_params->drop_ttl0;
+   p_ramrod->untagged = p_params->only_untagged;
+   p_ramrod->zero_placement_offset = p_params->zero_placem

[dpdk-dev] [PATCH v7 5/7] qede: add SRIOV support

2016-04-27 Thread Rasesh Mody
This patch adds following SRIOV features to qede PMD:
 - VF configuration
 - VF intialization/de-initialization
 - VF PF communications channel
 - statistics capture and query

Signed-off-by: Harish Patil 
Signed-off-by: Rasesh Mody 
Signed-off-by: Sony Chacko 
---
 drivers/net/qede/Makefile  |2 +
 drivers/net/qede/base/bcm_osal.c   |9 +
 drivers/net/qede/base/bcm_osal.h   |   10 +-
 drivers/net/qede/base/ecore.h  |   10 +
 drivers/net/qede/base/ecore_dev.c  |   99 +-
 drivers/net/qede/base/ecore_hw.c   |9 +-
 drivers/net/qede/base/ecore_init_ops.c |4 +
 drivers/net/qede/base/ecore_int.c  |   31 +-
 drivers/net/qede/base/ecore_iov_api.h  |  933 +
 drivers/net/qede/base/ecore_l2.c   |  230 ++-
 drivers/net/qede/base/ecore_l2.h   |   50 +
 drivers/net/qede/base/ecore_mcp.c  |   30 +
 drivers/net/qede/base/ecore_spq.c  |8 +-
 drivers/net/qede/base/ecore_sriov.c| 3422 
 drivers/net/qede/base/ecore_sriov.h|  390 
 drivers/net/qede/base/ecore_vf.c   | 1332 +
 drivers/net/qede/base/ecore_vf.h   |  415 
 drivers/net/qede/base/ecore_vf_api.h   |  200 ++
 drivers/net/qede/base/ecore_vfpf_if.h  |  590 ++
 drivers/net/qede/qede_ethdev.c |   68 +-
 drivers/net/qede/qede_ethdev.h |4 +-
 drivers/net/qede/qede_main.c   |  219 +-
 22 files changed, 7969 insertions(+), 96 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_iov_api.h
 create mode 100644 drivers/net/qede/base/ecore_sriov.c
 create mode 100644 drivers/net/qede/base/ecore_sriov.h
 create mode 100644 drivers/net/qede/base/ecore_vf.c
 create mode 100644 drivers/net/qede/base/ecore_vf.h
 create mode 100644 drivers/net/qede/base/ecore_vf_api.h
 create mode 100644 drivers/net/qede/base/ecore_vfpf_if.h

diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 8ccf7cb..536d377 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -82,6 +82,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_init_ops.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_mcp.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_int.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/bcm_osal.c
+SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_sriov.c
+SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_vf.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_eth_if.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_main.c
diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index f46f31b..9540c4b 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -14,6 +14,7 @@
 #include "bcm_osal.h"
 #include "ecore.h"
 #include "ecore_hw.h"
+#include "ecore_iov_api.h"

 unsigned long qede_log2_align(unsigned long n)
 {
@@ -81,6 +82,14 @@ inline u32 qede_find_first_zero_bit(unsigned long *addr, u32 
limit)
return (i == nwords) ? limit : i * OSAL_BITS_PER_UL + qede_ffz(addr[i]);
 }

+void qede_vf_fill_driver_data(struct ecore_hwfn *hwfn,
+ __rte_unused struct vf_pf_resc_request *resc_req,
+ struct ecore_vf_acquire_sw_info *vf_sw_info)
+{
+   vf_sw_info->os_type = VFPF_ACQUIRE_OS_LINUX_USERSPACE;
+   vf_sw_info->override_fw_version = 1;
+}
+
 void *osal_dma_alloc_coherent(struct ecore_dev *p_dev,
  dma_addr_t *phys, size_t size)
 {
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index f15242d..ae43594 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -22,6 +22,9 @@
 /* Forward declaration */
 struct ecore_dev;
 struct ecore_hwfn;
+struct ecore_vf_acquire_sw_info;
+struct vf_pf_resc_request;
+void qed_link_update(struct ecore_hwfn *hwfn);

 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 #undef __BIG_ENDIAN
@@ -302,7 +305,7 @@ u32 qede_find_first_zero_bit(unsigned long *, u32);
 #define OSAL_BUILD_BUG_ON(cond)nothing
 #define ETH_ALEN   ETHER_ADDR_LEN

-#define OSAL_LINK_UPDATE(hwfn) nothing
+#define OSAL_LINK_UPDATE(hwfn) qed_link_update(hwfn)

 /* SR-IOV channel */

@@ -315,12 +318,15 @@ u32 qede_find_first_zero_bit(unsigned long *, u32);
 #define OSAL_IOV_VF_ACQUIRE(hwfn, vfid) 0
 #define OSAL_IOV_VF_CLEANUP(hwfn, vfid) nothing
 #define OSAL_IOV_VF_VPORT_UPDATE(hwfn, vfid, p_params, p_mask) 0
-#define OSAL_VF_FILL_ACQUIRE_RESC_REQ(_dev_p, _resc_req, _os_info) nothing
 #define OSAL_VF_UPDATE_ACQUIRE_RESC_RESP(_dev_p, _resc_resp) 0
 #define OSAL_IOV_GET_OS_TYPE() 0

 u32 qede_unzip_data(struct ecore_hwfn *p_hwfn, u32 input_len,
   u8 *input_buf, u32 max_size, u8 *unzip_buf);
+void qede_vf_fill_driver_data(struct ecore_hwfn *, struct vf_pf_resc_request *,
+ struct ecore_vf_acquire_sw_info *);
+#define OSAL_VF_FILL_ACQUIRE_RESC_REQ(_dev_p, _resc_req,

[dpdk-dev] [PATCH v7 7/7] qede: add DCBX support

2016-04-27 Thread Rasesh Mody
This patch adds LLDP and DCBX capabilities to the qede PMD.

Signed-off-by: Harish Patil 
Signed-off-by: Rasesh Mody 
Signed-off-by: Sony Chacko 
---
 drivers/net/qede/Makefile |1 +
 drivers/net/qede/base/bcm_osal.h  |1 +
 drivers/net/qede/base/ecore.h |2 +
 drivers/net/qede/base/ecore_dcbx.c|  887 +
 drivers/net/qede/base/ecore_dcbx.h|   55 ++
 drivers/net/qede/base/ecore_dcbx_api.h|  160 ++
 drivers/net/qede/base/ecore_dev.c |   27 +
 drivers/net/qede/base/ecore_mcp.c |   16 +
 drivers/net/qede/base/ecore_sp_commands.c |4 +
 drivers/net/qede/base/mcp_public.h|  205 +++
 drivers/net/qede/base/nvm_cfg.h   |6 +
 11 files changed, 1364 insertions(+)
 create mode 100644 drivers/net/qede/base/ecore_dcbx.c
 create mode 100644 drivers/net/qede/base/ecore_dcbx.h
 create mode 100644 drivers/net/qede/base/ecore_dcbx_api.h

diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 536d377..e973f43 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -81,6 +81,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_spq.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_init_ops.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_mcp.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_int.c
+SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_dcbx.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/bcm_osal.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_sriov.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += base/ecore_vf.c
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index ae43594..47d056e 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -306,6 +306,7 @@ u32 qede_find_first_zero_bit(unsigned long *, u32);
 #define ETH_ALEN   ETHER_ADDR_LEN

 #define OSAL_LINK_UPDATE(hwfn) qed_link_update(hwfn)
+#define OSAL_DCBX_AEN(hwfn, mib_type) nothing

 /* SR-IOV channel */

diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index 2f1a6d1..d682a78 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -161,6 +161,7 @@ struct ecore_dma_mem;
 struct ecore_sb_sp_info;
 struct ecore_igu_info;
 struct ecore_mcp_info;
+struct ecore_dcbx_info;

 struct ecore_rt_data {
u32 *init_val;
@@ -508,6 +509,7 @@ struct ecore_hwfn {
struct ecore_vf_iov *vf_iov_info;
struct ecore_pf_iov *pf_iov_info;
struct ecore_mcp_info *mcp_info;
+   struct ecore_dcbx_info *p_dcbx_info;

struct ecore_hw_cid_data *p_tx_cids;
struct ecore_hw_cid_data *p_rx_cids;
diff --git a/drivers/net/qede/base/ecore_dcbx.c 
b/drivers/net/qede/base/ecore_dcbx.c
new file mode 100644
index 000..6a966cb
--- /dev/null
+++ b/drivers/net/qede/base/ecore_dcbx.c
@@ -0,0 +1,887 @@
+/*
+ * Copyright (c) 2016 QLogic Corporation.
+ * All rights reserved.
+ * www.qlogic.com
+ *
+ * See LICENSE.qede_pmd for copyright and licensing details.
+ */
+
+#include "bcm_osal.h"
+#include "ecore.h"
+#include "ecore_sp_commands.h"
+#include "ecore_dcbx.h"
+#include "ecore_cxt.h"
+#include "ecore_gtt_reg_addr.h"
+#include "ecore_iro.h"
+
+#define ECORE_DCBX_MAX_MIB_READ_TRY(100)
+#define ECORE_MAX_PFC_PRIORITIES   8
+#define ECORE_ETH_TYPE_DEFAULT (0)
+
+#define ECORE_DCBX_INVALID_PRIORITY0xFF
+
+/* Get Traffic Class from priority traffic class table, 4 bits represent
+ * the traffic class corresponding to the priority.
+ */
+#define ECORE_DCBX_PRIO2TC(prio_tc_tbl, prio) \
+   ((u32)(pri_tc_tbl >> ((7 - prio) * 4)) & 0x7)
+
+static bool ecore_dcbx_app_ethtype(u32 app_info_bitmap)
+{
+   return (ECORE_MFW_GET_FIELD(app_info_bitmap, DCBX_APP_SF) ==
+   DCBX_APP_SF_ETHTYPE) ? true : false;
+}
+
+static bool ecore_dcbx_app_port(u32 app_info_bitmap)
+{
+   return (ECORE_MFW_GET_FIELD(app_info_bitmap, DCBX_APP_SF) ==
+   DCBX_APP_SF_PORT) ? true : false;
+}
+
+static bool ecore_dcbx_default_tlv(u32 app_info_bitmap, u16 proto_id)
+{
+   return (ecore_dcbx_app_ethtype(app_info_bitmap) &&
+   proto_id == ECORE_ETH_TYPE_DEFAULT) ? true : false;
+}
+
+static bool ecore_dcbx_enabled(u32 dcbx_cfg_bitmap)
+{
+   return (ECORE_MFW_GET_FIELD(dcbx_cfg_bitmap, DCBX_CONFIG_VERSION) ==
+   DCBX_CONFIG_VERSION_DISABLED) ? false : true;
+}
+
+static bool ecore_dcbx_cee(u32 dcbx_cfg_bitmap)
+{
+   return (ECORE_MFW_GET_FIELD(dcbx_cfg_bitmap, DCBX_CONFIG_VERSION) ==
+   DCBX_CONFIG_VERSION_CEE) ? true : false;
+}
+
+static bool ecore_dcbx_ieee(u32 dcbx_cfg_bitmap)
+{
+   return (ECORE_MFW_GET_FIELD(dcbx_cfg_bitmap, DCBX_CONFIG_VERSION) ==
+   DCBX_CONFIG_VERSION_IEEE) ? true : false;
+}
+
+/* @@@TBD A0 Eagle workaround */
+void ecore_dcbx_eagle_workaround(struct ecore_hwfn *p_hwfn,
+struct ecore_ptt *p_ptt, b

[dpdk-dev] [PATCH] examples/exception_path: bad shift operation in setup_port_lcore_affinities

2016-04-27 Thread Thomas Monjalon
2016-04-15 17:29, Daniel Mrzyglod:
> CID: #30688
> The operaton may have an undefined behavior or yield to an unexpected result.
> 
> In setup_port_lcore_affinities: A bit shift operation has a shift amount which
> is too large or has a negative value.
> 
> Fixes: af75078fece3 ("first public release")
> 
> Signed-off-by: Daniel Mrzyglod 

Applied, thanks


[dpdk-dev] [PATCH] examples/vm_power_manager: buffer not null terminated

2016-04-27 Thread Thomas Monjalon
2016-04-12 17:13, Daniel Mrzyglod:
> CID30691:
> If the buffer is treated as a null terminated string in later operations,
> a buffer overflow or over-read may occur.
[...]
> --- a/examples/vm_power_manager/channel_manager.c
> +++ b/examples/vm_power_manager/channel_manager.c
> - strncpy(new_domain->name, vm_name, sizeof(new_domain->name));
> + strncat(new_domain->name, vm_name, sizeof(new_domain->name) -
> + strlen(new_domain->name) - 1);

It looks to be a copy paste of a ready-to-use replacement of strncpy.
Why not just do new_domain->name[sizeof(new_domain->name) - 1] = 0 ?



[dpdk-dev] [PATCH v7 1/7] qede: add base driver

2016-04-27 Thread Rasesh Mody
The base driver is the backend module for the QLogic FastLinQ QL4
25G/40G CNA family of adapters as well as their virtual functions (VF)
in SR-IOV context.

The purpose of the base module is to:
 - provide all the common code that will be shared between the various
   drivers that would be used with said line of products. Flows such as
   chip initialization and de-initialization fall under this category.
 - abstract the protocol-specific HW & FW components, allowing the
   protocol drivers to have clean APIs, which are detached in its
   slowpath configuration from the actual Hardware Software Interface(HSI).

This patch adds a base module without any protocol-specific bits.
I.e., this adds a basic implementation that almost entirely falls under
the first category.

Signed-off-by: Harish Patil 
Signed-off-by: Rasesh Mody 
Signed-off-by: Sony Chacko 
---
 MAINTAINERS |6 +
 drivers/net/qede/LICENSE.qede_pmd   |   28 +
 drivers/net/qede/Makefile   |   81 +
 drivers/net/qede/base/bcm_osal.c|  172 ++
 drivers/net/qede/base/bcm_osal.h|  389 +++
 drivers/net/qede/base/common_hsi.h  |  714 ++
 drivers/net/qede/base/ecore.h   |  742 ++
 drivers/net/qede/base/ecore_chain.h |  718 ++
 drivers/net/qede/base/ecore_cxt.c   | 1961 +++
 drivers/net/qede/base/ecore_cxt.h   |  157 ++
 drivers/net/qede/base/ecore_cxt_api.h   |   79 +
 drivers/net/qede/base/ecore_dev.c   | 3442 +++
 drivers/net/qede/base/ecore_dev_api.h   |  497 
 drivers/net/qede/base/ecore_gtt_reg_addr.h  |   42 +
 drivers/net/qede/base/ecore_gtt_values.h|   33 +
 drivers/net/qede/base/ecore_hsi_common.h| 1912 +++
 drivers/net/qede/base/ecore_hsi_eth.h   | 1912 +++
 drivers/net/qede/base/ecore_hsi_tools.h | 1081 +
 drivers/net/qede/base/ecore_hw.c|  905 +++
 drivers/net/qede/base/ecore_hw.h|  269 +++
 drivers/net/qede/base/ecore_hw_defs.h   |   49 +
 drivers/net/qede/base/ecore_init_fw_funcs.c | 1275 ++
 drivers/net/qede/base/ecore_init_fw_funcs.h |  263 ++
 drivers/net/qede/base/ecore_init_ops.c  |  595 +
 drivers/net/qede/base/ecore_init_ops.h  |  103 +
 drivers/net/qede/base/ecore_int.c   | 1069 +
 drivers/net/qede/base/ecore_int.h   |  234 ++
 drivers/net/qede/base/ecore_int_api.h   |  277 +++
 drivers/net/qede/base/ecore_iro.h   |  115 +
 drivers/net/qede/base/ecore_iro_values.h|   59 +
 drivers/net/qede/base/ecore_mcp.c   | 1886 +++
 drivers/net/qede/base/ecore_mcp.h   |  304 +++
 drivers/net/qede/base/ecore_mcp_api.h   |  611 +
 drivers/net/qede/base/ecore_proto_if.h  |   28 +
 drivers/net/qede/base/ecore_rt_defs.h   |  446 
 drivers/net/qede/base/ecore_sp_api.h|   42 +
 drivers/net/qede/base/ecore_sp_commands.c   |  521 
 drivers/net/qede/base/ecore_sp_commands.h   |  137 ++
 drivers/net/qede/base/ecore_spq.c   |  937 
 drivers/net/qede/base/ecore_spq.h   |  284 +++
 drivers/net/qede/base/ecore_status.h|   30 +
 drivers/net/qede/base/ecore_utils.h |   31 +
 drivers/net/qede/base/eth_common.h  |  526 
 drivers/net/qede/base/mcp_public.h  | 1000 
 drivers/net/qede/base/nvm_cfg.h |  913 +++
 drivers/net/qede/base/reg_addr.h| 1107 +
 46 files changed, 27982 insertions(+)
 create mode 100644 drivers/net/qede/LICENSE.qede_pmd
 create mode 100644 drivers/net/qede/Makefile
 create mode 100644 drivers/net/qede/base/bcm_osal.c
 create mode 100644 drivers/net/qede/base/bcm_osal.h
 create mode 100644 drivers/net/qede/base/common_hsi.h
 create mode 100644 drivers/net/qede/base/ecore.h
 create mode 100644 drivers/net/qede/base/ecore_chain.h
 create mode 100644 drivers/net/qede/base/ecore_cxt.c
 create mode 100644 drivers/net/qede/base/ecore_cxt.h
 create mode 100644 drivers/net/qede/base/ecore_cxt_api.h
 create mode 100644 drivers/net/qede/base/ecore_dev.c
 create mode 100644 drivers/net/qede/base/ecore_dev_api.h
 create mode 100644 drivers/net/qede/base/ecore_gtt_reg_addr.h
 create mode 100644 drivers/net/qede/base/ecore_gtt_values.h
 create mode 100644 drivers/net/qede/base/ecore_hsi_common.h
 create mode 100644 drivers/net/qede/base/ecore_hsi_eth.h
 create mode 100644 drivers/net/qede/base/ecore_hsi_tools.h
 create mode 100644 drivers/net/qede/base/ecore_hw.c
 create mode 100644 drivers/net/qede/base/ecore_hw.h
 create mode 100644 drivers/net/qede/base/ecore_hw_defs.h
 create mode 100644 drivers/net/qede/base/ecore_init_fw_funcs.c
 create mode 100644 drivers/net/qede/base/ecore_init_fw_funcs.h
 create mode 100644 drivers/net/qede/base/ecore_init_ops.c
 create mode 100644 drivers/net/qede/base/ecore_init_ops.h
 create mode 100644 drivers/net/qede/base/ecore_int.c
 c

[dpdk-dev] [PATCH v7 6/7] qede: add interrupt handling support

2016-04-27 Thread Rasesh Mody
Physical link is handled by the management Firmware.
This patch lays the infrastructure for interrupt/attention handling in
the driver, as link change notifications arrive via async interrupts,
as well as the handling of such notifications. It adds async event
notification handler interfaces to the PMD.

Signed-off-by: Harish Patil 
Signed-off-by: Rasesh Mody 
Signed-off-by: Sony Chacko 
---
 drivers/net/qede/base/ecore_attn_values.h |13287 +
 drivers/net/qede/base/ecore_dev.c |   51 +
 drivers/net/qede/base/ecore_int.c | 1131 +++
 3 files changed, 14469 insertions(+)
 create mode 100644 drivers/net/qede/base/ecore_attn_values.h

diff --git a/drivers/net/qede/base/ecore_attn_values.h 
b/drivers/net/qede/base/ecore_attn_values.h
new file mode 100644
index 000..d8951bc
--- /dev/null
+++ b/drivers/net/qede/base/ecore_attn_values.h
@@ -0,0 +1,13287 @@
+/*
+ * Copyright (c) 2016 QLogic Corporation.
+ * All rights reserved.
+ * www.qlogic.com
+ *
+ * See LICENSE.qede_pmd for copyright and licensing details.
+ */
+
+#ifndef __ATTN_VALUES_H__
+#define __ATTN_VALUES_H__
+
+#ifndef __PREVENT_INT_ATTN__
+
+/* HW Attention register */
+struct attn_hw_reg {
+   u16 reg_idx;/* Index of this register in its block */
+   u16 num_of_bits;/* number of valid attention bits */
+   const u16 *bit_attn_idx;/* attention index per valid bit */
+   u32 sts_addr;   /* Address of the STS register */
+   u32 sts_clr_addr;   /* Address of the STS_CLR register */
+   u32 sts_wr_addr;/* Address of the STS_WR register */
+   u32 mask_addr;  /* Address of the MASK register */
+};
+
+/* HW block attention registers */
+struct attn_hw_regs {
+   u16 num_of_int_regs;/* Number of interrupt regs */
+   u16 num_of_prty_regs;   /* Number of parity regs */
+   struct attn_hw_reg **int_regs;  /* interrupt regs */
+   struct attn_hw_reg **prty_regs; /* parity regs */
+};
+
+/* HW block attention registers */
+struct attn_hw_block {
+   const char *name;   /* Block name */
+   const char **int_desc;  /* Array of interrupt attention descriptions */
+   const char **prty_desc; /* Array of parity attention descriptions */
+   struct attn_hw_regs chip_regs[3];   /* attention regs per chip.*/
+};
+
+#ifdef ATTN_DESC
+static const char *grc_int_attn_desc[5] = {
+   "grc_address_error",
+   "grc_timeout_event",
+   "grc_global_reserved_address",
+   "grc_path_isolation_error",
+   "grc_trace_fifo_valid_data",
+};
+#else
+#define grc_int_attn_desc OSAL_NULL
+#endif
+
+static const u16 grc_int0_bb_a0_attn_idx[4] = {
+   0, 1, 2, 3,
+};
+
+static struct attn_hw_reg grc_int0_bb_a0 = {
+   0, 4, grc_int0_bb_a0_attn_idx, 0x50180, 0x5018c, 0x50188, 0x50184
+};
+
+static struct attn_hw_reg *grc_int_bb_a0_regs[1] = {
+   &grc_int0_bb_a0,
+};
+
+static const u16 grc_int0_bb_b0_attn_idx[4] = {
+   0, 1, 2, 3,
+};
+
+static struct attn_hw_reg grc_int0_bb_b0 = {
+   0, 4, grc_int0_bb_b0_attn_idx, 0x50180, 0x5018c, 0x50188, 0x50184
+};
+
+static struct attn_hw_reg *grc_int_bb_b0_regs[1] = {
+   &grc_int0_bb_b0,
+};
+
+static const u16 grc_int0_k2_attn_idx[5] = {
+   0, 1, 2, 3, 4,
+};
+
+static struct attn_hw_reg grc_int0_k2 = {
+   0, 5, grc_int0_k2_attn_idx, 0x50180, 0x5018c, 0x50188, 0x50184
+};
+
+static struct attn_hw_reg *grc_int_k2_regs[1] = {
+   &grc_int0_k2,
+};
+
+#ifdef ATTN_DESC
+static const char *grc_prty_attn_desc[3] = {
+   "grc_mem003_i_mem_prty",
+   "grc_mem002_i_mem_prty",
+   "grc_mem001_i_mem_prty",
+};
+#else
+#define grc_prty_attn_desc OSAL_NULL
+#endif
+
+static const u16 grc_prty1_bb_a0_attn_idx[2] = {
+   1, 2,
+};
+
+static struct attn_hw_reg grc_prty1_bb_a0 = {
+   0, 2, grc_prty1_bb_a0_attn_idx, 0x50200, 0x5020c, 0x50208, 0x50204
+};
+
+static struct attn_hw_reg *grc_prty_bb_a0_regs[1] = {
+   &grc_prty1_bb_a0,
+};
+
+static const u16 grc_prty1_bb_b0_attn_idx[2] = {
+   0, 1,
+};
+
+static struct attn_hw_reg grc_prty1_bb_b0 = {
+   0, 2, grc_prty1_bb_b0_attn_idx, 0x50200, 0x5020c, 0x50208, 0x50204
+};
+
+static struct attn_hw_reg *grc_prty_bb_b0_regs[1] = {
+   &grc_prty1_bb_b0,
+};
+
+static const u16 grc_prty1_k2_attn_idx[2] = {
+   0, 1,
+};
+
+static struct attn_hw_reg grc_prty1_k2 = {
+   0, 2, grc_prty1_k2_attn_idx, 0x50200, 0x5020c, 0x50208, 0x50204
+};
+
+static struct attn_hw_reg *grc_prty_k2_regs[1] = {
+   &grc_prty1_k2,
+};
+
+#ifdef ATTN_DESC
+static const char *miscs_int_attn_desc[14] = {
+   "miscs_address_error",
+   "miscs_generic_sw",
+   "miscs_cnig_interrupt",
+   "miscs_opte_dorq_fifo_err_eng1",
+   "miscs_opte_dorq_fifo_err_eng0",
+   "miscs_opte_dbg_fifo_err_eng1",
+   "miscs_opte_dbg_fifo_err_eng0",
+   "miscs_opte_btb_if1_fifo_err_eng1",
+   "miscs_opte_btb_if1_fifo_err_eng0",
+   "miscs_opte_btb_if0_

[dpdk-dev] [PATCH] virtio: avoid avail ring entry index update if equal

2016-04-27 Thread Huawei Xie
Avail ring is updated by the frontend and consumed by the backend.
There are frequent core to core cache transfers for the avail ring.

This optmization avoids avail ring entry index update if the entry
already holds the same value.
As DPDK virtio PMD implements FIFO free descriptor list (also for
performance reason of CACHE), in which descriptors are allocated
from the head and freed to the tail, with this patch in most cases
avail ring will remain the same, then it would be valid in both caches
of frontend and backend.

Signed-off-by: Huawei Xie 
Suggested-by: ms >> Michael S. Tsirkin 
---
 drivers/net/virtio/virtqueue.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
index 4e9239e..8c46a83 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -302,7 +302,8 @@ vq_update_avail_ring(struct virtqueue *vq, uint16_t 
desc_idx)
 * descriptor.
 */
avail_idx = (uint16_t)(vq->vq_avail_idx & (vq->vq_nentries - 1));
-   vq->vq_ring.avail->ring[avail_idx] = desc_idx;
+   if (unlikely(vq->vq_ring.avail->ring[avail_idx] != desc_idx))
+   vq->vq_ring.avail->ring[avail_idx] = desc_idx;
vq->vq_avail_idx++;
 }

-- 
2.4.3



[dpdk-dev] [PATCH] app/testpmd: fix strcat can overrun fixed-size string

2016-04-27 Thread Thomas Monjalon
2016-04-11 18:03, Tomasz Kulasek:
> CID 13307 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
> fixed_size_dest: You might overrun the 128 byte fixed-size string fwd_modes
> by copying fwd_eng->fwd_mode_name without checking the length.
> 
> Fixes: 769ce6b17835 ("app/testpmd: list forwarding engines")
> 
> Signed-off-by: Tomasz Kulasek 

Applied, thanks


[dpdk-dev] [PATCH] i40e: configure MTU

2016-04-27 Thread Xing, Beilei
> -Original Message-
> From: Julien Meunier [mailto:julien.meunier at 6wind.com]
> Sent: Wednesday, April 27, 2016 7:44 PM
> To: Xing, Beilei ; Wu, Jingjing  intel.com>
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] i40e: configure MTU
> 
> Hello,
> 
> On 04/23/2016 01:26 PM, Beilei Xing wrote:
> [...]
> > +   /* mtu setting is forbidden if port is start */
> > +   if (dev_data->dev_started) {
> > +   PMD_DRV_LOG(ERR,
> > +   "port %d must be stopped before configuration\n",
> > +   dev_data->port_id);
> > +   return -EBUSY;
> > +   }
> 
> According to rte_ethdev.h, only 4 return codes are supported for
> rte_eth_dev_set_mtu:
> 
> * - (0) if successful.
> * - (-ENOTSUP) if operation is not supported.
> * - (-ENODEV) if *port_id* invalid.
> * - (-EINVAL) if *mtu* invalid.
> 
> EBUSY should not be returned.

Hi Meunier,
Thanks for your comments, it shouldn't be EBUSY here.

> 
> > +   for (i = 0; i < dev_data->nb_rx_queues; i++) {
> > +   rxq = dev_data->rx_queues[i];
> > +   if (!rxq || !rxq->q_set)
> > +   continue;
> > +
> > +   dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
> > +   len = hw->func_caps.rx_buf_chain_len * rxq->rx_buf_len;
> > +   rxq->max_pkt_len = RTE_MIN(len, frame_size);
> > +   }
> > +
> > +   ret = i40e_dev_rx_init(pf);
> > +
> > +   return ret;
> > +}
> >
> 
> Why do want to reconfigure rxq here ? All these operations are already done
> when you call i40e_dev_rx_init.
> i40e_dev_rx_init => i40e_rx_queue_init (for each queue) =>
> i40e_rx_queue_config => redefine rxq->max_pkt_len
> 
> Moreover, you should move dev_data->dev_conf.rxmode.max_rx_pkt_len out
> of the loop. frame_size is the same for all rx_queues.

Yes, you're right, needn't reconfigure rxq->max_pkt_len here, I just need 
reconfigure dev_data->dev_conf.rxmode.max_rx_pkt_len cause i40e_dev_rx_init 
will cover all. 
Thanks very much.
Beilei

> 
> --
> Julien MEUNIER
> 6WIND


[dpdk-dev] [PATCH v2] virtio: check if virtio net header could fit in mbuf headroom

2016-04-27 Thread Huawei Xie
check merge-able header as it is supported.
previously we don't support merge-able feature, so non merge-able
header is checked.

v2:
 add missed signoff

Signed-off-by: Huawei Xie 
---
 drivers/net/virtio/virtio_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index 63a368a..20ff03e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1036,7 +1036,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
struct rte_pci_device *pci_dev;
int ret;

-   RTE_BUILD_BUG_ON(RTE_PKTMBUF_HEADROOM < sizeof(struct virtio_net_hdr));
+   RTE_BUILD_BUG_ON(RTE_PKTMBUF_HEADROOM < sizeof(struct 
virtio_net_hdr_mrg_rxbuf));

eth_dev->dev_ops = &virtio_eth_dev_ops;
eth_dev->tx_pkt_burst = &virtio_xmit_pkts;
-- 
1.8.1.4



[dpdk-dev] [PATCH] examples/performance-thread: fix size of destination port ids in l3fwd-thread

2016-04-27 Thread Thomas Monjalon
2016-04-20 16:45, Tomasz Kulasek:
> This patch uses similar approach for fix, like in commit 8353a36a9b4b
> ("examples/l3fwd: fix size of destination port ids"), restoring 16 bit size
> for destination port ids and doing necessary conversion from 32 to 16 bit
> after lpm_lookupx4.
> 
> Also fixes wrong logic in get_dst_port() on lpm path causing unpredictable
> return value when ipv4/ipv6 lookup success, introduced in the same patch.

The word "Also" means that you should write 2 patches :)


[dpdk-dev] [PATCH] examples/performance-thread: fix segfault with in gcc 5.x

2016-04-27 Thread Thomas Monjalon
2016-04-26 17:47, Tomasz Kulasek:
> It seems that with gcc >5.x and -O2/-O3 optimization breaks packet grouping
> algorithm in l3fwd-thread application causing segfault.
> 
> When last packet pointer "lp" and "pnum->u64" buffer points the same
> memory buffer, high optimization can cause unpredictable results. It seems
> that assignment of precalculated group sizes may interfere with
> initialization of new group size when lp points value inside current group
> and didn't should be changed.
> 
> With gcc >5.x and optimization we cannot be sure which assignment will be
> done first, so the group size can be counted incorrectly causing segfault.
> 
> This patch eliminates intersection of assignment of initial group size
> (lp[0] = 1) and precalculated group sizes when gptbl[v].idx < 4.
> 
> Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
> 
> Signed-off-by: Tomasz Kulasek 

Same patch as af1694d94 (for original l3fwd).
Applied, thanks



[dpdk-dev] [PATCH] eal: remove useless internal function from memcpy headers

2016-04-27 Thread Thomas Monjalon
2016-04-20 11:07, David Marchand:
> On Tue, Apr 19, 2016 at 10:47 PM, Thomas Monjalon
>  wrote:
> > The function rte_memcpy_func() is used in ARM and PPC implementations
> > of rte_memcpy().
> > There are some useless copies in Tile and some ARM branches.
> > It was also declared without doxygen comment in the generic header.
> >
> > Signed-off-by: Thomas Monjalon 
> 
> Looks good to me.
> Acked-by: David Marchand 

Applied


[dpdk-dev] [PATCH] eal/linux: fix undefined allocation of 0 bytes (CERT MEM04-C; CWE-131)

2016-04-27 Thread Daniel Mrzyglod
Fix issue reported by clang scan-build

there is a chance that nr_hugepages will be 0 if conditions for loop
for (i = 0; i < (int) internal_config.num_hugepage_sizes; i++)
will be unmeet.

Fixes: b6a468ad41d5 ("memory: add --socket-mem option")

Signed-off-by: Daniel Mrzyglod 
---
 lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c 
b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 5b9132c..e94538e 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -1114,6 +1114,8 @@ rte_eal_hugepage_init(void)
 * processing done on these pages, shared memory will be created
 * at a later stage.
 */
+   if (nr_hugepages == 0)
+   goto fail;
tmp_hp = malloc(nr_hugepages * sizeof(struct hugepage_file));
if (tmp_hp == NULL)
goto fail;
-- 
2.5.5



[dpdk-dev] [PATCH v7 0/7] qede: add qede PMD

2016-04-27 Thread Bruce Richardson
On Wed, Apr 27, 2016 at 07:18:35AM -0700, Rasesh Mody wrote:
> Hi Bruce, Thomas,
> 
> The v7 series incorporates the following review comments:
>  - MAINTAINERS and LICENSE.qede_pmd file changes added to base driver
>  - Reworked flags used for clang compilation
>  - index.rst, overview.rst and qede.rst changes added to core driver
>  - Addressed documentation comments on qede.rst
>  - Enable the PMD right after adding core driver, add new features
>thereafter
>  - Addressed checkpatch UNSPECIFIED_INT warnings generated by
>checkpatch.pl from kernel v4.6
>  - Renamed DBG_STATUS_DATA_DIDNT_TRIGGER to DBG_STATUS_NO_DATA_TRIGGERED
>  - Updated subject/commit message of interrupt handling patch to make
>it reader friendly
> 
> The patches are generated and tested against latest dpdk based off
> of v16.04.
> 
> These patches are checked using checkpatch.sh with following
> additional ignore option:
>options="$options --ignore=BIT_MACRO,CAMELCASE,"
> 
> Please apply!
> 
> Rasesh Mody (7):
>   qede: add base driver
>   qede: add core driver
>   qede: enable PMD build
>   qede: add L2 support
>   qede: add SRIOV support
>   qede: add interrupt handling support
>   qede: add DCBX support
> 
Patchset applied to dpdk-next-net/rel_16_07

Thanks,
/Bruce



[dpdk-dev] [PATCH] i40e: Remove redundant fdir forward declarations.

2016-04-27 Thread Bruce Richardson
On Wed, Apr 27, 2016 at 02:51:55AM +, Zhang, Helin wrote:
> 
> 
> > -Original Message-
> > From: Rosen, Rami
> > Sent: Saturday, March 26, 2016 9:32 AM
> > To: Zhang, Helin
> > Cc: dev at dpdk.org; Rosen, Rami
> > Subject: [PATCH] i40e: Remove redundant fdir forward declarations.
> > 
> > This patch removes several redundant forward declarations in i40e_fdir.c.
> > 
> > Signed-off-by: Rami Rosen 
> Acked-by: Helin Zhang 

Added fixes line:
Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")

Applied to dpdk-next-net/rel_16_04

If there are other unneeded forward declarations in this driver or other 
drivers,
as suggested by Thomas, please send on additional patches.

Thanks,
/bruce


[dpdk-dev] [PATCH v2 0/3] improve i40e vpmd

2016-04-27 Thread Bruce Richardson
On Sun, Apr 17, 2016 at 04:32:10PM +0800, Zhe Tao wrote:
> On Thu, Apr 14, 2016 at 05:02:34PM +0100, Bruce Richardson wrote:
> > This patchset improves the performance of the i40e SSE pmd by removing
> > operations that triggered CPU stalls. It also shortens the code and
> > cleans it up a little.
> > 
> > The base requirement for using the SSE code path has been pushed up to
> > SSE4.1 from SSE3, due to the use of the blend instruction. The instruction
> > set level is now checked at runtime as part of the driver selection process
> > 
> > Bruce Richardson (3):
> >   i40e: require SSE4.1 support for vector driver
> >   i40e: improve performance of vector PMD
> >   i40e: simplify SSE packet length extraction code
> > 
> >  drivers/net/i40e/Makefile|  6 
> >  drivers/net/i40e/i40e_rxtx_vec.c | 59 
> > ++--
> >  2 files changed, 27 insertions(+), 38 deletions(-)
> > 
> > -- 
> > 2.5.5
> Acked-by: Zhe Tao  

Applied to dpdk-next-net/rel_16_07

/Bruce


[dpdk-dev] [PATCH] i40e: Remove redundant fdir forward declarations.

2016-04-27 Thread Richardson, Bruce
> -Original Message-
> From: Bruce Richardson [mailto:bruce.richardson at intel.com]
> Sent: Wednesday, April 27, 2016 5:20 PM
> To: Zhang, Helin 
> Cc: Rosen, Rami ; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] i40e: Remove redundant fdir forward
> declarations.
> 
> On Wed, Apr 27, 2016 at 02:51:55AM +, Zhang, Helin wrote:
> >
> >
> > > -Original Message-
> > > From: Rosen, Rami
> > > Sent: Saturday, March 26, 2016 9:32 AM
> > > To: Zhang, Helin
> > > Cc: dev at dpdk.org; Rosen, Rami
> > > Subject: [PATCH] i40e: Remove redundant fdir forward declarations.
> > >
> > > This patch removes several redundant forward declarations in
> i40e_fdir.c.
> > >
> > > Signed-off-by: Rami Rosen 
> > Acked-by: Helin Zhang 
> 
> Added fixes line:
> Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")
> 
> Applied to dpdk-next-net/rel_16_04
> 
Where by 04 I obviously mean 07! :-)

/Bruce


[dpdk-dev] [PATCH v2] virtio: check if virtio net header could fit in mbuf headroom

2016-04-27 Thread Yuanhan Liu
On Wed, Apr 27, 2016 at 07:27:55AM +0800, Huawei Xie wrote:
> check merge-able header as it is supported.
> previously we don't support merge-able feature, so non merge-able
> header is checked.
> 
> v2:
>  add missed signoff

Applied to dpdk-next-virtio with above version log removed: DPDK
prefers to put it below the SoB, so that it will not be in git
history.

Thanks.

--yliu


[dpdk-dev] [PATCH v2] vhost: Fix linkage of vhost PMD

2016-04-27 Thread Yuanhan Liu
On Tue, Apr 26, 2016 at 02:39:29PM +0900, Tetsuya Mukawa wrote:
> Currently, vhost PMD doesn't have linkage for librte_vhost, even though
> it depends on librte_vhost APIs. This causes a linkage error if below
> conditions are fulfilled.
> 
>  - DPDK libraries are compiled as shared libraries.
>  - DPDK application doesn't link librte_vhost.
>  - Above application tries to link vhost PMD using '-d' DPDK option.
> 
> The patch adds linkage for librte_vhost to vhost PMD not to cause an
> above error.
> 
> Signed-off-by: Tetsuya Mukawa 
> Acked-by: Panu Matilainen 

Applied to dpdk-next-virtio.

Thanks.

--yliu


[dpdk-dev] [PATCH] virtio: fix memory leak of virtqueue memzones

2016-04-27 Thread Yuanhan Liu
On Tue, Apr 26, 2016 at 12:32:12PM +, Jianfeng Tan wrote:
> Issue: When virtio was proposed in DPDK, there is no API to free memzones.
> But this has changed since rte_memzone_free() has been implemented by
> commit ff909fe21f.

The more proper way to reference a commit is

commit_id ("$commit_subject")

Like what the fixline does.

> This patch is to make sure memzones in struct virtqueue, like mz and
> virtio_net_hdr_mz, are freed when queue is released or setup fails.
> 
> Signed-off-by: Jianfeng Tan 
> ---
>  drivers/net/virtio/virtio_ethdev.c | 69 
> --
>  drivers/net/virtio/virtio_ethdev.h |  2 +-
>  drivers/net/virtio/virtio_rxtx.c   |  4 +--
>  3 files changed, 40 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c 
> b/drivers/net/virtio/virtio_ethdev.c
> index 63a368a..54eacf6 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -261,12 +261,18 @@ virtio_set_multiple_queues(struct rte_eth_dev *dev, 
> uint16_t nb_queues)
>  }
>  
>  void
> -virtio_dev_queue_release(struct virtqueue *vq) {
> +virtio_dev_queue_release(struct virtqueue *vq, int io_related)
> +{
>   struct virtio_hw *hw;
>  
>   if (vq) {
>   hw = vq->hw;
> - hw->vtpci_ops->del_queue(hw, vq);
> + if (io_related)
> + hw->vtpci_ops->del_queue(hw, vq);

What is "io_related" supposed to mean here, queue has been started/set
up? If so, "started" might be better. And remember to put it into the vq
struct: we don't need an extra parameter for that.

> +
> + rte_memzone_free(vq->mz);
> + if (vq->virtio_net_hdr_mz)
> + rte_memzone_free(vq->virtio_net_hdr_mz);
>  
>   rte_free(vq->sw_ring);
>   rte_free(vq);
> @@ -286,6 +292,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
>   unsigned int vq_size, size;
>   struct virtio_hw *hw = dev->data->dev_private;
>   struct virtqueue *vq = NULL;
> + const char *queue_names[] = {"rvq", "txq", "cvq"};
>  
>   PMD_INIT_LOG(DEBUG, "setting up queue: %u", vtpci_queue_idx);
>  
> @@ -305,34 +312,34 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
>   return -EINVAL;
>   }
>  
> - if (queue_type == VTNET_RQ) {
> - snprintf(vq_name, sizeof(vq_name), "port%d_rvq%d",
> - dev->data->port_id, queue_idx);
> - vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
> - vq_size * sizeof(struct vq_desc_extra), 
> RTE_CACHE_LINE_SIZE);
> - vq->sw_ring = rte_zmalloc_socket("rxq->sw_ring",
> - (RTE_PMD_VIRTIO_RX_MAX_BURST + vq_size) *
> - sizeof(vq->sw_ring[0]), RTE_CACHE_LINE_SIZE, socket_id);
> - } else if (queue_type == VTNET_TQ) {
> - snprintf(vq_name, sizeof(vq_name), "port%d_tvq%d",
> - dev->data->port_id, queue_idx);
> - vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
> - vq_size * sizeof(struct vq_desc_extra), 
> RTE_CACHE_LINE_SIZE);
> - } else if (queue_type == VTNET_CQ) {
> - snprintf(vq_name, sizeof(vq_name), "port%d_cvq",
> - dev->data->port_id);
> - vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
> - vq_size * sizeof(struct vq_desc_extra),
> - RTE_CACHE_LINE_SIZE);
> + if (queue_type < VTNET_RQ || queue_type > VTNET_RQ) {
> + PMD_INIT_LOG(ERR, "invalid queue type: %d", queue_type);
> + return -EINVAL;
>   }
> +
> + snprintf(vq_name, sizeof(vq_name), "port%d_%s%d",
> +  dev->data->port_id, queue_names[queue_type], queue_idx);
> + vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
> +  vq_size * sizeof(struct vq_desc_extra),
> +  RTE_CACHE_LINE_SIZE);

This is a cleanup, a good cleanup. So, make a patch for that, and do
NOT mix cleanup and fix in one single patch, which is something I
have told you quite few times, right?


--yliu


[dpdk-dev] [RFC] eal: provide option to set vhost_user socket owner/permissions

2016-04-27 Thread Yuanhan Liu
On Tue, Apr 26, 2016 at 09:33:48AM -0400, Aaron Conole wrote:
> >> > b) would prefer a change of the API?
> >> 
> >> Adding a new option to the current register API might will not work well,
> >> either. It gives you no ability to do a dynamic change later. I mean,
> >> taking OVS as an example, OVS provides you the flexible ability to do all
> >> kinds of configuration in a dynamic way, say number of rx queues. If we
> >> do the permissions setup in the register time, there would be no way to
> >> change it later, right?
> >> 
> >> So, I'm thinking that we may could add a new API for that? It then would
> >> allow applications to change it at anytime.
> >
> > A vhost API in the library?

Yes, I supposed so.

> > And for vhost PMD?

Technically, vhost PMD is an application (or precisely, an user) of
vhost lib. So, it's supposed to invoke the new API.

> What about devargs parameters?

Yes, and it then invoke the API, as stated above.

> 
> I don't know the most sane solution here, other than to echo the
> sentiment that a new API for this is probably appropriate. Where that
> API lives, and how it looks should be hashed out. For now, I'm working
> on a solution in OVS because no such API or facility exists in DPDK.
> 
> Actually, there are a number of edge cases with vhost-user sockets. I
> don't want to get into all of them, but since we're discussing the API a
> bit here, I'd like to also bring up the following:
> 
>   What is the desired behavior w.r.t. file cleanup when the application
>   crashes, restarts, and tells DPDK to use that file again (which hasn't
>   been cleaned up due to the crash)?
>   At present, the vhost-user code errors out. But how does the
>   application correct the situation without deleting arbitrary files on
>   the filesystem?

Oops, yes, that's another one. We also had some discussion before:

http://dpdk.org/ml/archives/dev/2015-December/030326.html

It ended up with an agreement that we should let the application to
handle it, due to it's a path provided by the application, though
it's DPDK does the creation.

> 
> >> > c) consider it an issue of consuming projects and let them take care?
> >> 
> >> It's not exactly an issue of consuming projects; we created the socket
> >> file after all.
> >
> > Yes
> 
> Just want to reiterate at present there is no solution, so projects will
> invent their own. I can point to Ubuntu and Red Hat customer bugs which
> require silly workarounds like "after you started a bunch of stuff, go
> to the directory and run chmod/chown."
> 
> I'm actually not opposed to any solution that seems sane. If DPDK takes
> the stance that the file is specified by the application, and therefore
> "file management" activities (removal, permissions, ownership, etc.) are
> the responsibility of the application, so be it.

Exactly. But DPDK, as a library, could provides some handy APIs to make
the application developer's life be less painful. So, that also echoes
to what we have said before: we provide the tool, you use it, and it's
you to make sure it's right.

--yliu

> If the stance is that
> DPDK owns the management of the file, so be that as well. I think the
> first case is easier for the library maintainers (do nothing), the
> second is easier for the applications (use these semantics).
> 
> If it really is the responsibility of DPDK, then I think the only sane
> approach is an API for managing this. That may require an additional
> library framework to link the vhost-user PMD and rte_ethdev facilities
> so that a common API could be provided.
> 
> Just my $.02.
> 
> Thanks,
> Aaron


[dpdk-dev] [PATCH] virtio: fix memory leak of virtqueue memzones

2016-04-27 Thread Yuanhan Liu
On Thu, Apr 28, 2016 at 10:01:06AM +0800, Tan, Jianfeng wrote:
> >>+
> >>+   snprintf(vq_name, sizeof(vq_name), "port%d_%s%d",
> >>+dev->data->port_id, queue_names[queue_type], queue_idx);
> >>+   vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
> >>+vq_size * sizeof(struct vq_desc_extra),
> >>+RTE_CACHE_LINE_SIZE);
> >This is a cleanup, a good cleanup. So, make a patch for that, and do
> >NOT mix cleanup and fix in one single patch, which is something I
> >have told you quite few times, right?
> 
> You mean submit a specific patch for cleanup or just another commit inside
> this patch set?

Do it as a patchset, as the two are connected: the fix should be based
on the cleanup patch.

--yliu


[dpdk-dev] [PATCH 0/7] vhost/example cleanup/fix

2016-04-27 Thread Yuanhan Liu
On Thu, Apr 28, 2016 at 05:45:16AM +, Wang, Zhihong wrote:
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Yuanhan Liu
> > Sent: Tuesday, April 26, 2016 12:46 PM
> > To: dev at dpdk.org
> > Cc: Xie, Huawei ; Yuanhan Liu
> > 
> > Subject: [dpdk-dev] [PATCH 0/7] vhost/example cleanup/fix
> > 
> > I'm starting to work on the vhost ABI refactoring, that I also have to
> > touch the vhost example code, to make it work. The vhost example code,
> > however, is very messy, full of __very__ long lines. This would make
> > a later diff to apply the new vhost API be very ugly, therefore, not
> > friendly for review. This is how this cleanup comes.
> 
> 
> I think this patch is great effort to clean the messy code and make clearer
> logic, only one suggestion: do you think a complete cleanup would help more?

Yes, but I will stop here, and maybe do the left in near future, as I
have more important thing to do now. I even thought about to make the
VMDq and VLAN stuff optional, to not let our example connect with those
hardware feature that tight.

So, feel free to make patches to clean it further if you have time.

--yliu


[dpdk-dev] [PATCH] virtio: avoid avail ring entry index update if equal

2016-04-27 Thread Yuanhan Liu
On Wed, Apr 27, 2016 at 04:53:58AM -0400, Huawei Xie wrote:
> Avail ring is updated by the frontend and consumed by the backend.
> There are frequent core to core cache transfers for the avail ring.
> 
> This optmization avoids avail ring entry index update if the entry
> already holds the same value.
> As DPDK virtio PMD implements FIFO free descriptor list (also for
> performance reason of CACHE), in which descriptors are allocated
> from the head and freed to the tail, with this patch in most cases
> avail ring will remain the same, then it would be valid in both caches
> of frontend and backend.

Acked-by: Yuanhan Liu 

> 
> Signed-off-by: Huawei Xie 
> Suggested-by: ms >> Michael S. Tsirkin 

And applied to dpdk-next-virtio, with few tiny changes:

- we normally put suggested/reported-by above the SoB.

- removed "ms >>"

Thanks.

--yliu