Re: [PATCH] iscsi-target: Make buf param of iscsit_do_crypto_hash_buf() const void *

2013-05-03 Thread Nicholas A. Bellinger
On Fri, 2013-05-03 at 23:22 +0200, Geert Uytterhoeven wrote:
> On Fri, May 3, 2013 at 11:15 PM, Geert Uytterhoeven
>  wrote:
> > --- a/drivers/target/iscsi/iscsi_target.c
> > +++ b/drivers/target/iscsi/iscsi_target.c
> 
> > @@ -3585,9 +3575,8 @@ static int iscsit_send_reject(
> > }
> >
> > if (conn->conn_ops->DataDigest) {
> > -   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
> > -   (unsigned char *)cmd->buf_ptr, 
> > ISCSI_HDR_LEN,
> > -   0, NULL, (u8 *)&cmd->data_crc);
> > +   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, cmd->buf_ptr,
> > +   ISCSI_HDR_LEN, 0, NULL, (u8 
> > *)&cmd->data_crc);
> 
> BTW, there are serious issues with casting pointers to u32s to pointers to u8s
> for the last two output parameters of iscsit_do_crypto_hash_buf() (pad_bytes
> and data_crc):
>   1. It's not endian-safe,
>   2. In many cases, the original u32 was not initialized at all, so the other 
> 24
>   bits contain garbage. This will cause 32-bit comparisons like
> 
> if (checksum != data_crc)
> 
>  to fail in unpredictable ways.
> 

Ugh, I can see how that would be problematic for BE..

Changing these to use u8 data_crc[ISCSI_DIGEST_SIZE] and
pad_bytes[ISCSI_PAD_LEN] now, and will post a patch soon.

Thanks again,

--nab


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] iscsi-target: Make buf param of iscsit_do_crypto_hash_buf() const void *

2013-05-03 Thread Nicholas A. Bellinger
On Fri, 2013-05-03 at 23:15 +0200, Geert Uytterhoeven wrote:
> Make the "buf" input param of iscsit_do_crypto_hash_buf() "const void *".
> This allows to remove lots of casts in its callers.
> 
> Signed-off-by: Geert Uytterhoeven 
> ---

Applied to target-pending/queue.

Thanks Geert!

--nab

>  drivers/target/iscsi/iscsi_target.c |   57 
> ++-
>  1 files changed, 23 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/target/iscsi/iscsi_target.c 
> b/drivers/target/iscsi/iscsi_target.c
> index ffbc6a9..721ecc5 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -1250,7 +1250,7 @@ static u32 iscsit_do_crypto_hash_sg(
>  
>  static void iscsit_do_crypto_hash_buf(
>   struct hash_desc *hash,
> - unsigned char *buf,
> + const void *buf,
>   u32 payload_length,
>   u32 padding,
>   u8 *pad_bytes,
> @@ -2524,9 +2524,8 @@ static int iscsit_send_conn_drop_async_message(
>   if (conn->conn_ops->HeaderDigest) {
>   u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
>  
> - iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
> - (unsigned char *)hdr, ISCSI_HDR_LEN,
> - 0, NULL, (u8 *)header_digest);
> + iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr,
> + ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
>  
>   cmd->tx_size += ISCSI_CRC_LEN;
>   pr_debug("Attaching CRC32C HeaderDigest to"
> @@ -2662,9 +2661,8 @@ static int iscsit_send_datain(struct iscsi_cmd *cmd, 
> struct iscsi_conn *conn)
>   if (conn->conn_ops->HeaderDigest) {
>   u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
>  
> - iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
> - (unsigned char *)cmd->pdu, ISCSI_HDR_LEN,
> - 0, NULL, (u8 *)header_digest);
> + iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, cmd->pdu,
> + ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
>  
>   iov[0].iov_len += ISCSI_CRC_LEN;
>   tx_size += ISCSI_CRC_LEN;
> @@ -2841,9 +2839,8 @@ iscsit_send_logout(struct iscsi_cmd *cmd, struct 
> iscsi_conn *conn)
>   if (conn->conn_ops->HeaderDigest) {
>   u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
>  
> - iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
> - (unsigned char *)&cmd->pdu[0], ISCSI_HDR_LEN,
> - 0, NULL, (u8 *)header_digest);
> + iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, &cmd->pdu[0],
> + ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
>  
>   iov[0].iov_len += ISCSI_CRC_LEN;
>   tx_size += ISCSI_CRC_LEN;
> @@ -2900,9 +2897,8 @@ static int iscsit_send_unsolicited_nopin(
>   if (conn->conn_ops->HeaderDigest) {
>   u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
>  
> - iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
> - (unsigned char *)hdr, ISCSI_HDR_LEN,
> - 0, NULL, (u8 *)header_digest);
> + iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr,
> + ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
>  
>   tx_size += ISCSI_CRC_LEN;
>   pr_debug("Attaching CRC32C HeaderDigest to"
> @@ -2949,9 +2945,8 @@ iscsit_send_nopin(struct iscsi_cmd *cmd, struct 
> iscsi_conn *conn)
>   if (conn->conn_ops->HeaderDigest) {
>   u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
>  
> - iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
> - (unsigned char *)hdr, ISCSI_HDR_LEN,
> - 0, NULL, (u8 *)header_digest);
> + iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr,
> + ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
>  
>   iov[0].iov_len += ISCSI_CRC_LEN;
>   tx_size += ISCSI_CRC_LEN;
> @@ -3040,9 +3035,8 @@ static int iscsit_send_r2t(
>   if (conn->conn_ops->HeaderDigest) {
>   u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
>  
> - iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
> - (unsigned char *)hdr, ISCSI_HDR_LEN,
> - 0, NULL, (u8 *)header_digest);
> + iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr,
> + ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
>  
>   cmd->iov_misc[0].iov_len += ISCSI_CRC_LEN;
>   tx_size += ISCSI_CRC_LEN;
> @@ -3256,9 +3250,8 @@ static int iscsit_send_response(struct iscsi_cmd *cmd, 
> struct iscsi_conn *conn)
>   if (conn->conn_ops->HeaderDigest) {
>   u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_L

Re: [RFC-v4 7/9] iscsi-target: Refactor TX queue logic + export response PDU creation

2013-05-03 Thread Nicholas A. Bellinger
On Fri, 2013-05-03 at 23:04 +0200, Geert Uytterhoeven wrote:
> Hi Nicholas,
> 
> On Fri, Apr 12, 2013 at 10:52 PM, Nicholas A. Bellinger
>  wrote:
> > --- a/drivers/target/iscsi/iscsi_target.c
> > +++ b/drivers/target/iscsi/iscsi_target.c
> 
> >  static int iscsit_send_reject(
> > struct iscsi_cmd *cmd,
> > struct iscsi_conn *conn)
> > @@ -3505,18 +3548,9 @@ static int iscsit_send_reject(
> > struct iscsi_reject *hdr;
> > struct kvec *iov;
> >
> > -   hdr = (struct iscsi_reject *) cmd->pdu;
> 
> Woops, and now hdr is no longer initialized:
> 
> drivers/target/iscsi/iscsi_target.c: In function ‘iscsit_send_reject’:
> drivers/target/iscsi/iscsi_target.c:3577: warning: ‘hdr’ is used
> uninitialized in this function
> 
> > -   hdr->opcode = ISCSI_OP_REJECT;
> > -   hdr->flags  |= ISCSI_FLAG_CMD_FINAL;
> > -   hton24(hdr->dlength, ISCSI_HDR_LEN);
> > -   hdr->   = cpu_to_be32(0x);
> > -   cmd->stat_sn= conn->stat_sn++;
> > -   hdr->statsn = cpu_to_be32(cmd->stat_sn);
> > -   hdr->exp_cmdsn  = cpu_to_be32(conn->sess->exp_cmd_sn);
> > -   hdr->max_cmdsn  = cpu_to_be32(conn->sess->max_cmd_sn);
> > +   iscsit_build_reject(cmd, conn, (struct iscsi_reject *)&cmd->pdu[0]);
> 
> Hence it will crash later:
> 
> iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
> (unsigned char *)hdr, ISCSI_HDR_LEN,
> 0, NULL, (u8 *)header_digest);
> 
> and
> 
> pr_debug("Built Reject PDU StatSN: 0x%08x, Reason: 0x%02x,"
> " CID: %hu\n", ntohl(hdr->statsn), hdr->reason, conn->cid);
> 

Whoops.  Applying the following patch to fix this up now, and including
in the next PULL request.

Thanks alot for catching this!

--nab

diff --git a/drivers/target/iscsi/iscsi_target.c 
b/drivers/target/iscsi/iscsi_target.c
index ffbc6a9..c230eac 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3557,11 +3557,11 @@ static int iscsit_send_reject(
struct iscsi_cmd *cmd,
struct iscsi_conn *conn)
 {
-   u32 iov_count = 0, tx_size = 0;
-   struct iscsi_reject *hdr;
+   struct iscsi_reject *hdr = (struct iscsi_reject *)&cmd->pdu[0];
struct kvec *iov;
+   u32 iov_count = 0, tx_size;
 
-   iscsit_build_reject(cmd, conn, (struct iscsi_reject *)&cmd->pdu[0]);
+   iscsit_build_reject(cmd, conn, hdr);
 
iov = &cmd->iov_misc[0];
iov[iov_count].iov_base = cmd->pdu;


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] iscsi-target: Make buf param of iscsit_do_crypto_hash_buf() const void *

2013-05-03 Thread Geert Uytterhoeven
On Fri, May 3, 2013 at 11:15 PM, Geert Uytterhoeven
 wrote:
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c

> @@ -3585,9 +3575,8 @@ static int iscsit_send_reject(
> }
>
> if (conn->conn_ops->DataDigest) {
> -   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
> -   (unsigned char *)cmd->buf_ptr, ISCSI_HDR_LEN,
> -   0, NULL, (u8 *)&cmd->data_crc);
> +   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, cmd->buf_ptr,
> +   ISCSI_HDR_LEN, 0, NULL, (u8 *)&cmd->data_crc);

BTW, there are serious issues with casting pointers to u32s to pointers to u8s
for the last two output parameters of iscsit_do_crypto_hash_buf() (pad_bytes
and data_crc):
  1. It's not endian-safe,
  2. In many cases, the original u32 was not initialized at all, so the other 24
  bits contain garbage. This will cause 32-bit comparisons like

if (checksum != data_crc)

 to fail in unpredictable ways.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] iscsi-target: Make buf param of iscsit_do_crypto_hash_buf() const void *

2013-05-03 Thread Geert Uytterhoeven
Make the "buf" input param of iscsit_do_crypto_hash_buf() "const void *".
This allows to remove lots of casts in its callers.

Signed-off-by: Geert Uytterhoeven 
---
 drivers/target/iscsi/iscsi_target.c |   57 ++-
 1 files changed, 23 insertions(+), 34 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target.c 
b/drivers/target/iscsi/iscsi_target.c
index ffbc6a9..721ecc5 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1250,7 +1250,7 @@ static u32 iscsit_do_crypto_hash_sg(
 
 static void iscsit_do_crypto_hash_buf(
struct hash_desc *hash,
-   unsigned char *buf,
+   const void *buf,
u32 payload_length,
u32 padding,
u8 *pad_bytes,
@@ -2524,9 +2524,8 @@ static int iscsit_send_conn_drop_async_message(
if (conn->conn_ops->HeaderDigest) {
u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
 
-   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
-   (unsigned char *)hdr, ISCSI_HDR_LEN,
-   0, NULL, (u8 *)header_digest);
+   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr,
+   ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
 
cmd->tx_size += ISCSI_CRC_LEN;
pr_debug("Attaching CRC32C HeaderDigest to"
@@ -2662,9 +2661,8 @@ static int iscsit_send_datain(struct iscsi_cmd *cmd, 
struct iscsi_conn *conn)
if (conn->conn_ops->HeaderDigest) {
u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
 
-   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
-   (unsigned char *)cmd->pdu, ISCSI_HDR_LEN,
-   0, NULL, (u8 *)header_digest);
+   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, cmd->pdu,
+   ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
 
iov[0].iov_len += ISCSI_CRC_LEN;
tx_size += ISCSI_CRC_LEN;
@@ -2841,9 +2839,8 @@ iscsit_send_logout(struct iscsi_cmd *cmd, struct 
iscsi_conn *conn)
if (conn->conn_ops->HeaderDigest) {
u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
 
-   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
-   (unsigned char *)&cmd->pdu[0], ISCSI_HDR_LEN,
-   0, NULL, (u8 *)header_digest);
+   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, &cmd->pdu[0],
+   ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
 
iov[0].iov_len += ISCSI_CRC_LEN;
tx_size += ISCSI_CRC_LEN;
@@ -2900,9 +2897,8 @@ static int iscsit_send_unsolicited_nopin(
if (conn->conn_ops->HeaderDigest) {
u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
 
-   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
-   (unsigned char *)hdr, ISCSI_HDR_LEN,
-   0, NULL, (u8 *)header_digest);
+   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr,
+   ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
 
tx_size += ISCSI_CRC_LEN;
pr_debug("Attaching CRC32C HeaderDigest to"
@@ -2949,9 +2945,8 @@ iscsit_send_nopin(struct iscsi_cmd *cmd, struct 
iscsi_conn *conn)
if (conn->conn_ops->HeaderDigest) {
u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
 
-   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
-   (unsigned char *)hdr, ISCSI_HDR_LEN,
-   0, NULL, (u8 *)header_digest);
+   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr,
+   ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
 
iov[0].iov_len += ISCSI_CRC_LEN;
tx_size += ISCSI_CRC_LEN;
@@ -3040,9 +3035,8 @@ static int iscsit_send_r2t(
if (conn->conn_ops->HeaderDigest) {
u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
 
-   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
-   (unsigned char *)hdr, ISCSI_HDR_LEN,
-   0, NULL, (u8 *)header_digest);
+   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr,
+   ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest);
 
cmd->iov_misc[0].iov_len += ISCSI_CRC_LEN;
tx_size += ISCSI_CRC_LEN;
@@ -3256,9 +3250,8 @@ static int iscsit_send_response(struct iscsi_cmd *cmd, 
struct iscsi_conn *conn)
if (conn->conn_ops->HeaderDigest) {
u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN];
 
-   iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
-   (unsigned char *)cmd->pdu, ISCSI_HDR_LEN,
-   0, NULL, (u8 *)header_d

Re: [RFC-v4 7/9] iscsi-target: Refactor TX queue logic + export response PDU creation

2013-05-03 Thread Geert Uytterhoeven
Hi Nicholas,

On Fri, Apr 12, 2013 at 10:52 PM, Nicholas A. Bellinger
 wrote:
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c

>  static int iscsit_send_reject(
> struct iscsi_cmd *cmd,
> struct iscsi_conn *conn)
> @@ -3505,18 +3548,9 @@ static int iscsit_send_reject(
> struct iscsi_reject *hdr;
> struct kvec *iov;
>
> -   hdr = (struct iscsi_reject *) cmd->pdu;

Woops, and now hdr is no longer initialized:

drivers/target/iscsi/iscsi_target.c: In function ‘iscsit_send_reject’:
drivers/target/iscsi/iscsi_target.c:3577: warning: ‘hdr’ is used
uninitialized in this function

> -   hdr->opcode = ISCSI_OP_REJECT;
> -   hdr->flags  |= ISCSI_FLAG_CMD_FINAL;
> -   hton24(hdr->dlength, ISCSI_HDR_LEN);
> -   hdr->   = cpu_to_be32(0x);
> -   cmd->stat_sn= conn->stat_sn++;
> -   hdr->statsn = cpu_to_be32(cmd->stat_sn);
> -   hdr->exp_cmdsn  = cpu_to_be32(conn->sess->exp_cmd_sn);
> -   hdr->max_cmdsn  = cpu_to_be32(conn->sess->max_cmd_sn);
> +   iscsit_build_reject(cmd, conn, (struct iscsi_reject *)&cmd->pdu[0]);

Hence it will crash later:

iscsit_do_crypto_hash_buf(&conn->conn_tx_hash,
(unsigned char *)hdr, ISCSI_HDR_LEN,
0, NULL, (u8 *)header_digest);

and

pr_debug("Built Reject PDU StatSN: 0x%08x, Reason: 0x%02x,"
" CID: %hu\n", ntohl(hdr->statsn), hdr->reason, conn->cid);

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -next 2/2] sun3_scsi: switch to ->show_info()

2013-05-03 Thread Geert Uytterhoeven
Ping?

Now the build failure is also in Linus' tree:

http://kisskb.ellerman.id.au/kisskb/buildresult/8674437/

BTW, this patch depends on "[PATCH 1/2] sun3_scsi: Fill in missing
scsi_host_template.proc_info method"

On Wed, Apr 10, 2013 at 1:52 PM, Geert Uytterhoeven
 wrote:
> Based on Al's changes to atari_scsi.
>
> Signed-off-by: Geert Uytterhoeven 
> ---
> http://kisskb.ellerman.id.au/kisskb/buildresult/8543326/
>
>  drivers/scsi/sun3_NCR5380.c |  185 ++
>  drivers/scsi/sun3_scsi.c|2 +-
>  drivers/scsi/sun3_scsi.h|2 +-
>  3 files changed, 81 insertions(+), 108 deletions(-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] scsi: ufs: add support for query requests

2013-05-03 Thread James Bottomley
On Thu, 2013-05-02 at 17:25 +0530, Santosh Y wrote:
> From: Dolev Raviv 
> 
> Add support for sending UFS query requests through tagged command
> queuing. This design allows queuing query requests in any open slot
> along with other SCSI commands. In this way there is no need to
> save a slot in the requests queue and decrease its size.
> 
> A query request is posing to a SCSI command to use native flow. But
> unlike normal SCSI command flow, the data and response fields are
> filled in UFS host data structure instead of passing as arguments
> while queuing into SCSI mlqueue (mid-layer SCSI queue, the requests
> from this queue are submitted to the device queue). As per specification
> only one query request is allowed to be processed by device. Hence a
> mutex lock for protecting data and response fields (hba->query.request and
> hba->query.response) needs to be held while query request is in
> progress.
> 
> The API for submitting a query request is ufs_query_request() in
> ufshcd.c. This function is responsible for:
> 1. Obtaining the SCSI device from the host
> 2. Keeping the query mutex to prevent multiple queries
> 3. Storing the required data for sending a query request in ufs_hba
> 4. Queuing a SCSI vendor specific command to trigger a query request
>in the UFS driver.
> 
> The callers of ufs_query_request() are expected to fill the query
> command data fields and are to provide an allocated response field
> for the driver to fill response fields after request completion.
> 
> The request and response upiu is extended in a union to enable using the
> same data structure, both for command upiu and query request upiu.
> 
> The query request flow is separated from the scsi command flow in:
> 1. Preparing the request
> 2. Validating response (error) codes
> 3. Copying data (only used for descriptor read/write query requests)
> 4. Copying response/sense
> 
> Data error can't be handled in the scsi command native flow. Hence,
> we pass the code as without a change back to the submitting layer.
> 
> UPIU (UFS Protocol Information Unit) size is increased to 512 bytes
> from 128. The UPIU header and the transaction specific fields (SCSI
> command or Query Request OSF - Op-code Specific Fields) are 32 bytes
> together, the rest is used to transfer extra request data (such as
> descriptor in query requests). In order to accommodate the largest
> descriptor in the UFS spec (256 bytes) we need to increase the UPIU
> size.
> 
> Signed-off-by: Dolev Raviv 
> Signed-off-by: Santosh Y 
> 
> diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig
> index 35faf24..82417d6 100644
> --- a/drivers/scsi/ufs/Kconfig
> +++ b/drivers/scsi/ufs/Kconfig
> @@ -35,6 +35,7 @@
>  config SCSI_UFSHCD
>   tristate "Universal Flash Storage Controller Driver Core"
>   depends on SCSI
> + default y
>   ---help---
>   This selects the support for UFS devices in Linux, say Y and make
> sure that you know the name of your UFS host adapter (the card

I don't think you want to force this on in every configuration since
it's only appropriate to non server/desktop.  I stripped this hunk.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: Handle MLQUEUE busy response in scsi_send_eh_cmnd

2013-05-03 Thread James Bottomley
On Fri, 2013-05-03 at 10:24 -0400, wenxi...@linux.vnet.ibm.com wrote:
> Quoting Hannes Reinecke :
> 
> > scsi_send_eh_cmnd() is calling queuecommand() directly, so
> > it needs to check the return value here.
> > The only valid return codes for queuecommand() are 'busy'
> > states, so we need to wait for a bit to allow the LLDD
> > to recover.
> >
> > Based on an earlier patch from Wen Xiong.
> >
> > Cc: Wen Xiong 
> > Cc: Brian King 
> > Signed-off-by: Hannes Reinecke 
> >
> Hi James,
> 
> I have verified this patch with two new ipr adapters. EEH error can be  
> recoery successfully.
> Do you have any question about this new patch?

Yes, it's not correct: stall_for is in jiffies not msec, so
msleep(stall_for) is taking far too long.  Plus you don't know that
stall_for is a divisor of timeleft, so timeleft -= stall_for could wrap
and cause the retry loop to go on effectively forever.

I think the below is the correct patch, so I'll commit it unless there
are objections.

James

---
>From a74498dda7acf6f5fb99e43df54f2c1f5c6beec9 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke 
Date: Thu, 25 Apr 2013 08:10:00 +0200
Subject: [PATCH] [SCSI] Handle MLQUEUE busy response in scsi_send_eh_cmnd

scsi_send_eh_cmnd() is calling queuecommand() directly, so
it needs to check the return value here.
The only valid return codes for queuecommand() are 'busy'
states, so we need to wait for a bit to allow the LLDD
to recover.

Based on an earlier patch from Wen Xiong.

[jejb: fix confusion between msec and jiffies values and other issues]
Cc: Wen Xiong 
Cc: Brian King 
Signed-off-by: Hannes Reinecke 
Signed-off-by: James Bottomley 

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index c1b05a8..cfd1ef2 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -791,22 +792,33 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, 
unsigned char *cmnd,
struct scsi_device *sdev = scmd->device;
struct Scsi_Host *shost = sdev->host;
DECLARE_COMPLETION_ONSTACK(done);
-   unsigned long timeleft;
+   unsigned long timeleft = timeout;
struct scsi_eh_save ses;
+   const unsigned long stall_for = min(msecs_to_jiffies(10), 1UL);
int rtn;
 
+retry:
scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes);
shost->eh_action = &done;
 
scsi_log_send(scmd);
scmd->scsi_done = scsi_eh_done;
-   shost->hostt->queuecommand(shost, scmd);
-
-   timeleft = wait_for_completion_timeout(&done, timeout);
+   rtn = shost->hostt->queuecommand(shost, scmd);
+   if (rtn) {
+   if (timeleft > stall_for) {
+   scsi_eh_restore_cmnd(scmd, &ses);
+   timeleft -= stall_for;
+   msleep(jiffies_to_msecs(stall_for));
+   goto retry;
+   }
+   timeleft = 0;
+   rtn = NEEDS_RETRY;
+   } else
+   timeleft = wait_for_completion_timeout(&done, timeout);
 
shost->eh_action = NULL;
 
-   scsi_log_completion(scmd, SUCCESS);
+   scsi_log_completion(scmd, rtn);
 
SCSI_LOG_ERROR_RECOVERY(3,
printk("%s: scmd: %p, timeleft: %ld\n",
@@ -837,7 +849,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, 
unsigned char *cmnd,
rtn = FAILED;
break;
}
-   } else {
+   } else if (!rtn) {
scsi_abort_eh_cmnd(scmd);
rtn = FAILED;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] cciss: bug fix to prevent cciss from loading in kdump crash kernel

2013-05-03 Thread Mike Miller (OS Dev)
On Fri, 2013-05-03 at 11:02 -0700, James Bottomley wrote:
> On Tue, 2013-04-23 at 12:25 -0500, Mike Miller wrote:
> > PATCH 1/1
> > 
> > By default the cciss driver supports all "older" HP Smart Array controllers
> > and hpsa supports all controllers starting with the G6 family. There are
> > module parameters that allow a user to override those defaults and use hpsa
> > for any HP Smart Array controller.
> > If the user does override the default behavior and uses hpsa for older
> > controllers it is possible that cciss may try to load in a kdump crash
> > kernel. This may happen if cciss is loaded first from the kdump initrd
> > image. If cciss does load rather than hpsa and reset_devices is true we
> > immediately call cciss_hard_reset_controller. This will result in a kernel
> > panic and the core file cannot be created.
> > This patch prevents cciss from trying to load in this scenario.
> > 
> > Tested with 3.9.0-rc7.
> > 
> > From: Mike 
> > Signed-off-by: Mike Miller 
> > 
> > ---
> >  drivers/block/cciss.c |   10 ++
> >  1 files changed, 10 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> > index 1c1b8e5..06c8dba 100644
> > --- a/drivers/block/cciss.c
> > +++ b/drivers/block/cciss.c
> > @@ -4960,6 +4960,16 @@ static int cciss_init_one(struct pci_dev *pdev, 
> > const struct pci_device_id *ent)
> > ctlr_info_t *h;
> > unsigned long flags;
> >  
> > +   /*
> > +* By default the cciss driver is used for all older HP Smart Array
> > +* controllers. There are module paramaters that allow a user to
> > +* override this behavior and instead use the hpsa SCSI driver. If
> > +* this is the case cciss may be loaded first from the kdump initrd
> > +* image and cause a kernel panic. So if reset_devices is true and
> > +* cciss_allow_hpsa is set just bail.
> > +*/
> > +   if ((reset_devices) && (cciss_allow_hpsa == 1))
> > +   return -ENODEV;
> > rc = cciss_init_reset_devices(pdev);
> > if (rc) {
> > if (rc != -ENOTSUPP)
> 
> Sigh, right change log, incomplete bug fix.
> 
> Can we all agree that this is the right one?
> 
> James

I submitted 2 patches. Below the 2 are combined and make the fix
complete.

-- mikem

> 
> ---
> >From 746ba9f715b9037264ae0b8175c6286f5f8f62d4 Mon Sep 17 00:00:00 2001
> From: Mike Miller 
> Date: Thu, 18 Apr 2013 13:49:37 -0500
> Subject: [PATCH] [SCSI] cciss: bug fix to prevent cciss from loading in kdump
>  crash kernel
> 
> By default the cciss driver supports all "older" HP Smart Array controllers
> and hpsa supports all controllers starting with the G6 family. There are
> module parameters that allow a user to override those defaults and use hpsa
> for any HP Smart Array controller.
> If the user does override the default behavior and uses hpsa for older
> controllers it is possible that cciss may try to load in a kdump crash
> kernel. This may happen if cciss is loaded first from the kdump initrd
> image. If cciss does load rather than hpsa and reset_devices is true we
> immediately call cciss_hard_reset_controller. This will result in a kernel
> panic and the core file cannot be created.
> This patch prevents cciss from trying to load in this scenario.
> 
> Signed-off-by: Mike Miller 
> Cc: 
> Signed-off-by: James Bottomley 
> 
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index 1c1b8e5..daaab88 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -75,6 +75,12 @@ module_param(cciss_simple_mode, int, S_IRUGO|S_IWUSR);
>  MODULE_PARM_DESC(cciss_simple_mode,
>   "Use 'simple mode' rather than 'performant mode'");
>  
> +static int cciss_allow_hpsa;
> +module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR);
> +MODULE_PARM_DESC(cciss_allow_hpsa,
> + "Prevent cciss driver from accessing hardware known to be "
> + " supported by the hpsa driver");
> +
>  static DEFINE_MUTEX(cciss_mutex);
>  static struct proc_dir_entry *proc_cciss;
>  
> @@ -4960,6 +4966,16 @@ static int cciss_init_one(struct pci_dev *pdev, const 
> struct pci_device_id *ent)
>   ctlr_info_t *h;
>   unsigned long flags;
>  
> + /*
> +  * By default the cciss driver is used for all older HP Smart Array
> +  * controllers. There are module paramaters that allow a user to
> +  * override this behavior and instead use the hpsa SCSI driver. If
> +  * this is the case cciss may be loaded first from the kdump initrd
> +  * image and cause a kernel panic. So if reset_devices is true and
> +  * cciss_allow_hpsa is set just bail.
> +  */
> + if ((reset_devices) && (cciss_allow_hpsa == 1))
> + return -ENODEV;
>   rc = cciss_init_reset_devices(pdev);
>   if (rc) {
>   if (rc != -ENOTSUPP)
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] cciss: bug fix to prevent cciss from loading in kdump crash kernel

2013-05-03 Thread James Bottomley
On Tue, 2013-04-23 at 12:25 -0500, Mike Miller wrote:
> PATCH 1/1
> 
> By default the cciss driver supports all "older" HP Smart Array controllers
> and hpsa supports all controllers starting with the G6 family. There are
> module parameters that allow a user to override those defaults and use hpsa
> for any HP Smart Array controller.
> If the user does override the default behavior and uses hpsa for older
> controllers it is possible that cciss may try to load in a kdump crash
> kernel. This may happen if cciss is loaded first from the kdump initrd
> image. If cciss does load rather than hpsa and reset_devices is true we
> immediately call cciss_hard_reset_controller. This will result in a kernel
> panic and the core file cannot be created.
> This patch prevents cciss from trying to load in this scenario.
> 
> Tested with 3.9.0-rc7.
> 
> From: Mike 
> Signed-off-by: Mike Miller 
> 
> ---
>  drivers/block/cciss.c |   10 ++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index 1c1b8e5..06c8dba 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -4960,6 +4960,16 @@ static int cciss_init_one(struct pci_dev *pdev, const 
> struct pci_device_id *ent)
>   ctlr_info_t *h;
>   unsigned long flags;
>  
> + /*
> +  * By default the cciss driver is used for all older HP Smart Array
> +  * controllers. There are module paramaters that allow a user to
> +  * override this behavior and instead use the hpsa SCSI driver. If
> +  * this is the case cciss may be loaded first from the kdump initrd
> +  * image and cause a kernel panic. So if reset_devices is true and
> +  * cciss_allow_hpsa is set just bail.
> +  */
> + if ((reset_devices) && (cciss_allow_hpsa == 1))
> + return -ENODEV;
>   rc = cciss_init_reset_devices(pdev);
>   if (rc) {
>   if (rc != -ENOTSUPP)

Sigh, right change log, incomplete bug fix.

Can we all agree that this is the right one?

James

---
>From 746ba9f715b9037264ae0b8175c6286f5f8f62d4 Mon Sep 17 00:00:00 2001
From: Mike Miller 
Date: Thu, 18 Apr 2013 13:49:37 -0500
Subject: [PATCH] [SCSI] cciss: bug fix to prevent cciss from loading in kdump
 crash kernel

By default the cciss driver supports all "older" HP Smart Array controllers
and hpsa supports all controllers starting with the G6 family. There are
module parameters that allow a user to override those defaults and use hpsa
for any HP Smart Array controller.
If the user does override the default behavior and uses hpsa for older
controllers it is possible that cciss may try to load in a kdump crash
kernel. This may happen if cciss is loaded first from the kdump initrd
image. If cciss does load rather than hpsa and reset_devices is true we
immediately call cciss_hard_reset_controller. This will result in a kernel
panic and the core file cannot be created.
This patch prevents cciss from trying to load in this scenario.

Signed-off-by: Mike Miller 
Cc: 
Signed-off-by: James Bottomley 

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 1c1b8e5..daaab88 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -75,6 +75,12 @@ module_param(cciss_simple_mode, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(cciss_simple_mode,
"Use 'simple mode' rather than 'performant mode'");
 
+static int cciss_allow_hpsa;
+module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(cciss_allow_hpsa,
+   "Prevent cciss driver from accessing hardware known to be "
+   " supported by the hpsa driver");
+
 static DEFINE_MUTEX(cciss_mutex);
 static struct proc_dir_entry *proc_cciss;
 
@@ -4960,6 +4966,16 @@ static int cciss_init_one(struct pci_dev *pdev, const 
struct pci_device_id *ent)
ctlr_info_t *h;
unsigned long flags;
 
+   /*
+* By default the cciss driver is used for all older HP Smart Array
+* controllers. There are module paramaters that allow a user to
+* override this behavior and instead use the hpsa SCSI driver. If
+* this is the case cciss may be loaded first from the kdump initrd
+* image and cause a kernel panic. So if reset_devices is true and
+* cciss_allow_hpsa is set just bail.
+*/
+   if ((reset_devices) && (cciss_allow_hpsa == 1))
+   return -ENODEV;
rc = cciss_init_reset_devices(pdev);
if (rc) {
if (rc != -ENOTSUPP)


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: Handle MLQUEUE busy response in scsi_send_eh_cmnd

2013-05-03 Thread wenxiong


Quoting Hannes Reinecke :


scsi_send_eh_cmnd() is calling queuecommand() directly, so
it needs to check the return value here.
The only valid return codes for queuecommand() are 'busy'
states, so we need to wait for a bit to allow the LLDD
to recover.

Based on an earlier patch from Wen Xiong.

Cc: Wen Xiong 
Cc: Brian King 
Signed-off-by: Hannes Reinecke 


Hi James,

I have verified this patch with two new ipr adapters. EEH error can be  
recoery successfully.

Do you have any question about this new patch?

Thanks,
Wendy

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index d58db32..6a3c1d2 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -889,22 +889,32 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd  
*scmd, unsigned char *cmnd,

struct scsi_device *sdev = scmd->device;
struct Scsi_Host *shost = sdev->host;
DECLARE_COMPLETION_ONSTACK(done);
-   unsigned long timeleft;
+   unsigned long timeleft = timeout;
struct scsi_eh_save ses;
+   const int stall_for = min(HZ/10, 1);
int rtn;

+retry:
scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes);
shost->eh_action = &done;

scsi_log_send(scmd);
scmd->scsi_done = scsi_eh_done;
-   shost->hostt->queuecommand(shost, scmd);
-
-   timeleft = wait_for_completion_timeout(&done, timeout);
+   rtn = shost->hostt->queuecommand(shost, scmd);
+   if (rtn) {
+   if (timeleft) {
+   scsi_eh_restore_cmnd(scmd, &ses);
+   timeleft -= stall_for;
+   msleep(stall_for);
+   goto retry;
+   }
+   rtn = NEEDS_RETRY;
+   } else
+   timeleft = wait_for_completion_timeout(&done, timeout);

shost->eh_action = NULL;

-   scsi_log_completion(scmd, SUCCESS);
+   scsi_log_completion(scmd, rtn);

SCSI_LOG_ERROR_RECOVERY(3,
printk("%s: scmd: %p, timeleft: %ld\n",
@@ -935,7 +945,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd  
*scmd, unsigned char *cmnd,

rtn = FAILED;
break;
}
-   } else {
+   } else if (!rtn) {
scsi_abort_eh_cmnd(scmd);
rtn = FAILED;
}




--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] scsi: ufs: Rework UFS host driver implementation

2013-05-03 Thread Sujit Reddy Thumma
UFS protocol comprises of two specifications, UFS device and
UFS host controller specification. The current UFSHCD driver
combines implementation of both the specs into one file. As
new features evolve in both specifications one single file
looks cumbersome and hard to maintain. Split the UFS driver file
into two -

ufs.c:
- Behave as a LLD to SCSI mid layer.
- Implements UFS device specification
o Driver interfaces to UFS device in terms of UPIUs.
o Prepares UPIUs for SCSI commands and internal commands
  and send it to host driver through host ops.
o Handles full device initialization.
o Handles device power management
o Handles device specific features like bkops etc.
o Handles task management commands.

ufshcd.c:
- Driver interfaces with host controller and UIC layer on host side.
- Implements UFS HCI specification
o Configure memory and transfer descriptors
o Build UTRD and UTMRD based on request from ufs.c and allow
  controller to execute the commands
o Handle hardware interrupts from controller including errors.
o Handle UIC commands
o Handle host controller/UIC specific power management

Signed-off-by: Sujit Reddy Thumma 

---
The patch is not complete and does not handle some of the points
mentioned above. This is just for review on design part.
---
 drivers/scsi/ufs/Makefile |2 +-
 drivers/scsi/ufs/ufs.c|  341 +++
 drivers/scsi/ufs/ufs.h|   37 +
 drivers/scsi/ufs/ufshcd.c |  352 +
 drivers/scsi/ufs/ufshcd.h |   10 ++
 5 files changed, 487 insertions(+), 255 deletions(-)
 create mode 100644 drivers/scsi/ufs/ufs.c

diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile
index 1e5bd48..386b17a 100644
--- a/drivers/scsi/ufs/Makefile
+++ b/drivers/scsi/ufs/Makefile
@@ -1,4 +1,4 @@
 # UFSHCD makefile
-obj-$(CONFIG_SCSI_UFSHCD) += ufshcd.o
+obj-$(CONFIG_SCSI_UFSHCD) += ufshcd.o ufs.o
 obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o
 obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o
diff --git a/drivers/scsi/ufs/ufs.c b/drivers/scsi/ufs/ufs.c
new file mode 100644
index 000..50dac2d
--- /dev/null
+++ b/drivers/scsi/ufs/ufs.c
@@ -0,0 +1,341 @@
+/*
+ * Universal Flash Storage driver Core
+ *
+ * This code is based on drivers/scsi/ufs/ufshcd.c
+ * Copyright (C) 2011-2013 Samsung India Software Operations
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Authors:
+ * Santosh Yaraganavi 
+ * Vinayak Holikatti 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * See the COPYING file in the top-level directory or visit
+ * 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This program is provided "AS IS" and "WITH ALL FAULTS" and
+ * without warranty of any kind. You are solely responsible for
+ * determining the appropriateness of using and distributing
+ * the program and assume all risks associated with your exercise
+ * of rights with respect to the program, including but not limited
+ * to infringement of third party rights, the risks and costs of
+ * program errors, damage to or loss of data, programs or equipment,
+ * and unavailability or interruption of operations. Under no
+ * circumstances will the contributor of this Program be liable for
+ * any damages of any kind arising from your use or distribution of
+ * this program.
+ *
+ * The Linux Foundation chooses to take subject only to the GPLv2
+ * license terms, and distributes only under these terms.
+ */
+
+#include "ufshcd.h"
+
+static bool ufs_is_valid_tr_rsp(struct ufs_tr_queue_cmd *trcmd)
+{
+   struct utp_upiu_rsp *resp_upiu = trcmd->resp_upiu;
+   struct utp_upiu_cmd *req_upiu = trcmd->req_upiu;
+   u8 cmd;
+   u8 resp;
+
+   cmd = be32_to_cpu(req_upiu->header.dword_0) >> 24;
+   resp = be32_to_cpu(resp_upiu->header.dword_0) >> 24;
+
+   switch (cmd) {
+   case UPIU_TRANSACTION_COMMAND:
+   if (resp == UPIU_TRANSACTION_RESPONSE)
+   return true;
+   default:
+   return false;
+   }
+}
+
+static inline u16 ufs_get_rsp_upiu_result(struct utp_upiu_rsp *upiu)
+{
+   return be32_to_cpu(upiu->header.dword_1) & MASK_RSP_UPIU_RESULT;
+}
+
+static inline void ufs_copy_sense_data(struct ufs_tr_queue_cmd *trcmd)
+{
+   int len;
+   struct utp_upiu_rsp *upiu = trcmd->resp_upiu;
+   unsigned char *buf = trcmd->scmd->sense_buffer;
+
+   if (buf) 

[PATCH 1/1] [scsi] ufs: Remove redundant platform_set_drvdata()

2013-05-03 Thread Sachin Kamat
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat 
---
 drivers/scsi/ufs/ufshcd-pltfrm.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
index 03319ac..3db2ee1 100644
--- a/drivers/scsi/ufs/ufshcd-pltfrm.c
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
@@ -184,7 +184,6 @@ static int ufshcd_pltfrm_remove(struct platform_device 
*pdev)
mem_size = resource_size(mem_res);
release_mem_region(mem_res->start, mem_size);
}
-   platform_set_drvdata(pdev, NULL);
return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: initial LIO iSER performance numbers [was: GIT PULL] target updates for v3.10-rc1)

2013-05-03 Thread Asias He
On Fri, May 03, 2013 at 09:57:20AM +0300, Or Gerlitz wrote:
> On Thu, May 2, 2013 at 10:31 PM, Nicholas A. Bellinger
>  wrote:
> 
> >> We used RAMDISK_MCP backend which was patched to act as NULL device, so
> >> we can test the raw iSER wire performance.
> 
> > Btw, I'll be including a similar patch to allow for RAMDISK_NULL to be
> > configured as a NULL device mode.
> 
> yep, that would be very helpful, so people can do that sort of testing
> without hacks...

+1, I used to hack drivers/block/brd.c to get a NULL ramdisk.

> Or.

-- 
Asias
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html