All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: Grant Grundler <grundler@google.com>
Cc: "James.Bottomley@hansenpartnership.com"
	<James.Bottomley@hansenpartnership.com>,
	"michaelc@cs.wisc.edu" <michaelc@cs.wisc.edu>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"open-iscsi@googlegroups.com" <open-iscsi@googlegroups.com>,
	Anil Veerabhadrappa <anilgv@broadcom.com>,
	Benjamin Li <benli@broadcom.com>
Subject: Re: [PATCH 4/4] bnx2i: Add bnx2i iSCSI driver.
Date: Tue, 26 May 2009 09:49:01 -0700	[thread overview]
Message-ID: <1243356541.29526.27.camel@HP1> (raw)
In-Reply-To: <da824cf30905260937s4029fe7crc723da03fba08c7b@mail.gmail.com>


On Tue, 2009-05-26 at 09:37 -0700, Grant Grundler wrote:
> On Sat, May 23, 2009 at 2:11 PM, Michael Chan <mchan@broadcom.com> wrote:
> > New iSCSI driver for Broadcom BNX2 devices.
> ...
> > +/*
> > + * iSCSI Async CQE
> > + */
> > +struct bnx2i_async_msg {
> ...
> > +#if defined(__BIG_ENDIAN)
> > +       u8 async_event;
> > +       u8 async_vcode;
> > +       u16 param1;
> > +#elif defined(__LITTLE_ENDIAN)
> > +       u16 param1;
> > +       u8 async_vcode;
> > +       u8 async_event;
> > +#endif
> ...
> 
> Michael,
> I'm feeling a bit dense and am not seeing why byte data
> would have to worry about the 32-bit word endianess of the CPU.
> Can you give an example of why defined(__BIG_ENDIAN) is needed?
> 
> Normally the _*ENDIAN defines are used for bit fields, not byte fields.
> 
> Byte data addressable by the CPU (e.g. host memory) is at the same offset
> regardless of endianness of the CPU. I feel like I'm missing
> something that should be obvious.

Hi Grant, these are what we call "DMA control structures" as opposed to
DMA packet data.  Our chips are configured to do an additional 32-bit
endian swap on all DMA control structures.  This way, all 32-bit control
fields (such as length, status, etc) will come out right when the driver
reads these fields.

If everything was defined as u32 in all these control structures, we
wouldn't have to add the #ifdef.  u8 and u16 fields have to be defined
this way or else big endian CPUs would read the wrong offset.

If you look at some of the control structures in tg3.h, you'll see the
same thing.

Thanks.



  reply	other threads:[~2009-05-26 16:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-23 21:11 [PATCH 0/4] Add bnx2i driver Michael Chan
2009-05-23 21:11 ` [PATCH 1/4] iscsi class: Add new NETLINK_ISCSI messages for cnic/bnx2i driver Michael Chan
2009-05-23 21:11 ` [PATCH 2/4] bnx2: Add support for CNIC driver Michael Chan
     [not found] ` <1243113110-29635-1-git-send-email-mchan-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2009-05-23 21:11   ` [PATCH 3/4] cnic: Add new Broadcom " Michael Chan
2009-05-25 15:19     ` Rolf Eike Beer
2009-05-26  5:35       ` Michael Chan
2009-05-27  2:35   ` [PATCH 0/4] Add bnx2i driver Mike Christie
2009-05-23 21:11 ` [PATCH 4/4] bnx2i: Add bnx2i iSCSI driver Michael Chan
2009-05-26 16:37   ` Grant Grundler
2009-05-26 16:49     ` Michael Chan [this message]
2009-05-26 17:03       ` Grant Grundler
  -- strict thread matches above, loose matches on Subject: below --
2009-06-09  1:14 [PATCH 0/4] Add Broadcom " Michael Chan
     [not found] ` <1244510084-4457-1-git-send-email-mchan-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2009-06-09  1:14   ` [PATCH 4/4] bnx2i: Add " Michael Chan
2009-05-01 20:00 [PATCH 0/4] Add bnx2 iscsi support Michael Chan
2009-05-01 20:00 ` [PATCH 4/4] bnx2i: Add bnx2i iSCSI driver Michael Chan
2009-05-06 16:48   ` Mike Christie
2009-05-06 23:02     ` Karen Xie
2009-05-06 23:02       ` Karen Xie
2009-05-07 17:03     ` Michael Chan
2009-05-07 21:01       ` Mike Christie
2009-05-19  1:50         ` Michael Chan
2009-05-19 14:22           ` Mike Christie
2009-05-19 20:47             ` Michael Chan
2009-05-19 21:58               ` Mike Christie
2009-05-20 16:58                 ` Michael Chan
2009-05-20 19:57                   ` Mike Christie
     [not found]                     ` <4A14608F.6070800-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2009-05-20 22:22                       ` Michael Chan
2009-05-20 22:51                         ` Mike Christie
2009-04-24  0:22 [PATCH 0/4] Add bnx2 iSCSI support Michael Chan
     [not found] ` <1240532563-23048-1-git-send-email-mchan-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2009-04-24  0:22   ` [PATCH 4/4] bnx2i: Add bnx2i iSCSI driver Michael Chan

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=1243356541.29526.27.camel@HP1 \
    --to=mchan@broadcom.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=anilgv@broadcom.com \
    --cc=benli@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=grundler@google.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=open-iscsi@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.