Commit Graph

104 Commits

Author SHA1 Message Date
James Poole
594302c722 app/testpmd: fix timeout in Rx queue flushing
When testpmd is run, the application would hang on the second time
that "start" is executed. This is because the timer limit would get
multiplied to an unreachably high number.

At the start of flush_fwd_rx_queues(), the timer limit now resets
to stop it from getting to this high number.

The timer has been made local for this function.

Fixes: f487715f36 ("app/testpmd: add timeout in Rx queue flushing")

Signed-off-by: James Poole <james.g.poole@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-09-23 20:20:07 +02:00
Olivier Matz
24427bb914 app/testpmd: fix crash when mempool allocation fails
Avoid access to mempool pointer if it is NULL.

Coverity issue: 127553
Fixes: b19a0c75a0 ("app/testpmd: remove anonymous mempool code")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-09-23 20:16:23 +02:00
Amine Kherbouche
f03723017a remove unused ring includes
This patch removes all unused <rte_ring.h> headers.

Signed-off-by: Amine Kherbouche <amine.kherbouche@6wind.com>
2016-09-16 10:16:02 +02:00
Reshma Pattan
0e3d2a9efa app/testpmd: remove redundant timer update
Inside flush_fwd_rx_queues removed redundant prev_tsc update with cur_tsc,
as prev_tsc value is always updated with rte_rdtsc() in for loop.

Coverity issue: 127797
Fixes: f487715f36 ("app/testpmd: add timeout in Rx queue flushing")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-07-15 23:40:09 +02:00
Reshma Pattan
f487715f36 app/testpmd: add timeout in Rx queue flushing
Testpmd can stuck inside do while loop of the flush_fwd_rx_queues()
function. As non-zero packets are returned always by rte_eth_rx_burst()
function when compiled with no optimizations and if input line rate is
high. "do while" loop must exit at one stage to proceed further to
enable packet forwarding and forward the packets. So timer is set to
exit the do while loop after 1 second.

Fixes: af75078f ("first public release")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-07-11 15:35:06 +02:00
Reshma Pattan
102b732950 app/testpmd: initialize pdump
Call rte_pdump_init and rte_pdump_uninit for packet
capturing initialization and uninitialization.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2016-06-16 23:40:26 +02:00
Zhihong Wang
933617d87e app/testpmd: show topology at forwarding start
This patch show topology at forwarding start.

"show config fwd" also does this, but showing it directly can reduce the
possibility of misconfiguration.

Currently fwd_config_display() calls fwd_config_setup(), this misleading
behavior will be fixed in other patches.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-16 16:34:48 +02:00
Zhihong Wang
acbf77a690 app/testpmd: add tx_first burst number option
This patch enables configurable tx_first burst number.

Use "start tx_first (burst_num)" to specify how many bursts of packets to
be sent before forwarding start, or "start tx_first" like before for the
default 1 burst send.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-16 16:25:25 +02:00
Zhihong Wang
bf56fce1fb app/testpmd: add retry option
This patch adds retry option in testpmd to prevent most packet losses.
It can be enabled by "set fwd <mode> retry". All modes except rxonly
support this option.

Adding retry mechanism expands test case coverage to support scenarios
where packet loss affects test results.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-16 16:23:24 +02:00
Bernard Iremonger
d76c19309a app/testpmd: stop forwarding on exit
Stop forwarding on exit whether all ports are started or not.

Fixes: ce8d561418 ("app/testpmd: add port configuration settings")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-16 10:20:29 +02:00
Bernard Iremonger
1e1d6bdd6d app/testpmd: check for valid mbuf pool
Fixes: b6ea6408fb ("ethdev: store numa_node per device")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-16 10:20:29 +02:00
Bernard Iremonger
931126baaf app/testpmd: check for valid socket id when attaching port
Fixes: edab33b1c0 ("app/testpmd: support port hotplug")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
2016-06-16 10:20:28 +02:00
Bernard Iremonger
edf87b4ad0 app/testpmd: move forward streams initialisation
Move call to init_fwd_streams from start_port function
to start_packet_forwarding function.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-16 10:20:28 +02:00
Bernard Iremonger
0c0db76f42 app/testpmd: separate forward config setup from display
Add call to fwd_config_setup to init_config.
Add call to fwd_config_setup for corelist, coremask and nbcore setup.
Add call to fwd_config_setup for portlist, portmask and nbport setup.
Add call to fwd_config_setup for rxq, txq, rxd and txd setup.
Remove fwd_config_setup from fwd_config_display.
Call the pkt_fwd_config_display function directly,
and remove the fwd_config_display wrapper function.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-16 10:19:29 +02:00
Bernard Iremonger
0e545d3047 app/testpmd: check stopping port is not in bonding
Add new function port_is_bonding_slave
Use this function in stop_port and close_port functions.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-16 10:19:29 +02:00
Bernard Iremonger
a8ef3e3a98 app/testpmd: check stopping port is not forwarding
Add calls to port_is_forwarding function in stop_port and
close_port functions to check that port is not forwarding.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-16 10:10:06 +02:00
Bernard Iremonger
ebf5e9b715 app/testpmd: do not update forwarding config
Do not update forwarding configuration when attaching or detaching a port
Remove checks on test_done variable.
Remove code to update forwarding configuration.

Fixes: edab33b1c0 ("app/testpmd: support port hotplug")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-16 10:10:06 +02:00
Pablo de Lara
b38bb262a4 app/testpmd: fix typo when closing port
Fixes: ce8d561418 ("app/testpmd: add port configuration settings")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-08 22:38:53 +02:00
Olivier Matz
d1eb542e05 app/testpmd: log mbuf pool creation
Enhance the logs related to mbuf pool creation. Display an info level
log when creating the mbuf, and display the error as a string on failure.

After the patch, we have:

  [...]
  EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
  USER1: create a new mbuf pool <mbuf_pool_socket_0>: n=331456, \
      size=2176, socket=0
  EAL: Error - exiting with code: 1
    Cause: Creation of mbuf pool for socket 0 failed: Cannot allocate \
      memory

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-06-08 22:38:53 +02:00
Olivier Matz
b19a0c75a0 app/testpmd: remove anonymous mempool code
Now that mempool library provide functions to populate with anonymous
mmap'd memory, we can remove this specific code from test-pmd.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2016-05-19 14:40:14 +02:00
Christian Ehrhardt
bece7b6cf6 app/testpmd: fix running without Xen whereas enabled
With LIBRTE_PMD_XENVIRT enabled testpmd is built in a way to ONLY work
in XEN environments.
It will surface as:
   PMD: gntalloc: ioctl error
   EAL: Error - exiting with code: 1
     Cause: Creation of mbuf pool for socket 0 failed

With LIBRTE_PMD_XENVIRT enabled this now tries the xen style grant
table allocation, but falls back gracefully for the normal allocation.

The only thing left in the log will be the
   PMD: gntalloc: ioctl error

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2016-04-11 16:44:15 +02:00
Thomas Monjalon
09419f235e ethdev: use constants for link state
Define and use ETH_LINK_UP and ETH_LINK_DOWN where appropriate.

Signed-off-by: Marc Sune <marcdevel@gmail.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-04-01 21:38:34 +02:00
Igor Ryzhov
86057c9992 ethdev: remove missed packets from error counter
Comment for "ierrors" counter says that it counts erroneous received
packets. But for some reason "imissed" counter is added to "ierrors"
counter in most drivers.
It is a mistake, because missed packets are obviously not received.
This patch fixes it.

Fixes: 70bdb18657 ("ethdev: add Rx error counters for missed, badcrc and badlen packets")
Fixes: 6bfe648406 ("i40e: add Rx error statistics")
Fixes: 856505d303 ("cxgbe: add port statistics")

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-03-22 11:07:28 +01:00
Reshma Pattan
5a8fb55c48 app/testpmd: support unidirectional configuration
Added testpmd support to validate zero nb_rxq/nb_txq
changes of ethdev (d505ba8).

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-03-13 16:22:55 +01:00
Stephen Hurd
f54fe5ee31 app/testpmd: fix numa socket detection
Previously, max_socket was set to the highest numbered socket with
an enabled lcore.  The intent is to set it to the highest socket
regardless of it being enabled.

Fixes: 7acf894d07 ("app/testpmd: detect numa socket count")

Signed-off-by: Stephen Hurd <shurd@broadcom.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-03-05 20:09:31 +01:00
Zhihong Wang
d3a274ce9d app/testpmd: handle SIGINT and SIGTERM
Handle SIGINT and SIGTERM in testpmd.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
2016-01-27 17:06:51 +01:00
Stephen Hemminger
6c76533ccf replace bzero with memset
The standard for DPDK is to use memset() not bzero which
is a leftover BSD-ism.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2015-12-07 04:57:16 +01:00
Stephen Hemminger
f72a0fa627 app/testpmd: remove references to deprecated statistics
Some of the statistics are deprecated, so don't test them.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2015-11-12 23:05:20 +01:00
Konstantin Ananyev
79bec05b32 app/testpmd: add ability to split outgoing packets
For CSUM forwarding mode add ability to copy & split outgoing packet
into the new mbuf that consists of multiple segments.
For TXONLY and CSUM forwarding modes add ability to make number of
segments in the outgoing packet to vary on a per packet basis.
Number of segments and size of each segment is controlled by
'set txpkts' command.
Split policy is controlled by 'set txsplit' command.
Possible values are: on | off | rand.
Tha allows to increase test coverage for TX PMD codepaths.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2015-11-12 00:22:26 +01:00
Jingjing Wu
1a572499be app/testpmd: setup DCB forwarding based on traffic class
This patch changes the testpmd DCB forwarding stream to make it
based on traffic class.
It also fixes some coding style issues.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
2015-11-01 14:52:06 +01:00
Jingjing Wu
cb60ede6e3 ethdev: rename DCB field in config structs
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
2015-11-01 14:44:31 +01:00
Wenzhuo Lu
47b3ac6b45 app/testpmd: initialize new flow director masks
When a port is enabled, there're default values for the parameters of
fdir mask. For the new parameters, the default values also need to be
set.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-10-29 00:02:16 +01:00
Stephen Hurd
7acf894d07 app/testpmd: detect numa socket count
Currently, there is a MAX_SOCKET macro which artificially limits the
number of NUMA sockets testpmd can use.  Anything on a higher socket
ends up using socket zero.  This patch replaces this with a variable
set during set_default_fwd_lcores_config() and uses RTE_MAX_NUMA_NODES
where a hard-coded max number of sockets is required.

Signed-off-by: Stephen Hurd <shurd@broadcom.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2015-10-24 21:41:17 +02:00
Michael Qiu
d4e8ad64fa app/testpmd: fix error message when closing port twice
When close one port twice, testpmd will give out wrong messagse.

testpmd> port stop  0
Stopping ports...
Checking link statuses...
Port 0 Link Up - speed 0 Mbps - full-duplex
Port 1 Link Up - speed 0 Mbps - full-duplex
Done
testpmd> port close 0
Closing ports...
Done
testpmd> port close 0
Closing ports...
Port 0 is now not stopped
Done
testpmd>

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
2015-07-30 02:15:32 +02:00
Bernard Iremonger
41b05095c4 app/testpmd: fix bonding start
When the bonded port is started it also starts the slave port,
but the slave port status is not set. A slave_flag has been
added to struct rte_port to resolve this issue.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
2015-07-27 19:20:45 +02:00
Bernard Iremonger
20718201c8 app/testpmd: fix port detaching with virtio
At this point the stop() and close() functions have already been called.
The rte_eth_promiscuous_disable() function does not return on the VM.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2015-07-19 22:24:42 +02:00
Stephen Hemminger
f3618dcbcf app: fix whitespace
Fix trailing whitespace, space before tab and empty lines at end of file.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
[Thomas: fix indent and alignment in test_acl.h and test_sched.c]
2015-06-12 11:10:10 +02:00
Olivier Matz
ea0c20ea95 apps: use helper to create mbuf pools
When it's possible, use the new helper to create the mbuf pools.
Most of the patch is trivial, except for the following files that
have some specifics (indirect mbufs):
- ip_fragmentation
- ip_pipeline
- ipv4_multicast
- vhost

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-04-28 11:34:10 +02:00
Olivier Matz
dfb03bbe2b app/testpmd: use standard functions to initialize mbufs and mbuf pool
The rte_pktmbuf_pool_init() and rte_pktmbuf_init() functions now
support to have a non-hardcoded buffer length. We can remove the
specific functions used in testpmd and replace them by the standard
ones.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-04-28 11:22:56 +02:00
Olivier Matz
1d493a4949 mbuf: fix data room size calculation in pool init
Deduct the mbuf data room size from mempool->elt_size and priv_size,
instead of using an hardcoded value that is not related to the real
buffer size.

To use rte_pktmbuf_pool_init(), the user can either:
- give a NULL parameter to rte_pktmbuf_pool_init(): in this case, the
  private size is assumed to be 0, and the room size is
  mp->elt_size - sizeof(struct rte_mbuf).
- give the rte_pktmbuf_pool_private filled with appropriate
  data_room_size and priv_size values.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-04-27 22:39:20 +02:00
Julien Cretin
12a8e30fd7 app/testpmd: fix potential out of bounds read
After the last enabled port has been seen, and the last time we
evaluate the loop condition, there is an out of bounds read in
ports[p].enabled because p is equal to size, which is the length of
ports.

Signed-off-by: Julien Cretin <julien.cretin@trust-in-soft.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2015-03-23 12:35:20 +01:00
Pablo de Lara
8210ec2572 app/testpmd: stop forwarding when quitting
When user quits testpmd, and there is traffic being forwarded,
that may produce a segmentation fault, due to ports being closed,
while they are still transmitting packets.

This patch prevents the issue from happening,
by stopping packet forwarding before closing the ports.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2015-03-10 16:22:44 +01:00
David Marchand
ff708facfc tailq: remove unneeded inclusions
Only keep inclusion where really needed.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2015-03-10 11:47:46 +01:00
Michael Qiu
4468635fdd app/testpmd: forbid actions on invalid port
Currently, if try to start/stop/close one invalid port,
no error shows in testpmd.
This is a bug, need check the port number.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: Tetsuya Mukawa <mukawa@igel.co.jp>
2015-03-09 12:47:25 +01:00
Michael Qiu
92d2703e2c app/testpmd: fix log with no bound device
As hotplug has been enabled, start the testpmd with no nic binded
will show one error log "Please stop the ports first":

Interactive-mode selected
Please stop the ports first
Done
testpmd>

This issue is cause by the logic of check link status.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2015-03-09 12:46:46 +01:00
Tetsuya Mukawa
ffc468ff3c app/testpmd: fix crash when portmask is specified
If testpmd is invoked with portmask option like below, segmentation
fault will occur. This patch fixes the issue.

Reported-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2015-02-28 00:24:32 +01:00
Tetsuya Mukawa
edab33b1c0 app/testpmd: support port hotplug
The patch introduces following commands.
- port attach [ident]
- port detach [port_id]
 - attach: attaching a port
 - detach: detaching a port
 - ident: pci address of physical device.
          Or device name and parameters of virtual device.
         (ex. 0000:02:00.0, eth_pcap0,iface=eth0)
 - port_id: port identifier

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2015-02-26 00:20:43 +01:00
Jingjing Wu
d9d5e6f2f0 app/testpmd: set default flow director mask
This patch sets the default value of flow director's mask.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
2015-02-22 01:49:44 +01:00
Jingjing Wu
299191e0c9 ethdev: remove flexbytes offset from flow director
This patch removes the flexbytes_offset from rte_fdir_conf, because
the flexible payload setting is done by flex_conf instead of flexbytes_offset.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
2015-02-22 01:14:31 +01:00
Pablo de Lara
f2c5125a68 app/testpmd: use default Rx/Tx port configuration
Function to get rx/tx port configuration from the PMDs
was added in previous release to simplify the port configuration
in all sample apps, but testpmd was not modified.

This patch makes testpmd get the default rx/tx port configuration,
but still uses the parameters passed by the command line.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
2015-02-14 11:35:25 +01:00