Commit Graph

250 Commits

Author SHA1 Message Date
Viacheslav Ovsiienko
7ca262b886 app/testpmd: fix port detach cleanup
At port detach routine after calling the rte_dev_remove()
testpmd performs some cleanup, checking the statuses of
remaining ports and closes the appropriate ones. The port
scanning is based on the new sibling iterator which uses the
invalid (already closed) port for reference. This patch
replaces the foreach iterator and uses the device object for
reference. It is worth to note this cleanup is not needed
for some drivers (at least for mlx5 and probably for others)
and is preserved due to possible compatibility issues.

Fixes: 13302cd5bd ("app/testpmd: use port sibling iterator in device cleanup")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2019-04-19 14:51:54 +02:00
Chenbo Xia
2b0e0eba2c app/testpmd: fix return value check
Fix unchecked return value issue for rte_eth_dev_configure.

Coverity issue: 195021
Fixes: 2a977b891f ("app/testpmd: fix DCB configuration")
Cc: stable@dpdk.org

Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Acked-by: Rami Rosen <ramirose@gmail.com>
2019-04-12 11:02:02 +02:00
Shahaf Shuler
3a0968c828 app/testpmd: map anonymous memory for devices
Mempools can be populated with anonymous memory when using command line
parameter --mp-alloc=anon.

Considering the mempools are going to be used by the net devices,
it is better to DMA map this memory.

This patch add such mapping now that we have the APIs in place[1].

[1] commit c33a675b62 ("bus: introduce device level DMA memory mapping")

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2019-04-12 11:02:02 +02:00
Shahaf Shuler
59fcf854ed app/testpmd: support no IOVA contiguous mempools
providing a command line parameter to set the mempool flags accordingly.
This mode is relevant only when creating an empty mempool and then
populating with memory.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2019-04-12 11:02:02 +02:00
Shahaf Shuler
401b744da2 app/testpmd: fix mempool free on exit
Allocated mempools were never free. it is bad practice.

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

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2019-04-12 11:02:02 +02:00
Thomas Monjalon
13302cd5bd app/testpmd: use port sibling iterator in device cleanup
When removing a rte_device on a port-based request,
all the sibling ports must be marked as closed.
The iterator loop can be simplified by using the dedicated macro.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
2019-04-05 17:45:22 +02:00
Yongseok Koh
82010ef55e app/testpmd: make txonly mode generate multiple flows
Testpmd can generate multiple flows without taking much cost and this
could be a simple traffic generator for developer's quick tests.
If "--txonly-multi-flow" is specified in the command line, IP source
address is varied to generate multiple flows.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2019-03-29 19:42:42 +01:00
David Marchand
53324971a1 app/testpmd: display/clear forwarding stats on demand
Add a new "show/clear fwd stats all" command to display fwd and port
statistics on the fly.

To be able to do so, the (testpmd only) rte_port structure can't be used
to maintain any statistics.
Moved the stats dump parts from stop_packet_forwarding() and merge with
fwd_port_stats_display() into fwd_stats_display().
fwd engine statistics are then aggregated into a local per port array.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2019-03-29 17:25:31 +01:00
David Marchand
7718296d06 app/testpmd: remove useless casts on statistics
Caught by code review while investigating the fwd stats display code.

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

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2019-03-29 17:25:31 +01:00
David Marchand
c185d42cb4 app/testpmd: extend forwarding statistics to 64 bits
fwd engine statistics are stored as unsigned int (32bits) and can wrap
quite quickly.
Example: sending 7mpps for 614s gives us 4298000000 packets =>
0x1002e4680 larger than 32bits.

testpmd reports forwarding stats as:
RX-packets: 3500381        TX-packets: 3500010        TX-dropped: 371

While the port and accumulated stats are reported as 64bits:
RX-packets: 4298467677     RX-dropped: 0             RX-total: 4298467677
TX-packets: 4298467306     TX-dropped: 371           TX-total: 4298467677

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

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2019-03-29 17:25:31 +01:00
David Marchand
94d655468c app/testpmd: add missing newline when showing statistics
Having the standard stats and the rx burst stats on the same line gives a
really long line and is not consistent with the rest.

Before:
iofwd engine
  RX-packets: 121811360      TX-packets: 121811392      TX-dropped: 0               RX-bursts : 3806605 [100% of 32 pkts]
  TX-bursts : 3806606 [100% of 32 pkts]

csum engine
  RX-packets: 5467488        TX-packets: 5467520        TX-dropped: 0               RX- bad IP checksum: 0               Rx- bad L4 checksum: 0              Rx- bad outer L4 checksum: 0
  RX-bursts : 170859 [100% of 32 pkts]
  TX-bursts : 170860 [100% of 32 pkts]

After:
iofwd engine
  RX-packets: 259770560      TX-packets: 259770592      TX-dropped: 0
  RX-bursts : 8117830 [100% of 32 pkts]
  TX-bursts : 8117831 [100% of 32 pkts]

csum engine
  RX-packets: 7834016        TX-packets: 7834048        TX-dropped: 0               RX- bad IP checksum: 0               Rx- bad L4 checksum: 0              Rx- bad outer L4 checksum: 0
  RX-bursts : 244813 [100% of 32 pkts]
  TX-bursts : 244814 [100% of 32 pkts]

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

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2019-03-29 17:25:31 +01:00
Igor Romanov
683d1e82a0 app/testpmd: fix stdout flush after printing stats
User can specify stats period(n). The statistics should be available
to user every n second. But the print_stats() function does not
force stdout to be flushed, so for instance, a user reading testpmd's
stdout through pipe will not be able to read it until the stdout
buffer is filled.

Fixes: cfea1f3048 ("app/testpmd: print statistics periodically")
Cc: stable@dpdk.org

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2019-03-20 21:12:33 +01:00
Bruce Richardson
5fbc1d498f build/freebsd: rename macro BSDPAPP to FREEBSD
Rename the macro and all instances in DPDK code, but keep a copy of
the old macro defined for legacy code linking against DPDK

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2019-03-12 23:01:14 +01:00
Viacheslav Ovsiienko
62e8a5a8c8 app/testpmd: add TOS and TTL fields to VXLAN encapsulation
The new testpmd set vxlan-tos-ttl command is added. It
allows to specify tos and tll fields for encapsulation IP
header.

IPv4 VXLAN outer header:

  testpmd> set vxlan-tos-ttl ip-version ipv4 vni 4 udp-src 4
           udp-dst 4 ip-tos 0 ip-ttl 255 ip-src 127.0.0.1
           ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
           eth-dst 22:22:22:22:22:22

IPv6 VXLAN outer header:
  testpmd> set vxlan-tos-ttl ip-version ipv6 vni 4 udp-src 4
           udp-dst 4 ip-tos 0 ip-ttl 255 ::1 ip-dst ::2222
           eth-src 11:11:11:11:11:11 eth-dst
           22:22:22:22:22:22

Note: ip-ttl parameter corresponds the nop_limits field for IPv6.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
2019-02-07 12:59:17 +01:00
Cristian Dumitrescu
08fd782b84 app/testpmd: fix quit to stop all ports before close
This patch proposes a slightly different test-pmd quit operation: stop
all devices before starting to close any device. Basically, stop all
moving parts before beginning to remove them. The current test-pmd quit
is stopping and closing each device before moving to the next device.

If all devices in the system are independent of each other, this
difference is usually not important. In case of Soft NIC devices, any
such virtual device typically depends on one or more physical devices
being alive, as it accesses their queues, so this difference becomes
important.

Without this straightforward fix, all the Soft NIC devices need to be
manually stopped before the quit command is issued, otherwise the quit
command can sometimes crash the test-pmd application.

Fixes: d3a274ce9d ("app/testpmd: handle SIGINT and SIGTERM")
Cc: stable@dpdk.org

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2019-01-14 17:44:29 +01:00
Anatoly Burakov
9d65053761 eal: add 64-bit log2 function
Add missing implementation for 64-bit log2 function, and extend
the unit test to test this new function. Also, remove duplicate
reimplementation of this function from testpmd and memalloc.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-12-21 00:23:49 +01:00
Anatoly Burakov
4e261f5519 eal: add 64-bit bsf and 32-bit safe bsf functions
Add an rte_bsf64 function that follows the convention of existing
rte_bsf32 function. Also, add missing implementation for safe
version of rte_bsf32, and implement unit tests for all recently
added bsf varieties.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-12-21 00:00:58 +01:00
Tiwei Bie
e9436f54af pdump: remove deprecated APIs
We already changed to use generic IPC in pdump since below commit:

commit 660098d61f ("pdump: use generic multi-process channel")

The `rte_pdump_set_socket_dir()`, the `path` parameter of
`rte_pdump_init()` and the `enum rte_pdump_socktype` have been
deprecated since then. This commit removes these deprecated
APIs and also bumps the pdump ABI.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
2018-12-19 01:25:56 +01:00
Jeff Guo
cc1bf3077d app/testpmd: workaround deadlock in hot-unplug callback
Because the user's callback is invoked in eal interrupt callback, the
interrupt callback need to be finished before it can be unregistered
when detaching device. So finish callback soon and use a deferred
removal to detach device is need.

It is a workaround, once the device detaching be moved into the eal in
the future, the deferred removal could be deleted. This patch aim to
add this workaround and refine the function name and the description to
be more explicit and comment the limitation.

Fixes: 2049c5113f ("app/testpmd: use hotplug failure handler")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
2018-11-18 17:17:07 +01:00
Thomas Monjalon
4f1ed78ebd app/testpmd: setup attached ports on probe event
After probing is done, each new port must be setup.
The new ports are currently guessed by iterating on ports
matching the devargs string used for probing.

When probing a port, it is possible that one more port probing
get triggered (e.g. PF is automatically probed when probing
a VF representor). Such automatic probing will be caught only on event.

The iterator loop may be replaced by a call from the event callback.
In order to be able to test both modes, a command is added
to choose between iterator and event modes.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-26 22:14:06 +02:00
Thomas Monjalon
97b5d8b545 app/testpmd: move ethdev events registration
The callback for ethdev events was registered on port start,
so it was missing some events.

It is now registered at the beginning of the main function.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-26 22:14:06 +02:00
Thomas Monjalon
86fa5de1d8 app/testpmd: check not configuring port twice
It is possible to request probing of a device twice,
and possibly get new ports for this device.
However, the ports which were already probed and setup
must not be setup again. That's why it is checked whether
the port is already part of fwd_ports_ids array at the beginning
of the function setup_attached_port().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-26 22:14:06 +02:00
Thomas Monjalon
4f1de450c9 app/testpmd: merge ports list update functions
The arrays ports_ids and fwd_ports_ids require the same kind
of update when some ports are removed or added.

The functions update_fwd_ports() and remove_unused_fwd_ports()
are merged in the new function remove_invalid_ports().
The part for adding new port is moved into setup_attached_port().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-26 22:14:06 +02:00
Thomas Monjalon
f8e5baa266 app/testpmd: check not detaching device twice
The command "port detach" is removing the EAL rte_device
of the ethdev port specified as parameter.
The function name and some comments are updated to make clear
that we are detaching the whole device.

After detaching, the pointer, which maps a port to its device,
is reset. This way, it is possible to check whether a port
is still associated to a (not removed) device.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-26 22:14:06 +02:00
Thomas Monjalon
c9cce42876 ethdev: remove deprecated attach/detach functions
The hotplug attach/detach features are implemented in EAL layer.
There is a new ethdev iterator to retrieve ports from ethdev layer.

As announced earlier, the (buggy) ethdev functions are now removed.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-10-26 22:14:05 +02:00
Dekel Peled
c18feafa19 app/testpmd: support metadata as flow rule item
As described in [1], this series adds option to set metadata value
as match pattern when creating a new flow rule.

This patch introduces additional options in testpmd commands:
- New item type "meta" "data"
- New per-port offload flag "match_metadata".

It also adds commands to configure the tx_metadata value to use:
- New 'config' command takes a 32 bit value and stores it per port:
	port config <port_id> tx_metadata <value>
  testpmd will add to any Tx packet sent from this port the metadata
  value, and set ol_flags accordingly.
- A matching 'show' command is added to read the configured value:
	port config <port_id> tx_metadata <value>

[1] "ethdev: support metadata as flow rule criteria"

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-10-26 22:14:05 +02:00
Thomas Monjalon
23ea57a2a0 ethdev: complete closing of port
After closing a port, it cannot be restarted.
So there is no reason to not free all associated resources.

The last step was done with rte_eth_dev_detach() which is deprecated.
Instead of blindly removing the associated rte_device, the driver should
check if no more port (ethdev, cryptodev, etc) is open for the device.

The last ethdev freeing which were done by rte_eth_dev_detach(),
are now done at the end of rte_eth_dev_close() if the driver supports
the flag RTE_ETH_DEV_CLOSE_REMOVE.
There will be a transition period for PMDs to enable this new flag
and migrate to the new behaviour.
When enabling RTE_ETH_DEV_CLOSE_REMOVE, the PMD must free all its
private resources for the port, in its dev_close function.
It is advised to call the dev_close function in the remove function
in order to support removing a device without closing its ports.

Some drivers does not allocate MAC addresses dynamically or separately.
In those cases, the pointer is set to NULL, in order to avoid wrongly
freeing them in rte_eth_dev_release_port().

A closed port will have the state RTE_ETH_DEV_UNUSED which is
considered as invalid by rte_eth_dev_is_valid_port().
So validity is not checked anymore for closed ports in testpmd.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-10-26 22:14:05 +02:00
Thomas Monjalon
3f4a837047 app/testpmd: allow detaching a port not closed
The testpmd application aim is for testing;
so order of operations should not be enforced.

There was a test to forbid detaching before closing a port.
However, it may interesting to test what happens in such case.
It is possible for a PMD to automatically close the port when detaching.

in order to avoid a crash, it is checked that the port must be stopped
before detaching (as for closing).

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-26 22:14:05 +02:00
Wisam Jaddo
ce6959bf79 app/testpmd: update port list for multiple removals
When detaching a port, the full rte_device is removed.
If the rte_device was hosting several ports,
the testpmd list of ports must be updated for multiple removals.

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-26 22:14:05 +02:00
Raslan Darawsheh
b5b38ed878 app/testpmd: set packet dump based on verbosity level
when changing verbosity level it will configure rx/tx callbacks to dump
packets based on the verbosity value as following:
    1- dump only received packets:
       testpmd> set verbose 1
    2- dump only sent packets:
       testpmd> set verbose 2
    3- dump sent and received packets:
       testpmd> set verbose (any number > 2)
    4- disable dump
       testpmd> set verbose 0

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-18 10:24:39 +02:00
Phil Yang
effdb8bbb0 app/testpmd: fix physical port socket initialization
Once the lcore list setting excluded the socket which physical device
attached, it will cause failure. Meanwhile, it will disable Testpmd
cross NUMA scenario.

Fixes: dbfb8ec709 ("app/testpmd: optimize mbuf pool allocation")
Cc: stable@dpdk.org

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2018-10-18 10:24:39 +02:00
Phil Yang
2984133643 app/testpmd: fix vdev socket initialization
The cmdline settings of port-numa-config and rxring-numa-config have
been flushed by the following init_config. If we don't configure the
port-numa-config, the virtual device will allocate the device ports to
socket 0. It will cause failure when the socket 0 is unavailable.

eg:
testpmd -l <cores from socket 1> --vdev net_pcap0,iface=lo
--socket-mem=64 -- --numa --port-numa-config="(0,1)"
--ring-numa-config="(0,1,1),(0,2,1)" -i

...
Configuring Port 0 (socket 0)
Failed to setup RX queue:No mempool allocation on the socket 0
EAL: Error - exiting with code: 1
  Cause: Start ports failed

Fix by allocate the devices port to the first available socket or the
socket configured in port-numa-config.

Fixes: 487f9a592a ("app/testpmd: fix NUMA structures initialization")
Fixes: 20a0286fd2 ("app/testpmd: check socket id validity")
Cc: stable@dpdk.org

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-10-18 10:24:39 +02:00
Jeff Guo
89ecd11052 eal: modify device event process function
This patch modify the device event callback process function name to be
more explicit, change the variable to be const. And more, because not only
eal device helper will use the callback, but also vfio bus will use the
callback to handle hot-unplug, so exposure the API out from private eal.
The bus drivers and eal device would directly use this API to process
device event callback.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-10-15 22:55:55 +02:00
Jeff Guo
2049c5113f app/testpmd: use hotplug failure handler
This patch use testpmd for example, to show how an app smoothly handle
failure when device be hot-unplug. Except that app should enabled the
device event monitor and register the hotplug event’s callback, it also
need enable hotplug handle mechanism before running. Once app detect the
removal event, the hot-unplug callback would be called. It will first stop
the packet forwarding, then stop the port, close the port, and finally
detach the port to clean the device and release the resources.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-15 22:19:00 +02:00
Jens Freimann
3c156061b9 app/testpmd: add noisy neighbour forwarding mode
This adds a new forwarding mode to testpmd to simulate
more realistic behavior of a guest machine engaged in receiving
and sending packets performing Virtual Network Function (VNF).

The goal is to enable a simple way of measuring performance impact on
cache and memory footprint utilization from various VNF co-located on
the same host machine. For this it does:

* Buffer packets in a FIFO:

Create a fifo to buffer received packets. Once it flows over put
those packets into the actual tx queue. The fifo is created per tx
queue and its size can be set with the --noisy-tx-sw-buffer-flushtime
commandline parameter.

A second commandline parameter is used to set a timeout in
milliseconds after which the fifo is flushed.

--noisy-tx-sw-buffer-size [packet numbers]
Keep the mbuf in a FIFO and forward the over flooding packets from the
FIFO. This queue is per TX-queue (after all other packet processing).

--noisy-tx-sw-buffer-flushtime [delay]
Flush the packet queue if no packets have been seen during
[delay]. As long as packets are seen, the timer is reset.

Add several options to simulate route lookups (memory reads) in tables
that can be quite large, as well as route hit statistics update.
These options simulates the while stack traversal and
will trash the cache. Memory access is random.

* simulate route lookups:

Allocate a buffer and perform reads and writes on it as specified by
commandline options:

--noisy-lkup-memory [size]
Size of the VNF internal memory (MB), in which the random
read/write will be done, allocated by rte_malloc (hugepages).

--noisy-lkup-num-writes [num]
Number of random writes in memory per packet should be
performed, simulating hit-flags update. 64 bits per write,
all write in different cache lines.

--noisy-lkup-num-reads [num]
Number of random reads in memory per packet should be
performed, simulating FIB/table lookups. 64 bits per read,
all write in different cache lines.

--noisy-lkup-num-reads-writes [num]
Number of random reads and writes in memory per packet should
be performed, simulating stats update. 64 bits per read-write, all
reads and writes in different cache lines.

Signed-off-by: Jens Freimann <jfreimann@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-11 18:56:02 +02:00
Herakliusz Lipiec
f431e0104d app/testpmd: fix printf format in event callback
change PRIu8 -> PRIu16 for port_id in eth_event_callback
(portid_t is uint16_t)

Fixes: 76ad4a2d82 ("app/testpmd: add generic event handler")
Cc: stable@dpdk.org

Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-11 18:53:49 +02:00
Jerin Jacob
58d475b78c app/testpmd: collect bad outer L4 checksum for csum engine
Collect and prints the statistics for PKT_RX_EL4_CKSUM_BAD
errors.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-11 18:53:49 +02:00
Anatoly Burakov
c7f5dba7d4 app/testpmd: support external memory
Currently, mempools can only be allocated either using native
DPDK memory, or anonymous memory. This patch will add two new
methods to allocate mempool using external memory (regular or
hugepage memory), and add documentation about it to testpmd
user guide.

It adds a new flag "--mp-alloc", with four possible values:
native (use regular DPDK allocator), anon (use anonymous
mempool), xmem (use externally allocated memory area), and
xmemhuge (use externally allocated hugepage memory area). Old
flag "--mp-anon" is kept for compatibility.

All external memory is allocated using the same external heap,
but each will allocate and add a new memory area.

Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-10-11 11:56:55 +02:00
Phil Yang
dbfb8ec709 app/testpmd: optimize mbuf pool allocation
By default, testpmd will create membuf pool for all NUMA nodes and
ignore EAL configuration.

Count the number of available NUMA according to EAL core mask or core
list configuration. Optimized by only creating membuf pool for those
nodes.

Fixes: c9cafcc82d ("app/testpmd: fix mempool creation by socket id")
Cc: stable@dpdk.org

Signed-off-by: Phil Yang <phil.yang@arm.com>
Acked-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-09-19 15:21:36 +02:00
Ferruh Yigit
323e7b667f ethdev: make default behavior CRC strip on Rx
Removed DEV_RX_OFFLOAD_CRC_STRIP offload flag.
Without any specific Rx offload flag, default behavior by PMDs is to
strip CRC.

PMDs that support keeping CRC should advertise DEV_RX_OFFLOAD_KEEP_CRC
Rx offload capability.

Applications that require keeping CRC should check PMD capability first
and if it is supported can enable this feature by setting
DEV_RX_OFFLOAD_KEEP_CRC in Rx offload flag in rte_eth_dev_configure()

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Tomasz Duszynski <tdu@semihalf.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Jan Remes <remes@netcope.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
2018-09-14 20:08:41 +02:00
Konstantin Ananyev
ac7c491c3f app/testpmd: fix DCB config
After adding RSS hash offload check, default rss_hf will fail on devices
that do not support all bits. This will lead to dcb config failure. The
patch fixes this issue by reading current valid rss_conf from the device.

Fixes: 8863a1fbfc ("ethdev: add supported hash function check")
Fixes: 1a572499be ("app/testpmd: setup DCB forwarding based on traffic class")
Cc: stable@dpdk.org

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-08-01 16:36:04 +02:00
Xiaoyun Li
4918a35756 app/testpmd: fix little performance drop
There is about 3% perf drop. And it is because of a bitrate
calculation in the datapath. So improve it by maintaining an array
of port indexes in testpmd, which is updated with ethdev events.

Fixes: 8728ccf376 ("fix ethdev ports enumeration")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
2018-07-23 23:55:26 +02:00
Nelio Laranjeiro
dcd962fc6b app/testpmd: add NVGRE encap/decap
Due to the complex NVGRE_ENCAP flow action and based on the fact testpmd
does not allocate memory, this patch adds a new command in testpmd to
initialise a global structure containing the necessary information to
make the outer layer of the packet.  This same global structure will
then be used by the flow command line in testpmd when the action
nvgre_encap will be parsed, at this point, the conversion into such
action becomes trivial.

This global structure is only used for the encap action.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Tested-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
2018-07-23 23:55:26 +02:00
Nelio Laranjeiro
1960be7d32 app/testpmd: add VXLAN encap/decap
Due to the complex VXLAN_ENCAP flow action and based on the fact testpmd
does not allocate memory, this patch adds a new command in testpmd to
initialise a global structure containing the necessary information to
make the outer layer of the packet.  This same global structure will
then be used by the flow command line in testpmd when the action
vxlan_encap will be parsed, at this point, the conversion into such
action becomes trivial.

This global structure is only used for the encap action.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Tested-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
2018-07-23 23:55:26 +02:00
Jasvinder Singh
0ad778b398 app/testpmd: rework softnic forward mode
Modied the testpmd softnic forwarding mode as per the
changes in softnic PMD.

To run testpmd application with softnic fwd mode, following
command is used;

$ ./testpmd -c 0xc -n 4 --vdev 'net_softnic0,firmware=script.cli'
  -- -i --forward-mode=softnic

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
2018-07-12 13:55:56 +02:00
Jiayu Hu
aaacd052ce app/testpmd: enable UDP GSO in csum engine
This patch enables GSO for UDP/IPv4 packets. Oversized UDP/IPv4
packets transmitted over a GSO-enabled port will undergo segmentation.

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Acked-by: Xiao Wang <xiao.w.wang@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Tested-by: Yuwei Zhang <yuwei1.zhang@intel.com>
2018-07-11 23:49:37 +02:00
Ferruh Yigit
ab3ce1e0c1 ethdev: remove old offload API
In DPDK 17.11, the ethdev offloads API has changed:
	commit cba7f53b71 ("ethdev: introduce Tx queue offloads API")
	commit ce17eddefc ("ethdev: introduce Rx queue offloads API")
The new API is documented in the programmer's guide:
	http://doc.dpdk.org/guides/prog_guide/poll_mode_drv.html#hardware-offload

For reminder, the main concepts in the new API were:
	- All offloads are disabled by default
	- Distinction between per port and per queue offloads.

The transition bits are now removed:
	- Translation of the old API in ethdev
	- rte_eth_conf.rxmode.ignore_offload_bitfield
	- ETH_TXQ_FLAGS_IGNORE

The old API bits are now removed:
	- Rx per-port rte_eth_conf.rxmode.[bit-fields]
	- Tx per-queue rte_eth_txconf.txq_flags
	- ETH_TXQ_FLAGS_NO*

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Shahaf Shuler <shahafs@mellanox.com>
2018-07-04 21:50:32 +02:00
Wei Zhao
26f579aa27 app/testpmd: fix VLAN TCI mask set error for FDIR
The vlan tci mask should be set to 0xEFFF, not 0x0,
the wrong mask will cause mask error for register set.

Fixes: d9d5e6f2f0 ("app/testpmd: set default flow director mask")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
2018-07-03 01:35:58 +02:00
Adrien Mazarguil
422515b9aa app/testpmd: fix crash when attaching a device
Below commit checks global device information to determine if a port uses
the softnic driver once initialized. Problem is that this information is
not available at this point when a port is initialized interactively
through a "port attach XXX" command, crashing testpmd.

This patch systematically initializes global device information to address
this issue.

Fixes: 5b590fbe09 ("app/testpmd: add traffic management forwarding mode")
Cc: stable@dpdk.org

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-06-14 19:27:50 +02:00
Ferruh Yigit
d493079469 app/testpmd: fix descriptor number for Rx queue setup
Wrong index used to select descriptor number, causing setting up queue
with wrong number of descriptors.

Fixes: d44f8a485f ("app/testpmd: enable per queue configure")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-05-23 00:35:01 +02:00