@@ -178,24 +178,34 @@ impl<'obj> OpenMapMut<'obj> {
178178 util:: parse_ret ( ret)
179179 }
180180
181- // TODO: Document member.
182- #[ allow( missing_docs) ]
181+ /// Set the NUMA node for this map.
182+ ///
183+ /// This can be used to ensure that the map is allocated on a particular
184+ /// NUMA node, which can be useful for performance-critical applications.
183185 pub fn set_numa_node ( & mut self , numa_node : u32 ) -> Result < ( ) > {
184186 let ret = unsafe { libbpf_sys:: bpf_map__set_numa_node ( self . ptr . as_ptr ( ) , numa_node) } ;
185187 util:: parse_ret ( ret)
186188 }
187189
188- // TODO: Document member.
189- #[ allow( missing_docs) ]
190+ /// Set the inner map FD.
191+ ///
192+ /// This is used for nested maps, where the value type of the outer map is a pointer to the
193+ /// inner map.
190194 pub fn set_inner_map_fd ( & mut self , inner_map_fd : BorrowedFd < ' _ > ) -> Result < ( ) > {
191195 let ret = unsafe {
192196 libbpf_sys:: bpf_map__set_inner_map_fd ( self . ptr . as_ptr ( ) , inner_map_fd. as_raw_fd ( ) )
193197 } ;
194198 util:: parse_ret ( ret)
195199 }
196200
197- // TODO: Document member.
198- #[ allow( missing_docs) ]
201+ /// Set the `map_extra` field for this map.
202+ ///
203+ /// Allows users to pass additional data to the
204+ /// kernel when loading the map. The kernel will store this value in the
205+ /// `bpf_map_info` struct associated with the map.
206+ ///
207+ /// This can be used to pass data to the kernel that is not otherwise
208+ /// representable via the existing `bpf_map_def` fields.
199209 pub fn set_map_extra ( & mut self , map_extra : u64 ) -> Result < ( ) > {
200210 let ret = unsafe { libbpf_sys:: bpf_map__set_map_extra ( self . ptr . as_ptr ( ) , map_extra) } ;
201211 util:: parse_ret ( ret)
@@ -1203,40 +1213,112 @@ bitflags! {
12031213#[ non_exhaustive]
12041214#[ repr( u32 ) ]
12051215#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
1206- // TODO: Document members.
1207- #[ allow( missing_docs) ]
12081216pub enum MapType {
1217+ /// An unspecified map type.
12091218 Unspec = libbpf_sys:: BPF_MAP_TYPE_UNSPEC ,
1219+ /// A general purpose Hash map storage type.
1220+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_hash.html) for more details.
12101221 Hash = libbpf_sys:: BPF_MAP_TYPE_HASH ,
1222+ /// An Array map storage type.
1223+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_array.html) for more details.
12111224 Array = libbpf_sys:: BPF_MAP_TYPE_ARRAY ,
1225+ /// A program array map which holds only the file descriptors to other eBPF programs. Used for
1226+ /// tail-calls.
12121227 ProgArray = libbpf_sys:: BPF_MAP_TYPE_PROG_ARRAY ,
1228+ /// An array map which holds only the file descriptors to perf events.
12131229 PerfEventArray = libbpf_sys:: BPF_MAP_TYPE_PERF_EVENT_ARRAY ,
1230+ /// A Hash map with per CPU storage.
1231+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_hash.html#per-cpu-hashes) for more details.
12141232 PercpuHash = libbpf_sys:: BPF_MAP_TYPE_PERCPU_HASH ,
1233+ /// An Array map with per CPU storage.
1234+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_array.html) for more details.
12151235 PercpuArray = libbpf_sys:: BPF_MAP_TYPE_PERCPU_ARRAY ,
1236+ #[ allow( missing_docs) ]
12161237 StackTrace = libbpf_sys:: BPF_MAP_TYPE_STACK_TRACE ,
1238+ #[ allow( missing_docs) ]
12171239 CgroupArray = libbpf_sys:: BPF_MAP_TYPE_CGROUP_ARRAY ,
1240+ /// A Hash map with least recently used (LRU) eviction policy.
1241+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_hash.html#bpf-map-type-lru-hash-and-variants) for more details.
12181242 LruHash = libbpf_sys:: BPF_MAP_TYPE_LRU_HASH ,
1243+ /// A Hash map with least recently used (LRU) eviction policy with per CPU storage.
1244+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_hash.html#per-cpu-hashes) for more details.
12191245 LruPercpuHash = libbpf_sys:: BPF_MAP_TYPE_LRU_PERCPU_HASH ,
1246+ /// A Longest Prefix Match (LPM) algorithm based map.
1247+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_lpm_trie.html) for more details.
12201248 LpmTrie = libbpf_sys:: BPF_MAP_TYPE_LPM_TRIE ,
1249+ /// A map in map storage.
1250+ /// One level of nesting is supported, where an outer map contains instances of a single type
1251+ /// of inner map. Refer the kernel [documentation](https://docs.kernel.org/bpf/map_of_maps.html) for more details.
12211252 ArrayOfMaps = libbpf_sys:: BPF_MAP_TYPE_ARRAY_OF_MAPS ,
1253+ /// A map in map storage.
1254+ /// One level of nesting is supported, where an outer map contains instances of a single type
1255+ /// of inner map. Refer the kernel [documentation](https://docs.kernel.org/bpf/map_of_maps.html) for more details.
12221256 HashOfMaps = libbpf_sys:: BPF_MAP_TYPE_HASH_OF_MAPS ,
1257+ /// An array map that uses the key as the index to lookup a reference to a net device.
1258+ /// Primarily used for XDP BPF Helper.
1259+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_devmap.html) for more details.
12231260 Devmap = libbpf_sys:: BPF_MAP_TYPE_DEVMAP ,
1261+ /// An array map holds references to a socket descriptor.
1262+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_sockmap.html) for more details.
12241263 Sockmap = libbpf_sys:: BPF_MAP_TYPE_SOCKMAP ,
1264+ /// A map that redirects raw XDP frames to another CPU.
1265+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_cpumap.html) for more details.
12251266 Cpumap = libbpf_sys:: BPF_MAP_TYPE_CPUMAP ,
1267+ /// A map that redirects raw XDP frames to AF_XDP sockets (XSKs), a new type of address family
1268+ /// in the kernel that allows redirection of frames from a driver to user space without
1269+ /// having to traverse the full network stack. Refer the kernel [documentation](https://docs.kernel.org/bpf/map_xskmap.html) for more details.
12261270 Xskmap = libbpf_sys:: BPF_MAP_TYPE_XSKMAP ,
1271+ /// A Hash map that holds references to sockets via their socket descriptor.
1272+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_sockmap.html) for more details.
12271273 Sockhash = libbpf_sys:: BPF_MAP_TYPE_SOCKHASH ,
1274+ /// Deprecated. Use `CGrpStorage` instead.
1275+ ///
1276+ /// A Local storage for cgroups.
1277+ /// Only available with `CONFIG_CGROUP_BPF` and to programs that attach to cgroups.
1278+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/cgroup_storage.html) for more details.
12281279 CgroupStorage = libbpf_sys:: BPF_MAP_TYPE_CGROUP_STORAGE ,
1280+ /// A Local storage for cgroups.
1281+ /// Only available with `CONFIG_CGROUPS`.
1282+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/cgroup_storage.html) for more details.
1283+ ///
1284+ /// See also [Difference between cgrp_storage and cgroup_storage](https://docs.kernel.org/bpf/map_cgrp_storage.html#difference-between-bpf-map-type-cgrp-storage-and-bpf-map-type-cgroup-storage)
1285+ CGrpStorage = libbpf_sys:: BPF_MAP_TYPE_CGRP_STORAGE ,
1286+ /// A map that holds references to sockets with `SO_REUSEPORT` option set.
1287+ /// Refer [documentation](https://docs.ebpf.io/linux/map-type/BPF_MAP_TYPE_REUSEPORT_SOCKARRAY/) for more details.
12291288 ReuseportSockarray = libbpf_sys:: BPF_MAP_TYPE_REUSEPORT_SOCKARRAY ,
1289+ /// A per-CPU variant of [`BPF_MAP_TYPE_CGROUP_STORAGE`][`MapType::CgroupStorage`].
1290+ /// Refer [documentation](https://docs.ebpf.io/linux/map-type/BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE) for more details.
12301291 PercpuCgroupStorage = libbpf_sys:: BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE ,
1292+ /// A FIFO storage.
1293+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_queue_stack.html) for more details.
12311294 Queue = libbpf_sys:: BPF_MAP_TYPE_QUEUE ,
1295+ /// A LIFO storage.
1296+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_queue_stack.html) for more details.
12321297 Stack = libbpf_sys:: BPF_MAP_TYPE_STACK ,
1298+ /// A socket-local storage.
1299+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_sk_storage.html) for more details.
12331300 SkStorage = libbpf_sys:: BPF_MAP_TYPE_SK_STORAGE ,
1301+ /// A Hash map that uses the key as the index to lookup a reference to a net device.
1302+ /// Primarily used for XDP BPF Helper.
1303+ /// Refer the kernel [documentation](https://docs.kernel.org/bpf/map_devmap.html) for more details.
12341304 DevmapHash = libbpf_sys:: BPF_MAP_TYPE_DEVMAP_HASH ,
1305+ /// A specialized map that act as implementations of "struct ops" structures defined in the
1306+ /// kernel. Refer [documentation](https://docs.ebpf.io/linux/map-type/BPF_MAP_TYPE_STRUCT_OPS/) for more details.
12351307 StructOps = libbpf_sys:: BPF_MAP_TYPE_STRUCT_OPS ,
1308+ /// A ring buffer map to efficiently send large amount of data.
1309+ /// Refer [documentation](https://docs.ebpf.io/linux/map-type/BPF_MAP_TYPE_RINGBUF/) for more details.
12361310 RingBuf = libbpf_sys:: BPF_MAP_TYPE_RINGBUF ,
1311+ /// A storage map that holds data keyed on inodes.
1312+ /// Refer [documentation](https://docs.ebpf.io/linux/map-type/BPF_MAP_TYPE_INODE_STORAGE/) for more details.
12371313 InodeStorage = libbpf_sys:: BPF_MAP_TYPE_INODE_STORAGE ,
1314+ /// A storage map that holds data keyed on tasks.
1315+ /// Refer [documentation](https://docs.ebpf.io/linux/map-type/BPF_MAP_TYPE_TASK_STORAGE/) for more details.
12381316 TaskStorage = libbpf_sys:: BPF_MAP_TYPE_TASK_STORAGE ,
1317+ /// Bloom filters are a space-efficient probabilistic data structure used to quickly test
1318+ /// whether an element exists in a set. In a bloom filter, false positives are possible
1319+ /// whereas false negatives are not. Refer the kernel [documentation](https://docs.kernel.org/bpf/map_bloom_filter.html) for more details.
12391320 BloomFilter = libbpf_sys:: BPF_MAP_TYPE_BLOOM_FILTER ,
1321+ #[ allow( missing_docs) ]
12401322 UserRingBuf = libbpf_sys:: BPF_MAP_TYPE_USER_RINGBUF ,
12411323 /// We choose to specify our own "unknown" type here b/c it's really up to the kernel
12421324 /// to decide if it wants to reject the map. If it accepts it, it just means whoever
0 commit comments