Skip to content

Commit 169e777

Browse files
committed
Merge tag 'net-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
Pull networking updates from Jakub Kicinski: "The sprinkling of SPI drivers is because we added a new one and Mark sent us a SPI driver interface conversion pull request. Core ---- - Introduce XDP multi-buffer support, allowing the use of XDP with jumbo frame MTUs and combination with Rx coalescing offloads (LRO). - Speed up netns dismantling (5x) and lower the memory cost a little. Remove unnecessary per-netns sockets. Scope some lists to a netns. Cut down RCU syncing. Use batch methods. Allow netdev registration to complete out of order. - Support distinguishing timestamp types (ingress vs egress) and maintaining them across packet scrubbing points (e.g. redirect). - Continue the work of annotating packet drop reasons throughout the stack. - Switch netdev error counters from an atomic to dynamically allocated per-CPU counters. - Rework a few preempt_disable(), local_irq_save() and busy waiting sections problematic on PREEMPT_RT. - Extend the ref_tracker to allow catching use-after-free bugs. BPF --- - Introduce "packing allocator" for BPF JIT images. JITed code is marked read only, and used to be allocated at page granularity. Custom allocator allows for more efficient memory use, lower iTLB pressure and prevents identity mapping huge pages from getting split. - Make use of BTF type annotations (e.g. __user, __percpu) to enforce the correct probe read access method, add appropriate helpers. - Convert the BPF preload to use light skeleton and drop the user-mode-driver dependency. - Allow XDP BPF_PROG_RUN test infra to send real packets, enabling its use as a packet generator. - Allow local storage memory to be allocated with GFP_KERNEL if called from a hook allowed to sleep. - Introduce fprobe (multi kprobe) to speed up mass attachment (arch bits to come later). - Add unstable conntrack lookup helpers for BPF by using the BPF kfunc infra. - Allow cgroup BPF progs to return custom errors to user space. - Add support for AF_UNIX iterator batching. - Allow iterator programs to use sleepable helpers. - Support JIT of add, and, or, xor and xchg atomic ops on arm64. - Add BTFGen support to bpftool which allows to use CO-RE in kernels without BTF info. - Large number of libbpf API improvements, cleanups and deprecations. Protocols --------- - Micro-optimize UDPv6 Tx, gaining up to 5% in test on dummy netdev. - Adjust TSO packet sizes based on min_rtt, allowing very low latency links (data centers) to always send full-sized TSO super-frames. - Make IPv6 flow label changes (AKA hash rethink) more configurable, via sysctl and setsockopt. Distinguish between server and client behavior. - VxLAN support to "collect metadata" devices to terminate only configured VNIs. This is similar to VLAN filtering in the bridge. - Support inserting IPv6 IOAM information to a fraction of frames. - Add protocol attribute to IP addresses to allow identifying where given address comes from (kernel-generated, DHCP etc.) - Support setting socket and IPv6 options via cmsg on ping6 sockets. - Reject mis-use of ECN bits in IP headers as part of DSCP/TOS. Define dscp_t and stop taking ECN bits into account in fib-rules. - Add support for locked bridge ports (for 802.1X). - tun: support NAPI for packets received from batched XDP buffs, doubling the performance in some scenarios. - IPv6 extension header handling in Open vSwitch. - Support IPv6 control message load balancing in bonding, prevent neighbor solicitation and advertisement from using the wrong port. Support NS/NA monitor selection similar to existing ARP monitor. - SMC - improve performance with TCP_CORK and sendfile() - support auto-corking - support TCP_NODELAY - MCTP (Management Component Transport Protocol) - add user space tag control interface - I2C binding driver (as specified by DMTF DSP0237) - Multi-BSSID beacon handling in AP mode for WiFi. - Bluetooth: - handle MSFT Monitor Device Event - add MGMT Adv Monitor Device Found/Lost events - Multi-Path TCP: - add support for the SO_SNDTIMEO socket option - lots of selftest cleanups and improvements - Increase the max PDU size in CAN ISOTP to 64 kB. Driver API ---------- - Add HW counters for SW netdevs, a mechanism for devices which offload packet forwarding to report packet statistics back to software interfaces such as tunnels. - Select the default NIC queue count as a fraction of number of physical CPU cores, instead of hard-coding to 8. - Expose devlink instance locks to drivers. Allow device layer of drivers to use that lock directly instead of creating their own which always runs into ordering issues in devlink callbacks. - Add header/data split indication to guide user space enabling of TCP zero-copy Rx. - Allow configuring completion queue event size. - Refactor page_pool to enable fragmenting after allocation. - Add allocation and page reuse statistics to page_pool. - Improve Multiple Spanning Trees support in the bridge to allow reuse of topologies across VLANs, saving HW resources in switches. - DSA (Distributed Switch Architecture): - replay and offload of host VLAN entries - offload of static and local FDB entries on LAG interfaces - FDB isolation and unicast filtering New hardware / drivers ---------------------- - Ethernet: - LAN937x T1 PHYs - Davicom DM9051 SPI NIC driver - Realtek RTL8367S, RTL8367RB-VB switch and MDIO - Microchip ksz8563 switches - Netronome NFP3800 SmartNICs - Fungible SmartNICs - MediaTek MT8195 switches - WiFi: - mt76: MediaTek mt7916 - mt76: MediaTek mt7921u USB adapters - brcmfmac: Broadcom BCM43454/6 - Mobile: - iosm: Intel M.2 7360 WWAN card Drivers ------- - Convert many drivers to the new phylink API built for split PCS designs but also simplifying other cases. - Intel Ethernet NICs: - add TTY for GNSS module for E810T device - improve AF_XDP performance - GTP-C and GTP-U filter offload - QinQ VLAN support - Mellanox Ethernet NICs (mlx5): - support xdp->data_meta - multi-buffer XDP - offload tc push_eth and pop_eth actions - Netronome Ethernet NICs (nfp): - flow-independent tc action hardware offload (police / meter) - AF_XDP - Other Ethernet NICs: - at803x: fiber and SFP support - xgmac: mdio: preamble suppression and custom MDC frequencies - r8169: enable ASPM L1.2 if system vendor flags it as safe - macb/gem: ZynqMP SGMII - hns3: add TX push mode - dpaa2-eth: software TSO - lan743x: multi-queue, mdio, SGMII, PTP - axienet: NAPI and GRO support - Mellanox Ethernet switches (mlxsw): - source and dest IP address rewrites - RJ45 ports - Marvell Ethernet switches (prestera): - basic routing offload - multi-chain TC ACL offload - NXP embedded Ethernet switches (ocelot & felix): - PTP over UDP with the ocelot-8021q DSA tagging protocol - basic QoS classification on Felix DSA switch using dcbnl - port mirroring for ocelot switches - Microchip high-speed industrial Ethernet (sparx5): - offloading of bridge port flooding flags - PTP Hardware Clock - Other embedded switches: - lan966x: PTP Hardward Clock - qca8k: mdio read/write operations via crafted Ethernet packets - Qualcomm 802.11ax WiFi (ath11k): - add LDPC FEC type and 802.11ax High Efficiency data in radiotap - enable RX PPDU stats in monitor co-exist mode - Intel WiFi (iwlwifi): - UHB TAS enablement via BIOS - band disablement via BIOS - channel switch offload - 32 Rx AMPDU sessions in newer devices - MediaTek WiFi (mt76): - background radar detection - thermal management improvements on mt7915 - SAR support for more mt76 platforms - MBSSID and 6 GHz band on mt7915 - RealTek WiFi: - rtw89: AP mode - rtw89: 160 MHz channels and 6 GHz band - rtw89: hardware scan - Bluetooth: - mt7921s: wake on Bluetooth, SCO over I2S, wide-band-speed (WBS) - Microchip CAN (mcp251xfd): - multiple RX-FIFOs and runtime configurable RX/TX rings - internal PLL, runtime PM handling simplification - improve chip detection and error handling after wakeup" * tag 'net-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2521 commits) llc: fix netdevice reference leaks in llc_ui_bind() drivers: ethernet: cpsw: fix panic when interrupt coaleceing is set via ethtool ice: don't allow to run ice_send_event_to_aux() in atomic ctx ice: fix 'scheduling while atomic' on aux critical err interrupt net/sched: fix incorrect vlan_push_eth dest field net: bridge: mst: Restrict info size queries to bridge ports net: marvell: prestera: add missing destroy_workqueue() in prestera_module_init() drivers: net: xgene: Fix regression in CRC stripping net: geneve: add missing netlink policy and size for IFLA_GENEVE_INNER_PROTO_INHERIT net: dsa: fix missing host-filtered multicast addresses net/mlx5e: Fix build warning, detected write beyond size of field iwlwifi: mvm: Don't fail if PPAG isn't supported selftests/bpf: Fix kprobe_multi test. Revert "rethook: x86: Add rethook x86 implementation" Revert "arm64: rethook: Add arm64 rethook implementation" Revert "powerpc: Add rethook support" Revert "ARM: rethook: Add rethook arm implementation" netdevice: add missing dm_private kdoc net: bridge: mst: prevent NULL deref in br_mst_info_size() selftests: forwarding: Use same VRF for port and VLAN upper ...
2 parents 7403e6d + 8969519 commit 169e777

File tree

2,020 files changed

+122284
-38112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,020 files changed

+122284
-38112
lines changed

Documentation/ABI/testing/sysfs-timecard

+115-1
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,15 @@ Description: (RO) Set of available destinations (sinks) for a SMA
3737
PPS2 signal is sent to the PPS2 selector
3838
TS1 signal is sent to timestamper 1
3939
TS2 signal is sent to timestamper 2
40+
TS3 signal is sent to timestamper 3
41+
TS4 signal is sent to timestamper 4
4042
IRIG signal is sent to the IRIG-B module
4143
DCF signal is sent to the DCF module
44+
FREQ1 signal is sent to frequency counter 1
45+
FREQ2 signal is sent to frequency counter 2
46+
FREQ3 signal is sent to frequency counter 3
47+
FREQ4 signal is sent to frequency counter 4
48+
None signal input is disabled
4249
===== ================================================
4350

4451
What: /sys/class/timecard/ocpN/available_sma_outputs
@@ -50,10 +57,16 @@ Description: (RO) Set of available sources for a SMA output signal.
5057
10Mhz output is from the 10Mhz reference clock
5158
PHC output PPS is from the PHC clock
5259
MAC output PPS is from the Miniature Atomic Clock
53-
GNSS output PPS is from the GNSS module
60+
GNSS1 output PPS is from the first GNSS module
5461
GNSS2 output PPS is from the second GNSS module
5562
IRIG output is from the PHC, in IRIG-B format
5663
DCF output is from the PHC, in DCF format
64+
GEN1 output is from frequency generator 1
65+
GEN2 output is from frequency generator 2
66+
GEN3 output is from frequency generator 3
67+
GEN4 output is from frequency generator 4
68+
GND output is GND
69+
VCC output is VCC
5770
===== ================================================
5871

5972
What: /sys/class/timecard/ocpN/clock_source
@@ -63,6 +76,97 @@ Description: (RW) Contains the current synchronization source used by
6376
the PHC. May be changed by writing one of the listed
6477
values from the available_clock_sources attribute set.
6578

79+
What: /sys/class/timecard/ocpN/clock_status_drift
80+
Date: March 2022
81+
Contact: Jonathan Lemon <[email protected]>
82+
Description: (RO) Contains the current drift value used by the firmware
83+
for internal disciplining of the atomic clock.
84+
85+
What: /sys/class/timecard/ocpN/clock_status_offset
86+
Date: March 2022
87+
Contact: Jonathan Lemon <[email protected]>
88+
Description: (RO) Contains the current offset value used by the firmware
89+
for internal disciplining of the atomic clock.
90+
91+
What: /sys/class/timecard/ocpN/freqX
92+
Date: March 2022
93+
Contact: Jonathan Lemon <[email protected]>
94+
Description: (RO) Optional directory containing the sysfs nodes for
95+
frequency counter <X>.
96+
97+
What: /sys/class/timecard/ocpN/freqX/frequency
98+
Date: March 2022
99+
Contact: Jonathan Lemon <[email protected]>
100+
Description: (RO) Contains the measured frequency over the specified
101+
measurement period.
102+
103+
What: /sys/class/timecard/ocpN/freqX/seconds
104+
Date: March 2022
105+
Contact: Jonathan Lemon <[email protected]>
106+
Description: (RW) Specifies the number of seconds from 0-255 that the
107+
frequency should be measured over. Write 0 to disable.
108+
109+
What: /sys/class/timecard/ocpN/genX
110+
Date: March 2022
111+
Contact: Jonathan Lemon <[email protected]>
112+
Description: (RO) Optional directory containing the sysfs nodes for
113+
frequency generator <X>.
114+
115+
What: /sys/class/timecard/ocpN/genX/duty
116+
Date: March 2022
117+
Contact: Jonathan Lemon <[email protected]>
118+
Description: (RO) Specifies the signal duty cycle as a percentage from 1-99.
119+
120+
What: /sys/class/timecard/ocpN/genX/period
121+
Date: March 2022
122+
Contact: Jonathan Lemon <[email protected]>
123+
Description: (RO) Specifies the signal period in nanoseconds.
124+
125+
What: /sys/class/timecard/ocpN/genX/phase
126+
Date: March 2022
127+
Contact: Jonathan Lemon <[email protected]>
128+
Description: (RO) Specifies the signal phase offset in nanoseconds.
129+
130+
What: /sys/class/timecard/ocpN/genX/polarity
131+
Date: March 2022
132+
Contact: Jonathan Lemon <[email protected]>
133+
Description: (RO) Specifies the signal polarity, either 1 or 0.
134+
135+
What: /sys/class/timecard/ocpN/genX/running
136+
Date: March 2022
137+
Contact: Jonathan Lemon <[email protected]>
138+
Description: (RO) Either 0 or 1, showing if the signal generator is running.
139+
140+
What: /sys/class/timecard/ocpN/genX/start
141+
Date: March 2022
142+
Contact: Jonathan Lemon <[email protected]>
143+
Description: (RO) Shows the time in <sec>.<nsec> that the signal generator
144+
started running.
145+
146+
What: /sys/class/timecard/ocpN/genX/signal
147+
Date: March 2022
148+
Contact: Jonathan Lemon <[email protected]>
149+
Description: (RW) Used to start the signal generator, and summarize
150+
the current status.
151+
152+
The signal generator may be started by writing the signal
153+
period, followed by the optional signal values. If the
154+
optional values are not provided, they default to the current
155+
settings, which may be obtained from the other sysfs nodes.
156+
157+
period [duty [phase [polarity]]]
158+
159+
echo 500000000 > signal # 1/2 second period
160+
echo 1000000 40 100 > signal
161+
echo 0 > signal # turn off generator
162+
163+
Period and phase are specified in nanoseconds. Duty cycle is
164+
a percentage from 1-99. Polarity is 1 or 0.
165+
166+
Reading this node will return:
167+
168+
period duty phase polarity start_time
169+
66170
What: /sys/class/timecard/ocpN/gnss_sync
67171
Date: September 2021
68172
Contact: Jonathan Lemon <[email protected]>
@@ -126,6 +230,16 @@ Description: (RW) These attributes specify the direction of the signal
126230
The 10Mhz reference clock input is currently only valid
127231
on SMA1 and may not be combined with other destination sinks.
128232

233+
What: /sys/class/timecard/ocpN/tod_correction
234+
Date: March 2022
235+
Contact: Jonathan Lemon <[email protected]>
236+
Description: (RW) The incoming GNSS signal is in UTC time, and the NMEA
237+
format messages do not provide a TAI offset. This sets the
238+
correction value for the incoming time.
239+
240+
If UBX_LS is enabled, this should be 0, and the offset is
241+
taken from the UBX-NAV-TIMELS message.
242+
129243
What: /sys/class/timecard/ocpN/ts_window_adjust
130244
Date: September 2021
131245
Contact: Jonathan Lemon <[email protected]>

Documentation/admin-guide/sysctl/net.rst

+9
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,15 @@ new netns has been created.
365365

366366
Default : 0 (for compatibility reasons)
367367

368+
txrehash
369+
--------
370+
371+
Controls default hash rethink behaviour on listening socket when SO_TXREHASH
372+
option is set to SOCK_TXREHASH_DEFAULT (i. e. not overridden by setsockopt).
373+
374+
If set to 1 (default), hash rethink is performed on listening socket.
375+
If set to 0, hash rethink is not performed.
376+
368377
2. /proc/sys/net/unix - Parameters for Unix domain sockets
369378
----------------------------------------------------------
370379

Documentation/bpf/bpf_prog_run.rst

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
===================================
4+
Running BPF programs from userspace
5+
===================================
6+
7+
This document describes the ``BPF_PROG_RUN`` facility for running BPF programs
8+
from userspace.
9+
10+
.. contents::
11+
:local:
12+
:depth: 2
13+
14+
15+
Overview
16+
--------
17+
18+
The ``BPF_PROG_RUN`` command can be used through the ``bpf()`` syscall to
19+
execute a BPF program in the kernel and return the results to userspace. This
20+
can be used to unit test BPF programs against user-supplied context objects, and
21+
as way to explicitly execute programs in the kernel for their side effects. The
22+
command was previously named ``BPF_PROG_TEST_RUN``, and both constants continue
23+
to be defined in the UAPI header, aliased to the same value.
24+
25+
The ``BPF_PROG_RUN`` command can be used to execute BPF programs of the
26+
following types:
27+
28+
- ``BPF_PROG_TYPE_SOCKET_FILTER``
29+
- ``BPF_PROG_TYPE_SCHED_CLS``
30+
- ``BPF_PROG_TYPE_SCHED_ACT``
31+
- ``BPF_PROG_TYPE_XDP``
32+
- ``BPF_PROG_TYPE_SK_LOOKUP``
33+
- ``BPF_PROG_TYPE_CGROUP_SKB``
34+
- ``BPF_PROG_TYPE_LWT_IN``
35+
- ``BPF_PROG_TYPE_LWT_OUT``
36+
- ``BPF_PROG_TYPE_LWT_XMIT``
37+
- ``BPF_PROG_TYPE_LWT_SEG6LOCAL``
38+
- ``BPF_PROG_TYPE_FLOW_DISSECTOR``
39+
- ``BPF_PROG_TYPE_STRUCT_OPS``
40+
- ``BPF_PROG_TYPE_RAW_TRACEPOINT``
41+
- ``BPF_PROG_TYPE_SYSCALL``
42+
43+
When using the ``BPF_PROG_RUN`` command, userspace supplies an input context
44+
object and (for program types operating on network packets) a buffer containing
45+
the packet data that the BPF program will operate on. The kernel will then
46+
execute the program and return the results to userspace. Note that programs will
47+
not have any side effects while being run in this mode; in particular, packets
48+
will not actually be redirected or dropped, the program return code will just be
49+
returned to userspace. A separate mode for live execution of XDP programs is
50+
provided, documented separately below.
51+
52+
Running XDP programs in "live frame mode"
53+
-----------------------------------------
54+
55+
The ``BPF_PROG_RUN`` command has a separate mode for running live XDP programs,
56+
which can be used to execute XDP programs in a way where packets will actually
57+
be processed by the kernel after the execution of the XDP program as if they
58+
arrived on a physical interface. This mode is activated by setting the
59+
``BPF_F_TEST_XDP_LIVE_FRAMES`` flag when supplying an XDP program to
60+
``BPF_PROG_RUN``.
61+
62+
The live packet mode is optimised for high performance execution of the supplied
63+
XDP program many times (suitable for, e.g., running as a traffic generator),
64+
which means the semantics are not quite as straight-forward as the regular test
65+
run mode. Specifically:
66+
67+
- When executing an XDP program in live frame mode, the result of the execution
68+
will not be returned to userspace; instead, the kernel will perform the
69+
operation indicated by the program's return code (drop the packet, redirect
70+
it, etc). For this reason, setting the ``data_out`` or ``ctx_out`` attributes
71+
in the syscall parameters when running in this mode will be rejected. In
72+
addition, not all failures will be reported back to userspace directly;
73+
specifically, only fatal errors in setup or during execution (like memory
74+
allocation errors) will halt execution and return an error. If an error occurs
75+
in packet processing, like a failure to redirect to a given interface,
76+
execution will continue with the next repetition; these errors can be detected
77+
via the same trace points as for regular XDP programs.
78+
79+
- Userspace can supply an ifindex as part of the context object, just like in
80+
the regular (non-live) mode. The XDP program will be executed as though the
81+
packet arrived on this interface; i.e., the ``ingress_ifindex`` of the context
82+
object will point to that interface. Furthermore, if the XDP program returns
83+
``XDP_PASS``, the packet will be injected into the kernel networking stack as
84+
though it arrived on that ifindex, and if it returns ``XDP_TX``, the packet
85+
will be transmitted *out* of that same interface. Do note, though, that
86+
because the program execution is not happening in driver context, an
87+
``XDP_TX`` is actually turned into the same action as an ``XDP_REDIRECT`` to
88+
that same interface (i.e., it will only work if the driver has support for the
89+
``ndo_xdp_xmit`` driver op).
90+
91+
- When running the program with multiple repetitions, the execution will happen
92+
in batches. The batch size defaults to 64 packets (which is same as the
93+
maximum NAPI receive batch size), but can be specified by userspace through
94+
the ``batch_size`` parameter, up to a maximum of 256 packets. For each batch,
95+
the kernel executes the XDP program repeatedly, each invocation getting a
96+
separate copy of the packet data. For each repetition, if the program drops
97+
the packet, the data page is immediately recycled (see below). Otherwise, the
98+
packet is buffered until the end of the batch, at which point all packets
99+
buffered this way during the batch are transmitted at once.
100+
101+
- When setting up the test run, the kernel will initialise a pool of memory
102+
pages of the same size as the batch size. Each memory page will be initialised
103+
with the initial packet data supplied by userspace at ``BPF_PROG_RUN``
104+
invocation. When possible, the pages will be recycled on future program
105+
invocations, to improve performance. Pages will generally be recycled a full
106+
batch at a time, except when a packet is dropped (by return code or because
107+
of, say, a redirection error), in which case that page will be recycled
108+
immediately. If a packet ends up being passed to the regular networking stack
109+
(because the XDP program returns ``XDP_PASS``, or because it ends up being
110+
redirected to an interface that injects it into the stack), the page will be
111+
released and a new one will be allocated when the pool is empty.
112+
113+
When recycling, the page content is not rewritten; only the packet boundary
114+
pointers (``data``, ``data_end`` and ``data_meta``) in the context object will
115+
be reset to the original values. This means that if a program rewrites the
116+
packet contents, it has to be prepared to see either the original content or
117+
the modified version on subsequent invocations.

Documentation/bpf/btf.rst

+27-18
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,19 @@ valid index (starting from 0) pointing to a member or an argument.
503503
* ``info.vlen``: 0
504504
* ``type``: the type with ``btf_type_tag`` attribute
505505

506+
Currently, ``BTF_KIND_TYPE_TAG`` is only emitted for pointer types.
507+
It has the following btf type chain:
508+
::
509+
510+
ptr -> [type_tag]*
511+
-> [const | volatile | restrict | typedef]*
512+
-> base_type
513+
514+
Basically, a pointer type points to zero or more
515+
type_tag, then zero or more const/volatile/restrict/typedef
516+
and finally the base type. The base type is one of
517+
int, ptr, array, struct, union, enum, func_proto and float types.
518+
506519
3. BTF Kernel API
507520
=================
508521

@@ -565,18 +578,15 @@ A map can be created with ``btf_fd`` and specified key/value type id.::
565578
In libbpf, the map can be defined with extra annotation like below:
566579
::
567580

568-
struct bpf_map_def SEC("maps") btf_map = {
569-
.type = BPF_MAP_TYPE_ARRAY,
570-
.key_size = sizeof(int),
571-
.value_size = sizeof(struct ipv_counts),
572-
.max_entries = 4,
573-
};
574-
BPF_ANNOTATE_KV_PAIR(btf_map, int, struct ipv_counts);
581+
struct {
582+
__uint(type, BPF_MAP_TYPE_ARRAY);
583+
__type(key, int);
584+
__type(value, struct ipv_counts);
585+
__uint(max_entries, 4);
586+
} btf_map SEC(".maps");
575587

576-
Here, the parameters for macro BPF_ANNOTATE_KV_PAIR are map name, key and
577-
value types for the map. During ELF parsing, libbpf is able to extract
578-
key/value type_id's and assign them to BPF_MAP_CREATE attributes
579-
automatically.
588+
During ELF parsing, libbpf is able to extract key/value type_id's and assign
589+
them to BPF_MAP_CREATE attributes automatically.
580590

581591
.. _BPF_Prog_Load:
582592

@@ -824,13 +834,12 @@ structure has bitfields. For example, for the following map,::
824834
___A b1:4;
825835
enum A b2:4;
826836
};
827-
struct bpf_map_def SEC("maps") tmpmap = {
828-
.type = BPF_MAP_TYPE_ARRAY,
829-
.key_size = sizeof(__u32),
830-
.value_size = sizeof(struct tmp_t),
831-
.max_entries = 1,
832-
};
833-
BPF_ANNOTATE_KV_PAIR(tmpmap, int, struct tmp_t);
837+
struct {
838+
__uint(type, BPF_MAP_TYPE_ARRAY);
839+
__type(key, int);
840+
__type(value, struct tmp_t);
841+
__uint(max_entries, 1);
842+
} tmpmap SEC(".maps");
834843

835844
bpftool is able to pretty print like below:
836845
::

Documentation/bpf/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ that goes into great technical depth about the BPF Architecture.
2121
helpers
2222
programs
2323
maps
24+
bpf_prog_run
2425
classic_vs_extended.rst
2526
bpf_licensing
2627
test_debug

0 commit comments

Comments
 (0)