[dpdk-dev] [PATCH 03/15] pmd: Add PMD_REGISTER_DRIVER macro

Neil Horman nhorman at tuxdriver.com
Fri Apr 18 19:42:08 CEST 2014


On Fri, Apr 18, 2014 at 03:32:15PM +0200, Thomas Monjalon wrote:
> 2014-04-18 09:20, Neil Horman:
> > On Fri, Apr 18, 2014 at 02:08:56PM +0200, Thomas Monjalon wrote:
> > > 2014-04-18 08:04, Neil Horman:
> > > > On Fri, Apr 18, 2014 at 04:42:01AM -0700, Thomas Monjalon wrote:
> > > > > 2014-04-15 14:05, Neil Horman:
> > > > > > Rather than have each driver have to remember to add a constructor
> > > > > > to it
> > > > > > to
> > > > > > make sure its gets registered properly, wrap that process up in a
> > > > > > macro
> > > > > > to
> > > > > > make registration a one line affair.  This also sets the stage for
> > > > > > us to
> > > > > > make registration of vdev pmds and physical pmds a uniform process
> > > > > > 
> > > > > > Signed-off-by: Neil Horman <nhorman at tuxdriver.com>
> > > > > > 
> > > > > > --- /dev/null
> > > > > > +++ b/lib/librte_eal/common/include/rte_pmd.h
> > > > > 
> > > > > So you are creating a new header file for PMD API, right?
> > > > > 
> > > > > According to rte_ethdev.h,
> > > > > "The Ethernet Device API is composed of two parts:"
> > > > > "- The application-oriented Ethernet API"
> > > > > "- The driver-oriented Ethernet API"
> > > > > 
> > > > > So we should implement this macro in rte_ethdev.h.
> > > > > But maybe you prefer to split this file in two files. If so, please
> > > > > send a
> > > > > separated patch for that.
> > > > 
> > > > Actually I'm fine with moving the macro to another file, though if I do,
> > > > I
> > > > think merging it into rte_dev.h is more appropriate, as thats where the
> > > > driver registration function lives.
> > > 
> > > I'm not sure to understand what you're saying.
> > > My suggestion is to have 2 files in lib/librte_ether: 1 for application
> > > API
> > > and 1 for PMD API.
> > 
> > I'm suggesting not having 2 files at all, and merging rte_pmd.h into into
> > rte_dev.h, which is where all the rest of the device registration code lives
> > already.  Does that make sense?
> 
> Oh yes, I didn't understand because you speak about rte_dev.h which is 
> actually rte_ethdev.h.
> 
No, its not.  Oliviers patch set introduced rte_dev.h to add the driver
registration functions.  I had rte_pmd.h separately since we were apparently
developing in parallel.  Since you accepted his, I'm fine with merging the one
macro in rte_pmd.h into his rte_dev.h header, since the functionality all goes
together there.

> I'm fine with keeping it. I just was wondering if it would be a cleaner API by 
> splitting it as it has 2 very different roles.
> 
You've already got it split (rte_ethdev.h for ethernet interface registration,
and rte_dev.h for pmd driver registration).  The only reason rte_pmd.h still
exists is because thats what I had when I did my initial development.  The only
thing left to do is either merge the stuff in rte_dev.h into rte_pmd.h or merge
the stuff in rte_pmd.h into rte_dev.h.  Since rte_pmd.h only has one macro, it
seems merging it into rte_dev.h is more pragmatic.

Neil

> -- 
> Thomas
> 


More information about the dev mailing list