[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201202082305.17415.vapier@gentoo.org>
Date: Wed, 8 Feb 2012 23:05:13 -0500
From: Mike Frysinger <vapier@...too.org>
To: Danny Kukawka <danny.kukawka@...ect.de>
Cc: "David S. Miller" <davem@...emloft.net>,
Danny Kukawka <dkukawka@...e.de>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Bob Liu <lliubbo@...il.com>,
Sonic Zhang <sonic.zhang@...log.com>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
"Lars-Peter Clausen" <lars@...afoo.de>,
Scott Jiang <scott.jiang@...log.com>,
uclinux-dist-devel@...ckfin.uclinux.org
Subject: Re: [PATCH 04/50] adi/blackfin: set addr_assign_type correctly if random
On Wednesday 08 February 2012 16:10:11 Danny Kukawka wrote:
> --- a/arch/blackfin/mach-bf537/boards/cm_bf537e.c
> +++ b/arch/blackfin/mach-bf537/boards/cm_bf537e.c
>
> -void bfin_get_ether_addr(char *addr)
> +int bfin_get_ether_addr(char *addr)
> {
> random_ether_addr(addr);
> printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n",
> __FILE__, __func__);
> + return 1;
> }
these boards that just call random_ether_addr() should be changed to only
return 1 ...
> --- a/drivers/net/ethernet/adi/bfin_mac.c
> +++ b/drivers/net/ethernet/adi/bfin_mac.c
> @@ -621,6 +621,8 @@
>
> memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
> + if (dev->addr_assign_type & NET_ADDR_RANDOM)
> + dev->addr_assign_type ^= NET_ADDR_RANDOM;
> setup_mac_addr(dev->dev_addr);
> return 0;
> }
> @@ -1496,12 +1498,14 @@
>
> - if (!is_valid_ether_addr(ndev->dev_addr))
> - bfin_get_ether_addr(ndev->dev_addr);
> + if (!is_valid_ether_addr(ndev->dev_addr)) {
> + if (bfin_get_ether_addr(ndev->dev_addr))
> + ndev->addr_assign_type |= NET_ADDR_RANDOM;
> + }
if it returned non-zero, then the mac addr is still invalid, so down below ...
> /* If still not valid, get a random one */
> if (!is_valid_ether_addr(ndev->dev_addr))
> - random_ether_addr(ndev->dev_addr);
> + dev_hw_addr_random(ndev, ndev->dev_addr);
... we call dev_hw_addr_random(), so explicitly setting NET_ADDR_RANDOM
ourselves is unnecessary
i think the logic should read:
if (!is_valid_ether_addr(ndev->dev_addr)) {
if (bfin_get_ether_addr(ndev->dev_addr))
goto random_mac;
if (!is_valid_ether_addr(ndev->dev_addr))
random_mac:
dev_hw_addr_random(ndev, ndev->dev_addr);
-mike
Download attachment "signature.asc " of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists