Thread View: org.kernel.vger.xdp-newbies
1 messages
1 total messages
Started by Ye Zhengnan
Wed, 07 May 2025 11:52
[RFC] xdp: Multi-Return Value Support For XDP
Author: Ye Zhengnan
Date: Wed, 07 May 2025 11:52
Date: Wed, 07 May 2025 11:52
56 lines
6163 bytes
6163 bytes
Hi all,
I'm proposing support for multiple return values in XDP programs to
enable combined actions like XDP_TX/XDP_REDIRECT with XDP_PASS. Please
review this design proposal and share your feedback.
== Motivation ==
Current mutually exclusive return values prevent scenarios like:
- Fast forwarding (XDP_TX/XDP_REDIRECT) and ack by kernel network
stack (XDP_PASS)
- Traffic balancing while maintaining normal processing
== Design Proposal ==
Option 1: True Tail Call Implementation
For Generic XDP:
1. Parent XDP program:
- Specify child XDP program using new helper functions
- Return combined flags such as XDP_CALL | XDP_TX
2. In net/core/dev.c:
- After XDP_TX or XDP_REDIRECT, check XDP_CALL flag
* Get child XDP program via bpf_tail_call
* Goto netif_receive_generic_xdp()
- Before bpf_net_ctx_set(), two approaches:
a. Synchronous: ensure skb not recycled, run child XDP program
b. Cloning: copy skb before driver uses it
For Native XDP:
- Synchronization cost of TX operation is unclear
- Cloning skb may be necessary
- Offload XDP support is not considered for now
Challenges:
- Conflicting packet modifications between parent/child programs
- Potential need for packet cloning (performance impact)
- Safe skb management when combining actions
Option 2: bpf_clone_redirect() for XDP
- Clone skb before return via bpf_clone_redirect()
- Send cloned skb to ingress path via backlog
- Prepare child XDP on target networker
Current Limitations:
- Redirect to ingress path not fully supported
- Memory copy overhead in XDP fast path
I'm new to Linux kernel development and would greatly appreciate
any feedback, suggestions, or corrections regarding this proposal or
the process.
Thank you for your time and consideration.
Best regards
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads