• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq --impl-partialeq --rustified-enum ".*" --rust-target 1.40
2 typedef unsigned char uint8_t;
3 typedef unsigned short uint16_t;
4 typedef unsigned int uint32_t;
5 typedef unsigned long long uint64_t;
6 
7 #define RTE_CACHE_LINE_SIZE 64
8 
9 /**
10  * Force alignment
11  */
12 #define __rte_aligned(a) __attribute__((__aligned__(a)))
13 
14 /**
15  * Force alignment to cache line.
16  */
17 #define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE)
18 
19 #define RTE_LIBRTE_IP_FRAG_MAX_FRAG 4
20 
21 enum {
22 	IP_LAST_FRAG_IDX,    /**< index of last fragment */
23 	IP_FIRST_FRAG_IDX,   /**< index of first fragment */
24 	IP_MIN_FRAG_NUM,     /**< minimum number of fragments */
25 	IP_MAX_FRAG_NUM = RTE_LIBRTE_IP_FRAG_MAX_FRAG,
26 	/**< maximum number of fragments per packet */
27 };
28 
29 /** @internal fragmented mbuf */
30 struct ip_frag {
31 	uint16_t ofs;          /**< offset into the packet */
32 	uint16_t len;          /**< length of fragment */
33 	struct rte_mbuf *mb;   /**< fragment mbuf */
34 };
35 
36 /** @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram. */
37 struct ip_frag_key {
38 	uint64_t src_dst[4];      /**< src address, first 8 bytes used for IPv4 */
39 	uint32_t id;           /**< dst address */
40 	uint32_t key_len;      /**< src/dst key length */
41 };
42 
43 #define	TAILQ_ENTRY(type)						                    \
44 struct {								                            \
45 	struct type *tqe_next;	/* next element */			            \
46 	struct type **tqe_prev;	/* address of previous next element */	\
47 }
48 
49 /**
50  * @internal Fragmented packet to reassemble.
51  * First two entries in the frags[] array are for the last and first fragments.
52  */
53 struct ip_frag_pkt {
54 	TAILQ_ENTRY(ip_frag_pkt) lru;   /**< LRU list */
55 	struct ip_frag_key key;           /**< fragmentation key */
56 	uint64_t             start;       /**< creation timestamp */
57 	uint32_t             total_size;  /**< expected reassembled size */
58 	uint32_t             frag_size;   /**< size of fragments received */
59 	uint32_t             last_idx;    /**< index of next entry to fill */
60 	struct ip_frag       frags[IP_MAX_FRAG_NUM]; /**< fragments */
61 } __rte_cache_aligned;
62