From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: akataria@vmware.com
Cc: James Bottomley <James.Bottomley@suse.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
Subject: Re: [PATCH] SCSI driver for VMware's virtual HBA - V3.
Date: Thu, 3 Sep 2009 23:18:53 +0200 [thread overview]
Message-ID: <200909032318.54298.eike-kernel@sf-tec.de> (raw)
In-Reply-To: <1252006675.18725.20.camel@ank32.eng.vmware.com>
[-- Attachment #1: Type: Text/Plain, Size: 1832 bytes --]
Alok Kataria wrote:
> VMware PVSCSI driver - v3.
>
> +static void pvscsi_write_cmd_desc(const struct pvscsi_adapter *adapter,
> + u32 cmd, const void *desc, size_t len)
> +{
> + const u32 *ptr = desc;
> + unsigned i;
> +
> + len /= sizeof(*ptr);
> + pvscsi_reg_write(adapter, PVSCSI_REG_OFFSET_COMMAND, cmd);
> + for (i = 0; i < len; i++)
This would limit len to 16 GiB as "unsigned" (looks like "unsigned int" is
preferred in kernel) is only 32 bit long. Instead i should probably be size_t,
too.
> +static int __devinit pvscsi_allocate_rings(struct pvscsi_adapter *adapter)
> +{
...
> + BUG_ON(adapter->ringStatePA & ~PAGE_MASK);
> + BUG_ON(adapter->reqRingPA & ~PAGE_MASK);
> + BUG_ON(adapter->cmpRingPA & ~PAGE_MASK);
Ok, that took me a moment. How about BUG_ON(!IS_ALIGNED(foo, PAGE_SIZE))?
> +static const char *pvscsi_info(struct Scsi_Host *host)
> +{
> + struct pvscsi_adapter *adapter = shost_priv(host);
> + static char buf[512];
> +
> + sprintf(buf, "VMware PVSCSI storage adapter rev %d, req/cmp/msg rings: "
> + "%u/%u/%u pages, cmd_per_lun=%u", adapter->rev,
> + adapter->req_pages, adapter->cmp_pages, adapter->msg_pages,
> + pvscsi_template.cmd_per_lun);
The buffer looks rather huge here. I'm too lazy to calculate an exact size but
256 should still be more than enough, no?
> +static void pvscsi_shutdown_intr(struct pvscsi_adapter *adapter)
> +{
> + if (adapter->irq) {
> + free_irq(adapter->irq, adapter);
> + adapter->irq = 0;
> + }
> + if (adapter->use_msi) {
> + pci_disable_msi(adapter->dev);
> + adapter->use_msi = 0;
> + }
> +
> + if (adapter->use_msix) {
> + pci_disable_msix(adapter->dev);
> + adapter->use_msix = 0;
> + }
> +}
If MSI and MSI-X are exclusive the last one could be "else if".
Greetings,
Eike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2009-09-03 21:18 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 [this message]
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
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=200909032318.54298.eike-kernel@sf-tec.de \
--to=eike-kernel@sf-tec.de \
--cc=James.Bottomley@suse.de \
--cc=akataria@vmware.com \
--cc=akpm@linux-foundation.org \
--cc=bvanassche@acm.org \
--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