mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: yalin wang <yalin.wang2010@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: Tobias Klauser <tklauser@distanz.ch>,
	"fabf@skynet.be" <fabf@skynet.be>,
	"david@gibson.dropbear.id.au" <david@gibson.dropbear.id.au>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"benh@kernel.crashing.org" <benh@kernel.crashing.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] bmac:change to use bitrev8() generic function
Date: Tue, 11 Aug 2015 10:06:23 +0800	[thread overview]
Message-ID: <89DC2B55-8B16-4B35-8EE0-AAD912E273BA@gmail.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CB77DC9@AcuExch.aculab.com>


> On Aug 10, 2015, at 20:02, David Laight <David.Laight@ACULAB.COM> wrote:
> 
>> From: Tobias Klauser
>> Sent: 10 August 2015 12:49
>> On 2015-08-10 at 11:53:41 +0200, yalin wang <yalin.wang2010@gmail.com> wrote:
>>> This change to use generic bitrev8() for bmac driver.
> ...
>>> @@ -871,7 +860,7 @@ bmac_addhash(struct bmac_data *bp, unsigned char *addr)
>>> 
>>> 	if (!(*addr)) return;
>>> 	crc = bmac_crc((unsigned short *)addr) & 0x3f; /* Big-endian alert! */
> 
> Why not *((u8 *)addr + 1) & 0x3f
> 
>>> -	crc = reverse6[crc];	/* Hyperfast bit-reversing algorithm */
>>> +	crc = bitrev8((u8)crc);
>> 
>> No, this won't work. reverse6 works on 6 bit values, while bitrev8 works
>> on 8bit values, e.g. reverse6[1] = 0x20, while bitrev8(1) = 0x80
> 
> You could use bitrev8(n) >> 2.
> 
> But that is a 'strange' map of a 7-bit value to a 6-bit one.
> 
> I thought it was more common for ethernet hardware to use the
> value of the crc register after all 6 bytes of the mac address
> had been processed.
oh, my mistake, i will change it in V2 for review.

  reply	other threads:[~2015-08-11  2:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10  9:53 yalin wang
2015-08-10 11:49 ` Tobias Klauser
2015-08-10 12:02   ` David Laight
2015-08-11  2:06     ` yalin wang [this message]
2015-08-11  2:28       ` [RFC V2] " yalin wang

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=89DC2B55-8B16-4B35-8EE0-AAD912E273BA@gmail.com \
    --to=yalin.wang2010@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=david@gibson.dropbear.id.au \
    --cc=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tklauser@distanz.ch \
    /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

all inboxes | Powered by JetHome®