DPDK usage discussions
 help / color / mirror / Atom feed
* rte_eth_dev_count_avail returns different value in library
@ 2022-10-28  9:45 Robert Hable
  2022-10-28 10:48 ` Dmitry Kozlyuk
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Hable @ 2022-10-28  9:45 UTC (permalink / raw)
  To: users

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

Hello,

I am trying to build a static library based on the skeleton example. My problem is when calling rte_eth_dev_count_avail() I always receive 0 in the static library. When I start the skeleton example app as a regular exe file, then it returns 2.
What could be the reason that rte_eth_dev_count_avail() returns different values depending on if it is an exe application or a static library?

rte_eal_init() is called in both applications with the default parameters.
Both processes are running under the same administrator user.

I am using Windows Server 2022 with a Mellanox ConnectX-4 on DPDK V 22.11.0-rc0.

Kind regards,
Robert Hable


[-- Attachment #2: Type: text/html, Size: 2980 bytes --]

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

* Re: rte_eth_dev_count_avail returns different value in library
  2022-10-28  9:45 rte_eth_dev_count_avail returns different value in library Robert Hable
@ 2022-10-28 10:48 ` Dmitry Kozlyuk
  2022-11-11 13:51   ` AW: " Robert Hable
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Kozlyuk @ 2022-10-28 10:48 UTC (permalink / raw)
  To: Robert Hable; +Cc: users

2022-10-28 09:45 (UTC+0000), Robert Hable:
> Hello,
> 
> I am trying to build a static library based on the skeleton example. My problem is when calling rte_eth_dev_count_avail() I always receive 0 in the static library. When I start the skeleton example app as a regular exe file, then it returns 2.
> What could be the reason that rte_eth_dev_count_avail() returns different values depending on if it is an exe application or a static library?
> 
> rte_eal_init() is called in both applications with the default parameters.
> Both processes are running under the same administrator user.
> 
> I am using Windows Server 2022 with a Mellanox ConnectX-4 on DPDK V 22.11.0-rc0.
> 
> Kind regards,
> Robert Hable
> 

Hi Robert,

Are you building DPDK as static libraries?
Shared build is currently non-functional on Windows.

If so, are you linking PMD libraries (librte_common_mlx5, librte_net_mlx5)
to the application that is using your static library?
If relevant PMD libraries are not linked, HW will not be discovered
(same for mempools BTW).

It is irrelevant from where rte_eth_dev_count_avail() is called,
but please check that in both cases it is done after rte_eal_init().

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

* AW: rte_eth_dev_count_avail returns different value in library
  2022-10-28 10:48 ` Dmitry Kozlyuk
@ 2022-11-11 13:51   ` Robert Hable
  2022-11-11 14:48     ` Dmitry Kozlyuk
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Hable @ 2022-11-11 13:51 UTC (permalink / raw)
  To: Dmitry Kozlyuk; +Cc: users

Hello Dimitry,

Yes, I am building DPDK as static library. As far as I have seen it should also be the default option on windows builds?

I tried linking the following libraries to my application, which is using my own dpdk-library, but I had no success in using any dpdk functionality (rte_eth_dev_count_avail() returns 0).
In the linker output I found out that the libraries are currently unused:

1>Unused libraries:
1>  C:\Dev\Extern\dpdk\build\lib\librte_eal.a
1>  C:\Dev\Extern\dpdk\build\lib\librte_mbuf.a
1>  C:\Dev\Extern\dpdk\build\lib\librte_mempool.a
1>  C:\Dev\Extern\dpdk\build\lib\librte_ethdev.a
1>  C:\Dev\Extern\dpdk\build\drivers\librte_common_mlx5.a
1>  C:\Dev\Extern\dpdk\build\drivers\librte_net_mlx5.a

Do you have any other ideas what I am missing there and why they are not linked to it? Is it may be possible to include all the PMD libraries already in my own library, so I only need to link against one library?
Yes, rte_eth_dev_count_avail() is called directly after rte_eal_init().

By the way I am using the visual studio 2022 compiler to build my own application and clang for compiling dpdk if that matters.

Kind regards,
Robert

-----Ursprüngliche Nachricht-----
Von: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> 
Gesendet: Freitag, 28. Oktober 2022 12:48
An: Robert Hable <Robert.Hable@spusu.at>
Cc: users@dpdk.org
Betreff: Re: rte_eth_dev_count_avail returns different value in library

2022-10-28 09:45 (UTC+0000), Robert Hable:
> Hello,
> 
> I am trying to build a static library based on the skeleton example. My problem is when calling rte_eth_dev_count_avail() I always receive 0 in the static library. When I start the skeleton example app as a regular exe file, then it returns 2.
> What could be the reason that rte_eth_dev_count_avail() returns different values depending on if it is an exe application or a static library?
> 
> rte_eal_init() is called in both applications with the default parameters.
> Both processes are running under the same administrator user.
> 
> I am using Windows Server 2022 with a Mellanox ConnectX-4 on DPDK V 22.11.0-rc0.
> 
> Kind regards,
> Robert Hable
> 

Hi Robert,

Are you building DPDK as static libraries?
Shared build is currently non-functional on Windows.

If so, are you linking PMD libraries (librte_common_mlx5, librte_net_mlx5) to the application that is using your static library?
If relevant PMD libraries are not linked, HW will not be discovered (same for mempools BTW).

It is irrelevant from where rte_eth_dev_count_avail() is called, but please check that in both cases it is done after rte_eal_init().

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

* Re: rte_eth_dev_count_avail returns different value in library
  2022-11-11 13:51   ` AW: " Robert Hable
@ 2022-11-11 14:48     ` Dmitry Kozlyuk
  2022-11-17  9:17       ` AW: " Robert Hable
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Kozlyuk @ 2022-11-11 14:48 UTC (permalink / raw)
  To: Robert Hable; +Cc: users

2022-11-11 13:51 (UTC+0000), Robert Hable:
> Hello Dimitry,
> 
> Yes, I am building DPDK as static library. As far as I have seen it should also be the default option on windows builds?

DPDK builds both static and dynamic libraries by default
("default_library=static" means that DPDK apps will use static libraries).
However, DLLs don't work on Windows currently.

> I tried linking the following libraries to my application, which is using my own dpdk-library, but I had no success in using any dpdk functionality (rte_eth_dev_count_avail() returns 0).
> In the linker output I found out that the libraries are currently unused:
> 
> 1>Unused libraries:
> 1>  C:\Dev\Extern\dpdk\build\lib\librte_eal.a
> 1>  C:\Dev\Extern\dpdk\build\lib\librte_mbuf.a
> 1>  C:\Dev\Extern\dpdk\build\lib\librte_mempool.a
> 1>  C:\Dev\Extern\dpdk\build\lib\librte_ethdev.a

I'm puzzled why these four are unused.
If the DLL using rte_eth_dev_count_avail() links successfully,
the linked must use "librte_ethdev.a".

> 1>  C:\Dev\Extern\dpdk\build\drivers\librte_common_mlx5.a
> 1>  C:\Dev\Extern\dpdk\build\drivers\librte_net_mlx5.a  
> 
> Do you have any other ideas what I am missing there and why they are not linked to it? Is it may be possible to include all the PMD libraries already in my own library, so I only need to link against one library?
> Yes, rte_eth_dev_count_avail() is called directly after rte_eal_init().
> 
> By the way I am using the visual studio 2022 compiler to build my own application and clang for compiling dpdk if that matters.

Please try /WHOLEARCHIVE for these libraries as documented here:

https://learn.microsoft.com/en-us/cpp/build/reference/wholearchive-include-all-library-object-files?view=msvc-160

On Unices, PMDs are also linked using a similar --whole-archive option.
This is needed because there are no direct references from DPDK libraries
to PMDs, because PMDs register themselves at startup.

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

* AW: rte_eth_dev_count_avail returns different value in library
  2022-11-11 14:48     ` Dmitry Kozlyuk
@ 2022-11-17  9:17       ` Robert Hable
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Hable @ 2022-11-17  9:17 UTC (permalink / raw)
  To: Dmitry Kozlyuk; +Cc: users

Hello Dimitry,

thank you! I got it working now using /WHOLEARCHIVE.
I just needed to link mlx5devx.lib from the DevX SDK as well to my application.

Kind regards,
Robert

-----Ursprüngliche Nachricht-----
Von: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> 
Gesendet: Freitag, 11. November 2022 15:49
An: Robert Hable <Robert.Hable@spusu.at>
Cc: users@dpdk.org
Betreff: Re: rte_eth_dev_count_avail returns different value in library

2022-11-11 13:51 (UTC+0000), Robert Hable:
> Hello Dimitry,
> 
> Yes, I am building DPDK as static library. As far as I have seen it should also be the default option on windows builds?

DPDK builds both static and dynamic libraries by default ("default_library=static" means that DPDK apps will use static libraries).
However, DLLs don't work on Windows currently.

> I tried linking the following libraries to my application, which is using my own dpdk-library, but I had no success in using any dpdk functionality (rte_eth_dev_count_avail() returns 0).
> In the linker output I found out that the libraries are currently unused:
> 
> 1>Unused libraries:
> 1>  C:\Dev\Extern\dpdk\build\lib\librte_eal.a
> 1>  C:\Dev\Extern\dpdk\build\lib\librte_mbuf.a
> 1>  C:\Dev\Extern\dpdk\build\lib\librte_mempool.a
> 1>  C:\Dev\Extern\dpdk\build\lib\librte_ethdev.a

I'm puzzled why these four are unused.
If the DLL using rte_eth_dev_count_avail() links successfully, the linked must use "librte_ethdev.a".

> 1>  C:\Dev\Extern\dpdk\build\drivers\librte_common_mlx5.a
> 1>  C:\Dev\Extern\dpdk\build\drivers\librte_net_mlx5.a
> 
> Do you have any other ideas what I am missing there and why they are not linked to it? Is it may be possible to include all the PMD libraries already in my own library, so I only need to link against one library?
> Yes, rte_eth_dev_count_avail() is called directly after rte_eal_init().
> 
> By the way I am using the visual studio 2022 compiler to build my own application and clang for compiling dpdk if that matters.

Please try /WHOLEARCHIVE for these libraries as documented here:

https://learn.microsoft.com/en-us/cpp/build/reference/wholearchive-include-all-library-object-files?view=msvc-160

On Unices, PMDs are also linked using a similar --whole-archive option.
This is needed because there are no direct references from DPDK libraries to PMDs, because PMDs register themselves at startup.

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

end of thread, other threads:[~2022-11-17  9:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28  9:45 rte_eth_dev_count_avail returns different value in library Robert Hable
2022-10-28 10:48 ` Dmitry Kozlyuk
2022-11-11 13:51   ` AW: " Robert Hable
2022-11-11 14:48     ` Dmitry Kozlyuk
2022-11-17  9:17       ` AW: " Robert Hable

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