[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20150227.172206.206607639934597507.davem@davemloft.net>
Date: Fri, 27 Feb 2015 17:22:06 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: tlfalcon@...ux.vnet.ibm.com
Cc: netdev@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH] ibmveth: Add function to enable live MAC address
changes
From: Thomas Falcon <tlfalcon@...ux.vnet.ibm.com>
Date: Wed, 25 Feb 2015 18:34:24 -0600
> Add a function that will enable changing the MAC address
> of an ibmveth interface while it is still running.
>
> Signed-off-by: Thomas Falcon <tlfalcon@...ux.vnet.ibm.com>
> ---
> drivers/net/ethernet/ibm/ibmveth.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index 21978cc..6e44357 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -1327,6 +1327,24 @@ static unsigned long ibmveth_get_desired_dma(struct vio_dev *vdev)
> return ret;
> }
>
> +static int ibmveth_set_mac_addr(struct net_device *dev, void *p)
> +{
> + struct ibmveth_adapter *adapter = netdev_priv(dev);
> + struct sockaddr *addr = p;
> + u64 mac_address;
> + int rc;
> +
> + if (!is_valid_ether_addr(addr->sa_data))
> + return -EADDRNOTAVAIL;
> +
> + ether_addr_copy(dev->dev_addr, addr->sa_data);
> +
> + mac_address = ibmveth_encode_mac_addr(dev->dev_addr);
> + rc = h_change_logical_lan_mac(adapter->vdev->unit_address, mac_address);
As others have said, if this hypervisor call fails you must not change
dev->dev_addr. It must always be in sync with "the hardware."
--
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