dpdk.git
2 years agocryptodev: expose driver interface as internal
Akhil Goyal [Tue, 10 Aug 2021 19:50:20 +0000 (01:20 +0530)]
cryptodev: expose driver interface as internal

The rte_cryptodev_pmd.* files are for drivers only and should be
private to DPDK, and not installed for app use.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2 years agoexamples/fips_validation: remove illegal usage of API
Akhil Goyal [Tue, 10 Aug 2021 19:50:19 +0000 (01:20 +0530)]
examples/fips_validation: remove illegal usage of API

Some of the cryptodev APIs are not allowed to be used
by application directly. Hence removing the usage of
1. queue_pair_release: it is not required, as configure
   of queue pair release the previous queue pairs and the
   dev is not directly exposed to application, hence cannot
   use its ops from app.
2. rte_cryptodev_stop: it can be used directly without
   checking if the device is started or not.
3. rte_cryptodev_pmd_destroy: application should use
   rte_cryptodev_close instead.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2 years agocryptodev: rename function to check device validity
Akhil Goyal [Tue, 10 Aug 2021 19:50:18 +0000 (01:20 +0530)]
cryptodev: rename function to check device validity

The API rte_cryptodev_pmd_is_valid_dev, can be used
by the application as well as PMD to check whether
the device is valid or not. Hence, _pmd is removed
from the API.
The applications and drivers which use this API are
also updated.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2 years agotest/crypto: remove illegal PMD header include
Akhil Goyal [Tue, 10 Aug 2021 19:50:17 +0000 (01:20 +0530)]
test/crypto: remove illegal PMD header include

rte_cryptodev_pmd.h is an interface between
driver and library and it is mentioned in the
file that application cannot use it directly.
Hence, removing the include.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2 years agocrypto/cnxk: add feature flag for cn9k lookaside IPsec
Archana Muniganti [Tue, 7 Sep 2021 14:21:03 +0000 (19:51 +0530)]
crypto/cnxk: add feature flag for cn9k lookaside IPsec

Update device feature flag to support lookaside IPsec for
cn9k.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Archana Muniganti <marchana@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agocrypto/cnxk: update tailroom requirement
Archana Muniganti [Tue, 7 Sep 2021 14:21:02 +0000 (19:51 +0530)]
crypto/cnxk: update tailroom requirement

Update min tailroom to reflect IPsec additions.
PMD crypto_cn9k & crypto_cn10k would have packet
grow into tailroom post IPsec processing.

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agocrypto/cnxk: add cn9k lookaside IPsec datapath
Archana Muniganti [Tue, 7 Sep 2021 14:21:01 +0000 (19:51 +0530)]
crypto/cnxk: add cn9k lookaside IPsec datapath

Adds support for cn9k lookaside enqueue and dequeue
operations.

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agocrypto/cnxk: add cn9k security session operations
Archana Muniganti [Tue, 7 Sep 2021 14:21:00 +0000 (19:51 +0530)]
crypto/cnxk: add cn9k security session operations

Add security session ops.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Archana Muniganti <marchana@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agocommon/cnxk: add cn9k IPsec microcode defines
Archana Muniganti [Tue, 7 Sep 2021 14:20:59 +0000 (19:50 +0530)]
common/cnxk: add cn9k IPsec microcode defines

Microcode IE opcodes support IPsec operations. Add defines
and structs defined by microcode.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Archana Muniganti <marchana@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agocrypto/cnxk: add cn9k security context
Archana Muniganti [Tue, 7 Sep 2021 14:20:58 +0000 (19:50 +0530)]
crypto/cnxk: add cn9k security context

Add security ctx in cn9k crypto PMD.

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agocrypto/openssl: fix CCM processing 0 length source
Ciara Power [Mon, 23 Aug 2021 12:47:14 +0000 (12:47 +0000)]
crypto/openssl: fix CCM processing 0 length source

When given a source length 0 for CCM, the encryption and decryption
functions did not call the EVP_ENCRYPTUPDATE/EVP_DECRYPTUPDATE functions
with a src and dst, causing some FIPS validation failures for testcases
with PLen=0:

process_openssl_auth_encryption_ccm() line 1131:
Process openssl auth encryption ccm failed

Fixes: 1a4998dc4d94 ("crypto/openssl: support AES-CCM")
Cc: stable@dpdk.org
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agotest/crypto: refactor scheduler workers init
Rebecca Troy [Thu, 2 Sep 2021 11:54:16 +0000 (11:54 +0000)]
test/crypto: refactor scheduler workers init

Previously, the scheduler unit test only created and attached 1 or 2
AESNI-MB cryptodev PMDs as workers if less than 2 AESNI-MB PMDs had
already been initialized.

This commit changes this to always create and attach 2 new AESNI-MB
cryptodev PMDs, regardless of previously initialized AESNI-MB PMDs.

Signed-off-by: Rebecca Troy <rebecca.troy@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agoconfig/ppc: ignore GCC 11 psabi warnings
David Christensen [Thu, 2 Sep 2021 23:53:26 +0000 (16:53 -0700)]
config/ppc: ignore GCC 11 psabi warnings

Suppress the gcc warning "note: the layout of aggregates containing
vectors with 4-byte alignment has changed in GCC 5" on POWER systems
by setting "-Wno-psabi".  Warning was originally added to gcc in
commit https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=9832651 to warn
of the vector alignment changes introduced in GCC 5.  Older gcc
versions forced vector alignment to 16 bytes due to requirements for
POWER 6 and earlier CPUs, but these restrictions don't apply to CPUs
supported by DPDK.

Bugzilla ID: 739
Cc: stable@dpdk.org
Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
2 years agoeal/ppc: ignore GCC 10 stringop-overflow warnings
David Christensen [Thu, 2 Sep 2021 22:15:14 +0000 (15:15 -0700)]
eal/ppc: ignore GCC 10 stringop-overflow warnings

Suppress gcc warning "warning: writing 16 bytes into a region of
size 0" for users of the POWER rte_memcpy() function.  Existing
rte_memcpy() code takes different code paths based on the actual
size of the move so the warning is already addressed. See also
commit b5b3ea803e47 ("eal/x86: ignore gcc 10 stringop-overflow warnings")

Cc: stable@dpdk.org
Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
2 years agocrypto/cnxk: add dual submission in cn9k
Anoob Joseph [Thu, 2 Sep 2021 12:22:34 +0000 (17:52 +0530)]
crypto/cnxk: add dual submission in cn9k

Submit two instructions with one LMTST operation.
Also updated dequeue path to have local var for constants.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: support ucode API change
Vidya Sagar Velumuri [Thu, 2 Sep 2021 12:22:33 +0000 (17:52 +0530)]
crypto/cnxk: support ucode API change

Add support for API changes in ucode 1.13

Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: remove redundant assignment
Anoob Joseph [Thu, 2 Sep 2021 12:22:32 +0000 (17:52 +0530)]
crypto/cnxk: remove redundant assignment

The assignment to -1 is not required. Remove the same.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: remove redundant memcpy of IV for ZUC
Anoob Joseph [Thu, 2 Sep 2021 12:22:31 +0000 (17:52 +0530)]
crypto/cnxk: remove redundant memcpy of IV for ZUC

Swap is not required for ZUC. Update IV updation
sequence to remove the redundant swap in case of ZUC.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: remove redundant SNOW3G decrypt
Anoob Joseph [Thu, 2 Sep 2021 12:22:30 +0000 (17:52 +0530)]
crypto/cnxk: remove redundant SNOW3G decrypt

The opcode for encryption & decryption is the
same and single routine would be able to handle
both encryption and decryption operations.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocommon/cnxk: update to v1.16 ucc codes
Anoob Joseph [Thu, 2 Sep 2021 12:22:29 +0000 (17:52 +0530)]
common/cnxk: update to v1.16 ucc codes

Update to v1.16 microcode completion codes.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocommon/cnxk: update to v1.13 ZUC API
Vidya Sagar Velumuri [Thu, 2 Sep 2021 12:22:28 +0000 (17:52 +0530)]
common/cnxk: update to v1.13 ZUC API

Add support for ZUC API change in ucode 1.13

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/mlx5: fix timestamp format configuration
Michael Baum [Sun, 5 Sep 2021 08:04:15 +0000 (11:04 +0300)]
crypto/mlx5: fix timestamp format configuration

This patch adds support for the timestamp format settings for
the receive and send queues. If the firmware version x.30.1000
or above is installed and the NIC timestamps are configured
with the real-time format, the default zero values for newly
added fields cause the queue creation to fail.

The patch queries the timestamp formats supported by the hardware
and sets the configuration values in queue context accordingly.

Fixes: 6152534e211e ("crypto/mlx5: support queue pairs operations")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agoevent/cnxk: add cn10k crypto adapter fast path
Shijith Thotton [Thu, 2 Sep 2021 14:41:56 +0000 (20:11 +0530)]
event/cnxk: add cn10k crypto adapter fast path

Set crypto adapter enqueue and dequeue operations for CN10K.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: add cn10k crypto adapter fast path
Shijith Thotton [Thu, 2 Sep 2021 14:41:55 +0000 (20:11 +0530)]
crypto/cnxk: add cn10k crypto adapter fast path

Added crypto adapter enqueue and dequeue operations for CN10K.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agoevent/cnxk: add cn9k crypto adapter fast path
Shijith Thotton [Thu, 2 Sep 2021 14:41:54 +0000 (20:11 +0530)]
event/cnxk: add cn9k crypto adapter fast path

Set crypto adapter enqueue and dequeue operations for CN9K.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: add cn9k crypto adapter fast path
Shijith Thotton [Thu, 2 Sep 2021 14:41:53 +0000 (20:11 +0530)]
crypto/cnxk: add cn9k crypto adapter fast path

Added crypto adapter enqueue and dequeue operations for CN9K.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agoevent/cnxk: add crypto adapter operations
Shijith Thotton [Thu, 2 Sep 2021 14:41:52 +0000 (20:11 +0530)]
event/cnxk: add crypto adapter operations

Added eventdev ops required to initialize crypto adapter.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocommon/cnxk: add function to check CPT IQ is full
Shijith Thotton [Thu, 2 Sep 2021 14:41:51 +0000 (20:11 +0530)]
common/cnxk: add function to check CPT IQ is full

Added flow control based check to determine CPT IQ is full.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agoevent/cnxk: add macros to set eventdev operations
Shijith Thotton [Thu, 2 Sep 2021 14:41:50 +0000 (20:11 +0530)]
event/cnxk: add macros to set eventdev operations

Added a common macro to set eventdev enqueue and
dequeue operations to reduce code.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agonet/cnxk: add flag to show CPT can enqueue events
Shijith Thotton [Thu, 2 Sep 2021 14:41:49 +0000 (20:11 +0530)]
net/cnxk: add flag to show CPT can enqueue events

CPT can be told to submit events to SSO upon completion.
Crypto adapter uses this feature and the new flag can be
used to optimize receive path in those cases.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/octeontx2: fix unaligned access to device memory
Danny Patel [Fri, 27 Aug 2021 05:33:58 +0000 (11:03 +0530)]
crypto/octeontx2: fix unaligned access to device memory

Use otx2_mbox_memcpy() instead of memcpy() to prevent unaligned access.

Fixes: a0645ed0d6ef ("crypto/octeontx2: discover capabilities")
Cc: stable@dpdk.org
Signed-off-by: Danny Patel <dannyp@marvell.com>
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
2 years agocompress/mlx5: fix leak on QP setup failure
Michael Baum [Tue, 31 Aug 2021 20:39:41 +0000 (23:39 +0300)]
compress/mlx5: fix leak on QP setup failure

The QP setup function allocates buffer for its
opaque MR and register it into MR structure.

After buffer allocation and before MR registration,
it tries allocate MR Btree.
When the MR Btree allocation fails, the buffer was
not freed what caused a memory leak.

Allocate the MR Btree before buffer alloction.

Fixes: 0165bccdb45f ("compress/mlx5: add memory region management")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agocommon/cnxk: make IPsec defines common
Archana Muniganti [Wed, 1 Sep 2021 10:19:30 +0000 (15:49 +0530)]
common/cnxk: make IPsec defines common

Make IPsec defines common and remove redundant macros.

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: support cn10k transport mode
Tejasree Kondoj [Wed, 1 Sep 2021 10:19:28 +0000 (15:49 +0530)]
crypto/cnxk: support cn10k transport mode

Adding support for cn10k lookaside IPsec transport mode.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: make IPsec verify functions common
Archana Muniganti [Wed, 1 Sep 2021 10:19:27 +0000 (15:49 +0530)]
crypto/cnxk: make IPsec verify functions common

IPsec verify functions can be made common which can
be used for both cn9k and cn10k

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: use rlen from CPT result with lookaside
Tejasree Kondoj [Wed, 1 Sep 2021 10:19:26 +0000 (15:49 +0530)]
crypto/cnxk: use rlen from CPT result with lookaside

Use rlen from CPT result with lookaside operations

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: remove redundant code
Tejasree Kondoj [Wed, 1 Sep 2021 10:19:25 +0000 (15:49 +0530)]
crypto/cnxk: remove redundant code

Removing redundant code in cn10k lookaside IPsec.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: support lookaside IPsec
Tejasree Kondoj [Wed, 1 Sep 2021 10:19:24 +0000 (15:49 +0530)]
crypto/cnxk: support lookaside IPsec

Added lookaside IPsec AES-CBC-HMAC-SHA1
support to cnxk driver.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocommon/cnxk: add hash generation API
Tejasree Kondoj [Wed, 1 Sep 2021 10:19:23 +0000 (15:49 +0530)]
common/cnxk: add hash generation API

Adding functions for hash generation that can be used
in hmac opad/ipad calculation.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agodevargs: parse global device syntax
Xueming Li [Tue, 13 Apr 2021 03:14:12 +0000 (03:14 +0000)]
devargs: parse global device syntax

When parsing a devargs, try to parse using the global device syntax
first. Fallback on legacy syntax on error.

Example of new global device syntax:
 -a bus=pci,addr=82:00.0/class=eth/driver=mlx5,dv_flow_en=1

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Gaetan Rivet <grive@u256.net>
2 years agobus: add device arguments name parsing
Xueming Li [Tue, 13 Apr 2021 03:14:11 +0000 (03:14 +0000)]
bus: add device arguments name parsing

For device probe and iterator, devargs name was key information,
parsed by rte_devargs_parse. In legacy parser, devargs name was
extracted after bus name:
  bus:name,kv_arguments,,,
Example:
  pci:83:00.0,arguments,...
  vdev:pcap0,...

To be compatible with legacy parser, this patch introduces new
bus driver API devargs_parse to parse devargs and update devargs name.
If devargs_parse not implemented by bus driver, the new syntax parser
rte_devargs_layers_parse default will resolve devargs name from bus's
"name" argument.

Different bus driver might choose different keys from arguments with
unified format. The PCI bus implementation fills the devargs name with
the "addr" argument, example:
 -a bus=pci,addr=83:00.0/class=eth/driver=mlx5,...
    name: 0000:03:00.0
 -a bus=vdev,name=pcap0/class=eth/driver=pcap,...
    name:pcap0

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Gaetan Rivet <grive@u256.net>
2 years agoapp/testpmd: fix dump of Tx offload flags
Nithin Dabilpuram [Mon, 16 Aug 2021 07:09:42 +0000 (12:39 +0530)]
app/testpmd: fix dump of Tx offload flags

Fix verbose mode dump for Tx to dump tx offload flags instead of
Rx offload flags.

Fixes: d862c45b5955 ("app/testpmd: move dumping packets to a separate function")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Raslan Darawsheh <rasland@nvidia.com>
2 years agoapp/testpmd: fix check without outer checksum
Nithin Dabilpuram [Mon, 16 Aug 2021 07:09:41 +0000 (12:39 +0530)]
app/testpmd: fix check without outer checksum

Donot use outer metadata when neither outer ip checksum nor
outer udp checksum is enabled. PMD's will ignore the
outer_l2_len and outer_l3_len in cases where none of
the outer checksum is enabled and hence only l2_len and
l3_len will be used to calculate the offsets for L2 or L3
header.

Fixes: 3c32113a1aac ("app/testpmd: fix IPv6 tunnel checksum")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
2 years agonet/bnxt: fix VNIC config error in Rx queue start
Ajit Khaparde [Tue, 24 Aug 2021 01:58:20 +0000 (18:58 -0700)]
net/bnxt: fix VNIC config error in Rx queue start

During port stop/start sequence the Thor FW is returning an error.
This is because we are deriving incorrect active Rx ring and using
that wrong information in the bnxt_vnic_rss_cfg HWRM command.

Fix it by using the rx_queue_state from eth_dev.

Fixes: 0105ea1296c9 ("net/bnxt: support runtime queue setup")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix crash after port stop/start
Somnath Kotur [Mon, 23 Aug 2021 15:44:53 +0000 (21:14 +0530)]
net/bnxt: fix crash after port stop/start

On chips like Thor, port stop/start sequence could result in a crash
in the application. This is because of false detection of a bad
opaque in the Rx completion and the subsequent kicking-in of the ring
reset code to recover from the condition.
The root cause being that the port stop/start would result in the HW
starting with fresh values, while the driver internal tracker variable
`rx_next_cons` is still pointing to a stale value.
Fix this by resetting rx_next_cons to 0 in bnxt_init_one_rx_ring()

Fixes: 03c8f2fe111c ("net/bnxt: detect bad opaque in Rx completion")
Cc: stable@dpdk.org
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2 years agoapp/testpmd: use per-core variable in flowgen
Zhihong Wang [Fri, 13 Aug 2021 08:05:48 +0000 (16:05 +0800)]
app/testpmd: use per-core variable in flowgen

Use per-core variable for flow indexing to solve cache contention in
multi-core scenarios.

Signed-off-by: Zhihong Wang <wangzhihong.wzh@bytedance.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
2 years agoapp/testpmd: record Rx and dropped stats in flowgen
Zhihong Wang [Fri, 13 Aug 2021 08:05:47 +0000 (16:05 +0800)]
app/testpmd: record Rx and dropped stats in flowgen

Call inc_rx_burst_stats for rx operation, and record fwd_dropped.

Signed-off-by: Zhihong Wang <wangzhihong.wzh@bytedance.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
2 years agoapp/testpmd: use existing checksum API in flowgen engine
Zhihong Wang [Fri, 13 Aug 2021 08:05:46 +0000 (16:05 +0800)]
app/testpmd: use existing checksum API in flowgen engine

Use the rte_ipv4_cksum API to replace local ip_sum implementation.

Signed-off-by: Zhihong Wang <wangzhihong.wzh@bytedance.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
2 years agoapp/testpmd: fix Tx retry in flowgen engine
Zhihong Wang [Fri, 13 Aug 2021 08:05:45 +0000 (16:05 +0800)]
app/testpmd: fix Tx retry in flowgen engine

Fix tx_pkt number in tx retry logic.

Fixes: bf56fce1fb45 ("app/testpmd: add retry option")
Cc: stable@dpdk.org
Signed-off-by: Zhihong Wang <wangzhihong.wzh@bytedance.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
2 years agonet/mlx5: update GENEVE TLV option matching
Shiri Kuzin [Mon, 31 May 2021 11:45:43 +0000 (14:45 +0300)]
net/mlx5: update GENEVE TLV option matching

The GENEVE TLV option matching is done using a flex parser.

Recent update in firmware, requires that in order to match on the
GENEVE TLV option the "geneve_tlv_option_0_exist" bit should be set.

Add the new "geneve_tlv_option_0_exist" setting when translating the
GENEVE TLV option item.

Signed-off-by: Shiri Kuzin <shirik@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/bnxt: update ring group after ring stop start
Ajit Khaparde [Mon, 2 Aug 2021 04:44:30 +0000 (21:44 -0700)]
net/bnxt: update ring group after ring stop start

A Rx ring stop start sequence may result in the FW returning
a different set of Rx ring and AGG ring IDs. If the ring group
is not updated with the new IDs, the HW sees the host driver using
incorrect BD types for the Rx ring and AGG ring. This can cause
the chip to go into a bad state or encounter RE_flush issue
or leak mbufs in the HW.

Fix this by issuing a bnxt_hwrm_ring_grp_free() and an
bnxt_hwrm_ring_grp_alloc() to refresh the ring group information.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/mlx5: fix eCPRI matching
Dmitry Kozlyuk [Mon, 9 Aug 2021 14:26:46 +0000 (17:26 +0300)]
net/mlx5: fix eCPRI matching

When an ETH or VLAN flow item directly preceding ECPRI (i. e. a pattern
for eCPRI over Ethernet) did not specify the eCPRI protocol, matches
were not restricted to eCPRI traffic. For example, "eth / ecpri / end"
pattern behaved as "eth / end". Implicitly add Ethernet type condition,
so that "eth / ecpri / end" behaves as "eth type is 0xAEFE / end".

Fixes: daa38a8924a0 ("net/mlx5: add flow translation of eCPRI header")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix mbuf replenishment check for zipped CQE
Alexander Kozyrev [Wed, 4 Aug 2021 06:23:16 +0000 (09:23 +0300)]
net/mlx5: fix mbuf replenishment check for zipped CQE

A core dump is being generated with the following call stack:
0 _mm256_storeu_si256 (__A=..., __P=0x80)
1 rte_mov32 (src=0x2299c9140 "", dst=0x80)
2 rte_memcpy_aligned (n=60, src=0x2299c9140, dst=0x80)
3 rte_memcpy (n=60, src=0x2299c9140, dst=0x80)
4 mprq_buf_to_pkt (strd_cnt=1, strd_idx=0, buf=0x2299c8a00, len=60,
pkt=0x18345f0c0, rxq=0x18345ef40)
5 rxq_copy_mprq_mbuf_v (rxq=0x18345ef40, pkts=0x7f76e0ff6d18, pkts_n=5)
6 rxq_burst_mprq_v (rxq=0x18345ef40, pkts=0x7f76e0ff6d18, pkts_n=46,
err=0x7f76e0ff6a28, no_cq=0x7f76e0ff6a27)
7 mlx5_rx_burst_mprq_vec (dpdk_rxq=0x18345ef40, pkts=0x7f76e0ff6a88,
pkts_n=128)
8 rte_eth_rx_burst (nb_pkts=128, rx_pkts=0x7f76e0ff6a88,
queue_id=<optimized out>, port_id=<optimized out>)

This crash is caused by an attempt to copy previously uncompressed CQEs
into non-allocated mbufs. There is a check to make sure we only use
allocated mbufs in the rxq_burst_mprq_v() function, but it is done only
before the main processing loop. Leftovers of compressed CQEs session are
handled before that loop and may lead to the mbufs overflow as seen.

Move the check for replenished mbufs up to protect uncompressed CQEs
session leftovers from accessing non-allocated mbufs after the
mlx5_rx_mprq_replenish_bulk_mbuf() function is invoked.

Bugzilla ID: 746
Fixes: 0f20acbf5eda ("net/mlx5: implement vectorized MPRQ burst")
Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix RSS expansion for inner tunnel VLAN
Lior Margalit [Tue, 3 Aug 2021 18:13:22 +0000 (21:13 +0300)]
net/mlx5: fix RSS expansion for inner tunnel VLAN

The RSS expansion algorithm is using a graph to find the possible
expansion paths. The VLAN item in the flow pattern requires special
treatment, because it should not be added implicitly by the expansion
algorithm.  If the flow pattern ends with ETH item, the pattern will be
expanded with IPv4 and IPv6.
For example:
testpmd> flow create ... eth / end actions rss / end
ETH END
ETH IPV4 END
ETH IPV6 END
If a VLAN item follows the ETH item in the flow pattern, the pattern
will be expanded with IPv4 and IPv6 following the VLAN item.
For example:
testpmd> flow create ... eth / vlan / end actions rss level 1 / end
ETH VLAN END
ETH VLAN IPV4 END
ETH VLAN IPV6 END

The case of inner tunnel VLAN item was not taken care of so the flow
pattern did not expand with IPv6 and IPv4 as expected.
Example with inner VLAN:
testpmd> flow create ... / vxlan / eth / vlan / end actions rss level 2
/ end
The current result of the expansion alg:
ETH IPV6 UDP VXLAN ETH VLAN END
The expected result of the expansion alg:
ETH IPV6 UDP VXLAN ETH VLAN END
ETH IPV6 UDP VXLAN ETH VLAN IPV4 END
ETH IPV6 UDP VXLAN ETH VLAN IPV6 END

The fix is to introduce a new flag to set on a graph expansion node
to apply the 'explicit' behavior, meaning the node is not added to
the expanded pattern, if it is not found in the flow pattern, but the
expansion alg can go deeper to its next nodes.

Fixes: c7870bfe09dc ("ethdev: move RSS expansion code to mlx5 driver")
Cc: stable@dpdk.org
Signed-off-by: Lior Margalit <lmargalit@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/txgbe: fix L4 port mask in flow director
Jiawen Wu [Thu, 12 Aug 2021 02:00:20 +0000 (10:00 +0800)]
net/txgbe: fix L4 port mask in flow director

Remove bit reverse for TCP/UDP port mask, since it causes the flows with
some TCP/UDP ports to disobey the flow director rules.

Fixes: ea230dda16ad ("net/txgbe: configure flow director filter")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/txgbe: fix reading SFP module SFF-8472 data
Jiawen Wu [Thu, 12 Aug 2021 02:00:19 +0000 (10:00 +0800)]
net/txgbe: fix reading SFP module SFF-8472 data

Fix the I2C target address selection to read SFP module's SFF-8472 data.

Fixes: 8f09fb4642fa ("net/txgbe: add module identify")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/txgbe: fix link status when device stopped
Jiawen Wu [Thu, 12 Aug 2021 02:00:18 +0000 (10:00 +0800)]
net/txgbe: fix link status when device stopped

When device is stopped, the port status is not changed and only the Tx
laser is turned off by hardware design.

Fixes: 0c061eadec59 ("net/txgbe: add link status change")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/nfp: rename files for consistency
Heinrich Kuhn [Thu, 29 Jul 2021 13:47:11 +0000 (15:47 +0200)]
net/nfp: rename files for consistency

Rename the nfp_net.c file to nfp_common as it now contains functions
common to VF and PF functionality. Rename the header file too to be
consistent. Also remove the "net" naming from the _ctrl and _logs files
for consistency across the PMD.

Signed-off-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
2 years agonet/nfp: move PF functions into its own file
Heinrich Kuhn [Thu, 29 Jul 2021 13:47:10 +0000 (15:47 +0200)]
net/nfp: move PF functions into its own file

Similar to the last commit, this changeset moves all the PF specific
functions to a new file called nfp_ethdev.c.

Signed-off-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
2 years agonet/nfp: move VF functions into its own file
Heinrich Kuhn [Thu, 29 Jul 2021 13:47:09 +0000 (15:47 +0200)]
net/nfp: move VF functions into its own file

Move any ethdev functionality specific to VF devices into a new file
called nfp_ethdev_vf.c.

Signed-off-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
2 years agonet/nfp: move common function prototypes
Heinrich Kuhn [Thu, 29 Jul 2021 13:47:08 +0000 (15:47 +0200)]
net/nfp: move common function prototypes

The majority of "ethdev" type functions are used for both PF devices and
VF devices. Prototype these functions in the nfp_net_pmd header file in
preparation of splitting PF and VF specific functions.

Signed-off-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
2 years agonet/nfp: move CPP bridge to separate file
Heinrich Kuhn [Thu, 29 Jul 2021 13:47:07 +0000 (15:47 +0200)]
net/nfp: move CPP bridge to separate file

This commit moves the CPP bridge logic to a separate file. A new
corresponding header file is also created.

Signed-off-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
2 years agonet/nfp: move datapath functions to their own file
Heinrich Kuhn [Thu, 29 Jul 2021 13:47:06 +0000 (15:47 +0200)]
net/nfp: move datapath functions to their own file

Create a new rxtx file and move the Rx/Tx functions to this file. This
commit will also move the needed shared functions to the nfp_net_pmd.h
file as needed.

Signed-off-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
2 years agonet/nfp: split datapath structs into separate file
Heinrich Kuhn [Thu, 29 Jul 2021 13:47:05 +0000 (15:47 +0200)]
net/nfp: split datapath structs into separate file

This change splits out the rx/tx specific structs and defines from the
main nfp_net_pmd header file and into their own header file.

Signed-off-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
2 years agonet/hns3: support set link up/down for PF
Huisong Li [Mon, 26 Jul 2021 10:59:40 +0000 (18:59 +0800)]
net/hns3: support set link up/down for PF

This patch adds set link up/down feature. RxTx datapath and link status
will be disabled when dev_set_link_down() is called, and can be enabled by
dev_start() or dev_set_link_up().

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: add Tx start/stop multi-process handling
Huisong Li [Mon, 26 Jul 2021 10:59:39 +0000 (18:59 +0800)]
net/hns3: add Tx start/stop multi-process handling

Currently, hns3 PMD has supported start/stop RxTx datapath request message
between the primary and secondary processes. However, there are some cases
only to start/stop Tx datapath. This patch adds start/stop Tx datapath
request for MP.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/nfp: remove compile time log
Ferruh Yigit [Tue, 18 May 2021 10:41:15 +0000 (11:41 +0100)]
net/nfp: remove compile time log

Logging should be converted to dynamic log.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>
2 years agonet/ice: fix bandwidth config size in memory copy
Ting Xu [Tue, 27 Jul 2021 10:55:08 +0000 (18:55 +0800)]
net/ice: fix bandwidth config size in memory copy

The memory size of bandwidth config parameters is not set correctly in
memory copy process, which leads to the wrong values. This patch fixed
the size to the correct value.

Fixes: 3a6bfc37eaf4 ("net/ice: support QoS config VF bandwidth in DCF")
Cc: stable@dpdk.org
Signed-off-by: Ting Xu <ting.xu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice: fix max entry number for ACL normal priority
Simei Su [Wed, 28 Jul 2021 02:24:29 +0000 (10:24 +0800)]
net/ice: fix max entry number for ACL normal priority

For ACL, there are three entry priorities: LOW, NORMAL, HIGH.
Low priority starts from the highest index, 25% of total entries;
Normal priority starts from the highest index, 50% of total entries;
High priority starts from the lowest index, 25% of total entries.

Each TCAM block has 512 entries of 40 bits. Currently, there is a
scenario in which multiple TCAM blocks are cascaded. It means the
total entries are 512. The default priority is NORMAL, so the max
entry is 256, not 512. This patch changes the max entry number for
NORMAL priority.

Fixes: 40d466fa9f76 ("net/ice: support ACL filter in DCF")
Cc: stable@dpdk.org
Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice/base: increase maximum TCAM/PTG per profile
Qi Zhang [Tue, 10 Aug 2021 02:51:40 +0000 (10:51 +0800)]
net/ice/base: increase maximum TCAM/PTG per profile

For GTPoGRE protocol in AVF FDIR/RSS, the number of associated PTGs
of one Profile may exceed the defined ICE_MAX_PTG_PER_PROFILE and
ICE_MAX_TCAM_PER_PROFILE. In those cases, some PTGs may be missed,
and therefore, the related and received packets will not have hash
values. Thus, this patch updated the ICE_MAX_PTG_PER_PROFILE and
ICE_MAX_TCAM_PER_PROFILE to a larger number 64.

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: fix typo in comment
Qi Zhang [Tue, 10 Aug 2021 02:51:39 +0000 (10:51 +0800)]
net/ice/base: fix typo in comment

Correct spelling of word data instead of date.

Fixes: 453d087ccaff ("net/ice/base: add common functions")
Cc: stable@dpdk.org
Signed-off-by: Kevin Scott <kevin.c.scott@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: rename and add setter for unicast MAC flag
Qi Zhang [Tue, 10 Aug 2021 02:51:38 +0000 (10:51 +0800)]
net/ice/base: rename and add setter for unicast MAC flag

Rename ucast_shared to umac_shared, as "umac" is a more widely
used shorthand for "unicast MAC".

Also add a helper function to set this flag. This helper is
expected to be called by core drivers.

Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: support flow director for GTPU UL/DL with QFI
Qi Zhang [Tue, 10 Aug 2021 02:51:37 +0000 (10:51 +0800)]
net/ice/base: support flow director for GTPU UL/DL with QFI

Enable Flow Director filtering for GTPU UL/DL QFI field matching.

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: enable jumbo frame during HW init
Qi Zhang [Tue, 10 Aug 2021 02:51:36 +0000 (10:51 +0800)]
net/ice/base: enable jumbo frame during HW init

Call ice_aq_set_mac_cfg in ice_hw_init to enable jumbo frame support.

Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: support RSS for IPv4/L4 checksum
Qi Zhang [Tue, 10 Aug 2021 02:51:35 +0000 (10:51 +0800)]
net/ice/base: support RSS for IPv4/L4 checksum

The IPv4/TCP/UDP/SCTP header checksum fields are defined in this
patch and can be used as RSS input sets.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: support flow director for GTPoGRE
Qi Zhang [Tue, 10 Aug 2021 02:51:34 +0000 (10:51 +0800)]
net/ice/base: support flow director for GTPoGRE

Enable Flow Director filtering for GTPoGRE inner/outer fields
matching.

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: enable NVM update reset capabilities
Qi Zhang [Tue, 10 Aug 2021 02:51:33 +0000 (10:51 +0800)]
net/ice/base: enable NVM update reset capabilities

Add logic to parse capabilities relating to the firmware update reset
requirements. This includes both capability 0x76, which informs the
driver if the firmware can sometimes skip PCIe resets, and 0x77, which
informs the driver if the firmware might potentially restrict EMP
resets.

For capability 0x76, if the number is 1, the firmware will report the
required reset level for a given update as part of its response to the
last command sent to program the NVM bank. (Otherwise, if the firmware
does not support this capability then it will always send a 0 in the
field of the response).

For capability 0x77, if the number is 1, the firmware will report when
EMP reset is available as part of the response to the command for
switching flash banks. (Otherwise, if the firmware does not support this
capability, it will always send a 0 in the field of the response
message).

These capabilities are required to implement immediate firmware
activation. If the capabilities are set, software can read the response
data and determine what reset level is required to activate the firmware
image. If only an EMP reset is required, and if the EMP reset is not
restricted by firmware, then the driver can issue an EMP reset to
immediately activate the new firmware.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: support RSS for GTPoGRE
Qi Zhang [Tue, 10 Aug 2021 02:51:32 +0000 (10:51 +0800)]
net/ice/base: support RSS for GTPoGRE

Support RSS for GTPoGRE inner fields hash.

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: support flow director for GTPU EH inner IPv6
Qi Zhang [Tue, 10 Aug 2021 02:51:31 +0000 (10:51 +0800)]
net/ice/base: support flow director for GTPU EH inner IPv6

Support FDIR filtering for IPV4_GTPU_EH_IPV6 with inner
IPV6/UDP/TCP fields matching.

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: support RSS for GRE tunnel
Qi Zhang [Tue, 10 Aug 2021 02:51:30 +0000 (10:51 +0800)]
net/ice/base: support RSS for GRE tunnel

Support RSS of inner headers for GRE tunnel packet.

Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: support flow director for GRE tunnel
Qi Zhang [Tue, 10 Aug 2021 02:51:29 +0000 (10:51 +0800)]
net/ice/base: support flow director for GRE tunnel

Support IPV4_GRE and IPV6_GRE with inner IPV4/IPV6/UDP/TCP for
FDIR.

Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: support TC nodes PIR configuration
Qi Zhang [Tue, 10 Aug 2021 02:51:28 +0000 (10:51 +0800)]
net/ice/base: support TC nodes PIR configuration

TC nodes CIR configuration is not supported. In order to configure PIR,
the corresponding adminq command should not include the flag for CIR.
Since the TC node info has this flag by default, it is supposed to delete
this flag for TC nodes before sending the adminq command.

Signed-off-by: Ting Xu <ting.xu@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: refine MAC rule adding
Qi Zhang [Tue, 10 Aug 2021 02:51:27 +0000 (10:51 +0800)]
net/ice/base: refine MAC rule adding

Move replay_pre_init function to interface.
Add further MAC rules, despite unicast address is already on list.

Signed-off-by: Marcin Domagala <marcinx.domagala@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: add new AQ description
Qi Zhang [Tue, 10 Aug 2021 02:51:26 +0000 (10:51 +0800)]
net/ice/base: add new AQ description

Add ice_aqc_sw_gpio struct to ice_aq_desc
This change allows us to do SW_GPIO AQ cmd transactions
over ice_aq_send_cmd() interface.

Signed-off-by: Siddaraju DH <siddaraju.dh@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: implement firmware debug dump
Qi Zhang [Tue, 10 Aug 2021 02:51:25 +0000 (10:51 +0800)]
net/ice/base: implement firmware debug dump

Basic implementation of FW Debug Dump.

Signed-off-by: Marcin Domagala <marcinx.domagala@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: add E810T check function
Qi Zhang [Tue, 10 Aug 2021 02:51:24 +0000 (10:51 +0800)]
net/ice/base: add E810T check function

Add function ice_is_e810t() to be able to distinguish if hardware is
E810T based or not.

Signed-off-by: Michal Michalik <michal.michalik@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: support starting PHY in bypass mode
Qi Zhang [Tue, 10 Aug 2021 02:51:23 +0000 (10:51 +0800)]
net/ice/base: support starting PHY in bypass mode

After starting the timestamping block, hardware begins calculating
precise offsets through a process of vernier calibration. This process
measures the effective phase offset of the various internal clocks used
in the PHY.

Once hardware completes these measurements, the P_REG_TX_OV_STATUS and
P_REG_RX_OV_STATUS registers are updated to indicate that the hardware
offset measurements are done.

This process does not happen immediately, but requires that at least one
packet be sent or received in order for the offset in that direction to
be calculated.

This poses a problem in some setups, because software expects the first
packet sent to be timestamped. This most often occurs if the clock time
is set by an application during startup. This set time command triggers
a PHY restart. Because of this, the timestamping block is reset, and
timestamps are not enabled until vernier calibration is complete. Since
this process won't complete until at least one packet is sent through
the PHY, timestamps of the very first packet sent will not be obtained.

This can result in the application failing due to missing timestamps.

To avoid this, allow starting the PHY in bypass mode. This mode enables
timestamps immediately, and skips adding the precise offset measurement.
This reduces the accuracy of the timestamp slightly, but ensures that we
get a reasonable value for the first packet.

The driver can continue monitoring the P_REG_TX_OV_STATUS and
P_REG_RX_OV_STATUS registers and exit bypass mode once the total
calibration is completed. In this way, once calibration is complete, the
timestamps will have the precise offset, but we do not break
applications which expect to be able to timestamp immediately.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: clarify comments on checking PFC mode
Qi Zhang [Tue, 10 Aug 2021 02:51:22 +0000 (10:51 +0800)]
net/ice/base: clarify comments on checking PFC mode

Rework the comment around checking PFC mode to make it clear why we are
checking the mode after sending the command.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: implement Vernier calibration for E822
Qi Zhang [Tue, 10 Aug 2021 02:51:21 +0000 (10:51 +0800)]
net/ice/base: implement Vernier calibration for E822

Move the implementation of Vernier calibration from Linux core ice_ptp.c
into the shared ice_ptp_hw.c file.

This implementation was recently refactored in Linux, so the move should
be verbatim with the latest Linux code that we had implemented.

This includes a new constant table with pre-determined values based on
link speed, new functions to aide in reading the multi-register values
from the PHY, functions to program the PAR/PCS conversion ratios, and
the UIX conversion ratios, functions to program the total Tx and Rx
offset after vernier calibration in the hardware completes, and finally
a function to start and stop the PHY timestamping block.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: print human-friendly PHY types
Qi Zhang [Tue, 10 Aug 2021 02:51:20 +0000 (10:51 +0800)]
net/ice/base: print human-friendly PHY types

Add functions to print PHY types in human-friendly form

Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: add accessors to get/set time reference
Qi Zhang [Tue, 10 Aug 2021 02:51:19 +0000 (10:51 +0800)]
net/ice/base: add accessors to get/set time reference

The E822 device clock might come from a variety of different sources,
called TIME_REFs. The firmware reports the current TIME_REF as part of
its function capabilities, which the driver caches when it loads.

Add an accessor function to look up the current TIME_REF from the
capabilities. This reduces line length significantly and also avoids
a tight coupling to the capabilities structure.

In some cases, TIME_REF might change at run time. This can occur in the
event that the CGU registers are updated. When this happens, its
possible that the capabilities structure can be out of date until the
capabilities are re-read.

Add a setter function to update the TIME_REF when this occurs. The
driver can call this function after updating the CGU to ensure that the
TIME_REF in the capabilities structure is up to date, without needing to
re-read the entire capabilities from firmware.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: add clock initialization function
Qi Zhang [Tue, 10 Aug 2021 02:51:18 +0000 (10:51 +0800)]
net/ice/base: add clock initialization function

Before the device PTP hardware clock can be initialized, some steps must
be taken by the driver. This includes writing some registers and
initializing the PHY.

Some of these steps are distinct depending on the device type (E810 or
E822). Additionally, a future change will introduce more steps for E822
devices to program the Clock Generation Unit.

Introduce ice_ptp_init_phc as well as device-specific sub-functions for
e810 and e822 devices.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: add timestamp masks
Qi Zhang [Tue, 10 Aug 2021 02:51:17 +0000 (10:51 +0800)]
net/ice/base: add timestamp masks

Adding macros for shift and masking of the lower timestamp work in the
Rx flex descriptor. The LSB of the timestamp-low word indicates the
validity of the timestamp while the rest 7 bits contain the timestamp.

Signed-off-by: Vignesh Sridhar <vignesh.sridhar@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: change dummy packets with VLAN
Qi Zhang [Tue, 10 Aug 2021 02:51:16 +0000 (10:51 +0800)]
net/ice/base: change dummy packets with VLAN

Ethertype was traded as VLAN tpid in dummy packets with VLAN.
This led to a problem when user wanted to add filter for VLAN and
ethertype.

Change ice_vlan_hdr to reflect correct order of VLAN fields in
packets (VLAN tpid, VLAN id). Correct all dummy packets with VLAN.
Move VLAN fields before ethertype and change offsets. Leave values
from dummy packets unchanged as they fit to new VLAN layout.

Order of offsets in ice_prot_ext_tbl_entry for VLAN protocol should
reflect order of fields in ice_vlan_hdr. However, hardware doesn't
support matching on all tpid. This should be done by matching on
packet flags. There is no FV word with protocol for VLAN and offset
2. Because of that, adding vlan tpid with not zero mask will lead
to error in creating recipe.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: add ethertype IPv6 check for dummy packet
Qi Zhang [Tue, 10 Aug 2021 02:51:15 +0000 (10:51 +0800)]
net/ice/base: add ethertype IPv6 check for dummy packet

In order to support switch rule for ethertype filter
with ipv6 ethertype id, it has to check ethertype and
then find a proper dummy packet. There was a silent
assumption that packet is ipv4, unless src or dst ipv6
address is specified in a flow.

Signed-off-by: Grzegorz Nitka <grzegorz.nitka@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: add functions for device clock control
Qi Zhang [Tue, 10 Aug 2021 02:51:14 +0000 (10:51 +0800)]
net/ice/base: add functions for device clock control

The ice hardware supports exposing a hardware clock for high precision
timestamping. This is primarily intended for accelerating the Precision
Time Protocol.

Add several low level functions intended to be used as the basis for
enabling the device clock, and ensuring that the port timers are
synchronized properly.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/ice/base: add IEEE 1588 capability probing
Qi Zhang [Tue, 10 Aug 2021 02:51:13 +0000 (10:51 +0800)]
net/ice/base: add IEEE 1588 capability probing

Parse 1588 timesync capability during device capability probing.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
2 years agonet/i40e: fix clang warning on non-x86
Ruifeng Wang [Fri, 30 Jul 2021 09:32:58 +0000 (17:32 +0800)]
net/i40e: fix clang warning on non-x86

Build on aarch64 with clang-10 has warning:
i40e_rxtx.c:3228:1:
warning: unused function 'get_avx_supported' [-Wunused-function]

The function is used in x86 specific path. Moved it into ifdef
to fix build on non-x86.

Fixes: c30751afc360 ("net/i40e: fix data path selection in secondary process")
Cc: stable@dpdk.org
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice: fix priority of DCF switch rule
Wenjun Wu [Mon, 2 Aug 2021 07:25:17 +0000 (15:25 +0800)]
net/ice: fix priority of DCF switch rule

This patch fixes the reversed priority of DCF switch rule. Priority 0
and 1 are supported, and priority 0 should be the highest priority.

Fixes: 2321e34c23b3 ("net/ice: support flow priority for DCF switch filter")
Cc: stable@dpdk.org
Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/i40e: reduce L1 cache misses in NEON Rx
Feifei Wang [Fri, 23 Jul 2021 03:10:49 +0000 (11:10 +0800)]
net/i40e: reduce L1 cache misses in NEON Rx

For N1 platform, packet mbuf load and descs load are hot spots to limit
the performance for "desc_to_ptype_v" and "desc_to_olflags_v" functions
in i40e rx NEON path. This is because packet mbuf and descs are evicted
from l1d-cache to l2d-cache.

To reduce l1d-cache-misses and improve the performance, change the code
order and move "desc_to_ptype_v" and "desc_to_olflags_v" functions
forward to the location, where packet mbuf and descs are just loaded.

Test Result:
dpdk:21.08-rc1
gcc-9
For n1sdp, the patch improves the performance by 1.8%.
For thunderx2, no performance changes.

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>