netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jamal <hadi@cyberus.ca>
To: Radu Rendec <radu.rendec@ines.ro>
Cc: Jarek Poplawski <jarkao2@o2.pl>, netdev@vger.kernel.org
Subject: Re: Endianness problem with u32 classifier hash masks
Date: Tue, 06 Nov 2007 08:34:31 -0500	[thread overview]
Message-ID: <1194356071.4444.23.camel@localhost> (raw)
In-Reply-To: <1194336542.3305.33.camel@rad.rendec.ines.ro>

On Tue, 2007-06-11 at 10:09 +0200, Radu Rendec wrote:

> Yup, you're right. Bitwise anding is the same regardless of the byte
> ordering of the operands. As long as you don't have one operand in host
> order and the other in net order, it's ok.

Ok

> However, Jarek's computations with his mask and your patch seemed
> correct to me yesterday. And I think I know the answer: data must be
> changed to host order _before_ shifting. I mean something like this:
> 
> static __inline__ unsigned u32_hash_fold(u32 key, struct tc_u32_sel
> *sel, u8 fshift)
> {
>        unsigned h = ntohl(key & sel->hmask) >> fshift;
>        return h;
> }

Even better than what i suggested ;->

> > > On paper i get the same result with the new or old scheme for the bucket selection.
> > > As i stated on the patch - i never did test the theory.
> 
> Well, neither did I (about what I stated above). But still I think,
> Jarek was right yesterday and I can't figure out how it worked for you
> on paper. How about this new version?

Looks good - we can think of optimizing later.

> Well, I think it's pretty clear now: I'll try my version of Jamal's
> patch :) 

Which derived from your original patch using little effort in comparison
to yours. All the hardwork is yours.
You did quiet an impressive debug work. Please give yourself a little
pat on the back for me.

> But not right now, because I also have to show up at work.

I empathize. 
Please send two patches instead of one. One for this and the next for
the ffs conversion (please run some simple tests in both cases).

Jarek,
Heres a few more derivations of Canada for you:

Legend has it that Canada's name is derived from  
"settlement" in Iroquoian (One the First Nations in present day Canada).
I think it was pronounced "Kanata"
An alternative legend says the early Spanish called it acánada  meaning
"nothing here"

I tend to believe the Iroquoian version since to this day Canada
continues to serve as a new settlement for many people. And the Spanish
were totaly wrong - there is something here ;-> At least Tim Hortons
coffee.

cheers,
jamal


  reply	other threads:[~2007-11-06 13:34 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01 17:55 Endianness problem with u32 classifier hash masks Radu Rendec
2007-11-02 17:31 ` Jarek Poplawski
2007-11-02 23:23   ` jamal
2007-11-03 23:39     ` Jarek Poplawski
2007-11-03 23:58       ` Jarek Poplawski
2007-11-04  0:30         ` Jarek Poplawski
2007-11-04  1:17           ` Jarek Poplawski
2007-11-04 23:58             ` jamal
2007-11-05  9:12               ` Jarek Poplawski
2007-11-05 12:59                 ` Radu Rendec
2007-11-05 13:43                   ` jamal
2007-11-05 14:49                     ` Jarek Poplawski
2007-11-05 16:12                       ` Radu Rendec
2007-11-05 13:52                   ` Jarek Poplawski
2007-11-05 14:06                     ` jamal
2007-11-05 17:31                       ` Radu Rendec
2007-11-05 21:06                         ` Jarek Poplawski
2007-11-05 21:28                           ` Jarek Poplawski
2007-11-05 22:27                           ` jamal
2007-11-06  0:02                             ` Jarek Poplawski
2007-11-06  0:12                               ` Jarek Poplawski
2007-11-06  8:09                               ` Radu Rendec
2007-11-06 13:34                                 ` jamal [this message]
2007-11-06 14:25                                   ` Jarek Poplawski
2007-11-06 14:43                                     ` jamal
2007-11-06 17:00                                       ` Radu Rendec
2007-11-06 20:28                                         ` Jarek Poplawski
2007-11-07  9:22                                         ` David Miller
2007-11-07 12:56                                           ` Jarek Poplawski
2007-11-07 13:42                                           ` jamal
2007-11-07 13:55                                             ` Radu Rendec
2007-11-07 14:35                                           ` Radu Rendec
2007-11-08 11:07                                           ` [PATCH] [PKT_SCHED] CLS_U32: Use ffs() instead of C code on hash mask to get first set bit Radu Rendec
2007-11-08 11:37                                             ` Jarek Poplawski
2007-11-08 13:45                                             ` jamal
2007-11-11  5:55                                               ` David Miller
2007-11-05 13:47                 ` Endianness problem with u32 classifier hash masks jamal
2007-11-05 14:35                   ` Jarek Poplawski

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=1194356071.4444.23.camel@localhost \
    --to=hadi@cyberus.ca \
    --cc=jarkao2@o2.pl \
    --cc=netdev@vger.kernel.org \
    --cc=radu.rendec@ines.ro \
    /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).