Re: [PATCH 3/2] target: Add support for 64-bit tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/14/2015 3:31 PM, Bart Van Assche wrote:
For several transports (e.g. SRP) tags are 64 bits wide.
Hence add support for 64-bit tags.

Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Andy Grover <agrover@xxxxxxxxxx>
Cc: Sagi Grimberg <sagig@xxxxxxxxxxxx>
Cc: <qla2xxx-upstream@xxxxxxxxxx>
Cc: Felipe Balbi <balbi@xxxxxx>
Cc: Michael S. Tsirkin <mst@xxxxxxxxxx>
Cc: Juergen Gross <jgross@xxxxxxxx>
---
  drivers/infiniband/ulp/srpt/ib_srpt.c  |  8 ++++----
  drivers/scsi/qla2xxx/qla_target.c      | 14 +++++++-------
  drivers/target/sbp/sbp_target.c        |  2 +-
  drivers/target/target_core_tmr.c       |  8 ++++----
  drivers/target/target_core_transport.c | 14 +++++++-------
  include/target/target_core_base.h      |  4 ++--
  6 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 86b0a0a..5ec3374 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -1339,7 +1339,7 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx)
  		goto out;
  	}

-	pr_debug("Aborting cmd with state %d and tag %d\n", state,
+	pr_debug("Aborting cmd with state %d and tag %lld\n", state,
  		 ioctx->cmd.tag);

  	switch (state) {
@@ -2976,7 +2976,7 @@ static int srpt_write_pending(struct se_cmd *se_cmd)
  	case CH_DISCONNECTING:
  	case CH_DRAINING:
  	case CH_RELEASING:
-		pr_debug("cmd with tag %d: channel disconnecting\n",
+		pr_debug("cmd with tag %lld: channel disconnecting\n",
  			 ioctx->cmd.tag);
  		srpt_set_cmd_state(ioctx, SRPT_STATE_DATA_IN);
  		ret = -EINVAL;
@@ -3051,7 +3051,7 @@ static void srpt_queue_response(struct se_cmd *cmd)
  	    !ioctx->queue_status_only) {
  		ret = srpt_xfer_data(ch, ioctx);
  		if (ret) {
-			printk(KERN_ERR "xfer_data failed for tag %u\n",
+			printk(KERN_ERR "xfer_data failed for tag %llu\n",
  			       ioctx->cmd.tag);
  			return;
  		}
@@ -3068,7 +3068,7 @@ static void srpt_queue_response(struct se_cmd *cmd)
  	}
  	ret = srpt_post_send(ch, ioctx, resp_len);
  	if (ret) {
-		printk(KERN_ERR "sending cmd response failed for tag %u\n",
+		printk(KERN_ERR "sending cmd response failed for tag %llu\n",
  		       ioctx->cmd.tag);
  		srpt_unmap_sg_to_ib_sge(ch, ioctx);
  		srpt_set_cmd_state(ioctx, SRPT_STATE_DONE);
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 87f3b84..e7515069 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1728,7 +1728,7 @@ static int qlt_pre_xmit_response(struct qla_tgt_cmd *cmd,

  	if (unlikely(cmd->aborted)) {
  		ql_dbg(ql_dbg_tgt_mgt, vha, 0xf014,
-		       "qla_target(%d): terminating exchange for aborted cmd=%p (se_cmd=%p, tag=%d)",
+		       "qla_target(%d): terminating exchange for aborted cmd=%p (se_cmd=%p, tag=%lld)",
  		       vha->vp_idx, cmd, se_cmd, se_cmd->tag);

  		cmd->state = QLA_TGT_STATE_ABORTED;
@@ -1764,7 +1764,7 @@ static int qlt_pre_xmit_response(struct qla_tgt_cmd *cmd,
  	if (se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) {
  		prm->residual = se_cmd->residual_count;
  		ql_dbg(ql_dbg_io + ql_dbg_verbose, vha, 0x305c,
-		    "Residual underflow: %d (tag %d, op %x, bufflen %d, rq_result %x)\n",
+		    "Residual underflow: %d (tag %lld, op %x, bufflen %d, rq_result %x)\n",
  		       prm->residual, se_cmd->tag,
  		       se_cmd->t_task_cdb ? se_cmd->t_task_cdb[0] : 0,
  		       cmd->bufflen, prm->rq_result);
@@ -1772,7 +1772,7 @@ static int qlt_pre_xmit_response(struct qla_tgt_cmd *cmd,
  	} else if (se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) {
  		prm->residual = se_cmd->residual_count;
  		ql_dbg(ql_dbg_io, vha, 0x305d,
-		    "Residual overflow: %d (tag %d, op %x, bufflen %d, rq_result %x)\n",
+		    "Residual overflow: %d (tag %lld, op %x, bufflen %d, rq_result %x)\n",
  		       prm->residual, se_cmd->tag, se_cmd->t_task_cdb ?
  		       se_cmd->t_task_cdb[0] : 0, cmd->bufflen, prm->rq_result);
  		prm->rq_result |= SS_RESIDUAL_OVER;
@@ -3192,7 +3192,7 @@ skip_term:
  		return;
  	} else if (cmd->state == QLA_TGT_STATE_ABORTED) {
  		ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01e,
-		  "Aborted command %p (tag %d) finished\n", cmd, se_cmd->tag);
+		  "Aborted command %p (tag %lld) finished\n", cmd, se_cmd->tag);
  	} else {
  		ql_dbg(ql_dbg_tgt_mgt, vha, 0xf05c,
  		    "qla_target(%d): A command in state (%d) should "
@@ -3889,7 +3889,7 @@ static void qlt_handle_srr(struct scsi_qla_host *vha,
  			resp = 1;
  		} else {
  			ql_dbg(ql_dbg_tgt_mgt, vha, 0xf064,
-			       "qla_target(%d): SRR for in data for cmd without them (tag %d, SCSI status %d), reject",
+			       "qla_target(%d): SRR for in data for cmd without them (tag %lld, SCSI status %d), reject",
  			       vha->vp_idx, se_cmd->tag,
  			    cmd->se_cmd.scsi_status);
  			goto out_reject;
@@ -3924,7 +3924,7 @@ static void qlt_handle_srr(struct scsi_qla_host *vha,
  			}
  		} else {
  			ql_dbg(ql_dbg_tgt_mgt, vha, 0xf066,
-			    "qla_target(%d): SRR for out data for cmd without them (tag %d, SCSI status %d), reject",
+			    "qla_target(%d): SRR for out data for cmd without them (tag %lld, SCSI status %d), reject",
  			       vha->vp_idx, se_cmd->tag, cmd->se_cmd.scsi_status);
  			goto out_reject;
  		}
@@ -4046,7 +4046,7 @@ restart:
  		cmd->sg = se_cmd->t_data_sg;

  		ql_dbg(ql_dbg_tgt_mgt, vha, 0xf02c,
-		       "SRR cmd %p (se_cmd %p, tag %d, op %x), sg_cnt=%d, offset=%d",
+		       "SRR cmd %p (se_cmd %p, tag %lld, op %x), sg_cnt=%d, offset=%d",
  		       cmd, &cmd->se_cmd, se_cmd->tag, se_cmd->t_task_cdb ?
  		       se_cmd->t_task_cdb[0] : 0, cmd->sg_cnt, cmd->offset);

diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index 0f23583..bacd8de 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -1235,7 +1235,7 @@ static void sbp_handle_command(struct sbp_target_request *req)
  			req->orb_pointer, unpacked_lun, data_length, data_dir);

  	/* only used for printk until we do TMRs */
-	req->se_cmd.tag = (u32)req->orb_pointer;
+	req->se_cmd.tag = req->orb_pointer;
  	if (target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf,
  			      req->sense_buf, unpacked_lun, data_length,
  			      TCM_SIMPLE_TAG, data_dir, 0))
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
index 8a2cc56..015a87b 100644
--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -117,7 +117,7 @@ void core_tmr_abort_task(
  {
  	struct se_cmd *se_cmd;
  	unsigned long flags;
-	int ref_tag;
+	u64 ref_tag;

  	spin_lock_irqsave(&se_sess->sess_cmd_lock, flags);
  	list_for_each_entry(se_cmd, &se_sess->sess_cmd_list, se_cmd_list) {
@@ -164,7 +164,7 @@ void core_tmr_abort_task(
  	spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);

  out:
-	printk("ABORT_TASK: Sending TMR_TASK_DOES_NOT_EXIST for ref_tag: %d\n",
+	printk("ABORT_TASK: Sending TMR_TASK_DOES_NOT_EXIST for ref_tag: %lld\n",
  			tmr->ref_task_tag);
  	tmr->response = TMR_TASK_DOES_NOT_EXIST;
  }
@@ -289,13 +289,13 @@ static void core_tmr_drain_state_list(
  		list_del(&cmd->state_list);

  		pr_debug("LUN_RESET: %s cmd: %p"
-			" ITT/CmdSN: 0x%08x/0x%08x, i_state: %d, t_state: %d"
+			" ITT/CmdSN: 0x%08llx/0x%08x, i_state: %d, t_state: %d"
  			"cdb: 0x%02x\n",
  			(preempt_and_abort_list) ? "Preempt" : "", cmd,
  			cmd->tag, 0,
  			cmd->se_tfo->get_cmd_state(cmd), cmd->t_state,
  			cmd->t_task_cdb[0]);
-		pr_debug("LUN_RESET: ITT[0x%08x] - pr_res_key: 0x%016Lx"
+		pr_debug("LUN_RESET: ITT[0x%08llx] - pr_res_key: 0x%016Lx"
  			" -- CMD_T_ACTIVE: %d"
  			" CMD_T_STOP: %d CMD_T_SENT: %d\n",
  			cmd->tag, cmd->pr_res_key,
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 87c37bc..9c5f462 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -592,7 +592,7 @@ static int transport_cmd_check_stop(struct se_cmd *cmd, bool remove_from_lists,
  	 * this command for frontend exceptions.
  	 */
  	if (cmd->transport_state & CMD_T_STOP) {
-		pr_debug("%s:%d CMD_T_STOP for ITT: 0x%08x\n",
+		pr_debug("%s:%d CMD_T_STOP for ITT: 0x%08llx\n",
  			__func__, __LINE__, cmd->tag);

  		spin_unlock_irqrestore(&cmd->t_state_lock, flags);
@@ -1637,7 +1637,7 @@ void transport_generic_request_failure(struct se_cmd *cmd,
  {
  	int ret = 0;

-	pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08x"
+	pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08llx"
  		" CDB: 0x%02x\n", cmd, cmd->tag, cmd->t_task_cdb[0]);
  	pr_debug("-----[ i_state: %d t_state: %d sense_reason: %d\n",
  		cmd->se_tfo->get_cmd_state(cmd),
@@ -1846,7 +1846,7 @@ void target_execute_cmd(struct se_cmd *cmd)
  	 */
  	spin_lock_irq(&cmd->t_state_lock);
  	if (cmd->transport_state & CMD_T_STOP) {
-		pr_debug("%s:%d CMD_T_STOP for ITT: 0x%08x\n",
+		pr_debug("%s:%d CMD_T_STOP for ITT: 0x%08llx\n",
  			__func__, __LINE__, cmd->tag);

  		spin_unlock_irq(&cmd->t_state_lock);
@@ -2652,7 +2652,7 @@ bool transport_wait_for_tasks(struct se_cmd *cmd)

  	cmd->transport_state |= CMD_T_STOP;

-	pr_debug("wait_for_tasks: Stopping %p ITT: 0x%08x i_state: %d, t_state: %d, CMD_T_STOP\n",
+	pr_debug("wait_for_tasks: Stopping %p ITT: 0x%08llx i_state: %d, t_state: %d, CMD_T_STOP\n",
  		cmd, cmd->tag, cmd->se_tfo->get_cmd_state(cmd), cmd->t_state);

  	spin_unlock_irqrestore(&cmd->t_state_lock, flags);
@@ -2662,7 +2662,7 @@ bool transport_wait_for_tasks(struct se_cmd *cmd)
  	spin_lock_irqsave(&cmd->t_state_lock, flags);
  	cmd->transport_state &= ~(CMD_T_ACTIVE | CMD_T_STOP);

-	pr_debug("wait_for_tasks: Stopped wait_for_completion(&cmd->t_transport_stop_comp) for ITT: 0x%08x\n",
+	pr_debug("wait_for_tasks: Stopped wait_for_completion(&cmd->t_transport_stop_comp) for ITT: 0x%08llx\n",
  		cmd->tag);

  	spin_unlock_irqrestore(&cmd->t_state_lock, flags);
@@ -2965,7 +2965,7 @@ int transport_check_aborted_status(struct se_cmd *cmd, int send_status)
  	if (!send_status || !(cmd->se_cmd_flags & SCF_SEND_DELAYED_TAS))
  		return 1;

-	pr_debug("Sending delayed SAM_STAT_TASK_ABORTED status for CDB: 0x%02x ITT: 0x%08x\n",
+	pr_debug("Sending delayed SAM_STAT_TASK_ABORTED status for CDB: 0x%02x ITT: 0x%08llx\n",
  		 cmd->t_task_cdb[0], cmd->tag);

  	cmd->se_cmd_flags &= ~SCF_SEND_DELAYED_TAS;
@@ -3005,7 +3005,7 @@ void transport_send_task_abort(struct se_cmd *cmd)

  	transport_lun_remove_cmd(cmd);

-	pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x, ITT: 0x%08x\n",
+	pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x, ITT: 0x%08llx\n",
  		 cmd->t_task_cdb[0], cmd->tag);

  	trace_target_cmd_complete(cmd);
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 1800c6d..9f1314e 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -431,7 +431,7 @@ struct se_tmr_req {
  	u8			response;
  	int			call_transport;
  	/* Reference to ITT that Task Mgmt should be performed */
-	u32			ref_task_tag;
+	u64			ref_task_tag;
  	void 			*fabric_tmr_ptr;
  	struct se_cmd		*task_cmd;
  	struct se_device	*tmr_dev;
@@ -484,7 +484,7 @@ struct se_cmd {
  	u8			scsi_asc;
  	u8			scsi_ascq;
  	u16			scsi_sense_length;
-	u32			tag; /* SAM command identifier aka task tag */
+	u64			tag; /* SAM command identifier aka task tag */
  	/* Delay for ALUA Active/NonOptimized state access in milliseconds */
  	int			alua_nonop_delay;
  	/* See include/linux/dma-mapping.h */


This looks good.

Reviewed-by: Sagi Grimberg <sagig@xxxxxxxxxxxx>

P.S.
Now the tag/command allocation can be centralized as well. The
drivers duplicate this code at the moment.

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




[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux