MPTCP Linux Development
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Gang Yan <yangang@kylinos.cn>, mptcp@lists.linux.dev
Subject: Re: [Patch, v2, 1/2] BCC: Python: Support 'fmod_ret' method for eBPF
Date: Wed, 9 Apr 2025 10:26:23 +0200	[thread overview]
Message-ID: <1d6bceea-daae-49b5-918f-60df35b0791f@kernel.org> (raw)
In-Reply-To: <224f2b589ffd6e6f5aa42a213f5f6410c21f9dcf.1744182834.git.yangang@kylinos.cn>

Hi Gang,

On 09/04/2025 09:17, Gang Yan wrote:
> 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.
> 
> But there exists a question about how to check 'fmod_ret' support in
> kernel, do you have any suggestion? I already considered checking the
> kernel version which seems not suitable.
> 
> Signed-off-by: Gang Yan <yangang@kylinos.cn>
> ---
>  src/python/bcc/__init__.py | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/src/python/bcc/__init__.py b/src/python/bcc/__init__.py
> index 8bc85516..12ce3ef6 100644
> --- a/src/python/bcc/__init__.py
> +++ b/src/python/bcc/__init__.py

(...)

> @@ -1189,6 +1205,22 @@ class BPF(object):
>          self.kfunc_entry_fds[fn_name] = fd
>          return self
>  
> +    def attach_fmod_ret(self, fn_name=b""):
> +        fn_name = _assert_is_bytes(fn_name)
> +        fn_name = BPF.add_prefix(b"kmod_ret__", fn_name)
> +
> +        if fn_name in self.fmod_ret_fds:
> +            raise Exception("Fmod_ret func %s has been attached" % fn_name)
Detail: maybe clearer with this:

  "Fmod_ret func %s is already attached"

(...)

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


  reply	other threads:[~2025-04-09  8:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09  7:17 [Patch, v2, 0/2] BCC: python: support fmod_ret Gang Yan
2025-04-09  7:17 ` [Patch, v2, 1/2] BCC: Python: Support 'fmod_ret' method for eBPF Gang Yan
2025-04-09  8:26   ` Matthieu Baerts [this message]
2025-04-09  9:29     ` Gang Yan
2025-04-09  7:17 ` [Patch, v2, 2/2] BCC: python: add a useful tool for mptcp Gang Yan
2025-04-09  8:26   ` Matthieu Baerts
2025-04-09  8:26 ` [Patch, v2, 0/2] BCC: python: support fmod_ret Matthieu Baerts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1d6bceea-daae-49b5-918f-60df35b0791f@kernel.org \
    --to=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=yangang@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox