Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[pandora-kernel.git] / drivers / net / mlx4 / en_netdev.c
index 9a87c4f..6d6806b 100644 (file)
@@ -119,7 +119,7 @@ static void mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
        mutex_unlock(&mdev->state_lock);
 }
 
-static u64 mlx4_en_mac_to_u64(u8 *addr)
+u64 mlx4_en_mac_to_u64(u8 *addr)
 {
        u64 mac = 0;
        int i;
@@ -523,6 +523,10 @@ static void mlx4_en_do_get_stats(struct work_struct *work)
 
                queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY);
        }
+       if (mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port]) {
+               queue_work(mdev->workqueue, &priv->mac_task);
+               mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port] = 0;
+       }
        mutex_unlock(&mdev->state_lock);
 }
 
@@ -538,10 +542,10 @@ static void mlx4_en_linkstate(struct work_struct *work)
         * report to system log */
        if (priv->last_link_state != linkstate) {
                if (linkstate == MLX4_DEV_EVENT_PORT_DOWN) {
-                       en_dbg(LINK, priv, "Link Down\n");
+                       en_info(priv, "Link Down\n");
                        netif_carrier_off(priv->dev);
                } else {
-                       en_dbg(LINK, priv, "Link Up\n");
+                       en_info(priv, "Link Up\n");
                        netif_carrier_on(priv->dev);
                }
        }
@@ -663,6 +667,7 @@ int mlx4_en_start_port(struct net_device *dev)
                en_err(priv, "Failed setting port mac\n");
                goto tx_err;
        }
+       mdev->mac_removed[priv->port] = 0;
 
        /* Init port */
        en_dbg(HW, priv, "Initializing port\n");
@@ -714,12 +719,12 @@ void mlx4_en_stop_port(struct net_device *dev)
        netif_tx_stop_all_queues(dev);
        netif_tx_unlock_bh(dev);
 
-       /* close port*/
+       /* Set port as not active */
        priv->port_up = false;
-       mlx4_CLOSE_PORT(mdev->dev, priv->port);
 
        /* Unregister Mac address for the port */
        mlx4_unregister_mac(mdev->dev, priv->port, priv->mac_index);
+       mdev->mac_removed[priv->port] = 1;
 
        /* Free TX Rings */
        for (i = 0; i < priv->tx_ring_num; i++) {
@@ -741,6 +746,9 @@ void mlx4_en_stop_port(struct net_device *dev)
                        msleep(1);
                mlx4_en_deactivate_cq(priv, &priv->rx_cq[i]);
        }
+
+       /* close port*/
+       mlx4_CLOSE_PORT(mdev->dev, priv->port);
 }
 
 static void mlx4_en_restart(struct work_struct *work)
@@ -1027,15 +1035,17 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
         */
        dev->netdev_ops = &mlx4_netdev_ops;
        dev->watchdog_timeo = MLX4_EN_WATCHDOG_TIMEOUT;
-       dev->real_num_tx_queues = MLX4_EN_NUM_TX_RINGS;
+       netif_set_real_num_tx_queues(dev, priv->tx_ring_num);
+       netif_set_real_num_rx_queues(dev, priv->rx_ring_num);
 
        SET_ETHTOOL_OPS(dev, &mlx4_en_ethtool_ops);
 
        /* Set defualt MAC */
        dev->addr_len = ETH_ALEN;
-       for (i = 0; i < ETH_ALEN; i++)
-               dev->dev_addr[ETH_ALEN - 1 - i] =
-               (u8) (priv->mac >> (8 * i));
+       for (i = 0; i < ETH_ALEN; i++) {
+               dev->dev_addr[ETH_ALEN - 1 - i] = (u8) (priv->mac >> (8 * i));
+               dev->perm_addr[ETH_ALEN - 1 - i] = (u8) (priv->mac >> (8 * i));
+       }
 
        /*
         * Set driver features
@@ -1048,8 +1058,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
        dev->features |= NETIF_F_HW_VLAN_TX |
                         NETIF_F_HW_VLAN_RX |
                         NETIF_F_HW_VLAN_FILTER;
-       if (mdev->profile.num_lro)
-               dev->features |= NETIF_F_LRO;
+       dev->features |= NETIF_F_GRO;
        if (mdev->LSO_support) {
                dev->features |= NETIF_F_TSO;
                dev->features |= NETIF_F_TSO6;