DPDK usage discussions
 help / color / mirror / Atom feed
From: Paras Jha <dreadiscool@gmail.com>
To: contact@filipjaniszewski.com
Cc: users@dpdk.org
Subject: Re: [dpdk-users] Difference between APP and LIB
Date: Thu, 24 May 2018 16:20:39 -0700	[thread overview]
Message-ID: <CAMs8r4NP5=8juss4SVRsJoSn1+o9AbVpX2c0==7FZbxmSRco=A@mail.gmail.com> (raw)
In-Reply-To: <a0b8e762-8d2a-7a68-3611-b32e236c30a2@filipjaniszewski.com>

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
>

      reply	other threads:[~2018-05-24 23:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24 13:34 Filip Janiszewski
2018-05-24 23:20 ` Paras Jha [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMs8r4NP5=8juss4SVRsJoSn1+o9AbVpX2c0==7FZbxmSRco=A@mail.gmail.com' \
    --to=dreadiscool@gmail.com \
    --cc=contact@filipjaniszewski.com \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).