DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xuelin Shi <xuelin.shi@freescale.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] librte_lpm: define tbl entry reversely for big endian
Date: Mon, 9 Mar 2015 01:54:06 +0000	[thread overview]
Message-ID: <CY1PR0301MB0684F68641BAFBDBF80BCFB2861B0@CY1PR0301MB0684.namprd03.prod.outlook.com> (raw)
In-Reply-To: <20150306111332.GB9352@bricha3-MOBL3>

Hi Bruce,

Yes, the patch http://dpdk.org/dev/patchwork/patch/3132/ should be abandoned.

Thanks,
Shi xuelin

> -----Original Message-----
> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Friday, March 06, 2015 19:14
> To: Shi Xuelin-B29237
> Cc: thomas.monjalon@6wind.com; dev@dpdk.org
> Subject: Re: [PATCH] librte_lpm: define tbl entry reversely for big
> endian
> 
> On Thu, Mar 05, 2015 at 02:12:12AM +0000, Xuelin Shi wrote:
> > Hi Bruce,
> >
> > Yes, it needs to swap the fields. The bit field is first identified as
> the uint8_t and then packed.
> >
> > Thanks,
> > Shi xuelin
> >
> Am I right in thinking that this patch set supercedes that for
> "lpm: use field access instead of type conversion"
> http://dpdk.org/dev/patchwork/patch/3132/ ?
> 
> > > -----Original Message-----
> > > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > > Sent: Wednesday, March 04, 2015 18:48
> > > To: Shi Xuelin-B29237
> > > Cc: thomas.monjalon@6wind.com; dev@dpdk.org
> > > Subject: Re: [PATCH] librte_lpm: define tbl entry reversely for big
> > > endian
> > >
> > > On Wed, Mar 04, 2015 at 02:34:12PM +0800, xuelin.shi@freescale.com
> wrote:
> > > > From: Xuelin Shi <xuelin.shi@freescale.com>
> > > >
> > > > This module uses type conversion between struct and int.
> > > > Also truncation and comparison is used with this int.
> > > > It is not safe for different endian arch.
> > > >
> > > > Add ifdef for big endian struct to fix this issue.
> > > >
> > > > Signed-off-by: Xuelin Shi <xuelin.shi@freescale.com>
> > > > ---
> > > >  lib/librte_lpm/rte_lpm.h | 19 +++++++++++++++++++
> > > >  1 file changed, 19 insertions(+)
> > > >
> > > > diff --git a/lib/librte_lpm/rte_lpm.h b/lib/librte_lpm/rte_lpm.h
> > > > index
> > > > 1af150c..08a2859 100644
> > > > --- a/lib/librte_lpm/rte_lpm.h
> > > > +++ b/lib/librte_lpm/rte_lpm.h
> > > > @@ -96,6 +96,7 @@ extern "C" {
> > > >  /** Bitmask used to indicate successful lookup */
> > > >  #define RTE_LPM_LOOKUP_SUCCESS          0x0100
> > > >
> > > > +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> > > >  /** @internal Tbl24 entry structure. */  struct
> rte_lpm_tbl24_entry {
> > > >  	/* Stores Next hop or group index (i.e. gindex)into tbl8. */
> @@
> > > > -117,6 +118,24 @@ struct rte_lpm_tbl8_entry {
> > > >  	uint8_t valid_group :1; /**< Group validation flag. */
> > > >  	uint8_t depth       :6; /**< Rule depth. */
> > > >  };
> > > > +#else
> > > > +struct rte_lpm_tbl24_entry {
> > > > +	uint8_t depth 	    :6;
> > > > +	uint8_t ext_entry   :1;
> > > > +	uint8_t valid	    :1;
> > >
> > > Since endianness only refers to the order of bytes within a word, do
> > > the bitfields within the uint8_t really need to be swapped around too?
> > >
> > > /Bruce
> >
> > >
> > > > +	union {
> > > > +		uint8_t tbl8_gindex;
> > > > +		uint8_t next_hop;
> > > > +	};
> > > > +};
> > > > +
> > > > +struct rte_lpm_tbl8_entry {
> > > > +	uint8_t depth 	    :6;
> > > > +	uint8_t valid_group :1;
> > > > +	uint8_t valid	    :1;
> > > > +	uint8_t next_hop;
> > > > +};
> > > > +#endif
> > > >
> > > >  /** @internal Rule structure. */
> > > >  struct rte_lpm_rule {
> > > > --
> > > > 1.9.1
> > > >

  reply	other threads:[~2015-03-09  1:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04  6:34 xuelin.shi
2015-03-04 10:48 ` Bruce Richardson
2015-03-05  2:12   ` Xuelin Shi
2015-03-06 11:13     ` Bruce Richardson
2015-03-09  1:54       ` Xuelin Shi [this message]
2015-03-09  9:12         ` Mcnamara, John
2015-03-09  9:35           ` Xuelin Shi
2015-03-09 14:04           ` Thomas Monjalon
2015-03-09 14:02 ` Bruce Richardson
2015-03-23 14:03   ` Thomas Monjalon
2015-03-24  7:28     ` Xuelin Shi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY1PR0301MB0684F68641BAFBDBF80BCFB2861B0@CY1PR0301MB0684.namprd03.prod.outlook.com \
    --to=xuelin.shi@freescale.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).