diff --git a/backport-libbpf-Add-bpf_cpumask_op-API-to-support-prefered-cp.patch b/backport-libbpf-Add-bpf_cpumask_op-API-to-support-prefered-cp.patch new file mode 100644 index 0000000000000000000000000000000000000000..b1a0081bd336a087c8d8cccba3756c2aa12b6f28 --- /dev/null +++ b/backport-libbpf-Add-bpf_cpumask_op-API-to-support-prefered-cp.patch @@ -0,0 +1,70 @@ +From 0068e572ca766f3e93c8382802602f12412ffb05 Mon Sep 17 00:00:00 2001 +From: tianmuyang +Date: Sat, 13 Sep 2025 18:27:55 +0800 +Subject: [PATCH] libbpf: Add bpf_cpumask_op API to support prefered cpu + control in eBPF program + +Signed-off-by: tianmuyang +--- + src/bpf_helper_defs.h | 45 +++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 45 insertions(+) + +diff --git a/src/bpf_helper_defs.h b/src/bpf_helper_defs.h +index 05729b3..576cecb 100644 +--- a/src/bpf_helper_defs.h ++++ b/src/bpf_helper_defs.h +@@ -3679,6 +3679,51 @@ static __u64 (*bpf_get_sockops_uid_gid)(void *sockops) = (void *) 156; + */ + static int (*bpf_sk_original_addr)(void *bpf_socket, int optname, char *optval, int optlen) = (void *) 157; + ++/* ++ * bpf_cpumask_op(struct cpumask_op_args *op, int len) ++ * Description ++ * A series of cpumask-related operations. Perform different ++ * operations base on *op*->type. User also need fill other ++ * *op* field base on *op*->type. *op*->type is one of them ++ * ++ * **CPUMASK_EMPTY** ++ * *(op->arg1) == 0 returned. ++ * **CPUMASK_AND** ++ * *(op->arg1) = *(op->arg2) & *(op->arg3) ++ * **CPUMASK_ANDNOT** ++ * *(op->arg1) = *(op->arg2) & ~*(op->arg3) ++ * **CPUMASK_SUBSET** ++ * *(op->arg1) & ~*(op->arg2) == 0 returned ++ * **CPUMASK_EQUAL** ++ * *(op->arg1) == *(op->arg2) returned ++ * **CPUMASK_TEST_CPU** ++ * test for a cpu *(int)(op->arg1) in *(op->arg2) ++ * returns 1 if *op*->arg1 is set in *op*->arg2, else returns 0 ++ * **CPUMASK_COPY** ++ * *(op->arg1) = *(op->arg2), return 0 always ++ * **CPUMASK_WEIGHT** ++ * count of bits in *(op->arg1) ++ * **CPUMASK_NEXT** ++ * get the next cpu in *(struct cpumask *)(op->arg2) ++ * *(int *)(op->arg1): the cpu prior to the place to search ++ * **CPUMASK_NEXT_WRAP** ++ * helper to implement for_each_cpu_wrap ++ * @op->arg1: the cpu prior to the place to search ++ * @op->arg2: the cpumask pointer ++ * @op->arg3: the start point of the iteration ++ * @op->arg4: assume @op->arg1 crossing @op->arg3 terminates the iteration ++ * returns >= nr_cpu_ids on completion ++ * **CPUMASK_NEXT_AND** ++ * get the next cpu in *(op->arg1) & *(op->arg2) ++ * **CPUMASK_CPULIST_PARSE** ++ * extract a cpumask from a user string of ranges. ++ * (char *)op->arg1 -> (struct cpumask *)(op->arg2) ++ * 0 on success, or a negative error in case of failure. ++ * Return ++ * View above. ++ */ ++static int (*bpf_cpumask_op)(struct cpumask_op_args *op, int len) = (void *) 168; ++ + /* + * bpf_nodemask_op + * +-- +2.33.0 + diff --git a/libbpf.spec b/libbpf.spec index 8453abcdba372dcbb2a44c409fc248f70a5e9108..11a3ab7527c828ae0f4c2989237e44ff192db343 100644 --- a/libbpf.spec +++ b/libbpf.spec @@ -4,7 +4,7 @@ Name: %{githubname} Version: %{githubver} -Release: 20 +Release: 21 Summary: Libbpf library License: LGPLv2 or BSD @@ -58,6 +58,7 @@ Patch0041: backport-libbpf-Adaption-for-sched-type-eBPF-program.patch Patch0042: backport-libbpf-Fix-out-of-bound-read.patch Patch0043: backport-libbpf-fix-LDX_STX_ST-CO-RE-relocation-size-adjustment-logic.patch Patch0044: backport-libbpf-Fix-hypothetical-STT_SECTION-extern-NULL-deref-case.patch +Patch0045: backport-libbpf-Add-bpf_cpumask_op-API-to-support-prefered-cp.patch # This package supersedes libbpf from kernel-tools, # which has default Epoch: 0. By having Epoch: 1 @@ -110,6 +111,10 @@ developing applications that use %{name} %{_libdir}/libbpf.a %changelog +* Sat Sep 13 2025 tianmuyang 2:0.8.1-21 +- Add bpf_cpumask_op API to support prefered cpu control in eBPF program: + backport-libbpf-Add-bpf_cpumask_op-API-to-support-prefered-cp.patch + * Wed Jul 30 2025 andy 2:0.8.1-20 - backport patch from upstream: backport-libbpf-Fix-out-of-bound-read.patch