All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] ethernet: ROM MAC address vs env variable MAC address
Date: Wed, 8 Nov 2017 12:02:55 +0000	[thread overview]
Message-ID: <HE1PR04MB12410876E4BA09FC9CD7800C97560@HE1PR04MB1241.eurprd04.prod.outlook.com> (raw)

Hi All, 

I am seeing following type of code for MAC address write for a network device.

net/eth-uclass.c  eth_post_probe()   or net/eth_legacy.c eth_write_hwaddr()

	eth_env_get_enetaddr_by_index("eth", dev->seq, env_enetaddr);
	if (!is_zero_ethaddr(env_enetaddr)) {
		if (!is_zero_ethaddr(pdata->enetaddr) &&
		    memcmp(pdata->enetaddr, env_enetaddr, ARP_HLEN)) {
			printf("\nWarning: %s MAC addresses don't match:\n",
			       dev->name);
			printf("Address in ROM is          %pM\n",
			       pdata->enetaddr);
			printf("Address in environment is  %pM\n",
			       env_enetaddr);
		}

		/* Override the ROM MAC address */
		memcpy(pdata->enetaddr, env_enetaddr, ARP_HLEN);

Why ROM MAC address getting overwritten by environment env MAC address.  
MAC address is something unique and assigned to a particular device. So one should never change its MAC address.

Please suggest. 

Regards,
Prabhakar

             reply	other threads:[~2017-11-08 12:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08 12:02 Prabhakar Kushwaha [this message]
2017-11-09 10:14 ` [U-Boot] ethernet: ROM MAC address vs env variable MAC address Lukasz Majewski
2017-11-13 19:49 ` Wolfgang Denk
2017-11-14  9:31   ` Mike Looijmans

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=HE1PR04MB12410876E4BA09FC9CD7800C97560@HE1PR04MB1241.eurprd04.prod.outlook.com \
    --to=prabhakar.kushwaha@nxp.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.