Re: [PATCH v3] ibmveth: Add function to enable live MAC address changes

2015-03-03 Thread David Miller
From: Thomas Falcon 
Date: Mon,  2 Mar 2015 11:56:12 -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 

Applied, thanks.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v3] ibmveth: Add function to enable live MAC address changes

2015-03-03 Thread Jiri Pirko
Mon, Mar 02, 2015 at 06:56:12PM CET, tlfal...@linux.vnet.ibm.com wrote:
>Add a function that will enable changing the MAC address
>of an ibmveth interface while it is still running.
>
>Signed-off-by: Thomas Falcon 

Reviewed-by: Jiri Pirko 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH v3] ibmveth: Add function to enable live MAC address changes

2015-03-02 Thread Thomas Falcon
Add a function that will enable changing the MAC address
of an ibmveth interface while it is still running.

Signed-off-by: Thomas Falcon 
---
v3:
   removed text wrapping in error message
v2:
   If h_change_logical_lan_mac fails, dev->dev_addr will not be changed.

 drivers/net/ethernet/ibm/ibmveth.c | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c 
b/drivers/net/ethernet/ibm/ibmveth.c
index 21978cc..072426a 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1327,6 +1327,28 @@ 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;
+
+   mac_address = ibmveth_encode_mac_addr(addr->sa_data);
+   rc = h_change_logical_lan_mac(adapter->vdev->unit_address, mac_address);
+   if (rc) {
+   netdev_err(adapter->netdev, "h_change_logical_lan_mac failed 
with rc=%d\n", rc);
+   return rc;
+   }
+
+   ether_addr_copy(dev->dev_addr, addr->sa_data);
+
+   return 0;
+}
+
 static const struct net_device_ops ibmveth_netdev_ops = {
.ndo_open   = ibmveth_open,
.ndo_stop   = ibmveth_close,
@@ -1337,7 +1359,7 @@ static const struct net_device_ops ibmveth_netdev_ops = {
.ndo_fix_features   = ibmveth_fix_features,
.ndo_set_features   = ibmveth_set_features,
.ndo_validate_addr  = eth_validate_addr,
-   .ndo_set_mac_address= eth_mac_addr,
+   .ndo_set_mac_address= ibmveth_set_mac_addr,
 #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller= ibmveth_poll_controller,
 #endif
-- 
1.8.3.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev