All of lore.kernel.org
 help / color / mirror / Atom feed
* NXP DPAA2: Symbol renaming issue: Request for Suggestions
@ 2017-01-24 14:39 Shreyansh Jain
  2017-01-24 16:24 ` Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Shreyansh Jain @ 2017-01-24 14:39 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit, dev; +Cc: Hemant Agrawal

Hello,

We are facing a peculiar problem with respect to symbol namespace in DPDK. I
think Ferruh and Thomas would have fair idea about it as they have already
reviewed and commented on it. I was hoping to get some input to take it
forward from here.

Brief Intro to DPAA2 Architecture:

This is brief about NXP's DPAA2 PMD to start with:
(A lot more information is available at [1])

                                                    
                                                     
                 +-------------------------------+   
                 |         Application           |     
                 +----.--------------------.-----+     
                      |                    |           
                 +----'------+       +-----'-----+     
    drivers/---->|   DPIO    |       |   DPIO    |<---drivers/bus/fslmc
     bus/fslmc   +----.------+       +------.----+    
                      |                     |          
                 +----/-||--------------||--/----+     
                 |   Queue/Buffer Manager        |<--- drivers/common/dpaa2      
                 +----\-||--------------||--\----+      qbman
                      |                     |         
                 +----'------+       +------'----+     
    drivers/ --->|   DPNI    |       |   DPSEC   |<---drivers/cyrpto
     net/dpaa2   +----|------+       +-----|-----+     dpaa2_sec
                      |                    |          
                 +----|------+      +------|-----+       +----------------+
                 | PHY H/W   |      |   SEC H/W  |      .> FSL MC BUS     |
                 +-----------+      +------------+     / +----------------+
                                                      drivers/bus/fslmc
                                                      
          
If we consider the above layout, drivers/crypto/dpaa_sec (NXP's DPAA2 Crypto
PMD, already available on ML [2]), and drivers/net/dpaa2 (NXP's DPAA2 PMD) are
using a common code (drivers/common/dpaa2/qbman).

QBMAN (drivers/common/dpaa2/qbman) is essentially a Queue and Buffer Manager
set of APIs which allow DPIO (Data Path IO interfaces) to communicate with the
Hardware through queues (and buffers).

At the scan time, FSLMC bus is scanned and all devices (Phy or Sec) are
identified and added to a list. For each such device, appropriate I/O portals
are opened which are essentially gateway between user-space and DP* devices
using the hardware queues/buffers (qbman)

Problem:

You might have noticed that we have exposed a lot of symbols from
drivers/common and drivers/bus for drivers/net and drivers/crypto. All these 
symbols are not rte_* as what has been suggested for exported symbols.

Review comments have been received for renaming these to make them rte_* or
_rte_* prefixed.

Just as a side note, these symbols are being exposed _internally_ within
drivers/* area. 

There are (3) possible solutions we have:

1/ Rename all the symbols:
  - This is a difficult option for us. Renaming means breaking our linkage
    with existing code (Linux Kernel upstream candidate as well as internal
    repository).
  - Changing it means maintaining this change set internally/independently
    which is not a feasible long term solution.

2/ Merge all the libraries together:
  - In the initial RFC days, there were review comments which suggested that
    we should break the PMD into common libraries and place it in drivers/*
    parallel folders.
  - This is precisely the reason we are facing the situation.
  - Another possibility is to start duplicating the code for common. But, this
    too has a technical limitation for us as some data structures are shared
    across net and crypto and it is not possible to have multiple instances of
    those.
  - One more offshoot option could have been to keep the library external
    of the DPDK framework (external location and linked on demand basis,
    manually). We don't prefer this as this will make it difficult for any user
    to use DPAA2 easily.

3/ Finding a way to keep symbols internal to drivers/* independent of rte_*
   prefix:
   - For example, allowing symbols to be exposed limited to drivers/* area
     and not allowing them to be available across lib/* (not sure how, though!)
   
   <This is where I need you help - is there some suggestion or comments which
    can help us arrive to a solution?>
   
   My argument for this:
  - With new bus infra in place, there would be more drivers being contributed.
    It also means that there would be PMDs having their own code and symbol
    models. It would be difficult to ask all of them to mandatorily adhere
    to a naming scheme.
    This argument bodes well for lib/* because that is core (libraries) which
    should be controlled for uniformity and performance.

[1] https://www.kernel.org/doc/readme/drivers-staging-fsl-mc-README.txt
[2] http://dpdk.org/ml/archives/dev/2017-January/054251.html

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

* Re: NXP DPAA2: Symbol renaming issue: Request for Suggestions
  2017-01-24 14:39 NXP DPAA2: Symbol renaming issue: Request for Suggestions Shreyansh Jain
@ 2017-01-24 16:24 ` Ferruh Yigit
  2017-01-25 11:35   ` Shreyansh Jain
  2017-01-24 16:51 ` Thomas Monjalon
  2017-01-25 12:37 ` Neil Horman
  2 siblings, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2017-01-24 16:24 UTC (permalink / raw)
  To: Shreyansh Jain, Thomas Monjalon, dev; +Cc: Hemant Agrawal

On 1/24/2017 2:39 PM, Shreyansh Jain wrote:
> Hello,
> 
> We are facing a peculiar problem with respect to symbol namespace in DPDK. I
> think Ferruh and Thomas would have fair idea about it as they have already
> reviewed and commented on it. I was hoping to get some input to take it
> forward from here.
> 
> Brief Intro to DPAA2 Architecture:
> 
> This is brief about NXP's DPAA2 PMD to start with:
> (A lot more information is available at [1])
> 
>                                                     
>                                                      
>                  +-------------------------------+   
>                  |         Application           |     
>                  +----.--------------------.-----+     
>                       |                    |           
>                  +----'------+       +-----'-----+     
>     drivers/---->|   DPIO    |       |   DPIO    |<---drivers/bus/fslmc
>      bus/fslmc   +----.------+       +------.----+    
>                       |                     |          
>                  +----/-||--------------||--/----+     
>                  |   Queue/Buffer Manager        |<--- drivers/common/dpaa2      
>                  +----\-||--------------||--\----+      qbman
>                       |                     |         
>                  +----'------+       +------'----+     
>     drivers/ --->|   DPNI    |       |   DPSEC   |<---drivers/cyrpto
>      net/dpaa2   +----|------+       +-----|-----+     dpaa2_sec
>                       |                    |          
>                  +----|------+      +------|-----+       +----------------+
>                  | PHY H/W   |      |   SEC H/W  |      .> FSL MC BUS     |
>                  +-----------+      +------------+     / +----------------+
>                                                       drivers/bus/fslmc
>                                                       
>           
> If we consider the above layout, drivers/crypto/dpaa_sec (NXP's DPAA2 Crypto
> PMD, already available on ML [2]), and drivers/net/dpaa2 (NXP's DPAA2 PMD) are
> using a common code (drivers/common/dpaa2/qbman).
> 
> QBMAN (drivers/common/dpaa2/qbman) is essentially a Queue and Buffer Manager
> set of APIs which allow DPIO (Data Path IO interfaces) to communicate with the
> Hardware through queues (and buffers).
> 
> At the scan time, FSLMC bus is scanned and all devices (Phy or Sec) are
> identified and added to a list. For each such device, appropriate I/O portals
> are opened which are essentially gateway between user-space and DP* devices
> using the hardware queues/buffers (qbman)
> 
> Problem:
> 
> You might have noticed that we have exposed a lot of symbols from
> drivers/common and drivers/bus for drivers/net and drivers/crypto. All these 
> symbols are not rte_* as what has been suggested for exported symbols.
> 
> Review comments have been received for renaming these to make them rte_* or
> _rte_* prefixed.
> 
> Just as a side note, these symbols are being exposed _internally_ within
> drivers/* area. 
> 
> There are (3) possible solutions we have:

What do you think about following:

Create wrappers for DPDK with namespace, and export those for DPDK.
And in the user side, create macros to convert them back.

sample: [1]

Although this may work, I am not sure this really worth the effort, if
there is no intended consumer of these API other than dpaa2 code.


[1]
======

API .c (no modification):
int func_foo() {};
------

wrapper.c (new file):
int rte_foo() {	return func_foo(); }
------

*version.map:
	...
	rte_foo;
	...
------

user dpdk_macro.h (new file):
#define func_foo rte_foo
...
------

user.c (no modification except include):
#include "dpdk_macro.h"

func_foo();

======

	


> 
> 1/ Rename all the symbols:
>   - This is a difficult option for us. Renaming means breaking our linkage
>     with existing code (Linux Kernel upstream candidate as well as internal
>     repository).
>   - Changing it means maintaining this change set internally/independently
>     which is not a feasible long term solution.
> 
> 2/ Merge all the libraries together:
>   - In the initial RFC days, there were review comments which suggested that
>     we should break the PMD into common libraries and place it in drivers/*
>     parallel folders.
>   - This is precisely the reason we are facing the situation.
>   - Another possibility is to start duplicating the code for common. But, this
>     too has a technical limitation for us as some data structures are shared
>     across net and crypto and it is not possible to have multiple instances of
>     those.
>   - One more offshoot option could have been to keep the library external
>     of the DPDK framework (external location and linked on demand basis,
>     manually). We don't prefer this as this will make it difficult for any user
>     to use DPAA2 easily.
> 
> 3/ Finding a way to keep symbols internal to drivers/* independent of rte_*
>    prefix:
>    - For example, allowing symbols to be exposed limited to drivers/* area
>      and not allowing them to be available across lib/* (not sure how, though!)
>    
>    <This is where I need you help - is there some suggestion or comments which
>     can help us arrive to a solution?>
>    
>    My argument for this:
>   - With new bus infra in place, there would be more drivers being contributed.
>     It also means that there would be PMDs having their own code and symbol
>     models. It would be difficult to ask all of them to mandatorily adhere
>     to a naming scheme.
>     This argument bodes well for lib/* because that is core (libraries) which
>     should be controlled for uniformity and performance.
> 
> [1] https://www.kernel.org/doc/readme/drivers-staging-fsl-mc-README.txt
> [2] http://dpdk.org/ml/archives/dev/2017-January/054251.html
> 

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

* Re: NXP DPAA2: Symbol renaming issue: Request for Suggestions
  2017-01-24 14:39 NXP DPAA2: Symbol renaming issue: Request for Suggestions Shreyansh Jain
  2017-01-24 16:24 ` Ferruh Yigit
@ 2017-01-24 16:51 ` Thomas Monjalon
  2017-01-25 12:37 ` Neil Horman
  2 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2017-01-24 16:51 UTC (permalink / raw)
  To: Shreyansh Jain; +Cc: Ferruh Yigit, dev, Hemant Agrawal

2017-01-24 14:39, Shreyansh Jain:
> You might have noticed that we have exposed a lot of symbols from
> drivers/common and drivers/bus for drivers/net and drivers/crypto. All these 
> symbols are not rte_* as what has been suggested for exported symbols.
> 
> Review comments have been received for renaming these to make them rte_* or
> _rte_* prefixed.
> 
> Just as a side note, these symbols are being exposed _internally_ within
> drivers/* area. 
> 
> There are (3) possible solutions we have:
> 
> 1/ Rename all the symbols:
>   - This is a difficult option for us. Renaming means breaking our linkage
>     with existing code (Linux Kernel upstream candidate as well as internal
>     repository).
>   - Changing it means maintaining this change set internally/independently
>     which is not a feasible long term solution.

I don't understand the problem.
You can have a DPDK layer which rename functions and structs.

> 2/ Merge all the libraries together:
>   - In the initial RFC days, there were review comments which suggested that
>     we should break the PMD into common libraries and place it in drivers/*
>     parallel folders.
>   - This is precisely the reason we are facing the situation.
>   - Another possibility is to start duplicating the code for common. But, this
>     too has a technical limitation for us as some data structures are shared
>     across net and crypto and it is not possible to have multiple instances of
>     those.
>   - One more offshoot option could have been to keep the library external
>     of the DPDK framework (external location and linked on demand basis,
>     manually). We don't prefer this as this will make it difficult for any user
>     to use DPAA2 easily.

Yes, it was my first comment. If this layer is common with other projects,
why not maintaining it as a standalone library?

> 3/ Finding a way to keep symbols internal to drivers/* independent of rte_*
>    prefix:
>    - For example, allowing symbols to be exposed limited to drivers/* area
>      and not allowing them to be available across lib/* (not sure how, though!)
>    
>    <This is where I need you help - is there some suggestion or comments which
>     can help us arrive to a solution?>

There is currently no difference between API symbols and inter-libs symbols.

>    My argument for this:
>   - With new bus infra in place, there would be more drivers being contributed.
>     It also means that there would be PMDs having their own code and symbol
>     models. It would be difficult to ask all of them to mandatorily adhere
>     to a naming scheme.
>     This argument bodes well for lib/* because that is core (libraries) which
>     should be controlled for uniformity and performance.

I think it is acceptable to have some DPAA2-specific symbols with their own
namespace.

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

* Re: NXP DPAA2: Symbol renaming issue: Request for Suggestions
  2017-01-24 16:24 ` Ferruh Yigit
@ 2017-01-25 11:35   ` Shreyansh Jain
  0 siblings, 0 replies; 6+ messages in thread
From: Shreyansh Jain @ 2017-01-25 11:35 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Thomas Monjalon, dev, Hemant Agrawal

Hello Ferruh,

On Tuesday 24 January 2017 09:54 PM, Ferruh Yigit wrote:
> On 1/24/2017 2:39 PM, Shreyansh Jain wrote:
>> Hello,
>>
>> We are facing a peculiar problem with respect to symbol namespace in DPDK. I
>> think Ferruh and Thomas would have fair idea about it as they have already
>> reviewed and commented on it. I was hoping to get some input to take it
>> forward from here.
>>
>> Brief Intro to DPAA2 Architecture:
>>
>> This is brief about NXP's DPAA2 PMD to start with:
>> (A lot more information is available at [1])
>>
>>
>>
>>                  +-------------------------------+
>>                  |         Application           |
>>                  +----.--------------------.-----+
>>                       |                    |
>>                  +----'------+       +-----'-----+
>>     drivers/---->|   DPIO    |       |   DPIO    |<---drivers/bus/fslmc
>>      bus/fslmc   +----.------+       +------.----+
>>                       |                     |
>>                  +----/-||--------------||--/----+
>>                  |   Queue/Buffer Manager        |<--- drivers/common/dpaa2
>>                  +----\-||--------------||--\----+      qbman
>>                       |                     |
>>                  +----'------+       +------'----+
>>     drivers/ --->|   DPNI    |       |   DPSEC   |<---drivers/cyrpto
>>      net/dpaa2   +----|------+       +-----|-----+     dpaa2_sec
>>                       |                    |
>>                  +----|------+      +------|-----+       +----------------+
>>                  | PHY H/W   |      |   SEC H/W  |      .> FSL MC BUS     |
>>                  +-----------+      +------------+     / +----------------+
>>                                                       drivers/bus/fslmc
>>
>>
>> If we consider the above layout, drivers/crypto/dpaa_sec (NXP's DPAA2 Crypto
>> PMD, already available on ML [2]), and drivers/net/dpaa2 (NXP's DPAA2 PMD) are
>> using a common code (drivers/common/dpaa2/qbman).
>>
>> QBMAN (drivers/common/dpaa2/qbman) is essentially a Queue and Buffer Manager
>> set of APIs which allow DPIO (Data Path IO interfaces) to communicate with the
>> Hardware through queues (and buffers).
>>
>> At the scan time, FSLMC bus is scanned and all devices (Phy or Sec) are
>> identified and added to a list. For each such device, appropriate I/O portals
>> are opened which are essentially gateway between user-space and DP* devices
>> using the hardware queues/buffers (qbman)
>>
>> Problem:
>>
>> You might have noticed that we have exposed a lot of symbols from
>> drivers/common and drivers/bus for drivers/net and drivers/crypto. All these
>> symbols are not rte_* as what has been suggested for exported symbols.
>>
>> Review comments have been received for renaming these to make them rte_* or
>> _rte_* prefixed.
>>
>> Just as a side note, these symbols are being exposed _internally_ within
>> drivers/* area.
>>
>> There are (3) possible solutions we have:
>
> What do you think about following:
>
> Create wrappers for DPDK with namespace, and export those for DPDK.
> And in the user side, create macros to convert them back.
>
> sample: [1]
>
> Although this may work, I am not sure this really worth the effort, if
> there is no intended consumer of these API other than dpaa2 code.
>
>
> [1]
> ======
>
> API .c (no modification):
> int func_foo() {};
> ------
>
> wrapper.c (new file):
> int rte_foo() {	return func_foo(); }
> ------
>
> *version.map:
> 	...
> 	rte_foo;
> 	...
> ------
>
> user dpdk_macro.h (new file):
> #define func_foo rte_foo
> ....
> ------
>
> user.c (no modification except include):
> #include "dpdk_macro.h"
>
> func_foo();
>
> ======
>

I too considered this option (1/ below). But, this is an unclean
approach. Adding wrappers around functions is going to performance 
impact considering that all the code in this library is datapath.

Besides, it means we need to maintain our APIs across internal changes
(though, API changes are not frequent, I agree).

Another option being what Thomas suggested - to keep the library
external to DPDK. That is better than this but would impact ease of use.
(And I do remember some comments on ML about external libraries not
being preferred.)

But, thanks for your suggestion. I need to figure out something.

>
>
>>
>> 1/ Rename all the symbols:
>>   - This is a difficult option for us. Renaming means breaking our linkage
>>     with existing code (Linux Kernel upstream candidate as well as internal
>>     repository).
>>   - Changing it means maintaining this change set internally/independently
>>     which is not a feasible long term solution.
>>
>> 2/ Merge all the libraries together:
>>   - In the initial RFC days, there were review comments which suggested that
>>     we should break the PMD into common libraries and place it in drivers/*
>>     parallel folders.
>>   - This is precisely the reason we are facing the situation.
>>   - Another possibility is to start duplicating the code for common. But, this
>>     too has a technical limitation for us as some data structures are shared
>>     across net and crypto and it is not possible to have multiple instances of
>>     those.
>>   - One more offshoot option could have been to keep the library external
>>     of the DPDK framework (external location and linked on demand basis,
>>     manually). We don't prefer this as this will make it difficult for any user
>>     to use DPAA2 easily.
>>
>> 3/ Finding a way to keep symbols internal to drivers/* independent of rte_*
>>    prefix:
>>    - For example, allowing symbols to be exposed limited to drivers/* area
>>      and not allowing them to be available across lib/* (not sure how, though!)
>>
>>    <This is where I need you help - is there some suggestion or comments which
>>     can help us arrive to a solution?>
>>
>>    My argument for this:
>>   - With new bus infra in place, there would be more drivers being contributed.
>>     It also means that there would be PMDs having their own code and symbol
>>     models. It would be difficult to ask all of them to mandatorily adhere
>>     to a naming scheme.
>>     This argument bodes well for lib/* because that is core (libraries) which
>>     should be controlled for uniformity and performance.
>>
>> [1] https://www.kernel.org/doc/readme/drivers-staging-fsl-mc-README.txt
>> [2] http://dpdk.org/ml/archives/dev/2017-January/054251.html
>>
>
>

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

* Re: NXP DPAA2: Symbol renaming issue: Request for Suggestions
  2017-01-24 14:39 NXP DPAA2: Symbol renaming issue: Request for Suggestions Shreyansh Jain
  2017-01-24 16:24 ` Ferruh Yigit
  2017-01-24 16:51 ` Thomas Monjalon
@ 2017-01-25 12:37 ` Neil Horman
  2017-01-25 13:00   ` Shreyansh Jain
  2 siblings, 1 reply; 6+ messages in thread
From: Neil Horman @ 2017-01-25 12:37 UTC (permalink / raw)
  To: Shreyansh Jain; +Cc: Thomas Monjalon, Ferruh Yigit, dev, Hemant Agrawal

On Tue, Jan 24, 2017 at 02:39:56PM +0000, Shreyansh Jain wrote:
> Hello,
> 
> We are facing a peculiar problem with respect to symbol namespace in DPDK. I
> think Ferruh and Thomas would have fair idea about it as they have already
> reviewed and commented on it. I was hoping to get some input to take it
> forward from here.
> 
> Brief Intro to DPAA2 Architecture:
> 
> This is brief about NXP's DPAA2 PMD to start with:
> (A lot more information is available at [1])
> 
>                                                     
>                                                      
>                  +-------------------------------+   
>                  |         Application           |     
>                  +----.--------------------.-----+     
>                       |                    |           
>                  +----'------+       +-----'-----+     
>     drivers/---->|   DPIO    |       |   DPIO    |<---drivers/bus/fslmc
>      bus/fslmc   +----.------+       +------.----+    
>                       |                     |          
>                  +----/-||--------------||--/----+     
>                  |   Queue/Buffer Manager        |<--- drivers/common/dpaa2      
>                  +----\-||--------------||--\----+      qbman
>                       |                     |         
>                  +----'------+       +------'----+     
>     drivers/ --->|   DPNI    |       |   DPSEC   |<---drivers/cyrpto
>      net/dpaa2   +----|------+       +-----|-----+     dpaa2_sec
>                       |                    |          
>                  +----|------+      +------|-----+       +----------------+
>                  | PHY H/W   |      |   SEC H/W  |      .> FSL MC BUS     |
>                  +-----------+      +------------+     / +----------------+
>                                                       drivers/bus/fslmc
>                                                       
>           
> If we consider the above layout, drivers/crypto/dpaa_sec (NXP's DPAA2 Crypto
> PMD, already available on ML [2]), and drivers/net/dpaa2 (NXP's DPAA2 PMD) are
> using a common code (drivers/common/dpaa2/qbman).
> 
> QBMAN (drivers/common/dpaa2/qbman) is essentially a Queue and Buffer Manager
> set of APIs which allow DPIO (Data Path IO interfaces) to communicate with the
> Hardware through queues (and buffers).
> 
> At the scan time, FSLMC bus is scanned and all devices (Phy or Sec) are
> identified and added to a list. For each such device, appropriate I/O portals
> are opened which are essentially gateway between user-space and DP* devices
> using the hardware queues/buffers (qbman)
> 
> Problem:
> 
> You might have noticed that we have exposed a lot of symbols from
> drivers/common and drivers/bus for drivers/net and drivers/crypto. All these 
> symbols are not rte_* as what has been suggested for exported symbols.
> 
> Review comments have been received for renaming these to make them rte_* or
> _rte_* prefixed.
> 
> Just as a side note, these symbols are being exposed _internally_ within
> drivers/* area. 
> 
> There are (3) possible solutions we have:
> 
> 1/ Rename all the symbols:
>   - This is a difficult option for us. Renaming means breaking our linkage
>     with existing code (Linux Kernel upstream candidate as well as internal
>     repository).
>   - Changing it means maintaining this change set internally/independently
>     which is not a feasible long term solution.
> 
> 2/ Merge all the libraries together:
>   - In the initial RFC days, there were review comments which suggested that
>     we should break the PMD into common libraries and place it in drivers/*
>     parallel folders.
>   - This is precisely the reason we are facing the situation.
>   - Another possibility is to start duplicating the code for common. But, this
>     too has a technical limitation for us as some data structures are shared
>     across net and crypto and it is not possible to have multiple instances of
>     those.
>   - One more offshoot option could have been to keep the library external
>     of the DPDK framework (external location and linked on demand basis,
>     manually). We don't prefer this as this will make it difficult for any user
>     to use DPAA2 easily.
> 
> 3/ Finding a way to keep symbols internal to drivers/* independent of rte_*
>    prefix:
>    - For example, allowing symbols to be exposed limited to drivers/* area
>      and not allowing them to be available across lib/* (not sure how, though!)
>    
>    <This is where I need you help - is there some suggestion or comments which
>     can help us arrive to a solution?>
>    
>    My argument for this:
>   - With new bus infra in place, there would be more drivers being contributed.
>     It also means that there would be PMDs having their own code and symbol
>     models. It would be difficult to ask all of them to mandatorily adhere
>     to a naming scheme.
>     This argument bodes well for lib/* because that is core (libraries) which
>     should be controlled for uniformity and performance.
> 
> [1] https://www.kernel.org/doc/readme/drivers-staging-fsl-mc-README.txt
> [2] http://dpdk.org/ml/archives/dev/2017-January/054251.html
> 
> 

So, Option 3 seems pretty easy, just use symbol aliasing.  Make all your
exported symbols static, and use the MAP_SATIC_SYMBOL macro (or use your own
inline asm if you want), to create rte_ aliases for them all, add the rte_*
variants to your version map and it should all work out.  You get to keep your
naming in tact, you can create some macro ifdeffery to make your names static or
not depending on your build environment (upstream linux kernel vs. dpdk, vs
something else), and just use the aliases when it suit you (like for dpdk naming
conventions)

Neil

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

* Re: NXP DPAA2: Symbol renaming issue: Request for Suggestions
  2017-01-25 12:37 ` Neil Horman
@ 2017-01-25 13:00   ` Shreyansh Jain
  0 siblings, 0 replies; 6+ messages in thread
From: Shreyansh Jain @ 2017-01-25 13:00 UTC (permalink / raw)
  To: Neil Horman; +Cc: Thomas Monjalon, Ferruh Yigit, dev, Hemant Agrawal

On Wednesday 25 January 2017 06:07 PM, Neil Horman wrote:
> On Tue, Jan 24, 2017 at 02:39:56PM +0000, Shreyansh Jain wrote:
>> Hello,
>>
>> We are facing a peculiar problem with respect to symbol namespace in DPDK. I
>> think Ferruh and Thomas would have fair idea about it as they have already
>> reviewed and commented on it. I was hoping to get some input to take it
>> forward from here.
>>
>> Brief Intro to DPAA2 Architecture:
>>
>> This is brief about NXP's DPAA2 PMD to start with:
>> (A lot more information is available at [1])
>>
>>
>>
>>                  +-------------------------------+
>>                  |         Application           |
>>                  +----.--------------------.-----+
>>                       |                    |
>>                  +----'------+       +-----'-----+
>>     drivers/---->|   DPIO    |       |   DPIO    |<---drivers/bus/fslmc
>>      bus/fslmc   +----.------+       +------.----+
>>                       |                     |
>>                  +----/-||--------------||--/----+
>>                  |   Queue/Buffer Manager        |<--- drivers/common/dpaa2
>>                  +----\-||--------------||--\----+      qbman
>>                       |                     |
>>                  +----'------+       +------'----+
>>     drivers/ --->|   DPNI    |       |   DPSEC   |<---drivers/cyrpto
>>      net/dpaa2   +----|------+       +-----|-----+     dpaa2_sec
>>                       |                    |
>>                  +----|------+      +------|-----+       +----------------+
>>                  | PHY H/W   |      |   SEC H/W  |      .> FSL MC BUS     |
>>                  +-----------+      +------------+     / +----------------+
>>                                                       drivers/bus/fslmc
>>
>>
>> If we consider the above layout, drivers/crypto/dpaa_sec (NXP's DPAA2 Crypto
>> PMD, already available on ML [2]), and drivers/net/dpaa2 (NXP's DPAA2 PMD) are
>> using a common code (drivers/common/dpaa2/qbman).
>>
>> QBMAN (drivers/common/dpaa2/qbman) is essentially a Queue and Buffer Manager
>> set of APIs which allow DPIO (Data Path IO interfaces) to communicate with the
>> Hardware through queues (and buffers).
>>
>> At the scan time, FSLMC bus is scanned and all devices (Phy or Sec) are
>> identified and added to a list. For each such device, appropriate I/O portals
>> are opened which are essentially gateway between user-space and DP* devices
>> using the hardware queues/buffers (qbman)
>>
>> Problem:
>>
>> You might have noticed that we have exposed a lot of symbols from
>> drivers/common and drivers/bus for drivers/net and drivers/crypto. All these
>> symbols are not rte_* as what has been suggested for exported symbols.
>>
>> Review comments have been received for renaming these to make them rte_* or
>> _rte_* prefixed.
>>
>> Just as a side note, these symbols are being exposed _internally_ within
>> drivers/* area.
>>
>> There are (3) possible solutions we have:
>>
>> 1/ Rename all the symbols:
>>   - This is a difficult option for us. Renaming means breaking our linkage
>>     with existing code (Linux Kernel upstream candidate as well as internal
>>     repository).
>>   - Changing it means maintaining this change set internally/independently
>>     which is not a feasible long term solution.
>>
>> 2/ Merge all the libraries together:
>>   - In the initial RFC days, there were review comments which suggested that
>>     we should break the PMD into common libraries and place it in drivers/*
>>     parallel folders.
>>   - This is precisely the reason we are facing the situation.
>>   - Another possibility is to start duplicating the code for common. But, this
>>     too has a technical limitation for us as some data structures are shared
>>     across net and crypto and it is not possible to have multiple instances of
>>     those.
>>   - One more offshoot option could have been to keep the library external
>>     of the DPDK framework (external location and linked on demand basis,
>>     manually). We don't prefer this as this will make it difficult for any user
>>     to use DPAA2 easily.
>>
>> 3/ Finding a way to keep symbols internal to drivers/* independent of rte_*
>>    prefix:
>>    - For example, allowing symbols to be exposed limited to drivers/* area
>>      and not allowing them to be available across lib/* (not sure how, though!)
>>
>>    <This is where I need you help - is there some suggestion or comments which
>>     can help us arrive to a solution?>
>>
>>    My argument for this:
>>   - With new bus infra in place, there would be more drivers being contributed.
>>     It also means that there would be PMDs having their own code and symbol
>>     models. It would be difficult to ask all of them to mandatorily adhere
>>     to a naming scheme.
>>     This argument bodes well for lib/* because that is core (libraries) which
>>     should be controlled for uniformity and performance.
>>
>> [1] https://www.kernel.org/doc/readme/drivers-staging-fsl-mc-README.txt
>> [2] http://dpdk.org/ml/archives/dev/2017-January/054251.html
>>
>>
>
> So, Option 3 seems pretty easy, just use symbol aliasing.  Make all your
> exported symbols static, and use the MAP_SATIC_SYMBOL macro (or use your own
> inline asm if you want), to create rte_ aliases for them all, add the rte_*
> variants to your version map and it should all work out.  You get to keep your
> naming in tact, you can create some macro ifdeffery to make your names static or
> not depending on your build environment (upstream linux kernel vs. dpdk, vs
> something else), and just use the aliases when it suit you (like for dpdk naming
> conventions)

Thanks. Sounds interesting, though something I will need to
investigate. I will experiment on this.

>
> Neil
>
>

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

end of thread, other threads:[~2017-01-25 12:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 14:39 NXP DPAA2: Symbol renaming issue: Request for Suggestions Shreyansh Jain
2017-01-24 16:24 ` Ferruh Yigit
2017-01-25 11:35   ` Shreyansh Jain
2017-01-24 16:51 ` Thomas Monjalon
2017-01-25 12:37 ` Neil Horman
2017-01-25 13:00   ` Shreyansh Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.