Skip to main content

RawTracePointRunOptions

Struct RawTracePointRunOptions 

Source
pub struct RawTracePointRunOptions {
    pub args: [u64; 12],
    pub cpu: Option<u32>,
}
Expand description

Options for running a RawTracePoint program test via BPF_PROG_TEST_RUN.

The kernel’s bpf_prog_test_run_raw_tp handler (v5.10, commit b84e6faeed1) is far more restrictive than the skb/XDP path:

  • data_in, data_out, ctx_out, repeat, batch_size must all be zero/NULL; passing any of them returns EINVAL.
  • ctx_in is the only data path: a packed array of u64 tracepoint arguments.
  • CPU pinning via BPF_F_TEST_RUN_ON_CPU is supported and is the primary reason to use BPF_PROG_TEST_RUN with raw tracepoints.

This struct deliberately omits the forbidden fields so misuse is a compile-time error rather than a runtime EINVAL.

Fields§

§args: [u64; 12]

Fake tracepoint arguments, up to 12 u64 values.

Each element corresponds to one tracepoint argument in order. The kernel copies the entire array into ctx_in before calling the program, which reads them via ctx.arg(n). Unused slots default to zero.

The array size of 12 matches the kernel’s maximum: the longest tracepoint in the kernel takes 12 arguments. See net/bpf/test_run.c.

§cpu: Option<u32>

If Some(cpu), pin execution to that CPU via BPF_F_TEST_RUN_ON_CPU.

The only flag the kernel accepts for raw tracepoints; batch_size and all other TestRunAttrs knobs return EINVAL.

Implementations§

Source§

impl RawTracePointRunOptions

Source

pub const fn new() -> Self

Creates a new RawTracePointRunOptions with all arguments zeroed.

Trait Implementations§

Source§

impl Debug for RawTracePointRunOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RawTracePointRunOptions

Source§

fn default() -> RawTracePointRunOptions

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.