From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 71BDF1B74E for ; Fri, 13 Oct 2017 17:17:56 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Oct 2017 08:17:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,371,1503385200"; d="scan'208";a="1205521091" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.37]) by fmsmga001.fm.intel.com with SMTP; 13 Oct 2017 08:17:53 -0700 Received: by (sSMTP sendmail emulation); Fri, 13 Oct 2017 16:17:49 +0100 Date: Fri, 13 Oct 2017 16:17:49 +0100 From: Bruce Richardson To: Stephen Hemminger Cc: Thomas Monjalon , gowrishankar.m@linux.vnet.ibm.com, jerin.jacob@caviumnetworks.com, jianbo.liu@linaro.org, sergio.gonzalez.monroy@intel.com, dev@dpdk.org Message-ID: <20171013151749.GA54072@bricha3-MOBL3.ger.corp.intel.com> References: <20171013000247.4158-5-thomas@monjalon.net> <20171012204724.120d7b25@xeon-e3> <1683017.mmorKbpdtt@xps> <20171013081306.15b4a494@xeon-e3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171013081306.15b4a494@xeon-e3> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.8.3 (2017-05-23) Subject: Re: [dpdk-dev] [PATCH 4/4] eal/x86: implement arch-specific TSC freq query X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Oct 2017 15:17:59 -0000 On Fri, Oct 13, 2017 at 08:13:06AM -0700, Stephen Hemminger wrote: > On Fri, 13 Oct 2017 09:30:43 +0200 > Thomas Monjalon wrote: > > > 13/10/2017 05:47, Stephen Hemminger: > > > On Fri, 13 Oct 2017 02:02:47 +0200 > > > Thomas Monjalon 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.