28 #include <linux/pci.h>
29 #include <linux/slab.h>
32 #include <scsi/scsi.h>
84 lpfc_alloc_vpi(
struct lpfc_hba *phba)
96 phba->
sli4_hba.max_cfg_param.vpi_used++;
97 spin_unlock_irq(&phba->
hbalock);
102 lpfc_free_vpi(
struct lpfc_hba *phba,
int vpi)
109 phba->
sli4_hba.max_cfg_param.vpi_used--;
110 spin_unlock_irq(&phba->
hbalock);
145 "1830 Signal aborted mbxCmd x%x\n",
154 "1818 VPort failed init, mbxCmd x%x "
155 "READ_SPARM mbxStatus x%x, rc = x%x\n",
180 const char *name_type)
185 if (!((wwn->
u.
wwn[0] >> 4) == 1 &&
186 ((wwn->
u.
wwn[0] & 0xf) != 0 || (wwn->
u.
wwn[1] & 0xf) != 0)))
190 "1822 Invalid %s: %02x:%02x:%02x:%02x:"
191 "%02x:%02x:%02x:%02x\n",
208 if (vport == new_vport)
214 spin_unlock_irqrestore(&phba->
hbalock, flags);
218 spin_unlock_irqrestore(&phba->
hbalock, flags);
237 static void lpfc_discovery_wait(
struct lpfc_vport *vport)
241 unsigned long wait_time_max;
257 (vport->
fc_flag & wait_flags) ||
261 "1833 Vport discovery quiesce Wait:"
262 " state x%x fc_flags x%x"
263 " num_nodes x%x, waiting 1000 msecs"
264 " total wait msecs x%x\n",
272 "1834 Vport discovery quiesced:"
273 " state x%x fc_flags x%x"
284 "1835 Vport discovery quiesce failed:"
285 " state x%x fc_flags x%x wait msecs x%x\n",
305 "1808 Create VPORT failed: "
306 "NPIV is not enabled: SLImode:%d\n",
312 vpi = lpfc_alloc_vpi(phba);
315 "1809 Create VPORT failed: "
316 "Max VPORTs (%d) exceeded\n",
325 "1810 Create VPORT failed: Cannot get "
326 "instance number\n");
327 lpfc_free_vpi(phba, vpi);
335 "1811 Create VPORT failed: vpi x%x\n", vpi);
336 lpfc_free_vpi(phba, vpi);
344 if ((
status = lpfc_vport_sparm(phba, vport))) {
347 "1831 Create VPORT Interrupted.\n");
351 "1813 Create VPORT failed. "
352 "Cannot get sparam\n");
355 lpfc_free_vpi(phba, vpi);
366 if (!lpfc_valid_wwn_format(phba, &vport->
fc_sparam.nodeName,
"WWNN") ||
367 !lpfc_valid_wwn_format(phba, &vport->
fc_sparam.portName,
"WWPN")) {
369 "1821 Create VPORT failed. "
370 "Invalid WWN format\n");
371 lpfc_free_vpi(phba, vpi);
377 if (!lpfc_unique_wwpn(phba, vport)) {
379 "1823 Create VPORT failed. "
380 "Duplicate WWN on HBA\n");
381 lpfc_free_vpi(phba, vpi);
402 "1838 Failed to INIT_VPI on vpi %d "
403 "status %d\n", vpi, rc);
405 lpfc_free_vpi(phba, vpi);
445 "0262 No NPIV Fabric support\n");
454 "1825 Vport Created.\n");
502 spin_lock_irq(
shost->host_lock);
504 spin_unlock_irq(
shost->host_lock);
508 "1826 Vport Disabled.\n");
513 enable_vport(
struct fc_vport *fc_vport)
526 spin_lock_irq(
shost->host_lock);
529 spin_unlock_irq(
shost->host_lock);
543 "0264 No NPIV Fabric support\n");
549 "1827 Vport Enabled.\n");
557 return disable_vport(fc_vport);
559 return enable_vport(fc_vport);
574 "1812 vport_delete failed: Cannot delete "
583 "1837 vport_delete failed: Cannot delete "
589 spin_unlock_irq(&phba->
hbalock);
596 while (check_count < ((phba->
fc_ratov * 3) + 3) &&
681 "1829 CT command failed to "
682 "delete objects on fabric\n");
734 lpfc_discovery_wait(vport);
754 lpfc_free_vpi(phba, vport->
vpi);
758 spin_unlock_irq(&phba->
hbalock);
760 "1828 Vport Deleted.\n");
781 "1801 Create vport work array FAILED: "
782 "cannot do scsi_host_get\n");
785 vports[index++] = port_iterator;
787 spin_unlock_irq(&phba->
hbalock);
851 "0287 lpfc_alloc_bucket failed to "
852 "allocate statistical data buffer DID "