Skip to contentSkip to conversation

aacraid: Correct hba_send to include iu_type

PATCH Applied Dave Carroll 3 participants 3 messages Apr 25, 2018 – May 2, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 aacraid: Correct hba_send to include iu_type

commit b60710ec7d7ab ("aacraid: enable sending of TMFs from aac_hba_send()")

allows aac_hba_send() to send scsi commands, and TMF requests, but the existing code only updates the iu_type for scsi commands. For TMF requests we are sending an unknown iu_type to firmware, which causes a fault.

Include iu_type prior to determining the validity of the command

Fixes b60710ec7d7ab ("aacraid: enable sending of TMFs from aac_hba_send()")
Fixes 423400e64d377 ("aacraid: Include HBA direct interface")
---
 drivers/scsi/aacraid/commsup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/aacraid/commsup.c +4 -4
index 0156c96..d62ddd6 100644
@@ -724,6 +724,8 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
 	int wait;
 	unsigned long flags = 0;
 	unsigned long mflags = 0;
+	struct aac_hba_cmd_req *hbacmd = (struct aac_hba_cmd_req *)
+			fibptr->hw_fib_va;
 
 	fibptr->flags = (FIB_CONTEXT_FLAG | FIB_CONTEXT_FLAG_NATIVE_HBA);
 	if (callback) {
@@ -734,11 +736,9 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
 		wait = 1;
 
 
-	if (command == HBA_IU_TYPE_SCSI_CMD_REQ) {
-		struct aac_hba_cmd_req *hbacmd =
-			(struct aac_hba_cmd_req *)fibptr->hw_fib_va;
+	hbacmd->iu_type = command;
 
-		hbacmd->iu_type = command;
+	if (command == HBA_IU_TYPE_SCSI_CMD_REQ) {
 		/* bit1 of request_id must be 0 */
 		hbacmd->request_id =
 			cpu_to_le32((((u32)(fibptr - dev->fibs)) << 2) + 1);
Signature · 1 line
2.8.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 37 lines · Dave Carroll

commit b60710ec7d7ab ("aacraid: enable sending of TMFs from aac_hba_send()")

allows aac_hba_send() to send scsi commands, and TMF requests, but the existing code only updates the iu_type for scsi commands. For TMF requests we are sending an unknown iu_type to firmware, which causes a fault.

Include iu_type prior to determining the validity of the command

Fixes b60710ec7d7ab ("aacraid: enable sending of TMFs from aac_hba_send()")
Fixes 423400e64d377 ("aacraid: Include HBA direct interface")
---
 drivers/scsi/aacraid/commsup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/aacraid/commsup.c +2 -0
index 0156c96..d62ddd6 100644
@@ -724,6 +724,8 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
 	int wait;
 	unsigned long flags = 0;
 	unsigned long mflags = 0;
+	struct aac_hba_cmd_req *hbacmd = (struct aac_hba_cmd_req *)
+			fibptr->hw_fib_va;
 
 	fibptr->flags = (FIB_CONTEXT_FLAG | FIB_CONTEXT_FLAG_NATIVE_HBA);
 	if (callback) {
@@ -734,11 +736,9 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
 		wait = 1;
 
 

drivers/scsi/aacraid/commsup.c int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback, · line 744

Quoted 10 lines
drivers/scsi/aacraid/commsup.c +2 -4
-	if (command == HBA_IU_TYPE_SCSI_CMD_REQ) {
-		struct aac_hba_cmd_req *hbacmd =
-			(struct aac_hba_cmd_req *)fibptr->hw_fib_va;
+	hbacmd->iu_type = command;
 
-		hbacmd->iu_type = command;
+	if (command == HBA_IU_TYPE_SCSI_CMD_REQ) {
 		/* bit1 of request_id must be 0 */
 		hbacmd->request_id =
 			cpu_to_le32((((u32)(fibptr - dev->fibs)) << 2) + 1);
Signature · 3 lines
Brian King
Power Linux I/O
IBM Linux Technology Center
#2 lore raw
In reply to Dave Carroll

Dave,

Quoted 7 lines

commit b60710ec7d7ab ("aacraid: enable sending of TMFs from aac_hba_send()")

allows aac_hba_send() to send scsi commands, and TMF requests, but the existing code only updates the iu_type for scsi commands. For TMF requests we are sending an unknown iu_type to firmware, which causes a fault.

Include iu_type prior to determining the validity of the command

Applied to 4.17/scsi-fixes. Thank you!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering