Skip to content

ixgbe: XDP via libie_xg (code sharing with ixgbevf) - #8

Open
walking-machine wants to merge 39 commits into
ixgbevf-xdp-publicfrom
libie-xgb-xdp-xsk
Open

ixgbe: XDP via libie_xg (code sharing with ixgbevf)#8
walking-machine wants to merge 39 commits into
ixgbevf-xdp-publicfrom
libie-xgb-xdp-xsk

Conversation

@walking-machine

Copy link
Copy Markdown
Owner

No description provided.

walking-machine and others added 30 commits July 27, 2026 13:45
Again, same as in the related iavf commit 920d86f ("iavf: drop page
splitting and recycling"), as an intermediate step, drop the page sharing
and recycling logic in a preparation to offload it to page_pool.

Instead of the previous sharing and recycling, just allocate a new page
every time.

Suggested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Use page_pool buffers by the means of libeth in the Rx queues, this
significantly reduces code complexity of the driver itself.

Suggested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Implement XDP support for received fragmented packets, this requires using
some helpers from libeth_xdp.

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Use libeth to support XDP_TX action for segmented packets.

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
To fully support XDP_REDIRECT, utilize more libeth helpers in XDP Rx path,
hence save cached_ntu in the ring structure instead of stack.

ixgbevf-supported VFs usually have few queues, so use libeth_xdpsq_lock
functionality for XDP queue sharing. Adjust filling-in of XDP Tx
descriptors to use data from xdp frame. Otherwise, simply use libeth
helpers to implement .ndo_xdp_xmit().

While at it, fix a typo in libeth docs.

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Introduce pseudo header split support in the ixgbevf driver, specifically
targeting ixgbe_mac_82599_vf.

On older hardware (e.g. ixgbe_mac_82599_vf), RX DMA write size can only be
limited in 1K increments. This causes issues when attempting to fit
multiple packets per page, as a DMA write may overwrite the
headroom of the next packet.

To address this, introduce pseudo header split support, where the hardware
copies the full L2 header into a dedicated header buffer. This avoids the
need for HR/TR alignment and allows safe skb construction from the header
buffer without risking overwrites.

Given that once packet is too big to fit into a single page, the behaviour
is the same for all supported HW, use pseudo header split only for smaller
packets.

Signed-off-by: Natalia Wochtman <natalia.wochtman@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Co-developed-by: Larysa Zaremba <larysa.zaremba@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Currently, when MTU is changed, page pool is not reconfigured, which leads
to usage of suboptimal buffer sizes.

Always destroy page pool when cleaning the ring up and create it anew when
we first allocate Rx buffers.

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
xskxceiver attempts to change MTU after attaching XDP program,
ixgbevf rejects the request leading to test being failed.

Support MTU change operation even when XDP program is already attached,
perform the same frame size check as when attaching a program.

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
AF_XDP ZC Rx path is also required to implement skb creation. Move all
common functions to a header file as inlines.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Implement xsk_buff_pool configuration and supporting functionality, such as
a single queue pair reconfiguration. Also, properly initialize Rx buffers.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Add code that handles Tx ZC queues inside of napi_poll(), utilize libeth.
As NIC's multiple buffer conventions do not play nicely with AF_XDP's,
leave handling of segments for later.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Add code that handles AF_XDP ZC Rx queues inside of napi_poll(), utilize
libeth helpers.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
To finalize basic AF_XDP implementation, set features and add
.ndo_xsk_wakeup() handler.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Transmitting multi-buffer AF_XDP packets is not very straightforward
given HW limitations in ixgbevf, namely that the first data descriptor
must contain the length of the whole packet.

Use private data of an sqe to store the length of an unfinished packet so
far and the first descriptor index. Once EoP zero-copy descriptor is
processed, write the accumulated length into the saved first descriptor.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Similarly, like for virtual function in ixgbevf, remove
ixgbe_construct_skb(), the legacy-rx private flag, and all
ring_uses_build_skb() conditionals. build_skb is now the
only RX code path.

This is a preparation for the conversion to libeth and page_pool
based Rx buffer management.

Signed-off-by: Magdalena Pytel <magdalena.pytel@intel.com>
Stop sharing pages between multiple Rx buffers. Convert ixgbe Rx path
from page-sharing/recycling to a simple one-page-per-packet model.
Remove logic that refers to page-sharing buffer management. This is a
preparatory step before converting the Rx path to page_pool
and libeth.

Fixed XDP_DROP/ABORTED: reaches ixgbe_put_rx_buffer() but page
is never freed.

Signed-off-by: Magdalena Pytel <magdalena.pytel@intel.com>
Convert ixgbe Rx path from manual page-per-packet DMA management
to libeth/page_pool infrastructure, and integrates libeth XDP helpers.
Each packet gets its own buffer instead of sharing pages between packets.

Signed-off-by: Magdalena Pytel <magdalena.pytel@intel.com>
* Added branch prediction hints to the ixgbe Rx path and clean up
the packet accounting.
* Moved total_rx_bytes and total_rx_packets accounting together.

Signed-off-by: Magdalena Pytel <magdalena.pytel@intel.com>
Implement XDP multi-buffer support for Rx fragmented packets
using libeth_xdp.

* Added MODULE_IMPORT_NS("LIBETH_XDP")
and #include <net/libeth/types.h>
* Replaced struct sk_buff *skb in ixgbe_ring with
struct libeth_xdp_buff_stash
 and ixgbe_clean_rx_ring skb cleanup with libeth_xdp_return_stash
* Removed ixgbe_add_rx_frag()
* Reorganized ixgbe_clean_rx_irq() and ixgbe_is_non_eop()
* Updated ixgbe_xdp_setup() to allow multi-buffer XDP programs
* Added NETDEV_XDP_ACT_RX_SG in xdp_features

Signed-off-by: Magdalena Pytel <magdalena.pytel@intel.com>
In order to share some generation-specific non-trivial XDP code between
ixgbevf and ixgbe, identify required ring fields and separate them into a
base ring structure.

Use the structure in a somewhat struct_group fashion, exposing a named
.base structure (for shared code to use) as well as direct field access in
a union (to not disturb the ancient code). But given that 2 different
structures will need to include the base, instead of struct_group, utilize
a relatively recently enabled -fms-extensions anonymous member structures
feature.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Some functions used in ixgbevf XDP_TX and AF_XDP ZC implementation are at
the same time non-trivial and trivially shareable with ixgbe. Move those
functions to a new libie_xg header and rename them accordingly.

Inline sharing was chosen, since a big chunk of those function are used in
datapath, and a hypothetical small module would introduce more memory
overhead than plain code duplication.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
…oduce and use libie_xg_ring"

This reverts commit a66f091.
Replace overlapping fields in ixgbe_ring with libie_xg_ring, included both
as anonymous and named structure. For now, add xdp_frame to the generic Tx
buffer, but it will be rendered unnecessary by further commits.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Wakeup is not necessarily tied to Tx processing, so Tx not being active is
not a reason to skip on Rx buffer refill. Also, some checks are redundant.

Rely on Rx rings to access the interrupt, and clear up the redundant code.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Introduce pseudo header split support in the ixgbe driver.

* Added IXGBE_RX_SRRCTL_BUF_SIZE macro and IXGBE_FLAG2_HSPLIT flag
* Added hdr_truesize, hdr_fqes, hdr_pp, hdr_buf_len to ixgbe_ring
* Added ixgbe_rx_hsplit_wa() to copy header from data to header buffer
* Added ixgbe_rx_create_pp()/ixgbe_rx_destroy_pp() helpers
* Updated ixgbe_alloc_rx_buffers to allocate header buffers
* Updated ixgbe_clean_rx_irq to process header split
* Refactored ixgbe_setup_rx_resources to use ixgbe_rx_create_pp
* Refactored ixgbe_free_rx_resources to use ixgbe_rx_destroy_pp
* Set IXGBE_FLAG2_HSPLIT for 82599 in ixgbe_sw_init
* Updated ixgbe_xdp_setup to require mbuf frags with hsplit

Signed-off-by: Magdalena Pytel <magdalena.pytel@intel.com>
Magda-Pytel and others added 9 commits August 19, 2026 13:07
* Moved page pool creation from ixgbe_setup_rx_resources() to
  ixgbe_configure_rx_ring()
* Moved page pool destruction to ixgbe_clean_all_rx_rings() and
  ixgbe_free_rx_resources()
* Added ixgbe_dma_dev_from_ring() helper to obtain DMA device without
  relying on page pool pointer.
* Handled XSK path in ixgbe_configure_rx_ring()

Signed-off-by: Magdalena Pytel <magdalena.pytel@intel.com>
Utilize libeth and libie_xg libraries to support segments in AF_XDP ZC
mode. Since Tx path supports frags, it does not need updating for now.

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
@walking-machine
walking-machine force-pushed the ixgbevf-xdp-public branch 2 times, most recently from 3e20491 to ef18019 Compare September 4, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants