Commit Graph

34447 Commits

Author SHA1 Message Date
Shun Hao
e551740696 net/mlx5: fix action flag data type
MLX5_FLOW_ACTION flags are used as uint64_t now, but some old flags
are not defined as 64 bits. So if they are type casted to uint64 after
bitwise operations, the high 32-bit data might be incorrect.

E.g. Currently MLX5_FLOW_ACTION_DROP is defined as 0x1u, when it is used
like:
	(action_flags & ~MLX5_FLOW_ACTION_DROP)
action_flags is uint64_t so (~MLX5_FLOW_ACTION_DROP) will be casted to
uint64_t as well, but its high 32 bits will be all 0s. This will make the
result not as expected.

This patch fixes this by making all action flags definition as 64-bit
data type.

Fixes: 4b7bf3ffb4 ("net/mlx5: support yellow in meter policy validation")
Cc: stable@dpdk.org

Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2022-11-10 18:15:46 +01:00
Michael Baum
d37435dc3f net/mlx5: assert for enough space in counter rings
There is a by-design assumption in the code that the global counter
rings can contain all the port counters.
So, enqueuing to these global rings should always succeed.

Add assertions to help for debugging this assumption.

In addition, change mlx5_hws_cnt_pool_put() function to return void due
to those assumptions.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Xiaoyu Min <jackmin@nvidia.com>
2022-11-10 18:15:45 +01:00
Michael Baum
77ca194b4e net/mlx5: add assertions in counter get/put for HWS
Add assertions to help debug in case of counter double alloc/free.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Xiaoyu Min <jackmin@nvidia.com>
2022-11-10 18:15:45 +01:00
Michael Baum
2fd25a6d13 net/mlx5: fix counter elements copies for HWS
The __hws_cnt_r2rcpy() function copies elements from one zero-copy ring
to another zero-copy ring in place.
This routine needs to consider the situation that the address was given
by source and destination could be both wrapped.

It uses 4 different "n" local variables to manage it:
 - n:  Number of elements to copy in total.
 - n1: Number of elements to copy from ptr1, it is the minimal value
       from source/dest n1 field.
 - n2: Number of elements to copy from src->ptr1 to dst->ptr2 or from
       src->ptr2 to dst->ptr1, this variable is 0 when both source and
       dest n1 field are equal.
 - n3: Number of elements to copy from src->ptr2 to dst->ptr2.

The function copies the first n1 elements. If n2 isn't zero it copies
more elements and check whether n3 is zero.
This logic is wrong since n3 may be bigger than zero even when n2 is
zero. This scenario is commonly happening in counters when the internal
mlx5 service thread copies elements from the reset ring into the reuse
ring.

This patch changes the function to copy n3 regardless of n2 value.

Fixes: 4d368e1da3 ("net/mlx5: support flow counter action for HWS")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Xiaoyu Min <jackmin@nvidia.com>
2022-11-10 18:15:45 +01:00
Michael Baum
5b21f92556 net/mlx5: fix counter access for HWS
The HWS counter has 2 different identifiers:
1. Type "cnt_id_t" which represents the counter inside caches and in
   the flow structure. This index cannot be zero and is mostly called
   "cnt_id".
 2. Internal index, the index in counters array with type "uint32_t".
    mostly it is called "iidx".
The second ID is calculated from the first using "mlx5_hws_cnt_iidx()"
function.

When a direct counter is allocated, if the queue cache is not empty, the
counter represented by cnt_id is popped from the cache. This counter may
be invalid according to the query_gen field. Thus, the "iidx" is parsed
from cnt_id and if it is valid, it is used to update the fields of the
counter structure.
When this counter is invalid, all the cache is flashed and new counters
are fetched into the cache. After fetching, another counter represented
by cnt_id is taken from the cache.
Unfortunately, for updating fields like "in_used" or "age_idx", the
function wrongly may use the old "iidx" coming from an invalid cnt_id.

Update the "iidx" in case of an invalid counter popped from the cache.

Fixes: 4d368e1da3 ("net/mlx5: support flow counter action for HWS")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Xiaoyu Min <jackmin@nvidia.com>
2022-11-10 18:15:44 +01:00
Michael Baum
a94e89e47b net/mlx5: fix race condition in counter pool resizing
Counter management structure has array of counter pools. This array is
invalid in management structure initialization and grows on demand.

The resizing include:
1. Allocate memory for the new size.
2. Copy the existing data to the new memory.
3. Move the pointer to the new memory.
4. Free the old memory.

The third step can be performed before for this function, and compiler
may do that, but another thread might read the pointer before coping and
read invalid data or even crash.

This patch allocates memory for this array once in management structure
initialization and limit the counters number by 16M.

Fixes: 3aa279157f ("net/mlx5: synchronize flow counter pool creation")
Cc: stable@dpdk.org

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2022-11-10 18:15:44 +01:00
Suanming Mou
d114dbee28 net/mlx5: enable queue flow aging action
As the queue-based aging API has been integrated[1], the flow aging
action support in HWS steering code can be enabled now.

[1]: https://patchwork.dpdk.org/project/dpdk/cover/
20221026214943.3686635-1-michaelba@nvidia.com/

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2022-11-10 18:15:43 +01:00
Alex Vesker
0bed4ef76f net/mlx5/hws: remove deprecated rte_atomic
The use of rte_atomic functions is deprecated and is not
required in HWS code. HWS refcounts are used only during
control and always under lock.

Fixes: f8c8a6d844 ("net/mlx5/hws: add action object")

Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2022-11-10 18:15:43 +01:00
Abdullah Ömer Yamaç
7dde9c844a drivers: omit symbol map when unneeded
In this patch, we removed the necessity of the version files and
you don't need to update these files for each release, you can just
remove them.

Suggested-by: Ferruh Yigit <ferruh.yigit@amd.com>
Signed-off-by: Abdullah Ömer Yamaç <omer.yamac@ceng.metu.edu.tr>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@amd.com>
2022-11-14 15:22:46 +01:00
Thomas Monjalon
d7b705b47f maintainers: update for pmdinfo tool
The original maintainer of pmdinfo/pmdinfogen
did not send an email for 2 years.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
2022-11-14 11:30:39 +01:00
Thomas Monjalon
04fd724416 maintainers: group service cores files
Move example with library files, all with the same maintainer.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
2022-11-14 11:30:39 +01:00
David Marchand
ecf7518017 build: list selected applications
With the addition of enable/disable_apps meson options, it is a bit
harder to figure out which application is built, and why.

Display the list of applications in the same way we do for drivers and
libraries.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Markus Theil <markus.theil@secunet.com>
2022-11-14 11:30:02 +01:00
Thomas Monjalon
e9cc7c7abc common/mlx5: use build configuration dictionary
A recent commit added an explicit dependency check on common/mlx5.
For consistency, query dpdk_conf instead of the list of common drivers.
The lists *_drivers should be used only for printing.

Fixes: 3df380f617 ("common/mlx5: fix disabling build")

Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2022-11-14 11:28:49 +01:00
Bing Zhao
bc96714996 bus/auxiliary: prevent device from being probed again
The device on auxiliary bus doesn't support being probed again
without being removed firstly. The PMD will detect and return error
for this unsupported operation. Some of the resources would be
cleared wrongly. When quitting, there will be unexpected error like
crash.

To prevent this, the device driver will be checked before probing a
device.

Fixes: 1afce3086c ("bus/auxiliary: introduce auxiliary bus")
CC: stable@dpdk.org

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Reviewed-by: Gregory Etelson <getelson@nvidia.com>
Reviewed-by: Matan Azrad <matan@nvidia.com>
2022-11-14 11:15:44 +01:00
Vladimir Medvedkin
521171cf2a test/hash: fix bulk lookup check
Check return value after bulk lookup.

Coverity issue: 357746
Fixes: 14b8ab5762 ("hash: add bulk lookup with signatures array")
Cc: stable@dpdk.org

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-11-14 11:06:06 +01:00
Vladimir Medvedkin
e5408325f3 test/hash: remove dead code in extendable bucket test
Remove unnecessary variable assignment.

Coverity issue: 336800
Fixes: 3f9aab961e ("test/hash: check lock-free extendable bucket")
Cc: stable@dpdk.org

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2022-11-14 11:05:09 +01:00
Jun Qiu
bdd0c62c69 hash: fix RCU configuration memory leak
The memory of h->hash_rcu_cfg which is allocated in
rte_hash_rcu_qsbr_add was leaked.

Fixes: 769b2de7fb ("hash: implement RCU resources reclamation")
Cc: stable@dpdk.org

Signed-off-by: Jun Qiu <jun.qiu@jaguarmicro.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2022-11-14 11:03:54 +01:00
Tadhg Kearney
08aa805a0b power: fix double free of opened files
Fix double free of f_min and f_max by reverting the fclose() for f_min
and f_max. As f_min and f_max are stored for further use and closed in
uncore deinitialization.

Fixes: b127e74cce ("power: fix open file descriptors leak")

Signed-off-by: Tadhg Kearney <tadhg.kearney@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
2022-11-14 10:39:24 +01:00
Jerin Jacob
58794bf8d2 power: fix some doxygen comments
Fix following syntax error reported by doxygen 1.9.5 version.

lib/power/rte_power.h:169: error: rte_power_freq_up has
@param documentation sections but no arguments
(warning treated as error, aborting now)

Fixes: d7937e2e3d ("power: initial import")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
2022-11-14 10:38:41 +01:00
Jerin Jacob
61c7dfe75a eal: fix doxygen comments for UUID
Fix following syntax error reported by doxygen 1.9.5 version.

lib/eal/include/rte_uuid.h:89: error: RTE_UUID_STRLEN
has @param documentation sections but no arguments
(warning treated as error, aborting now)

Fixes: 6bc67c497a ("eal: add uuid API")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
2022-11-14 10:37:33 +01:00
Junfeng Guo
10d9e91a76 net/gve: support queue release
Add support for queue operations:
 - rx_queue_release
 - tx_queue_release

Previous gve_tx_queue_release and gve_rx_queue_release functions are
only used internally to release Rx/Tx queue related resources.

But when the queues or ports are required to re-config, both of the dev
ops tx_queue_release and ops rx_queue_release will be checked and then
called.

Without these two dev ops, the Rx/Tx queue struct will be set as NULL
directly.

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
2022-11-11 15:48:09 +01:00
Hanumanth Pothula
4f04edcda7 app/testpmd: support multiple mbuf pools per Rx queue
Some of the HW has support for choosing memory pools based on
the packet's size. The pool sort capability allows PMD/NIC to
choose a memory pool based on the packet's length.

On multiple mempool support enabled, populate mempool array
accordingly. Also, print pool name on which packet is received.

Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2022-11-10 11:30:36 +01:00
Yuan Wang
54a0f4d756 app/testpmd: fix protocol header list for Rx buffer split
The "show config rxhdrs" cmd displays the configured protocol headers
that are used for protocol-based buffer split.
However, it shows inner-ipv6 as inner-ipv4.

This patch fixes that by redefining rx_pkt_hdr_protos to hold
the full ptypes, and the show and set commands therefore
remain symmetrical.

Fixes: 52e2e7edcf ("app/testpmd: add protocol-based buffer split")

Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2022-11-10 09:52:25 +01:00
Alexander Kozyrev
f4f7ba1ad2 app/testpmd: fix flow list with async flow API
Flows created with the new asynchronous flow API lack attributes
(direction, priority, group number). These attributes are part of
a template table for flows created via rte_flow_async_create().

When testpmd tries to list all the flows it accesses flow
attributes via pointer and crashes. Save flow attributes during
the template table creation and use them in the "flow list" output.

Fixes: ecdc927b99 ("app/testpmd: add async flow create/destroy operations")
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2022-11-10 07:52:00 +01:00
Huisong Li
b4924c0db5 net/bonding: fix mbuf fast free handling
The RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload can't be used in bonding
mode Broadcast and mode 8023AD. Currently, bonding driver forcibly removes
from the dev->data->dev_conf.txmode.offloads and processes as success in
bond_ethdev_configure(). But this still cause that rte_eth_dev_configure()
fails to execute because of the failure of validating Tx offload in the
eth_dev_validate_offloads(). So this patch moves the modification of txmode
offlaods to the stage of adding slave device to report the correct txmode
offloads.

Fixes: 18c41457cb ("net/bonding: fix mbuf fast free usage")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2022-11-10 07:40:22 +01:00
Stephen Hemminger
4c243bd4a8 app/testpmd: make quit flag volatile
Since f_quit is set in a signal handler it needs to be marked
volatile.  Otherwise, compiler is allowed to optimize the loop because
it can assume the value never changes. The flag can also be made local
to the file it is used in.

Fixes: d9a191a00e ("app/testpmd: fix quitting in container")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2022-11-10 07:40:22 +01:00
Huisong Li
7c06f1ab3b app/testpmd: update bonding configuration for new slave
Some capabilities (like, rx_offload_capa and tx_offload_capa) of bonding
device in dev_info is zero when no slave is added. And its capability will
be updated when add a new slave device.

The capability to update dynamically may introduce some problems if not
handled properly. For example, the reconfig() is called to initialize
bonding port configurations when create a bonding device. The global
tx_mode is assigned to dev_conf.txmode. The DEV_TX_OFFLOAD_MBUF_FAST_FREE
which is the default value of global tx_mode.offloads in testpmd is removed
from bonding device configuration because of zero rx_offload_capa.
As a result, this offload isn't set to bonding device.

Generally, port configurations of bonding device must be within the
intersection of the capability of all slave devices. If use original port
configurations, the removed capabilities because of adding a new slave may
cause failure when re-initialize bonding device.

So port configurations of bonding device need to be updated because of the
added and removed capabilities. In addition, this also helps to ensure
consistency between testpmd and bonding device.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Min Hu (Connor) <humin29@huawei.com>
2022-11-07 06:33:37 +01:00
Huisong Li
30bfba52cf net/bonding: fix dropping valid MAC packets
Currently, by default, bond4 will first try to enable allmulti and
then enable promiscuous if fail to enable allmulti. On reception,
whether unicast and multicast packets should be dropped depends on
which mode has been enabled on the bonding interface.

In fact, if MAC address of packets in mac_addrs array of bonding
interface, these packets should not be dropped. However, now only
check the default MAC address, which will cause the packets with
MAC added by the '.mac_addr_add' are dropped.

Fixes: 68218b87c1 ("net/bonding: prefer allmulti to promiscuous for LACP")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2022-11-06 11:53:32 +01:00
Nathan Skrzypczak
c1c8a32ad2 net/memif: increase link speed to 100G
Change the advertised link speed from 10G to 100G as the memory
interfaces can reach higher throughput than 10G with large packets.

Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2022-11-06 11:45:44 +01:00
Gregory Etelson
236bc417e2 app/testpmd: fix MAC header in checksum forward engine
MLX5 SR-IOV Tx engine will not transmit Ethernet frame
if destination MAC address matched local port address. The frame ether
looped-back to Rx or dropped, depending on the port configuration.

Application running over MLX5 SR-IOV port cannot transmit packet
polled from Rx queue as is. The packet Ethernet destination address
must be changed.

Add new run-time configuration parameter to the `csum` forwarding
engine to control MAC addresses configuration:

testpmd> csum mac-swap on|off <port_id>

`mac-swap on`  replace MAC addresses.
`mac-swap off` keep Ethernet header unchanged.

Fixes: 9b4ea7ae77 ("app/testpmd: revert MAC update in checksum forwarding")
Cc: stable@dpdk.org

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
2022-11-06 10:48:08 +01:00
Huisong Li
b514566778 net/bonding: fix slave device Rx/Tx offload configuration
Normally, the Rx/Tx offload capability of bonding interface is
the intersection of the capability of all slave devices. And
Rx/Tx offloads configuration of slave device comes from bonding
interface. But now there is a risk that slave device retains its
previous offload configurations which is not within the offload
configurations of bond interface.

Fixes: 57b156540f ("net/bonding: fix offloading configuration")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
2022-11-06 10:44:01 +01:00
Ivan Malov
550e8d6d34 net/bonding: set initial value of descriptor count alignment
The driver had once been broken by patch [1] looking to have
a non-zero "nb_max" value in a use case not involving adding
any back-end ports. That was addressed afterwards ([2]). But,
as per report [3], similar test cases exist which attempt to
setup Rx queues on a void bond before attaching any back-end
ports. Rx queue setup, in turn, involves device info get API
invocation, and one of the checks on received data causes an
exception (division by zero). The "nb_align" value is indeed
zero at that time, but, as explained in [2], such test cases
are totally incorrect since a bond device must have at least
one back-end port plugged before any ethdev APIs can be used.

Once again, to avoid any problems with fixing the test cases,
this patch adjusts the bond PMD itself to workaround the bug.

[1] commit 5be3b40fea ("net/bonding: fix values of descriptor limits")
[2] commit d03c0e83cc ("net/bonding: fix descriptor limit reporting")
[3] https://bugs.dpdk.org/show_bug.cgi?id=1118

Bugzilla ID: 1118
Fixes: d03c0e83cc ("net/bonding: fix descriptor limit reporting")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
Tested-by: Weiyuan Li <weiyuanx.li@intel.com>
2022-11-06 10:38:23 +01:00
Ivan Malov
5847b57aed net/bonding: fix device configure reentrancy
As per report [1], the previous patch for device
configure code apparently overlooks the corner
case of manually adding back-end devices to
the bond using testpmd CLI. The problem is
in removing back-end ports on re-configure
instead of just stopping them. Fix that.

[1] https://bugs.dpdk.org/show_bug.cgi?id=1119

Bugzilla ID: 1119
Fixes: 339f1ba513 ("net/bonding: make configure method re-entrant")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Tested-by: Dukai Yuan <dukaix.yuan@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2022-11-06 10:36:55 +01:00
Chaoyong He
98e675a4e9 net/nfp: fix out-of-bounds write for VXLAN
Fix the check logic of the index of the array, which
caused the out of bounds write problem.

Coverity issue: 381616
Fixes: c55abf6141 ("net/nfp: support RSS on VXLAN inner layer")

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
2022-11-06 10:30:28 +01:00
Andrew Boyer
3c02593c9e net/ionic: fix false positive forward-null in Tx
If tx_pkts is NULL, nb_pkts must be 0. Coverity doesn't know
this so it thinks this is a forward-NULL violation.
Make things more clear by checking for nb_pkts instead.

Coverity issue: 381614
Coverity issue: 381619
Fixes: e86a6fcc7c ("net/ionic: add optimized non-scattered Rx/Tx")

Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>
2022-11-06 10:21:13 +01:00
Andrew Boyer
4b53e9802b net/ionic: fix sign extension in queue allocation
(uint16_t * uint16_t) promoted to uint64_t has a sign extension
problem reported by Coverity. Cast one arg to uint64_t first
to eliminate the sign extension.

Coverity issue: 381617
Coverity issue: 381618
Fixes: 7b20fc2f3c ("net/ionic: overhaul Rx for performance")

Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>
2022-11-06 10:21:13 +01:00
Junfeng Guo
0cfde775a6 net/gve: fix Rx/Tx queue dereference before null check
The pointers 'rxq' and 'txq' are dereferenced before the null check.
Fixed the logic in this patch.

Fixes: 4bec2d0b55 ("net/gve: support queue operations")

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
2022-10-31 14:39:27 +01:00
Morten Brørup
203dcc9cfe mempool: use cache for frequently updated stats
When built with stats enabled (RTE_LIBRTE_MEMPOOL_STATS defined),
the performance of mempools with caches is improved as follows.

When accessing objects in the mempool, either the put_bulk and put_objs or
the get_success_bulk and get_success_objs statistics counters are likely
to be incremented.

By adding an alternative set of these counters to the mempool cache
structure, accessing the dedicated statistics structure is avoided
in the likely cases where these counters are incremented.

The trick here is that the cache line holding the mempool cache structure
is accessed anyway, in order to access the 'len' or 'flushthresh' fields.
Updating some statistics counters in the same cache line has lower
performance cost than accessing the statistics counters in the dedicated
statistics structure, which resides in another cache line.

mempool_perf_autotest with this patch shows the following improvements in
rate_persec.

The cost of enabling mempool stats (without debug) after this patch:
-6.8 % and -6.7 %, respectively without and with cache.

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
2022-11-10 17:32:54 +01:00
Morten Brørup
17749e4d64 mempool: add stats for unregistered non-EAL threads
This patch adds statistics for unregistered non-EAL threads,
which was previously not included in the statistics.

Add one more entry to the stats array,
and use the last index for unregistered non-EAL threads.

The unregistered non-EAL thread statistics are incremented atomically.

In theory, the EAL thread counters should also be accessed atomically to
avoid tearing on 32 bit architectures. However, it was decided to avoid
the performance cost of using atomic operations, because:
1. these are debug counters, and
2. statistics counters in DPDK are usually incremented non-atomically.

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
2022-11-10 17:32:54 +01:00
Morten Brørup
9d87e05d08 mempool: split stats from debug mode
Split stats from debug, to make mempool statistics available without the
performance cost of continuously validating the debug cookies in the
mempool elements.

mempool_perf_autotest shows the following improvements in rate_persec.

The cost of enabling mempool debug without this patch:
-28.1 % and -74.0 %, respectively without and with cache.

The cost of enabling mempool stats (without debug) after this patch:
-5.8 % and -21.2 %, respectively without and with cache.

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
2022-11-10 17:32:45 +01:00
Juraj Linkeš
5d67406528 dts: add executable script
The script is an interface to run DTS.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
2022-11-09 18:07:56 +01:00
Juraj Linkeš
57c58bf832 dts: add workflow module
The module implements methods needed to run DTS. It handles the creation
of objects and eventually the whole DTS workflow, such as running node
setups, test gathering, setup and execution and various cleanups.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
2022-11-09 18:07:56 +01:00
Juraj Linkeš
c4ef44de8d dts: add node base class
The base class implements basic node management methods - connect and
execute commands.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
2022-11-09 18:07:56 +01:00
Juraj Linkeš
812c4071a6 dts: add SSH session
The module uses the pexpect python library and implements connection to
a node and two ways to interact with the node:
1. Send a string with specified prompt which will be matched after
   the string has been sent to the node.
2. Send a command to be executed. No prompt is specified here.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
2022-11-09 18:07:56 +01:00
Juraj Linkeš
34dfd2654c dts: add remote session abstraction
The abstraction allows for easy switching of implementations of remote
connections (ssh, telnet, etc.). It implements some common features,
such as logging of commands and their outputs and history bookkeeping
and defines methods that must be implemented by derived classes.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
2022-11-09 18:07:56 +01:00
Juraj Linkeš
179d705936 dts: add basic logging
The logging module provides loggers distinguished by two attributes,
a custom format and a verbosity switch. The loggers log to both console
and more verbosely to files.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
2022-11-09 18:07:56 +01:00
Owen Hilyard
995fb3372e dts: add config parser
The configuration is split into two parts, one defining the parameters
of the test run and the other defining the topology to be used.

The format of the configuration is YAML. It is validated according to a
json schema which also server as detailed documentation of the various
configuration fields. This means that the complete set of allowed values
are tied to the schema as a source of truth. This enables making changes
to parts of DTS that interface with config files without a high risk of
breaking someone's configuration.

This configuration system uses immutable objects to represent the
configuration, making IDE/LSP autocomplete work properly.

There are two ways to specify the configuration file path, an
environment variable or a command line argument, applied in that order.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
2022-11-09 18:07:56 +01:00
Juraj Linkeš
724b8a37be dts: add code formatting and check
The devtools that check Python code are Black and Isort to format the
code and Pylama to do static analysis.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
2022-11-09 18:07:56 +01:00
Juraj Linkeš
bb5f299066 dts: add tools configuration
Add configuration for Python tools used in DTS:
Poetry, dependency and package manager
Black, formatter
Pylama, static analysis
Isort, import sorting

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
2022-11-09 18:07:56 +01:00
Rahul Bhansali
a39f5e1456 examples/l2fwd: check Rx packets count
An additional check is added to avoid extra processing if
receive packets are 0.

Performance impact: with Marvell OCTEON TX2 platform, observed an
improvement by ~14%.

Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2022-11-02 16:54:43 +01:00