New upstream version 18.11-rc2
[deb_dpdk.git] / lib / librte_ip_frag / rte_ip_frag.h
index b3f3f78..a4ccaf9 100644 (file)
@@ -44,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 */
+               };
+       };
 };
 
 /**
@@ -65,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 */
 };
 
@@ -325,6 +336,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