DPDK Number of ports must be even - dpdk

I spent some time trying to figure out how to fix the "number of ports must be even" error. I've seen this answer which explains how to run DPDK inside a VM. I was wondering if there is a solution that does not require one.
My platform: Debian 10, Linux 5.8 (on a laptop) with an e1000e NIC driver
What I want to do: Make the skeleton (basicfwd) app work
My problem: rte_eth_dev_count_avail returns 0
What I did up until now: I followed the documentation and tried to setup a vfio_pci driver to my ethernet device.
Two things:
When I bind a device with the vfio_pci driver it loses its IP
interface
I can't create VF devices because I can't write in /sys/bus/pci/devices/ even when I su root
The skeleton program is not working with this so I tried using another driver.
I bound the device to the uio_pci_generic driver. It does bind to it but the app still doesn't work. Here is the dpdk-devbind.py --status output:
Network devices using DPDK-compatible driver
============================================
0000:00:1f.6 'Device 0d4f' drv=uio_pci_generic unused=e1000e
What happens when I launch the program:
$ sudo ./build/examples/dpdk-skeleton -l 0-3 -n 4 -a 0000:00:1f.6
EAL: Detected 8 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: Probing VFIO support...
EAL: No legacy callbacks, legacy socket not created
EAL: Error - exiting with code: 1
Cause: Error: number of ports must be even
Thanks for reading, any help is appreciated !

In VM I am able to get e1000 bind with the following steps
Start VM with 82540EM Gigabit Ethernet Controller
Download and build DPDK 21.02
insmod igb_uio or modprobe uio_pci_generic
bind with vfio-pci fails with vfio-pci: probe of 0000:00:08.0 failed with error -22
start the application with ./a.out -l 1 --log-level=pmd,8
build application: gcc basicfwd.c $(pkg-config --libs --cflags --static libdpdk
Logs:
e1000_null_phy_generic(): e1000_null_phy_generic
e1000_read_phy_reg_m88(): e1000_read_phy_reg_m88
e1000_null_ops_generic(): e1000_null_ops_generic
e1000_read_phy_reg_mdic(): e1000_read_phy_reg_mdic
e1000_null_phy_generic(): e1000_null_phy_generic
e1000_read_phy_reg_m88(): e1000_read_phy_reg_m88
e1000_null_ops_generic(): e1000_null_ops_generic
e1000_read_phy_reg_mdic(): e1000_read_phy_reg_mdic
e1000_null_phy_generic(): e1000_null_phy_generic
e1000_setup_copper_link_generic(): Unable to establish link!!!
e1000_setup_link_generic(): Initializing the Flow Control address, type and timer regs
e1000_set_fc_watermarks_generic(): e1000_set_fc_watermarks_generic
e1000_clear_hw_cntrs_82540(): e1000_clear_hw_cntrs_82540
e1000_clear_hw_cntrs_base_generic(): e1000_clear_hw_cntrs_base_generic
e1000_check_for_copper_link_generic(): e1000_check_for_copper_link
e1000_phy_has_link_generic(): e1000_phy_has_link_generic
e1000_read_phy_reg_m88(): e1000_read_phy_reg_m88
e1000_null_ops_generic(): e1000_null_ops_generic
e1000_read_phy_reg_mdic(): e1000_read_phy_reg_mdic
e1000_null_phy_generic(): e1000_null_phy_generic
e1000_read_phy_reg_m88(): e1000_read_phy_reg_m88
e1000_null_ops_generic(): e1000_null_ops_generic
e1000_read_phy_reg_mdic(): e1000_read_phy_reg_mdic
e1000_null_phy_generic(): e1000_null_phy_generic
e1000_null_ops_generic(): e1000_null_ops_generic
eth_em_dev_init(): port_id 0 vendorID=0x8086 deviceID=0x100e
note: unmodified skeleton requires an even number of ports to work properly.
Hence there is no issue with e1000 and DPDK usability
[EDIT-1] had a live debug with Jeremy, the issue is now reproduced on a physical machine with physical NIC (an not emulated e1000). Checking the PCIe details the physical NIC is not in the list of supported Intel DPDK NIC. Requested to use a physical NIC recommend from DPDK.

Related

DPDK 21.11 rte_eth_dev_configure failing for X722 NIC

While upgrading DPDK from version 17.02 to 21.11 rte_eth_dev_configure is failing with return code -22. Due to that, my application is not working.
PFB the details about the system.
Using Intel Corporation Ethernet Connection X722.
lspci | grep "Ethernet"
3d:00.0 Ethernet controller: Intel Corporation Ethernet Connection X722 for 10GBASE-T (rev 09)
3d:00.1 Ethernet controller: Intel Corporation Ethernet Connection X722 for 10GBASE-T (rev 09)
af:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
Driver used :
ethtool -i eth0
driver: i40e
version: 2.7.29
firmware-version: 3.31 0x80000d31 1.1767.0
expansion-rom-version:
bus-info: 0000:3d:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: yes
Number of RX queues : 4
enabled log using --log-level=pmd,8 , PFB the dpdk.log output.
"[Wed Jan 11 04:00:34 2023][ms_dpi: 1150] Starting DPDK logging
session EAL: Detected CPU lcores: 40 EAL: Detected NUMA nodes: 1 EAL:
Static memory layout is selected, amount of reserved memory can be
adjusted with -m or --socket-mem EAL: Detected shared linkage of DPDK
EAL: Trace dir: /root/dpdk-traces/rte-2023-01-11-AM-04-00-34 EAL:
Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA
mode 'PA' EAL: NUMA support not available consider that all memory is
in socket_id 0 EAL: Probe PCI driver: net_i40e (8086:37d2) device:
0000:3d:00.1 (socket 0) eth_i40e_dev_init(): >> i40e_pf_reset(): Core
and Global modules ready 0 i40e_init_shared_code():
i40e_init_shared_code i40e_set_mac_type(): i40e_set_mac_type
i40e_set_mac_type(): i40e_set_mac_type found mac: 3, returns: 0
i40e_init_nvm(): i40e_init_nvm i40e_allocate_dma_mem_d(): memzone
i40e_dma_0 allocated with physical address: 65496862720"
The application was working fine with DPDK version 17.02. Is there any change with respect to the i40e driver which is causing this issue? All libraries needed to build the application are present in the system like -Wl,-lrte_net_enic -Wl,-lrte_net_i40e.
Did anybody face the same issue with provided configuration?
I am not able to figure out the root cause of this error. Any help is appreciated. Thanks
Issue has been resolved. Application code was earlier using eth_config.rx_adv_conf.rss_conf.rss_hf = 260 (RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_IPV6).
After running the testpmd with same configuration (rx queues = 4 and tx queue = 1) got to know the supported RSS offload attributes.
Output of the testpmd command shows supported offload flags.
testpmd> show port 0 rss-hash
RSS functions:
ipv4-frag ipv4-other ipv6-frag ipv6-other
testpmd> quit
Supported offload attributes by i40e driver.
#define I40E_RSS_OFFLOAD_ALL ( \
RTE_ETH_RSS_FRAG_IPV4 | \
RTE_ETH_RSS_NONFRAG_IPV4_TCP | \
RTE_ETH_RSS_NONFRAG_IPV4_UDP | \
RTE_ETH_RSS_NONFRAG_IPV4_SCTP | \
RTE_ETH_RSS_NONFRAG_IPV4_OTHER | \
RTE_ETH_RSS_FRAG_IPV6 | \
RTE_ETH_RSS_NONFRAG_IPV6_TCP | \
RTE_ETH_RSS_NONFRAG_IPV6_UDP | \
RTE_ETH_RSS_NONFRAG_IPV6_SCTP | \
RTE_ETH_RSS_NONFRAG_IPV6_OTHER | \
RTE_ETH_RSS_L2_PAYLOAD)
eth_config.rx_adv_conf.rss_conf.rss_hf = 840 (RTE_ETH_RSS_FRAG_IPV4| RTE_ETH_RSS_NONFRAG_IPV4_OTHER|RTE_ETH_RSS_FRAG_IPV6 |RTE_ETH_RSS_NONFRAG_IPV6_OTHER)
After providing the right hash value. Application started running fine.

What causes EIO (-5) from dpdk?

Trying to get Intel adapter E810-XXVDA2 to work with VPP (using vfio-pci driver) and cannot figure out the error. When I use the adapter outside of VPP/DPDK, it works just fine (uses ice driver).
Adapter: Intel(R) Ethernet Network Adapter E810-XXVDA2, driver: vfio-pci
VPP: v22.02
Linux: kernel 5.13.0-40-generic, Ubuntu focal 20.04.3 LTS
When interface is specified in /etc/vpp/startup.conf and started with vppctl:
vpp# show hardware-interfaces TwentyFiveGigabitEthernet37/0/0
Name Idx Link Hardware
TwentyFiveGigabitEthernet37/0/0 1 up TwentyFiveGigabitEthernet37/0/0
...
rx bytes ok 2613819
rx missed 18468
Errors:
rte_eth_dev_start[port:0, errno:-5]: Unknown error -5
rte_eth_dev_start[port:0, errno:-5]: Unknown error -5
What does the -5 (EIO) from dpdk mean? Thanks in advance!
EDIT:
I was able to get past this error. Going by the suggestion from #VipinVarghese, I turned on logging (which for VPP users means adding log-level pmd,8 to dpdk section and default-log-level debug in logging section of /etc/vpp/startup.conf).
There I saw that there was a second error which needed me to update ice driver. I was at 1.3.4, I moved it to 1.8.8. After that, both errors got resolved.
The errors were:
2022/05/04 19:58:48:594 error dpdk Interface TwentyFiveGigabitEthernet37/0/0 error -5: Unknown error -5
2022/05/04 19:58:48:594 error interface sw_set_flags_helper: dpdk_interface_admin_up_down: Interface start failed
2022/05/04 19:58:48:595 notice dpdk ice_tx_queue_start(): >>
2022/05/04 19:58:48:595 notice dpdk ice_rx_queue_start(): >>
2022/05/04 19:58:48:595 notice dpdk ice_program_hw_rx_queue(): Port (0) - Rx queue (0) is set with RXDID : 22
2022/05/04 19:58:48:595 notice dpdk ice_program_hw_rx_queue(): currently package doesn't support RXDID (22)
2022/05/04 19:58:48:595 notice dpdk ice_rx_queue_start(): fail to program RX queue 0
2022/05/04 19:58:48:595 notice dpdk ice_dev_start(): fail to start Rx queue 0
RXDID #22 (ICE_RXDID_COMMS_OVS) was not supported until later versions.
DPDK ICE (columibaville E810) PMD can return EIO at 2 different places
HW or device reset - hw->resetting
Traffic Manager configuration - hw->tm_conf
Hence to nail down on the exact problem, always run it with DPDK EAL_INIT option --log-level=pmd,8. This will help to capture more details with respect to PMD. I highly recommend to use the appropriate driver and firmware version against the DPDK version as mentioned in section 25.3.
[Update] updating the linux driver (which in turn houses the DDP and firmware) has solved the issue for #schugcove.

Gdb can't connect to OpenOCD on stm32

Trying to debug my sample blink_led code on STM32L476 Nucleo-64 board but gdb can't connect to OpenOCD (connection drops almost instantly with error). I've read plenty of posts here and there but none of them helped. Tried adding commands to OpenOCD using -c but no change of behavior.
My code compiles both in Release and Debug config in Eclipse. I can flash the bin file using drag and drop (while the board has built-in STLink add-on) and looks the code runs perfectly on the board (LED blinks).
Cross compiling on Centos7 using the following versions:
Toolchain (gdb): gcc-arm-none-eabi-8-2018-q4-major
OpenOCD: 0.10.0-11-20190118-1134
As using eclipse didn't work I tried the command line,
(I'm not an experienced developer in this environment so I could not find any config file closer to my stm32l476 board than the stm32l4discovery.cfg, please let me know if there might be some issues using it)
./bin/openocd -f scripts/board/stm32l4discovery.cfg -c "init"
It starts,
GNU MCU Eclipse 64-bit Open On-Chip Debugger 0.10.0+dev-00462-gdd1d90111 (2019-01-18-11:37)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 500 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 500 kHz
Info : STLINK V2J28M17 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.244386
Info : stm32l4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Then starting GDB:
./arm-none-eabi-gdb ~/eclipse-workspace/test-blink-led/Debug/test-blink-led.elf
then running the following command in gdb:
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
Remote connection closed
As it shows gdb connection drops instantly and OpenOCD prompts the following errors:
Info : accepting 'gdb' connection on tcp/3333
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080022e6 msp: 0x20017ff8
Info : device id = 0x10076415
Warn : STM32 flash size failed, probe inaccurate - assuming 1024k flash
Info : flash size = 1024kbytes
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
Error: jtag status contains invalid mode value - communication failure
Polling target stm32l4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
So from those geeks who do it on a similar platform on a daily basis, can anyone help and tell me where am I doing wrong. Does missing any compile-time flag might result in this problem?
I'm scratching my head for a couple of days now so please let me have your hints.
One of the reasons may be that your STLINK firmware seems pretty old (STLINK V2J28M17 as your log shows). I suggest downloading the STSW-LINK007 application to upgrade the firmware. The software is a multiplatform Java application. It works flawlessly in Debian GNU/Linux.
Currently, I use another gdb server texane/stlink for my debugging task with GDB without any problem on some Nucleo and also custom boards. I use target extended-remote command to join the port of the server. Maybe you can try to connect with this command also under OpenOCD.
Try
telnet localhost 4444
it worked for me, while 3333 didn't

X710 (i40e) NIC DPDK bind Error in centos 7.3

When I use dpdk-devbind.py to bind a port of Network port of X710. I get error:
Error: bind failed for 0000:20.00.0 - Cannot bind to driver uio_pci_generic.
Error: unbind failed for 0000:20:00.0 - Cannot open /sys/bus/pci/drivers//unbind
The command was run by root user. Linux version is: 3.10.0-693.21.1.el7.x86_64. It is run in CentOS 7.3.
Same haredware, same command run in CentOS 7 (Linux: 3.10.0-123.el7.x86_64), the bind work well.
In addition, CentOS 7.3 with Intel X520 work well with dpdk.
Something else: before bind command from dpdp, in CentOS 7, ifconfig cannot view i40e port. but in CentOS 7.3, it can see the ports.
Looks like Linux Kernel problem, but when I upgrade kernel to 4.16 (mainline) or 4.4 (longterm), I get ERST: cannot request mem error. Anything else I can try?
you should bind with igb_uio , generic is not supported for this type of intel controller.

Qt on Linux embedded: Unable to get QBluetoothLocalDevice

I have a Linux embedded device using Linux kernel 3.17 and a WiLink 8 wireless module as Bluetooth device (uses UART) (see Gumstix AirStorm-y). Also, I have Qt 5.3.2 and Bluez 4.101 installed on it.
My problem is when I execute my Qt app, I can't get information on my bluetooth device using QBluetoothLocalDevice. For example, QBluetoothLocalDevice::allDevices() always returns an empty list and QBluetoothLocalDevice::address() always returns "00:00:00:00:00:00". If I try to execute the chat example, I get the 'Cannot bind chat server to "00:00:00:00:00:00"' error.
I'm sure my bluetooth device is up and running:
hci0:
Type: BR/EDR Bus: UART
BD Address: 5C:31:3E:CE:C3:CE ACL MTU: 1021:6 SCO MTU: 180:4
UP RUNNING PSCAN
RX bytes:657 acl:0 sco:0 events:37 errors:0
TX bytes:979 acl:0 sco:0 commands:37 errors:0
I can also do scan using hcitools.
Dbus is also running correctly, when I do dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.DefaultAdapter I get:
method return sender=:1.5 -> dest=:1.12 reply_serial=2
object path "/org/bluez/1743/hci0"
In my app, everything else seems to work just fine (I a have a QTCPserver and file manager with QFileSystemWatcher), it's only the BLuetooth part I can't manage to make it worked.