mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 15:22:21 -04:00
scsi: ibmvfc: update state machine to process NVMe/FC targets
Update the host work loop and target state-machine helpers to process NVMe targets in addition to SCSI targets. Check both protocol-specific target lists when determining whether there is initialization or logout work pending, and extend the query, target init, and target delete phases to dispatch work for NVMe targets using the same common state-machine callbacks. This allows the existing discovery and login state machine to drive NVMe/FC targets through query, login, and deletion without duplicating the control flow. Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com> Link: https://patch.msgid.link/20260723000149.969416-23-tyreld@linux.ibm.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
e0fca728a8
commit
0a3ab63e43
@@ -5718,6 +5718,11 @@ static int ibmvfc_dev_init_to_do(struct ibmvfc_host *vhost)
|
||||
tgt->action == IBMVFC_TGT_ACTION_INIT_WAIT)
|
||||
return 1;
|
||||
}
|
||||
list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) {
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_INIT ||
|
||||
tgt->action == IBMVFC_TGT_ACTION_INIT_WAIT)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -5738,6 +5743,11 @@ static int ibmvfc_dev_logo_to_do(struct ibmvfc_host *vhost)
|
||||
tgt->action == IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT)
|
||||
return 1;
|
||||
}
|
||||
list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) {
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_LOGOUT_RPORT ||
|
||||
tgt->action == IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5766,9 +5776,15 @@ static int __ibmvfc_work_to_do(struct ibmvfc_host *vhost)
|
||||
list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue)
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_INIT)
|
||||
return 1;
|
||||
list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue)
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_INIT)
|
||||
return 1;
|
||||
list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue)
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_INIT_WAIT)
|
||||
return 0;
|
||||
list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue)
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_INIT_WAIT)
|
||||
return 0;
|
||||
return 1;
|
||||
case IBMVFC_HOST_ACTION_TGT_DEL:
|
||||
case IBMVFC_HOST_ACTION_TGT_DEL_FAILED:
|
||||
@@ -5777,9 +5793,15 @@ static int __ibmvfc_work_to_do(struct ibmvfc_host *vhost)
|
||||
list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue)
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_LOGOUT_RPORT)
|
||||
return 1;
|
||||
list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue)
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_LOGOUT_RPORT)
|
||||
return 1;
|
||||
list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue)
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT)
|
||||
return 0;
|
||||
list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue)
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_LOGOUT_RPORT_WAIT)
|
||||
return 0;
|
||||
return 1;
|
||||
case IBMVFC_HOST_ACTION_LOGO:
|
||||
case IBMVFC_HOST_ACTION_INIT:
|
||||
@@ -5967,6 +5989,8 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
|
||||
case IBMVFC_HOST_ACTION_QUERY:
|
||||
list_for_each_entry(tgt, &vhost->scsi_scrqs.targets, queue)
|
||||
ibmvfc_init_tgt(tgt, ibmvfc_tgt_query_target);
|
||||
list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue)
|
||||
ibmvfc_init_tgt(tgt, ibmvfc_tgt_query_target);
|
||||
ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_QUERY_TGTS);
|
||||
break;
|
||||
case IBMVFC_HOST_ACTION_QUERY_TGTS:
|
||||
@@ -5976,6 +6000,12 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
|
||||
break;
|
||||
}
|
||||
}
|
||||
list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) {
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_INIT) {
|
||||
tgt->job_step(tgt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ibmvfc_dev_init_to_do(vhost))
|
||||
ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_TGT_DEL);
|
||||
@@ -5988,6 +6018,12 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
|
||||
break;
|
||||
}
|
||||
}
|
||||
list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) {
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_LOGOUT_RPORT) {
|
||||
tgt->job_step(tgt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ibmvfc_dev_logo_to_do(vhost)) {
|
||||
spin_unlock_irqrestore(vhost->host->host_lock, flags);
|
||||
@@ -6075,6 +6111,12 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
|
||||
break;
|
||||
}
|
||||
}
|
||||
list_for_each_entry(tgt, &vhost->nvme_scrqs.targets, queue) {
|
||||
if (tgt->action == IBMVFC_TGT_ACTION_INIT) {
|
||||
tgt->job_step(tgt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ibmvfc_dev_init_to_do(vhost))
|
||||
ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_TGT_DEL_FAILED);
|
||||
|
||||
Reference in New Issue
Block a user