[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1367598632.2756.3.camel@bwh-desktop.uk.solarflarecom.com>
Date: Fri, 3 May 2013 17:30:32 +0100
From: Ben Hutchings <bhutchings@...arflare.com>
To: Benjamin Herrenschmidt <benh@...nel.crashing.org>
CC: <netdev@...r.kernel.org>, David Miller <davem@...emloft.net>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
David Gibson <dwg@....ibm.com>
Subject: Re: net/eth/ibmveth: Fixup retrieval of MAC address
On Thu, 2013-05-02 at 11:35 +1000, Benjamin Herrenschmidt wrote:
> Some ancient pHyp versions used to create a 8 bytes local-mac-address
> property in the device-tree instead of a 6 bytes one for veth.
>
> The Linux driver code to deal with that is an insane hack which also
> happens to break with some choices of MAC addresses in qemu by testing
> for a bit in the address rather than just looking at the size of the
> property.
>
> Sanitize this by doing the latter instead.
[...]
> @@ -1334,11 +1334,19 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
> dev->unit_address);
>
> mac_addr_p = (unsigned char *)vio_get_attribute(dev, VETH_MAC_ADDR,
> - NULL);
> + &mac_len);
> if (!mac_addr_p) {
> dev_err(&dev->dev, "Can't find VETH_MAC_ADDR attribute\n");
> return -EINVAL;
> }
> + /* Workaround for old/broken pHyp */
> + if (mac_len == 8)
> + mac_addr_p += 2;
> + if (mac_len != 6) {
Missing 'else' before the second if?
> + dev_err(&dev->dev, "VETH_MAC_ADDR attribute wrong len %d\n",
> + mac_len);
> + return -EINVAL;
> + }
[...]
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists