cxgb4 : Fix missing initialization of win0_lock
[sfrench/cifs-2.6.git] / drivers / net / ethernet / chelsio / cxgb4 / cxgb4_main.c
index 5b38e955af6ec39b804b333cbbfd9bdf3817db4f..8520d5529df872fad60a377231f5154fcf91a4e3 100644 (file)
@@ -694,7 +694,11 @@ int cxgb4_dcb_enabled(const struct net_device *dev)
 #ifdef CONFIG_CHELSIO_T4_DCB
        struct port_info *pi = netdev_priv(dev);
 
-       return pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED;
+       if (!pi->dcb.enabled)
+               return 0;
+
+       return ((pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED) ||
+               (pi->dcb.state == CXGB4_DCB_STATE_HOST));
 #else
        return 0;
 #endif
@@ -2929,16 +2933,26 @@ static int set_flash(struct net_device *netdev, struct ethtool_flash *ef)
        int ret;
        const struct firmware *fw;
        struct adapter *adap = netdev2adap(netdev);
+       unsigned int mbox = FW_PCIE_FW_MASTER_MASK + 1;
 
        ef->data[sizeof(ef->data) - 1] = '\0';
        ret = request_firmware(&fw, ef->data, adap->pdev_dev);
        if (ret < 0)
                return ret;
 
-       ret = t4_load_fw(adap, fw->data, fw->size);
+       /* If the adapter has been fully initialized then we'll go ahead and
+        * try to get the firmware's cooperation in upgrading to the new
+        * firmware image otherwise we'll try to do the entire job from the
+        * host ... and we always "force" the operation in this path.
+        */
+       if (adap->flags & FULL_INIT_DONE)
+               mbox = adap->mbox;
+
+       ret = t4_fw_upgrade(adap, mbox, fw->data, fw->size, 1);
        release_firmware(fw);
        if (!ret)
-               dev_info(adap->pdev_dev, "loaded firmware %s\n", ef->data);
+               dev_info(adap->pdev_dev, "loaded firmware %s,"
+                        " reload cxgb4 driver\n", ef->data);
        return ret;
 }
 
@@ -4359,6 +4373,7 @@ EXPORT_SYMBOL(cxgb4_unregister_uld);
  * success (true) if it belongs otherwise failure (false).
  * Called with rcu_read_lock() held.
  */
+#if IS_ENABLED(CONFIG_IPV6)
 static bool cxgb4_netdev(const struct net_device *netdev)
 {
        struct adapter *adap;
@@ -4480,6 +4495,13 @@ static int update_root_dev_clip(struct net_device *dev)
                return ret;
 
        /* Parse all bond and vlan devices layered on top of the physical dev */
+       root_dev = netdev_master_upper_dev_get_rcu(dev);
+       if (root_dev) {
+               ret = update_dev_clip(root_dev, dev);
+               if (ret)
+                       return ret;
+       }
+
        for (i = 0; i < VLAN_N_VID; i++) {
                root_dev = __vlan_find_dev_deep_rcu(dev, htons(ETH_P_8021Q), i);
                if (!root_dev)
@@ -4512,6 +4534,7 @@ static void update_clip(const struct adapter *adap)
        }
        rcu_read_unlock();
 }
+#endif /* IS_ENABLED(CONFIG_IPV6) */
 
 /**
  *     cxgb_up - enable the adapter
@@ -4558,7 +4581,9 @@ static int cxgb_up(struct adapter *adap)
        t4_intr_enable(adap);
        adap->flags |= FULL_INIT_DONE;
        notify_ulds(adap, CXGB4_STATE_UP);
+#if IS_ENABLED(CONFIG_IPV6)
        update_clip(adap);
+#endif
  out:
        return err;
  irq_err:
@@ -6589,6 +6614,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        spin_lock_init(&adapter->stats_lock);
        spin_lock_init(&adapter->tid_release_lock);
+       spin_lock_init(&adapter->win0_lock);
 
        INIT_WORK(&adapter->tid_release_task, process_tid_release_list);
        INIT_WORK(&adapter->db_full_task, process_db_full);
@@ -6852,14 +6878,18 @@ static int __init cxgb4_init_module(void)
        if (ret < 0)
                debugfs_remove(cxgb4_debugfs_root);
 
+#if IS_ENABLED(CONFIG_IPV6)
        register_inet6addr_notifier(&cxgb4_inet6addr_notifier);
+#endif
 
        return ret;
 }
 
 static void __exit cxgb4_cleanup_module(void)
 {
+#if IS_ENABLED(CONFIG_IPV6)
        unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier);
+#endif
        pci_unregister_driver(&cxgb4_driver);
        debugfs_remove(cxgb4_debugfs_root);  /* NULL ok */
 }