From: David Laight <David.Laight@ACULAB.COM>
To: "'Tobias Klauser'" <tklauser@distanz.ch>,
yalin wang <yalin.wang2010@gmail.com>
Cc: "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: Mon, 10 Aug 2015 12:02:47 +0000 [thread overview]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CB77DC9@AcuExch.aculab.com> (raw)
In-Reply-To: <20150810114901.GS16878@distanz.ch>
> 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.
David
next prev parent reply other threads:[~2015-08-10 12:05 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 [this message]
2015-08-11 2:06 ` yalin wang
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=063D6719AE5E284EB5DD2968C1650D6D1CB77DC9@AcuExch.aculab.com \
--to=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 \
--cc=yalin.wang2010@gmail.com \
/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®