-
Notifications
You must be signed in to change notification settings - Fork 97
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 #5207
Closed
Closed
bpf: netdev TX metadata #5207
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>
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). Attachment and detachment is implemented via syscall BPF program by calling bpf_devtx_sb_attach (attach to tx-submission) or bpf_devtx_cp_attach (attach to tx completion). Right now, the attachment does not return a link and doesn't support multiple programs. I plan to switch to Daniel's bpf_mprog infra once it's available. 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-base 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>
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>
Upstream branch: ba49f97 |
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=756388 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: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=756388