BPF List
 help / color / mirror / Atom feed
From: Amery Hung <ameryhung@gmail.com>
To: netdev@vger.kernel.org
Cc: bpf@vger.kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	alexei.starovoitov@gmail.com, martin.lau@kernel.org,
	kuba@kernel.org, edumazet@google.com, xiyou.wangcong@gmail.com,
	jhs@mojatatu.com, sinquersw@gmail.com, toke@redhat.com,
	juntong.deng@outlook.com, jiri@resnulli.us, stfomichev@gmail.com,
	ekarani.silvestre@ccc.ufcg.edu.br, yangpeihao@sjtu.edu.cn,
	yepeilin.cs@gmail.com, ameryhung@gmail.com, kernel-team@meta.com
Subject: [PATCH bpf-next v6 02/11] bpf: Prepare to reuse get_ctx_arg_idx
Date: Wed, 19 Mar 2025 14:53:49 -0700	[thread overview]
Message-ID: <20250319215358.2287371-3-ameryhung@gmail.com> (raw)
In-Reply-To: <20250319215358.2287371-1-ameryhung@gmail.com>

Rename get_ctx_arg_idx to bpf_ctx_arg_idx, and allow others to call it.
No functional change.

Signed-off-by: Amery Hung <ameryhung@gmail.com>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
 include/linux/btf.h | 1 +
 kernel/bpf/btf.c    | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/btf.h b/include/linux/btf.h
index ebc0c0c9b944..b2983706292f 100644
--- a/include/linux/btf.h
+++ b/include/linux/btf.h
@@ -522,6 +522,7 @@ bool btf_param_match_suffix(const struct btf *btf,
 			    const char *suffix);
 int btf_ctx_arg_offset(const struct btf *btf, const struct btf_type *func_proto,
 		       u32 arg_no);
+u32 btf_ctx_arg_idx(struct btf *btf, const struct btf_type *func_proto, int off);
 
 struct bpf_verifier_log;
 
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 519e3f5e9c10..9a4920828c30 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -6369,8 +6369,8 @@ static bool is_int_ptr(struct btf *btf, const struct btf_type *t)
 	return btf_type_is_int(t);
 }
 
-static u32 get_ctx_arg_idx(struct btf *btf, const struct btf_type *func_proto,
-			   int off)
+u32 btf_ctx_arg_idx(struct btf *btf, const struct btf_type *func_proto,
+		    int off)
 {
 	const struct btf_param *args;
 	const struct btf_type *t;
@@ -6649,7 +6649,7 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type,
 			tname, off);
 		return false;
 	}
-	arg = get_ctx_arg_idx(btf, t, off);
+	arg = btf_ctx_arg_idx(btf, t, off);
 	args = (const struct btf_param *)(t + 1);
 	/* if (t == NULL) Fall back to default BPF prog with
 	 * MAX_BPF_FUNC_REG_ARGS u64 arguments.
-- 
2.47.1


  parent reply	other threads:[~2025-03-19 21:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19 21:53 [PATCH bpf-next v6 00/11] bpf qdisc Amery Hung
2025-03-19 21:53 ` [PATCH bpf-next v6 01/11] bpf: Add struct_ops context information to struct bpf_prog_aux Amery Hung
2025-03-21  0:10   ` Martin KaFai Lau
2025-03-19 21:53 ` Amery Hung [this message]
2025-03-19 21:53 ` [PATCH bpf-next v6 03/11] bpf: net_sched: Support implementation of Qdisc_ops in bpf Amery Hung
2025-03-19 21:53 ` [PATCH bpf-next v6 04/11] bpf: net_sched: Add basic bpf qdisc kfuncs Amery Hung
2025-03-19 21:53 ` [PATCH bpf-next v6 05/11] bpf: net_sched: Add a qdisc watchdog timer Amery Hung
2025-03-19 21:53 ` [PATCH bpf-next v6 06/11] bpf: net_sched: Support updating bstats Amery Hung
2025-03-19 21:53 ` [PATCH bpf-next v6 07/11] bpf: net_sched: Disable attaching bpf qdisc to non root Amery Hung
2025-03-19 21:53 ` [PATCH bpf-next v6 08/11] libbpf: Support creating and destroying qdisc Amery Hung
2025-03-19 21:53 ` [PATCH bpf-next v6 09/11] selftests/bpf: Add a basic fifo qdisc test Amery Hung
2025-03-19 21:53 ` [PATCH bpf-next v6 10/11] selftests/bpf: Add a bpf fq qdisc to selftest Amery Hung
2025-03-19 21:53 ` [PATCH bpf-next v6 11/11] selftests/bpf: Test attaching bpf qdisc to mq and non root Amery Hung
2025-03-21  0:10 ` [PATCH bpf-next v6 00/11] bpf qdisc patchwork-bot+netdevbpf

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=20250319215358.2287371-3-ameryhung@gmail.com \
    --to=ameryhung@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=edumazet@google.com \
    --cc=ekarani.silvestre@ccc.ufcg.edu.br \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=juntong.deng@outlook.com \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sinquersw@gmail.com \
    --cc=stfomichev@gmail.com \
    --cc=toke@redhat.com \
    --cc=xiyou.wangcong@gmail.com \
    --cc=yangpeihao@sjtu.edu.cn \
    --cc=yepeilin.cs@gmail.com \
    /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