dpdk.git
8 years agovhost: check ring descriptor address
Ilya Maximets [Fri, 15 Jul 2016 11:15:05 +0000 (14:15 +0300)]
vhost: check ring descriptor address

In current implementation vhost will crash with segmentation fault
if malicious or buggy virtio application breaks addresses of descriptors.

Before commit 0823c1cb0a73 ("vhost: workaround stale vring base")
this crash was reproducible even with normal DPDK application that tries
to change number of virtqueues dynamically inside VM.

Fix that by checking addresses of descriptors before using.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix used descriptors number of mergeable enqueue
Ilya Maximets [Fri, 15 Jul 2016 11:15:04 +0000 (14:15 +0300)]
vhost: fix used descriptors number of mergeable enqueue

Return value on error changed from '-1' to '0' because it returns
unsigned value and it means number of used descriptors.

Also fixed updating of 'last_used_idx' by using actual number of
used descriptors.

Fixes: 623bc47054d0 ("vhost: do sanity check for ring descriptor length")

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovfio: fix coding style
Yong Wang [Thu, 7 Jul 2016 22:26:37 +0000 (15:26 -0700)]
vfio: fix coding style

Signed-off-by: Yong Wang <yongwang@vmware.com>
8 years agovfio: fix PCI resource mapping
Yong Wang [Fri, 15 Jul 2016 00:15:10 +0000 (17:15 -0700)]
vfio: fix PCI resource mapping

The offset of the 2nd mmap() when mapping the region after msix_bar
needs to take region address into consideration as mmap() takes
address that is resource-relative instead of bar-relative.  This is
exposed when binding vmxnet3 to vfio-pci.

Fixes: 90a1633b2347 ("eal/linux: allow to map BARs with MSI-X tables")

Signed-off-by: Yong Wang <yongwang@vmware.com>
Signed-off-by: Ronghua Zhang <rzhang@vmware.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
8 years agomempool: fix empty structure definition
Adrien Mazarguil [Wed, 13 Jul 2016 12:30:41 +0000 (14:30 +0200)]
mempool: fix empty structure definition

This commit addresses the following warning reported by clang, which
happens by default, as long as CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG is disabled:

 warning: empty struct has size 0 in C, size 1 in C++

C and C++ must use the same size for objects to avoid corruption during run
time.

Fixes: 97e7e685bfcd ("mempool: add structure for object trailers")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agospinlock: move constructor out of x86 header file
Damjan Marion [Thu, 14 Jul 2016 13:27:29 +0000 (15:27 +0200)]
spinlock: move constructor out of x86 header file

Having constructor function in the header file is generally
a bad idea, as it will eventually be implanted to 3rd party
library.

In this case it causes linking issues with 3rd party libraries
when an application is not linked to dpdk, due to missing
symbol called by constructor.

Fixes: ba7468997ea6 ("spinlock: add HTM lock elision for x86")

Signed-off-by: Damjan Marion <damarion@cisco.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoapp/test: filter out unavailable tests
Thomas Monjalon [Wed, 13 Jul 2016 16:41:12 +0000 (18:41 +0200)]
app/test: filter out unavailable tests

Some tests can fail to run because they are not compiled.
It has been more visible recently when the PCI test became disabled
in the default configuration because of dependency on libarchive:
    PCI autotest:    Fail [Not found]

The autotest script catch them and do not count them as an error anymore:
    PCI autotest:    Skipped [Not Available]

The commands dump_ring and dump_mempool are removed from the autotest list
because they are some internal commands but not some registered tests.
Thus they cannot be parsed as available test commands.

Suggested-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoapp/test: rework command registration
Thomas Monjalon [Wed, 13 Jul 2016 12:38:13 +0000 (14:38 +0200)]
app/test: rework command registration

The tests are registered with their command name by adding a structure
to a list. The structure of each test was declared in each test file
and passed to the register macro.
This rework generate the structure inside the register macro.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agomk: fix default rule of test subdirectory
Thomas Monjalon [Tue, 12 Jul 2016 10:11:06 +0000 (12:11 +0200)]
mk: fix default rule of test subdirectory

When using "make -C app/test" (with RTE_SDK/RTE_TARGET adjusted)
without specifying the rule (all), the build is not done.
Indeed the default rule is not "all" anymore since there are some
rules added for external resources link.

It is fixed by adding a reference to "all" at the top of the file
which makes it the default rule.

Note that make app/test_sub (without environment variable) is preffered.

Fixes: ab64f5df8004 ("app/test: support resources externally linked")

Reported-by: Reshma Pattan <reshma.pattan@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
8 years agomk: fix dependency on toolchain libraries
Thomas Monjalon [Tue, 12 Jul 2016 13:00:13 +0000 (15:00 +0200)]
mk: fix dependency on toolchain libraries

The -l options specifying libraries to link with are in LDLIBS.
But it can happen to have some libraries in other variables.
In case of a low level dependency specified in some environments
via EXTRA_LDFLAGS, there can be an unresolved issue due to a
wrong linking order. Indeed the libraries must be specified from
the higher level (dependency consumers) to the lower level (dependencies).

It is fixed by moving LDLIBS before LDFLAGS variables in the link
command line.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: Raslan Darawsheh <rasland@mellanox.com>
8 years agomk: clean up application linker flags
Thomas Monjalon [Tue, 12 Jul 2016 12:25:35 +0000 (14:25 +0200)]
mk: clean up application linker flags

Make some cleaning before fixing the link dependency ordering
in the next commit.

- Move flags for creating a map file in the variable MAPFLAGS.
- Make only one call to linkerprefix macro.
- Group linker flags on the same line.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: remove old build option
Thomas Monjalon [Mon, 11 Jul 2016 21:33:43 +0000 (23:33 +0200)]
scripts: remove old build option

The config option CONFIG_RTE_PCI_CONFIG does not exist anymore.

Fixes: 7d619406f31d ("pci: remove deprecated specific config")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: fix libnuma dependency in build test
Thomas Monjalon [Mon, 11 Jul 2016 21:26:01 +0000 (23:26 +0200)]
scripts: fix libnuma dependency in build test

The option CONFIG_RTE_LIBRTE_VHOST_NUMA depends on availability of
libnuma in the system.
The configuration option DPDK_DEP_NUMA can be set if available for
the DPDK_TARGET being built.

Fixes: cd31ca579c0d ("scripts: add build tests")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: print failed directory when testing build
Thomas Monjalon [Fri, 15 Jul 2016 13:49:57 +0000 (15:49 +0200)]
scripts: print failed directory when testing build

The script test-build.sh can be used to test building several
targets with different configurations. The directory name reflects
the target and the customized configuration.
When there is a failure, it is convenient to print this build
directory to quickly know which case is failing without scrolling
the build log history.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoversion: 16.07-rc2
Thomas Monjalon [Mon, 11 Jul 2016 19:47:34 +0000 (21:47 +0200)]
version: 16.07-rc2

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agomempool: fix creation with Xen dom0
Olivier Matz [Mon, 11 Jul 2016 10:20:28 +0000 (12:20 +0200)]
mempool: fix creation with Xen dom0

Restore the use of 2M hugepages when using Xen Dom0 that was
dropped during mempool rework.

Fixes: c042ba20674a ("mempool: rework support of Xen dom0")

Reported-by: Huilong Xu <huilongx.xu@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agombuf: set errno on pool creation error
Olivier Matz [Mon, 11 Jul 2016 10:20:26 +0000 (12:20 +0200)]
mbuf: set errno on pool creation error

In rte_pktmbuf_pool_create(), the rte_errno variable was not always
set on failure.

Fixes: 152ca517900b ("mbuf: use default mempool handler from config")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoxen: fix retrieval of physical address
Olivier Matz [Mon, 11 Jul 2016 10:20:27 +0000 (12:20 +0200)]
xen: fix retrieval of physical address

When using Xen Dom0, it looks that /proc/self/pagemap returns 0.
This breaks the creation of mbufs pool.

We can workaround this in rte_mem_virt2phy() by browsing the dpdk memory
segments. This only works for dpdk memory, but it's enough to fix the
mempool creation.

Fixes: c042ba20674a ("mempool: rework support of Xen dom0")
Fixes: 3097de6e6bfb ("mem: get physical address of any pointer")

Reported-by: Huilong Xu <huilongx.xu@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoxen: fix build as shared library
Thomas Monjalon [Mon, 11 Jul 2016 16:52:56 +0000 (18:52 +0200)]
xen: fix build as shared library

When building as shared library, the compiler complains for
undefined reference to `rte_xen_mem_phy2mch'

The symbol rte_xen_mem_phy2mch was introduced in DPDK 2.2
and has been called in mempool recently via rte_mem_phy2mch.

Fixes: c042ba20674a ("mempool: rework support of Xen dom0")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoxen: fix build
Olivier Matz [Mon, 11 Jul 2016 10:20:25 +0000 (12:20 +0200)]
xen: fix build

Fix the compilation with CONFIG_RTE_LIBRTE_XEN_DOM0=y, by correcting the
typo in variable names.

Fixes: 8dab48370129 ("xen: return machine address without knowing memseg id")

Reported-by: Huilong Xu <huilongx.xu@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agonet/ena: remove unneeded PCI macro
David Marchand [Mon, 11 Jul 2016 14:40:45 +0000 (16:40 +0200)]
net/ena: remove unneeded PCI macro

I suppose this is a remnant of rte_pci_dev_ids.h, just remove this.

Signed-off-by: David Marchand <david.marchand@6wind.com>
8 years agonet/bnxt: move PCI device ids to the driver
David Marchand [Mon, 11 Jul 2016 14:40:44 +0000 (16:40 +0200)]
net/bnxt: move PCI device ids to the driver

Moved defines since the driver had no such information.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.

Signed-off-by: David Marchand <david.marchand@6wind.com>
8 years agonet/bnx2x: move PCI device ids to the driver
David Marchand [Mon, 11 Jul 2016 14:40:43 +0000 (16:40 +0200)]
net/bnx2x: move PCI device ids to the driver

Reused defines from the driver and moved broadcom vendor id macro.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.

Signed-off-by: David Marchand <david.marchand@6wind.com>
8 years agonet/enic: move PCI device ids to the driver
David Marchand [Mon, 11 Jul 2016 14:40:42 +0000 (16:40 +0200)]
net/enic: move PCI device ids to the driver

Moved cisco vendor id since the driver had no such information.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.

Signed-off-by: David Marchand <david.marchand@6wind.com>
8 years agonet/vmxnet3: move PCI device ids to the driver
David Marchand [Mon, 11 Jul 2016 14:40:41 +0000 (16:40 +0200)]
net/vmxnet3: move PCI device ids to the driver

Moved vmware device ids macro since the driver had no such information.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.

Signed-off-by: David Marchand <david.marchand@6wind.com>
8 years agonet/virtio: move PCI device ids to the driver
David Marchand [Mon, 11 Jul 2016 14:40:40 +0000 (16:40 +0200)]
net/virtio: move PCI device ids to the driver

Reused defines from the driver.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/fm10k: move PCI device ids to the driver
David Marchand [Mon, 11 Jul 2016 14:40:39 +0000 (16:40 +0200)]
net/fm10k: move PCI device ids to the driver

Reused defines from the driver.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.

Signed-off-by: David Marchand <david.marchand@6wind.com>
8 years agonet/i40e: move PCI device ids to the driver
David Marchand [Mon, 11 Jul 2016 14:40:38 +0000 (16:40 +0200)]
net/i40e: move PCI device ids to the driver

Reused defines from the driver.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.

Signed-off-by: David Marchand <david.marchand@6wind.com>
8 years agonet/e1000: move em PCI device ids to the driver
David Marchand [Mon, 11 Jul 2016 14:40:37 +0000 (16:40 +0200)]
net/e1000: move em PCI device ids to the driver

Reused defines from the driver and added a Intel vendor id macro for use by
igb later.
Used RTE_PCI_DEVICE in place of RTE_PCI_DEV_ID_DECL* stuff.

igb/igbvf is left as is, waiting for kni/ethtool cleanup.

Signed-off-by: David Marchand <david.marchand@6wind.com>
8 years agoeal: remove PCI device ids header from doxygen
David Marchand [Mon, 11 Jul 2016 14:40:36 +0000 (16:40 +0200)]
eal: remove PCI device ids header from doxygen

This file is going to disappear, remove the doxygen parts that reference
various drivers and remove it from the doxygen index.

Signed-off-by: David Marchand <david.marchand@6wind.com>
8 years agoexamples/ip_pipeline: add config diagram generator
Jasvinder Singh [Tue, 28 Jun 2016 16:22:25 +0000 (17:22 +0100)]
examples/ip_pipeline: add config diagram generator

This commit adds Python script for generating diagram of the application
configuration file. This script requires graphviz package to be installed
on the machine. The input config file is translated to an output file in
DOT syntax, which is then used to create the image file using graphviz.

To run the script, following command is used;

./diagram-generator.py -f <input configuration file>

Some optional arguments are as follows:
  -h, --help            show this help message and exit

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agoexamples/vm_power_manager: remove dependency on internal header
Marvin Liu [Mon, 4 Jul 2016 08:57:59 +0000 (16:57 +0800)]
examples/vm_power_manager: remove dependency on internal header

Macro CHANNEL_CMDS_MAX_CPUS stand for the maximum number of cores
controlled by virtual channels. This macro only be used in the example,
so remove it from library to example header file.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
8 years agoexamples/bond: check thread termination
Piotr Azarewicz [Wed, 29 Jun 2016 13:15:38 +0000 (15:15 +0200)]
examples/bond: check thread termination

The example is calling rte_eal_wait_lcore without checking return value.
Now it is fixed by checking the value and print proper message.

Coverity issue: 37789, 37790
Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6")

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
8 years agoexamples/tep_term: fix port id check
Beilei Xing [Tue, 5 Jul 2016 06:15:40 +0000 (14:15 +0800)]
examples/tep_term: fix port id check

Coverity reported lots of out-of-bounds in function
vxlan_link, these issues should happen when index
port_id evaluates to 2, cause size of arrays is
2 in structure.
Fix this issue by modifying judgement condition, make
sure port_id is less than 2.

Coverity issue: 107121, 107122, 107123, 107124, 107125
Fixes: 4abe471ed6fc ("examples/tep_term: implement VXLAN processing")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
8 years agoexamples/l3fwd: update usage and documentation
Beilei Xing [Mon, 27 Jun 2016 14:26:48 +0000 (22:26 +0800)]
examples/l3fwd: update usage and documentation

Update l3fwd example usage and documentation with missing options.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agoexamples/l2fwd-crypto: fix stats array length
Slawomir Mrozowicz [Thu, 30 Jun 2016 09:05:34 +0000 (11:05 +0200)]
examples/l2fwd-crypto: fix stats array length

crypto_statistics array was not big enough for storing
all the possible crypto device statistics, as its size was
RTE_MAX_ETHPORTS, but should be RTE_CRYPTO_MAX_DEVS, leading
this to a potential out-of-bounds issue.

Coverity issue: 120145
Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
8 years agoexamples/l2fwd-crypto: flush buffers
Pablo de Lara [Wed, 6 Jul 2016 09:38:50 +0000 (10:38 +0100)]
examples/l2fwd-crypto: flush buffers

Crypto operations are enqueued in the crypto devices
when the crypto device buffers are full (MAX_PKT_BURST),
in order to be more efficient.

The problem is that operations might be stuck in those buffers,
if they never get full, and therefore, those operations
will never be performed.

Therefore, it is necessary to have a buffer flush mechanism,
similar to the one used for flush the TX buffers, so eventually,
all packets received are ciphered and sent out.

Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/test: fix hexdump length for crypto
Pablo de Lara [Sun, 10 Jul 2016 16:16:12 +0000 (17:16 +0100)]
app/test: fix hexdump length for crypto

Plaintexts and ciphertexts are dumped when debugging is enabled,
using TEST_HEXDUMP. For Snow3G and KASUMI, their lengths are in bits,
but TEST_HEXDUMP uses bytes, so lenghts are passed in bytes now.

Fixes: 47df73a1a62f ("app/test: use hexdump if debug log is enabled")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/testpmd: fix comment of RSS setup
Ilya Maximets [Tue, 5 Jul 2016 07:20:26 +0000 (10:20 +0300)]
app/testpmd: fix comment of RSS setup

Since commit f2bb7ae1d204, behavior of rss_fwd_config_setup() changed
and description of this function is wrong now.

Also, there is a type mismatch in a loop.

Fixes: f2bb7ae1d204 ("app/testpmd: handle all Rx queues in RSS setup")

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
8 years agoapp/testpmd: add timeout in Rx queue flushing
Reshma Pattan [Fri, 1 Jul 2016 10:28:16 +0000 (11:28 +0100)]
app/testpmd: add timeout in Rx queue flushing

Testpmd can stuck inside do while loop of the flush_fwd_rx_queues()
function. As non-zero packets are returned always by rte_eth_rx_burst()
function when compiled with no optimizations and if input line rate is
high. "do while" loop must exit at one stage to proceed further to
enable packet forwarding and forward the packets. So timer is set to
exit the do while loop after 1 second.

Fixes: af75078f ("first public release")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: remove ixgbe check for bypass
Wenzhuo Lu [Mon, 11 Jul 2016 08:29:18 +0000 (16:29 +0800)]
app/testpmd: remove ixgbe check for bypass

In testpmd code, device id is used directly to check if bypass
is supported. But APP should not know the details of HW, the NIC
specific info should not be exposed here.
As every bypass API does know if it's supported, no need to check
that at first. So, this patch removes the *bypass_is_supported*.

Suggested-by: Jingjing Wu <jingjing.wu@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
8 years agonet/bonding: fix exported symbol versioning
Christian Ehrhardt [Mon, 11 Jul 2016 11:27:01 +0000 (13:27 +0200)]
net/bonding: fix exported symbol versioning

The older versions of rte_eth_bond_8023ad_conf_get and
rte_eth_bond_8023ad_setup were available in the old way since 2.0 - at
least according to the map file.

But versioning in the code was set to 16.04.
That breaks compatibility checks for 2.0 on that library.

For example with the dpdk abi checker:
http://people.canonical.com/~paelzer/compat_report.html

To fix, version the old symbols on the 2.0 version as they were
initially added to the map file.

See http://people.canonical.com/~paelzer/compat_report.html

Fixes: dc40f17a ("net/bonding: allow external state machine in mode 4")

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
8 years agomk: filter duplicate configuration entries
Christian Ehrhardt [Wed, 6 Jul 2016 09:13:06 +0000 (11:13 +0200)]
mk: filter duplicate configuration entries

Due to the hierarchy and the demand to keep the base config showing all
options, some config keys end up multiple times in the .config file.

Due to the way the actual config is sourced only the last entry is
important. That can confuse people changing values in .config which
are then ignored.

A suggested solution was to filter for duplicates at the end of the
actual config step which is implemented here.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
8 years agovfio: rework initialization to be extendable
Jan Viktorin [Mon, 4 Jul 2016 15:16:51 +0000 (17:16 +0200)]
vfio: rework initialization to be extendable

We can now just OR the vfio_enabled sequentially and so adding new VFIO
subsystems (vfio_platform) is possible.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: initialize out of the PCI subsystem
Jan Viktorin [Mon, 4 Jul 2016 15:16:50 +0000 (17:16 +0200)]
vfio: initialize out of the PCI subsystem

The VFIO does not depend on the PCI anymore so it can be initialized out of
the PCI subsystem.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: generalize process synchronization
Jan Viktorin [Mon, 4 Jul 2016 15:16:49 +0000 (17:16 +0200)]
vfio: generalize process synchronization

The module eal_pci_vfio_mp_sync is quite generic so it shouldn't contain the
"pci" string in its name. The internal functions don't need the pci_* prefix.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: make mode types private
Jan Viktorin [Mon, 4 Jul 2016 15:16:48 +0000 (17:16 +0200)]
vfio: make mode types private

There is no more reason to expose those definitions as nobody uses them.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: fix typo in doc for device setup
Jan Viktorin [Mon, 4 Jul 2016 15:16:47 +0000 (17:16 +0200)]
vfio: fix typo in doc for device setup

Suggested-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agovfio: move global config out of PCI files
Jan Viktorin [Mon, 4 Jul 2016 15:16:46 +0000 (17:16 +0200)]
vfio: move global config out of PCI files

The vfio_cfg is a module-global variable and so together with this
variable, it is necessary to move functions:

* pci_vfio_get_group_fd
  - renamed to vfio_get_group_fd
  - pci_* version removed (no other call in EAL)

* pci_vfio_setup_device
  - renamed as vfio_setup_device

* pci_vfio_enable
  - renamed as vfio_enable
  - generalized to check for a specific vfio driver presence
  - pci_* specialization preserved as a wrapper

* pci_vfio_is_enabled
  - renamed as vfio_is_enabled
  - generalized to check for a specific vfio driver presence
    to preserve the semantics of VFIO + PCI
  - pci_* specialization preserved as a wrapper

* clear_current_group
  - private function, just moved

To stop GCC complaining about "defined but not used", the private
function pci_vfio_get_group_no has been removed entirely.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: extract setup logic out of resource mapping
Jan Viktorin [Mon, 4 Jul 2016 15:16:45 +0000 (17:16 +0200)]
vfio: extract setup logic out of resource mapping

The setup logic access the global vfio_cfg variable that will be moved in the
following commits. We need to separate all accesses to this variable to a
general code.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: generalize non PCI-specific functions
Jan Viktorin [Mon, 4 Jul 2016 15:16:40 +0000 (17:16 +0200)]
vfio: generalize non PCI-specific functions

The pci_vfio_set_iommu_type is not PCI-specific and it is a private function
of the eal_pci_vfio.c. We just rename the function and make it available even
for non-PCI devices.

The pci_vfio_has_supported_extensions is not PCI-specific and it is a private
function of the eal_pci_vfio.c. We just rename the function and make it
available even for non-PCI devices.

The pci_vfio_get_container_fd is not PCI-specific. Move the implementation to
the eal_vfio.c as vfio_get_container_fd. No other code seems to call this
function.

Generalize the pci_vfio_get_group_no to not be PCI-specific. Move the general
implementation to the eal_vfio.c as vfio_get_group_no and leave the original
pci_vfio_get_group_no being a wrapper around this to preserve compilation
issues. The pci_vfio_get_group_no function will be removed later.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: move common code out of PCI file
Jan Viktorin [Mon, 4 Jul 2016 15:16:39 +0000 (17:16 +0200)]
vfio: move common code out of PCI file

We make the iommu_types public temporarily here until the depending stuff is
refactored. The iommu_types and dma_map functions will be changed to be private
inside the eal_vfio module later.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: move definitions from PCI to VFIO header
Jan Viktorin [Mon, 4 Jul 2016 15:16:37 +0000 (17:16 +0200)]
vfio: move definitions from PCI to VFIO header

The common VFIO definitions should be separated from the PCI-specific parts.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agovfio: fix private include to be local
Jan Viktorin [Mon, 4 Jul 2016 15:16:36 +0000 (17:16 +0200)]
vfio: fix private include to be local

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agonet/virtio: fix 32-bit build with gcc 6
Ferruh Yigit [Thu, 7 Jul 2016 13:49:08 +0000 (14:49 +0100)]
net/virtio: fix 32-bit build with gcc 6

This is for target i686-native-linuxapp-gcc and gcc6,

Compilation error is:

In file included from
  include/rte_mempool.h:77:0, from
  drivers/net/virtio/virtio_rxtx_simple.c:
In function `virtio_xmit_pkts_simple':
  include/rte_memcpy.h:551:2: error:
    array subscript is above array bounds
      rte_mov16((uint8_t *)dst + 1 * 16, (const uint8_t *)src + 1 * 16);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Call stack is as following:

virtio_xmit_pkts_simple
  virtio_xmit_cleanup
    rte_mempool_put_bulk
      rte_mempool_generic_put
        __mempool_generic_put
  rte_memcpy

The array used as source buffer in virtio_xmit_cleanup (free) is a
pointer array with 32 elements, in 32bit this makes 128 bytes.

in rte_memcpy() implementation, there a code piece as following:
if (size > 256) {
    rte_move128(...);
    rte_move128(...); <--- [1]
    ....
}

The compiler traces the array all through the call stack and knows the
size of array is 128 and generates a warning on above [1] which tries to
access beyond byte 128.
But unfortunately it ignores the "(size > 256)" check.

Giving a hint to compiler that variable "size" is related to the size of
the source buffer fixes compiler warning.

Fixes: 863bfb474493 ("mempool: optimize copy in cache")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/vhost: fix queue state not reset on destroy
Rich Lane [Fri, 1 Jul 2016 16:31:12 +0000 (09:31 -0700)]
net/vhost: fix queue state not reset on destroy

Fixes a bug where rte_eth_vhost_get_queue_event would not return enabled
queues after a guest application restart.

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

Signed-off-by: Rich Lane <rich.lane@bigswitch.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: print error logs on failure
Jianfeng Tan [Fri, 1 Jul 2016 08:50:31 +0000 (08:50 +0000)]
examples/vhost: print error logs on failure

When the specified cores and memory lie on different NUMA socket with
physical NIC, vhost fails to set up Rx queue, and exits without any
hints. This could leads to confusion of users.

This patch fixes it by adding some error messages when calling ether
APIs returns errors.

Suggested-by: Yulong Pei <yulong.pei@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio: fix null pointer dereference
Jianfeng Tan [Tue, 5 Jul 2016 11:42:59 +0000 (11:42 +0000)]
net/virtio: fix null pointer dereference

There is a logic bug in this code, that could lead to null pointer
dereference when cvq is NULL. Fix this problem by changing logic
&& to logic ||.

   >> CID 127480:  Null pointer dereferences  (FORWARD_NULL)
   >> Dereferencing null pointer "cvq".
    if (!cvq && !cvq->vq) {
            ...
        }

Coverity issue: 127480
Fixes: 01ad44fd374f ("net/virtio: split Rx/Tx queue")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agodoc: explain virtio Rx/Tx functions
Zhihong Wang [Fri, 1 Jul 2016 03:28:01 +0000 (23:28 -0400)]
doc: explain virtio Rx/Tx functions

This patch explains current virtio PMD Rx/Tx callbacks, to help understand
what's the difference, and how to enable the right ones.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix string unterminated
Jianfeng Tan [Wed, 29 Jun 2016 09:05:36 +0000 (09:05 +0000)]
net/virtio-user: fix string unterminated

When use strcpy() to copy string with length exceeding the last
parameter of strcpy(), it may lead to the destination string
unterminated.

We replaced strncpy with snprintf to make sure it's NULL terminated.

Coverity issue: 127476
Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix resource leaks
Jianfeng Tan [Wed, 29 Jun 2016 09:05:35 +0000 (09:05 +0000)]
net/virtio-user: fix resource leaks

The return value by rte_kvargs_parse is not free(d), which leads
to memory leak.

Coverity issue: 127482
Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix string overflow
Jianfeng Tan [Wed, 29 Jun 2016 09:05:34 +0000 (09:05 +0000)]
net/virtio-user: fix string overflow

When parsing /proc/self/maps to get hugepage information, the string
was being copied with strcpy(), which could, theoretically but in fact
not possiblly, overflow the destination buffer. Anyway, to avoid the
false alarm, we replaced strncpy with snprintf for safely copying the
strings.

Coverity issue: 127484
Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix return value not checked
Jianfeng Tan [Wed, 29 Jun 2016 09:05:33 +0000 (09:05 +0000)]
net/virtio-user: fix return value not checked

When return values of function calls are not checked, Coverity will
report errors like:

    if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PATH) == 1)
    >>>     CID 127477:    (CHECKED_RETURN)
    >>>     Calling "rte_kvargs_process" without checking return value
            (as is done elsewhere 25 out of 30 times).
          rte_kvargs_process(kvlist, VIRTIO_USER_ARG_PATH,
             &get_string_arg, &path);

Coverity issue: 127477, 127478
Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")
Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix build on Suse 11
Jianfeng Tan [Wed, 29 Jun 2016 03:23:03 +0000 (03:23 +0000)]
net/virtio-user: fix build on Suse 11

On some older systems, such as SUSE 11, the compiling error shows
as:
   .../dpdk/drivers/net/virtio/virtio_user/virtio_user_dev.c:67:22:
         error: ‘O_CLOEXEC’ undeclared (first use in this function)

The fix is to use EFD_CLOEXEC, which is defined in sys/eventfd.h,
instead of O_CLOEXEC which needs _GNU_SOURCE defined on some old
systems.

Fixes: 37a7eb2ae816 ("net/virtio-user: add device emulation layer")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio-user: fix missing default config value
Jianfeng Tan [Wed, 29 Jun 2016 03:20:06 +0000 (03:20 +0000)]
net/virtio-user: fix missing default config value

With current config structure, all configuration parameters put into
common_base with a default value, and overwritten in environment file
if required, CONFIG_RTE_VIRTIO_USER is missing in common_base.

This fix is simple, by adding CONFIG_RTE_VIRTIO_USER=n as the default
macro value.

Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix potential null pointer dereference
Yuanhan Liu [Tue, 28 Jun 2016 03:58:31 +0000 (11:58 +0800)]
vhost: fix potential null pointer dereference

Fix the potential NULL pointer dereference issue raised by Coverity.

    578             reconn = malloc(sizeof(*reconn));
    >>>     CID 127481:  Null pointer dereferences  (NULL_RETURNS)
    >>>     Dereferencing a null pointer "reconn".
    579             reconn->un = un;

Coverity issue: 127481
Fixes: e623e0c6d8a5 ("vhost: add reconnect ability")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix not null terminated string
Yuanhan Liu [Tue, 28 Jun 2016 03:58:30 +0000 (11:58 +0800)]
vhost: fix not null terminated string

Fix an issue raised by Coverity.

    >>>     CID 127475:  Memory - illegal accesses  (BUFFER_SIZE_WARNING)
    >>>     Calling strncpy with a maximum size argument of 108 bytes on
    >>>     destination array "un->sun_path" of size 108 bytes might leave
    >>>     the destination string unterminated.
    441             strncpy(un->sun_path, path, sizeof(un->sun_path));
    442
    443             return fd;
    444     }

Coverity issue: 127475
Fixes: 64ab701c3d1e ("vhost: add vhost-user client mode")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix memory leak
Yuanhan Liu [Tue, 28 Jun 2016 03:58:29 +0000 (11:58 +0800)]
vhost: fix memory leak

Fix potential memory leak raised by Coverity.

    >>>     Variable "vsocket" going out of scope leaks the storage it
    >>>     points to.

Coverity issue: 127483
Fixes: e623e0c6d8a5 ("vhost: add reconnect ability")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/ena: fix unneeded doorbell submission
Jan Medala [Fri, 8 Jul 2016 11:11:30 +0000 (13:11 +0200)]
net/ena: fix unneeded doorbell submission

Avoid submitting doorbell when:
* no packets have been submitted to TX
* no free resources have been submitted while RX

Sending doorbell without actual work to be performed by device
violates ENA specification and can lead to unpredictable behavior.

Fixes: 1173fca25af9 ("ena: add polling-mode driver")

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/enic: fix removing old MAC address when setting new one
Nelson Escobar [Fri, 8 Jul 2016 01:11:08 +0000 (18:11 -0700)]
net/enic: fix removing old MAC address when setting new one

enic_set_mac_address() meant to remove the old MAC address before
setting the new one, but accidentally tried removing the new MAC
address before setting the new MAC address.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
8 years agonet/enic: fix setting MAC address when a port is restarted
Nelson Escobar [Fri, 8 Jul 2016 01:10:21 +0000 (18:10 -0700)]
net/enic: fix setting MAC address when a port is restarted

enic_disable() removed the MAC address when a port was shut down but
enic_enable() didn't add the MAC address back when the port was
started again. Move where we set the MAC address for the adapter from
enic_setup_finish() to a enic_enable() so that port restarting works
properly.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
8 years agonet/bnx2x: add xstats
Rasesh Mody [Thu, 7 Jul 2016 22:50:39 +0000 (15:50 -0700)]
net/bnx2x: add xstats

This patch adds support for extended statistics for BNX2X PMD.

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agonet/qede: add xstats
Rasesh Mody [Thu, 7 Jul 2016 22:50:38 +0000 (15:50 -0700)]
net/qede: add xstats

This patch adds support for extended statistics for QEDE PMD.

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Acked-by: Remy Horton <remy.horton@intel.com>
8 years agonet/mlx5: fix crash in Rx
Nélio Laranjeiro [Fri, 8 Jul 2016 12:43:26 +0000 (14:43 +0200)]
net/mlx5: fix crash in Rx

Fixed issue could occur when Mbuf starvation happens in a middle of
reception of a segmented packet. In such a situation, the PMD has to
release all segments of that packet.  The end condition was wrong
causing it to free an Mbuf still handled by the NIC.

Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support")

Reported-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx5: fix packet type and offload flags on Rx
Maxime Leroy [Thu, 7 Jul 2016 16:34:45 +0000 (18:34 +0200)]
net/mlx5: fix packet type and offload flags on Rx

In mlx5 rx function, the packet_type and ol_flags mbuf fields are not
properly initialized when no rx offload feature is enabled (checksum, l2
tun checksum, vlan_strip, crc). Thus, these fields can have a value
different of 0 depending on their value when the mbuf was freed.

This can result in an incorrect application behavior if invalid
ol_flags/ptype are set, or memory corruptions if IND_ATTACHED_MBUF is
set in ol_flags.

Fixes: 081f7eae242e ("mlx5: process offload flags only when requested")

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/enic: fix resource check failures when bonding devices
Nelson Escobar [Wed, 6 Jul 2016 23:21:59 +0000 (16:21 -0700)]
net/enic: fix resource check failures when bonding devices

The enic PMD was using the same variables in the enic structure to
track two different things.  Initially rq_count, wq_count, cq_count,
and intr_count were set to the values obtained from the VIC adapters
as the maximum resources allocated on the VIC, then in
enic_set_vnic_res(), they were set to the counts of resources actually
used, discarding the initial values. The checks in enic_set_vnic_res()
were technically incorrect if it is called more than once on a port,
which happens when using bonding, but were harmless in practice as the
checks couldn't fail on the second call.

The enic rx-scatter patch misunderstood the subtleties of
enic_set_vnic_res(), and naively added a multiply by two to the
rq_count check. This resulted in the rq_count check failing when
enic_set_vnic_res() was called a second time, ie when using bonding.

This patch adds new variables to the enic structure to track the
maximum resources the VIC is configured to provide so that the
information isn't later lost and calls to enic_set_vnic_res() do
the expected thing.

Fixes: 856d7ba7ed22 ("net/enic: support scattered Rx")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
8 years agodoc: update Linux guide for i40e firmware version
Ian Stokes [Wed, 6 Jul 2016 10:29:31 +0000 (11:29 +0100)]
doc: update Linux guide for i40e firmware version

Update the 'High Performance of Small Packets on 40G NIC' section of the
Getting Started Guide (GSG) as the firmware version referenced for a NIC
using the i40e driver was version 4.2.5 which is no longer validated.
Instruct users to consult release notes for current validated firmware
versions.

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agonet/i40e: fix out-of-bounds access
Beilei Xing [Tue, 5 Jul 2016 06:10:05 +0000 (14:10 +0800)]
net/i40e: fix out-of-bounds access

When calling i40e_flowtype_to_pctype in i40e_get_hash_filter_global_config
and i40e_set_hash_filter_global_config, function i40e_flowtype_to_pctype
will be possibly make an out-of-bounds access, because size of the array
is 15. So check the flow type is valid before calling
i40e_flowtype_to_pctype.
In the process fix other occurances of the same problem

Coverity issue: 37793, 37794
Fixes: 782c8c92f13f ("i40e: add hash configuration")
Fixes: f2b2e2354bbd ("i40e: split function for hash and flow director input")
Fixes: 98f055707685 ("i40e: configure input fields for RSS or flow director")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/i40e: fix dereference before null check
Beilei Xing [Tue, 5 Jul 2016 06:10:04 +0000 (14:10 +0800)]
net/i40e: fix dereference before null check

Null-checking vsi suggests that it may be null, but it
has been dereferenced before null-checking. So move the
check to before the assignment statement using the pointer.

Coverity issue: 119265, 119266
Fixes: d0a349409bd7 ("i40e: support AQ based RSS config")
Fixes: 647d1eaf758b ("i40evf: support AQ based RSS config")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/i40e: fix log error
Beilei Xing [Tue, 5 Jul 2016 06:10:03 +0000 (14:10 +0800)]
net/i40e: fix log error

The condition, "(pf->flags | I40E_FLAG_VMDQ)" will always be true,
regardless of the value of the flags operand, because I40E_FLAG_VMDQ
is 4ULL - meaning at least one bit will always be set in the result.
That will cause log error when VMDq is disabled.
Since the original intent behind the condition is to check if VMDq
is enabled, fix the code by changing "|" to "&".

Coverity issue: 13219, 13221
Fixes: 4805ed59e957 ("i40e: enhance mac address operations")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/bnxt: fix broadcast/multicast Rx
Ajit Khaparde [Mon, 4 Jul 2016 18:52:04 +0000 (13:52 -0500)]
net/bnxt: fix broadcast/multicast Rx

Currently we are wrongly setting HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST
flag in bnxt_hwrm_cfa_l2_set_rx_mask() which is preventing promiscuous
and multicast promiscuous settings from working correctly.
This patch fixes it.

Fixes: 244bc98b0da7 ("net/bnxt: set L2 Rx mask")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
8 years agonet/ena: fix freeing memory using correct API
Jan Medala [Thu, 30 Jun 2016 15:04:58 +0000 (17:04 +0200)]
net/ena: fix freeing memory using correct API

Memory zones should be freed using the proper memzone_free function not
rte_free which is for malloc calls.
After allocating memzone it's required to zeroize memory in it, so do so
before storing the handle for later freeing.

Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK")

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/ena: make coherent memory allocation NUMA-aware
Jan Medala [Thu, 30 Jun 2016 15:04:57 +0000 (17:04 +0200)]
net/ena: make coherent memory allocation NUMA-aware

While allocating (coherent) memory, get information about calling node Id
and pass that as parameter when reserving a memzone.

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/ena: disable readless communication when no HW support
Jan Medala [Thu, 30 Jun 2016 15:04:56 +0000 (17:04 +0200)]
net/ena: disable readless communication when no HW support

Depending on HW revision readless communcation between host and device
may be unavailable. In that case prevent PMD from setting up readless
communication mechanism.

"readless" refers to ability to read ENA registers without actually
issuing read request from host (x86). Instead, host programs 2 registers
on the device that triggers a DMA from device to host and reports a
register value. However, this functionality is not going to be available
in all types of devices. The decision if this mode is supported or not,
is taken from revision_id in pci configuration space.

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/ena: add dedicated memory area for extra device info
Jan Medala [Thu, 30 Jun 2016 15:04:55 +0000 (17:04 +0200)]
net/ena: add dedicated memory area for extra device info

Increase maintenance and debug potentiality with dedicated areas of memory
where additional information can be stored by the ENA device.

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/ena: update ENA comms layer for latest FW
Jan Medala [Thu, 30 Jun 2016 15:04:54 +0000 (17:04 +0200)]
net/ena: update ENA comms layer for latest FW

Synchronize ENA communication layer with latest ENA FW version.

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
8 years agonet/enic: fix Rx queue init after restarting a device
John Daley [Wed, 29 Jun 2016 23:03:21 +0000 (16:03 -0700)]
net/enic: fix Rx queue init after restarting a device

If you stop, then start a port that had already received some packets,
the NIC could fetch discriptors from the wrong location. This could
effectivly reduce the size of the Rx queue by a random amount and
cause packet drop or reduced performance.

Reset the NIC fetch index to 0 when allocating and posting mbuf
addresses to the NIC.

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

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
8 years agonet/enic: fix Tx crash after restart
Nelson Escobar [Wed, 29 Jun 2016 23:03:20 +0000 (16:03 -0700)]
net/enic: fix Tx crash after restart

If you stop then start a port that had already sent some packets,
there was a segfault due to not resetting the number of completed
sends to zero.

Fixes: a3b1e9551c26 ("net/enic: streamline mbuf handling in Tx path")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
8 years agonet/mlx4: add link up/down callback functions
Fengtian Guo [Mon, 4 Jul 2016 08:24:19 +0000 (10:24 +0200)]
net/mlx4: add link up/down callback functions

Implement dev_set_link_up and dev_set_link_down device
operations. Code is inspired by mlx5 implementations.

Signed-off-by: Fengtian Guo <fengtian.guo@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx5: fix API comment of link set function
Olivier Matz [Mon, 4 Jul 2016 08:24:18 +0000 (10:24 +0200)]
net/mlx5: fix API comment of link set function

Fixes: 62072098b54e ("mlx5: support setting link up or down")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/mlx: fix setting interface flags
Olivier Matz [Mon, 4 Jul 2016 08:24:17 +0000 (10:24 +0200)]
net/mlx: fix setting interface flags

According to the documentation, the function
priv_set_flags(priv, keep, flags) should not modify the flags
in "keep" mask.

So 'flags' argument should be masked with '~keep' before ORing
it with the previous flags value.

This avoids messing up the kernel interface flags when calling
priv_set_flags(priv, ~IFF_UP, ~IFF_UP) in priv_set_link():

  $ ip link
  26: eth0: BROADCAST,MULTICAST,NOARP,ALLMULTI,PROMISC,DEBUG,\
      DYNAMIC,AUTOMEDIA,PORTSEL,NOTRAILERS

Fixes: 7fae69eeff13 ("mlx4: new poll mode driver")
Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")

Reported-by: Fengtian Guo <fengtian.guo@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/fm10k: fix Rx descriptor read timing
Xiao Wang [Mon, 4 Jul 2016 07:51:08 +0000 (15:51 +0800)]
net/fm10k: fix Rx descriptor read timing

We find that when traffic is light, a small number of packets will have
wrong metadata (e.g. packet type), however this issue will not happen
when traffic is heavy.

The root cause is some fields in fm10k_rx_desc are read at the wrong time,
since the descriptor (being 16-bytes big) is not read as a single atomic
operation. When the input speed is slower than software's capability,
fm10k scalar Rx function accesses descriptors at about the same time
as HW writes them, so the scenario can occur: some fields like pkt_info
in fm10k_rx_desc are read before HW writeback but some fields like DD bit
are read after HW writeback, this will lead to the later packet parsing
function using incorrect value.

This patch fixes this issue by reading and parsing Rx descriptor only after
first checking that the DD bit is set.

Fixes: 4b61d3bfa941 ("fm10k: add receive and tranmit")
Fixes: c82dd0a7bfa5 ("fm10k: add scatter receive")

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agonet/thunderx: fix memory alloc issue when changing ring size
Kamil Rytarowski [Mon, 4 Jul 2016 07:16:14 +0000 (12:46 +0530)]
net/thunderx: fix memory alloc issue when changing ring size

Allocate maximum supported hardware ring hardware descriptors
memory on the first rte_eth_dma_zone_reserve call in order to
get sufficient hardware ring buffer space on subsequent queue
setup request with different queue size.

Fixes: aa0d976e501d ("net/thunderx: add Rx queue setup and release")
Fixes: 3f3c6f9724a8 ("net/thunderx: add Tx queue setup and release")
Fixes: 7413feee662d ("net/thunderx: add device start/stop and close")

Signed-off-by: Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
Signed-off-by: Zyta Szpak <zyta.szpak@semihalf.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
8 years agonet/ixgbe: fix build whith offload flags disabled
Olivier Matz [Fri, 1 Jul 2016 08:02:27 +0000 (10:02 +0200)]
net/ixgbe: fix build whith offload flags disabled

The ixgbe driver does not compile if CONFIG_RTE_IXGBE_RX_OLFLAGS_ENABLE=n
because the macro has not the proper number of parameters. To reproduce
the issue:

  make config T=x86_64-native-linuxapp-gcc
  sed -i 's,\(IXGBE_RX_OLFLAGS_ENABLE\)=y,\1=n,' build/.config
  make -j4
  [...]
   ixgbe_rxtx_vec_sse.c: In function ‘_recv_raw_pkts_vec’:
   ixgbe_rxtx_vec_sse.c:345:53: error:
     macro "desc_to_olflags_v" passed 3 arguments, but takes just 2
      desc_to_olflags_v(descs, vlan_flags, &rx_pkts[pos]);
                                                        ^
   ixgbe_rxtx_vec_sse.c:345:3: error:
     ‘desc_to_olflags_v’ undeclared (first use in this function)
      desc_to_olflags_v(descs, vlan_flags, &rx_pkts[pos]);
      ^
   ixgbe_rxtx_vec_sse.c:231:10: error:
     variable ‘vlan_flags’ set but not used
     uint8_t vlan_flags;
             ^

This patch fixes the number of arguments in the macro, and ensures that
vlan_flags is marked as used to avoid the third error.

Fixes: b37b528d957c ("mbuf: add new Rx flags for stripped VLAN")

Reported-by: Amin Tootoonchian <amint@icsi.berkeley.edu>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agonet/i40e: fix VLAN filtering in promiscuous mode
Jingjing Wu [Thu, 30 Jun 2016 01:25:55 +0000 (09:25 +0800)]
net/i40e: fix VLAN filtering in promiscuous mode

For VLAN filtering, the VLAN table should be enabled.
But the VLAN table is disabled by default until a rule is added.
In promiscuous mode no rule is added to enable the VLAN table.

This patch clears promiscuous VLAN flag on VSI, and adds a
rule to enable the VLAN table to fix VLAN filtering in promiscuous
mode.

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 agonet/bnx2x: fix incorrect number of supported queues
Charles (Chas) Williams [Tue, 28 Jun 2016 16:14:50 +0000 (12:14 -0400)]
net/bnx2x: fix incorrect number of supported queues

We need sc->igu_sb_cnt determined before calculating the number of queues
we can support, so move the call to bnx2x_init_rte() to later in the code.

Fixes: 3754101cd74c ("net/bnx2x: fix MSIX vector and VF resource counts")

Signed-off-by: Charles (Chas) Williams <ciwillia@brocade.com>
Acked-by: Rasesh Mody <rasesh.mody@qlogic.com>
8 years agonet/bnx2x: set random MAC address if none assigned
Charles (Chas) Williams [Tue, 21 Jun 2016 12:18:46 +0000 (08:18 -0400)]
net/bnx2x: set random MAC address if none assigned

If the PF hasn't assigned an address, assign one randomly.  While here,
convert to use DPDK's ether address utility routines.

Fixes: 540a211084a7 ("bnx2x: driver core")

Signed-off-by: Charles (Chas) Williams <ciwillia@brocade.com>
Acked-by: Rasesh Mody <rasesh.mody@qlogic.com>
8 years agoscripts: add more git log capitalization checks
Bruce Richardson [Tue, 5 Jul 2016 16:03:11 +0000 (17:03 +0100)]
scripts: add more git log capitalization checks

Add API, NUMA, HW, SW, FW and VMDq to list of words to capitalize properly.
Since VMDq is a bit unusual, add it as special case check so we can
print an error message giving the correct way to write it.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoscripts: check headline of drivers commits
Nelio Laranjeiro [Wed, 29 Jun 2016 15:55:08 +0000 (17:55 +0200)]
scripts: check headline of drivers commits

A driver patch under net should start with "net/<driver name>" or if
a patch touch multiple drivers, it should only start with "net:".
The same apply for crypto.
A patch touching all drivers (net + crypto) should start with "drivers:".

Longer prefixes like "net/mlx:" (for mlx4/mlx5) or "net/e1000/base:" are
handled by not checking the colon.

The directories doc/ and config/ are ignored because a driver patch
can modify them.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: reduce line size of commit checks
Thomas Monjalon [Tue, 5 Jul 2016 21:13:24 +0000 (23:13 +0200)]
scripts: reduce line size of commit checks

Small cleanup to comply with the 80 chars limit.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>