API mbox_alloc_msg_npa_aq_enq() mbox is called if SQ needs
to be updated from mbox response else mbox call to kernel
is bypassed reducing the time taken to complete
roc_nix_tm_sq_aura_fc() function.This reduces ethdev
teardown time by 20%.

Signed-off-by: Rakesh Kudurumalla <rkuduruma...@marvell.com>
---
 drivers/common/cnxk/roc_nix_tm_ops.c | 29 ++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/common/cnxk/roc_nix_tm_ops.c 
b/drivers/common/cnxk/roc_nix_tm_ops.c
index e1cef7a670..2c53472047 100644
--- a/drivers/common/cnxk/roc_nix_tm_ops.c
+++ b/drivers/common/cnxk/roc_nix_tm_ops.c
@@ -51,25 +51,26 @@ roc_nix_tm_sq_aura_fc(struct roc_nix_sq *sq, bool enable)
                goto exit;
 
        /* Read back npa aura ctx */
-       req = mbox_alloc_msg_npa_aq_enq(mbox);
-       if (req == NULL) {
-               rc = -ENOSPC;
-               goto exit;
-       }
+       if (enable) {
+               req = mbox_alloc_msg_npa_aq_enq(mbox);
+               if (req == NULL) {
+                       rc = -ENOSPC;
+                       goto exit;
+               }
 
-       req->aura_id = roc_npa_aura_handle_to_aura(aura_handle);
-       req->ctype = NPA_AQ_CTYPE_AURA;
-       req->op = NPA_AQ_INSTOP_READ;
+               req->aura_id = roc_npa_aura_handle_to_aura(aura_handle);
+               req->ctype = NPA_AQ_CTYPE_AURA;
+               req->op = NPA_AQ_INSTOP_READ;
 
-       rc = mbox_process_msg(mbox, (void *)&rsp);
-       if (rc)
-               goto exit;
+               rc = mbox_process_msg(mbox, (void *)&rsp);
+               if (rc)
+                       goto exit;
 
-       /* Init when enabled as there might be no triggers */
-       if (enable)
+               /* Init when enabled as there might be no triggers */
                *(volatile uint64_t *)sq->fc = rsp->aura.count;
-       else
+       } else {
                *(volatile uint64_t *)sq->fc = sq->aura_sqb_bufs;
+       }
        /* Sync write barrier */
        plt_wmb();
        rc = 0;
-- 
2.25.1

Reply via email to