lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 08 Oct 2009 12:39:21 -0400
From:	Rob Evers <revers@...hat.com>
To:	Jing Huang <huangj@...cade.com>
CC:	linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
	rvadivel@...cade.com, vravindr@...cade.com
Subject: Re: [PATCH 5/14] bfa: Brocade BFA FC SCSI driver (bfa4)


> +
> +#define bfa_swap_3b(_x)				\
> +	((((_x) & 0xff) << 16) |		\
> +	((_x) & 0x00ff00) |			\
> +	(((_x) & 0xff0000) >> 16))
> +
> +#define bfa_swap_8b(_x) 				\
> +     ((((_x) & 0xff00000000000000ull) >> 56)		\
> +      | (((_x) & 0x00ff000000000000ull) >> 40)		\
> +      | (((_x) & 0x0000ff0000000000ull) >> 24)		\
> +      | (((_x) & 0x000000ff00000000ull) >> 8)		\
> +      | (((_x) & 0x00000000ff000000ull) << 8)		\
> +      | (((_x) & 0x0000000000ff0000ull) << 24)		\
> +      | (((_x) & 0x000000000000ff00ull) << 40)		\
> +      | (((_x) & 0x00000000000000ffull) << 56))
> +
> +#define bfa_os_swap32(_x) 			\
> +	((((_x) & 0xff) << 24) 		|	\
> +	(((_x) & 0x0000ff00) << 8)	|	\
> +	(((_x) & 0x00ff0000) >> 8)	|	\
> +	(((_x) & 0xff000000) >> 24))
> +
> +
> +#ifndef __BIGENDIAN
> +#define bfa_os_htons(_x) ((u16)((((_x) & 0xff00) >> 8) | \
> +				 (((_x) & 0x00ff) << 8)))
> +
> +#define bfa_os_htonl(_x)	bfa_os_swap32(_x)
> +#define bfa_os_htonll(_x)	bfa_swap_8b(_x)
> +#define bfa_os_hton3b(_x)	bfa_swap_3b(_x)
> +
> +#define bfa_os_wtole(_x)   (_x)
> +
> +#else
> +
> +#define bfa_os_htons(_x)   (_x)
> +#define bfa_os_htonl(_x)   (_x)
> +#define bfa_os_hton3b(_x)  (_x)
> +#define bfa_os_htonll(_x)  (_x)
> +#define bfa_os_wtole(_x)   bfa_os_swap32(_x)
> +
> +#endif
> +
> +#define bfa_os_ntohs(_x)   bfa_os_htons(_x)
> +#define bfa_os_ntohl(_x)   bfa_os_htonl(_x)
> +#define bfa_os_ntohll(_x)  bfa_os_htonll(_x)
> +#define bfa_os_ntoh3b(_x)  bfa_os_hton3b(_x)
>   

Can bfa_os_ntoh* and bfa_os_hton* be defined to use
linux defined ntoh* and hton*?

include/linux/byteorder/generic.h has some of these definitions.
Perhaps this could be expanded a bit, or, is an expanded set
of such definitions available elsewhere?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ