Commit Graph

927 Commits

Author SHA1 Message Date
Raslan Darawsheh
f16d377150 app/testpmd: add parsing for QinQ VLAN headers
When having QinQ VLAN headers in the packet, parse_ethernet
is capable of parsing only the first VLAN.

Add parsing for QinQ VLAN headers in the packet.

Fixes: 51f694dd40 ("app/testpmd: rework checksum forward engine")
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2020-04-25 23:09:29 +02:00
Thomas Monjalon
a658775c57 app: fix usage help of options separated by dashes
The EAL options and app-specific options are separated
with double dashes.

The help of testpmd, test-acl and pdump were missing
the dashes after EAL options.
Note: testpmd was completely missing the EAL options.

Fixes: af75078fec ("first public release")
Fixes: 26c057ab6c ("acl: new test-acl application")
Fixes: b2854d5317 ("app/pdump: support multi-core capture")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-04-25 21:56:18 +02:00
Luca Boccassi
611faa5f46 fix various typos found by Lintian
Cc: stable@dpdk.org

Signed-off-by: Luca Boccassi <bluca@debian.org>
2020-04-25 19:53:47 +02:00
Lijun Ou
99e040d3ad app/testpmd: remove hardcoded descriptors limit
When users configure rxds and txds by used port config cmd based
on testpmd application, it will not be able to configure rxd and
txd according to the max capability range supported by the actual
NIC hardware. Due testpmd defects, it can only configure a fixed
range to 0 to 2048.
The final result is that an incorrect printing prompt appears and
cannot be applied using rxd && txd according to the actual
capabilities supported by the device.
In order to solve the above problems, we modify the testpmd. First
by calling the rte_eth_dev_info_get api to obtain the max and min
rx/tx capability supported by the hns3, and then use this range
to compare with the actual value by users configured and make
reasonable limitation.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2020-04-21 19:23:56 +02:00
Jeff Guo
a8a544890f app/testpmd: add new types to RSS hash commands
Add some new types, such as eth/l2-src-only/l2-dst-only/svlan/cvlan/
l2tpv3/esp/ah/pfcp types into RSS hash commands, it could be used
to configure these rss input set by cmdline.

Example flow commands was:
testpmd>flow create 0 ingress pattern eth / ipv4 / l2tpv3oip / end \
	actions rss types l2tpv3 end key_len 0 queues end / end

port config commands was:
testpmd>port config all rss l2tpv3

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2020-04-21 18:03:26 +02:00
Dong Zhou
44bf3c796b ethdev: support flow aging
One of the reasons to destroy a flow is the fact that no packet matches
the flow for "timeout" time.
For example, when TCP\UDP sessions are suddenly closed.

Currently, there is not any DPDK mechanism for flow aging and the
applications use their own ways to detect and destroy aged-out flows.

The flow aging implementation need include:
- A new rte_flow action: RTE_FLOW_ACTION_TYPE_AGE to set the timeout and
  the application flow context for each flow.
- A new ethdev event: RTE_ETH_EVENT_FLOW_AGED for the driver to report
  that there are new aged-out flows.
- A new rte_flow API: rte_flow_get_aged_flows to get the aged-out flows
  contexts from the port.
- Support input flow aging command line in Testpmd.

The new event type addition in the enum is flagged as an ABI breakage,
so an ignore rule is added for these reasons:
- It is not changing value of existing types (except MAX)
- The new value is not used by existing API if the event is not
  registered
In general, it is safe adding new ethdev event types at the end of the
enum, because of event callback registration mechanism.

Signed-off-by: Dong Zhou <dongz@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Matan Azrad <matan@mellanox.com>
2020-04-21 17:34:05 +02:00
Bernard Iremonger
d3bd79713b app/testpmd: handle RSS offload types ESP and AH
Parse RSS offload types ESP and AH add printf for rss_hf

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
2020-04-21 13:57:08 +02:00
Xiao Zhang
c3ea098ae3 app/testpmd: fix PPPoE flow command
The command line to create RTE flow for specific proto_id of PPPOES can
not work.

It was:
testpmd> flow create 0 ingress pattern proto_id
 proto_id [TOKEN]: match PPPoE session protocol identifier
testpmd> flow create 0 ingress pattern proto_id proto_id
 proto_id [TOKEN]: match PPPoE session protocol identifier
testpmd> flow create 0 ingress pattern proto_id proto_id proto_id
 proto_id [TOKEN]: match PPPoE session protocol identifier

The proto_id can not be set with previous implementation.

This patch is to fix this issue, and change the command line to:
testpmd> flow create 0 pattern pppoe_proto_id is xxxx

Fixes: 226c6e60c3 ("ethdev: add PPPoE to flow API")
Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
2020-04-21 13:57:07 +02:00
Xueming Li
9b1249d9ff app/testpmd: support dumping socket memory
Introduce new command to dump memory statistics of each socket,
summary, also show changes since last call.

Usage:
    dump_socket_mem

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-04-21 13:57:06 +02:00
Dekel Peled
2fdf502242 app/testpmd: enhance GTP support
This patch adds CLI option to enter the v_pt_rsv_flags value for GTP
flow pattern item.
It also adds GTP as valid item in raw_encap and raw_decap setting.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
2020-04-21 13:57:06 +02:00
Muhammad Ahmad
476ec8e278 app/testpmd: add FW version in port info
rte_eth_dev_fw_version_get() was not called in test PMD.
Added rte_eth_dev_fw_version_get() in testpmd under
"show port info <port no>"

Bugzilla ID: 225

Reported-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Muhammad Ahmad <muhammad.ahmad@emumba.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-04-21 13:57:04 +02:00
Thomas Monjalon
f2fc83b40f replace unused attributes
There is a common macro __rte_unused, avoiding warnings,
which is now used where appropriate for consistency.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2020-04-16 18:30:58 +02:00
Thomas Monjalon
ef5baf3486 replace packed attributes
There is a common macro __rte_packed for packing structs,
which is now used where appropriate for consistency.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2020-04-16 18:16:46 +02:00
Pavan Nikhilesh
acec04c4b2 build: disable experimental API check internally
Remove setting ALLOW_EXPERIMENTAL_API individually for each Makefile and
meson.build. Instead, enable ALLOW_EXPERIMENTAL_API flag across app, lib
and drivers.
This changes reduces the clutter across the project while still
maintaining the functionality of ALLOW_EXPERIMENTAL_API i.e. warning
external applications about experimental API usage.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
2020-04-14 16:22:34 +02:00
Xiao Zhang
ecbc857013 ethdev: add PFCP header to flow API
This patch adds the new flow item RTE_FLOW_ITEM_TYPE_PFCP to flow API to
match a PFCP header.
Add sample PFCP rules for testpmd guide. Since Session Endpoint
Identifier (SEID) only will be present in PFCP Session header and PFCP
Session headers shall be identified when the S field is equal to 1, when
create rules for PFCP Session header with certain SEID the S field need
be set 1.

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
2020-03-18 10:21:42 +01:00
Xiao Zhang
573ef95dc7 app/testpmd: parse flow command line for AH
Add AH and AH SPI to testpmd rte flow command line.
Add note and sample AH rules in testpmd guide.

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
2020-03-18 10:21:41 +01:00
Hariprasad Govindharajan
7eeda4d55a app/testpmd: fix return of port list parser
The function parse_port_list() is designed to return
unsigned int value. After sanitizing the inputs,
it is returning -1. Changed it to return 0.

Fixes: 2df00d562d ("app/testpmd: add --portlist option")

Signed-off-by: Hariprasad Govindharajan <hariprasad.govindharajan@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-02-21 11:41:21 +01:00
Wisam Jaddo
f1cfa5687f app/testpmd: fix identifier size for port attach
Identifier for new port may contain white list options,
and white list options will not fit into 128 from STR_TOKEN_SIZE,
instead having 4096 char from STR_MULTI_TOKEN_SIZE will provide
better and more options

Fixes: edab33b1c0 ("app/testpmd: support port hotplug")
Cc: stable@dpdk.org

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2020-02-21 11:41:20 +01:00
Ferruh Yigit
5e4154cec4 app/testpmd: guarantee port array access in range
Coverity complains about out of bound access, which is a false positive.

The return value of the 'parse_port_list()' can't be bigger than
'maxsize' because of the logic in the function. ('value >= (int)maxsize'
check and 'marked[]' usage.)

But this is not explicitly clear, causing coverity warning and same
question can be rise by reviews later.

Adding a redundant check to highlight the access is in range, this is
done by replacing existing redundant check.

This is also good to protect against out out bound access in case
'parse_port_list()' behaviour changes later unexpectedly.

Coverity issue: 354229
Fixes: 2df00d562d ("app/testpmd: add --portlist option")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2020-02-19 15:40:24 +01:00
Wei Hu (Xavier)
150c9ac2df app/testpmd: update Rx offload after setting MTU
Currently, Rx offload capabilities and max_rx_pkt_len in the struct
variable named rte_port are not updated after setting mtu successfully
in port_mtu_set function by 'port config mtu <port_id> <value>' command.
This may lead to reconfig mtu to the initial value in the driver when
recalling rte_eth_dev_configure API interface.

This patch updates Rx offload capabilities and max_rx_pkt_len after
setting mtu successfully when configuring mtu.

Fixes: ae03d0d18a ("app/testpmd: command to configure MTU")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-02-14 12:42:13 +01:00
Thomas Monjalon
0654d4a8ad app/testpmd: fix hot-unplug detaching
There is a possible race condition in the hotplug path
in rmv_port_callback(). If a port is created between
close_port(port_id) and detach_port_device(port_id),
then the port_id will have been reallocated to a different
device which will be wrongly detached.

Since a check was added in detach_port_device() for
manual detach case, the hotplug path was even more broken.
It became impossible to run because the new check prevented
to run detach_port_device() after the port is closed.

The solution for both issues is to not rely on the port_id
for detaching the rte_device.
The function detach_port_device() is split to allow calling
detach_device() directly with the rte_device pointer, saved
before closing the port.

Fixes: 43d0e30498 ("app/testpmd: fix invalid port detaching")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-02-14 12:42:13 +01:00
Thomas Monjalon
5edee5f6da app/testpmd: rename function for detaching by devargs
There is a function detach_port_device() which takes a port_id,
and a function detach_device() which takes a devargs string.
In order to add a third function accepting a rte_device pointer,
the function detach_device() is renamed into detach_devargs().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-02-14 12:42:13 +01:00
Thomas Monjalon
c8743d5f15 app/testpmd: add port check before manual detach
User may try to run "port detach <port_id>"
for an already detached device.
It has been decided to protect from such usage in testpmd,
so a check was added to detach_port_device() in DPDK 19.11.
This check might be removed to allow hotplug path detaching
the device of a closed port.
Whatever will be decided in future, this check is also added
before the call to detach_port_device().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-02-14 12:42:13 +01:00
Hariprasad Govindharajan
2df00d562d app/testpmd: add --portlist option
In current version, we are setting the ports
using portmask. With portmask, we can use only
up to 64 ports. This portlist option enables the user
to use more than 64 ports.
Now we can specify the ports in 2 different ways
 - Using portmask (-p [0x]nnn): mask must be in hex format
 - Using portlist in the following format
 --portlist <p1>[-p2][,p3[-p4],...]

 --portmask 0x2 is same as --portlist 1
 --portmask 0x3 is same as --portlist 0-1

Signed-off-by: Hariprasad Govindharajan <hariprasad.govindharajan@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
2020-02-14 12:42:12 +01:00
Viacheslav Ovsiienko
0eb89ba9f4 app/testpmd: fix txonly flow generation entropy
The testpmd application in txonly forwarding mode has an option
to generate the packet flows by varying the destination IP address.
The patch increments the IP for each packet sent, this improves
the entropy and RSS distribution on the peer receiving size
is getting more uniform.

Fixes: 01b645dcff ("app/testpmd: move txonly prepare in separate function")
Cc: stable@dpdk.org

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-02-14 12:42:12 +01:00
Thomas Monjalon
80139e3549 fix Mellanox copyright and SPDX tag
Mellanox owns Tilera and EZchip, so the copyrights can be converted.
At the same time, the license header is switched to SPDX tag format,
and a typo is fixed in another copyright line.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2020-02-13 18:47:28 +01:00
Thomas Monjalon
43e34a229d build: remove redundant config include
The header file rte_config.h is always included by make or meson.
If required in an exported API header file, it must be included
in the public header file for external applications.
In the internal files, explicit include of rte_config.h is useless,
and can be removed.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@mellanox.com>
Acked-by: David Marchand <david.marchand@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2020-02-11 16:50:59 +01:00
Wei Hu (Xavier)
8a43329728 app/testpmd: fix uninitialized members when setting PFC
Only a part of members in the local structure variable named pfc_conf
are initialized in the function named cmd_priority_flow_ctrl_set_parsed
when typing "set pfc_ctrl..." command, and others are random values.
However, those uninitialized members may cause failure.

This patch adds clearing zero operation before calling the API named
rte_eth_dev_priority_flow_ctrl_set API with pfc_conf as the input
parameter.

Fixes: 9b53e542e9 ("app/testpmd: add priority flow control")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Xuan Li <lixuan47@hisilicon.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-02-05 09:51:21 +01:00
Wei Hu (Xavier)
3b687ec6e1 app/testpmd: fix initial value when setting PFC
Currently, the initial values of the local structure variable named
rx_tx_onoff_2_lfc_mode and rx_tx_onoff_2_pfc_mode are different in the
similar part of these two following functions:
	cmd_link_flow_ctrl_set_parsed
	cmd_priority_flow_ctrl_set_parsed
1) The code snippset in cmd_link_flow_ctrl_set_parsed function:
	static enum rte_eth_fc_mode rx_tx_onoff_2_lfc_mode[2][2] = {
	    {RTE_FC_NONE, RTE_FC_TX_PAUSE}, {RTE_FC_RX_PAUSE, RTE_FC_FULL}
	};

	if (!cmd || cmd == &cmd_link_flow_control_set_rx)
		rx_fc_en = (!strcmp(res->rx_lfc_mode, "on")) ? 1 : 0;
	if (!cmd || cmd == &cmd_link_flow_control_set_tx)
		tx_fc_en = (!strcmp(res->tx_lfc_mode, "on")) ? 1 : 0;

	fc_conf.mode = rx_tx_onoff_2_lfc_mode[rx_fc_en][tx_fc_en];
	<...>
	ret = rte_eth_dev_flow_ctrl_set(res->port_id, &fc_conf);
	<...>
2) The code snippset in cmd_priority_flow_ctrl_set_parsed function:
	static enum rte_eth_fc_mode rx_tx_onoff_2_pfc_mode[2][2] = {
	    {RTE_FC_NONE, RTE_FC_RX_PAUSE}, {RTE_FC_TX_PAUSE, RTE_FC_FULL}
	};

	rx_fc_enable = (!strncmp(res->rx_pfc_mode, "on",2)) ? 1 : 0;
	tx_fc_enable = (!strncmp(res->tx_pfc_mode, "on",2)) ? 1 : 0;
	pfc_conf.fc.mode =
		 rx_tx_onoff_2_pfc_mode[rx_fc_enable][tx_fc_enable];
	<...>
	ret = rte_eth_dev_priority_flow_ctrl_set(res->port_id, &pfc_conf);
	<...>
The initial value of rx_tx_onoff_2_pfc_mode is wrong, it should be the
same as rx_tx_onoff_2_lfc_mode.

Fixes: 9b53e542e9 ("app/testpmd: add priority flow control")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Xuan Li <lixuan47@hisilicon.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-02-05 09:51:21 +01:00
Ori Kam
bd164530ec app/testpmd: fix copy of dynamic flag name
When working with testpmd and setting the dynflag name, we copy the
name given by the cmd to the dynflag name.

The issue is that the size of the dynflag name is smaller then the
string used by testpmd.

This commit solves this issue by checking that the length of the requested
flag name is not too long.

Coverity issue: 353610
Fixes: b57b66a97e ("app/testpmd: support mbuf dynamic flag")

Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2020-02-05 09:51:21 +01:00
Ori Kam
56d5c1eedf app/testpmd: fix uninitialized members of MPLS
Some of the members of the MPLS struct are not initialized.
This commit init the uninitialized members.

Coverity issue: 325735
Fixes: 3e77031be8 ("app/testpmd: add MPLSoGRE encapsulation")
Cc: stable@dpdk.org

Signed-off-by: Ori Kam <orika@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-02-05 09:51:21 +01:00
Stephen Hemminger
8d7c19d9e4 app/testpmd: fix RFC addresses for Tx only
The previous patch to change default IP addresses for tx only
mode got the wrong values (typo).

Fixes: bf5b2126bf ("app/testpmd: add ability to set Tx IP and UDP parameters")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-02-05 09:51:20 +01:00
Pavan Nikhilesh
71bdd8a178 app: use common macro RTE_DIM
Use RTE_DIM macro to calculate array size.

Suggested-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-02-05 14:37:41 +01:00
Viacheslav Ovsiienko
72512e1897 app/testpmd: add mempool with external data buffers
The new mbuf pool type is added to testpmd. To engage the
mbuf pool with externally attached data buffers the parameter
"--mp-alloc=xbuf" should be specified in testpmd command line.

The objective of this patch is just to test whether mbuf pool
with externally attached data buffers works OK. The memory for
data buffers is allocated from DPDK memory, so this is not
"true" external memory from some physical device (this is
supposed the most common use case for such kind of mbuf pool).

The user should be aware that not all drivers support the mbuf
with EXT_ATTACHED_BUF flags set in newly allocated mbuf (many
PMDs just overwrite ol_flags field and flag value is getting
lost).

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2020-01-20 23:37:49 +01:00
Xueming Li
1e8a4e97b0 app/testpmd: add flow dump command
New flow dump CLI to dump device internal representation information
of flows into screen.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
2020-01-17 19:59:19 +01:00
Dekel Peled
47e7ad1b91 app/testpmd: support GTP message type
This patch adds CLI option to enter the msg_type value for GTP
flow pattern item.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
2020-01-17 19:59:19 +01:00
Ori Kam
b57b66a97e app/testpmd: support mbuf dynamic flag
DPDK now supports registration of dynamic flags (dynf) to the mbuf.
dynf can be given any name, and can be used with a supporting PMD or
supporting application.

Due to the generic concept of the dynf, it is impossible and
meaningless, to define register set/get function for each flag.
This commit introduce a generic way to register and set/clear such
flags.

The basic syntax:
port config <port id> dynf <name> <set|clear>

The first step the new flag is registered. Regardless if the action is
set or clear.
There is no way to unregister the flag, after registering it.

The second step, if the action is set then we set the requested flag.
If this is the first flag that is enabled we also register a call back
for the Tx. In this call back we set the flag.
If the action is clear the requested flag is cleared, and if there
are no more flags that are set, the call back is removed.

The reason that the set is only applied in Tx is that in case of Rx
it is assumed that the value comes from the PMD.

If log is enabled the name of the flag, and value will be printed
in the packet info.
In order for the log to work correctly the registration of the flag
must be done before setting verbose.

Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-01-17 19:59:19 +01:00
Bernard Iremonger
eda749cd22 app/testpmd: improve flow command debug
print function name in port_flow_complain()

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2020-01-17 19:59:18 +01:00
Bernard Iremonger
6a42e7ef9d app/testpmd: parse flow command line for ESP
add ITEM_ESP
add ITEM_ESP_SPI
update release notes for testpmd changes
add sample ESP rules in testpmd guide

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
2020-01-17 19:59:18 +01:00
Rory Sexton
65388f4c4c ethdev: add L2TPv3 over IP header to flow API
This patch adds the new flow item RTE_FLOW_ITEM_TYPE_L2TPV3OIP to
flow API to match a L2TPv3 over IP header. This patch supports only
L2TPv3 over IP header format which is different to L2TPv2/L2TPv3
over UDP. The difference in header formats between L2TPv3 over IP
and L2TP over UDP require a separate implementation for each.

Signed-off-by: Rory Sexton <rory.sexton@intel.com>
Signed-off-by: Dariusz Jagus <dariuszx.jagus@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
2020-01-17 19:46:26 +01:00
Dekel Peled
dcd05da0ae app/testpmd: fix GENEVE flow item
Previous patch added support of GENEVE pattern item in flow rule.
Function flow_item_default_mask() was not updated, so using it with
GENEVE item returns null.
Using testpmd command "set raw_decap" or "set raw_encap" with
GENEVE item, without specifying any parameters, results in
segmentation fault.

This patch updates function flow_item_default_mask(),
adding case to handle GENEVE item.

Fixes: 0f4203fe9d ("app/testpmd: support GENEVE pattern item in flow rules")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2020-01-17 19:46:02 +01:00
Suanming Mou
8482ffe4b6 ethdev: add IPv4/IPv6 DSCP rewrite action
For some overlay network, such as VXLAN, the DSCP field in the new outer
IP header after VXLAN decapsulation may need to be updated accordingly.

This commit introduce the DSCP modify action for IPv4 and IPv6.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Ori Kam <orika@mellanox.com>
2020-01-17 19:46:02 +01:00
Stephen Hemminger
5e516c8983 app/testpmd: call cleanup on exit
The rte_eal_cleanup code is not exercised by testpmd which
is the most used DPDK test tool. Add a call at end of program.

This helps exercise free and close paths which can
be checked with tools like valgrind.

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2020-01-17 19:46:01 +01:00
Ciara Power
c11562a121 app/testpmd: fix device mcast list error handling
The multicast set list function now has a return value, which is checked
by the calling functions. A rollback occurs on detection of failure, to
realign local config with the device config.

The error print statement in the function had included the port_id and
mc_addr_nb values in the wrong order, these are now swapped.

Fixes: 8fff667578 ("app/testpmd: new command to add/remove multicast MAC addresses")
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-01-17 19:45:23 +01:00
Kalesh AP
e1d44d0ad6 app/testpmd: show MAC addresses added to a port
Patch adds a runtime function to display the unicast and
multicast MAC addresses added to a port.

Syntax:
	show port (port_id) macs|mcast_macs

Usage:
testpmd> show port 0 macs
Number of MAC address added: 1
  B0:26:28:7F:F5:C1
testpmd>
testpmd> show port 0 mcast_macs
Number of Multicast MAC address added: 0
testpmd>
testpmd> mac_addr add 0 B0:26:28:7F:22:33
testpmd> mac_addr add 0 B0:26:28:7F:22:34
testpmd> show port 0 macs
Number of MAC address added: 3
  B0:26:28:7F:F5:C1
  B0:26:28:7F:22:33
  B0:26:28:7F:22:34
testpmd>
testpmd> mac_addr remove 0 B0:26:28:7F:22:33
testpmd> show port 0 macs
Number of MAC address added: 2
  B0:26:28:7F:F5:C1
  B0:26:28:7F:22:34

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-01-17 19:45:23 +01:00
Pavan Nikhilesh
7392ad06f5 app/testpmd: use better randomness for Tx split
Use rte_rand() instead of random() for better randomness.

Coverity issue: 337666
Fixes: 79bec05b32 ("app/testpmd: add ability to split outgoing packets")
Cc: stable@dpdk.org

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2019-11-26 18:05:15 +01:00
David Marchand
9e6b36c34c app/testpmd: reduce memory consumption
Following [1], testpmd memory consumption has skyrocketted.
The rte_port structure has gotten quite fat.

struct rte_port {
[...]
  struct rte_eth_rxconf rx_conf[65536];            /* 266280 3145728 */
  /* --- cacheline 53312 boundary (3411968 bytes) was 40 bytes ago --- */
  struct rte_eth_txconf tx_conf[65536];            /* 3412008 3670016 */
  /* --- cacheline 110656 boundary (7081984 bytes) was 40 bytes ago --- */
[...]
  /* size: 8654936, cachelines: 135234, members: 31 */
[...]

testpmd handles RTE_MAX_ETHPORTS ports (32 by default) which means that it
needs ~256MB just for this internal representation.

The reason is that a testpmd rte_port (the name is quite confusing, as
it is a local type) maintains configurations for all queues of a port.
But where you would expect testpmd to use RTE_MAX_QUEUES_PER_PORT as the
maximum queue count, the rte_port uses MAX_QUEUE_ID set to 64k.

Prefer the ethdev maximum value.

After this patch:
struct rte_port {
[...]
  struct rte_eth_rxconf      rx_conf[1025];        /*  8240 49200 */
  /* --- cacheline 897 boundary (57408 bytes) was 32 bytes ago --- */
  struct rte_eth_txconf      tx_conf[1025];        /* 57440 57400 */
  /* --- cacheline 1794 boundary (114816 bytes) was 24 bytes ago --- */
[...]
  /* size: 139488, cachelines: 2180, members: 31 */
[...]

With this, we can ask for less memory in test-null.sh.

[1]: https://git.dpdk.org/dpdk/commit/?id=436b3a6b6e62

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2019-11-26 18:05:15 +01:00
Stephen Hemminger
149677c9a3 app/testpmd: fix memory leak on detach
The RTE_FOREACH_MATCHING_DEV iterator requires that
if a break is done before the end of the loop,
the function rte_eth_iterator_cleanup() must be called.

Fixes: 55e51c9624 ("app/testpmd: add device related commands")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2019-11-26 18:05:15 +01:00
Matan Azrad
43d0e30498 app/testpmd: fix invalid port detaching
The port was not validated before detaching.

Ignore port detach operation when the port is not valid.

Fixes: f8e5baa266 ("app/testpmd: check not detaching device twice")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2019-11-21 00:18:02 +01:00
David Marchand
8fad2e5ab2 app/testpmd: report invalid command line parameter
We currently do not check that a non option string has been passed to
testpmd.

Example:
$ ./master/app/testpmd --no-huge -m 512 --vdev net_null0 \
	--vdev net_null1 -- -i nb-cores=2 --total-num-mbuf 2048
[...]
testpmd> show config fwd
io packet forwarding - ports=2 - cores=1 - streams=2 - NUMA support
enabled, MP allocation mode: native
Logical Core 1 (socket 0) forwards packets on 2 streams:
  RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
  RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00

Here nb-cores=2 is just ignored, while the (probably sleepy) user did not
notice this.

Validate that all strings passed to testpmd are part of a known option.

After this patch:
$ ./master/app/testpmd --no-huge -m 512 --vdev net_null0 \
	--vdev net_null1 -- -i nb-cores=2 --total-num-mbuf 2048
[...]
Invalid parameter: nb-cores=2
EAL: Error - exiting with code: 1
  Cause: Command line incorrect

While at it, when passing an unknown option, print the string that gets
refused by getopt_long to help the user.

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

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2019-11-20 17:36:06 +01:00