DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/9] common/cnxk: get mbox lock before NDC sync
@ 2023-01-16  9:39 Nithin Dabilpuram
  2023-01-16  9:39 ` [PATCH 2/9] common/cnxk: enable CQ late BP with valid CPT BPID Nithin Dabilpuram
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Nithin Dabilpuram @ 2023-01-16  9:39 UTC (permalink / raw)
  To: jerinj, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
  Cc: dev, rkudurumalla

Take mbox lock before NDC sync to be thread safe.
Also release the lock only after access to response
is complete.

Fixes: 7a978bc4be6b ("common/cnxk: support mailbox locking")
Cc: rkudurumalla@marvell.com

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 drivers/common/cnxk/roc_nix_tm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/common/cnxk/roc_nix_tm.c b/drivers/common/cnxk/roc_nix_tm.c
index 4e5f320712..4ced7a052f 100644
--- a/drivers/common/cnxk/roc_nix_tm.c
+++ b/drivers/common/cnxk/roc_nix_tm.c
@@ -690,13 +690,16 @@ roc_nix_tm_sq_free_pending_sqe(struct nix *nix, int q)
 
 	mbox = dev->mbox;
 	/* Sync NDC-NIX-TX for LF */
-	ndc_req = mbox_alloc_msg_ndc_sync_op(mbox);
-	if (ndc_req == NULL)
+	ndc_req = mbox_alloc_msg_ndc_sync_op(mbox_get(mbox));
+	if (ndc_req == NULL) {
+		mbox_put(mbox);
 		return -EFAULT;
+	}
 
 	ndc_req->nix_lf_tx_sync = 1;
 	if (mbox_process(mbox))
 		rc |= NIX_ERR_NDC_SYNC;
+	mbox_put(mbox);
 
 	if (rc)
 		plt_err("NDC_SYNC failed rc %d", rc);
@@ -1480,8 +1483,9 @@ nix_tm_alloc_txschq(struct nix *nix, enum roc_nix_tm_tree tree)
 			mbox_put(mbox);
 			goto alloc_err;
 		}
-		mbox_put(mbox);
+
 		nix_tm_copy_rsp_to_nix(nix, rsp);
+		mbox_put(mbox);
 	} while (pend);
 
 	nix->tm_link_cfg_lvl = rsp->link_cfg_lvl;
-- 
2.25.1


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

end of thread, other threads:[~2023-01-17 11:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16  9:39 [PATCH 1/9] common/cnxk: get mbox lock before NDC sync Nithin Dabilpuram
2023-01-16  9:39 ` [PATCH 2/9] common/cnxk: enable CQ late BP with valid CPT BPID Nithin Dabilpuram
2023-01-16  9:39 ` [PATCH 3/9] common/cnxk: configure fc hist bits Nithin Dabilpuram
2023-01-16  9:39 ` [PATCH 4/9] net/cnxk: reset pfc mode and flow control Nithin Dabilpuram
2023-01-16  9:39 ` [PATCH 5/9] common/cnxk: dump inline device RQ context Nithin Dabilpuram
2023-01-16  9:39 ` [PATCH 6/9] common/cnxk: free tm resources in order from leaf to root Nithin Dabilpuram
2023-01-16  9:39 ` [PATCH 7/9] common/cnxk: update CPT inbound inline IPsec mailbox Nithin Dabilpuram
2023-01-16  9:39 ` [PATCH 8/9] net/cnxk: make flow control op for SDP as no-op Nithin Dabilpuram
2023-01-16  9:39 ` [PATCH 9/9] common/cnxk: skip L4 checks on inline IPsec traffic Nithin Dabilpuram
2023-01-17 11:47   ` Jerin Jacob

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).