[SCSI] lpfc 8.2.2 : Rework the lpfc_printf_log() macro

Rework the lpfc_printf_log() macro so that logging is enabled on a
per-vport basis. Used to be on a physical-port basis, thus logging
with large numbers of vports became a mess.  Required redefinition of
the macro, and an update of every use.

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 70e1bc3..77067d1 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -125,11 +125,10 @@
 	pmb->vport = vport;
 	rc = lpfc_sli_issue_mbox_wait(phba, pmb, phba->fc_ratov * 2);
 	if (rc != MBX_SUCCESS) {
-		lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
-				"%d (%d):1818 VPort failed init, mbxCmd x%x "
-				"READ_SPARM mbxStatus x%x, rc = x%x\n",
-				phba->brd_no, vport->vpi,
-				mb->mbxCommand, mb->mbxStatus, rc);
+		lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT | LOG_VPORT,
+				 "1818 VPort failed init, mbxCmd x%x "
+				 "READ_SPARM mbxStatus x%x, rc = x%x\n",
+				 mb->mbxCommand, mb->mbxStatus, rc);
 		lpfc_mbuf_free(phba, mp->virt, mp->phys);
 		kfree(mp);
 		if (rc != MBX_TIMEOUT)
@@ -162,9 +161,9 @@
 		return 1;
 
 	lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-			"%d:1822 Invalid %s: %02x:%02x:%02x:%02x:"
+			"1822 Invalid %s: %02x:%02x:%02x:%02x:"
 			"%02x:%02x:%02x:%02x\n",
-			phba->brd_no, name_type,
+			name_type,
 			wwn->u.wwn[0], wwn->u.wwn[1],
 			wwn->u.wwn[2], wwn->u.wwn[3],
 			wwn->u.wwn[4], wwn->u.wwn[5],
@@ -209,9 +208,9 @@
 	if ((phba->sli_rev < 3) ||
 		!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) {
 		lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-				"%d:1808 Create VPORT failed: "
+				"1808 Create VPORT failed: "
 				"NPIV is not enabled: SLImode:%d\n",
-				phba->brd_no, phba->sli_rev);
+				phba->sli_rev);
 		rc = VPORT_INVAL;
 		goto error_out;
 	}
@@ -219,9 +218,9 @@
 	vpi = lpfc_alloc_vpi(phba);
 	if (vpi == 0) {
 		lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-				"%d:1809 Create VPORT failed: "
+				"1809 Create VPORT failed: "
 				"Max VPORTs (%d) exceeded\n",
-				phba->brd_no, phba->max_vpi);
+				phba->max_vpi);
 		rc = VPORT_NORESOURCES;
 		goto error_out;
 	}
@@ -230,8 +229,8 @@
 	/* Assign an unused board number */
 	if ((instance = lpfc_get_instance()) < 0) {
 		lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-				"%d:1810 Create VPORT failed: Cannot get "
-				"instance number\n", phba->brd_no);
+				"1810 Create VPORT failed: Cannot get "
+				"instance number\n");
 		lpfc_free_vpi(phba, vpi);
 		rc = VPORT_NORESOURCES;
 		goto error_out;
@@ -240,8 +239,7 @@
 	vport = lpfc_create_port(phba, instance, &fc_vport->dev);
 	if (!vport) {
 		lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-				"%d:1811 Create VPORT failed: vpi x%x\n",
-				phba->brd_no, vpi);
+				"1811 Create VPORT failed: vpi x%x\n", vpi);
 		lpfc_free_vpi(phba, vpi);
 		rc = VPORT_NORESOURCES;
 		goto error_out;
@@ -251,10 +249,9 @@
 	lpfc_debugfs_initialize(vport);
 
 	if (lpfc_vport_sparm(phba, vport)) {
-		lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-				"%d:1813 Create VPORT failed: vpi:%d "
-				"Cannot get sparam\n",
-				phba->brd_no, vpi);
+		lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+				 "1813 Create VPORT failed. "
+				 "Cannot get sparam\n");
 		lpfc_free_vpi(phba, vpi);
 		destroy_port(vport);
 		rc = VPORT_NORESOURCES;
@@ -274,10 +271,9 @@
 
 	if (!lpfc_valid_wwn_format(phba, &vport->fc_sparam.nodeName, "WWNN") ||
 	    !lpfc_valid_wwn_format(phba, &vport->fc_sparam.portName, "WWPN")) {
-		lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-				"%d:1821 Create VPORT failed: vpi:%d "
-				"Invalid WWN format\n",
-				phba->brd_no, vpi);
+		lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+				 "1821 Create VPORT failed. "
+				 "Invalid WWN format\n");
 		lpfc_free_vpi(phba, vpi);
 		destroy_port(vport);
 		rc = VPORT_INVAL;
@@ -285,10 +281,9 @@
 	}
 
 	if (!lpfc_unique_wwpn(phba, vport)) {
-		lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-				"%d:1823 Create VPORT failed: vpi:%d "
-				"Duplicate WWN on HBA\n",
-				phba->brd_no, vpi);
+		lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+				 "1823 Create VPORT failed. "
+				 "Duplicate WWN on HBA\n");
 		lpfc_free_vpi(phba, vpi);
 		destroy_port(vport);
 		rc = VPORT_INVAL;
@@ -320,10 +315,8 @@
 			lpfc_initial_fdisc(vport);
 		} else {
 			lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP);
-			lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-					"%d (%d):0262 No NPIV Fabric "
-					"support\n",
-					phba->brd_no, vport->vpi);
+			lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+					 "0262 No NPIV Fabric support\n");
 		}
 	} else {
 		lpfc_vport_set_state(vport, FC_VPORT_FAILED);
@@ -409,10 +402,8 @@
 			lpfc_initial_fdisc(vport);
 		} else {
 			lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP);
-			lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-					"%d (%d):0264 No NPIV Fabric "
-					"support\n",
-					phba->brd_no, vport->vpi);
+			lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+					 "0264 No NPIV Fabric support\n");
 		}
 	} else {
 		lpfc_vport_set_state(vport, FC_VPORT_FAILED);
@@ -462,9 +453,9 @@
 		return VPORT_INVAL;
 
 	if (vport->port_type == LPFC_PHYSICAL_PORT) {
-		lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-				"%d:1812 vport_delete failed: Cannot delete "
-				"physical host\n", phba->brd_no);
+		lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+				 "1812 vport_delete failed: Cannot delete "
+				 "physical host\n");
 		goto out;
 	}
 
@@ -544,8 +535,12 @@
 		return NULL;
 	spin_lock_irq(&phba->hbalock);
 	list_for_each_entry(port_iterator, &phba->port_list, listentry) {
-		if (!scsi_host_get(lpfc_shost_from_vport(port_iterator)))
+		if (!scsi_host_get(lpfc_shost_from_vport(port_iterator))) {
+			lpfc_printf_vlog(port_iterator, KERN_ERR, LOG_VPORT,
+					 "1801 Create vport work array FAILED: "
+					 "cannot do scsi_host_get\n");
 			continue;
+		}
 		vports[index++] = port_iterator;
 	}
 	spin_unlock_irq(&phba->hbalock);