]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
qede: Initialize lock and slowpath workqueue early
authorMintz, Yuval <Yuval.Mintz@cavium.com>
Mon, 20 Feb 2017 20:43:34 +0000 (22:43 +0200)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 6 Mar 2017 05:00:29 +0000 (21:00 -0800)
Orabug: 25477939

Need to make sure the slowpath workqueue and the qede lock
are ready for the registration of the netdevice, as once
registered there's no guarantee those wouldn't be used.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0e0b80a9a7181cbdbb965a6b4750574932106e31)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/qlogic/qede/qede_main.c

index 9230034fd6ef01bcb37a798f144a5792eca584b4..1134ee10372cfde59bab5889d983952f1651aae9 100644 (file)
@@ -2653,6 +2653,13 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
        if (rc)
                goto err3;
 
+       /* Prepare the lock prior to the registeration of the netdev,
+        * as once it's registered we might reach flows requiring it
+        * [it's even possible to reach a flow needing it directly
+        * from there, although it's unlikely].
+        */
+       INIT_DELAYED_WORK(&edev->sp_task, qede_sp_task);
+       mutex_init(&edev->qede_lock);
        rc = register_netdev(edev->ndev);
        if (rc) {
                DP_NOTICE(edev, "Cannot register net-device\n");
@@ -2668,8 +2675,6 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
                qede_set_dcbnl_ops(edev->ndev);
 #endif
 
-       INIT_DELAYED_WORK(&edev->sp_task, qede_sp_task);
-       mutex_init(&edev->qede_lock);
        edev->rx_copybreak = QEDE_RX_HDR_SIZE;
 
        DP_INFO(edev, "Ending successfully qede probe\n");