All of lore.kernel.org
 help / color / mirror / Atom feed
From: Himanshu Madhani <hmadhani@marvell.com>
To: <James.Bottomley@HansenPartnership.com>, <martin.petersen@oracle.com>
Cc: <hmadhani@marvell.com>, <linux-scsi@vger.kernel.org>
Subject: [PATCH 12/25] qla2xxx: Cleanup ELS/PUREX iocb fields
Date: Wed, 12 Feb 2020 13:44:23 -0800	[thread overview]
Message-ID: <20200212214436.25532-13-hmadhani@marvell.com> (raw)
In-Reply-To: <20200212214436.25532-1-hmadhani@marvell.com>

From: Joe Carnuccio <joe.carnuccio@cavium.com>

This patch does following to improve RDP processing

- Rename field port_id to d_id in ELS and PUREX iocb structs
  to match FW spec.
- Remove redundant comments from ELS and PUREX iocb structs.
- Refactor fields in ELS iocb struct for error subcode
  common access.
- Properly use error subcode fields in rdp processing routine.
- Add print logs for alloc failure in purex rdp processing routine.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
---
 drivers/scsi/qla2xxx/qla_fw.h   | 39 +++++++++++++++++++++++++--------------
 drivers/scsi/qla2xxx/qla_iocb.c | 12 ++++++------
 drivers/scsi/qla2xxx/qla_os.c   | 28 +++++++++++++++++-----------
 3 files changed, 48 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index 649bdfd61bc5..f7a40dcda7ce 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -779,9 +779,8 @@ struct els_entry_24xx {
 
 	uint32_t handle;		/* System handle. */
 
-	uint16_t reserved_1;
-
-	uint16_t nport_handle;		/* N_PORT handle. */
+	uint16_t comp_status;		/* response only */
+	uint16_t nport_handle;
 
 	uint16_t tx_dsd_count;
 
@@ -796,7 +795,7 @@ struct els_entry_24xx {
 	uint8_t opcode;
 	uint8_t reserved_2;
 
-	uint8_t port_id[3];
+	uint8_t d_id[3];
 	uint8_t s_id[3];
 
 	uint16_t control_flags;		/* Control flags. */
@@ -808,13 +807,24 @@ struct els_entry_24xx {
 #define ECF_CLR_PASSTHRU_PEND	BIT_12
 #define ECF_INCL_FRAME_HDR	BIT_11
 
-	__le32	 rx_byte_count;
-	__le32	 tx_byte_count;
+	union {
+		struct {
+			__le32	 rx_byte_count;
+			__le32	 tx_byte_count;
 
-	__le64	 tx_address __packed;	/* Data segment 0 address. */
-	__le32	 tx_len;		/* Data segment 0 length. */
-	__le64	 rx_address __packed;	/* Data segment 1 address. */
-	__le32	 rx_len;		/* Data segment 1 length. */
+			__le64	 tx_address __packed;	/* DSD 0 address. */
+			__le32	 tx_len;		/* DSD 0 length. */
+
+			__le64	 rx_address __packed;	/* DSD 1 address. */
+			__le32	 rx_len;		/* DSD 1 length. */
+		};
+		struct {
+			uint32_t total_byte_count;
+			uint32_t error_subcode_1;
+			uint32_t error_subcode_2;
+			uint32_t error_subcode_3;
+		};
+	};
 };
 
 struct els_sts_entry_24xx {
@@ -840,15 +850,16 @@ struct els_sts_entry_24xx {
 	uint8_t opcode;
 	uint8_t reserved_3;
 
-	uint8_t port_id[3];
-	uint8_t reserved_4;
-
-	uint16_t reserved_5;
+	uint8_t d_id[3];
+	uint8_t s_id[3];
 
 	uint16_t control_flags;		/* Control flags. */
 	uint32_t total_byte_count;
 	uint32_t error_subcode_1;
 	uint32_t error_subcode_2;
+	uint32_t error_subcode_3;
+
+	uint32_t reserved_4[4];
 };
 /*
  * ISP queue - Mailbox Command entry structure definition.
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 47bf60a9490a..5b73d09da739 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -2684,9 +2684,9 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
 	els_iocb->rx_dsd_count = 0;
 	els_iocb->opcode = elsio->u.els_logo.els_cmd;
 
-	els_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
-	els_iocb->port_id[1] = sp->fcport->d_id.b.area;
-	els_iocb->port_id[2] = sp->fcport->d_id.b.domain;
+	els_iocb->d_id[0] = sp->fcport->d_id.b.al_pa;
+	els_iocb->d_id[1] = sp->fcport->d_id.b.area;
+	els_iocb->d_id[2] = sp->fcport->d_id.b.domain;
 	/* For SID the byte order is different than DID */
 	els_iocb->s_id[1] = vha->d_id.b.al_pa;
 	els_iocb->s_id[2] = vha->d_id.b.area;
@@ -3030,9 +3030,9 @@ qla24xx_els_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
 	    sp->type == SRB_ELS_CMD_RPT ?
 	    bsg_request->rqst_data.r_els.els_code :
 	    bsg_request->rqst_data.h_els.command_code;
-        els_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
-        els_iocb->port_id[1] = sp->fcport->d_id.b.area;
-        els_iocb->port_id[2] = sp->fcport->d_id.b.domain;
+	els_iocb->d_id[0] = sp->fcport->d_id.b.al_pa;
+	els_iocb->d_id[1] = sp->fcport->d_id.b.area;
+	els_iocb->d_id[2] = sp->fcport->d_id.b.domain;
         els_iocb->control_flags = 0;
         els_iocb->rx_byte_count =
             cpu_to_le32(bsg_job->reply_payload.payload_len);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index dbbe20c7fbaf..295c7fec0918 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -5886,13 +5886,19 @@ static int qla24xx_process_purex_iocb(struct scsi_qla_host *vha, void *pkt)
 
 	rsp_els = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_els),
 	    &rsp_els_dma, GFP_KERNEL);
-	if (!rsp_els)
+	if (!rsp_els) {
+		ql_log(ql_log_warn, vha, 0x0183,
+		    "Failed allocate dma buffer ELS RSP.\n");
 		goto dealloc;
+	}
 
 	rsp_payload = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_payload),
 	    &rsp_payload_dma, GFP_KERNEL);
-	if (!rsp_payload)
+	if (!rsp_payload) {
+		ql_log(ql_log_warn, vha, 0x0184,
+		    "Failed allocate dma buffer ELS RSP payload.\n");
 		goto dealloc;
+	}
 
 	sfp = dma_alloc_coherent(&ha->pdev->dev, SFP_RTDI_LEN,
 	    &sfp_dma, GFP_KERNEL);
@@ -5918,9 +5924,9 @@ static int qla24xx_process_purex_iocb(struct scsi_qla_host *vha, void *pkt)
 	rsp_els->rx_dsd_count = 0;
 	rsp_els->opcode = purex->els_frame_payload[0];
 
-	rsp_els->port_id[0] = purex->s_id[0];
-	rsp_els->port_id[1] = purex->s_id[1];
-	rsp_els->port_id[2] = purex->s_id[2];
+	rsp_els->d_id[0] = purex->s_id[0];
+	rsp_els->d_id[1] = purex->s_id[1];
+	rsp_els->d_id[2] = purex->s_id[2];
 
 	rsp_els->control_flags = EPD_ELS_ACC;
 	rsp_els->rx_byte_count = 0;
@@ -6263,14 +6269,14 @@ static int qla24xx_process_purex_iocb(struct scsi_qla_host *vha, void *pkt)
 
 	rval = qla2x00_issue_iocb(vha, rsp_els, rsp_els_dma, 0);
 
-	if (rval != QLA_SUCCESS) {
+	if (rval) {
 		ql_log(ql_log_warn, vha, 0x0188,
-		    "%s: failed to issue IOCB (%x).\n", __func__, rval);
-	} else if (rsp_els->entry_status != 0) {
+		    "%s: iocb failed to execute -> %x\n", __func__, rval);
+	} else if (rsp_els->comp_status) {
 		ql_log(ql_log_warn, vha, 0x0189,
-		    "%s: failed to complete IOCB -- error status (%x).\n",
-		    __func__, rsp_els->entry_status);
-		rval = QLA_FUNCTION_FAILED;
+		    "%s: iocb failed to complete -> completion=%#x subcode=(%#x,%#x)\n",
+		    __func__, rsp_els->comp_status,
+		    rsp_els->error_subcode_1, rsp_els->error_subcode_2);
 	} else {
 		ql_dbg(ql_dbg_init, vha, 0x018a, "%s: done.\n", __func__);
 	}
-- 
2.12.0


  parent reply	other threads:[~2020-02-12 21:47 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 21:44 [PATCH 00/25] qla2xxx: Updates for the driver Himanshu Madhani
2020-02-12 21:44 ` [PATCH 01/25] qla2xxx: Add beacon LED config sysfs interface Himanshu Madhani
2020-02-12 21:44 ` [PATCH 02/25] qla2xxx: Move free of fcport out of interrupt context Himanshu Madhani
2020-02-12 21:44 ` [PATCH 03/25] qla2xxx: Add sysfs node for D-Port Diagnostics AEN data Himanshu Madhani
2020-02-12 21:44 ` [PATCH 04/25] qla2xxx: Remove all DIX-0 references Himanshu Madhani
2020-02-12 21:44 ` [PATCH 05/25] qla2xxx: Add endianizer macro calls to fc host stats Himanshu Madhani
2020-02-12 21:44 ` [PATCH 06/25] qla2xxx: Add changes in preparation for vendor extended FDMI/RDP Himanshu Madhani
2020-02-12 21:44 ` [PATCH 07/25] qla2xxx: Add vendor extended RDP additions and amendments Himanshu Madhani
2020-02-12 21:44 ` [PATCH 08/25] qla2xxx: Add ql2xrdpenable module parameter for RDP Himanshu Madhani
2020-02-12 21:44 ` [PATCH 09/25] qla2xxx: Add vendor extended FDMI commands Himanshu Madhani
2020-02-12 21:44 ` [PATCH 10/25] qla2xxx: Display message for FCE enabled Himanshu Madhani
2020-02-12 21:44 ` [PATCH 11/25] qla2xxx: Show correct port speed capabilities for RDP command Himanshu Madhani
2020-02-12 21:44 ` Himanshu Madhani [this message]
2020-02-12 21:44 ` [PATCH 13/25] qla2xxx: Add deferred queue for processing ABTS and RDP Himanshu Madhani
2020-02-12 21:44 ` [PATCH 14/25] qla2xxx: Handle cases for limiting RDP response payload length Himanshu Madhani
2020-02-12 21:44 ` [PATCH 15/25] qla2xxx: Fix RDP response size Himanshu Madhani
2020-02-12 21:44 ` [PATCH 16/25] qla2xxx: Use endian macros to assign static fields in fwdump header Himanshu Madhani
2020-02-12 21:44 ` [PATCH 17/25] qla2xxx: Correction to selection of loopback/echo test Himanshu Madhani
2020-02-12 21:44 ` [PATCH 18/25] qla2xxx: Fix qla2x00_echo_test() based on ISP type Himanshu Madhani
2020-02-12 21:44 ` [PATCH 19/25] qla2xxx: Print portname for logging in qla24xx_logio_entry() Himanshu Madhani
2020-02-12 21:44 ` [PATCH 20/25] qla2xxx: Use correct ISP28xx active FW region Himanshu Madhani
2020-02-12 21:44 ` [PATCH 21/25] qla2xxx: Save rscn_gen for new fcport Himanshu Madhani
2020-02-12 21:44 ` [PATCH 22/25] qla2xxx: Fix control flags for login/logout IOCB Himanshu Madhani
2020-02-12 21:44 ` [PATCH 23/25] qla2xxx: Add fixes for mailbox command Himanshu Madhani
2020-02-12 21:44 ` [PATCH 24/25] qla2xxx: Use QLA_FW_STOPPED macro to propagate flag Himanshu Madhani
2020-02-12 21:44 ` [PATCH 25/25] qla2xxx: Update driver version to 10.01.00.24-k Himanshu Madhani
2020-02-21 23:33 ` [PATCH 00/25] qla2xxx: Updates for the driver Martin K. Petersen
2020-02-24 16:36   ` Himanshu Madhani
2020-02-25  4:32   ` Bart Van Assche

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=20200212214436.25532-13-hmadhani@marvell.com \
    --to=hmadhani@marvell.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.