dpdk.git
8 years agomempool: use the list to audit all elements
Olivier Matz [Wed, 18 May 2016 11:04:31 +0000 (13:04 +0200)]
mempool: use the list to audit all elements

Use the new rte_mempool_obj_iter() instead the old rte_mempool_obj_iter()
to iterate among objects to audit them (check for cookies).

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: use the list to iterate the elements
Olivier Matz [Wed, 18 May 2016 11:04:30 +0000 (13:04 +0200)]
mempool: use the list to iterate the elements

Now that the mempool objects are chained into a list, we can use it to
browse them. This implies a rework of rte_mempool_obj_iter() API, that
does not need to take as many arguments as before. The previous function
is kept as a private function, and renamed in this commit. It will be
removed in a next commit of the patch series.

The only internal users of this function are the mellanox drivers. The
code is updated accordingly.

Introducing an API compatibility for this function has been considered,
but it is not easy to do without keeping the old code, as the previous
function could also be used to browse elements that were not added in a
mempool. Moreover, the API is already be broken by other patches in this
version.

The library version was already updated in
commit 213af31e0960 ("mempool: reduce structure size if no cache needed")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: remove const qualifier in dump and audit
Olivier Matz [Wed, 18 May 2016 11:04:29 +0000 (13:04 +0200)]
mempool: remove const qualifier in dump and audit

In next commits, we will use an iterator to walk through the objects in
mempool in rte_mempool_audit(). This iterator takes a "struct
rte_mempool *" as a parameter because it is assumed that the callback
function can modify the mempool.

The previous approach was to introduce a RTE_DECONST() macro, but
after discussion it seems that removing the const qualifier is better
to avoid fooling the compiler, and also because these functions are
not used in datapath (possible compiler optimizations due to const
are not critical).

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: remove const qualifier when browsing pools
Olivier Matz [Wed, 18 May 2016 11:04:28 +0000 (13:04 +0200)]
mempool: remove const qualifier when browsing pools

This commit removes the const qualifier for the mempool in
rte_mempool_walk() callback prototype.

Indeed, most functions that can be done on a mempool require a non-const
mempool pointer, except the dump and the audit. Therefore, the
mempool_walk() is more useful if the mempool pointer is not const.

This is required by next commit where the mellanox drivers use
rte_mempool_walk() to iterate the mempools, then rte_mempool_obj_iter()
to iterate the objects in each mempool.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: list objects when added
Olivier Matz [Wed, 18 May 2016 11:04:27 +0000 (13:04 +0200)]
mempool: list objects when added

Introduce a list entry in object header so they can be listed and
browsed. The objective is to introduce a more simple way to browse the
elements of a mempool.

The next commits will update rte_mempool_obj_iter() to use this list,
and remove the previous complex implementation.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: rename object constructor typedef
Olivier Matz [Wed, 18 May 2016 11:04:26 +0000 (13:04 +0200)]
mempool: rename object constructor typedef

This commit renames mempool_obj_ctor_t as mempool_obj_cb_t.

In next commits, we will add the ability to populate the
mempool and iterate through objects using the same function.
We will use the same callback type for that. As the callback is
not a constructor anymore, rename it into rte_mempool_obj_cb_t.

The rte_mempool_obj_iter_t that was used to iterate over objects
will be removed in next commits.

No functional change.
In this commit, the API is preserved through a compat typedef.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: use sizeof to get size of header and trailer
Olivier Matz [Wed, 18 May 2016 11:04:25 +0000 (13:04 +0200)]
mempool: use sizeof to get size of header and trailer

Since commits d2e0ca22f and 97e7e685b the headers and trailers
of the mempool are defined as a structure. We can get their
size using a sizeof instead of doing a calculation that will
become wrong at the first structure update.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: uninline function to check cookies
Olivier Matz [Wed, 18 May 2016 11:04:24 +0000 (13:04 +0200)]
mempool: uninline function to check cookies

There's no reason to keep this function inlined. Move it to
rte_mempool.c. We need to export the function for when compiling
with shared libraries + debug. We also need to keep the macro,
because we don't want to call an empty function when debug is
disabled.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: rename element size variables
Olivier Matz [Wed, 18 May 2016 11:04:23 +0000 (13:04 +0200)]
mempool: rename element size variables

This commit replaces elt_size by total_elt_size when appropriate.

In some mempool functions, we use the size of the elements as arguments
or variables. There is a confusion between the size including or not
including the header and trailer.

To avoid this confusion:
- update the API documentation
- rename the variables and argument names as "elt_size" when the size
  does not include the header and trailer, or else as "total_elt_size".

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked by: Keith Wiles <keith.wiles@intel.com>

8 years agomempool: rework comments and style
Olivier Matz [Wed, 18 May 2016 11:04:22 +0000 (13:04 +0200)]
mempool: rework comments and style

No functional change, just fix some comments and styling issues.
Also avoid to duplicate comments between rte_mempool_create()
and rte_mempool_xmem_create().

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked by: Keith Wiles <keith.wiles@intel.com>

8 years agombuf: decrease reference counter when detaching
Hiroyuki Mikita [Wed, 18 May 2016 14:41:03 +0000 (23:41 +0900)]
mbuf: decrease reference counter when detaching

The rte_pktmbuf_detach() function should decrease refcnt on a direct
buffer as stated in doc/guides/prog_guide/mbuf_lib.rst:
"whenever the indirect buffer is detached, the reference counter on the
direct buffer is decremented."

Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agocmdline: check initialization error
Marcin Kerlin [Tue, 17 May 2016 08:36:57 +0000 (10:36 +0200)]
cmdline: check initialization error

The value returned by rdline_init() was not checked in cmdline_new().
On error, free the allocated memory and return NULL.

This condition should not happen today, but it's safer to do the check
in case rdline_init() is updated.

Coverity issue: 13204
Fixes: af75078fece3 ("first public release")

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agotools: allow binding to other network class devices
Thadeu Lima de Souza Cascardo [Fri, 6 May 2016 18:27:01 +0000 (15:27 -0300)]
tools: allow binding to other network class devices

dpdk_nic_bind will only handle Ethernet devices, but Mellanox ConnectX-3 Pro,
for example, is a Network class device, but not an Ethernet one. Even though
this allows other devices in the list, like Wireless devices, this should not be
a problem.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
8 years agolog: fix level/type retrieving from a standard thread
Maxime Leroy [Mon, 9 May 2016 16:13:36 +0000 (18:13 +0200)]
log: fix level/type retrieving from a standard thread

The functions rte_log_cur_msg_loglevel() and rte_log_cur_msg_logtype()
return the current log level/type for the message being processed. They
are used when implementing a user-defined logging stream.

The current log levels and types were stored in a table indexed by the
lcore_id, only returning a valid value for dataplane threads. Setting
and getting these values in a non dataplane thread was ignored, using
the global value instead.

To fix this issue, a per-thread variable could be used (with
RTE_DEFINE_PER_LCORE), allowing any pthread to set and retrieve its
current log level or type.

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agomk: add build directory to library search path
Ferruh Yigit [Tue, 3 May 2016 15:03:39 +0000 (16:03 +0100)]
mk: add build directory to library search path

Add default library output folder to the library search folder.

This is useful for development environment, in production environment
DPDK libraries already should be in know locations.

Patch removes requirement to set LD_LIBRARY_PATH variable when DPDK
compiled as shared library.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agomk: introduce NXP dpaa2 architecture based on armv8-a
Hemant Agrawal [Wed, 11 May 2016 13:47:59 +0000 (19:17 +0530)]
mk: introduce NXP dpaa2 architecture based on armv8-a

This patch introduces dpaa2 machine target to address difference
in cpu parameter, number of core to 8 and no numa support
w.r.t default armv8-a machine

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
8 years agoconfig: disable igb_uio for ARMv8
Hemant Agrawal [Wed, 11 May 2016 13:47:58 +0000 (19:17 +0530)]
config: disable igb_uio for ARMv8

IGB_UIO not supported for arm64 arch in kernel so disable.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
8 years agomempool: reduce structure size if no cache needed
Keith Wiles [Thu, 14 Apr 2016 09:42:36 +0000 (11:42 +0200)]
mempool: reduce structure size if no cache needed

The rte_mempool structure is changed, which will cause an ABI change
for this structure. Providing backward compat is not reasonable
here as this structure is used in multiple defines/inlines.

Allow mempool cache support to be dynamic depending on if the
mempool being created needs cache support. Saves about 1.5M of
memory used by the rte_mempool structure.

Allocating small mempools which do not require cache can consume
larges amounts of memory if you have a number of these mempools.

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agombuf: add raw allocation function
Olivier Matz [Wed, 11 May 2016 14:43:46 +0000 (16:43 +0200)]
mbuf: add raw allocation function

Many drivers provide their own implementation of rte_mbuf_raw_alloc(),
duplicating the code. Introduce a new public function in rte_mbuf to
allocate a raw mbuf (uninitialized).

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agodoc: move release notes instructions as comments
Olivier Matz [Fri, 13 May 2016 13:27:59 +0000 (15:27 +0200)]
doc: move release notes instructions as comments

We don't want to have this instructions in the generated docs, so use
comments. It's also less confusing for people adding entries in the
documentation.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agoexamples: remove useless check of port count
Mauricio Vasquez B [Tue, 3 May 2016 21:16:57 +0000 (23:16 +0200)]
examples: remove useless check of port count

The rte_eth_dev_count() function will never return a value greater
than RTE_MAX_ETHPORTS, so that checking is useless.

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agoexamples/ip_pipeline: fix initialization of firewall bulk handler
Daniel Mrzyglod [Fri, 6 May 2016 17:54:44 +0000 (19:54 +0200)]
examples/ip_pipeline: fix initialization of firewall bulk handler

bulk functions expect that all memory is set with zeros

Fixes: 67ebdbef0c31 ("examples/ip_pipeline: add bulk update of firewall rules")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: fix options array overflow
Marcin Kerlin [Thu, 14 Apr 2016 09:53:47 +0000 (11:53 +0200)]
examples/ip_pipeline: fix options array overflow

In the function app_init_eal(struct app params * app) number of
entries into array exceeds the size of the array if the conditions
are fulfilled.

Coverity issue: 124567
Fixes: 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/distributor: check mempool error
Marcin Kerlin [Tue, 19 Apr 2016 12:31:48 +0000 (14:31 +0200)]
examples/distributor: check mempool error

Value returned from a function is not checked for errors before being used.

Coverity issue: 13207
Fixes: 07db4a975094 ("examples/distributor: new sample app")

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
8 years agoexamples/netmap_compat: fix infinite loop
Michal Kobylinski [Wed, 27 Apr 2016 13:22:41 +0000 (15:22 +0200)]
examples/netmap_compat: fix infinite loop

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.

Coverity issue: 30701
Fixes: 06371afe ("examples/netmap_compat: import netmap compatibility example")

Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
8 years agoexamples/qos_meter: check flow configuration error
Slawomir Mrozowicz [Fri, 13 May 2016 08:35:07 +0000 (10:35 +0200)]
examples/qos_meter: check flow configuration error

Calling rte_meter_srtcm_config without checking return value.

Coverity issue: 30693
Fixes: e6541fdec8b2 ("meter: initial import")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/qos_sched: fix lcore limit
Slawomir Mrozowicz [Wed, 11 May 2016 08:48:05 +0000 (10:48 +0200)]
examples/qos_sched: fix lcore limit

In expression 1ULL << i, left shifting by more than 63 bits
has undefined behavior. The shift amount, i, is as much as 127.

Coverity issue: 30690
Fixes: de3cfa2c9823 ("sched: initial import")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/qos_sched: fix error message
Slawomir Mrozowicz [Thu, 21 Apr 2016 13:08:12 +0000 (15:08 +0200)]
examples/qos_sched: fix error message

rx_port in pconf->rx_port looks like a copy-paste error.

Coverity issue: 30699
Fixes: de3cfa2c9823 ("sched: initial import")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/qos_sched: fix negative loop bound in option parsing
Slawomir Mrozowicz [Thu, 21 Apr 2016 13:08:11 +0000 (15:08 +0200)]
examples/qos_sched: fix negative loop bound in option parsing

negative_returns: Using unsigned variable n_tokens in a loop exit condition.

Coverity issue: 30704
Fixes: de3cfa2c9823 ("sched: initial import")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/qos_sched: fix out-of-bounds option parsing
Slawomir Mrozowicz [Thu, 21 Apr 2016 11:47:36 +0000 (13:47 +0200)]
examples/qos_sched: fix out-of-bounds option parsing

overrun-local: Overrunning array tokens of 8 8-byte elements
at element index 4294967294 (byte offset 34359738352)
using index i (which evaluates to 4294967294).

Coverity issue: 30708
Fixes: de3cfa2c9823 ("sched: initial import")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/kni: print release error
Daniel Mrzyglod [Mon, 9 May 2016 09:38:30 +0000 (11:38 +0200)]
examples/kni: print release error

In kni_free_kni: Value returned from a function is not checked for errors
before being used

Coverity issue: 30692
Fixes: b475eb0bc400 ("examples/kni: new parameters")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoexamples/vm_power_manager: ensure domain name is null terminated
Daniel Mrzyglod [Tue, 10 May 2016 15:49:22 +0000 (17:49 +0200)]
examples/vm_power_manager: ensure domain name is null terminated

In add_vm: The string buffer may not have a null terminator if the source
string's length is equal to the buffer size

Coverity issue: 30691
Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
8 years agopower: fix error messages
Daniel Mrzyglod [Wed, 20 Apr 2016 14:39:30 +0000 (16:39 +0200)]
power: fix error messages

Function strerror(errno) has built strings only for non-negative errno values.
for negative values of errno it describe error as "Unknown error -errno"
to be more descriptive i put string "channel not found" taken from header.

The negative argument will be interpreted as a very large unsigned value.

Coverity issue: 13266
Coverity issue: 13269
Fixes: 445c6528b55f ("power: common interface for guest and host")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
8 years agoconfig: disable qede for ARMv7
Jan Viktorin [Mon, 9 May 2016 21:34:16 +0000 (23:34 +0200)]
config: disable qede for ARMv7

The qede PMD driver is failing when building for ARMv7:

drivers/net/qede/base/ecore_dev.c:1150:6:
error: variable ‘prs_reg’ set but not used
[...]
drivers/net/qede/base/ecore_dev.c:2492:13:
error: variable ‘p_phys’ set but not used
[...]
drivers/net/qede/base/ecore_dev.c:2532:39:
error: variable ‘pbl_size’ set but not used

Fixes: 3eae93a9bfd5 ("qede: enable PMD build")

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agoqede: fix build with gcc 6
Panu Matilainen [Tue, 10 May 2016 10:01:25 +0000 (13:01 +0300)]
qede: fix build with gcc 6

With gcc >= 6.0, qede base driver fails to build with:
drivers/net/qede/base/ecore_cxt.c: In function 'ecore_cdu_init_common':
cc1: error: left shift of negative value [-Werror=shift-negative-value]

Since the base drivers are untouchable, work around by disabling
the warning.

Fixes: ec94dbc57362 ("qede: add base driver")

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
8 years agoqede: fix build with icc
Ferruh Yigit [Tue, 10 May 2016 11:23:27 +0000 (12:23 +0100)]
qede: fix build with icc

fix errors:
icc: command line warning #10006: ignoring unknown option '-Wno-unused-value'
icc: command line warning #10006: ignoring unknown option '-Wno-format-nonliteral'
icc: command line warning #10006: ignoring unknown option '-Wno-shift-negative-value'
qede/base/ecore_dev.c(1643): error #188: enumerated type mixed with another type
        return 0;
               ^

Fixes: ec94dbc57362 ("qede: add base driver")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Harish Patil <harish.patil@qlogic.com>
8 years agovhost: fix name not null terminated
Daniel Mrzyglod [Tue, 10 May 2016 16:11:18 +0000 (18:11 +0200)]
vhost: fix name not null terminated

Fix issue reported by Coverity.
Coverity ID 124556

If the buffer is treated as a null terminated string in later operations,
a buffer overflow or over-read may occur.

In vhost_set_ifname: The string buffer may not have a null terminator if
the source string's length is equal to the buffer size

Fixes: 54292e9520e0 ("vhost: support ifname for vhost-user")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: embed statistics into device structure
Yuanhan Liu [Mon, 2 May 2016 21:23:50 +0000 (14:23 -0700)]
examples/vhost: embed statistics into device structure

Embed dev_statistics into vhost_dev struct, which could clean
the code a bit.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: clean switch worker
Yuanhan Liu [Mon, 2 May 2016 21:23:49 +0000 (14:23 -0700)]
examples/vhost: clean switch worker

switch_worker() is the last piece of code that is messy yet it touches
virtio/vhost device.

Here do a cleanup, so that we will be less painful for later vhost ABI
refactoring.

The cleanup is straight forward: break long lines, move some code into
functions. The last, comment a bit on switch_worker().

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: fix mbuf allocation failure
Yuanhan Liu [Mon, 2 May 2016 21:23:48 +0000 (14:23 -0700)]
examples/vhost: fix mbuf allocation failure

It has always been a mystery (at least to me before) that how many
mbuf is enough while creating an mbuf pool. While current macro
NUM_MBUFS_PER_PORT gives your some insights, it's not that accurate:
it doesn't consider the case we may receive a big packet, say 64K
when TSO is enabled.

We actually have tried to fix it once before, with commit 5499c1fc9baa
("examples/vhost: fix mbuf allocation"), but it just workarounded it
by enlarging it a bit so that the case described in the commit log
by passes. So, while trying to fix it ultimately, I'm thinking how
big is big enough, and what are the factors need consider to figure
out a proper value.

Therefore, here you are. I introduced a helper function to create
the mbuf pool, and do the "how many mbufs are needed" calculation
there. Also, I put detailed comments how that comes, to serve as
the guidelines.

Fixes: 9fd72e3cbd29 ("examples/vhost: add virtio offload")
Fixes: 5499c1fc9baa ("examples/vhost: fix mbuf allocation")

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: handle broadcast packet
Yuanhan Liu [Mon, 2 May 2016 21:23:47 +0000 (14:23 -0700)]
examples/vhost: handle broadcast packet

Every time I do a VM2VM iperf test with vhost example, I have to set
the arp table manually, as vhost-switch just ignores the broadcast
packet, leaving the ARP request not served.

Here we do a transmit a broadcast packet (such as ARP request) to
every vhost device, as well as the physical port, to fix above
arp table issue.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: use MAC compare helper
Yuanhan Liu [Mon, 2 May 2016 21:23:46 +0000 (14:23 -0700)]
examples/vhost: use MAC compare helper

rte_ether.h already provides a helper function to do mac address
compare. No need to define our own, use it directly.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: use tailq to link vhost devices
Yuanhan Liu [Mon, 2 May 2016 21:23:45 +0000 (14:23 -0700)]
examples/vhost: use tailq to link vhost devices

To simplify code and logic.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: remove unused macro and struct
Yuanhan Liu [Mon, 2 May 2016 21:23:44 +0000 (14:23 -0700)]
examples/vhost: remove unused macro and struct

Interestingly, DESC_PER_CACHELINE has never been used since the
introduction of vhost example. Remove it.

vlan_ethhdr struct and VLAN_ETH_HLEN macro reference had been removed
by commit 4d50b6acbd95 ("examples/vhost: adapt Tx routing to lib"), but
had forgot to remove the definition.

Fixes: 4d50b6acbd95 ("examples/vhost: adapt Tx routing to lib")

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: remove the non-working zero copy code
Yuanhan Liu [Mon, 2 May 2016 21:23:43 +0000 (14:23 -0700)]
examples/vhost: remove the non-working zero copy code

It's reported that it's has not been working for a long while. And due
to it's complex, it's better to redesign it than to fix it to make it
work again.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovirtio: fix memory leak of virtqueue memzones
Jianfeng Tan [Fri, 29 Apr 2016 00:48:46 +0000 (00:48 +0000)]
virtio: fix memory leak of virtqueue memzones

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 ff909fe21f0a ("mem: introduce memzone freeing").

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.

Fixes: c1f86306a026 ("virtio: add new driver")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovirtio: simplify queue allocation
Jianfeng Tan [Fri, 29 Apr 2016 00:48:45 +0000 (00:48 +0000)]
virtio: simplify queue allocation

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovirtio: fix overwritten driver flags
Jianfeng Tan [Mon, 9 May 2016 16:35:57 +0000 (09:35 -0700)]
virtio: fix overwritten driver flags

The "drv_flags" is set with device as the input, which means different
device (say, modern vs legacy) could end up with a different value. And
the fact that "drv_flags" is shared by all devices means that every time
we add a new device, it simply overwrites the value configured from the
last device.

Therefore, when two virtio devices have different flags, it may lead to
wrong result, such as virtio would set irq config when it's not supported.

Making the flag per device (using "dev->data->dev_flags") could let us
have different value for each device, which would avoid the above issue.

Fixes: da978dfdc43 ("virtio: use port IO to get PCI resource")

Reported-by: David Marchand <david.marchand@6wind.com>
Suggested-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovirtio: optimize avail ring update
Huawei Xie [Wed, 27 Apr 2016 08:53:58 +0000 (04:53 -0400)]
virtio: optimize avail ring update

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.

Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix linkage of driver with library
Tetsuya Mukawa [Tue, 26 Apr 2016 05:39:29 +0000 (14:39 +0900)]
vhost: fix linkage of driver with library

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.

Fixes: ee584e9710b9 ("vhost: add driver on top of the library")

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agomk: add build-time library directory to linker path
Panu Matilainen [Wed, 27 Apr 2016 11:02:09 +0000 (14:02 +0300)]
mk: add build-time library directory to linker path

This is a pre-requisite for adding DT_NEEDED dependencies
between internal libraries.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Tested-by: Tetsuya Mukawa <mukawa@igel.co.jp>
8 years agovirtio: fix mbuf headroom size check
Huawei Xie [Tue, 26 Apr 2016 23:27:55 +0000 (07:27 +0800)]
virtio: fix mbuf headroom size check

check merge-able header as it is supported.
previously we don't support merge-able feature, so non merge-able
header is checked.

Fixes: 13ce5e7eb94f ("virtio: mergeable buffers")

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovirtio: fix segfault on Tx desc flags setup
Jianfeng Tan [Mon, 25 Apr 2016 02:37:45 +0000 (02:37 +0000)]
virtio: fix segfault on Tx desc flags setup

After the do-while loop, idx could be VQ_RING_DESC_CHAIN_END (32768)
when it's the last vring desc buf we can get. Therefore, following
expresssion could lead to a segfault error, as it tries to access
beyond the desc memory boundary.

    start_dp[idx].flags &= ~VRING_DESC_F_NEXT;

This bug could be reproduced easily with "set fwd txonly" in the
guest PMD, where the dequeue on host is slower than the guest Tx,
that running out of free desc buf is pretty easy.

The fix is straightforward and easy, just remove it, as we have
already set desc flags properly inside the do-while loop.

Fixes: dd856dfcb9e ("virtio: use any layout on Tx")

[Yuanhan Liu: commit log reword]
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovirtio: fix newline under debug mode
Jianfeng Tan [Tue, 19 Apr 2016 05:22:37 +0000 (05:22 +0000)]
virtio: fix newline under debug mode

Issue: output of appliations and debug info of DPDK may be mixed up
in same line when enabling below debug options of virtio:
CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_INIT
CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_TX
CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_DRIVER

This patch adds "\n" in the tail of definitions like PMD_RX_LOG,
PMD_TX_LOG, and PMD_DRV_LOG, and removes some "\n" when using these
macros.

Fixes: c1f86306a026 ("virtio: add new driver")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoi40e: fix VLAN stripping from inner header
Jingjing Wu [Wed, 4 May 2016 05:42:25 +0000 (13:42 +0800)]
i40e: fix VLAN stripping from inner header

Previously, for tunnel packets, such as VXLAN/NVGRE, the vlan
tags of the inner header will be stripped without putting vlan
info to descriptor, what is not expected behaviour.
This patch fixes it by changing hardware configuration to leave
the inner packet alone.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
8 years agoi40evf: expose queue info functions reused from PF
Beilei Xing [Thu, 28 Apr 2016 03:18:19 +0000 (11:18 +0800)]
i40evf: expose queue info functions reused from PF

Add three new functions to the vf ops structure:
* rx_queue_count
* rxq_info_get
* txq_info_get
In all cases, the corresponding PF APIs can be reused.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
8 years agoenic: fix offset for Rx mbuf data
John Daley [Wed, 27 Apr 2016 02:51:56 +0000 (19:51 -0700)]
enic: fix offset for Rx mbuf data

The code to provide mbufs for RX used m->data_off instead of
RTE_PKTMBUF_HEADROOM as the position inside the mbuf for the data to be
written. As the mbuf is uninitialised, this could potentially cause Rx
data to be placed at the wrong address in the mbuf - or even outside it.

Fixes: 947d860c821f ("enic: improve Rx performance")

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonfp: expose device hotplug capability
Alejandro Lucero [Tue, 26 Apr 2016 13:10:25 +0000 (14:10 +0100)]
nfp: expose device hotplug capability

RTE_PCI_DRV_DETACHABLE flag is required to indicate that a device
can be detached during execution.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
8 years agonfp: fix freeing multi-mbuf packets
Alejandro Lucero [Tue, 26 Apr 2016 13:06:36 +0000 (14:06 +0100)]
nfp: fix freeing multi-mbuf packets

mbufs were not properly released post-tx when they are chained.

Fixes: b812daadad0d ("nfp: add Rx and Tx")

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
8 years agonfp: serialize access for hardware reconfiguration
Alejandro Lucero [Tue, 26 Apr 2016 13:03:01 +0000 (14:03 +0100)]
nfp: serialize access for hardware reconfiguration

Some apps calling some functions from different threads at the
same time could lead to reconfig problems. Reconfig mechanism is
based on a hardware queue where incrementing a counter signals the
firmware to do the reconfig. If there is a second increment before the
first one has been processed the firmware will stop and a device
reset is necessary.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
8 years agomk: cleanup leftover references to malloc library
Panu Matilainen [Tue, 26 Apr 2016 12:16:01 +0000 (15:16 +0300)]
mk: cleanup leftover references to malloc library

librte_malloc was long since merged into librte_eal, mop up the
leftover references to it from driver Makefiles.

Fixes: 2f9d47013e4d ("mem: move librte_malloc to eal/common")

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Applied with qede Makefile update too.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoi40evf: report error for unsupported CRC stripping config
Björn Töpel [Fri, 22 Apr 2016 05:39:22 +0000 (07:39 +0200)]
i40evf: report error for unsupported CRC stripping config

On hosts running a non-DPDK PF driver, the VF has no means of changing
the HW CRC strip setting for a RX queue. It's implicitly enabled.

This patch checks if the host is running a non-DPDK PF kernel driver,
and returns an error, if HW CRC stripping was not requested in the port
configuration.

Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoi40e: remove unneeded NULL check
Daniel Mrzyglod [Mon, 18 Apr 2016 17:13:23 +0000 (19:13 +0200)]
i40e: remove unneeded NULL check

In i40evf_config_vlan_pvid the check for NULL for the dev value is
unnecessary, since this value is passed in from the ethdev API which
will ensure that a valid rte_eth_dev structure is provided.
Furthermore, all code paths leading to this function already use the
dev value.

Issue identified 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 <danielx.t.mrzyglod@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
8 years agoi40e: simplify SSE packet length extraction code
Bruce Richardson [Thu, 14 Apr 2016 16:02:37 +0000 (17:02 +0100)]
i40e: simplify SSE packet length extraction code

In Table 8-16 of the "Intel® Ethernet Controller XL710 Datasheet" it is
stated that when the whole packet is written to a single buffer, the
header length field in the descriptor will be 0. This means that when
extracting the packet/data_len field from the descriptor in the driver
we do not need to mask out the extra header-length bits.

Inside the vector driver, this reduces the need to pull all four pktlen
fields into a single register to work on. Instead of a shift and mask,
we now need to only do a shift. Therefore, we can work on each descriptor
independently, processing each using one shift intrinsic and a blend.

This change makes the code shorter and easier to read, so we can pull it
into the main descriptor processing loop instead of needing its own
function. This in turn makes the descriptor processing in the loop as a
whole slightly easier to read as it's more linear.

In terms of performance, in testing this change shows little effect, with
single-core perf tests showing a very slight improvement.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Zhe Tao <zhe.tao@intel.com>
8 years agoi40e: improve performance of vector PMD
Bruce Richardson [Thu, 14 Apr 2016 16:02:36 +0000 (17:02 +0100)]
i40e: improve performance of vector PMD

An analysis of the i40e code using Intel® VTune™ Amplifier 2016 showed
that the code was unexpectedly causing stalls due to "Loads blocked by
Store Forwards". This can occur when a load from memory has to wait
due to the prior store being to the same address, but being of a smaller
size i.e. the stored value cannot be directly returned to the loader.
[See ref: https://software.intel.com/en-us/node/544454]

These stalls are due to the way in which the data_len values are handled
in the driver. The lengths are extracted using vector operations, but those
16-bit lengths are then assigned using scalar operations i.e. 16-bit
stores.

These regular 16-bit stores actually have two effects in the code:
* they cause the "Loads blocked by Store Forwards" issues reported
* they also cause the previous loads in the RX function to actually be a
load followed by a store to an address on the stack, because the 16-bit
assignment can't be done to an xmm register.

By converting the 16-bit store operations into a sequence of SSE blend
operations, we can ensure that the descriptor loads only occur once, and
avoid both the additional stores and loads from the stack, as well as the
stalls due to the blocked loads.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Zhe Tao <zhe.tao@intel.com>
8 years agoi40e: require SSE4.1 support for vector driver
Bruce Richardson [Thu, 14 Apr 2016 16:02:35 +0000 (17:02 +0100)]
i40e: require SSE4.1 support for vector driver

Later commits to improve the driver will make use of the SSE4.1
_mm_blend_epi16 intrinsic, so:
* set the compilation level to always have SSE4.1 support,
* and add in a runtime check for SSE4.1 as part of the condition checks
  for vector driver selection.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Zhe Tao <zhe.tao@intel.com>
8 years agoi40e: remove redundant fdir forward declarations
Rami Rosen [Sat, 26 Mar 2016 01:32:08 +0000 (04:32 +0300)]
i40e: remove redundant fdir forward declarations

This patch removes several redundant forward declarations
in i40e_fdir.c.

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

Signed-off-by: Rami Rosen <rami.rosen@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoqede: add DCBX support
Rasesh Mody [Wed, 27 Apr 2016 14:18:42 +0000 (07:18 -0700)]
qede: add DCBX support

This patch adds LLDP and DCBX capabilities to the qede PMD.

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
8 years agoqede: add interrupt handling support
Rasesh Mody [Wed, 27 Apr 2016 14:18:41 +0000 (07:18 -0700)]
qede: add interrupt handling support

The 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 <harish.patil@qlogic.com>
Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
8 years agoqede: add SRIOV support
Rasesh Mody [Wed, 27 Apr 2016 14:18:40 +0000 (07:18 -0700)]
qede: add SRIOV support

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 <harish.patil@qlogic.com>
Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
8 years agoqede: add L2 support
Rasesh Mody [Wed, 27 Apr 2016 14:18:39 +0000 (07:18 -0700)]
qede: add L2 support

This patch adds the features to supports configuration of various Layer 2
elements, such as channels and filtering options.

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
8 years agoqede: enable PMD build
Rasesh Mody [Wed, 27 Apr 2016 14:18:38 +0000 (07:18 -0700)]
qede: enable PMD build

This patch enables the QEDE PMD build.

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
8 years agoqede: add core driver
Rasesh Mody [Wed, 27 Apr 2016 14:18:37 +0000 (07:18 -0700)]
qede: add core driver

The Qlogic Everest Driver for Ethernet(QEDE) Poll Mode Driver(PMD) is
the DPDK specific module for QLogic FastLinQ QL4xxxx 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 <harish.patil@qlogic.com>
Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
8 years agoqede: add base driver
Rasesh Mody [Wed, 27 Apr 2016 14:18:36 +0000 (07:18 -0700)]
qede: add base driver

The base driver is the backend module for the QLogic FastLinQ QL4xxxx
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 <harish.patil@qlogic.com>
Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
8 years agoixgbe: fix bit shift overflow in VMDQ pool setup
Tomasz Kulasek [Fri, 22 Apr 2016 15:35:57 +0000 (17:35 +0200)]
ixgbe: fix bit shift overflow in VMDQ pool setup

Fix issue reported by Coverity.

Coverity ID 13193: Bad bit shift operation (BAD_SHIFT)
large_shift: In expression 1 << pool, left shifting by more than 31 bits
has undefined behavior. The shift amount, pool, is at least 32.

This patch is a rework of register addr selection logic and mask
computation to made it more readable and avoid bit overflow when 32 bit
value is shifted over its size for pool > 31.

Fixes: fe3a45fd4104 ("ixgbe: add VMDq support")

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoi40e: fix packet count stats
Jingjing Wu [Tue, 19 Apr 2016 06:11:13 +0000 (14:11 +0800)]
i40e: fix packet count stats

The statistics queried by calling rte_eth_stats_get are zero when
the API is first called on the port. The root cause is because the
offset_loaded flag is not set correctly after device start.
This patch fixes this issue by resetting statistics at initialization
time. The resetting process will set offset_loaded flag.

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

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agofm10k: fix packet type for multi-segment packets
Michael Frasca [Mon, 18 Apr 2016 12:51:52 +0000 (08:51 -0400)]
fm10k: fix packet type for multi-segment packets

When building a chain of mbufs for a multi-segment packet, the
packet_type field resides at the end of the chain. It should be
copied forward to the head of the list.

Also, uses RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE to guard packet-type
computation. The mbuf fields are not copied when this define is not set.

Fixes: fe65e1e1ce61 ("fm10k: add vector scatter Rx")

Signed-off-by: Michael Frasca <michael.frasca@oracle.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
8 years agoixgbe: fix bit masking in queue stop
Piotr Azarewicz [Thu, 14 Apr 2016 09:59:30 +0000 (11:59 +0200)]
ixgbe: fix bit masking in queue stop

The masking for the RX/TX enable bit was incorrect in the rx and tx
queue stop functions. Instead of using "& MASK" it used "| MASK" which
would always return true. This error was found by converity scan.

CID 13215 : Wrong operator used (CONSTANT_EXPRESSION_RESULT)
operator_confusion: txdctl | 33554432 is always 1/true regardless of the
values of its operand. This occurs as the logical second operand of
'&&'.

CID 13216 : Wrong operator used (CONSTANT_EXPRESSION_RESULT)
operator_confusion: rxdctl | 33554432 is always 1/true regardless of the
values of its operand. This occurs as the logical second operand of
'&&'.

Coverity issue: 13215
Coverity issue: 13216
Fixes: 029fd06d40fa ("ixgbe: queue start and stop")

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agoi40e: fix register dump offset
Remy Horton [Wed, 13 Apr 2016 09:44:45 +0000 (10:44 +0100)]
i40e: fix register dump offset

The position of register values within i40e register dumps is
supposed to reflect the register addresses. These were not being
correctly calculated.

Fixes: d9efd0136ac1 ("i40e: add EEPROM and registers dumping")

Signed-off-by: Remy Horton <remy.horton@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
8 years agoixgbe: clean up code style
Stephen Hemminger [Thu, 7 Apr 2016 23:45:28 +0000 (16:45 -0700)]
ixgbe: clean up code style

Run ixgbe driver through checkpatch and fix the issues highlighted
Fix line spacing, some bad indentation, and in a couple
of cases use short circuit (already there) return to lessen indentation.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Applied with four additional fixes for issues highlighted by checkpatch
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoeal: add missing include to debug header
Bruce Richardson [Wed, 4 May 2016 16:37:56 +0000 (17:37 +0100)]
eal: add missing include to debug header

The header file rte_debug.h makes use of the "unlikely" macro which
means it should include the rte_branch_prediction.h header file.

Fixes: 50705e8e3cdd ("eal: add assert macro for debug")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agomk: do not enforce any specific ARM ABI
Jan Viktorin [Fri, 15 Apr 2016 22:33:06 +0000 (00:33 +0200)]
mk: do not enforce any specific ARM ABI

The dpdk build system passes -mfloat-abi=softfp, which makes the build fail
when the selected ABI is EABIhf. The dpdk build system should not make
assumptions on the selected ARM ABI.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agoeal: add assert macro for debug
Thomas Monjalon [Fri, 22 Apr 2016 12:21:26 +0000 (14:21 +0200)]
eal: add assert macro for debug

The macro RTE_VERIFY always checks a condition.
It is optimized with "unlikely" hint.
While this macro is well suited for test applications, it is preferred
in libraries and examples to enable such check in debug mode.
That's why the macro RTE_ASSERT is introduced to call RTE_VERIFY only
if built with debug logs enabled.

A lot of assert macros were duplicated and enabled with a specific flag.
Removing these #ifdef allows to test these code branches more easily
and avoid dead code pitfalls.

The ENA_ASSERT is kept (in debug mode only) because it has more
parameters to log.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoexamples: remove useless debug flags
Thomas Monjalon [Fri, 22 Apr 2016 10:52:20 +0000 (12:52 +0200)]
examples: remove useless debug flags

The debug logs must be enabled at compile-time and run-time.
There are also some internal flags in some examples to enable the debug
logs of the applications. They are now enabled in debug configs and
can be disabled thanks to the more generic logtype mechanism:
rte_set_log_type(RTE_LOGTYPE_USER1, 0);

Removing these #ifdef allows to test these code branches more easily
and avoid dead code pitfalls.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agolog: increase default level to info
Thomas Monjalon [Fri, 22 Apr 2016 10:25:59 +0000 (12:25 +0200)]
log: increase default level to info

The default was to compile every logs (including debug) and set
the default level to debug.
As some debug logs may hurt performance, a notice is added and the
default level is now info.

In order to enable debug logs, they must be compiled with
RTE_LOG_LEVEL=RTE_LOG_DEBUG and enabled at runtime with --log-level=8.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoeal: increase log level of some messages
Thomas Monjalon [Fri, 22 Apr 2016 13:03:02 +0000 (15:03 +0200)]
eal: increase log level of some messages

Some relevant EAL logs are raised from debug to info level in order to
show the available number of cores and the detected devices.
The driver ids and name are logged only if the device is not blacklisted.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agocmdline: add any multi string mode to token string
Piotr Azarewicz [Fri, 29 Apr 2016 14:29:34 +0000 (16:29 +0200)]
cmdline: add any multi string mode to token string

While parsing token string there may be several modes:
- fixed single string
- multi-choice single string
- any single string

This patch add one more mode - any multi string.

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agocfgfile: fix uninitialized variable on load error
Michal Kobylinski [Wed, 13 Apr 2016 12:15:02 +0000 (14:15 +0200)]
cfgfile: fix uninitialized variable on load error

CID 13323:
Uninitialized scalar variable. Using uninitialized value
cfg->num_sections when calling rte_cfgfile_close.

Fixes: eaafbad419bf ("cfgfile: library to interpret config files")

Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agocfgfile: fix return value comment
Dmitriy Yakovlev [Fri, 15 Apr 2016 22:58:43 +0000 (01:58 +0300)]
cfgfile: fix return value comment

Function rte_cfgfile_load can return NULL value, when something goes wrong.

Signed-off-by: Dmitriy Yakovlev <bombermag@gmail.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agolpm6: fix possible garbage in lookup
Daniel Mrzyglod [Wed, 27 Apr 2016 15:07:53 +0000 (17:07 +0200)]
lpm6: fix possible garbage in lookup

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 <danielx.t.mrzyglod@intel.com>
8 years agolpm6: fix missing header dependency
Igor Ryzhov [Thu, 28 Apr 2016 12:08:33 +0000 (15:08 +0300)]
lpm6: fix missing header dependency

Include stdint.h for the definition of uint*_t types.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
8 years agolpm: fix freeing in compatibility mode
Christian Ehrhardt [Tue, 12 Apr 2016 13:49:27 +0000 (15:49 +0200)]
lpm: fix freeing in compatibility mode

Back then when we fixed the missing free lpm I was to quickly to say yes
if it applies not only to the lpm6 but also to all of the lpm code.

It turned out to not apply to all of them. In rte_lpm_create_v20 there
is an unexpected fused allocation:
mem_size = sizeof(*lpm) + (sizeof(lpm->rules_tbl[0]) * max_rules);
[...]
lpm = (struct rte_lpm_v20 *)rte_zmalloc_socket(mem_name,mem_size,
               RTE_CACHE_LINE_SIZE, socket_id);

That causes lpm->rules_tbl not to have an own struct malloc_elem that
can be derived via RTE_PTR_SUB(data, MALLOC_ELEM_HEADER_LEN) in
malloc_elem_from_data.
Due to that the rte_lpm_free_v20 accidentially misderives the elem and
assumes it is ELEM_FREE triggering in malloc_elem_free
if (!malloc_elem_cookies_ok(elem) || elem->state !=
        return -1;

While it seems counter-intuitive the way to properly remove rules_tbl in
the old fused allocation style of rte_lpm_free_v20 is to not remove it.

The newer rte_lpm_free_v1604 is safe because in rte_lpm_create_v1604
rules_tbl is a separate allocation.

Fixes: d4c18f0a1d5d ("lpm: fix missing free")

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoip_frag: fix double free of chained mbufs
Chaeyong Chong [Thu, 21 Apr 2016 17:28:01 +0000 (02:28 +0900)]
ip_frag: fix double free of chained mbufs

If any fragment hole is found in ipv4_frag_reassemble() and
ipv6_frag_reassemble(), whole ip_frag_pkt mbufs are moved to death-row.
Any mbufs already chained to another mbuf are freed multiple times as
there are still in ip_frag_pkt array.

Signed-off-by: Chaeyong Chong <cychong@gmail.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agomem: fix freeing of memzone used by ivshmem
Mauricio Vasquez B [Fri, 15 Apr 2016 08:29:49 +0000 (10:29 +0200)]
mem: fix freeing of memzone used by ivshmem

Although previous implementation returned an error when trying to release
a memzone assigned to an ivshmem device, it stills freed it.

Fixes: cd10c42eb5bc ("mem: fix ivshmem freeing")

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agokni: support chained mbufs
Ferruh Yigit [Tue, 26 Apr 2016 12:37:58 +0000 (13:37 +0100)]
kni: support chained mbufs

rx_q fifo may have chained mbufs, merge them into single skb before
handing to the network stack.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agokni: keep ethernet MAC address when interface goes up
Igor Ryzhov [Thu, 21 Apr 2016 16:27:30 +0000 (19:27 +0300)]
kni: keep ethernet MAC address when interface goes up

Currently every time a KNI interface goes up, its ethernet address
is reassigned.
After this patch ethernet address is assigned only once,
at initialization time.

Suggested-by: Sergey Balabanov <balabanovsv@ecotelecom.ru>
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
8 years agoapp/testpmd: fix string overrun in engines listing
Tomasz Kulasek [Mon, 11 Apr 2016 16:03:48 +0000 (18:03 +0200)]
app/testpmd: fix string overrun in engines listing

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 <tomaszx.kulasek@intel.com>
8 years agoexamples/performance-thread: fix crash with gcc 5
Tomasz Kulasek [Tue, 26 Apr 2016 15:47:56 +0000 (17:47 +0200)]
examples/performance-thread: fix crash with gcc 5

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.

The same patch was applied for original l3fwd (af1694d94).

Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
8 years agoexamples/exception_path: fix shift operation in lcore setup
Daniel Mrzyglod [Fri, 15 Apr 2016 15:29:40 +0000 (17:29 +0200)]
examples/exception_path: fix shift operation in lcore setup

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 <danielx.t.mrzyglod@intel.com>
8 years agoacl: fix division by float zero in test app
Daniel Mrzyglod [Fri, 22 Apr 2016 16:00:50 +0000 (18:00 +0200)]
acl: fix division by float zero in test app

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 <danielx.t.mrzyglod@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>