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

XDP Compat #14

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

XDP Compat #14

wants to merge 11 commits into from

Conversation

jschwinger233
Copy link
Owner

No logic change.

Background

Checklist

Full Changelogs

  • [Implement ...]

Issue Reference

Closes #[issue number]

Test Result

@jschwinger233 jschwinger233 force-pushed the gray/xdp-compat branch 5 times, most recently from 1a4278d to 8702f04 Compare April 10, 2024 13:54
Because we pass l3proto instead, which is parsed from parse_transport()
And it also returns bpf_redirect().
This is because:
1. XDP can't operate skb->cb
2. Further handling doesn't need L2 info at all
we will implement the corresponding functions for XDP soon.
To distinguish from XDP lib functions.
Just copy without a single character change.
1. xdp won't be attached to L3 netdev, so no need to handle 0 hlen
2. use xdp helpers instead of skb helpers
@jschwinger233 jschwinger233 force-pushed the gray/xdp-compat branch 2 times, most recently from 8416b4a to 42b7098 Compare April 12, 2024 11:57
@jschwinger233
Copy link
Owner Author

PR 暂时搁置,主要问题是:

  1. XDP generic mode 性能烂爆了,iperf tcp 能跑出数量级的差距。原因之一是 XDP generic 没有 GRO
  2. XDP driver mode 适配性很难控,如果是服务端软件还好,这种 2C 软件分发出去,用户用什么网卡都可能有。有些网卡支持 XDP native,但又没有完全支持,出问题能把人查死。我自己测试就遇到了 XDP redirect 不支持的情况,流量就消失在茫茫宇宙里了。
  3. XDP bpf 不能操作 skb,和 dae 有些功能冲突了,如 set mark。我观察到有用户在用这个功能,不能不支持。
    (4. 内核要求 >=5.18)

但是也不是没有转机。

如果 AF_XDP 能够完全实现 TCP + UDP 的劫持,那就算是 generic mode 说不定也有 更好的性能。

另一方面,是否可以考虑单向的 AF_XDP,比如从 dae 回复 UDP 的时候用 XSK 发送而不走内核栈,也许也可以考虑(不确定,因为要为每一个 tuple 查一次 redirect_map 确定用哪个 XSK,最差情况下无法缓存,性能能不能将功补过不好说,CPU 肯定爆炸了)

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

Successfully merging this pull request may close these issues.

1 participant