numam-dpdk/lib/ethdev
David Marchand 41f2f05574 ethdev: warn once when using port not ready
Warning continuously is a pain when developping or if a unit test
is/gets broken.

It could also be a problem if application behaves badly only in some
corner cases and a DoS results of those logs being continuously displayed.

Let's warn once per port and per rx/tx.

Getting such a log is scary, but let's make it more eye catching by
dumping a backtrace with it.

Tested by introducing a bug in testpmd:
 static int
 eth_dev_start_mp(uint16_t port_id)
 {
-       if (is_proc_primary())
+       if (!is_proc_primary())
                return rte_eth_dev_start(port_id);

        return 0;

Then, running a basic null test:
$ ./devtools/test-null.sh
...
Start automatic packet forwarding
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

lcore 0 called rx_pkt_burst for not ready port 0
8: [build/app/dpdk-testpmd() [0x59e839]]
7: [/lib64/libc.so.6(__libc_start_main+0xf5) [0x7ff481b69555]]
6: [build/app/dpdk-testpmd(main+0x54b) [0x662d24]]
5: [build/app/dpdk-testpmd(start_packet_forwarding+0x263) [0x65e795]]
4: [build/app/dpdk-testpmd() [0x65e1be]]
3: [build/app/dpdk-testpmd() [0x65a996]]
2: [build/app/dpdk-testpmd() [0xa6cbc7]]
1: [build/app/dpdk-testpmd(rte_dump_stack+0x27) [0xaee796]]
lcore 0 called rx_pkt_burst for not ready port 1
8: [build/app/dpdk-testpmd() [0x59e839]]
7: [/lib64/libc.so.6(__libc_start_main+0xf5) [0x7ff481b69555]]
6: [build/app/dpdk-testpmd(main+0x54b) [0x662d24]]
5: [build/app/dpdk-testpmd(start_packet_forwarding+0x263) [0x65e795]]
4: [build/app/dpdk-testpmd() [0x65e1be]]
3: [build/app/dpdk-testpmd() [0x65a996]]
2: [build/app/dpdk-testpmd() [0xa6cbc7]]
1: [build/app/dpdk-testpmd(rte_dump_stack+0x27) [0xaee796]]
  io packet forwarding packets/burst=32
  nb forwarding cores=1 - nb forwarding ports=2
  port 0: RX queue number: 1 Tx queue number: 1
    Rx offloads=0x0 Tx offloads=0x0

Fixes: c87d435a4d ("ethdev: copy fast-path API into separate structure")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-10-27 19:28:45 +02:00
..
ethdev_driver.h ethdev: add namespace 2021-10-22 18:15:38 +02:00
ethdev_pci.h drivers: remove direct access to interrupt handle 2021-10-25 21:20:12 +02:00
ethdev_private.c ethdev: warn once when using port not ready 2021-10-27 19:28:45 +02:00
ethdev_private.h ethdev: fix ID spelling in comments and log messages 2021-10-21 13:43:56 +02:00
ethdev_profile.c ethdev: fix Ethernet spelling 2021-10-21 13:43:56 +02:00
ethdev_profile.h lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
ethdev_trace_points.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
ethdev_vdev.h ethdev: fix Ethernet spelling 2021-10-21 13:43:56 +02:00
meson.build lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
rte_class_eth.c ethdev: fix ID spelling in comments and log messages 2021-10-21 13:43:56 +02:00
rte_dev_info.h ethdev: fix EEPROM spelling 2021-10-21 13:43:56 +02:00
rte_eth_ctrl.h ethdev: fix Rx/Tx spelling 2021-10-21 13:43:56 +02:00
rte_ethdev_core.h ethdev: fix Rx/Tx spelling 2021-10-21 13:43:56 +02:00
rte_ethdev_trace_fp.h lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
rte_ethdev_trace.h ethdev: fix max Rx packet length 2021-10-18 19:20:20 +02:00
rte_ethdev.c lib: remove direct access to interrupt handle 2021-10-25 21:20:12 +02:00
rte_ethdev.h mbuf: add namespace to offload flags 2021-10-24 13:37:43 +02:00
rte_flow_driver.h ethdev: introduce configurable flexible item 2021-10-20 18:58:54 +02:00
rte_flow.c ethdev: support L2TPv2 and PPP procotol 2021-10-21 14:15:59 +02:00
rte_flow.h mbuf: add namespace to offload flags 2021-10-24 13:37:43 +02:00
rte_mtr_driver.h ethdev: avoid documentation in next lines 2021-10-21 13:43:56 +02:00
rte_mtr.c ethdev: add pre-defined meter policy API 2021-04-21 12:22:17 +02:00
rte_mtr.h ethdev: add pre-defined meter policy API 2021-04-21 12:22:17 +02:00
rte_tm_driver.h lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
rte_tm.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
rte_tm.h ethdev: fix Rx/Tx spelling 2021-10-21 13:43:56 +02:00
version.map ethdev: get device capability name as string 2021-10-22 00:08:57 +02:00