dpdk.git
4 years agoethdev: extract checking queue id into common functions
Wei Hu (Xavier) [Tue, 13 Oct 2020 11:50:53 +0000 (19:50 +0800)]
ethdev: extract checking queue id into common functions

This patch extract checking rx_queue_id or tx_queue_id into two separate
common functions named eth_dev_validate_rx_queue and
eth_dev_validate_tx_queue.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: support query of age action
Dekel Peled [Wed, 7 Oct 2020 13:28:43 +0000 (16:28 +0300)]
app/testpmd: support query of age action

Following ethdev update in the previous patch of this series, this
patch adds CLI support to query information related to AGE action.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agoethdev: support query of age action
Dekel Peled [Wed, 7 Oct 2020 13:28:42 +0000 (16:28 +0300)]
ethdev: support query of age action

Existing API supports AGE action to monitor the aging of a flow.
This patch implements RFC [1], introducing the response format for query
of an AGE action.
Application will be able to query the AGE action state.
The response will be returned in the format implemented here.

[1] https://mails.dpdk.org/archives/dev/2020-September/180061.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
4 years agonet/ice: refactor RSS config wrap and fix potential bugs
Junfeng Guo [Tue, 13 Oct 2020 06:25:55 +0000 (14:25 +0800)]
net/ice: refactor RSS config wrap and fix potential bugs

Current implementation for PF RSS config wrap function has some
potential bugs about GTPU, e.g., same input set for GTPU inner and
non-TUN have different hash values, which should be same. Thus, we
use extra pre and post processing to re-config GTPU rules.

Fixes: 185fe122f489 ("net/ice: fix GTPU down/uplink and extension conflict")
Cc: stable@dpdk.org
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agoapp/testpmd: support port and encap for sample action
Jiawei Wang [Fri, 9 Oct 2020 13:46:06 +0000 (16:46 +0300)]
app/testpmd: support port and encap for sample action

Use sample action with ratio is 1 for mirroring flow, add
supports to set the different port or encap action for mirrored
packets.

The example of test-pmd command:

1. set sample_actions 1 port_id id 1 / end
   flow create 0 ... pattern eth / end actions
sample ratio 1 index 1 / port_id id 2...
The flow will result in all the matched ingress packets will be sent to
port 2, and also mirrored the packets and sent to port 1.

2. set raw_encap 0 eth src.../ ipv4.../...
   set raw_encap 1 eth src.../ ipv4.../...
   set sample_actions 2 raw_encap index 0 / port_id id 0 / end
   flow create 0 ... pattern eth / end actions
sample ratio 1 index 2 / raw_encap index 1 / port_id id 0...
The flow will result in all the matched egress packets will be
encapsulated and sent to wire, and also mirrored the packets and with
the different encapsulated data and sent to wire.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agoapp/testpmd: add command for sample action
Jiawei Wang [Fri, 9 Oct 2020 13:46:05 +0000 (16:46 +0300)]
app/testpmd: add command for sample action

Add a new testpmd command 'set sample_actions' that supports the
multiple sample actions list configuration by using the index:
set sample_actions <index> <actions list>

The examples for the sample flow use case and result as below:

1. set sample_actions 0 mark id 0x8 / queue index 2 / end
.. pattern eth / end actions sample ratio 2 index 0 / jump group 2 ...

This flow will result in all the matched ingress packets will be
jumped to next flow table, and the each second packet will be
marked and sent to queue 2 of the control application.

2. ...pattern eth / end actions sample ratio 2 / port_id id 2 ...

The flow will result in all the matched ingress packets will be
duplicated and sent to the representor peer (VF or wire) on DPDK port 2,
and the each second packet will also be sent to E-Switch manager vport.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agoethdev: introduce flow sample action
Jiawei Wang [Fri, 9 Oct 2020 13:46:04 +0000 (16:46 +0300)]
ethdev: introduce flow sample action

When using full offload, all traffic will be handled by the HW, and
forwarded to the requested VF or wire and the control application does
not see this traffic anymore. So there's a need for an action that
enables the control application some forwarded traffic visibility.

The solution introduces a new action that will sample the incoming
traffic and send a duplicated traffic with the specified ratio to the
application, while the original packet will continue to the target
destination.

The packets sampled equals is '1/ratio', the ratio value set to 1
means that the packets will be completely mirrored. The sample packet
can be assigned with different set of actions from the original packet.

In order to support the sample packet in rte_flow, new rte_flow action
definition RTE_FLOW_ACTION_TYPE_SAMPLE and structure rte_flow_action_sample
will be introduced.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/pcap: fix crash on exit for infinite Rx
Ferruh Yigit [Fri, 9 Oct 2020 15:50:39 +0000 (16:50 +0100)]
net/pcap: fix crash on exit for infinite Rx

If the infinite Rx argument ('infinite_rx') is provided a ring is
allocated and filled in the '.rx_queue_setup' dev_ops.
Later this ring freed in the '.dev_close' dev_ops.

If the 'infinite_rx' provided and '.dev_close' called before
'.rx_queue_setup', the ring will be NULL and trying to empty/free it
will cause a crash.

This is fixed by adding ring NULL check before trying to empty/free it.

Bugzilla ID: 548
Fixes: a3f5252e5cbd ("net/pcap: enable infinitely Rx a pcap file")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/memif: use abstract socket address
Jakub Grajciar [Mon, 12 Oct 2020 08:28:29 +0000 (10:28 +0200)]
net/memif: use abstract socket address

Abstract socket address has no connection with
filesystem pathnames and the socket disappears
once all open references are closed.

Memif pmd will use abstract socket address by default.
For backwards compatibility use new argument
'socket-abstract=no'

Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
4 years agonet/octeontx2: remove useless check before free
Yunjian Wang [Fri, 9 Oct 2020 12:39:05 +0000 (20:39 +0800)]
net/octeontx2: remove useless check before free

The glibc free allows free(NULL) as null operation,
so remove this useless null checks.

Coverity issue: 357719
Fixes: da138cd47e06 ("net/octeontx2: handle port reconfigure")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agonet/bnxt: add parent child flow create and free
Kishore Padmanabha [Fri, 9 Oct 2020 11:11:29 +0000 (16:41 +0530)]
net/bnxt: add parent child flow create and free

Added support in the ULP mapper to enable parent child flow
creation and destroy. This feature enables support for the vxlan
decap functionality.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: remove flow db table type from templates
Mike Baucom [Fri, 9 Oct 2020 11:11:28 +0000 (16:41 +0530)]
net/bnxt: remove flow db table type from templates

FDB type is now driven by the caller, not the template.
So remove it.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
4 years agonet/bnxt: consolidate template table processing
Mike Baucom [Fri, 9 Oct 2020 11:11:27 +0000 (16:41 +0530)]
net/bnxt: consolidate template table processing

Name changes due to consolidating the template table processing
and hence are not necessary.

- chip before type in name
- removal of class in key field info

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
4 years agonet/bnxt: support parent child flow database
Kishore Padmanabha [Fri, 9 Oct 2020 11:11:26 +0000 (16:41 +0530)]
net/bnxt: support parent child flow database

Added support for parent child flow database apis. This
feature adds support to enable vxlan decap support where
flows needs to maintain parent-child flow relationship.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support runtime EM selection
Mike Baucom [Fri, 9 Oct 2020 11:11:25 +0000 (16:41 +0530)]
net/bnxt: support runtime EM selection

This patch adds support to select internal Exact Match vs
External Exact Match support while loading the PMD.
- Added new mem type conditional opcode for internal/external
- Adapted the flowdb resource counts based on selected mode
- Template changes to use the new opcode
- The decision for internal/external EM support is based on the
  devargs parameter max_num_kflows.  If this is set, external EM
  is used.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: handle default VNIC change async event
Venkat Duvvuru [Fri, 9 Oct 2020 11:11:24 +0000 (16:41 +0530)]
net/bnxt: handle default VNIC change async event

Currently, we are only registering to this event if the function
is a trusted VF. This patch extends it for PFs as well.

Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")
Cc: stable@dpdk.org
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: combine default and regular flows
Kishore Padmanabha [Fri, 9 Oct 2020 11:11:23 +0000 (16:41 +0530)]
net/bnxt: combine default and regular flows

The default and regular flows are stored in the same flow table
instead of different flow tables. This should help code reuse
and reducing the number of allocations.
So combine default and regular flows in flow database.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: consolidate template table processing
Mike Baucom [Fri, 9 Oct 2020 11:11:22 +0000 (16:41 +0530)]
net/bnxt: consolidate template table processing

The table processing has been consolidated to be able to reuse the same
code for action and classification template processing.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix PF support in SR-IOV mode
Venkat Duvvuru [Fri, 9 Oct 2020 11:11:21 +0000 (16:41 +0530)]
net/bnxt: fix PF support in SR-IOV mode

1. Implement HWRM_FUNC_VF_RESOURCE_CFG command and use it to
   reserve resources for VFs when NEW RM is enabled.
2. Invoke PF’s FUNC_CFG before configuring VFs resources.
3. Don’t consider max_rx_em_flows in max_l2_ctx calculation
   when VFs are configured.
4. Issue HWRM_FUNC_QCFG instead of HWRM_FUNC_QCAPS to find
   out the actual allocated resources for VF.
5. Don’t add random mac to the VF.
6. Handle completion type CMPL_BASE_TYPE_HWRM_FWD_REQ instead
   of CMPL_BASE_TYPE_HWRM_FWD_RESP.
7. Don't enable HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE
   when the list of HWRM commands that needs to be forwarded
   to the PF is specified in HWRM_FUNC_DRV_RGTR.
8. Update the HWRM commands list that can be forwarded to the
   PF.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add Stingray device support to ULP
Mike Baucom [Fri, 9 Oct 2020 11:11:20 +0000 (16:41 +0530)]
net/bnxt: add Stingray device support to ULP

- Add new template files for Stingray
- Add new TRUFLOW resources for Stingray

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add multi-device infrastructure
Mike Baucom [Fri, 9 Oct 2020 11:11:19 +0000 (16:41 +0530)]
net/bnxt: add multi-device infrastructure

In order to support multiple devices this patch:
- Breaks the template into device specific files
- Changes template list retrieval to use device id
- Determines the software device id using the bp pointer
- Determines the TRUFLOW resources based on device id

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: fix corruption of session details
Kishore Padmanabha [Fri, 9 Oct 2020 11:11:18 +0000 (16:41 +0530)]
net/bnxt: fix corruption of session details

The session details that is shared among multiple ports
need to be outside the bnxt structure.

Fixes: 70e64b27af5b ("net/bnxt: support ULP session manager cleanup")
Cc: stable@dpdk.org
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix non-vector fast mbuf free offload
Lance Richardson [Fri, 9 Oct 2020 16:36:42 +0000 (12:36 -0400)]
net/bnxt: fix non-vector fast mbuf free offload

The fast mbuf free offload for non-vector mode requires
additional checks in order to handle long tx buffer
descriptors, so dedicated functions are needed for
vector- and non-vector-modes.

Fixes: 369f6077c515 ("net/bnxt: support fast mbuf free")

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/mlx5: support ICMP identifier matching
Li Zhang [Fri, 9 Oct 2020 06:11:42 +0000 (09:11 +0300)]
net/mlx5: support ICMP identifier matching

PRM expose fields "Icmp_header_data" in IPv4 ICMP.
Update ICMP mask parameter with ICMP identifier and sequence number
fields.
ICMP sequence number spec with mask, Icmp_header_data low 16 bits are
set.
ICMP identifier spec with mask, Icmp_header_data high 16 bits are set.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
4 years agonet/octeontx2: fix RSS flow create
Kiran Kumar K [Sat, 10 Oct 2020 06:33:10 +0000 (12:03 +0530)]
net/octeontx2: fix RSS flow create

While creating flow with action type RSS, action type is not being
set to RSS, and action type is being set to unicast. Therefore it breaks
RSS functionality. This patch add changes to program the RSS action
properly.

Fixes: 4092e4845dc1 ("net/octeontx2: add flow operations")
Cc: stable@dpdk.org
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
4 years agoethdev: fix xstat name of basic stats per queue
Thomas Monjalon [Wed, 7 Oct 2020 21:48:48 +0000 (23:48 +0200)]
ethdev: fix xstat name of basic stats per queue

As described in doc/guides/prog_guide/poll_mode_drv.rst,
the naming scheme for the xstats is parts separated with underscore:
* direction
* detail 1
* detail 2
* detail n
* unit
where detail 1 can be "q" followed with a queue number.
It means the name of the stats per queue should be rx_qN_* or tx_qN_*.

The second underscore was missing so far.
Fixing the basic xstat names may be considered an API change,
that's why it should not be backported.

While fixing this mistake, some examples of the naming scheme
are given as part of the API documentation of rte_eth_xstat_name.
More proposals about standardizing statistics:
http://fast.dpdk.org/events/slides/DPDK-2019-09-Ethernet_Statistics.pdf

Fixes: bd6aa172cf35 ("ethdev: fetch extended statistics with integer ids")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ciara Power <ciara.power@intel.com>
4 years agonet/af_xdp: use strlcpy instead of strncpy
Ciara Loftus [Wed, 7 Oct 2020 09:20:50 +0000 (09:20 +0000)]
net/af_xdp: use strlcpy instead of strncpy

strncpy may leave the destination buffer not NULL terminated so use
strlcpy instead.

Coverity issue: 362975
Fixes: 339b88c6a91f ("net/af_xdp: support multi-queue")
Cc: stable@dpdk.org
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/memif: move barrier outside loop
Honnappa Nagarahalli [Mon, 28 Sep 2020 19:03:34 +0000 (14:03 -0500)]
net/memif: move barrier outside loop

load-acquire memory order has a barrier. Loading it inside
the loop will result in a barrier in every iteration. Hence,
load the variable once outside the loop.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Jakub Grajciar <jgrajcia@cisco.com>
4 years agonet/memif: relax load of ring head for S2M zc ring
Honnappa Nagarahalli [Mon, 28 Sep 2020 19:03:33 +0000 (14:03 -0500)]
net/memif: relax load of ring head for S2M zc ring

For zero-copy S2M rings, ring->head is updated by the sender and
eth_memif_tx_zc function is called in the context of sending thread.
The loads in the sender do not need to synchronize with its own stores.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Jakub Grajciar <jgrajcia@cisco.com>
4 years agonet/memif: remove extra check
Honnappa Nagarahalli [Mon, 28 Sep 2020 19:03:32 +0000 (14:03 -0500)]
net/memif: remove extra check

eth_memif_tx_zc function is called only for S2M rings. Remove
additional code for M2S rings in this function.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Jakub Grajciar <jgrajcia@cisco.com>
4 years agonet/memif: relax load of ring head for M2S zc ring
Honnappa Nagarahalli [Mon, 28 Sep 2020 19:03:31 +0000 (14:03 -0500)]
net/memif: relax load of ring head for M2S zc ring

For zero-copy M2S rings, ring->head is updated by the receiver
and eth_memif_rx_zc function is called in the context of
receiving thread. The loads in the receiver do not need to
synchronize with its own stores.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Jakub Grajciar <jgrajcia@cisco.com>
4 years agonet/memif: relax load of ring head for S2M ring
Honnappa Nagarahalli [Mon, 28 Sep 2020 19:03:30 +0000 (14:03 -0500)]
net/memif: relax load of ring head for S2M ring

For S2M rings, ring->head is updated by the sender and eth_memif_tx
function is called in the context of sending thread. The loads in
the sender do not need to synchronize with its own stores.

Fixes: a2aafb9aa651 ("net/memif: optimize with one-way barrier")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Jakub Grajciar <jgrajcia@cisco.com>
4 years agonet/memif: relax load of ring head for M2S ring
Honnappa Nagarahalli [Mon, 28 Sep 2020 19:03:29 +0000 (14:03 -0500)]
net/memif: relax load of ring head for M2S ring

For M2S rings, ring->head is updated by the receiver and eth_memif_rx
function is called in the context of receiving thread. The loads in
the receiver do not need to synchronize with its own stores.

Fixes: a2aafb9aa651 ("net/memif: optimize with one-way barrier")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Jakub Grajciar <jgrajcia@cisco.com>
4 years agonet/memif: relax load of ring tail for M2S ring
Honnappa Nagarahalli [Mon, 28 Sep 2020 19:03:28 +0000 (14:03 -0500)]
net/memif: relax load of ring tail for M2S ring

For M2S rings, ring->tail is updated by the sender and eth_memif_tx
function is called in the context of sending thread. The loads in
the sender do not need to synchronize with its own stores.

Fixes: a2aafb9aa651 ("net/memif: optimize with one-way barrier")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Jakub Grajciar <jgrajcia@cisco.com>
4 years agonet/memif: do not update local copy of tail in Tx
Honnappa Nagarahalli [Mon, 28 Sep 2020 19:03:27 +0000 (14:03 -0500)]
net/memif: do not update local copy of tail in Tx

In the case of S2M queues, the receiver synchronizes with the sender
(i.e. informs of the packets it has received) using ring->tail.
Hence, the sender does not need to update last_tail.

In the case of M2S queues, the receiver uses last_tail to
keep track of the descriptors it has received. The
sender is not required to update the last_tail. Updating
the last_tail makes it a shared variable between the
transmitter and receiver affecting the performance.

Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Jakub Grajciar <jgrajcia@cisco.com>
4 years agonet/pcap: fix input only Rx
Ferruh Yigit [Thu, 8 Oct 2020 11:34:25 +0000 (12:34 +0100)]
net/pcap: fix input only Rx

When input only Rx interface argument 'rx_iface_in' provided, current
code assigns 'eth_null_rx' burst function by mistake and no packet
received as a result.
Like in following usage no packets received from physical interface:
"--vdev net_pcap0,rx_iface_in=eth0,tx_iface=eth0"

Fixing the burst function assignment when 'rx_iface_in' argument is used

Fixes: f14a94591504 ("net/pcap: remove Rx queue argument necessity")
Cc: stable@dpdk.org
Reported-by: Muthurajan Jayakumar <muthurajan.jayakumar@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/bonding: fix Rx queue conversion
Dongsheng Rong [Tue, 22 Sep 2020 10:29:32 +0000 (18:29 +0800)]
net/bonding: fix Rx queue conversion

In 'bond_ethdev_rx_burst_alb()' in Rx path, 'bond_rx_queue' should be
used, not 'bond_tx_queue'.

Fixes: 06fe78b98ccd ("bond: add mode 6")
Cc: stable@dpdk.org
Signed-off-by: Dongsheng Rong <rongdongsheng@baidu.com>
Signed-off-by: RongQing Li <lirongqing@baidu.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/bonding: fix possible unbalanced packet receiving
RongQing Li [Tue, 22 Sep 2020 10:29:31 +0000 (18:29 +0800)]
net/bonding: fix possible unbalanced packet receiving

Current Rx round robin policy for the slaves has two issue:

1. active_slave in bond_dev_private is shared by multiple PMDS which
   maybe cause some slave Rx hungry, for example, there is two PMD and
   two slave port, both PMDs start to receive, and see that active_slave
   is 0, and receive from slave 0, after complete, they increase
   active_slave by one, totally active_slave are increased by two, next
   time, they will start to receive from slave 0 again, at last, slave 1
   maybe drop packets during to not be polled by PMD

2. active_slave is shared and written by multiple PMD in RX path for
   every time RX, this is a kind of cache false share, low performance.

So move active_slave from bond_dev_private to bond_rx_queue make it as
per queue variable

Fixes: ae2a04864a9a ("net/bonding: reduce slave starvation on Rx poll")
Cc: stable@dpdk.org
Signed-off-by: RongQing Li <lirongqing@baidu.com>
Signed-off-by: Dongsheng Rong <rongdongsheng@baidu.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agoapp/testpmd: cleanup tunnel protocols parsing
Ophir Munk [Thu, 8 Oct 2020 20:16:56 +0000 (20:16 +0000)]
app/testpmd: cleanup tunnel protocols parsing

This is a cleanup commit.
It assembles all tunnel outer updates into one function call to avoid
code duplications.
It defines RTE_VXLAN_GPE_DEFAULT_PORT (4790) in accordance with all
other tunnel protocol definitions.
It replaces all numeric values 4789 in their corresponding definition
RTE_VXLAN_GPE_DEFAULT_PORT.
It updates the 'csum parse-tunnel' documentation.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: enable configuring GENEVE port
Ophir Munk [Thu, 8 Oct 2020 20:16:55 +0000 (20:16 +0000)]
app/testpmd: enable configuring GENEVE port

IANA has assigned port 6081 as the fixed well-known destination port for
GENEVE. Nevertheless draft-ietf-nvo3-geneve-09 recommends that
implementations make this configurable.  This commit enables specifying
any positive UDP destination port number for GENEVE protocol parsing.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: add GENEVE parsing
Ophir Munk [Thu, 8 Oct 2020 20:16:54 +0000 (20:16 +0000)]
app/testpmd: add GENEVE parsing

GENEVE is a widely used tunneling protocol in modern Virtualized
Networks. testpmd already supports parsing of several tunneling
protocols including VXLAN, VXLAN-GPE, GRE. This commit adds GENEVE
parsing of inner protocols (IPv4-0x0800, IPv6-0x86dd, Ethernet-0x6558)
based on IETF draft-ietf-nvo3-geneve-09. GENEVE is considered more
flexible than the other protocols.  In terms of protocol format GENEVE
header has a variable length options as opposed to other tunneling
protocols which have a fixed header size.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: add speed capability in device info
Sarosh Arif [Thu, 8 Oct 2020 18:25:13 +0000 (23:25 +0500)]
app/testpmd: add speed capability in device info

Called rte_eth_dev_info_get() in testpmd, to get device info
so that speed capabilities can be printed under "show device info"

Bugzilla ID: 496

Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/netvsc: fix Tx queue leak in error path
Yunjian Wang [Wed, 7 Oct 2020 02:06:25 +0000 (10:06 +0800)]
net/netvsc: fix Tx queue leak in error path

In hn_dev_tx_queue_setup() allocated memory for txq, we don't free it
when error happens and it will lead to memory leak.

We can check for tx_free_thresh at the beginning of the function to
fix it, before calling txq = rte_zmalloc_socket().

Fixes: cc0251813277 ("net/netvsc: split send buffers from Tx descriptors")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Long Li <longli@microsoft.com>
4 years agonet/dpaa2: fix build with timesync functions
Chenxu Di [Tue, 6 Oct 2020 17:16:37 +0000 (18:16 +0100)]
net/dpaa2: fix build with timesync functions

Some timesync related source files are built only when
'RTE_LIBRTE_IEEE1588' config is set, which is missing in meson.

Building with '-DRTE_LIBRTE_IEEE1588' cflag will enable timesync
functionality in the files that are build, but it won't build files
that require 'RTE_LIBRTE_IEEE1588' config.
This causes the build error.

Fixing by removing config check in meson file and build all .c files by
default, but wrap relevant code part with 'RTE_LIBRTE_IEEE1588' macro.

Also removing 'RTE_LIBRTE_IEEE1588' ifdef around some fields of the data
structures, to not require finer grained macro wraps on the functions
using them.
Since the registration of the function disabled with macro check, having
functions compiled shouldn't affect the functionality.

Fixes: 184c39d16568 ("net/dpaa2: add DPRTC sub-module")
Cc: stable@dpdk.org
Signed-off-by: Chenxu Di <chenxux.di@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
4 years agovhost: use fixed virtio-net header length packed ring
Maxime Coquelin [Thu, 1 Oct 2020 10:11:55 +0000 (12:11 +0200)]
vhost: use fixed virtio-net header length packed ring

This small optimization uses the static the Virtio-net
header len in packed datapath, since Virtio-net header
cannot be the legacy one in case of packed ring.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agovhost: fix virtio-net header length with packed ring
Maxime Coquelin [Thu, 1 Oct 2020 10:11:54 +0000 (12:11 +0200)]
vhost: fix virtio-net header length with packed ring

In case packed ring layout has been negotiated, but neither
Version 1 nor mergeable buffers, the Virtio-net header len
is assigned to the legacy devices value, which is wrong.

This patch fixes this with using the proper len as devices
using packed ring are not legacy devices.

Fixes: a922401f35cc ("vhost: add Rx support for packed ring")
Fixes: ae999ce49dcb ("vhost: add Tx support for packed ring")
Cc: stable@dpdk.org
Reported-by: Marvin Liu <yong.liu@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agovhost: fix external mbuf creation
Olivier Matz [Wed, 7 Oct 2020 12:53:18 +0000 (14:53 +0200)]
vhost: fix external mbuf creation

In virtio_dev_extbuf_alloc(), the shinfo structure used to store
the reference counter and the free callback of the external buffer
is by default stored inside the mbuf data.

This is wrong because the mbuf (and its data) can be freed before
the external buffer, for instance in the following situation:

  pkt2 = rte_pktmbuf_alloc(mp);
  rte_pktmbuf_attach(pkt2, pkt);
  rte_pktmbuf_free(pkt);

After this, pkt is freed, but it still contains shinfo, which is
referenced by pkt2.

Fix this by always storing the shinfo beside the external buffer.

Fixes: c3ff0ac70acb ("vhost: improve performance by supporting large buffer")
Cc: stable@dpdk.org
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost/crypto: fix feature negotiation
Fan Zhang [Fri, 2 Oct 2020 15:36:01 +0000 (16:36 +0100)]
vhost/crypto: fix feature negotiation

This patch fixes the feature negotiation for vhost crypto during
initialization. The patch uses the newly created driver start
function to inform the driver type with the fixed vhost features.
In addition the patch provides a new API specifically used by
the application to start a vhost-crypto driver.

Fixes: 939066d96563 ("vhost/crypto: add public function implementation")
Cc: stable@dpdk.org
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/bnxt: remove unused macros and fields
Lance Richardson [Thu, 8 Oct 2020 14:30:41 +0000 (10:30 -0400)]
net/bnxt: remove unused macros and fields

Remove unused structure fields and macro definitions.

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agoeal/x86: fix memcpy AVX-512 enablement
Bruce Richardson [Mon, 12 Oct 2020 14:51:48 +0000 (15:51 +0100)]
eal/x86: fix memcpy AVX-512 enablement

When testing on some x86 platforms, code compiled with meson was observed
running at a different power-license level to that compiled with make. This
is due to the fact that meson auto-detects the instruction sets available
on the system and enabled AVX512 rte_memcpy when AVX512 was available,
while on make, a build time AVX-512 flag needed to be explicitly set to
enable that AVX512 rte_memcpy code path.

In the absence of runtime path selection for rte_memcpy - which is
complicated by it being a static inline function in a header file - we can
fix this behaviour regression by similarly having a build-time option which
must be set to enable the AVX-512 memcpy path.

Fixes: a25a650be5f0 ("build: add infrastructure for meson and ninja builds")
Fixes: 3e1bb55fd6ef ("build/x86: add SSE flags")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Yingya Han <yingyax.han@intel.com>
4 years agodoc: make sphinx errors more visible
Thomas Monjalon [Fri, 16 Oct 2020 03:05:49 +0000 (05:05 +0200)]
doc: make sphinx errors more visible

When running Sphinx through ninja, the wrapper configured in meson
redirects stdout to a log file.
It makes more important to print issues on stderr.

Some warnings generated by the conf.py were hidden because
printed on stdout. The first improvement is to print them on stderr.

The second measure is to stop processing if meson was configured
with --werror.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agodoc: fix project version in guides
Thomas Monjalon [Fri, 16 Oct 2020 02:45:59 +0000 (04:45 +0200)]
doc: fix project version in guides

The DPDK version should appear in the top left corner of the HTML guides.
When dropping make, the variable version has been removed,
so Sphinx stopped integrating the version number.

Fixes: a4362f150204 ("doc: build without using make")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
4 years agocrypto/bcmfs: fix features documentation
Vikas Gupta [Fri, 16 Oct 2020 04:49:44 +0000 (10:19 +0530)]
crypto/bcmfs: fix features documentation

Fix documentation error in bcmfs.ini.
Add a section for asymmetric algorithms.

Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agobus/pci: clear undefined bits in Windows segment parsing
Tal Shnaiderman [Wed, 14 Oct 2020 19:30:01 +0000 (22:30 +0300)]
bus/pci: clear undefined bits in Windows segment parsing

When reading bus and segment values using SPDRP_BUSNUMBER
bits 24-31 are undefined.

They are cleared to verify we read the segment number correctly.

Fixes: c3adf8144a17 ("bus/pci: support segment as address domain on Windows")
Cc: stable@dpdk.org
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
4 years agoeal: add cache line demotion API
Omkar Maslekar [Thu, 15 Oct 2020 23:20:03 +0000 (16:20 -0700)]
eal: add cache line demotion API

rte_cldemote is similar to a prefetch hint - in reverse.
On x86, cldemote(addr) enables software to hint to hardware that line is
likely to be shared. This is quite useful in core-to-core communications
where cache-line is likely to be shared.
ARM and PPC implementation is provided with NOP and can be added if any
equivalent instructions could be used for implementation on those
architectures.

Signed-off-by: Omkar Maslekar <omkar.maslekar@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
4 years agodevtools: check Windows export files
David Marchand [Fri, 16 Oct 2020 10:27:11 +0000 (12:27 +0200)]
devtools: check Windows export files

Updating export files (supposed to disappear at some point, but still
there) might be missed when removing symbols in the API / map files.
Add a check for this case.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
4 years agoeal/windows: fix symbol export
David Marchand [Fri, 16 Oct 2020 10:27:10 +0000 (12:27 +0200)]
eal/windows: fix symbol export

The incriminated commit forgot to clean the Windows export file.

Fixes: 3cd73a1a1c4d ("eal: simplify exit functions")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
4 years agotest/service: fix race condition on stopping lcore
Kevin Laatz [Fri, 16 Oct 2020 09:08:04 +0000 (10:08 +0100)]
test/service: fix race condition on stopping lcore

There is a potential race condition in 'service_attr_get' which will cause
test failures since the service core thread is still running while the
values are being retrieved/reset.

This patch fixes the race condition by waiting for the service core thread
to stop before continuing with the unit test checks.

Fixes: 4d55194d76a4 ("service: add attribute get function")

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
4 years agoeventdev: add PCI probe named convenience function
Timothy McDaniel [Thu, 15 Oct 2020 14:16:46 +0000 (09:16 -0500)]
eventdev: add PCI probe named convenience function

Add new internal wrapper function for use by pci drivers as a
.probe function to attach to an event interface.  Same as
rte_event_pmd_pci_probe, except the caller can specify the name.

Updated rte_event_pmd_pci_probe so as to not duplicate
code.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
Reviewed-by: Gage Eads <gage.eads@intel.com>
4 years agoeventdev: express DLB/DLB2 PMD constraints
Timothy McDaniel [Thu, 15 Oct 2020 18:07:15 +0000 (13:07 -0500)]
eventdev: express DLB/DLB2 PMD constraints

This commit implements the eventdev ABI changes required by
the DLB/DLB2 PMDs.  Several data structures and constants are modified
or added in this patch, thereby requiring modifications to the
dependent apps and examples.

The DLB/DLB2 hardware does not conform exactly to the eventdev interface.
1) It has a limit on the number of queues that may be linked to a port.
2) Some ports a further restricted to a maximum of 1 linked queue.
3) DLB does not have the ability to carry the flow_id as part
   of the event (QE) payload. Note that the DLB2 hardware is capable of
   carrying the flow_id.

Following is a detailed description of the changes that have been made.

1) Add new fields to the rte_event_dev_info struct. These fields allow
the device to advertise its capabilities so that applications can take
the appropriate actions based on those capabilities.

    struct rte_event_dev_info {
uint32_t max_event_port_links;
/**< Maximum number of queues that can be linked to a single event
 * port by this device.
 */

uint8_t max_single_link_event_port_queue_pairs;
/**< Maximum number of event ports and queues that are optimized for
 * (and only capable of) single-link configurations supported by this
 * device. These ports and queues are not accounted for in
 * max_event_ports or max_event_queues.
 */
    }

2) Add a new field to the rte_event_dev_config struct. This field allows
the application to specify how many of its ports are limited to a single
link, or will be used in single link mode.

    /** Event device configuration structure */
    struct rte_event_dev_config {
uint8_t nb_single_link_event_port_queues;
/**< Number of event ports and queues that will be singly-linked to
 * each other. These are a subset of the overall event ports and
 * queues; this value cannot exceed *nb_event_ports* or
 * *nb_event_queues*. If the device has ports and queues that are
 * optimized for single-link usage, this field is a hint for how many
 * to allocate; otherwise, regular event ports and queues can be used.
 */
    }

3) Replace the dedicated implicit_release_disabled field with a bit field
of explicit port capabilities. The implicit_release_disable functionality
is assigned to one bit, and a port-is-single-link-only  attribute is
assigned to other, with the remaining bits available for future assignment.

* Event port configuration bitmap flags */
#define RTE_EVENT_PORT_CFG_DISABLE_IMPL_REL    (1ULL << 0)
/**< Configure the port not to release outstanding events in
 * rte_event_dev_dequeue_burst(). If set, all events received through
 * the port must be explicitly released with RTE_EVENT_OP_RELEASE or
 * RTE_EVENT_OP_FORWARD. Must be unset if the device is not
 * RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE capable.
 */
#define RTE_EVENT_PORT_CFG_SINGLE_LINK         (1ULL << 1)

/**< This event port links only to a single event queue.
 *
 *  @see rte_event_port_setup(), rte_event_port_link()
 */

#define RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE 3
/**
 * The implicit release disable attribute of the port
 */

struct rte_event_port_conf {
uint32_t event_port_cfg;
/**< Port cfg flags(EVENT_PORT_CFG_) */
}

This patch also removes the depreciation notice and announce
the new eventdev ABI changes in release note.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agoevent/sw: improve performance
Radu Nicolau [Wed, 7 Oct 2020 13:51:00 +0000 (13:51 +0000)]
event/sw: improve performance

Add minimum burst throughout the scheduler pipeline and a flush counter.
Use a single threaded ring implementation for the reorder buffer free list.

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
4 years agoapp/eventdev: enable fast free offload
Harman Kalra [Thu, 8 Oct 2020 18:48:46 +0000 (00:18 +0530)]
app/eventdev: enable fast free offload

Since we are not holding the mbufs or creating any references
in the app, hence mbuf fast free offload can be enabled.

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agonet/octeontx2: fix jumbo frame crash
Harman Kalra [Thu, 8 Oct 2020 18:48:45 +0000 (00:18 +0530)]
net/octeontx2: fix jumbo frame crash

Issue has been observed in case of multi segments where mbuf
data gets corrupted due to missing barriers. Changes made to
mbuf just before LMTST by one core gets updatded when the
same mbuf is in use by another core, leading to corruption.
It should be ensured that all changes made to mbuf should be
written before LMTST.

Fixes: cbd5710db48d ("net/octeontx2: add Tx multi segment version")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Harman Kalra <hkalra@marvell.com>
4 years agoevent/octeontx2: improve single flow performance
Pavan Nikhilesh [Thu, 8 Oct 2020 18:48:44 +0000 (00:18 +0530)]
event/octeontx2: improve single flow performance

Improve single flow performance by moving the point of coherence
to the end of transmit sequence.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
4 years agoevent/octeontx2: add switch tag flush operation
Pavan Nikhilesh [Thu, 8 Oct 2020 18:48:43 +0000 (00:18 +0530)]
event/octeontx2: add switch tag flush operation

Add SWTAG flush operation at the end of transmit sequence to
immediately release the tag held by the core.
Reuse Tag address to check SWTAG completion status.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
4 years agoevent/octeontx2: add crypto adapter datapath
Ankur Dwivedi [Thu, 8 Oct 2020 10:34:35 +0000 (16:04 +0530)]
event/octeontx2: add crypto adapter datapath

In the op new mode of crypto adapter, the completed crypto operation
is submitted to the event device by the OCTEON TX2 crypto PMD.
During event device dequeue the result of crypto operation is checked.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
4 years agoevent/octeontx2: add crypto adapter framework
Ankur Dwivedi [Thu, 8 Oct 2020 10:34:34 +0000 (16:04 +0530)]
event/octeontx2: add crypto adapter framework

The crypto adapter callback functions and associated data structures
are added.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
4 years agocrypto/octeontx2: move functions to helper file
Ankur Dwivedi [Thu, 8 Oct 2020 10:34:33 +0000 (16:04 +0530)]
crypto/octeontx2: move functions to helper file

Some functions are common across cryptodev pmd and the event
crypto adapter. This patch moves them into a helper file.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
4 years agotest/event: free resources after crypto adapter test
Ankur Dwivedi [Thu, 8 Oct 2020 12:52:34 +0000 (18:22 +0530)]
test/event: free resources after crypto adapter test

The resources held by crypto adapter should be freed when the
test suite exits.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
4 years agotest/event: fix function arguments for crypto adapter
Ankur Dwivedi [Thu, 8 Oct 2020 12:52:33 +0000 (18:22 +0530)]
test/event: fix function arguments for crypto adapter

The arguments passed to rte_event_crypto_adapter_caps_get() and
rte_event_crypto_adapter_create() are incorrect.

In the rte_event_crypto_adapter_caps_get(), event device id should
be the first argument and cryptodev id should be the second argument.
In the rte_event_crypto_adapter_create(), the event device id should
be the second argument.

Fixes: 3c2c535ecfc0 ("test: add event crypto adapter auto-test")
Cc: stable@dpdk.org
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
4 years agotest/event: check unsupported crypto adapter mode
Ankur Dwivedi [Thu, 8 Oct 2020 12:52:32 +0000 (18:22 +0530)]
test/event: check unsupported crypto adapter mode

The capability of a hardware event device should be checked before
creating a event crypto adapter in a particular mode. The test case
returns error if the mode is not supported.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
4 years agotest/event: add null dev creation in Rx adapter autotest
Jay Jayatheerthan [Sat, 3 Oct 2020 09:05:41 +0000 (14:35 +0530)]
test/event: add null dev creation in Rx adapter autotest

Allows creation of net_null if vdev EAL option is not specified and
uninit vdev created in the test. The change also adds error checks
for vdev init and uninit.

Signed-off-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
4 years agotest/event: uninit vdevs in Rx adapter autotest
Jay Jayatheerthan [Sat, 3 Oct 2020 09:05:40 +0000 (14:35 +0530)]
test/event: uninit vdevs in Rx adapter autotest

adapter_multi_eth_add_del() does vdev init but doesn't uninit them.
This causes issues when running event_eth_rx_adapter_autotest multiple
times.

The fix does vdev uninit before exiting the test.

Signed-off-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
4 years agoeventdev: fix adapter leak in error path
Yunjian Wang [Tue, 29 Sep 2020 13:46:33 +0000 (21:46 +0800)]
eventdev: fix adapter leak in error path

In rte_event_crypto_adapter_create_ext() allocated memory for
adapter, we should free it when error happens, otherwise it
will lead to memory leak.

Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agoevent/dpaa2: fix dereference before null check
Yunjian Wang [Wed, 26 Aug 2020 13:07:40 +0000 (21:07 +0800)]
event/dpaa2: fix dereference before null check

Coverity flags that 'portal' variable is used before
it's checked for NULL. This patch fixes this issue.

Coverity issue: 323516
Fixes: 4ab57b042e7c ("event/dpaa2: affine portal at runtime during I/O")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
4 years agoevent/octeontx: validate events requested against available
Pavan Nikhilesh [Tue, 28 Jul 2020 18:22:23 +0000 (23:52 +0530)]
event/octeontx: validate events requested against available

Validate events configured in ssopf against the total number of
events configured across all the RX/TIM event adapters.

Events available to ssopf can be reconfigured by passing the required
amount to kernel bootargs and are only limited by DRAM size.
Example:
ssopf.max_events= 2097152

Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
4 years agoeventdev: check allocation in Tx adapter
Yunjian Wang [Mon, 27 Jul 2020 14:03:14 +0000 (22:03 +0800)]
eventdev: check allocation in Tx adapter

The function rte_zmalloc() could return NULL, the return value
need to be checked.

Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
4 years agoeventdev: support telemetry with xstats info
Mike Ximing Chen [Fri, 18 Sep 2020 17:39:22 +0000 (13:39 -0400)]
eventdev: support telemetry with xstats info

The telemetry library is connected with eventdev xstats and
port link info. The following new telemetry commands are added:

/eventdev/dev_list
/eventdev/port_list,DevID
/eventdev/queue_list,DevID
/eventdev/dev_xstats,DevID
/eventdev/port_xstats,DevID,PortID
/eventdev/queue_xstats,DevID,PortID
/eventdev/queue_links,DevID,PortID

queue_links command displays a list of queues linked with a specified
eventdev port and a service priority associated with each link.

Signed-off-by: Mike Ximing Chen <mike.ximing.chen@intel.com>
Reviewed-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Gage Eads <gage.eads@intel.com>
4 years agoethdev: make flow API thread safe
Suanming Mou [Thu, 15 Oct 2020 01:07:47 +0000 (09:07 +0800)]
ethdev: make flow API thread safe

Currently, the rte_flow functions are not defined as thread safe.
DPDK applications either call the functions in single thread or
protect any concurrent calling for the rte_flow operations using
a lock.

For PMDs support the flow operations thread safe natively, the
redundant protection in application hurts the performance of the
rte_flow operation functions.

And the restriction of thread safe is not guaranteed for the
rte_flow functions also limits the applications' expectation.

This feature is going to change the rte_flow functions to be thread
safe. As different PMDs have different flow operations, some may
support thread safe already and others may not. For PMDs don't
support flow thread safe operation, a new lock is defined in ethdev
in order to protects thread unsafe PMDs from rte_flow level.

A new RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE device flag is added to
determine whether the PMD supports thread safe flow operation or not.
For PMDs support thread safe flow operations, set the
RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE flag, rte_flow level functions will
skip the thread safe helper lock for these PMDs. Again the rte_flow
level thread safe lock only works when PMD operation functions are
not thread safe.

For the PMDs which don't want the default mutex lock, just set the
flag in the PMD, and add the prefer type of lock in the PMD. Then
the default mutex lock is easily replaced by the PMD level lock.

The change has no effect on the current DPDK applications. No change
is required for the current DPDK applications. For the standard posix
pthread_mutex, if no lock contention with the added rte_flow level
mutex, the mutex only does the atomic increasing in
pthread_mutex_lock() and decreasing in
pthread_mutex_unlock(). No futex() syscall will be involved.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
4 years agoeal/windows: add pthread mutex
Suanming Mou [Thu, 15 Oct 2020 01:07:46 +0000 (09:07 +0800)]
eal/windows: add pthread mutex

Add pthread mutex lock as it is needed for the thread safe rte_flow
functions.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Tested-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
4 years agombuf: extend meaning of QinQ stripped bit
Somnath Kotur [Tue, 6 Oct 2020 07:22:32 +0000 (09:22 +0200)]
mbuf: extend meaning of QinQ stripped bit

Clarify the documentation of QinQ flags, and extend the meaning of the
flag: if PKT_RX_QINQ_STRIPPED is set and PKT_RX_VLAN_STRIPPED is unset,
only the outer VLAN is removed from packet data, but both tci are saved
in mbuf->vlan_tci (inner) and mbuf->vlan_tci_outer (outer).

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
4 years agocrypto/bcmfs: optimize crypto request processing
Vikas Gupta [Tue, 13 Oct 2020 07:47:13 +0000 (13:17 +0530)]
crypto/bcmfs: optimize crypto request processing

Reduce number of source BDs to submit a request to crypto engine.
This improves the performance as crypto engine fetches all the BDs in
single cycle. Adjust optional metadata (OMD) in continuation of
fixed meta data (FMD).

Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agotest/crypto: add PDCP-SDAP cases
Franck Lenormand [Mon, 12 Oct 2020 14:10:06 +0000 (19:40 +0530)]
test/crypto: add PDCP-SDAP cases

A new functions which uses the structure of the test vectors for SDAP
is added and call a functions responsible to call the test_pdcp_proto
with the test vector both for encapsulation and decapsulation.

Signed-off-by: Franck Lenormand <franck.lenormand@nxp.com>
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agotest/crypto: rework PDCP function
Franck Lenormand [Mon, 12 Oct 2020 14:10:05 +0000 (19:40 +0530)]
test/crypto: rework PDCP function

The function test_pdcp_proto was relying to heavily on the structure
of test vectors for PDCP making it difficult to be reusable.

The function is changed to take all the test parameters as input and
does not need access to the tests vectors anymore.

Signed-off-by: Franck Lenormand <franck.lenormand@nxp.com>
4 years agotest/crypto: add test vectors for PDCP-SDAP
Franck Lenormand [Mon, 12 Oct 2020 14:10:04 +0000 (19:40 +0530)]
test/crypto: add test vectors for PDCP-SDAP

The test vectors are structured in a more readable way compared
to test vector for PDCP. This structure allows to have all the
information about a test vector at the same place.

Signed-off-by: Franck Lenormand <franck.lenormand@nxp.com>
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agocrypto/dpaa_sec: enable PDCP-SDAP sessions
Akhil Goyal [Mon, 12 Oct 2020 14:10:03 +0000 (19:40 +0530)]
crypto/dpaa_sec: enable PDCP-SDAP sessions

Based on the new field in PDCP xform, a decision is made
to create a PDCP session with or without SDAP enabled.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agocrypto/dpaa2_sec: enable PDCP-SDAP sessions
Akhil Goyal [Mon, 12 Oct 2020 14:10:02 +0000 (19:40 +0530)]
crypto/dpaa2_sec: enable PDCP-SDAP sessions

Based on the new field in PDCP xform, a decision is made
to create a PDCP session with or without SDAP enabled.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agodoc: remove unnecessary API code from security guide
Akhil Goyal [Mon, 12 Oct 2020 14:10:01 +0000 (19:40 +0530)]
doc: remove unnecessary API code from security guide

Various xform structures are being copied in
rte_security guide which can be referred from the
API documentation generated by Doxygen. The security guide
does not talk about specific details of these xforms and
thus are removed from the security guide.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agosecurity: modify PDCP xform to support SDAP
Akhil Goyal [Mon, 12 Oct 2020 14:10:00 +0000 (19:40 +0530)]
security: modify PDCP xform to support SDAP

The SDAP is a protocol in the LTE stack on top of PDCP for
QOS. A particular PDCP session may or may not have
SDAP enabled. But if it is enabled, SDAP header should be
authenticated but not encrypted if both confidentiality and
integrity is enabled. Hence, the driver should be intimated
from the xform so that it skip the SDAP header while encryption.

A new field is added in the PDCP xform to specify SDAP is enabled.
The overall size of the xform is not changed, as hfn_ovrd is just
a flag and does not need uint32. Hence, it is converted to uint8_t
and a 16 bit reserved field is added for future.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
4 years agocommon/dpaax/caamflib: support PDCP-SDAP
Franck Lenormand [Mon, 12 Oct 2020 14:09:59 +0000 (19:39 +0530)]
common/dpaax/caamflib: support PDCP-SDAP

The SDAP is a protocol in the LTE stack on top of PDCP. It is
dedicated to QoS.

The difficulty of implementing this protocol is because the
PDCP change behavior regarding encryption and authentication
of the SDU it receives. In effect PDCP shall not encrypt the
SDAP SDU but must authenticate it (when encryption and
authentication is enabled).

The current version of SEC does not support the SDAP and the
change of behavior of PDCP prevent the use of the PDCP
protocol command available.

The way to do it is to reuse the PDCP implementation but to
not use the PDCP protocol and to have descriptors which
performs the PDCP protocol.

It is implemented by doing small changes of code:
        #ifdef SDAP_SUPPORT
                length += SDAP_BYTE_SIZE;
                offset -= SDAP_BYTE_SIZE;
        #endif
after having computed the size of the SN to read from the
input data, then
        #ifdef SDAP_SUPPORT
                MATHI(p, MATH0, LSHIFT, 8, MATH1, 8, 0);
                MATHB(p, MATH1, AND, sn_mask, MATH1, 8, IFB | IMMED2);
        #else
                MATHB(p, MATH0, AND, sn_mask, MATH1, 8, IFB | IMMED2);
        #endif
It will keep the SN and the SDAP header in MATH0, then shift
it to remove the SDAP header and store the result in MATH1.

Signed-off-by: Franck Lenormand <franck.lenormand@nxp.com>
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agocryptodev: remove algo lists end
Arek Kusztal [Mon, 12 Oct 2020 19:21:24 +0000 (20:21 +0100)]
cryptodev: remove algo lists end

This patch removes enumerators RTE_CRYPTO_CIPHER_LIST_END,
RTE_CRYPTO_AUTH_LIST_END, RTE_CRYPTO_AEAD_LIST_END to prevent
ABI breakage that may arise when adding new crypto algorithms.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agotest/event_crypto_adapter: fix configuration
Abhinandan Gujjar [Thu, 17 Sep 2020 01:14:35 +0000 (06:44 +0530)]
test/event_crypto_adapter: fix configuration

This patch updates the xform with right configuration.
For session based ops, sym session pool is created with
valid userdata size.

Fixes: 24054e3640a2 ("test/crypto: use separate session mempools")
Cc: stable@dpdk.org
Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agotest/crypto: add cases for raw datapath API
Fan Zhang [Sun, 11 Oct 2020 00:38:54 +0000 (01:38 +0100)]
test/crypto: add cases for raw datapath API

This patch adds the cryptodev raw API test support to unit test.
In addition a new test-case for QAT PMD for the test type is
enabled.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agocrypto/qat: support raw datapath API
Fan Zhang [Sun, 11 Oct 2020 00:38:53 +0000 (01:38 +0100)]
crypto/qat: support raw datapath API

This patch updates QAT PMD to add raw data-path API support.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>
4 years agocryptodev: add raw crypto datapath API
Fan Zhang [Sun, 11 Oct 2020 00:38:52 +0000 (01:38 +0100)]
cryptodev: add raw crypto datapath API

This patch adds raw data-path APIs for enqueue and dequeue
operations to cryptodev. The APIs support flexible user-define
enqueue and dequeue behaviors.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Piotr Bronowski <piotrx.bronowski@intel.com>
Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agocryptodev: change crypto symmetric vector structure
Fan Zhang [Sun, 11 Oct 2020 00:38:51 +0000 (01:38 +0100)]
cryptodev: change crypto symmetric vector structure

This patch updates ``rte_crypto_sym_vec`` structure to add
support for both cpu_crypto synchronous operation and
asynchronous raw data-path APIs. The patch also includes
AESNI-MB and AESNI-GCM PMD changes, unit test changes and
documentation updates.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agocrypto/aesni_mb: support AES-CCM-256
Pablo de Lara [Fri, 9 Oct 2020 12:18:59 +0000 (12:18 +0000)]
crypto/aesni_mb: support AES-CCM-256

This patch adds support for AES-CCM-256 when using AESNI-MB

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
4 years agocrypto/aesni_mb: support Chacha20-Poly1305
Pablo de Lara [Fri, 9 Oct 2020 12:05:21 +0000 (12:05 +0000)]
crypto/aesni_mb: support Chacha20-Poly1305

Add support for Chacha20-Poly1305 AEAD algorithm.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
4 years agocrypto/aesni_mb: fix GCM digest size check
Pablo de Lara [Fri, 9 Oct 2020 12:05:20 +0000 (12:05 +0000)]
crypto/aesni_mb: fix GCM digest size check

GCM digest sizes should be between 1 and 16 bytes.

Fixes: 7b2d4706c90e ("crypto/aesni_mb: support newer library version only")
Cc: stable@dpdk.org
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
4 years agocrypto/aesni_mb: fix CCM digest size check
Pablo de Lara [Fri, 9 Oct 2020 12:05:19 +0000 (12:05 +0000)]
crypto/aesni_mb: fix CCM digest size check

Digest size for CCM was being checked for other algorithms
apart from CCM.

Fixes: c4c0c312a823 ("crypto/aesni_mb: check for invalid digest size")
Cc: stable@dpdk.org
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>