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

net: Avoid building native stack components with CONFIG_NET_NATIVE=n #79206

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rlubos
Copy link
Contributor

@rlubos rlubos commented Sep 30, 2024

Another set of changes for better separation of native network stack and offloaded cases. This disables building of native stack features when NET_NATIVE is disabled. It's been reported that builds may fail with --no-gc-sections option enabled.

The major change here is separation of generic socket code (syscalls shared between native and offloaded implementations) from native IP sockets implementation. For some reason git produced pretty scary diff, but in reality the sockets.c file has simply been split into two.

@rlubos
Copy link
Contributor Author

rlubos commented Sep 30, 2024

@jukkar What's your say on

 MACRO_WITH_FLOW_CONTROL: Macros with flow control statements should be avoided
File:subsys/net/lib/sockets/sockets_inet.c
Line:37

It's about SET_ERRNO() macro, the check must've been disabled when the macro was originally introduced. Shall we ask to override this, or take the opportunity and remove that macro?

@rlubos
Copy link
Contributor Author

rlubos commented Sep 30, 2024

Added a commit removing the faulty macro, just in case.

jukkar
jukkar previously approved these changes Sep 30, 2024
@jukkar
Copy link
Member

jukkar commented Sep 30, 2024

It's about SET_ERRNO() macro, the check must've been disabled when the macro was originally introduced. Shall we ask to override this, or take the opportunity and remove that macro?

Overriding is a good choice, I think the macro just hides things without being useful.

Native IP socket implementation need only be build if native IP stack is
enabled. Therefore, split the native IP sockets from the common socket
syscalls shared across all socket implementations.

Signed-off-by: Robert Lubos <[email protected]>
In case NET_NATIVE is disabled, certain network stack components do not
need to be compiled. Otherwise, they could throw errors if
--no-gc-sections compiler options is enabled.

Signed-off-by: Robert Lubos <[email protected]>
Net offloading doesn't need net TC threads to be enabled as they're used
by the native stack. This fixes build if CONFIG_NET_OFFLOAD is enabled
but native stack is disabled.

Signed-off-by: Robert Lubos <[email protected]>
Macros with flow control are discouraged and generate compliance error,
hence remove it and replace the corresponding code with simple errno
assignments.

Signed-off-by: Robert Lubos <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants