[dpdk-dev] rte_eth_dev_count() returns 0 in shared library mode.

Venkatesh N venkatesh.nagaraj at gmail.com
Wed Mar 21 16:08:38 CET 2018


Thank Yigit.

It worked for me. I think if the same information is provided in the
doc folder then it can avoid confusion. Many blogs said
to build it as static library.

Regards,
Venky

On Tue, Mar 20, 2018 at 5:54 PM, Ferruh Yigit <ferruh.yigit at intel.com> wrote:
> On 3/19/2018 3:34 PM, Venkatesh N wrote:
>> Hi Everyone,
>>
>> Need urgent help over here.
>>
>> After cloning the latest git, when i compiled the dpdk
>> in shared library mode by modifying the common_base config file
>> and rebuild the examples the api rte_eth_dev_count() returns 0
>>
>> However in the static library mode, rte_eth_dev_count() returns  2.
>> Can someone please let me know what iam missing over here.
>>
>> Here are details
>>
>> -- Code --
>>
>>   /* Check that there is an even number of ports to send/receive on. */
>>         nb_ports = rte_eth_dev_count();
>>         if (nb_ports < 2 || (nb_ports & 1))
>>                 rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");
>>
>>
>> #make config T=x86_64-native-linuxapp-gcc install examples
>> ---------------------------------------
>> Libraries built by changing the SHARED_LIB.
>>
>> config/common_base
>> +++ b/config/common_base
>> @@ -38,7 +38,7 @@ CONFIG_RTE_ARCH_STRICT_ALIGN=n
>>  #
>>  # Compile to share library
>>  #
>> -CONFIG_RTE_BUILD_SHARED_LIB=n
>> +CONFIG_RTE_BUILD_SHARED_LIB=y
>> ----------------------------------------
>>
>>
>> ------------------------------------------------------------------------------------------
>>
>> [root at localhost dpdk_new]#
>> ./examples/skeleton/x86_64-native-linuxapp-gcc/basicfwd
>> EAL: Detected 72 lcore(s)
>> EAL: Multi-process socket /var/run/.rte_unix
>> EAL: Probing VFIO support...
>> EAL: Error - exiting with code: 1
>>   Cause: Error: number of ports must be even
>> ------------------------------------------------------------------------------------------
>> [root at localhost dpdk_new]# ldd
>> ./examples/skeleton/x86_64-native-linuxapp-gcc/basicfwd
>>         linux-vdso.so.1 =>  (0x00007fffa858a000)
>>         librte_flow_classify.so.1.1 =>
>> /root/DPDK/dpdk_new/x86_64-native-linuxapp-gcc/lib/librte_flow_classify.so.1.1
>> (0x00007f7272f5f000)
>>         librte_pipeline.so.3.1 =>
>> /root/DPDK/dpdk_new/x86_64-native-linuxapp-gcc/lib/librte_pipeline.so.3.1
>> (0x00007f7272d58000)
>>         librte_table.so.3.1 =>
>> /root/DPDK/dpdk_new/x86_64-native-linuxapp-gcc/lib/librte_table.so.3.1
>> (0x00007f7272b3e000)
>>         librte_port.so.3.1 =>
>> /root/DPDK/dpdk_new/x86_64-native-linuxapp-gcc/lib/librte_port.so.3.1
>> (0x00007f727291d000)
>>         librte_pdump.so.2.1 =>
>> /root/DPDK/dpdk_new/x86_64-native-linuxapp-gcc/lib/librte_pdump.so.2.1
>> (0x00007f7272513000)
>>         librte_distributor.so.1.1 =>
>> /root/DPDK/dpdk_new/x86_64-native-linuxapp-gcc/lib/librte_distributor.so.1.1
>> (0x00007f727230d000)
>>         librte_ip_frag.so.1.1 =>
>> /root/DPDK/dpdk_new/x86_64-native-linuxapp-gcc/lib/librte_ip_frag.so.1.1
>> (0x00007f7272103000)
>>         librte_gro.so.1.1 =>
>> /root/DPDK/dpdk_new/x86_64-native-linuxapp-gcc/lib/librte_gro.so.1.1
>> (0x00007f7271efc000)
>>         librte_gso.so.1.1 =>
>> /root/DPDK/dpdk_new/x86_64-native-linuxapp-gcc/lib/librte_gso.so.1.1
>> (0x00007f7271cf7000)
>> --snip--
>>
>> [root at localhost dpdk_new]# ./usertools/dpdk-devbind.py --status
>>
>> Network devices using DPDK-compatible driver
>> ============================================
>> 0000:04:00.0 'I350 Gigabit Network Connection 1521' drv=igb_uio unused=
>> 0000:04:00.1 'I350 Gigabit Network Connection 1521' drv=igb_uio unused=
>>
>> ------------ Static Library Mode ---------------------
>>
>> [root at localhost dpdk_new]#
>> ./examples/skeleton/x86_64-native-linuxapp-gcc/basicfwd
>> EAL: Detected 72 lcore(s)
>> EAL: Multi-process socket /var/run/.rte_unix
>> EAL: Probing VFIO support...
>> EAL: PCI device 0000:04:00.0 on NUMA socket 0
>> EAL:   probe driver: 8086:1521 net_e1000_igb
>> EAL: PCI device 0000:04:00.1 on NUMA socket 0
>> EAL:   probe driver: 8086:1521 net_e1000_igb
>> EAL: PCI device 0000:04:00.2 on NUMA socket 0
>> EAL:   probe driver: 8086:1521 net_e1000_igb
>> EAL: PCI device 0000:04:00.3 on NUMA socket 0
>> EAL:   probe driver: 8086:1521 net_e1000_igb
>> EAL: PCI device 0000:05:00.0 on NUMA socket 0
>> EAL:   probe driver: 8086:1572 net_i40e
>> EAL: PCI device 0000:05:00.1 on NUMA socket 0
>> EAL:   probe driver: 8086:1572 net_i40e
>> Port 0 MAC: 14 02 ec 6b 36 10
>> Port 1 MAC: 14 02 ec 6b 36 11
>>
>> -----------------------------------
>>
>> Git Log
>> -------
>> commit 09e1e8d256b0832a64af6d13bf96fcb49e1e7ded
>> Author: Hemant Agrawal <hemant.agrawal at nxp.com>
>> Date:   Fri Feb 23 15:28:03 2018 +0530
>>
>>     mk: fix dependencies of dpaaX drivers
>>
>>     This  patch fixes the build dependency of various
>>     dpaaX components, when the dpaa or fslmc bus is disabled,
>>     or VFIO is disabled.
>>
>> Regards,
>> Venky
>>
>
> Need to provide "-d" parameter for shared build [1], something like:
> "./examples/skeleton/x86_64-native-linuxapp-gcc/basicfwd -d
> ./x86_64-native-linuxapp-gcc/lib"
>
>
> [1]
> https://dpdk.org/doc/guides/linux_gsg/build_sample_apps.html#running-a-sample-application


More information about the dev mailing list