From dabb8bf0df0779f433998eed2e993cd05391b31e Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Sat, 1 Nov 2025 14:07:47 +0530 Subject: [PATCH] Fix imports for BPF_GET_SMP_PROCESSOR_ID --- pythonbpf/helper/__init__.py | 2 ++ pythonbpf/helper/helpers.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/pythonbpf/helper/__init__.py b/pythonbpf/helper/__init__.py index 1bfa7ac..ee07d5a 100644 --- a/pythonbpf/helper/__init__.py +++ b/pythonbpf/helper/__init__.py @@ -9,6 +9,7 @@ from .helpers import ( probe_read_str, random, probe_read, + smp_processor_id, XDP_DROP, XDP_PASS, ) @@ -77,6 +78,7 @@ __all__ = [ "probe_read_str", "random", "probe_read", + "smp_processor_id", "XDP_DROP", "XDP_PASS", ] diff --git a/pythonbpf/helper/helpers.py b/pythonbpf/helper/helpers.py index 440d311..6bed131 100644 --- a/pythonbpf/helper/helpers.py +++ b/pythonbpf/helper/helpers.py @@ -37,6 +37,11 @@ def probe_read(dst, size, src): return ctypes.c_int64(0) +def smp_processor_id(): + """get the current CPU id""" + return ctypes.c_int32(0) + + XDP_ABORTED = ctypes.c_int64(0) XDP_DROP = ctypes.c_int64(1) XDP_PASS = ctypes.c_int64(2)