ethdev: register as a class
[dpdk.git] / examples / ipsec-secgw / esp.c
index 63587df..e33232c 100644 (file)
@@ -96,6 +96,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,
 
                switch (sa->cipher_algo) {
                case RTE_CRYPTO_CIPHER_NULL:
+               case RTE_CRYPTO_CIPHER_3DES_CBC:
                case RTE_CRYPTO_CIPHER_AES_CBC:
                        /* Copy IV at the end of crypto operation */
                        rte_memcpy(iv_ptr, iv, sa->iv_len);
@@ -149,7 +150,8 @@ esp_inbound_post(struct rte_mbuf *m, struct ipsec_sa *sa,
        RTE_ASSERT(sa != NULL);
        RTE_ASSERT(cop != NULL);
 
-       if (sa->type == RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO) {
+       if ((sa->type == RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) ||
+                       (sa->type == RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO)) {
                if (m->ol_flags & PKT_RX_SEC_OFFLOAD) {
                        if (m->ol_flags & PKT_RX_SEC_OFFLOAD_FAILED)
                                cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
@@ -325,6 +327,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
        } else {
                switch (sa->cipher_algo) {
                case RTE_CRYPTO_CIPHER_NULL:
+               case RTE_CRYPTO_CIPHER_3DES_CBC:
                case RTE_CRYPTO_CIPHER_AES_CBC:
                        memset(iv, 0, sa->iv_len);
                        break;
@@ -386,6 +389,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
        } else {
                switch (sa->cipher_algo) {
                case RTE_CRYPTO_CIPHER_NULL:
+               case RTE_CRYPTO_CIPHER_3DES_CBC:
                case RTE_CRYPTO_CIPHER_AES_CBC:
                        sym_cop->cipher.data.offset = ip_hdr_len +
                                sizeof(struct esp_hdr);
@@ -445,7 +449,8 @@ esp_outbound_post(struct rte_mbuf *m,
        RTE_ASSERT(m != NULL);
        RTE_ASSERT(sa != NULL);
 
-       if (sa->type == RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO) {
+       if ((sa->type == RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) ||
+                       (sa->type == RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO)) {
                m->ol_flags |= PKT_TX_SEC_OFFLOAD;
        } else {
                RTE_ASSERT(cop != NULL);