net/cnxk: support to create meter profile
[dpdk.git] / drivers / common / cnxk / roc_nix_queue.c
index 41e8f2c..cba1294 100644 (file)
@@ -492,15 +492,20 @@ roc_nix_cq_init(struct roc_nix *roc_nix, struct roc_nix_cq *cq)
                cq->drop_thresh = min_rx_drop;
        } else {
                cq->drop_thresh = NIX_CQ_THRESH_LEVEL;
-               cq_ctx->drop = cq->drop_thresh;
-               cq_ctx->drop_ena = 1;
+               /* Drop processing or red drop cannot be enabled due to
+                * due to packets coming for second pass from CPT.
+                */
+               if (!roc_nix_inl_inb_is_enabled(roc_nix)) {
+                       cq_ctx->drop = cq->drop_thresh;
+                       cq_ctx->drop_ena = 1;
+               }
        }
 
        /* TX pause frames enable flow ctrl on RX side */
        if (nix->tx_pause) {
                /* Single BPID is allocated for all rx channels for now */
                cq_ctx->bpid = nix->bpid[0];
-               cq_ctx->bp = cq_ctx->drop;
+               cq_ctx->bp = cq->drop_thresh;
                cq_ctx->bp_ena = 1;
        }
 
@@ -656,6 +661,8 @@ sq_cn9k_init(struct nix *nix, struct roc_nix_sq *sq, uint32_t rr_quantum,
        aq->sq.sqe_stype = NIX_STYPE_STF;
        aq->sq.ena = 1;
        aq->sq.sso_ena = !!sq->sso_ena;
+       aq->sq.cq_ena = !!sq->cq_ena;
+       aq->sq.cq = sq->cqid;
        if (aq->sq.max_sqe_size == NIX_MAXSQESZ_W8)
                aq->sq.sqe_stype = NIX_STYPE_STP;
        aq->sq.sqb_aura = roc_npa_aura_handle_to_aura(sq->aura_handle);
@@ -754,6 +761,8 @@ sq_init(struct nix *nix, struct roc_nix_sq *sq, uint32_t rr_quantum,
        aq->sq.sqe_stype = NIX_STYPE_STF;
        aq->sq.ena = 1;
        aq->sq.sso_ena = !!sq->sso_ena;
+       aq->sq.cq_ena = !!sq->cq_ena;
+       aq->sq.cq = sq->cqid;
        if (aq->sq.max_sqe_size == NIX_MAXSQESZ_W8)
                aq->sq.sqe_stype = NIX_STYPE_STP;
        aq->sq.sqb_aura = roc_npa_aura_handle_to_aura(sq->aura_handle);
@@ -929,6 +938,11 @@ roc_nix_sq_fini(struct roc_nix_sq *sq)
                rc |= NIX_ERR_NDC_SYNC;
 
        rc |= nix_tm_sq_flush_post(sq);
+
+       /* Restore limit to max SQB count that the pool was created
+        * for aura drain to succeed.
+        */
+       roc_npa_aura_limit_modify(sq->aura_handle, NIX_MAX_SQB);
        rc |= roc_npa_pool_destroy(sq->aura_handle);
        plt_free(sq->fc);
        plt_free(sq->sqe_mem);