netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next-2.6 PATCH 1/2] enic: bug fix: sprintf UUID to string as u8[] rather than u16[] array
@ 2010-05-23  3:29 Scott Feldman
  2010-05-23  3:29 ` [net-next-2.6 PATCH 2/2] enic: Use random mac addr when associating port-profile Scott Feldman
  2010-05-24  6:11 ` [net-next-2.6 PATCH 1/2] enic: bug fix: sprintf UUID to string as u8[] rather than u16[] array David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Scott Feldman @ 2010-05-23  3:29 UTC (permalink / raw)
  To: davem; +Cc: netdev, chrisw

From: Scott Feldman <scofeldm@cisco.com>



Signed-off-by: Scott Feldman <scofeldm@cisco.com>
---
 drivers/net/enic/enic_main.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index e125113..7e97323 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1034,9 +1034,10 @@ static int enic_set_port_profile(struct enic *enic, u8 request, u8 *mac,
 {
 	struct vic_provinfo *vp;
 	u8 oui[3] = VIC_PROVINFO_CISCO_OUI;
-	unsigned short *uuid;
+	u8 *uuid;
 	char uuid_str[38];
-	static char *uuid_fmt = "%04X%04X-%04X-%04X-%04X-%04X%04X%04X";
+	static char *uuid_fmt = "%02X%02X%02X%02X-%02X%02X-%02X%02X-"
+		"%02X%02X-%02X%02X%02X%02X%0X%02X";
 	int err;
 
 	if (!name)
@@ -1058,20 +1059,24 @@ static int enic_set_port_profile(struct enic *enic, u8 request, u8 *mac,
 		ETH_ALEN, mac);
 
 	if (instance_uuid) {
-		uuid = (unsigned short *)instance_uuid;
+		uuid = instance_uuid;
 		sprintf(uuid_str, uuid_fmt,
-			uuid[0], uuid[1], uuid[2], uuid[3],
-			uuid[4], uuid[5], uuid[6], uuid[7]);
+			uuid[0],  uuid[1],  uuid[2],  uuid[3],
+			uuid[4],  uuid[5],  uuid[6],  uuid[7],
+			uuid[8],  uuid[9],  uuid[10], uuid[11],
+			uuid[12], uuid[13], uuid[14], uuid[15]);
 		vic_provinfo_add_tlv(vp,
 			VIC_LINUX_PROV_TLV_CLIENT_UUID_STR,
 			sizeof(uuid_str), uuid_str);
 	}
 
 	if (host_uuid) {
-		uuid = (unsigned short *)host_uuid;
+		uuid = host_uuid;
 		sprintf(uuid_str, uuid_fmt,
-			uuid[0], uuid[1], uuid[2], uuid[3],
-			uuid[4], uuid[5], uuid[6], uuid[7]);
+			uuid[0],  uuid[1],  uuid[2],  uuid[3],
+			uuid[4],  uuid[5],  uuid[6],  uuid[7],
+			uuid[8],  uuid[9],  uuid[10], uuid[11],
+			uuid[12], uuid[13], uuid[14], uuid[15]);
 		vic_provinfo_add_tlv(vp,
 			VIC_LINUX_PROV_TLV_HOST_UUID_STR,
 			sizeof(uuid_str), uuid_str);


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [net-next-2.6 PATCH 2/2] enic: Use random mac addr when associating port-profile
  2010-05-23  3:29 [net-next-2.6 PATCH 1/2] enic: bug fix: sprintf UUID to string as u8[] rather than u16[] array Scott Feldman
@ 2010-05-23  3:29 ` Scott Feldman
  2010-05-24  6:11   ` David Miller
  2010-05-24  6:11 ` [net-next-2.6 PATCH 1/2] enic: bug fix: sprintf UUID to string as u8[] rather than u16[] array David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Scott Feldman @ 2010-05-23  3:29 UTC (permalink / raw)
  To: davem; +Cc: netdev, chrisw

From: Scott Feldman <scofeldm@cisco.com>

Use random mac addr for interface when associating port-profile to 
dynamic enic device, in the case no mac addr was previous assigned.

Signed-off-by: Scott Feldman <scofeldm@cisco.com>
---
 drivers/net/enic/enic_main.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 7e97323..6586b5c 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1132,6 +1132,14 @@ static int enic_set_vf_port(struct net_device *netdev, int vf,
 	switch (request) {
 	case PORT_REQUEST_ASSOCIATE:
 
+		/* If the interface mac addr hasn't been assigned,
+		 * assign a random mac addr before setting port-
+		 * profile.
+		 */
+
+		if (is_zero_ether_addr(netdev->dev_addr))
+			random_ether_addr(netdev->dev_addr);
+
 		if (port[IFLA_PORT_PROFILE])
 			name = nla_data(port[IFLA_PORT_PROFILE]);
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [net-next-2.6 PATCH 1/2] enic: bug fix: sprintf UUID to string as u8[] rather than u16[] array
  2010-05-23  3:29 [net-next-2.6 PATCH 1/2] enic: bug fix: sprintf UUID to string as u8[] rather than u16[] array Scott Feldman
  2010-05-23  3:29 ` [net-next-2.6 PATCH 2/2] enic: Use random mac addr when associating port-profile Scott Feldman
@ 2010-05-24  6:11 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-05-24  6:11 UTC (permalink / raw)
  To: scofeldm; +Cc: netdev, chrisw

From: Scott Feldman <scofeldm@cisco.com>
Date: Sat, 22 May 2010 20:29:52 -0700

> From: Scott Feldman <scofeldm@cisco.com>
> 
> 
> 
> Signed-off-by: Scott Feldman <scofeldm@cisco.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [net-next-2.6 PATCH 2/2] enic: Use random mac addr when associating port-profile
  2010-05-23  3:29 ` [net-next-2.6 PATCH 2/2] enic: Use random mac addr when associating port-profile Scott Feldman
@ 2010-05-24  6:11   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-05-24  6:11 UTC (permalink / raw)
  To: scofeldm; +Cc: netdev, chrisw

From: Scott Feldman <scofeldm@cisco.com>
Date: Sat, 22 May 2010 20:29:58 -0700

> From: Scott Feldman <scofeldm@cisco.com>
> 
> Use random mac addr for interface when associating port-profile to 
> dynamic enic device, in the case no mac addr was previous assigned.
> 
> Signed-off-by: Scott Feldman <scofeldm@cisco.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-24  6:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-23  3:29 [net-next-2.6 PATCH 1/2] enic: bug fix: sprintf UUID to string as u8[] rather than u16[] array Scott Feldman
2010-05-23  3:29 ` [net-next-2.6 PATCH 2/2] enic: Use random mac addr when associating port-profile Scott Feldman
2010-05-24  6:11   ` David Miller
2010-05-24  6:11 ` [net-next-2.6 PATCH 1/2] enic: bug fix: sprintf UUID to string as u8[] rather than u16[] array David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).