---
name: "rte_ipv6_fragment_packet"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_ip_frag.h"
---

# rte\_ipv6\_fragment\_packet(3)

Part of [rte\_ip\_frag.h(3)](/rte_ip_frag.h/3.md).

## NAME

rte\_ip\_frag.h

## SYNOPSIS

`#include <stdint.h>`\
 `#include <stdio.h>`\
 `#include <rte_config.h>`\
 `#include <rte_malloc.h>`\
 `#include <rte_memory.h>`\
 `#include <rte_ip.h>`\
 `#include <rte_byteorder.h>`\

### Data Structures

struct **rte\_ip\_frag\_death\_row**\

### Macros

\#define **RTE\_IP\_FRAG\_DEATH\_ROW\_LEN**   32\
 \#define **RTE\_IP\_FRAG\_DEATH\_ROW\_MBUF\_LEN**   	(**RTE\_IP\_FRAG\_DEATH\_ROW\_LEN** \* (RTE\_LIBRTE\_IP\_FRAG\_MAX\_FRAG + 1))\

**Obsolete macros, kept here for compatibility reasons.**\
 Will be deprecated/removed in future DPDK releases.

\#define **IP\_FRAG\_DEATH\_ROW\_LEN**   **RTE\_IP\_FRAG\_DEATH\_ROW\_LEN**\
 \#define **IP\_FRAG\_DEATH\_ROW\_MBUF\_LEN**   **RTE\_IP\_FRAG\_DEATH\_ROW\_MBUF\_LEN**\
 \#define **ipv6\_extension\_fragment**   rte\_ipv6\_fragment\_ext\

### Functions

struct rte\_ip\_frag\_tbl \* **rte\_ip\_frag\_table\_create** (uint32\_t bucket\_num, uint32\_t bucket\_entries, uint32\_t max\_entries, uint64\_t max\_cycles, int socket\_id)\
 void **rte\_ip\_frag\_table\_destroy** (struct rte\_ip\_frag\_tbl \*tbl)\
 int32\_t **rte\_ipv6\_fragment\_packet** (struct **rte\_mbuf** \*pkt\_in, struct **rte\_mbuf** \*\*pkts\_out, uint16\_t nb\_pkts\_out, uint16\_t mtu\_size, struct **rte\_mempool** \*pool\_direct, struct **rte\_mempool** \*pool\_indirect)\
 struct **rte\_mbuf** \* **rte\_ipv6\_frag\_reassemble\_packet** (struct rte\_ip\_frag\_tbl \*tbl, struct **rte\_ip\_frag\_death\_row** \*dr, struct **rte\_mbuf** \*mb, uint64\_t tms, struct rte\_ipv6\_hdr \*ip\_hdr, struct rte\_ipv6\_fragment\_ext \*frag\_hdr)\
 static struct rte\_ipv6\_fragment\_ext \* **rte\_ipv6\_frag\_get\_ipv6\_fragment\_header** (struct rte\_ipv6\_hdr \*hdr)\
 int32\_t **rte\_ipv4\_fragment\_packet** (struct **rte\_mbuf** \*pkt\_in, struct **rte\_mbuf** \*\*pkts\_out, uint16\_t nb\_pkts\_out, uint16\_t mtu\_size, struct **rte\_mempool** \*pool\_direct, struct **rte\_mempool** \*pool\_indirect)\
 int32\_t **rte\_ipv4\_fragment\_copy\_nonseg\_packet** (struct **rte\_mbuf** \*pkt\_in, struct **rte\_mbuf** \*\*pkts\_out, uint16\_t nb\_pkts\_out, uint16\_t mtu\_size, struct **rte\_mempool** \*pool\_direct)\
 struct **rte\_mbuf** \* **rte\_ipv4\_frag\_reassemble\_packet** (struct rte\_ip\_frag\_tbl \*tbl, struct **rte\_ip\_frag\_death\_row** \*dr, struct **rte\_mbuf** \*mb, uint64\_t tms, struct rte\_ipv4\_hdr \*ip\_hdr)\
 static int **rte\_ipv4\_frag\_pkt\_is\_fragmented** (const struct rte\_ipv4\_hdr \*hdr)\
 void **rte\_ip\_frag\_free\_death\_row** (struct **rte\_ip\_frag\_death\_row** \*dr, uint32\_t prefetch)\
 void **rte\_ip\_frag\_table\_statistics\_dump** (FILE \*f, const struct rte\_ip\_frag\_tbl \*tbl)\
 void **rte\_ip\_frag\_table\_del\_expired\_entries** (struct rte\_ip\_frag\_tbl \*tbl, struct **rte\_ip\_frag\_death\_row** \*dr, uint64\_t tms)\

## Detailed Description

RTE IP Fragmentation and Reassembly

Implementation of IP packet fragmentation and reassembly.

Definition in file **rte\_ip\_frag.h**.

## Macro Definition Documentation

### #define RTE\_IP\_FRAG\_DEATH\_ROW\_LEN 32

death row size (in packets)

Definition at line **31** of file **rte\_ip\_frag.h**.

### #define RTE\_IP\_FRAG\_DEATH\_ROW\_MBUF\_LEN (RTE\_IP\_FRAG\_DEATH\_ROW\_LEN \* (RTE\_LIBRTE\_IP\_FRAG\_MAX\_FRAG + 1))

death row size in mbufs

Definition at line **34** of file **rte\_ip\_frag.h**.

### #define IP\_FRAG\_DEATH\_ROW\_LEN RTE\_IP\_FRAG\_DEATH\_ROW\_LEN

Obsolete

Definition at line **298** of file **rte\_ip\_frag.h**.

### #define IP\_FRAG\_DEATH\_ROW\_MBUF\_LEN RTE\_IP\_FRAG\_DEATH\_ROW\_MBUF\_LEN

Obsolete

Definition at line **300** of file **rte\_ip\_frag.h**.

### #define ipv6\_extension\_fragment rte\_ipv6\_fragment\_ext

Obsolete

Definition at line **302** of file **rte\_ip\_frag.h**.

## Function Documentation

### struct rte\_ip\_frag\_tbl \* rte\_ip\_frag\_table\_create (uint32\_t bucket\_num, uint32\_t bucket\_entries, uint32\_t max\_entries, uint64\_t max\_cycles, int socket\_id)

Create a new IP fragmentation table.

**Parameters**

*bucket\_num* Number of buckets in the hash table. \
 *bucket\_entries* Number of entries per bucket (e.g. hash associativity). Should be power of two. \
 *max\_entries* Maximum number of entries that could be stored in the table. The value should be less or equal then bucket\_num \* bucket\_entries. \
 *max\_cycles* Maximum TTL in cycles for each fragmented packet. \
 *socket\_id* The *socket\_id* argument is the socket identifier in the case of NUMA. The value can be *SOCKET\_ID\_ANY* if there is no NUMA constraints.

**Returns**

The pointer to the new allocated fragmentation table, on success. NULL on error.

### void rte\_ip\_frag\_table\_destroy (struct rte\_ip\_frag\_tbl \* tbl)

Free allocated IP fragmentation table.

**Parameters**

*tbl* Fragmentation table to free.

### int32\_t rte\_ipv6\_fragment\_packet (struct rte\_mbuf \* pkt\_in, struct rte\_mbuf \*\* pkts\_out, uint16\_t nb\_pkts\_out, uint16\_t mtu\_size, struct rte\_mempool \* pool\_direct, struct rte\_mempool \* pool\_indirect)

This function implements the fragmentation of IPv6 packets.

**Parameters**

*pkt\_in* The input packet. \
 *pkts\_out* Array storing the output fragments. \
 *nb\_pkts\_out* Number of fragments. \
 *mtu\_size* Size in bytes of the Maximum Transfer Unit (MTU) for the outgoing IPv6 datagrams. This value includes the size of the IPv6 header. \
 *pool\_direct* MBUF pool used for allocating direct buffers for the output fragments. \
 *pool\_indirect* MBUF pool used for allocating indirect buffers for the output fragments.

**Returns**

Upon successful completion - number of output fragments placed in the pkts\_out array. Otherwise - (-1) \* errno.

### struct rte\_mbuf \* rte\_ipv6\_frag\_reassemble\_packet (struct rte\_ip\_frag\_tbl \* tbl, struct rte\_ip\_frag\_death\_row \* dr, struct rte\_mbuf \* mb, uint64\_t tms, struct rte\_ipv6\_hdr \* ip\_hdr, struct rte\_ipv6\_fragment\_ext \* frag\_hdr)

This function implements reassembly of fragmented IPv6 packets. Incoming mbuf should have its l2\_len/l3\_len fields setup correctly.

**Parameters**

*tbl* Table where to lookup/add the fragmented packet. \
 *dr* Death row to free buffers to \
 *mb* Incoming mbuf with IPv6 fragment. \
 *tms* Fragment arrival timestamp. \
 *ip\_hdr* Pointer to the IPv6 header. \
 *frag\_hdr* Pointer to the IPv6 fragment extension header.

**Returns**

Pointer to mbuf for reassembled packet, or NULL if:

- •

  an error occurred.

- •

  not all fragments of the packet are collected yet.

### static struct rte\_ipv6\_fragment\_ext \* rte\_ipv6\_frag\_get\_ipv6\_fragment\_header (struct rte\_ipv6\_hdr \* hdr)` [inline]`, ` [static]`

Return a pointer to the packet's fragment header, if found. It only looks at the extension header that's right after the fixed IPv6 header, and doesn't follow the whole chain of extension headers.

**Parameters**

*hdr* Pointer to the IPv6 header.

**Returns**

Pointer to the IPv6 fragment extension header, or NULL if it's not present.

Definition at line **143** of file **rte\_ip\_frag.h**.

### int32\_t rte\_ipv4\_fragment\_packet (struct rte\_mbuf \* pkt\_in, struct rte\_mbuf \*\* pkts\_out, uint16\_t nb\_pkts\_out, uint16\_t mtu\_size, struct rte\_mempool \* pool\_direct, struct rte\_mempool \* pool\_indirect)

IPv4 fragmentation.

This function implements the fragmentation of IPv4 packets.

**Parameters**

*pkt\_in* The input packet. \
 *pkts\_out* Array storing the output fragments. \
 *nb\_pkts\_out* Number of fragments. \
 *mtu\_size* Size in bytes of the Maximum Transfer Unit (MTU) for the outgoing IPv4 datagrams. This value includes the size of the IPv4 header. \
 *pool\_direct* MBUF pool used for allocating direct buffers for the output fragments. \
 *pool\_indirect* MBUF pool used for allocating indirect buffers for the output fragments.

**Returns**

Upon successful completion - number of output fragments placed in the pkts\_out array. Otherwise - (-1) \* errno.

### int32\_t rte\_ipv4\_fragment\_copy\_nonseg\_packet (struct rte\_mbuf \* pkt\_in, struct rte\_mbuf \*\* pkts\_out, uint16\_t nb\_pkts\_out, uint16\_t mtu\_size, struct rte\_mempool \* pool\_direct)

IPv4 fragmentation by copy.

This function implements the fragmentation of IPv4 packets by copy non-segmented mbuf. This function is mainly used to adapt Tx MBUF\_FAST\_FREE offload. MBUF\_FAST\_FREE: Device supports optimization for fast release of mbufs. When set, application must guarantee that per-queue all mbufs comes from the same mempool, has refcnt = 1, direct and non-segmented.

**Parameters**

*pkt\_in* The input packet. \
 *pkts\_out* Array storing the output fragments. \
 *nb\_pkts\_out* Number of fragments. \
 *mtu\_size* Size in bytes of the Maximum Transfer Unit (MTU) for the outgoing IPv4 datagrams. This value includes the size of the IPv4 header. \
 *pool\_direct* MBUF pool used for allocating direct buffers for the output fragments.

**Returns**

Upon successful completion - number of output fragments placed in the pkts\_out array. Otherwise - (-1) \* errno.

### struct rte\_mbuf \* rte\_ipv4\_frag\_reassemble\_packet (struct rte\_ip\_frag\_tbl \* tbl, struct rte\_ip\_frag\_death\_row \* dr, struct rte\_mbuf \* mb, uint64\_t tms, struct rte\_ipv4\_hdr \* ip\_hdr)

This function implements reassembly of fragmented IPv4 packets. Incoming mbufs should have its l2\_len/l3\_len fields setup correctly.

**Parameters**

*tbl* Table where to lookup/add the fragmented packet. \
 *dr* Death row to free buffers to \
 *mb* Incoming mbuf with IPv4 fragment. \
 *tms* Fragment arrival timestamp. \
 *ip\_hdr* Pointer to the IPV4 header inside the fragment.

**Returns**

Pointer to mbuf for reassembled packet, or NULL if:

- •

  an error occurred.

- •

  not all fragments of the packet are collected yet.

### static int rte\_ipv4\_frag\_pkt\_is\_fragmented (const struct rte\_ipv4\_hdr \* hdr)` [inline]`, ` [static]`

Check if the IPv4 packet is fragmented

**Parameters**

*hdr* IPv4 header of the packet

**Returns**

1 if fragmented, 0 if not fragmented

Definition at line **246** of file **rte\_ip\_frag.h**.

### void rte\_ip\_frag\_free\_death\_row (struct rte\_ip\_frag\_death\_row \* dr, uint32\_t prefetch)

Free mbufs on a given death row.

**Parameters**

*dr* Death row to free mbufs in. \
 *prefetch* How many buffers to prefetch before freeing.

### void rte\_ip\_frag\_table\_statistics\_dump (FILE \* f, const struct rte\_ip\_frag\_tbl \* tbl)

Dump fragmentation table statistics to file.

**Parameters**

*f* File to dump statistics to \
 *tbl* Fragmentation table to dump statistics from

### void rte\_ip\_frag\_table\_del\_expired\_entries (struct rte\_ip\_frag\_tbl \* tbl, struct rte\_ip\_frag\_death\_row \* dr, uint64\_t tms)

Delete expired fragments

**Parameters**

*tbl* Table to delete expired fragments from \
 *dr* Death row to free buffers to \
 *tms* Current timestamp

## Author

Generated automatically by Doxygen for DPDK from the source code.
