From: Alok Kataria <akataria@vmware.com>
To: Brian King <brking@linux.vnet.ibm.com>
Cc: James Bottomley <James.Bottomley@suse.de>,
Rolf Eike Beer <eike-kernel@sf-tec.de>,
Matthew Wilcox <matthew@wil.cx>,
Roland Dreier <rdreier@cisco.com>,
Bart Van Assche <bvanassche@acm.org>,
Robert Love <robert.w.love@intel.com>,
Randy Dunlap <randy.dunlap@oracle.com>,
Mike Christie <michaelc@cs.wisc.edu>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"pv-drivers@vmware.com" <pv-drivers@vmware.com>,
"Chetan.Loke@Emulex.Com" <Chetan.Loke@Emulex.Com>
Subject: Re: [PATCH] SCSI driver for VMware's virtual HBA - V3.
Date: Tue, 08 Sep 2009 18:07:45 -0700 [thread overview]
Message-ID: <1252458465.24914.65.camel@ank32.eng.vmware.com> (raw)
In-Reply-To: <4AA03A9F.2040500@linux.vnet.ibm.com>
Hi all,
Thanks for taking another look. I have addressed all of Eike and Bryan's
comments except the host_lock one, see below for details.
Also I have rolled out a v4 patch with all the changes, which I will
send out separately.
On Thu, 2009-09-03 at 14:52 -0700, Brian King wrote:
> Alok Kataria wrote:
> > +
> > +struct pvscsi_adapter {
> > + char *mmioBase;
> > + unsigned int irq;
> > + u8 rev;
> > + bool use_msi;
> > + bool use_msix;
> > + bool use_msg;
> > +
> > + spinlock_t hw_lock;
>
> Why not just use host_lock in the scsi_host structure?
>
I agree with Chetan here, lets keep these locks separate.
> > +
> > +/*
> > + * Map all data buffers for a command into PCI space and
> > + * setup the scatter/gather list if needed.
> > + */
> > +static void pvscsi_map_buffers(struct pvscsi_adapter *adapter,
> > + struct pvscsi_ctx *ctx,
> > + struct scsi_cmnd *cmd, PVSCSIRingReqDesc *e)
> > +{
> > + unsigned count;
> > + unsigned bufflen = scsi_bufflen(cmd);
> > + struct scatterlist *sg;
> > +
> > + e->dataLen = bufflen;
> > + e->dataAddr = 0;
> > + if (bufflen == 0)
> > + return;
> > +
> > + sg = scsi_sglist(cmd);
> > + count = scsi_sg_count(cmd);
> > + if (count != 0) {
> > + int segs = pci_map_sg(adapter->dev, sg, count,
> > + cmd->sc_data_direction);
>
> Should use scsi_dma_map here instead.
Done.
> > + if (segs > 1) {
> > + pvscsi_create_sg(ctx, sg, segs);
> > +
> > + e->flags |= PVSCSI_FLAG_CMD_WITH_SG_LIST;
> > + ctx->sglPA = pci_map_single(adapter->dev, ctx->sgl,
> > + SGL_SIZE, PCI_DMA_TODEVICE);
> > + e->dataAddr = ctx->sglPA;
> > + } else
> > + e->dataAddr = sg_dma_address(sg);
> > + } else {
> > + /*
> > + * In case there is no S/G list, scsi_sglist points
> > + * directly to the buffer.
> > + */
> > + ctx->dataPA = pci_map_single(adapter->dev, sg, bufflen,
> > + cmd->sc_data_direction);
> > + e->dataAddr = ctx->dataPA;
> > + }
> > +}
> > +
> > +static void pvscsi_unmap_buffers(const struct pvscsi_adapter *adapter,
> > + struct pvscsi_ctx *ctx)
> > +{
> > + struct scsi_cmnd *cmd;
> > + unsigned bufflen;
> > +
> > + cmd = ctx->cmd;
> > + bufflen = scsi_bufflen(cmd);
> > +
> > + if (bufflen != 0) {
> > + unsigned count = scsi_sg_count(cmd);
> > +
> > + if (count != 0) {
> > + pci_unmap_sg(adapter->dev, scsi_sglist(cmd), count,
> > + cmd->sc_data_direction);
>
> Use scsi_dma_unmap here instead.
Done.
>
> > + if (ctx->sglPA) {
> > + pci_unmap_single(adapter->dev, ctx->sglPA,
> > + SGL_SIZE, PCI_DMA_TODEVICE);
> > + ctx->sglPA = 0;
> > + }
> > + } else
> > + pci_unmap_single(adapter->dev, ctx->dataPA, bufflen,
> > + cmd->sc_data_direction);
> > + }
> > + if (cmd->sense_buffer)
> > + pci_unmap_single(adapter->dev, ctx->sensePA,
> > + SCSI_SENSE_BUFFERSIZE, PCI_DMA_FROMDEVICE);
> > +}
> > +
>
>
Thanks,
Alok
next prev parent reply other threads:[~2009-09-09 1:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-03 19:37 [PATCH] SCSI driver for VMware's virtual HBA - V3 Alok Kataria
2009-09-03 21:18 ` Rolf Eike Beer
2009-09-03 21:52 ` Brian King
2009-09-03 22:21 ` Chetan.Loke
2009-09-09 1:07 ` Alok Kataria
2009-09-09 22:48 ` Chetan.Loke
2009-09-09 1:07 ` Alok Kataria [this message]
2009-09-04 9:28 ` Gerd Hoffmann
2009-09-04 16:51 ` Alok Kataria
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=1252458465.24914.65.camel@ank32.eng.vmware.com \
--to=akataria@vmware.com \
--cc=Chetan.Loke@Emulex.Com \
--cc=James.Bottomley@suse.de \
--cc=akpm@linux-foundation.org \
--cc=brking@linux.vnet.ibm.com \
--cc=bvanassche@acm.org \
--cc=eike-kernel@sf-tec.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=michaelc@cs.wisc.edu \
--cc=pv-drivers@vmware.com \
--cc=randy.dunlap@oracle.com \
--cc=rdreier@cisco.com \
--cc=robert.w.love@intel.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