dpdk.git
3 years agodrivers/mempool: mark internal NXP symbols
Hemant Agrawal [Fri, 15 May 2020 09:47:43 +0000 (15:17 +0530)]
drivers/mempool: mark internal NXP symbols

This patch moves the internal symbols to INTERNAL sections
so that any change in them is not reported as ABI breakage.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agobus/dpaa: mark internal symbols
Hemant Agrawal [Fri, 15 May 2020 09:47:42 +0000 (15:17 +0530)]
bus/dpaa: mark internal symbols

This patch moves the internal symbols to INTERNAL sections
so that any change in them is not reported as ABI breakage.

This patch also removes two symbols, which are not to be exported.
rte_dpaa_mem_ptov  - static inline in the headerfile
fman_ccsr_map_fd - local shared variable.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agobus/fslmc: mark internal symbols
Hemant Agrawal [Fri, 15 May 2020 09:47:41 +0000 (15:17 +0530)]
bus/fslmc: mark internal symbols

This patch moves the internal symbols to INTERNAL sections
so that any change in them is not reported as ABI breakage.

This patch also removes two symbols, which were not used
anywhere else i.e. rte_fslmc_vfio_dmamap & dpaa2_get_qbman_swp

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agocommon/dpaax: mark internal symbols
Hemant Agrawal [Fri, 15 May 2020 09:47:40 +0000 (15:17 +0530)]
common/dpaax: mark internal symbols

This patch moves the internal symbols to INTERNAL sections
so that any change in them is not reported as ABI breakage.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agotelemetry: fix buffer overrun if max bytes read
Ciara Power [Tue, 12 May 2020 15:29:02 +0000 (16:29 +0100)]
telemetry: fix buffer overrun if max bytes read

If 1024 bytes were received over the socket, this caused
buffer_recvf[bytes] to overrun the array. The size of the buffer - 1 is
now passed to the read function.

Coverity issue: 358442
Fixes: b80fe1805eee ("telemetry: introduce backward compatibility")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
3 years agotelemetry: check socket creation failure
Ciara Power [Tue, 12 May 2020 15:29:01 +0000 (16:29 +0100)]
telemetry: check socket creation failure

The return value from the socket function is now checked, as it can
return a negative value on error.

Coverity issue: 358443
Fixes: b80fe1805eee ("telemetry: introduce backward compatibility")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
3 years agotelemetry: close socket on connection failure
Ciara Power [Tue, 12 May 2020 15:29:00 +0000 (16:29 +0100)]
telemetry: close socket on connection failure

The socket fd is now being closed when the connection fails.

Coverity issue: 358444
Fixes: b80fe1805eee ("telemetry: introduce backward compatibility")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
3 years agotelemetry: fix error checking for strchr function
Ciara Power [Tue, 12 May 2020 15:28:59 +0000 (16:28 +0100)]
telemetry: fix error checking for strchr function

The strchr function return was not being checked which could lead to
NULL deferencing later in the function.

Coverity issue: 358438, 358445
Fixes: b80fe1805eee ("telemetry: introduce backward compatibility")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
3 years agotelemetry: keep threads separate from data plane
Ciara Power [Tue, 12 May 2020 15:28:58 +0000 (16:28 +0100)]
telemetry: keep threads separate from data plane

The threads for listening on the telemetry sockets are control threads
and should be separated from those on the data plane. Since telemetry
cannot use the rte_ctrl_thread_create() API, as it does not depend on
EAL, we pass the ctrl thread cpu_set to telemetry init and use it
directly to ensure that telemetry cannot interfere with the data plane
threads.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
3 years agokvargs: fix strcmp helper documentation
Gaetan Rivet [Wed, 13 May 2020 10:42:29 +0000 (12:42 +0200)]
kvargs: fix strcmp helper documentation

Minor error, "unless" was used instead of "unlike".

Fixes: a3b85476c51e ("kvargs: add generic string matching callback")
Cc: stable@dpdk.org
Signed-off-by: Gaetan Rivet <grive@u256.net>
3 years agodoc: fix typos in ABI policy
Gaetan Rivet [Wed, 13 May 2020 10:43:01 +0000 (12:43 +0200)]
doc: fix typos in ABI policy

Some errors in the document:

  * API instead of ABI once.

Some typos:

  * __rte_depreciated instead of __rte_deprecated.
  * missing ```` around value.
  * inconsistent reference to major ABI version, most
    of the time described without the minor appended, except once.

Verbosity and grammar:

  * Long sentences that would be better cut short.
  * Comma abuse.
  * 'May' used where 'can' seems more fitting.

I'm not a native speaker though, so grain of salt applies.

Fixes: fdf7471cccb8 ("doc: introduce major ABI versions")
Cc: stable@dpdk.org
Signed-off-by: Gaetan Rivet <grive@u256.net>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agotest: cleanup when leaving bitrate and latency tests
Hemant Agrawal [Tue, 19 May 2020 10:52:58 +0000 (16:22 +0530)]
test: cleanup when leaving bitrate and latency tests

Both bitratestats_autotest latency test initializes the metrics library.
It should be cleaned during exit.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: David Marchand <david.marchand@redhat.com>
3 years agometrics: fix library cleanup
Hemant Agrawal [Tue, 19 May 2020 10:52:57 +0000 (16:22 +0530)]
metrics: fix library cleanup

metrics_initialized shall be reset in deinit function.
This is currently causing issue in running metrics_autotest
multiple times.

Fixes: 07c1b6925b65 ("telemetry: invert dependency on metrics library")

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: David Marchand <david.marchand@redhat.com>
3 years agopci: explain how empty strings are rejected in DBDF
Gaetan Rivet [Wed, 13 May 2020 10:47:51 +0000 (12:47 +0200)]
pci: explain how empty strings are rejected in DBDF

Empty strings are forbidden as input to rte_pci_addr_parse().
It is explicitly enforced in BDF parsing as parsing the bus
field will immediately fail. The related check is commented.

It is implicitly enforced in DBDF parsing, as the domain would be
parsed to 0 without error, but the check `end[0] != ':'` afterward
will return -EINVAL.

Enforcing consistency between parsers by reading the code is not helped
by this property being implicit. Add a comment to explain.

Signed-off-by: Gaetan Rivet <grive@u256.net>
Acked-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
3 years agopci: reject negative values in PCI id
Gaetan Rivet [Wed, 13 May 2020 10:47:50 +0000 (12:47 +0200)]
pci: reject negative values in PCI id

The function strtoul will not return ERANGE if the input is negative, as
one might expect.

   0000:-FFFFFFFFFFFFFFFB:00.0

is not a better way to write 0000:05:00.0.
To simplify checking for '-', forbid using spaces before the field value.

   0000: 00:   2c.0

Should not be accepted.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Gaetan Rivet <grive@u256.net>
Acked-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
3 years agopci: accept 32-bit domain numbers
Darek Stojaczyk [Tue, 12 May 2020 13:30:57 +0000 (15:30 +0200)]
pci: accept 32-bit domain numbers

The parsing code was bailing on domains greater than UINT16_MAX,
but domain numbers like that are still valid and present on some systems.
One example is Intel VMD (Volume Management Device), which acts somewhat
as a software-managed PCI switch and its upstream linux driver assigns
all downstream devices a PCI domain of 0x10000.

Parsing a BDF like 10000:01:00.0 was failing before. To fix it, increase
the upper limit of domain number to UINT32_MAX. This matches the size of
struct rte_pci_addr->domain (uint32).

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Acked-by: Gaetan Rivet <grive@u256.net>
3 years agonet/igc/base: update copyright
Xiaoyun Li [Mon, 18 May 2020 09:13:05 +0000 (17:13 +0800)]
net/igc/base: update copyright

Clarify Intel copyright and update the date to 2020.

Fixes: 8cb7c57d9b3c ("net/igc: support device initialization")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agonet/ice/base: update copyright
Xiaoyun Li [Mon, 18 May 2020 09:07:33 +0000 (17:07 +0800)]
net/ice/base: update copyright

Clarify Intel copyright and update the date to 2020.

Fixes: f3202a097f12 ("net/ice/base: add ACL module")
Fixes: a90fae1d0755 ("net/ice/base: add admin queue structures and commands")
Fixes: 2d2bdc026737 ("net/ice/base: add various headers")
Fixes: c9e37832c95f ("net/ice/base: rework on bit ops")
Fixes: 453d087ccaff ("net/ice/base: add common functions")
Fixes: 6c1f26be50a2 ("net/ice/base: add control queue information")
Fixes: 1082f786547e ("net/ice/base: support DCB")
Fixes: 6aa406714a65 ("net/ice/base: add device IDs for Intel E800 Series NICs")
Fixes: bd984f155f49 ("net/ice/base: support FDIR")
Fixes: 51d04e4933e3 ("net/ice/base: add flexible pipeline module")
Fixes: 2d2bdc026737 ("net/ice/base: add various headers")
Fixes: aa1cd410fa64 ("net/ice/base: add flow module")
Fixes: 51c7f09f3f81 ("net/ice/base: add registers for Intel E800 Series NIC")
Fixes: 64e9587d5629 ("net/ice/base: add structures for Rx/Tx queues")
Fixes: 557fa75bcf55 ("net/ice/base: add code to work with the NVM")
Fixes: b06499a43394 ("net/ice/base: update Boot Configuration Section read of NVM")
Fixes: 04b8ec1ea807 ("net/ice/base: add protocol structures and defines")
Fixes: 2a27e0a16d29 ("net/ice/base: add sideband queue info")
Fixes: 93e84b1bfc92 ("net/ice/base: add basic Tx scheduler")
Fixes: c7dd15931183 ("net/ice/base: add virtual switch code")
Fixes: a240ff50505b ("net/ice/base: add basic structures")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agocommon/iavf: update copyright
Xiaoyun Li [Mon, 18 May 2020 08:45:46 +0000 (16:45 +0800)]
common/iavf: update copyright

Clarify Intel copyright and update the date to 2020.

Fixes: 317862a4e44f ("net/iavf: replace license text with SPDX tag")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agonet/i40e/base: update copyright
Xiaoyun Li [Mon, 18 May 2020 08:44:06 +0000 (16:44 +0800)]
net/i40e/base: update copyright

Clarify Intel copyright and update the date to 2020.

Fixes: 547be3f01f55 ("net/i40e/base: replace license text with SPDX tag")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agonet/ixgbe/base: update copyright
Xiaoyun Li [Mon, 18 May 2020 08:41:36 +0000 (16:41 +0800)]
net/ixgbe/base: update copyright

Clarify Intel copyright and update the date to 2020.

Fixes: 9db3087f4f77 ("net/ixgbe/base: update the license")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agoapp/testpmd: fix DCB set
Ting Xu [Tue, 12 May 2020 10:13:56 +0000 (10:13 +0000)]
app/testpmd: fix DCB set

When set DCB in testpmd, there is a segmentation fault. It is
because the local variable rss_conf in get_eth_dcb_conf()
is not cleared, so that the pointer member variable rss_key has
a random address, which leads to an error in the following
processing. This patch initialized the local variable rss_conf
to avoid this situation.

Fixes: ac7c491c3fec ("app/testpmd: fix DCB config")
Cc: stable@dpdk.org
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agonet/mlx5: fix port action resource initialization
Bing Zhao [Fri, 15 May 2020 11:44:44 +0000 (19:44 +0800)]
net/mlx5: fix port action resource initialization

After memory optimization, the organization of some resources are
changed from pointer based LIST to the index based ILIST. A lot of
code parts are touched due to such change.
Some static code checking and analysis tool will complain and raise
a false warning on the uninitialized value using. E.g. in the port
action registering function, the stack variable will be used as the
right value with some uninitialized field to initialize variable
allocated from heap. But indeed, it is not an error because all the
fields set with the uninitialized value will be overwritten in the
following code part and the macros. All the fields will be used as
the left value explicitly.
It makes no sense to clear the stack variable to 0 in this case,
and the extra memset will introduce some cycles overhead. It just
needs to ignore the false warning from the tool, if any.

Fixes: f3faf9ea1185 ("net/mlx5: convert port id action to indexed")

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Reviewed-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
3 years agonet/mlx5: fix port action assert timing
Bing Zhao [Fri, 15 May 2020 11:44:43 +0000 (19:44 +0800)]
net/mlx5: fix port action assert timing

After memory optimization, some action object handles are changed to
index to save the overhead. Assertion in debug mode will be helpful
for trouble shooting.
In the current implementation, only one port action is supported in
switchdev mode for one device flow. In debug mode, an assertion will
be used to check the if the port action is none, and it should
locate before the port action resource registration but not after
it. The action index in the handle should be 0 before registration.
Or else it will always cause a failure because the port action is
registered and the index is not 0.

Fixes: f3faf9ea1185 ("net/mlx5: convert port id action to indexed")

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Reviewed-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
3 years agocommon/mlx5: fix netlink buffer allocation from stack
Viacheslav Ovsiienko [Thu, 14 May 2020 07:11:12 +0000 (07:11 +0000)]
common/mlx5: fix netlink buffer allocation from stack

The buffer size to receive netlink reply messages is relatively
large (32K), and it is allocated on the stack and it might
break in application is using smaller per-thread stacks.
This patch allocates temporary buffer from heap.

Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")
Cc: stable@dpdk.org
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agocommon/mlx5: fix MAC addresses assert
Viacheslav Ovsiienko [Thu, 14 May 2020 07:09:02 +0000 (07:09 +0000)]
common/mlx5: fix MAC addresses assert

The MLX5 device supports up to MLX5_MAX_MAC_ADDRESSES (256) MAC
addresses.  The code flushes all MAC devices.

If DPDK is compiled with MLX5_DEBUG this would an assert.
PANIC in mlx5_nl_mac_addr_flush():
line 775 assert "(size_t)(i) < sizeof(mac_own) * 8" failed

The root cause is that mac_own is a pointer and is being used as
a bitmap array. The sizeof(mac_own) would therefore be 64 but the
number of entries to be flushed would be 256.

There is a whole set of asserts in MLX5 netlink code with
the same bug; that should just be changed into proper error checks.

Fixes: 8e46d4e18f09 ("common/mlx5: improve assert control")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/mlx5: fix shared flow counter lookup
Suanming Mou [Fri, 15 May 2020 08:36:03 +0000 (16:36 +0800)]
net/mlx5: fix shared flow counter lookup

Currently, the shared counter search uses the wrong nested index which
is used by the pool index. The incorrect nested index using causes the
search go to incorrect counter pool is not existed.

Add the counter index to fix the incorrect nested use case.

Fixes: 4001d7ad26d4 ("net/mlx5: change Direct Verbs counter to indexed")

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/mlx5: fix doorbell bitmap management offsets
Bing Zhao [Fri, 15 May 2020 08:13:58 +0000 (16:13 +0800)]
net/mlx5: fix doorbell bitmap management offsets

The doorbell record is organized with page and bitmap. When some new
doorbell needs to be associated with a queue, the bit will be set
in the bitmap to indicate the corresponding doorbell occupied. A
counter is used to record the number of doorbell occupied to speed
up the searching.
If the number reaches the maximal value of a pre-defined number of a
page, a new page will be allocated. If not, then the bitmap will be
checked to find a free one.
The LSHIFT and OR (AND NOT) operations are used to update the bitmap
of a page. But 1 will be treated as a signed integer when compiling.
When the shift number is 31, the shifted value will be considered as
negative. Then a wrong extension will be done when setting it to a
64-bits variable. All the upper 32-bits will be set to 1 by such
extension.
Then a wrong offset value will be calculated because of this. The
next 64 bits will be also treated as the bitmap and get corrupted
through the bit set operation.
The immediate value 1 needs to be used as 64 bits width explicitly.

Fixes: 21cae8580fd0 ("net/mlx5: allocate door-bells via DevX")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/mlx5: fix Verbs counter pool allocation
Suanming Mou [Fri, 15 May 2020 00:48:15 +0000 (08:48 +0800)]
net/mlx5: fix Verbs counter pool allocation

When create the Verbs flows with counter, randomly SEGSEV will also
comes. The reason is that the counter pool memory is not allocated
sufficiently and initialized correctly in Verbs case.

As the mlx5_flow_counter array member is moved out of the counter pool
struct, the counter pool memory layout currently contain implicitly
with mlx5_flow_counter, mlx5_age_param(if the pool is an age pool),
mlx5_flow_counter_ext(if the pool is a none batch pool). When allocate
the pool memory, the pool size should be calculated based on the pool
type accordingly.

Currently, for Verbs counter pool, both mlx5_flow_counter and
mlx5_flow_counter_ext need to be taken into account in the pool size.
And the pool type should also be initialized as CNT_POOL_TYPE_EXT.

This patch add the missing size and type for the Verbs counter pool.

Fixes: 8d93c830e450 ("net/mlx5: modify ext-counter memory allocation")

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/iavf: fix RXDID setting for Rx queue
Ting Xu [Mon, 11 May 2020 15:27:48 +0000 (15:27 +0000)]
net/iavf: fix RXDID setting for Rx queue

CVL kernel PF configures all reserved queues for VF, including
Rx queue RXDID. The number of reserved queues is the maximum
between Tx and Rx queues. If the number of the enabled Rx queues
is less than that of reserved queues, required RXDID will only
be set for those enabled, but default value (0) is set for others.
However, RXDID 0 (legacy 16byte descriptor) is not supported now,
PF will return error when configuring those disabled VF queues.

In this patch, required RXDID is set for all reserved Rx queues,
no matter enabled or not. In this way, PF will configure Rx
queues correctly without reporting error.

Fixes: b8b4c54ef9b0 ("net/iavf: support flexible Rx descriptor in normal path")

Signed-off-by: Ting Xu <ting.xu@intel.com>
Tested-by: Xiaoxiao Zeng <xiaoxiaox.zeng@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
3 years agonet/i40e: fix queue region in RSS flow
Shougang Wang [Fri, 15 May 2020 07:32:31 +0000 (07:32 +0000)]
net/i40e: fix queue region in RSS flow

This patch fixes the issue that the queue region does not
take effect due to incorrectly setting the flow type.

Fixes: ecad87d22383 ("net/i40e: move RSS to flow API")
Cc: stable@dpdk.org
Signed-off-by: Shougang Wang <shougangx.wang@intel.com>
Reviewed-by: Jeff Guo <jia.guo@intel.com>
Tested-by: Hailin Xu <hailinx.xu@intel.com>
Tested-by: Lunyuan Cui <lunyuanx.cui@intel.com>
3 years agonet/ice/base: fix flow director rule passthrough mode
Simei Su [Fri, 8 May 2020 01:22:22 +0000 (09:22 +0800)]
net/ice/base: fix flow director rule passthrough mode

This patch adds support for FDIR passthrough mode. When FDIR rule
hits, FDIR just forward this packet to the next stage filter.

Fixes: 55daca4e45fc ("net/ice/base: change function to static")

Signed-off-by: Simei Su <simei.su@intel.com>
Tested-by: Xiaoxiao Zeng <xiaoxiaox.zeng@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
3 years agonet/bnxt: fix allocation of ULP context
Mike Baucom [Tue, 12 May 2020 20:25:28 +0000 (16:25 -0400)]
net/bnxt: fix allocation of ULP context

Fix to allocate bnxt ulp context when TRUFLOW is enabled.
This patch reduces the size of struct bnxt.

Fixes: 313ac35ac701 ("net/bnxt: support ULP session manager init")

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: fix storing MAC address twice
Kalesh AP [Fri, 15 May 2020 05:04:36 +0000 (22:04 -0700)]
net/bnxt: fix storing MAC address twice

We are maintaining MAC address twice which is unnecessary.
This patch removes the copy which helps reduce size of bnxt structure.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: fix using RSS config struct
Ajit Khaparde [Fri, 15 May 2020 11:25:11 +0000 (04:25 -0700)]
net/bnxt: fix using RSS config struct

There is no need to maintain local copy.
This helps reduce the size of the bnxt structure.

Fixes: fcc0aa1edc10 ("net/bnxt: add RSS hash configuration")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
3 years agonet/bnxt: fix allocation of PF info struct
Ajit Khaparde [Fri, 15 May 2020 11:10:41 +0000 (16:40 +0530)]
net/bnxt: fix allocation of PF info struct

Fixes: 804e746c7b73 ("net/bnxt: add hardware resource manager init code")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
3 years agonet/bnxt: fix allocation of link info struct
Ajit Khaparde [Fri, 15 May 2020 11:05:15 +0000 (16:35 +0530)]
net/bnxt: fix allocation of link info struct

Dynamically alloc link info structure.

Fixes: 1d0704f4d793 ("net/bnxt: add device configure operation")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
3 years agonet/bnxt: fix allocation of flow stat related structs
Ajit Khaparde [Fri, 15 May 2020 08:31:59 +0000 (14:01 +0530)]
net/bnxt: fix allocation of flow stat related structs

Consolidate flow stat related structs for performance improvement.
The intention of this patch is to reduce the size struct bnxt which
had grown because of recent changes and was impacting performance.

Fixes: 02a95625fe9c ("net/bnxt: add flow stats in extended stats")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
3 years agonet/bnxt: fix allocation of COS queue info
Ajit Khaparde [Fri, 15 May 2020 18:07:32 +0000 (11:07 -0700)]
net/bnxt: fix allocation of COS queue info

Fixes: 698aa7e95325 ("net/bnxt: add code to determine the Tx COS queue")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
3 years agonet/bnxt: fix allocation of LED config info
Ajit Khaparde [Fri, 15 May 2020 07:01:51 +0000 (00:01 -0700)]
net/bnxt: fix allocation of LED config info

Dynamically allocate bnxt_led_cfg.
This helps reduces memory footprint of struct bnxt.

Fixes: bb81e07323bb ("net/bnxt: support LED on/off")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
3 years agonet/bnxt: fix error log for command timeout
Ajit Khaparde [Fri, 15 May 2020 06:37:34 +0000 (23:37 -0700)]
net/bnxt: fix error log for command timeout

Log the command sequence number to aid debug in case of a
FW command timeout.

Fixes: 804e746c7b73 ("net/bnxt: add hardware resource manager init code")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
3 years agonet/qede: fix port reconfiguration
Rasesh Mody [Fri, 15 May 2020 06:34:19 +0000 (23:34 -0700)]
net/qede: fix port reconfiguration

This patch fixes deallocation of all fastpath resources unconditionally,
when re-configuring the device. When re-allocating resources PMD depends
on application to explicitly setup the Rx/Tx queue.

Deallocation of all the resources is only required if the Rx/Tx queue
configuration changes. For other scenarios like KNI MTU change we'd keep
existing configuration.

Fixes: 8de0c4201926 ("net/qede: fix odd number of queues usage in 100G mode")
Fixes: dd28bc8c6ef4 ("net/qede: fix VF port creation sequence")
Cc: stable@dpdk.org
Signed-off-by: Rasesh Mody <rmody@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
3 years agonet/qede: fix assignment of Rx/Tx handlers
Rasesh Mody [Fri, 15 May 2020 06:34:18 +0000 (23:34 -0700)]
net/qede: fix assignment of Rx/Tx handlers

Fix to assign dummy Rx/Tx handlers in dev_stop.
For MTU set, assignment of the appropriate Rx/Tx handlers will be
handled by dev_start/dev_stop.

Fixes: 81f8804992c9 ("net/qede: enhance Rx CPU utilization")
Fixes: 8de0c4201926 ("net/qede: fix odd number of queues usage in 100G mode")
Cc: stable@dpdk.org
Signed-off-by: Rasesh Mody <rmody@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
3 years agodoc: add aarch64 generic counter in profiling guide
Dharmik Thakkar [Fri, 8 May 2020 22:38:29 +0000 (22:38 +0000)]
doc: add aarch64 generic counter in profiling guide

Add a separate section for low-resolution generic counter
for ARM64 profiling methods.

Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoapp/testpmd: print fractional part in CPU cycles
Dharmik Thakkar [Fri, 8 May 2020 22:38:26 +0000 (22:38 +0000)]
app/testpmd: print fractional part in CPU cycles

Change printing of CPU cycles/packet to include fractional part for
accurateness.

Example:

Without patch:
CPU cycles/packet=14
(total cycles=4899533541 / total RX packets=343031966)

With patch:
CPU cycles/packet=14.28
(total cycles=4899533541 / total RX packets=343031966)

Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
3 years agoapp/testpmd: print clock with CPU cycles per packet
Dharmik Thakkar [Fri, 8 May 2020 22:38:25 +0000 (22:38 +0000)]
app/testpmd: print clock with CPU cycles per packet

On aarch64 platforms, the cycles are counted using either a
low-resolution generic counter or a high-resolution PMU cycle counter.
Print the clock frequency along with CPU cycles/packet to identify which
cycle counter is being used.

Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
3 years agoexamples/vhost_blk: fix not null-terminated buffer
Jin Yu [Fri, 15 May 2020 14:45:02 +0000 (22:45 +0800)]
examples/vhost_blk: fix not null-terminated buffer

In vhost_blk_bdev_construct: The string buffer may not have
a null terminator if the source string's length is equal to
the buffer size.

Fixes: 91d3e2d42997 ("examples/vhost_blk: refactor to increase readability")

Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
3 years agonet/virtio: fix unexpected event after reconnect
Marvin Liu [Fri, 15 May 2020 02:35:07 +0000 (10:35 +0800)]
net/virtio: fix unexpected event after reconnect

Event notification should be disabled after virtqueue initialization and
enabled by calling rte_eth_dev_rx_intr_enable later. When virtio user
device reconnecting to vhost, virtqueue_disable_intr should be called to
disable event notification.

Fixes: 6ebbf4109f35 ("net/virtio-user: fix packed ring server mode")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Acked-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agonet/virtio: remove duplicated AVX512 check
Marvin Liu [Tue, 12 May 2020 13:18:06 +0000 (21:18 +0800)]
net/virtio: remove duplicated AVX512 check

Runtime checks for vectorized datapath are organized into device
configuration function. Remove duplicated check in device init
function.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agovhost: handle mbuf allocation failure
Sivaprasad Tummala [Fri, 8 May 2020 11:17:51 +0000 (16:47 +0530)]
vhost: handle mbuf allocation failure

vhost buffer allocation is successful for packets that fit
into a linear buffer. If it fails, vhost library is expected
to drop the current packet and skip to the next.

The patch fixes the error scenario by skipping to next packet.
Note: Drop counters are not currently supported.

Fixes: c3ff0ac70acb ("vhost: improve performance by supporting large buffer")
Cc: stable@dpdk.org
Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agonet/i40e: fix boundary check in RSS config
Chenxu Di [Thu, 14 May 2020 07:07:20 +0000 (07:07 +0000)]
net/i40e: fix boundary check in RSS config

This patch fixes (out-of-bounds read) coverity issue.

Coverity issue: 357699, 357694
Fixes: feaae285b342 ("net/i40e: support hash configuration in RSS flow")

Signed-off-by: Chenxu Di <chenxux.di@intel.com>
Reviewed-by: Jeff Guo <jia.guo@intel.com>
3 years agonet/hinic: optimize RSS RETA table update
Xiaoyun Wang [Thu, 14 May 2020 09:29:19 +0000 (17:29 +0800)]
net/hinic: optimize RSS RETA table update

Before updating RSS indirection table, firstly determine whether
rq num in RETA table is legal, if it is invalid(such as exceeding
the maximum rxq num), driver will not update hw indirection
table and return fail.

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
3 years agonet/hinic: update code style
Xiaoyun Wang [Thu, 14 May 2020 09:29:18 +0000 (17:29 +0800)]
net/hinic: update code style

The patch modifies the comments of structures or functions, and adds
space for comments, removes extra empty lines and adjusts the
print level for VF branches in one sdk interface.

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
3 years agonet/hinic: fix Tx mbuf length while copying
Xiaoyun Wang [Thu, 14 May 2020 09:29:17 +0000 (17:29 +0800)]
net/hinic: fix Tx mbuf length while copying

When copy a mbuf to a new dst_mbuf, the pkt_len member of
dst_mbuf needs to be updated.

Fixes: 076221c8fe1d ("net/hinic: add Rx/Tx")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
3 years agonet/hinic: fix queues resource free
Xiaoyun Wang [Thu, 14 May 2020 09:29:16 +0000 (17:29 +0800)]
net/hinic: fix queues resource free

Adds tx_queues and rx_queues non-null judgment before free tx or
rx resources, because some app may set tx_queues or rx_queues to
be null before call free resource interfaces, which may cause
a segfault.

Fixes: 64727024d2fd ("net/hinic: add device initialization")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
3 years agonet/vmxnet3: handle bad host framing
Stephen Hemminger [Tue, 12 May 2020 20:40:03 +0000 (13:40 -0700)]
net/vmxnet3: handle bad host framing

The VMXNet3 protocol has a start-of-packet (SOP) and end-of-packet (EOP)
marker. If there was a bug where mbuf arrived without SOP the code that
chains the mbuf would dereference a null pointer.
Also, record any mbuf's dropped in statistics.

Although did the initial code no longer have access to VMware.
Compile tested only!

Coverity issue: 124563
Fixes: 8ee787ce80a8 ("vmxnet3: remove asserts that confuse coverity")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Yong Wang <yongwang@vmware.com>
3 years agodoc: remove limitation for mlx5 TSO over VM
Raslan Darawsheh [Wed, 13 May 2020 11:00:31 +0000 (14:00 +0300)]
doc: remove limitation for mlx5 TSO over VM

Removing the current limitation for TSO over VM
due to the fact that mlx5 currently support it.

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Asaf Penso <asafp@mellanox.com>
3 years agonet/mlx5: fix VLAN flow action with wildcard VLAN item
Dekel Peled [Wed, 13 May 2020 19:49:19 +0000 (22:49 +0300)]
net/mlx5: fix VLAN flow action with wildcard VLAN item

Previous patch added support of VLAN item without VLAN ID value,
i.e. using wildcard VLAN item, to match VLAN with any VLAN ID.
The implication on VLAN actions was not taken into consideration.
VLAN actions (e.g. push vlan) use the VLAN ID value in the VLAN item,
and expect it to be valid.

This patch updates function flow_dev_get_vlan_info_from_items() to
check the VLAN item contents before trying to use it.

Fixes: 92818d839e8e ("net/mlx5: fix match on empty VLAN item in DV mode")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
3 years agonet/mlx5: fix flow counter container resize
Matan Azrad [Tue, 12 May 2020 12:52:13 +0000 (12:52 +0000)]
net/mlx5: fix flow counter container resize

The design of counter container resize used double buffer algorithm in
order to synchronize between the query thread to the control thread.
When the control thread detected resize need, it created new bigger
buffer for the counter pools in a new container and change the container
index atomically.
In case the query thread had not detect the previous resize before a new
one need was detected by the control thread, the control thread returned
EAGAIN to the flow creation API used a COUNT action.

The rte_flow API doesn't allow unblocked commands and doesn't expect to
get EAGAIN error type.

So, when a lot of flows were created between 2 different periodic
queries, 2 different resizes might try to be created and caused EAGAIN
error.
This behavior may blame flow creations.

Change the synchronization way to use lock instead of double buffer
algorithm.

The critical section of this lock is very small, so flow insertion
rate should not be decreased.

Fixes: ebbac312e448 ("net/mlx5: resize a full counter container")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
3 years agodoc: add required Linux capabilities in mlx5 guide
Thomas Monjalon [Mon, 2 Mar 2020 23:08:53 +0000 (00:08 +0100)]
doc: add required Linux capabilities in mlx5 guide

If running DPDK as non-root, some extra capabilities may be required.
The Mellanox devices, using a bifurcated model with Linux drivers,
have some specific requirements summarized in mlx5 PMD guide.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Raslan Darawsheh <rasland@mellanox.com>
3 years agonet/qede: fix link state configuration
Rasesh Mody [Thu, 14 May 2020 04:09:02 +0000 (21:09 -0700)]
net/qede: fix link state configuration

Move link state enable/disable to dev_start() and dev_stop()
respectively. This will ensure when devices are stopped,
link status will be appropriately shown as down.

Fixes: dd28bc8c6ef4 ("net/qede: fix VF port creation sequence")
Cc: stable@dpdk.org
Signed-off-by: Shahed Shaikh <shshaikh@marvell.com>
Signed-off-by: Rasesh Mody <rmody@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
3 years agonet/i40e: fix RSS rule creation with L2 payload
Shougang Wang [Thu, 7 May 2020 09:44:01 +0000 (09:44 +0000)]
net/i40e: fix RSS rule creation with L2 payload

This patch fixes the issue that failed to create an RSS rule with type
L2-payload.

Fixes: feaae285b342 ("net/i40e: support hash configuration in RSS flow")

Signed-off-by: Shougang Wang <shougangx.wang@intel.com>
Tested-by: Hailin Xu <hailinx.xu@intel.com>
Reviewed-by: Jeff Guo <jia.guo@intel.com>
3 years agonet/iavf: fix RSS algorithm configuration
Jeff Guo [Wed, 13 May 2020 20:21:28 +0000 (16:21 -0400)]
net/iavf: fix RSS algorithm configuration

When configure RSS rule, the etherdev rss hash function type should be
mapped to the corresponding virtchnl rss algorithm type.

Fixes: 7be10c3004be ("net/iavf: add RSS configuration for VF")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
3 years agocommon/iavf: fix RSS algorithm type
Jeff Guo [Wed, 13 May 2020 20:21:27 +0000 (16:21 -0400)]
common/iavf: fix RSS algorithm type

A typo need to be fixed for Simple XOR algorithm configuration.

Fixes: 57094d594324 ("common/iavf: support advanced RSS input set change")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
3 years agonet/bnxt: support 200G link speed
Kalesh AP [Wed, 13 May 2020 04:51:25 +0000 (10:21 +0530)]
net/bnxt: support 200G link speed

When the driver is loaded on a 200G NIC, the port speed is not
displayed correctly. Parse the 200G speed before displaying it.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agocommon/mlx5: disable relaxed ordering in unsuitable CPUs
Shiri Kuzin [Tue, 12 May 2020 12:21:46 +0000 (15:21 +0300)]
common/mlx5: disable relaxed ordering in unsuitable CPUs

Relaxed ordering is a PCI optimization that enables reordering
reads/writes in order to improve performance.

Relaxed ordering was enabled for all processors causing
a degradation in performance in Haswell and Broadwell processors
that don't support this optimization.

In order to avoid that we check if the processor is Haswell
or Broadwell and if so we disable relaxed ordering.

Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agocommon/mlx5: fix relaxed ordering count object
Shiri Kuzin [Tue, 12 May 2020 12:21:45 +0000 (15:21 +0300)]
common/mlx5: fix relaxed ordering count object

In order to improve performance relaxed ordering was enabled
when creating count object using Devx.

Currently rte enables this optimization by default when using
Devx.

This causes an issue when using firmware that does not have this
capability causing a count object failure.

In order to fix this issue a check of firmware capabilities was
added before enabling relaxed ordering.

Fixes: 53ac93f71ad1 ("net/mlx5: create relaxed ordering memory regions")

Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agocommon/mlx5: fix relaxed ordering support detection
Shiri Kuzin [Tue, 12 May 2020 12:21:44 +0000 (15:21 +0300)]
common/mlx5: fix relaxed ordering support detection

Relaxed ordering is a PCI optimization that allows reordering
of reads/writes in order to improve performance.

In order to enable this optimization only when relaxed ordering
is supported, it is checked if IBV_ACCESS_RELAXED_ORDERING is
defined in verbs.h.

Since IBV_ACCESS_RELAXED_ORDERING is an enum and not
defined relaxed ordering wasn't enabled even when supported.

This issue is fixed by using AUTOCONF to check if relaxed
ordering is supported and disabling only if it isn't.

Fixes: 53ac93f71ad1 ("net/mlx5: create relaxed ordering memory regions")

Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/i40e: fix flow director MAC rule creation
Shougang Wang [Wed, 13 May 2020 02:54:50 +0000 (02:54 +0000)]
net/i40e: fix flow director MAC rule creation

This patch fixes the issue that the flow which both source MAC mask
and destination MAC mask are all zeros can not be created.

Fixes: ea0c22fd8227 ("net/i40e: enable MAC address as flow director input set")

Signed-off-by: Shougang Wang <shougangx.wang@intel.com>
Tested-by: Hailin Xu <hailinx.xu@intel.com>
Reviewed-by: Jeff Guo <jia.guo@intel.com>
3 years agonet/ixgbe: fix statistics in flow control mode
Guinan Sun [Tue, 12 May 2020 08:13:06 +0000 (08:13 +0000)]
net/ixgbe: fix statistics in flow control mode

The register autoneg can't be updated synchronously with flow control
mode setting in the state of port start, so NIC statistics error occurs.
AUTO_NEG Advt register should be updated by ixgbe_setup_fc() when
enabling flow control.
The patch fixes the issue.

Fixes: a524f550da6e ("net/ixgbe: fix flow control mode setting")
Cc: stable@dpdk.org
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
3 years agocommon/mlx5: fix umem buffer alignment
Dekel Peled [Mon, 11 May 2020 10:02:45 +0000 (13:02 +0300)]
common/mlx5: fix umem buffer alignment

The value MLX5_WQE_BUF_ALIGNMENT is defined as 512.
In some cases this alignment size is not adequate, which results in
memory registration that is not accepted by FW.
The result error can be "page_offset is not aligned to page_size/64,
bad umem_offset" (syndrome 0x357275).

This patch updates the definition to match the running system.

Fixes: 18a68e046b51 ("net/mlx5: fix DevX Rx queue memory alignment")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/mlx5: prefer DevX API to create Rx objects
Dekel Peled [Sun, 10 May 2020 11:18:32 +0000 (14:18 +0300)]
net/mlx5: prefer DevX API to create Rx objects

Currently, DevX API is used to create Rx objects (RQ, RQT, TIR) only
if LRO or hairpin features are enabled on this RQ.

This patch uses DevX API by default, if DevX is supported and can be
used. Otherwise, Verbs API is used.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agocommon/mlx5: remove DevX dependency on Verbs and DV
Ophir Munk [Thu, 7 May 2020 11:31:13 +0000 (11:31 +0000)]
common/mlx5: remove DevX dependency on Verbs and DV

File mlx5_devx_cmds.c should contain pure DevX calls. It must be OS
agnostic and not include any references to ibv or dv structs (defined in
ibverbs and rdma-core linux libraries).  This commit replaces all ibv
and dv references with 'void *'.  Specifically, the following struct
were replaced:
1. struct ibv_context *
2. struct ibv_qp *
3. struct mlx5dv_devx_cmd_comp *

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agocommon/mlx5: mark internal symbols
Ophir Munk [Thu, 7 May 2020 11:31:12 +0000 (11:31 +0000)]
common/mlx5: mark internal symbols

Move mlx5 symbols in the map file to the INTERNAL section and add
__internal tags to their definitions.
Those symbols were exported in 20.02 and now (20.05) they are removed.
Avoid ABI comparison issues between 20.05/20.08 and 20.02 by adding the
suppress_file directive to libabigail.abignore file. This directive will
prevent loading mlx5 common symbols and no comparison will be performed.

In addition move symbols from the EXPERIMENTAL section to the INTERNAL
section.

Fixes: 7b4f1e6bd367 ("common/mlx5: introduce common library")

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agodoc: fix multicast filter feature announcement
Qiming Yang [Fri, 8 May 2020 14:04:09 +0000 (22:04 +0800)]
doc: fix multicast filter feature announcement

Multicast MAC filter flag means device ops set_mc_addr_list support
or not. This patch fixes the wrong flag value in Intel driver's document.

Fixes: 9db3f52126fb ("doc: generate NIC overview table from ini files")
Fixes: cb25d4323fbf ("net/avf: enable MAC VLAN and promisc ops")
Fixes: 26e887343321 ("net/ice: support MAC ops")
Cc: stable@dpdk.org
Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
3 years agonet/iavf: remove useless assignment in Rx
Leyi Rong [Mon, 11 May 2020 08:36:55 +0000 (16:36 +0800)]
net/iavf: remove useless assignment in Rx

Fix coverity defects of unused value.

Coverity issue: 357745, 357769
Fixes: b8b4c54ef9b0 ("net/iavf: support flexible Rx descriptor in normal path")

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
3 years agonet/igc: fix boundary checks for RSS
Alvin Zhang [Fri, 8 May 2020 08:54:37 +0000 (16:54 +0800)]
net/igc: fix boundary checks for RSS

Fix some out-of-bounds memory issues, they may lead to wrong results
or affect application stability.

Coverity issue: 357759, 357713
Fixes: bd3fcf0d0fa1 ("net/igc: support RSS")

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Jeff Guo <jia.guo@intel.com>
3 years agonet/e1000: fix port hotplug for multi-process
Alvin Zhang [Wed, 29 Apr 2020 06:37:24 +0000 (14:37 +0800)]
net/e1000: fix port hotplug for multi-process

Enable detach device on secondary process.

Fixes: b9eee2cb8c29 ("e1000: support port hotplug")
Cc: stable@dpdk.org
Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Tested-by: Jianwei Mei <jianweix.mei@intel.com>
Reviewed-by: Jeff Guo <jia.guo@intel.com>
3 years agodoc: fix build issue in ABI guide
Raslan Darawsheh [Tue, 19 May 2020 07:36:53 +0000 (10:36 +0300)]
doc: fix build issue in ABI guide

doc/guides/contributing/abi_versioning.rst:416:
 ERROR: Error in "code-block" directive:
1 argument(s) required, 0 supplied.

.. code-block::

   use_function_versioning = true

Fixes: 45a4103e680d ("doc: fix default symbol binding in ABI guide")

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: David Marchand <david.marchand@redhat.com>
3 years agoeal: fix C++17 compilation
Stephen Hemminger [Fri, 8 May 2020 23:25:05 +0000 (16:25 -0700)]
eal: fix C++17 compilation

Compiling a C++ application that includes directly or indirectly
rte_common.h will cause a warning:

include/rte_common.h:350:37: warning: ISO C++17 does not allow
  ‘register’ storage class specifier [-Wregister]
 rte_combine32ms1b(register uint32_t x)

C++ is pickier than standard C and flags this antique usage.

The register keyword is an old K&R legacy and should be removed
everywhere in DPDK. For now, fix it where it hurts.

Fixes: 08f683174e94 ("eal: add functions for previous power of 2 alignment")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agocompat: provide experimental alias for matured ABI
Ferruh Yigit [Fri, 15 May 2020 15:01:53 +0000 (16:01 +0100)]
compat: provide experimental alias for matured ABI

On v20.02 some APIs matured and symbols moved from EXPERIMENTAL to
DPDK_20.0.1 block.

This had the affect of breaking the applications that were using these
APIs on v19.11. Although there is no modification of the APIs and the
action is positive and matures the APIs, the affect can be negative to
applications.

When a maintainer is promoting an API to become part of the next major
ABI version by removing the experimental tag. The maintainer may
choose to offer an alias to the experimental tag, to prevent these
breakages in future.

The following changes are made to enabling aliasing:

Updated to the ABI policy and ABI versioning documents.

Created VERSION_SYMBOL_EXPERIMENTAL helper macro.

Updated the 'check-symbols.sh' tool, which was complaining that the
symbol is in EXPERIMENTAL tag in .map file but it is not in the
.experimental section (__rte_experimental tag is missing).
Updated tool in a way it won't complain if the symbol in the
EXPERIMENTAL tag duplicated in some other block in .map file (versioned)

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
3 years agodoc: fix default symbol binding in ABI guide
Ray Kinsella [Wed, 6 May 2020 15:41:05 +0000 (16:41 +0100)]
doc: fix default symbol binding in ABI guide

The document abi_versioning.rst incorrectly instructs the developer to
add BIND_DEFAULT_SYMBOL to the public header, not the source file. This
commit fixes the issue and adds some clarifications.

The commit also clarifies the use of use_function_versioning in the
meson/ninja build system, and does some minor re-organization of the
document.

Fixes: f1ef9794f9bd ("doc: add ABI guidelines")
Cc: stable@dpdk.org
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
3 years agodoc: add reason for three-part ABI versioning
Ray Kinsella [Tue, 5 May 2020 08:56:48 +0000 (09:56 +0100)]
doc: add reason for three-part ABI versioning

Clarify the reasons behind the three part version numbering scheme.
Documents the fixes made in f26c2b3.

Fixes: f26c2b39b271 ("build: fix soname info for 19.11 compatibility")
Cc: stable@dpdk.org
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodoc: add RCU defer queue API in release notes
Honnappa Nagarahalli [Wed, 6 May 2020 03:54:15 +0000 (22:54 -0500)]
doc: add RCU defer queue API in release notes

Added a note about RCU defer queue APIs.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
3 years agodoc: fix LTO config option
Matteo Croce [Tue, 12 May 2020 19:48:56 +0000 (21:48 +0200)]
doc: fix LTO config option

The documentation says that CONFIG_ENABLE_LTO enables LTO during the
build, but the correct value actually is CONFIG_RTE_ENABLE_LTO.

Fixes: 098cc0fea3be ("build: add option to enable LTO")
Cc: stable@dpdk.org
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Andrzej Ostruszka <aostruszka@marvell.com>
3 years agomempool/octeontx2: mark internal symbols
Pavan Nikhilesh [Wed, 13 May 2020 09:55:57 +0000 (15:25 +0530)]
mempool/octeontx2: mark internal symbols

Move the internal symbols to INTERNAL sections so that any
change in them is not reported as ABI breakage.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Signed-off-by: David Marchand <david.marchand@redhat.com>
3 years agocommon/octeontx2: mark internal symbols
Pavan Nikhilesh [Wed, 13 May 2020 09:55:56 +0000 (15:25 +0530)]
common/octeontx2: mark internal symbols

Move the internal symbols to INTERNAL sections so that any
change in them is not reported as ABI breakage.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Signed-off-by: David Marchand <david.marchand@redhat.com>
3 years agovhost: fix potential fd leak
Xuan Ding [Mon, 18 May 2020 13:17:04 +0000 (14:17 +0100)]
vhost: fix potential fd leak

Vhost will create temporary file when receiving VHOST_USER_GET_INFLIGHT_FD
message. Malicious guest can send endless this message to drain out the
resource of host.

When receiving VHOST_USER_GET_INFLIGHT_FD message repeatedly, closing the
file created during the last handling of this message.

CVE-2020-10726
Fixes: d87f1a1cb7b666550 ("vhost: support inflight info sharing")
Cc: stable@dpdk.org
Signed-off-by: Xuan Ding <xuan.ding@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agovhost: fix potential memory space leak
Xiaolong Ye [Mon, 18 May 2020 13:17:03 +0000 (14:17 +0100)]
vhost: fix potential memory space leak

A malicious container which has direct access to the vhost-user socket
can keep sending VHOST_USER_GET_INFLIGHT_FD messages which may cause
leaking resources until resulting a DOS. Fix it by unmapping the
dev->inflight_info->addr before assigning new mapped addr to it.

CVE-2020-10726
Fixes: d87f1a1cb7b6 ("vhost: support inflight info sharing")
Cc: stable@dpdk.org
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agovhost: fix translated address not checked
Marvin Liu [Mon, 18 May 2020 13:17:02 +0000 (14:17 +0100)]
vhost: fix translated address not checked

Malicious guest can construct desc with invalid address and zero buffer
length. That will request vhost to check both translated address and
translated data length. This patch will add missed address check.

CVE-2020-10725
Fixes: 75ed51697820 ("vhost: add packed ring batch dequeue")
Fixes: ef861692c398 ("vhost: add packed ring batch enqueue")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agovhost/crypto: validate keys lengths
Maxime Coquelin [Mon, 18 May 2020 13:17:01 +0000 (14:17 +0100)]
vhost/crypto: validate keys lengths

transform_cipher_param() and transform_chain_param() handle
the payload data for the VHOST_USER_CRYPTO_CREATE_SESS
message. These payloads have to be validated, since it
could come from untrusted sources.

Two buffers and their lengths are defined in this payload,
one the the auth key and one for the cipher key. But above
functions do not validate the key length inputs, which could
lead to read out of bounds, as buffers have static sizes of
64 bytes for the cipher key and 512 bytes for the auth key.

This patch adds necessary checks on the key length field
before being used.

CVE-2020-10724
Fixes: e80a98708166 ("vhost/crypto: add session message handler")
Cc: stable@dpdk.org
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Reviewed-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
3 years agovhost: fix vring index check
Maxime Coquelin [Mon, 18 May 2020 13:17:00 +0000 (14:17 +0100)]
vhost: fix vring index check

vhost_user_check_and_alloc_queue_pair() is used to extract
a vring index from a payload. This function validates the
index and is called early on in when performing message
handling. Most message handlers depend on it correctly
validating the vring index.

Depending on the message type the vring index is in
different parts of the payload. The function contains a
switch/case for each type and copies the index. This is
stored in a uint16. This index is then validated. Depending
on the message, the source index is an unsigned int. If
integer truncation occurs (uint->uint16) the top 16 bits
of the index are never validated.

When they are used later on  (e.g. in
vhost_user_set_vring_num() or vhost_user_set_vring_addr())
it can lead to out of bound indexing. The out of bound
indexed data gets written to, and hence this can cause
memory corruption.

This patch fixes this vulnerability by declaring vring
index as an unsigned int in
vhost_user_check_and_alloc_queue_pair().

CVE-2020-10723
Fixes: 160cbc815b41 ("vhost: remove a hack on queue allocation")
Cc: stable@dpdk.org
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Reviewed-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
3 years agovhost: check log mmap offset and size overflow
Maxime Coquelin [Mon, 18 May 2020 13:16:59 +0000 (14:16 +0100)]
vhost: check log mmap offset and size overflow

vhost_user_set_log_base() is a message handler that is
called to handle the VHOST_USER_SET_LOG_BASE message.
Its payload contains a 64 bit size and offset. Both are
added up and used as a size when calling mmap().

There is no integer overflow check. If an integer overflow
occurs a smaller memory map would be created than
requested. Since the returned mapping is mapped as writable
and used for logging, a memory corruption could occur.

CVE-2020-10722
Fixes: fbc4d248b198 ("vhost: fix offset while mmaping log base address")
Cc: stable@dpdk.org
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Reviewed-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
3 years agobuild: disable gcc 10 zero-length-bounds warning
Kevin Traynor [Thu, 14 May 2020 13:18:57 +0000 (14:18 +0100)]
build: disable gcc 10 zero-length-bounds warning

gcc 10 issues warnings about the use of rearm_data marker
from struct rte_mbuf.

e.g.
../drivers/net/enic/enic_rxtx_vec_avx2.c: In function ‘rx_one’:
../drivers/net/enic/enic_rxtx_vec_avx2.c:21:2:
warning:
array subscript 0 is outside the bounds of an interior zero-length array
‘RTE_MARKER64’ {aka ‘long unsigned int[0]’} [-Wzero-length-bounds]
   21 |  *(uint64_t *)&mb->rearm_data = enic->mbuf_initializer;
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../lib/librte_mbuf/rte_mbuf.h:45,
                 from ../drivers/net/enic/enic_rxtx_vec_avx2.c:6:
../lib/librte_mbuf/rte_mbuf_core.h:484:15:
note: while referencing ‘rearm_data’
  484 |  RTE_MARKER64 rearm_data;
      |

Disable this warning for gcc 10 in order to allow v20.05 to build
without changes to struct rte_mbuf.

Bugzilla ID: 396
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
3 years agohash: fix gcc 10 maybe-uninitialized warning
Kevin Traynor [Fri, 15 May 2020 14:28:08 +0000 (15:28 +0100)]
hash: fix gcc 10 maybe-uninitialized warning

gcc 10.1.1 reports a warning for the ext_bkt_id variable:

../lib/librte_hash/rte_cuckoo_hash.c:
In function ‘__rte_hash_add_key_with_hash’:
../lib/librte_hash/rte_cuckoo_hash.c:1104:29:
warning: ‘ext_bkt_id’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
 1104 |  (h->buckets_ext[ext_bkt_id - 1]).sig_current[0] = short_sig;
      |                  ~~~~~~~~~~~^~~

The return value of rte_ring_sc_dequeue_elem() is already checked,
but also initialize ext_bkt_id to zero (invalid value) and check
that it also overwritten.

Fixes: fbfe568103b0 ("hash: use 32-bit elements rings to save memory")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
3 years agocrypto/virtio: enable OOP feature flag
Jay Zhou [Fri, 15 May 2020 09:31:27 +0000 (17:31 +0800)]
crypto/virtio: enable OOP feature flag

Since it will check the feature mask before running out-of-place
test cases and the virtio-crypto device supports OOP_LB_IN_LB_OUT mode.

Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agocrypto/octeontx: improve symmetric session-less path
Anoob Joseph [Sat, 16 May 2020 09:26:58 +0000 (14:56 +0530)]
crypto/octeontx: improve symmetric session-less path

Cleanup sessionless code path and improve error handling.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
3 years agocrypto/octeontx: enable non-byte aligned data
Ankur Dwivedi [Sat, 16 May 2020 09:26:57 +0000 (14:56 +0530)]
crypto/octeontx: enable non-byte aligned data

The OCTEON TX crypto PMD supports non-byte aligned data as
input for SNOW and ZUC algos. Adding the same to the feature list.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
3 years agocrypto/octeontx2: improve symmetric session algos check
Anoob Joseph [Sat, 16 May 2020 09:26:56 +0000 (14:56 +0530)]
crypto/octeontx2: improve symmetric session algos check

Session configure should return -ENOTSUP in case of unsupported xform
requests. Moving the validation of combinations out of cpt, as the
feature support will not be same across OCTEON TX and OCTEON TX2.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
3 years agocrypto/octeontx2: enable non-byte aligned data
Ankur Dwivedi [Sat, 16 May 2020 09:26:55 +0000 (14:56 +0530)]
crypto/octeontx2: enable non-byte aligned data

The OCTEON TX2 crypto PMD supports non-byte aligned data as
input for SNOW and ZUC algos. Adding the same to the feature list.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Anoob Joseph <anoobj@marvell.com>