netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bernard Blackham <bernard@largestprime.net>
To: Steve Glendinning <steve.glendinning@smsc.com>, netdev@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Subject: [PATCH] smsc95xx: generate random MAC address once, not every ifup
Date: Tue, 19 Oct 2010 10:16:39 +1100	[thread overview]
Message-ID: <20101018231639.GA15955@mersenne.largestprime.net> (raw)

The smsc95xx driver currently generates a new random MAC address
every time the interface is brought up. This makes it impossible to
override using the standard `ifconfig hw ether` approach.

Past patches tried to make the MAC address a module parameter or
base it off the die ID, but it seems to me much simpler (and
hopefully less controversial) to stick with the current random
generation scheme, but allow the user to change the address.

This patch does exactly that - it moves the random address
generation from smsc95xx_reset() into smsc95xx_bind(), so that it is
done once on module load, not on every ifup. The user can then
override this using the standard mechanisms.

Applies against 2.6.35 and linux-2.6 head.

Signed-off-by: Bernard Blackham <b-omap@largestprime.net>

---

--- a/drivers/net/usb/smsc95xx.c	2010-10-19 00:15:35.915612223 +1100
+++ b/drivers/net/usb/smsc95xx.c	2010-10-19 00:15:55.408550929 +1100
@@ -805,8 +805,6 @@ static int smsc95xx_reset(struct usbnet
 		return ret;
 	}
 
-	smsc95xx_init_mac_address(dev);
-
 	ret = smsc95xx_set_mac_address(dev);
 	if (ret < 0)
 		return ret;
@@ -1047,6 +1045,8 @@ static int smsc95xx_bind(struct usbnet *
 	pdata->use_tx_csum = DEFAULT_TX_CSUM_ENABLE;
 	pdata->use_rx_csum = DEFAULT_RX_CSUM_ENABLE;
 
+	smsc95xx_init_mac_address(dev);
+
 	/* Init all registers */
 	ret = smsc95xx_reset(dev);
 

             reply	other threads:[~2010-10-18 23:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18 23:16 Bernard Blackham [this message]
2010-10-21 10:17 ` [PATCH] smsc95xx: generate random MAC address once, not every ifup David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101018231639.GA15955@mersenne.largestprime.net \
    --to=bernard@largestprime.net \
    --cc=linux-omap@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=steve.glendinning@smsc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).