Re: multicast hash incorrect on big endian archs

Manfred Spraul (manfred@colorfullife.com)
Mon, 04 Jun 2001 09:02:00 +0200


"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
-
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/