Commit Graph

1274 Commits

Author SHA1 Message Date
Jasvinder Singh
f6feb39c20 examples/qos_meter: fix color type conversion
In APP_MODE_SRTCM_COLOR_AWARE mode, sample app compilation fails
due to wrong meter color type conversion.

error log-
/qos_meter/main.c:error: conversion to incomplete type
(enum rte_meter_color) input_color);

Fixes: c1656328db ("meter: replace color definitions")
Cc: stable@dpdk.org

Reported-by: Yuan Peng <yuan.peng@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2019-08-11 00:07:31 +02:00
Jasvinder Singh
4aae2d28ef examples/ip_pipeline: fix TC oversubscription weight
The sched library checks the subport tc ov weight value regardless
of whether RTE_SCHED_SUBPORT_TC_OV flag is enabled or not.

This fix allows application to always set valid tc ov weight value.

error log
SCHED: pipe_profile_check: Incorrect value for tc ov weight
SCHED: rte_sched_port_check_params: Pipe profile check failed(-22)
Command "tmgr" failed.

Fixes: 25961ff3bc ("examples/ip_pipeline: add traffic manager object")
Cc: stable@dpdk.org

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2019-08-06 15:22:48 +02:00
Konstantin Ananyev
9a710863de examples/bpf: fix build
Example BPF programs t2.c, t3.c in folder examples/bpf are
failing to compile with latest dpdk.org master.
The reason is changes in some core DPDK header files, that causes
now inclusion of x86 specific headers.
To overcome the issue, minimize inclusion of DPDK header files
into BPF source code.

Bugzilla ID: 321

Fixes: 9dfc06c26a ("test/bpf: add samples")
Cc: stable@dpdk.org

Reported-by: Michel Machado <michel@digirati.com.br>
Suggested-by: Michel Machado <michel@digirati.com.br>
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-08-06 12:30:11 +02:00
Xiaoyun Li
440af660ff examples/ntb: fix error handling
This patch adds return value checking for fseek function to fix
error handling issue found by coverity scan.

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

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
2019-08-06 10:40:54 +02:00
Stephen Hemminger
6f3f0acd95 remove extra blank lines at end of files
There should not be blank lines at end of files.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2019-08-05 15:19:32 +02:00
Hariprasad Govindharajan
d7f936190e examples/l3fwd: fix unaligned memory access on x86
Fix unaligned memory access when reading IPv6 header which
leads to segmentation fault by changing aligned memory read
to unaligned memory read.

Bugzilla ID: 279
Fixes: 64d3955de1 ("examples/l3fwd: fix ARM build")
Cc: stable@dpdk.org

Signed-off-by: Hariprasad Govindharajan <hariprasad.govindharajan@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
Reviewed-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
Tested-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
2019-07-30 22:05:00 +02:00
Harman Kalra
6f327ba1a3 examples/rxtx_callbacks: fix HW timestamp config
Since all PMDs doesn't implement per queue offload capabilities but
supports RX timestamping and also since rx_offload_capa includes all
rx_queue_offload_capa's. Hence moving the logic to enable HW timestamp
via DEV_RX_OFFLOAD_TIMESTAMP flag before device configuration so that
this application can work with all PMDs.

Fixes: cd1dadeb9b ("examples/rxtx_callbacks: support HW timestamp")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2019-07-30 11:21:49 +02:00
Jasvinder Singh
7f394eebbb examples/qos_sched: add more TC to red configuration
Add RED configuration to more traffic classes in app configuration
files.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2019-07-30 10:19:08 +02:00
Harman Kalra
376aa383e7 examples/ptpclient: fix delay request message
Observed an issue with the length and domain number of the
delay request message sent out by the client. Due to which delay
response from master was not received.

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

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2019-07-30 00:11:42 +02:00
Sunil Kumar Kori
ed553e3db4 examples/ip_frag: remove Tx fast free offload flag
Application uses different pool to allocate direct and indirect
mbufs which are further spliced together to consturct a fragmented
packet and same is transmitted over the port which is configured
with DEV_TX_OFFLOAD_MBUF_FAST_FREE enabled i.e. all segments
must belong to the same pool. But constructed packet violates
the conditions.

So fixing DEV_TX_OFFLOAD_MBUF_FAST_FREE flag during device
configuration.

Fixes: fdb9eff67f ("examples/ip_fragmentation: convert to new offloads API")
Cc: stable@dpdk.org

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-29 23:47:29 +02:00
Xiaolong Ye
abd5ed65ea examples/qos_sched: replace license text with SPDX tag
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2019-07-29 13:31:45 +02:00
Marcin Zapolski
f0f96b472c examples/ip_frag: fix stale content of ethdev info
The eth_dev_info was used with content that was obsolete. Added update
of struct content prior to use.

Fixes: 6b7780bfeb ("examples/ip_frag: fix use of ethdev internal device array")
Cc: stable@dpdk.org

Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-22 19:10:31 +02:00
Jasvinder Singh
be1e533238 examples/qos_sched: add TC and queue config flexibility
Update qos sched sample app for configuration flexibility of
pipe traffic classes and queues.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Abraham Tovar <abrahamx.tovar@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
2019-07-22 15:43:10 +02:00
Jasvinder Singh
3f2eaa4ce9 examples/ip_pipeline: add config flexibility to TM
Update ip pipeline sample app for configuration flexiblity of
pipe traffic classes and queues.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Abraham Tovar <abrahamx.tovar@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
2019-07-22 15:42:59 +02:00
Jasvinder Singh
e16b06da09 sched: remove WRR from strict priority TC queues
All higher priority traffic classes contain only one queue, thus
remove wrr function for them. The lowest priority best-effort
traffic class conitnue to have multiple queues and packet are
scheduled from its queues using wrr function.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Abraham Tovar <abrahamx.tovar@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
2019-07-22 15:16:25 +02:00
Bernard Iremonger
f0529ed29c examples/ipsec-secgw: fix inline test scripts
Remove workaround in tun_aesgcm_defs.sh and trs_aesgcm_defs.sh
to get around the bug where the first inbound packet is dropped
for inline crypto.

Fixes: 9297844520 ("examples/ipsec-secgw: add scripts for functional test")
Cc: stable@dpdk.org

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-19 14:32:58 +02:00
Bernard Iremonger
3a690d5a65 examples/ipsec-secgw: fix first packet with inline crypto
Inline crypto installs a flow rule in the NIC. This flow
rule must be installed before the first inbound packet is
received.

The create_session() function installs the flow rule,
create_session() has been refactored into create_inline_session()
and create_lookaside_session(). The create_inline_session() function
uses the socket_ctx data and is now called at initialisation in
sa_add_rules().

The max_session_size() function has been added to calculate memory
requirements.

The cryprodev_init() function has been refactored to drop calls to
rte_mempool_create() and to drop calculation of memory requirements.

The main() function has been refactored to call max_session_size() and
to call session_pool_init() and session_priv_pool_init() earlier.
The ports are started now before adding a flow rule in main().
The sa_init(), sp4_init(), sp6_init() and rt_init() functions are
now called after the ports have been started.

The rte_ipsec_session_prepare() function is called in fill_ipsec_session()
for inline which is called from the ipsec_sa_init() function.

Fixes: ec17993a14 ("examples/ipsec-secgw: support security offload")
Fixes: d299106e8e ("examples/ipsec-secgw: add IPsec sample application")
Cc: stable@dpdk.org

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2019-07-19 14:32:46 +02:00
Tao Zhu
37a29f0039 examples/ipsec-secgw: fix --mtu option parsing
This patch add parameter --mtu parse key and enumeration value.

Fixes: b01d1cd213 ("examples/ipsec-secgw: support fragmentation and reassembly")

Signed-off-by: Tao Zhu <taox.zhu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-19 14:15:21 +02:00
Fan Zhang
186b14d685 cryptodev: make xform key pointer constant
This patch changes the key pointer data types in cipher, auth,
and aead xforms from "uint8_t *" to "const uint8_t *" for a
more intuitive and safe sessionn creation.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Liron Himi <lironh@marvell.com>
2019-07-19 14:15:21 +02:00
Erik Gabriel Carrillo
b58b3c9675 examples/performance-thread: init timer subsystem
The timer subsystem should be initialized in the l3fwd-thread app before
the L-thread subsystem can be used.

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

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
2019-07-18 23:20:14 +02:00
Haiyue Wang
faa4ee7536 examples/tep_term: remove duplicate definitions
The state of virtio device has been defined in both header file and
source file, keep the definition in header file for public use.

Fixes: a50245ede7 ("examples/tep_term: initialize VXLAN sample")
Cc: stable@dpdk.org

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
2019-07-18 23:10:19 +02:00
Konstantin Ananyev
826038fcfc examples/ip_frag: fix unknown ethernet type
Right now app blindly set IPv4 ether type for all non IPv6 packets.
Instead we can save and later restore original type value.

Fixes: 74de12b7b6 ("examples/ip_fragmentation: overhaul")
Cc: stable@dpdk.org

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-18 23:07:17 +02:00
Konstantin Ananyev
b869cbc955 examples/ip_frag: fix Tx un-fragmented packets
With latest changes l3fwd_simple_forward() blindly set
(PKT_TX_IPV4 | PKT_TX_IP_CKSUM) ol_flags for all IPv4 packets.
Though for un-fragmented packets we also do have to set l3_len
to make HW IP cksum offload to work properly.
That causes HW/PMD to drop or generate invalid packets.
Though for un-fragmented packets we don't need to regenerate
IPv4 cksum, as L3 header is not modified.
Fix by setting ol_flags only when required.

Fixes: 16863bbb4a ("examples/ip_fragmentation: enable IP checksum offload")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-18 23:05:36 +02:00
Marcin Zapolski
6b7780bfeb examples/ip_frag: fix use of ethdev internal device array
Modify ip_fragmentation example app to use rte_eth_info_get instead
of global rte_eth_devices structure.
Apps should not be using internal DPDK data structures directly.

Fixes: 9758b956dc ("examples/ip_fragmentation: fix Tx queues init")
Cc: stable@dpdk.org

Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2019-07-18 23:05:13 +02:00
Marcin Zapolski
0109baf196 examples/ipsec-secgw: fix use of ethdev internal struct
Modify ipsec-secgw example app to use rte_eth_dev_info_get instead of
rte_eth_dev.
Apps should not be using internal DPDK data structures directly.

Fixes: a4677f7836 ("examples/ipsec-secgw: add target queues in flow actions")
Cc: stable@dpdk.org

Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2019-07-18 23:05:13 +02:00
Marcin Zapolski
5c5c1f99a9 examples: fix use of ethdev internal device array
Modify l3fwd and related example apps to use locally defined port_conf
instead of global rte_eth_devices which is not a part of public API.
Apps should not be using internal DPDK data structures directly.

Fixes: 1ef9600b2d ("examples/l3fwd: convert to ethdev offloads API")
Fixes: ba8c103d24 ("examples/l3fwd-acl: convert to new ethdev offloads API")
Fixes: 40df1d7a69 ("examples/l3fwd-power: convert to new ethdev offloads API")
Fixes: 43fc038262 ("examples/l3fwd-vf: convert to new ethdev offloads API")
Fixes: 373149c631 ("examples/performance-thread: convert to new offloads API")
Cc: stable@dpdk.org

Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
2019-07-18 22:32:45 +02:00
David Hunt
abeef65dfd examples/power: fix policy handling for FIFO
While the core frequency scale-up and scale down all works fine with the
fifo-per-core functionality, there was a gap for policy handling. When
creating or destroying a policy, the core associated with the FIFO
needs to be automatically added to the core list, so the policy is
associated with the correct core.

Fixes: 221e7026d5 ("examples/power: add FIFO per core for JSON interface")

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2019-07-17 22:53:38 +02:00
David Hunt
b55d8fec46 examples/l3fwd-power: fix busyness number
Current implementation only outputs 3 numbers for busyness, 0, 50 and 100.
Fix this so that the 50% is replaced by a curve, more meaningful.
This can be replaced in each use case by a suitable calculation for
that use case.

Fixes: 609e79841f ("examples/l3fwd-power: add telemetry mode")

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2019-07-17 22:53:28 +02:00
David Hunt
135393d456 examples/power: fix strcpy buffer overrun
replace strcpy with strlcpy to prevent buffer overrun
With fix, attempting to use a VERY lonng vm name results in a nicely
truncated 32 character name rather than a segfault:
Setting VM Name to [sdfdsfsfsdffdsdsasdsadasdakjshd]

Using strlcpy rather than rte_strlcpy, as the rte_ version is only a
fallback.

As well as the fix in main.c, this patch also changes an occurrence of
rte_strlcpy in channel_manager.c and channel_monitor.c to strlcpy.

Fixes: 59287933a0 ("examples/vm_power: add options to guest app")
Cc: stable@dpdk.org

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2019-07-16 13:30:58 +02:00
David Hunt
16015fd65a examples/power: fix FreeBSD meson lib dependency
Samples apps that depend on the power library should not build if
the power library is not present. So now the following apps will
check to see if it's built, else skip building.
* l3fwd-pwer
* vm_power_manager
* guest_cli

Fixes: e013078857 ("examples/power: support meson/ninja build")
Fixes: 89f0711f9d ("examples: build some samples with meson")
Cc: stable@dpdk.org

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2019-07-12 10:26:55 +01:00
David Hunt
018faf21d6 examples/l3fwd-power: fix metrics divisions
6 issues caught by Coverity 343465
* Possible divide by zero on 3 lines
* Convert to float then back to int, losing precision on 3 lines

This patch modifies the code so that it only assigns calculated
values if the divisor is > 0, otherwise sets metrics to zero.
Also removes the un-needed round() function.

Coverity issue: 343465
Fixes: 609e79841f ("examples/l3fwd-power: add telemetry mode")

Signed-off-by: David Hunt <david.hunt@intel.com>
2019-07-11 00:00:46 +02:00
Marcin Hajkowski
221e7026d5 examples/power: add FIFO per core for JSON interface
This patch implements a separate FIFO for each cpu core to improve the
previous functionality where anyone with access to the FIFO could affect
any core on the system. By using appropriate permissions, FIFO interfaces
can be configured to only affect the particular cores.

Because each FIFO is per core, the following fields have been removed
from the command JSON format: core_list, resource_id, name.

Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Signed-off-by: Lukasz Gosiewski <lukaszx.gosiewski@intel.com>
Signed-off-by: Marcin Hajkowski <marcinx.hajkowski@intel.com>
Tested-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2019-07-10 23:55:07 +02:00
Dilshod Urazov
4fbf332431 examples/ipsec-secgw: fix error sign
rte_errno values should be positive.

Fixes: d299106e8e ("examples/ipsec-secgw: add IPsec sample application")
Cc: stable@dpdk.org

Signed-off-by: Dilshod Urazov <dilshod.urazov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2019-07-08 12:35:55 +02:00
Phil Yang
016493307a examples/packet_ordering: add stats per worker thread
The current implementation using the '__sync' built-ins to synchronize
statistics within worker threads. The '__sync' built-ins functions are
full barriers which will affect the performance, so add a per worker
packets statistics to remove the synchronisation between worker threads.

Since the maximum core number can get to 256, so disable the per core
stats print in default and add the --insight-worker option to enable it.

For example:
sudo examples/packet_ordering/arm64-armv8a-linuxapp-gcc/packet_ordering \
-l 112-115 --socket-mem=1024,1024 -n 4 -- -p 0x03 --insight-worker

RX thread stats:
 - Pkts rxd:                            226539223
 - Pkts enqd to workers ring:           226539223

Worker thread stats on core [113]:
 - Pkts deqd from workers ring:         77557888
 - Pkts enqd to tx ring:                77557888
 - Pkts enq to tx failed:               0

Worker thread stats on core [114]:
 - Pkts deqd from workers ring:         148981335
 - Pkts enqd to tx ring:                148981335
 - Pkts enq to tx failed:               0

Worker thread stats:
 - Pkts deqd from workers ring:         226539223
 - Pkts enqd to tx ring:                226539223
 - Pkts enq to tx failed:               0

TX stats:
 - Pkts deqd from tx ring:              226539223
 - Ro Pkts transmitted:                 226539168
 - Ro Pkts tx failed:                   0
 - Pkts transmitted w/o reorder:        0
 - Pkts tx failed w/o reorder:          0

Suggested-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
2019-07-08 16:33:06 +02:00
Sunil Kumar Kori
31c787678c examples/ip_reassembly: enable IP checksum offload
As per the documentation to use any IP offload features, application
must set required offload flags into mbuf->ol_flags.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-08 11:04:01 +02:00
Sunil Kumar Kori
16863bbb4a examples/ip_fragmentation: enable IP checksum offload
As per the documentation to use any IP offload features, application
must set required offload flags into mbuf->ol_flags.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-08 11:04:01 +02:00
Fan Zhang
1cfd1559b2 examples/ipsec-secgw: support header reconstruction
This patch updates the ipsec-secgw application to support
header reconstruction. In addition a series of tests have
been added to prove the implementation's correctness.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-05 15:28:14 +02:00
Konstantin Ananyev
ba3f160318 examples/ipsec-secgw: add bypass test case
Add simple test-case with all traffic in BYPASS mode.
Useful for some basic test of your network environment.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-05 15:28:14 +02:00
Konstantin Ananyev
d06fe6ea67 examples/ipsec-secgw: add multi-segment test cases
Enhance test scripts to support fragmentation/reassemble functionality.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-05 15:28:14 +02:00
Konstantin Ananyev
b01d1cd213 examples/ipsec-secgw: support fragmentation and reassembly
Add optional ability to fragment packet bigger then mtu,
and reassemble fragmented packet.
To minimize possible performance effect, reassembly is
implemented as RX callback.
To support these features ipsec-secgw relies on librte_ipsec ability
to handle multi-segment packets.
Also when reassemble/fragmentation support is enabled, attached
crypto devices have to support 'In Place SGL' offload capability.
To enable/disable this functionality, two new optional command-line
options are introduced:
  --reassemble <val> - number of entries in reassemble table
  --mtu <val> - MTU value for all attached ports
As separate '--mtu' option is introduced, '-j <val>' option is now used
to specify mbuf data buffer size only.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2019-07-05 15:28:14 +02:00
Konstantin Ananyev
a135e050ad examples/ipsec-secgw: fix packet length
for packets smaller then 64B some NICs reports pkt_len=64B.
As ipsec-secgw (and librte_ipsec) relies on pkt_len value to determine
payload length, that causes problems for small packets.
To fix the issue, check that pkt_len matches values in IPv4/IPv6 header
and re-adjust pkt_len if necessary.

Fixes: 906257e965 ("examples/ipsec-secgw: support IPv6")
Fixes: d299106e8e ("examples/ipsec-secgw: add IPsec sample application")
Cc: stable@dpdk.org

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2019-07-05 15:28:14 +02:00
Mariusz Drost
b1a3ac782d examples/ipsec-secgw: fix inline modes
Application ipsec-secgw is not working for IPv4 transport mode and for
IPv6 both transport and tunnel mode.

IPv6 tunnel mode is not working due to wrongly assigned fields of
security association patterns, as it was IPv4, during creation of
inline crypto session.

IPv6 and IPv4 transport mode is iterating through security capabilities
until it reaches tunnel, which causes session to be created as tunnel,
instead of transport. Another issue, is that config file does not
provide source and destination ip addresses for transport mode, which
are required by NIC to perform inline crypto. It uses default addresses
stored in security association (all zeroes), which causes dropped
packages.

To fix that, reorganization of code in create_session() is needed,
to behave appropriately to given protocol (IPv6/IPv4). Change in
iteration through security capabilities is also required, to check
for expected mode (not only tunnel).

For lack of addresses issue, some resolving mechanism is needed.
Approach is to store addresses in security association, as it is
for tunnel mode. Difference is that they are obtained from sp rules,
instead of config file. To do that, sp[4/6]_spi_present() function
is used to find addresses based on spi value, and then stored in
corresponding sa rule. This approach assumes, that every sp rule
for inline crypto have valid addresses, as well as range of addresses
is not supported.

New flags for ipsec_sa structure are required to distinguish between
IPv4 and IPv6 transport modes. Because of that, there is need to
change all checks done on these flags, so they work as expected.

Fixes: ec17993a14 ("examples/ipsec-secgw: support security offload")
Fixes: 9a0752f498 ("net/ixgbe: enable inline IPsec")
Cc: stable@dpdk.org

Signed-off-by: Mariusz Drost <mariuszx.drost@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-05 15:28:14 +02:00
Marcin Smoczynski
9a18283a54 examples/ipsec-secgw: add scapy based tests
Add new unittest-like mechanism which uses scapy to craft custom
packets and a set of assertions to check how ipsec-secgw example
application is processing them. Python3 with scapy module is
required by pkttest.sh to run test scripts.

A new mechanism is used to test IPv6 transport mode traffic with
header extensions (trs_ipv6opts.py).

Fix incomplete test log problem by disabling buffering of ipsec-secgw
standard output with stdbuf application.

Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-05 15:28:14 +02:00
Marcin Smoczynski
1e05895e35 examples/ipsec-secgw: support IPv6 options
Using transport with IPv6 and header extensions requires calculating
total header length including extensions up to ESP header which is
achieved with iteratively parsing extensions when preparing traffic
for processing. Calculated l3_len is later used to determine SPI
field offset for an inbound traffic and to reconstruct L3 header by
librte_ipsec.

Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2019-07-05 15:28:14 +02:00
Anoob Joseph
c9030ae382 cryptodev: add feature flags to disable
Adding a new field, ff_disable, to allow applications to control the
features enabled on the crypto device. This would allow for efficient
usage of HW/SW offloads.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2019-07-05 15:03:25 +02:00
Fan Zhang
6da6a83ee0 examples/fips_validation: fix logically dead code
Coverity issue: 336866, 336841, 336838
Fixes: 41d561cbdd ("examples/fips_validation: add power on self test")
Cc: stable@dpdk.org

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
2019-07-05 14:52:25 +02:00
Xiaoyun Li
c5eebf85ba examples/ntb: add example for NTB
Enable an example for rawdev ntb. Support interactive mode to send
file on one host and receive file from another host. The command line
would be 'send [filepath]' and 'receive [filepath]'.

But since the FIFO is not enabled right now, use rte_memcpy as the enqueue
and dequeue functions and only support transmitting file no more than 4M.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
2019-07-05 12:50:19 +02:00
Lukasz Krakowiak
60dea75f90 examples/power: remove double copy of FIFO path
Removed doubled created fifo path string for channel info.

Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Signed-off-by: Lukasz Gosiewski <lukaszx.gosiewski@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
2019-07-04 22:42:45 +02:00
Bruce Richardson
4131ad5db7 examples: fix pkg-config detection with older make
Make versions before 4.2 did not have support for the .SHELLSTATUS
variable, so use another method to detect shell success.

Fixes: 22119c4591 ("examples: use pkg-config in makefiles")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-07-03 23:10:23 +02:00
Bruce Richardson
291d090364 examples/vhost_crypto: support build with pkg-config
The vhost_crypto example app did not check for a libdpdk pkg-config file
and attempt to build using that. Add support for that method of compile to
align the app with the other examples.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-07-02 18:12:13 +02:00