+static const struct rte_security_capability
+otx2_crypto_sec_capabilities[] = {
+ { /* IPsec Lookaside Protocol ESP Tunnel Ingress */
+ .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL,
+ .protocol = RTE_SECURITY_PROTOCOL_IPSEC,
+ .ipsec = {
+ .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
+ .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
+ .direction = RTE_SECURITY_IPSEC_SA_DIR_INGRESS,
+ .options = { 0 }
+ },
+ .crypto_capabilities = otx2_cpt_sec_caps,
+ .ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
+ },
+ { /* IPsec Lookaside Protocol ESP Tunnel Egress */
+ .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL,
+ .protocol = RTE_SECURITY_PROTOCOL_IPSEC,
+ .ipsec = {
+ .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
+ .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
+ .direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
+ .options = { 0 }
+ },
+ .crypto_capabilities = otx2_cpt_sec_caps,
+ .ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
+ },
+ {
+ .action = RTE_SECURITY_ACTION_TYPE_NONE
+ }
+};
+
+static void
+cpt_caps_add(const struct rte_cryptodev_capabilities *caps, int nb_caps)
+{
+ static int cur_pos;
+
+ if (cur_pos + nb_caps > OTX2_CPT_MAX_CAPS)
+ return;
+
+ memcpy(&otx2_cpt_caps[cur_pos], caps, nb_caps * sizeof(caps[0]));
+ cur_pos += nb_caps;
+}
+
+void
+otx2_crypto_capabilities_init(union cpt_eng_caps *hw_caps)
+{
+ CPT_CAPS_ADD(hw_caps, mul);
+ CPT_CAPS_ADD(hw_caps, sha1_sha2);
+ CPT_CAPS_ADD(hw_caps, chacha20);
+ CPT_CAPS_ADD(hw_caps, zuc_snow3g);
+ CPT_CAPS_ADD(hw_caps, aes);
+ CPT_CAPS_ADD(hw_caps, kasumi);
+ CPT_CAPS_ADD(hw_caps, des);
+
+ cpt_caps_add(caps_null, RTE_DIM(caps_null));
+ cpt_caps_add(caps_end, RTE_DIM(caps_end));
+}
+