Skip to content

nxp-imx/imx-xdp-fp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Compilation steps
# Set kernel headers include path:
export SDKTARGETSYSROOT=<path>
Note: Kernel headers can be installed by using command in kernel source:
	"make ARCH=arm64 headers_install INSTALL_HDR_PATH=<path>"

# Set CC path
export CC=<gcc path>

# This repository has dependancy on bpf, zstd, z and elf libraries.
# To enable BPF debugs , add "-DDEBUG" in CLANG_FLAGS.
# Set headers and libraries path in CFLAGS, CLANG_FLAGS and LDFLAGS, then run:

make

===================================================================================
NAT Flow Setup and Testing Guide

+-------------------+                         +-------------------+
|  Sprint Port 1    |                         |  Sprint Port 2    |
|  IPv4: 1.1.1.2    |                         |  IPv4: 4.4.4.1    |
|  Gateway: 1.1.1.1 |                         |  Gateway: 4.4.4.4 |
+---------+---------+                         +---------+---------+
         |                                             |
         |                                             |
         | eth0                                  eth1  |
+---------+---------------------------------------------+---------+
|                       i.MX95 Board                              |
|       eth0: 1.1.1.1                    eth1: 4.4.4.4            |
|                                                                 |
|                 (IP Forwarding Enabled)                         |
+-----------------------------------------------------------------+

1. Setup Requirements

 Hardware:
- i.MX95 board with two available Ethernet interfaces
- Two Sprint ports

2. Network Setup
   Sprint Port Configuration
   1. Connect Sprint Port 1 to eth0 on the i.MX95 board.
     Configure the connected device:
       IPv4 Address: 1.1.1.2
       IPv4 Gateway: 1.1.1.1

   2. Connect Sprint Port 2 to eth1 on the i.MX95 board.
     Configure the connected device:
       IPv4 Address: 4.4.4.1
       IPv4 Gateway: 4.4.4.4

i.MX95 Board Configuration
Assign IP addresses to Ethernet interfaces:
  ifconfig eth0 1.1.1.1 up
  ifconfig eth1 4.4.4.4 up
Add a static route:
  ip route add 8.8.8.0/24 via 4.4.4.1
Enable IP forwarding:
  echo 1 > /proc/sys/net/ipv4/ip_forward
Verify network connectivity:
  ping 1.1.1.2
  ping 4.4.4.1

3. NAT Flow Rule Setup
Edit the input.txt file available at /opt/xdp/ and add the following NAT flow rule:
  nat_saddr=4.4.4.2
  nat_daddr=8.8.8.8
  nat_sport=1036
  nat_dport=1024
  mtu=1500
  saddr=1.1.1.2
  daddr=8.8.8.8
  sport=1024
  dport=1024
  protocol=17
  interface=eth1

4. Load the XDP program on both eth0 and eth1.
	- cd /opt/xdp/
	- xdp_fp -D eth0 eth1

	Note: xdp_fp, xdp_fp_kern.o and input.txt must be present in the same directory.
		use "xdp_fp -h" for help.

5. Traffic Generation and Packet Capture
Generate a traffic stream from Sprint Port 1 towards 8.8.8.8.
Capture the packets at Sprint Port 2.

You should observe the following traffic pattern in the Wireshark capture:

	Time				Source   Destination 	Protocol	Length	Info
2	2025-04-28 18:27:24.346281	4.4.4.2	 8.8.8.8	    UDP		128	1036 -> 1024 Len=82
3	2025-04-28 18:27:24.346281	4.4.4.2	 8.8.8.8	    UDP		128	1036 -> 1024 Len=82
4	2025-04-28 18:27:24.346281	4.4.4.2	 8.8.8.8	    UDP		128	1036 -> 1024 Len=82
5	2025-04-28 18:27:24.346281	4.4.4.2	 8.8.8.8	    UDP		128	1036 -> 1024 Len=82
6	2025-04-28 18:27:24.346281	4.4.4.2	 8.8.8.8	    UDP		128	1036 -> 1024 Len=82

About

XDP-FP - XDP based fastpath applications for i.mx

Resources

License

Stars

Watchers

Forks

Packages

No packages published