-
Notifications
You must be signed in to change notification settings - Fork 444
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
PSA/eBPF: Enable passing packets up to the kernel stack #3691
Conversation
backends/ebpf/psa/ebpfPipeline.cpp
Outdated
@@ -568,6 +583,28 @@ void TCIngressPipeline::emitTrafficManager(CodeBuilder *builder) { | |||
control->outputStandardMetadata->name.name); | |||
builder->newline(); | |||
|
|||
builder->appendFormat("if (%s.drop == false && %s.egress_port == 0) ", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually you don't write 'x==false' but '!x'
backends/ebpf/psa/README.md
Outdated
The NTK packet path allows integrating P4/PSA programs for eBPF with the standard Linux kernel stack. The main use case is handling | ||
ICMP/ARP requests and sending packet to the userspace process listening on a socket. | ||
|
||
The NTK path is enforced if `drop` is set to `false` and `egress_port` is left unspecified or set to 0 (it's a special implicit port number that forwards packets to the kernel stack). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not say "unspecified", but "unchanged". Since it is an inout value, it must be initialized properly.
@mbudiu-vmw I addressed your comments, thanks! Can we merge this? |
This PR introduces an implicit custom packet path to the PSA model used for eBPF backend. The new packet path enables integrating PSA pipelines for eBPF with the standard Linux kernel network stack. The main use case is to delegate ARP/ICMP handling to the kernel, instead of re-inventing the wheel by implementing own ARP/ICMP handlers in userspace. The new packet path also enables sending packets to the userspace application listening on a socket.
To send packets to the kernel, a P4 programmer should set
drop
tofalse
and leaveegress_port
unspecified (or set to0
) in the ingress pipeline.Note that reply packets (ICMP Reply, ARP Response, etc.) traverse the egress pipeline, but the PSA Egress pipeline is unable to distinguish between packets from PSA Ingress and from kernel. Therefore, we disallow handling packets from kernel in the egress pipeline. Such packets are ignored by the egress eBPF program and directly send out to the output port.