crypto/cnxk: enable allocated queues only
[dpdk.git] / drivers / crypto / cnxk / cn9k_ipsec.c
index a43864d..6455ef9 100644 (file)
@@ -280,6 +280,7 @@ cn9k_ipsec_outb_sa_create(struct cnxk_cpt_qp *qp,
        struct rte_crypto_sym_xform *auth_xform = crypto_xform->next;
        struct roc_ie_on_ip_template *template = NULL;
        struct roc_cpt *roc_cpt = qp->lf.roc_cpt;
+       union roc_on_ipsec_outb_param1 param1;
        struct cnxk_cpt_inst_tmpl *inst_tmpl;
        struct roc_ie_on_outb_sa *out_sa;
        struct cn9k_sec_session *sess;
@@ -407,7 +408,12 @@ cn9k_ipsec_outb_sa_create(struct cnxk_cpt_qp *qp,
        w4.u64 = 0;
        w4.s.opcode_major = ROC_IE_ON_MAJOR_OP_PROCESS_OUTBOUND_IPSEC;
        w4.s.opcode_minor = ctx_len >> 3;
-       w4.s.param1 = ROC_IE_ON_PER_PKT_IV;
+
+       param1.u16 = 0;
+       param1.s.ikev2 = 1;
+       param1.s.per_pkt_iv = 1;
+       w4.s.param1 = param1.u16;
+
        inst_tmpl->w4 = w4.u64;
 
        w7.u64 = 0;
@@ -427,6 +433,7 @@ cn9k_ipsec_inb_sa_create(struct cnxk_cpt_qp *qp,
 {
        struct rte_crypto_sym_xform *auth_xform = crypto_xform;
        struct roc_cpt *roc_cpt = qp->lf.roc_cpt;
+       union roc_on_ipsec_inb_param2 param2;
        struct cnxk_cpt_inst_tmpl *inst_tmpl;
        struct roc_ie_on_inb_sa *in_sa;
        struct cn9k_sec_session *sess;
@@ -445,6 +452,7 @@ cn9k_ipsec_inb_sa_create(struct cnxk_cpt_qp *qp,
        memset(sa, 0, sizeof(struct cn9k_ipsec_sa));
 
        sa->dir = RTE_SECURITY_IPSEC_SA_DIR_INGRESS;
+       sa->replay_win_sz = ipsec->replay_win_sz;
 
        ret = fill_ipsec_common_sa(ipsec, crypto_xform, &in_sa->common_sa);
        if (ret)
@@ -476,6 +484,11 @@ cn9k_ipsec_inb_sa_create(struct cnxk_cpt_qp *qp,
        w4.u64 = 0;
        w4.s.opcode_major = ROC_IE_ON_MAJOR_OP_PROCESS_INBOUND_IPSEC;
        w4.s.opcode_minor = ctx_len >> 3;
+
+       param2.u16 = 0;
+       param2.s.ikev2 = 1;
+       w4.s.param2 = param2.u16;
+
        inst_tmpl->w4 = w4.u64;
 
        w7.u64 = 0;
@@ -483,6 +496,22 @@ cn9k_ipsec_inb_sa_create(struct cnxk_cpt_qp *qp,
        w7.s.cptr = rte_mempool_virt2iova(in_sa);
        inst_tmpl->w7 = w7.u64;
 
+       if (sa->replay_win_sz) {
+               if (sa->replay_win_sz > CNXK_ON_AR_WIN_SIZE_MAX) {
+                       plt_err("Replay window size:%u is not supported",
+                               sa->replay_win_sz);
+                       return -ENOTSUP;
+               }
+
+               /* Set window bottom to 1, base and top to size of window */
+               sa->ar.winb = 1;
+               sa->ar.wint = sa->replay_win_sz;
+               sa->ar.base = sa->replay_win_sz;
+
+               in_sa->common_sa.esn_low = 0;
+               in_sa->common_sa.esn_hi = 0;
+       }
+
        return cn9k_cpt_enq_sa_write(
                sa, qp, ROC_IE_ON_MAJOR_OP_WRITE_IPSEC_INBOUND, ctx_len);
 }