dpdk.git
8 years agonet/vhost: move statistics into a structure
Zhiyong Yang [Thu, 29 Sep 2016 12:35:48 +0000 (20:35 +0800)]
net/vhost: move statistics into a structure

The patch moves all stats counters to a new defined struct vhost_stats
as follows, in order to manage all stats counters in a unified way and
simplify the subsequent function implementation(vhost_dev_xstats_reset).

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/vhost: retrieve vid for a given port
Ciara Loftus [Tue, 13 Sep 2016 13:47:43 +0000 (14:47 +0100)]
net/vhost: retrieve vid for a given port

In some cases when using the vHost PMD, certain vHost library functions
may still need to be accessed. One such example is the
rte_vhost_get_queue_num function which returns the number of virtqueues
reported by the guest - information which is not exposed by the PMD.

This commit introduces a new rte_eth_vhost function that returns the
'vid' associated with a given port id. This allows the PMD user to call
vHost library functions which require the 'vid' value.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio: add NEON based Rx handler
Jerin Jacob [Thu, 18 Aug 2016 04:12:11 +0000 (12:12 +0800)]
net/virtio: add NEON based Rx handler

Added neon based Rx vector implementation.
Selection of the new handler based neon availability at runtime.
Updated the release notes and MAINTAINERS file.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Jianbo Liu <jianbo.liu@linaro.org>
8 years agonet/virtio: select data handler depending on CPU flag
Jerin Jacob [Tue, 5 Jul 2016 12:49:25 +0000 (18:19 +0530)]
net/virtio: select data handler depending on CPU flag

Introduced cpuflag based run-time detection to select the
SSE based simple Rx handler

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio: move SSE based Rx code to separate file
Jerin Jacob [Tue, 5 Jul 2016 12:49:24 +0000 (18:19 +0530)]
net/virtio: move SSE based Rx code to separate file

Split out SSE instruction based virtio simple Rx
implementation to a separate file

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio: cleanup conditional compilation
Jerin Jacob [Tue, 5 Jul 2016 12:49:23 +0000 (18:19 +0530)]
net/virtio: cleanup conditional compilation

Removed unnecessary compile time dependency on "use_simple_rxtx".

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet: fix clang build
Yuanhan Liu [Mon, 26 Sep 2016 04:29:13 +0000 (12:29 +0800)]
net: fix clang build

Interestingly, clang and gcc has different prototype for _mm_prefetch().
For gcc, we have

   _mm_prefetch (const void *__P, enum _mm_hint __I)

While for clang, it's

   #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))

That's how the following error comes with clang:

   error: cast from 'const void *' to 'void *' drops const qualifier
   [-Werror,-Wcast-qual]
           _mm_prefetch((const void *)rused, _MM_HINT_T0);
   /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58:
   note: expanded from macro '_mm_prefetch'
            #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a),
                                          0, (sel)))

What's weird is that the build was actaully Okay before. I met it while
apply Jerin's vector support for ARM patch set: he just move this piece
of code to another file, nothing else changed.

This patch fix the issue when Jerin's patchset is applied. Thus, I think
it's still needed.

Similarly, make the same change to other _mm_prefetch users, just in case
this weird issue shows up again somehow later.

Fixes: fc3d66212fed ("virtio: add vector Rx")
Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx")
Fixes: 9ed94e5bb04e ("i40e: add vector Rx")
Fixes: 7092be8437bd ("fm10k: add vector Rx")

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
8 years agonet/virtio_user: fix error management during init
Jianfeng Tan [Tue, 27 Sep 2016 19:11:06 +0000 (19:11 +0000)]
net/virtio_user: fix error management during init

Currently, when virtio_user device fails to be started (e.g., vhost
unix socket does not exit), the init function does not return struct
rte_eth_dev (and some other structs) back to ether layer. And what's
more, it does not report the error to upper layer.

The fix is to free those structs and report error when failing to
start virtio_user devices.

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 wrong sequence of messages
Jianfeng Tan [Tue, 27 Sep 2016 19:11:05 +0000 (19:11 +0000)]
net/virtio_user: fix wrong sequence of messages

When virtio_user is used with VPP's native vhost user, it cannot
send/receive any packets.

The root cause is that vpp-vhost-user translates the message
VHOST_USER_SET_FEATURES as puting this device into init state,
aka, zero all related structures. However, previous code
puts this message at last in the whole initialization process,
which leads to all previous information are zeroed.

To fix this issue, we rearrange the sequence of those messages.
  - step 0, send VHOST_USER_SET_VRING_CALL so that vhost allocates
    virtqueue structures;
  - step 1, send VHOST_USER_SET_FEATURES to confirm the features;
  - step 2, send VHOST_USER_SET_MEM_TABLE to share mem regions;
  - step 3, send VHOST_USER_SET_VRING_NUM, VHOST_USER_SET_VRING_BASE,
    VHOST_USER_SET_VRING_ADDR, VHOST_USER_SET_VRING_KICK for each
    queue;
  - ...

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

Reported-by: Zhihong Wang <zhihong.wang@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio_user: fix first queue pair without multiqueue
Jianfeng Tan [Tue, 27 Sep 2016 19:11:04 +0000 (19:11 +0000)]
net/virtio_user: fix first queue pair without multiqueue

When virtio_user is used with OVS-DPDK (with mq disabled), it cannot
receive any packets. This is because no queue is enabled at all when
mq is disabled.

To fix it, we should consistently make sure the 1st queue is enabled,
which is also the behaviour QEMU takes.

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

Reported-by: Ning Li <lining18@jd.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: support indirect Tx descriptors
Maxime Coquelin [Tue, 27 Sep 2016 08:42:49 +0000 (10:42 +0200)]
vhost: support indirect Tx descriptors

Indirect descriptors are usually supported by virtio-net devices,
allowing to dispatch a larger number of requests.

When the virtio device sends a packet using indirect descriptors,
only one slot is used in the ring, even for large packets.

The main effect is to improve the 0% packet loss benchmark.
A PVP benchmark using Moongen (64 bytes) on the TE, and testpmd
(fwd io for host, macswap for VM) on DUT shows a +50% gain for
zero loss.

On the downside, micro-benchmark using testpmd txonly in VM and
rxonly on host shows a loss between 1 and 4%. But depending on
the needs, feature can be disabled at VM boot time by passing
indirect_desc=off argument to vhost-user device in Qemu.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agotools: fix virtio interface name when binding
Gary Mussar [Fri, 2 Sep 2016 13:16:33 +0000 (09:16 -0400)]
tools: fix virtio interface name when binding

The dpdk-devbind.py script does not find/display the ifname for virtio
interfaces since the "net" directory is not directly under the device
directory but rather under a subdirectory.
eg.
> dpdk-devbind.py --status
0000:00:03.0 'Virtio network device' if= drv=virtio-pci unused=

This change searches for the first "net" directory under the device
directory hierarchy.
eg.
0000:00:03.0 'Virtio network device' if=ens3 drv=virtio-pci unused=

Fixes: 629395b063e8 ("igb_uio: remove PCI id table")

Signed-off-by: Gary Mussar <gmussar@ciena.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio: fix xstats name
Zhiyong Yang [Wed, 7 Sep 2016 06:11:00 +0000 (14:11 +0800)]
net/virtio: fix xstats name

We have a stats named "size_1024_1517_packets", while the code
actually counts the range "[1024, 1518]", which is obviously wrong.
The code is as follows in the function virtio_update_packet_stats.

else if (s < 1519)
stats->size_bins[6]++;

We could either fix it by correcting the "if" check in the code,
or fix it by just renaming the stats to conform to the code. The
latter solution is taken because that's what the RFC2819 suggests.

Fixes: 76d4c652e07d ("virtio: add extended stats")

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio: enable indirect descriptors feature
Pierre Pfister [Wed, 7 Sep 2016 02:46:18 +0000 (10:46 +0800)]
net/virtio: enable indirect descriptors feature

Virtio indirect descriptors are supported by the data-path
but the feature bit is never set during feature negociation.

This patch simply adds VIRTIO_RING_F_INDIRECT_DESC back to
the supported features bit mask, hence enabling the use of
indirect descriptors when the feature is negociated with the
device.

Signed-off-by: Pierre Pfister <ppfister@cisco.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: remove obsolete comment
Matthias Gatto [Fri, 2 Sep 2016 15:05:21 +0000 (17:05 +0200)]
vhost: remove obsolete comment

As new_device and destroy_device use an int instead of a
"struct virtio_net *", The comment about setting VIRTIO_DEV_RUNNING
doesn't make sense anymore, plus If I've correctly understand the
code, the drivers take care of setting the flag before calling the
callbacks, so I guess that this comment is obsolet and I've remove it.

Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: simplify features set/get
Yuanhan Liu [Thu, 18 Aug 2016 08:48:43 +0000 (16:48 +0800)]
vhost: simplify features set/get

No need to use a pointer to store/retrieve features.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
8 years agovhost: get device once
Yuanhan Liu [Thu, 18 Aug 2016 08:48:42 +0000 (16:48 +0800)]
vhost: get device once

Invoke get_device() at the beginning of vhost_user_msg_handler, so that
we could check the return value once. Which could save tons of duplicate
get-and-check device.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
8 years agovhost: unify function names
Yuanhan Liu [Thu, 18 Aug 2016 08:48:41 +0000 (16:48 +0800)]
vhost: unify function names

Some functions are with prefix "user_", while others with "vhost_".
Making them all starting with "vhost_user_" to unify the function names.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
8 years agovhost: fold common message handlers
Yuanhan Liu [Thu, 18 Aug 2016 08:48:40 +0000 (16:48 +0800)]
vhost: fold common message handlers

Due to history reason (that we have 2 vhost implementations), some
messages are handled in two calls: vhost specific implementation
handles it first and then invoke the common one to do another handling.

We have one implementation only now, we could write one method for
each message. Here fold those common handles to corresponding vhost
user handler.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
8 years agovhost: refactor code structure
Yuanhan Liu [Thu, 18 Aug 2016 08:48:39 +0000 (16:48 +0800)]
vhost: refactor code structure

The code structure is a bit messy now. For example, vhost-user message
handling is spread to three different files:

    vhost-net-user.c  virtio-net.c  virtio-net-user.c

Where, vhost-net-user.c is the entrance to handle all those messages
and then invoke the right method for a specific message. Some of them
are stored at virtio-net.c, while others are stored at virtio-net-user.c.

The truth is all of them should be in one file, vhost_user.c.

So this patch refactors the source code structure: mainly on renaming
files and moving code from one file to another file that is more suitable
for storing it. Thus, no functional changes are made.

After the refactor, the code structure becomes to:

- socket.c      handles all vhost-user socket file related stuff, such
                as, socket file creation for server mode, reconnection
                for client mode.

- vhost.c       mainly on stuff like vhost device creation/destroy/reset.
                Most of the vhost API implementation are there, too.

- vhost_user.c  all stuff about vhost-user messages handling goes there.

- virtio_net.c  all stuff about virtio-net should go there. It has virtio
                net Rx/Tx implementation only so far: it's just a rename
                from vhost_rxtx.c

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
8 years agovhost: remove sub-directory
Yuanhan Liu [Thu, 18 Aug 2016 08:48:38 +0000 (16:48 +0800)]
vhost: remove sub-directory

We now have one vhost implementation; no sub source dir is needed.
Remove it by move them to upper dir.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
8 years agovhost: remove vhost-cuse
Yuanhan Liu [Thu, 18 Aug 2016 08:48:37 +0000 (16:48 +0800)]
vhost: remove vhost-cuse

remove vhost-cuse code, including the eventfd_link kernel module that
is for vhost-cuse only.

The lib/virt/qemu-wrap.py is also removed, as it's mainly for vhost-cuse
usage.

As we have one vhost implementation now, one vhost config option is
needed only. Thus, CONFIG_RTE_LIBRTE_VHOST_USER is removed.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
8 years agoexamples/vhost: remove VLAN strip option
Jianfeng Tan [Thu, 18 Aug 2016 05:46:13 +0000 (05:46 +0000)]
examples/vhost: remove VLAN strip option

When VMDQ is enabled, different NICs have different behaviors for
disabling VLAN strip. In detail, i40e only enables/disables it of
PF's main vsi; fm10k cannot disable VLAN strip, etc. We now remove
this option, --vlan-strip, to reduce any confusion. And now, VLAN
strip will be enabled and cannot be disabled.

Reported-by: Qian Xu <qian.q.xu@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: support multiple socket files
Jiayu Hu [Sat, 20 Aug 2016 10:11:36 +0000 (06:11 -0400)]
examples/vhost: support multiple socket files

When examples/vhost runs in client mode, only one QEMU can be connected.
This is because that examples/vhost just supports one socket file. This
patch is to add multiple sockets support for examples/vhost.

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/vhost: rename --dev-basename to --socket-file
Jiayu Hu [Sat, 20 Aug 2016 10:10:33 +0000 (06:10 -0400)]
examples/vhost: rename --dev-basename to --socket-file

In examples/vhost, "dev-basename" is a program option, which is to set
the vhost-net socket used by vhost-user, or the character device used
by vhost-cuse. Since vhost-cuse should be dropped, and "dev-basename"
is not a suitable name for the vhost-net socket. Therefore, this patch
is to change this option name for examples/vhost.

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agotools: fix json output of pmdinfo
Olivier Matz [Fri, 26 Aug 2016 13:15:32 +0000 (15:15 +0200)]
tools: fix json output of pmdinfo

Using dpdk-pmdinfo with the '-r' flag does not produce a json output as
documented. Instead, the python representation of the json object is
shown, which is nearly the same, but cannot be properly parsed by a json
parser.

python repr (before):
  {u'pci_ids': [[5549, 1968, 65535, 65535]], u'name': u'vmxnet3'}
json (after):
  {"pci_ids": [[5549, 1968, 65535, 65535]], "name": "vmxnet3"}

Fixes: c67c9a5c646a ("tools: query binaries for HW and other support information")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agopmdinfogen: fix clang build
Ferruh Yigit [Wed, 28 Sep 2016 10:05:19 +0000 (11:05 +0100)]
pmdinfogen: fix clang build

Compile error:
  CC mlx5.o.pmd.o
mlx5.o.pmd.c:1:227:
error: no newline at end of file [-Werror,-Wnewline-eof]
  ...__attribute__((used)) = "PMD_INFO_STRING= {...}";
                                                      ^

Produced with clang 3.8.0 and MLX5_PMD and MLX5_DEBUG
config options enabled.

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

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agohash: fix free slot check
Pablo de Lara [Tue, 4 Oct 2016 07:16:34 +0000 (08:16 +0100)]
hash: fix free slot check

In function rte_hash_cuckoo_insert_mw_tm, while looking for
an empty slot, only the first entry in the bucket was being checked,
as key_idx array was not being iterated.

Fixes: 5fc74c2e146d ("hash: check if slot is empty with key index")

Reported-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoethdev: clarify API comment for imissed stats
Olivier Matz [Fri, 9 Sep 2016 08:15:21 +0000 (10:15 +0200)]
ethdev: clarify API comment for imissed stats

The "imissed" stats represent RX packets dropped by the HW,
so we should not talk about mbufs as the hardware is not aware
of this structure. Buffer seems to be a better word.

Fixes: 4eadb8ba11b7 ("ethdev: do not deprecate imissed counter")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: fix comments for no contiguous flag
Ferruh Yigit [Wed, 28 Sep 2016 13:59:29 +0000 (14:59 +0100)]
mempool: fix comments for no contiguous flag

Fixes: ce94a51ff05c ("mempool: add flag for removing phys contiguous constraint")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: fix comments of create functions
Ferruh Yigit [Wed, 28 Sep 2016 13:59:28 +0000 (14:59 +0100)]
mempool: fix comments of create functions

Fixes: 85226f9c526b ("mempool: introduce a function to create an empty pool")
Fixes: d1d914ebbc25 ("mempool: allocate in several memory chunks by default")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoeal/armv8: use high-resolution cycle counter
Jerin Jacob [Thu, 18 Aug 2016 11:51:30 +0000 (17:21 +0530)]
eal/armv8: use high-resolution cycle counter

Existing cntvct_el0 based rte_rdtsc() provides portable
means to get wall clock counter at user space. Typically
it runs at <= 100MHz.

The alternative method to enable rte_rdtsc() for high resolution
wall clock counter is through armv8 PMU subsystem.
The PMU cycle counter runs at CPU frequency, However,
access to PMU cycle counter from user space is not enabled
by default in the arm64 linux kernel.
It is possible to enable cycle counter at user space access
by configuring the PMU from the privileged mode (kernel space).

by default rte_rdtsc() implementation uses portable
cntvct_el0 scheme. Application can choose the PMU based
implementation with CONFIG_RTE_ARM_EAL_RDTSC_USE_PMU

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
8 years agopci: fix memory leak when detaching device
Yangchao Zhou [Thu, 29 Sep 2016 01:41:10 +0000 (09:41 +0800)]
pci: fix memory leak when detaching device

Fixes: dbe6b4b61b0e ("pci: probe or close device")

Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agopci: create device list and fallback on its members
Jan Viktorin [Tue, 20 Sep 2016 12:41:36 +0000 (18:11 +0530)]
pci: create device list and fallback on its members

Now that rte_device is available, drivers can start using its members
(numa, name) as well as link themselves into another rte_device list.

As of now no one is using this list, but can be used for moving over all
devices (pdev/vdev/Xdev) and perform bulk actions (like cleanup).

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Reword commit log for extra rte_device list]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agoeal: introduce generalized device
Jan Viktorin [Tue, 20 Sep 2016 12:41:35 +0000 (18:11 +0530)]
eal: introduce generalized device

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agoeal: register drivers explicitly
Jan Viktorin [Tue, 20 Sep 2016 12:41:34 +0000 (18:11 +0530)]
eal: register drivers explicitly

To register both vdev and pci drivers into the list of all rte_driver,
we have to call rte_eal_driver_register explicitly.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agopci: inherit common driver in PCI driver
Jan Viktorin [Tue, 20 Sep 2016 12:41:33 +0000 (18:11 +0530)]
pci: inherit common driver in PCI driver

Remove the 'name' member from rte_pci_driver and move to generic
rte_driver.

Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
as well as assigning a name to eth_driver.pci_drv.name member.
In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has
been populated into the rte_driver.name member - assignments through
eth_driver has been removed.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Rebase and expand changes to newly added files]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agoeal: rename and move PCI resource structure
Jan Viktorin [Tue, 20 Sep 2016 12:41:32 +0000 (18:11 +0530)]
eal: rename and move PCI resource structure

There is no need to have a custom memory resource representation for
each infrastructure (PCI, ...) as it would always have the same members.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agoeal: include dev headers in place of PCI headers
Jan Viktorin [Tue, 20 Sep 2016 12:41:31 +0000 (18:11 +0530)]
eal: include dev headers in place of PCI headers

Further refactoring and generalization of PCI infrastructure will
require access to the rte_dev.h contents.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agoeal: remove unused PMD types
Jan Viktorin [Tue, 20 Sep 2016 12:41:30 +0000 (18:11 +0530)]
eal: remove unused PMD types

- All devices register themselfs by calling a kind of DRIVER_REGISTER_XXX.
  The PMD_REGISTER_DRIVER is not used anymore.
- PMD_VDEV type is also not being used - can be removed from all VDEVs.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agodrivers: use vdev registration
Jan Viktorin [Tue, 20 Sep 2016 12:41:29 +0000 (18:11 +0530)]
drivers: use vdev registration

All PMD_VDEV drivers can now use rte_vdev_driver instead of the
rte_driver (which is embedded in the rte_vdev_driver).

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agoeal: remove PCI/vdev unused code
Jan Viktorin [Tue, 20 Sep 2016 12:41:28 +0000 (18:11 +0530)]
eal: remove PCI/vdev unused code

- Remove checks for VDEV from rte_eal_vdev_(init/uninint) as all devices
  are inherently virtual here.
- PDEVs perform PCI specific inits - rte_eal_dev_init() need not call
  rte_driver->init();

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Reword commit log]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agoeal: extract vdev infra
Jan Viktorin [Tue, 20 Sep 2016 12:41:27 +0000 (18:11 +0530)]
eal: extract vdev infra

Move all PMD_VDEV-specific code into a separate module and header
file to not polute the generic code anymore. There is now a list
of virtual devices available.

The rte_vdev_driver integrates the original rte_driver inside
(C inheritance). The rte_driver will be however change in the
future to serve as a common base for all other types of drivers.

The existing PMDs (PMD_VDEV) are to be modified later (there is
no change for them at the moment).

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agoethdev: get rid of device type
David Marchand [Tue, 20 Sep 2016 12:41:26 +0000 (18:11 +0530)]
ethdev: get rid of device type

Now that hotplug has been moved to eal, there is no reason to keep the
device type in this layer.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
8 years agoethdev: convert to EAL hotplug
David Marchand [Tue, 20 Sep 2016 12:41:25 +0000 (18:11 +0530)]
ethdev: convert to EAL hotplug

Remove bus logic from ethdev hotplug by using eal for this.

Current api is preserved:
- the last port that has been created is tracked to return it to the
  application when attaching,
- the internal device name is reused when detaching.

We can not get rid of ethdev hotplug yet since we still need some
mechanism to inform applications of port creation/removal to substitute
for ethdev hotplug api.

dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the
following commit.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
8 years agoeal: add hotplug operations for PCI and vdev
David Marchand [Tue, 20 Sep 2016 12:41:24 +0000 (18:11 +0530)]
eal: add hotplug operations for PCI and vdev

Hotplug invocations, which deals with devices, should come from the layer
that already handles them, i.e. EAL.

For both attach and detach operations, 'name' is used to select the bus
that will handle the request.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
8 years agoethdev: do not scan all PCI devices on attach
David Marchand [Tue, 20 Sep 2016 12:41:23 +0000 (18:11 +0530)]
ethdev: do not scan all PCI devices on attach

No need to scan all devices, we only need to update the device being
attached.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
8 years agopci: introduce helpers for device name parsing/update
David Marchand [Tue, 20 Sep 2016 12:41:22 +0000 (18:11 +0530)]
pci: introduce helpers for device name parsing/update

- Move rte_eth_dev_create_unique_device_name() from ether/rte_ethdev.c to
  common/include/rte_pci.h as rte_eal_pci_device_name(). Being a common
  method, can be used across crypto/net PCI PMDs.
- Remove crypto specific routine and fallback to common name function.
- Introduce a eal private Update function for PCI device naming.

Signed-off-by: David Marchand <david.marchand@6wind.com>
[Shreyansh: Merge crypto/pci helper patches]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
8 years agodrivers: use PCI registration macro
David Marchand [Tue, 20 Sep 2016 12:41:20 +0000 (18:11 +0530)]
drivers: use PCI registration macro

Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.

Exceptions:
- virtio and mlx* use RTE_INIT directly as they have custom initialization
  steps.
- VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.

Update documentation for replacing an example referring to
PMD_REGISTER_DRIVER.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
8 years agodrivers: export probe/remove helpers for PCI drivers
David Marchand [Tue, 20 Sep 2016 12:41:19 +0000 (18:11 +0530)]
drivers: export probe/remove helpers for PCI drivers

crypto and ethdev drivers aligned to PCI probe/remove. These wrappers are
mapped directly to PCI resources.
Existing handlers for init/uninit can be easily reused for this.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
8 years agoeal: introduce driver init macros
David Marchand [Tue, 20 Sep 2016 12:41:18 +0000 (18:11 +0530)]
eal: introduce driver init macros

Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
DRIVER_REGISTER_PCI is added as a helper for pci drivers.

Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
[Shreyansh: Update PCI Registration macro name]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
8 years agodrivers: align PCI driver definitions
David Marchand [Tue, 20 Sep 2016 12:41:17 +0000 (18:11 +0530)]
drivers: align PCI driver definitions

Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
8 years agocryptodev: remove PMD type
David Marchand [Tue, 20 Sep 2016 12:41:16 +0000 (18:11 +0530)]
cryptodev: remove PMD type

This information is not used and just adds noise.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agopci: replace devinit/devuninit with probe/remove
Shreyansh Jain [Tue, 20 Sep 2016 12:41:15 +0000 (18:11 +0530)]
pci: replace devinit/devuninit with probe/remove

Probe and Remove are more appropriate names for PCI init and uninint
operations. This is a cosmetic change.

Only MLX* uses the PCI direct registration, bypassing PMD_* macro.
The callbacks for this too have been updated.

VDEV are left out. For them, init/uninit are more appropriate.

Suggested-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agopci: initialize lists statically
David Marchand [Tue, 20 Sep 2016 12:41:14 +0000 (18:11 +0530)]
pci: initialize lists statically

These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).

A nice side effect is that pci drivers can now register in constructors.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
8 years agoeal: remove duplicate function declaration
David Marchand [Tue, 20 Sep 2016 12:41:13 +0000 (18:11 +0530)]
eal: remove duplicate function declaration

rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h

Fixes: e57f20e05177 ("eal: make vdev init path generic for both virtual and pci devices")

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agoeal: move CPU flags check from constructor to init
Flavio Leitner [Fri, 23 Sep 2016 14:47:31 +0000 (11:47 -0300)]
eal: move CPU flags check from constructor to init

An application might be linked to DPDK but not really use it,
so move the cpu flag check to the EAL initialization instead.

Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Aaron Conole <aconole@redhat.com>
8 years agomem: fix crash on hugepage mapping error
Maciej Czekaj [Wed, 28 Sep 2016 10:52:57 +0000 (12:52 +0200)]
mem: fix crash on hugepage mapping error

In ASLR-enabled system, it is possible that selected
virtual space is occupied by program segments. Therefore,
error path should not blindly unmap all memmory segments
but only those already mapped.

Steps that lead to crash:
1. memeseg 0 in secondary process overlaps with libc.so
2. mmap of /dev/zero fails for virtual space of memseg 0
3. munmap of memseg 0 leads to unmapping libc.so itself
4. app gets SIGSEGV after returning from syscall to libc

Fixes: ea329d7f8e34 ("mem: fix leak after mapping failure")

Signed-off-by: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>
8 years agomem: remove single file segments
Yuanhan Liu [Fri, 23 Sep 2016 07:10:46 +0000 (15:10 +0800)]
mem: remove single file segments

RTE_EAL_SINGLE_FILE_SEGMENTS was introduced with ivshmem integration.
Now that ivshmem was removed (commit c711ccb30987)
and a simple git grep shows no one else references it;
I think we can now remove it.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agohash: check if slot is empty with key index
Pablo de Lara [Fri, 26 Aug 2016 21:30:09 +0000 (22:30 +0100)]
hash: check if slot is empty with key index

Instead of checking if the current and alternative signatures are 0,
it is faster to check if the key index associated to an entry
is 0, meaning that the slot is empty.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
8 years agohash: fix false zero signature key hit lookup
Pablo de Lara [Fri, 26 Aug 2016 21:30:08 +0000 (22:30 +0100)]
hash: fix false zero signature key hit lookup

This commit fixes a corner case scenario. When a key is deleted,
its signature in the hash table gets clear, which should prevent
a lookup of that same key, unless the signature of the key is all zeroes.

In that case, there will be a match, and key would be compared against
the key that is in the table (which does not get cleared,
as the performance penalty would be high), resulting in a wrong hit.

To prevent this from happening, the key index associated to that entry
should be set to zero when deleting it, so in case that same key
is looked up just after a deletion, it will point to the dummy key slot,
which guarantees a miss.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
8 years agohash: fix ring size
Pablo de Lara [Fri, 26 Aug 2016 21:30:07 +0000 (22:30 +0100)]
hash: fix ring size

Ring stores the free slots available to be used in the key table.
The ring size was being increased by 1, because of the dummy slot,
used for key misses, but this is not actually stored in the ring,
so there is no need to increase it.

Fixes: 5915699153d7 ("hash: fix scaling by reducing contention")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
8 years agoeal: customize delay function
Jozef Martiniak [Mon, 26 Sep 2016 08:35:09 +0000 (10:35 +0200)]
eal: customize delay function

When running single-core, some drivers tend to call rte_delay_us for a
long time, and that is causing packet drops.
To avoid this, rte_delay_us can be replaced with user-defined delay
function with:

void rte_delay_us_callback_register(void(*userfunc)(unsigned));

When userfunc==rte_delay_us_block build-in blocking delay function is
restored.

Signed-off-by: Jozef Martiniak <jozmarti@cisco.com>
8 years agosched: fix releasing enqueued packets
Hiroyuki Mikita [Mon, 5 Sep 2016 15:15:14 +0000 (00:15 +0900)]
sched: fix releasing enqueued packets

rte_sched_port_free should release only enqueued packets of all queues.
Previous behavior is that enqueued and already dequeued packets of
only first 4 queues are released.

Fixes: 61383240 ("sched: release enqueued mbufs when freeing port")

Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoapp/proc_info: check for primary process
Maryam Tahhan [Wed, 7 Sep 2016 10:37:50 +0000 (11:37 +0100)]
app/proc_info: check for primary process

Add a check to see if the primary process is running and exit gracefully
if it is not.

Suggested-by: Patrick Kutch <patrick.g.kutch@intel.com>
Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
8 years agoapp/testpmd: fix help of MTU set commmand
Ferruh Yigit [Wed, 31 Aug 2016 16:48:48 +0000 (17:48 +0100)]
app/testpmd: fix help of MTU set commmand

Fixes: ae03d0d18adf ("app/testpmd: command to configure MTU")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: fix timeout in Rx queue flushing
James Poole [Thu, 8 Sep 2016 09:49:16 +0000 (10:49 +0100)]
app/testpmd: fix timeout in Rx queue flushing

When testpmd is run, the application would hang on the second time
that "start" is executed. This is because the timer limit would get
multiplied to an unreachably high number.

At the start of flush_fwd_rx_queues(), the timer limit now resets
to stop it from getting to this high number.

The timer has been made local for this function.

Fixes: f487715f36f5 ("app/testpmd: add timeout in Rx queue flushing")

Signed-off-by: James Poole <james.g.poole@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agoapp/testpmd: fix crash when mempool allocation fails
Olivier Matz [Fri, 9 Sep 2016 09:42:08 +0000 (11:42 +0200)]
app/testpmd: fix crash when mempool allocation fails

Avoid access to mempool pointer if it is NULL.

Coverity issue: 127553
Fixes: b19a0c75a0d4 ("app/testpmd: remove anonymous mempool code")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/test-pipeline: fix table hash LRU initialization
Guruprasad Rao [Fri, 23 Sep 2016 13:54:50 +0000 (06:54 -0700)]
app/test-pipeline: fix table hash LRU initialization

macro ‘APP_METADATA_OFFSET’ was not used to initialize
‘signature_offset’ and ‘key_offset’ part of struct
rte_table_hash_lru_params.
Instead integer offset values were directly used.

with this fix 'hash-8-lru', 'hash-16-lru', 'hash-32-lru' table types are
able to forward traffic as expected.

Fixes: 48f31ca50cc4 ("app/pipeline: packet framework benchmark")

Signed-off-by: Sankar Chokkalingam <sankarx.chokkalingam@intel.com>
Signed-off-by: Guruprasad Rao <guruprasadx.rao@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoapp/test: fix packet framework table unit tests
Jasvinder Singh [Mon, 12 Sep 2016 11:05:52 +0000 (12:05 +0100)]
app/test: fix packet framework table unit tests

The pipeline object is not freed when a particular test-case of the
unit-test finishes. Using rte_pipeline_free() before returning the
outcome for each test-case fixes the issue.

Fixes: 5205954791cb ("app/test: packet framework unit tests")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoapp/test: decrease memory requirements for sched
Olivier Matz [Mon, 12 Sep 2016 11:38:49 +0000 (13:38 +0200)]
app/test: decrease memory requirements for sched

The sched test consumes 35MB memory. When memory is too fragmented (with
2M hugepages), the test can fail.

To reduce this risk, decrease it to 4.5MB by modifying
n_pipes_per_subport and qsize.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoapp/test: decrease memory requirements for hash
Olivier Matz [Mon, 12 Sep 2016 11:38:08 +0000 (13:38 +0200)]
app/test: decrease memory requirements for hash

In hash autotest, the size of tables that should be successfully created
is 32K entries (256KB), except for the table called "different_name",
which is 1M entries (8MB). When memory is too fragmented (with 2M
hugepages), the test can fail.

To avoid allocation failures due to memory fragmentation, decrease the
size of the table to 32K.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomk: allow to override devel mode from environment
Luca Boccassi [Wed, 14 Sep 2016 10:50:42 +0000 (11:50 +0100)]
mk: allow to override devel mode from environment

RTE_DEVEL_BUILD is set to := y in mk/rte.vars.mk, which makes it
impossible to override via an environment variable, and forces users
to pass it inline in the make call.
Use ?= instead to have it pick up the environment variable as well.

Signed-off-by: Luca Boccassi <lboccass@brocade.com>
Acked-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
8 years agomk: add missing preprocessor options
Luca Boccassi [Tue, 30 Aug 2016 17:25:04 +0000 (18:25 +0100)]
mk: add missing preprocessor options

Some targets in mk/internal/rte.compile-pre.mk are calling CC or
HOSTCC without passing CPPFLAGS, EXTRA_CPPFLAGS or HOST_CPPFLAGS,
HOST_EXTRA_CPPFLAGS.
On Debian/Ubuntu builds this means that preprocessor flags set by the
dpkg-buildpackage environment, like hardening flags, are not
correctly passed to all objects builds.

Signed-off-by: Luca Boccassi <lboccass@brocade.com>
Acked-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
8 years agomk: fix verbosity zero
Thomas Monjalon [Thu, 22 Sep 2016 23:35:39 +0000 (01:35 +0200)]
mk: fix verbosity zero

Verbosity is considered enabled when $V is not empty.
It is a well spread shortcut in makefiles, see git grep '$(if $(*V'
So V=0 and V=1 are equivalent.
It is fixed by unsetting V when it is 0.

A side effect is to fix kernel module compilation verbosity
which is set to 0 when V is empty.

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agomk: fix install on FreeBSD
Ferruh Yigit [Mon, 29 Aug 2016 09:11:32 +0000 (10:11 +0100)]
mk: fix install on FreeBSD

FreeBSD make install fails because of unsupported tar option:
tar: Option --warning=no-ignore-newer is not supported

Issue fixed by removing unsupported tar option.

Fixes: 6b62a72a70d0 ("mk: install a standard cutomizable tree")
Fixes: e4552b9cc603 ("mk: install doc")

Reported-by: Daniel Verkamp <daniel.verkamp@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agokni: fix large stack frame size
Ferruh Yigit [Thu, 22 Sep 2016 14:48:54 +0000 (15:48 +0100)]
kni: fix large stack frame size

Compile error:
.../lib/librte_eal/linuxapp/kni/kni_net.c:
In function ‘kni_net_rx_lo_fifo’:
.../lib/librte_eal/linuxapp/kni/kni_net.c:331:1:
error: the frame size of 1056 bytes is larger than 1024 bytes
[-Werror=frame-larger-than=]

This compile error seen with some compiler / kernel combinations.

Moved some local variables to the kni_dev struct.

Fixes: 8451269e6d7b ("kni: remove continuous memory restriction")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agohash: fix custom compare
Masoud Hasanifard [Sat, 17 Sep 2016 09:43:24 +0000 (14:13 +0430)]
hash: fix custom compare

Set cmp_jump_table_idx to KEY_CUSTOM in rte_hash_cmp_eq so that the custom
function we are setting in rte_hash_set_cmp_func properly works. The custom
function is only called by rte_hash_cmp_eq if cmp_jump_table_idx is set to
KEY_CUSTOM.

Fixes: 95da2f8e9c61 ("hash: customize compare function")

Signed-off-by: Masoud Hasanifard <masoudhasanifard@gmail.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agometer: fix excess token bucket update in srtcm
Nikhil Jagtap [Wed, 21 Sep 2016 05:57:42 +0000 (00:57 -0500)]
meter: fix excess token bucket update in srtcm

As per srTCM RFC 2697, we should be updating the E bucket only after the
C bucket overflows. This patch fixes the current DPDK implementation,
where we are updating both the buckets simultaneously at the same rate
(CIR) which results in token accumulation rate of (2*CIR).

Signed-off-by: Nikhil Jagtap <nikhil.jagtap@gmail.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agokni: remove continuous memory restriction
Ferruh Yigit [Thu, 25 Aug 2016 11:30:34 +0000 (12:30 +0100)]
kni: remove continuous memory restriction

Use mempool buf_addr and buf_physaddr fields for address translation.

Since each mbuf address calculated separately, the restriction of all
mbufs should come from a continuous memory restriction is no more valid.

mbuf related FIFO's content changed, rx_q and alloc_q now carries
physical address of mbufs. tx_q and free_q content not changed, they
still carries virtual address of mbufs.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agokni: fix error rollback kernel crash
Yangchao Zhou [Sun, 11 Sep 2016 09:59:23 +0000 (17:59 +0800)]
kni: fix error rollback kernel crash

Fixes: 9c61145ff6f9 ("kni: allow multiple threads")

Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agokni: remove panic exits from library
Ferruh Yigit [Fri, 2 Sep 2016 09:51:49 +0000 (10:51 +0100)]
kni: remove panic exits from library

This also helps to remove stack backtrace when kernel module is not
inserted.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agokni: fix build with kernel 4.8
Ferruh Yigit [Thu, 8 Sep 2016 18:32:09 +0000 (19:32 +0100)]
kni: fix build with kernel 4.8

Linux kernel v4.8 removes macro DEFINE_PCI_DEVICE_TABLE

Linux: 7e9321599011 ("treewide: remove references to the now unnecessary
DEFINE_PCI_DEVICE_TABLE")

Replaced macro with its value in kni ethtool drivers.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
8 years agokni: fix build with kernel < 3.0
Ferruh Yigit [Fri, 16 Sep 2016 16:09:58 +0000 (17:09 +0100)]
kni: fix build with kernel < 3.0

Compile error:
  CC [M]  .../build/lib/librte_eal/linuxapp/kni/igb_main.o
.../build/lib/librte_eal/linuxapp/kni/igb_main.c:
In function ‘igb_check_swap_media’:
.../build/lib/librte_eal/linuxapp/kni/igb_main.c:1556:7:
error: variable ‘link’ set but not used [-Werror=unused-but-set-variable]
  bool link;
       ^

With Linux kernel >= v3.0 this warning disabled:
Linux: 8417da6f2128 ("kbuild: Fix passing -Wno-* options to gcc 4.4+")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agokni: support RHEL 7.3
Pablo de Lara [Fri, 16 Sep 2016 21:01:09 +0000 (22:01 +0100)]
kni: support RHEL 7.3

Add support for RHEL 7.3, which uses kernel 3.10,
but backported features from newer kernels.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agokni: fix debug build
Ferruh Yigit [Thu, 15 Sep 2016 12:06:44 +0000 (13:06 +0100)]
kni: fix debug build

Fix build error with Linux kernel >= v4.7

Fix compile error because of Linux API change, 'trans_start' field
removed from 'struct net_device'.

Linux: 9b36627acecd ("net: remove dev->trans_start")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agomempool: fix corruption due to invalid handler
Weiliang Luo [Thu, 8 Sep 2016 15:29:57 +0000 (10:29 -0500)]
mempool: fix corruption due to invalid handler

When using rte_mempool_create(), the mempool handler is selected
depending on the flags given by the user:
  - multi-consumer / multi-producer
  - multi-consumer / single-producer
  - single-consumer / multi-producer
  - single-consumer / single-producer

The flags were not properly tested, resulting in the selection of sc/sp
handler if sc/mp or mc/sp was asked. This can lead to corruption or
crashes because the get/put operations are not atomic.

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

Signed-off-by: Weiliang Luo <droidluo@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomem: use more restrictive permissions on hugepages
Robin Jarry [Wed, 10 Aug 2016 14:52:54 +0000 (16:52 +0200)]
mem: use more restrictive permissions on hugepages

There is no need for the page files to be readable (and executable) by
other users. This can be exploited by non-privileged users to access the
working memory of a DPDK app.

Open the files with 0600.

Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
8 years agodrivers: make driver names consistent
Pablo de Lara [Wed, 24 Aug 2016 22:24:54 +0000 (23:24 +0100)]
drivers: make driver names consistent

As discussed in the past release, driver names are modified
to be more consistent, and the future driver should follow
this new convention.

Driver names consist of:
"driver category"_"driver folder name"_"optional extra name".

For example:
- Crypto null driver       -> "crypto_null"
- Network IXGBE VF driver  -> "net_ixgbe_vf"

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoremove unused ring includes
Amine Kherbouche [Wed, 31 Aug 2016 08:34:26 +0000 (10:34 +0200)]
remove unused ring includes

This patch removes all unused <rte_ring.h> headers.

Signed-off-by: Amine Kherbouche <amine.kherbouche@6wind.com>
8 years agomaintainers: claim responsability for crypto subtree
Pablo de Lara [Thu, 15 Sep 2016 23:25:32 +0000 (00:25 +0100)]
maintainers: claim responsability for crypto subtree

From 16.07, I will be the maintainer of the crypto subtree.

This will include:
- app/test/test_cryptodev*
- doc/guides/cryptodevs/
- drivers/crypto/
- examples/l2fwd-crypto/
- examples/ipsec-secgw/
- lib/librte_cryptodev/

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: disable optimization for ABI validation
Ferruh Yigit [Fri, 26 Aug 2016 15:06:40 +0000 (16:06 +0100)]
scripts: disable optimization for ABI validation

abi-dumper giving following warning:
WARNING: incompatible build option detected: -O3

Although this patch won't fix warning, it is to ensure code compiled
with optimization disabled.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agoscripts: reverse order of checked commits
Thomas Monjalon [Fri, 9 Sep 2016 11:01:51 +0000 (13:01 +0200)]
scripts: reverse order of checked commits

The list of git commits to check was in the reversed order.
Also add a comment in the help of checkpatches.sh about list input.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: David Marchand <david.marchand@6wind.com>
8 years agoscripts: remove useless checkpatch notes
Thomas Monjalon [Mon, 29 Aug 2016 08:55:38 +0000 (10:55 +0200)]
scripts: remove useless checkpatch notes

Depending of the checkpatch version in use, more or less notes are
printed below the report.
Only 6 lines were stripped, resulting to such note being printed:
NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.

The stripping is now more reliable because based on a very stable pattern.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: hide double git reference check error
Thomas Monjalon [Mon, 29 Aug 2016 08:15:47 +0000 (10:15 +0200)]
scripts: hide double git reference check error

When checking a git reference which does not exist, a git error
with the long git-branch usage is printed:

% scripts/check-git-log.sh '-1 3780cbd'
error: malformed object name 2de9f8551ff9
usage: git branch ...
  [a lot of lines]
Wrong 'Fixes' reference:
  Fixes: 2de9f8551ff9 ("ethdev: fix documentation for queue start/stop")

The error from the script is sufficient so the git error can be hidden.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoscripts: check compilation of exported header files
Adrien Mazarguil [Thu, 8 Sep 2016 12:25:11 +0000 (14:25 +0200)]
scripts: check compilation of exported header files

This script checks that header files in a given directory do not miss
dependencies when included on their own, do not conflict and accept being
compiled with the strictest possible flags.

It is too slow at the moment to be automatically executed by test-build.sh
and should be run voluntarily (like check-git-log.sh and friends) after
making changes to exported header files.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agolib: hide static functions never defined
Adrien Mazarguil [Thu, 8 Sep 2016 12:25:10 +0000 (14:25 +0200)]
lib: hide static functions never defined

Arch-specific functions not defined for all architectures (missing on x86
in this case) and not used anywhere should not expose a prototype.

This commit prevents the following error:

 error: `rte_mov48' declared `static' but never defined

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agolib: remove named variadic macros in exported headers
Adrien Mazarguil [Thu, 8 Sep 2016 12:25:09 +0000 (14:25 +0200)]
lib: remove named variadic macros in exported headers

Exported header files used by applications should allow the strictest
compiler flags. Language extensions used in many places must be explicitly
marked or removed to avoid warnings and compilation failures.

Since there is no way to force named variadic macros as extensions, use a
a standard __VA_ARGS__ with an extra dummy argument to format strings.

This commit prevents the following errors:

 error: ISO C does not permit named variadic macros

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agolib: work around forward reference to enum types
Adrien Mazarguil [Thu, 8 Sep 2016 12:25:08 +0000 (14:25 +0200)]
lib: work around forward reference to enum types

Exported header files used by applications should allow the strictest
compiler flags. Language extensions used in many places must be explicitly
marked or removed to avoid warnings and compilation failures.

This commit prevents the following errors:

 error: ISO C forbids forward references to `enum' types

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agolib: add missing include dependencies
Adrien Mazarguil [Thu, 8 Sep 2016 12:25:07 +0000 (14:25 +0200)]
lib: add missing include dependencies

Exported header files for use by applications should be self sufficient and
allow out of order inclusion. Moreover, they must include all the system
headers they need for types and macros.

This commit prevents the following errors:

 error: `RTE_MAX_LCORE' undeclared here (not in a function)
 error: `RTE_LPM_VALID_EXT_ENTRY_BITMASK' undeclared
  (first use in this function)
 error: #error "Unsupported cache line size"
 error: `asm' undeclared (first use in this function)
 error: implicit declaration of function `[...]'
 error: unknown type name `[...]'
 error: field `mac_addr' has incomplete type
 error: `CHAR_BIT' undeclared here (not in a function)
 error: `struct [...]' declared inside parameter list
 error: unknown type name `uint8_t'

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