Patchwork [net-next,7/8] qlge: Add support for using alternate MAC address.

login
register
mail settings
Submitter Ron Mercer
Date June 9, 2009, 3:39 p.m.
Message ID <1244561974-25662-7-git-send-email-ron.mercer@qlogic.com>
Download mbox | patch
Permalink /patch/28336/
State Accepted
Delegated to: David Miller
Headers show

Comments

Ron Mercer - June 9, 2009, 3:39 p.m.
Extract either manufacturer or Bladecenter Open Fabric
Manager (BOFM) MAC address.  BOFM may indicate an
alternate MAC address.  This patch honors that request
by extracting the MAC address from a different
flash location if a flag is set.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
---
 drivers/net/qlge/qlge_main.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
David Miller - June 10, 2009, 8:05 a.m.
From: Ron Mercer <ron.mercer@qlogic.com>
Date: Tue,  9 Jun 2009 08:39:33 -0700

> Extract either manufacturer or Bladecenter Open Fabric
> Manager (BOFM) MAC address.  BOFM may indicate an
> alternate MAC address.  This patch honors that request
> by extracting the MAC address from a different
> flash location if a flag is set.
> 
> Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index d5f3628..5055f5b 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -675,6 +675,7 @@  static int ql_get_8000_flash_params(struct ql_adapter *qdev)
 	int status;
 	__le32 *p = (__le32 *)&qdev->flash;
 	u32 offset;
+	u8 mac_addr[6];
 
 	/* Get flash offset for function and adjust
 	 * for dword access.
@@ -705,14 +706,26 @@  static int ql_get_8000_flash_params(struct ql_adapter *qdev)
 		goto exit;
 	}
 
-	if (!is_valid_ether_addr(qdev->flash.flash_params_8000.mac_addr)) {
+	/* Extract either manufacturer or BOFM modified
+	 * MAC address.
+	 */
+	if (qdev->flash.flash_params_8000.data_type1 == 2)
+		memcpy(mac_addr,
+			qdev->flash.flash_params_8000.mac_addr1,
+			qdev->ndev->addr_len);
+	else
+		memcpy(mac_addr,
+			qdev->flash.flash_params_8000.mac_addr,
+			qdev->ndev->addr_len);
+
+	if (!is_valid_ether_addr(mac_addr)) {
 		QPRINTK(qdev, IFUP, ERR, "Invalid MAC address.\n");
 		status = -EINVAL;
 		goto exit;
 	}
 
 	memcpy(qdev->ndev->dev_addr,
-		qdev->flash.flash_params_8000.mac_addr,
+		mac_addr,
 		qdev->ndev->addr_len);
 
 exit: