[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <89DC2B55-8B16-4B35-8EE0-AAD912E273BA@gmail.com>
Date: Tue, 11 Aug 2015 10:06:23 +0800
From: yalin wang <yalin.wang2010@...il.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: Tobias Klauser <tklauser@...tanz.ch>,
"fabf@...net.be" <fabf@...net.be>,
"david@...son.dropbear.id.au" <david@...son.dropbear.id.au>,
"davem@...emloft.net" <davem@...emloft.net>,
"benh@...nel.crashing.org" <benh@...nel.crashing.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] bmac:change to use bitrev8() generic function
> On Aug 10, 2015, at 20:02, David Laight <David.Laight@...LAB.COM> wrote:
>
>> From: Tobias Klauser
>> Sent: 10 August 2015 12:49
>> On 2015-08-10 at 11:53:41 +0200, yalin wang <yalin.wang2010@...il.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.--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists