examples/ipsec-secgw: use HW parsed packet type in poll mode
[dpdk.git] / examples / ipsec-secgw / ipsec.h
index d19f851..9a4e7ea 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <rte_byteorder.h>
 #include <rte_crypto.h>
+#include <rte_ip_frag.h>
 #include <rte_security.h>
 #include <rte_flow.h>
 #include <rte_ipsec.h>
 
 #define IP6_VERSION (6)
 
+#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)
+
 struct rte_crypto_xform;
 struct ipsec_xform;
 struct rte_mbuf;
@@ -63,8 +69,7 @@ struct ip_addr {
        } ip;
 };
 
-#define MAX_KEY_SIZE           36
-
+#define MAX_KEY_SIZE           64
 /*
  * application wide SA parameters
  */
@@ -123,6 +128,8 @@ struct ipsec_sa {
 #define TRANSPORT  (1 << 2)
 #define IP4_TRANSPORT (1 << 3)
 #define IP6_TRANSPORT (1 << 4)
+#define SA_TELEMETRY_ENABLE (1 << 5)
+
        struct ip_addr src;
        struct ip_addr dst;
        struct {
@@ -141,6 +148,7 @@ struct ipsec_sa {
        enum rte_security_ipsec_sa_direction direction;
        uint8_t udp_encap;
        uint16_t portid;
+       uint64_t esn;
        uint16_t mss;
        uint8_t fdir_qid;
        uint8_t fdir_flag;
@@ -246,7 +254,7 @@ struct socket_ctx {
        struct sp_ctx *sp_ip6_out;
        struct rt_ctx *rt_ip4;
        struct rt_ctx *rt_ip6;
-       struct rte_mempool *mbuf_pool;
+       struct rte_mempool *mbuf_pool[RTE_MAX_ETHPORTS];
        struct rte_mempool *mbuf_pool_indir;
        struct rte_mempool *session_pool;
        struct rte_mempool *session_priv_pool;
@@ -258,6 +266,34 @@ struct cnt_blk {
        uint32_t cnt;
 } __rte_packed;
 
+struct lcore_rx_queue {
+       uint16_t port_id;
+       uint8_t queue_id;
+} __rte_cache_aligned;
+
+struct buffer {
+       uint16_t len;
+       struct rte_mbuf *m_table[MAX_PKT_BURST] __rte_aligned(sizeof(void *));
+};
+
+struct lcore_conf {
+       uint16_t nb_rx_queue;
+       struct lcore_rx_queue rx_queue_list[MAX_RX_QUEUE_PER_LCORE];
+       uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
+       struct buffer tx_mbufs[RTE_MAX_ETHPORTS];
+       struct ipsec_ctx inbound;
+       struct ipsec_ctx outbound;
+       struct rt_ctx *rt4_ctx;
+       struct rt_ctx *rt6_ctx;
+       struct {
+               struct rte_ip_frag_tbl *tbl;
+               struct rte_mempool *pool_indir;
+               struct rte_ip_frag_death_row dr;
+       } frag;
+} __rte_cache_aligned;
+
+extern struct lcore_conf lcore_conf[RTE_MAX_LCORE];
+
 /* Socket ctx */
 extern struct socket_ctx socket_ctx[NB_SOCKETS];