[dpdk-dev,1/3] eal/drivers: prefix driver REGISTER macros with EAL

Message ID a64af194-3c5f-b38e-70ce-3c3f69a844d9@nxp.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Shreyansh Jain Oct. 7, 2016, 1:41 p.m. UTC
  Hi David, Thomas,

On Friday 07 October 2016 07:03 PM, Shreyansh Jain wrote:
> DRIVER_REGISTER_PCI -> EAL_REGISTER_PCI
> DRIVER_REGISTER_PCI_TABLE -> EAL_REGISTER_PCI_TABLE
>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
>  doc/guides/prog_guide/dev_kit_build_system.rst | 2 +-
>  drivers/crypto/qat/rte_qat_cryptodev.c         | 4 ++--
>  drivers/net/bnx2x/bnx2x_ethdev.c               | 8 ++++----
>  drivers/net/bnxt/bnxt_ethdev.c                 | 4 ++--
>  drivers/net/cxgbe/cxgbe_ethdev.c               | 4 ++--
>  drivers/net/e1000/em_ethdev.c                  | 4 ++--
>  drivers/net/e1000/igb_ethdev.c                 | 8 ++++----
>  drivers/net/ena/ena_ethdev.c                   | 4 ++--
>  drivers/net/enic/enic_ethdev.c                 | 4 ++--
>  drivers/net/fm10k/fm10k_ethdev.c               | 4 ++--
>  drivers/net/i40e/i40e_ethdev.c                 | 4 ++--
>  drivers/net/i40e/i40e_ethdev_vf.c              | 4 ++--
>  drivers/net/ixgbe/ixgbe_ethdev.c               | 8 ++++----
>  drivers/net/mlx4/mlx4.c                        | 2 +-
>  drivers/net/mlx5/mlx5.c                        | 2 +-
>  drivers/net/nfp/nfp_net.c                      | 4 ++--
>  drivers/net/qede/qede_ethdev.c                 | 8 ++++----
>  drivers/net/szedata2/rte_eth_szedata2.c        | 4 ++--
>  drivers/net/thunderx/nicvf_ethdev.c            | 4 ++--
>  drivers/net/virtio/virtio_ethdev.c             | 2 +-
>  drivers/net/vmxnet3/vmxnet3_ethdev.c           | 4 ++--
>  lib/librte_eal/common/include/rte_dev.h        | 2 +-
>  lib/librte_eal/common/include/rte_pci.h        | 2 +-
>  23 files changed, 48 insertions(+), 48 deletions(-)
>
[...]

Ideally there should be a another patch like below as part of the series:

--->8---

--->8---

But unfortunately, my build system complained about this. (and I stopped 
short of sending this patch).

The output of compilation after this patch is something like:

--->8---
   CC eal_pci_vfio.o
   PMDINFO eal_pci_vfio.o.pmd.c
/bin/sh: 1: 
/home/shreyansh/build/DPDK/02_dpdk/x86_64-native-linuxapp-gcc/app/dpdk-pmdinfogen: 
not found
/home/shreyansh/build/DPDK/02_dpdk/mk/internal/rte.compile-pre.mk:138: 
recipe for target 'eal_pci_vfio.o' failed
--->8---

I don't think PMDINFO should be running on eal_pci_vfio file. Isn't it? 
Is it because EAL_REGISTER_* is matching EAL_REGISTER_TAILQ like macro 
as well?

I am not very well versed with how PMDINFO is linking with the build 
system so any hints/insight into this would be really helpful.

One I get more clarity on this, I will push a new version of this patch.

-
Shreyansh
  

Comments

Thomas Monjalon Oct. 7, 2016, 1:51 p.m. UTC | #1
2016-10-07 19:11, Shreyansh Jain:
> --- a/mk/internal/rte.compile-pre.mk
> +++ b/mk/internal/rte.compile-pre.mk
> @@ -87,7 +87,7 @@ endif
>   PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
>   PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
>   PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
> -PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
> +PMDINFO_TO_O = if grep 'EAL_REGISTER_.*(.*)' $<; then \
>          echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
>          $(PMDINFO_GEN) && \
>          echo "$(if $V,$(PMDINFO_CC),  CC $@.pmd.o)" && \
> 
> --->8---
>    CC eal_pci_vfio.o
>    PMDINFO eal_pci_vfio.o.pmd.c
> /bin/sh: 1: 
> /home/shreyansh/build/DPDK/02_dpdk/x86_64-native-linuxapp-gcc/app/dpdk-pmdinfogen: 
> not found
> /home/shreyansh/build/DPDK/02_dpdk/mk/internal/rte.compile-pre.mk:138: 
> recipe for target 'eal_pci_vfio.o' failed
> --->8---
> 
> I don't think PMDINFO should be running on eal_pci_vfio file. Isn't it? 

Every files are scanned for the pattern.

> Is it because EAL_REGISTER_* is matching EAL_REGISTER_TAILQ like macro 
> as well?

Probably.
That's another argument in favor of good prefixes.
I think you should use RTE_DRIVER_REGISTER_ or better, RTE_PMD_REGISTER_
> 
> I am not very well versed with how PMDINFO is linking with the build 
> system so any hints/insight into this would be really helpful.
> 
> One I get more clarity on this, I will push a new version of this patch.

Thanks
  
Neil Horman Oct. 7, 2016, 2:18 p.m. UTC | #2
On Fri, Oct 07, 2016 at 03:51:44PM +0200, Thomas Monjalon wrote:
> 2016-10-07 19:11, Shreyansh Jain:
> > --- a/mk/internal/rte.compile-pre.mk
> > +++ b/mk/internal/rte.compile-pre.mk
> > @@ -87,7 +87,7 @@ endif
> >   PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
> >   PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
> >   PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
> > -PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
> > +PMDINFO_TO_O = if grep 'EAL_REGISTER_.*(.*)' $<; then \
> >          echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
> >          $(PMDINFO_GEN) && \
> >          echo "$(if $V,$(PMDINFO_CC),  CC $@.pmd.o)" && \
> > 
> > --->8---
> >    CC eal_pci_vfio.o
> >    PMDINFO eal_pci_vfio.o.pmd.c
> > /bin/sh: 1: 
> > /home/shreyansh/build/DPDK/02_dpdk/x86_64-native-linuxapp-gcc/app/dpdk-pmdinfogen: 
> > not found
> > /home/shreyansh/build/DPDK/02_dpdk/mk/internal/rte.compile-pre.mk:138: 
> > recipe for target 'eal_pci_vfio.o' failed
> > --->8---
> > 
> > I don't think PMDINFO should be running on eal_pci_vfio file. Isn't it? 
> 
> Every files are scanned for the pattern.
> 
> > Is it because EAL_REGISTER_* is matching EAL_REGISTER_TAILQ like macro 
> > as well?
> 
> Probably.
> That's another argument in favor of good prefixes.
> I think you should use RTE_DRIVER_REGISTER_ or better, RTE_PMD_REGISTER_
Thats what we had, about 4 changes to this macro ago, and yes, that made alot
more sense, to grep on a more complete version of the macro name to ensure a
unique match.  You might just look for the regex
EAL_REGISTER_VDEV|EAL_REGISTER_PCI with grep -E

Neil



> > 
> > I am not very well versed with how PMDINFO is linking with the build 
> > system so any hints/insight into this would be really helpful.
> > 
> > One I get more clarity on this, I will push a new version of this patch.
> 
> Thanks
>
  
Shreyansh Jain Oct. 8, 2016, 1 p.m. UTC | #3
Hi Thomas,

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Friday, October 07, 2016 7:22 PM
> To: Shreyansh Jain <shreyansh.jain@nxp.com>
> Cc: david.marchand@6wind.com; dev@dpdk.org
> Subject: Re: [PATCH 1/3] eal/drivers: prefix driver REGISTER macros with EAL
> 
> 2016-10-07 19:11, Shreyansh Jain:
> > --- a/mk/internal/rte.compile-pre.mk
> > +++ b/mk/internal/rte.compile-pre.mk
> > @@ -87,7 +87,7 @@ endif
> >   PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
> >   PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
> >   PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
> > -PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
> > +PMDINFO_TO_O = if grep 'EAL_REGISTER_.*(.*)' $<; then \
> >          echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
> >          $(PMDINFO_GEN) && \
> >          echo "$(if $V,$(PMDINFO_CC),  CC $@.pmd.o)" && \
> >
> > --->8---
> >    CC eal_pci_vfio.o
> >    PMDINFO eal_pci_vfio.o.pmd.c
> > /bin/sh: 1:
> > /home/shreyansh/build/DPDK/02_dpdk/x86_64-native-linuxapp-gcc/app/dpdk-
> pmdinfogen:
> > not found
> > /home/shreyansh/build/DPDK/02_dpdk/mk/internal/rte.compile-pre.mk:138:
> > recipe for target 'eal_pci_vfio.o' failed
> > --->8---
> >
> > I don't think PMDINFO should be running on eal_pci_vfio file. Isn't it?
> 
> Every files are scanned for the pattern.
 
Sorry, I should have been clearer in my statement.
I meant, I didn't think eal_pci_vfio.o had anything of interest for the PMD tool and hence the mk files would have skipped over it in absence of a match.
I understand that PMDINFO would run on all files.

> 
> > Is it because EAL_REGISTER_* is matching EAL_REGISTER_TAILQ like macro
> > as well?
> 
> Probably.
> That's another argument in favor of good prefixes.
> I think you should use RTE_DRIVER_REGISTER_ or better, RTE_PMD_REGISTER_
 
I thought of EAL_PMD_REGISTER_* but dropped it because for PCI_TABLE like macros, the name got really long (EAL_PMD_REGISTER_PCI_TABLE()).
Anyways, I will use RTE_PMD_REGISTER_* now and send another version.

> >
> > I am not very well versed with how PMDINFO is linking with the build
> > system so any hints/insight into this would be really helpful.
> >
> > One I get more clarity on this, I will push a new version of this patch.
> 
> Thanks

-
Shreyansh
  
Shreyansh Jain Oct. 8, 2016, 1:01 p.m. UTC | #4
Hi Neil,

> -----Original Message-----
> From: Neil Horman [mailto:nhorman@tuxdriver.com]
> Sent: Friday, October 07, 2016 7:48 PM
> To: Thomas Monjalon <thomas.monjalon@6wind.com>
> Cc: Shreyansh Jain <shreyansh.jain@nxp.com>; david.marchand@6wind.com;
> dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 1/3] eal/drivers: prefix driver REGISTER
> macros with EAL
> 
> On Fri, Oct 07, 2016 at 03:51:44PM +0200, Thomas Monjalon wrote:
> > 2016-10-07 19:11, Shreyansh Jain:
> > > --- a/mk/internal/rte.compile-pre.mk
> > > +++ b/mk/internal/rte.compile-pre.mk
> > > @@ -87,7 +87,7 @@ endif
> > >   PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
> > >   PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
> > >   PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
> > > -PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
> > > +PMDINFO_TO_O = if grep 'EAL_REGISTER_.*(.*)' $<; then \
> > >          echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
> > >          $(PMDINFO_GEN) && \
> > >          echo "$(if $V,$(PMDINFO_CC),  CC $@.pmd.o)" && \
> > >
> > > --->8---
> > >    CC eal_pci_vfio.o
> > >    PMDINFO eal_pci_vfio.o.pmd.c
> > > /bin/sh: 1:
> > > /home/shreyansh/build/DPDK/02_dpdk/x86_64-native-linuxapp-gcc/app/dpdk-
> pmdinfogen:
> > > not found
> > > /home/shreyansh/build/DPDK/02_dpdk/mk/internal/rte.compile-pre.mk:138:
> > > recipe for target 'eal_pci_vfio.o' failed
> > > --->8---
> > >
> > > I don't think PMDINFO should be running on eal_pci_vfio file. Isn't it?
> >
> > Every files are scanned for the pattern.
> >
> > > Is it because EAL_REGISTER_* is matching EAL_REGISTER_TAILQ like macro
> > > as well?
> >
> > Probably.
> > That's another argument in favor of good prefixes.
> > I think you should use RTE_DRIVER_REGISTER_ or better, RTE_PMD_REGISTER_
> Thats what we had, about 4 changes to this macro ago, and yes, that made alot
> more sense, to grep on a more complete version of the macro name to ensure a
> unique match.  You might just look for the regex
> EAL_REGISTER_VDEV|EAL_REGISTER_PCI with grep -E
 
Thanks. I will use this grep.

> 
> Neil
> 
> 
> 
> > >
> > > I am not very well versed with how PMDINFO is linking with the build
> > > system so any hints/insight into this would be really helpful.
> > >
> > > One I get more clarity on this, I will push a new version of this patch.
> >
> > Thanks
> >

-
Shreyansh
  
Neil Horman Oct. 10, 2016, 12:56 p.m. UTC | #5
On Sat, Oct 08, 2016 at 01:00:59PM +0000, Shreyansh Jain wrote:
> Hi Thomas,
> 
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > Sent: Friday, October 07, 2016 7:22 PM
> > To: Shreyansh Jain <shreyansh.jain@nxp.com>
> > Cc: david.marchand@6wind.com; dev@dpdk.org
> > Subject: Re: [PATCH 1/3] eal/drivers: prefix driver REGISTER macros with EAL
> > 
> > 2016-10-07 19:11, Shreyansh Jain:
> > > --- a/mk/internal/rte.compile-pre.mk
> > > +++ b/mk/internal/rte.compile-pre.mk
> > > @@ -87,7 +87,7 @@ endif
> > >   PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
> > >   PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
> > >   PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
> > > -PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
> > > +PMDINFO_TO_O = if grep 'EAL_REGISTER_.*(.*)' $<; then \
> > >          echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
> > >          $(PMDINFO_GEN) && \
> > >          echo "$(if $V,$(PMDINFO_CC),  CC $@.pmd.o)" && \
> > >
> > > --->8---
> > >    CC eal_pci_vfio.o
> > >    PMDINFO eal_pci_vfio.o.pmd.c
> > > /bin/sh: 1:
> > > /home/shreyansh/build/DPDK/02_dpdk/x86_64-native-linuxapp-gcc/app/dpdk-
> > pmdinfogen:
> > > not found
> > > /home/shreyansh/build/DPDK/02_dpdk/mk/internal/rte.compile-pre.mk:138:
> > > recipe for target 'eal_pci_vfio.o' failed
> > > --->8---
> > >
> > > I don't think PMDINFO should be running on eal_pci_vfio file. Isn't it?
> > 
> > Every files are scanned for the pattern.
>  
> Sorry, I should have been clearer in my statement.
> I meant, I didn't think eal_pci_vfio.o had anything of interest for the PMD tool and hence the mk files would have skipped over it in absence of a match.
> I understand that PMDINFO would run on all files.
> 
Thats incorrect, the Makefile does a REGEX search for appropriate registration
macros that imply the need for pmdinfo to run.  If its running on an
inappropriate file its because your new macros inadvertently match the current
regex, hence my suggestion that the regex should be tuned to be more specific

Neil

> > 
> > > Is it because EAL_REGISTER_* is matching EAL_REGISTER_TAILQ like macro
> > > as well?
> > 
> > Probably.
> > That's another argument in favor of good prefixes.
> > I think you should use RTE_DRIVER_REGISTER_ or better, RTE_PMD_REGISTER_
>  
> I thought of EAL_PMD_REGISTER_* but dropped it because for PCI_TABLE like macros, the name got really long (EAL_PMD_REGISTER_PCI_TABLE()).
> Anyways, I will use RTE_PMD_REGISTER_* now and send another version.
> 
> > >
> > > I am not very well versed with how PMDINFO is linking with the build
> > > system so any hints/insight into this would be really helpful.
> > >
> > > One I get more clarity on this, I will push a new version of this patch.
> > 
> > Thanks
> 
> -
> Shreyansh
>
  
Shreyansh Jain Oct. 11, 2016, 6:36 a.m. UTC | #6
On Monday 10 October 2016 06:26 PM, Neil Horman wrote:
> On Sat, Oct 08, 2016 at 01:00:59PM +0000, Shreyansh Jain wrote:
>> Hi Thomas,
>>
>>> -----Original Message-----
>>> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
>>> Sent: Friday, October 07, 2016 7:22 PM
>>> To: Shreyansh Jain <shreyansh.jain@nxp.com>
>>> Cc: david.marchand@6wind.com; dev@dpdk.org
>>> Subject: Re: [PATCH 1/3] eal/drivers: prefix driver REGISTER macros with EAL
>>>
>>> 2016-10-07 19:11, Shreyansh Jain:
>>>> --- a/mk/internal/rte.compile-pre.mk
>>>> +++ b/mk/internal/rte.compile-pre.mk
>>>> @@ -87,7 +87,7 @@ endif
>>>>   PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
>>>>   PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
>>>>   PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
>>>> -PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
>>>> +PMDINFO_TO_O = if grep 'EAL_REGISTER_.*(.*)' $<; then \
>>>>          echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
>>>>          $(PMDINFO_GEN) && \
>>>>          echo "$(if $V,$(PMDINFO_CC),  CC $@.pmd.o)" && \
>>>>
>>>> --->8---
>>>>    CC eal_pci_vfio.o
>>>>    PMDINFO eal_pci_vfio.o.pmd.c
>>>> /bin/sh: 1:
>>>> /home/shreyansh/build/DPDK/02_dpdk/x86_64-native-linuxapp-gcc/app/dpdk-
>>> pmdinfogen:
>>>> not found
>>>> /home/shreyansh/build/DPDK/02_dpdk/mk/internal/rte.compile-pre.mk:138:
>>>> recipe for target 'eal_pci_vfio.o' failed
>>>> --->8---
>>>>
>>>> I don't think PMDINFO should be running on eal_pci_vfio file. Isn't it?
>>>
>>> Every files are scanned for the pattern.
>>
>> Sorry, I should have been clearer in my statement.
>> I meant, I didn't think eal_pci_vfio.o had anything of interest for the PMD tool and hence the mk files would have skipped over it in absence of a match.
>> I understand that PMDINFO would run on all files.
>>
> Thats incorrect, the Makefile does a REGEX search for appropriate registration
> macros that imply the need for pmdinfo to run.  If its running on an
> inappropriate file its because your new macros inadvertently match the current
> regex, hence my suggestion that the regex should be tuned to be more specific

Agree. Thats is what I wanted to clarify as stated below: 
"...EAL_REGISTER_* (macro name has changed since) is matching 
EAL_REGISTER_TAILQ..".

As for 'more specific' match - I did suggest [2] a longer more specific 
version but Thomas had a different view point [1]. You can have a look 
at [2] and let me know your suggestion or if that is wrong.

[1] http://dpdk.org/ml/archives/dev/2016-October/048425.html
[2] http://dpdk.org/ml/archives/dev/2016-October/048407.html

>
> Neil
>
>>>
>>>> Is it because EAL_REGISTER_* is matching EAL_REGISTER_TAILQ like macro
>>>> as well?
>>>
>>> Probably.
>>> That's another argument in favor of good prefixes.
>>> I think you should use RTE_DRIVER_REGISTER_ or better, RTE_PMD_REGISTER_
>>
>> I thought of EAL_PMD_REGISTER_* but dropped it because for PCI_TABLE like macros, the name got really long (EAL_PMD_REGISTER_PCI_TABLE()).
>> Anyways, I will use RTE_PMD_REGISTER_* now and send another version.
>>
>>>>
>>>> I am not very well versed with how PMDINFO is linking with the build
>>>> system so any hints/insight into this would be really helpful.
>>>>
>>>> One I get more clarity on this, I will push a new version of this patch.
>>>
>>> Thanks
>>
>> -
>> Shreyansh
>>
>

-
Shreyansh
  
Thomas Monjalon Oct. 11, 2016, 7:27 a.m. UTC | #7
2016-10-11 12:06, Shreyansh Jain:
> On Monday 10 October 2016 06:26 PM, Neil Horman wrote:
> > On Sat, Oct 08, 2016 at 01:00:59PM +0000, Shreyansh Jain wrote:
> >> Hi Thomas,
> >>
> >>> -----Original Message-----
> >>> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> >>> Sent: Friday, October 07, 2016 7:22 PM
> >>> To: Shreyansh Jain <shreyansh.jain@nxp.com>
> >>> Cc: david.marchand@6wind.com; dev@dpdk.org
> >>> Subject: Re: [PATCH 1/3] eal/drivers: prefix driver REGISTER macros with EAL
> >>>
> >>> 2016-10-07 19:11, Shreyansh Jain:
> >>>> --- a/mk/internal/rte.compile-pre.mk
> >>>> +++ b/mk/internal/rte.compile-pre.mk
> >>>> @@ -87,7 +87,7 @@ endif
> >>>>   PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
> >>>>   PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
> >>>>   PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
> >>>> -PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
> >>>> +PMDINFO_TO_O = if grep 'EAL_REGISTER_.*(.*)' $<; then \
> >>>>          echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
> >>>>          $(PMDINFO_GEN) && \
> >>>>          echo "$(if $V,$(PMDINFO_CC),  CC $@.pmd.o)" && \
> >>>>
> >>>> --->8---
> >>>>    CC eal_pci_vfio.o
> >>>>    PMDINFO eal_pci_vfio.o.pmd.c
> >>>> /bin/sh: 1:
> >>>> /home/shreyansh/build/DPDK/02_dpdk/x86_64-native-linuxapp-gcc/app/dpdk-
> >>> pmdinfogen:
> >>>> not found
> >>>> /home/shreyansh/build/DPDK/02_dpdk/mk/internal/rte.compile-pre.mk:138:
> >>>> recipe for target 'eal_pci_vfio.o' failed
> >>>> --->8---
> >>>>
> >>>> I don't think PMDINFO should be running on eal_pci_vfio file. Isn't it?
> >>>
> >>> Every files are scanned for the pattern.
> >>
> >> Sorry, I should have been clearer in my statement.
> >> I meant, I didn't think eal_pci_vfio.o had anything of interest for the PMD tool and hence the mk files would have skipped over it in absence of a match.
> >> I understand that PMDINFO would run on all files.
> >>
> > Thats incorrect, the Makefile does a REGEX search for appropriate registration
> > macros that imply the need for pmdinfo to run.  If its running on an
> > inappropriate file its because your new macros inadvertently match the current
> > regex, hence my suggestion that the regex should be tuned to be more specific
> 
> Agree. Thats is what I wanted to clarify as stated below: 
> "...EAL_REGISTER_* (macro name has changed since) is matching 
> EAL_REGISTER_TAILQ..".
> 
> As for 'more specific' match - I did suggest [2] a longer more specific 
> version but Thomas had a different view point [1]. You can have a look 
> at [2] and let me know your suggestion or if that is wrong.
> 
> [1] http://dpdk.org/ml/archives/dev/2016-October/048425.html
> [2] http://dpdk.org/ml/archives/dev/2016-October/048407.html

I do not have a different point of view :)
We need to be more specific than EAL_REGISTER_*.
And RTE_PMD_REGISTER_* is specific enough. That's all :)
  
Neil Horman Oct. 11, 2016, 1:38 p.m. UTC | #8
On Tue, Oct 11, 2016 at 12:06:27PM +0530, Shreyansh Jain wrote:
> On Monday 10 October 2016 06:26 PM, Neil Horman wrote:
> > On Sat, Oct 08, 2016 at 01:00:59PM +0000, Shreyansh Jain wrote:
> > > Hi Thomas,
> > > 
> > > > -----Original Message-----
> > > > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > > > Sent: Friday, October 07, 2016 7:22 PM
> > > > To: Shreyansh Jain <shreyansh.jain@nxp.com>
> > > > Cc: david.marchand@6wind.com; dev@dpdk.org
> > > > Subject: Re: [PATCH 1/3] eal/drivers: prefix driver REGISTER macros with EAL
> > > > 
> > > > 2016-10-07 19:11, Shreyansh Jain:
> > > > > --- a/mk/internal/rte.compile-pre.mk
> > > > > +++ b/mk/internal/rte.compile-pre.mk
> > > > > @@ -87,7 +87,7 @@ endif
> > > > >   PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
> > > > >   PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
> > > > >   PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
> > > > > -PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
> > > > > +PMDINFO_TO_O = if grep 'EAL_REGISTER_.*(.*)' $<; then \
> > > > >          echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
> > > > >          $(PMDINFO_GEN) && \
> > > > >          echo "$(if $V,$(PMDINFO_CC),  CC $@.pmd.o)" && \
> > > > > 
> > > > > --->8---
> > > > >    CC eal_pci_vfio.o
> > > > >    PMDINFO eal_pci_vfio.o.pmd.c
> > > > > /bin/sh: 1:
> > > > > /home/shreyansh/build/DPDK/02_dpdk/x86_64-native-linuxapp-gcc/app/dpdk-
> > > > pmdinfogen:
> > > > > not found
> > > > > /home/shreyansh/build/DPDK/02_dpdk/mk/internal/rte.compile-pre.mk:138:
> > > > > recipe for target 'eal_pci_vfio.o' failed
> > > > > --->8---
> > > > > 
> > > > > I don't think PMDINFO should be running on eal_pci_vfio file. Isn't it?
> > > > 
> > > > Every files are scanned for the pattern.
> > > 
> > > Sorry, I should have been clearer in my statement.
> > > I meant, I didn't think eal_pci_vfio.o had anything of interest for the PMD tool and hence the mk files would have skipped over it in absence of a match.
> > > I understand that PMDINFO would run on all files.
> > > 
> > Thats incorrect, the Makefile does a REGEX search for appropriate registration
> > macros that imply the need for pmdinfo to run.  If its running on an
> > inappropriate file its because your new macros inadvertently match the current
> > regex, hence my suggestion that the regex should be tuned to be more specific
> 
> Agree. Thats is what I wanted to clarify as stated below: "...EAL_REGISTER_*
> (macro name has changed since) is matching EAL_REGISTER_TAILQ..".
> 
> As for 'more specific' match - I did suggest [2] a longer more specific
> version but Thomas had a different view point [1]. You can have a look at
> [2] and let me know your suggestion or if that is wrong.
> 
> [1] http://dpdk.org/ml/archives/dev/2016-October/048425.html
> [2] http://dpdk.org/ml/archives/dev/2016-October/048407.html
> 
Right, so I'm on the same page as Thomas, in that the "RTE_PMD_REGISTER_.*("
regex is sufficient in the current state.  However, your patches are changing
the registration macros from something that is sufficiently unique for pmdinfo
to detect to something that collides with an inappropriate match (the
EAL_REGISTER_TAILQ macro), and so you have to make the regex more specific.

This also begs the question in my mind, is it really worth changing the macro?
I really don't think it is.  The registration macros are pretty descriptive as
they stand, and have already changed 3 or 4 times in the last 6 months, which
suggests to me that any change here is really just churn more than meaningful
change.  You can make the argument that the name might be more in line with the
library its implemented in or what not, but in truth, its easy to understand
what the macros do (in their previous or current incantations), and any change
that just makes them the same as other macros in their naming is really more
trouble than its worth.

Neil


Neil

> > 
> > Neil
> > 
> > > > 
> > > > > Is it because EAL_REGISTER_* is matching EAL_REGISTER_TAILQ like macro
> > > > > as well?
> > > > 
> > > > Probably.
> > > > That's another argument in favor of good prefixes.
> > > > I think you should use RTE_DRIVER_REGISTER_ or better, RTE_PMD_REGISTER_
> > > 
> > > I thought of EAL_PMD_REGISTER_* but dropped it because for PCI_TABLE like macros, the name got really long (EAL_PMD_REGISTER_PCI_TABLE()).
> > > Anyways, I will use RTE_PMD_REGISTER_* now and send another version.
> > > 
> > > > > 
> > > > > I am not very well versed with how PMDINFO is linking with the build
> > > > > system so any hints/insight into this would be really helpful.
> > > > > 
> > > > > One I get more clarity on this, I will push a new version of this patch.
> > > > 
> > > > Thanks
> > > 
> > > -
> > > Shreyansh
> > > 
> > 
> 
> -
> Shreyansh
>
  
Thomas Monjalon Oct. 11, 2016, 1:57 p.m. UTC | #9
2016-10-11 09:38, Neil Horman:
> This also begs the question in my mind, is it really worth changing the macro?
> I really don't think it is.  The registration macros are pretty descriptive as
> they stand, and have already changed 3 or 4 times in the last 6 months, which
> suggests to me that any change here is really just churn more than meaningful
> change.  You can make the argument that the name might be more in line with the
> library its implemented in or what not, but in truth, its easy to understand
> what the macros do (in their previous or current incantations), and any change
> that just makes them the same as other macros in their naming is really more
> trouble than its worth.

Neil, the long term goal is to stop having some identifiers which do not
start with RTE_ in our exported .h files.
I think it is a reasonable policy, for a library, to live in a well defined
namespace.
  
Neil Horman Oct. 11, 2016, 2:57 p.m. UTC | #10
On Tue, Oct 11, 2016 at 03:57:29PM +0200, Thomas Monjalon wrote:
> 2016-10-11 09:38, Neil Horman:
> > This also begs the question in my mind, is it really worth changing the macro?
> > I really don't think it is.  The registration macros are pretty descriptive as
> > they stand, and have already changed 3 or 4 times in the last 6 months, which
> > suggests to me that any change here is really just churn more than meaningful
> > change.  You can make the argument that the name might be more in line with the
> > library its implemented in or what not, but in truth, its easy to understand
> > what the macros do (in their previous or current incantations), and any change
> > that just makes them the same as other macros in their naming is really more
> > trouble than its worth.
> 
> Neil, the long term goal is to stop having some identifiers which do not
> start with RTE_ in our exported .h files.
> I think it is a reasonable policy, for a library, to live in a well defined
> namespace.
> 

I don't disagree that a consistent namespace is a nice thing, only that we've
had 3 changes to these macros in the last few months, none of which have really
moved us toward that goal.  

At least we can agree that the EAL_ macro being proposed isn't the right thing
to do regardless of motivation :)

Neil
  
Shreyansh Jain Oct. 12, 2016, 4:29 a.m. UTC | #11
On Tuesday 11 October 2016 08:27 PM, Neil Horman wrote:
> On Tue, Oct 11, 2016 at 03:57:29PM +0200, Thomas Monjalon wrote:
>> 2016-10-11 09:38, Neil Horman:
>>> This also begs the question in my mind, is it really worth changing the macro?
>>> I really don't think it is.  The registration macros are pretty descriptive as
>>> they stand, and have already changed 3 or 4 times in the last 6 months, which
>>> suggests to me that any change here is really just churn more than meaningful
>>> change.  You can make the argument that the name might be more in line with the
>>> library its implemented in or what not, but in truth, its easy to understand
>>> what the macros do (in their previous or current incantations), and any change
>>> that just makes them the same as other macros in their naming is really more
>>> trouble than its worth.
>>
>> Neil, the long term goal is to stop having some identifiers which do not
>> start with RTE_ in our exported .h files.
>> I think it is a reasonable policy, for a library, to live in a well defined
>> namespace.

Understood and agreed.

>>
>
> I don't disagree that a consistent namespace is a nice thing, only that we've
> had 3 changes to these macros in the last few months, none of which have really
> moved us toward that goal.
>
> At least we can agree that the EAL_ macro being proposed isn't the right thing
> to do regardless of motivation :)

Macro proposed by this patch is not EAL_*. Thomas had already suggested 
that change for v1; v3 changes it to RTE_PMD_REGISTER_*.

--->8---
  DRIVER_REGISTER_PCI -> RTE_PMD_REGISTER_PCI
  DRIVER_REGISTER_PCI_TABLE -> RTE_PMD_REGISTER_PCI_TABLE
  DRIVER_REGISTER_VDEV -> RTE_PMD_REGISTER_VDEV
  DRIVER_REGISTER_PARAM_STRING -> RTE_PMD_REGISTER_PARAM_STRING
  DRIVER_EXPORT_* -> RTE_PMD_EXPORT_*
--->8---

-
Shreyansh
  

Patch

diff --git a/mk/internal/rte.compile-pre.mk b/mk/internal/rte.compile-pre.mk
index a42ef03..a91c265 100644
--- a/mk/internal/rte.compile-pre.mk
+++ b/mk/internal/rte.compile-pre.mk
@@ -87,7 +87,7 @@  endif
  PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
  PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c
  PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
-PMDINFO_TO_O = if grep -q 'DRIVER_REGISTER_.*(.*)' $<; then \
+PMDINFO_TO_O = if grep 'EAL_REGISTER_.*(.*)' $<; then \
         echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
         $(PMDINFO_GEN) && \
         echo "$(if $V,$(PMDINFO_CC),  CC $@.pmd.o)" && \