summaryrefslogtreecommitdiffstats
path: root/drivers/target/iscsi
diff options
context:
space:
mode:
authorMike Christie <michael.christie@oracle.com>2023-03-18 20:56:15 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2023-03-24 17:32:23 -0400
commit6d256bee602b131bd4fbc92863b6a1210bcf6325 (patch)
treebf88ed77e94ca2ffb23210cefdb644245c7dae87 /drivers/target/iscsi
parent8e288be8606ad87c1726618eacfb8fbd3ab4b806 (diff)
downloadlinux-6d256bee602b131bd4fbc92863b6a1210bcf6325.tar.gz
linux-6d256bee602b131bd4fbc92863b6a1210bcf6325.tar.bz2
linux-6d256bee602b131bd4fbc92863b6a1210bcf6325.zip
scsi: target: iscsit: isert: Alloc per conn cmd counter
This has iscsit allocate a per conn cmd counter and converts iscsit/isert to use it instead of the per session one. Signed-off-by: Mike Christie <michael.christie@oracle.com> Link: https://lore.kernel.org/r/20230319015620.96006-5-michael.christie@oracle.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/target/iscsi')
-rw-r--r--drivers/target/iscsi/iscsi_target.c4
-rw-r--r--drivers/target/iscsi/iscsi_target_login.c17
2 files changed, 9 insertions, 12 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 87927a36f90d..11115c207844 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1193,7 +1193,7 @@ int iscsit_setup_scsi_cmd(struct iscsit_conn *conn, struct iscsit_cmd *cmd,
conn->sess->se_sess, be32_to_cpu(hdr->data_length),
cmd->data_direction, sam_task_attr,
cmd->sense_buffer + 2, scsilun_to_int(&hdr->lun),
- conn->sess->se_sess->cmd_cnt);
+ conn->cmd_cnt);
pr_debug("Got SCSI Command, ITT: 0x%08x, CmdSN: 0x%08x,"
" ExpXferLen: %u, Length: %u, CID: %hu\n", hdr->itt,
@@ -2057,7 +2057,7 @@ iscsit_handle_task_mgt_cmd(struct iscsit_conn *conn, struct iscsit_cmd *cmd,
conn->sess->se_sess, 0, DMA_NONE,
TCM_SIMPLE_TAG, cmd->sense_buffer + 2,
scsilun_to_int(&hdr->lun),
- conn->sess->se_sess->cmd_cnt);
+ conn->cmd_cnt);
target_get_sess_cmd(&cmd->se_cmd, true);
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
index 8ab6c0107d89..274bdd7845ca 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -324,18 +324,8 @@ static int iscsi_login_zero_tsih_s1(
goto free_ops;
}
- /*
- * This is temp for iser. It will be moved to per conn in later
- * patches for iscsi.
- */
- sess->se_sess->cmd_cnt = target_alloc_cmd_counter();
- if (!sess->se_sess->cmd_cnt)
- goto free_se_sess;
-
return 0;
-free_se_sess:
- transport_free_session(sess->se_sess);
free_ops:
kfree(sess->sess_ops);
free_id:
@@ -1157,8 +1147,14 @@ static struct iscsit_conn *iscsit_alloc_conn(struct iscsi_np *np)
goto free_conn_cpumask;
}
+ conn->cmd_cnt = target_alloc_cmd_counter();
+ if (!conn->cmd_cnt)
+ goto free_conn_allowed_cpumask;
+
return conn;
+free_conn_allowed_cpumask:
+ free_cpumask_var(conn->allowed_cpumask);
free_conn_cpumask:
free_cpumask_var(conn->conn_cpumask);
free_conn_ops:
@@ -1172,6 +1168,7 @@ free_conn:
void iscsit_free_conn(struct iscsit_conn *conn)
{
+ target_free_cmd_counter(conn->cmd_cnt);
free_cpumask_var(conn->allowed_cpumask);
free_cpumask_var(conn->conn_cpumask);
kfree(conn->conn_ops);