dpdk.git
7 years agopmdinfogen: fix build warnings
Thomas Monjalon [Thu, 7 Jul 2016 12:41:36 +0000 (14:41 +0200)]
pmdinfogen: fix build warnings

When compiled with a standard clang, pmdinfogen can raise a warning:
    buildtools/pmdinfogen/pmdinfogen.c:365:1: warning:
    control reaches end of non-void function

Actually there can be more warnings with stricter compilers.
In order to catch them early and fix most of them, the DPDK standard flags
WERROR_FLAGS are used.

The warnings fixed are:
    no previous prototype for ...
    no return statement in function returning non-void
    variable ‘secstrings’ set but not used
    ‘sec_name’ defined but not used
    ‘get_symbol_index’ defined but not used
    pointer of type ‘void *’ used in arithmetic

Fixes: 98b0fdb0ffc6 ("pmdinfogen: add buildtools and pmdinfogen utility")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
7 years agomk: fix verbose pmdinfogen run
Thomas Monjalon [Thu, 7 Jul 2016 12:06:38 +0000 (14:06 +0200)]
mk: fix verbose pmdinfogen run

When building with "make V=1" it is expected to see the output of each
compiler command in order to debug them.
Unfortunately the pmdinfogen related commands were always quiet.

It is fixed by defining the commands in some Makefile variables.
They are printed if the verbose mode is enabled.

The other benefit of this rework is to stop compilation after a
failure with pmdinfogen.

The command readlink is removed in this rework because it seems useless.

Fixes: 3d781ca32874 ("mk: do post processing on objects that register a driver")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
7 years agomk: fix driver build with installed SDK
Thomas Monjalon [Thu, 7 Jul 2016 12:19:54 +0000 (14:19 +0200)]
mk: fix driver build with installed SDK

The tool pmdinfogen was called from RTE_OUTPUT/app/ which does not exist
if building a driver outside of the SDK build.
When building DPDK, RTE_SDK_BIN is RTE_OUTPUT. When building an external
driver, RTE_SDK_BIN must point to the installed DPDK directory containing
includes, libs, etc.

That's why pmdinfogen must be installed in the SDK directory and be part
of the SDK installation.

Fixes: 3d781ca32874 ("mk: do post processing on objects that register a driver")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
7 years agomk: remove traces of hostapp build directory
Thomas Monjalon [Thu, 7 Jul 2016 11:49:58 +0000 (13:49 +0200)]
mk: remove traces of hostapp build directory

The recipe rte.hostapp.mk does not build in hostapp/ anymore.

Fixes: 98b0fdb0ffc6 ("pmdinfogen: add buildtools and pmdinfogen utility")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
7 years agomk: fix build dependency of drivers on pmdinfogen
Thomas Monjalon [Thu, 7 Jul 2016 08:20:28 +0000 (10:20 +0200)]
mk: fix build dependency of drivers on pmdinfogen

When compiling the drivers, some code is generated with pmdinfogen.
A fresh parallel build can fail if a driver is compiled before pmdinfogen:
build/buildtools/dpdk-pmdinfogen: Permission denied

There was a dependency declared in drivers/Makefile but it cannot work
because this file is based on mk/rte.subdir.mk which do not handle
dependencies.

It is fixed by declaring the whole buildtools as (order only) prerequisite
of drivers.

Fixes: cb6696d22023 ("drivers: update registration macro usage")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
7 years agodrivers: fix build with new register macro
Thomas Monjalon [Wed, 6 Jul 2016 21:14:20 +0000 (23:14 +0200)]
drivers: fix build with new register macro

Compilation fails because of some typos.

Fixes: cb6696d22023 ("drivers: update registration macro usage")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Tested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agodoc: add prog guide section documenting pmdinfo script
Neil Horman [Fri, 17 Jun 2016 18:46:25 +0000 (14:46 -0400)]
doc: add prog guide section documenting pmdinfo script

Information on pmdinfogen may be useful to 3rd party driver developers.
Include documentation on what it does

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
7 years agotools: query binaries for HW and other support information
Neil Horman [Fri, 17 Jun 2016 18:46:24 +0000 (14:46 -0400)]
tools: query binaries for HW and other support information

This tool searches for the primer sting PMD_DRIVER_INFO= in any ELF binary,
and, if found parses the remainder of the string as a json encoded string,
outputting the results in either a human readable or raw, script parseable
format

Note that, in the case of dynamically linked applications, pmdinfo.py will
scan for implicitly linked PMDs by searching the specified binaries
.dynamic section for DT_NEEDED entries that contain the substring
librte_pmd.  The DT_RUNPATH, LD_LIBRARY_PATH, /usr/lib and /lib are
searched for these libraries, in that order

If a file is specified with no path, it is assumed to be a PMD DSO, and the
LD_LIBRARY_PATH, /usr/lib[64]/ and /lib[64] is searched for it

Currently the tool can output data in 3 formats:

a) raw, suitable for scripting, where the raw JSON strings are dumped out
b) table format (default) where hex pci ids are dumped in a table format
c) pretty, where a user supplied pci.ids file is used to print out vendor
and device strings

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
7 years agomk: do post processing on objects that register a driver
Neil Horman [Fri, 17 Jun 2016 18:46:23 +0000 (14:46 -0400)]
mk: do post processing on objects that register a driver

Modify the compilation makefile to identify C files that export PMD
information, and use that to trigger execution of the pmdinfo binary.  If
the execution of pmdinfo is successful, compile the output C file to an
object, and use the linker to do relocatable linking on the resultant
object file into the parent object that it came from.  This effectively
just adds the json string into the string table of the object that defines
the PMD to the outside world.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
7 years agoeal: export default plugin path to external tools
Neil Horman [Fri, 17 Jun 2016 18:46:22 +0000 (14:46 -0400)]
eal: export default plugin path to external tools

Export a symbol containing the string:
DPDK_PLUGIN_PATH="$(CONFIG_RTE_EAL_PMD_PATH)"

Where the latter half of the string is set at build time to a location from
which autoloaded DSO's will be found.  This string is used by pmdinfo in
'plugin' mode, whereby a user can specify a dpdk installation directory (or
static binary), and scan the associated path (if found) for pmd DSO's and
report on their hardware support.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
7 years agodrivers: update registration macro usage
Neil Horman [Fri, 17 Jun 2016 18:46:21 +0000 (14:46 -0400)]
drivers: update registration macro usage

Modify the PMD_REGISTER_DRIVER macro, adding a name argument to it.  The
addition of a name argument creates a token that can be used for subsequent
macros in the creation of unique symbol names to export additional bits of
information for use by the pmdinfogen tool.  For example:

PMD_REGISTER_DRIVER(ena_driver, ena);

registers the ena_driver struct as it always did, and creates a symbol
const char this_pmd_name0[] __attribute__((used)) = "ena";

which pmdinfogen can search for and extract.  The subsequent macro

DRIVER_REGISTER_PCI_TABLE(ena, ena_pci_id_map);

creates a symbol const char ena_pci_tbl_export[] __attribute__((used)) =
"ena_pci_id_map";

Which allows pmdinfogen to find the pci table of this driver

Using this pattern, we can export arbitrary bits of information.

pmdinfo uses this information to extract hardware support from an object
file and create a json string to make hardware support info discoverable
later.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
7 years agopmdinfogen: add buildtools and pmdinfogen utility
Neil Horman [Fri, 17 Jun 2016 18:46:20 +0000 (14:46 -0400)]
pmdinfogen: add buildtools and pmdinfogen utility

pmdinfogen is a tool used to parse object files and build json strings for
use in later determining hardware support in a dso or application binary.
pmdinfo looks for the non-exported symbol names this_pmd_name<n> and
this_pmd_tbl<n> (where n is a integer counter).  It records the name of
each of these tuples, using the later to find the symbolic name of the
pci_table for physical devices that the object supports.  With this
information, it outputs a C file with a single line of the form:

static char *<pmd_name>_driver_info[] __attribute__((used)) = " \
PMD_DRIVER_INFO=<json string>";

Where <pmd_name> is the arbitrary name of the pmd, and <json_string> is the
json encoded string that hold relevant pmd information, including the pmd
name, type and optional array of pci device/vendor ids that the driver
supports.

This c file is suitable for compiling to object code, then relocatably
linking into the parent file from which the C was generated.  This creates
an entry in the string table of the object that can inform a later tool
about hardware support.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
7 years agoversion: 16.07-rc1
Thomas Monjalon [Mon, 4 Jul 2016 01:43:08 +0000 (03:43 +0200)]
version: 16.07-rc1

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
7 years agonet/virtio-user: fix build with icc
Jianfeng Tan [Sun, 26 Jun 2016 13:48:13 +0000 (13:48 +0000)]
net/virtio-user: fix build with icc

Implicit int to enum conversion is not allowed when icc is used as
the compiler. It raises the compiling error like,
    drivers/net/virtio/virtio_user/vhost_user.c(257):
        error #188: enumerated type mixed with another type
    msg.request = req;
                ^

The fix is simple, change the type of parameter req to enum
vhost_user_request.

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

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
7 years agonet/vhost: fix Tx error counting
Tetsuya Mukawa [Fri, 24 Jun 2016 02:04:20 +0000 (11:04 +0900)]
net/vhost: fix Tx error counting

According to 'rte_eth_stats' structure comments, 'imissed'
should represent RX error counting, but currently 'imissed' is
used to count TX error.

The patch replaces 'imissed' by 'oerrors'.

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

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
7 years agovhost: fix missing flag reset on stop
Yuanhan Liu [Mon, 27 Jun 2016 05:22:00 +0000 (13:22 +0800)]
vhost: fix missing flag reset on stop

Commit 550c9d27d143 ("vhost: set/reset device flags internally") moves
the VIRTIO_DEV_RUNNING set/reset to vhost lib. But I missed one reset
on stop; here fixes it.

Fixes: 550c9d27d143 ("vhost: set/reset device flags internally")

Reported-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Tested-by: Ciara Loftus <ciara.loftus@intel.com>
7 years agodoc: update vhost guide
Yuanhan Liu [Fri, 24 Jun 2016 07:52:48 +0000 (15:52 +0800)]
doc: update vhost guide

Mainly on updating vhost-user part: we now support client mode.
Also refine some words, and add a bit more explanation.

And made an emphatic statement that you are suggested to use vhost-user
instead of vhost-cuse, because we have enhanced vhost-user a lot since
v2.2 (Actually, I doubt there are any people still using vhost-cuse)

[John McNamara: rewords, better formats]
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
7 years agoivshmem: fix for modified mempool struct
Ferruh Yigit [Fri, 1 Jul 2016 16:26:48 +0000 (17:26 +0100)]
ivshmem: fix for modified mempool struct

struct rte_mempool changed its "ring" field to "pool_data"

"ring" field is accessed by ivshmem library, and updated to "pool_data"

This patch fixes the compile error:

lib/librte_ivshmem/rte_ivshmem.c:
 In function 'add_mempool_to_metadata':
 lib/librte_ivshmem/rte_ivshmem.c:584:32:
 error: 'const struct rte_mempool' has no member named 'ring'
  return add_ring_to_metadata(mp->ring, config);
                                ^~

Fixes: 449c49b93a6b ("mempool: support handler operations")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
7 years agomk: fix ACL library static linking
Sergio Gonzalez Monroy [Fri, 1 Jul 2016 14:38:49 +0000 (15:38 +0100)]
mk: fix ACL library static linking

Since below commit, ACL library is outside the scope of --whole-archive
and ACL autotest fails.

  RTE>>acl_autotest
  ACL: allocation of 25166728 bytes on socket 9 for ACL_acl_ctx failed
  ACL: rte_acl_add_rules(acl_ctx): rule #1 is invalid
  Line 1584: SSE classify with zero categories failed!
  Test Failed

This is the result of the linker picking weak over non-weak functions.

Fixes: 95dc3c3cf31c ("mk: reduce scope of whole-archive static linking")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
7 years agomk: allow duplicate linker flags in libraries list
Sergio Gonzalez Monroy [Fri, 1 Jul 2016 14:38:48 +0000 (15:38 +0100)]
mk: allow duplicate linker flags in libraries list

Since [1] duplicates in LDLIBS are removed. The side effect is that it
does not distinguish between libraries or linker flags.

This patch allows multiple linker flags in LDLIBS, such as
--whole-archive.

[1] Commit: edf4d331dcdb ("mk: eliminate duplicates from libraries list")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
7 years agoethdev: clarify API of packet types support
Olivier Matz [Fri, 1 Jul 2016 08:43:52 +0000 (10:43 +0200)]
ethdev: clarify API of packet types support

As discussed in http://dpdk.org/ml/archives/dev/2016-June/042229.html,
clarify the behavior of rte_eth_dev_get_supported_ptypes().

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoethdev: remove redundant id field in xstats name lookup
Remy Horton [Fri, 1 Jul 2016 13:16:45 +0000 (14:16 +0100)]
ethdev: remove redundant id field in xstats name lookup

For all drivers that currently implement xstats, the id field in the
rte_eth_stats_name structure equals the entry's array index. This
patch eliminates the redundant id field as a direct index lookup is
faster than a search for the matching id field.

Suggested-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Remy Horton <remy.horton@intel.com>
7 years agoethdev: fix extended statistics description
Thomas Monjalon [Wed, 29 Jun 2016 16:53:24 +0000 (18:53 +0200)]
ethdev: fix extended statistics description

The old structure rte_eth_xstats contained names and values.
The new structure rte_eth_xstat contains ids and values.

Fixes: bd6aa172cf35 ("ethdev: fetch extended statistics with integer ids")
Fixes: e2aae1c1ced9 ("ethdev: remove name from extended statistic fetch")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Remy Horton <remy.horton@intel.com>
7 years agoscripts: test clean build when config is changed
Thomas Monjalon [Thu, 30 Jun 2016 10:08:26 +0000 (12:08 +0200)]
scripts: test clean build when config is changed

If there is a change in the config directory the build test
will refresh the tested build config to take into account new options.
The git working directory and the last git commit are checked for a
change in config/.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
7 years agoscripts: check fixed commit branch
Thomas Monjalon [Wed, 29 Jun 2016 14:39:50 +0000 (16:39 +0200)]
scripts: check fixed commit branch

The commit id of a fixed commit must be in the current branch.
It avoids referencing a local branch or a next-* branch when
pushing in the master.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
7 years agoapp/test: migrate custom mempool handler to stack handler
David Hunt [Thu, 30 Jun 2016 18:05:09 +0000 (19:05 +0100)]
app/test: migrate custom mempool handler to stack handler

After introducing the stack handler in the previous commit,
we now have very similar code to the custom handler in test_mempool.c,
which creates a custom mempool based on simple mallocs.
The stack handler is a cleaner example of adding a new mempool handler,
so this commit replaces the custom handler test with a stack
handler test, and removes the custom handler code.

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agomempool: add stack mempool handler
David Hunt [Thu, 30 Jun 2016 18:05:08 +0000 (19:05 +0100)]
mempool: add stack mempool handler

This is a mempool handler that is useful for pipelining apps, where
the mempool cache doesn't really work - example, where we have one
core doing rx (and alloc), and another core doing Tx (and return).
In such a case, the mempool ring simply cycles through all the mbufs,
resulting in a LLC miss on every mbuf allocated when the number of
mbufs is large. A stack (LIFO) recycles buffers more effectively in
this case.

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agomempool: rename functions with confusing names
Bruce Richardson [Thu, 30 Jun 2016 12:49:25 +0000 (13:49 +0100)]
mempool: rename functions with confusing names

The mempool_count and mempool_free_count behaved contrary to what their
names suggested. The free_count function actually returned the number of
elements that were allocated from the pool, not the number unallocated as
the name implied.

Fix this by introducing two new functions to replace the old ones,
* rte_mempool_avail_count to replace rte_mempool_count
* rte_mempool_in_use_count to replace rte_mempool_free_count

In this patch, the new functions are added, and the old ones are marked
as deprecated. All apps and examples that use the old functions are
updated to use the new functions.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
7 years agoport: remove duplicated symbols from .map
Ferruh Yigit [Mon, 27 Jun 2016 13:02:31 +0000 (14:02 +0100)]
port: remove duplicated symbols from .map

Fixes: 9d41beed24b0 ("lib: provide initial versioning")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
7 years agocmdline: remove duplicated symbol from .map
Ferruh Yigit [Mon, 27 Jun 2016 13:02:30 +0000 (14:02 +0100)]
cmdline: remove duplicated symbol from .map

Fixes: 9d41beed24b0 ("lib: provide initial versioning")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoethdev: remove duplicated symbol from .map
Ferruh Yigit [Mon, 27 Jun 2016 13:02:29 +0000 (14:02 +0100)]
ethdev: remove duplicated symbol from .map

Fixes: 19b16e2f6442 ("ethdev: add vlan type when setting ether type")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agoapp/testpmd: limit number of forwarding cores
Pablo de Lara [Mon, 27 Jun 2016 22:35:19 +0000 (23:35 +0100)]
app/testpmd: limit number of forwarding cores

Number of forwarding cores must be equal or less than
number of forwarding streams, otherwise two cores
would try to use a same queue on a port, which is not allowed.

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

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Tested-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
7 years agomempool: optimize copy in cache
Jerin Jacob [Thu, 30 Jun 2016 12:16:36 +0000 (17:46 +0530)]
mempool: optimize copy in cache

Replace C memcpy code semantics with optimized rte_memcpy.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Tested-by: David Hunt <david.hunt@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agomem: revert page locking when not using hugepages
Olivier Matz [Mon, 27 Jun 2016 15:58:51 +0000 (17:58 +0200)]
mem: revert page locking when not using hugepages

This reverts commit 593a084afc2b441895aeca78a2c4465e450d0ef5.

Since recently [1], it is not possible to run the dpdk with
non-root privileges and the --no-huge option. This is because the eal
layer tries to lock the memory. Using locked memory is mandatory for
physical devices because they reference physical addresses.

But a user may want to start the dpdk without locked memory, because he
does not have the permission to do so, and/or does not have this need,
for instance because he uses virtual drivers.

So this commit reverts the use of MAP_LOCKED in mmap() flags.

[1] http://www.dpdk.org/ml/archives/dev/2016-May/039404.html

Fixes: 593a084afc2b ("mem: lock pages when not using hugepages")

Reported-by: Panu Matilainen <pmatilai@redhat.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
7 years agojobstats: fix typo in a comment
Rami Rosen [Wed, 20 Apr 2016 20:04:45 +0000 (23:04 +0300)]
jobstats: fix typo in a comment

Signed-off-by: Rami Rosen <rami.rosen@intel.com>
7 years agoethdev: fix typo in a comment
Rami Rosen [Sat, 25 Jun 2016 15:53:40 +0000 (18:53 +0300)]
ethdev: fix typo in a comment

Signed-off-by: Rami Rosen <rami.rosen@intel.com>
7 years agomem: fix allocating all free hugepages
Jianfeng Tan [Tue, 31 May 2016 03:37:07 +0000 (03:37 +0000)]
mem: fix allocating all free hugepages

EAL memory init allocates all free hugepages of the whole system,
which seen from sysfs, even when applications do not ask so many.
When there is a limitation on how many hugepages an application can
use (such as cgroup.hugetlb), or hugetlbfs is specified with an
option of size (exceeding the quota of the fs), it just fails to
start even there are enough hugepages allocated.

To fix above issue, this patch:
 - Changes the logic to continue memory init to see if hugetlb
   requirement of application can be addressed by already allocated
   hugepages.
 - To make sure each hugepage is allocated successfully, we add a
   recover mechanism, which relies on a mem access to fault-in
   hugepages, and if it fails with SIGBUS, recover to previously
   saved stack environment with siglongjmp().

For the case of CONFIG_RTE_EAL_SINGLE_FILE_SEGMENTS (enabled by
default when compiling IVSHMEM target), it's indispensable to
mapp all free hugepages in the system. Under this case, it fails
to start when allocating fails.

Test example:
  a. cgcreate -g hugetlb:/test-subgroup
  b. cgset -r hugetlb.1GB.limit_in_bytes=2147483648 test-subgroup
  c. cgexec -g hugetlb:test-subgroup \
          ./examples/helloworld/build/helloworld -c 0x2 -n 4

Fixes: af75078fece ("first public release")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Tested-by: Yulong Pei <yulong.pei@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
7 years agopci: increase log level to show blacklisted devices
Huilong Xu [Tue, 31 May 2016 02:40:12 +0000 (10:40 +0800)]
pci: increase log level to show blacklisted devices

Maybe we should change log level, when add port in blacklist,
for check it easy.
It does not influence performance and function.

Signed-off-by: Huilong Xu <huilongx.xu@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agomempool: allow user-owned cache
Lazaros Koromilas [Tue, 28 Jun 2016 23:47:38 +0000 (00:47 +0100)]
mempool: allow user-owned cache

The mempool cache is only available to EAL threads as a per-lcore
resource. Change this so that the user can create and provide their own
cache on mempool get and put operations. This works with non-EAL threads
too. This commit introduces the new API calls:

    rte_mempool_cache_create(size, socket_id)
    rte_mempool_cache_free(cache)
    rte_mempool_cache_flush(cache, mp)
    rte_mempool_default_cache(mp, lcore_id)

Changes the API calls:

    rte_mempool_generic_put(mp, obj_table, n, cache, flags)
    rte_mempool_generic_get(mp, obj_table, n, cache, flags)

The cache-oblivious API calls use the per-lcore default local cache.

Signed-off-by: Lazaros Koromilas <l@nofutznetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agomempool: use bit flags for multi consumers and producers
Lazaros Koromilas [Tue, 28 Jun 2016 23:47:37 +0000 (00:47 +0100)]
mempool: use bit flags for multi consumers and producers

Pass the same flags as in rte_mempool_create(). Changes API calls:

    rte_mempool_generic_put(mp, obj_table, n, flags)
    rte_mempool_generic_get(mp, obj_table, n, flags)

Signed-off-by: Lazaros Koromilas <l@nofutznetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agomempool: deprecate specific get and put functions
Lazaros Koromilas [Tue, 28 Jun 2016 23:47:36 +0000 (00:47 +0100)]
mempool: deprecate specific get and put functions

This commit introduces the API calls:

    rte_mempool_generic_put(mp, obj_table, n, is_mp)
    rte_mempool_generic_get(mp, obj_table, n, is_mc)

Deprecates the API calls:

    rte_mempool_mp_put_bulk(mp, obj_table, n)
    rte_mempool_sp_put_bulk(mp, obj_table, n)
    rte_mempool_mp_put(mp, obj)
    rte_mempool_sp_put(mp, obj)
    rte_mempool_mc_get_bulk(mp, obj_table, n)
    rte_mempool_sc_get_bulk(mp, obj_table, n)
    rte_mempool_mc_get(mp, obj_p)
    rte_mempool_sc_get(mp, obj_p)

We also check cookies in one place now.

Signed-off-by: Lazaros Koromilas <l@nofutznetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agonet/thunderx: add missing external dependency
Ferruh Yigit [Wed, 29 Jun 2016 18:34:49 +0000 (19:34 +0100)]
net/thunderx: add missing external dependency

To prevent compile error when compiling for shared library:
nicvf_hw.o: In function `nicvf_qsize_regbit':
nicvf_hw.c:(.text+0xe64): undefined reference to `log2'
nicvf_hw.o: In function `nicvf_rss_reta_update':
nicvf_hw.c:(.text+0x19dd): undefined reference to `log2'
nicvf_hw.o: In function `nicvf_rss_reta_query':
nicvf_hw.c:(.text+0x1acb): undefined reference to `log2'

Fixes: e438796617dc ("net/thunderx: add PMD skeleton")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agonet/i40e: add floating VEB option
Zhe Tao [Wed, 29 Jun 2016 13:06:03 +0000 (21:06 +0800)]
net/i40e: add floating VEB option

The standard Virtual Ethernet Bridge(VEB) definition in 1Qbg is a bridge
which has an uplink port to the outside world (maybe another bridge), but
a "floating" VEB is a special VEB without an uplink port to the outside.
Instead, traffic can be sent from one VF to another using the floating
VEB - even when the physical link on the NIC port is down.

This patch adds floating VEB options in the devargs for i40e driver.
Using these parameters, applications can decide whether to use legacy
VEB/VEPA or a floating VEB.
To enable this feature, the user should pass a devargs parameter to the
EAL, for example "-w 84:00.0,enable_floating_veb=1", to control whether
the PMD will to use the floating VEB feature or not.

Once the floating VEB feature is enabled, all the VFs created by
this PF device are connected to the floating VEB.

NOTE: The floating VEB functionality requires a NIC firmware version
of 5.0 or greater.

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
7 years agonet/i40e: support floating VEB
Zhe Tao [Wed, 29 Jun 2016 13:06:02 +0000 (21:06 +0800)]
net/i40e: support floating VEB

The standard Virtual Ethernet Bridge(VEB) definition in 1Qbg is a bridge
which has an uplink port to the outside world (maybe another bridge),
but a "floating" VEB is a special VEB without an uplink port to the
outside. Instead, traffic can be sent from one VF to another using the
floating VEB - even when the physical link on the NIC port is down.

VFs VSIs connect either to the standard VEB/VEPA or to the floating VEB,
they cannot connect to both of them. The PF, VMDQ and FD VSIs still
connect to the normal VEB/VEPA.

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
7 years agonet/enic: fix Rx scatter with multiple queues
Nelson Escobar [Tue, 28 Jun 2016 18:49:11 +0000 (11:49 -0700)]
net/enic: fix Rx scatter with multiple queues

The Rx scatter patch failed to make a few changes and resulted in
problems when using multiple receive queues (RQs) in DPDK (ie RSS)
since the wrong adapter resources were being used.

- get and use the correct completion queue index associated with a
  receive queue.
- set the correct receive queue index when using RSS

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

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
7 years agonet/thunderx: fix build with clang
Jerin Jacob [Mon, 27 Jun 2016 16:16:06 +0000 (21:46 +0530)]
net/thunderx: fix build with clang

Fix the following error with clang
error: unused function 'nicvf_mbox_msg_str'

The function nicvf_mbox_msg_str() may be unused, based on DEBUG
compilation option selected. Mark __attribute__((unused)) on
this function, to inform compiler that this function may be unused

Fixes: 966e225c2396 ("net/thunderx/base: add mailbox for PF/VF communication")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agonet/thunderx: fix build flags with clang
Jerin Jacob [Mon, 27 Jun 2016 16:16:05 +0000 (21:46 +0530)]
net/thunderx: fix build flags with clang

'fno-prefetch-loop-arrays' optimization flag is not supported with clang,
so use it only when compiling with gcc.

Fixes: 1c421f18e095 ("net/thunderx: add single and multi-segment Tx")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agonet/igb: support setting link up or down
Aaron Campbell [Mon, 27 Jun 2016 15:46:25 +0000 (12:46 -0300)]
net/igb: support setting link up or down

Add driver functions to set link state up or down.

Signed-off-by: Aaron Campbell <aaron@arbor.net>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/enic: update MTU for non-scattered Rx
John Daley [Fri, 24 Jun 2016 22:29:28 +0000 (15:29 -0700)]
net/enic: update MTU for non-scattered Rx

Provide an update MTU callback. The function returns -ENOTSUP
if Rx scatter is enabled. Updating the MTU to be greater than
the value configured via the Cisco CIMC/UCSM management interface
is allowed provided it is still less than the maximum egress packet
size allowed by the NIC minus the size of the L2 header.

Signed-off-by: John Daley <johndale@cisco.com>
7 years agonet/enic: determine max egress packet size and max MTU
John Daley [Fri, 24 Jun 2016 22:29:27 +0000 (15:29 -0700)]
net/enic: determine max egress packet size and max MTU

Pull in common VNIC code which enables querying for max egress
packet size with newer firmware via a device command. If the
field is non-zero, it is the max egress packet size. If it is
0, the default value (9022) can safely be assumed. The value
for 1300 series VICS using firmware versions >= 3.1.2 for blade
series and >= 2.0.13 for rack series servers is 9208.

Tx buffers can be emitted only if they are less than the max egress
packet size regardless of the MTU setting (the MTU is advisory).
The max egress packet size can used to determine the upper limit
of the MTU since the enic can also receive packets of size greater
than max egress packet size. A max_mtu variable is added with
a value of max egress packet size minus L2 header size.

The default MTU is set via the CIMC/UCSM management interface and
currently allows value up to 9000. If the value is changed, the
host must be reboot. To avoid the reboot and allow MTU values
up to the max capability of the NIC, MTU update capability will
be added with a max value capped by max_mtu.

Signed-off-by: John Daley <johndale@cisco.com>
7 years agonet/bnx2x: fix build with icc
Ferruh Yigit [Mon, 27 Jun 2016 16:02:33 +0000 (17:02 +0100)]
net/bnx2x: fix build with icc

Fix multiple icc issues of type:
error #188: enumerated type mixed with another type

For simple cases, just fix the code causing the problem.
However, we still need to disable compiler warning because of
more complex cases.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Rasesh Mody <rasesh.mody@qlogic.com>
7 years agonet/i40e: remove unsupported VF command
Helin Zhang [Sun, 26 Jun 2016 15:46:18 +0000 (23:46 +0800)]
net/i40e: remove unsupported VF command

Delete 'case I40E_VIRTCHNL_OP_FCOE', as it is not necessary. The
default case reports on all unsupported commands included this one.
This also prevents warnings about a missing "break" at the end of the
"case" block.

Coverity issue: 13265

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

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
7 years agonet/i40e: fix null checks
Helin Zhang [Sun, 26 Jun 2016 15:46:17 +0000 (23:46 +0800)]
net/i40e: fix null checks

This patch fixes the issues reported by Coverity of 'Dereference
before null check', by deleting unnecessary null checks, or moving
null checks to before the offending use of the pointer.

Coverity issue: 13298, 13299, 13294, 13301, 119267

Fixes: 8e109464c022 ("i40e: allow vector Rx and Tx usage")
Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")
Fixes: a778a1fa2e4e ("i40e: set up and initialize flow director")
Fixes: 4861cde46116 ("i40e: new poll mode driver")

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
7 years agonet/enic: fix memory freeing
Nelson Escobar [Thu, 23 Jun 2016 23:14:58 +0000 (16:14 -0700)]
net/enic: fix memory freeing

enic_alloc_consistent() allocated memory, but enic_free_consistent()
was an empty function, so allocated memory was never freed.

This commit adds a list and lock to the enic structure to keep track
of the memzones allocated in enic_alloc_consistent(), and
enic_free_consistent() uses that information to properly free memory.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
7 years agonet/enic: fix name of classifiers hash table
Nelson Escobar [Thu, 23 Jun 2016 23:10:02 +0000 (16:10 -0700)]
net/enic: fix name of classifiers hash table

The enic_clsf_init() function is called once per enic instance, but it
used a static name to create the hash table.  Consequently when using
more than one enic instance, there was a name collision which caused
errors:

EAL: memzone_reserve_aligned_thread_unsafe():
  memzone<RG_HT_enicpmd_clsf_hash> already exists
RING: Cannot reserve memory
HASH: memory allocation failed
PMD: rte_enic_pmd: Init of hash table for clsf failed.
  Flow director feature will not work

This patch changes the name to be unique per enic instance.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
7 years agonet/mlx: fix build with icc
Ferruh Yigit [Tue, 14 Jun 2016 16:17:24 +0000 (17:17 +0100)]
net/mlx: fix build with icc

Compilation errors:
mlx4:
  drivers/net/mlx4/mlx4.c(5409): error #188:
  enumerated type mixed with another type
          priv->intr_handle.type = 0;
                                 ^
mlx5:
  drivers/net/mlx5/mlx5_rxq.c(282): error #188:
  enumerated type mixed with another type
        enum hash_rxq_type type = 0;
                                  ^
and more same type of error.
Fix these by assigning enum values rather than integer values to the enum
variables

Fixes: c4da6caa426d ("mlx4: handle link status interrupts")
Fixes: 198a3c339a8f ("mlx5: handle link status interrupts")
Fixes: 0d2186743d62 ("mlx5: manage all special flow types at once")
Fixes: 612ad38209f7 ("mlx5: fix hash Rx queue type in RSS mode")
Fixes: 083c2dd31776 ("mlx5: refactor special flows handling")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/ixgbe: remove useless assignment
Daniel Mrzyglod [Thu, 2 Jun 2016 16:01:22 +0000 (18:01 +0200)]
net/ixgbe: remove useless assignment

The "end" variable is assigned and then two lines later is assigned a
different value, making the first assignment useless. Remove it.

Coverity issue: 13335
Fixes: cf4b4708a88a ("ixgbe: improve slow-path perf with vector scattered Rx")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
7 years agonet/e1000/base: fix build with gcc 6
Markos Chandras [Thu, 23 Jun 2016 09:25:52 +0000 (10:25 +0100)]
net/e1000/base: fix build with gcc 6

Add the missing braces to the 'if' statements to fix the misleading
identation. This also fixes the following build errors when building
with gcc >= 6:

drivers/net/e1000/base/e1000_phy.c:4156:2:
error: this 'if' clause does not guard... [-Werror=misleading-indentation]
    if (locked)

drivers/net/e1000/base/e1000_phy.c:4158:3:
note: ...this statement, but the latter is misleadingly indented as if
it is guarded by the 'if'
    if (!ready)

drivers/net/e1000/base/e1000_phy.c:4221:2:
error: this 'if' clause does not guard... [-Werror=misleading-indentation]
    if (locked)

drivers/net/e1000/base/e1000_phy.c:4223:3:
note: ...this statement, but the latter is misleadingly indented as if
it is guarded by the 'if'
    if (!ready)

Signed-off-by: Markos Chandras <mchandras@suse.de>
7 years agonet/ixgbe/base: update documentation for base code update
Beilei Xing [Thu, 23 Jun 2016 07:22:37 +0000 (15:22 +0800)]
net/ixgbe/base: update documentation for base code update

The ixgbe base driver was updated to version
cid-10g-shared-code.2016.04.12

The changes include:
Added sgmii link for X550.
Added mac link setup for X550a SFP and SFP+.
Added KR support for X550em_a.
Added new phy definitions for M88E1500.
Added support for the VLVF to be bypassed when adding/removing
a VFTA entry.
Added X550a flow control auto negotiation support.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: define bit to enable crosstalk workaround
Beilei Xing [Thu, 23 Jun 2016 07:22:36 +0000 (15:22 +0800)]
net/ixgbe/base: define bit to enable crosstalk workaround

A work around for a new crosstalk erratum that causes link flap in
entry cages has been introduced. So this patch defines the bit in
NVM that will tell software if this work around is needed.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: add flow control autoneg for X550a
Beilei Xing [Thu, 23 Jun 2016 07:22:35 +0000 (15:22 +0800)]
net/ixgbe/base: add flow control autoneg for X550a

This patch adds X550a flow control auto negotiation support.
ixgbe_setup_fc_x550a and ixgbe_fc_autoneg_X550a functions are
added to setup and enable flow control. MAC ops function pointer
fc_autoneg was added so that hardware specific fc autoneg functions
can be called from ixgbe_fc_enable_generic.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: allow setting MAC anti spoofing per VF
Beilei Xing [Thu, 23 Jun 2016 07:22:34 +0000 (15:22 +0800)]
net/ixgbe/base: allow setting MAC anti spoofing per VF

Make ixgbe_set_mac_anti_spoofing() consistent with the other
functions that deal with setting VLAN and Ethertype spoofing by
changing the prototype to accept a VF parameter.

Also change the logic for writing the PFVFSPOOF register to be similar
to the MAC and Ethertype functions.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: fix endianness
Beilei Xing [Thu, 23 Jun 2016 07:22:33 +0000 (15:22 +0800)]
net/ixgbe/base: fix endianness

This patch fixes endianness issues about host interface command.

Fixes: ad66a85dce9a ("ixgbe/base: new FW values")
Fixes: 0790adeb5675 ("ixgbe/base: support X550em_a device")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: use 8 bits for PCI functions
Beilei Xing [Thu, 23 Jun 2016 07:22:32 +0000 (15:22 +0800)]
net/ixgbe/base: use 8 bits for PCI functions

Since PCIe standard defines maximum of 8 functions per device lan_id
is a value 0..7. Because of that, lan_id don't need to be u16.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: unify coding style
Beilei Xing [Thu, 23 Jun 2016 07:22:31 +0000 (15:22 +0800)]
net/ixgbe/base: unify coding style

This patch changes static keyword to STATIC definition, which can be
redefined depending on the compiler used.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: allow bypassing VLAN pool filters
Beilei Xing [Thu, 23 Jun 2016 07:22:30 +0000 (15:22 +0800)]
net/ixgbe/base: allow bypassing VLAN pool filters

This patch adds support for the VLAN pool filter (VLVF) to be
bypassed when adding or removing a VLAN filter table array (VFTA) entry.
The PF can utilize the default pool while preserving the VLVF for the
VFs use.
Meanwhile, update the VF operations and drivers where corresponding
functionality is invoked.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: simplify VLAN management
Beilei Xing [Thu, 23 Jun 2016 07:22:29 +0000 (15:22 +0800)]
net/ixgbe/base: simplify VLAN management

This patch simplifies the adding and removing VLANs from
VFTA/VLVF/VLVFB registers. The logic to determine the registers to use
has been simplified to (vid / 32) and (1 - vid / 32). Many conditional
paths and checks are no longer needed with this patch.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: limit PHY token lock to MDIO access
Beilei Xing [Thu, 23 Jun 2016 07:22:28 +0000 (15:22 +0800)]
net/ixgbe/base: limit PHY token lock to MDIO access

This patch limits getting and putting the PHY Token to PHY MDIO
access only by adding ixgbe_read_phy_reg_x550a and
ixgbe_write_phy_reg_x550a. The PHY Token is only needed to
synchronize access to the MDIO shared between the two MAC instance.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: fix register access error
Beilei Xing [Thu, 23 Jun 2016 07:22:27 +0000 (15:22 +0800)]
net/ixgbe/base: fix register access error

This patch corrects the FLA/GSCL/GSCN access offset values according
to the datasheet.

Fixes: 0790adeb5675 ("ixgbe/base: support X550em_a device")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: fix race condition between ports
Beilei Xing [Thu, 23 Jun 2016 07:22:26 +0000 (15:22 +0800)]
net/ixgbe/base: fix race condition between ports

This patch fixes a possible race issue between ports, when issuing host
interface commands, by acquiring/releasing the management host interface
semaphore in ixgbe_host_interface_command.

Fixes: 36f43e8679ae ("ixgbe/base: refactor manageability block communication")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: add function to reset swfw semaphore
Beilei Xing [Thu, 23 Jun 2016 07:22:25 +0000 (15:22 +0800)]
net/ixgbe/base: add function to reset swfw semaphore

For X540 onwards it is possible if a system reset occurs at the
right time to leave the SWFW semaphore high. This new function will
attempt to grab and release the semaphore. If the grab times out it
will still release the semaphore placing it in a known good state.
The idea is to call this when you know no one should be holding the
semaphore (i.e. probe time)

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: update device IDs
Beilei Xing [Thu, 23 Jun 2016 07:22:24 +0000 (15:22 +0800)]
net/ixgbe/base: update device IDs

There are two device IDs changed from 15C6/15C7 to 15E4/15E5 because of
PHY info changes. 15C6/15C7 IDs are now used for the backplane
SGMII versions.
Also, clean up some discovery kludges from the previous shared ID,
and also add 15C6/15C7 to ixgbe_set_mdio_speed just for paranoia
to control MDIO speed even though nothing should be attached.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: support new PHY types
Beilei Xing [Thu, 23 Jun 2016 07:22:23 +0000 (15:22 +0800)]
net/ixgbe/base: support new PHY types

This patch adds new phy definitions and support functions to enable those
new phy types.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: refactor internal PHY mode determination
Beilei Xing [Thu, 23 Jun 2016 07:22:22 +0000 (15:22 +0800)]
net/ixgbe/base: refactor internal PHY mode determination

NW_MNG_IF_SEL register is a PHY link configuration register.
Add ixgbe_read_mng_if_sel_x550em to read NW_MNG_IF_SEL, validate
register values and save fields such as PHY MDIO address. This
centralises the reading and checking of the register in one place

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: rename header guard
Beilei Xing [Thu, 23 Jun 2016 07:22:21 +0000 (15:22 +0800)]
net/ixgbe/base: rename header guard

The ixgbe_vf.h file did not use _<FILENAME>_ and instead used
__<FILENAME>__ which is not the standard used in every other file.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: fix error path to release lock
Beilei Xing [Thu, 23 Jun 2016 07:22:20 +0000 (15:22 +0800)]
net/ixgbe/base: fix error path to release lock

When there is an error getting the PHY token, the error path
fails to release the locks that it has taken. Release those
locks in that failure case.

Fixes: 86b8fb293fdf ("ixgbe/base: add sw-firmware sync for resource sharing on X550em_a")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: fix macro name
Beilei Xing [Thu, 23 Jun 2016 07:22:19 +0000 (15:22 +0800)]
net/ixgbe/base: fix macro name

This patch renames IXGBE_PVFTTDLEN to IXGBE_PVFTDLEN according to
abbreviation of Transmit Descriptor Length in datasheet.

Fixes: d2e72774e58c ("ixgbe/base: support X550")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: clear stale VMDq pool mappings
Beilei Xing [Thu, 23 Jun 2016 07:22:18 +0000 (15:22 +0800)]
net/ixgbe/base: clear stale VMDq pool mappings

This patch adds clearing the pool mappings when configuring default
MAC addresses for the interface. Without this there will be the risk
of leaking an address into pool 0 which really belongs to VF 0 when
SR-IOV is enabled.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: add link MAC setup for X550a SFP+
Beilei Xing [Thu, 23 Jun 2016 07:22:17 +0000 (15:22 +0800)]
net/ixgbe/base: add link MAC setup for X550a SFP+

This patch updates ixgbe_setup_mac_link_sfp_x550a for X550 SFP+.
ixgbe_set_lan_id_multi_port_pcie has been updated to set the MAC
instance(0/1) which is needed when configuring the external PHY,
since X550a has two instances of MGPK. The MAC instance is read
from the EEPROM.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: allow per-device-type method calls
Beilei Xing [Thu, 23 Jun 2016 07:22:16 +0000 (15:22 +0800)]
net/ixgbe/base: allow per-device-type method calls

Use the method pointers instead of direct function calls for IOSF
access so that the right functions can be called on X550EM_a,
compared to other devices using the driver.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: add KR support for X550em_a devices
Beilei Xing [Thu, 23 Jun 2016 07:22:15 +0000 (15:22 +0800)]
net/ixgbe/base: add KR support for X550em_a devices

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: refactor EEE setup for X550
Beilei Xing [Thu, 23 Jun 2016 07:22:14 +0000 (15:22 +0800)]
net/ixgbe/base: refactor EEE setup for X550

Break ixgbe_setup_eee_X550 down to better handle a change from if
statements to switch statements needed to add X550em_a KR support.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: fix firmware command checksum error
Beilei Xing [Thu, 23 Jun 2016 07:22:13 +0000 (15:22 +0800)]
net/ixgbe/base: fix firmware command checksum error

When software sends commands to firmware using the host
slave command interface, firmware fails to receive the
command due to a checksum failed error, as the checksum is
not being correctly set by the driver software.

This patch sets command checksum to the default value of
0xFF, as per the datasheet, therefore the checksum won't
be checked by firmware.

Fixes: 86b8fb293fdf ("ixgbe/base: add sw-firmware sync for resource sharing on X550em_a")
Fixes: 0790adeb5675 ("ixgbe/base: support X550em_a device")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: add MAC link setup for X550a SFP
Beilei Xing [Thu, 23 Jun 2016 07:22:12 +0000 (15:22 +0800)]
net/ixgbe/base: add MAC link setup for X550a SFP

This patch adds ixgbe_setup_mac_link_sfp_x550a for X550a SFP.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: return error on VF MAC address failure
Beilei Xing [Thu, 23 Jun 2016 07:22:11 +0000 (15:22 +0800)]
net/ixgbe/base: return error on VF MAC address failure

An error code indicating that the PF rejects the MAC address change
should be returned, in case that the PF has already assigned a MAC
for the VF.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: add SGMII link for X550
Beilei Xing [Thu, 23 Jun 2016 07:22:10 +0000 (15:22 +0800)]
net/ixgbe/base: add SGMII link for X550

This patch adds new phy type and media type to support
SGMII link for X550, and add ixgbe_setup_sgmii to support
SGMII link setup.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/ixgbe/base: add new VF requests to mailbox API
Beilei Xing [Thu, 23 Jun 2016 07:22:09 +0000 (15:22 +0800)]
net/ixgbe/base: add new VF requests to mailbox API

This patch adds two new VF requests of IXGBE_VF_GET_RETA and
IXGBE_VF_GET_RSS_KEY to the mailbox API.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/mlx5: re-add Rx scatter support
Nélio Laranjeiro [Fri, 24 Jun 2016 13:18:04 +0000 (15:18 +0200)]
net/mlx5: re-add Rx scatter support

This commit brings back Rx scatter and related support by the MTU update
function. The maximum number of segments per packet is not a fixed value
anymore (previously MLX5_PMD_SGE_WR_N, set to 4 by default) as it caused
performance issues when fewer segments were actually needed as well as
limitations on the maximum packet size that could be received with the
default mbuf size (supporting at most 8576 bytes).

These limitations are now lifted as the number of SGEs is derived from the
MTU (which implies MRU) at queue initialization and during MTU update.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: make Rx queue reinitialization safer
Adrien Mazarguil [Fri, 24 Jun 2016 13:18:03 +0000 (15:18 +0200)]
net/mlx5: make Rx queue reinitialization safer

The primary purpose of rxq_rehash() function is to stop and restart
reception on a queue after re-posting buffers. This may fail if the array
that temporarily stores existing buffers for reuse cannot be allocated.

Update rxq_rehash() to work on the target queue directly (not through a
template copy) and avoid this allocation.

rxq_alloc_elts() is modified accordingly to take buffers from an existing
queue directly and update their refcount.

Unlike rxq_rehash(), rxq_setup() must work on a temporary structure but
should not allocate new mbufs from the pool while reinitializing an
existing queue. This is achieved by using the refcount-aware
rxq_alloc_elts() before overwriting queue data.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
7 years agonet/mlx5: remove redundant Rx queue initialization
Adrien Mazarguil [Fri, 24 Jun 2016 13:18:02 +0000 (15:18 +0200)]
net/mlx5: remove redundant Rx queue initialization

Toggling RX checksum offloads is already done at initialization time. This
code does not belong in rxq_rehash().

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: re-add Tx gather support
Adrien Mazarguil [Fri, 24 Jun 2016 13:18:00 +0000 (15:18 +0200)]
net/mlx5: re-add Tx gather support

Compared to its previous incarnation, the software limit on the number of
mbuf segments is no more (previously MLX5_PMD_SGE_WR_N, set to 4 by
default) hence no need for linearization code and related buffers that
permanently consumed a non negligible amount of memory to handle oversized
mbufs.

The resulting code is both lighter and faster.

With the addition of this code, older GCC versions (such
as 4.8.5) may complain about 'wqe' variable being uninitialized, so
initialize it preemptively, even though it is not necessary to do so.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: check remaining space while processing Tx burst
Adrien Mazarguil [Fri, 24 Jun 2016 13:17:59 +0000 (15:17 +0200)]
net/mlx5: check remaining space while processing Tx burst

The space necessary to store segmented packets cannot be known in advance
and must be verified for each of them.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: add debug information about Tx queues capabilities
Adrien Mazarguil [Fri, 24 Jun 2016 13:17:58 +0000 (15:17 +0200)]
net/mlx5: add debug information about Tx queues capabilities

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/mlx5: support multi-packet send
Nélio Laranjeiro [Fri, 24 Jun 2016 13:17:57 +0000 (15:17 +0200)]
net/mlx5: support multi-packet send

This feature enables the TX burst function to emit up to 5 packets using
only two work queue entries (WQEs) on devices that support it. Saves PCI
bandwidth and improves performance.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
7 years agonet/mlx5: support inline send
Yaacov Hazan [Fri, 24 Jun 2016 13:17:56 +0000 (15:17 +0200)]
net/mlx5: support inline send

Implement send inline feature which copies packet data directly into
work queue entries (WQEs) for improved latency. The maximum packet
size and the minimum number of Tx queues to qualify for inline send
are user-configurable.

This feature is effective when HW causes a performance bottleneck.

Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: replace countdown with threshold for Tx completions
Adrien Mazarguil [Fri, 24 Jun 2016 13:17:55 +0000 (15:17 +0200)]
net/mlx5: replace countdown with threshold for Tx completions

Replacing the variable countdown (which depends on the number of
descriptors) with a fixed relative threshold known at compile time improves
performance by reducing the TX queue structure footprint and the amount of
code to manage completions during a burst.

Completions are now requested at most once per burst after threshold is
reached.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
7 years agonet/mlx5: handle Rx CQE compression
Nélio Laranjeiro [Fri, 24 Jun 2016 13:17:54 +0000 (15:17 +0200)]
net/mlx5: handle Rx CQE compression

Mini (compressed) completion queue entries (CQEs) are returned by the
NIC when PCI back pressure is detected, in which case the first CQE64
contains common packet information followed by a number of CQE8
providing the rest, followed by a matching number of empty CQE64
entries to be used by software for decompression.

Before decompression:

      0           1          2           6         7         8
  +-------+  +---------+ +-------+   +-------+ +-------+ +-------+
  | CQE64 |  |  CQE64  | | CQE64 |   | CQE64 | | CQE64 | | CQE64 |
  |-------|  |---------| |-------|   |-------| |-------| |-------|
  | ..... |  | cqe8[0] | |       | . |       | |       | | ..... |
  | ..... |  | cqe8[1] | |       | . |       | |       | | ..... |
  | ..... |  | ....... | |       | . |       | |       | | ..... |
  | ..... |  | cqe8[7] | |       |   |       | |       | | ..... |
  +-------+  +---------+ +-------+   +-------+ +-------+ +-------+

After decompression:

      0          1     ...     8
  +-------+  +-------+     +-------+
  | CQE64 |  | CQE64 |     | CQE64 |
  |-------|  |-------|     |-------|
  | ..... |  | ..... |  .  | ..... |
  | ..... |  | ..... |  .  | ..... |
  | ..... |  | ..... |  .  | ..... |
  | ..... |  | ..... |     | ..... |
  +-------+  +-------+     +-------+

This patch does not perform the entire decompression step as it would be
really expensive, instead the first CQE64 is consumed and an internal
context is maintained to interpret the following CQE8 entries directly.

Intermediate empty CQE64 entries are handed back to HW without further
processing.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
7 years agonet/mlx5: refactor Tx data path
Nélio Laranjeiro [Fri, 24 Jun 2016 13:17:53 +0000 (15:17 +0200)]
net/mlx5: refactor Tx data path

Bypass Verbs to improve Tx performance.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/mlx5: refactor Rx data path
Nélio Laranjeiro [Fri, 24 Jun 2016 13:17:52 +0000 (15:17 +0200)]
net/mlx5: refactor Rx data path

Bypass Verbs to improve RX performance.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
7 years agonet/mlx5: add Tx/Rx burst function selection wrapper
Nélio Laranjeiro [Fri, 24 Jun 2016 13:17:51 +0000 (15:17 +0200)]
net/mlx5: add Tx/Rx burst function selection wrapper

These wrappers are meant to prevent code duplication later.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>