git: ignore python bytecode files
[dpdk.git] / lib / librte_ip_frag / rte_ip_frag.h
index b24bade..04fd9df 100644 (file)
@@ -19,6 +19,7 @@ extern "C" {
 #include <stdint.h>
 #include <stdio.h>
 
+#include <rte_config.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
 #include <rte_ip.h>
@@ -43,9 +44,17 @@ struct ip_frag {
 
 /** @internal <src addr, dst_addr, id> to uniquely identify fragmented datagram. */
 struct ip_frag_key {
-       uint64_t src_dst[4];      /**< src address, first 8 bytes used for IPv4 */
-       uint32_t id;           /**< dst address */
-       uint32_t key_len;      /**< src/dst key length */
+       uint64_t src_dst[4];
+       /**< src and dst address, only first 8 bytes used for IPv4 */
+       RTE_STD_C11
+       union {
+               uint64_t id_key_len; /**< combined for easy fetch */
+               __extension__
+               struct {
+                       uint32_t id;       /**< packet id */
+                       uint32_t key_len;  /**< src/dst key length */
+               };
+       };
 };
 
 /**
@@ -64,10 +73,13 @@ struct ip_frag_pkt {
 
 #define IP_FRAG_DEATH_ROW_LEN 32 /**< death row size (in packets) */
 
+/* death row size in mbufs */
+#define IP_FRAG_DEATH_ROW_MBUF_LEN (IP_FRAG_DEATH_ROW_LEN * (IP_MAX_FRAG_NUM + 1))
+
 /** mbuf death row (packets to be freed) */
 struct rte_ip_frag_death_row {
        uint32_t cnt;          /**< number of mbufs currently on death row */
-       struct rte_mbuf *row[IP_FRAG_DEATH_ROW_LEN * (IP_MAX_FRAG_NUM + 1)];
+       struct rte_mbuf *row[IP_FRAG_DEATH_ROW_MBUF_LEN];
        /**< mbufs to be freed */
 };
 
@@ -103,6 +115,7 @@ struct rte_ip_frag_tbl {
 #define        RTE_IPV6_EHDR_MF_MASK                   1
 #define        RTE_IPV6_EHDR_FO_SHIFT                  3
 #define        RTE_IPV6_EHDR_FO_MASK                   (~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
+#define        RTE_IPV6_EHDR_FO_ALIGN                  (1 << RTE_IPV6_EHDR_FO_SHIFT)
 
 #define RTE_IPV6_FRAG_USED_MASK                        \
        (RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
@@ -324,6 +337,20 @@ void rte_ip_frag_free_death_row(struct rte_ip_frag_death_row *dr,
 void
 rte_ip_frag_table_statistics_dump(FILE * f, const struct rte_ip_frag_tbl *tbl);
 
+/**
+ * Delete expired fragments
+ *
+ * @param tbl
+ *   Table to delete expired fragments from
+ * @param dr
+ *   Death row to free buffers to
+ * @param tms
+ *   Current timestamp
+ */
+void __rte_experimental
+rte_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl,
+       struct rte_ip_frag_death_row *dr, uint64_t tms);
+
 #ifdef __cplusplus
 }
 #endif