examples/ipsec-secgw: add poll mode worker for inline proto
[dpdk.git] / examples / ipsec-secgw / ipsec_process.c
index bb2f2b8..089d89f 100644 (file)
 #include <rte_mbuf.h>
 
 #include "ipsec.h"
-
-#define SATP_OUT_IPV4(t)       \
-       ((((t) & RTE_IPSEC_SATP_MODE_MASK) == RTE_IPSEC_SATP_MODE_TRANS && \
-       (((t) & RTE_IPSEC_SATP_IPV_MASK) == RTE_IPSEC_SATP_IPV4)) || \
-       ((t) & RTE_IPSEC_SATP_MODE_MASK) == RTE_IPSEC_SATP_MODE_TUNLV4)
-
-/* helper routine to free bulk of packets */
-static inline void
-free_pkts(struct rte_mbuf *mb[], uint32_t n)
-{
-       uint32_t i;
-
-       for (i = 0; i != n; i++)
-               rte_pktmbuf_free(mb[i]);
-}
+#include "ipsec-secgw.h"
+#include "ipsec_worker.h"
 
 /* helper routine to free bulk of crypto-ops and related packets */
 static inline void
@@ -126,6 +113,7 @@ sa_group(void *sa_ptr[], struct rte_mbuf *pkts[],
        void * const nosa = &spi;
 
        sa = nosa;
+       grp[0].m = pkts;
        for (i = 0, n = 0; i != num; i++) {
 
                if (sa != sa_ptr[i]) {
@@ -216,23 +204,6 @@ ipsec_prepare_crypto_group(struct ipsec_ctx *ctx, struct ipsec_sa *sa,
        return k;
 }
 
-/*
- * helper routine for inline and cpu(synchronous) processing
- * this is just to satisfy inbound_sa_check() and get_hop_for_offload_pkt().
- * Should be removed in future.
- */
-static inline void
-prep_process_group(void *sa, struct rte_mbuf *mb[], uint32_t cnt)
-{
-       uint32_t j;
-       struct ipsec_mbuf_metadata *priv;
-
-       for (j = 0; j != cnt; j++) {
-               priv = get_priv(mb[j]);
-               priv->sa = sa;
-       }
-}
-
 /*
  * finish processing of packets successfully decrypted by an inline processor
  */