XDP_EXTENSION structure
February 3, 2026 ยท View on GitHub
A structure defining an XDP data path extension.
Syntax
//
// Structure defining an XDP data path extension.
//
typedef struct _XDP_EXTENSION {
//
// This field is reserved for XDP platform use.
//
UINT16 Reserved;
} XDP_EXTENSION;
Members
Reserved
A 16-bit field reserved for XDP platform use. This field contains the byte offset from the descriptor base to the extension data. Applications and drivers should not access this field directly; instead use the XdpGetExtensionData helper function or extension-specific getter functions.
Remarks
The XDP_EXTENSION structure serves as an opaque handle to an XDP descriptor extension. It is obtained by querying for a specific extension using XDP_EXTENSION_INFO via socket options (for AF_XDP applications) or driver APIs (for XDP drivers).
Usage Pattern
- Initialize extension info: Use
XdpInitializeExtensionInfoto create anXDP_EXTENSION_INFOstructure describing the desired extension - Query for extension: Register the extension with XskSetSockopt (AF_XDP) or driver APIs
- Retrieve extension handle: After binding/queue creation, query to get the populated
XDP_EXTENSIONstructure - Access extension data: Use
XdpGetExtensionData()or extension-specific helper functions likeXdpGetFragmentExtension()to access extension data for each descriptor
Thread Safety
Once obtained, an XDP_EXTENSION handle can be safely accessed from multiple threads concurrently as long as the associated queue/socket remains active. The extension offset is immutable after initialization.
Performance Considerations
Extension handles should be cached during initialization rather than queried per-packet. The small size (2 bytes) makes extension handles suitable for stack allocation or embedding in context structures.
For more information about the extension model, see Descriptor Extensions.