Add protocol-specific query-target support for NVMe/FC targets.

Use the NVMe query-target specific MAD when querying an NVMe target and
update the associated debug and error logging to include the target
protocol.

Signed-off-by: Tyrel Datwyler <[email protected]>
---
 drivers/scsi/ibmvscsi/ibmvfc-core.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c 
b/drivers/scsi/ibmvscsi/ibmvfc-core.c
index b45cd0183fb5..363bf75d6244 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc-core.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c
@@ -4849,7 +4849,7 @@ static void ibmvfc_tgt_query_target_done(struct 
ibmvfc_event *evt)
        ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE);
        switch (status) {
        case IBMVFC_MAD_SUCCESS:
-               tgt_dbg(tgt, "Query Target succeeded\n");
+               tgt_dbg(tgt, "%s Query Target succeeded\n", 
proto_type[tgt->protocol]);
                if (be64_to_cpu(rsp->scsi_id) != tgt->scsi_id)
                        ibmvfc_del_tgt(tgt);
                else
@@ -4871,9 +4871,9 @@ static void ibmvfc_tgt_query_target_done(struct 
ibmvfc_event *evt)
                else
                        ibmvfc_del_tgt(tgt);
 
-               tgt_log(tgt, level, "Query Target failed: %s (%x:%x) %s (%x) %s 
(%x) rc=0x%02X\n",
-                       ibmvfc_get_cmd_error(be16_to_cpu(rsp->status), 
be16_to_cpu(rsp->error)),
-                       be16_to_cpu(rsp->status), be16_to_cpu(rsp->error),
+               tgt_log(tgt, level, "%s Query Target failed: %s (%x:%x) %s (%x) 
%s (%x) rc=0x%02X\n",
+                       proto_type[tgt->protocol], 
ibmvfc_get_cmd_error(be16_to_cpu(rsp->status),
+                       be16_to_cpu(rsp->error)), be16_to_cpu(rsp->status), 
be16_to_cpu(rsp->error),
                        ibmvfc_get_fc_type(be16_to_cpu(rsp->fc_type)), 
be16_to_cpu(rsp->fc_type),
                        ibmvfc_get_gs_explain(be16_to_cpu(rsp->fc_explain)), 
be16_to_cpu(rsp->fc_explain),
                        status);
@@ -4913,7 +4913,10 @@ static void ibmvfc_tgt_query_target(struct ibmvfc_target 
*tgt)
        query_tgt = &evt->iu.query_tgt;
        memset(query_tgt, 0, sizeof(*query_tgt));
        query_tgt->common.version = cpu_to_be32(1);
-       query_tgt->common.opcode = cpu_to_be32(IBMVFC_QUERY_TARGET);
+       if (tgt->protocol == IBMVFC_PROTO_SCSI)
+               query_tgt->common.opcode = cpu_to_be32(IBMVFC_QUERY_TARGET);
+       else
+               query_tgt->common.opcode = 
cpu_to_be32(IBMVFC_NVMF_QUERY_TARGET);
        query_tgt->common.length = cpu_to_be16(sizeof(*query_tgt));
        query_tgt->wwpn = cpu_to_be64(tgt->ids.port_name);
 
@@ -4923,7 +4926,7 @@ static void ibmvfc_tgt_query_target(struct ibmvfc_target 
*tgt)
                ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE);
                kref_put(&tgt->kref, ibmvfc_release_tgt);
        } else
-               tgt_dbg(tgt, "Sent Query Target\n");
+               tgt_dbg(tgt, "Sent %s Query Target\n", 
proto_type[tgt->protocol]);
 }
 
 /**
-- 
2.54.0


Reply via email to