ehea: set mac address fix
authorJan-Bernd Themann <ossthema@de.ibm.com>
Mon, 9 Jun 2008 14:17:37 +0000 (15:17 +0100)
committerJeff Garzik <jgarzik@redhat.com>
Tue, 10 Jun 2008 22:20:23 +0000 (18:20 -0400)
eHEA has to call firmware functions in order to change the mac address
of a logical port. This patch checks if the logical port is up
when calling the register / deregister mac address calls. If the port
is down these firmware calls would fail and are therefore not executed.

Signed-off-by: Jan-Bernd Themann <themann@de.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/ehea/ehea_main.c

index 287a619187392ddc8944cb5ec3283cd0783827d2..faae01dc1c4b9d719031a422d1a5d66a0c4a6584 100644 (file)
@@ -1766,16 +1766,20 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa)
        mutex_lock(&ehea_bcmc_regs.lock);
 
        /* Deregister old MAC in pHYP */
-       ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
-       if (ret)
-               goto out_upregs;
+       if (port->state == EHEA_PORT_UP) {
+               ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
+               if (ret)
+                       goto out_upregs;
+       }
 
        port->mac_addr = cb0->port_mac_addr << 16;
 
        /* Register new MAC in pHYP */
-       ret = ehea_broadcast_reg_helper(port, H_REG_BCMC);
-       if (ret)
-               goto out_upregs;
+       if (port->state == EHEA_PORT_UP) {
+               ret = ehea_broadcast_reg_helper(port, H_REG_BCMC);
+               if (ret)
+                       goto out_upregs;
+       }
 
        ret = 0;