hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/scsi/lpfc/lpfc_hbadisc.c
....@@ -1,7 +1,7 @@
11 /*******************************************************************
22 * This file is part of the Emulex Linux Device Driver for *
33 * Fibre Channel Host Bus Adapters. *
4
- * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term *
4
+ * Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term *
55 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
66 * Copyright (C) 2004-2016 Emulex. All rights reserved. *
77 * EMULEX and SLI are trademarks of Emulex. *
....@@ -28,14 +28,13 @@
2828 #include <linux/kthread.h>
2929 #include <linux/interrupt.h>
3030 #include <linux/lockdep.h>
31
+#include <linux/utsname.h>
3132
3233 #include <scsi/scsi.h>
3334 #include <scsi/scsi_device.h>
3435 #include <scsi/scsi_host.h>
3536 #include <scsi/scsi_transport_fc.h>
3637 #include <scsi/fc/fc_fs.h>
37
-
38
-#include <linux/nvme-fc-driver.h>
3938
4039 #include "lpfc_hw4.h"
4140 #include "lpfc_hw.h"
....@@ -72,6 +71,7 @@
7271 static void lpfc_disc_flush_list(struct lpfc_vport *vport);
7372 static void lpfc_unregister_fcfi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);
7473 static int lpfc_fcf_inuse(struct lpfc_hba *);
74
+static void lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *);
7575
7676 void
7777 lpfc_terminate_rport_io(struct fc_rport *rport)
....@@ -118,6 +118,7 @@
118118 struct lpfc_work_evt *evtp;
119119 int put_node;
120120 int put_rport;
121
+ unsigned long iflags;
121122
122123 rdata = rport->dd_data;
123124 ndlp = rdata->pnode;
....@@ -132,7 +133,7 @@
132133 ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag);
133134
134135 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
135
- "3181 dev_loss_callbk x%06x, rport %p flg x%x\n",
136
+ "3181 dev_loss_callbk x%06x, rport x%px flg x%x\n",
136137 ndlp->nlp_DID, ndlp->rport, ndlp->nlp_flag);
137138
138139 /* Don't defer this if we are in the process of deleting the vport
....@@ -155,37 +156,37 @@
155156 return;
156157
157158 if (rport->port_name != wwn_to_u64(ndlp->nlp_portname.u.wwn))
158
- lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE,
159
- "6789 rport name %llx != node port name %llx",
160
- rport->port_name,
161
- wwn_to_u64(ndlp->nlp_portname.u.wwn));
159
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
160
+ "6789 rport name %llx != node port name %llx",
161
+ rport->port_name,
162
+ wwn_to_u64(ndlp->nlp_portname.u.wwn));
162163
163164 evtp = &ndlp->dev_loss_evt;
164165
165166 if (!list_empty(&evtp->evt_listp)) {
166
- lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE,
167
- "6790 rport name %llx dev_loss_evt pending",
168
- rport->port_name);
167
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
168
+ "6790 rport name %llx dev_loss_evt pending",
169
+ rport->port_name);
169170 return;
170171 }
171172
172173 shost = lpfc_shost_from_vport(vport);
173
- spin_lock_irq(shost->host_lock);
174
+ spin_lock_irqsave(shost->host_lock, iflags);
174175 ndlp->nlp_flag |= NLP_IN_DEV_LOSS;
175
- spin_unlock_irq(shost->host_lock);
176
+ spin_unlock_irqrestore(shost->host_lock, iflags);
176177
177178 /* We need to hold the node by incrementing the reference
178179 * count until this queued work is done
179180 */
180181 evtp->evt_arg1 = lpfc_nlp_get(ndlp);
181182
182
- spin_lock_irq(&phba->hbalock);
183
+ spin_lock_irqsave(&phba->hbalock, iflags);
183184 if (evtp->evt_arg1) {
184185 evtp->evt = LPFC_EVT_DEV_LOSS;
185186 list_add_tail(&evtp->evt_listp, &phba->work_list);
186187 lpfc_worker_wake_up(phba);
187188 }
188
- spin_unlock_irq(&phba->hbalock);
189
+ spin_unlock_irqrestore(&phba->hbalock, iflags);
189190
190191 return;
191192 }
....@@ -212,14 +213,15 @@
212213 int put_node;
213214 int warn_on = 0;
214215 int fcf_inuse = 0;
216
+ unsigned long iflags;
215217
216218 rport = ndlp->rport;
217219 vport = ndlp->vport;
218220 shost = lpfc_shost_from_vport(vport);
219221
220
- spin_lock_irq(shost->host_lock);
222
+ spin_lock_irqsave(shost->host_lock, iflags);
221223 ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS;
222
- spin_unlock_irq(shost->host_lock);
224
+ spin_unlock_irqrestore(shost->host_lock, iflags);
223225
224226 if (!rport)
225227 return fcf_inuse;
....@@ -235,7 +237,7 @@
235237 ndlp->nlp_DID, ndlp->nlp_type, rport->scsi_target_id);
236238
237239 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
238
- "3182 dev_loss_tmo_handler x%06x, rport %p flg x%x\n",
240
+ "3182 dev_loss_tmo_handler x%06x, rport x%px flg x%x\n",
239241 ndlp->nlp_DID, ndlp->rport, ndlp->nlp_flag);
240242
241243 /*
....@@ -294,7 +296,7 @@
294296 }
295297
296298 if (warn_on) {
297
- lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
299
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
298300 "0203 Devloss timeout on "
299301 "WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x "
300302 "NPort x%06x Data: x%x x%x x%x\n",
....@@ -303,7 +305,7 @@
303305 ndlp->nlp_DID, ndlp->nlp_flag,
304306 ndlp->nlp_state, ndlp->nlp_rpi);
305307 } else {
306
- lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
308
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_TRACE_EVENT,
307309 "0204 Devloss timeout on "
308310 "WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x "
309311 "NPort x%06x Data: x%x x%x x%x\n",
....@@ -550,6 +552,15 @@
550552 fcf_inuse,
551553 nlp_did);
552554 break;
555
+ case LPFC_EVT_RECOVER_PORT:
556
+ ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1);
557
+ lpfc_sli_abts_recover_port(ndlp->vport, ndlp);
558
+ free_evt = 0;
559
+ /* decrement the node reference count held for
560
+ * this queued work
561
+ */
562
+ lpfc_nlp_put(ndlp);
563
+ break;
553564 case LPFC_EVT_ONLINE:
554565 if (phba->link_state < LPFC_LINK_DOWN)
555566 *(int *) (evtp->evt_arg1) = lpfc_online(phba);
....@@ -624,9 +635,15 @@
624635 if (phba->pci_dev_grp == LPFC_PCI_DEV_OC)
625636 lpfc_sli4_post_async_mbox(phba);
626637
627
- if (ha_copy & HA_ERATT)
638
+ if (ha_copy & HA_ERATT) {
628639 /* Handle the error attention event */
629640 lpfc_handle_eratt(phba);
641
+
642
+ if (phba->fw_dump_cmpl) {
643
+ complete(phba->fw_dump_cmpl);
644
+ phba->fw_dump_cmpl = NULL;
645
+ }
646
+ }
630647
631648 if (ha_copy & HA_MBATT)
632649 lpfc_sli_handle_mb_event(phba);
....@@ -638,8 +655,6 @@
638655 if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) {
639656 if (phba->hba_flag & HBA_RRQ_ACTIVE)
640657 lpfc_handle_rrq_active(phba);
641
- if (phba->hba_flag & FCP_XRI_ABORT_EVENT)
642
- lpfc_sli4_fcp_xri_abort_event_proc(phba);
643658 if (phba->hba_flag & ELS_XRI_ABORT_EVENT)
644659 lpfc_sli4_els_xri_abort_event_proc(phba);
645660 if (phba->hba_flag & ASYNC_EVENT)
....@@ -700,7 +715,10 @@
700715 if (!(phba->hba_flag & HBA_SP_QUEUE_EVT))
701716 set_bit(LPFC_DATA_READY, &phba->data_flags);
702717 } else {
703
- if (phba->link_state >= LPFC_LINK_UP ||
718
+ /* Driver could have abort request completed in queue
719
+ * when link goes down. Allow for this transition.
720
+ */
721
+ if (phba->link_state >= LPFC_LINK_DOWN ||
704722 phba->link_flag & LS_MDS_LOOPBACK) {
705723 pring->flag &= ~LPFC_DEFERRED_RING_EVENT;
706724 lpfc_sli_handle_slow_ring_event(phba, pring,
....@@ -753,7 +771,7 @@
753771 || kthread_should_stop()));
754772 /* Signal wakeup shall terminate the worker thread */
755773 if (rc) {
756
- lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
774
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
757775 "0433 Wakeup on signal: rc=x%x\n", rc);
758776 break;
759777 }
....@@ -821,6 +839,12 @@
821839 if ((phba->sli_rev < LPFC_SLI_REV4) &&
822840 (!remove && ndlp->nlp_type & NLP_FABRIC))
823841 continue;
842
+
843
+ /* Notify transport of connectivity loss to trigger cleanup. */
844
+ if (phba->nvmet_support &&
845
+ ndlp->nlp_state == NLP_STE_UNMAPPED_NODE)
846
+ lpfc_nvmet_invalidate_host(phba, ndlp);
847
+
824848 lpfc_disc_state_machine(vport, ndlp, NULL,
825849 remove
826850 ? NLP_EVT_DEVICE_RM
....@@ -859,10 +883,9 @@
859883 void
860884 lpfc_linkdown_port(struct lpfc_vport *vport)
861885 {
862
- struct lpfc_hba *phba = vport->phba;
863886 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
864887
865
- if (phba->cfg_enable_fc4_type != LPFC_ENABLE_NVME)
888
+ if (vport->cfg_enable_fc4_type != LPFC_ENABLE_NVME)
866889 fc_host_post_event(shost, fc_get_event_number(),
867890 FCH_EVT_LINKDOWN, 0);
868891
....@@ -894,11 +917,21 @@
894917 /* Block all SCSI stack I/Os */
895918 lpfc_scsi_dev_block(phba);
896919
920
+ phba->defer_flogi_acc_flag = false;
921
+
897922 spin_lock_irq(&phba->hbalock);
898923 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_SCAN_DONE);
899924 spin_unlock_irq(&phba->hbalock);
900925 if (phba->link_state > LPFC_LINK_DOWN) {
901926 phba->link_state = LPFC_LINK_DOWN;
927
+ if (phba->sli4_hba.conf_trunk) {
928
+ phba->trunk_link.link0.state = 0;
929
+ phba->trunk_link.link1.state = 0;
930
+ phba->trunk_link.link2.state = 0;
931
+ phba->trunk_link.link3.state = 0;
932
+ phba->sli4_hba.link_state.logical_speed =
933
+ LPFC_LINK_SPEED_UNKNOWN;
934
+ }
902935 spin_lock_irq(shost->host_lock);
903936 phba->pport->fc_flag &= ~FC_LBIT;
904937 spin_unlock_irq(shost->host_lock);
....@@ -911,8 +944,8 @@
911944
912945 vports[i]->fc_myDID = 0;
913946
914
- if ((phba->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
915
- (phba->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
947
+ if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
948
+ (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
916949 if (phba->nvmet_support)
917950 lpfc_nvmet_update_targetport(phba);
918951 else
....@@ -1003,7 +1036,7 @@
10031036 (vport != phba->pport))
10041037 return;
10051038
1006
- if (phba->cfg_enable_fc4_type != LPFC_ENABLE_NVME)
1039
+ if (vport->cfg_enable_fc4_type != LPFC_ENABLE_NVME)
10071040 fc_host_post_event(shost, fc_get_event_number(),
10081041 FCH_EVT_LINKUP, 0);
10091042
....@@ -1045,6 +1078,11 @@
10451078 spin_lock_irq(shost->host_lock);
10461079 phba->pport->rcv_flogi_cnt = 0;
10471080 spin_unlock_irq(shost->host_lock);
1081
+
1082
+ /* reinitialize initial FLOGI flag */
1083
+ phba->hba_flag &= ~(HBA_FLOGI_ISSUED);
1084
+ phba->defer_flogi_acc_flag = false;
1085
+
10481086 return 0;
10491087 }
10501088
....@@ -1070,7 +1108,7 @@
10701108 /* Check for error */
10711109 if ((mb->mbxStatus) && (mb->mbxStatus != 0x1601)) {
10721110 /* CLEAR_LA mbox error <mbxStatus> state <hba_state> */
1073
- lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
1111
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
10741112 "0320 CLEAR_LA mbxStatus error x%x hba "
10751113 "state x%x\n",
10761114 mb->mbxStatus, vport->port_state);
....@@ -1116,17 +1154,19 @@
11161154 return;
11171155 }
11181156
1119
-
11201157 void
11211158 lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
11221159 {
11231160 struct lpfc_vport *vport = pmb->vport;
1124
- uint8_t bbscn = 0;
1125
-
1126
- if (pmb->u.mb.mbxStatus)
1127
- goto out;
1161
+ LPFC_MBOXQ_t *sparam_mb;
1162
+ struct lpfc_dmabuf *sparam_mp;
1163
+ u16 status = pmb->u.mb.mbxStatus;
1164
+ int rc;
11281165
11291166 mempool_free(pmb, phba->mbox_mem_pool);
1167
+
1168
+ if (status)
1169
+ goto out;
11301170
11311171 /* don't perform discovery for SLI4 loopback diagnostic test */
11321172 if ((phba->sli_rev == LPFC_SLI_REV4) &&
....@@ -1146,31 +1186,57 @@
11461186 }
11471187
11481188 /* Start discovery by sending a FLOGI. port_state is identically
1149
- * LPFC_FLOGI while waiting for FLOGI cmpl
1189
+ * LPFC_FLOGI while waiting for FLOGI cmpl.
11501190 */
11511191 if (vport->port_state != LPFC_FLOGI) {
1152
- if (phba->bbcredit_support && phba->cfg_enable_bbcr) {
1153
- bbscn = bf_get(lpfc_bbscn_def,
1154
- &phba->sli4_hba.bbscn_params);
1155
- vport->fc_sparam.cmn.bbRcvSizeMsb &= 0xf;
1156
- vport->fc_sparam.cmn.bbRcvSizeMsb |= (bbscn << 4);
1192
+ /* Issue MBX_READ_SPARAM to update CSPs before FLOGI if
1193
+ * bb-credit recovery is in place.
1194
+ */
1195
+ if (phba->bbcredit_support && phba->cfg_enable_bbcr &&
1196
+ !(phba->link_flag & LS_LOOPBACK_MODE)) {
1197
+ sparam_mb = mempool_alloc(phba->mbox_mem_pool,
1198
+ GFP_KERNEL);
1199
+ if (!sparam_mb)
1200
+ goto sparam_out;
1201
+
1202
+ rc = lpfc_read_sparam(phba, sparam_mb, 0);
1203
+ if (rc) {
1204
+ mempool_free(sparam_mb, phba->mbox_mem_pool);
1205
+ goto sparam_out;
1206
+ }
1207
+ sparam_mb->vport = vport;
1208
+ sparam_mb->mbox_cmpl = lpfc_mbx_cmpl_read_sparam;
1209
+ rc = lpfc_sli_issue_mbox(phba, sparam_mb, MBX_NOWAIT);
1210
+ if (rc == MBX_NOT_FINISHED) {
1211
+ sparam_mp = (struct lpfc_dmabuf *)
1212
+ sparam_mb->ctx_buf;
1213
+ lpfc_mbuf_free(phba, sparam_mp->virt,
1214
+ sparam_mp->phys);
1215
+ kfree(sparam_mp);
1216
+ sparam_mb->ctx_buf = NULL;
1217
+ mempool_free(sparam_mb, phba->mbox_mem_pool);
1218
+ goto sparam_out;
1219
+ }
1220
+
1221
+ phba->hba_flag |= HBA_DEFER_FLOGI;
1222
+ } else {
1223
+ lpfc_initial_flogi(vport);
11571224 }
1158
- lpfc_initial_flogi(vport);
1159
- } else if (vport->fc_flag & FC_PT2PT) {
1160
- lpfc_disc_start(vport);
1225
+ } else {
1226
+ if (vport->fc_flag & FC_PT2PT)
1227
+ lpfc_disc_start(vport);
11611228 }
11621229 return;
11631230
11641231 out:
1165
- lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
1166
- "0306 CONFIG_LINK mbxStatus error x%x "
1167
- "HBA state x%x\n",
1168
- pmb->u.mb.mbxStatus, vport->port_state);
1169
- mempool_free(pmb, phba->mbox_mem_pool);
1232
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
1233
+ "0306 CONFIG_LINK mbxStatus error x%x HBA state x%x\n",
1234
+ status, vport->port_state);
11701235
1236
+sparam_out:
11711237 lpfc_linkdown(phba);
11721238
1173
- lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
1239
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
11741240 "0200 CONFIG_LINK bad hba state x%x\n",
11751241 vport->port_state);
11761242
....@@ -1180,7 +1246,7 @@
11801246
11811247 /**
11821248 * lpfc_sli4_clear_fcf_rr_bmask
1183
- * @phba pointer to the struct lpfc_hba for this port.
1249
+ * @phba: pointer to the struct lpfc_hba for this port.
11841250 * This fucnction resets the round robin bit mask and clears the
11851251 * fcf priority list. The list deletions are done while holding the
11861252 * hbalock. The ON_LIST flag and the FLOGI_FAILED flags are cleared
....@@ -1206,10 +1272,10 @@
12061272 struct lpfc_vport *vport = mboxq->vport;
12071273
12081274 if (mboxq->u.mb.mbxStatus) {
1209
- lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
1210
- "2017 REG_FCFI mbxStatus error x%x "
1211
- "HBA state x%x\n",
1212
- mboxq->u.mb.mbxStatus, vport->port_state);
1275
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
1276
+ "2017 REG_FCFI mbxStatus error x%x "
1277
+ "HBA state x%x\n", mboxq->u.mb.mbxStatus,
1278
+ vport->port_state);
12131279 goto fail_out;
12141280 }
12151281
....@@ -1279,7 +1345,7 @@
12791345
12801346 /**
12811347 * lpfc_sw_name_match - Check if the fcf switch name match.
1282
- * @fab_name: pointer to fabric name.
1348
+ * @sw_name: pointer to switch name.
12831349 * @new_fcf_record: pointer to fcf record.
12841350 *
12851351 * This routine compare the fcf record's switch name with provided
....@@ -1342,14 +1408,14 @@
13421408 }
13431409
13441410 /**
1345
- * lpfc_update_fcf_record - Update driver fcf record
13461411 * __lpfc_update_fcf_record_pri - update the lpfc_fcf_pri record.
13471412 * @phba: pointer to lpfc hba data structure.
13481413 * @fcf_index: Index for the lpfc_fcf_record.
13491414 * @new_fcf_record: pointer to hba fcf record.
13501415 *
13511416 * This routine updates the driver FCF priority record from the new HBA FCF
1352
- * record. This routine is called with the host lock held.
1417
+ * record. The hbalock is asserted held in the code path calling this
1418
+ * routine.
13531419 **/
13541420 static void
13551421 __lpfc_update_fcf_record_pri(struct lpfc_hba *phba, uint16_t fcf_index,
....@@ -1357,8 +1423,6 @@
13571423 )
13581424 {
13591425 struct lpfc_fcf_pri *fcf_pri;
1360
-
1361
- lockdep_assert_held(&phba->hbalock);
13621426
13631427 fcf_pri = &phba->fcf.fcf_pri[fcf_index];
13641428 fcf_pri->fcf_rec.fcf_index = fcf_index;
....@@ -1369,7 +1433,7 @@
13691433
13701434 /**
13711435 * lpfc_copy_fcf_record - Copy fcf information to lpfc_hba.
1372
- * @fcf: pointer to driver fcf record.
1436
+ * @fcf_rec: pointer to driver fcf record.
13731437 * @new_fcf_record: pointer to fcf record.
13741438 *
13751439 * This routine copies the FCF information from the FCF
....@@ -1437,7 +1501,7 @@
14371501 *
14381502 * This routine updates the driver FCF record from the new HBA FCF record
14391503 * together with the address mode, vlan_id, and other informations. This
1440
- * routine is called with the host lock held.
1504
+ * routine is called with the hbalock held.
14411505 **/
14421506 static void
14431507 __lpfc_update_fcf_record(struct lpfc_hba *phba, struct lpfc_fcf_rec *fcf_rec,
....@@ -1832,7 +1896,7 @@
18321896 */
18331897 lpfc_sli4_mbx_sge_get(mboxq, 0, &sge);
18341898 if (unlikely(!mboxq->sge_array)) {
1835
- lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
1899
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
18361900 "2524 Failed to get the non-embedded SGE "
18371901 "virtual address\n");
18381902 return NULL;
....@@ -1848,11 +1912,12 @@
18481912 if (shdr_status || shdr_add_status) {
18491913 if (shdr_status == STATUS_FCF_TABLE_EMPTY ||
18501914 if_type == LPFC_SLI_INTF_IF_TYPE_2)
1851
- lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
1915
+ lpfc_printf_log(phba, KERN_ERR,
1916
+ LOG_TRACE_EVENT,
18521917 "2726 READ_FCF_RECORD Indicates empty "
18531918 "FCF table.\n");
18541919 else
1855
- lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
1920
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
18561921 "2521 READ_FCF_RECORD mailbox failed "
18571922 "with status x%x add_status x%x, "
18581923 "mbx\n", shdr_status, shdr_add_status);
....@@ -1936,7 +2001,7 @@
19362001 }
19372002
19382003 /**
1939
- lpfc_sli4_fcf_record_match - testing new FCF record for matching existing FCF
2004
+ * lpfc_sli4_fcf_record_match - testing new FCF record for matching existing FCF
19402005 * @phba: pointer to lpfc hba data structure.
19412006 * @fcf_rec: pointer to an existing FCF record.
19422007 * @new_fcf_record: pointer to a new FCF record.
....@@ -2050,7 +2115,7 @@
20502115 /**
20512116 * lpfc_sli4_fcf_pri_list_del
20522117 * @phba: pointer to lpfc hba data structure.
2053
- * @fcf_index the index of the fcf record to delete
2118
+ * @fcf_index: the index of the fcf record to delete
20542119 * This routine checks the on list flag of the fcf_index to be deleted.
20552120 * If it is one the list then it is removed from the list, and the flag
20562121 * is cleared. This routine grab the hbalock before removing the fcf
....@@ -2080,7 +2145,7 @@
20802145 /**
20812146 * lpfc_sli4_set_fcf_flogi_fail
20822147 * @phba: pointer to lpfc hba data structure.
2083
- * @fcf_index the index of the fcf record to update
2148
+ * @fcf_index: the index of the fcf record to update
20842149 * This routine acquires the hbalock and then set the LPFC_FCF_FLOGI_FAILED
20852150 * flag so the the round robin slection for the particular priority level
20862151 * will try a different fcf record that does not have this bit set.
....@@ -2100,7 +2165,8 @@
21002165 /**
21012166 * lpfc_sli4_fcf_pri_list_add
21022167 * @phba: pointer to lpfc hba data structure.
2103
- * @fcf_index the index of the fcf record to add
2168
+ * @fcf_index: the index of the fcf record to add
2169
+ * @new_fcf_record: pointer to a new FCF record.
21042170 * This routine checks the priority of the fcf_index to be added.
21052171 * If it is a lower priority than the current head of the fcf_pri list
21062172 * then it is added to the list in the right order.
....@@ -2230,7 +2296,7 @@
22302296 new_fcf_record = lpfc_sli4_fcf_rec_mbox_parse(phba, mboxq,
22312297 &next_fcf_index);
22322298 if (!new_fcf_record) {
2233
- lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
2299
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
22342300 "2765 Mailbox command READ_FCF_RECORD "
22352301 "failed to retrieve a FCF record.\n");
22362302 /* Let next new FCF event trigger fast failover */
....@@ -2274,7 +2340,8 @@
22742340 new_fcf_record, LPFC_FCOE_IGNORE_VID)) {
22752341 if (bf_get(lpfc_fcf_record_fcf_index, new_fcf_record) !=
22762342 phba->fcf.current_rec.fcf_indx) {
2277
- lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
2343
+ lpfc_printf_log(phba, KERN_ERR,
2344
+ LOG_TRACE_EVENT,
22782345 "2862 FCF (x%x) matches property "
22792346 "of in-use FCF (x%x)\n",
22802347 bf_get(lpfc_fcf_record_fcf_index,
....@@ -2344,7 +2411,7 @@
23442411 phba->pport->fc_flag);
23452412 goto out;
23462413 } else
2347
- lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
2414
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
23482415 "2863 New FCF (x%x) matches "
23492416 "property of in-use FCF (x%x)\n",
23502417 bf_get(lpfc_fcf_record_fcf_index,
....@@ -2758,10 +2825,9 @@
27582825 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
27592826 LPFC_SLI_INTF_IF_TYPE_0) &&
27602827 mboxq->u.mb.mbxStatus != MBX_VFI_IN_USE) {
2761
- lpfc_printf_vlog(vport, KERN_ERR,
2762
- LOG_MBOX,
2763
- "2891 Init VFI mailbox failed 0x%x\n",
2764
- mboxq->u.mb.mbxStatus);
2828
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
2829
+ "2891 Init VFI mailbox failed 0x%x\n",
2830
+ mboxq->u.mb.mbxStatus);
27652831 mempool_free(mboxq, phba->mbox_mem_pool);
27662832 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
27672833 return;
....@@ -2789,7 +2855,7 @@
27892855 mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
27902856 if (!mboxq) {
27912857 lpfc_printf_vlog(vport, KERN_ERR,
2792
- LOG_MBOX, "2892 Failed to allocate "
2858
+ LOG_TRACE_EVENT, "2892 Failed to allocate "
27932859 "init_vfi mailbox\n");
27942860 return;
27952861 }
....@@ -2797,8 +2863,8 @@
27972863 mboxq->mbox_cmpl = lpfc_init_vfi_cmpl;
27982864 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT);
27992865 if (rc == MBX_NOT_FINISHED) {
2800
- lpfc_printf_vlog(vport, KERN_ERR,
2801
- LOG_MBOX, "2893 Failed to issue init_vfi mailbox\n");
2866
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
2867
+ "2893 Failed to issue init_vfi mailbox\n");
28022868 mempool_free(mboxq, vport->phba->mbox_mem_pool);
28032869 }
28042870 }
....@@ -2818,10 +2884,9 @@
28182884 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
28192885
28202886 if (mboxq->u.mb.mbxStatus) {
2821
- lpfc_printf_vlog(vport, KERN_ERR,
2822
- LOG_MBOX,
2823
- "2609 Init VPI mailbox failed 0x%x\n",
2824
- mboxq->u.mb.mbxStatus);
2887
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
2888
+ "2609 Init VPI mailbox failed 0x%x\n",
2889
+ mboxq->u.mb.mbxStatus);
28252890 mempool_free(mboxq, phba->mbox_mem_pool);
28262891 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
28272892 return;
....@@ -2835,7 +2900,7 @@
28352900 ndlp = lpfc_findnode_did(vport, Fabric_DID);
28362901 if (!ndlp)
28372902 lpfc_printf_vlog(vport, KERN_ERR,
2838
- LOG_DISCOVERY,
2903
+ LOG_TRACE_EVENT,
28392904 "2731 Cannot find fabric "
28402905 "controller node\n");
28412906 else
....@@ -2848,7 +2913,7 @@
28482913 lpfc_initial_fdisc(vport);
28492914 else {
28502915 lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP);
2851
- lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
2916
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
28522917 "2606 No NPIV Fabric support\n");
28532918 }
28542919 mempool_free(mboxq, phba->mbox_mem_pool);
....@@ -2871,8 +2936,7 @@
28712936 if ((vport->port_type != LPFC_PHYSICAL_PORT) && (!vport->vpi)) {
28722937 vpi = lpfc_alloc_vpi(vport->phba);
28732938 if (!vpi) {
2874
- lpfc_printf_vlog(vport, KERN_ERR,
2875
- LOG_MBOX,
2939
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
28762940 "3303 Failed to obtain vport vpi\n");
28772941 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
28782942 return;
....@@ -2883,7 +2947,7 @@
28832947 mboxq = mempool_alloc(vport->phba->mbox_mem_pool, GFP_KERNEL);
28842948 if (!mboxq) {
28852949 lpfc_printf_vlog(vport, KERN_ERR,
2886
- LOG_MBOX, "2607 Failed to allocate "
2950
+ LOG_TRACE_EVENT, "2607 Failed to allocate "
28872951 "init_vpi mailbox\n");
28882952 return;
28892953 }
....@@ -2892,8 +2956,8 @@
28922956 mboxq->mbox_cmpl = lpfc_init_vpi_cmpl;
28932957 rc = lpfc_sli_issue_mbox(vport->phba, mboxq, MBX_NOWAIT);
28942958 if (rc == MBX_NOT_FINISHED) {
2895
- lpfc_printf_vlog(vport, KERN_ERR,
2896
- LOG_MBOX, "2608 Failed to issue init_vpi mailbox\n");
2959
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
2960
+ "2608 Failed to issue init_vpi mailbox\n");
28972961 mempool_free(mboxq, vport->phba->mbox_mem_pool);
28982962 }
28992963 }
....@@ -2937,7 +3001,7 @@
29373001 lpfc_vport_set_state(vports[i],
29383002 FC_VPORT_NO_FABRIC_SUPP);
29393003 lpfc_printf_vlog(vports[i], KERN_ERR,
2940
- LOG_ELS,
3004
+ LOG_TRACE_EVENT,
29413005 "0259 No NPIV "
29423006 "Fabric support\n");
29433007 }
....@@ -2949,7 +3013,7 @@
29493013 void
29503014 lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
29513015 {
2952
- struct lpfc_dmabuf *dmabuf = mboxq->context1;
3016
+ struct lpfc_dmabuf *dmabuf = mboxq->ctx_buf;
29533017 struct lpfc_vport *vport = mboxq->vport;
29543018 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
29553019
....@@ -2961,10 +3025,10 @@
29613025 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
29623026 LPFC_SLI_INTF_IF_TYPE_0) &&
29633027 mboxq->u.mb.mbxStatus != MBX_VFI_IN_USE) {
2964
- lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
2965
- "2018 REG_VFI mbxStatus error x%x "
2966
- "HBA state x%x\n",
2967
- mboxq->u.mb.mbxStatus, vport->port_state);
3028
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
3029
+ "2018 REG_VFI mbxStatus error x%x "
3030
+ "HBA state x%x\n",
3031
+ mboxq->u.mb.mbxStatus, vport->port_state);
29683032 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
29693033 /* FLOGI failed, use loop map to make discovery list */
29703034 lpfc_disc_list_loopmap(vport);
....@@ -3042,7 +3106,7 @@
30423106 lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
30433107 {
30443108 MAILBOX_t *mb = &pmb->u.mb;
3045
- struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) pmb->context1;
3109
+ struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)pmb->ctx_buf;
30463110 struct lpfc_vport *vport = pmb->vport;
30473111 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
30483112 struct serv_parm *sp = &vport->fc_sparam;
....@@ -3051,7 +3115,7 @@
30513115 /* Check for error */
30523116 if (mb->mbxStatus) {
30533117 /* READ_SPARAM mbox error <mbxStatus> state <hba_state> */
3054
- lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
3118
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
30553119 "0319 READ_SPARAM mbxStatus error x%x "
30563120 "hba state x%x>\n",
30573121 mb->mbxStatus, vport->port_state);
....@@ -3083,10 +3147,18 @@
30833147 lpfc_mbuf_free(phba, mp->virt, mp->phys);
30843148 kfree(mp);
30853149 mempool_free(pmb, phba->mbox_mem_pool);
3150
+
3151
+ /* Check if sending the FLOGI is being deferred to after we get
3152
+ * up to date CSPs from MBX_READ_SPARAM.
3153
+ */
3154
+ if (phba->hba_flag & HBA_DEFER_FLOGI) {
3155
+ lpfc_initial_flogi(vport);
3156
+ phba->hba_flag &= ~HBA_DEFER_FLOGI;
3157
+ }
30863158 return;
30873159
30883160 out:
3089
- pmb->context1 = NULL;
3161
+ pmb->ctx_buf = NULL;
30903162 lpfc_mbuf_free(phba, mp->virt, mp->phys);
30913163 kfree(mp);
30923164 lpfc_issue_clear_la(phba, vport);
....@@ -3105,8 +3177,9 @@
31053177 int rc;
31063178 struct fcf_record *fcf_record;
31073179 uint32_t fc_flags = 0;
3180
+ unsigned long iflags;
31083181
3109
- spin_lock_irq(&phba->hbalock);
3182
+ spin_lock_irqsave(&phba->hbalock, iflags);
31103183 phba->fc_linkspeed = bf_get(lpfc_mbx_read_top_link_spd, la);
31113184
31123185 if (!(phba->hba_flag & HBA_FCOE_MODE)) {
....@@ -3119,6 +3192,7 @@
31193192 case LPFC_LINK_SPEED_16GHZ:
31203193 case LPFC_LINK_SPEED_32GHZ:
31213194 case LPFC_LINK_SPEED_64GHZ:
3195
+ case LPFC_LINK_SPEED_128GHZ:
31223196 break;
31233197 default:
31243198 phba->fc_linkspeed = LPFC_LINK_SPEED_UNKNOWN;
....@@ -3202,15 +3276,17 @@
32023276 vport->fc_myDID = phba->fc_pref_DID;
32033277 fc_flags |= FC_LBIT;
32043278 }
3205
- spin_unlock_irq(&phba->hbalock);
3279
+ spin_unlock_irqrestore(&phba->hbalock, iflags);
32063280
32073281 if (fc_flags) {
3208
- spin_lock_irq(shost->host_lock);
3282
+ spin_lock_irqsave(shost->host_lock, iflags);
32093283 vport->fc_flag |= fc_flags;
3210
- spin_unlock_irq(shost->host_lock);
3284
+ spin_unlock_irqrestore(shost->host_lock, iflags);
32113285 }
32123286
32133287 lpfc_linkup(phba);
3288
+ sparam_mbox = NULL;
3289
+
32143290 sparam_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
32153291 if (!sparam_mbox)
32163292 goto out;
....@@ -3224,7 +3300,7 @@
32243300 sparam_mbox->mbox_cmpl = lpfc_mbx_cmpl_read_sparam;
32253301 rc = lpfc_sli_issue_mbox(phba, sparam_mbox, MBX_NOWAIT);
32263302 if (rc == MBX_NOT_FINISHED) {
3227
- mp = (struct lpfc_dmabuf *) sparam_mbox->context1;
3303
+ mp = (struct lpfc_dmabuf *)sparam_mbox->ctx_buf;
32283304 lpfc_mbuf_free(phba, mp->virt, mp->phys);
32293305 kfree(mp);
32303306 mempool_free(sparam_mbox, phba->mbox_mem_pool);
....@@ -3256,7 +3332,7 @@
32563332 GFP_KERNEL);
32573333 if (unlikely(!fcf_record)) {
32583334 lpfc_printf_log(phba, KERN_ERR,
3259
- LOG_MBOX | LOG_SLI,
3335
+ LOG_TRACE_EVENT,
32603336 "2554 Could not allocate memory for "
32613337 "fcf record\n");
32623338 rc = -ENODEV;
....@@ -3268,7 +3344,7 @@
32683344 rc = lpfc_sli4_add_fcf_record(phba, fcf_record);
32693345 if (unlikely(rc)) {
32703346 lpfc_printf_log(phba, KERN_ERR,
3271
- LOG_MBOX | LOG_SLI,
3347
+ LOG_TRACE_EVENT,
32723348 "2013 Could not manually add FCF "
32733349 "record 0, status %d\n", rc);
32743350 rc = -ENODEV;
....@@ -3281,33 +3357,37 @@
32813357 * The driver is expected to do FIP/FCF. Call the port
32823358 * and get the FCF Table.
32833359 */
3284
- spin_lock_irq(&phba->hbalock);
3360
+ spin_lock_irqsave(&phba->hbalock, iflags);
32853361 if (phba->hba_flag & FCF_TS_INPROG) {
3286
- spin_unlock_irq(&phba->hbalock);
3362
+ spin_unlock_irqrestore(&phba->hbalock, iflags);
32873363 return;
32883364 }
32893365 /* This is the initial FCF discovery scan */
32903366 phba->fcf.fcf_flag |= FCF_INIT_DISC;
3291
- spin_unlock_irq(&phba->hbalock);
3367
+ spin_unlock_irqrestore(&phba->hbalock, iflags);
32923368 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
32933369 "2778 Start FCF table scan at linkup\n");
32943370 rc = lpfc_sli4_fcf_scan_read_fcf_rec(phba,
32953371 LPFC_FCOE_FCF_GET_FIRST);
32963372 if (rc) {
3297
- spin_lock_irq(&phba->hbalock);
3373
+ spin_lock_irqsave(&phba->hbalock, iflags);
32983374 phba->fcf.fcf_flag &= ~FCF_INIT_DISC;
3299
- spin_unlock_irq(&phba->hbalock);
3375
+ spin_unlock_irqrestore(&phba->hbalock, iflags);
33003376 goto out;
33013377 }
33023378 /* Reset FCF roundrobin bmask for new discovery */
33033379 lpfc_sli4_clear_fcf_rr_bmask(phba);
33043380 }
33053381
3382
+ /* Prepare for LINK up registrations */
3383
+ memset(phba->os_host_name, 0, sizeof(phba->os_host_name));
3384
+ scnprintf(phba->os_host_name, sizeof(phba->os_host_name), "%s",
3385
+ init_utsname()->nodename);
33063386 return;
33073387 out:
33083388 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
3309
- lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
3310
- "0263 Discovery Mailbox error: state: 0x%x : %p %p\n",
3389
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
3390
+ "0263 Discovery Mailbox error: state: 0x%x : x%px x%px\n",
33113391 vport->port_state, sparam_mbox, cfglink_mbox);
33123392 lpfc_issue_clear_la(phba, vport);
33133393 return;
....@@ -3353,8 +3433,9 @@
33533433 struct lpfc_mbx_read_top *la;
33543434 struct lpfc_sli_ring *pring;
33553435 MAILBOX_t *mb = &pmb->u.mb;
3356
- struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1);
3436
+ struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(pmb->ctx_buf);
33573437 uint8_t attn_type;
3438
+ unsigned long iflags;
33583439
33593440 /* Unblock ELS traffic */
33603441 pring = lpfc_phba_elsring(phba);
....@@ -3376,12 +3457,12 @@
33763457
33773458 memcpy(&phba->alpa_map[0], mp->virt, 128);
33783459
3379
- spin_lock_irq(shost->host_lock);
3460
+ spin_lock_irqsave(shost->host_lock, iflags);
33803461 if (bf_get(lpfc_mbx_read_top_pb, la))
33813462 vport->fc_flag |= FC_BYPASSED_MODE;
33823463 else
33833464 vport->fc_flag &= ~FC_BYPASSED_MODE;
3384
- spin_unlock_irq(shost->host_lock);
3465
+ spin_unlock_irqrestore(shost->host_lock, iflags);
33853466
33863467 if (phba->fc_eventTag <= la->eventTag) {
33873468 phba->fc_stat.LinkMultiEvent++;
....@@ -3392,12 +3473,12 @@
33923473
33933474 phba->fc_eventTag = la->eventTag;
33943475 if (phba->sli_rev < LPFC_SLI_REV4) {
3395
- spin_lock_irq(&phba->hbalock);
3476
+ spin_lock_irqsave(&phba->hbalock, iflags);
33963477 if (bf_get(lpfc_mbx_read_top_mm, la))
33973478 phba->sli.sli_flag |= LPFC_MENLO_MAINT;
33983479 else
33993480 phba->sli.sli_flag &= ~LPFC_MENLO_MAINT;
3400
- spin_unlock_irq(&phba->hbalock);
3481
+ spin_unlock_irqrestore(&phba->hbalock, iflags);
34013482 }
34023483
34033484 phba->link_events++;
....@@ -3439,8 +3520,8 @@
34393520 phba->pport->port_state, vport->fc_flag);
34403521 else if (attn_type == LPFC_ATT_UNEXP_WWPN)
34413522 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
3442
- "1313 Link Down UNEXP WWPN Event x%x received "
3443
- "Data: x%x x%x x%x x%x x%x\n",
3523
+ "1313 Link Down Unexpected FA WWPN Event x%x "
3524
+ "received Data: x%x x%x x%x x%x x%x\n",
34443525 la->eventTag, phba->fc_eventTag,
34453526 phba->pport->port_state, vport->fc_flag,
34463527 bf_get(lpfc_mbx_read_top_mm, la),
....@@ -3510,15 +3591,15 @@
35103591 lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
35113592 {
35123593 struct lpfc_vport *vport = pmb->vport;
3513
- struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1);
3514
- struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) pmb->context2;
3594
+ struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(pmb->ctx_buf);
3595
+ struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp;
35153596 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
35163597
3517
- pmb->context1 = NULL;
3518
- pmb->context2 = NULL;
3598
+ pmb->ctx_buf = NULL;
3599
+ pmb->ctx_ndlp = NULL;
35193600
35203601 lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
3521
- "0002 rpi:%x DID:%x flg:%x %d map:%x %p\n",
3602
+ "0002 rpi:%x DID:%x flg:%x %d map:%x x%px\n",
35223603 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag,
35233604 kref_read(&ndlp->kref),
35243605 ndlp->nlp_usg_map, ndlp);
....@@ -3578,7 +3659,7 @@
35783659 break;
35793660 /* If VPI is busy, reset the HBA */
35803661 case 0x9700:
3581
- lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE,
3662
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
35823663 "2798 Unreg_vpi failed vpi 0x%x, mb status = 0x%x\n",
35833664 vport->vpi, mb->mbxStatus);
35843665 if (!(phba->pport->load_flag & FC_UNLOADING))
....@@ -3616,7 +3697,7 @@
36163697 mbox->mbox_cmpl = lpfc_mbx_cmpl_unreg_vpi;
36173698 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
36183699 if (rc == MBX_NOT_FINISHED) {
3619
- lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT,
3700
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
36203701 "1800 Could not issue unreg_vpi\n");
36213702 mempool_free(mbox, phba->mbox_mem_pool);
36223703 vport->unreg_vpi_cmpl = VPORT_ERROR;
....@@ -3645,8 +3726,8 @@
36453726 spin_unlock_irq(shost->host_lock);
36463727 vport->fc_myDID = 0;
36473728
3648
- if ((phba->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
3649
- (phba->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
3729
+ if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
3730
+ (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
36503731 if (phba->nvmet_support)
36513732 lpfc_nvmet_update_targetport(phba);
36523733 else
....@@ -3703,7 +3784,7 @@
37033784
37043785 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
37053786 if (!pmb) {
3706
- lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
3787
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
37073788 "0542 lpfc_create_static_vport failed to"
37083789 " allocate mailbox memory\n");
37093790 return;
....@@ -3713,7 +3794,7 @@
37133794
37143795 vport_info = kzalloc(sizeof(struct static_vport_info), GFP_KERNEL);
37153796 if (!vport_info) {
3716
- lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
3797
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
37173798 "0543 lpfc_create_static_vport failed to"
37183799 " allocate vport_info\n");
37193800 mempool_free(pmb, phba->mbox_mem_pool);
....@@ -3723,8 +3804,8 @@
37233804 vport_buff = (uint8_t *) vport_info;
37243805 do {
37253806 /* free dma buffer from previous round */
3726
- if (pmb->context1) {
3727
- mp = (struct lpfc_dmabuf *)pmb->context1;
3807
+ if (pmb->ctx_buf) {
3808
+ mp = (struct lpfc_dmabuf *)pmb->ctx_buf;
37283809 lpfc_mbuf_free(phba, mp->virt, mp->phys);
37293810 kfree(mp);
37303811 }
....@@ -3746,7 +3827,7 @@
37463827
37473828 if (phba->sli_rev == LPFC_SLI_REV4) {
37483829 byte_count = pmb->u.mqe.un.mb_words[5];
3749
- mp = (struct lpfc_dmabuf *)pmb->context1;
3830
+ mp = (struct lpfc_dmabuf *)pmb->ctx_buf;
37503831 if (byte_count > sizeof(struct static_vport_info) -
37513832 offset)
37523833 byte_count = sizeof(struct static_vport_info)
....@@ -3774,11 +3855,12 @@
37743855 if ((le32_to_cpu(vport_info->signature) != VPORT_INFO_SIG) ||
37753856 ((le32_to_cpu(vport_info->rev) & VPORT_INFO_REV_MASK)
37763857 != VPORT_INFO_REV)) {
3777
- lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
3778
- "0545 lpfc_create_static_vport bad"
3779
- " information header 0x%x 0x%x\n",
3780
- le32_to_cpu(vport_info->signature),
3781
- le32_to_cpu(vport_info->rev) & VPORT_INFO_REV_MASK);
3858
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
3859
+ "0545 lpfc_create_static_vport bad"
3860
+ " information header 0x%x 0x%x\n",
3861
+ le32_to_cpu(vport_info->signature),
3862
+ le32_to_cpu(vport_info->rev) &
3863
+ VPORT_INFO_REV_MASK);
37823864
37833865 goto out;
37843866 }
....@@ -3811,8 +3893,8 @@
38113893 out:
38123894 kfree(vport_info);
38133895 if (mbx_wait_rc != MBX_TIMEOUT) {
3814
- if (pmb->context1) {
3815
- mp = (struct lpfc_dmabuf *)pmb->context1;
3896
+ if (pmb->ctx_buf) {
3897
+ mp = (struct lpfc_dmabuf *)pmb->ctx_buf;
38163898 lpfc_mbuf_free(phba, mp->virt, mp->phys);
38173899 kfree(mp);
38183900 }
....@@ -3833,16 +3915,16 @@
38333915 {
38343916 struct lpfc_vport *vport = pmb->vport;
38353917 MAILBOX_t *mb = &pmb->u.mb;
3836
- struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1);
3918
+ struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(pmb->ctx_buf);
38373919 struct lpfc_nodelist *ndlp;
38383920 struct Scsi_Host *shost;
38393921
3840
- ndlp = (struct lpfc_nodelist *) pmb->context2;
3841
- pmb->context1 = NULL;
3842
- pmb->context2 = NULL;
3922
+ ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp;
3923
+ pmb->ctx_ndlp = NULL;
3924
+ pmb->ctx_buf = NULL;
38433925
38443926 if (mb->mbxStatus) {
3845
- lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
3927
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
38463928 "0258 Register Fabric login error: 0x%x\n",
38473929 mb->mbxStatus);
38483930 lpfc_mbuf_free(phba, mp->virt, mp->phys);
....@@ -3908,16 +3990,15 @@
39083990 int
39093991 lpfc_issue_gidft(struct lpfc_vport *vport)
39103992 {
3911
- struct lpfc_hba *phba = vport->phba;
3912
-
39133993 /* Good status, issue CT Request to NameServer */
3914
- if ((phba->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
3915
- (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP)) {
3994
+ if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
3995
+ (vport->cfg_enable_fc4_type == LPFC_ENABLE_FCP)) {
39163996 if (lpfc_ns_cmd(vport, SLI_CTNS_GID_FT, 0, SLI_CTPT_FCP)) {
39173997 /* Cannot issue NameServer FCP Query, so finish up
39183998 * discovery
39193999 */
3920
- lpfc_printf_vlog(vport, KERN_ERR, LOG_SLI,
4000
+ lpfc_printf_vlog(vport, KERN_ERR,
4001
+ LOG_TRACE_EVENT,
39214002 "0604 %s FC TYPE %x %s\n",
39224003 "Failed to issue GID_FT to ",
39234004 FC_TYPE_FCP,
....@@ -3927,13 +4008,14 @@
39274008 vport->gidft_inp++;
39284009 }
39294010
3930
- if ((phba->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
3931
- (phba->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
4011
+ if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
4012
+ (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
39324013 if (lpfc_ns_cmd(vport, SLI_CTNS_GID_FT, 0, SLI_CTPT_NVME)) {
39334014 /* Cannot issue NameServer NVME Query, so finish up
39344015 * discovery
39354016 */
3936
- lpfc_printf_vlog(vport, KERN_ERR, LOG_SLI,
4017
+ lpfc_printf_vlog(vport, KERN_ERR,
4018
+ LOG_TRACE_EVENT,
39374019 "0605 %s FC_TYPE %x %s %d\n",
39384020 "Failed to issue GID_FT to ",
39394021 FC_TYPE_NVME,
....@@ -3947,6 +4029,35 @@
39474029 return vport->gidft_inp;
39484030 }
39494031
4032
+/**
4033
+ * lpfc_issue_gidpt - issue a GID_PT for all N_Ports
4034
+ * @vport: The virtual port for which this call is being executed.
4035
+ *
4036
+ * This routine will issue a GID_PT to get a list of all N_Ports
4037
+ *
4038
+ * Return value :
4039
+ * 0 - Failure to issue a GID_PT
4040
+ * 1 - GID_PT issued
4041
+ **/
4042
+int
4043
+lpfc_issue_gidpt(struct lpfc_vport *vport)
4044
+{
4045
+ /* Good status, issue CT Request to NameServer */
4046
+ if (lpfc_ns_cmd(vport, SLI_CTNS_GID_PT, 0, GID_PT_N_PORT)) {
4047
+ /* Cannot issue NameServer FCP Query, so finish up
4048
+ * discovery
4049
+ */
4050
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
4051
+ "0606 %s Port TYPE %x %s\n",
4052
+ "Failed to issue GID_PT to ",
4053
+ GID_PT_N_PORT,
4054
+ "Finishing discovery.");
4055
+ return 0;
4056
+ }
4057
+ vport->gidft_inp++;
4058
+ return 1;
4059
+}
4060
+
39504061 /*
39514062 * This routine handles processing a NameServer REG_LOGIN mailbox
39524063 * command upon completion. It is setup in the LPFC_MBOXQ
....@@ -3957,16 +4068,16 @@
39574068 lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
39584069 {
39594070 MAILBOX_t *mb = &pmb->u.mb;
3960
- struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1);
3961
- struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) pmb->context2;
4071
+ struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(pmb->ctx_buf);
4072
+ struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp;
39624073 struct lpfc_vport *vport = pmb->vport;
39634074
3964
- pmb->context1 = NULL;
3965
- pmb->context2 = NULL;
4075
+ pmb->ctx_buf = NULL;
4076
+ pmb->ctx_ndlp = NULL;
39664077 vport->gidft_inp = 0;
39674078
39684079 if (mb->mbxStatus) {
3969
- lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
4080
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
39704081 "0260 Register NameServer error: 0x%x\n",
39714082 mb->mbxStatus);
39724083
....@@ -4002,8 +4113,8 @@
40024113 ndlp->nlp_flag |= NLP_RPI_REGISTERED;
40034114 ndlp->nlp_type |= NLP_FABRIC;
40044115 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
4005
- lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
4006
- "0003 rpi:%x DID:%x flg:%x %d map%x %p\n",
4116
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_DISCOVERY,
4117
+ "0003 rpi:%x DID:%x flg:%x %d map%x x%px\n",
40074118 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag,
40084119 kref_read(&ndlp->kref),
40094120 ndlp->nlp_usg_map, ndlp);
....@@ -4015,17 +4126,19 @@
40154126 lpfc_ns_cmd(vport, SLI_CTNS_RSPN_ID, 0, 0);
40164127 lpfc_ns_cmd(vport, SLI_CTNS_RFT_ID, 0, 0);
40174128
4018
- if ((phba->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
4019
- (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP))
4129
+ if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
4130
+ (vport->cfg_enable_fc4_type == LPFC_ENABLE_FCP))
40204131 lpfc_ns_cmd(vport, SLI_CTNS_RFF_ID, 0, FC_TYPE_FCP);
40214132
4022
- if ((phba->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
4023
- (phba->cfg_enable_fc4_type == LPFC_ENABLE_NVME))
4133
+ if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
4134
+ (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME))
40244135 lpfc_ns_cmd(vport, SLI_CTNS_RFF_ID, 0,
40254136 FC_TYPE_NVME);
40264137
40274138 /* Issue SCR just before NameServer GID_FT Query */
4028
- lpfc_issue_els_scr(vport, SCR_DID, 0);
4139
+ lpfc_issue_els_scr(vport, 0);
4140
+
4141
+ lpfc_issue_els_rdf(vport, 0);
40294142 }
40304143
40314144 vport->fc_ns_retry = 0;
....@@ -4056,7 +4169,7 @@
40564169 struct fc_rport_identifiers rport_ids;
40574170 struct lpfc_hba *phba = vport->phba;
40584171
4059
- if (phba->cfg_enable_fc4_type == LPFC_ENABLE_NVME)
4172
+ if (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)
40604173 return;
40614174
40624175 /* Remote port has reappeared. Re-register w/ FC transport */
....@@ -4108,15 +4221,21 @@
41084221 rdata->pnode = lpfc_nlp_get(ndlp);
41094222
41104223 if (ndlp->nlp_type & NLP_FCP_TARGET)
4111
- rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET;
4224
+ rport_ids.roles |= FC_PORT_ROLE_FCP_TARGET;
41124225 if (ndlp->nlp_type & NLP_FCP_INITIATOR)
4113
- rport_ids.roles |= FC_RPORT_ROLE_FCP_INITIATOR;
4226
+ rport_ids.roles |= FC_PORT_ROLE_FCP_INITIATOR;
4227
+ if (ndlp->nlp_type & NLP_NVME_INITIATOR)
4228
+ rport_ids.roles |= FC_PORT_ROLE_NVME_INITIATOR;
4229
+ if (ndlp->nlp_type & NLP_NVME_TARGET)
4230
+ rport_ids.roles |= FC_PORT_ROLE_NVME_TARGET;
4231
+ if (ndlp->nlp_type & NLP_NVME_DISCOVERY)
4232
+ rport_ids.roles |= FC_PORT_ROLE_NVME_DISCOVERY;
41144233
41154234 if (rport_ids.roles != FC_RPORT_ROLE_UNKNOWN)
41164235 fc_remote_port_rolechg(rport, rport_ids.roles);
41174236
41184237 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
4119
- "3183 rport register x%06x, rport %p role x%x\n",
4238
+ "3183 rport register x%06x, rport x%px role x%x\n",
41204239 ndlp->nlp_DID, rport, rport_ids.roles);
41214240
41224241 if ((rport->scsi_target_id != -1) &&
....@@ -4131,9 +4250,8 @@
41314250 {
41324251 struct fc_rport *rport = ndlp->rport;
41334252 struct lpfc_vport *vport = ndlp->vport;
4134
- struct lpfc_hba *phba = vport->phba;
41354253
4136
- if (phba->cfg_enable_fc4_type == LPFC_ENABLE_NVME)
4254
+ if (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)
41374255 return;
41384256
41394257 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT,
....@@ -4141,7 +4259,7 @@
41414259 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type);
41424260
41434261 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
4144
- "3184 rport unregister x%06x, rport %p\n",
4262
+ "3184 rport unregister x%06x, rport x%px\n",
41454263 ndlp->nlp_DID, rport);
41464264
41474265 fc_remote_port_delete(rport);
....@@ -4153,8 +4271,9 @@
41534271 lpfc_nlp_counters(struct lpfc_vport *vport, int state, int count)
41544272 {
41554273 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
4274
+ unsigned long iflags;
41564275
4157
- spin_lock_irq(shost->host_lock);
4276
+ spin_lock_irqsave(shost->host_lock, iflags);
41584277 switch (state) {
41594278 case NLP_STE_UNUSED_NODE:
41604279 vport->fc_unused_cnt += count;
....@@ -4184,7 +4303,7 @@
41844303 vport->fc_npr_cnt += count;
41854304 break;
41864305 }
4187
- spin_unlock_irq(shost->host_lock);
4306
+ spin_unlock_irqrestore(shost->host_lock, iflags);
41884307 }
41894308
41904309 static void
....@@ -4270,7 +4389,7 @@
42704389 GFP_KERNEL);
42714390
42724391 if (!ndlp->lat_data)
4273
- lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE,
4392
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
42744393 "0286 lpfc_nlp_state_cleanup failed to "
42754394 "allocate statistical data buffer DID "
42764395 "0x%x\n", ndlp->nlp_DID);
....@@ -4410,6 +4529,8 @@
44104529 INIT_LIST_HEAD(&ndlp->els_retry_evt.evt_listp);
44114530 INIT_LIST_HEAD(&ndlp->dev_loss_evt.evt_listp);
44124531 timer_setup(&ndlp->nlp_delayfunc, lpfc_els_retry_delay, 0);
4532
+ INIT_LIST_HEAD(&ndlp->recovery_evt.evt_listp);
4533
+
44134534 ndlp->nlp_DID = did;
44144535 ndlp->vport = vport;
44154536 ndlp->phba = vport->phba;
....@@ -4419,6 +4540,7 @@
44194540 NLP_INT_NODE_ACT(ndlp);
44204541 atomic_set(&ndlp->cmd_pending, 0);
44214542 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth;
4543
+ ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING;
44224544 }
44234545
44244546 struct lpfc_nodelist *
....@@ -4426,18 +4548,31 @@
44264548 int state)
44274549 {
44284550 struct lpfc_hba *phba = vport->phba;
4429
- uint32_t did;
4551
+ uint32_t did, flag;
44304552 unsigned long flags;
44314553 unsigned long *active_rrqs_xri_bitmap = NULL;
44324554 int rpi = LPFC_RPI_ALLOC_ERROR;
4555
+ uint32_t defer_did = 0;
44334556
44344557 if (!ndlp)
44354558 return NULL;
44364559
44374560 if (phba->sli_rev == LPFC_SLI_REV4) {
4438
- rpi = lpfc_sli4_alloc_rpi(vport->phba);
4439
- if (rpi == LPFC_RPI_ALLOC_ERROR)
4561
+ if (ndlp->nlp_rpi == LPFC_RPI_ALLOC_ERROR)
4562
+ rpi = lpfc_sli4_alloc_rpi(vport->phba);
4563
+ else
4564
+ rpi = ndlp->nlp_rpi;
4565
+
4566
+ if (rpi == LPFC_RPI_ALLOC_ERROR) {
4567
+ lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE,
4568
+ "0359 %s: ndlp:x%px "
4569
+ "usgmap:x%x refcnt:%d FAILED RPI "
4570
+ " ALLOC\n",
4571
+ __func__,
4572
+ (void *)ndlp, ndlp->nlp_usg_map,
4573
+ kref_read(&ndlp->kref));
44404574 return NULL;
4575
+ }
44414576 }
44424577
44434578 spin_lock_irqsave(&phba->ndlp_lock, flags);
....@@ -4445,9 +4580,9 @@
44454580 if (NLP_CHK_FREE_REQ(ndlp)) {
44464581 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
44474582 lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE,
4448
- "0277 lpfc_enable_node: ndlp:x%p "
4583
+ "0277 %s: ndlp:x%px "
44494584 "usgmap:x%x refcnt:%d\n",
4450
- (void *)ndlp, ndlp->nlp_usg_map,
4585
+ __func__, (void *)ndlp, ndlp->nlp_usg_map,
44514586 kref_read(&ndlp->kref));
44524587 goto free_rpi;
44534588 }
....@@ -4455,23 +4590,30 @@
44554590 if (NLP_CHK_NODE_ACT(ndlp)) {
44564591 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
44574592 lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE,
4458
- "0278 lpfc_enable_node: ndlp:x%p "
4593
+ "0278 %s: ndlp:x%px "
44594594 "usgmap:x%x refcnt:%d\n",
4460
- (void *)ndlp, ndlp->nlp_usg_map,
4595
+ __func__, (void *)ndlp, ndlp->nlp_usg_map,
44614596 kref_read(&ndlp->kref));
44624597 goto free_rpi;
44634598 }
44644599
4465
- /* Keep the original DID */
4600
+ /* First preserve the orginal DID, xri_bitmap and some flags */
44664601 did = ndlp->nlp_DID;
4602
+ flag = (ndlp->nlp_flag & NLP_UNREG_INP);
4603
+ if (flag & NLP_UNREG_INP)
4604
+ defer_did = ndlp->nlp_defer_did;
44674605 if (phba->sli_rev == LPFC_SLI_REV4)
44684606 active_rrqs_xri_bitmap = ndlp->active_rrqs_xri_bitmap;
44694607
4470
- /* re-initialize ndlp except of ndlp linked list pointer */
4608
+ /* Zero ndlp except of ndlp linked list pointer */
44714609 memset((((char *)ndlp) + sizeof (struct list_head)), 0,
44724610 sizeof (struct lpfc_nodelist) - sizeof (struct list_head));
4473
- lpfc_initialize_node(vport, ndlp, did);
44744611
4612
+ /* Next reinitialize and restore saved objects */
4613
+ lpfc_initialize_node(vport, ndlp, did);
4614
+ ndlp->nlp_flag |= flag;
4615
+ if (flag & NLP_UNREG_INP)
4616
+ ndlp->nlp_defer_did = defer_did;
44754617 if (phba->sli_rev == LPFC_SLI_REV4)
44764618 ndlp->active_rrqs_xri_bitmap = active_rrqs_xri_bitmap;
44774619
....@@ -4480,7 +4622,7 @@
44804622 ndlp->nlp_rpi = rpi;
44814623 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
44824624 "0008 rpi:%x DID:%x flg:%x refcnt:%d "
4483
- "map:%x %p\n", ndlp->nlp_rpi, ndlp->nlp_DID,
4625
+ "map:%x x%px\n", ndlp->nlp_rpi, ndlp->nlp_DID,
44844626 ndlp->nlp_flag,
44854627 kref_read(&ndlp->kref),
44864628 ndlp->nlp_usg_map, ndlp);
....@@ -4489,6 +4631,14 @@
44894631
44904632 if (state != NLP_STE_UNUSED_NODE)
44914633 lpfc_nlp_set_state(vport, ndlp, state);
4634
+ else
4635
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
4636
+ "0013 rpi:%x DID:%x flg:%x refcnt:%d "
4637
+ "map:%x x%px STATE=UNUSED\n",
4638
+ ndlp->nlp_rpi, ndlp->nlp_DID,
4639
+ ndlp->nlp_flag,
4640
+ kref_read(&ndlp->kref),
4641
+ ndlp->nlp_usg_map, ndlp);
44924642
44934643 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE,
44944644 "node enable: did:x%x",
....@@ -4496,8 +4646,10 @@
44964646 return ndlp;
44974647
44984648 free_rpi:
4499
- if (phba->sli_rev == LPFC_SLI_REV4)
4649
+ if (phba->sli_rev == LPFC_SLI_REV4) {
45004650 lpfc_sli4_free_rpi(vport->phba, rpi);
4651
+ ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR;
4652
+ }
45014653 return NULL;
45024654 }
45034655
....@@ -4620,9 +4772,11 @@
46204772 case CMD_GEN_REQUEST64_CR:
46214773 if (iocb->context_un.ndlp == ndlp)
46224774 return 1;
4775
+ fallthrough;
46234776 case CMD_ELS_REQUEST64_CR:
46244777 if (icmd->un.elsreq64.remoteID == ndlp->nlp_DID)
46254778 return 1;
4779
+ fallthrough;
46264780 case CMD_XMIT_ELS_RSP64_CX:
46274781 if (iocb->context1 == (uint8_t *) ndlp)
46284782 return 1;
....@@ -4731,11 +4885,70 @@
47314885 struct lpfc_vport *vport = pmb->vport;
47324886 struct lpfc_nodelist *ndlp;
47334887
4734
- ndlp = (struct lpfc_nodelist *)(pmb->context1);
4888
+ ndlp = (struct lpfc_nodelist *)(pmb->ctx_ndlp);
47354889 if (!ndlp)
47364890 return;
47374891 lpfc_issue_els_logo(vport, ndlp, 0);
47384892 mempool_free(pmb, phba->mbox_mem_pool);
4893
+
4894
+ /* Check to see if there are any deferred events to process */
4895
+ if ((ndlp->nlp_flag & NLP_UNREG_INP) &&
4896
+ (ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING)) {
4897
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
4898
+ "1434 UNREG cmpl deferred logo x%x "
4899
+ "on NPort x%x Data: x%x x%px\n",
4900
+ ndlp->nlp_rpi, ndlp->nlp_DID,
4901
+ ndlp->nlp_defer_did, ndlp);
4902
+
4903
+ ndlp->nlp_flag &= ~NLP_UNREG_INP;
4904
+ ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING;
4905
+ lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
4906
+ } else {
4907
+ if (ndlp->nlp_flag & NLP_RELEASE_RPI) {
4908
+ lpfc_sli4_free_rpi(vport->phba, ndlp->nlp_rpi);
4909
+ ndlp->nlp_flag &= ~NLP_RELEASE_RPI;
4910
+ ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR;
4911
+ }
4912
+ ndlp->nlp_flag &= ~NLP_UNREG_INP;
4913
+ }
4914
+}
4915
+
4916
+/*
4917
+ * Sets the mailbox completion handler to be used for the
4918
+ * unreg_rpi command. The handler varies based on the state of
4919
+ * the port and what will be happening to the rpi next.
4920
+ */
4921
+static void
4922
+lpfc_set_unreg_login_mbx_cmpl(struct lpfc_hba *phba, struct lpfc_vport *vport,
4923
+ struct lpfc_nodelist *ndlp, LPFC_MBOXQ_t *mbox)
4924
+{
4925
+ unsigned long iflags;
4926
+
4927
+ if (ndlp->nlp_flag & NLP_ISSUE_LOGO) {
4928
+ mbox->ctx_ndlp = ndlp;
4929
+ mbox->mbox_cmpl = lpfc_nlp_logo_unreg;
4930
+
4931
+ } else if (phba->sli_rev == LPFC_SLI_REV4 &&
4932
+ (!(vport->load_flag & FC_UNLOADING)) &&
4933
+ (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >=
4934
+ LPFC_SLI_INTF_IF_TYPE_2) &&
4935
+ (kref_read(&ndlp->kref) > 0)) {
4936
+ mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
4937
+ mbox->mbox_cmpl = lpfc_sli4_unreg_rpi_cmpl_clr;
4938
+ } else {
4939
+ if (vport->load_flag & FC_UNLOADING) {
4940
+ if (phba->sli_rev == LPFC_SLI_REV4) {
4941
+ spin_lock_irqsave(&vport->phba->ndlp_lock,
4942
+ iflags);
4943
+ ndlp->nlp_flag |= NLP_RELEASE_RPI;
4944
+ spin_unlock_irqrestore(&vport->phba->ndlp_lock,
4945
+ iflags);
4946
+ }
4947
+ lpfc_nlp_get(ndlp);
4948
+ }
4949
+ mbox->ctx_ndlp = ndlp;
4950
+ mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
4951
+ }
47394952 }
47404953
47414954 /*
....@@ -4758,12 +4971,29 @@
47584971 if (ndlp->nlp_flag & NLP_RPI_REGISTERED ||
47594972 ndlp->nlp_flag & NLP_REG_LOGIN_SEND) {
47604973 if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND)
4761
- lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
4974
+ lpfc_printf_vlog(vport, KERN_INFO,
4975
+ LOG_NODE | LOG_DISCOVERY,
47624976 "3366 RPI x%x needs to be "
47634977 "unregistered nlp_flag x%x "
47644978 "did x%x\n",
47654979 ndlp->nlp_rpi, ndlp->nlp_flag,
47664980 ndlp->nlp_DID);
4981
+
4982
+ /* If there is already an UNREG in progress for this ndlp,
4983
+ * no need to queue up another one.
4984
+ */
4985
+ if (ndlp->nlp_flag & NLP_UNREG_INP) {
4986
+ lpfc_printf_vlog(vport, KERN_INFO,
4987
+ LOG_NODE | LOG_DISCOVERY,
4988
+ "1436 unreg_rpi SKIP UNREG x%x on "
4989
+ "NPort x%x deferred x%x flg x%x "
4990
+ "Data: x%px\n",
4991
+ ndlp->nlp_rpi, ndlp->nlp_DID,
4992
+ ndlp->nlp_defer_did,
4993
+ ndlp->nlp_flag, ndlp);
4994
+ goto out;
4995
+ }
4996
+
47674997 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
47684998 if (mbox) {
47694999 /* SLI4 ports require the physical rpi value. */
....@@ -4773,36 +5003,56 @@
47735003
47745004 lpfc_unreg_login(phba, vport->vpi, rpi, mbox);
47755005 mbox->vport = vport;
4776
- if (ndlp->nlp_flag & NLP_ISSUE_LOGO) {
4777
- mbox->context1 = ndlp;
4778
- mbox->mbox_cmpl = lpfc_nlp_logo_unreg;
4779
- } else {
4780
- if (phba->sli_rev == LPFC_SLI_REV4 &&
4781
- (!(vport->load_flag & FC_UNLOADING)) &&
4782
- (bf_get(lpfc_sli_intf_if_type,
4783
- &phba->sli4_hba.sli_intf) >=
4784
- LPFC_SLI_INTF_IF_TYPE_2) &&
4785
- (kref_read(&ndlp->kref) > 0)) {
4786
- mbox->context1 = lpfc_nlp_get(ndlp);
4787
- mbox->mbox_cmpl =
4788
- lpfc_sli4_unreg_rpi_cmpl_clr;
4789
- /*
4790
- * accept PLOGIs after unreg_rpi_cmpl
4791
- */
4792
- acc_plogi = 0;
4793
- } else
4794
- mbox->mbox_cmpl =
4795
- lpfc_sli_def_mbox_cmpl;
4796
- }
5006
+ lpfc_set_unreg_login_mbx_cmpl(phba, vport, ndlp, mbox);
5007
+ if (mbox->mbox_cmpl == lpfc_sli4_unreg_rpi_cmpl_clr)
5008
+ /*
5009
+ * accept PLOGIs after unreg_rpi_cmpl
5010
+ */
5011
+ acc_plogi = 0;
5012
+ if (((ndlp->nlp_DID & Fabric_DID_MASK) !=
5013
+ Fabric_DID_MASK) &&
5014
+ (!(vport->fc_flag & FC_OFFLINE_MODE)))
5015
+ ndlp->nlp_flag |= NLP_UNREG_INP;
5016
+
5017
+ lpfc_printf_vlog(vport, KERN_INFO,
5018
+ LOG_NODE | LOG_DISCOVERY,
5019
+ "1433 unreg_rpi UNREG x%x on "
5020
+ "NPort x%x deferred flg x%x "
5021
+ "Data:x%px\n",
5022
+ ndlp->nlp_rpi, ndlp->nlp_DID,
5023
+ ndlp->nlp_flag, ndlp);
47975024
47985025 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
47995026 if (rc == MBX_NOT_FINISHED) {
48005027 mempool_free(mbox, phba->mbox_mem_pool);
48015028 acc_plogi = 1;
48025029 }
5030
+ } else {
5031
+ lpfc_printf_vlog(vport, KERN_INFO,
5032
+ LOG_NODE | LOG_DISCOVERY,
5033
+ "1444 Failed to allocate mempool "
5034
+ "unreg_rpi UNREG x%x, "
5035
+ "DID x%x, flag x%x, "
5036
+ "ndlp x%px\n",
5037
+ ndlp->nlp_rpi, ndlp->nlp_DID,
5038
+ ndlp->nlp_flag, ndlp);
5039
+
5040
+ /* Because mempool_alloc failed, we
5041
+ * will issue a LOGO here and keep the rpi alive if
5042
+ * not unloading.
5043
+ */
5044
+ if (!(vport->load_flag & FC_UNLOADING)) {
5045
+ ndlp->nlp_flag &= ~NLP_UNREG_INP;
5046
+ lpfc_issue_els_logo(vport, ndlp, 0);
5047
+ ndlp->nlp_prev_state = ndlp->nlp_state;
5048
+ lpfc_nlp_set_state(vport, ndlp,
5049
+ NLP_STE_NPR_NODE);
5050
+ }
5051
+
5052
+ return 1;
48035053 }
48045054 lpfc_no_rpi(phba, ndlp);
4805
-
5055
+out:
48065056 if (phba->sli_rev != LPFC_SLI_REV4)
48075057 ndlp->nlp_rpi = 0;
48085058 ndlp->nlp_flag &= ~NLP_RPI_REGISTERED;
....@@ -4832,8 +5082,8 @@
48325082
48335083 vports = lpfc_create_vport_work_array(phba);
48345084 if (!vports) {
4835
- lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
4836
- "2884 Vport array allocation failed \n");
5085
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
5086
+ "2884 Vport array allocation failed \n");
48375087 return;
48385088 }
48395089 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
....@@ -4870,15 +5120,16 @@
48705120 mbox);
48715121 mbox->vport = vport;
48725122 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
4873
- mbox->context1 = NULL;
5123
+ mbox->ctx_ndlp = NULL;
48745124 rc = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO);
48755125 if (rc != MBX_TIMEOUT)
48765126 mempool_free(mbox, phba->mbox_mem_pool);
48775127
48785128 if ((rc == MBX_TIMEOUT) || (rc == MBX_NOT_FINISHED))
4879
- lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT,
4880
- "1836 Could not issue "
4881
- "unreg_login(all_rpis) status %d\n", rc);
5129
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
5130
+ "1836 Could not issue "
5131
+ "unreg_login(all_rpis) status %d\n",
5132
+ rc);
48825133 }
48835134 }
48845135
....@@ -4899,13 +5150,13 @@
48995150 mbox);
49005151 mbox->vport = vport;
49015152 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
4902
- mbox->context1 = NULL;
5153
+ mbox->ctx_ndlp = NULL;
49035154 rc = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO);
49045155 if (rc != MBX_TIMEOUT)
49055156 mempool_free(mbox, phba->mbox_mem_pool);
49065157
49075158 if ((rc == MBX_TIMEOUT) || (rc == MBX_NOT_FINISHED))
4908
- lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT,
5159
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
49095160 "1815 Could not issue "
49105161 "unreg_did (default rpis) status %d\n",
49115162 rc);
....@@ -4923,6 +5174,7 @@
49235174 struct lpfc_hba *phba = vport->phba;
49245175 LPFC_MBOXQ_t *mb, *nextmb;
49255176 struct lpfc_dmabuf *mp;
5177
+ unsigned long iflags;
49265178
49275179 /* Cleanup node for NPort <nlp_DID> */
49285180 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
....@@ -4932,16 +5184,16 @@
49325184 ndlp->nlp_state, ndlp->nlp_rpi);
49335185 if (NLP_CHK_FREE_REQ(ndlp)) {
49345186 lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE,
4935
- "0280 lpfc_cleanup_node: ndlp:x%p "
5187
+ "0280 %s: ndlp:x%px "
49365188 "usgmap:x%x refcnt:%d\n",
4937
- (void *)ndlp, ndlp->nlp_usg_map,
5189
+ __func__, (void *)ndlp, ndlp->nlp_usg_map,
49385190 kref_read(&ndlp->kref));
49395191 lpfc_dequeue_node(vport, ndlp);
49405192 } else {
49415193 lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE,
4942
- "0281 lpfc_cleanup_node: ndlp:x%p "
5194
+ "0281 %s: ndlp:x%px "
49435195 "usgmap:x%x refcnt:%d\n",
4944
- (void *)ndlp, ndlp->nlp_usg_map,
5196
+ __func__, (void *)ndlp, ndlp->nlp_usg_map,
49455197 kref_read(&ndlp->kref));
49465198 lpfc_disable_node(vport, ndlp);
49475199 }
....@@ -4953,8 +5205,8 @@
49535205 if ((mb = phba->sli.mbox_active)) {
49545206 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) &&
49555207 !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) &&
4956
- (ndlp == (struct lpfc_nodelist *) mb->context2)) {
4957
- mb->context2 = NULL;
5208
+ (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) {
5209
+ mb->ctx_ndlp = NULL;
49585210 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
49595211 }
49605212 }
....@@ -4964,18 +5216,18 @@
49645216 list_for_each_entry(mb, &phba->sli.mboxq_cmpl, list) {
49655217 if ((mb->u.mb.mbxCommand != MBX_REG_LOGIN64) ||
49665218 (mb->mbox_flag & LPFC_MBX_IMED_UNREG) ||
4967
- (ndlp != (struct lpfc_nodelist *) mb->context2))
5219
+ (ndlp != (struct lpfc_nodelist *)mb->ctx_ndlp))
49685220 continue;
49695221
4970
- mb->context2 = NULL;
5222
+ mb->ctx_ndlp = NULL;
49715223 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
49725224 }
49735225
49745226 list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) {
49755227 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) &&
49765228 !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) &&
4977
- (ndlp == (struct lpfc_nodelist *) mb->context2)) {
4978
- mp = (struct lpfc_dmabuf *) (mb->context1);
5229
+ (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) {
5230
+ mp = (struct lpfc_dmabuf *)(mb->ctx_buf);
49795231 if (mp) {
49805232 __lpfc_mbuf_free(phba, mp->virt, mp->phys);
49815233 kfree(mp);
....@@ -5001,9 +5253,24 @@
50015253
50025254 list_del_init(&ndlp->els_retry_evt.evt_listp);
50035255 list_del_init(&ndlp->dev_loss_evt.evt_listp);
5256
+ list_del_init(&ndlp->recovery_evt.evt_listp);
50045257 lpfc_cleanup_vports_rrqs(vport, ndlp);
5005
- lpfc_unreg_rpi(vport, ndlp);
5006
-
5258
+ if (phba->sli_rev == LPFC_SLI_REV4)
5259
+ ndlp->nlp_flag |= NLP_RELEASE_RPI;
5260
+ if (!lpfc_unreg_rpi(vport, ndlp)) {
5261
+ /* Clean up unregistered and non freed rpis */
5262
+ if ((ndlp->nlp_flag & NLP_RELEASE_RPI) &&
5263
+ !(ndlp->nlp_rpi == LPFC_RPI_ALLOC_ERROR)) {
5264
+ lpfc_sli4_free_rpi(vport->phba,
5265
+ ndlp->nlp_rpi);
5266
+ spin_lock_irqsave(&vport->phba->ndlp_lock,
5267
+ iflags);
5268
+ ndlp->nlp_flag &= ~NLP_RELEASE_RPI;
5269
+ ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR;
5270
+ spin_unlock_irqrestore(&vport->phba->ndlp_lock,
5271
+ iflags);
5272
+ }
5273
+ }
50075274 return 0;
50085275 }
50095276
....@@ -5029,8 +5296,10 @@
50295296 /* For this case we need to cleanup the default rpi
50305297 * allocated by the firmware.
50315298 */
5032
- lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
5033
- "0005 rpi:%x DID:%x flg:%x %d map:%x %p\n",
5299
+ lpfc_printf_vlog(vport, KERN_INFO,
5300
+ LOG_NODE | LOG_DISCOVERY,
5301
+ "0005 Cleanup Default rpi:x%x DID:x%x flg:x%x "
5302
+ "ref %d map:x%x ndlp x%px\n",
50345303 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag,
50355304 kref_read(&ndlp->kref),
50365305 ndlp->nlp_usg_map, ndlp);
....@@ -5045,7 +5314,7 @@
50455314 mbox->mbox_flag |= LPFC_MBX_IMED_UNREG;
50465315 mbox->mbox_cmpl = lpfc_mbx_cmpl_dflt_rpi;
50475316 mbox->vport = vport;
5048
- mbox->context2 = ndlp;
5317
+ mbox->ctx_ndlp = ndlp;
50495318 rc =lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
50505319 if (rc == MBX_NOT_FINISHED) {
50515320 mempool_free(mbox, phba->mbox_mem_pool);
....@@ -5066,9 +5335,10 @@
50665335 * for registered rport so need to cleanup rport
50675336 */
50685337 lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE,
5069
- "0940 removed node x%p DID x%x "
5070
- " rport not null %p\n",
5071
- ndlp, ndlp->nlp_DID, ndlp->rport);
5338
+ "0940 removed node x%px DID x%x "
5339
+ "rpi %d rport not null x%px\n",
5340
+ ndlp, ndlp->nlp_DID, ndlp->nlp_rpi,
5341
+ ndlp->rport);
50725342 rport = ndlp->rport;
50735343 rdata = rport->dd_data;
50745344 rdata->pnode = NULL;
....@@ -5141,15 +5411,15 @@
51415411
51425412 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
51435413 if (lpfc_matchdid(vport, ndlp, did)) {
5144
- data1 = (((uint32_t) ndlp->nlp_state << 24) |
5145
- ((uint32_t) ndlp->nlp_xri << 16) |
5146
- ((uint32_t) ndlp->nlp_type << 8) |
5147
- ((uint32_t) ndlp->nlp_rpi & 0xff));
5414
+ data1 = (((uint32_t)ndlp->nlp_state << 24) |
5415
+ ((uint32_t)ndlp->nlp_xri << 16) |
5416
+ ((uint32_t)ndlp->nlp_type << 8) |
5417
+ ((uint32_t)ndlp->nlp_usg_map & 0xff));
51485418 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
51495419 "0929 FIND node DID "
5150
- "Data: x%p x%x x%x x%x %p\n",
5420
+ "Data: x%px x%x x%x x%x x%x x%px\n",
51515421 ndlp, ndlp->nlp_DID,
5152
- ndlp->nlp_flag, data1,
5422
+ ndlp->nlp_flag, data1, ndlp->nlp_rpi,
51535423 ndlp->active_rrqs_xri_bitmap);
51545424 return ndlp;
51555425 }
....@@ -5175,6 +5445,41 @@
51755445 }
51765446
51775447 struct lpfc_nodelist *
5448
+lpfc_findnode_mapped(struct lpfc_vport *vport)
5449
+{
5450
+ struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
5451
+ struct lpfc_nodelist *ndlp;
5452
+ uint32_t data1;
5453
+ unsigned long iflags;
5454
+
5455
+ spin_lock_irqsave(shost->host_lock, iflags);
5456
+
5457
+ list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
5458
+ if (ndlp->nlp_state == NLP_STE_UNMAPPED_NODE ||
5459
+ ndlp->nlp_state == NLP_STE_MAPPED_NODE) {
5460
+ data1 = (((uint32_t)ndlp->nlp_state << 24) |
5461
+ ((uint32_t)ndlp->nlp_xri << 16) |
5462
+ ((uint32_t)ndlp->nlp_type << 8) |
5463
+ ((uint32_t)ndlp->nlp_rpi & 0xff));
5464
+ spin_unlock_irqrestore(shost->host_lock, iflags);
5465
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
5466
+ "2025 FIND node DID "
5467
+ "Data: x%px x%x x%x x%x x%px\n",
5468
+ ndlp, ndlp->nlp_DID,
5469
+ ndlp->nlp_flag, data1,
5470
+ ndlp->active_rrqs_xri_bitmap);
5471
+ return ndlp;
5472
+ }
5473
+ }
5474
+ spin_unlock_irqrestore(shost->host_lock, iflags);
5475
+
5476
+ /* FIND node did <did> NOT FOUND */
5477
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
5478
+ "2026 FIND mapped did NOT FOUND.\n");
5479
+ return NULL;
5480
+}
5481
+
5482
+struct lpfc_nodelist *
51785483 lpfc_setup_disc_node(struct lpfc_vport *vport, uint32_t did)
51795484 {
51805485 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
....@@ -5191,6 +5496,13 @@
51915496 if (!ndlp)
51925497 return NULL;
51935498 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
5499
+
5500
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
5501
+ "6453 Setup New Node 2B_DISC x%x "
5502
+ "Data:x%x x%x x%x\n",
5503
+ ndlp->nlp_DID, ndlp->nlp_flag,
5504
+ ndlp->nlp_state, vport->fc_flag);
5505
+
51945506 spin_lock_irq(shost->host_lock);
51955507 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
51965508 spin_unlock_irq(shost->host_lock);
....@@ -5199,8 +5511,17 @@
51995511 if (vport->phba->nvmet_support)
52005512 return NULL;
52015513 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_NPR_NODE);
5202
- if (!ndlp)
5514
+ if (!ndlp) {
5515
+ lpfc_printf_vlog(vport, KERN_WARNING, LOG_SLI,
5516
+ "0014 Could not enable ndlp\n");
52035517 return NULL;
5518
+ }
5519
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
5520
+ "6454 Setup Enabled Node 2B_DISC x%x "
5521
+ "Data:x%x x%x x%x\n",
5522
+ ndlp->nlp_DID, ndlp->nlp_flag,
5523
+ ndlp->nlp_state, vport->fc_flag);
5524
+
52045525 spin_lock_irq(shost->host_lock);
52055526 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
52065527 spin_unlock_irq(shost->host_lock);
....@@ -5219,6 +5540,12 @@
52195540 * delay timeout is not needed.
52205541 */
52215542 lpfc_cancel_retry_delay_tmo(vport, ndlp);
5543
+
5544
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
5545
+ "6455 Setup RSCN Node 2B_DISC x%x "
5546
+ "Data:x%x x%x x%x\n",
5547
+ ndlp->nlp_DID, ndlp->nlp_flag,
5548
+ ndlp->nlp_state, vport->fc_flag);
52225549
52235550 /* NVME Target mode waits until rport is known to be
52245551 * impacted by the RSCN before it transitions. No
....@@ -5242,9 +5569,21 @@
52425569 spin_lock_irq(shost->host_lock);
52435570 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
52445571 spin_unlock_irq(shost->host_lock);
5245
- } else
5572
+ } else {
5573
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
5574
+ "6456 Skip Setup RSCN Node x%x "
5575
+ "Data:x%x x%x x%x\n",
5576
+ ndlp->nlp_DID, ndlp->nlp_flag,
5577
+ ndlp->nlp_state, vport->fc_flag);
52465578 ndlp = NULL;
5579
+ }
52475580 } else {
5581
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
5582
+ "6457 Setup Active Node 2B_DISC x%x "
5583
+ "Data:x%x x%x x%x\n",
5584
+ ndlp->nlp_DID, ndlp->nlp_flag,
5585
+ ndlp->nlp_state, vport->fc_flag);
5586
+
52485587 /* If the initiator received a PLOGI from this NPort or if the
52495588 * initiator is already in the process of discovery on it,
52505589 * there's no need to try to discover it again.
....@@ -5396,10 +5735,10 @@
53965735
53975736 /* Start Discovery state <hba_state> */
53985737 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
5399
- "0202 Start Discovery hba state x%x "
5400
- "Data: x%x x%x x%x\n",
5738
+ "0202 Start Discovery port state x%x "
5739
+ "flg x%x Data: x%x x%x x%x\n",
54015740 vport->port_state, vport->fc_flag, vport->fc_plogi_cnt,
5402
- vport->fc_adisc_cnt);
5741
+ vport->fc_adisc_cnt, vport->fc_npr_cnt);
54035742
54045743 /* First do ADISCs - if any */
54055744 num_sent = lpfc_els_disc_adisc(vport);
....@@ -5471,12 +5810,10 @@
54715810 lpfc_free_tx(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
54725811 {
54735812 LIST_HEAD(completions);
5474
- struct lpfc_sli *psli;
54755813 IOCB_t *icmd;
54765814 struct lpfc_iocbq *iocb, *next_iocb;
54775815 struct lpfc_sli_ring *pring;
54785816
5479
- psli = &phba->sli;
54805817 pring = lpfc_phba_elsring(phba);
54815818 if (unlikely(!pring))
54825819 return;
....@@ -5641,7 +5978,8 @@
56415978 case LPFC_FLOGI:
56425979 /* port_state is identically LPFC_FLOGI while waiting for FLOGI cmpl */
56435980 /* Initial FLOGI timeout */
5644
- lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
5981
+ lpfc_printf_vlog(vport, KERN_ERR,
5982
+ LOG_TRACE_EVENT,
56455983 "0222 Initial %s timeout\n",
56465984 vport->vpi ? "FDISC" : "FLOGI");
56475985
....@@ -5659,7 +5997,8 @@
56595997 case LPFC_FABRIC_CFG_LINK:
56605998 /* hba_state is identically LPFC_FABRIC_CFG_LINK while waiting for
56615999 NameServer login */
5662
- lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
6000
+ lpfc_printf_vlog(vport, KERN_ERR,
6001
+ LOG_TRACE_EVENT,
56636002 "0223 Timeout while waiting for "
56646003 "NameServer login\n");
56656004 /* Next look for NameServer ndlp */
....@@ -5672,7 +6011,8 @@
56726011
56736012 case LPFC_NS_QRY:
56746013 /* Check for wait for NameServer Rsp timeout */
5675
- lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
6014
+ lpfc_printf_vlog(vport, KERN_ERR,
6015
+ LOG_TRACE_EVENT,
56766016 "0224 NameServer Query timeout "
56776017 "Data: x%x x%x\n",
56786018 vport->fc_ns_retry, LPFC_MAX_NS_RETRY);
....@@ -5705,7 +6045,8 @@
57056045 /* Setup and issue mailbox INITIALIZE LINK command */
57066046 initlinkmbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
57076047 if (!initlinkmbox) {
5708
- lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
6048
+ lpfc_printf_vlog(vport, KERN_ERR,
6049
+ LOG_TRACE_EVENT,
57096050 "0206 Device Discovery "
57106051 "completion error\n");
57116052 phba->link_state = LPFC_HBA_ERROR;
....@@ -5727,7 +6068,8 @@
57276068
57286069 case LPFC_DISC_AUTH:
57296070 /* Node Authentication timeout */
5730
- lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
6071
+ lpfc_printf_vlog(vport, KERN_ERR,
6072
+ LOG_TRACE_EVENT,
57316073 "0227 Node Authentication timeout\n");
57326074 lpfc_disc_flush_list(vport);
57336075
....@@ -5747,7 +6089,8 @@
57476089
57486090 case LPFC_VPORT_READY:
57496091 if (vport->fc_flag & FC_RSCN_MODE) {
5750
- lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
6092
+ lpfc_printf_vlog(vport, KERN_ERR,
6093
+ LOG_TRACE_EVENT,
57516094 "0231 RSCN timeout Data: x%x "
57526095 "x%x\n",
57536096 vport->fc_ns_retry, LPFC_MAX_NS_RETRY);
....@@ -5761,7 +6104,8 @@
57616104 break;
57626105
57636106 default:
5764
- lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
6107
+ lpfc_printf_vlog(vport, KERN_ERR,
6108
+ LOG_TRACE_EVENT,
57656109 "0273 Unexpected discovery timeout, "
57666110 "vport State x%x\n", vport->port_state);
57676111 break;
....@@ -5770,21 +6114,23 @@
57706114 switch (phba->link_state) {
57716115 case LPFC_CLEAR_LA:
57726116 /* CLEAR LA timeout */
5773
- lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
6117
+ lpfc_printf_vlog(vport, KERN_ERR,
6118
+ LOG_TRACE_EVENT,
57746119 "0228 CLEAR LA timeout\n");
57756120 clrlaerr = 1;
57766121 break;
57776122
57786123 case LPFC_LINK_UP:
57796124 lpfc_issue_clear_la(phba, vport);
5780
- /* Drop thru */
6125
+ fallthrough;
57816126 case LPFC_LINK_UNKNOWN:
57826127 case LPFC_WARM_START:
57836128 case LPFC_INIT_START:
57846129 case LPFC_INIT_MBX_CMDS:
57856130 case LPFC_LINK_DOWN:
57866131 case LPFC_HBA_ERROR:
5787
- lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
6132
+ lpfc_printf_vlog(vport, KERN_ERR,
6133
+ LOG_TRACE_EVENT,
57886134 "0230 Unexpected timeout, hba link "
57896135 "state x%x\n", phba->link_state);
57906136 clrlaerr = 1;
....@@ -5817,20 +6163,20 @@
58176163 lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
58186164 {
58196165 MAILBOX_t *mb = &pmb->u.mb;
5820
- struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1);
5821
- struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) pmb->context2;
6166
+ struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(pmb->ctx_buf);
6167
+ struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp;
58226168 struct lpfc_vport *vport = pmb->vport;
58236169
5824
- pmb->context1 = NULL;
5825
- pmb->context2 = NULL;
6170
+ pmb->ctx_buf = NULL;
6171
+ pmb->ctx_ndlp = NULL;
58266172
58276173 if (phba->sli_rev < LPFC_SLI_REV4)
58286174 ndlp->nlp_rpi = mb->un.varWords[0];
58296175 ndlp->nlp_flag |= NLP_RPI_REGISTERED;
58306176 ndlp->nlp_type |= NLP_FABRIC;
58316177 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
5832
- lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
5833
- "0004 rpi:%x DID:%x flg:%x %d map:%x %p\n",
6178
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_DISCOVERY,
6179
+ "0004 rpi:%x DID:%x flg:%x %d map:%x x%px\n",
58346180 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag,
58356181 kref_read(&ndlp->kref),
58366182 ndlp->nlp_usg_map, ndlp);
....@@ -5884,8 +6230,8 @@
58846230 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
58856231 if (filter(ndlp, param)) {
58866232 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
5887
- "3185 FIND node filter %p DID "
5888
- "ndlp %p did x%x flg x%x st x%x "
6233
+ "3185 FIND node filter %ps DID "
6234
+ "ndlp x%px did x%x flg x%x st x%x "
58896235 "xri x%x type x%x rpi x%x\n",
58906236 filter, ndlp, ndlp->nlp_DID,
58916237 ndlp->nlp_flag, ndlp->nlp_state,
....@@ -5895,7 +6241,7 @@
58956241 }
58966242 }
58976243 lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
5898
- "3186 FIND node filter %p NOT FOUND.\n", filter);
6244
+ "3186 FIND node filter %ps NOT FOUND.\n", filter);
58996245 return NULL;
59006246 }
59016247
....@@ -5935,10 +6281,11 @@
59356281 {
59366282 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
59376283 struct lpfc_nodelist *ndlp;
6284
+ unsigned long flags;
59386285
5939
- spin_lock_irq(shost->host_lock);
6286
+ spin_lock_irqsave(shost->host_lock, flags);
59406287 ndlp = __lpfc_findnode_rpi(vport, rpi);
5941
- spin_unlock_irq(shost->host_lock);
6288
+ spin_unlock_irqrestore(shost->host_lock, flags);
59426289 return ndlp;
59436290 }
59446291
....@@ -5974,21 +6321,21 @@
59746321 }
59756322
59766323 if (i >= phba->max_vpi) {
5977
- lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
5978
- "2936 Could not find Vport mapped "
5979
- "to vpi %d\n", vpi);
6324
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
6325
+ "2936 Could not find Vport mapped "
6326
+ "to vpi %d\n", vpi);
59806327 return NULL;
59816328 }
59826329 }
59836330
5984
- spin_lock_irqsave(&phba->hbalock, flags);
6331
+ spin_lock_irqsave(&phba->port_list_lock, flags);
59856332 list_for_each_entry(vport, &phba->port_list, listentry) {
59866333 if (vport->vpi == i) {
5987
- spin_unlock_irqrestore(&phba->hbalock, flags);
6334
+ spin_unlock_irqrestore(&phba->port_list_lock, flags);
59886335 return vport;
59896336 }
59906337 }
5991
- spin_unlock_irqrestore(&phba->hbalock, flags);
6338
+ spin_unlock_irqrestore(&phba->port_list_lock, flags);
59926339 return NULL;
59936340 }
59946341
....@@ -6017,12 +6364,12 @@
60176364 INIT_LIST_HEAD(&ndlp->nlp_listp);
60186365 if (vport->phba->sli_rev == LPFC_SLI_REV4) {
60196366 ndlp->nlp_rpi = rpi;
6020
- lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
6021
- "0007 rpi:%x DID:%x flg:%x refcnt:%d "
6022
- "map:%x %p\n", ndlp->nlp_rpi, ndlp->nlp_DID,
6023
- ndlp->nlp_flag,
6024
- kref_read(&ndlp->kref),
6025
- ndlp->nlp_usg_map, ndlp);
6367
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_DISCOVERY,
6368
+ "0007 Init New ndlp x%px, rpi:x%x DID:%x "
6369
+ "flg:x%x refcnt:%d map:x%x\n",
6370
+ ndlp, ndlp->nlp_rpi, ndlp->nlp_DID,
6371
+ ndlp->nlp_flag, kref_read(&ndlp->kref),
6372
+ ndlp->nlp_usg_map);
60266373
60276374 ndlp->active_rrqs_xri_bitmap =
60286375 mempool_alloc(vport->phba->active_rrq_pool,
....@@ -6057,8 +6404,9 @@
60576404 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type);
60586405
60596406 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
6060
- "0279 lpfc_nlp_release: ndlp:x%p did %x "
6407
+ "0279 %s: ndlp:x%px did %x "
60616408 "usgmap:x%x refcnt:%d rpi:%x\n",
6409
+ __func__,
60626410 (void *)ndlp, ndlp->nlp_DID, ndlp->nlp_usg_map,
60636411 kref_read(&ndlp->kref), ndlp->nlp_rpi);
60646412
....@@ -6070,8 +6418,6 @@
60706418 spin_lock_irqsave(&phba->ndlp_lock, flags);
60716419 NLP_CLR_NODE_ACT(ndlp);
60726420 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
6073
- if (phba->sli_rev == LPFC_SLI_REV4)
6074
- lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi);
60756421
60766422 /* free ndlp memory for final ndlp release */
60776423 if (NLP_CHK_FREE_REQ(ndlp)) {
....@@ -6107,9 +6453,9 @@
61076453 if (!NLP_CHK_NODE_ACT(ndlp) || NLP_CHK_FREE_ACK(ndlp)) {
61086454 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
61096455 lpfc_printf_vlog(ndlp->vport, KERN_WARNING, LOG_NODE,
6110
- "0276 lpfc_nlp_get: ndlp:x%p "
6456
+ "0276 %s: ndlp:x%px "
61116457 "usgmap:x%x refcnt:%d\n",
6112
- (void *)ndlp, ndlp->nlp_usg_map,
6458
+ __func__, (void *)ndlp, ndlp->nlp_usg_map,
61136459 kref_read(&ndlp->kref));
61146460 return NULL;
61156461 } else
....@@ -6135,9 +6481,9 @@
61356481 return 1;
61366482
61376483 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE,
6138
- "node put: did:x%x flg:x%x refcnt:x%x",
6139
- ndlp->nlp_DID, ndlp->nlp_flag,
6140
- kref_read(&ndlp->kref));
6484
+ "node put: did:x%x flg:x%x refcnt:x%x",
6485
+ ndlp->nlp_DID, ndlp->nlp_flag,
6486
+ kref_read(&ndlp->kref));
61416487 phba = ndlp->phba;
61426488 spin_lock_irqsave(&phba->ndlp_lock, flags);
61436489 /* Check the ndlp memory free acknowledge flag to avoid the
....@@ -6147,9 +6493,9 @@
61476493 if (NLP_CHK_FREE_ACK(ndlp)) {
61486494 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
61496495 lpfc_printf_vlog(ndlp->vport, KERN_WARNING, LOG_NODE,
6150
- "0274 lpfc_nlp_put: ndlp:x%p "
6496
+ "0274 %s: ndlp:x%px "
61516497 "usgmap:x%x refcnt:%d\n",
6152
- (void *)ndlp, ndlp->nlp_usg_map,
6498
+ __func__, (void *)ndlp, ndlp->nlp_usg_map,
61536499 kref_read(&ndlp->kref));
61546500 return 1;
61556501 }
....@@ -6160,9 +6506,9 @@
61606506 if (NLP_CHK_IACT_REQ(ndlp)) {
61616507 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
61626508 lpfc_printf_vlog(ndlp->vport, KERN_WARNING, LOG_NODE,
6163
- "0275 lpfc_nlp_put: ndlp:x%p "
6509
+ "0275 %s: ndlp:x%px "
61646510 "usgmap:x%x refcnt:%d\n",
6165
- (void *)ndlp, ndlp->nlp_usg_map,
6511
+ __func__, (void *)ndlp, ndlp->nlp_usg_map,
61666512 kref_read(&ndlp->kref));
61676513 return 1;
61686514 }
....@@ -6252,7 +6598,8 @@
62526598 goto out;
62536599 } else if (ndlp->nlp_flag & NLP_RPI_REGISTERED) {
62546600 ret = 1;
6255
- lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
6601
+ lpfc_printf_log(phba, KERN_INFO,
6602
+ LOG_NODE | LOG_DISCOVERY,
62566603 "2624 RPI %x DID %x flag %x "
62576604 "still logged in\n",
62586605 ndlp->nlp_rpi, ndlp->nlp_DID,
....@@ -6280,10 +6627,10 @@
62806627 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
62816628
62826629 if (mboxq->u.mb.mbxStatus) {
6283
- lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX,
6284
- "2555 UNREG_VFI mbxStatus error x%x "
6285
- "HBA state x%x\n",
6286
- mboxq->u.mb.mbxStatus, vport->port_state);
6630
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
6631
+ "2555 UNREG_VFI mbxStatus error x%x "
6632
+ "HBA state x%x\n",
6633
+ mboxq->u.mb.mbxStatus, vport->port_state);
62876634 }
62886635 spin_lock_irq(shost->host_lock);
62896636 phba->pport->fc_flag &= ~FC_VFI_REGISTERED;
....@@ -6305,10 +6652,10 @@
63056652 struct lpfc_vport *vport = mboxq->vport;
63066653
63076654 if (mboxq->u.mb.mbxStatus) {
6308
- lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX,
6309
- "2550 UNREG_FCFI mbxStatus error x%x "
6310
- "HBA state x%x\n",
6311
- mboxq->u.mb.mbxStatus, vport->port_state);
6655
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
6656
+ "2550 UNREG_FCFI mbxStatus error x%x "
6657
+ "HBA state x%x\n",
6658
+ mboxq->u.mb.mbxStatus, vport->port_state);
63126659 }
63136660 mempool_free(mboxq, phba->mbox_mem_pool);
63146661 return;
....@@ -6397,7 +6744,7 @@
63976744
63986745 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
63996746 if (!mbox) {
6400
- lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX,
6747
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
64016748 "2551 UNREG_FCFI mbox allocation failed"
64026749 "HBA state x%x\n", phba->pport->port_state);
64036750 return -ENOMEM;
....@@ -6408,7 +6755,7 @@
64086755 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
64096756
64106757 if (rc == MBX_NOT_FINISHED) {
6411
- lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
6758
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
64126759 "2552 Unregister FCFI command failed rc x%x "
64136760 "HBA state x%x\n",
64146761 rc, phba->pport->port_state);
....@@ -6432,7 +6779,7 @@
64326779 /* Preparation for unregistering fcf */
64336780 rc = lpfc_unregister_fcf_prep(phba);
64346781 if (rc) {
6435
- lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
6782
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
64366783 "2748 Failed to prepare for unregistering "
64376784 "HBA's FCF record: rc=%d\n", rc);
64386785 return;
....@@ -6468,7 +6815,7 @@
64686815 spin_lock_irq(&phba->hbalock);
64696816 phba->fcf.fcf_flag &= ~FCF_INIT_DISC;
64706817 spin_unlock_irq(&phba->hbalock);
6471
- lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY|LOG_MBOX,
6818
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
64726819 "2553 lpfc_unregister_unused_fcf failed "
64736820 "to read FCF record HBA state x%x\n",
64746821 phba->pport->port_state);
....@@ -6490,7 +6837,7 @@
64906837 /* Preparation for unregistering fcf */
64916838 rc = lpfc_unregister_fcf_prep(phba);
64926839 if (rc) {
6493
- lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
6840
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
64946841 "2749 Failed to prepare for unregistering "
64956842 "HBA's FCF record: rc=%d\n", rc);
64966843 return;
....@@ -6577,9 +6924,9 @@
65776924 conn_entry = kzalloc(sizeof(struct lpfc_fcf_conn_entry),
65786925 GFP_KERNEL);
65796926 if (!conn_entry) {
6580
- lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
6581
- "2566 Failed to allocate connection"
6582
- " table entry\n");
6927
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
6928
+ "2566 Failed to allocate connection"
6929
+ " table entry\n");
65836930 return;
65846931 }
65856932
....@@ -6723,7 +7070,7 @@
67237070
67247071 /* Check the region signature first */
67257072 if (memcmp(buff, LPFC_REGION23_SIGNATURE, 4)) {
6726
- lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
7073
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
67277074 "2567 Config region 23 has bad signature\n");
67287075 return;
67297076 }
....@@ -6732,8 +7079,8 @@
67327079
67337080 /* Check the data structure version */
67347081 if (buff[offset] != LPFC_REGION23_VERSION) {
6735
- lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
6736
- "2568 Config region 23 has bad version\n");
7082
+ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
7083
+ "2568 Config region 23 has bad version\n");
67377084 return;
67387085 }
67397086 offset += 4;