DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] Difference between APP and LIB
@ 2018-05-24 13:34 Filip Janiszewski
  2018-05-24 23:20 ` Paras Jha
  0 siblings, 1 reply; 2+ messages in thread
From: Filip Janiszewski @ 2018-05-24 13:34 UTC (permalink / raw)
  To: users

Hi,

I've a weird situation: If I build my code using rte.app.mk, then
calling rte_eal_init and rte_eth_dev_count returns the proper amount of
NICs.

The very same code built with rte.lib.mk into a *.a library does not
recognize any NIC (If I include the lib in another test application that
only invoke one function that trigger rte_eal_init and rte_eth_dev_count).

The output of running rte_eal_init with rte.app.mk on my machine is:

.
EAL: Detected 8 lcore(s)
EAL: Multi-process socket /var/run/.rte_unix
EAL: Probing VFIO support...
EAL: PCI device 0000:06:00.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 15b3:1015 net_mlx5
PMD: net_mlx5: PCI information matches, using device "mlx5_0" (SR-IOV:
false)
PMD: net_mlx5: 1 port(s) detected
PMD: net_mlx5: MPS is enabled
PMD: net_mlx5: Reserved UAR address space: 0x7f0680000000
PMD: net_mlx5: port 1 MAC address is 7c:fe:90:5e:79:fa
EAL: PCI device 0000:06:00.1 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 15b3:1015 net_mlx5
PMD: net_mlx5: PCI information matches, using device "mlx5_1" (SR-IOV:
false)
PMD: net_mlx5: 1 port(s) detected
PMD: net_mlx5: MPS is enabled
PMD: net_mlx5: port 1 MAC address is 7c:fe:90:5e:79:fb
.

While the same invocation with the code built using rte.lib.mk generate
this output:

.
EAL: Detected 8 lcore(s)
EAL: Multi-process socket /var/run/.rte_unix
EAL: Probing VFIO support...
.

That's all -no more prints-, it seems that nothing else is done by the
eal init function. What could be the problem here? As a background note:
I'm trying to move my existing DPDK code into a lib, and this is already
failing at the first step (eal init).

Thanks

-- 
BR, Filip
+48 666 369 823

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-users] Difference between APP and LIB
  2018-05-24 13:34 [dpdk-users] Difference between APP and LIB Filip Janiszewski
@ 2018-05-24 23:20 ` Paras Jha
  0 siblings, 0 replies; 2+ messages in thread
From: Paras Jha @ 2018-05-24 23:20 UTC (permalink / raw)
  To: contact; +Cc: users

Hello,

I actually had the exact same issue earlier!

The PMDs for DPDK mark their functions as constructors to get them to
initialize before main() - however, this causes the linker to (mistakenly)
believe there is no reference to the function and remove it from the binary.

The rte.app.mk already does this for you, but you can manually do it by
adding these flags during link stage

-Wl,--whole-archive -ldpdk -Wl,--no-whole-archive

Please note that this will embed ALL of dpdk into your binary - if you want
to fine-tune your binary to be smaller you might find it prudent to include
only the libs that are relevant to your application

Thanks

On Thu, May 24, 2018 at 6:35 AM Filip Janiszewski <
contact@filipjaniszewski.com> wrote:

> Hi,
>
> I've a weird situation: If I build my code using rte.app.mk, then
> calling rte_eal_init and rte_eth_dev_count returns the proper amount of
> NICs.
>
> The very same code built with rte.lib.mk into a *.a library does not
> recognize any NIC (If I include the lib in another test application that
> only invoke one function that trigger rte_eal_init and rte_eth_dev_count).
>
> The output of running rte_eal_init with rte.app.mk on my machine is:
>
> .
> EAL: Detected 8 lcore(s)
> EAL: Multi-process socket /var/run/.rte_unix
> EAL: Probing VFIO support...
> EAL: PCI device 0000:06:00.0 on NUMA socket -1
> EAL:   Invalid NUMA socket, default to 0
> EAL:   probe driver: 15b3:1015 net_mlx5
> PMD: net_mlx5: PCI information matches, using device "mlx5_0" (SR-IOV:
> false)
> PMD: net_mlx5: 1 port(s) detected
> PMD: net_mlx5: MPS is enabled
> PMD: net_mlx5: Reserved UAR address space: 0x7f0680000000
> PMD: net_mlx5: port 1 MAC address is 7c:fe:90:5e:79:fa
> EAL: PCI device 0000:06:00.1 on NUMA socket -1
> EAL:   Invalid NUMA socket, default to 0
> EAL:   probe driver: 15b3:1015 net_mlx5
> PMD: net_mlx5: PCI information matches, using device "mlx5_1" (SR-IOV:
> false)
> PMD: net_mlx5: 1 port(s) detected
> PMD: net_mlx5: MPS is enabled
> PMD: net_mlx5: port 1 MAC address is 7c:fe:90:5e:79:fb
> .
>
> While the same invocation with the code built using rte.lib.mk generate
> this output:
>
> .
> EAL: Detected 8 lcore(s)
> EAL: Multi-process socket /var/run/.rte_unix
> EAL: Probing VFIO support...
> .
>
> That's all -no more prints-, it seems that nothing else is done by the
> eal init function. What could be the problem here? As a background note:
> I'm trying to move my existing DPDK code into a lib, and this is already
> failing at the first step (eal init).
>
> Thanks
>
> --
> BR, Filip
> +48 666 369 823
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-24 23:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24 13:34 [dpdk-users] Difference between APP and LIB Filip Janiszewski
2018-05-24 23:20 ` Paras Jha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).