netdev
[Top] [All Lists]

Re: multicast hash incorrect on big endian archs

To: "David S. Miller" <davem@xxxxxxxxxx>
Subject: Re: multicast hash incorrect on big endian archs
From: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx>
Date: Mon, 04 Jun 2001 09:02:00 +0200
Cc: linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
References: <3B1A9558.2DBAECE7@xxxxxxxxxxxxxxxx> <15130.61778.471925.245018@xxxxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
"David S. Miller" wrote:
> 
> Manfred Spraul writes:
>  > I noticed that the multicast hash calculations assumed little endian
>  > byte ordering in the winbond-840 driver, and it seems that several other
>  > drivers are also affected:
>  >
>  > 8139too, epic100, fealnx, pci-skeleton, sis900, starfile, sundance,
>  > via-rhine, yellowfin
>  > perhaps drivers/net/pcmcia/xircom_tulip_cb
> 
> Many big-endian systems already need to provide little-endian bitops,
> for ext2's sake for example.
> 
> We should formalize this, with {set,clear,change,test}_le_bit which
> technically every port has implemented in some for or another already.
>
The multicast hash is written into a nic register with

        set_bit(crc(...),mc_list);
        ...
        out{b,w,l}(mc_list[i],ioaddr);

set_bit_le only helps for outb. My patch uses set_bit_16 and set_bit_32.

Another option would be
        set_bit_le(crc(...),mc_list)
        ...
        out{w,l}(le{16,32}_to_cpu(mc_list[i]),ioaddr);

but I think set_bit_{8,16,32,64} are the better solution.

Obviously we could move them into a header file.

--
        Manfred

<Prev in Thread] Current Thread [Next in Thread>