linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomas Henzl <thenzl@redhat.com>
To: linux-scsi@vger.kernel.org
Cc: steve.masters@lsi.com, michael.benz@lsi.com, aradford@gmail.com,
	bo.yang@lsi.com, Tomas Henzl <thenzl@redhat.com>
Subject: [PATCH 2/2] megaraid_sas: Initialize the cmd field to a known value
Date: Wed, 24 Aug 2011 17:35:30 +0200	[thread overview]
Message-ID: <1314200130-28890-3-git-send-email-thenzl@redhat.com> (raw)
In-Reply-To: <1314200130-28890-1-git-send-email-thenzl@redhat.com>

When the command is returned to the pool initialize it with a known value,
this helps to recognize an errant (non-initialized) command and skip it later.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/megaraid/megaraid_sas.h      |    4 ++++
 drivers/scsi/megaraid/megaraid_sas_base.c |    5 +++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index 3cdb769..edc0117 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -138,6 +138,10 @@
 #define MFI_CMD_ABORT				0x06
 #define MFI_CMD_SMP				0x07
 #define MFI_CMD_STP				0x08
+#define MFI_CMD_GHOST				0x09
+/*
+ * Ghost command - used to catch unexpected messages from the hardware
+ */
 
 #define MR_DCMD_CTRL_GET_INFO			0x01010000
 #define MR_DCMD_LD_GET_LIST			0x03010000
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 14c33f6..4b8f457 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -212,6 +212,7 @@ megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd)
 
 	cmd->scmd = NULL;
 	cmd->frame_count = 0;
+	cmd->frame->hdr.cmd = MFI_CMD_GHOST;
 	list_add_tail(&cmd->list, &instance->cmd_pool);
 
 	spin_unlock_irqrestore(&instance->cmd_pool_lock, flags);
@@ -2288,6 +2289,10 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 		megasas_complete_abort(instance, cmd);
 		break;
 
+	case MFI_CMD_GHOST:
+		printk("megasas: Ghost command arrived, this really shoudn't happen!\n");
+		break;
+
 	default:
 		printk("megasas: Unknown command completed! [0x%X]\n",
 		       hdr->cmd);
-- 
1.7.6


      parent reply	other threads:[~2011-08-24 15:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 15:35 [PATCH 0/2] megaraid_sas: Fix an errant command from hw Tomas Henzl
2011-08-24 15:35 ` [PATCH 1/2] megaraid_sas: Remove the shutdown_controller call Tomas Henzl
2011-08-24 20:55   ` adam radford
2011-08-25  8:17     ` Tomas Henzl
2011-08-26  0:00       ` adam radford
2011-09-05 14:17         ` Tomas Henzl
2011-08-24 15:35 ` Tomas Henzl [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=1314200130-28890-3-git-send-email-thenzl@redhat.com \
    --to=thenzl@redhat.com \
    --cc=aradford@gmail.com \
    --cc=bo.yang@lsi.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michael.benz@lsi.com \
    --cc=steve.masters@lsi.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;
as well as URLs for NNTP newsgroup(s).