Subject: Re: New Qlogic qla3xxx NIC Driver v2.02.00k31 for upstream inclusion

From: Philip Craig <[email-masked]>
Date: Fri, 23 Jun 2006 10:51:03 +1000

On 06/22/2006 02:55 PM, Andrew Morton wrote:
> - Is there a better way of doing this?
>
> static void ql_swap_mac_addr(u8 * macAddress)
> {
> #ifdef __BIG_ENDIAN
> 	u8 temp;
> 	temp = macAddress[0];
> 	macAddress[0] = macAddress[1];
> 	macAddress[1] = temp;
> 	temp = macAddress[2];
> 	macAddress[2] = macAddress[3];
> 	macAddress[3] = temp;
> 	temp = macAddress[4];
> 	macAddress[4] = macAddress[5];
> 	macAddress[5] = temp;
> #endif
> }

Perhaps something like:

static void ql_swap_mac_addr(u8 * macAddress)
{
	u16 *p = (u16 *)macAddress;

	cpu_to_le16s(p);
	cpu_to_le16s(p+1);
	cpu_to_le16s(p+2);
}

You could use cpu_to_le16s for the version/numPorts conversion too.