DPDK  17.11.10
Data Structures | Macros | Functions
rte_gro.h File Reference
#include <stdint.h>
#include <rte_mbuf.h>

Go to the source code of this file.

Data Structures

struct  rte_gro_param
 

Macros

#define RTE_GRO_MAX_BURST_ITEM_NUM   128U
 
#define RTE_GRO_TYPE_MAX_NUM   64
 
#define RTE_GRO_TYPE_SUPPORT_NUM   1
 
#define RTE_GRO_TCP_IPV4   (1ULL << RTE_GRO_TCP_IPV4_INDEX)
 

Functions

void * rte_gro_ctx_create (const struct rte_gro_param *param)
 
void rte_gro_ctx_destroy (void *ctx)
 
uint16_t rte_gro_reassemble_burst (struct rte_mbuf **pkts, uint16_t nb_pkts, const struct rte_gro_param *param)
 
uint16_t rte_gro_reassemble (struct rte_mbuf **pkts, uint16_t nb_pkts, void *ctx)
 
uint16_t rte_gro_timeout_flush (void *ctx, uint64_t timeout_cycles, uint64_t gro_types, struct rte_mbuf **out, uint16_t max_nb_out)
 
uint64_t rte_gro_get_pkt_count (void *ctx)
 

Detailed Description

Interface to GRO library

Definition in file rte_gro.h.

Macro Definition Documentation

#define RTE_GRO_MAX_BURST_ITEM_NUM   128U

the max number of packets that rte_gro_reassemble_burst() can process in each invocation.

Definition at line 48 of file rte_gro.h.

#define RTE_GRO_TYPE_MAX_NUM   64

the max number of supported GRO types

Definition at line 52 of file rte_gro.h.

#define RTE_GRO_TYPE_SUPPORT_NUM   1

the number of currently supported GRO types

Definition at line 54 of file rte_gro.h.

#define RTE_GRO_TCP_IPV4   (1ULL << RTE_GRO_TCP_IPV4_INDEX)

TCP/IPv4 GRO flag

Definition at line 58 of file rte_gro.h.

Function Documentation

void* rte_gro_ctx_create ( const struct rte_gro_param param)
Warning
EXPERIMENTAL: this API may change without prior notice

This function create a GRO context object, which is used to merge packets in rte_gro_reassemble().

Parameters
paramapplications use it to pass needed parameters to create a GRO context object.
Returns
if create successfully, return a pointer which points to the GRO context object. Otherwise, return NULL.
void rte_gro_ctx_destroy ( void *  ctx)
Warning
EXPERIMENTAL: this API may change without prior notice

This function destroys a GRO context object.

Parameters
ctxpointer points to a GRO context object.
uint16_t rte_gro_reassemble_burst ( struct rte_mbuf **  pkts,
uint16_t  nb_pkts,
const struct rte_gro_param param 
)

This is one of the main reassembly APIs, which merges numbers of packets at a time. It assumes that all inputted packets are with correct checksums. That is, applications should guarantee all inputted packets are correct. Besides, it doesn't re-calculate checksums for merged packets. If inputted packets are IP fragmented, this function assumes them are complete (i.e. with L4 header). After finishing processing, it returns all GROed packets to applications immediately.

Parameters
pktsa pointer array which points to the packets to reassemble. Besides, it keeps mbuf addresses for the GROed packets.
nb_pktsthe number of packets to reassemble.
paramapplications use it to tell rte_gro_reassemble_burst() what rules are demanded.
Returns
the number of packets after been GROed. If no packets are merged, the returned value is nb_pkts.
uint16_t rte_gro_reassemble ( struct rte_mbuf **  pkts,
uint16_t  nb_pkts,
void *  ctx 
)
Warning
EXPERIMENTAL: this API may change without prior notice

Reassembly function, which tries to merge inputted packets with the packets in the reassembly tables of a given GRO context. This function assumes all inputted packets are with correct checksums. And it won't update checksums if two packets are merged. Besides, if inputted packets are IP fragmented, this function assumes they are complete packets (i.e. with L4 header).

If the inputted packets don't have data or are with unsupported GRO types etc., they won't be processed and are returned to applications. Otherwise, the inputted packets are either merged or inserted into the table. If applications want get packets in the table, they need to call flush API.

Parameters
pktspacket to reassemble. Besides, after this function finishes, it keeps the unprocessed packets (e.g. without data or unsupported GRO types).
nb_pktsthe number of packets to reassemble.
ctxa pointer points to a GRO context object.
Returns
return the number of unprocessed packets (e.g. without data or unsupported GRO types). If all packets are processed (merged or inserted into the table), return 0.
uint16_t rte_gro_timeout_flush ( void *  ctx,
uint64_t  timeout_cycles,
uint64_t  gro_types,
struct rte_mbuf **  out,
uint16_t  max_nb_out 
)
Warning
EXPERIMENTAL: this API may change without prior notice

This function flushes the timeout packets from reassembly tables of desired GRO types. The max number of flushed timeout packets is the element number of the array which is used to keep the flushed packets.

Besides, this function won't re-calculate checksums for merged packets in the tables. That is, the returned packets may be with wrong checksums.

Parameters
ctxa pointer points to a GRO context object.
timeout_cyclesmax TTL for packets in reassembly tables, measured in nanosecond.
gro_typesthis function only flushes packets which belong to the GRO types specified by gro_types.
outa pointer array that is used to keep flushed timeout packets.
max_nb_outthe element number of out. It's also the max number of timeout packets that can be flushed finally.
Returns
the number of flushed packets. If no packets are flushed, return 0.
uint64_t rte_gro_get_pkt_count ( void *  ctx)
Warning
EXPERIMENTAL: this API may change without prior notice

This function returns the number of packets in all reassembly tables of a given GRO context.

Parameters
ctxpointer points to a GRO context object.
Returns
the number of packets in all reassembly tables.