examples/ipsec-secgw: move IV to crypto op private data
[dpdk.git] / examples / ipsec-secgw / ipsec.h
index ad96782..d48b299 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -90,7 +90,7 @@ struct ip_addr {
        } ip;
 };
 
-#define MAX_KEY_SIZE           20
+#define MAX_KEY_SIZE           32
 
 struct ipsec_sa {
        uint32_t spi;
@@ -113,14 +113,15 @@ struct ipsec_sa {
        uint16_t cipher_key_len;
        uint8_t auth_key[MAX_KEY_SIZE];
        uint16_t auth_key_len;
+       uint16_t aad_len;
        struct rte_crypto_sym_xform *xforms;
 } __rte_cache_aligned;
 
 struct ipsec_mbuf_metadata {
-       uint8_t buf[32];
        struct ipsec_sa *sa;
        struct rte_crypto_op cop;
        struct rte_crypto_sym_op sym_cop;
+       uint8_t buf[32];
 } __rte_cache_aligned;
 
 struct cdev_qp {
@@ -193,6 +194,14 @@ get_cnt_blk(struct rte_mbuf *m)
        return &priv->buf[0];
 }
 
+static inline void *
+get_aad(struct rte_mbuf *m)
+{
+       struct ipsec_mbuf_metadata *priv = get_priv(m);
+
+       return &priv->buf[16];
+}
+
 static inline void *
 get_sym_cop(struct rte_crypto_op *cop)
 {