Python-BCC: support fmod_ret attaching method, and add a useful tool for mptcp#5274
Merged
Conversation
chenhengqi
reviewed
Apr 9, 2025
chenhengqi
reviewed
Apr 10, 2025
chenhengqi
reviewed
Apr 14, 2025
matttbe
reviewed
Apr 15, 2025
Contributor
Author
|
Hi @chenhengqi and @yonghong-song, It was truly delightful to receive your valuable suggestions regarding this pull request. I'm pleased to inform you that all the issues have now been addressed. Would you mind taking another look at it when you have a moment? Thank you so much! |
chenhengqi
reviewed
Apr 28, 2025
chenhengqi
reviewed
Apr 28, 2025
Followed by the suggestions of Hengqi, which judging the kernel whether supported 'fmod_ret' by using 'kernel_struct_has_field' to check the existence of enum 'BPF_MODIFY_RETURN'. But, the 'kernel_struct_has_filed' is not supported the 'enum' type, so this patch provides an interface 'kernel_enum_has_val' to achieve this. Co-developed-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Gang Yan <yangang@kylinos.cn>
In kernel, there exists a lot of 'fmod_ret' functions, such as 'update_socket_protocol'. But it cannot attached in BCC-python directly, so this patch provides an interface for python to use 'fmod_ret' attaching method. This patch is suggested by Yonghong: ''' On Sun, 2024-08-25 at 21:05 -0700, Yonghong Song wrote: ... > Gang Yan, could you explore to add fmod_ret support in bcc? It should > be similar to kfunc/kretfunc support. I am happy to review your patches. ''' And the method to check 'fmod_ret' support in kernel is from Hengqi. Co-developed-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Gang Yan <yangang@kylinos.cn>
Multipath TCP (MPTCP) is an extension of the standard TCP protocol that allows a single transport connection to use multiple network interfaces or paths. MPTCP is useful for applications like bandwidth aggregation, failover, and more resilient connections. Linux kernel starts to support MPTCP since v5.6, this patch provides a method which can easily force applications use MPTCP socket without modifing its code. Co-developed-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Gang Yan <yangang@kylinos.cn>
Contributor
Author
|
Hi, @chenhengqi , |
Collaborator
|
Just merged. The CI need to be fixed. Will investigate. |
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.
Multipath TCP (MPTCP) serves as an enhancement to the conventional TCP
protocol, enabling a single transport-layer connection to leverage
multiple network interfaces. This capability makes MPTCP advantageous
for applications requiring bandwidth consolidation, seamless failover
mechanisms, and more robust connectivity solutions.
Linux kernel starts to support MPTCP since v5.6, and it provides a
fmod_ret interface 'update_socket_protocol' to force applications using
MPTCP instead of TCP without modifyiing its code.
So these patches provide a tool named 'mptcpify' which can achieve this.
Using python-BCC is a more easy way for future development, so it is so
important to support 'fmod_ret' in python-BCC.
The first patch is suggested by Yonghong:
‘’‘
On Sun, 2024-08-25 at 21:05 -0700, Yonghong Song wrote:
...
> Gang Yan, could you explore to add fmod_ret support in bcc? It should
> be similar to kfunc/kretfunc support. I am happy to review your patches.
’‘’
when I try to make a commit to kernel. (Link attached below)
https://patchwork.kernel.org/project/netdevbpf/patch/tencent_1E619C9E44C8C4B2B713A0D6DD45B92BF70A@qq.com/
@matttbe from the MPTCP kernel team had a look at the new tool.