-
Notifications
You must be signed in to change notification settings - Fork 104
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
Send packets to controller from the running program #292
Conversation
This should make PR #270 obsolete. |
@FedeParola, given the rather large amount of code that is involved in this PR, I would suggest to briefly explain how you changed the code, even here as a comment in this PR. Thanks! |
Added more details in the PR description, let me now if there is still something not clear. |
@FedeParola a little late to review the the code, does this change fixes the problem or only refactoring the code? |
If you mean the problem in issue #281, yes, it is fixed.
You are right, the packet can still be processed by the network stack. With that sentence I meant that the packet can not be further processed by the ebpf program, unless you send it to the controller and then send it back to the fast path, with a decrease in performance and the problem described above. |
This PR allows to send packets to the controller from the running program and then continue with the processing.
pcn_pkt_controller()
now returns the return value ofbpf_perf_event_output()
helper.Formerly packets were sent to the controller through a dedicated program executed via tail call and they could not be further processed in the datapath.
Fixes #281.
In details:
CTRL_TC_TX
andCTRL_XDP_TX
) responsible of sending packets to the controller has been moved from theController
class (controller.cpp
) to thepcn_pkt_controller()
helper in classesCubeTC
(cube_tc.cpp
),CubeXDP
(cubec_xdp.cpp
),TransparentCubeTC
(transparent_cube_tc.cpp
) andTransparentCubeXDP
(transparent_cube_xdp.cpp
) with minor modifications.Standard and transparent versions of this code differ in the fact that standard code uses the
port_id
filed of metadata to store the port, while transparent version uses it to store the direction of the packet.Controller
class now only instantiate two perf rings used to send packets to user plane (controller_tc
andcontroller_xdp
), declared as public tables, and then polls on them to retrieve the packets and forward them to the corresponding cube.The code responsible of sending packets back to the fast path was not modified.
pcn_pkt_controller_with_metadata_stack()
helper has been removed since the calling program can send the packet to the controller and then let it proceed to the stack returningRX_OK
.pcn_pkt_controller()
helper (except frompacketcapture
) have been updated to call the helper and then returnRX_DROP
, in order to keep the same behavior as before.The
packetcapture
returns RX_OK to let the packet pass.