[dpdk-dev] [PATCH v2 2/3] eal: add new rte color definition

Ananyev, Konstantin konstantin.ananyev at intel.com
Tue Dec 18 11:38:22 CET 2018


Hi Reshma,

> > > > > > > > diff --git a/lib/librte_eal/common/include/rte_color.h
> > > > > > > b/lib/librte_eal/common/include/rte_color.h
> > > > > > > > new file mode 100644
> > > > > > > > index 000000000..f4387071b
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/lib/librte_eal/common/include/rte_color.h
> > > > > > > > @@ -0,0 +1,18 @@
> > > > > > > > +/* SPDX-License-Identifier: BSD-3-Clause
> > > > > > > > + * Copyright(c) 2018 Intel Corporation  */
> > > > > > > > +
> > > > > > > > +#ifndef _RTE_COLOR_H_
> > > > > > > > +#define _RTE_COLOR_H_
> > > > > > > > +
> > > > > > > > +/**
> > > > > > > > + * Color
> > > > > > > > + */
> > > > > > > > +enum rte_color {
> > > > > > > > +	RTE_COLOR_GREEN = 0, /**< Green */
> > > > > > > > +	RTE_COLOR_YELLOW, /**< Yellow */
> > > > > > > > +	RTE_COLOR_RED, /**< Red */
> > > > > > > > +	RTE_COLORS /**< Number of colors */ };
> > > > > > >
> > > > > > > Does it really belong to EAL?
> > > > > > > Konstantin
> > > > > > >
> > > > > >
> > > > > > Why not?
> > > > > >
> > > > > > It needs to be visible to multiple libraries: ethdev, meter,
> > > > > > sched, as well as drivers. We'd like to avoid adding more
> > > > > > complexity to
> > > > dependencies
> > > > > between libraries.
> > > > > >
> > > > > > It is very generic. EAL common/include is currently the place to
> > > > > > put generic data structures, functions, algs, etc that are
> > > > > > widely used by DPDK
> > > > > libraries. Lots of similar examples are easy to find in this folder.
> > > > >
> > > > > I don't think it is *that* generic to be in EAL.
> > > > > Yes it is used by few libs, ethdev and by softnic PMD, but it
> > > > > doesn't look as core dpdk thing to me.
> > > > >
> > > > > >
> > > > > > Where else would you put it?
> > > > >
> > > > > If it defines format of rte_mbuf fileds, then probably new .h
> > > > > inside
> > > > librte_mbuf is
> > > > > a good place.
> > > > > Other alternatives would be rte_ethdev or rte_net.
> > > >
> > > > After going through the lib/Makefile dependencies, I see we can have
> > > > rte_color.h in eal or mbuf library only.
> > > > Cannot keep it inside ethdev or net libraries because these two
> > > > libraries already have dependency  on mbuf library, so cannot create
> > > > loop dependency.
> > > >
> > > > Snippet
> > > >
> > > > 1) DEPDIRS-librte_eal := librte_kvargs
> > > >
> > > > 2)DEPDIRS-librte_mbuf := librte_eal librte_mempool
> > > >
> > > > 3)DEPDIRS-librte_ethdev := librte_net librte_eal librte_mempool
> > > > librte_ring DEPDIRS-librte_ethdev += librte_mbuf
> > > > DEPDIRS-librte_ethdev += librte_kvargs DEPDIRS-librte_ethdev +=
> > > > librte_cmdline
> > > >
> > > > 4) DEPDIRS-librte_net := librte_mbuf librte_eal
> > > >
> > > > 5) DEPDIRS-librte_meter := librte_eal
> > > >
> > > > Thanks,
> > > > Reshma
> > >
> > > Yes, I wound not mind to put this header file in librte_net, it makes
> > > sense to me. But librte_net depends on librte_mbuf, so then librte_net is not
> > an option.
> > >
> > > The only two options are librte_eal and librte_mbuf. Between these
> > > two, my vote was librte_eal (as we already have plenty of similar
> > > items in librte_eal/common/include) instead of librte_mbuf, as to me the
> > packet color is not related to how DPDK decides to pick its packet meta- data.
> > >
> > > To me, librte_eal/common/include is still the best option, but I guess I can live
> > with librte_mbuf in case Konstantin has a hard opinion on it.
> > >
> > > What is your choice, Konstantin?
> >
> > If to choose between EAL and mbuf - I would choose mbuf, that what I stated in
> > my previous mail, see above.
> > BTW, I probably missing something, but why rte_net is not an option?
> > What circular dependency you are talking about?
> > Konstantin
> >
> 
> Since librte_net has mbuf in its dependent list as below from lib/Makefile.
> i.e. DEPDIRS-librte_net := librte_mbuf librte_eal
> 
> So now, If we move rte_color.h to librte_net, then need to add librte_net to mbuf dependency list(as we are using rte_color.h in
> rte_mbuf.h)
> 
> Current mbuf dependency list is
> DEPDIRS-librte_mbuf := librte_eal librte_mempool
> 
> The new will be
> DEPDIRS-librte_mbuf := librte_eal librte_mempool librte_net
> 
> So this will create circular dependency, I think this is not allowed in DPDK right?

I understand that part, but why rte_color definitions have to be visible by rte_mbuf?
Do you refer it in rte_mbuf functions?
Konstantin

> 
> If my understanding is correct,  librte_net is not the correct place. Please clarify.





More information about the dev mailing list