aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qedf/qedf_main.c
diff options
context:
space:
mode:
authorChad Dupuis <chad.dupuis@cavium.com>2017-08-15 10:08:16 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2017-08-24 22:29:02 -0400
commit01fd76a76552b801897ac087e4e2d7667dd7c458 (patch)
tree9d8ec0ea710e31f2354df5f32c101747e032e828 /drivers/scsi/qedf/qedf_main.c
parentscsi: qla2xxx: fix spelling mistake of variable sfp_additonal_info (diff)
downloadlinux-dev-01fd76a76552b801897ac087e4e2d7667dd7c458.tar.xz
linux-dev-01fd76a76552b801897ac087e4e2d7667dd7c458.zip
scsi: qedf: Set WWNN and WWPN based on values from qed.
If dev_info.wwpn and dev_info.wwnn are set by qed use these values to set the WWNs of the port. Otherwise fall back to the old method using fcoe_wwn_from_mac(). Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/qedf/qedf_main.c')
-rw-r--r--drivers/scsi/qedf/qedf_main.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 7786c97e033f..e17e5a7fc73e 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -3058,9 +3058,24 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "MAC address is %pM.\n",
qedf->mac);
- /* Set the WWNN and WWPN based on the MAC address */
- qedf->wwnn = fcoe_wwn_from_mac(qedf->mac, 1, 0);
- qedf->wwpn = fcoe_wwn_from_mac(qedf->mac, 2, 0);
+ /*
+ * Set the WWNN and WWPN in the following way:
+ *
+ * If the info we get from qed is non-zero then use that to set the
+ * WWPN and WWNN. Otherwise fall back to use fcoe_wwn_from_mac() based
+ * on the MAC address.
+ */
+ if (qedf->dev_info.wwnn != 0 && qedf->dev_info.wwpn != 0) {
+ QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
+ "Setting WWPN and WWNN from qed dev_info.\n");
+ qedf->wwnn = qedf->dev_info.wwnn;
+ qedf->wwpn = qedf->dev_info.wwpn;
+ } else {
+ QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
+ "Setting WWPN and WWNN using fcoe_wwn_from_mac().\n");
+ qedf->wwnn = fcoe_wwn_from_mac(qedf->mac, 1, 0);
+ qedf->wwpn = fcoe_wwn_from_mac(qedf->mac, 2, 0);
+ }
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "WWNN=%016llx "
"WWPN=%016llx.\n", qedf->wwnn, qedf->wwpn);