From: Rob Evers <revers@redhat.com>
To: Jing Huang <huangj@brocade.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 3/6] bfa: remove os wrapper functions and macros
Date: Wed, 20 Oct 2010 11:25:19 -0400 [thread overview]
Message-ID: <4CBF09DF.8000308@redhat.com> (raw)
In-Reply-To: <1287447149-28678-1-git-send-email-huangj@brocade.com>
Hi Jing,
A few more potential issues I noticed after looking through this patch.
These are not necessarily problems with this patch, but are highlighted
by the patch. Perhaps these could be addressed in a subsequent patch or
patch set?
Rob
> diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h
> index 71c0b5a..d60e472 100644
> --- a/drivers/scsi/bfa/bfa_ioc.h
> +++ b/drivers/scsi/bfa/bfa_ioc.h
> @@ -62,9 +62,9 @@ struct bfa_sge_s {
> };
>
> #define bfa_sge_word_swap(__sge) do { \
> - ((u32 *)(__sge))[0] = bfa_os_swap32(((u32 *)(__sge))[0]); \
> - ((u32 *)(__sge))[1] = bfa_os_swap32(((u32 *)(__sge))[1]); \
> - ((u32 *)(__sge))[2] = bfa_os_swap32(((u32 *)(__sge))[2]); \
> + ((u32 *)(__sge))[0] = swab32(((u32 *)(__sge))[0]); \
> + ((u32 *)(__sge))[1] = swab32(((u32 *)(__sge))[1]); \
> + ((u32 *)(__sge))[2] = swab32(((u32 *)(__sge))[2]); \
> } while (0)
>
Is bfa_sge_word_swap used anywhere? I didn't see it.
snip
> +#define bfa_mem_read(_raddr, _off) swab32(readl(((_raddr) + (_off))))
>
> #define bfa_mem_write(_raddr, _off, _val) \
> - bfa_os_mem_write(_raddr, _off, _val)
> + writel(swab32((_val)), ((_raddr) + (_off)))
>
Do bfa_mem_read/write() belong here after your cleanup? Could you
explain these a bit if they are required?
snip
> diff --git a/drivers/scsi/bfa/bfa_os_inc.h b/drivers/scsi/bfa/bfa_os_inc.h
> index d928dca..f9edc75 100644
> --- a/drivers/scsi/bfa/bfa_os_inc.h
> +++ b/drivers/scsi/bfa/bfa_os_inc.h
> @@ -65,12 +65,6 @@ do { \
> ((_x) & 0x00ff00) | \
> (((_x) & 0xff0000) >> 16))
>
> -#define bfa_os_swap32(_x) \
> - ((((_x) & 0xff) << 24) | \
> - (((_x) & 0x0000ff00) << 8) | \
> - (((_x) & 0x00ff0000) >> 8) | \
> - (((_x) & 0xff000000) >> 24))
> -
> #define bfa_os_swap_sgaddr(_x) ((u64)( \
> (((u64)(_x) & (u64)0x00000000000000ffull) << 32) | \
> (((u64)(_x) & (u64)0x000000000000ff00ull) << 32) | \
> @@ -82,7 +76,7 @@ do { \
> (((u64)(_x) & (u64)0xff00000000000000ull) >> 32)))
>
The sg byte swapping code above lead me to look at the sg code in the
bfa driver and I saw that bfa doesn't use scsi_for_each_sg() from what I
can tell.
Is scsi_for_each_sg() use pretty standard for mass storage drivers these
days?
Is the byte swapping required if the more traditional sg implementation
is used?
>
> #ifndef __BIGENDIAN
> -#define bfa_os_hton3b(_x) bfa_swap_3b(_x)
> +#define bfa_os_hton3b(_x) bfa_swap_3b(_x)
>
Should bfa_os_hton3b and related functionality be relocated
appropriately and implemented in common form to the other common byte
swapping code?
next prev parent reply other threads:[~2010-10-20 15:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-19 0:12 [PATCH 3/6] bfa: remove os wrapper functions and macros Jing Huang
2010-10-20 15:25 ` Rob Evers [this message]
2010-10-20 22:16 ` Mike Christie
2010-10-20 23:04 ` Joe Eykholt
2010-10-20 23:16 ` Jing Huang
2010-10-20 23:50 ` Mike Christie
2010-10-20 23:48 ` Jing Huang
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=4CBF09DF.8000308@redhat.com \
--to=revers@redhat.com \
--cc=huangj@brocade.com \
--cc=linux-scsi@vger.kernel.org \
/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).