Преглед на файлове

aya: add minimum kernel version for each map and program type (#18)

Arnabjyoti Kalita преди 3 години
родител
ревизия
35f15f70e0

+ 4 - 0
aya/src/maps/array/array.rs

@@ -17,6 +17,10 @@ use crate::{
 /// The size of the array is defined on the eBPF side using the `bpf_map_def::max_entries` field.
 /// All the entries are zero-initialized when the map is created.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 3.19.
+///
 /// # Examples
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[], None)?;

+ 4 - 0
aya/src/maps/array/per_cpu_array.rs

@@ -17,6 +17,10 @@ use crate::{
 /// The size of the array is defined on the eBPF side using the `bpf_map_def::max_entries` field.
 /// All the entries are zero-initialized when the map is created.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.6.
+///
 /// # Examples
 /// ```no_run
 /// # #[derive(thiserror::Error, Debug)]

+ 4 - 0
aya/src/maps/array/program_array.rs

@@ -20,6 +20,10 @@ use crate::{
 /// prog_array, index)`. You can use [`ProgramArray`] to configure which
 /// programs correspond to which jump indexes.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.2.
+///
 /// # Examples
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[], None)?;

+ 4 - 0
aya/src/maps/hash_map/hash_map.rs

@@ -13,6 +13,10 @@ use crate::{
 
 /// A hash map that can be shared between eBPF programs and user space.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 3.19.
+///
 /// # Examples
 ///
 /// ```no_run

+ 4 - 0
aya/src/maps/hash_map/per_cpu_hash_map.rs

@@ -20,6 +20,10 @@ use crate::{
 /// This type can be used with eBPF maps of type `BPF_MAP_TYPE_PERCPU_HASH` and
 /// `BPF_MAP_TYPE_LRU_PERCPU_HASH`.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.6.
+///
 /// # Examples
 ///
 /// ```no_run

+ 4 - 0
aya/src/maps/perf/async_perf_event_array.rs

@@ -26,6 +26,10 @@ use crate::maps::{
 /// * call [`AsyncPerfEventArray::open`]
 /// * call [`AsyncPerfEventArrayBuffer::read_events`] to read the events
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.3.
+///
 /// # Examples
 ///
 /// ```no_run

+ 4 - 0
aya/src/maps/perf/perf_event_array.rs

@@ -76,6 +76,10 @@ impl<T: DerefMut<Target = Map>> AsRawFd for PerfEventArrayBuffer<T> {
 ///   inserted in the buffer
 /// * call [`PerfEventArrayBuffer::read_events`] to read the events
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.3.
+///
 /// # Examples
 ///
 /// A common way to use a perf array is to have one perf buffer for each

+ 4 - 0
aya/src/maps/queue.rs

@@ -15,6 +15,10 @@ use crate::{
 
 /// A FIFO queue.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.20.
+///
 /// # Examples
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[], None)?;

+ 4 - 0
aya/src/maps/sock/sock_hash.rs

@@ -23,6 +23,10 @@ use crate::{
 /// A `SockHash` can also be used to redirect packets to sockets contained by the
 /// map using `bpf_redirect_map()`, `bpf_sk_redirect_hash()` etc.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.18.
+///
 /// # Examples
 ///
 /// ```no_run

+ 4 - 0
aya/src/maps/sock/sock_map.rs

@@ -22,6 +22,10 @@ use crate::{
 /// A `SockMap` can also be used to redirect packets to sockets contained by the
 /// map using `bpf_redirect_map()`, `bpf_sk_redirect_map()` etc.    
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.14.
+///
 /// # Examples
 ///
 /// ```no_run

+ 4 - 0
aya/src/maps/stack.rs

@@ -15,6 +15,10 @@ use crate::{
 
 /// A LIFO stack.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.20.
+///
 /// # Examples
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[], None)?;

+ 5 - 1
aya/src/maps/stack_trace.rs

@@ -17,6 +17,10 @@ use crate::{
 /// useful for profiling, to associate a trace to an event, etc. You can capture traces calling
 /// `stack_id = bpf_get_stackid(ctx, map, flags)` from eBPF, and then you can retrieve the traces
 /// from their stack ids.
+///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.6.
 ///  
 /// # Examples
 ///
@@ -39,7 +43,7 @@ use crate::{
 /// // load kernel symbols from /proc/kallsyms
 /// let ksyms = kernel_symbols()?;
 ///
-/// // NOTE: you tipically send stack_ids from eBPF to user space using other maps
+/// // NOTE: you typically send stack_ids from eBPF to user space using other maps
 /// let stack_id = 1234;
 /// let mut stack_trace = stack_traces.get(&stack_id, 0)?;
 ///

+ 4 - 0
aya/src/programs/cgroup_skb.rs

@@ -19,6 +19,10 @@ use super::FdLink;
 ///
 /// [cgroup]: https://man7.org/linux/man-pages/man7/cgroups.7.html
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.10.
+///
 /// # Examples
 ///
 /// ```no_run

+ 4 - 0
aya/src/programs/kprobe.rs

@@ -20,6 +20,10 @@ use crate::{
 /// - `kprobe`: get attached to the *start* of the target functions
 /// - `kretprobe`: get attached to the *return address* of the target functions
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.1.
+///
 /// # Examples
 ///
 /// ```no_run

+ 4 - 0
aya/src/programs/lirc_mode2.rs

@@ -15,6 +15,10 @@ use libc::{close, dup};
 ///
 /// [lirc]: https://www.kernel.org/doc/html/latest/userspace-api/media/rc/lirc-dev.html
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.18.
+///
 /// # Examples
 ///
 /// ```no_run

+ 4 - 0
aya/src/programs/sk_msg.rs

@@ -11,6 +11,10 @@ use crate::{
 /// filter and redirect messages sent on sockets. See also [`SockMap`] and
 /// [`SockHash`].
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.17.
+///
 /// # Examples
 ///
 /// ```no_run

+ 4 - 0
aya/src/programs/sk_skb.rs

@@ -21,6 +21,10 @@ pub enum SkSkbKind {
 /// inspect, redirect or filter incoming packet. See also [`SockMap`] and
 /// [`SockHash`].
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.14.
+///
 /// # Examples
 ///
 /// ```no_run

+ 4 - 0
aya/src/programs/sock_ops.rs

@@ -12,6 +12,10 @@ use crate::{
 /// parameters, watch connection state changes and more. They are attached to
 /// cgroups.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.13.
+///
 /// # Examples
 ///
 /// ```no_run

+ 3 - 0
aya/src/programs/socket_filter.rs

@@ -26,6 +26,9 @@ pub enum SocketFilterError {
 /// [`SocketFilter`] programs are attached on sockets and can be used to inspect
 /// and filter incoming packets.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.0.
 ///
 /// # Examples
 ///

+ 4 - 0
aya/src/programs/tc.rs

@@ -32,6 +32,10 @@ pub enum TcAttachType {
 ///
 /// # Examples
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.1.
+///
 /// ```no_run
 /// # #[derive(Debug, thiserror::Error)]
 /// # enum Error {

+ 4 - 0
aya/src/programs/trace_point.rs

@@ -22,6 +22,10 @@ pub enum TracePointError {
 /// be attached to. See `/sys/kernel/debug/tracing/events` for a list of which
 /// events can be traced.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.7.
+///
 /// # Examples
 ///
 /// ```no_run

+ 4 - 0
aya/src/programs/xdp.rs

@@ -46,6 +46,10 @@ bitflags! {
 /// underlying network driver, XDP programs can execute directly on network cards, greatly
 /// reducing CPU load.
 ///
+/// # Minimum kernel version
+///
+/// The minimum kernel version required to use this feature is 4.8.
+///
 /// # Examples
 ///
 /// ```no_run