[dpdk-dev] [PATCH 4/4] eal/x86: implement arch-specific TSC freq query
Bruce Richardson
bruce.richardson at intel.com
Fri Oct 13 17:17:49 CEST 2017
On Fri, Oct 13, 2017 at 08:13:06AM -0700, Stephen Hemminger wrote:
> On Fri, 13 Oct 2017 09:30:43 +0200
> Thomas Monjalon <thomas at monjalon.net> wrote:
>
> > 13/10/2017 05:47, Stephen Hemminger:
> > > On Fri, 13 Oct 2017 02:02:47 +0200
> > > Thomas Monjalon <thomas at monjalon.net> wrote:
> > >
> > > > +static uint32_t
> > > > +check_model_wsm_nhm(uint8_t model)
> > > > +{
> > > > + switch (model) {
> > > > + /* Westmere */
> > > > + case 0x25:
> > > > + case 0x2C:
> > > > + case 0x2F:
> > > > + /* Nehalem */
> > > > + case 0x1E:
> > > > + case 0x1F:
> > > > + case 0x1A:
> > > > + case 0x2E:
> > > > + return 1;
> > > > + }
> > > > +
> > > > + return 0;
> > > > +}
> > >
> > > How about a table rather than switch?
> > > Also bool rather than int?
> >
> > It is a matter of taste :)
> > I plan to push it as is. It can be changed later if desired.
>
> Also using #define's rather than magic constants would help.
Assuming that we could just come up with more meaningful names that help
more than just have a comment indicating what uarch's each set of
numbers is for. :-)
For me, I don't think #defines are needed to enhance readability here.
More information about the dev
mailing list