From: Hannes Reinecke <hare@mas.arch.suse.de>
Date: Thu, 7 Oct 2010 15:45:55 +0200
Subject: Introduce 'use_vlan_id' to omit using of VLAN ID for WWPN
References: bnc#620929
Patch-Mainline: never

This is an update to commit cc0136c2e9c10e889cb36e39710c0eb10707b396.

That commit introduced vlan id info to WWPN but WWPN needs to
remain static as an unique port identifier in the fabric, therefore
variable fabric vlan id info doesn't need to be coded inside WWPN.

After this revert, port arg to fcoe_wwn_from_mac is always zero
but still leaving it as-is okay to later allow users to use NAA 2
scheme with this additional port arg.

This patch adds a new module parameter 'use_vlan_id' which enables
the user to enable the old behaviour.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index fe0485f..b3c313b 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -55,6 +55,10 @@ module_param_named(ddp_min, fcoe_ddp_min, uint, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(ddp_min, "Minimum I/O size in bytes for "	\
 		 "Direct Data Placement (DDP).");
 
+static unsigned int fcoe_use_vlan_id = 0;
+module_param_named(use_vlan_id, fcoe_use_vlan_id, uint, S_IRUGO);
+MODULE_PARM_DESC(use_vlan_id, "Include VLAN ID in generated WWNN/WWPN.");
+
 DEFINE_MUTEX(fcoe_config_mutex);
 
 /* fcoe_percpu_clean completion.  Waiter protected by fcoe_create_mutex */
@@ -632,9 +636,10 @@ static int fcoe_netdev_config(struct fc_lport *lport, struct net_device *netdev)
 		/*
 		 * Use NAA 1&2 (FC-FS Rev. 2.0, Sec. 15) to generate WWNN/WWPN:
 		 * For WWNN, we use NAA 1 w/ bit 27-16 of word 0 as 0.
-		 * For WWPN, we use NAA 2 w/ bit 27-16 of word 0 from VLAN ID
+		 * For WWPN, we use NAA 2 w/ bit 27-16 of word 0 from VLAN ID.
+		 * If use_vlan_id is 0 the VLAN ID is not used.
 		 */
-		if (netdev->priv_flags & IFF_802_1Q_VLAN)
+		if (fcoe_use_vlan_id && netdev->priv_flags & IFF_802_1Q_VLAN)
 			vid = vlan_dev_vlan_id(netdev);
 
 		if (fcoe_get_wwn(netdev, &wwnn, NETDEV_FCOE_WWNN))
