You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(linux): Consolidate XDP documentation to a unified location for ICSSG and CPSW
- Add new centralized XDP documentation at
Kernel/Kernel_Drivers/Network/XDP.rst
- Add kernel_xdp reference label that can be used throughout the docs
- Update PRU_ICSSG_XDP.rst to redirect to the consolidated XDP docs
- Update features supported in PRU_ICSSG_Ethernet.rst
- Update CPSW-Ethernet.rst to reference kernel_xdp instead of
pru_icssg_xdp
- Add XDP.rst to AM64X device-specific table of contents
- Add XDP.rst to main Kernel Drivers toctree
The new XDP documentation covers:
- XDP introduction and concepts
- Use cases and kernel configuration
- AF_XDP sockets and zero-copy mode
- Testing with xdp-tools (xdp-bench, xdp-trafficgen)
- Performance comparison for CPSW and ICSSG drivers
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Meghana Malladi <m-malladi@ti.com>
XDP (eXpress Data Path) provides a framework for BPF that enables high-performance programmable packet processing in the Linux kernel. It runs the BPF program at the earliest possible point in software, namely at the moment the network driver receives the packet.
13
+
eXpress Data Path (XDP) provides a framework for extended Berkeley Packet Filters (eBPF) that enables high-performance programmable packet processing in the Linux kernel. It runs the eBPF program at the earliest possible point in software, namely at the moment the network driver receives the packet.
15
14
16
-
XDP allows running a BPF program just before the skbs are allocated in the driver, the BPF program can look at the packet and return the following things.
15
+
XDP allows running an eBPF program just before the socket buffers (skbs) are allocated in the driver. The eBPF program can examine the packet and return one of the following actions.
17
16
18
-
- XDP_DROP :- The packet is dropped right away, without wasting any resources. Useful for firewall etc.
19
-
- XDP_ABORTED :- Similar to drop, an exception is generated.
20
-
- XDP_PASS :- Pass the packet to kernel stack, i.e. the skbs are allocated and it works normally.
21
-
- XDP_TX :- Send the packet back to same NIC with modification(if done by the program).
22
-
- XDP_REDIRECT :- Send the packet to another NIC or to the user space through AF_XDP Socket(discussed below).
17
+
- ``XDP_DROP`` :- The packet is dropped right away, without wasting any resources. Useful for firewall etc.
18
+
- ``XDP_ABORTED`` :- Similar to drop, an exception is generated.
19
+
- ``XDP_PASS`` :- Pass the packet to kernel stack, i.e. the skbs are allocated and it works normally.
20
+
- ``XDP_TX`` :- Send the packet back to same NIC with modification(if done by the program).
21
+
- ``XDP_REDIRECT`` :- Send the packet to another NIC or to the user space through AF_XDP Socket(discussed below).
23
22
24
-
.. Image:: /images/XDP-packet-processing.png
23
+
.. image:: /images/XDP-packet-processing.png
25
24
26
-
As explained before, the XDP_REDIRECT sends packets directly to the user space.
25
+
As explained before, the ``XDP_REDIRECT`` sends packets directly to the user space.
27
26
This works by using the AF_XDP socket type which was introduced specifically for this usecase.
28
27
29
28
In this process, the packet is directly sent to the user space without going through the kernel network stack.
30
29
31
-
.. Image:: /images/xdp-packet.png
30
+
.. image:: /images/xdp-packet.png
32
31
33
32
Use cases for XDP
34
-
=================
33
+
-----------------
35
34
36
35
XDP is particularly useful for these common networking scenarios:
37
36
@@ -42,10 +41,10 @@ XDP is particularly useful for these common networking scenarios:
42
41
5. **Network Analytics**: Real-time traffic analysis and monitoring
43
42
6. **Custom Network Functions**: Specialized packet handling for unique requirements
44
43
45
-
How to run XDP with PRU_ICSSG
46
-
=============================
44
+
How to run XDP on EVM
45
+
---------------------
47
46
48
-
The kernel configuration requires the following changes to use XDP with PRU_ICSSG:
47
+
The kernel configuration requires the following changes to use XDP:
49
48
50
49
.. code-block:: console
51
50
@@ -59,7 +58,7 @@ The kernel configuration requires the following changes to use XDP with PRU_ICSS
59
58
CONFIG_XDP_SOCKETS=y
60
59
61
60
Tools for debugging XDP Applications
62
-
====================================
61
+
-------------------------------------
63
62
64
63
Debugging tools for XDP development:
65
64
@@ -68,9 +67,8 @@ Debugging tools for XDP development:
68
67
- perf - For performance monitoring and analysis
69
68
- bpftrace - For tracing BPF program execution
70
69
71
-
**************
72
70
AF_XDP Sockets
73
-
**************
71
+
==============
74
72
75
73
AF_XDP is a socket address family specifically designed to work with the XDP framework.
76
74
These sockets provide a high-performance interface for user space applications to receive
@@ -84,13 +82,13 @@ Key characteristics of AF_XDP sockets include:
84
82
- Optimized for high-throughput, low-latency applications
85
83
86
84
How AF_XDP Works
87
-
================
85
+
----------------
88
86
89
87
AF_XDP sockets operate through a shared memory mechanism:
90
88
91
89
1. XDP program intercepts packets at driver level
92
-
2. XDP_REDIRECT action sends packets to the socket
93
-
3. Shared memory rings (RX/TX/FILL/COMPLETION) manage packet data
90
+
2. ``XDP_REDIRECT`` action sends packets to the socket
91
+
3. Shared memory rings (``RX``/``TX``/``FILL``/``COMPLETION``) manage packet data
94
92
4. Userspace application directly accesses the packet data
95
93
5. Zero or minimal copying depending on the mode used
96
94
@@ -99,30 +97,20 @@ The AF_XDP architecture uses several ring buffers:
99
97
- **RX Ring**: Received packets ready for consumption
100
98
- **TX Ring**: Packets to be transmitted
101
99
- **FILL Ring**: Pre-allocated buffers for incoming packets
For more details on AF_XDP please refer to the official documentation: `AF_XDP <https://www.kernel.org/doc/html/latest/networking/af_xdp.html>`_.
105
103
106
-
Current Support Status in PRU_ICSSG
107
-
===================================
108
-
109
-
The PRU_ICSSG Ethernet driver currently supports:
110
-
111
-
- Native XDP mode
112
-
- Generic XDP mode (SKB-based)
113
-
- Zero-copy mode
114
-
115
-
**************************
116
-
XDP Zero-Copy in PRU_ICSSG
117
-
**************************
104
+
XDP Zero-Copy
105
+
=============
118
106
119
107
Introduction to Zero-Copy Mode
120
-
==============================
108
+
-------------------------------
121
109
122
110
Zero-copy mode is an optimization in AF_XDP that eliminates packet data copying between the kernel and user space. This results in significantly improved performance for high-throughput network applications.
123
111
124
112
How Zero-Copy Works
125
-
===================
113
+
-------------------
126
114
127
115
In standard XDP operation (copy mode), packet data is copied from kernel memory to user space memory when processed. Zero-copy mode eliminates this copy operation by:
128
116
@@ -131,31 +119,88 @@ In standard XDP operation (copy mode), packet data is copied from kernel memory
131
119
3. Managing memory ownership through descriptor rings rather than data movement
132
120
133
121
This approach provides several benefits:
122
+
134
123
- Reduced CPU utilization
135
124
- Lower memory bandwidth consumption
136
125
- Decreased latency for packet processing
137
126
- Improved overall throughput
138
127
139
-
Requirements for Zero-Copy
140
-
==========================
128
+
Performance Considerations
129
+
--------------------------
130
+
131
+
When implementing XDP applications, consider these performance factors:
132
+
133
+
1. **Memory Alignment**: Buffers should be aligned to page boundaries for optimal performance
134
+
2. **Batch Processing**: Process multiple packets in batches when possible
135
+
3. **Poll Mode**: Use poll() or similar mechanisms to avoid blocking on socket operations
136
+
4. **Core Affinity**: Bind application threads to specific CPU cores to reduce cache contention
137
+
138
+
Testing XDP on EVM
139
+
==================
140
+
141
+
The `xdp-tools <https://github.com/xdp-project/xdp-tools>`__ package provides
142
+
utility tools for testing XDP and AF_XDP such as `xdp-bench`, `xdp-trafficgen` etc.
143
+
144
+
TI SDK packages the latest version of ``xdp-tools`` utilities and provides it as part of the SDK.
145
+
This allows users to easily test XDP functionality on EVM using these tools.
141
146
142
-
For zero-copy to function properly with PRU_ICSSG, ensure:
147
+
Both CPSW and ICSSG Ethernet drivers supports Native XDP, Generic XDP, and Zero-copy mode.
143
148
144
-
1. **Driver Support**: Verify the PRU_ICSSG driver is loaded with zero-copy support enabled
145
-
2. **Memory Alignment**: Buffer addresses must be properly aligned to page boundaries
146
-
3. **UMEM Configuration**: The UMEM area must be correctly configured:
147
-
- Properly aligned memory allocation
148
-
- Sufficient number of packet buffers
149
-
- Appropriate buffer sizes
150
-
4. **Hugepages**: Using hugepages for UMEM allocation is recommended for optimal performance
149
+
.. note::
150
+
151
+
In case of testing with CPSW please note that when running XDP in Zero-copy mode, non-XDP traffic will be dropped.
152
+
153
+
**XDP Transmit test** — generate traffic using XDP (copy mode):
While xdpsock is not packaged into the SDK, the same functionality can be done with xsk-trafficgen and xsk-bench from the xdp-tools package.
196
+
For more details on xdpsock and how it performs XDP zero copy testing refer to `xdpsock <https://github.com/xdp-project/bpf-examples/tree/main/AF_XDP-example>`_
151
197
152
198
Performance Comparison
153
-
======================
199
+
----------------------
154
200
155
201
Performance testing shows that zero-copy mode can provide substantial throughput improvements compared to copy mode:
156
202
157
-
`xdpsock <https://github.com/xdp-project/bpf-examples/tree/main/AF_XDP-example>`_ opensource tool was used for testing XDP zero copy.
158
-
AF_XDP performance while using 64 byte packets in Kpps:
203
+
AF_XDP performance while using 64 byte packets for ICSSG (in Kpps):
159
204
160
205
.. list-table::
161
206
:header-rows: 1
@@ -173,13 +218,20 @@ AF_XDP performance while using 64 byte packets in Kpps:
173
218
- 354
174
219
- 855
175
220
176
-
Performance Considerations
177
-
==========================
221
+
AF_XDP performance while using 64 byte packets for CPSW (in Kpps):
178
222
179
-
When implementing XDP applications, consider these performance factors:
223
+
.. list-table::
224
+
:header-rows: 1
180
225
181
-
1. **Memory Alignment**: Buffers should be aligned to page boundaries for optimal performance
182
-
2. **Batch Processing**: Process multiple packets in batches when possible
183
-
3. **Poll Mode**: Use poll() or similar mechanisms to avoid blocking on socket operations
184
-
4. **Core Affinity**: Bind application threads to specific CPU cores to reduce cache contention
185
-
5. **NUMA Awareness**: Consider NUMA topology when allocating memory for packet buffers
Copy file name to clipboardExpand all lines: source/linux/Foundational_Components/PRU-ICSS/Linux_Drivers/PRU_ICSSG_Ethernet.rst
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ Features supported
44
44
- Different MII modes for Real-Time Ethernet ports (MII_G_RT1 and MII_G_RT2) on different PRU_ICSSG instances. For example, MII on a PRU_ICSSG1 port, and RGMII on a PRU_ICSSG2 port, is supported.
45
45
- IRQ Coalescing also known as interrupt pacing.
46
46
- Multi-cast HW filtering
47
-
- XDP Native Mode and XDP Generic Mode
47
+
- XDP Native Mode, XDP Generic Mode and Zero-copy mode
48
48
- Cut Through forwarding
49
49
- PHY Interrupt mode for ICSSG2
50
50
- Multicast filtering support for VLAN interfaces
@@ -54,7 +54,6 @@ Features supported
54
54
- VLAN HW filtering
55
55
- All-multi mode is always enabled
56
56
- Different MII modes for Real-Time Ethernet ports (MII_G_RT1 and MII_G_RT2) on a single PRU_ICSSG instance. For example, MII_G_RT1=MII and MII_G_RT2=RGMII.
57
-
- XDP with Zero-copy mode
58
57
59
58
Driver Configuration
60
59
####################
@@ -713,8 +712,8 @@ To turn off PPS,
713
712
XDP
714
713
###
715
714
716
-
The PRU_ICSSG Ethernet driver supports Native XDP as well as Generic XDP. XDP with Zero-copy mode is not supported yet.
717
-
For detailed setup and how to test XDP please refer to :ref:`pru_icssg_xdp`.
715
+
The PRU_ICSSG Ethernet driver supports Native XDP, Generic XDP, and Zero-copy mode.
0 commit comments