dpdk.git
6 years agonet/sfc: support equal stride super-buffer Rx mode
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:55 +0000 (12:36 +0100)]
net/sfc: support equal stride super-buffer Rx mode

HW Rx descriptor represents many contiguous packet buffers which
follow each other. Number of buffers, stride and maximum DMA
length are setup-time configurable per Rx queue based on provided
mempool. The mempool must support contiguous block allocation and
get info API to retrieve number of objects in the block.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
6 years agonet/sfc: allow to take mbuf pool into account when sizing
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:54 +0000 (12:36 +0100)]
net/sfc: allow to take mbuf pool into account when sizing

The new argument will be used by the equal stride super-buffer
Rx datapath.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
6 years agonet/sfc: allow one Rx queue entry carry many packet buffers
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:53 +0000 (12:36 +0100)]
net/sfc: allow one Rx queue entry carry many packet buffers

One HW Rx descriptor has many packet buffers in the case of equal
stride super-buffer Rx modes. Each packet buffer is still treated
as separate SW Rx descriptor. rxq_entries is the size of HW Rx ring
whereas nb_rx_desc is the number of SW Rx descriptors.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
6 years agonet/sfc: conditionally compile support for tunnel packets
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:52 +0000 (12:36 +0100)]
net/sfc: conditionally compile support for tunnel packets

Equal stride super-buffer Rx datapath does not support tunnels, code to
parse tunnel packet types and inner checksum offload is not required and
it is important to be able to compile it out on build time to avoid
extra CPU load.

Cutting of tunnels support relies on compiler optimizaitons to
be able to drop extra checks and branches if tun_ptype is always 0.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
6 years agonet/sfc: move EF10 Rx event parser to shared header
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:51 +0000 (12:36 +0100)]
net/sfc: move EF10 Rx event parser to shared header

Equal stride super-buffer Rx datapath will use it as well.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
6 years agonet/sfc: prepare EF10 Rx event parser to be reused
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:50 +0000 (12:36 +0100)]
net/sfc: prepare EF10 Rx event parser to be reused

Equal stride super-buffer Rx mode will be handled by the dedicated
Rx datapath and the mode has almost the same Rx event structure as
single packet Rx mode.

Restructure the code to allow the common parts to be shared.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
6 years agonet/sfc: factor out function to push Rx doorbell
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:49 +0000 (12:36 +0100)]
net/sfc: factor out function to push Rx doorbell

The function may be shared by different Rx datapath implementations.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
6 years agonet/sfc/base: add equal stride super-buffer prefix layout
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:48 +0000 (12:36 +0100)]
net/sfc/base: add equal stride super-buffer prefix layout

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc/base: support equal stride super-buffer Rx mode
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:47 +0000 (12:36 +0100)]
net/sfc/base: support equal stride super-buffer Rx mode

Equal stride super-buffer Rx mode is supported by DPDK firmware
variant. One Rx descriptor provides many Rx buffers to firmware.
Rx buffers follow each other with specified stride.
Also it supports head of line blocking with timeout to address
drops when no Rx descriptors are available. So it gives extra time
to the driver to provide Rx descriptors before drop.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc/base: detect equal stride super-buffer support
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:46 +0000 (12:36 +0100)]
net/sfc/base: detect equal stride super-buffer support

Equal stride super-buffer Rx mode is supported on Medford2 by
DPDK firmware variant.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc/base: make RxQ type data an union
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:45 +0000 (12:36 +0100)]
net/sfc/base: make RxQ type data an union

The type is an internal interface. Single integer is insufficient
to carry RxQ type-specific information in the case of equal stride
super-buffer Rx mode (packet buffers per bucket, maximum DMA length,
packet stride, head of line block timeout).

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc/base: update autogenerated MCDI and TLV headers
Andrew Rybchenko [Thu, 19 Apr 2018 11:36:44 +0000 (12:36 +0100)]
net/sfc/base: update autogenerated MCDI and TLV headers

Equal stride super-buffer is a new name instead of deprecated equal
stride packed stream to avoid confusion with previous packed stream.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/nfp: use dynamic logging everywhere
Stephen Hemminger [Wed, 25 Apr 2018 15:45:51 +0000 (08:45 -0700)]
net/nfp: use dynamic logging everywhere

Drivers should only log with their assigned logtype, not with the
generic PMD log type.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
6 years agonet/nfp: add newline in PMD_RX/TX_LOG macros
Stephen Hemminger [Wed, 25 Apr 2018 15:45:50 +0000 (08:45 -0700)]
net/nfp: add newline in PMD_RX/TX_LOG macros

Be consistent with usage in other drivers.
No need for snowflake drivers.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
6 years agonet/nfp: fix double space in init log
Stephen Hemminger [Wed, 25 Apr 2018 15:45:49 +0000 (08:45 -0700)]
net/nfp: fix double space in init log

Shouldn't pass extra newline.

Fixes: 7dcb19d78f27 ("net/nfp: fix Rx interrupt when multiqueue")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
6 years agonet/nfp: add implied new line to log macro
Stephen Hemminger [Wed, 25 Apr 2018 15:45:48 +0000 (08:45 -0700)]
net/nfp: add implied new line to log macro

The PMD_INIT_LOG macro always adds a newline, and other drivers version
of PMD_DRV_LOG always adds a newline. Therefore change nfp driver
to be consitent with others.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
6 years agonet/nfp: use correct logtype for init messages
Stephen Hemminger [Wed, 25 Apr 2018 15:45:47 +0000 (08:45 -0700)]
net/nfp: use correct logtype for init messages

The NFP driver init messages would come out under PMD not net.pmd.nfp.init.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
6 years agoethdev: add shared counter to flow API
Declan Doherty [Thu, 26 Apr 2018 17:29:19 +0000 (18:29 +0100)]
ethdev: add shared counter to flow API

Add rte_flow_action_count action data structure to enable shared
counters across multiple flows on a single port or across multiple
flows on multiple ports within the same switch domain. Also this enables
multiple count actions to be specified in a single flow action.

This patch also modifies the existing rte_flow_query API to take the
rte_flow_action structure as an input parameter instead of the
rte_flow_action_type enumeration to allow querying a specific action
from a flow rule when multiple actions of the same type are specified.

This patch also contains updates for the bonding, failsafe and mlx5 PMDs
and testpmd application which are affected by this API change.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
6 years agoethdev: add mark flow item
Declan Doherty [Thu, 26 Apr 2018 17:29:18 +0000 (18:29 +0100)]
ethdev: add mark flow item

Introduces a new action type RTE_FLOW_ITEM_TYPE_MARK which enables
flow patterns to specify arbitrary integer values to match aginst
set by the RTE_FLOW_ACTION_TYPE_MARK action in previously matched
flows.

Add support for specification of new MARK flow item in testpmd's cli.
Update testpmd documentation to describe new MARK flow item support.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
6 years agoethdev: add group jump action
Declan Doherty [Thu, 26 Apr 2018 17:29:17 +0000 (18:29 +0100)]
ethdev: add group jump action

Add jump action type which defines an action which allows a matched
flow to be redirect to the specified group. This allows physical and
logical flow table/group hierarchies to be defined through rte_flow.

This breaks ABI compatibility for the following public functions (as it
modifes the ordering of the rte_flow_action_type enumeration):

- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()

Add support for specification of new JUMP action to testpmd's flow
cli, and update the testpmd documentation to describe this new
action.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
6 years agoethdev: add tunnel encap/decap actions
Declan Doherty [Thu, 26 Apr 2018 17:29:16 +0000 (18:29 +0100)]
ethdev: add tunnel encap/decap actions

Add new flow action types and associated action data structures to
support the encapsulation and decapsulation of VXLAN and NVGRE tunnel
endpoints.

The RTE_FLOW_ACTION_TYPE_[VXLAN/NVGRE]_ENCAP action will cause the
matching flow to be encapsulated in the tunnel endpoint overlay
defined in the [vxlan/nvgre]_encap action data.

The RTE_FLOW_ACTION_TYPE_[VXLAN/NVGRE]_DECAP action will cause all
headers associated with the outer most tunnel endpoint of the specified
type for the matching flows.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
6 years agonet/sfc: do not use RSS context if it is not required
Andrew Rybchenko [Thu, 26 Apr 2018 16:48:57 +0000 (17:48 +0100)]
net/sfc: do not use RSS context if it is not required

RSS action with only one destination queue and no specific settings
for hash types and key does not require dedicated RSS context and
may be simplified to QUEUE action.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Roman Zhukov <roman.zhukov@oktetlabs.ru>
6 years agonet/tap: return empty port offload capabilities
Ophir Munk [Thu, 26 Apr 2018 11:13:02 +0000 (11:13 +0000)]
net/tap: return empty port offload capabilities

Fix internal report on port specific offload capabilities to be 0 (no
capabilities). Before this commit port capabilities were a clone of queue
capabilities, however the current TAP offload capabilities (e.g.
checksum calculation) are per queue and are not specific per port.
This commit fixes an internal validation check for new configured
queue offloads.
The port capability API keeps reporting all queue capabilities as port
capabilities.

Fixes: 95ae196ae10b ("net/tap: use new Rx offloads API")
Fixes: 818fe14a9891 ("net/tap: use new Tx offloads API")
Cc: stable@dpdk.org
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
6 years agonet/sfc: ignore spec bits not covered by mask
Andrew Rybchenko [Wed, 25 Apr 2018 17:18:34 +0000 (18:18 +0100)]
net/sfc: ignore spec bits not covered by mask

mask is a simple bit-mask applied before interpreting the contents
of spec and last.

Fixes: a9825ccf5bb8 ("net/sfc: support flow API filters")
Cc: stable@dpdk.org
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Reviewed-by: Roman Zhukov <roman.zhukov@oktetlabs.ru>
6 years agonet/ixgbe: add support for representor ports
Declan Doherty [Thu, 26 Apr 2018 10:41:05 +0000 (11:41 +0100)]
net/ixgbe: add support for representor ports

Add support for virtual function representor ports to the ixgbe PF
driver. When SR-IOV virtual functions devices are enabled a
corresponding representor port for each VF can be enabled in the
process in which the ixgbe PMD is running within, by specifying the
representor devargs with the list of VF ports that representors
are to be created for.

An example of the devargs which would create VF representor for virtual
functions 0,2,4,5,6 and 7 is:

-w DBDF,representor=[0,2,4-7]

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Signed-off-by: Remy Horton <remy.horton@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/i40e: add support for representor ports
Declan Doherty [Thu, 26 Apr 2018 10:41:04 +0000 (11:41 +0100)]
net/i40e: add support for representor ports

Add support for virtual function representor ports to the i40e PF
driver. When SR-IOV virtual functions devices are enabled a
corresponding representor port for each VF can be enabled, in the
process in which the i40e PMD is running, by specifying the
representor devargs with the list of VF ports that representors
are to be created for.

An example of the devargs which would create VF representor for virtual
functions 0,2,4,5,6 and 7 is:

-w DBDF,representor=[0,2,4-7]

and to just specify a single representor on virtual function 3 (switch
port id):

-w DBDF,representor=3

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Signed-off-by: Remy Horton <remy.horton@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoethdev: add switch domain allocator
Declan Doherty [Thu, 26 Apr 2018 10:41:03 +0000 (11:41 +0100)]
ethdev: add switch domain allocator

Add switch domain allocate and free API to enable NET devices to
synchronise switch domain allocation.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoethdev: add common devargs parser
Remy Horton [Thu, 26 Apr 2018 10:41:02 +0000 (11:41 +0100)]
ethdev: add common devargs parser

Introduces a new structure, rte_eth_devargs, to support generic
ethdev arguments common across NET PMDs, with a new API
rte_eth_devargs_parse API to support PMD parsing these arguments. The
patch add support for a representor argument  passed with passed with
the EAL -w option. The representor parameter allows the user to specify
which representor ports to initialise on a device.

The argument supports passing a single representor port, a list of
port values or a range of port values.

-w BDF,representor=1  # create representor port 1 on pci device BDF
-w BDF,representor=[1,2,5,6,10] # create representor ports in list
-w BDF,representor=[0-31] # create representor ports in range

Signed-off-by: Remy Horton <remy.horton@intel.com>
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoapp/testpmd: add port name to device info
Declan Doherty [Thu, 26 Apr 2018 10:41:01 +0000 (11:41 +0100)]
app/testpmd: add port name to device info

Add the port name to information printed by show port info <port_id>

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoethdev: add port representor device flag
Declan Doherty [Thu, 26 Apr 2018 10:41:00 +0000 (11:41 +0100)]
ethdev: add port representor device flag

Add new device flag to specify that an ethdev port is a port
representor.  Extend rte_eth_dev_info structure to expose device flags
to the user which enables applications to discover if a port is a
representor port.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoethdev: add generic create/destroy ethdev APIs
Declan Doherty [Thu, 26 Apr 2018 10:40:59 +0000 (11:40 +0100)]
ethdev: add generic create/destroy ethdev APIs

Add new bus generic ethdev create/destroy APIs which are bus independent
and provide hooks for bus specific initialisation.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoethdev: add switch identifier parameter to port
Declan Doherty [Thu, 26 Apr 2018 10:40:58 +0000 (11:40 +0100)]
ethdev: add switch identifier parameter to port

Introduces a new port attribute to ethdev port's which denotes the
switch domain a port belongs to. By default all port's switch
identifiers are set to RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID. Ports
which supported the concept of switch domains can be configured with
the same switch domain id.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agodoc: add switch representation documentation
Declan Doherty [Thu, 26 Apr 2018 10:40:57 +0000 (11:40 +0100)]
doc: add switch representation documentation

Add document to describe the  model for representing switching capable
devices in DPDK, using a general ethdev port model and through port
representors. This document also details the port model and the
rte_flow semantics required for flow programming, as well as listing
some example use cases.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agodoc: update mlx5 guide on tunnel offloading
Xueming Li [Mon, 23 Apr 2018 12:33:10 +0000 (20:33 +0800)]
doc: update mlx5 guide on tunnel offloading

Remove tunnel limitations, add new hardware tunnel offload features.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: allow flow tunnel ID 0 with outer pattern
Xueming Li [Mon, 23 Apr 2018 12:33:09 +0000 (20:33 +0800)]
net/mlx5: allow flow tunnel ID 0 with outer pattern

Tunnel w/o tunnel id pattern could match any non-tunneled packet,
this patch allowed tunnel w/o tunnel id pattern after proper outer spec.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: introduce VXLAN-GPE tunnel type
Xueming Li [Mon, 23 Apr 2018 12:33:08 +0000 (20:33 +0800)]
net/mlx5: introduce VXLAN-GPE tunnel type

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: add hardware flow debug dump
Xueming Li [Mon, 23 Apr 2018 12:33:07 +0000 (20:33 +0800)]
net/mlx5: add hardware flow debug dump

Dump verb flow detail including flow spec type and size for debugging
purpose.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: support tunnel RSS level
Xueming Li [Mon, 23 Apr 2018 12:33:06 +0000 (20:33 +0800)]
net/mlx5: support tunnel RSS level

Tunnel RSS level of flow RSS action offers user a choice to do RSS hash
calculation on inner or outer RSS fields. Testpmd flow command examples:

GRE flow inner RSS:
  flow create 0 ingress pattern eth / ipv4 proto is 47 / gre / end
actions rss queues 1 2 end level 1 / end

GRE tunnel flow outer RSS:
  flow create 0 ingress pattern eth  / ipv4 proto is 47 / gre / end
actions rss queues 1 2 end level 0 / end

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: split flow RSS handling logic
Xueming Li [Mon, 23 Apr 2018 12:33:05 +0000 (20:33 +0800)]
net/mlx5: split flow RSS handling logic

This patch split out flow RSS hash field handling logic to dedicate
function.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: cleanup tunnel checksum offloads
Xueming Li [Mon, 23 Apr 2018 12:33:04 +0000 (20:33 +0800)]
net/mlx5: cleanup tunnel checksum offloads

Once tunnel packet type(RTE_PTYPE_TUNNEL_xxx) identified,
PKT_RX_IP_CKSUM_XXX and PKT_RX_L4_CKSUM_XXX represent checksum result of
inner headers, outer L3 and L4 header checksum are always valid as soon
as tunnel identified. If no tunnel identified, PKT_RX_IP_CKSUM_XXX and
PKT_RX_L4_CKSUM_XXX represent checksum result of outer L3 and L4
headers.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: support Rx tunnel type identification
Xueming Li [Mon, 23 Apr 2018 12:33:03 +0000 (20:33 +0800)]
net/mlx5: support Rx tunnel type identification

This patch introduced tunnel type identification based on flow rules.
If flows of multiple tunnel types built on same queue, no tunnel type
will be returned. User application could use bits in flow mark as tunnel
type identifier.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: support L3 VXLAN flow
Xueming Li [Mon, 23 Apr 2018 12:33:02 +0000 (20:33 +0800)]
net/mlx5: support L3 VXLAN flow

This patch support L3 VXLAN, no inner L2 header comparing to standard
VXLAN protocol. L3 VXLAN using specific overlay UDP destination port to
discriminate against standard VXLAN, device parameter and FW has to be
configured to support it:
  sudo mlxconfig -d <device> -y s IP_OVER_VXLAN_EN=1
  sudo mlxconfig -d <device> -y s IP_OVER_VXLAN_PORT=<port>

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: support GRE tunnel flow
Xueming Li [Mon, 23 Apr 2018 12:33:01 +0000 (20:33 +0800)]
net/mlx5: support GRE tunnel flow

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: support 16 hardware priorities
Xueming Li [Mon, 23 Apr 2018 12:33:00 +0000 (20:33 +0800)]
net/mlx5: support 16 hardware priorities

This patch supports new 16 Verbs flow priorities by trying to create a
simple flow of priority 15. If 16 priorities not available, fallback to
traditional 8 priorities.

Verb priority mapping:
8 priorities >=16 priorities
Control flow: 4-7 8-15
User normal flow: 1-3 4-7
User tunnel flow: 0-2 0-3

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agoapp/testpmd: fix config due to RSS offload check
Qi Zhang [Wed, 25 Apr 2018 13:38:16 +0000 (21:38 +0800)]
app/testpmd: fix config due to RSS offload check

After add RSS hash offload check, default rss_hf  will fail on
devices that not support all bits, the patch take rss_hf as
a suggest value and only set bits that device supported base on
rte_eth_dev_get_info, also rss_hf will only be updated when new
rss offload is successfully updated on all ports by
"port config all rss [!default]" command.

Fixes: 8863a1fbfc66 ("ethdev: add supported hash function check")
Fixes: d9aa619c60b6 ("app/testpmd: new parameter for port config all RSS command")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agonet/sfc: convert to the advanced EFX RSS interface
Ivan Malov [Wed, 25 Apr 2018 17:51:44 +0000 (18:51 +0100)]
net/sfc: convert to the advanced EFX RSS interface

The current code has the following drawbacks:
 - It is assumed that TCP 4-tuple hash is
   always supported, which is untrue in
   the case of packed stream FW variant.
 - The driver is unaware of UDP hash support
   available with latest firmware.

In order to cope with the mentioned issues, this
patch implements the new approach to handle hash
settings using the advanced EFX RSS interface.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc: factor out RSS fields from adapter info
Ivan Malov [Wed, 25 Apr 2018 17:51:43 +0000 (18:51 +0100)]
net/sfc: factor out RSS fields from adapter info

RSS handling will need more sophisticated fields
in the adapter context storage in future patches.
This patch groups existing fields in a dedicated
structure and updates the rest of the code.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc: remove conditional compilation for RSS
Ivan Malov [Wed, 25 Apr 2018 17:51:42 +0000 (18:51 +0100)]
net/sfc: remove conditional compilation for RSS

RSS is one of the most valuable features in the
driver, and one would hardly need to disable it
at build time. This patch withdraws unnecessary
conditionals for RSS snippets.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc: process RSS settings on Rx configure step
Ivan Malov [Wed, 25 Apr 2018 17:51:41 +0000 (18:51 +0100)]
net/sfc: process RSS settings on Rx configure step

One may submit advanced RSS settings as part of
rte_eth_conf to customise RSS configuration from
the very beginning. Currently the driver does not
check that piece of settings and proceeds with
default choices for RSS hash functions and RSS key.

This patch implements the required processing.

Fixes: 4ec1fc3ba881 ("net/sfc: add basic stubs for RSS support on driver attach")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc/base: honour packed stream RSS restriction
Ivan Malov [Wed, 25 Apr 2018 17:51:40 +0000 (18:51 +0100)]
net/sfc/base: honour packed stream RSS restriction

Packed stream firmware variant on EF10 adapters has a
number of properties which must be taken into account:

 - Only one exclusive RSS context is available per port.
 - Only IP addresses can contribute to the hash value.

Huntington and Medford have one more limitation which
is important for the drivers capable of packed stream:

 - Hash algorithm is non-standard (i.e. non-Toeplitz).
   This implies XORing together source + destination
   IP addresses (or last four bytes in the case of IPv6)
   and using the result as the input to a Toeplitz hash.

This patch provides a number of improvements in order
to treat the mentioned limitations in the common code.

If the firmware variant is packed stream, the list of
supported hash tuples will include less variants, and
the maximum number of RSS contexts will be set to one.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc/base: support more RSS hash configurations
Ivan Malov [Wed, 25 Apr 2018 17:51:39 +0000 (18:51 +0100)]
net/sfc/base: support more RSS hash configurations

Modern firmwares on EF10 adapters have support for
more traffic classes eligible for hash computation.
Also, it has become possible to adjust hashing per
individual class and select distinct packet fields
which will be able to contribute to the hash value.

This patch adds support for the mentioned features.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc/base: add a new means to control RSS hash
Ivan Malov [Wed, 25 Apr 2018 17:51:38 +0000 (18:51 +0100)]
net/sfc/base: add a new means to control RSS hash

Currently, libefx has no support for additional RSS modes
available with later controllers. In order to support this,
libefx should be able to list available hash configurations.

This patch provides basic infrastructure for the new interface.
The client drivers will be able to query the list of supported
hash configurations for a particular hash algorithm. Also, it
will be possible to configure hashing by means of new definitions.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc/base: cope with clang warning on negative shift
Andrew Rybchenko [Wed, 25 Apr 2018 17:51:37 +0000 (18:51 +0100)]
net/sfc/base: cope with clang warning on negative shift

clang 4.0.1-6 on Ubuntu generates false positive warning that shift
is negative.  It is done regardless of the fact that the branch is
not taken because of previous check.

The warning is generate in EFX_INSERT_NATIVE32 used by
EFX_INSERT_FIELD_NATIVE32. All similar cases are fixed as well.

It is undesirable to suppress the warning completely.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: add VLAN and MPLS actions to flow API
Qi Zhang [Tue, 24 Apr 2018 15:59:02 +0000 (17:59 +0200)]
ethdev: add VLAN and MPLS actions to flow API

Add support for the following OpenFlow-defined actions:

- RTE_FLOW_ACTION_OF_POP_VLAN: pop the outer VLAN tag.

- RTE_FLOW_ACTION_OF_PUSH_VLAN: push a new VLAN tag.

- RTE_FLOW_ACTION_OF_SET_VLAN_VID: set the 802.1q VLAN id.

- RTE_FLOW_ACTION_OF_SET_VLAN_PCP: set the 802.1q priority.

- RTE_FLOW_ACTION_OF_POP_MPLS: pop the outer MPLS tag.

- RTE_FLOW_ACTION_OF_PUSH_MPLS: push a new MPLS tag.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agoethdev: add TTL change actions to flow API
Qi Zhang [Tue, 24 Apr 2018 15:59:00 +0000 (17:59 +0200)]
ethdev: add TTL change actions to flow API

Add support for the following OpenFlow-defined actions:

- RTE_FLOW_ACTION_OF_SET_MPLS_TTL: MPLS TTL.

- RTE_FLOW_ACTION_OF_DEC_MPLS_TTL: decrement MPLS TTL.

- RTE_FLOW_ACTION_OF_SET_NW_TTL: IP TTL.

- RTE_FLOW_ACTION_OF_DEC_NW_TTL: decrement IP TTL.

- RTE_FLOW_ACTION_OF_COPY_TTL_OUT: copy TTL "outwards".

- RTE_FLOW_ACTION_OF_COPY_TTL_IN: copy TTL "inwards".

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agoethdev: add neighbor discovery to flow API
Qi Zhang [Tue, 24 Apr 2018 15:58:58 +0000 (17:58 +0200)]
ethdev: add neighbor discovery to flow API

- RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4: matches an ARP header for Ethernet/IPv4.

- RTE_FLOW_ITEM_TYPE_IPV6_EXT: matches the presence of any IPv6 extension
  header.

- RTE_FLOW_ITEM_TYPE_ICMP6: matches any ICMPv6 header.

- RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS: matches an ICMPv6 neighbor discovery
  solicitation.

- RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA: matches an ICMPv6 neighbor discovery
  advertisement.

- RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT: matches the presence of any ICMPv6
  neighbor discovery option.

- RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_ETH_SLA: matches an ICMPv6 neighbor
  discovery source Ethernet link-layer address option.

- RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_ETH_TLA: matches an ICMPv6 neighbor
  discovery target Ethernet link-layer address option.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agoapp/testpmd: support more GRE extension in csum engine
Xueming Li [Mon, 23 Apr 2018 12:16:35 +0000 (20:16 +0800)]
app/testpmd: support more GRE extension in csum engine

This patch adds GRE checksum and sequence extension supports in addtion
to key extension to csum forwarding engine.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agoapp/testpmd: introduce new tunnel VXLAN-GPE
Xueming Li [Mon, 23 Apr 2018 12:16:34 +0000 (20:16 +0800)]
app/testpmd: introduce new tunnel VXLAN-GPE

Add VXLAN-GPE support to csum forwarding engine and rte flow.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agoethdev: introduce tunnel type MPLS-in-GRE and MPLS-in-UDP
Xueming Li [Mon, 23 Apr 2018 12:16:33 +0000 (20:16 +0800)]
ethdev: introduce tunnel type MPLS-in-GRE and MPLS-in-UDP

This patch adds new tunnel type for MPLS-in-GRE and MPLS-in-UDP.

MPLS-in-GRE protocol link:
https://tools.ietf.org/html/rfc4023

MPLS-in-UDP protocol link:
https://tools.ietf.org/html/rfc7510

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agoethdev: introduce new tunnel VXLAN-GPE
Xueming Li [Mon, 23 Apr 2018 12:16:32 +0000 (20:16 +0800)]
ethdev: introduce new tunnel VXLAN-GPE

VXLAN-GPE enables VXLAN for all protocols. Protocol link:
https://www.ietf.org/id/draft-ietf-nvo3-vxlan-gpe-05.txt

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agoethdev: add port ID item and action to flow API
Adrien Mazarguil [Wed, 25 Apr 2018 15:28:10 +0000 (17:28 +0200)]
ethdev: add port ID item and action to flow API

RTE_FLOW_ACTION_TYPE_PORT_ID brings the ability to inject matching traffic
into a different device, as identified by its DPDK port ID.

This is normally only supported when the target port ID has some kind of
relationship with the port ID the flow rule is created against, such as
being exposed by a common physical device (e.g. a different port of an
Ethernet switch).

The converse pattern item, RTE_FLOW_ITEM_TYPE_PORT_ID, makes the resulting
flow rule match traffic whose origin is the specified port ID. Note that
specifying a port ID that differs from the one the flow rule is created
against is normally meaningless (if even accepted), but can make sense if
combined with the transfer attribute.

These must not be confused with their PHY_PORT counterparts, which refer to
physical ports using device-specific indices, but unlike PORT_ID are not
necessarily tied to DPDK port IDs.

This breaks ABI compatibility for the following public functions:

- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: add physical port action to flow API
Adrien Mazarguil [Wed, 25 Apr 2018 15:28:08 +0000 (17:28 +0200)]
ethdev: add physical port action to flow API

This patch adds the missing action counterpart to the PHY_PORT pattern
item, that is, the ability to directly inject matching traffic into a
physical port of the underlying device.

It breaks ABI compatibility for the following public functions:

- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
6 years agoethdev: rename physical port item in flow API
Adrien Mazarguil [Wed, 25 Apr 2018 15:28:06 +0000 (17:28 +0200)]
ethdev: rename physical port item in flow API

While RTE_FLOW_ITEM_TYPE_PORT refers to physical ports of the underlying
device using specific identifiers, these are often confused with DPDK port
IDs exposed to applications in the global name space.

Since this pattern item is seldom used, rename it RTE_FLOW_ITEM_PHY_PORT
for better clarity.

No ABI impact.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: fix behavior of VF/PF in flow API
Adrien Mazarguil [Wed, 25 Apr 2018 15:28:03 +0000 (17:28 +0200)]
ethdev: fix behavior of VF/PF in flow API

Contrary to all other pattern items, these are inconsistently documented as
affecting traffic instead of simply matching its origin, without provision
for the latter.

This commit clarifies documentation and updates PMDs since the original
behavior now has to be explicitly requested using the new transfer
attribute.

It breaks ABI compatibility for the following public functions:

- rte_flow_create()
- rte_flow_validate()

Impacted PMDs are bnxt and i40e, for which the VF pattern item is now only
supported when a transfer attribute is also present.

Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agoethdev: add transfer attribute to flow API
Adrien Mazarguil [Wed, 25 Apr 2018 15:28:01 +0000 (17:28 +0200)]
ethdev: add transfer attribute to flow API

This new attribute enables applications to create flow rules that do not
simply match traffic whose origin is specified in the pattern (e.g. some
non-default physical port or VF), but actively affect it by applying the
flow rule at the lowest possible level in the underlying device.

It breaks ABI compatibility for the following public functions:

- rte_flow_copy()
- rte_flow_create()
- rte_flow_validate()

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agoethdev: fix default VLAN TCI mask in flow API
Adrien Mazarguil [Wed, 25 Apr 2018 15:27:58 +0000 (17:27 +0200)]
ethdev: fix default VLAN TCI mask in flow API

VLAN TCI is a 16-bit field broken down as PCP (3b), DEI (1b) and VID (12b).

The default mask used by PMDs for the VLAN pattern when one isn't provided
by the application comprises the entire TCI, which is problematic because
most devices only support VID matching.

This forces applications to always provide a mask limited to the VID part
in order to successfully apply a flow rule with a VLAN pattern item.
Moreover, applications rarely want to match PCP and DEI intentionally.

Given the above and since VID is what is commonly referred to when talking
about VLAN, this commit excludes PCP and DEI from the default mask.

Fixes: 6de5c0f1302c ("ethdev: define default item masks in flow API")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: fix TPID handling in flow API
Adrien Mazarguil [Wed, 25 Apr 2018 15:27:56 +0000 (17:27 +0200)]
ethdev: fix TPID handling in flow API

TPID handling in rte_flow VLAN and E_TAG pattern item definitions is not
consistent with the normal stacking order of pattern items, which is
confusing to applications.

Problem is that when followed by one of these layers, the EtherType field
of the preceding layer keeps its "inner" definition, and the "outer" TPID
is provided by the subsequent layer, the reverse of how a packet looks like
on the wire:

 Wire:     [ ETH TPID = A | VLAN EtherType = B | B DATA ]
 rte_flow: [ ETH EtherType = B | VLAN TPID = A | B DATA ]

Worse, when QinQ is involved, the stacking order of VLAN layers is
unspecified. It is unclear whether it should be reversed (innermost to
outermost) as well given TPID applies to the previous layer:

 Wire:       [ ETH TPID = A | VLAN TPID = B | VLAN EtherType = C | C DATA ]
 rte_flow 1: [ ETH EtherType = C | VLAN TPID = B | VLAN TPID = A | C DATA ]
 rte_flow 2: [ ETH EtherType = C | VLAN TPID = A | VLAN TPID = B | C DATA ]

While specifying EtherType/TPID is hopefully rarely necessary, the stacking
order in case of QinQ and the lack of documentation remain an issue.

This patch replaces TPID in the VLAN pattern item with an inner
EtherType/TPID as is usually done everywhere else (e.g. struct vlan_hdr),
clarifies documentation and updates all relevant code.

It breaks ABI compatibility for the following public functions:

- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()

Summary of changes for PMDs that implement ETH, VLAN or E_TAG pattern
items:

- bnxt: EtherType matching is supported with and without VLAN, but TPID
  matching is not and triggers an error.

- e1000: EtherType matching is only supported with the ETHERTYPE filter,
  which does not support VLAN matching, therefore no impact.

- enic: same as bnxt.

- i40e: same as bnxt with existing FDIR limitations on allowed EtherType
  values. The remaining filter types (VXLAN, NVGRE, QINQ) do not support
  EtherType matching.

- ixgbe: same as e1000, with additional minor change to rely on the new
  E-Tag macro definition.

- mlx4: EtherType/TPID matching is not supported, no impact.

- mlx5: same as bnxt.

- mvpp2: same as bnxt.

- sfc: same as bnxt.

- tap: same as bnxt.

Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")
Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: add encap level to RSS flow API action
Adrien Mazarguil [Wed, 25 Apr 2018 15:27:54 +0000 (17:27 +0200)]
ethdev: add encap level to RSS flow API action

RSS hash types (ETH_RSS_* macros defined in rte_ethdev.h) describe the
protocol header fields of a packet that must be taken into account while
computing RSS.

When facing encapsulated (e.g. tunneled) packets, there is an ambiguity as
to whether these should apply to inner or outer packets. Applications need
the ability to tell exactly "where" RSS must be performed.

This is addressed by adding encapsulation level information to the RSS flow
action. Its default value is 0 and stands for the usual unspecified
behavior. Other values provide a specific encapsulation level.

Contrary to the change announced by commit 676b605182a5 ("doc: announce
ethdev API change for RSS configuration"), this patch does not affect
struct rte_eth_rss_conf but struct rte_flow_action_rss as the former is not
used anymore by the RSS flow action. ABI impact is therefore limited to
rte_flow.

This breaks ABI compatibility for the following public functions:

- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: add hash function to RSS flow API action
Adrien Mazarguil [Wed, 25 Apr 2018 15:27:52 +0000 (17:27 +0200)]
ethdev: add hash function to RSS flow API action

By definition, RSS involves some kind of hash algorithm, usually Toeplitz.

Until now it could not be modified on a flow rule basis and PMDs had to
always assume RTE_ETH_HASH_FUNCTION_DEFAULT, which remains the default
behavior when unspecified (0).

This breaks ABI compatibility for the following public functions:

- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: flatten RSS configuration in flow API
Adrien Mazarguil [Wed, 25 Apr 2018 15:27:50 +0000 (17:27 +0200)]
ethdev: flatten RSS configuration in flow API

Since its inception, the rte_flow RSS action has been relying in part on
external struct rte_eth_rss_conf for compatibility with the legacy RSS API.
This structure lacks parameters such as the hash algorithm to use, and more
recently, a method to tell which layer RSS should be performed on [1].

Given struct rte_eth_rss_conf will never be flexible enough to represent a
complete RSS configuration (e.g. RETA table), this patch supersedes it by
extending the rte_flow RSS action directly.

A subsequent patch will add a field to use a non-default RSS hash
algorithm. To that end, a field named "types" replaces the field formerly
known as "rss_hf" and standing for "RSS hash functions" as it was
confusing. Actual RSS hash function types are defined by enum
rte_eth_hash_function.

This patch updates all PMDs and example applications accordingly.

It breaks ABI compatibility for the following public functions:

- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()

[1] commit 676b605182a5 ("doc: announce ethdev API change for RSS
    configuration")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: fix C99 flexible arrays from flow API
Adrien Mazarguil [Wed, 25 Apr 2018 15:27:48 +0000 (17:27 +0200)]
ethdev: fix C99 flexible arrays from flow API

This patch replaces C99-style flexible arrays in struct rte_flow_action_rss
and struct rte_flow_item_raw with standard pointers to the same data.

They proved difficult to use in the field (e.g. no possibility of static
initialization) and unsuitable for C++ applications.

Affected PMDs and examples are updated accordingly.

This breaks ABI compatibility for the following public functions:

- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()

Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agoethdev: alter behavior of flow API actions
Adrien Mazarguil [Wed, 25 Apr 2018 15:27:46 +0000 (17:27 +0200)]
ethdev: alter behavior of flow API actions

This patch makes the following changes to flow rule actions:

- List order now matters, they are redefined as performed first to last
  instead of "all simultaneously".

- Repeated actions are now supported (e.g. specifying QUEUE multiple times
  now duplicates traffic among them). Previously only the last action of
  any given kind was taken into account.

- No more distinction between terminating/non-terminating/meta actions.
  Flow rules themselves are now defined as always terminating unless a
  PASSTHRU action is specified.

These changes alter the behavior of flow rules in corner cases in order to
prepare the flow API for actions that modify traffic contents or properties
(e.g. encapsulation, compression) and for which order matter when combined.

Previously one would have to do so through multiple flow rules by combining
PASSTRHU with priority levels, however this proved overly complex to
implement at the PMD level, hence this simpler approach.

This breaks ABI compatibility for the following public functions:

- rte_flow_create()
- rte_flow_validate()

PMDs with rte_flow support are modified accordingly:

- bnxt: no change, implementation already forbids multiple actions and does
  not support PASSTHRU.

- e1000: no change, same as bnxt.

- enic: modified to forbid redundant actions, no support for default drop.

- failsafe: no change needed.

- i40e: no change, implementation already forbids multiple actions.

- ixgbe: same as i40e.

- mlx4: modified to forbid multiple fate-deciding actions and drop when
  unspecified.

- mlx5: same as mlx4, with other redundant actions also forbidden.

- sfc: same as mlx4.

- tap: implementation already complies with the new behavior except for
  the default pass-through modified as a default drop.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: remove DUP action from flow API
Adrien Mazarguil [Wed, 25 Apr 2018 15:27:44 +0000 (17:27 +0200)]
ethdev: remove DUP action from flow API

Upcoming changes in relation to the handling of actions list will make the
DUP action redundant as specifying several QUEUE actions will achieve the
same behavior. Besides, no PMD implements this action.

By removing an entry from enum rte_flow_action_type, this patch breaks ABI
compatibility for the following public functions:

- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agodoc: remove flow API migration section
Adrien Mazarguil [Wed, 25 Apr 2018 15:27:43 +0000 (17:27 +0200)]
doc: remove flow API migration section

This section has become less relevant since the flow API (rte_flow) is now
a mature DPDK API with applications developed directly on top of it instead
of an afterthought.

This patch removes it for the following reasons:

- It has never been updated to track the latest changes in the legacy
  filter types and never will.

- Many provided examples are theoretical and misleading since PMDs do not
  implement them. Others are obvious.

- Upcoming work on the flow API will alter the behavior of several pattern
  items, actions and in some cases, flow rules, which will in turn cause
  existing examples to be wrong.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: clarify flow API pattern items and actions
Adrien Mazarguil [Wed, 25 Apr 2018 15:27:41 +0000 (17:27 +0200)]
ethdev: clarify flow API pattern items and actions

Although pattern items and actions examples end with "and so on", these
lists include all existing definitions and as a result are updated almost
every time new types are added. This is cumbersome and pointless.

This patch also synchronizes Doxygen and external API documentation wording
with a slight clarification regarding meta pattern items.

No fundamental API change.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: add error types to flow API
Adrien Mazarguil [Wed, 25 Apr 2018 15:27:38 +0000 (17:27 +0200)]
ethdev: add error types to flow API

These enable more precise reporting of objects responsible for errors.

This breaks ABI compatibility for the following public functions:

- rte_flow_create()
- rte_flow_destroy()
- rte_flow_error_set()
- rte_flow_flush()
- rte_flow_isolate()
- rte_flow_query()
- rte_flow_validate()

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/i40e: add module EEPROM callbacks for i40e
Zijie Pan [Wed, 25 Apr 2018 14:02:06 +0000 (16:02 +0200)]
net/i40e: add module EEPROM callbacks for i40e

Add new callbacks for eth_dev_ops of i40e to get the information
and data of plugin module eeprom.

Signed-off-by: Zijie Pan <zijie.pan@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
6 years agonet/e1000: add module EEPROM callbacks for e1000
Zijie Pan [Wed, 25 Apr 2018 14:02:05 +0000 (16:02 +0200)]
net/e1000: add module EEPROM callbacks for e1000

Add new callbacks for eth_dev_ops of e1000 to get the information and
data of plugin module EEPROM.

Signed-off-by: Zijie Pan <zijie.pan@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
6 years agonet/ixgbe: add module EEPROM callbacks for ixgbe
Zijie Pan [Wed, 25 Apr 2018 14:02:04 +0000 (16:02 +0200)]
net/ixgbe: add module EEPROM callbacks for ixgbe

Add new callbacks for eth_dev_ops of ixgbe to get the information
and data of plugin module eeprom.

Signed-off-by: Zijie Pan <zijie.pan@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
6 years agoexamples/ethtool: add a new command module-eeprom
Zijie Pan [Wed, 25 Apr 2018 14:02:03 +0000 (16:02 +0200)]
examples/ethtool: add a new command module-eeprom

Add a new command "module-eeprom" to get the data of plugin
module EEPROM.

Signed-off-by: Zijie Pan <zijie.pan@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
6 years agoethdev: add access to EEPROM
Zijie Pan [Wed, 25 Apr 2018 14:02:02 +0000 (16:02 +0200)]
ethdev: add access to EEPROM

add new APIs:
- rte_eth_dev_get_module_info
- rte_eth_dev_get_module_eeprom

Signed-off-by: Zijie Pan <zijie.pan@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agoethdev: remove experimental flag of ports enumeration
Thomas Monjalon [Tue, 24 Apr 2018 02:15:11 +0000 (04:15 +0200)]
ethdev: remove experimental flag of ports enumeration

The basic operations for ports enumeration should not be
considered as experimental in DPDK 18.05.

The iterator RTE_ETH_FOREACH_DEV was introduced in DPDK 17.05.
It uses the function the rte_eth_find_next_owned_by() to get
only ownerless ports. Its API can be considered stable.
So the flag experimental is removed from rte_eth_find_next_owned_by().

The flag experimental is removed from rte_eth_dev_count_avail()
which is the new name of the old function rte_eth_dev_count().

The flag experimental is set to rte_eth_dev_count_total()
in the .c file for consistency with the declaration in the .h file.

A lot of internal applications are fixed to not allow experimental API.

Fixes: 8728ccf37615 ("fix ethdev ports enumeration")
Fixes: d9a42a69febf ("ethdev: deprecate port count function")
Fixes: e70e26861eaf ("net/mvpp2: fix build")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: David Marchand <david.marchand@6wind.com>
6 years agonet/mlx5: allow max 192B TSO inline header length
Xueming Li [Sun, 8 Apr 2018 12:41:21 +0000 (20:41 +0800)]
net/mlx5: allow max 192B TSO inline header length

Change max inline header length to 192B to allow IPv6 VXLAN TSO headers
and header with options that more than 128B.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/mlx5: support generic tunnel offloading
Xueming Li [Sun, 8 Apr 2018 12:41:20 +0000 (20:41 +0800)]
net/mlx5: support generic tunnel offloading

This commit adds support for generic tunnel TSO and checksum offload.
PMD will compute the inner/outer headers offset according to the
mbuf fields. Hardware will do calculation based on offsets and types.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/mlx5: separate TSO function in Tx data path
Xueming Li [Sun, 8 Apr 2018 12:41:19 +0000 (20:41 +0800)]
net/mlx5: separate TSO function in Tx data path

Separate TSO function to make logic of mlx5_tx_burst clear.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/mlx5: implement multicast add list devop
Nélio Laranjeiro [Mon, 23 Apr 2018 11:09:28 +0000 (13:09 +0200)]
net/mlx5: implement multicast add list devop

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: split MAC address add/remove code
Nélio Laranjeiro [Mon, 23 Apr 2018 11:09:27 +0000 (13:09 +0200)]
net/mlx5: split MAC address add/remove code

Move some code in DPDK callbacks to add/remove MAC addresses to internal
function.  This modification will be necessary to handle implement the
devop set_mc_addr_list.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: add more checks on MAC addresses
Nélio Laranjeiro [Mon, 23 Apr 2018 11:09:26 +0000 (13:09 +0200)]
net/mlx5: add more checks on MAC addresses

Verify MAC address before further process.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agodrivers/net: fix link autoneg value for virtual PMDs
Ferruh Yigit [Fri, 20 Apr 2018 00:01:24 +0000 (01:01 +0100)]
drivers/net: fix link autoneg value for virtual PMDs

These drivers never attempt link speed negotiation. Change link_autoneg
value to ETH_LINK_FIXED to be more accurate and consistent between PMDs.

Fixes: 1e3a958f40b3 ("ethdev: fix link autonegotiation value")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agoapp/testpmd: add option to configure UDP tunnel port
Shahed Shaikh [Sun, 22 Apr 2018 20:59:24 +0000 (13:59 -0700)]
app/testpmd: add option to configure UDP tunnel port

This change adds a new option to "port config" command to
add udp tunnel port for VXLAN and GENEVE tunneling protocols.
This command can be extended for other tunneling protocols
listed in "enum rte_eth_tunnel_type" as and when needed.

usage:
port config <port_id> udp_tunnel_port add|rm vxlan|geneve <udp_port>

Signed-off-by: Shahed Shaikh <shahed.shaikh@cavium.com>
Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/dpaa2: fix the ethdev offload checks
Sunil Kumar Kori [Tue, 24 Apr 2018 17:16:14 +0000 (22:46 +0530)]
net/dpaa2: fix the ethdev offload checks

Fixes: 0ebce6129bc6 ("net/dpaa2: support new ethdev offload APIs")

Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agonet/dpaa: fix the ethdev offload checks
Sunil Kumar Kori [Tue, 24 Apr 2018 17:16:13 +0000 (22:46 +0530)]
net/dpaa: fix the ethdev offload checks

Fixes: 16e2c27f4fc7 ("net/dpaa: support new ethdev offload APIs")

Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>
6 years agonet/tap: fix icc build
Ferruh Yigit [Mon, 12 Mar 2018 19:31:33 +0000 (19:31 +0000)]
net/tap: fix icc build

build error:
.../dpdk/drivers/net/tap/rte_eth_tap.c(598):
error #279: controlling expression is constant
RTE_ASSERT(!"unsupported request type: must not happen");

Although RTE_ASSERT helps debugging this issue when assert enabled,
constant expression in assert means this path can be taken during
runtime and there is no protection against it when assert is disabled.

Adding error log and error return back, replacing RTE_ASSERT.

Fixes: 7748a4b44196 ("net/tap: add debug messages")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
6 years agonet/bonding: support flow API
Matan Azrad [Wed, 28 Mar 2018 11:16:01 +0000 (11:16 +0000)]
net/bonding: support flow API

Ethernet devices which are grouped by bonding PMD, aka slaves, are
sharing the same queues and RSS configurations and their Rx burst
functions must be managed by the bonding PMD according to the bonding
architecture.

So, it makes sense to configure the same flow rules for all the bond
slaves to allow consistency in packet flow management.

Add rte flow support to the bonding PMD to manage all flow
configuration to the bonded slaves.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
6 years agonet/i40e: enable runtime queue setup
Qi Zhang [Tue, 24 Apr 2018 12:44:10 +0000 (20:44 +0800)]
net/i40e: enable runtime queue setup

Expose the runtime queue configuration capability and enhance
i40e_dev_[rx|tx]_queue_setup to handle the situation when
device already started.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoapp/testpmd: enable queue ring size configure
Qi Zhang [Tue, 24 Apr 2018 12:44:09 +0000 (20:44 +0800)]
app/testpmd: enable queue ring size configure

Add command to change specific queue's ring size configure,
the new value will only take effect after command that restart
the device(port stop <port_id>/port start <port_id>) or command
that setup the queue(port <port_id> rxq <qid> setup) at runtime.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoapp/testpmd: enable per queue configure
Qi Zhang [Tue, 24 Apr 2018 12:44:08 +0000 (20:44 +0800)]
app/testpmd: enable per queue configure

Each queue has independent configure information in rte_port.
Base on this, we are able to add new commands to configure
different queues with different value.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoapp/testpmd: add command for queue setup
Qi Zhang [Tue, 24 Apr 2018 12:44:07 +0000 (20:44 +0800)]
app/testpmd: add command for queue setup

Add new command to setup queue, rte_eth_[rx|tx]_queue_setup will
be called corresponsively.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoethdev: support runtime queue setup
Qi Zhang [Tue, 24 Apr 2018 12:44:06 +0000 (20:44 +0800)]
ethdev: support runtime queue setup

It's not possible to setup a queue when the port is started
because of a check in ethdev layer. New capability flags are
added in order to relax this check for devices which support
queue setup in runtime. The functions rte_eth_[rx|tx]_queue_setup
will raise an error only if the port is started and runtime setup
of queue is not supported.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agonet/nfp: fix mbufs releasing when stop or close
Alejandro Lucero [Mon, 23 Apr 2018 11:23:58 +0000 (12:23 +0100)]
net/nfp: fix mbufs releasing when stop or close

PMDs have the responsibility of releasing mbufs sent through xmit burst
function. NFP PMD attaches those sent mbufs to the TX ring structure,
and it is at the next time a specific ring descriptor is going to be
used when the previous linked mbuf, already transmitted at that point,
is released. Those mbufs belonging to a chained mbuf got its own link
to a ring descriptor, and they are released independently of the mbuf
head of that chain.

The problem is how those mbufs are released when the PMD is stopped or
closed. Instead of releasing those mbufs as the xmit functions does,
this is independently of being in a mbuf chain, the code calls
rte_pktmbuf_free which will release not just the mbuf head in that
chain but all the chained mbufs. The loop will try to release those
mbufs which have already been released again when chained mbufs exist.

This patch fixes the problem using rte_pktmbuf_free_seg instead.

Fixes: b812daadad0d ("nfp: add Rx and Tx")
Cc: stable@dpdk.org
Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>