Commit Graph

33385 Commits

Author SHA1 Message Date
David Marchand
97bbdba31d dev: introduce driver accessors
Prepare for making the driver object opaque by adding accessors.
Update existing "external" users.
Internal users may still dereference a rte_driver object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-23 16:14:34 +02:00
David Marchand
a04322f616 bus: hide bus object
Make rte_bus opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Introduce a new driver header and move rte_bus definition and helpers.
Update drivers and library to use the internal header.

Some applications may have been dereferencing rte_bus objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-23 16:14:34 +02:00
David Marchand
148c51a3de bus: introduce accessors
Add helpers to get a rte_bus object details.
This will be used externally.
Internal users may still dereference a rte_bus object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-23 16:14:34 +02:00
David Marchand
770ebc060e bus: move IOVA definition from header
iova enum definition does not need to be defined as part of the bus API.
Move it to rte_eal.h.
With this step, rte_eal.h does not depend on rte_bus.h and rte_dev.h.
Fix existing code that was relying on these implicit inclusions.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-23 16:14:34 +02:00
David Marchand
84aaf06d81 bus/vmbus: make driver-only headers private
The vmbus bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup the code:
- fix indentation,
- remove unneeded reference to bus specific singleton object,
- remove unneeded list head structure type,
- reorder the definitions and macro manipulating the bus singleton object,
- remove inclusion of rte_bus.h and fix the code that relied on implicit
  inclusion,

Signed-off-by: David Marchand <david.marchand@redhat.com>
2022-09-23 16:14:34 +02:00
David Marchand
4851ef2b40 bus/vdev: make driver-only headers private
The vdev bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup the code:
- fix indentation,
- remove unneeded reference to bus specific singleton object,
- remove unneeded list head structure type,
- reorder the definitions and macro manipulating the bus singleton object,
- remove inclusion of rte_bus.h and fix the code that relied on implicit
  inclusion,

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2022-09-23 16:14:34 +02:00
David Marchand
1f37cb2bb4 bus/pci: make driver-only headers private
The pci bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup the code:
- fix indentation,
- remove unneeded reference to bus specific singleton object,
- remove unneeded list head structure type,
- reorder the definitions and macro manipulating the bus singleton object,
- remove inclusion of rte_bus.h and fix the code that relied on implicit
  inclusion,

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
2022-09-23 16:14:34 +02:00
David Marchand
925c074e37 bus/ifpga: make driver-only headers private
The ifpga bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup the code:
- remove unneeded list head structure type,
- reorder the definitions and macro manipulating the bus singleton object,
- remove inclusion of rte_bus.h and fix the code that relied on implicit
  inclusion,

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
2022-09-23 16:14:34 +02:00
David Marchand
9c89c333bc bus/ifpga: cleanup exported symbols
Remove unused symbols (exposed only in an internal header which
guarantees that no application out there relied on them).

Remove rte_ prefix and inline the rest to avoid having to expose them as
global symbols for a relatively small added value.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
2022-09-23 16:14:34 +02:00
David Marchand
b4f22ca5cb bus/fslmc: make driver-only headers private
The fslmc bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup internal structures:
- remove unneeded reference to bus specific singleton object,
- remove unneeded list head structure type,
- reorder the definitions and macro manipulating the bus singleton object,
- remove inclusion of rte_bus.h and update code that relied on it,

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2022-09-23 16:14:34 +02:00
David Marchand
a2f1da7da8 bus/dpaa: make driver-only headers private
The dpaa bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup internal structures:
- remove unneeded reference to bus specific singleton object,
- remove unneeded list head structure type,
- reorder the definitions and macro manipulating the bus singleton object,
- remove inclusion of rte_bus.h and update code that relied on it,

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2022-09-23 16:14:34 +02:00
David Marchand
b3f89090d6 bus/auxiliary: make driver-only headers private
The auxiliary bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup the code:
- fix indentation,
- remove unneeded reference to bus specific singleton object,
- remove unneeded list head structure type,
- reorder the definitions and macro manipulating the bus singleton object,
- remove inclusion of rte_bus.h and fix the code that relied on implicit
  inclusion,

Signed-off-by: David Marchand <david.marchand@redhat.com>
2022-09-23 16:14:34 +02:00
David Marchand
ada7338954 build: export drivers headers
Same as for device classes, external DPDK users may need to include some
bus headers for their out of tree drivers.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-23 16:14:34 +02:00
David Marchand
82ee04a855 devargs: remove dependency on bus header
We don't need to include rte_bus.h in rte_devargs.h.
Only a forward declaration of rte_bus and an inclusion of rte_dev.h are
needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-23 16:14:34 +02:00
David Marchand
8f1d23ece0 eal: deprecate RTE_FUNC_PTR_* macros
Those macros have no real value and are easily replaced with a simple
if() block.

Existing users have been converted using a new cocci script.
Deprecate them.

Signed-off-by: David Marchand <david.marchand@redhat.com>
2022-09-23 16:14:34 +02:00
David Marchand
99948194a8 dev: hide debug messages in device iterator
For any bus that does not support device iteration, rte_dev_iterator_init
both returned an error code and logged an error message.
An application (like testpmd) that only wants to list devices, would have
no choice but to inspect a bus object to avoid spewing error logs.

Make those log messages debug level, and remove the check in testpmd.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-23 16:14:34 +02:00
David Marchand
d589a8a8a7 examples/ethtool: prefer device name
Rely on the generic device name rather than restrict to only supporting
PCI devices.

Signed-off-by: David Marchand <david.marchand@redhat.com>
2022-09-23 16:14:33 +02:00
David Marchand
18bdf6ab8e kni: stop populating PCI info in examples
addr and id fields are deprecated and are not used in the kni library.
Stop populating them in the in-tree examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-23 16:14:33 +02:00
David Marchand
1bcb7ba9de app/testpmd: drop PCI register commands
Those commands date back to the early stages of DPDK when only PCI
devices were supported.
At the time, developers may have used those commands to help in
debugging their buggy^Wwork in progress drivers.

Removing them, we can drop the dependency on the PCI bus and library and
make testpmd bus agnostic.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-23 16:14:33 +02:00
David Marchand
9c1b4ae5c0 raw/ifpga: remove PCI bus accessor
There is no in-tree user for this accessor that returns the PCI bus
object.
On the other hand, a bus object can be retrieved by name using
rte_bus_find_by_name.
We can remove this driver specific API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
2022-09-23 16:14:33 +02:00
David Marchand
709b9a4770 common/mlx5: rework check on driver registration
Rely on a local flag rather than dereference a bus object.
This will help next commits.

Signed-off-by: David Marchand <david.marchand@redhat.com>
2022-09-23 16:14:33 +02:00
David Marchand
cfb4161d03 devtools: forbid inclusions of driver only headers
Let's be good citizens and enforce not using driver only headers in our
own examples.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-23 16:14:33 +02:00
Cristian Dumitrescu
9ebff617fe pipeline: support moving large structure fields
Add support to the move instruction for operands bigger than 64 bits.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Harshad Narayane <harshad.suresh.narayane@intel.com>
2022-09-23 13:56:01 +02:00
Cristian Dumitrescu
86347cd9ce pipeline: support large default action arguments
Support structure fields bigger than 64 bits as default action
arguments.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Harshad Narayane <harshad.suresh.narayane@intel.com>
2022-09-23 13:56:01 +02:00
Cristian Dumitrescu
103b303d4c pipeline: read large structure fields on control path
Support reading structure fields that are bigger than 64 bits on the
control path for the table update operations.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Harshad Narayane <harshad.suresh.narayane@intel.com>
2022-09-23 13:56:01 +02:00
Cristian Dumitrescu
076d612875 pipeline: remove 64-bit limit for structure fields
Remove the generic limitation of structure fields to 64 bits or less
and push this restriction to the instructions that require it.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Harshad Narayane <harshad.suresh.narayane@intel.com>
2022-09-23 13:56:01 +02:00
Abdullah Sevincer
aec322ce15 eal: export coremask parsing helper
DLB2 has a need to parse a user supplied coremask as part
of an optimization that associates optimal core/resource
pairs. Therefore eal_parse_coremask has been renamed
to rte_eal_parse_coremask and exported but kept internal.

Signed-off-by: Abdullah Sevincer <abdullah.sevincer@intel.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
2022-09-23 12:07:49 +02:00
Thomas Monjalon
40c7e9608b gpu/cuda: fix build
A recent commit removed errno.h from rte_common.h.
It has to be added in various places where it is used,
and was implicitly included via rte_common.h,
but was forgotten in gpu/cuda.

As a result, the compilation is broken:
	drivers/gpu/cuda/gdrcopy.c:116:17: error: ‘ENOTSUP’ undeclared

Note that rte_errno.h does not include errno.h.
The include of errno.h is added.

Fixes: 72b452c5f2 ("eal: remove unneeded includes from a public header")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: David Marchand <david.marchand@redhat.com>
2022-09-23 10:39:36 +02:00
Cristian Dumitrescu
d2384afb47 net/softnic: print output port packet drop counters
Print the output port packet drop statistics counters.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2022-09-22 16:56:58 +02:00
Cristian Dumitrescu
67f707b354 examples/pipeline: print output port packet drop counters
Print the output port pacet drop statistics counters.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2022-09-22 16:56:58 +02:00
Cristian Dumitrescu
f8b0c950a5 port: prevent unnecessary flush for ring output port
Do not flush the buffered packets unnecessarily when a burst was sent
since the last flush call.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2022-09-22 16:56:58 +02:00
Cristian Dumitrescu
0b5122dcf5 port: free buffered packets on ring output port free
Free the buffered packets as opposed to retrying to send them when the
output port is freed.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2022-09-22 16:56:58 +02:00
Cristian Dumitrescu
87eda68957 port: rework ring output port behavior to non-blocking
Drop packets that cannot be sent instead of retry sending the same
packets potentially forever when the ring consumer that is down.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2022-09-22 16:56:58 +02:00
Cristian Dumitrescu
45b3fcbfd1 port: prevent unnecessary flush for ethdev output port
Do not flush the buffered packets unnecessarily when a burst was sent
since the last flush call.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2022-09-22 16:56:58 +02:00
Cristian Dumitrescu
7150064dc2 port: free buffered packets on ethdev output port free
Free the buffered packets as opposed to retrying to send them when the
output port is freed.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2022-09-22 16:56:58 +02:00
Cristian Dumitrescu
f317fff048 port: rework ethdev output port behavior to non-blocking
Drop packets that cannot be sent instead of retry sending the same
packets potentially forever when the Ethernet device that is down.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2022-09-22 16:56:58 +02:00
Cristian Dumitrescu
7c10ca26f0 port: adjust sink port counters
The sink port is tasked to drop all packets, hence the packet and byte
counters should be named to reflect the drop operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2022-09-22 16:56:58 +02:00
Cristian Dumitrescu
e28e064b28 port: add output port packet drop counters
Add packet drop statistics counters for the output ports. Required by
the non-blocking output port behavior where the packets that cannot
be sent at the time of the operation are dropped as opposed to the
send operation being retried potentially forever for the same packets.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2022-09-22 16:56:58 +02:00
Dmitry Kozlyuk
72b452c5f2 eal: remove unneeded includes from a public header
Do not include <ctype.h>, <errno.h>, and <stdlib.h> from <rte_common.h>,
because they are not used by this file.
Include the needed headers directly from the files that need them.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-21 15:31:03 +02:00
Dmitry Kozlyuk
347623c9c7 eal: uninline some string formatting helper
There is no reason for rte_str_to_size() to be inline.
Move the implementation out of <rte_common.h>.
Export it as a stable ABI because it always has been public.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
2022-09-21 15:31:03 +02:00
Dmitry Kozlyuk
107dc0664c eal: deduplicate roundup code
RTE_CACHE_LINE_ROUNDUP() implementation repeated RTE_ALIGN_MUL_CEIL().
In other places RTE_CACHE_LINE_SIZE is assumed to be a power-of-2,
so define RTE_CACHE_LINE_ROUNDUP() using RTE_ALIGN_CEIL().

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
2022-09-21 15:31:03 +02:00
Dmitry Kozlyuk
1a7374c956 eal: fix side effect in some pointer arithmetic macros
RTE_PTR_SUB(ptr, x) and RTE_PTR_ALIGN_FLOOR() worked incorrectly
if "ptr" was an expression:

    uint32_t arr[3];

    RTE_PTR_SUB(arr + 1, sizeof(arr[0]));
    // expected: (uint32_t *)((uintptr_t)(arr + 1) - 4) == arr
    // actual:   (uint32_t *)((uintptr_t) arr + 1  - 4) != arr

    RTE_PTR_ALIGN_FLOOR(arr + 2, sizeof(arr[0]));
    // expected: RTE_ALIGN_FLOOR((uintptr_t)(arr + 2), 4) == &arr[2]
    // actual:   RTE_ALIGN_FLOOR((uintptr_t) arr + 2,  4) == &arr[0]

Fix the macros and extend the relevant unit test.
Convert uses of a custom test failure macro to RTE_TEST_ASSERT*().

Fixes: af75078fec ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
2022-09-21 15:31:03 +02:00
Henning Schild
0832959682 bpf: avoid useless memcpy call
There is no point in such a call and UBSan complains about a call to
memcpy with a null pointer as second arg.

When building with -Db_sanitize=undefined, Clang gives the following
warning
../lib/bpf/bpf_load.c:37:20: runtime error: null pointer passed as
	argument 2, which is declared to never be null

A check of the sz before calling memcpy fixes that.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
2022-09-21 15:04:45 +02:00
Cristian Dumitrescu
e415acd861 net/softnic: update default device program
Update the default device program.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
2022-09-21 13:45:29 +02:00
Cristian Dumitrescu
de0a728a17 net/softnic: add pipeline mirroring command
Add CLI command for pipeline mirroring configuration.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
2022-09-21 13:45:25 +02:00
Cristian Dumitrescu
4e141bf4ab net/softnic: add pipeline statistics command
Add CLI command for pipeline statistics counters query.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
2022-09-21 13:45:20 +02:00
Cristian Dumitrescu
49b842da01 net/softnic: add pipeline meter commands
Add CLI commands for pipeline meter configuration.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
2022-09-21 13:45:13 +02:00
Cristian Dumitrescu
c76830105d net/softnic: add pipeline register read/write commands
Add CLI commands for pipeline registers read and write operations.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
2022-09-21 12:26:16 +02:00
Cristian Dumitrescu
b4647f3a18 net/softnic: add pipeline commit and abort commands
Add CLI commands for pipeline table update commit and abort.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
2022-09-21 12:26:11 +02:00
Cristian Dumitrescu
3f14baa083 net/softnic: add pipeline learner table commands
Add CLI command for managing the learner table default entry.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
2022-09-21 12:26:07 +02:00