From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 2EACC2BCE for ; Thu, 25 Feb 2016 22:31:14 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP; 25 Feb 2016 13:30:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,498,1449561600"; d="scan'208";a="753358306" Received: from blesueur-mobl1.ger.corp.intel.com ([10.252.7.68]) by orsmga003.jf.intel.com with SMTP; 25 Feb 2016 13:30:55 -0800 Received: by (sSMTP sendmail emulation); Thu, 25 Feb 2016 21:30:54 +0025 Date: Thu, 25 Feb 2016 21:30:54 +0000 From: Bruce Richardson To: Aaron Conole Message-ID: <20160225213054.GA14936@bricha3-MOBL3> References: <1456426121-21423-1-git-send-email-aconole@redhat.com> <1456426121-21423-2-git-send-email-aconole@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456426121-21423-2-git-send-email-aconole@redhat.com> Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 1/8] lpm: Fix pointer aliasing issues X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2016 21:31:14 -0000 On Thu, Feb 25, 2016 at 01:48:34PM -0500, Aaron Conole wrote: > The current implementation attempts to use a uint16_t to alias the lpm table > structures. Such aliasing can break optimizer performance. This patch uses > union type indirection and adds static inline functions for performing the > aliasing. > > Signed-off-by: Aaron Conole > --- > lib/librte_lpm/rte_lpm.h | 53 +++++++++++++++++++++++++++++++++++++----------- > 1 file changed, 41 insertions(+), 12 deletions(-) > > diff --git a/lib/librte_lpm/rte_lpm.h b/lib/librte_lpm/rte_lpm.h > index c299ce2..eae6ff1 100644 > --- a/lib/librte_lpm/rte_lpm.h > +++ b/lib/librte_lpm/rte_lpm.h > @@ -157,6 +157,33 @@ struct rte_lpm { > }; > > /** > + * Convert from tbl_entry types to integer types > + */ > +static inline uint16_t > +rte_lpm_tbl24_entry_to_uint16(const struct rte_lpm_tbl24_entry *entry) > +{ > + union { > + uint16_t i; > + struct rte_lpm_tbl24_entry s; > + } tbl_entry_u; > + > + tbl_entry_u.s = *entry; > + return tbl_entry_u.i; > +} > + > +static inline uint16_t > +rte_lpm_tbl8_entry_to_uint16(const struct rte_lpm_tbl8_entry *entry) > +{ > + union { > + uint16_t i; > + struct rte_lpm_tbl8_entry s; > + } tbl_entry_u; > + > + tbl_entry_u.s = *entry; > + return tbl_entry_u.i; > +} > + These two new functions could be reduced to one with the help of patch: http://dpdk.org/dev/patchwork/patch/9087/ Anyone care to go back and review or ack that patch for me and simplify all the lpm code just that little bit? /Bruce