Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753714AbbHJMFM (ORCPT ); Mon, 10 Aug 2015 08:05:12 -0400 Received: from smtp-out4.electric.net ([192.162.216.188]:60609 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751716AbbHJMFI convert rfc822-to-8bit (ORCPT ); Mon, 10 Aug 2015 08:05:08 -0400 From: David Laight To: "'Tobias Klauser'" , yalin wang CC: "fabf@skynet.be" , "david@gibson.dropbear.id.au" , "davem@davemloft.net" , "benh@kernel.crashing.org" , "netdev@vger.kernel.org" , open list Subject: RE: [RFC] bmac:change to use bitrev8() generic function Thread-Topic: [RFC] bmac:change to use bitrev8() generic function Thread-Index: AQHQ02MCxwIL0GKyvEe93Dnjs7j/jp4FIIGg Date: Mon, 10 Aug 2015 12:02:47 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CB77DC9@AcuExch.aculab.com> References: <9A81C947-6F69-4549-B1D0-58061D6976CE@gmail.com> <20150810114901.GS16878@distanz.ch> In-Reply-To: <20150810114901.GS16878@distanz.ch> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1154 Lines: 33 > From: Tobias Klauser > Sent: 10 August 2015 12:49 > On 2015-08-10 at 11:53:41 +0200, yalin wang 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/