xdp: Allow BPF to set RX hints for XDP_REDIRECTed packets#9245
Closed
kernel-patches-daemon-bpf[bot] wants to merge 7 commits intobpf-next_basefrom
Closed
xdp: Allow BPF to set RX hints for XDP_REDIRECTed packets#9245kernel-patches-daemon-bpf[bot] wants to merge 7 commits intobpf-next_basefrom
kernel-patches-daemon-bpf[bot] wants to merge 7 commits intobpf-next_basefrom
Conversation
Author
|
Upstream branch: 621af19 |
d0d73c5 to
6fbb3d3
Compare
Author
|
Upstream branch: 564606f |
9c9278b to
a8ff4aa
Compare
6fbb3d3 to
08dbf36
Compare
Author
|
Upstream branch: 38d95be |
a8ff4aa to
ca4dc27
Compare
08dbf36 to
cc01c15
Compare
Introduce the `xdp_rx_meta` structure to serve as a container for XDP RX
hardware hints within XDP packet buffers. Initially, this structure will
accommodate `rx_hash` and `rx_vlan` metadata. (The `rx_timestamp` hint will
get stored in `skb_shared_info`).
A key design aspect is making this metadata accessible both during BPF
program execution (via `struct xdp_buff`) and later if an `struct
xdp_frame` is materialized (e.g., for XDP_REDIRECT).
To achieve this:
- The `struct xdp_frame` embeds an `xdp_rx_meta` field directly for
storage.
- The `struct xdp_buff` includes an `xdp_rx_meta` pointer. This pointer
is initialized (in `xdp_prepare_buff`) to point to the memory location
within the packet buffer's headroom where the `xdp_frame`'s embedded
`rx_meta` field would reside.
This setup allows BPF kfuncs, operating on `xdp_buff`, to populate the
metadata in the precise location where it will be found if an `xdp_frame`
is subsequently created.
The availability of this metadata storage area within the buffer is
indicated by the `XDP_FLAGS_META_AREA` flag in `xdp_buff->flags` (and
propagated to `xdp_frame->flags`). This flag is only set if sufficient
headroom (at least `XDP_MIN_HEADROOM`, currently 192 bytes) is present.
Specific hints like `XDP_FLAGS_META_RX_HASH` and `XDP_FLAGS_META_RX_VLAN`
will then denote which types of metadata have been populated into the
`xdp_rx_meta` structure.
This patch is a step for enabling the preservation and use of XDP RX
hints across operations like XDP_REDIRECT.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org>
Patchset increased xdp_buff with a pointer 8 bytes, and the bpf/test_run struct xdp_page_head have two xdp_buff's. Thus adjust test with 16 bytes. Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org>
Introduce the following kfuncs to store hw metadata provided by the NIC into the xdp_buff struct: - rx-hash: bpf_xdp_store_rx_hash - rx-vlan: bpf_xdp_store_rx_vlan - rx-hw-ts: bpf_xdp_store_rx_ts Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org>
Update the following hw metadata provided by the NIC building the skb from a xdp_frame. - rx hash - rx vlan - rx hw-ts Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Report xdp_rx_meta info if available in xdp_buff struct in xdp_metadata_ops callbacks for veth driver Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Introduce bpf selftests for the XDP rx_meta store kfuncs. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Author
|
Upstream branch: 38d95be |
Update the documentation[1] based on the changes in this patchset. [1] https://docs.kernel.org/networking/xdp-rx-metadata.html Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org>
ca4dc27 to
e8e6878
Compare
Author
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=978263 expired. Closing PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: xdp: Allow BPF to set RX hints for XDP_REDIRECTed packets
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=978263