-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpf: Netdev TX metadata #5243
Closed
Closed
bpf: Netdev TX metadata #5243
Conversation
This file contains 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
No functional changes. To make existing dev-bound infrastructure more generic and be less tightly bound to the xdp layer, rename some functions and move kfunc-related things into kernel/bpf/offload.c Cc: netdev@vger.kernel.org Signed-off-by: Stanislav Fomichev <sdf@google.com>
It is impossible to use skb_frag_t in the tracing program. So let's resolve a single typedef when walking the struct. Cc: netdev@vger.kernel.org Signed-off-by: Stanislav Fomichev <sdf@google.com>
For zerocopy mode, tx_desc->addr can point to the arbitrary offset and carry some TX metadata in the headroom. For copy mode, there is no way currently to populate skb metadata. Introduce new XDP_TX_METADATA_LEN that indicates how many bytes to treat as metadata. Metadata bytes come prior to tx_desc address (same as in RX case). Signed-off-by: Stanislav Fomichev <sdf@google.com>
devtx is a lightweight set of hooks before and after packet transmission. The hook is supposed to work for both skb and xdp paths by exposing a light-weight packet wrapper via devtx_frame (header portion + frags). devtx is implemented as a tracing program which has access to the XDP-metadata-like kfuncs. The initial set of kfuncs is implemented in the next patch, but the idea is similar to XDP metadata: the kfuncs have netdev-specific implementation, but common interface. Upon loading, the kfuncs are resolved to direct calls against per-netdev implementation. This can be achieved by marking devtx-tracing programs as dev-bound (largely reusing xdp-dev-bound program infrastructure). Cc: netdev@vger.kernel.org Signed-off-by: Stanislav Fomichev <sdf@google.com>
Two kfuncs, one per hook point: 1. at submit time - bpf_devtx_sb_request_timestamp - to request HW to put TX timestamp into TX completion descriptors 2. at completion time - bpf_devtx_cp_timestamp - to read out TX timestamp Cc: netdev@vger.kernel.org Signed-off-by: Stanislav Fomichev <sdf@google.com>
Have a software-based example for kfuncs to showcase how it can be used in the real devices and to have something to test against in the selftests. Both path (skb & xdp) are covered. Only the skb path is really tested though. Cc: netdev@vger.kernel.org Signed-off-by: Stanislav Fomichev <sdf@google.com>
Add new config field and call setsockopt. Signed-off-by: Stanislav Fomichev <sdf@google.com>
Will be used by the subsequent selftests. Signed-off-by: Stanislav Fomichev <sdf@google.com>
Attach kfuncs that request and report TX timestamp via ringbuf. Confirm on the userspace side that the program has triggered and the timestamp is non-zero. Also make sure devtx_frame has a sensible pointers and data. Cc: netdev@vger.kernel.org Signed-off-by: Stanislav Fomichev <sdf@google.com>
When we get packets on port 9091, we swap src/dst and send it out. At this point, we also request the timestamp and plumb it back to the userspace. The userspace simply prints the timestamp. Haven't really tested, still working on mlx5 patches... Cc: netdev@vger.kernel.org Signed-off-by: Stanislav Fomichev <sdf@google.com>
WIP, not tested, only to show the overall idea. Non-AF_XDP paths are marked with 'false' for now. Cc: netdev@vger.kernel.org Signed-off-by: Stanislav Fomichev <sdf@google.com>
Upstream branch: 970308a |
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=759225 expired. Closing PR. |
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: bpf: Netdev TX metadata
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=759225