crypto/cnxk: move IPsec SA creation to common
[dpdk.git] / drivers / common / cnxk / roc_nix_tm.c
index 5b23ecd..7fd54ef 100644 (file)
@@ -55,7 +55,7 @@ nix_tm_node_reg_conf(struct nix *nix, struct nix_tm_node *node)
                req = mbox_alloc_msg_nix_txschq_cfg(mbox);
                req->lvl = NIX_TXSCH_LVL_TL1;
 
-               k = nix_tm_tl1_default_prep(node->parent_hw_id, req->reg,
+               k = nix_tm_tl1_default_prep(nix, node->parent_hw_id, req->reg,
                                            req->regval);
                req->num_regs = k;
                rc = mbox_process(mbox);
@@ -325,14 +325,17 @@ nix_tm_bp_config_set(struct roc_nix *roc_nix, uint16_t sq, uint16_t tc,
        struct mbox *mbox = (&nix->dev)->mbox;
        struct nix_txschq_config *req = NULL;
        struct nix_tm_node_list *list;
+       uint16_t link = nix->tx_link;
        struct nix_tm_node *sq_node;
        struct nix_tm_node *parent;
        struct nix_tm_node *node;
        uint8_t k = 0;
-       uint16_t link;
        int rc = 0;
 
        sq_node = nix_tm_node_search(nix, sq, nix->tm_tree);
+       if (!sq_node)
+               return -ENOENT;
+
        parent = sq_node->parent;
        while (parent) {
                if (parent->lvl == ROC_TM_LVL_SCH2)
@@ -340,9 +343,10 @@ nix_tm_bp_config_set(struct roc_nix *roc_nix, uint16_t sq, uint16_t tc,
 
                parent = parent->parent;
        }
+       if (!parent)
+               return -ENOENT;
 
        list = nix_tm_node_list(nix, tree);
-       link = nix->tx_link;
 
        if (parent->rel_chan != NIX_TM_CHAN_INVALID && parent->rel_chan != tc) {
                rc = -EINVAL;
@@ -586,6 +590,7 @@ nix_tm_sq_flush_pre(struct roc_nix_sq *sq)
        struct nix_tm_node *node, *sibling;
        struct nix_tm_node_list *list;
        enum roc_nix_tm_tree tree;
+       struct msg_req *req;
        struct mbox *mbox;
        struct nix *nix;
        uint16_t qid;
@@ -675,6 +680,12 @@ nix_tm_sq_flush_pre(struct roc_nix_sq *sq)
                        rc);
                goto cleanup;
        }
+
+       req = mbox_alloc_msg_nix_rx_sw_sync(mbox);
+       if (!req)
+               return -ENOSPC;
+
+       rc = mbox_process(mbox);
 cleanup:
        /* Restore cgx state */
        if (!roc_nix->io_enabled) {
@@ -1038,10 +1049,8 @@ nix_tm_assign_hw_id(struct nix *nix, struct nix_tm_node *parent,
                        return -EFAULT;
                }
 
-               if (!slab) {
-                       if (!plt_bitmap_scan(bmp, &pos, &slab))
-                               return -ENOENT;
-               }
+               if (!slab)
+                       plt_bitmap_scan(bmp, &pos, &slab);
 
                if (child->priority == parent->rr_prio && spare_schq != -1) {
                        /* Use spare schq first if present */
@@ -1279,6 +1288,7 @@ nix_tm_alloc_txschq(struct nix *nix, enum roc_nix_tm_tree tree)
        } while (pend);
 
        nix->tm_link_cfg_lvl = rsp->link_cfg_lvl;
+       nix->tm_aggr_lvl_rr_prio = rsp->aggr_lvl_rr_prio;
        return 0;
 alloc_err:
        for (i = 0; i < NIX_TXSCH_LVL_CNT; i++) {