Skip to content

bpftool: Add 'prepend' option for tcx attach to insert at chain start#10683

Closed
kernel-patches-daemon-bpf[bot] wants to merge 2 commits intobpf-next_basefrom
series/1040988=>bpf-next
Closed

bpftool: Add 'prepend' option for tcx attach to insert at chain start#10683
kernel-patches-daemon-bpf[bot] wants to merge 2 commits intobpf-next_basefrom
series/1040988=>bpf-next

Conversation

@kernel-patches-daemon-bpf
Copy link
Copy Markdown

Pull request for series with
subject: bpftool: Add 'prepend' option for tcx attach to insert at chain start
version: 4
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 5714ca8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 9c1a352
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 9c1a352
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 7af3339
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: da4ab5d
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: c9c9f6b
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: b9da173
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: bbdbed1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 46c7676
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: e3d0dbb
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 9a403a4
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 934d974
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 2acbd05
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

Add support for the 'prepend' option when attaching tcx_ingress and
tcx_egress programs. This option allows inserting a BPF program at
the beginning of the TCX chain instead of appending it at the end.

The implementation uses BPF_F_BEFORE flag which automatically inserts
the program at the beginning of the chain when no relative reference
is specified.

This change includes:
- Modify do_attach_tcx() to support prepend insertion using BPF_F_BEFORE
- Update documentation to describe the new 'prepend' option
- Add bash completion support for the 'prepend' option on tcx attach types
- Add example usage in the documentation
- Add validation to reject 'overwrite' for non-XDP attach types

The 'prepend' option is only valid for tcx_ingress and tcx_egress attach
types. For XDP attach types, the existing 'overwrite' option remains
available.

Example usage:
  # bpftool net attach tcx_ingress name tc_prog dev lo prepend

This feature is useful when the order of program execution in the TCX
chain matters and users need to ensure certain programs run first.

Co-developed-by: Siwan Kim <siwan.kim@navercorp.com>
Signed-off-by: Siwan Kim <siwan.kim@navercorp.com>
Signed-off-by: Gyutae Bae <gyutae.bae@navercorp.com>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 1700147
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988
version: 4

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1040988 irrelevant now. Closing PR.

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf Bot deleted the series/1040988=>bpf-next branch January 16, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant