Skip to content

Commit aeac88b

Browse files
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>
1 parent 6448b30 commit aeac88b

7 files changed

Lines changed: 121 additions & 71 deletions

File tree

configs/AM64X/AM64X_linux_toc.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ linux/Foundational_Components/Kernel/Kernel_Drivers/Network/NETCONF-YANG
6666
linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_PRP_Non_Offload
6767
linux/Foundational_Components/Kernel/Kernel_Drivers/Network/HSR_Offload
6868
linux/Foundational_Components/Kernel/Kernel_Drivers/Network/PRP_Offload
69+
linux/Foundational_Components/Kernel/Kernel_Drivers/Network/XDP
6970
linux/Foundational_Components/Kernel/Kernel_Drivers/SPI
7071
linux/Foundational_Components/Kernel/Kernel_Drivers/PCIe/PCIe_End_Point
7172
linux/Foundational_Components/Kernel/Kernel_Drivers/PCIe/PCIe_Root_Complex
@@ -107,7 +108,6 @@ linux/Foundational_Components/PRU-ICSS/Linux_Drivers/RemoteProc
107108
linux/Foundational_Components/PRU-ICSS/Linux_Drivers/PRU_ICSSG_Ethernet
108109
linux/Foundational_Components/PRU-ICSS/Linux_Drivers/PRU_ICSSG_Ethernet_Switch
109110
linux/Foundational_Components/PRU-ICSS/Linux_Drivers/RPMsg
110-
linux/Foundational_Components/PRU-ICSS/Linux_Drivers/PRU_ICSSG_XDP
111111
linux/Foundational_Components/PRU-ICSS/RPMsg_Quick_Start_Guide
112112
linux/Foundational_Components/PRU-ICSS-Hardware
113113
linux/Foundational_Components/PRU-ICSS/PRU-EVMs

configs/AM65X/AM65X_linux_toc.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ linux/Foundational_Components/PRU-ICSS/Linux_Drivers/RemoteProc
8787
linux/Foundational_Components/PRU-ICSS/Linux_Drivers/RPMsg
8888
linux/Foundational_Components/PRU-ICSS/RPMsg_Quick_Start_Guide
8989
linux/Foundational_Components/PRU-ICSS/Linux_Drivers/PRU_ICSSG_Ethernet
90-
linux/Foundational_Components/PRU-ICSS/Linux_Drivers/PRU_ICSSG_XDP
9190
linux/Foundational_Components/PRU-ICSS/Linux_Drivers/PRU_ICSSG_Ethernet_Switch
9291
linux/Foundational_Components/PRU-ICSS/Linux_Drivers/PRU_ICSSG_Ethernet_sr10
9392
linux/Foundational_Components/PRU-ICSS-Hardware

source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW-Ethernet.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,5 @@ For further details regarding the TSN features and testing, refer :ref:`tsn_with
9090

9191
XDP and zero copy
9292
"""""""""""""""""
93-
The CPSW Ethernet Subsystem supports XDP and zero copy features similar to PRU-ICSS Ethernet Subsystem.
94-
For more details refer :ref:`pru_icssg_xdp`.
93+
The CPSW Ethernet Subsystem supports XDP Native Mode, XDP Generic Mode, and Zero-copy mode.
94+
For detailed setup and testing information, refer to :ref:`kernel_xdp`.

source/linux/Foundational_Components/PRU-ICSS/Linux_Drivers/PRU_ICSSG_XDP.rst renamed to source/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/XDP.rst

Lines changed: 114 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
1-
.. _pru_icssg_xdp:
1+
.. _kernel_xdp:
22

3-
#############
4-
PRU_ICSSG XDP
5-
#############
3+
===
4+
XDP
5+
===
66

77
.. contents:: :local:
88
:depth: 3
99

10-
************
1110
Introduction
12-
************
11+
============
1312

14-
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.
1514

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.
1716

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).
2322

24-
.. Image:: /images/XDP-packet-processing.png
23+
.. image:: /images/XDP-packet-processing.png
2524

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.
2726
This works by using the AF_XDP socket type which was introduced specifically for this usecase.
2827

2928
In this process, the packet is directly sent to the user space without going through the kernel network stack.
3029

31-
.. Image:: /images/xdp-packet.png
30+
.. image:: /images/xdp-packet.png
3231

3332
Use cases for XDP
34-
=================
33+
-----------------
3534

3635
XDP is particularly useful for these common networking scenarios:
3736

@@ -42,10 +41,10 @@ XDP is particularly useful for these common networking scenarios:
4241
5. **Network Analytics**: Real-time traffic analysis and monitoring
4342
6. **Custom Network Functions**: Specialized packet handling for unique requirements
4443

45-
How to run XDP with PRU_ICSSG
46-
=============================
44+
How to run XDP on EVM
45+
---------------------
4746

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:
4948

5049
.. code-block:: console
5150
@@ -59,7 +58,7 @@ The kernel configuration requires the following changes to use XDP with PRU_ICSS
5958
CONFIG_XDP_SOCKETS=y
6059
6160
Tools for debugging XDP Applications
62-
====================================
61+
-------------------------------------
6362

6463
Debugging tools for XDP development:
6564

@@ -68,9 +67,8 @@ Debugging tools for XDP development:
6867
- perf - For performance monitoring and analysis
6968
- bpftrace - For tracing BPF program execution
7069

71-
**************
7270
AF_XDP Sockets
73-
**************
71+
==============
7472

7573
AF_XDP is a socket address family specifically designed to work with the XDP framework.
7674
These sockets provide a high-performance interface for user space applications to receive
@@ -84,13 +82,13 @@ Key characteristics of AF_XDP sockets include:
8482
- Optimized for high-throughput, low-latency applications
8583

8684
How AF_XDP Works
87-
================
85+
----------------
8886

8987
AF_XDP sockets operate through a shared memory mechanism:
9088

9189
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
9492
4. Userspace application directly accesses the packet data
9593
5. Zero or minimal copying depending on the mode used
9694

@@ -99,30 +97,20 @@ The AF_XDP architecture uses several ring buffers:
9997
- **RX Ring**: Received packets ready for consumption
10098
- **TX Ring**: Packets to be transmitted
10199
- **FILL Ring**: Pre-allocated buffers for incoming packets
102-
- **COMPLETION Ring**: Tracks completed TX operations
100+
- **COMPLETION Ring**: Tracks completed ``TX`` operations
103101

104102
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>`_.
105103

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+
=============
118106

119107
Introduction to Zero-Copy Mode
120-
==============================
108+
-------------------------------
121109

122110
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.
123111

124112
How Zero-Copy Works
125-
===================
113+
-------------------
126114

127115
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:
128116

@@ -131,31 +119,88 @@ In standard XDP operation (copy mode), packet data is copied from kernel memory
131119
3. Managing memory ownership through descriptor rings rather than data movement
132120

133121
This approach provides several benefits:
122+
134123
- Reduced CPU utilization
135124
- Lower memory bandwidth consumption
136125
- Decreased latency for packet processing
137126
- Improved overall throughput
138127

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.
141146

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.
143148

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):
154+
155+
.. code-block:: console
156+
157+
xdp-trafficgen udp -m ff:ff:ff:ff:ff:ff <interface>
158+
159+
**XDP Drop test** — receive and drop packets using XDP (copy mode):
160+
161+
.. code-block:: console
162+
163+
xdp-bench xdp-bench drop <interface>
164+
165+
**XDP Pass test** — receive and pass packets through XDP allowing normal network stack processing (copy mode):
166+
167+
.. code-block:: console
168+
169+
xdp-bench xdp-bench pass <interface>
170+
171+
**XDP TX test** — Hairpins (bounces back) received packets on the same interface (copy mode):
172+
173+
.. code-block:: console
174+
175+
xdp-bench xdp-bench tx <interface>
176+
177+
**XDP Redirect test** — Redirects received packets on the from one interface to another (copy mode):
178+
179+
.. code-block:: console
180+
181+
xdp-bench xdp-bench redirect <interface1> <interface2>
182+
183+
**XSK Drop test** — receive and drop packets using AF_XDP socket in zero-copy mode:
184+
185+
.. code-block:: console
186+
187+
xdp-bench xsk-drop -q 0 -C zero-copy <interface>
188+
189+
**XSK Transmit test** — generate traffic using AF_XDP socket in zero-copy mode:
190+
191+
.. code-block:: console
192+
193+
xdp-trafficgen xsk-udp -m ff:ff:ff:ff:ff:ff -q 0 -C zero-copy <interface>
194+
195+
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>`_
151197

152198
Performance Comparison
153-
======================
199+
----------------------
154200

155201
Performance testing shows that zero-copy mode can provide substantial throughput improvements compared to copy mode:
156202

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):
159204

160205
.. list-table::
161206
:header-rows: 1
@@ -173,13 +218,20 @@ AF_XDP performance while using 64 byte packets in Kpps:
173218
- 354
174219
- 855
175220

176-
Performance Considerations
177-
==========================
221+
AF_XDP performance while using 64 byte packets for CPSW (in Kpps):
178222

179-
When implementing XDP applications, consider these performance factors:
223+
.. list-table::
224+
:header-rows: 1
180225

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
226+
* - Benchmark
227+
- XDP-SKB
228+
- XDP-Native
229+
- XDP-Native(ZeroCopy)
230+
* - rxdrop
231+
- 322
232+
- 491
233+
- 845
234+
* - txonly
235+
- 390
236+
- 394
237+
- 723

source/linux/Foundational_Components/PRU-ICSS-Linux-Drivers.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Linux Drivers
99
PRU-ICSS/Linux_Drivers/PRU-ICSS_Ethernet
1010
PRU-ICSS/Linux_Drivers/PRU_ICSSG_Ethernet
1111
PRU-ICSS/Linux_Drivers/PRU_ICSSG_Ethernet_Switch
12-
PRU-ICSS/Linux_Drivers/PRU_ICSSG_XDP
1312
PRU-ICSS/Linux_Drivers/PRU_ICSSG_Ethernet_sr10
1413
PRU-ICSS/Linux_Drivers/pru-sw-uart
1514
PRU-ICSS/Linux_Drivers/pruss-uart

source/linux/Foundational_Components/PRU-ICSS/Linux_Drivers/PRU_ICSSG_Ethernet.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Features supported
4444
- 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.
4545
- IRQ Coalescing also known as interrupt pacing.
4646
- Multi-cast HW filtering
47-
- XDP Native Mode and XDP Generic Mode
47+
- XDP Native Mode, XDP Generic Mode and Zero-copy mode
4848
- Cut Through forwarding
4949
- PHY Interrupt mode for ICSSG2
5050
- Multicast filtering support for VLAN interfaces
@@ -54,7 +54,6 @@ Features supported
5454
- VLAN HW filtering
5555
- All-multi mode is always enabled
5656
- 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
5857

5958
Driver Configuration
6059
####################
@@ -713,8 +712,8 @@ To turn off PPS,
713712
XDP
714713
###
715714

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.
716+
Refer to :ref:`kernel_xdp` for more details.
718717

719718

720719
Tips

source/linux/Foundational_Components_Kernel_Drivers.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Kernel Drivers
3232
Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW-Ethernet
3333
Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW2g
3434
Foundational_Components/Kernel/Kernel_Drivers/Network/NETCONF-YANG
35+
Foundational_Components/Kernel/Kernel_Drivers/Network/XDP
3536
Foundational_Components/Kernel/Kernel_Drivers/PCIe/PCIe_End_Point
3637
Foundational_Components/Kernel/Kernel_Drivers/PCIe/PCIe_Backplane
3738
Foundational_Components/Kernel/Kernel_Drivers/PCIe/PCIe_Root_Complex

0 commit comments

Comments
 (0)