netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Miscellaneous fixes
@ 2020-03-25 11:41 sunil.kovvuri
  2020-03-25 11:41 ` [PATCH net-next 1/2] octeontx2-pf: Fix rx buffer page refcount sunil.kovvuri
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sunil.kovvuri @ 2020-03-25 11:41 UTC (permalink / raw)
  To: netdev; +Cc: davem, Sunil Goutham

From: Sunil Goutham <sgoutham@marvell.com>

This patchset fixes couple of issues related to missing
page refcount updation and taking a mutex lock in atomic
context.

Sunil Goutham (2):
  octeontx2-pf: Fix rx buffer page refcount
  octeontx2-pf: Fix ndo_set_rx_mode

 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |  2 ++
 .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c   | 29 ++++++++++++++++++++--
 .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c |  1 +
 3 files changed, 30 insertions(+), 2 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] octeontx2-pf: Fix rx buffer page refcount
  2020-03-25 11:41 [PATCH net-next 0/2] Miscellaneous fixes sunil.kovvuri
@ 2020-03-25 11:41 ` sunil.kovvuri
  2020-03-25 11:41 ` [PATCH net-next 2/2] octeontx2-pf: Fix ndo_set_rx_mode sunil.kovvuri
  2020-03-25 19:20 ` [PATCH net-next 0/2] Miscellaneous fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: sunil.kovvuri @ 2020-03-25 11:41 UTC (permalink / raw)
  To: netdev; +Cc: davem, Sunil Goutham

From: Sunil Goutham <sgoutham@marvell.com>

Fixed an issue wherein while refilling receive buffers
for the last page allocated, recount is not being updated.

Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
index 94044a5..45abe0c 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
@@ -304,6 +304,7 @@ static int otx2_rx_napi_handler(struct otx2_nic *pfvf,
 		otx2_aura_freeptr(pfvf, cq->cq_idx, bufptr + OTX2_HEAD_ROOM);
 		cq->pool_ptrs--;
 	}
+	otx2_get_page(cq->rbpool);
 
 	return processed_cqe;
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] octeontx2-pf: Fix ndo_set_rx_mode
  2020-03-25 11:41 [PATCH net-next 0/2] Miscellaneous fixes sunil.kovvuri
  2020-03-25 11:41 ` [PATCH net-next 1/2] octeontx2-pf: Fix rx buffer page refcount sunil.kovvuri
@ 2020-03-25 11:41 ` sunil.kovvuri
  2020-03-25 19:20 ` [PATCH net-next 0/2] Miscellaneous fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: sunil.kovvuri @ 2020-03-25 11:41 UTC (permalink / raw)
  To: netdev; +Cc: davem, Sunil Goutham

From: Sunil Goutham <sgoutham@marvell.com>

Since set_rx_mode takes a mutex lock for sending mailbox
message to admin function to set the mode, moved logic
to a workqueue.

Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |  2 ++
 .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c   | 29 ++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index eaff5f6..018c283 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -243,6 +243,8 @@ struct otx2_nic {
 	struct workqueue_struct	*flr_wq;
 	struct flr_work		*flr_wrk;
 	struct refill_work	*refill_wrk;
+	struct workqueue_struct	*otx2_wq;
+	struct work_struct	rx_mode_work;
 
 	/* Ethtool stuff */
 	u32			msg_enable;
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index 4618c90..411e5ea 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -1679,6 +1679,14 @@ static netdev_tx_t otx2_xmit(struct sk_buff *skb, struct net_device *netdev)
 static void otx2_set_rx_mode(struct net_device *netdev)
 {
 	struct otx2_nic *pf = netdev_priv(netdev);
+
+	queue_work(pf->otx2_wq, &pf->rx_mode_work);
+}
+
+static void otx2_do_set_rx_mode(struct work_struct *work)
+{
+	struct otx2_nic *pf = container_of(work, struct otx2_nic, rx_mode_work);
+	struct net_device *netdev = pf->netdev;
 	struct nix_rx_mode *req;
 
 	if (!(netdev->flags & IFF_UP))
@@ -1740,6 +1748,17 @@ static const struct net_device_ops otx2_netdev_ops = {
 	.ndo_get_stats64	= otx2_get_stats64,
 };
 
+static int otx2_wq_init(struct otx2_nic *pf)
+{
+	pf->otx2_wq = create_singlethread_workqueue("otx2_wq");
+	if (!pf->otx2_wq)
+		return -ENOMEM;
+
+	INIT_WORK(&pf->rx_mode_work, otx2_do_set_rx_mode);
+	INIT_WORK(&pf->reset_task, otx2_reset_task);
+	return 0;
+}
+
 static int otx2_check_pf_usable(struct otx2_nic *nic)
 {
 	u64 rev;
@@ -1924,14 +1943,16 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	netdev->min_mtu = OTX2_MIN_MTU;
 	netdev->max_mtu = OTX2_MAX_MTU;
 
-	INIT_WORK(&pf->reset_task, otx2_reset_task);
-
 	err = register_netdev(netdev);
 	if (err) {
 		dev_err(dev, "Failed to register netdevice\n");
 		goto err_detach_rsrc;
 	}
 
+	err = otx2_wq_init(pf);
+	if (err)
+		goto err_unreg_netdev;
+
 	otx2_set_ethtool_ops(netdev);
 
 	/* Enable link notifications */
@@ -1943,6 +1964,8 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	return 0;
 
+err_unreg_netdev:
+	unregister_netdev(netdev);
 err_detach_rsrc:
 	otx2_detach_resources(&pf->mbox);
 err_disable_mbox_intr:
@@ -2089,6 +2112,8 @@ static void otx2_remove(struct pci_dev *pdev)
 
 	unregister_netdev(netdev);
 	otx2_sriov_disable(pf->pdev);
+	if (pf->otx2_wq)
+		destroy_workqueue(pf->otx2_wq);
 
 	otx2_detach_resources(&pf->mbox);
 	otx2_disable_mbox_intr(pf);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] Miscellaneous fixes
  2020-03-25 11:41 [PATCH net-next 0/2] Miscellaneous fixes sunil.kovvuri
  2020-03-25 11:41 ` [PATCH net-next 1/2] octeontx2-pf: Fix rx buffer page refcount sunil.kovvuri
  2020-03-25 11:41 ` [PATCH net-next 2/2] octeontx2-pf: Fix ndo_set_rx_mode sunil.kovvuri
@ 2020-03-25 19:20 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-03-25 19:20 UTC (permalink / raw)
  To: sunil.kovvuri; +Cc: netdev, sgoutham

From: sunil.kovvuri@gmail.com
Date: Wed, 25 Mar 2020 17:11:15 +0530

> From: Sunil Goutham <sgoutham@marvell.com>
> 
> This patchset fixes couple of issues related to missing
> page refcount updation and taking a mutex lock in atomic
> context.

Series applied, thanks Sunil.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-25 19:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 11:41 [PATCH net-next 0/2] Miscellaneous fixes sunil.kovvuri
2020-03-25 11:41 ` [PATCH net-next 1/2] octeontx2-pf: Fix rx buffer page refcount sunil.kovvuri
2020-03-25 11:41 ` [PATCH net-next 2/2] octeontx2-pf: Fix ndo_set_rx_mode sunil.kovvuri
2020-03-25 19:20 ` [PATCH net-next 0/2] Miscellaneous fixes David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).