Skip to contentSkip to conversation

Fix bugs in Octeontx2 netdev driver

PATCH In review [email protected] 2 participants 5 messages Jul 25, 2020 – Jul 29, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Fix bugs in Octeontx2 netdev driver

From: Subbaraya Sundeep <[email protected]>

Hi,

There are problems in the existing Octeontx2 netdev drivers like missing cancel_work for the reset task, missing lock in reset task and missing unergister_netdev in driver remove. This patch set fixes the above problems.

Thanks,
Sundeep

Subbaraya Sundeep (3):
octeontx2-pf: Fix reset_task bugs
octeontx2-pf: cancel reset_task work
octeontx2-pf: Unregister netdev at driver remove

 drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 3 +++
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 2 ++
 2 files changed, 5 insertions(+)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/3 octeontx2-pf: Fix reset_task bugs

From: Subbaraya Sundeep <[email protected]>

Two bugs exist in the code related to reset_task
in PF driver one is the missing protection
against network stack ndo_open and ndo_close.
Other one is the missing cancel_work.
This patch fixes those problems.

Fixes 4ff7d1488a84 ("octeontx2-pf: Error handling support")

---

v2 changes:
None

 drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +3 -0
index 6478656..75a8c40 100644
@@ -1730,10 +1730,12 @@ static void otx2_reset_task(struct work_struct *work)
 	if (!netif_running(pf->netdev))
 		return;
 
+	rtnl_lock();
 	otx2_stop(pf->netdev);
 	pf->reset_count++;
 	otx2_open(pf->netdev);
 	netif_trans_update(pf->netdev);
+	rtnl_unlock();
 }
 
 static const struct net_device_ops otx2_netdev_ops = {
@@ -2111,6 +2113,7 @@ static void otx2_remove(struct pci_dev *pdev)
 
 	pf = netdev_priv(netdev);
 
+	cancel_work_sync(&pf->reset_task);
 	/* Disable link notifications */
 	otx2_cgx_config_linkevents(pf, false);
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/3 octeontx2-pf: cancel reset_task work

In reply to [email protected]

From: Subbaraya Sundeep <[email protected]>

During driver exit cancel the queued
reset_task work in VF driver.

Fixes 3184fb5ba96e ("octeontx2-vf: Virtual function driver support")

---

v2 changes:
None

 drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +1 -0
index f422751..c1c263d 100644
@@ -617,6 +617,7 @@ static void otx2vf_remove(struct pci_dev *pdev)
 
 	vf = netdev_priv(netdev);
 
+	cancel_work_sync(&vf->reset_task);
 	otx2vf_disable_mbox_intr(vf);
 
 	otx2_detach_resources(&vf->mbox);
Signature · 1 line
2.7.4
#3 lore raw

PATCH v2 3/3 octeontx2-pf: Unregister netdev at driver remove

In reply to [email protected]

From: Subbaraya Sundeep <[email protected]>

Added unregister_netdev in the driver remove function. Generally unregister_netdev is called after disabling all the device interrupts but here it is called before disabling device mailbox interrupts. The reason behind this is VF needs mailbox interrupt to communicate with its PF to clean up its resources during otx2_stop. otx2_stop disables packet I/O and queue interrupts first and by using mailbox interrupt communicates to PF to free VF resources. Hence this patch calls unregister_device just before disabling mailbox interrupts.

Fixes 3184fb5ba96e ("octeontx2-vf: Virtual function driver support")

---

v2 changes:
Modified commit description

 drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +1 -0
index c1c263d..92a3db6 100644
@@ -618,6 +618,7 @@ static void otx2vf_remove(struct pci_dev *pdev)
 	vf = netdev_priv(netdev);
 
 	cancel_work_sync(&vf->reset_task);
+	unregister_netdev(netdev);
 	otx2vf_disable_mbox_intr(vf);
 
 	otx2_detach_resources(&vf->mbox);
Signature · 1 line
2.7.4
maintainer
#4 lore raw
In reply to [email protected]

From: [email protected]
Date: Sat, 25 Jul 2020 10:13:51 +0530

Quoted 9 lines

From: Subbaraya Sundeep <[email protected]>

Hi,

There are problems in the existing Octeontx2 netdev drivers like missing cancel_work for the reset task, missing lock in reset task and missing unergister_netdev in driver remove. This patch set fixes the above problems.

Series applied, thanks.