dpdk.git
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 years agodoc: update softnic guide for flow and QoS support
Reshma Pattan [Thu, 18 Oct 2018 14:54:13 +0000 (15:54 +0100)]
doc: update softnic guide for flow and QoS support

Update document with flow and qos api support in softnic PMD.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agotest/hash: add lock-free r/w concurrency
Dharmik Thakkar [Fri, 26 Oct 2018 05:37:33 +0000 (00:37 -0500)]
test/hash: add lock-free r/w concurrency

Unit tests to check for hash lookup and bulk-lookup perf
with lock-free enabled and with lock-free disabled.
Unit tests performed with readers running in parallel with writers.

Tests include:

- hash lookup on existing keys with:
  - hash add causing NO key-shifts of existing keys in the table

- hash lookup on existing keys likely to be on shift-path with:
  - hash add causing key-shifts of existing keys in the table

- hash lookup on existing keys NOT likely to be on shift-path with:
  - hash add causing key-shifts of existing keys in the table

- hash lookup on non-existing keys with:
  - hash add causing NO key-shifts of existing keys in the table
  - hash add causing key-shifts of existing keys in the table

- hash lookup on keys likely to be on shift-path with:
  - multiple writers causing key-shifts of existing keys in the table

Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agohash: add lock-free r/w concurrency
Honnappa Nagarahalli [Fri, 26 Oct 2018 05:37:32 +0000 (00:37 -0500)]
hash: add lock-free r/w concurrency

Add lock-free read-write concurrency. This is achieved by the
following changes.

1) Add memory ordering to avoid race conditions. The only race
condition that can occur is -  using the key store element
before the key write is completed. Hence, while inserting the element
the release memory order is used. Any other race condition is caught
by the key comparison. Memory orderings are added only where needed.
For ex: reads in the writer's context do not need memory ordering
as there is a single writer.

key_idx in the bucket entry and pdata in the key store element are
used for synchronisation. key_idx is used to release an inserted
entry in the bucket to the reader. Use of pdata for synchronisation
is required due to updation of an existing entry where-in only
the pdata is updated without updating key_idx.

2) Reader-writer concurrency issue, caused by moving the keys
to their alternative locations during key insert, is solved
by introducing a global counter(tbl_chng_cnt) indicating a
change in table.

3) Add the flag to enable reader-writer concurrency during
run time.

Signed-off-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: Steve Capper <steve.capper@arm.com>
Reviewed-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agohash: fix key store element alignment
Honnappa Nagarahalli [Fri, 26 Oct 2018 05:37:31 +0000 (00:37 -0500)]
hash: fix key store element alignment

Fix the key store array element alignment such that every array
element is aligned on KEY_ALIGNMENT boundary. This is required to
make 'pdata' in 'struct rte_hash_key' align on its natural boundary
for atomic load/store.

Fixes: 473d1bebce43 ("hash: allow to store data in hash table")
Cc: stable@dpdk.org
Signed-off-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: Steve Capper <steve.capper@arm.com>
Reviewed-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agohash: support no free on delete
Honnappa Nagarahalli [Fri, 26 Oct 2018 05:37:30 +0000 (00:37 -0500)]
hash: support no free on delete

rte_hash_lookup_xxx APIs return the index of slot in
the key store. Application(reader) can use that index to reference
other data structures in its scope. Because of this, the
index should not be freed till the application completes
using the index.
RTE_HASH_EXTRA_FLAGS_NO_FREE_ON_DEL is introduced to support this.
When this flag is enabled rte_hash_del_xxx APIs do not free the
key-store index/internal memory associated with the deleted
entry. The new API rte_hash_free_key_with_position should be called
to free the key-store index/internal memory after calling
rte_hash_del_xxx APIs.

Suggested-by: Yipeng Wang <yipeng1.wang@intel.com>
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agohash: separate multi-writer from r/w concurrency
Honnappa Nagarahalli [Fri, 26 Oct 2018 05:37:29 +0000 (00:37 -0500)]
hash: separate multi-writer from r/w concurrency

RW concurrency is required with single writer and multiple reader
usecase as well. Hence, multi-writer should not be enabled by default when
RW concurrency is enabled.

Fixes: f2e3001b53ec ("hash: support read/write concurrency")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agoexamples/power: support meson/ninja build
David Hunt [Wed, 17 Oct 2018 13:05:33 +0000 (14:05 +0100)]
examples/power: support meson/ninja build

Add meson.build in vm_power_manager and the guest_cli subdirectory.
Building can be achieved by going to the build directory, and using

meson configure -Dexamples=vm_power_manager,vm_power_manager/guest_cli

Then, when ninja is invoked, it will build dpdk-vm_power_manger and
dpdk-guest_cli

Work still needs to be done on the meson build system to handles the case
where the target list of example apps is defined as 'all'. That will come
in a future patch.

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agoexamples/power: clean up verbose messages
David Hunt [Wed, 17 Oct 2018 13:05:32 +0000 (14:05 +0100)]
examples/power: clean up verbose messages

Some messages appearing several times a second, removing as they are
unnecessary. Other less severe messages change from INFO to DEBUG

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoexamples/power: add JSON string handling
David Hunt [Wed, 17 Oct 2018 13:05:31 +0000 (14:05 +0100)]
examples/power: add JSON string handling

Add JSON string handling to vm_power_manager for JSON strings received
through the fifo. The format of the JSON strings are detailed in the
next patch, the vm_power_manager user guide documentation updates.

This patch introduces a new dependency on Jansson, a C library for
encoding, decoding and manipulating JSON data. To compile the sample app
you now need to have installed libjansson4 and libjansson-dev (these may
be named slightly differently depending on your Operating System)

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoexamples/power: increase allowed number of clients
David Hunt [Wed, 17 Oct 2018 13:05:30 +0000 (14:05 +0100)]
examples/power: increase allowed number of clients

Now that we're handling host policies, containers and virtual machines,
we'll rename MAX_VMS to MAX_CLIENTS, and increase from 4 to 64

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoexamples/power: add host channel to power manager
David Hunt [Wed, 17 Oct 2018 13:05:29 +0000 (14:05 +0100)]
examples/power: add host channel to power manager

This patch adds a fifo channel to the vm_power_manager app through which
we can send commands and polices. Intended for sending JSON strings.
The fifo is at /tmp/powermonitor/fifo

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoexamples/power: set core type in guest app
David Hunt [Wed, 17 Oct 2018 13:05:28 +0000 (14:05 +0100)]
examples/power: set core type in guest app

The changes here are minimal, as the guest app functionality is not
changing at all, but there is a new element in the channel_packet
struct that needs to have a default set (channel_packet->core_type).

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agolib/power: add changes for host commands/policies
David Hunt [Wed, 17 Oct 2018 13:05:27 +0000 (14:05 +0100)]
lib/power: add changes for host commands/policies

This patch does a couple of things:
  * Adds a new message type for removing policies (PKT_POLICY_REMOVE)
    Used when we want to remove a previously created policy.
  * Adds a core_type bool to the channel packet struct to specify whether
    the type of core we want to control is virtual or physical.

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoexamples/power: allow number of VMs to be zero
David Hunt [Wed, 17 Oct 2018 13:05:26 +0000 (14:05 +0100)]
examples/power: allow number of VMs to be zero

Previously the vm_power_manager app required to have some vms defined, so
the call to get_all_vm() always set the noVms variable. Now we're accepting
policies from the host OS (without any VMs defined), so it is now valid to
have zero VMs. This patch initialises the relevant variables to zero just
in case the call to get_all_vms() does not find any, so could return with
the variables uninitialised.

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoexamples/power: add checks around hypervisor
David Hunt [Wed, 17 Oct 2018 13:05:25 +0000 (14:05 +0100)]
examples/power: add checks around hypervisor

Allow vm_power_manager to run without requiring qemu to be present
on the machine. This will be required for instances where the JSON
interface is used for commands and polices, without any VMs present.
A use case for this is a container enviromnent.

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoexamples/l3fwd-power: support traffic pattern aware control
Liang Ma [Fri, 19 Oct 2018 11:07:19 +0000 (12:07 +0100)]
examples/l3fwd-power: support traffic pattern aware control

Add the support for new traffic pattern aware power control
power management API.

Example:
./l3fwd-power -l xxx   -n 4   -w 0000:xx:00.0 -w 0000:xx:00.1 -- -p 0x3
-P --config="(0,0,xx),(1,0,xx)" --empty-poll="0,0,0" -l 14 -m 9 -h 1

Please Reference l3fwd-power document for full parameter usage

The option "l", "m", "h" are used to set the power index for
LOW, MED, HIGH power state. Only is useful after enable empty-poll

--empty-poll="training_flag, med_threshold, high_threshold"

The option training_flag is used to enable/disable training mode.

The option med_threshold is used to indicate the empty poll threshold
of modest state which is customized by user.

The option high_threshold is used to indicate the empty poll threshold
of busy state which is customized by user.

Above three option default value is all 0.

Once enable empty-poll. System will apply the default parameter if no
other command line options are provided.

If training mode is enabled, the user should ensure that no traffic
is allowed to pass through the system. When training phase complete,
the application transfer to normal operation

System will start running with the modest power mode.
If the traffic goes above 70%, then system will move to High power state.
If the traffic drops below 30%, the system will fallback to the modest
power state.

Example code use master thread to monitoring worker thread busyness.
The default timer resolution is 10ms.

Signed-off-by: Liang Ma <liang.j.ma@intel.com>
Reviewed-by: Lei Yao <lei.a.yao@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
6 years agopower: add traffic pattern aware power control
Liang Ma [Fri, 19 Oct 2018 11:07:18 +0000 (12:07 +0100)]
power: add traffic pattern aware power control

1. Abstract

For packet processing workloads such as DPDK polling is continuous.
This means CPU cores always show 100% busy independent of how much work
those cores are doing. It is critical to accurately determine how busy
a core is hugely important for the following reasons:

   * No indication of overload conditions.

   * User does not know how much real load is on a system, resulting
     in wasted energy as no power management is utilized.

Compared to the original l3fwd-power design, instead of going to sleep
after detecting an empty poll, the new mechanism just lowers the core
frequency. As a result, the application does not stop polling the device,
which leads to improved handling of bursts of traffic.

When the system become busy, the empty poll mechanism can also increase the
core frequency (including turbo) to do best effort for intensive traffic.
This gives us more flexible and balanced traffic awareness over the
standard l3fwd-power application.

2. Proposed solution

The proposed solution focuses on how many times empty polls are executed.
The less the number of empty polls, means current core is busy with
processing workload, therefore, the higher frequency is needed. The high
empty poll number indicates the current core not doing any real work
therefore, we can lower the frequency to safe power.

In the current implementation, each core has 1 empty-poll counter which
assume 1 core is dedicated to 1 queue. This will need to be expanded in the
future to support multiple queues per core.

2.1 Power state definition:

LOW:  Not currently used, reserved for future use.

MED:  the frequency is used to process modest traffic workload.

HIGH: the frequency is used to process busy traffic workload.

2.2 There are two phases to establish the power management system:

a.Initialization/Training phase. The training phase is necessary
  in order to figure out the system polling baseline numbers from
  idle to busy. The highest poll count will be during idle, where
  all polls are empty. These poll counts will be different between
  systems due to the many possible processor micro-arch, cache
  and device configurations, hence the training phase.
  In the training phase, traffic is blocked so the training
  algorithm can average the empty-poll numbers for the LOW, MED and
  HIGH  power states in order to create a baseline.
  The core's counter are collected every 10ms, and the Training
  phase will take 2 seconds.
  Training is disabled as default configuration. The default
  parameter is applied. Sample App still can trigger training
  if that's needed. Once the training phase has been executed once on
  a system, the application can then be started with the relevant
  thresholds provided on the command line, allowing the application
  to start passing start traffic immediately

b.Normal phase. Traffic starts immediately based on the default
  thresholds, or based on the user supplied thresholds via the
  command line parameters. The run-time poll counts are compared with
  the baseline and the decision will be taken to move to MED power
  state or HIGH power state. The counters are calculated every 10ms.

3. Proposed  API

1.  rte_power_empty_poll_stat_init(struct ep_params **eptr,
uint8_t *freq_tlb, struct ep_policy *policy);
which is used to initialize the power management system.
 
2.  rte_power_empty_poll_stat_free(void);
which is used to free the resource hold by power management system.
 
3.  rte_power_empty_poll_stat_update(unsigned int lcore_id);
which is used to update specific core empty poll counter, not thread safe
 
4.  rte_power_poll_stat_update(unsigned int lcore_id, uint8_t nb_pkt);
which is used to update specific core valid poll counter, not thread safe
 
5.  rte_power_empty_poll_stat_fetch(unsigned int lcore_id);
which is used to get specific core empty poll counter.
 
6.  rte_power_poll_stat_fetch(unsigned int lcore_id);
which is used to get specific core valid poll counter.

7.  rte_empty_poll_detection(struct rte_timer *tim, void *arg);
which is used to detect empty poll state changes then take action.

Signed-off-by: Liang Ma <liang.j.ma@intel.com>
Reviewed-by: Lei Yao <lei.a.yao@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
6 years agohash: use partial-key hashing
Yipeng Wang [Mon, 22 Oct 2018 18:39:48 +0000 (11:39 -0700)]
hash: use partial-key hashing

This commit changes the hashing mechanism to "partial-key
hashing" to calculate bucket index and signature of key.

This is  proposed in Bin Fan, et al's paper
"MemC3: Compact and Concurrent MemCache with Dumber Caching
and Smarter Hashing". Basically the idea is to use "xor" to
derive alternative bucket from current bucket index and
signature.

With "partial-key hashing", it reduces the bucket memory
requirement from two cache lines to one cache line, which
improves the memory efficiency and thus the lookup speed.

Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agotest/hash: add extendable bucket
Yipeng Wang [Mon, 22 Oct 2018 18:39:47 +0000 (11:39 -0700)]
test/hash: add extendable bucket

This commit changes the current rte_hash unit test to
test the extendable table feature and performance.

Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agohash: add extendable bucket feature
Yipeng Wang [Mon, 22 Oct 2018 18:39:46 +0000 (11:39 -0700)]
hash: add extendable bucket feature

In use cases that hash table capacity needs to be guaranteed,
the extendable bucket feature can be used to contain extra
keys in linked lists when conflict happens. This is similar
concept to the extendable bucket hash table in packet
framework.

This commit adds the extendable bucket feature. User can turn
it on or off through the extra flag field during table
creation time.

Extendable bucket table composes of buckets that can be
linked list to current main table. When extendable bucket
is enabled, the hash table load can always achieve 100%.
In other words, the table can always accommodate the same
number of keys as the specified table size. This provides
100% table capacity guarantee.

Although keys ending up in the ext buckets may have longer
look up time, they should be rare due to the cuckoo
algorithm.

Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agohash: fix race condition in iterate
Yipeng Wang [Mon, 22 Oct 2018 18:39:45 +0000 (11:39 -0700)]
hash: fix race condition in iterate

In rte_hash_iterate, the reader lock did not protect the
while loop which checks empty entry. This created a race
condition that the entry may become empty when enters
the lock, then a wrong key data value would be read out.

This commit reads out the position in the while condition,
which makes sure that the position will not be changed
to empty before entering the lock.

Fixes: f2e3001b53ec ("hash: support read/write concurrency")
Cc: stable@dpdk.org
Reported-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agohash: remove unused constant
Yipeng Wang [Fri, 28 Sep 2018 14:11:09 +0000 (07:11 -0700)]
hash: remove unused constant

Since the depth-first search of cuckoo path is removed, we do not
need the macro anymore which specifies the depth of the cuckoo
search.

Fixes: f2e3001b53ec ("hash: support read/write concurrency")
Cc: stable@dpdk.org
Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agotest/hash: add missing file in meson build
Yipeng Wang [Fri, 28 Sep 2018 14:11:08 +0000 (07:11 -0700)]
test/hash: add missing file in meson build

The test_hash_readwrite.c was not in the meson.build file. This
commit adds the missing test into the file.

Fixes: 0eb3726ebcf1 ("test/hash: add test for read/write concurrency")
Cc: stable@dpdk.org
Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agotest/hash: fix r/w test with non-consecutive cores
Yipeng Wang [Fri, 28 Sep 2018 14:11:07 +0000 (07:11 -0700)]
test/hash: fix r/w test with non-consecutive cores

the multi-reader and multi-writer rte_hash unit test does not
work correctly with non-consecutive core ids. This commit
fixes the issue.

Fixes: 0eb3726ebcf1 ("test/hash: add test for read/write concurrency")
Cc: stable@dpdk.org
Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agotest/hash: improve accuracy of perf test output
Yipeng Wang [Fri, 28 Sep 2018 14:11:06 +0000 (07:11 -0700)]
test/hash: improve accuracy of perf test output

Edit the printf information when error happens to be more
accurate and informative.

Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agotest/hash: fix bucket size in perf test
Yipeng Wang [Fri, 28 Sep 2018 14:11:05 +0000 (07:11 -0700)]
test/hash: fix bucket size in perf test

The bucket size was changed from 4 to 8 but the corresponding
perf test was not changed accordingly.

In the test, the bucket size and number of buckets are used
to map to the underneath rte_hash structure. They are used
to test performance of two conditions: keys in primary
buckets only and keys in both primary and secondary buckets.

Although there is no functional issue with bucket size set
to 4, it mismatches the underneath rte_hash structure,
which may affect code readability and future extension.

Fixes: 58017c98ed53 ("hash: add vectorized comparison")
Cc: stable@dpdk.org
Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
6 years agonet/softnic: support flow API VXLAN encap action
Reshma Pattan [Tue, 16 Oct 2018 14:29:07 +0000 (15:29 +0100)]
net/softnic: support flow API VXLAN encap action

Added support for ethdev flow API VXLAN encap action.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>