Skip to content

net: code improvement in process_data() for high throughput case #80289

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

Closed
MaochenWang1 opened this issue Oct 23, 2024 · 4 comments
Closed

net: code improvement in process_data() for high throughput case #80289

MaochenWang1 opened this issue Oct 23, 2024 · 4 comments
Assignees
Labels
area: Networking Enhancement Changes/Updates/Additions to existing features

Comments

@MaochenWang1
Copy link
Collaborator

Is your enhancement proposal related to a problem? Please describe.
In process_data(), there are three net_packet_socket_input() called, looks redundant for running UDP throughput case.
And can we skip/optimize some of these functions? I locally tried, skip these functions can improve UDP RX for 5 Mbps.

Describe the solution you'd like
can we add some configs to skip some net_packet_socket_input() functions for high throughput case.

@MaochenWang1 MaochenWang1 added the Enhancement Changes/Updates/Additions to existing features label Oct 23, 2024
@jukkar
Copy link
Member

jukkar commented Oct 24, 2024

Just disable CONFIG_NET_SOCKETS_PACKET so that the packet socket processing is not done. If you need packet socket support, then the calls are needed to handle raw packet data in sockets.

The three net_packet_socket_input() calls are each handling different kind of packet/raw sockets.

@jukkar
Copy link
Member

jukkar commented Oct 24, 2024

It is probably possible to optimize the packet socket handling even further, patches are certainly welcome to improve performance.

@MaochenWang1
Copy link
Collaborator Author

MaochenWang1 commented Oct 28, 2024

Hi @jukkar @rlubos
the CONFIG_NET_SOCKETS_PACKET are needed for hostap enabled case to handle the EAPoL packets.
Any suggestions to optimize the packet socket handling even further?
Thanks

@rlubos
Copy link
Collaborator

rlubos commented Apr 23, 2025

We got rid of one of the packet socket input calls (net_packet_socket_input(pkt, IPPROTO_RAW)) with the invalid IPPROTO_RAW socket removal: #88044. The alternative (AF_INET/SOCK_RAW) now needs to be explicitly enabled in Kconfig, so it won't affect the overall performance if not used.

However, for the remaining two net_packet_socket_input() calls, I don't really see much room for improvement here. If packet sockets are enabled, we need to call this function before and after L2 processing, so it needs to be called twice. I've simplified the packet processing a bit in #88720, so we no longer call the bulky net_conn_input() in those cases, but still it's more of a simplification rather than optimization.

So, with all above, I think we should close the issue as no more improvements can be seen from my side. Please reopen if you have any specific ideas on what could be changed/improved if possible.

@rlubos rlubos closed this as completed Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

4 participants