dpdk.git
5 years agonet: add MPLS header structure
Olivier Matz [Tue, 23 Oct 2018 07:46:48 +0000 (09:46 +0200)]
net: add MPLS header structure

Add the Mpls header structure in librte_net. It will be used by next
patch that adds the support of Mpls L2 layer in the software packet
type parser.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoethdev: fix metadata documentation
Dekel Peled [Wed, 24 Oct 2018 06:22:00 +0000 (09:22 +0300)]
ethdev: fix metadata documentation

Previous patch introduced the Tx metadata feature, with unnecessary
restrictions on data entry.

This fix updates the documentation, removing the data entry
restrictions on metadata item.

Fixes: 839b20be0e9b ("ethdev: support metadata as flow rule criteria")

Acked-by: Ori Kam <orika@mellanox.com>
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
5 years agoapp/testpmd: fix metadata API and Tx insertion
Dekel Peled [Wed, 24 Oct 2018 06:21:59 +0000 (09:21 +0300)]
app/testpmd: fix metadata API and Tx insertion

Previous patch introduces the Tx metadata feature, with unnecessary
restrictions on data entry.
It also used the metadata in txonly fwd engine only.

This fix removes the data entry restrictions on metadata item.
It also implements callback function to add the metadata in every
Tx packet, sent by any fwd engine.

Fixes: c18feafa193c ("app/testpmd: support metadata as flow rule item")

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agoraw/ifpga: check probing error
Rosen Xu [Tue, 23 Oct 2018 01:50:49 +0000 (09:50 +0800)]
raw/ifpga: check probing error

Fixes not checking rte_eal_hotplug_add() return value issue.

Coverity issue: 323508
Fixes: ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
Cc: stable@dpdk.org
Signed-off-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
5 years agonet/mlx5: close all ports on remove
Ophir Munk [Tue, 23 Oct 2018 18:26:05 +0000 (18:26 +0000)]
net/mlx5: close all ports on remove

With the introduction of representors several eth devices are using
the same rte device (e.g. a PCI bus). When calling port detach on one
eth device it is required that all eth devices belonging to the
same rte device have been closed in advance, then the rte device
itself can be removed/detached.
This commit implements this requirement implicitly by adding a
remove callback to struct rte_pci_driver.
The new behavior can be demonstrated in testpmd.
First we attach a representor 0 using PCI address 0000:08:00.0
testpmd> port attach  0000:08:00.0,representor=[0]
Attaching a new port...
EAL: PCI device 0000:08:00.0 on NUMA socket 0
EAL:   probe driver: 15b3:1013 net_mlx5
Port 0 is attached.
Done
Port 1 is attached.
Done

Port 0 is the master device (PF) - an ethdev of the PCI address.
Port 1 is representor 0 - another ethdev (representing a VF) using the
same PCI address. Next we detach port 1
testpmd> port detach 1
Removing a device...
Port 0 is closed
Port 1 is closed
Now total ports is 0
Done

Since port 0 has been implicitly closed we cannot act on it anymore.
testpmd> port stop 0
Invalid port 0

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: release port on close
Ophir Munk [Tue, 23 Oct 2018 18:26:04 +0000 (18:26 +0000)]
net/mlx5: release port on close

With the introduction of representors several eth devices are using
the same rte device (e.g. a PCI bus). It is therefore required to
release the eth device resources during an eth device close operation
rather than during an rte device removal (detach) operation.
In current version many PMDs are still releasing the eth device as
part of the rte device removal. In order to allow a smooth transition
for all PMDs to behave correctly an ethdev flag RTE_ETH_DEV_CLOSE_REMOVE
is used. When this flag is set it indicates to rte_eth_dev_close() to
call rte_eth_dev_release_port(), so the port is freed during the close
operation.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: allow multiple probing for representor
Ophir Munk [Tue, 23 Oct 2018 18:26:03 +0000 (18:26 +0000)]
net/mlx5: allow multiple probing for representor

Implement probing of a rte device multiple times, see [1].
Set PCI driver RTE_PCI_DRV_PROBE_AGAIN flag to enable multiple probing
of the PCI device by the PCI common driver.
Consecutive probing requests with a devargs string may contain
repetitive master and representors devices for which eth device should
be created only once. In case an eth device already exists - silently
ignore it.

[1]
commit e9d159c3d534 ("eal: allow probing a device again")

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: fix bit width of item and action flags
Yongseok Koh [Wed, 24 Oct 2018 12:36:15 +0000 (15:36 +0300)]
net/mlx5: fix bit width of item and action flags

Most of the code uses uint64_t for MLX5_FLOW_LAYER_* and
MLX5_FLOW_ACTION_*, but there're some code using uint32_t.

Fixes: 2ed2fe5f0a9c ("net/mlx5: rewrite IP address UDP/TCP port by E-Switch")
Fixes: 57123c00c1b8 ("net/mlx5: add Linux TC flower driver for E-Switch flow")
Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function")
Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: fix flow tunnel handling
Yongseok Koh [Wed, 24 Oct 2018 12:36:14 +0000 (15:36 +0300)]
net/mlx5: fix flow tunnel handling

Both rte_flow and mlx5_flow redundantly have item flags. And it is not
properly set in the code. This causes wrong tunnel flag handling. A
rte_flow can have multiple expanded device flows if the flow has an RSS
action. Therefore, mlx5_flow should have the layers field.

Fixes: c4d9b9f7f382 ("net/mlx5: add Direct Verbs final functions")
Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function")
Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Fixes: 4e05a229c5da ("net/mlx5: add flow prepare function")
Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: rename static functions
Yongseok Koh [Wed, 24 Oct 2018 12:36:13 +0000 (15:36 +0300)]
net/mlx5: rename static functions

In mlx5_flow*.c, static functions have names starting from 'flow_' while
shared ones start from "mlx5_flow_'.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: fix flow mark ID conversion in Direct Verbs
Yongseok Koh [Tue, 23 Oct 2018 16:52:15 +0000 (16:52 +0000)]
net/mlx5: fix flow mark ID conversion in Direct Verbs

Fixes: d02cb0691299 ("net/mlx5: add Direct Verbs translate actions")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agonet/mlx5: fix wildcard item for Direct Verbs
Yongseok Koh [Tue, 23 Oct 2018 16:52:13 +0000 (16:52 +0000)]
net/mlx5: fix wildcard item for Direct Verbs

If a network layer is specified with no spec, it means wildcard match.
flow_dv_translate_item_*() returns without writing anything if spec is
null and it causes creation of wrong flow. E.g., the following flow has to
patch with any ipv4 packet.

  flow create 0 ingress pattern eth / ipv4 / end actions ...

But, with the current code, it matches any packet because PMD doesn't write
anything about IPv4. The matcher value and mask becomes completely zero. It
should have written the IP version at least. It is same for the rest of
items.

Even if the spec is null, PMD has to write constant fields before return,
e.g. IP version and IP protocol number.

Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agonet/mlx5: fix item validation in Direct Verbs
Yongseok Koh [Tue, 23 Oct 2018 16:52:12 +0000 (16:52 +0000)]
net/mlx5: fix item validation in Direct Verbs

1) remove MPLS item in validation as it doesn't have a translator.

2) add missing NVGRE item to validation

3) match switch-case order between validation and translation.

Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agonet/mlx5: fix UDP hash field flag in Direct Verbs
Yongseok Koh [Tue, 23 Oct 2018 16:52:10 +0000 (16:52 +0000)]
net/mlx5: fix UDP hash field flag in Direct Verbs

Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agonet/mlx5: add warning message for Direct Verbs flow
Yongseok Koh [Tue, 23 Oct 2018 16:52:09 +0000 (16:52 +0000)]
net/mlx5: add warning message for Direct Verbs flow

In case that the library doesn't support DV flow, if enabled by
'dv_flow_en=1', print out a warning message and disable it.

Fixes: 51e72d386c99 ("net/mlx5: add runtime parameter to enable Direct Verbs")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agonet/mlx5: support new flow counter API
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:16 +0000 (10:04 +0000)]
net/mlx5: support new flow counter API

This patch updates the functions performing the Verbs ibrary calls
in order to support different versions of the library.
The functions:
  - flow_verbs_counter_new()
  - flow_verbs_counter_release()
  - flow_verbs_counter_query()
now have the several compilation branches, depending on the
counters support found in the system at compile time.

The flow_verbs_counter_create() function is introduced as
helper for flow_verbs_counter_new(), actually this helper
create the counters with Verbs.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: remove unnecessary structure initializers
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:15 +0000 (10:04 +0000)]
net/mlx5: remove unnecessary structure initializers

The unnecessary structure filed initializers to zero are removed.
We need to do this minor preparation before the following
mlx5 counter structure modification.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: add new flow counter Verbs API to glue library
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:14 +0000 (10:04 +0000)]
net/mlx5: add new flow counter Verbs API to glue library

This patch updates the mlx5 glue library, new counter support
Verbs function pointers are added to the glue linking structure
mlx5_glue. This structure now contains the pointers to the both
versions of counter supporting functions due to compatibility
issues. Depending on configuration macros the functions perform
actual Verbs library calls or return an error with meaning
"feature is not supported" (NULL or ENOTSUP).

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: relocate flow counters query function
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:13 +0000 (10:04 +0000)]
net/mlx5: relocate flow counters query function

The flow_verbs_query_count() is moved into the the group of counter
managing functions and renamed to flow_verbs_counter_query() in order
to be in unified fashion with others.

Also minor function modification is made to avoid unreachable code
warnings if there is no counter support at compile time.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: simplify flow counters support check
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:13 +0000 (10:04 +0000)]
net/mlx5: simplify flow counters support check

The redundant check of Flow counters support in runtime is removed.
The flag flow_counter_en is eliminated from the code. The Verbs
create counter function just returns an error if no counter
support presented in the system.

If there is no any of Flow counters configuration macro defined
the log message is emited, indicating the missing counter support.

mlx5_flow_validate_action_count() fuctnion is also updated due to
flow_counter_en flag removal.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: introduce new flow counters configuration macro
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:12 +0000 (10:04 +0000)]
net/mlx5: introduce new flow counters configuration macro

The new configuration macro HAVE_IBV_DEVICE_COUNTERS_SET_V45 is
introduced. Both makefile and meson.build are changed.

Flow counter support code depends on the following configuration
macros:

- HAVE_IBV_DEVICE_COUNTERS_SET_V42 - is defined if system supports
  the "old" flow counters functionality, MLNX_OFED version from
  4.2 to 4.4 is required.

- HAVE_IBV_DEVICE_COUNTERS_SET_V45 - is defined if system supports
  the "new" flow counters functionality, MLNX_OVED 4.5 (or higher)
  or Linux rdma-core v19 (or higher) is required.

Neither HAVE_IBV_DEVICE_COUNTERS_SET_V42 nor
HAVE_IBV_DEVICE_COUNTERS_SET_V45 is defined if there is no
counters support.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: rename flow counter configuration macro
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:11 +0000 (10:04 +0000)]
net/mlx5: rename flow counter configuration macro

The HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT is replaced with
HAVE_IBV_DEVICE_COUNTERS_SET_V42. At this stage it is just
macro renaming. This macro is defined if system supports
the "old" Flow counters functionality, MLNX_OFED version
from 4.2 to 4.4 is required.

We need to do this preparation before introducing the new
configuration macro (HAVE_IBV_DEVICE_COUNTERS_SET_V45) for
the "new" Flow counters support.

Both makefile and meson.build are changed.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: fix flow counters creation
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:10 +0000 (10:04 +0000)]
net/mlx5: fix flow counters creation

The Flow counter creation function contains two problems:

  - Flow counter object in Verbs is not freed in case of memory
    allocation error. The call of counter Verbs object deallocating
    function is added to fix.

  - The initial value of reference counter is set to one in order
    to provide the correct counter object freeing in the
    flow_verbs_counter_release() function. The reference counter
    field should be initialized to one.

Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agovhost: initialize postcopy ufd properly
Tiwei Bie [Wed, 24 Oct 2018 09:39:48 +0000 (17:39 +0800)]
vhost: initialize postcopy ufd properly

Currently, postcopy_ufd is initialized to 0 implicitly, so fd 0
could be closed unexpectedly by vhost_backend_cleanup(). Fix this
issue by initializing postcopy_ufd to -1 explicitly.

Fixes: 9eefef3b5970 ("vhost: introduce postcopy advise message")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
5 years agovhost: avoid memory barriers when no descriptors dequeued
Maxime Coquelin [Tue, 23 Oct 2018 10:07:10 +0000 (12:07 +0200)]
vhost: avoid memory barriers when no descriptors dequeued

In both split and packed dequeue paths, flush_shadow_used_ring
and vhost_ring_call variants gets called even if not packets
have been dequeued, and so no descriptors updates happened.

It has an impact on CPU pipeline, as memory barriers are used
in these functions.

This patch don't call these functions if no descriptors have
been dequeued. The performance gain with split ring when
dequeue zero-copy is disabled should be null, but should be
noticeable with packed ring or dequeue zero-copy enabled.

Fixes: ae999ce49dcb ("vhost: add Tx support for packed ring")
Fixes: 915cf9404225 ("vhost: use shadow used ring in dequeue path")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
Tested-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
5 years agonet/i40e: update Tx offload mask
Beilei Xing [Tue, 23 Oct 2018 06:14:31 +0000 (14:14 +0800)]
net/i40e: update Tx offload mask

Tx offload mask is updated in following commit:
commit 1037ed842c37 ("mbuf: fix Tx offload mask").

Currently, the new added offload flags are not supported in PMD
and application will fail to call PMD transmit prepare function.
This patch updates PMD Tx offload mask.

Cc: stable@dpdk.org
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ixgbe: fix RSS flow error return
Wei Zhao [Tue, 23 Oct 2018 03:38:10 +0000 (11:38 +0800)]
net/ixgbe: fix RSS flow error return

If hash function is 0, it should disable RSS then return 0.

Fixes: 518cc3927b13 ("net/ixgbe: move RSS to flow API")
Cc: stable@dpdk.org
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Tested-by: Yuan Peng <yuan.peng@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/i40e: cancel alarm handler at the end of closure
Xiaolong Ye [Tue, 23 Oct 2018 00:54:28 +0000 (08:54 +0800)]
net/i40e: cancel alarm handler at the end of closure

Some operations in i40evf_dev_close like i40evf_dev_promiscuous_disable
still need alarm handler to clear the pending cmd, if alarm handler is
canceled in early stage of i40evf_dev_close,
i40evf_dev_promiscuous_disable will result in failure.

Fixes: 864a800d706d ("net/i40e: remove VF interrupt handler")
Cc: stable@dpdk.org
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
5 years agonet/i40e: enable loopback function for X722 MAC
Haiyue Wang [Mon, 22 Oct 2018 07:47:41 +0000 (15:47 +0800)]
net/i40e: enable loopback function for X722 MAC

In FVL, there was an issue and it didn't support the loopback function
before FW 5.0. For FPK (X722) it should work.

So it needs to distinguish between the devices by checking MAC type.

Fixes: 689bba33272d ("i40e: add VEB switching support")
Fixes: bce83974ba2c ("net/i40e: set Tx loopback from PF")
Cc: stable@dpdk.org
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ixgbe: fix flow create in ntuple check
Faicker Mo [Tue, 18 Sep 2018 05:48:52 +0000 (13:48 +0800)]
net/ixgbe: fix flow create in ntuple check

In ixgbe_flow_create function, ntuple filter is parsed first. If the
flow is considered to be ntuple filter, it will not go on to judge
ethertype filter, syn filter and fdir filter.
In the function ntuple_filter_to_5tuple, 5 tuple info is checked,
but it's too late to jump over the ntuple filter if it's a fdir filter.

Fixes: 46ea969177f3 ("net/ixgbe: add ntuple support to flow parser")
Cc: stable@dpdk.org
Signed-off-by: Faicker Mo <faicker.mo@ucloud.cn>
Acked-by: Wei Zhao <wei.zhao1@intel.com>
5 years agoethdev: support MAC address as iterator filter
Thomas Monjalon [Mon, 22 Oct 2018 13:15:30 +0000 (15:15 +0200)]
ethdev: support MAC address as iterator filter

The MAC addresses of a port can be matched with devargs.

As the conflict between rte_ether.h and netinet/ether.h is not resolved,
the MAC parsing is done with a rte_cmdline function.
As a result, cmdline library becomes a dependency of ethdev.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: support representor id as iterator filter
Thomas Monjalon [Mon, 22 Oct 2018 13:15:29 +0000 (15:15 +0200)]
ethdev: support representor id as iterator filter

The representor id is added in rte_eth_dev_data in order to be able
to match a port with its representor id in devargs.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: move representor parsing functions
Thomas Monjalon [Mon, 22 Oct 2018 13:15:28 +0000 (15:15 +0200)]
ethdev: move representor parsing functions

The functions for representor devargs parsing were static
in the file rte_ethdev.c.
In order to reuse them in the file rte_class_eth.c,
they are moved to the files ethdev_private.c/.h.

A log is fixed by adding a missing line feed.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agokvargs: support list value
Thomas Monjalon [Mon, 22 Oct 2018 13:15:27 +0000 (15:15 +0200)]
kvargs: support list value

If a value contains a comma, rte_kvargs_tokenize() will split here.
In order to support list syntax [a,b] as value, an extra parsing of
the square brackets is added.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
5 years agonet/mlx5: support metadata as flow rule criteria
Dekel Peled [Tue, 23 Oct 2018 19:34:09 +0000 (22:34 +0300)]
net/mlx5: support metadata as flow rule criteria

As described in series starting at [1], it adds option to set
metadata value as match pattern when creating a new flow rule.

This patch adds metadata support in mlx5 driver, in two parts:
- Add the validation and setting of metadata value in matcher,
  when creating a new flow rule.
- Add the passing of metadata value from mbuf to wqe when
  indicated by ol_flag, in different burst functions.

[1] "ethdev: support metadata as flow rule criteria"
    http://mails.dpdk.org/archives/dev/2018-September/113269.html

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agoapp/testpmd: support more types for flow RSS
Wei Zhao [Tue, 23 Oct 2018 09:20:56 +0000 (17:20 +0800)]
app/testpmd: support more types for flow RSS

Some user and tester require flow RSS to support more types,
so add "all" and "none" to make configuration more easy for users.

Tested-by: Yuan Peng <yuan.peng@intel.com>
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agoeal: remove deprecated attach/detach functions
Thomas Monjalon [Tue, 23 Oct 2018 08:28:41 +0000 (10:28 +0200)]
eal: remove deprecated attach/detach functions

These hotplug functions were deprecated and have some new replacements.
As announced earlier, the oldest ones are now removed.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: remove deprecated attach/detach functions
Thomas Monjalon [Tue, 23 Oct 2018 08:28:40 +0000 (10:28 +0200)]
ethdev: remove deprecated attach/detach functions

The hotplug attach/detach features are implemented in EAL layer.
There is a new ethdev iterator to retrieve ports from ethdev layer.

As announced earlier, the (buggy) ethdev functions are now removed.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agodoc: replace doxygen example in contribution guide
Thomas Monjalon [Tue, 23 Oct 2018 08:28:39 +0000 (10:28 +0200)]
doc: replace doxygen example in contribution guide

The provided example of doxygen header is about a deprecated function.
It is replaced by rte_spinlock_trylock() which is small and
good enough for the purpose.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: allow iterating with pure class filter
Thomas Monjalon [Tue, 23 Oct 2018 08:28:38 +0000 (10:28 +0200)]
ethdev: allow iterating with pure class filter

If no rte_device is given in the iterator,
eth_dev_match() is looking at all ports without any restriction,
except the ethdev kvargs filter.

It allows to iterate with a devargs filter referencing only
some ethdev parameters. The format (from the new devargs syntax) is:
class=eth,paramY=Y

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: add iterator to match devargs input
Thomas Monjalon [Tue, 23 Oct 2018 08:28:37 +0000 (10:28 +0200)]
ethdev: add iterator to match devargs input

The iterator will return the ethdev port ids matching a devargs string.
It is recommended to use the macro RTE_ETH_FOREACH_MATCHING_DEV()
for usage convenience.

The class string is prefixed with '+' in order to skip the validation
of the parameter keys. It is tolerated for the compatibility with
the old (current) syntax where all parameters (bus, class and driver)
are mixed in the same string without any delimiter.
Thanks to this compatibility prefix, the driver parameters will be
skipped during the ethdev parsing, and not considered invalid.

A macro is introduced in rte_common.h to workaround a const field.
This hack is needed to free const strings in the iterator.
It is preferred to keep the const for these fields, because it gives
a hint that they are not changed at each iteration.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agobus/vdev: add iteration filter on name
Thomas Monjalon [Tue, 23 Oct 2018 08:28:36 +0000 (10:28 +0200)]
bus/vdev: add iteration filter on name

A virtual device can be matched with following syntax:
bus=vdev,name=X

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agovhost: fix vector filling for packed ring
Tiwei Bie [Tue, 23 Oct 2018 06:07:49 +0000 (14:07 +0800)]
vhost: fix vector filling for packed ring

We should return the length of the buffers described by
the current descriptor chain after filling the buffer
vector. So we need to zero the *len first.

Fixes: 2f3225a7d69b ("vhost: add vector filling support for packed ring")
Cc: stable@dpdk.org
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
5 years agovhost/crypto: fix shared lib build without cryptodev
Timothy Redaelli [Tue, 16 Oct 2018 20:47:16 +0000 (22:47 +0200)]
vhost/crypto: fix shared lib build without cryptodev

Currently it's not possible to build DPDK as shared library with
cryptodev disabled since vhost is trying to link with rte_crypto,
but rte_crypto and rte_hash are only needed when you build vhost_crypto
and so only when cryptodev is enabled.

This patch fix this by linking rte_vhost with rte_crypto and rte_hash
only when cryptodev is enabled.

Fixes: b4ca81298613 ("vhost/crypto: fix build without cryptodev")
Fixes: 939066d96563 ("vhost/crypto: add public function implementation")
Cc: stable@dpdk.org
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
5 years agoapp/testpmd: add MPLSoGRE encapsulation
Ori Kam [Mon, 22 Oct 2018 17:38:11 +0000 (17:38 +0000)]
app/testpmd: add MPLSoGRE encapsulation

Example for MPLSoGRE tunnel:
ETH / IPV4 / GRE / MPLS / IP / L4..L7

In order to encapsulate such a tunnel there is a need to remove L2 of
the inner packet and encap the remaining tunnel, this is done by
applying 2 rte flow commands l2_decap followed by mplsogre_encap.
Both commands must appear in the same flow, and from the point of the
packet it both actions are applied at the same time. (There is no part
where a packet doesn't have L2 header).

Decapsulating such a tunnel works the other way, first we need to decap
the outer tunnel header and then apply the new L2.
So the commands will be mplsogre_decap / l2_encap

Due to the complex encapsulation of MPLSoGRE flow action and
based on the fact testpmd does not allocate memory, this patch adds a
new command in testpmd to initialise a global structure containing the
necessary information to make the outer layer of the packet.  This same
global structures will then be used by the flow commands in testpmd when
the action mplsogre_encap, mplsogre_decap, will be parsed, at this
point, the conversion into such action becomes trivial.

Signed-off-by: Ori Kam <orika@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoapp/testpmd: add MPLSoUDP encapsulation
Ori Kam [Mon, 22 Oct 2018 17:38:10 +0000 (17:38 +0000)]
app/testpmd: add MPLSoUDP encapsulation

MPLSoUDP is an example for L3 tunnel encapsulation.

L3 tunnel type is a tunnel that is missing the layer 2 header of the
inner packet.

Example for MPLSoUDP tunnel:
ETH / IPV4 / UDP / MPLS / IP / L4..L7

In order to encapsulate such a tunnel there is a need to remove L2 of
the inner packet and encap the remaining tunnel, this is done by
applying 2 rte flow commands l2_decap followed by mplsoudp_encap.
Both commands must appear in the same flow, and from the point of the
packet it both actions are applied at the same time. (There is no part
where a packet doesn't have L2 header).

Decapsulating such a tunnel works the other way, first we need to decap
the outer tunnel header and then apply the new L2.
So the commands will be mplsoudp_decap / l2_encap

Due to the complex encapsulation of MPLSoUDP and L2  flow actions and
based on the fact testpmd does not allocate memory, this patch adds a
new command in testpmd to initialise a global structures containing the
necessary information to make the outer layer of the packet.  This same
global structures will then be used by the flow commands in testpmd when
the action mplsoudp_encap, mplsoudp_decap, l2_encap, l2_decap, will be
parsed, at this point, the conversion into such action becomes trivial.

The l2_encap and l2_decap actions can also be used for other L3 tunnel
types.

Signed-off-by: Ori Kam <orika@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoethdev: add raw encapsulation action
Ori Kam [Mon, 22 Oct 2018 17:38:09 +0000 (17:38 +0000)]
ethdev: add raw encapsulation action

Currenlty the encap/decap actions only support encapsulation
of VXLAN and NVGRE L2 packets (L2 encapsulation is where
the inner packet has a valid Ethernet header, while L3 encapsulation
is where the inner packet doesn't have the Ethernet header).
In addtion the parameter to to the encap action is a list of rte items,
this results in 2 extra translation, between the application to the
actioni and from the action to the NIC. This results in negative impact
on the insertion performance.

Looking forward there are going to be a need to support many more tunnel
encapsulations. For example MPLSoGRE, MPLSoUDP.
Adding the new encapsulation will result in duplication of code.
For example the code for handling NVGRE and VXLAN are exactly the same,
and each new tunnel will have the same exact structure.

This patch introduce a raw encapsulation that can support L2 tunnel types
and L3 tunnel types. In addtion the new
encapsulations commands are using raw buffer inorder to save the
converstion time, both for the application and the PMD.

In order to encapsulate L3 tunnel type there is a need to use both
actions in the same rule: The decap to remove the L2 of the original
packet, and then encap command to encapsulate the packet with the
tunnel.
For decap L3 there is also a need to use both commands in the same flow
first the decap command to remove the outer tunnel header and then encap
to add the L2 header.

Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agonet/mlx5: support e-switch flow count action
Moti Haimovsky [Thu, 18 Oct 2018 18:29:23 +0000 (21:29 +0300)]
net/mlx5: support e-switch flow count action

This commit adds support for configuring flows destined to the mlx5
eswitch with 'count' action and for querying these counts at runtime.

Each flow rule configured by the mlx5 driver is implicitly assigned
with flow counters. These counters can be retrieved when querying
the flow rule via Netlink, they can be found in each flow action
section of the reply. Hence, supporting the 'count' action in the
flow configuration command is straight-forward. When transposing
the command to a tc Netlink message we just ignore it instead of
rejecting it.
In the 'flow query count' side, the command now uses tc Netlink
query command in order to retrieve the values of the flow counters.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
5 years agonet/mlx5: add flow query abstraction interface
Moti Haimovsky [Thu, 18 Oct 2018 18:29:22 +0000 (21:29 +0300)]
net/mlx5: add flow query abstraction interface

Flow engine now supports multiple driver paths with each having
its own flow query implantation routine.
This patch adds an abstraction to the flow query routine in accordance
to commit 0c76d1c9a18d ("net/mlx5: add abstraction for multiple flow
drivers") done by Yongseok Koh.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
5 years agonet/mlx5: use the new infrastructure for tc flow
Moti Haimovsky [Thu, 18 Oct 2018 18:29:21 +0000 (21:29 +0300)]
net/mlx5: use the new infrastructure for tc flow

modified TC-flow code to use the new infrastructure
introduced in "net/mlx5: refactor TC-flow infrastructure"
commit.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
5 years agonet/mlx5: refactor TC-flow infrastructure
Moti Haimovsky [Thu, 18 Oct 2018 18:29:20 +0000 (21:29 +0300)]
net/mlx5: refactor TC-flow infrastructure

This commit refactors tc_flow as a preparation to coming commits
that sends different type of messages and expect differ type of replies
while still using the same underlying routines.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
5 years agoapp/testpmd: support metadata as flow rule item
Dekel Peled [Sun, 21 Oct 2018 14:22:48 +0000 (17:22 +0300)]
app/testpmd: support metadata as flow rule item

As described in [1], this series adds option to set metadata value
as match pattern when creating a new flow rule.

This patch introduces additional options in testpmd commands:
- New item type "meta" "data"
- New per-port offload flag "match_metadata".

It also adds commands to configure the tx_metadata value to use:
- New 'config' command takes a 32 bit value and stores it per port:
port config <port_id> tx_metadata <value>
  testpmd will add to any Tx packet sent from this port the metadata
  value, and set ol_flags accordingly.
- A matching 'show' command is added to read the configured value:
port config <port_id> tx_metadata <value>

[1] "ethdev: support metadata as flow rule criteria"

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoethdev: support metadata as flow rule criteria
Dekel Peled [Sun, 21 Oct 2018 14:22:47 +0000 (17:22 +0300)]
ethdev: support metadata as flow rule criteria

As described in [1], a new rte_flow item is added to support metadata
to use as flow rule match pattern.
The metadata is an opaque item, fully controlled by the application.

The use of metadata is relevant for egress rules only.
It can be set in the flow rule using the RTE_FLOW_ITEM_META.

An additional member 'tx_metadata' is added in union with existing member
'hash' of struct 'rte_mbuf', located to avoid conflicts with existing
fields. This additional member is used to carry the metadata item.

Application should set the packet metadata in the mbuf dedicated field,
and set the PKT_TX_METADATA flag in the mbuf->ol_flags.
The NIC will use the packet metadata as match criteria for relevant
flow rules.

This patch introduces metadata item type for rte_flow RTE_FLOW_ITEM_META,
along with corresponding struct rte_flow_item_meta and ol_flag
PKT_TX_METADATA.

[1] "[RFC,v2] ethdev: support metadata as flow rule criteria"

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: complete closing of port
Thomas Monjalon [Fri, 19 Oct 2018 02:07:57 +0000 (04:07 +0200)]
ethdev: complete closing of port

After closing a port, it cannot be restarted.
So there is no reason to not free all associated resources.

The last step was done with rte_eth_dev_detach() which is deprecated.
Instead of blindly removing the associated rte_device, the driver should
check if no more port (ethdev, cryptodev, etc) is open for the device.

The last ethdev freeing which were done by rte_eth_dev_detach(),
are now done at the end of rte_eth_dev_close() if the driver supports
the flag RTE_ETH_DEV_CLOSE_REMOVE.
There will be a transition period for PMDs to enable this new flag
and migrate to the new behaviour.
When enabling RTE_ETH_DEV_CLOSE_REMOVE, the PMD must free all its
private resources for the port, in its dev_close function.
It is advised to call the dev_close function in the remove function
in order to support removing a device without closing its ports.

Some drivers does not allocate MAC addresses dynamically or separately.
In those cases, the pointer is set to NULL, in order to avoid wrongly
freeing them in rte_eth_dev_release_port().

A closed port will have the state RTE_ETH_DEV_UNUSED which is
considered as invalid by rte_eth_dev_is_valid_port().
So validity is not checked anymore for closed ports in testpmd.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: remove release function for secondary process
Thomas Monjalon [Fri, 19 Oct 2018 02:07:56 +0000 (04:07 +0200)]
ethdev: remove release function for secondary process

After previous changes, the function rte_eth_dev_release_port()
can be used for primary or secondary process as well.
The only difference with rte_eth_dev_release_port_secondary()
is the shared lock used in rte_eth_dev_release_port().

The function rte_eth_dev_release_port_secondary() was recently
added in 18.11 cycle.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: free all common data when releasing port
Thomas Monjalon [Fri, 19 Oct 2018 02:07:55 +0000 (04:07 +0200)]
ethdev: free all common data when releasing port

This is a clean-up of common ethdev data freeing.
All data freeing are moved to rte_eth_dev_release_port()
and done only in case of primary process.

It is probably fixing some memory leaks for PMDs which were
not freeing all data.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: fix doxygen comments of shared data fields
Thomas Monjalon [Fri, 19 Oct 2018 02:07:54 +0000 (04:07 +0200)]
ethdev: fix doxygen comments of shared data fields

Some doxygen comments were wrongly associated to the next field
because of syntax /** instead of /**<

Some other cleanups (like alignment) are done.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoapp/testpmd: allow detaching a port not closed
Thomas Monjalon [Fri, 19 Oct 2018 02:07:53 +0000 (04:07 +0200)]
app/testpmd: allow detaching a port not closed

The testpmd application aim is for testing;
so order of operations should not be enforced.

There was a test to forbid detaching before closing a port.
However, it may interesting to test what happens in such case.
It is possible for a PMD to automatically close the port when detaching.

in order to avoid a crash, it is checked that the port must be stopped
before detaching (as for closing).

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agoapp/testpmd: update port list for multiple removals
Wisam Jaddo [Fri, 19 Oct 2018 02:07:52 +0000 (04:07 +0200)]
app/testpmd: update port list for multiple removals

When detaching a port, the full rte_device is removed.
If the rte_device was hosting several ports,
the testpmd list of ports must be updated for multiple removals.

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agodoc: update release notes for enic
Hyong Youb Kim [Sat, 20 Oct 2018 08:32:49 +0000 (01:32 -0700)]
doc: update release notes for enic

Fixes: 8a6ff33d6d36 ("net/enic: add AVX2 based vectorized Rx handler")
Fixes: 86df6c4e2fce ("net/enic: support flow counter action")
Fixes: 70401fd7784d ("net/enic: add VLAN and csum offloads to simple Tx handler")
Fixes: c0aae00d7da0 ("net/enic: enable IOVA mode")

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
5 years agonet/enic: add missing Tx offload flags
Hyong Youb Kim [Sat, 20 Oct 2018 08:32:48 +0000 (01:32 -0700)]
net/enic: add missing Tx offload flags

The following commit has added a number of existing offload flags such
as PKT_TX_IPV4 and PKT_TX_IPV6 to PKT_TX_OFFLOAD_MASK defined in
rte_mbuf.h. That change breaks the enic driver's Tx prepare handler.

commit ef28cfa73822 ("mbuf: fix Tx offload mask")

The enic driver keeps the supported offload flags in a local variable
(tx_offload_mask), which is strictly a subset of
PKT_TX_OFFLOAD_MASK. This variable is then used to compute the
unsupported flags (tx_offload_notsup_mask), and the Tx prepare handler
(tx_pkt_prepare) uses it to reject packets with unsupported offload
flags.

As is, tx_offload_notsup_mask ends up containing flags like
PKT_TX_IPV4 that are actually supported by the driver, which then
breaks any application that uses checksum offloads and calls the Tx
prepare handler. So add the flags to tx_offload_mask that the driver
supports but were missing in PKT_TX_OFFLOAD_MASK.

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
5 years agonet/enic: fix supported packet types
Hyong Youb Kim [Sat, 20 Oct 2018 08:32:47 +0000 (01:32 -0700)]
net/enic: fix supported packet types

The handler for dev_supported_ptypes_get currently returns null when
the vectorized Rx handler is used. It is also missing tunnel packet
types. Add the missing packet types to the supported list, and return
the right list for the vectorized Rx handler.

Fixes: 8a6ff33d6d36 ("net/enic: add AVX2 based vectorized Rx handler")
Fixes: 93fb21fdbe23 ("net/enic: enable overlay offload for VXLAN and GENEVE")
Cc: stable@dpdk.org
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
5 years agoexamples/vdpa: fix spelling in error message
Stephen Hemminger [Thu, 18 Oct 2018 22:34:30 +0000 (15:34 -0700)]
examples/vdpa: fix spelling in error message

Fixes: edbed86d1cc3 ("examples/vdpa: introduce a new sample for vDPA")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agodoc: fix spelling in PMD guides
Stephen Hemminger [Thu, 18 Oct 2018 22:32:55 +0000 (15:32 -0700)]
doc: fix spelling in PMD guides

Trivial pelling errors found by codespell.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
5 years agonet/i40e: keep promiscuous on if allmulticast is enabled
Huaibin Wang [Fri, 19 Oct 2018 09:45:21 +0000 (11:45 +0200)]
net/i40e: keep promiscuous on if allmulticast is enabled

Promisc should not be disabled if the all multicast mode is enabled.
Patch keeps the promiscuous on if all multicast mode is on, this
behavior is also consistent with the implementation done on ixgbe
pmd.

Cc: stable@dpdk.org
Signed-off-by: Huaibin Wang <huaibin.wang@6wind.com>
Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agodoc: update i40e guide for PPPoE package release
Beilei Xing [Tue, 16 Oct 2018 06:45:42 +0000 (14:45 +0800)]
doc: update i40e guide for PPPoE package release

Add link of PPPoE package release.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
5 years agoapp/testpmd: reserve NUMA node per port and per ring
Phil Yang [Thu, 18 Oct 2018 10:39:25 +0000 (18:39 +0800)]
app/testpmd: reserve NUMA node per port and per ring

If user explicitly requested memory to be allocated from a socket via
`port-numa-config` and `ring-numa-config`, and if that socket is
valid, add that socket into socket_ids[] so that mempool allocated for
that socket.

Fixes: dbfb8ec7094c ("app/testpmd: optimize mbuf pool allocation")
Cc: stable@dpdk.org
Suggested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/tap: access primary process queues from secondary
Raslan Darawsheh [Thu, 18 Oct 2018 10:17:29 +0000 (13:17 +0300)]
net/tap: access primary process queues from secondary

In the case the device is created by the primary process,
the secondary must request some file descriptors to attach the queues.
The file descriptors are shared via IPC Unix socket.

Thanks to the IPC synchronization, the secondary process
is now able to do Rx/Tx on a TAP created by the primary process.

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/tap: move fds of queues to be in process private
Raslan Darawsheh [Thu, 18 Oct 2018 10:17:28 +0000 (13:17 +0300)]
net/tap: move fds of queues to be in process private

fd's cannot be shared between processes, and each process need to have
it's own fd's pointer.

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/tap: add queue and port ids in queue structures
Raslan Darawsheh [Thu, 18 Oct 2018 10:17:27 +0000 (13:17 +0300)]
net/tap: add queue and port ids in queue structures

Port and queue ids are added to easily map the file
descriptors stored in each process private.

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agokni: fix build on Linux < 3.14
Thomas Monjalon [Fri, 26 Oct 2018 21:23:36 +0000 (23:23 +0200)]
kni: fix build on Linux < 3.14

The atomic functions smp_load_acquire() and smp_store_release()
were introduced in Linux 3.14. Older kernels miss the functions:

kni_fifo.h:19:2: error:
implicit declaration of function ‘smp_load_acquire’
kni_fifo.h:30:2: error:
implicit declaration of function ‘smp_store_release’

The fallback is to drop the atomic barrier, as it was before
the commit below.

Fixes: 711859cd0d07 ("kni: fix kernel FIFO synchronization")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
5 years agoexamples/l3fwd-power: fix build with icc
Thomas Monjalon [Fri, 26 Oct 2018 21:45:49 +0000 (23:45 +0200)]
examples/l3fwd-power: fix build with icc

main.c(376): error #592: variable "lcore_id" is used before its value is set
        RTE_SET_USED(lcore_id);
        ^

The variables were voided with RTE_SET_USED without an obvious reason.
Removing these voidings should avoid the icc error.

Fixes: a137d012 ("examples/l3fwd-power: support traffic pattern aware control")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agomalloc: fix external heap allocation in no-huge mode
Anatoly Burakov [Thu, 25 Oct 2018 11:06:34 +0000 (12:06 +0100)]
malloc: fix external heap allocation in no-huge mode

When no-huge mode is enabled, we always overwrite the socket ID to be
SOCKET_ID_ANY in rte_malloc, because there is no NUMA awareness in no-huge
mode. However, with external memory support, a socket ID may have other
meaning, and we cannot overwrite the socket ID in those cases.

Fixes: 65ff37b105f7 ("malloc: add function to check if socket is external")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
5 years agotest/hash: add r/w concurrency to autotest
Yipeng Wang [Fri, 26 Oct 2018 09:53:46 +0000 (02:53 -0700)]
test/hash: add r/w concurrency to autotest

Add read-write concurrency test to meson and autotest
file.

Fixes: 0eb3726ebcf1 ("test/hash: add test for read/write concurrency")
Cc: stable@dpdk.org
Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
5 years agotest/hash: remove hash scaling unit test
Yipeng Wang [Fri, 26 Oct 2018 09:53:45 +0000 (02:53 -0700)]
test/hash: remove hash scaling unit test

The hash scaling unit test is not really needed
any more since the multi-writer is supported now
inside the library and it is tested by multi-writer
unit test.

Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
5 years agotest/hash: add extendable table to r/w test
Yipeng Wang [Fri, 26 Oct 2018 09:53:44 +0000 (02:53 -0700)]
test/hash: add extendable table to r/w test

This commit improves the readwrite test to consider
extendable table feature.

Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
5 years agotest/hash: test more corner cases
Yipeng Wang [Fri, 26 Oct 2018 09:53:43 +0000 (02:53 -0700)]
test/hash: test more corner cases

This commit improves the readwrite unit test to cover
more corner cases and reduces the testing time by
reducing the total key count.

Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
5 years agotest/hash: use jhash for multi-writer
Yipeng Wang [Fri, 26 Oct 2018 09:53:42 +0000 (02:53 -0700)]
test/hash: use jhash for multi-writer

With sequential key, the test will cover more corner
cases with jhash instead of crc hash, since jhash
generates more random hash pattern on sequential key.
It is useful for functional verification.

Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
5 years agohash: remove unnecessary pause
Yipeng Wang [Fri, 26 Oct 2018 09:53:41 +0000 (02:53 -0700)]
hash: remove unnecessary pause

There is a rte_pause in hash table reset function.
Since the loop is not a polling loop on shared
data structure, the rte_pause is not needed.

Fixes: b26473ff8f4a ("hash: add reset function")
Cc: stable@dpdk.org
Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
5 years agotest/kni: check module dependency
Naga Suresh Somarowthu [Fri, 14 Sep 2018 13:57:02 +0000 (14:57 +0100)]
test/kni: check module dependency

Check the prerequisites to run the test
1.checked whether the rte_kni module is loaded, if not fail testcase
2.checked whether the rte_kni module is loaded with loop back mode,
  if not skip packet forwarding testcase and log
3.Disabled the test in freebsd as test is not supported

Fixes: 5233e5924a ("app/test: update kni")
Cc: stable@dpdk.org
Signed-off-by: Naga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoexamples/kni: improve zeroing statistics
Dan Gora [Wed, 24 Oct 2018 22:26:31 +0000 (19:26 -0300)]
examples/kni: improve zeroing statistics

The worker threads incrementing the rx/tx_packets race with the signal
handler from the main thread zeroing the entire statistics structure.
This can cause the statistics to fail to be zeroed, even when there
is no traffic on those interfaces.

Improve zeroing the statistics by only incrementing rx/tx_packets
in worker threads by a non-zero amount.  This limits the race to the
periods in which traffic is actually being received or transmitted.

Signed-off-by: Dan Gora <dg@adax.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoexamples/kni: add logs to show and clear stats
Dan Gora [Wed, 24 Oct 2018 22:26:30 +0000 (19:26 -0300)]
examples/kni: add logs to show and clear stats

Add logging messages showing the commands necessary for the user to
have the application display and zero the statistics.

Signed-off-by: Dan Gora <dg@adax.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoexamples/kni: monitor and update link state continually
Dan Gora [Wed, 24 Oct 2018 22:26:29 +0000 (19:26 -0300)]
examples/kni: monitor and update link state continually

Update KNI example to add the command line flag '-m' to enable
a function to continuously monitor the Ethernet link status of
the physical link and update the link status of the corresponding
interfaces with rte_kni_update_link().

Signed-off-by: Dan Gora <dg@adax.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agokni: set default carrier state of interface
Dan Gora [Wed, 24 Oct 2018 22:26:28 +0000 (19:26 -0300)]
kni: set default carrier state of interface

Add module parameter 'carrier='on|off' to set the default carrier state
for linux network interfaces created by the KNI module.  The default
carrier state is 'off'.

For KNI interfaces which need to reflect the carrier state of
a physical Ethernet port controlled by the DPDK application, the
default carrier state should be left set to 'off'.  The application
can set the carrier state of the KNI interface to reflect the state
of the physical Ethernet port using rte_kni_update_link().

For KNI interfaces which are purely virtual, the default carrier
state can be set to 'on'.  This enables the KNI interface to be
used without having to explicity set the carrier state to 'on'
using rte_kni_update_link().

Signed-off-by: Dan Gora <dg@adax.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agokni: add function to set link state on kernel interface
Dan Gora [Wed, 24 Oct 2018 22:26:27 +0000 (19:26 -0300)]
kni: add function to set link state on kernel interface

Add a new API function to KNI, rte_kni_update_link() to allow DPDK
applications to update the link status for KNI network interfaces in
the linux kernel.

Signed-off-by: Dan Gora <dg@adax.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agokni: introduce C11 atomic into FIFO synchronization
Phil Yang [Mon, 8 Oct 2018 09:11:46 +0000 (17:11 +0800)]
kni: introduce C11 atomic into FIFO synchronization

Syncing the values by adding c11 atomic memory barriers to make sure
the values being synced before updating fifo_write and fifo_read.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agokni: fix kernel FIFO synchronization
Phil Yang [Mon, 8 Oct 2018 09:11:45 +0000 (17:11 +0800)]
kni: fix kernel FIFO synchronization

Adding memory barrier to make sure the values being synced
before updating fifo_write in kni_fifo_put and fifo_read in
kni_fifo_get.

Fixes: 3fc5ca2f6352 ("kni: initial import")
Cc: stable@dpdk.org
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agokni: fix FIFO synchronization
Phil Yang [Mon, 8 Oct 2018 09:11:44 +0000 (17:11 +0800)]
kni: fix FIFO synchronization

With existing code in kni_fifo_put, rx_q values are not being updated
before updating fifo_write. While reading rx_q in kni_net_rx_normal,
This is causing the sync issue on other core. The same situation happens
in kni_fifo_get as well.

So syncing the values by adding memory barriers to make sure the values
being synced before updating fifo_write and fifo_read.

Fixes: 3fc5ca2f6352 ("kni: initial import")
Cc: stable@dpdk.org
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoconfig: rename option for C11 memory model
Phil Yang [Mon, 8 Oct 2018 09:11:43 +0000 (17:11 +0800)]
config: rename option for C11 memory model

Keep only single config option RTE_USE_C11_MEM_MODEL for C11 memory
model, so all modules can leverage C11 atomic extension by enable this
option.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
5 years agokni: support meson build
Luca Boccassi [Fri, 12 Oct 2018 17:05:17 +0000 (18:05 +0100)]
kni: support meson build

A Kbuild is also included to allow users to use DKMS natively without
additional code.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
5 years agokni: fix build on Linux 4.19
Ferruh Yigit [Wed, 24 Oct 2018 11:10:10 +0000 (12:10 +0100)]
kni: fix build on Linux 4.19

The build error observed with Linux kernel 4.19 when KNI ethtool
support enabled (CONFIG_RTE_KNI_KMOD_ETHTOOL=y)

.../build/build/kernel/linux/kni/kni_ethtool.c:193:3:
   error: ‘struct ethtool_ops’ has no member named ‘get_settings’;
  .get_settings  = kni_get_settings,
   ^~~~~~~~~~~~

.../build/build/kernel/linux/kni/kni_ethtool.c:194:3:
   error: ‘struct ethtool_ops’ has no member named ‘set_settings’;
  .set_settings  = kni_set_settings,
   ^~~~~~~~~~~~

With kernel 4.19 ethtool_ops `get_settings` & `set_settings` are
replaced with `get_link_ksettings` & `set_link_ksettings`
Commit 9b3004953503 ("ethtool: drop get_settings and set_settings callbacks")

This fix practically removes `get_settings` & `set_settings` support
for the kernel versions that have the new ethtool_ops without
implementing the new ones.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agodoc: add crypto port and action for pipeline in release notes
Fan Zhang [Fri, 12 Oct 2018 08:38:04 +0000 (09:38 +0100)]
doc: add crypto port and action for pipeline in release notes

This patch updates the release notes for added feature of crypto
port and symmetric crypto action.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
5 years agopower: fix traffic aware build
David Hunt [Fri, 26 Oct 2018 12:38:24 +0000 (13:38 +0100)]
power: fix traffic aware build

1. %ld to PRId64 for 32-bit builds
2. Fix dependency on librte_timer

Fixes: 450f0791312c ("power: add traffic pattern aware power control")

Signed-off-by: David Hunt <david.hunt@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoeal/ppc: support pause API
Jerin Jacob [Sun, 7 Oct 2018 06:18:57 +0000 (11:48 +0530)]
eal/ppc: support pause API

Add support for rte_pause() implementation for ppc64.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
5 years agouse registered name for OCTEON TX references
Anoob Joseph [Wed, 10 Oct 2018 02:50:56 +0000 (08:20 +0530)]
use registered name for OCTEON TX references

'OCTEON TX' is the registered name. All other usages need to be fixed.

Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
5 years agodoc: remove unused release notes file
John McNamara [Tue, 25 Sep 2018 15:25:12 +0000 (16:25 +0100)]
doc: remove unused release notes file

Remove unused file from the release notes docs. This file was
used to display a hierarchy in older releases, circa 2015, but
doesn't seem useful in the current structure.

Signed-off-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
5 years agonet/softnic: add crypto commands
Fan Zhang [Wed, 24 Oct 2018 12:49:04 +0000 (13:49 +0100)]
net/softnic: add crypto commands

This patch updates the CLI parsing of softnic with extra symmetric
cryptodev, port, session, and action support.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
5 years agonet/softnic: add symmetric crypto action
Fan Zhang [Wed, 24 Oct 2018 12:49:03 +0000 (13:49 +0100)]
net/softnic: add symmetric crypto action

This patch adds symmetric crypto action support to softnic.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
5 years agonet/softnic: configure crypto port
Fan Zhang [Wed, 24 Oct 2018 12:49:02 +0000 (13:49 +0100)]
net/softnic: configure crypto port

This patch enables the crypt port configuration in softnic.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
5 years agonet/softnic: add cryptodev
Fan Zhang [Wed, 24 Oct 2018 12:49:01 +0000 (13:49 +0100)]
net/softnic: add cryptodev

This patch adds cryptodev abstraction to softnic. The DPDK
Cryptodevs are abstracted as crypto ports in the softnic.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>