All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.h.duyck@redhat.com>
To: Julian Anastasov <ja@ssi.bg>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [net-next PATCH 2/4] fib_trie: Replace plen with slen in leaf_info
Date: Wed, 25 Feb 2015 14:57:03 -0800	[thread overview]
Message-ID: <54EE533F.8080700@redhat.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1502260038050.2970@ja.home.ssi.bg>


On 02/25/2015 02:43 PM, Julian Anastasov wrote:
> 	Hello,
>
> On Wed, 25 Feb 2015, Alexander Duyck wrote:
>
>>>> +		if (((key ^ n->key) >> li->slen) &&
>>>> +		    ((BITS_PER_LONG > KEYLENGTH) || (li->slen != KEYLENGTH)))
>>>>       continue;
>>> 	The '(BITS_PER_LONG > KEYLENGTH) ||' part is not
>>> needed because on 64-bit processor we can still use
>>> 32-bit register (due to 32-bit t_key type) and to get
>>> undefined (!0) result from rshift with 32. We do not want
>>> to continue in this case. Is it really working on 64-bit for
>>> 0.0.0.0/0 ?
>> It is working but that may be due to the fact that gcc decided to place the
>> key in a 64b register.
>>
>> The last patch in the series probably does a better job of addressing your
>> concern.  It replaces the shift with a comparison to (1ul << fa->fa_slen).  In
>> that case I believe the BITS_PER_LONG check would then be appropriate would it
>> not?
> 	I guess, it expands value to 64 bits due to the
> "l" letter, try with "1U << fa->fa_slen" and BITS_PER_LONG
> will not be needed. Or more correctly ((t_key)1 << fa->fa_slen).
>
> Regards
>
> --
> Julian Anastasov <ja@ssi.bg>

I think you are kind of missing the point.  By using casting the 1 as a 
long on 64b systems we can avoid the need to check to see if fa_slen is 
equal to KEYLENGTH.  What the BITS_PER_LONG check does is allow us to 
strip the check for fa_slen == KEYLENGTH on systems that support 64b 
longs since (1ul << fa->fa_slen) will always be a defined value in that 
case so we don't need to check and see if fa->fa_slen is equal to 
KEYLENGTH or not.

- Alex

  reply	other threads:[~2015-02-25 22:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25 19:05 [net-next PATCH 0/4] fib_trie: Remove leaf_info structure Alexander Duyck
2015-02-25 19:06 ` [net-next PATCH 1/4] fib_trie: Convert fib_alias to hlist from list Alexander Duyck
2015-02-25 19:06 ` [net-next PATCH 2/4] fib_trie: Replace plen with slen in leaf_info Alexander Duyck
2015-02-25 21:15   ` Julian Anastasov
2015-02-25 21:30     ` Alexander Duyck
2015-02-25 22:43       ` Julian Anastasov
2015-02-25 22:57         ` Alexander Duyck [this message]
2015-02-25 19:06 ` [net-next PATCH 3/4] fib_trie: Add slen to fib alias Alexander Duyck
2015-02-25 19:06 ` [net-next PATCH 4/4] fib_trie: Remove leaf_info Alexander Duyck
2015-02-25 22:29   ` Julian Anastasov
2015-02-25 23:09     ` Alexander Duyck
2015-02-26  0:06       ` Julian Anastasov
2015-02-26  0:16         ` Alexander Duyck
2015-02-27 22:06 ` [net-next PATCH 0/4] fib_trie: Remove leaf_info structure David Miller

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=54EE533F.8080700@redhat.com \
    --to=alexander.h.duyck@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ja@ssi.bg \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.