public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <jbottomley@parallels.com>
To: Bradley Grove <bgrove@attotech.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"jseba@attotech.com" <jseba@attotech.com>
Subject: Re: [PATCH 00/10] [RFC] SCSI: esas2r: ATTO Technology ExpressSAS 6G SAS/SATA RAID Adapter Driver
Date: Thu, 13 Jun 2013 22:00:42 +0000	[thread overview]
Message-ID: <1371160841.2261.31.camel@dabdike> (raw)
In-Reply-To: <1371133868-13794-1-git-send-email-bgrove@attotech.com>

On Thu, 2013-06-13 at 10:30 -0400, Bradley Grove wrote:
> This is a new driver for ATTO Technology's ExpressSAS series of hardware RAID 
> adapters.  It supports the following adapters:
> 
>     - ExpressSAS R60F
>     - ExpressSAS R680
>     - ExpressSAS R608
>     - ExpressSAS R644
> 
> This patch is split into ten parts to make reviewing easier.   You'll need to
> apply all of them to get the complete patch.
> 
> We have done some testing under x86 and x64 architectures, but the code is 
> still under development and we expect to find additional issues.  We appreciate
> any review comments.

This isn't an exhaustive review by any means, but what I noticed just
from a quick skim over the driver is this:


> +#ifdef HOST_BIG_ENDIAN
> +	*((u16 *)&vrq->scsi.handle + 0) = a->cmd_ref_no++;
> +#else
> +	*((u16 *)&vrq->scsi.handle + 1) = a->cmd_ref_no++;
> +#endif

Looks obviously wrong (there is no HOST_BIG_ENDIAN define in the code).
I think what you want here is

*((u16 *)&vrq->scsi.handle) = cpu_to_be16(a->cmd_ref_no++);

There's also a lot of open coded linked list handling code like this:


> +/* Remove a request from a double-linked list */
> +static inline void esas2r_dequeue(struct esas2r_request *rq)

and 

> +/* Add a request to a double-linked list */
> +static inline void esas2r_enqueue(struct esas2r_request *head,
> +				  struct esas2r_request *rq)

Please don't do this.  Use the linux struct list_head (in list.h)
instead ... it's a common pattern that everyone thinks they have to
write their own linked lists and everyone invariably makes a mistake
doing it ... just using the provided handlers avoids a lot of the
problems.

You also have some hidden singly linked list open coding (like the
free_sg_list) which you should use the struct hlist primitives for.

Could you go through the driver and check for primitives which should
already be in Linux?  Another example of this is all the alignment ones
you have in the file ... you should be using the ALIGN macro.

You have another pattern of using memmove() where you should be using
memcpy().  memmove() is for the case where source and destination may
overlap and it can be less efficient than memcpy on a lot of platforms. 

If I read the code right, you've got a lun limit at 255, so you should
probably be setting max_lun in the host template (and checking the
value) to prevent accidents since you use the rest of the flags word for
command data.

James


      parent reply	other threads:[~2013-06-13 22:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-13 14:30 [PATCH 00/10] [RFC] SCSI: esas2r: ATTO Technology ExpressSAS 6G SAS/SATA RAID Adapter Driver Bradley Grove
2013-06-13 14:30 ` [PATCH 01/10] [RFC] SCSI: esas2r: Add main header file Bradley Grove
2013-06-13 14:31 ` [PATCH 02/10] [RFC] SCSI: esas2r: Add main file Bradley Grove
2013-06-13 14:31 ` [PATCH 03/10] [RFC] SCSI: esas2r: Add initialization functions Bradley Grove
2013-06-13 14:31 ` [PATCH 04/10] [RFC] SCSI: esas2r: Add device discovery and logging functions Bradley Grove
2013-06-13 14:31 ` [PATCH 05/10] [RFC] SCSI: esas2r: Add interrupt and IO functions Bradley Grove
2013-06-13 14:31 ` [PATCH 06/10] [RFC] SCSI: esas2r: Add flash and target database functions Bradley Grove
2013-06-13 14:31 ` [PATCH 07/10] [RFC] SCSI: esas2r: Add IOCTL header file Bradley Grove
2013-06-13 14:31 ` [PATCH 08/10] [RFC] SCSI: esas2r: Add IOCTL functions Bradley Grove
2013-06-13 14:31 ` [PATCH 09/10] [RFC] SCSI: esas2r: Add ATTO VDA Firmware API headers and functions. This API is used to control and manage the RAID adapter Bradley Grove
2013-06-13 14:31 ` [PATCH 10/10] [RFC] SCSI: esas2r: Add Makefile, Kconfig, and MAINTAINERS files Bradley Grove
2013-06-13 22:00 ` James Bottomley [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=1371160841.2261.31.camel@dabdike \
    --to=jbottomley@parallels.com \
    --cc=bgrove@attotech.com \
    --cc=jseba@attotech.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