From: Florian Fainelli <f.fainelli@gmail.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>,
netdev@vger.kernel.org
Cc: linux.nics@intel.com
Subject: Re: [PATCH] ixgbe: Look up MAC address in Open Firmware
Date: Fri, 14 Nov 2014 14:23:25 -0800 [thread overview]
Message-ID: <546680DD.7030708@gmail.com> (raw)
In-Reply-To: <yq1r3x5vbh9.fsf@sermon.lab.mkp.net>
On 11/14/2014 11:16 AM, Martin K. Petersen wrote:
[snip]
> +#ifdef CONFIG_OF
> +/**
> + * ixgbe_of_mac_addr - Look up MAC address in Open Firmware
> + * @adapter: Pointer to adapter struct
> + */
> +static void ixgbe_of_mac_addr(struct ixgbe_adapter *adapter)
> +{
> + struct device_node *dp = pci_device_to_OF_node(adapter->pdev);
> + struct ixgbe_hw *hw = &adapter->hw;
> + const unsigned char *addr;
> + int len;
> +
> + addr = of_get_property(dp, "local-mac-address", &len);
> + if (addr && len == 6) {
> + e_dev_info("Using OpenPROM MAC address\n");
> + memcpy(hw->mac.perm_addr, addr, 6);
> + }
Cannot you use of_get_mac_address() here which does iterate through all
the OF standard ways to specify a MAC address: mac-address,
local-mac-address and address? Benefit is that this will work for all
DT-enabled platforms.
> +
> + if (!is_valid_ether_addr(hw->mac.perm_addr)) {
> + e_dev_info("Using IDPROM MAC address\n");
> + memcpy(hw->mac.perm_addr, idprom->id_ethaddr, 6);
> + }
> +}
> +#endif
> +
> /**
> * ixgbe_probe - Device Initialization Routine
> * @pdev: PCI device information struct
> @@ -8223,6 +8253,10 @@ skip_sriov:
> goto err_sw_init;
> }
>
> +#ifdef CONFIG_OF
> + ixgbe_of_mac_addr(adapter);
> +#endif
> +
> memcpy(netdev->dev_addr, hw->mac.perm_addr, netdev->addr_len);
>
> if (!is_valid_ether_addr(netdev->dev_addr)) {
> --
> 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
>
prev parent reply other threads:[~2014-11-14 22:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-14 19:16 [PATCH] ixgbe: Look up MAC address in Open Firmware Martin K. Petersen
2014-11-14 19:26 ` [linux-nics] " Jeff Kirsher
2014-11-14 20:07 ` Sergei Shtylyov
2014-11-14 20:20 ` Martin K. Petersen
2014-11-14 21:11 ` Jesse Brandeburg
2014-11-14 21:40 ` [linux-nics] " Jeff Kirsher
2014-11-17 23:29 ` Rustad, Mark D
2014-11-14 21:25 ` David Miller
2014-11-14 22:23 ` Florian Fainelli [this message]
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=546680DD.7030708@gmail.com \
--to=f.fainelli@gmail.com \
--cc=linux.nics@intel.com \
--cc=martin.petersen@oracle.com \
--cc=netdev@vger.kernel.org \
/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).