Thread (5 messages) flat view 5 messages, 3 authors, 2015-08-11

Re: [RFC] bmac:change to use bitrev8() generic function

From: yalin wang <hidden>
Date: 2015-08-11 02:06:30
Also in: lkml

On Aug 10, 2015, at 20:02, David Laight [off-list ref] wrote:
quoted
From: Tobias Klauser
Sent: 10 August 2015 12:49
On 2015-08-10 at 11:53:41 +0200, yalin wang [off-list ref] wrote:
quoted
This change to use generic bitrev8() for bmac driver.
...
quoted
quoted
@@ -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
quoted
quoted
-	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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help