Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement xdp native attach mode #116

Closed
1 of 3 tasks
pirog-spb opened this issue Apr 18, 2023 · 1 comment · Fixed by #306
Closed
1 of 3 tasks

Implement xdp native attach mode #116

pirog-spb opened this issue Apr 18, 2023 · 1 comment · Fixed by #306
Assignees
Labels
ebpf ebpf program details performance

Comments

@pirog-spb
Copy link
Collaborator

pirog-spb commented Apr 18, 2023

  • Figure out how to make xdp native attach mode works
  • Prepare environment
  • Update README
@pirog-spb pirog-spb added the ebpf ebpf program details label Apr 18, 2023
@pirog-spb pirog-spb linked a pull request Jun 10, 2023 that will close this issue
@pirog-spb
Copy link
Collaborator Author

pirog-spb commented Jun 10, 2023

When applying --attach native option eupf successfully starts.

upf              | 2023/06/10 16:20:34 Apply eUPF config: {InterfaceName:[eth0 eth1] XDPAttachMode:native ApiAddress::8080 PfcpAddress::8805 PfcpNodeId:10.100.200.4 MetricsAddress::9090 N3Address:10.100.200.4 QerMapSize:1024 FarMapSize:1024 PdrMapSize:1024}
upf              | 2023/06/10 16:20:34 Attached XDP program to iface "eth0" (index 316)
upf              | 2023/06/10 16:20:34 Attached XDP program to iface "eth1" (index 318)

But packets aren't redirected (XDP_REDIRECT).

To fix it just load "zero" xdp program in native(driver) mode on the opposite interface of veth pair.

Show all eUPF interfaces, get ids of the interfaces in host namespace

/ # ip l sh
...
316: eth0@if317: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 xdp qdisc noqueue state UP mode DEFAULT group default 
    link/ether 02:42:0a:64:c8:04 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    prog/xdp id 628 name upf_ip_entrypoi tag a77c715aaac4979b jited 
318: eth1@if319: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 xdp qdisc noqueue state UP mode DEFAULT group default 
    link/ether 02:42:0a:64:fa:03 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    prog/xdp id 628 name upf_ip_entrypoi tag a77c715aaac4979b jited

Get interfaces in the host namespace by id

# ip l sh | grep 317
317: veth1f7ef0e@if316: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-free5gc state UP mode DEFAULT group default 
# ip l sh | grep 319
319: veth0915238@if318: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-free5gc-n6 state UP mode DEFAULT group default

Attach simple xdp program to both interfaces

sudo ip link set dev veth1f7ef0e xdpdrv obj zero_entrypoint_bpf.o sec xdp/upf_zero_entrypoint
sudo ip link set dev veth0915238 xdpdrv obj zero_entrypoint_bpf.o sec xdp/upf_zero_entrypoint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ebpf ebpf program details performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant