DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] driver initialization in DPDK 2.0 built into a shared library.
@ 2015-07-14 18:21 Polevoy, Igor
  2015-07-14 18:41 ` Keunhong Lee
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Polevoy, Igor @ 2015-07-14 18:21 UTC (permalink / raw)
  To: dev

Hi,
We are developing an application that uses DPDK PMD functionality .
We are using a linux shared library which contains the network packets processing code and it is statically linked with all the necessary DPDK libs.
The .so is loaded by the main program.
For the DPDK compilation we have added the -fPIC to the GCC options.

While it all worked fine with DPDK 1.6 where we had the rte_pmd_init_all method, in the 2.0 version the
drivers registration methods (PMD_REGISTER_DRIVER) are not called when the shared library is loaded.

Although, I can go along the lines of the rte_pmd_init all and manually call the driver registration, I'm concerned
that DPDK has other drivers initialization calls, and I don't actually know which are needed or could be needed and when.

Do you have any advice on that? What is the best way to resolve this issue?

Thank you
Igor.

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

* Re: [dpdk-dev] driver initialization in DPDK 2.0 built into a shared library.
  2015-07-14 18:21 [dpdk-dev] driver initialization in DPDK 2.0 built into a shared library Polevoy, Igor
@ 2015-07-14 18:41 ` Keunhong Lee
  2015-07-20 23:57   ` Polevoy, Igor
  2015-07-15  9:14 ` Bruce Richardson
  2015-07-16 13:00 ` Zoltan Kiss
  2 siblings, 1 reply; 5+ messages in thread
From: Keunhong Lee @ 2015-07-14 18:41 UTC (permalink / raw)
  To: Polevoy, Igor; +Cc: dev

Did you tried 'mk/rte_app.mk' to build you application?
Simply including -lrte_pmd_xxx may cause problem because
PMD_REGISTER_DRIVER uses 'init' attribute,
which is called before the 'main' function.
See the 'start-group' and 'whole-archive' linker options.

Keunhong.


2015-07-15 3:21 GMT+09:00 Polevoy, Igor <Igor_Polevoy@mcafee.com>:

> Hi,
> We are developing an application that uses DPDK PMD functionality .
> We are using a linux shared library which contains the network packets
> processing code and it is statically linked with all the necessary DPDK
> libs.
> The .so is loaded by the main program.
> For the DPDK compilation we have added the -fPIC to the GCC options.
>
> While it all worked fine with DPDK 1.6 where we had the rte_pmd_init_all
> method, in the 2.0 version the
> drivers registration methods (PMD_REGISTER_DRIVER) are not called when the
> shared library is loaded.
>
> Although, I can go along the lines of the rte_pmd_init all and manually
> call the driver registration, I'm concerned
> that DPDK has other drivers initialization calls, and I don't actually
> know which are needed or could be needed and when.
>
> Do you have any advice on that? What is the best way to resolve this issue?
>
> Thank you
> Igor.
>
>

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

* Re: [dpdk-dev] driver initialization in DPDK 2.0 built into a shared library.
  2015-07-14 18:21 [dpdk-dev] driver initialization in DPDK 2.0 built into a shared library Polevoy, Igor
  2015-07-14 18:41 ` Keunhong Lee
@ 2015-07-15  9:14 ` Bruce Richardson
  2015-07-16 13:00 ` Zoltan Kiss
  2 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2015-07-15  9:14 UTC (permalink / raw)
  To: Polevoy, Igor; +Cc: dev

On Tue, Jul 14, 2015 at 06:21:33PM +0000, Polevoy, Igor wrote:
> Hi,
> We are developing an application that uses DPDK PMD functionality .
> We are using a linux shared library which contains the network packets processing code and it is statically linked with all the necessary DPDK libs.
> The .so is loaded by the main program.
> For the DPDK compilation we have added the -fPIC to the GCC options.
> 
> While it all worked fine with DPDK 1.6 where we had the rte_pmd_init_all method, in the 2.0 version the
> drivers registration methods (PMD_REGISTER_DRIVER) are not called when the shared library is loaded.
> 
> Although, I can go along the lines of the rte_pmd_init all and manually call the driver registration, I'm concerned
> that DPDK has other drivers initialization calls, and I don't actually know which are needed or could be needed and when.
> 
> Do you have any advice on that? What is the best way to resolve this issue?
> 
> Thank you
> Igor.
> 
You probably need to add the "no-as-needed" flag to your link command.

/Bruce

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

* Re: [dpdk-dev] driver initialization in DPDK 2.0 built into a shared library.
  2015-07-14 18:21 [dpdk-dev] driver initialization in DPDK 2.0 built into a shared library Polevoy, Igor
  2015-07-14 18:41 ` Keunhong Lee
  2015-07-15  9:14 ` Bruce Richardson
@ 2015-07-16 13:00 ` Zoltan Kiss
  2 siblings, 0 replies; 5+ messages in thread
From: Zoltan Kiss @ 2015-07-16 13:00 UTC (permalink / raw)
  To: Polevoy, Igor, dev



On 14/07/15 19:21, Polevoy, Igor wrote:
> Hi,
> We are developing an application that uses DPDK PMD functionality .
> We are using a linux shared library which contains the network packets processing code and it is statically linked with all the necessary DPDK libs.
> The .so is loaded by the main program.
> For the DPDK compilation we have added the -fPIC to the GCC options.
>
> While it all worked fine with DPDK 1.6 where we had the rte_pmd_init_all method, in the 2.0 version the
> drivers registration methods (PMD_REGISTER_DRIVER) are not called when the shared library is loaded.
>
> Although, I can go along the lines of the rte_pmd_init all and manually call the driver registration, I'm concerned
> that DPDK has other drivers initialization calls, and I don't actually know which are needed or could be needed and when.
>
> Do you have any advice on that? What is the best way to resolve this issue?
>
> Thank you
> Igor.
>

I've seen a similar problem, but in a different setup. My app (OVS) 
links to ODP-DPDK statically, which then links to DPDK code statically. 
I found that the devinitfn_* functions are not called because OVS 
doesn't call directly into the DPDK library, only into ODP-DPDK. The 
workaround for me was to refer to those functions in the ODP-DPDK code:

#define PMD_EXT(drv)  extern void devinitfn_##drv(void);
PMD_EXT(bond_drv)
PMD_EXT(em_pmd_drv)
...

But there might be better solutions than that. This one is fragile, if 
you update DPDK you have to remember adding these references for new PMDs.

Zoli

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

* Re: [dpdk-dev] driver initialization in DPDK 2.0 built into a shared library.
  2015-07-14 18:41 ` Keunhong Lee
@ 2015-07-20 23:57   ` Polevoy, Igor
  0 siblings, 0 replies; 5+ messages in thread
From: Polevoy, Igor @ 2015-07-20 23:57 UTC (permalink / raw)
  To: Keunhong Lee; +Cc: dev

After linking the shared library using –whole-archive and –start-group and allowing for multiple definitions also with –z,muldefs I have the situation when init is called two times and I’m  getting the core created inside the tailqinitfn_rte_uio_tailq
(eal_common_tailqs.c:153).
Commenting out the log print does not help as the method still returns -1 and goes to the rte_panic.

Igor

From: Keunhong Lee [mailto:dlrmsghd@gmail.com]
Sent: Tuesday, July 14, 2015 11:42 AM
To: Polevoy, Igor
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] driver initialization in DPDK 2.0 built into a shared library.

Did you tried 'mk/rte_app.mk<http://rte_app.mk>' to build you application?
Simply including -lrte_pmd_xxx may cause problem because
PMD_REGISTER_DRIVER uses 'init' attribute,
which is called before the 'main' function.
See the 'start-group' and 'whole-archive' linker options.

Keunhong.


2015-07-15 3:21 GMT+09:00 Polevoy, Igor <Igor_Polevoy@mcafee.com<mailto:Igor_Polevoy@mcafee.com>>:
Hi,
We are developing an application that uses DPDK PMD functionality .
We are using a linux shared library which contains the network packets processing code and it is statically linked with all the necessary DPDK libs.
The .so is loaded by the main program.
For the DPDK compilation we have added the -fPIC to the GCC options.

While it all worked fine with DPDK 1.6 where we had the rte_pmd_init_all method, in the 2.0 version the
drivers registration methods (PMD_REGISTER_DRIVER) are not called when the shared library is loaded.

Although, I can go along the lines of the rte_pmd_init all and manually call the driver registration, I'm concerned
that DPDK has other drivers initialization calls, and I don't actually know which are needed or could be needed and when.

Do you have any advice on that? What is the best way to resolve this issue?

Thank you
Igor.


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

end of thread, other threads:[~2015-07-21  0:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 18:21 [dpdk-dev] driver initialization in DPDK 2.0 built into a shared library Polevoy, Igor
2015-07-14 18:41 ` Keunhong Lee
2015-07-20 23:57   ` Polevoy, Igor
2015-07-15  9:14 ` Bruce Richardson
2015-07-16 13:00 ` Zoltan Kiss

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).