dpdk.git
2 years agoexamples/l3fwd: fix scalar LPM
Stanislaw Kardach [Wed, 11 May 2022 14:56:50 +0000 (16:56 +0200)]
examples/l3fwd: fix scalar LPM

The lpm_process_event_pkt() can either process a packet using an
architecture specific (defined for X86/SSE, ARM/Neon and PPC64/Altivec)
path or a scalar one. The choice is however done using an ifdef
pre-processor macro. Because of that the scalar version was apparently
not widely exercised/compiled.
Due to some copy/paste errors, the scalar logic in
lpm_process_event_pkt() retained a "continue" statement where it should
utilize rfc1812_process() and return the port/BAD_PORT.

Fixes: 99fc91d18082 ("examples/l3fwd: add event lpm main loop")

Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agodevargs: fix leak on hotplug failure
David Marchand [Thu, 14 Apr 2022 11:27:56 +0000 (13:27 +0200)]
devargs: fix leak on hotplug failure

Caught by ASan, if a secondary process tried to attach a device with an
incorrect driver name, devargs was leaked.

Fixes: 64051bb1f144 ("devargs: unify scratch buffer storage")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
2 years agoeal/x86: fix unaligned access for small memcpy
Luc Pelletier [Fri, 25 Feb 2022 16:38:05 +0000 (11:38 -0500)]
eal/x86: fix unaligned access for small memcpy

Calls to rte_memcpy for 1 < n < 16 could result in unaligned
loads/stores, which is undefined behaviour according to the C
standard, and strict aliasing violations.

The code was changed to use a packed structure that allows aliasing
(using the __may_alias__ attribute) to perform the load/store
operations. This results in code that has the same performance as the
original code and that is also C standards-compliant.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Luc Pelletier <lucp.at.work@gmail.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2 years agotest/threads: add unit test
Tyler Retzlaff [Thu, 12 May 2022 13:14:30 +0000 (06:14 -0700)]
test/threads: add unit test

Establish unit test for testing thread api. Initial unit tests
for rte_thread_{get,set}_affinity_by_id().

Signed-off-by: Narcisa Vasile <navasile@linux.microsoft.com>
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
2 years agoeal: get/set thread affinity per thread identifier
Tyler Retzlaff [Thu, 12 May 2022 13:14:29 +0000 (06:14 -0700)]
eal: get/set thread affinity per thread identifier

Implement functions for getting/setting thread affinity.
Threads can be pinned to specific cores by setting their
affinity attribute.

Windows error codes are translated to errno-style error codes.
The possible return values are chosen so that we have as
much semantic compatibility between platforms as possible.

note: convert_cpuset_to_affinity has a limitation that all cpus of
the set belong to the same processor group.

Signed-off-by: Narcisa Vasile <navasile@linux.microsoft.com>
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
2 years agoeal: provide current thread identifier
Tyler Retzlaff [Thu, 12 May 2022 13:14:28 +0000 (06:14 -0700)]
eal: provide current thread identifier

Provide a portable type-safe thread identifier.
Provide rte_thread_self for obtaining current thread identifier.

Signed-off-by: Narcisa Vasile <navasile@linux.microsoft.com>
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
2 years agohash: unify CRC32 selection for x86 and Arm
Pavan Nikhilesh [Fri, 13 May 2022 18:27:10 +0000 (23:57 +0530)]
hash: unify CRC32 selection for x86 and Arm

Merge CRC32 hash calculation public API implementation for x86 and Arm.
Select the best available CRC32 algorithm when unsupported algorithm
on a given CPU architecture is requested by an application.

Previously, if an application directly includes `rte_crc_arm64.h`
without including `rte_hash_crc.h` it will fail to compile.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2 years agohash: split x86 and SW hash CRC intrinsics
Pavan Nikhilesh [Fri, 13 May 2022 18:27:09 +0000 (23:57 +0530)]
hash: split x86 and SW hash CRC intrinsics

Split x86 and SW hash crc intrinsics into separate files.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
2 years agoevent/cnxk: flush event queues over multiple pass
Shijith Thotton [Mon, 16 May 2022 16:22:29 +0000 (21:52 +0530)]
event/cnxk: flush event queues over multiple pass

If an event queue flush does not complete after a fixed number of tries,
remaining queues are flushed before retrying the one with incomplete
flush.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
2 years agoevent/cnxk: support setting queue attributes at runtime
Shijith Thotton [Mon, 16 May 2022 17:35:51 +0000 (23:05 +0530)]
event/cnxk: support setting queue attributes at runtime

Added API to set queue attributes at runtime and API to get weight and
affinity.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: lock when accessing mbox of SSO
Pavan Nikhilesh [Mon, 16 May 2022 17:35:50 +0000 (23:05 +0530)]
common/cnxk: lock when accessing mbox of SSO

Since mailbox is now accessed from multiple threads, use lock to
synchronize access.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
2 years agotest/event: set queue attributes at runtime
Shijith Thotton [Mon, 16 May 2022 17:35:49 +0000 (23:05 +0530)]
test/event: set queue attributes at runtime

Added test cases to test changing of queue QoS attributes priority,
weight and affinity at runtime.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoeventdev: add weight and affinity to queue attributes
Shijith Thotton [Mon, 16 May 2022 17:35:48 +0000 (23:05 +0530)]
eventdev: add weight and affinity to queue attributes

Extended eventdev queue QoS attributes to support weight and affinity.
If queues are of the same priority, events from the queue with highest
weight will be scheduled first. Affinity indicates the number of times,
the subsequent schedule calls from an event port will use the same event
queue. Schedule call selects another queue if current queue goes empty
or schedule count reaches affinity count.

To avoid ABI break, weight and affinity attributes are not yet added to
queue config structure and rely on PMD for managing it. New eventdev op
queue_attr_get can be used to get it from the PMD.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoeventdev: support setting queue attributes at runtime
Shijith Thotton [Mon, 16 May 2022 17:35:47 +0000 (23:05 +0530)]
eventdev: support setting queue attributes at runtime

Added a new eventdev API rte_event_queue_attr_set(), to set event queue
attributes at runtime from the values set during initialization using
rte_event_queue_setup(). PMD's supporting this feature should expose the
capability RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoevent/cnxk: implement event port quiesce function
Pavan Nikhilesh [Fri, 13 May 2022 17:58:41 +0000 (23:28 +0530)]
event/cnxk: implement event port quiesce function

Implement event port quiesce function to clean up any lcore
resources used.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
2 years agoexamples: use event port quiescing
Pavan Nikhilesh [Fri, 13 May 2022 17:58:40 +0000 (23:28 +0530)]
examples: use event port quiescing

Quiesce event ports used by the workers core on exit to free up
any outstanding resources.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoapp/eventdev: use port quiescing
Pavan Nikhilesh [Fri, 13 May 2022 17:58:40 +0000 (23:28 +0530)]
app/eventdev: use port quiescing

Quiesce event ports used by the workers core on exit to free up
any outstanding resources.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoeventdev: quiesce an event port
Pavan Nikhilesh [Fri, 13 May 2022 17:58:39 +0000 (23:28 +0530)]
eventdev: quiesce an event port

Add function to quiesce any core specific resources consumed by
the event port.

When the application decides to migrate the event port to another lcore
or teardown the current lcore it may to call `rte_event_port_quiesce`
to make sure that all the data associated with the event port are released
from the lcore, this might also include any prefetched events.

While releasing the event port from the lcore, this function calls the
user-provided flush callback once per event.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoexamples/ipsec-secgw: cleanup worker state before exit
Pavan Nikhilesh [Fri, 13 May 2022 16:07:19 +0000 (21:37 +0530)]
examples/ipsec-secgw: cleanup worker state before exit

Event ports are configured to implicitly release the scheduler contexts
currently held in the next call to rte_event_dequeue_burst().
A worker core might still hold a scheduling context during exit as the
next call to rte_event_dequeue_burst() is never made.
This might lead to deadlock based on the worker exit timing and when
there are very less number of flows.

Add a cleanup function to release any scheduling contexts held by the
worker by using RTE_EVENT_OP_RELEASE.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoexamples/l2fwd-event: clean up worker state before exit
Pavan Nikhilesh [Fri, 13 May 2022 16:07:18 +0000 (21:37 +0530)]
examples/l2fwd-event: clean up worker state before exit

Event ports are configured to implicitly release the scheduler contexts
currently held in the next call to rte_event_dequeue_burst().
A worker core might still hold a scheduling context during exit, as the
next call to rte_event_dequeue_burst() is never made.
This might lead to deadlock based on the worker exit timing and when
there are very less number of flows.

Add clean up function to release any scheduling contexts held by the
worker by using RTE_EVENT_OP_RELEASE.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoexamples/l3fwd: clean up worker state before exit
Pavan Nikhilesh [Fri, 13 May 2022 16:07:17 +0000 (21:37 +0530)]
examples/l3fwd: clean up worker state before exit

Event ports are configured to implicitly release the scheduler contexts
currently held in the next call to rte_event_dequeue_burst().
A worker core might still hold a scheduling context during exit, as the
next call to rte_event_dequeue_burst() is never made.
This might lead to deadlock based on the worker exit timing and when
there are very less number of flows.

Add clean up function to release any scheduling contexts held by the
worker by using RTE_EVENT_OP_RELEASE.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoexamples/eventdev: clean up worker state before exit
Pavan Nikhilesh [Fri, 13 May 2022 16:07:16 +0000 (21:37 +0530)]
examples/eventdev: clean up worker state before exit

Event ports are configured to implicitly release the scheduler contexts
currently held in the next call to rte_event_dequeue_burst().
A worker core might still hold a scheduling context during exit, as the
next call to rte_event_dequeue_burst() is never made.
This might lead to deadlock based on the worker exit timing and when
there are very less number of flows.

Add clean up function to release any scheduling contexts held by the
worker by using RTE_EVENT_OP_RELEASE.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoapp/eventdev: clean up worker state before exit
Pavan Nikhilesh [Fri, 13 May 2022 16:07:15 +0000 (21:37 +0530)]
app/eventdev: clean up worker state before exit

Event ports are configured to implicitly release the scheduler contexts
currently held in the next call to rte_event_dequeue_burst().
A worker core might still hold a scheduling context during exit, as the
next call to rte_event_dequeue_burst() is never made.
This might lead to deadlock based on the worker exit timing and when
there are very less number of flows.

Add clean up function to release any scheduling contexts held by the
worker by using RTE_EVENT_OP_RELEASE.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoapp/eventdev: simplify signal handling and teardown
Pavan Nikhilesh [Fri, 13 May 2022 16:07:14 +0000 (21:37 +0530)]
app/eventdev: simplify signal handling and teardown

Remove rte_*_dev calls from signal handler callback as signal handlers
are supposed to be light weight.

Split ethdev teardown into Rx and Tx sections, wait for
workers to finish processing after disabling Rx to allow workers
to complete processing currently held packets.

Verified SW event device on ARM64 using the following command:

./build/app/dpdk-test-eventdev -l 7-23 -s 0xf00 --vdev=event_sw0
 -a 0002:02:00.0 -- --prod_type_ethdev --nb_pkts=0 --verbose 2
 --test=pipeline_queue --stlist=o --wlcores 16-23

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoevent/cnxk: move post-processing to separate function
Pavan Nikhilesh [Wed, 27 Apr 2022 10:58:28 +0000 (16:28 +0530)]
event/cnxk: move post-processing to separate function

Move event post-processing to a separate function.
Do complete event post-processing in tear-down functions to prevent
incorrect memory free.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
2 years agoevent/cnxk: add checks in release operation
Pavan Nikhilesh [Wed, 27 Apr 2022 10:58:27 +0000 (16:28 +0530)]
event/cnxk: add checks in release operation

Add additional checks while performing RTE_EVENT_OP_RELEASE to
ensure that there are no pending SWTAGs and FLUSHEs in flight.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
2 years agoeventdev/timer: add telemetry
Ankur Dwivedi [Tue, 26 Apr 2022 03:59:45 +0000 (09:29 +0530)]
eventdev/timer: add telemetry

Adds telemetry support to get timer adapter info and timer adapter
statistics.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agoevent/cnxk: fix out of bounds access in test
Gowrishankar Muthukrishnan [Sun, 24 Apr 2022 16:24:55 +0000 (21:54 +0530)]
event/cnxk: fix out of bounds access in test

Fix out of bounds array access reported in coverity scan.

Coverity issue: 375817
Fixes: 2351506401e ("event/cnxk: add SSO selftest and dump")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoevent/dlb2: allow CQ depths up to 1024
Timothy McDaniel [Sat, 9 Apr 2022 15:13:20 +0000 (10:13 -0500)]
event/dlb2: allow CQ depths up to 1024

Updated to allow overriding the default CQ depth of 32.  Since there are
only 2048 DLB history list entries, increasing the CQ depth decreases
the number of available LDB ports to 2048/max_cq_depth. Resource query
will take this into account and return the correct maximum number of
LDB ports.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
2 years agoevent/cnxk: fix base pointer for SSO head wait
Volodymyr Fialko [Fri, 25 Mar 2022 10:59:39 +0000 (11:59 +0100)]
event/cnxk: fix base pointer for SSO head wait

Function roc_sso_hws_head_wait() expects a base as input pointer, and it
will itself get tag_op from the base. By passing tag_op instead of base
pointer to this function will add SSOW_LF_GWS_TAG register offset twice,
which will lead to accessing wrong register.

Fixes: 1f5b3d55c041 ("event/cnxk: store and reuse workslot status")
Cc: stable@dpdk.org
Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoeventdev/eth_rx: fix telemetry Rx stats reset
David Marchand [Thu, 24 Mar 2022 15:28:30 +0000 (16:28 +0100)]
eventdev/eth_rx: fix telemetry Rx stats reset

Caught by covscan:

1. dpdk-21.11/lib/eventdev/rte_event_eth_rx_adapter.c:3279:
logical_vs_bitwise: "~(*__ctype_b_loc()[(int)*params] & 2048 /*
(unsigned short)_ISdigit */)" is always 1/true regardless of the values
of its operand. This occurs as the logical second operand of "||".
2. dpdk-21.11/lib/eventdev/rte_event_eth_rx_adapter.c:3279: remediation:
Did you intend to use "!" rather than "~"?

While isdigit return value should be compared as an int to 0,
prefer ! since all of this file uses this convention.

Fixes: 814d01709328 ("eventdev/eth_rx: support telemetry")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
2 years agodoc: fix build with sphinx 4.5
Jerin Jacob [Sun, 1 May 2022 14:57:21 +0000 (20:27 +0530)]
doc: fix build with sphinx 4.5

Latest Sphinx checks C language syntax more aggressively.
Fix the following warning by correcting C language syntax.

doc/guides/prog_guide/event_ethernet_rx_adapter.rst:243:
WARNING: Could not lex literal_block as "c". Highlighting skipped.

Fixes: 3c838062b91f ("eventdev: introduce event vector Rx capability")
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
2 years agonet/mlx5: support ESP SPI match and RSS hash
Raja Zidane [Thu, 12 May 2022 09:17:11 +0000 (12:17 +0300)]
net/mlx5: support ESP SPI match and RSS hash

In packets with ESP header, the inner IP will be encrypted, and
its fields cannot be used for RSS hashing. So, ESP packets
can be hashed only by the outer IP layer.
So, when using RSS on ESP packets, hashing may not be efficient,
because the fields used by the hash functions are only the outer IPs,
causing all traffic belonging to all tunnels between a given
pair of GWs to land on one core.
Adding the SPI hash field can extend the spreading of IPsec packets.

Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix no-green metering with RSS
Shun Hao [Thu, 14 Apr 2022 07:55:20 +0000 (10:55 +0300)]
net/mlx5: fix no-green metering with RSS

When a meter with RSS action being used, there might be several
sub-flows using different sub-policies in the flow splitting stage.
If there's no green action, there's an error that will always use the
same sub-policy for all sub-flows, some resources will be
overwritten and cannot be released, leading assert during port close.

This patch fixes this issue by checking both green and yellow queue
index during getting a blank sub-policy, to avoid the incorrect
resource overwrite.

Fixes: b38a12272b3a ("net/mlx5: split meter color policy handling")
Cc: stable@dpdk.org
Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/bnxt: skip wait for link up on port start
Somnath Kotur [Wed, 27 Apr 2022 14:58:21 +0000 (20:28 +0530)]
net/bnxt: skip wait for link up on port start

Invoking bnxt_link_update_op() with wait_for_completion set would
result in the driver waiting for 10s in case the port link is down to
complete port initialization (dev_start_op()).
Change it by not waiting for the completion when invoking it in
dev_start_op()

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 agonet/bnxt: fix freeing VNIC filters
Somnath Kotur [Wed, 27 Apr 2022 14:58:20 +0000 (20:28 +0530)]
net/bnxt: fix freeing VNIC filters

In bnxt_free_all_filters(), all the filters attached to a vnic are removed.
But each of these filters hold a backreference ptr to the vnic and they
need to be reset to NULL now. Otherwise, during a normal testpmd quit, as
part of dev_close_op(), first bnxt_free_all_filters() is invoked in
dev_stop, followed by bnxt_free_filter_mem() from bnxt_uninit_resources(),
which finds a filter with a vnic back reference ptr and now
bnxt_hwrm_clean_up_l2_filter() also tries to remove the filter from the
vnic's filter list which was already done as part of
bnxt_free_all_filters().

Fixes: f0f6b5e6cf94 ("net/bnxt: fix reusing L2 filter")
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 agonet/bnxt: recheck FW readiness if in reset process
Kalesh AP [Wed, 27 Apr 2022 14:58:19 +0000 (20:28 +0530)]
net/bnxt: recheck FW readiness if in reset process

If Firmware is still in reset process and returns the error
HWRM_ERR_CODE_HOT_RESET_PROGRESS, retry VER_GET command.
We have to do it in bnxt_handle_if_change_status().

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org
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>
2 years agonet/bnxt: fix link status when port is stopped
Kalesh AP [Wed, 27 Apr 2022 14:58:18 +0000 (20:28 +0530)]
net/bnxt: fix link status when port is stopped

Driver forces link down during port stop. But device is not obliged
link down in certain scenarios, even when forced. In that case,
subsequent link queries returns link as up.
Fixed to return link status as down when port is stopped.
Driver is already doing that for VF/NPAR/MH functions.

Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: force PHY update on certain configurations
Kalesh AP [Wed, 27 Apr 2022 14:58:17 +0000 (20:28 +0530)]
net/bnxt: force PHY update on certain configurations

Device is not obliged link down in certain scenarios, even
when forced. When FW does not allow any user other than the BMC
to shutdown the port, bnxt_get_hwrm_link_config() call always
returns link up. Force phy update always in that case,
else user configuration for speed/autoneg would not get applied
correctly.

Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix speed autonegotiation
Kalesh AP [Wed, 27 Apr 2022 14:58:16 +0000 (20:28 +0530)]
net/bnxt: fix speed autonegotiation

The "active_fec_signal_mode" in HWRM_PORT_PHY_QCFG response
does not return correct value till the link is up. Driver cannot
rely on active_fec_signal_mode while setting autoneg speed.

While setting autoneg speed, driver is currently checking only
"auto_link_speed_mask". Fixed to check "auto_pam4_link_speed_mask"
as well. Also, while setting auto mode and setting speed mask,
driver will have to set both NRZ and PAM4 mask.

Fixes: c23f9ded0391 ("net/bnxt: support 200G PAM4 link")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: avoid unnecessary endianness conversion
Kalesh AP [Wed, 27 Apr 2022 14:58:15 +0000 (20:28 +0530)]
net/bnxt: avoid unnecessary endianness conversion

The "active_fec_signal_mode" in HWRM_PORT_PHY_QCFG response is uint8_t.
So no need of endianness conversion while parsing response.
Also, signal_mode is the first 4bits of "active_fec_signal_mode".

Fixes: c23f9ded0391 ("net/bnxt: support 200G PAM4 link")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: handle queue stop during RSS flow create
Somnath Kotur [Wed, 27 Apr 2022 14:58:14 +0000 (20:28 +0530)]
net/bnxt: handle queue stop during RSS flow create

The programming of the RSS table was not taking into account if
any of the queues in the set were stopped prior to the flow
creation, hence leading to a vnic RSS config cmd failure thrown by
the FW.
Fix by programming only the active queues in the RSS action queue
set.

Fixes: 239695f754cb ("net/bnxt: enhance RSS action support")
Cc: stable@dpdk.org
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
2 years agonet/bnxt: check duplicate queue IDs
Kalesh AP [Wed, 27 Apr 2022 14:58:13 +0000 (20:28 +0530)]
net/bnxt: check duplicate queue IDs

Currently driver does not have a check for duplicate queue ids.
User must either specify all Rx queues created or no queues in the
flow create command. Repeating the queue index is invalid.

Also, moved the check for invalid queue to the beginning of the function.

Fixes: 239695f754cb ("net/bnxt: enhance RSS action support")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix ring group on Rx restart
Somnath Kotur [Wed, 27 Apr 2022 14:58:12 +0000 (20:28 +0530)]
net/bnxt: fix ring group on Rx restart

When an Rx queue is stopped and restarted, as part of that workflow,
for cards that have ring groups, we free and reallocate the ring group.
This new ring group is not communicated to the VNIC though via
HWRM_VNIC_CFG cmd.
Fix to issue HWRM_VNIC_CFG cmd on all adapters now in this scenario.

Fixes: ed0ae3502fc9 ("net/bnxt: update ring group after ring stop start")
Cc: stable@dpdk.org
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
2 years agonet/bnxt: fix RSS action
Kalesh AP [Wed, 27 Apr 2022 14:58:11 +0000 (20:28 +0530)]
net/bnxt: fix RSS action

Specifying a subset of Rx queues created by the application in
the "flow create" command is invalid.
User must either specify all Rx queues created or no queues.

Also removed a wrong comment as RSS action will not be supported
if user or application specifies MARK or COUNT action.

Fixes: 239695f754cb ("net/bnxt: enhance RSS action support")
Cc: stable@dpdk.org
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>
2 years agonet/bnxt: remove count action support
Somnath Kotur [Wed, 27 Apr 2022 14:58:10 +0000 (20:28 +0530)]
net/bnxt: remove count action support

'Count' action was never really implemented in the legacy/AFM model.
But there was some place holder code, remove it so that the user
will see a failure when a flow with 'count' action is being
created.

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 agonet/bnxt: fix tunnel stateless offloads
Kalesh AP [Wed, 27 Apr 2022 14:58:09 +0000 (20:28 +0530)]
net/bnxt: fix tunnel stateless offloads

The HW only supports tunnel header parsing globally for supported tunnel
types. When a function uses one default VNIC to receive both the tunnel
and non-tunnel packets, applying the same stateless offload operation to
both tunnel and non-tunnel packets can cause problems in certain scenarios.
To workaround these problems, the firmware advertises no tunnel header
parsing capabilities to the driver using the HWRM_FUNC_QCAPS.
The driver must check this flag setting and accordingly not advertise
tunnel packet stateless offload capabilities to the stack.

If the device supports VXLAN, GRE, IPIP and GENEVE tunnel parsing,
then reports RX_OFFLOAD_OUTER_IPV4_CKSUM, RX_OFFLOAD_OUTER_UDP_CKSUM
and TX_OFFLOAD_OUTER_IPV4_CKSUM in the Rx/Tx offload capabilities of
the device.
Also, advertise tunnel TSO capabilities based on FW support.

Fixes: 0a6d2a720078 ("net/bnxt: get device infos")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix Rx configuration
Kalesh AP [Wed, 27 Apr 2022 14:58:08 +0000 (20:28 +0530)]
net/bnxt: fix Rx configuration

We are currently not handling RX/RSS modes correctly.
After launching testpmd with multiple RXQs, if the user tries to set
the number of RXQs to 1, driver is not updating the "hash_type"
and "hash_mode" values of the VNICs. As a result, driver issues
bnxt_vnic_rss_configure() unnecessarily and the FW command fails.

Fixed bnxt_mq_rx_configure() to update VNIC RSS fields unconditionally.

Fixes: 4191bc8f79a8 ("net/bnxt: handle multi queue mode properly")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: remove unused macro
Kalesh AP [Wed, 27 Apr 2022 14:58:07 +0000 (20:28 +0530)]
net/bnxt: remove unused macro

BNXT_FLAG_UPDATE_HASH is redundant now, remove it.

Fixes: 1ebb765090a6 ("net/bnxt: fix config RSS update")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix device capability reporting
Kalesh AP [Wed, 27 Apr 2022 14:58:06 +0000 (20:28 +0530)]
net/bnxt: fix device capability reporting

1. Added two functions bnxt_get_tx_port_offloads() and
   bnxt_get_rx_port_offloads() to report the device
   tx/rx offload capabilities to the application.
2. This avoids few duplicate code in the driver and make
   VF-rep capability the same as VF.
3. This will help in selectively reporting offload capabilities
   based on FW support.

Fixes: 0a6d2a720078 ("net/bnxt: get device infos")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: update HWRM structures
Kalesh AP [Wed, 27 Apr 2022 14:58:05 +0000 (20:28 +0530)]
net/bnxt: update HWRM structures

Brought in the latest hsi_struct_def_dpdk.h.
HWRM API is now updated to version "1.10.2.83".

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix reordering in NEON Rx
Ruifeng Wang [Wed, 13 Apr 2022 10:31:56 +0000 (18:31 +0800)]
net/bnxt: fix reordering in NEON Rx

Rx descriptor contains a valid bit which indicates readiness of the rest
of descriptor words. Hence, the word contains valid bit must be read
prior to other words.

In NEON vector path, two contiguous 8B descriptor are loaded to a single
NEON register. Given vector load ensures no 16B atomicity, read of the
word that includes valid bit could be reordered after read of other words.
In this case, data could be invalid.

Reloaded lower 64b after read barrier. This ensures what fetched is
correct.

Also fixed comments that not pertains to Arm platform architecture.

Fixes: deae85145c64 ("net/bnxt: handle multiple packets per loop in vector Rx")
Cc: stable@dpdk.org
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2 years agonet/bnxt: remove redundant ifdefs
Ruifeng Wang [Wed, 13 Apr 2022 10:31:55 +0000 (18:31 +0800)]
net/bnxt: remove redundant ifdefs

NEON vector path is built only when Arm platform is 64-bit.
The ifdefs in NEON path are of no use, hence remove.

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2 years agonet/bnxt: defer completion index update
Ruifeng Wang [Wed, 13 Apr 2022 10:31:54 +0000 (18:31 +0800)]
net/bnxt: defer completion index update

When no packet is received, there is no need to update completion raw cons.
Moved update down to remove unnecessary store in this case.

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2 years agocommon/cnxk: support per-port RQ in inline device
Nithin Dabilpuram [Sun, 8 May 2022 07:48:39 +0000 (13:18 +0530)]
common/cnxk: support per-port RQ in inline device

Add support for per port RQ in inline device thereby using
Aura/Pool attributes from that port specific first RQ.
When inline device is used with channel masking, it will
fallback to single RQ for all ethdev ports.

Also remove clamping up of CQ size for LBK ethdev when
inline inbound is enabled as now backpressure is supported
even on LBK ethdevs.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: fix hotplug detach for first device
Nithin Dabilpuram [Sun, 8 May 2022 07:48:38 +0000 (13:18 +0530)]
net/cnxk: fix hotplug detach for first device

Fix hotplug detach sequence to handle case where first PCI
device that is hosting NPA LF is being destroyed while in use.

Fixes: 5a4341c84979 ("net/cnxk: add platform specific probe and remove")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: fix multi-segment extraction in vwqe path
Nithin Dabilpuram [Sun, 8 May 2022 07:48:37 +0000 (13:18 +0530)]
net/cnxk: fix multi-segment extraction in vwqe path

Fix multi-seg extraction in vwqe path to avoid updating mbuf[]
array until it is used via cq0 path.

Fixes: 7fbbc981d54f ("event/cnxk: support vectorized Rx event fast path")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: perform early MTU setup for event mode
Nithin Dabilpuram [Sun, 8 May 2022 07:48:36 +0000 (13:18 +0530)]
net/cnxk: perform early MTU setup for event mode

Perform early MTU setup for event mode path in order
to update the Rx/Tx offload flags before Rx adapter setup
starts.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support flow control for outbound inline
Nithin Dabilpuram [Sun, 8 May 2022 07:48:35 +0000 (13:18 +0530)]
net/cnxk: support flow control for outbound inline

Add support for flow control in outbound inline path using
FC updates from CPT.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support security statistics
Akhil Goyal [Sun, 8 May 2022 07:48:34 +0000 (13:18 +0530)]
net/cnxk: support security statistics

Enabled rte_security stats operation based on the configuration
of SA options set while creating session.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: add capabilities for IPsec options
Akhil Goyal [Sun, 8 May 2022 07:48:33 +0000 (13:18 +0530)]
net/cnxk: add capabilities for IPsec options

Added supported capabilities for various IPsec SA options.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: add capabilities for IPsec crypto algos
Akhil Goyal [Sun, 8 May 2022 07:48:32 +0000 (13:18 +0530)]
net/cnxk: add capabilities for IPsec crypto algos

Added supported crypto algorithms for inline IPsec
offload.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: update L3/L4 checksum offload in mbuf
Akhil Goyal [Sun, 8 May 2022 07:48:31 +0000 (13:18 +0530)]
net/cnxk: update L3/L4 checksum offload in mbuf

When the packet is processed with inline IPsec offload,
the ol_flags were updated only with RTE_MBUF_F_RX_SEC_OFFLOAD.

But the hardware can also update the L3/L4 csum offload flags.
Hence, ol_flags are updated with RTE_MBUF_F_RX_IP_CKSUM_GOOD,
RTE_MBUF_F_RX_L4_CKSUM_GOOD, etc based on the microcode completion
codes.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: optimize Rx fast path for security offload
Nithin Dabilpuram [Sun, 8 May 2022 07:48:30 +0000 (13:18 +0530)]
net/cnxk: optimize Rx fast path for security offload

Optimize Rx fast path for security packets by preprocessing
most of the operations such as sa pointer compute,
inner WQE pointer fetch and microcode completion translation
before the pkt is characterized as inbound inline pkt.

Preprocessed info will be discarded if packet is not
found to be security pkt. Also fix fetching of CQ word5
for vector mode. Get ucode completion code from CPT parse
header and RLEN from IP4v/IPv6 decrypted packet as it is
in same 64B cacheline as CPT parse header in most of
the cases. By this method, we avoid accessing an extra
cacheline

Fixes: c062f5726f61 ("net/cnxk: support IP reassembly")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support decrement TTL for inline IPsec
Akhil Goyal [Sun, 8 May 2022 07:48:29 +0000 (13:18 +0530)]
net/cnxk: support decrement TTL for inline IPsec

Added support for decrementing TTL(IPv4)/hoplimit(IPv6)
while doing inline IPsec processing if the security session
SA options is enabled with dec_ttl.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: reset offload flag if reassembly is disabled
Akhil Goyal [Sun, 8 May 2022 07:48:28 +0000 (13:18 +0530)]
net/cnxk: reset offload flag if reassembly is disabled

The rx offload flag need to be reset if IP reassembly flag
is not set while calling reassembly_conf_set.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: update environment variable for debug IV
Akhil Goyal [Sun, 8 May 2022 07:48:27 +0000 (13:18 +0530)]
net/cnxk: update environment variable for debug IV

Changed environment variable name for specifying
debug IV for unit testing of inline IPsec offload
with known test vectors.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: update inline device in ethdev telemetry
Rakesh Kudurumalla [Sun, 8 May 2022 07:48:26 +0000 (13:18 +0530)]
net/cnxk: update inline device in ethdev telemetry

Inline PF_FUNC is updated in ethdev_tel_handle_info(),
when inline device is attached to any dpdk process

Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: fix roundup size with transport mode
Nithin Dabilpuram [Sun, 8 May 2022 07:48:25 +0000 (13:18 +0530)]
net/cnxk: fix roundup size with transport mode

For transport mode, roundup needs to be based on L4 data
and shouldn't include L3 length.

By including L3 length, rlen that is calculated and put in
send hdr would cross the final length of the packet in some
scenarios where padding is necessary.

Also when outer and inner checksum offload flags are enabled,
get the l2_len and l3_len from il3ptr and il4ptr.

Fixes: 55bfac717c72 ("net/cnxk: support Tx security offload on cn10k")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: disable default inner checksum for outbound inline
Nithin Dabilpuram [Sun, 8 May 2022 07:48:24 +0000 (13:18 +0530)]
net/cnxk: disable default inner checksum for outbound inline

Disable default inner L3/L4 checksum generation for outbound inline
path and enable based on SA options or RTE_MBUF flags as per
the spec. Though the checksum generation is not impacting much
performance, it is overwriting zero checksum for UDP packets
which is not always good.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: add barrier after meta batch free in scalar
Nithin Dabilpuram [Sun, 8 May 2022 07:48:23 +0000 (13:18 +0530)]
net/cnxk: add barrier after meta batch free in scalar

Add barrier after meta batch free in scalar routine when
LMT lines are exactly full to make sure that next LMT line user
in Tx only starts writing the lines only when previous stoerl's
are complete.

Fixes: 4382a7ccf781 ("net/cnxk: support Rx security offload on cn10k")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: update LBK ethdev link info
Nithin Dabilpuram [Sun, 8 May 2022 07:48:22 +0000 (13:18 +0530)]
net/cnxk: update LBK ethdev link info

Update link info of LBK ethdev i.e AF's VF's as always up
and 100G. This is because there is no phy for the LBK interfaces
and driver won't get a link update notification for the same.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support loopback mode on AF VF
Nithin Dabilpuram [Sun, 8 May 2022 07:48:21 +0000 (13:18 +0530)]
net/cnxk: support loopback mode on AF VF

Support internal loopback mode on AF VF's using ROC by setting
Tx channel same as Rx channel.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: use aggregate level RR priority from mbox
Nithin Dabilpuram [Sun, 8 May 2022 07:48:20 +0000 (13:18 +0530)]
common/cnxk: use aggregate level RR priority from mbox

Use aggregate level Round Robin Priority from mbox response instead of
fixing it to single macro. This is useful when kernel AF driver
changes the constant.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: convert warning to debug print
Akhil Goyal [Sun, 8 May 2022 07:48:19 +0000 (13:18 +0530)]
common/cnxk: convert warning to debug print

Inbound SA SPI if not in min-max range specified in devargs,
was marked as a warning. But this is not converted to debug
print because if the entry is found to be duplicate in the mask,
it will give another error print. Hence, warning print is not needed
and is now converted to debug print.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: fix soft expiry disable path
Nithin Dabilpuram [Sun, 8 May 2022 07:48:18 +0000 (13:18 +0530)]
common/cnxk: fix soft expiry disable path

Fix issues in mode where soft expiry is disabled in ROC.
When soft expiry support is not enabled in inline device,
memory is not allocated for the ring base array and should
not be accessed.

Fixes: bea5d990a93b ("net/cnxk: support outbound soft expiry notification")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: skip probing SoC environment for CN9K
Rakesh Kudurumalla [Sun, 8 May 2022 07:48:17 +0000 (13:18 +0530)]
common/cnxk: skip probing SoC environment for CN9K

SoC run platform file is not present in CN9k so probing
is done for CN10k devices

Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: fix SQ flush sequence
Satha Rao [Sun, 8 May 2022 07:48:16 +0000 (13:18 +0530)]
common/cnxk: fix SQ flush sequence

Fix SQ flush sequence to issue NIX RX SW Sync after SMQ flush.
This sync ensures that all the packets that were in-flight are
flushed out of memory.

This patch also fixes NULL return issues reported by
static analysis tool in Traffic Manager and sync's mailbox
to that of the kernel version.

Fixes: 05d727e8b14a ("common/cnxk: support NIX traffic management")
Fixes: 0b7e667ee303 ("common/cnxk: enable packet marking")
Cc: stable@dpdk.org
Signed-off-by: Satha Rao <skoteshwar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support timestamp PKIND in CPT
Vidya Sagar Velumuri [Sun, 8 May 2022 07:48:15 +0000 (13:18 +0530)]
common/cnxk: support timestamp PKIND in CPT

Add new API to configure the SA table entries with new CPT PKIND
when timestamp is enabled.

Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: add new PKIND for CPT when ts is enabled
Vidya Sagar Velumuri [Sun, 8 May 2022 07:48:14 +0000 (13:18 +0530)]
common/cnxk: add new PKIND for CPT when ts is enabled

With timestamp enabled, time stamp will be added to second pass packets
from CPT. NPC needs different configuration to parse second pass packets
with and without timestamp.
New PKIND is defined for CPT when time stamp is enabled on NIX.
CPT should use this PKIND for second pass packets when TS is enabled for
corresponding ethdev port.

Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: add receive channel backpressure for SDP
Radha Mohan Chintakuntla [Sun, 8 May 2022 07:48:13 +0000 (13:18 +0530)]
net/cnxk: add receive channel backpressure for SDP

The SDP interfaces also need to be configured for NIX receive channel
backpressure for packet receive.

Signed-off-by: Radha Mohan Chintakuntla <radhac@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support multi channel for SDP send queues
Subrahmanyam Nilla [Sun, 8 May 2022 07:48:12 +0000 (13:18 +0530)]
common/cnxk: support multi channel for SDP send queues

Currently only base channel number is configured as default
channel for all the SDP send queues. Due to this, packets
sent on different SQ's are landing on the same output queue
on the host. Channel number in the send queue should be
configured according to the number of queues assigned to the
SDP PF or VF device.

Signed-off-by: Subrahmanyam Nilla <snilla@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support IPv6 fragment flow pattern item
Satheesh Paul [Wed, 27 Apr 2022 06:23:19 +0000 (11:53 +0530)]
net/cnxk: support IPv6 fragment flow pattern item

Support matching IPv6 fragment extension header
with RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT flow pattern item.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: enable 3DES-CBC capability
Vamsi Attunuru [Sat, 30 Apr 2022 04:59:55 +0000 (10:29 +0530)]
net/cnxk: enable 3DES-CBC capability

Enable 3DES-CBC capability of inline crypto device.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support custom SA index
Kiran Kumar K [Wed, 4 May 2022 05:11:18 +0000 (10:41 +0530)]
net/cnxk: support custom SA index

Adding cnxk device driver support to configure custom SA index.
Custom SA index can be configured as part of the session create
as SPI, and later original SPI can be updated using session update.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support parsing custom SA action
Kiran Kumar K [Wed, 4 May 2022 05:11:17 +0000 (10:41 +0530)]
net/cnxk: support parsing custom SA action

Adding devargs support to parse custom SA action.
Devargs can be specified in the following way.
-a 0002:02:00.0,custom_sa_act=1

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support parsing custom SA action
Kiran Kumar K [Wed, 4 May 2022 05:11:16 +0000 (10:41 +0530)]
common/cnxk: support parsing custom SA action

Adding ROC Flow changes to parse custom SA action for cnxk device.
When custom sa action is enabled, VTAG actions are not allowed.
And custom SA index will be calculated based on SA_HI and SA_LO
values. This allows the potential for a MCAM entry to match
many SAs, rather than only match a single SA.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: fix out of bounds accesses
Gowrishankar Muthukrishnan [Sun, 24 Apr 2022 16:23:26 +0000 (21:53 +0530)]
net/cnxk: fix out of bounds accesses

Fix out of bounds access in cmd array which was reported in coverity
scan.

Coverity issue: 375245, 375246, 375260, 375263, 375264, 375271
Coverity issue: 375278, 375279, 375273, 375274, 375275, 375276
Coverity issue: 375280, 375281, 375283, 375286
Fixes: c5b97e98837 ("net/cnxk: add cn10k template Tx functions to build")
Fixes: dd8c20eee47 ("net/cnxk: add cn9k template Tx functions to build")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: fix uninitialized variables
Gowrishankar Muthukrishnan [Sun, 24 Apr 2022 16:18:18 +0000 (21:48 +0530)]
net/cnxk: fix uninitialized variables

Fix uninitialized scalar variable reported in coverity scan.

Coverity issue: 371876, 371877
Coverity issue: 371872, 371880
Fixes: 39dc567c195 ("net/cnxk: add Tx burst for CN9K")
Fixes: 19f3af2371a ("net/cnxk: add Tx burst for CN10K")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: fix sizeof not portable
Gowrishankar Muthukrishnan [Sun, 24 Apr 2022 16:17:46 +0000 (21:47 +0530)]
common/cnxk: fix sizeof not portable

Fix sizeof not portable issue reported in coverity scan.

Coverity issue: 376538
Fixes: 7e9a94909ee ("common/cnxk: realloc inline device XAQ AURA")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: fix null pointer dereference
Gowrishankar Muthukrishnan [Sun, 24 Apr 2022 16:17:23 +0000 (21:47 +0530)]
common/cnxk: fix null pointer dereference

Fix null pointer dereference reported in coverity scan.

Coverity issue: 372065
Fixes: 665b6a7400b ("common/cnxk: add NPC helper API")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: fix unaligned access to device memory
Satheesh Paul [Wed, 20 Apr 2022 06:38:25 +0000 (12:08 +0530)]
common/cnxk: fix unaligned access to device memory

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

Fixes: 1f66919817e ("common/cnxk: improve MCAM entries management")
Cc: stable@dpdk.org
Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: add message on flow parsing failure
Satheesh Paul [Tue, 19 Apr 2022 06:34:38 +0000 (12:04 +0530)]
net/cnxk: add message on flow parsing failure

Set the error message with rte_flow_error_set() API
when flow parsing fails.

Fixes: 8c009b4505e ("net/cnxk: support flow API")
Cc: stable@dpdk.org
Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Reviewed-by: Kiran Kumar K <kirankumark@marvell.com>
2 years agonet/cnxk: use ROC errata API
Rahul Bhansali [Wed, 30 Mar 2022 08:43:56 +0000 (14:13 +0530)]
net/cnxk: use ROC errata API

Used errata APIs roc_errata_nix_has_no_drop_re() and
roc_errata_nix_has_cq_min_size_4k() instead of direct
ROC model check.

Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: add ROC errata list
Rahul Bhansali [Wed, 30 Mar 2022 08:43:55 +0000 (14:13 +0530)]
common/cnxk: add ROC errata list

Created roc_errata.h to list the errata handled in userspace drivers.
Added no_drop_re, cq_min_size_4k, no_fc_stype_ststp, no_drop_aging,
no_vwqe_flush_op etc erratas.

Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: fix crash during hotplug detach operation
Sunil Kumar Kori [Tue, 29 Mar 2022 10:28:57 +0000 (15:58 +0530)]
net/cnxk: fix crash during hotplug detach operation

hot_plug application does not perform any port setup
configuration via rte_eth_dev_configure() API. All the probed
Ethernet ports do not contain any Rx and Tx queues.

While detaching a device via rte_eal_hotplug_remove(), CNXK
driver expects Rx and Tx queues structures populated during
reset of PFC. So application gets crashed as data->rx_queues
and data->tx_queues are NULL.

Fixes: 9544713564f5 ("net/cnxk: support priority flow control")
Cc: stable@dpdk.org
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: add null check for inline device
Volodymyr Fialko [Mon, 28 Mar 2022 10:41:02 +0000 (12:41 +0200)]
common/cnxk: add null check for inline device

Inline device could be null in cases when it was not bound or missing.
Added check to prevent null pointer access.

Fixes: fe5846bcc07 ("net/cnxk: add devargs for min-max SPI")
Cc: stable@dpdk.org
Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
2 years agocommon/cnxk: fix QinQ ROC item mismatch
Satheesh Paul [Thu, 17 Mar 2022 03:50:36 +0000 (09:20 +0530)]
common/cnxk: fix QinQ ROC item mismatch

ROC code is assuming presence of vlan extension headers in
case of QinQ, because of this, there is incompatibility
between the driver and ROC. Fixed this in ROC by treating
QINQ as multiple VLAN pattern items for DPDK (as opposed to
treating QINQ as separate pattern item).

Fixes: b8ac8b089ce ("common/cnxk: support matching VLAN existence")
Cc: stable@dpdk.org
Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: correct ROC naming conventions
Satheesh Paul [Thu, 17 Mar 2022 03:50:35 +0000 (09:20 +0530)]
common/cnxk: correct ROC naming conventions

Corrected some names to follow ROC naming convention in ROC NPC code.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support mark pattern item type
Satheesh Paul [Mon, 28 Feb 2022 04:53:22 +0000 (10:23 +0530)]
net/cnxk: support mark pattern item type

Added support for RTE_FLOW_ITEM_TYPE_MARK. This item type
can be used to create ingress flow rules to match packets
from CPT's second pass packets.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>