Skip to content

app: Move from nrf_ to zsock_ socket operations#316

Merged
MarkusLassila merged 2 commits into
nrfconnect:mainfrom
MarkusLassila:nrf-to-zsock
May 22, 2026
Merged

app: Move from nrf_ to zsock_ socket operations#316
MarkusLassila merged 2 commits into
nrfconnect:mainfrom
MarkusLassila:nrf-to-zsock

Conversation

@MarkusLassila
Copy link
Copy Markdown
Contributor

@MarkusLassila MarkusLassila commented May 22, 2026

Replace nrf_ socket operations with offloaded zsock_ socket operations.

Note: We changed from zsock_socket to nrf_socket in PR #47 due to SO_POLLCB support being only for nrf_sockets.. Now that we have SO_POLLCB, we can move back to offloaded sockets.

Jira: SM-319

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the Serial Modem application and its AT-socket test suite from nrf_* socket APIs to offloaded zsock_* socket operations, leveraging SO_POLLCB support to return to offloaded sockets.

Changes:

  • Replace nrf_* socket calls with zsock_* equivalents across the AT socket layer and HTTP client paths.
  • Update unit tests to mock zsock_* APIs and enable POSIX socket namespace compatibility for the test build.
  • Remove direct dependency on nrf_socket.h from shared defines and adjust buffer sizing.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
app/src/sm_at_socket.c Switch core AT socket operations, sockopts, polling and callbacks to zsock_*.
app/src/sm_at_httpc.c Use zsock_send/recv and ZSOCK_POLL* events for HTTP client socket I/O.
app/src/sm_at_httpc.h Update poll-event documentation to reference ZSOCK_POLL*.
app/src/sm_ppp.c Use zsock_inet_pton for PPP DNS fallback address parsing.
app/src/sm_defines.h Drop nrf_socket.h include and hardcode SM_MAX_MESSAGE_SIZE.
app/src/sm_at_icmp.c Remove nrf_socket.h include (keep Zephyr socket usage).
app/tests/at_socket/CMakeLists.txt Enable CONFIG_NET_NAMESPACE_COMPAT_MODE for the test target.
app/tests/at_socket/src/test_at_socket.c Update mocks/expectations from nrf_* to zsock_* across test cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/sm_at_socket.c
Comment thread app/src/sm_defines.h
Comment thread app/tests/at_socket/src/test_at_socket.c Outdated
Comment thread app/tests/at_socket/src/test_at_socket.c
Replace nrf_ socket operations with offloaded zsock_ socket
operations.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
Change the unit tests to use offloaded sockets.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
@MarkusLassila MarkusLassila merged commit 5c04469 into nrfconnect:main May 22, 2026
2 checks passed
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.

3 participants