Commit Graph

2019 Commits

Author SHA1 Message Date
Huisong Li
497025dac0 examples/ethtool: close port before exit
Currently, ethtool directly ends the process after 'quit' cmd. In this
case, software resources are not released and hardware resources of the
device are not uninstalled.

This patch adds closing port operation to release resources.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2021-11-17 18:43:21 +01:00
Chengwen Feng
4199ce1578 examples/ethtool: enhance Rx/Tx queue NUMA affinity
In DPDK, 'rte_socket_id' means the running socket while
'rte_eth_dev_socket_id' is the device socket.
For better performance, memory which queue setup used and device
should be in the same socket.

This patch make sure it calls rte_eth_dev_socket_id API to get device
socket_id when setting ringparam.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2021-11-17 18:43:21 +01:00
Chenbo Xia
5932109ac8 examples/vhost: fix port init in mergeable mode
When the example starts in mergeable mode with an i40e port,
it fails to launch because the examples use default mtu MAX_MTU
to configure ethdev. The root cause is some devices have Ethernet
frame overhead and then MAX_MTU will be larger than device's max
mtu, so the ethdev configure will fail.

This patch checks the device's max MTU before setting the ethdev
configuration. If the device has a max MTU, use that value to
configure.

Fixes: 1bb4a528c4 ("ethdev: fix max Rx packet length")

Reported-by: Xingguang He <xingguang.he@intel.com>
Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-11-16 11:01:22 +01:00
Miao Li
931e3a9945 examples/l3fwd-power: add wakeup log
This patch adds a log in main telemetry loop to show the thread has
woken up and begun to send and receive packets.

Signed-off-by: Miao Li <miao.li@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
2021-11-17 10:52:27 +01:00
Konstantin Ananyev
b7fc82ecb0 ip_frag: add namespace
Update public macros to have RTE_IP_FRAG_ prefix.
Update DPDK components to use new names.
Keep obsolete macro for compatibility reasons.
Renamed experimental function ``rte_frag_table_del_expired_entries``to
``rte_ip_frag_table_del_expired_entries`` to comply with other public
API naming convention.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2021-11-17 10:29:14 +01:00
David Marchand
2c7302145c examples/ntb: fix build dependency
Caught while building with -Ddisable_drivers=*/*.
This example requires raw/ntb specific API.
Fix dependency to avoid a compilation error:

FAILED: examples/c590b3c@@dpdk-ntb@exe/ntb_ntb_fwd.c.o
ccache gcc -Iexamples/c590b3c@@dpdk-ntb@exe -Iexamples -I../examples
  -Iexamples/ntb -I../examples/ntb -I. -I../ -Iconfig -I../config
  -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include
  -I../lib/eal/linux/include -Ilib/eal/x86/include
  -I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common
  -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs
  -Ilib/telemetry/../metrics -I../lib/telemetry/../metrics
  -Ilib/telemetry -I../lib/telemetry -Ilib/mempool -I../lib/mempool
  -Ilib/ring -I../lib/ring -Ilib/net -I../lib/net -Ilib/mbuf
  -I../lib/mbuf -Ilib/ethdev -I../lib/ethdev -Ilib/meter
  -I../lib/meter -Ilib/cmdline -I../lib/cmdline -Ilib/rawdev
  -I../lib/rawdev -fdiagnostics-color=always -pipe -Wall
  -Winvalid-pch -Werror -O2 -g -include rte_config.h -Wextra
  -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral
  -Wformat-security -Wmissing-declarations -Wmissing-prototypes
  -Wnested-externs -Wold-style-definition -Wpointer-arith
  -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings
  -Wno-missing-field-initializers -D_GNU_SOURCE -march=corei7
  -Wno-format-truncation -D_FILE_OFFSET_BITS=64
  -DALLOW_EXPERIMENTAL_API  -MD
  -MQ 'examples/c590b3c@@dpdk-ntb@exe/ntb_ntb_fwd.c.o'
  -MF 'examples/c590b3c@@dpdk-ntb@exe/ntb_ntb_fwd.c.o.d'
  -o 'examples/c590b3c@@dpdk-ntb@exe/ntb_ntb_fwd.c.o'
  -c ../examples/ntb/ntb_fwd.c
../examples/ntb/ntb_fwd.c:21:10: fatal error: rte_pmd_ntb.h:
  No such file or directory
 #include <rte_pmd_ntb.h>
          ^~~~~~~~~~~~~~~
compilation terminated.

Fixes: 5194299d6e ("examples/ntb: support more functions")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
2021-11-17 09:55:36 +01:00
Joyce Kong
9f4b0b7443 examples/flow_filtering: enhance code snippet readability
The 'IPv4' in the comment is to mark the code snippet, while it made
some confusion. Then removing 'IPv4' description will be clearer.

Fixes: 9a212dc06c ("doc: use code snippets in sample app guides")

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
2021-11-16 16:22:26 +01:00
Gregory Etelson
69f9d8aa35 examples/multi_process: fix Rx packets distribution
MP servers distributes Rx packets between clients according to
round-robin scheme.

Current implementation always started packets distribution from
the first client. That procedure resulted in uniform distribution
in cases when Rx packets number was around clients number
multiplication. However, if RX burst repeatedly returned single
packet, round-robin scheme would not work because all packets
were assigned to the first client only.

The patch does not restart packets distribution from
the first client.
Packets distribution always continues to the next client.

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

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2021-11-16 16:22:26 +01:00
Harneet Singh
19781e7a03 examples/l3fwd-power: fix early shutdown
Currently, EAL init cannot be interrupted with SIGINT because the
signal handler is already overridden by the time EAL init happens.

Fix it by moving signal handler installation to after EAL
initialization, to allow SIGNIT to interrupt EAL initialization.

Fixes: d7937e2e3d ("power: initial import")
Fixes: 613ce6691c ("examples/l3fwd-power: implement proper shutdown")
Cc: stable@dpdk.org

Signed-off-by: Harneet Singh <harneet.singh@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2021-11-16 16:22:26 +01:00
Radu Nicolau
5d1a17e6e0 examples/ipsec-secgw: fix telemetry memory leaks
Free telemetry structures when memory allocation
or input parameter errors occur.

Fixes: 3e7b7dd880 ("examples/ipsec-secgw: support telemetry")

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-11-16 07:38:07 +01:00
Conor Walsh
130e99db59 examples/performance-thread: remove unused hits count
Reported by clang 13.
This patch removes the hits variable from the cpu_load_collector function
within the performance thread example app as it is an unused but set
variable.

Bugzilla ID: 881
Fixes: d48415e1fe ("examples/performance-thread: add l3fwd-thread app")
Cc: stable@dpdk.org

Reported-by: Liang Longfeng <longfengx.liang@intel.com>
Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-11-16 13:02:27 +01:00
Pavan Nikhilesh
eab2ae4bc4 examples/l3fwd: use reserved addresses for EM mode
The l3fwd example should use the reserved IPv4/v6 reserved address
ranges defined in RFC5735, RFC5180 and RFC863 discard protocol for
the port number in the exact match mode of L3 forwarding.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-11-16 11:24:22 +01:00
Pavan Nikhilesh
fc89b4c8dd examples/l3fwd: print device name when adding routes
Since the number of Ethernet ports have gone up, print the device name
(which for PCI devices is the BDF triplet), along with the routes.
This is also helpful for cases where allow listing order is not honored.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-11-16 11:24:22 +01:00
Pavan Nikhilesh
cb94a679b7 examples/l3fwd: increase number of routes
Increase the number of routes from 8 to 16 that are statically added for
lpm and em mode as most of the SoCs support more than 8 interfaces.
The number of routes added is equal to the number of ethernet devices
ports enabled through port mask.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-11-16 11:24:22 +01:00
David Marchand
f01ca13fca examples: skip build when missing dependencies
Trying to disable the vhost library, meson will complain it can't build
the vhost* and vdpa examples when passing -Dexamples=all.

-Dexamples=all skips examples if the example itself announces it can't
be built (for external dependencies, internal dependencies and other
reasons).
Since examples/meson.build will evaluate the internal dependencies
in any case, let's move the check there and resolve the issue for
optional internal libraries.

Fixes: 0bf5832222 ("lib: allow disabling optional libraries")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2021-11-10 11:42:34 +01:00
Raja Zidane
9ad776442d crypto/mlx5: support 1MB data-unit
Add 1MB data-unit length to the capability's bitmap.
Handle 1MB data-unit length in the mlx5 session create operation,
and expose its capability in the mlx5 capabilities.

Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2021-11-04 19:46:27 +01:00
Srujana Challa
86738ebe1e examples/ipsec-secgw: support event vector
Adds event vector support to inline protocol offload mode.
By default vector support is disabled, it can be enabled by
using the option --event-vector.
Additional options to configure vector size and vector timeout are
also implemented and can be used by specifying --vector-size and
--vector-tmo.

Signed-off-by: Srujana Challa <schalla@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-11-04 19:46:27 +01:00
Radu Nicolau
9413c3901f examples/ipsec-secgw: support additional algorithms
Add support for AES-GMAC, AES_CTR, AES_XCBC_MAC,
AES_CCM, CHACHA20_POLY1305

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-11-04 19:46:27 +01:00
Radu Nicolau
fe105decc3 examples/ipsec-secgw: add ethdev reset callback
Applications should not quietly ignore an ethdev reset event.
Register an event handler for ethdev reset callback
RTE_ETH_EVENT_INTR_RESET that prints a message and
quits the application.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-11-04 19:46:27 +01:00
Radu Nicolau
560029d5cf examples/ipsec-secgw: define initial ESN value
New option added to the SA configuration arguments that
allows setting an arbitrary start value for ESN.

For example in the SA below ESN will be enabled and first egress
IPsec packet will have the ESN value 10000:

sa out 15 cipher_algo null auth_algo null mode ipv4-tunnel \
src 172.16.1.5 dst 172.16.2.5 \
esn 10000

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-11-04 19:46:27 +01:00
Radu Nicolau
3e7b7dd880 examples/ipsec-secgw: support telemetry
Add telemetry support to the IPsec GW sample app and add
support for per SA telemetry when using IPsec library.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-11-04 19:46:27 +01:00
Radu Nicolau
9ae86b4cfc examples/ipsec-secgw: support UDP encap for inline crypto
Enable UDP encapsulation for both transport and tunnel modes for the
inline crypto offload path.

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-11-04 19:46:27 +01:00
Radu Nicolau
6019fead25 examples/ipsec-secgw: update inline session create
Rework create inline session function as to update the session
configuration parameters before create session is called.
Also updated the rss key array size to prevent buffers overflows
with PMDs that copy more than 40 bytes.

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-11-04 19:46:27 +01:00
Radu Nicolau
2800893661 examples/ipsec-secgw: add stats interval argument
Add -t for stats screen update interval, disabled by default.

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2021-11-04 19:46:27 +01:00
Radu Nicolau
6f1d5c0b8e examples/ipsec-secgw: move global array from header
When STATS_INTERVAL is set to a non-zero value the
core_statistics array will be defined in multiple
compilation units and this can trigger a linker error
on particular environments. In order to fix this the
core_statistics definition was moved out of the header file.

Fixes: 1329602b6c ("examples/ipsec-secgw: add per-core packet statistics")
Cc: stable@dpdk.org

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-11-04 19:46:27 +01:00
Radu Nicolau
a7f32947a3 examples/ipsec-secgw: support TCP TSO
Add support to allow user to specific MSS for TCP TSO offload on a per SA
basis. MSS configuration in the context of IPsec is only supported for
outbound SA's in the context of an inline IPsec Crypto offload.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-11-04 19:46:27 +01:00
Fan Zhang
3b2311cc09 examples/fips_validation: fix device start
This patch fixes the missing device start for fips validation
sample app.

Bugzilla ID: 842
Fixes: 261bbff75e ("examples: use separate crypto session mempools")
Cc: stable@dpdk.org

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-11-04 19:46:27 +01:00
Maxime Coquelin
ab4bb42406 vhost: rename driver callbacks struct
As previously announced, this patch renames struct
vhost_device_ops to struct rte_vhost_device_ops.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
2021-11-03 11:59:27 +01:00
Maxime Coquelin
2cbe826e26 vhost: remove notion of async descriptor
Now that IO vectors iterator have been simplified, the
rte_vhost_async_desc struct only contains a pointer on
the iterator array stored in the async metadata.

This patch removes it, and pass directly the iterators
array pointer to the transfer_data callback. Doing that,
we avoid declaring the descriptor array in the stack, and
also avoid the cost of filling it.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
2021-10-29 12:32:30 +02:00
Maxime Coquelin
0af9f99221 vhost: remove useless fields in async iterator struct
Offset and count fields are unused and so can be removed.
The offset field was actually in the Vhost example, but
in a way that does not make sense.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
2021-10-29 12:32:30 +02:00
Maxime Coquelin
6171bfbfb2 vhost: introduce specific iovec structure
This patch introduces rte_vhost_iovec struct that contains
both source and destination addresses since we always have
a 1:1 mapping between source and destination. While using
the standard iovec struct might have seemed better, having
to duplicate IO vectors and its iterators is memory
inefficient and make the implementation more complex.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
2021-10-29 12:32:30 +02:00
Miao Li
f0b00d983e examples/l3fwd-power: support virtio/vhost
In l3fwd-power, there is default port configuration which requires
RSS and IPv4/UDP/TCP checksum. Once device does not support these,
the l3fwd-power will exit and report an error.
This patch updates the port configuration based on device capabilities
after getting the device information to support devices like virtio
and vhost.

Signed-off-by: Miao Li <miao.li@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
2021-10-29 12:32:29 +02:00
Wojciech Liguzinski
5dbbc2ab4a examples/ip_pipeline: support PIE congestion management
Adding the PIE support for IP Pipeline

Signed-off-by: Wojciech Liguzinski <wojciechx.liguzinski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
2021-11-04 15:43:43 +01:00
Wojciech Liguzinski
06135957c4 examples/qos_sched: support PIE congestion management
patch add support enable PIE or RED by
parsing config file.

Signed-off-by: Wojciech Liguzinski <wojciechx.liguzinski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
2021-11-04 15:43:24 +01:00
Wojciech Liguzinski
44c730b0e3 sched: add PIE based congestion management
Implement PIE based congestion management based on rfc8033.

The Proportional Integral Controller Enhanced (PIE) algorithm works
by proactively dropping packets randomly.
PIE is implemented as more advanced queue management is required to
address the bufferbloat problem and provide desirable quality of
service to users.

Tests for PIE code added to test application.
Added PIE related information to documentation.

Signed-off-by: Wojciech Liguzinski <wojciechx.liguzinski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
2021-11-04 15:41:49 +01:00
Vladimir Medvedkin
11c5b9b51a fib: add RIB extension size parameter
This patch adds a new parameter to the FIB configuration to specify
the size of the extension for internal RIB structure.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Tested-by: Conor Walsh <conor.walsh@intel.com>
2021-11-04 12:38:03 +01:00
Zhihong Peng
4d2d125815 examples/performance-thread: fix build with ASan
Code changes to avoid the following build error:
"strncpy specified bound XX equals destination size".

Signed-off-by: Xueqin Lin <xueqin.lin@intel.com>
Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2021-10-29 15:25:34 +02:00
Kevin Laatz
bb4141dbe5 examples/dma: rename ioat application example
Since the APIs have been updated from rawdev to dmadev, the application
should also be renamed to match. This patch also includes the documentation
updates for the renaming.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
2021-10-27 16:53:39 +02:00
Kevin Laatz
7fa68f51e2 examples/ioat: update naming to match change to dmadev
Existing functions, structures, defines etc need to be updated to reflect
the change to using the dmadev APIs.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
2021-10-27 16:53:39 +02:00
Kevin Laatz
d047310407 examples/ioat: port application to dmadev API
The dmadev library abstraction allows applications to use the same APIs for
all DMA device drivers in DPDK. This patch updates the ioatfwd application
to make use of the new dmadev APIs, in turn making it a generic application
which can be used with any of the DMA device drivers.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
2021-10-27 16:53:39 +02:00
Kevin Laatz
c789719678 examples/ioat: add signal-triggered device dump
Enable dumping device info via the signal handler. With this change, when a
SIGUSR1 is issued, the application will print a dump of all devices being
used by the application.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
2021-10-27 16:53:39 +02:00
Kevin Laatz
5a5f46be19 examples/ioat: add option to control stats print interval
Add a command line option to control the interval between stats prints.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
2021-10-27 16:53:39 +02:00
Konstantin Ananyev
8a256e97fb examples/ioat: add option to control maximum frame size
Add command line option for setting the max frame size.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
2021-10-27 16:53:39 +02:00
Konstantin Ananyev
198db0c9e2 examples/ioat: add option to control DMA batch size
Add a commandline options to control the HW copy batch size in the
application.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
2021-10-27 16:53:39 +02:00
Konstantin Ananyev
81ce0906ea examples/ioat: use always same lcore for enqueue/dequeue
Few changes in ioat sample behaviour:
- Always do SW copy for packet metadata (mbuf fields)
- Always use same lcore for both DMA requests enqueue and dequeue

Main reasons for that:
a) it is safer, as idxd PMD doesn't support MT safe enqueue/dequeue (yet).
b) sort of more apples to apples comparison with sw copy.
c) from my testing things are faster that way.

Documentation updates to reflect these changes are also included.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
2021-10-27 16:53:39 +02:00
Sarosh Arif
b54403fd08 examples/l2fwd: add promiscuous mode option
The default behaviour of l2fwd is to exit if we are unable to turn
promiscuous mode on. On some aws instances turning promiscuous mode
on is not permitted. In such cases there should be a way to run the
application without promiscuous mode.

This patch allows user to turn promiscuous mode on via command line
parameter. l3fwd has a similar option available.

Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2021-10-25 22:31:53 +02:00
Honnappa Nagarahalli
f6c6c686f1 eal: remove FINISHED lcore state
FINISHED state seems to be used to indicate that the worker's update
of the 'state' is not visible to other threads. There seems to be no
requirement to have such a state.

Since the FINISHED state is removed, the API rte_eal_wait_lcore
is updated to always return the status of the last function that
ran in the worker core.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
2021-10-25 18:20:59 +02:00
Yogesh Jangra
0317c4521d port: configure loop count for source port
Add support for configurable number of loops through the input PCAP
file for the source port. Added an additional parameter to source
port CLI command.

Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-10-25 14:30:32 +02:00
Olivier Matz
daa02b5cdd mbuf: add namespace to offload flags
Fix the mbuf offload flags namespace by adding an RTE_ prefix to the
name. The old flags remain usable, but a deprecation warning is issued
at compilation.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
2021-10-24 13:37:43 +02:00
Olivier Matz
5b63493241 mbuf: mark old VLAN offload flags as deprecated
The flags PKT_TX_VLAN_PKT and PKT_TX_QINQ_PKT are
marked as deprecated since commit 380a7aab1a ("mbuf: rename deprecated
VLAN flags") (2017). But they were not using the RTE_DEPRECATED
macro, because it did not exist at this time. Add it, and replace
usage of these flags.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-10-24 13:30:40 +02:00
Ferruh Yigit
295968d174 ethdev: add namespace
Add 'RTE_ETH' namespace to all enums & macros in a backward compatible
way. The macros for backward compatibility can be removed in next LTS.
Also updated some struct names to have 'rte_eth' prefix.

All internal components switched to using new names.

Syntax fixed on lines that this patch touches.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Wisam Jaddo <wisamm@nvidia.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Chenbo Xia <chenbo.xia@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
2021-10-22 18:15:38 +02:00
Wenwu Ma
ad5050e42e examples/vhost: fix use after free on drain
When a vdev is removed in destroy_device function,
the corresponding vhost TX buffer will also be freed,
but the vhost TX buffer may still be used in the
drain_vhost function, which will cause an error of
heap-use-after-free. Therefore, before accessing
vhost TX buffer, we need to check whether the vdev
has been removed, if so, let's skip this vdev.

Fixes: a68ba8e0a6 ("examples/vhost: refactor vhost data path")
Cc: stable@dpdk.org

Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
2021-10-21 14:24:21 +02:00
Harry van Haaren
2f2fcaed8b examples/eventdev_pipeline: use port config hints
This commit adds the per-port hints added to the eventdev API, indicating
which eventdev ports will be used for producing, forwarding, or consuming
events from the system.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2021-10-21 10:16:00 +02:00
Shijith Thotton
796b07e9c6 examples/l2fwd-event: support event vector
Added changes to receive packets as event vector. By default this is
disabled and can be enabled using the option --event-vector. Vector
size and timeout to form the vector can be configured using options
--event-vector-size and --event-vector-tmo.

Example:
dpdk-l2fwd-event -l 0-3 -n 4 -- -p 0x03 --mode=eventdev \
	--eventq-sched=ordered --event-vector --event-vector-size 16

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2021-10-21 10:16:00 +02:00
Shijith Thotton
e8adca1951 examples/l3fwd: support event vector
Added changes to receive packets as event vector. By default this is
disabled and can be enabled using the option --event-vector. Vector
size and timeout to form the vector can be configured using options
--event-vector-size and --event-vector-tmo.

Example:
dpdk-l3fwd -l 0-3 -n 4 -- -p 0x03 --mode=eventdev \
	--eventq-sched=ordered --event-vector --event-vector-size 16

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2021-10-21 10:16:00 +02:00
Ferruh Yigit
d1576625f7 examples/ip_reassembly: remove unused option
Remove 'max-pkt-len' parameter.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2021-10-18 19:20:21 +02:00
Ferruh Yigit
b563c14212 ethdev: remove jumbo offload flag
Removing 'DEV_RX_OFFLOAD_JUMBO_FRAME' offload flag.

Instead of drivers announce this capability, application can deduct the
capability by checking reported 'dev_info.max_mtu' or
'dev_info.max_rx_pktlen'.

And instead of application setting this flag explicitly to enable jumbo
frames, this can be deduced by driver by comparing requested 'mtu' to
'RTE_ETHER_MTU'.

Removing this additional configuration for simplification.

Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
2021-10-18 19:20:21 +02:00
Ferruh Yigit
1bb4a528c4 ethdev: fix max Rx packet length
There is a confusion on setting max Rx packet length, this patch aims to
clarify it.

'rte_eth_dev_configure()' API accepts max Rx packet size via
'uint32_t max_rx_pkt_len' field of the config struct 'struct
rte_eth_conf'.

Also 'rte_eth_dev_set_mtu()' API can be used to set the MTU, and result
stored into '(struct rte_eth_dev)->data->mtu'.

These two APIs are related but they work in a disconnected way, they
store the set values in different variables which makes hard to figure
out which one to use, also having two different method for a related
functionality is confusing for the users.

Other issues causing confusion is:
* maximum transmission unit (MTU) is payload of the Ethernet frame. And
  'max_rx_pkt_len' is the size of the Ethernet frame. Difference is
  Ethernet frame overhead, and this overhead may be different from
  device to device based on what device supports, like VLAN and QinQ.
* 'max_rx_pkt_len' is only valid when application requested jumbo frame,
  which adds additional confusion and some APIs and PMDs already
  discards this documented behavior.
* For the jumbo frame enabled case, 'max_rx_pkt_len' is an mandatory
  field, this adds configuration complexity for application.

As solution, both APIs gets MTU as parameter, and both saves the result
in same variable '(struct rte_eth_dev)->data->mtu'. For this
'max_rx_pkt_len' updated as 'mtu', and it is always valid independent
from jumbo frame.

For 'rte_eth_dev_configure()', 'dev->data->dev_conf.rxmode.mtu' is user
request and it should be used only within configure function and result
should be stored to '(struct rte_eth_dev)->data->mtu'. After that point
both application and PMD uses MTU from this variable.

When application doesn't provide an MTU during 'rte_eth_dev_configure()'
default 'RTE_ETHER_MTU' value is used.

Additional clarification done on scattered Rx configuration, in
relation to MTU and Rx buffer size.
MTU is used to configure the device for physical Rx/Tx size limitation,
Rx buffer is where to store Rx packets, many PMDs use mbuf data buffer
size as Rx buffer size.
PMDs compare MTU against Rx buffer size to decide enabling scattered Rx
or not. If scattered Rx is not supported by device, MTU bigger than Rx
buffer size should fail.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
2021-10-18 19:20:20 +02:00
Matan Azrad
cab0c8f3c0 cryptodev: extend data-unit length field
As described in [1] and as announced in [2], The field ``dataunit_len``
of the ``struct rte_crypto_cipher_xform`` moved to the end of the
structure and extended to ``uint32_t``.

In this way, sizes bigger than 64K bytes can be supported for data-unit
lengths.

[1] commit d014dddb2d ("cryptodev: support multiple cipher
data-units")
[2] commit 9a5c09211b ("doc: announce extension of crypto data-unit
length")

Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-10-16 16:24:43 +02:00
Nithin Dabilpuram
9cf884a805 examples/ipsec-secgw: accept inline packet in single SA
In inline protocol inbound SA's, plain IPv4 and IPv6 packets are
delivered to application unlike inline crypto or lookaside.
Hence fix the application to not drop them when working in
single SA mode.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-10-16 15:33:15 +02:00
Joyce Kong
69a3c63191 examples: remove unneeded atomic header include
Remove the unnecessary header file rte_atomic.h
included in example module.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2021-10-19 17:16:57 +02:00
Joyce Kong
4773be5875 examples/server_node_efd: use compiler atomics for sync
Convert rte_atomic32_test_and_set to compiler CAS atomic
operation for display_stats sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2021-10-19 17:16:57 +02:00
Joyce Kong
14215f34e8 examples/vm_power: use compiler atomics for sync
Convert rte_atomic32_cmpset to compiler atomic CAS
operation for channel status sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2021-10-19 17:16:54 +02:00
Joyce Kong
7383b25f4b examples/l2fwd-jobstats: use compiler atomics for stats sync
Convert rte_atomic usages to compiler atomic built-ins
for stats_read_pending sync in l2fwd_jobstats module.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2021-10-19 17:15:57 +02:00
Joyce Kong
da126627de examples/performance-thread: use compiler atomics for sync
Convert rte_atomic usages to compiler atomic built-ins
for thread sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2021-10-19 17:15:57 +02:00
Joyce Kong
6be26e3177 examples/kni: use compiler atomics for status sync
Convert rte_atomic usages to compiler atomic builit-ins
for kni_stop and kni_pause sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2021-10-19 17:15:57 +02:00
Joyce Kong
9b882c5b87 examples/multi_process: use compiler atomics for sync
Convert rte_atomic32_test_and_set usage to compiler atomic
CAS operation for display_stats sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2021-10-19 17:15:57 +02:00
Joyce Kong
5bd3c386b2 examples/bbdev: use compiler atomics for flag sync
Convert rte_atomic usages to compiler atomic built-ins
for global_exit_flag sync.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2021-10-19 17:15:53 +02:00
Simei Su
92854ed2b9 examples/ptpclient: enable Rx queue configuration
This patch adds support to enable per-queue Rx offloads so that
it can convey the configuration to PMD.

Signed-off-by: Simei Su <simei.su@intel.com>
2021-10-13 18:31:25 +02:00
Nithin Dabilpuram
2e7abb8bb8 examples/ipsec-secgw: use mbuf packet type in ev worker
Use mbuf packet type for traffic identification as
packet is parsed already by HW before and HW/PMD updates
necessary info in mbuf packet type of the found protocols.

This change is specifically for event mode.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-10-08 21:31:07 +02:00
Ciara Power
15bb59a5eb examples/fips_validation: fix resetting pointer
The env.digest memory was freed, but the pointer was not set to NULL
afterwards. This caused an "Invalid Memory" error, as the pointer tries
to free twice.

Fixes: 952e10cdad ("examples/fips_validation: support scatter gather list")
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2021-10-08 21:31:07 +02:00
Ciara Power
25d392e199 examples/fips_validation: remove unused allocation
The val.val pointer is allocated memory, however this memory is then
freed in get_writeback_data() without being used beforehand.
The pointer is then allocated memory again before use,
so the very first allocation is removed as it was unnecessary.

Fixes: f4797bae00 ("examples/fips_validation: support plain SHA")
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2021-10-08 21:31:07 +02:00
Dmitry Kozlyuk
04d43857ea net: rename Ethernet header fields
Definition of `rte_ether_addr` structure used a workaround allowing DPDK
and Windows SDK headers to be used in the same file, because Windows SDK
defines `s_addr` as a macro. Rename `s_addr` to `src_addr` and `d_addr`
to `dst_addr` to avoid the conflict and remove the workaround.
Deprecation notice:
https://mails.dpdk.org/archives/dev/2021-July/215270.html

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
2021-10-08 14:58:11 +02:00
Huisong Li
44fe9bd8e4 examples/kni: close port before exit
This patch adds dev_close() step to release network adapter resources
when kni free.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-10-06 16:51:58 +02:00
Anoob Joseph
5d05af5557 examples/ipsec-secgw: clear soft expiry configuration
Soft expiry is not a mandatory IPsec feature. It is verified separately
with IPsec unit tests. So configuration of the same is not required.
Also, soft expiry tracking can cause perf degradation with some PMDs.
Since a separate UT is available and the same setting in ipsec-secgw is
not verifying the functionality, remove the same by clearing life
configuration.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-09-28 14:16:37 +02:00
Anoob Joseph
ad7515a39f security: add SA lifetime configuration
Add SA lifetime configuration to register soft and hard expiry limits.
Expiry can be in units of number of packets or bytes. Crypto op
status is also updated to include new field, aux_flags, which can be
used to indicate cases such as soft expiry in case of lookaside
protocol operations.

In case of soft expiry, the packets are successfully IPsec processed but
the soft expiry would indicate that SA needs to be reconfigured. For
inline protocol capable ethdev, this would result in an eth event while
for lookaside protocol capable cryptodev, this can be communicated via
`rte_crypto_op.aux_flags` field.

In case of hard expiry, the packets will not be IPsec processed and
would result in error.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-09-28 14:11:29 +02:00
Anoob Joseph
8131b7eb50 examples/ipsec-secgw: fix parsing of flow queue
Documentation specifies that flow port & queue is provided as,

<...> port 0 queue 0

But code is expecting the same as,

<...> port 0 0

Fix the above to match documentation.

Fixes: 8e693616fc ("examples/ipsec-secgw: enable flow based distribution")
Cc: stable@dpdk.org

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-09-28 08:43:57 +02:00
Nithin Dabilpuram
ea28ab889e examples/ipsec-secgw: update event mode inline path
Update mbuf.l2_len with L2 header size for outbound
inline processing.

This patch also fixes a bug in arg parsing.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-09-28 08:43:57 +02:00
Cristian Dumitrescu
175d213bf8 pipeline: improve handling of learner action arguments
The arguments of actions that are learned are now specified as part of
the learn instruction as opposed to being statically specified as part
of the learner table configuration.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-09-27 12:18:49 +02:00
Cristian Dumitrescu
13228724c4 examples/pipeline: add learner table example
Added the files to illustrate the learner table usage.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-09-27 09:52:42 +02:00
Cristian Dumitrescu
8bd4862f29 examples/pipeline: support learner tables
Add application-level support for learner tables.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-09-27 09:52:14 +02:00
Cristian Dumitrescu
8df6b82284 examples/pipeline: add variable size headers
Added the files to illustrate the variable size header usage.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-09-27 09:15:18 +02:00
Jiayu Hu
abeb865255 vhost: remove copy threshold for async path
Copy threshold has been introduced in async vhost data
path to select the appropriate copy engine to do copies
for higher efficiency.

However, it may cause packets ordering issues and also
introduces performance unpredictability.

Therefore, this patch removes copy threshold support in
async vhost data path.

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-09-14 13:21:55 +02:00
Ruifeng Wang
328720c594 examples/service_cores: fix lcore count check
The example has various profiles to run services on specified
number of lcores. Due to incorrect boundary condition, service
can be dispatched to a core that does not exist. This puts main
core into endless wait.

Max available number of service cores is all detected lcores
excluding main core.

Fixes: 7f6ee6aee7 ("examples/service_cores: check cores before run")
Cc: stable@dpdk.org

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
2021-09-16 17:31:03 +02:00
Aman Deep Singh
a7db3afce7 net: add macro to extract MAC address bytes
Added macros to simplify print of MAC address.
The six bytes of a MAC address are extracted in
a macro here, to improve code readablity.

Signed-off-by: Aman Deep Singh <aman.deep.singh@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-09-07 19:08:05 +02:00
Aman Deep Singh
c2c4f87b12 net: add macro for MAC address print
Added macro to print six bytes of MAC address.
The MAC addresses will be printed in upper case
hexadecimal format.
In case there is a specific check for lower case
MAC address, the user may need to make a change in
such test case after this patch.

Signed-off-by: Aman Deep Singh <aman.deep.singh@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-09-07 19:07:46 +02:00
Akhil Goyal
74645f64ad examples/fips_validation: remove illegal usage of API
Some of the cryptodev APIs are not allowed to be used
by application directly. Hence removing the usage of
1. queue_pair_release: it is not required, as configure
   of queue pair release the previous queue pairs and the
   dev is not directly exposed to application, hence cannot
   use its ops from app.
2. rte_cryptodev_stop: it can be used directly without
   checking if the device is started or not.
3. rte_cryptodev_pmd_destroy: application should use
   rte_cryptodev_close instead.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2021-09-08 09:34:25 +02:00
Akhil Goyal
e74abd4843 cryptodev: rename function to check device validity
The API rte_cryptodev_pmd_is_valid_dev, can be used
by the application as well as PMD to check whether
the device is valid or not. Hence, _pmd is removed
from the API.
The applications and drivers which use this API are
also updated.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2021-09-08 09:21:10 +02:00
Jerin Jacob
5e184c4cc7 examples/performance-thread: fix build with clang 12.0.1
In clang 12.0.1 version, the use of pthread_yield() is deprecated,
use sched_yield() instead.

log:
    examples/performance-thread/pthread_shim/main.c:75:9: warning:
    'pthread_yield' is deprecated: pthread_yield is deprecated,
    use sched_yield instead [-Wdeprecated-declarations]

Bugzilla ID: 745
Fixes: 433ba6228f ("examples/performance-thread: add pthread_shim app")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Tested-by: Ali Alnubani <alialnu@nvidia.com>
2021-08-27 13:40:23 +02:00
Conor Fogarty
9a212dc06c doc: use code snippets in sample app guides
Currently the sample app user guides use hard coded code snippets,
this patch changes these to use literalinclude which will dynamically
update the snippets as changes are made to the code.
This was introduced in commit 413c75c33c ("doc: show how to include
code in guides"). Comments within the sample apps were updated to
accommodate this as part of this patch. This will help to ensure that
the code within the sample app user guides is up to date and not out
of sync with the actual code.

Signed-off-by: Conor Fogarty <conor.fogarty@intel.com>
Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
2021-07-31 15:42:43 +02:00
Matan Azrad
dcf384b4ff examples/l2fwd-crypto: support cipher multiple data-unit
The support for multiple data-units includes the next:
- Add a new command-line argument to provide the data-unit length.
- Set the length in the cipher xform.
- Validate device capabilities for this feature.
- Pad the AES-XTS operation length to be aligned to the defined data-unit.

Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-07-30 21:08:19 +02:00
Chaoyong He
97986fa564 examples/l3fwd: disable multi-queue for single queue
Set the Rx multi-queue mode to NONE when configuring a port that is
associated with hardware that only supports a single Rx queue.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2021-07-30 18:56:01 +02:00
Cheng Jiang
b9f23beee0 examples/vhost: handle memory hotplug for async vhost
When the guest memory is hotplugged, the vhost application which
enables DMA acceleration must stop DMA transfers before the vhost
re-maps the guest memory.

To accomplish that, we need to do these changes in the vhost sample:
1. add inflight packets count.
2. add vring_state_changed() callback.
3. add inflight packets clear process in destroy_device() and
vring_state_changed().

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-07-23 10:58:53 +02:00
Cheng Jiang
3f63c19b2b vhost: fix async callbacks return type
The async vhost callback ops should return negative value when there
are something wrong in the callback, so the return type should be
changed into int32_t. The issue in vhost example is also fixed.

Fixes: cd6760da10 ("vhost: introduce async enqueue for split ring")
Fixes: 819a716858 ("vhost: fix async callback return type")
Fixes: 6b3c81db8b ("vhost: simplify async copy completion")
Fixes: abec60e711 ("examples/vhost: support vhost async data path")
Fixes: 6e9a9d2a02 ("examples/vhost: fix ioat dependency")
Fixes: 873e8dad6f ("vhost: support packed ring in async datapath")
Cc: stable@dpdk.org

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-07-23 10:58:53 +02:00
Jiayu Hu
acbc38887b vhost: rework async configuration structure
This patch reworks the async configuration structure to improve code
readability. In addition, add preserved padding fields on the structure
for future usage.

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-07-21 07:56:13 +02:00
Srujana Challa
6425d95ad1 examples/ipsec-secgw: support inline UDP encapsulation
Adds support to allow udp-encap option for
RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL mode also.

Signed-off-by: Srujana Challa <schalla@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2021-07-20 10:32:05 +02:00
Cristian Dumitrescu
cfcc7bf8da examples/pipeline: fix out of bounds array access
Fix the incorrect array out of bounds check within the function
pipeline_selector_group_member_read().

Coverity issue: 371911
Fixes: 598fe0dd0d ("examples/pipeline: support selector table")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-07-21 13:51:17 +02:00
Ali Alnubani
00b67591d2 examples/pipeline: fix build
This patch fixes the following build failures seen on Ubuntu 16.04
with gcc 5.4.0 because of uninitialized variables:
...
examples/pipeline/cli.c:1559:11: error: 'weight_val' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:1545:13: error: 'member_id_val' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:1538:12: error: 'group_id_val' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2189:2: error: 'idx1' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2179:43: error: 'idx0' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2265:2: error: 'idx1' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2248:43: error: 'idx0' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2358:2: error: 'idx1' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]
...
examples/pipeline/cli.c:2325:43: error: 'idx0' may be used
  uninitialized in this function [-Werror=maybe-uninitialized]

Fixes: 598fe0dd0d ("examples/pipeline: support selector table")

Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-07-20 11:58:18 +02:00
David Hunt
a9ea60702e examples/l3fwd-power: add baseline PMD management mode
The PMD Power Management scheme currently has 3 modes,
scale, monitor and pause. However, it would be nice to
have a baseline mode for easy comparison of power savings
with and without these modes.

This patch adds a 'baseline' mode were the PMD power
management is not enabled. Use --pmd-mgmt=baseline.

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2021-07-10 08:43:13 +02:00
Cristian Dumitrescu
f0b97fc4fe examples/pipeline: add FIB example
Add example for FIB with VRF and ECMP support.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
2021-07-10 08:31:08 +02:00
Cristian Dumitrescu
eeaea4b537 examples/pipeline: add selector example
Added the files to illustrate the selector table usage.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-07-10 08:26:22 +02:00
Cristian Dumitrescu
598fe0dd0d examples/pipeline: support selector table
Add application-level support for selector tables.

Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-07-10 08:26:15 +02:00
Churchill Khangar
75129ceb1e examples/pipeline: improve table update commands
For more flexibility, the single monolithic table update command is
split into table entry add, table entry delete, table default entry
add, pipeline commit and pipeline abort.

Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-07-09 23:21:41 +02:00
Anatoly Burakov
25b4c0c42d examples/l3fwd-power: support multiqueue ethdev power management
Currently, l3fwd-power enforces the limitation of having one queue per
lcore. This is no longer necessary, so remove the limitation.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: David Hunt <david.hunt@intel.com>
2021-07-09 21:13:13 +02:00
Conor Walsh
815611b367 examples/l3fwd: remove useless reloads in EM main loop
This patch aligns the l3fwd EM code with the changes made to LPM in
commit 74fb854a3d ("examples/l3fwd: remove useless reloads in LPM
main loop").
This change ensures the compiler knows that the lcore config variables
are constant values and the compiler will then optimize the code
accordingly.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-07-07 11:54:21 +02:00
Conor Walsh
6018b5ac74 examples/l3fwd: remove useless reloads in FIB main loop
This patch aligns the l3fwd FIB code with the changes made to LPM in
commit 74fb854a3d ("examples/l3fwd: remove useless reloads in LPM
main loop").
This change ensures the compiler knows that the lcore config variables
are constant values and the compiler will then optimize the code
accordingly.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-07-07 11:54:21 +02:00
Chenglian Sun
487c582507 examples/l2fwd: remove mac-updating option
The "mac-updating" option can be removed since the associated mac_updating
variable is set to 1 by default.

Signed-off-by: Chenglian Sun <sunchenglian@loongson.cn>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-07-05 15:11:23 +02:00
Chenglian Sun
bbbe38a6d5 examples/l2fwd: fix [no-]mac-updating options
For l2fwd, --no-mac-updating and --mac-updating are treated as invalid
arguments. Rework long options parsing to let --no-mac-updating and
--mac-updating options work well.

Fixes: fa19eb20d2 ("examples/l2fwd: add forwarding port mapping option")
Cc: stable@dpdk.org

Signed-off-by: Chenglian Sun <sunchenglian@loongson.cn>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-07-05 15:11:12 +02:00
Ruifeng Wang
74fb854a3d examples/l3fwd: remove useless reloads in LPM main loop
Number of rx queue and number of rx port in lcore config are constants
during the period of l3 forward application running. But compiler has
no this information.

Copied values from lcore config to local variables and used the local
variables for iteration. Compiler can see that the local variables are
not changed, so qconf reloads at each iteration can be eliminated.

The change showed 1.8% performance uplift in single core, single port,
single queue test on N1SDP platform with MLX5 NIC.

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2021-07-05 11:30:58 +02:00
Ruifeng Wang
d76d65060c examples/l3fwd: remove useless calculations in NEON LPM
Both L2 and L3 headers will be used in forward processing. And these
two headers are in the same cache line. It has the same effect for
prefetching with L2 header address and prefetching with L3 header
address.

Changed to use L2 header address for prefetching. The change showed
no measurable performance improvement, but it definitely removed
unnecessary instructions for address calculation.

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2021-07-05 11:30:58 +02:00
Hongbo Zheng
db7447c708 examples/l3fwd-power: fix empty poll thresholds
Fix assignment errors of ep_hgh_edpi in function parse_ep_config.

Fixes: a137d012a0 ("examples/l3fwd-power: support traffic pattern aware control")
Cc: stable@dpdk.org

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Reshma Pattan <reshma.pattan@gmail.com>
Acked-by: David Hunt <david.hunt@intel.com>
2021-05-19 08:41:20 +02:00
Min Hu (Connor)
5ffa60cd77 examples/skeleton: fix NUMA check of port and core
According to the comments and logging, the author just hope user to use
the core and device which are in the same numa node for optimal
performance. If not, A warning gives out.

This patch fixes the check for a device on the node 0.

Fixes: 7107e471a6 ("examples/skeleton: very simple code for packet forwarding")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-05-12 21:46:05 +02:00
Min Hu (Connor)
59a50c6a9a examples/l2fwd-cat: fix NUMA check of port and core
According to the comments and logging, the author just hope user to use
the core and device which are in the same numa node for optimal
performance. If not, A warning gives out.

This patch fixes the check for a device on the node 0.

Fixes: f6baccbc2b ("examples/l2fwd-cat: add sample application for PQoS CAT and CDP")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-05-12 21:46:05 +02:00
Min Hu (Connor)
78a5545ef9 examples/flow_classify: fix NUMA check of port and core
According to the comments and logging, the author just hope user to use
the core and device which are in the same numa node for optimal
performance. If not, A warning gives out.

For example in flow_classify:
./build/flow_classify -a 0000:7d:00.1  -l 93
Here:
0000:7d:00.1 is on numa node 0.
core 93  is on numa node 3.

The two are not in same numa node, but no warning gives out in old codes
when device is on node 0.
This patch includes the node 0 in the check.

Fixes: bab16ddaf2 ("examples/flow_classify: add sample application")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Tested-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-05-12 21:46:05 +02:00
Dmitry Kozlyuk
7861009f7b examples/rxtx_callbacks: fix port ID format specifier
This fixes -Wformat warning with clang 10.0.0 on Windows.

Fixes: f8244c6399 ("ethdev: increase port id range")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2021-05-12 21:46:05 +02:00
Chengchang Tang
80aa15c4df examples/timer: fix time interval
Timer sample example assumes that the frequency of the timer is about
2Ghz to control the period of calling rte_timer_manage(). But this
assumption is easy to fail. For example. the frequency of tsc on ARM64
is much less than 2Ghz.

This patch uses the frequency of the current timer to calculate the
correct time interval to ensure consistent result on all platforms.

In addition, the rte_rdtsc() is replaced with the more recommended
rte_get_timer_cycles function in this patch.

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

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2021-05-12 16:52:20 +02:00
Konstantin Ananyev
1c91424d0a examples/ipsec-secgw: fix handling IPv6 extension headers
Recent patch to support UDP encapsulation introduced problem with
handling inbound IPv6 packets with header extensions.
This patch aims to fix the issue.

Bugzilla ID: 695
Fixes: 9a1cc8f1ed ("examples/ipsec-secgw: support UDP encapsulation")

Reported-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-05-05 16:50:21 +02:00
Reshma Pattan
4a8f4f9765 examples/vm_power: remove VM channel number check
VM channel number should not be validated against the
host vm_power_manager coremask core indexes, as VM
cores need not to be same as host cores.
So remove this check, to allow all the vm channels
to be added successfully.

Fixes: b49c677a0d ("examples/vm_power: respect core mask")
Cc: stable@dpdk.org

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: David Hunt <david.hunt@intel.com>
2021-05-05 23:43:22 +02:00
Jerin Jacob
11e027022d examples: fix pkg-config override
Move pkg-config override to beginning in the Makefile to allow
use PKGCONF variable to detect the libdpdk availability.

Fixes: fda34680eb ("examples: remove legacy sections of makefiles")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2021-05-05 22:20:24 +02:00
David Marchand
ca7036b4af vhost: fix offload flags in Rx path
The vhost library currently configures Tx offloading (PKT_TX_*) on any
packet received from a guest virtio device which asks for some offloading.

This is problematic, as Tx offloading is something that the application
must ask for: the application needs to configure devices
to support every used offloads (ip, tcp checksumming, tso..), and the
various l2/l3/l4 lengths must be set following any processing that
happened in the application itself.

On the other hand, the received packets are not marked wrt current
packet l3/l4 checksumming info.

Copy virtio rx processing to fix those offload flags with some
differences:
- accept VIRTIO_NET_HDR_GSO_ECN and VIRTIO_NET_HDR_GSO_UDP,
- ignore anything but the VIRTIO_NET_HDR_F_NEEDS_CSUM flag (to comply with
  the virtio spec),

Some applications might rely on the current behavior, so it is left
untouched by default.
A new RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS flag is added to enable the
new behavior.

The vhost example has been updated for the new behavior: TSO is applied to
any packet marked LRO.

Fixes: 859b480d5a ("vhost: add guest offload setting")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-05-04 10:22:17 +02:00
Cheng Jiang
47afdbbe56 examples/vhost: fix overflow in argument parsing
Change the way passing args to fix potential overflow in args process.

Coverity issue: 363741
Fixes: 965b06f035 ("examples/vhost: enhance getopt_long usage")

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-05-04 10:21:33 +02:00
Cheng Jiang
895f409c4a examples/vhost: fix ioat ring space in callbacks
We use ioat ring space for determining if ioat callbacks can enqueue a
packet to ioat device. But there is one slot can't be used in ioat
ring due to the ioat driver design, so we need to reduce one slot in
ioat ring to prevent ring size mismatch in ioat callbacks.

Fixes: 2aa47e94bf ("examples/vhost: add ioat ring space count and check")
Cc: stable@dpdk.org

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-04-28 03:58:50 +02:00
Bruce Richardson
245efe544d raw/ioat: report status of completed jobs
Add improved error handling to rte_ioat_completed_ops(). This patch adds
new parameters to the function to enable the user to track the completion
status of each individual operation in a batch. With this addition, the
function can help the user to determine firstly, how many operations may
have failed or been skipped and then secondly, which specific operations
did not complete successfully.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2021-05-04 17:43:50 +02:00
Bruce Richardson
7d5cfaa750 build: fix formatting of Meson lists
Running "./devtools/check-meson.py --fix" on the DPDK repo fixes a
number of issues with whitespace and formatting of files:

* indentation of lists
* missing trailing commas on final list element
* multiple list entries per line when list is not all single-line

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2021-05-04 15:01:47 +02:00
Conor Walsh
91470c0ddf examples/l3fwd: skip Tx queue drain on first FIB iteration
The commit a8f8b672d5 ("examples/l3fwd: skip Tx queue drain on first iteration")
implemented a change to the EM and LPM lookup methods to
prevent the Tx queue drain running in the first iteration of their
packet processing loops.

This patch applies the same change into the new FIB lookup method.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
2021-04-21 20:43:41 +02:00
Chengwen Feng
5be3505717 examples/ethtool: remove unused parsing
The new_mtu was assigned twice, the first assignment could be removed.

Fixes: bda68ab9d1 ("examples/ethtool: add user-space ethtool sample application")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2021-04-21 20:28:54 +02:00
Chengchang Tang
10aa375704 examples: add eal cleanup to examples
According to the programming guide, the rte_eal_init should be used pairs
with rte_eal_cleanup.

This patch add rte_eal_cleanup to examples to encourage new users of
DPDK to use it.

Fixes: aec9c13c52 ("eal: add function to release internal resources")
Fixes: 3d0fad56b7 ("examples/fips_validation: add crypto FIPS application")
Fixes: c8e6ceeceb ("examples/ioat: add new sample app for ioat driver")
Fixes: 4ff457986f ("examples/l2fwd-event: add default poll mode routines")
Fixes: 08bd1a1744 ("examples/l3fwd-graph: add graph-based l3fwd skeleton")
Fixes: c5eebf85ba ("examples/ntb: add example for NTB")
Fixes: b77f660028 ("examples/pipeline: add new example application")
Fixes: edbed86d1c ("examples/vdpa: introduce a new sample for vDPA")
Fixes: c19beb3f38 ("examples/vhost_blk: introduce vhost storage sample")
Fixes: f5188211c7 ("examples/vhost_crypto: add sample application")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
2021-04-21 20:21:25 +02:00
Chengwen Feng
e5fb1a9698 examples/vhost_blk: set control worker thread name
This patch supports set ctrl worker thread name which is helpful for
debugging.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2021-04-21 15:57:51 +02:00
Chengwen Feng
9ea3341577 examples/performance-thread: set thread names
This patch supports set helloworld thread name which is helpful for
debugging.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2021-04-21 15:57:51 +02:00
Bruce Richardson
cf59165dcb examples: reduce indentation in build files
As with the lib and drivers directories, we can use "continue" keyword to
reduce the indentation level of the majority of the foreach block. At the
same time, we can also replace tab indentation with spaces.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2021-04-21 14:04:09 +02:00
Cristian Dumitrescu
783768136f pipeline: auto-detect endianness of action arguments
Each table entry is made up of match fields and action data, with the
latter made up of the action ID and the action arguments. The approach
of having the user specify explicitly the endianness of the action
arguments is difficult to be picked up by P4 compilers, as the P4
compiler is generally unaware about this aspect.

This commit introduces the auto-detection of the endianness of the
action arguments by examining the endianness of the their destination:
network byte order (NBO) when they get copied to headers and host byte
order (HBO) when they get copied to packet meta-data or mailboxes.

The endianness specification of each action argument as part of the
rule specification, e.g. H(...) and N(...) is removed from the rule
file and auto-detected based on their destination. The DMA instruction
scope is made internal, so mov instructions need to be used. The
pattern of transferring complete headers from table entry action args
to headers is detected, and the associated set of mov instructions
plus header validate is internally detected and replaced with the
internal-only DMA instruction to preserve performance.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-04-20 21:55:43 +02:00
Conor Walsh
6a094e3285 examples/l3fwd: implement FIB lookup method
This patch implements the Forwarding Information Base (FIB) library
in l3fwd using the function calls and infrastructure introduced in
the previous patch.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
2021-04-20 20:18:29 +02:00
Conor Walsh
9510dd1feb examples/l3fwd: add FIB infrastructure
The purpose of this commit is to add the necessary function calls
and supporting infrastructure to allow the Forwarding Information Base
(FIB) library to be integrated into the l3fwd sample app.
Instead of adding an individual flag for FIB, a new flag '--lookup' has
been added that allows the user to select their desired lookup method.
The flags '-E' and '-L' have been retained for backwards compatibility.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2021-04-20 20:13:34 +02:00
Conor Walsh
da796d2755 examples/l3fwd: move routes to common header
To prevent code duplication from the addition of lookup methods
the routes specified in lpm should be moved to a common header.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
2021-04-20 20:05:41 +02:00
Conor Walsh
0c74a91ad6 examples/l3fwd: fix LPM IPv6 subnets
Any IP within the 2001:200::/48 subnet will match all the routes given
instead of 1 individual route and the application cannot
differentiate between them.
The change in this patch allows the ports to be individually matched using
smaller /64 ranges for each port. These smaller subnet ranges are still
within the 2001:200::/48 subnet range set aside for benchmarking
in RFC5180.
l3fwd will now use 2001:200:0:{0-7}::/64 where 0-7 is the port ID for IPv6.

Fixes: 37afe381bd ("examples/l3fwd: use reserved IP addresses")
Cc: stable@dpdk.org

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
2021-04-20 20:05:31 +02:00
Kathleen Capella
a8f8b672d5 examples/l3fwd: skip Tx queue drain on first iteration
Initialize prev_tsc to cur_tsc. This avoids running the TX queue drain
in the first iteration of the packet processing loop.

Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
2021-04-20 03:13:38 +02:00
Min Hu (Connor)
e1d10a42f6 examples/ptpclient: remove wrong comment
This patch deletes the comments which are wrong and unnecessary.

Fixes: ab129e9065 ("examples/ptpclient: add minimal PTP client")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-04-20 03:03:42 +02:00
Cristian Dumitrescu
1c8b6af9b0 examples/pipeline: add newline to error messages
Add newline to some error messages that were missing it.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-04-20 02:49:17 +02:00
Cristian Dumitrescu
742b0a57f5 pipeline: add table statistics to SWX
Add support for table statistics for the SWX pipeline. For each table,
we maintain a counter for lookup hit packets, one for lookup miss
packets and one packet counter for each table action.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
2021-04-20 02:27:56 +02:00
Cristian Dumitrescu
fe16d678e7 pipeline: add drop instruction to SWX
Enabled the TX instruction to accept an immediate value for the output
port argument. The drop instruction is simply an alias to the TX
instruction for the last output port of the pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-04-20 02:24:36 +02:00
Shiri Kuzin
3ea6ee38ec examples/l2fwd-crypto: remove key size validation
In the example application the key can be provided by the user or
generated randomly by the example application.

Then a validation is done in order to check if the key size is
supported in the algorithm capabilities.

A new feature flag is added in crypto PMDs to allow wrapped keys,
hence, to allow wrapped keys, app should remove the validation of
key size in the application and rely on a PMD key size validation.

The validation is removed in case the key is provided by user and
the RTE_CRYPTODEV_FF_CIPHER_WRAPPED_KEY feature flag is set, and
kept in case the key should be generated by the application or
RTE_CRYPTODEV_FF_CIPHER_WRAPPED_KEY is not set.

Signed-off-by: Shiri Kuzin <shirik@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-04-16 12:43:33 +02:00
Tejasree Kondoj
9a1cc8f1ed examples/ipsec-secgw: support UDP encapsulation
Adding lookaside IPsec UDP encapsulation support
for NAT traversal.
Application has to add udp-encap option to sa config file
to enable UDP encapsulation on the SA.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2021-04-16 12:43:33 +02:00
Rohit Raj
62c0b4484c examples/l2fwd-crypto: fix packet length while decryption
There were some padding left when a packet gets decrypted. This
patch removes those padding.
This patch also removes the padding left after verifying auth of
the packet.

Fixes: e2cdfbd07c ("examples/l2fwd-crypto: fix port id type")
Cc: stable@dpdk.org

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-04-16 12:43:33 +02:00
Apeksha Gupta
58266cc91e examples/l2fwd-crypto: skip masked devices
The devices which are masked by cryptodev mask should not be initialized
and skipped while traversing the device list.

Fixes: 6ae3fb9df6 ("examples/l2fwd-crypto: fix session mempool size")
Cc: stable@dpdk.org

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-04-16 12:43:33 +02:00
Gagandeep Singh
ef156f4eec examples/l2fwd-crypto: align private data size to cache size
L2fwd-crypto is passing 24b private data size while packet
pool creation. This patch aligns that private data size
to cache line size for better performance results.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2021-04-16 12:43:33 +02:00
Dmitry Kozlyuk
89813a522e net: provide IP-related API on any OS
Users of <rte_ip.h> relied on it to provide IP-related defines,
like IPPROTO_* constants, but still had to include POSIX headers
for inet_pton() and other standard IP-related facilities.

Extend <rte_ip.h> so that it is a single header to gain access
to IP-related facilities on any OS. Use it to replace POSIX includes
in components enabled on Windows. Move missing constants from Windows
networking shim to OS shim header and include it where needed.

Remove Windows networking shim that is no longer needed.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
2021-04-15 01:56:43 +02:00
Xueming Li
64051bb1f1 devargs: unify scratch buffer storage
In current design, legacy parser rte_devargs_parse() saved scratch
buffer to devargs.args while new parser rte_devargs_layers_parse() saved
to devargs.data. Code using devargs had to know the difference and
cleaned up memory accordingly - error prone.

This patch unifies scratch buffer to data field, introduces
rte_devargs_reset() function to wrap the memory clean up logic.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Reviewed-by: Gaetan Rivet <grive@u256.net>
2021-04-14 22:25:08 +02:00
Ibtisam Tariq
dd0946f975 examples/vhost_crypto: remove unused short option
Short option "s" was passed to getopt_long function, while there was
no condition on this option.

Fixes: f5188211c7 ("examples/vhost_crypto: add sample application")
Cc: stable@dpdk.org

Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-03-31 10:02:18 +02:00
Chenbo Xia
1739f81425 examples/vhost: check memory table query
This patch fixes unchecked return value for rte_vhost_get_mem_table(),
which is reported by coverity.

Coverity issue: 364233
Fixes: ca059fa5e2 ("examples/vhost: demonstrate the new generic APIs")
Cc: stable@dpdk.org

Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-03-31 08:46:32 +02:00
Keiichi Watanabe
510f43fc5e examples/vhost_blk: check features before inflight API
Avoid calling rte_vhost_get_vhost_ring_inflight() and
rte_vhost_get_vring_base_from_inflight() when
VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD is not set.

Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-03-31 08:20:59 +02:00
Cristian Dumitrescu
f38913b7fb pipeline: add meter array to SWX
Meter arrays are stateful objects that are updated by the data plane
and configured & monitored by the control plane. The meters implement
the RFC 2698 Two Rate Three Color Marker (trTCM) algorithm.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-03-24 19:18:45 +01:00
Cristian Dumitrescu
64cfcebd68 pipeline: add register array to SWX
Register arrays are stateful objects that can be read & modified by
both the data plane and the control plane, as opposed to tables, which
are read-only for data plane. One key use-case is the implementation
of stats counters.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-03-24 19:18:40 +01:00
Churchill Khangar
0d644eb621 examples/pipeline: support hexadecimal argument in CLI
This patch allows specification of integer arguments for the
CLI commands in hexadecimal and octal as well as decimal.

Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-03-24 18:27:09 +01:00
Dapeng Yu
c99f115bbd examples/packet_ordering: fix port configuration
A global ethernet port configuration is assigned to local variable
because in this way the local variable may be updated as required. But
this local variable is not used as input of rte_eth_dev_configure() in
original implementation, and cause that fast mbuf free feature cannot
be enabled on port.

This patch use this local variable as input of rte_eth_dev_configure().

Fixes: 6833f919f5 ("examples/packet_ordering: convert to new ethdev offloads API")
Cc: stable@dpdk.org

Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
2021-03-24 11:16:37 +01:00
Cristian Dumitrescu
0b50ea60fb examples/pipeline: make quanta configurable
Make the pipeline instruction quanta configurable at build time.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-03-24 10:03:12 +01:00
Venkata Suresh Kumar P
e2b8dc5256 port: add file descriptor SWX port
Add the file descriptor input/output port type for the SWX pipeline.
File descriptor port type provides interface with the kernel network
stack. Example file descriptor port is TAP device.

Signed-off-by: Venkata Suresh Kumar P <venkata.suresh.kumar.p@intel.com>
Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-03-23 19:50:44 +01:00
Cristian Dumitrescu
66440b7b22 table: add wildcard match table type
Add the widlcard match/ACL table type for the SWX pipeline, which is
used under the hood by the table instruction.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
2021-03-23 19:47:20 +01:00
Cristian Dumitrescu
cff9a7178e pipeline: improve table entry parsing
Improve the table entry parsing: better code structure, enable parsing
for the key field masks, allow comments and empty lines in the table
entry files.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Venkata Suresh Kumar P <venkata.suresh.kumar.p@intel.com>
Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
2021-03-23 18:41:47 +01:00
Cristian Dumitrescu
77a413017c port: add ring SWX port
Add the ring input/output port type for the SWX pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-03-23 17:22:47 +01:00
Ibtisam Tariq
270054edc9 examples/vhost_crypto: enhance getopt_long usage
Instead of using getopt_long return value, strcmp was used to
compare the input parameters with the struct option array. This
patch get rid of all those strcmp by directly binding each longopt
with an int enum. This is to improve readability and consistency in
all examples.

Bugzilla ID: 238

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-03-23 13:00:29 +01:00
Ibtisam Tariq
965b06f035 examples/vhost: enhance getopt_long usage
Instead of using getopt_long return value, strcmp was used to
compare the input parameters with the struct option array. This
patch get rid of all those strcmp by directly binding each longopt
with an int enum. This is to improve readability and consistency in
all examples.

Bugzilla ID: 238

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-03-23 13:00:29 +01:00
Ibtisam Tariq
a12daff4d1 examples/qos_sched: enhance getopt_long usage
Instead of using getopt_long return value, strcmp was used to
compare the input parameters with the struct option array. This
patch get rid of all those strcmp by directly binding each longopt
with an int enum. This is to improve readability and consistency in
all examples.

Bugzilla ID: 238

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-03-23 13:00:29 +01:00
Ibtisam Tariq
745d01a26a examples/performance-thread: enhance getopt_long usage
Instead of using getopt_long return value, strcmp was used to
compare the input parameters with the struct option array. This
patch get rid of all those strcmp by directly binding each longopt
with an int enum. This is to improve readability and consistency in
all examples.

Bugzilla ID: 238

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-03-23 13:00:29 +01:00
Ibtisam Tariq
3bb3ebb51b examples/packet_ordering: enhance getopt_long usage
Instead of using getopt_long return value, strcmp was used to
compare the input parameters with the struct option array. This
patch get rid of all those strcmp by directly binding each longopt
with an int enum. This is to improve readability and consistency in
all examples.

Bugzilla ID: 238

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-03-23 13:00:17 +01:00
Ibtisam Tariq
ec4887414a examples/l3fwd-acl: enhance getopt_long usage
Instead of using getopt_long return value, strcmp was used to
compare the input parameters with the struct option array. This
patch get rid of all those strcmp by directly binding each longopt
with an int enum. This is to improve readability and consistency in
all examples.

Bugzilla ID: 238

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-03-23 13:00:16 +01:00
Ibtisam Tariq
fc6e6515c7 examples/fips_validation: enhance getopt_long usage
Instead of using getopt_long return value, strcmp was used to
compare the input parameters with the struct option array. This
patch get rid of all those strcmp by directly binding each longopt
with an int enum. This is to improve readability and consistency in
all examples.

Bugzilla ID: 238

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-03-23 12:48:11 +01:00
Thomas Monjalon
960f28b2a3 examples/bbdev: fix header include for musl
The header file unistd.h should not be included from sys/ directory,
it is an error with musl libc.

Fixes: 1ffee690ea ("examples/bbdev: add sample app")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
2021-03-23 08:41:05 +01:00
Thomas Monjalon
1cd512b2f5 build: detect execinfo library on Linux
The library execinfo and its header file can be installed on Alpine Linux
where the backtrace feature is not part of musl libc:
	apk add libexecinfo-dev

As a consequence, this library should not be restricted to BSD only.

At the same time, the library and header are detected once and added
globally to be linked with any application, internal or external.

Fixes: 9065b1fac6 ("build: fix dependency on execinfo for BSD meson builds")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
2021-03-23 08:41:05 +01:00
Hemant Agrawal
7a04a4f67d examples/ptpclient: enable Rx timestamp offload
This patch add support to enable Rx offload for timestamp.
It is required to be enabled for some PMDs e.g. dpaa2.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
2021-03-17 13:49:12 +01:00
Bruce Richardson
5d20515e0c build: exclude meson files from examples installation
The meson.build files in each example directory is simply to support
building the example as part of the main SDK build, and these should not
be installed with the example's source code and makefile. The exclude of
"meson.build" only filters out the top-level examples/meson.build file,
not the file in each subdirectory.

To fix this, we can build up the list of files to exclude based off the
list of all examples. With this change "find examples/ -name meson.build"
returns no hits when run on an installed instance.

Fixes: e5b95003f1 ("examples: fix flattening directory layout on install")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2021-03-15 20:44:29 +01:00
Cheng Jiang
fa545ed3da examples/vhost: add error propagation in ioat ops
This patch adds add error propagation for rte_ioat_completed_ops call,
and also changes dev_id type from int to uint16_t.

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-02-04 18:19:36 +01:00
Cheng Jiang
ee6e451f14 examples/vhost: fix potentially overflowing expression
Change the type of buff_idx from uint64_t to uint32_t to fix coverity
issue.

Coverity issue: 366264
Fixes: a68ba8e0a6 ("examples/vhost: refactor vhost data path")

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-02-04 18:19:36 +01:00
Cheng Jiang
d4d4c6fed6 examples/vhost: remove async inflight packet counter
Remove async inflight packet counter since there is no need to keep
tracking it. Increase MAX_ENQUEUED_SIZE to prevent packet segment number
tracking ring from being exhausted.

Fixes: a68ba8e0a6 ("examples/vhost: refactor vhost data path")

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-02-04 18:19:36 +01:00
Bruce Richardson
5a19633079 examples: warn about broken pkg-config
Since the examples are designed to be built by end-users using Make, we
can detect and warn about broken pkg-config on the user's system as part
of the build process.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2021-01-30 01:27:28 +01:00
Cheng Jiang
a68ba8e0a6 examples/vhost: refactor vhost data path
Change the vm2vm data path to batch enqueue for better performance.
Support latest async vhost API, refactor vhost async data path,
replace rte_atomicNN_xxx to __atomic_XXX and clean some codes.

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-01-29 18:16:09 +01:00
Cheng Jiang
2aa47e94bf examples/vhost: add ioat ring space count and check
Add ioat ring space count and check, if ioat ring space is not enough
for the next async vhost packet enqueue, then just return to prevent
enqueue failure. Add rte_ioat_completed_ops() fail handler.

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-01-29 18:16:09 +01:00
Feifei Wang
f3527e0b97 examples/eventdev: move ethdev stop to the end
Move eth stop code from "signal_handler" function to the end of "main"
function. There are two reasons for this:

First, this improves code maintenance and makes code look simple and
clear. Based on this change, after receiving the interrupt signal,
"fdata->done" is set as 1. Then the main thread will wait all worker
lcores to jump out of the loop. Finally, the main thread will stop and
then close eth dev port.

Second, for older version, the main thread first stops eth dev port and
then waits the end of worker lcore. This may cause errors because it may
stop the eth dev port which worker lcores are using. This moving change
can fix this by waiting all worker threads to exit and then stop the
eth dev port.

In the meanwhile, remove wmb in signal_handler.

This is because when the main lcore receive the stop signal, it stores 1
into fdata->done. And then the worker lcores load "fdata->done" and jump
out of the loop to stop running. Nothing should be stored after updating
fdata->done, so the wmb is unnecessary.

Fixes: 085edac2ca ("examples/eventdev_pipeline: support Tx adapter")
Cc: stable@dpdk.org

Suggested-by: Ruifeng Wang <ruifeng.wang@arm.com>
Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
2021-01-26 13:58:01 +01:00
Feifei Wang
198b544843 examples/eventdev: add info output for main core
When the main core is set as tx/rx/sched/worker core, it also needs to
print some information to show this. Thus, add info output for the main
core, and add a "dump" function to print core information for the sake
of code simplicity and easy maintenance.

In the meanwhile, fix the count error. For the variable "worker_idx", it
should be incremented when the core is set as worker core. However, when
the main core is set as rx/tx/sched core, the worker_idx is also
incremented. Though this error may not have a substantial impact due to
that the main core is the last launched core, but it should be corrected
from the perspective of code correctness.

Fixes: 1094ca9668 ("doc: add SW eventdev pipeline to sample app guide")
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2021-01-26 13:44:06 +01:00
Feifei Wang
3d15913432 examples/eventdev: check CPU core enabling
In the case that the cores are isolated, if "-l" or "-c" parameter is not
added, the cores will not be enabled and can not launch worker function
correctly. In the meanwhile, no error information is reported.

For example:
totally CPUs:16
isolated CPUs:1-8
command: sudo gdb -args ./dpdk-eventdev_pipeline --vdev event_sw0 \
        -- -r1 -t1 -e4 -w F00 -s4 -n0 -c32 -W1000 -D

cores information:
rte_config->lcore_role = {ROLE_RTE, ROLE_OFF, ROLE_OFF, ROLE_OFF,
                          ROLE_OFF, ROLE_OFF, ROLE_OFF, ROLE_OFF,
                          ROLE_OFF, ROLE_RTE, ROLE_RTE, ROLE_RTE,
                          ROLE_RTE, ROLE_RTE, ROLE_RTE, ROLE_RTE}

output information:
...
[main()] lcore 9 executing worker, using eventdev port 0
[main()] lcore 10 executing worker, using eventdev port 1
[main()] lcore 11 executing worker, using eventdev port 2

This is because "RTE_LCORE_FOREACH_WORKER" chooses the enabled core. In
the case that the cores are isolated, "the lcore_role" flag of isolated
cores are set as "ROLE_OFF" by default(not enabled). So if we choose
these isolated cores as workers, "RTE_LCORE_FOREACH_WORKER" will ignore
these cores and not launch worker functions on them.

To fix this, add "-l" parameters to doc and add lcore enabled check.

Fixes: 1094ca9668 ("doc: add SW eventdev pipeline to sample app guide")
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2021-01-26 13:30:13 +01:00
Cristian Dumitrescu
821848f519 examples/pipeline: fix CLI parsing crash
Cannot dereference pointer for token[1] unless valid.

Fixes: 5074e1d551 ("examples/pipeline: add configuration commands")
Cc: stable@dpdk.org

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-01-29 16:20:58 +01:00
Liang Ma
26fe454ec0 examples/l3fwd-power: add ethdev power management
Add PMD power management feature support to l3fwd-power sample app.

Signed-off-by: Liang Ma <liang.j.ma@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
2021-01-29 15:29:48 +01:00
Bruce Richardson
825fddf651 power: clean up includes
re-organise the including of the new public header file and
remove un-needed includes

Fixes: 210c383e24 ("power: packet format for vm power management")
Fixes: cd0d5547e8 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2021-01-29 11:25:40 +01:00
Bruce Richardson
38d232b9b8 power: rename constants
Rename the #defines to have an RTE_POWER_ prefix

Fixes: 210c383e24 ("power: packet format for vm power management")
Fixes: cd0d5547e8 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2021-01-29 11:25:40 +01:00
Bruce Richardson
bd5b6720fe power: rename public structs
Rename the public structs to have an rte_power_ prefix.

Fixes: 210c383e24 ("power: packet format for vm power management")
Fixes: cd0d5547e8 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2021-01-29 11:25:40 +01:00
Bruce Richardson
5f443cc0f9 power: create guest channel public header file
In preparation for making the header file public, we first rename
channel_commands.h as rte_power_guest_channel.h.

Fixes: 210c383e24 ("power: packet format for vm power management")
Fixes: cd0d5547e8 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
2021-01-29 11:25:40 +01:00
David Hunt
b49c677a0d examples/vm_power: respect core mask
When vm_power_manager is started, it takes over power management on
all cores. This should be limited to cores defined in the core mask.

When initialising, if a core is not on the coremask, skip it.
Applies to both initialisation and exit.

Signed-off-by: David Hunt <david.hunt@intel.com>
2021-01-28 23:17:18 +01:00
Bruce Richardson
7be7dc6dea build: force pkg-config for dependency detection
Meson can use cmake as a fallback for detecting packages, and this can
lead to picking up 64-libs for 32-bit builds. To work around this, force
the use of pkg-config only for detecting libcrypto, zlib, jansson and
other package dependencies.

Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Ruifeng Wang <ruifeng.wang@arm.com>
Tested-by: Liron Himi <lironh@marvell.com>
Tested-by: Lee Daly <lee.daly@intel.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Martin Spinler <spinler@cesnet.cz>
2021-01-26 00:43:59 +01:00
David Marchand
6c51ba3c42 examples/pipeline: fix VXLAN script permission
This python script provides a shebang that only makes sense if the
script has the executable bit set.

Fixes: fde7a77270 ("examples/pipeline: add VXLAN encapsulation example")
Cc: stable@dpdk.org

Reported-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2021-01-25 10:15:34 +01:00
Harman Kalra
88256ed853 examples/l3fwd: remove limitation on Tx queue count
In l3fwd no of transmit queues is calculated based on no of
lcores with which it is launched. Hence maximum no of tx
queues possible per port should depend on RTE_MAX_LCORE value.

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

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2021-01-19 13:12:59 +01:00
Jiayu Hu
1b7b24389c vhost: enhance async enqueue for small packets
Async enqueue offloads large copies to DMA devices, and small copies
are still performed by the CPU. However, it requires users to get
enqueue completed packets by rte_vhost_poll_enqueue_completed(), even
if they are completed by the CPU when rte_vhost_submit_enqueue_burst()
returns. This design incurs extra overheads of tracking completed
pktmbufs and function calls, thus degrading performance on small packets.

This patch enhances async enqueue for small packets by enabling
rte_vhost_submit_enqueue_burst() to return completed packets.

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-01-13 18:51:58 +01:00
Dmitry Kozlyuk
da042bcfc6 build: fix linker flags on Windows
The --export-dynamic linker option is only applicable to ELF.
On Windows, where COFF is used, it causes warnings:

    x86_64-w64-mingw32-ld: warning: --export-dynamic is not supported
    for PE+ targets, did you mean --export-all-symbols? (MinGW)

    LINK : warning LNK4044: unrecognized option '/-export-dynamic';
    ignored (clang)

Don't add --export-dynamic on Windows anywhere.

Fixes: b031e13d7f ("build: fix plugin load on static build")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
2021-01-13 22:13:37 +01:00
Joyce Kong
96d1d898dc examples/vhost_blk: replace SMP barrier with thread fence
Simply replace the rte_smp_mb barriers with SEQ_CST atomic thread fence,
if there is no load/store operations.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2021-01-08 18:07:55 +01:00
Joyce Kong
111cf3f497 examples/vhost: relax memory ordering when enqueue/dequeue
Use C11 atomic APIs with one-way barriers to replace two-way
barriers when operating enqueue/dequeue. Used->idx and avail->idx
are the synchronization points for split vring.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2021-01-08 18:07:55 +01:00
Olivier Matz
b031e13d7f build: fix plugin load on static build
When dpdk is compiled as static libraries, it is not possible
to load a plugin from an application. We get the following error:

  EAL: librte_pmd_xxxx.so: undefined symbol: per_lcore__rte_errno

This happens because the dpdk symbols are not exported. Add them to the
dynamic symbol table by using '-Wl,--export-dynamic'. This option was
previously present when compiled with Makefiles, it was introduced in
commit f9a08f6502 ("eal: add support for shared object drivers")

Also add it to the pkg-config file.

Fixes: 16ade738fd ("app/testpmd: build with meson")
Fixes: 89f0711f9d ("examples: build some samples with meson")
Cc: stable@dpdk.org

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
2021-01-05 23:01:36 +01:00
Gregory Etelson
6184a02223 examples/l3fwd-power: check packet types after start
l3fwd-power uses `--parse-ptype' parameter to query egress packets
type.  Before that feature is enabled l3fwd-power verifies PMD ability
to advertise supported packet types with
rte_eth_dev_get_supported_ptypes().

The above ethdev function API contains this note:
"
Better to invoke this API after the device is already started or rx burst
function is decided, to obtain correct supported ptypes.
"

The patch updates code for PMDs that register supported types after
dev_start.

Fixes: 82bea46616 ("examples/l3fwd-power: add --parse-ptype option")
Cc: stable@dpdk.org

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
2020-11-22 18:27:08 +01:00
Bruce Richardson
aba2af9936 examples/multi_process: add SPDX license tag to makefiles
The makefiles for some of the multi_process example files were missing
SPDX license headers, so add them. These Makefiles completely replaced
the older makefiles and were written from scratch, not based on previous
versions, so add a new copyright year on them.

Fixes: 13abe17c3c ("examples/multi_process: convert to pkg-config-based build")

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2020-11-20 17:32:23 +01:00
Savinay Dharmappa
5ba66e8c2a examples/qos_sched: fix subport configuration
Update the qos_sched user guide and profile config file
with default subport profile.

Fixes: 802d214dc8 ("examples/qos_sched: update subport rate dynamically")

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-11-20 12:50:41 +01:00
Stephen Hemminger
db27370b57 eal: replace blacklist/whitelist options
Replace -w / --pci-whitelist with -a / --allow options
and --pci-blacklist with --block.
The -b short option remains unchanged.

Allow the old options for now, but print a nag
warning since old options are deprecated.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2020-11-16 00:11:22 +01:00
David Marchand
bc8e32473c examples: restore trace point
Before make removal, those examples were built with experimental flag
for tracepoints to be compiled in but the pkg-config part of those
makefiles were missed.

Fixes: 78d44153de ("ethdev: add tracepoints")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-11-15 15:35:11 +01:00
David Marchand
090693344b examples/rxtx_callbacks: fix build with pkg-config
This example is missing the experimental flag since it uses an
experimental API.

Fixes: cd1dadeb9b ("examples/rxtx_callbacks: support HW timestamp")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-11-15 15:34:50 +01:00
David Marchand
9c3586a643 examples/vhost_blk: fix build with pkg-config
vhost_blk.c: In function ‘ctrlr_worker’:
vhost_blk.c:543:2: warning: implicit declaration of function ‘CPU_ZERO’
[-Wimplicit-function-declaration]
  543 |  CPU_ZERO(&cpuset);
      |  ^~~~~~~~
vhost_blk.c:544:2: warning: implicit declaration of function ‘CPU_SET’
[-Wimplicit-function-declaration]
  544 |  CPU_SET(0, &cpuset);
      |  ^~~~~~~
vhost_blk.c:545:2: warning: implicit declaration of function
‘pthread_setaffinity_np’ [-Wimplicit-function-declaration]
  545 |  pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
      |  ^~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cczpiMWH.o: in function `ctrlr_worker':
vhost_blk.c:(.text+0x1076): undefined reference to `CPU_ZERO'
/usr/bin/ld: vhost_blk.c:(.text+0x1082): undefined reference to
`CPU_SET'
collect2: error: ld returned 1 exit status
gmake: *** [Makefile:34: build/vhost-blk-shared] Error 1

Explicitly pass _GNU_SOURCE and include missing headers (rather than
rely on automagic inclusion from other system headers).

Fixes: c19beb3f38 ("examples/vhost_blk: introduce vhost storage sample")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-11-15 15:33:05 +01:00
David Marchand
e0216ac509 examples/performance-thread: fix build with pkg-config
main.c: In function ‘lthread_tx’:
main.c:2091:25: error: implicit declaration of function ‘sched_getcpu’;
 did you mean ‘sched_getparam’? [-Werror=implicit-function-declaration]
 2091 |  tx_conf->conf.cpu_id = sched_getcpu();
      |                         ^~~~~~~~~~~~
      |                         sched_getparam
cc1: all warnings being treated as errors

Explicitly pass _GNU_SOURCE and include missing header (rather than
rely on automagic inclusion from other system headers).

Fixes: d48415e1fe ("examples/performance-thread: add l3fwd-thread app")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
2020-11-15 15:31:15 +01:00
David Marchand
9bb2997cb7 examples/ntb: fix clean target
When introducing this example, the cleanup from commit 7e9562a107
("examples: fix make clean when using pkg-config") was missed.

Fixes: c5eebf85ba ("examples/ntb: add example for NTB")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
2020-11-15 15:30:21 +01:00
David Marchand
db886c51df examples/l3fwd-graph: fix pkg-config usage
This example missed the fixes from commit 69b1bb49ed
("examples: hide error for missing pkg-config path flag") and
commit 12a652a02b ("examples: fix build with old pkg-config").

Fixes: 08bd1a1744 ("examples/l3fwd-graph: add graph-based l3fwd skeleton")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
2020-11-15 15:29:34 +01:00
David Marchand
0738209c23 examples/l3fwd-graph: fix static build
This example missed the rework from commit 8549295db0
("build/pkg-config: improve static linking flags").

Fixes: 08bd1a1744 ("examples/l3fwd-graph: add graph-based l3fwd skeleton")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-11-15 15:29:29 +01:00
David Marchand
bcd3004381 examples/l2fwd-crypto: fix build with pkg-config
Two issues fixed here.

First add the experimental flag.
Then fix a link issue with the crypto scheduler driver:
/usr/bin/ld: /tmp/cchr7aHA.o: in function `main':
main.c:(.text.startup+0x1673): undefined reference to
`rte_cryptodev_scheduler_workers_get'
collect2: error: ld returned 1 exit status

Fixes: e3bcb99a5e ("examples/l2fwd-crypto: limit number of sessions")
Fixes: 261bbff75e ("examples: use separate crypto session mempools")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
2020-11-15 15:29:24 +01:00
David Marchand
58a0648bd3 examples/kni: fix build with pkg-config
rm -f build/kni build/kni-static build/kni-shared
test -d build && rmdir -p build || true
[...]
/usr/bin/ld: /tmp/cc72ssnK.o: undefined reference to symbol
'pthread_join@@GLIBC_2.2.5'

This example explicitly call pthread API and should be linked against
the pthread library.

Fixes: 724beb913b ("examples/kni: monitor and update link state continually")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-11-15 15:29:23 +01:00
David Marchand
13db2494e8 examples/ipsec-gw: fix build with pkg-config
flow.c: In function ‘parse_flow_tokens’:
flow.c:153:23: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  153 |     if (ipv4_addr_cpy(&rule->ipv4.spec.hdr.src_addr,
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flow.c:154:9: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  154 |         &rule->ipv4.mask.hdr.src_addr,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flow.c:170:23: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  170 |     if (ipv4_addr_cpy(&rule->ipv4.spec.hdr.dst_addr,
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flow.c:171:9: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  171 |         &rule->ipv4.mask.hdr.dst_addr,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Meson build is fine since we waive those warnings.
Replicate it for make.

Fixes: 8e693616fc ("examples/ipsec-secgw: enable flow based distribution")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-11-15 15:29:22 +01:00
David Marchand
0525677c81 examples/fips_validation: fix build with pkg-config
When this example started using rte_cryptodev_sym_session_pool_create,
the part for pkg-config builds was not updated.

Fixes: 261bbff75e ("examples: use separate crypto session mempools")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-11-15 15:29:19 +01:00
Cheng Jiang
6e9a9d2a02 examples/vhost: fix ioat dependency
Fix vhost-switch compiling issue when ioat dependency is missing.
Change 'RTE_x86' check into 'RTE_RAW_IOAT' check in meson build file.
Use 'RTE_RAW_IOAT' to control conditional compiling in source file.
Clean some codes.

Fixes: abec60e711 ("examples/vhost: support vhost async data path")
Fixes: 3a04ecb214 ("examples/vhost: add async vhost args parsing")

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: David Marchand <david.marchand@redhat.com>
2020-11-13 19:43:26 +01:00
Cheng Jiang
653b5994e8 examples/vhost: fix string split error handling
Add checking return value of string split function to fix the
coverity issue.

Coverity issue: 363739
Fixes: 3a04ecb214 ("examples/vhost: add async vhost args parsing")

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-11-13 19:43:26 +01:00
Cheng Jiang
2b7126f5fc examples/vhost: check argument length
Add args length check before copying to fix the coverity issue.

Coverity issue: 363741
Fixes: 3a04ecb214 ("examples/vhost: add async vhost args parsing")

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-11-13 19:43:26 +01:00
Ibtisam Tariq
854dbee2ac examples/vhost_crypto: add new line character in usage
Add new line character(\n) in the usage of vhost_crypto example for
better readability

Fixes: 709521f4c2 ("examples/vhost_crypto: support multi-core")
Cc: stable@dpdk.org

Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-11-13 19:43:25 +01:00
Ibtisam Tariq
fc48d8a5b2 examples/qos_sched: fix usage string
The short option written for interactive mode is --i in usage of
this qos_sched example. Actually, it is -i.

Fixes: cfd5c971e5 ("examples/qos_sched: add stats")
Cc: stable@dpdk.org

Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2020-11-13 14:25:57 +01:00
Bruce Richardson
3495a68f2a examples: stop processing meson file if build impossible
Once it has been determined that an example cannot be built, there is
little point in continuing to process the meson.build file for that
example, so we can use subdir_done() to return to the calling file.
This can potentially prevent problems where later statement in the file
may cause an error on systems where the app cannot be built, e.g. on
Windows or FreeBSD.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2020-11-12 19:33:36 +01:00
Bruce Richardson
b334236abd examples/l2fwd-keepalive: skip meson build if no librt
When librt is not present on a system, processing the meson.build file
for this example application causes an error. Make the library
non-mandatory and just mark the example as unbuildable if it is
not present.

Fixes: 89f0711f9d ("examples: build some samples with meson")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2020-11-12 19:33:10 +01:00
Bruce Richardson
e5b95003f1 examples: fix flattening directory layout on install
By installing the examples one-by-one in a loop in the examples
meson.build file we effectively flattened out the structure of the examples
folder and omitted some common and shared subfolders that were never
directly built.  Instead, we can remove the loop and just have the whole
"examples" folder installed as-is in a single statement, preserving its
directory structure, and thereby fixing the build of a number of the
examples.

Fixes: 2daf565f91 ("examples: install as part of ninja install")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2020-11-12 19:33:06 +01:00
Dmitry Kozlyuk
c2341bb671 cmdline: avoid name clash with Windows system types
cmdline_numtype member names clash with Windows system identifiers.
Add RTE_ prefix to cmdline constants to avoid this and possible
future conflicts.

Suggested-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Jie Zhou <jizh@microsoft.com>
Tested-by: Jie Zhou <jizh@microsoft.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2020-11-05 17:49:00 +01:00
Cheng Jiang
abec60e711 examples/vhost: support vhost async data path
This patch is to implement vhost DMA operation callbacks for CBDMA
PMD and add vhost async data-path in vhost sample. With providing
callback implementation for CBDMA, vswitch can leverage IOAT to
accelerate vhost async data-path.

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-11-03 23:24:26 +01:00
Cheng Jiang
3a04ecb214 examples/vhost: add async vhost args parsing
This patch is to add async vhost driver arguments parsing function
for CBDMA channel, DMA initiation function and args description.
The meson build file is changed to fix dependency problem. With
these arguments vhost device can be set to use CBDMA or CPU for
enqueue operation and bind vhost device with specific CBDMA channel
to accelerate data copy.

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-11-03 23:24:26 +01:00
Vladimir Medvedkin
57ddbf7edd examples/ipsec-secgw: fix session mempool initialisation
Creation of a session mempool may fail in the case of a single lcore
and a low number of SA.

In case when there is only one lcore and number of configures SA less
then (0.5 * CDEV_MP_CACHE_SZ) then creation of the mempool fails with
EINVAL. This is because the number of requested items is less than
(cache size * CDEV_MP_CACHE_MULTIPLIER).

Hence, the number of elements in mempool is increased in such cases.

Fixes: e30b2833c4 ("security: update session create API")

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2020-11-02 09:24:41 +01:00
Fan Zhang
601b8a54a5 fips_validation: fix GCM test
This patch fixes FIPS GCM test of the redundant plaintext string
write and insufficient test case support check for some corner
cases.

Fixes: d09abf2d10 ("examples/fips_validation: update GCM test")
Cc: stable@dpdk.org

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
2020-11-02 09:24:41 +01:00
Fan Zhang
ecc3356fed examples/fips_validation: fix missed version line
This patch fixes the missing version line in the response file.

Fixes: 7936501840 ("examples/fips_validation: fix version compatibility")
Cc: stable@dpdk.org

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
2020-11-02 09:24:40 +01:00
Thomas Monjalon
13ad83f18a examples/rxtx_callbacks: switch timestamp to dynamic field
The mbuf timestamp is moved to a dynamic field
in order to allow removal of the deprecated static field.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2020-11-03 16:21:15 +01:00
Anatoly Burakov
317a1da8d6 examples/l3fwd-power: fix race on interrupt wakeup log
Currently, the interrupt status notification prevents log spam by
remembering whether previous interrupt wakeup was due to traffic or due
to timeout expiring. However, it is a single variable that can
potentially be accessed from multiple threads, so it is not thread-safe.

Fix it by having per-lcore interrupt status.

Fixes: f4d1e19c29 ("examples/l3fwd-power: add Rx interrupt timeout")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
Tested-by: Xi Zhang <xix.zhang@intel.com>
2020-11-02 11:47:19 +01:00
David Marchand
01f3496695 reorder: switch sequence number to dynamic mbuf field
The reorder library used sequence numbers stored in the deprecated field
seqn.
It is moved to a dynamic mbuf field in order to allow removal of seqn.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2020-10-31 22:14:30 +01:00
Ciara Power
bda9ce3c94 examples/fips_validation: fix leak on failure
The wb_data variable went out of scope on failure in the
get_writeback_data function. This is now freed before returning -1.

Coverity issue: 363453
Fixes: 952e10cdad ("examples/fips_validation: support scatter gather list")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2020-10-31 18:10:43 +01:00
Ciara Power
afda6b0116 examples/fips_validation: fix crash on allocation failure
The return value was not being checked when calling the
get_writeback_data function in the AES test case. On failure, this led
to a NULL dereference when using memcpy later. The return value is now
checked to avoid this NULL dereference.

Coverity issue: 363463
Fixes: 952e10cdad ("examples/fips_validation: support scatter gather list")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2020-10-31 18:00:03 +01:00
Thomas Monjalon
eb8258402b examples/rxtx_callbacks: switch TSC to dynamic field
The example used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2020-10-31 16:13:11 +01:00
Thomas Monjalon
61bf499d9c examples/bbdev: switch to dynamic mbuf field
The example used the deprecated mbuf field udata64 as input mbuf pointer.
It is moved to a dynamic field in order to allow removal of udata64.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2020-10-31 16:13:11 +01:00
Thomas Monjalon
614af75489 security: switch metadata to dynamic mbuf field
The device-specific metadata was stored in the deprecated field udata64.
It is moved to a dynamic mbuf field in order to allow removal of udata64.

The name rte_security_dynfield is not very descriptive
but it should be replaced later by separate fields for each type of data
that drivers pass to the upper layer.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
2020-10-31 16:13:11 +01:00
Thomas Monjalon
7b0de673e2 examples: enclose DPDK includes with angle brackets
In examples, DPDK header files are external,
so they must be enclosed with angle brackets, not quotes.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-10-31 16:13:10 +01:00
Honnappa Nagarahalli
4e3b2d4c76 examples/performance-thread: fix build with low core count
When the value of RTE_MAX_LCORE is small, it results in the
following compilation error.

../examples/performance-thread/l3fwd-thread/main.c:2338:34: error:
iteration 4 invokes undefined behavior
[-Werror=aggressive-loop-optimizations]

Fixes: d48415e1fe ("examples/performance-thread: add l3fwd-thread app")
Cc: stable@dpdk.org

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2020-10-30 15:45:59 +01:00
Bruce Richardson
27b549c12d examples/multi_process: fix build on Ubuntu 20.04
Two warnings are reported by gcc 9.3.0 on Ubuntu 20.04.

When producing a printable mac address the buffer was appropriately sized
for holding the mac address exactly, but the actual snprintf included a
'\n' character at the end, which means that the snprintf technically is
getting truncated i.e. the \n would not be added due to lack of space.
This gets flagged as a problem by modern versions of gcc, e.g. on Ubuntu
20.04.

main.c:77:37: warning: ‘__builtin___snprintf_chk’ output truncated
  before the last format character [-Wformat-truncation=]
   77 |     "%02x:%02x:%02x:%02x:%02x:%02x\n",
      |                                     ^

Since the \n is getting stripped anyway, we can fix the issue by just
removing it. In the process we can switch to using the standard ethernet
address formatting function from rte_ether.h.

The other warning is about possible string truncation when getting the
RX queue name:

In file included from init.c:36:
init.c: In function ‘init’:
../shared/common.h:38:28: warning: ‘%u’ directive output may be truncated
  writing between 1 and 10 bytes into a region of size 8
  [-Wformat-truncation=]
   38 | #define MP_CLIENT_RXQ_NAME "MProc_Client_%u_RX"
      |                            ^~~~~~~~~~~~~~~~~~~~
../shared/common.h:52:35: note: in expansion of macro ‘MP_CLIENT_RXQ_NAME’
   52 |  snprintf(buffer, sizeof(buffer), MP_CLIENT_RXQ_NAME, id);
      |                                   ^~~~~~~~~~~~~~~~~~

This is a false positive, as the value of the "id" is limited to 255,
being stored in the app as a uint8_t value, removing the possibility of
the %u being replaced by anything other then 3 characters max (rather than
up to 10 as thought by the compiler). Therefore, the warning can be easily
removed by changing the type of the "id" parameter to the local function
from "unsigned" to "uint8_t" also, ensuring the compiler is aware of the
range limit.

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

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
2020-10-30 14:54:50 +01:00
Bruce Richardson
a9f57cfc08 examples/vm_power: fix build on Ubuntu 20.04
When compiling on Ubuntu 20.04, a warning was issued about possible
truncation of the path string for the power management socket.

channel_manager.c: In function ‘add_all_channels’:
channel_manager.c:470:41: warning: ‘%s’ directive output may be
  truncated writing up to 255 bytes into a region of size 90
  [-Wformat-truncation=]
  470 |     sizeof(chan_info->channel_path), "%s%s",
      |                                         ^~

This can be fixed by adding in an explicit truncation check to the code
and handling it appropriately.

Fixes: e8ae9b6625 ("examples/vm_power: channel manager and monitor in host")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
2020-10-30 14:54:23 +01:00
Bruce Richardson
7157a9dcc4 examples: fix linking against specific drivers
Some example apps rely on driver-specific functionality and link explicitly
against those drivers. These apps need their makefiles updated to take
account of the renaming of the driver libs.

Fixes: a20b2c01a7 ("build: standardize component names and defines")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2020-10-30 14:33:36 +01:00
Rory Sexton
3ac192b309 examples/vm_power: fix memory leak
Fix memory leak where variable oob_enable can go out of scope leaking
the storage it points to.

Coverity issue: 337674
Fixes: 95f648ff9e ("examples/vm_power: make branch ratio threshold per core")

Signed-off-by: Rory Sexton <rory.sexton@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
2020-10-30 13:16:09 +01:00
Cristian Dumitrescu
570e681079 examples/ip_pipeline: fix external build
Fix build with external makefile.

Fixes: fbc74e6633 ("examples/ip_pipeline: remove infra code")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-29 17:32:51 +01:00
Cristian Dumitrescu
275ebefea7 examples/pipeline: fix resource leak
Coverity issue: 363041
Fixes: 5074e1d551 ("examples/pipeline: add configuration commands")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-29 17:32:51 +01:00
Xiaoyun Li
079981e980 examples/tep_term: remove this application
This example sets up a scenario that VXLAN packets can be received
by different PF queues based on VNID and each queue is bound to a VM
with a VNID so that the VM can receive its inner packets.

Usually, OVS is used to do the software encap/decap for VXLAN packets.

And the VXLAN packets offloading can be replaced with flow rules in
testpmd like Chapter "Sample VXLAN flow rules" in Testpmd Application
User Guide.

And this example hasn't been used for a long time.

So deprecate this example.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-10-29 12:37:51 +01:00
Yogesh Jangra
7fef9ef11f examples/pipeline: fix help command
This patch has the changes to list all supported commands and fix
supported commands help details.

Fixes: 5074e1d551 ("examples/pipeline: add configuration commands")

Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-23 13:40:32 +02:00
Ibtisam Tariq
4054466be9 examples/ipsec-secgw: use POSIX network address conversion
inet_pton4 and inet_pton6 was reimplemented. Replace implementation of
inet_pton4 and inet_pton6 with libc inet_pton function

Bugzilla ID: 365
Fixes: 0d547ed037 ("examples/ipsec-secgw: support configuration file")

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-10-23 11:02:13 +02:00
Ibtisam Tariq
03ef8c1b6b examples/ip_pipeline: use POSIX network address conversion
inet_pton4 and inet_pton6 was reimplemented. Replacing implementation of
inet_pton4 and inet_pton6 with libc inet_pton function

Bugzilla ID: 365
Fixes: ed7a0490f7 ("examples/ip_pipeline: add string parsing helpers")

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-10-23 11:01:51 +02:00
Stephen Hemminger
cb056611a8 eal: rename lcore master and slave
Replace master lcore with main lcore and
replace slave lcore with worker lcore.

Keep the old functions and macros but mark them as deprecated
for this release.

The "--master-lcore" command line option is also deprecated
and any usage will print a warning and use "--main-lcore"
as replacement.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2020-10-20 13:17:08 +02:00
Bruce Richardson
a8d0d473a0 build: replace use of old build macros
Use the newer macros defined by meson in all DPDK source code, to ensure
there are no errors when the old non-standard macros are removed.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Rosen Xu <rosen.xu@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2020-10-19 22:15:44 +02:00
Bruce Richardson
a20b2c01a7 build: standardize component names and defines
As discussed on the dpdk-dev mailing list[1], we can make some easy
improvements in standardizing the naming of the various components in DPDK,
and their associated feature-enabled macros.

Following this patch, each library will have the name in format,
'librte_<name>.so', and the macro indicating that library is enabled in the
build will have the form 'RTE_LIB_<NAME>'.

Similarly, for libraries, the equivalent name formats and macros are:
'librte_<class>_<name>.so' and 'RTE_<CLASS>_<NAME>', where class is the
device type taken from the relevant driver subdirectory name, i.e. 'net',
'crypto' etc.

To avoid too many changes at once for end applications, the old macro names
will still be provided in the build in this release, but will be removed
subsequently.

[1] http://inbox.dpdk.org/dev/ef7c1a87-79ab-e405-4202-39b7ad6b0c71@solarflare.com/t/#u

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Rosen Xu <rosen.xu@intel.com>
2020-10-19 22:15:34 +02:00
Bruce Richardson
52e2991eab examples/l2fwd-crypto: fix missing dependency
When the crypto-scheduler support is enabled, we were missing the
dependency on it as part of the meson build.

Fixes: 89f0711f9d ("examples: build some samples with meson")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2020-10-19 22:12:23 +02:00
Akhil Goyal
e30b2833c4 security: update session create API
The API ``rte_security_session_create`` takes only single
mempool for session and session private data. So the
application need to create mempool for twice the number of
sessions needed and will also lead to wastage of memory as
session private data need more memory compared to session.
Hence the API is modified to take two mempool pointers
- one for session and one for private data.
This is very similar to crypto based session create APIs.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2020-10-19 09:54:54 +02:00
Cristian Dumitrescu
03665a4893 examples/pipeline: fix resource release in table update
Fix the resource release sequence in table update.

Coverity issue: 362882, 363041, 363044, 363047
Fixes: 5074e1d551 ("examples/pipeline: add configuration commands")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2020-10-19 09:20:25 +02:00
Konstantin Ananyev
5636d60347 examples/l3fwd-acl: select ACL classify method
Replace '--scalar' command-line option with new one: --alg=<algname>
to allow user explicitly select desired classify method.
This is an optional parameter, if not specified default classify
algorithm will be used.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2020-10-19 09:20:25 +02:00