4 * Copyright(c) 2017 Intel Corporation. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of Intel Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 /**< the max packets number that rte_gro_reassemble_burst()
41 * can process in each invocation.
43 #define RTE_GRO_MAX_BURST_ITEM_NUM 128U
45 /**< max number of supported GRO types */
46 #define RTE_GRO_TYPE_MAX_NUM 64
47 /**< current supported GRO num */
48 #define RTE_GRO_TYPE_SUPPORT_NUM 0
51 struct rte_gro_param {
52 /**< desired GRO types */
54 /**< max flow number */
55 uint16_t max_flow_num;
56 /**< max packet number per flow */
57 uint16_t max_item_per_flow;
58 /**< socket index for allocating GRO related data structures,
59 * like reassembly tables. When use rte_gro_reassemble_burst(),
60 * applications don't need to set this value.
67 * @b EXPERIMENTAL: this API may change without prior notice
69 * This function create a GRO context object, which is used to merge
70 * packets in rte_gro_reassemble().
73 * applications use it to pass needed parameters to create a GRO
77 * if create successfully, return a pointer which points to the GRO
78 * context object. Otherwise, return NULL.
80 void *rte_gro_ctx_create(const struct rte_gro_param *param);
84 * @b EXPERIMENTAL: this API may change without prior notice
86 * This function destroys a GRO context object.
89 * pointer points to a GRO context object.
91 void rte_gro_ctx_destroy(void *ctx);
94 * This is one of the main reassembly APIs, which merges numbers of
95 * packets at a time. It assumes that all inputted packets are with
96 * correct checksums. That is, applications should guarantee all
97 * inputted packets are correct. Besides, it doesn't re-calculate
98 * checksums for merged packets. If inputted packets are IP fragmented,
99 * this function assumes them are complete (i.e. with L4 header). After
100 * finishing processing, it returns all GROed packets to applications
104 * a pointer array which points to the packets to reassemble. Besides,
105 * it keeps packet addresses for GROed packets.
107 * the number of packets to reassemble.
109 * applications use it to tell rte_gro_reassemble_burst() what rules
113 * the number of packets after been GROed. If no packets are merged,
114 * the returned value is nb_pkts.
116 uint16_t rte_gro_reassemble_burst(struct rte_mbuf **pkts,
118 const struct rte_gro_param *param);
122 * @b EXPERIMENTAL: this API may change without prior notice
124 * Reassembly function, which tries to merge inputted packets with
125 * the packets in the reassembly tables of a given GRO context. This
126 * function assumes all inputted packets are with correct checksums.
127 * And it won't update checksums if two packets are merged. Besides,
128 * if inputted packets are IP fragmented, this function assumes they
129 * are complete packets (i.e. with L4 header).
131 * If the inputted packets don't have data or are with unsupported GRO
132 * types etc., they won't be processed and are returned to applications.
133 * Otherwise, the inputted packets are either merged or inserted into
134 * the table. If applications want get packets in the table, they need
138 * packet to reassemble. Besides, after this function finishes, it
139 * keeps the unprocessed packets (e.g. without data or unsupported
142 * the number of packets to reassemble.
144 * a pointer points to a GRO context object.
147 * return the number of unprocessed packets (e.g. without data or
148 * unsupported GRO types). If all packets are processed (merged or
149 * inserted into the table), return 0.
151 uint16_t rte_gro_reassemble(struct rte_mbuf **pkts,
157 * @b EXPERIMENTAL: this API may change without prior notice
159 * This function flushes the timeout packets from reassembly tables of
160 * desired GRO types. The max number of flushed timeout packets is the
161 * element number of the array which is used to keep the flushed packets.
163 * Besides, this function won't re-calculate checksums for merged
164 * packets in the tables. That is, the returned packets may be with
168 * a pointer points to a GRO context object.
169 * @param timeout_cycles
170 * max TTL for packets in reassembly tables, measured in nanosecond.
172 * this function only flushes packets which belong to the GRO types
173 * specified by gro_types.
175 * a pointer array that is used to keep flushed timeout packets.
177 * the element number of out. It's also the max number of timeout
178 * packets that can be flushed finally.
181 * the number of flushed packets. If no packets are flushed, return 0.
183 uint16_t rte_gro_timeout_flush(void *ctx,
184 uint64_t timeout_cycles,
186 struct rte_mbuf **out,
187 uint16_t max_nb_out);
191 * @b EXPERIMENTAL: this API may change without prior notice
193 * This function returns the number of packets in all reassembly tables
194 * of a given GRO context.
197 * pointer points to a GRO context object.
200 * the number of packets in all reassembly tables.
202 uint64_t rte_gro_get_pkt_count(void *ctx);
208 #endif /* _RTE_GRO_H_ */