crypto/cnxk: add symmetric capabilities
[dpdk.git] / drivers / crypto / cnxk / cnxk_cryptodev_ops.c
index 8ef0e6f..0d81785 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "cnxk_cryptodev.h"
 #include "cnxk_cryptodev_ops.h"
+#include "cnxk_cryptodev_capabilities.h"
 #include "cnxk_se.h"
 
 static int
@@ -99,7 +100,7 @@ cnxk_cpt_dev_info_get(struct rte_cryptodev *dev,
 
        info->max_nb_queue_pairs = roc_cpt->nb_lf_avail;
        info->feature_flags = dev->feature_flags;
-       info->capabilities = NULL;
+       info->capabilities = cnxk_crypto_capabilities_get(vf);
        info->sym.max_nb_sessions = 0;
        info->min_mbuf_headroom_req = CNXK_CPT_MIN_HEADROOM_REQ;
        info->min_mbuf_tailroom_req = 0;
@@ -457,6 +458,32 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
        sess_priv = priv;
 
        switch (ret) {
+       case CNXK_CPT_CIPHER:
+               ret = fill_sess_cipher(xform, sess_priv);
+               break;
+       case CNXK_CPT_AUTH:
+               if (xform->auth.algo == RTE_CRYPTO_AUTH_AES_GMAC)
+                       ret = fill_sess_gmac(xform, sess_priv);
+               else
+                       ret = fill_sess_auth(xform, sess_priv);
+               break;
+       case CNXK_CPT_AEAD:
+               ret = fill_sess_aead(xform, sess_priv);
+               break;
+       case CNXK_CPT_CIPHER_ENC_AUTH_GEN:
+       case CNXK_CPT_CIPHER_DEC_AUTH_VRFY:
+               ret = fill_sess_cipher(xform, sess_priv);
+               if (ret < 0)
+                       break;
+               ret = fill_sess_auth(xform->next, sess_priv);
+               break;
+       case CNXK_CPT_AUTH_VRFY_CIPHER_DEC:
+       case CNXK_CPT_AUTH_GEN_CIPHER_ENC:
+               ret = fill_sess_auth(xform, sess_priv);
+               if (ret < 0)
+                       break;
+               ret = fill_sess_cipher(xform->next, sess_priv);
+               break;
        default:
                ret = -1;
        }
@@ -464,6 +491,13 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,
        if (ret)
                goto priv_put;
 
+       if ((sess_priv->roc_se_ctx.fc_type == ROC_SE_HASH_HMAC) &&
+           cpt_mac_len_verify(&xform->auth)) {
+               plt_dp_err("MAC length is not supported");
+               ret = -ENOTSUP;
+               goto priv_put;
+       }
+
        sess_priv->cpt_inst_w7 = cnxk_cpt_inst_w7_get(sess_priv, roc_cpt);
 
        set_sym_session_private_data(sess, driver_id, sess_priv);