Skip to content

Commit dabb8bf

Browse files
committed
Fix imports for BPF_GET_SMP_PROCESSOR_ID
1 parent 19deded commit dabb8bf

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pythonbpf/helper/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
probe_read_str,
1010
random,
1111
probe_read,
12+
smp_processor_id,
1213
XDP_DROP,
1314
XDP_PASS,
1415
)
@@ -77,6 +78,7 @@ def helper_call_handler(
7778
"probe_read_str",
7879
"random",
7980
"probe_read",
81+
"smp_processor_id",
8082
"XDP_DROP",
8183
"XDP_PASS",
8284
]

pythonbpf/helper/helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ def probe_read(dst, size, src):
3737
return ctypes.c_int64(0)
3838

3939

40+
def smp_processor_id():
41+
"""get the current CPU id"""
42+
return ctypes.c_int32(0)
43+
44+
4045
XDP_ABORTED = ctypes.c_int64(0)
4146
XDP_DROP = ctypes.c_int64(1)
4247
XDP_PASS = ctypes.c_int64(2)

0 commit comments

Comments
 (0)