linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Evers <revers@redhat.com>
To: Jing Huang <huangj@brocade.com>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	rvadivel@brocade.com, vravindr@brocade.com
Subject: Re: [PATCH 5/14] bfa: Brocade BFA FC SCSI driver (bfa4)
Date: Thu, 08 Oct 2009 12:39:21 -0400	[thread overview]
Message-ID: <4ACE15B9.1060501@redhat.com> (raw)
In-Reply-To: <200909240055.n8O0tNHN016016@swe58.brocade.com>


> +
> +#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?

      reply	other threads:[~2009-10-08 16:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24  0:55 [PATCH 5/14] bfa: Brocade BFA FC SCSI driver (bfa4) Jing Huang
2009-10-08 16:39 ` Rob Evers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ACE15B9.1060501@redhat.com \
    --to=revers@redhat.com \
    --cc=huangj@brocade.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=rvadivel@brocade.com \
    --cc=vravindr@brocade.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).