Skip to content

Commit

Permalink
manifest: nrf_modem v2.6.0
Browse files Browse the repository at this point in the history
Pull in latest nrf_modem.
For a detailed list of changes, see its CHANGELOG file.

Co-authored-by: Divya Pillai <[email protected]>
Co-authored-by: Andreas Moltumyr <[email protected]>
Co-authored-by: Eivind Jølsgard <[email protected]>
Co-authored-by: Mirko Covizzi <[email protected]>
Signed-off-by: Emanuele Di Santo <[email protected]>
  • Loading branch information
5 people authored and jfischer-no committed Feb 28, 2024
1 parent e21b491 commit b86721a
Show file tree
Hide file tree
Showing 36 changed files with 467 additions and 188 deletions.
31 changes: 28 additions & 3 deletions applications/asset_tracker_v2/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,31 @@ tests:
extra_args: EXTRA_CONF_FILE="overlay-lwm2m.conf;overlay-debug.conf"
tags: ci_build sysbuild
applications.asset_tracker_v2.lwm2m.debug-modem_trace:
build_only: true
build_on_all: true
platform_allow:
- nrf9160dk_nrf9160_ns
- nrf9161dk_nrf9161_ns
- nrf9151dk_nrf9151_ns
integration_platforms:
- nrf9160dk_nrf9160_ns
extra_args:
EXTRA_CONF_FILE="overlay-lwm2m.conf;overlay-debug.conf"
SNIPPET="nrf91-modem-trace-uart;tfm-enable-share-uart"
tags: ci_build
applications.asset_tracker_v2.lwm2m.debug-modem_trace.sysbuild:
build_only: true
sysbuild: true
build_on_all: true
platform_allow:
- nrf9160dk_nrf9160_ns
integration_platforms:
- nrf9160dk_nrf9160_ns
extra_args: >
EXTRA_CONF_FILE="overlay-lwm2m.conf;overlay-debug.conf"
asset_tracker_v2_SNIPPET="nrf91-modem-trace-uart;tfm-enable-share-uart"
tags: ci_build sysbuild
applications.asset_tracker_v2.lwm2m.modem_trace:
build_only: true
build_on_all: true
platform_allow:
Expand All @@ -443,10 +468,10 @@ tests:
- nrf9160dk_nrf9160_ns
- thingy91_nrf9160_ns
extra_args:
EXTRA_CONF_FILE="overlay-lwm2m.conf;overlay-debug.conf"
EXTRA_CONF_FILE="overlay-lwm2m.conf"
SNIPPET="nrf91-modem-trace-uart;tfm-enable-share-uart"
tags: ci_build
applications.asset_tracker_v2.lwm2m.debug-modem_trace.sysbuild:
applications.asset_tracker_v2.lwm2m.modem_trace.sysbuild:
build_only: true
sysbuild: true
build_on_all: true
Expand All @@ -458,7 +483,7 @@ tests:
- nrf9160dk_nrf9160_ns
- thingy91_nrf9160_ns
extra_args: >
EXTRA_CONF_FILE="overlay-lwm2m.conf;overlay-debug.conf"
EXTRA_CONF_FILE="overlay-lwm2m.conf"
asset_tracker_v2_SNIPPET="nrf91-modem-trace-uart;tfm-enable-share-uart"
tags: ci_build sysbuild
applications.asset_tracker_v2.lwm2m.memfault:
Expand Down
42 changes: 22 additions & 20 deletions applications/serial_lte_modem/doc/SOCKET_AT_commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -540,35 +540,37 @@ Syntax

* ``<value>`` is an integer that indicates the packet data network ID to bind to.

* ``50`` - :c:macro:`SO_RAI_NO_DATA` (set-only).
Immediately release the RRC.

* ``<value>`` is ignored.

* ``51`` - :c:macro:`SO_RAI_LAST` (set-only).
Enter Radio Resource Control (RRC) idle immediately after the next send operation.
* ``55`` - :c:macro:`SO_TCP_SRV_SESSTIMEO`.

* ``<value>`` is ignored.
* ``<value>`` is an integer that indicates the TCP server session inactivity timeout for a socket.
It accepts values from the range ``0`` to ``135``, where ``0`` is no timeout and ``135`` is 2 hours, 15 minutes.

* ``52`` - :c:macro:`SO_RAI_ONE_RESP` (set-only).
Wait for one incoming packet after the next send operation, before entering RRC idle mode.
* ``61`` - :c:macro:`SO_RAI` (set-only).
Release Assistance Indication (RAI).

* ``<value>`` is ignored.
* ``<value>`` The option accepts an integer, indicating the type of RAI.
Accepted values for the option are:

* ``53`` - :c:macro:`SO_RAI_ONGOING` (set-only).
Keep RRC in connected mode after the next send operation (client).
* ``1`` - :c:macro:`RAI_NO_DATA`.
Indicates that the application does not intend to send more data.
This socket option applies immediately and lets the modem exit connected mode more quickly.

* ``<value>`` is ignored.
* ``2`` - :c:macro:`RAI_LAST`.
Indicates that the application does not intend to send more data after the next call to :c:func:`send` or :c:func:`sendto`.
This lets the modem exit connected mode more quickly after sending the data.

* ``54`` - :c:macro:`SO_RAI_WAIT_MORE` (set-only).
Keep RRC in connected mode after the next send operation (server).
* ``3`` - :c:macro:`RAI_ONE_RESP`.
Indicates that the application is expecting to receive just one data packet after the next call to :c:func:`send` or :c:func:`sendto`.
This lets the modem exit connected mode more quickly after having received the data.

* ``<value>`` is ignored.
* ``4`` - :c:macro:`RAI_ONGOING`.
Indicates that the application is expecting to receive just one data packet after the next call to :c:func:`send` or :c:func:`sendto`.
This lets the modem exit connected mode more quickly after having received the data.

* ``55`` - :c:macro:`SO_TCP_SRV_SESSTIMEO`.
* ``5`` - :c:macro:`RAI_WAIT_MORE`.
Indicates that the socket is in active use by a server application.
This lets the modem stay in connected mode longer.

* ``<value>`` is an integer that indicates the TCP server session inactivity timeout for a socket.
It accepts value from range ``0`` to ``135``, where ``0`` is no timeout and ``135`` is 2 h 15 min.

See `nRF socket options`_ for explanation of the supported options.

Expand Down
4 changes: 4 additions & 0 deletions applications/serial_lte_modem/src/slm_at_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ static int at_sockopt_to_sockopt(enum at_sockopt at_option, int *level, int *opt
*level = SOL_SOCKET;
*option = SO_BINDTOPDN;
break;
case AT_SO_RAI:
*level = SOL_SOCKET;
*option = SO_RAI;
break;
case AT_SO_RAI_NO_DATA:
*level = SOL_SOCKET;
*option = SO_RAI_NO_DATA;
Expand Down
3 changes: 2 additions & 1 deletion applications/serial_lte_modem/src/slm_sockopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ enum at_sockopt {
AT_SO_RAI_ONE_RESP = 52,
AT_SO_RAI_ONGOING = 53,
AT_SO_RAI_WAIT_MORE = 54,
AT_SO_TCP_SRV_SESSTIMEO = 55
AT_SO_TCP_SRV_SESSTIMEO = 55,
AT_SO_RAI = 61,
};

/**
Expand Down
6 changes: 6 additions & 0 deletions doc/nrf/libraries/modem/lte_lc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ These callbacks allow any part of the application to perform certain operations
For example, one kind of operation that the application or a library may need to perform and repeat, whenever the modem enters a certain functional mode is the subscription to AT notifications.
The application can set up a callback for modem`s functional mode changes using the :c:macro:`LTE_LC_ON_CFUN` macro.

.. important::
When the :c:macro:`LTE_LC_ON_CFUN` macro is used, the application must not call :c:func:`nrf_modem_at_cfun_handler_set` as that will override the handler set by the modem library integration layer.

.. note::
The CFUN callback is not supported with :c:func:`nrf_modem_at_cmd_async`.

The following code snippet shows how to use the :c:macro:`LTE_LC_ON_CFUN` macro:

.. code-block:: c
Expand Down
25 changes: 22 additions & 3 deletions doc/nrf/libraries/modem/nrf_modem_lib/nrf_modem_lib_wrapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ When using the Modem library in |NCS|, the library must be initialized and shutd

.. _mlil_callbacks:

Callbacks
*********
Modem library callbacks
***********************

The library wrapper provides callbacks for the modem initialization and shutdown operations, as well as macros for registering multiple callbacks on changes to the modem functional mode.

Modem initialization and shutdown
=================================

The library wrapper also provides callbacks for the initialization and shutdown operations.
The application can set up a callback for the :c:func:`nrf_modem_lib_init` function using the :c:macro:`NRF_MODEM_LIB_ON_INIT` macro, and a callback for :c:func:`nrf_modem_lib_shutdown` function using the :c:macro:`NRF_MODEM_LIB_ON_SHUTDOWN` macro.
These compile-time callbacks allow any part of the application to perform any setup steps that require the modem to be in a certain state.
Furthermore, the callbacks ensure that the setup steps are repeated whenever another part of the application turns the modem on or off.
Expand All @@ -43,3 +47,18 @@ The callbacks registered using the :c:macro:`NRF_MODEM_LIB_ON_SHUTDOWN` macro ar
The callback context is provided to these callbacks.
Callbacks for the macro :c:macro:`NRF_MODEM_LIB_ON_SHUTDOWN` must have the signature ``void callback_name(void *ctx)``, where ``ctx`` is the context passed to the macro.
See the :ref:`modem_callbacks_sample` sample for more information.

Modem functional mode changes
=============================

The application can set up a callback for AT CFUN calls using the :c:macro:`NRF_MODEM_LIB_ON_CFUN` macro.
This compile-time callback allows any part of the application to perform any steps that are required when the modem changes functional mode.
The callbacks registered using the :c:macro:`NRF_MODEM_LIB_ON_CFUN` macro are executed after the functional mode has been successfully set.
See the :ref:`modem_callbacks_sample` sample for more information.

.. important::
The application should not call :c:func:`nrf_modem_at_cfun_handler_set` as that will override the handler set by the modem library integration layer.
Instead, the application should use the :c:macro:`NRF_MODEM_LIB_ON_CFUN` macro to register functional mode changes.

.. note::
The CFUN callback is not supported with :c:func:`nrf_modem_at_cmd_async`.
3 changes: 1 addition & 2 deletions doc/nrf/libraries/modem/pdn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ The library uses several AT commands, and it relies on the following two types o
* Notifications for unsolicited reporting of error codes sent by the network (``+CNEC``) - Subscribed by using the ``AT+CNEC=16`` command.
See the `AT+CNEC set command`_ section in the nRF9160 AT Commands Reference Guide or the `same section <nRF91x1 AT+CGEREP set command_>`_ in the nRF91x1 AT Commands Reference Guide, depending on the SiP you are using.

If the application uses the :ref:`lte_lc_readme` library to change the modem's functional mode, the PDN library automatically subscribes to the necessary AT notifications.
The PDN library automatically subscribes to the necessary AT notifications using :ref:`mlil_callbacks`.
This includes automatically resubscribing to the notifications upon functional mode changes.
If the application does not use the :ref:`lte_lc_readme` library to change the modem's functional mode, the application must subscribe to the necessary AT notifications manually.

.. note::
The subscription to AT notifications is lost upon changing the modem functional mode to ``+CFUN=0``.
Expand Down
26 changes: 26 additions & 0 deletions doc/nrf/releases_and_maturity/migration/migration_guide_2.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,32 @@ The following changes are mandatory to make your application work in the same wa
The setting controls whether the SLM connects automatically to the network on startup.
You can read and write it using the ``AT#XCARRIER="auto_connect"`` command.

* For applications using :ref:`nrf_modem_lib_readme`:

* The ``lte_connectivity`` module is renamed to ``lte_net_if``.
Make sure that all references are updated accordingly, including function names and Kconfig options.

* If your application is using the ``lte_net_if`` (formerly ``lte_connectivity``) without disabling :kconfig:option:`CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_START`, :kconfig:option:`CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_CONNECT`, and :kconfig:option:`CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_DOWN` Kconfig options, changes are required as the default values are changed from enabled to disabled.

* Consider using the :c:func:`conn_mgr_all_if_up`, :c:func:`conn_mgr_if_connect` and :c:func:`conn_mgr_if_disconnect` functions instead of enabling the Kconfig options to have better control of the initialization and connection establishment.

* The Release Assistance Indication (RAI) socket options have been deprecated and replaced with a new consolidated socket option.
If your application uses ``SO_RAI_*`` socket options, you need to update your socket configuration as follows:

#. Replace the deprecated socket options :c:macro:`SO_RAI_NO_DATA`, :c:macro:`SO_RAI_LAST`, :c:macro:`SO_RAI_ONE_RESP`, :c:macro:`SO_RAI_ONGOING`, and :c:macro:`SO_RAI_WAIT_MORE` with the new :c:macro:`SO_RAI` option.
#. Set the optval parameter of the :c:macro:`SO_RAI` socket option to one of the new values ``RAI_NO_DATA``, ``RAI_LAST``, ``RAI_ONE_RESP``, ``RAI_ONGOING``, or ``RAI_WAIT_MORE`` to specify the desired indication.

Example of migration:

.. code-block:: c
/* Before migration. */
setsockopt(socket_fd, SOL_SOCKET, SO_RAI_LAST, NULL, 0);
/* After migration. */
int rai_option = RAI_LAST;
setsockopt(socket_fd, SOL_SOCKET, SO_RAI, &rai_option, sizeof(rai_option));
* The ``AT#XCMNG`` AT command, which is activated with the :file:`overlay-native_tls.conf` overlay file, has been changed from using modem certificate storage to Zephyr settings storage.
You need to use the ``AT#XCMNG`` command to store previously stored credentials again.

Expand Down
25 changes: 21 additions & 4 deletions doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -940,13 +940,26 @@ Modem libraries

* A mention about enabling TF-M logging while using modem traces in the :ref:`modem_trace_module`.
* The :kconfig:option:`CONFIG_NRF_MODEM_LIB_NET_IF_DOWN_DEFAULT_LTE_DISCONNECT` option, allowing the user to change the behavior of the driver's :c:func:`net_if_down` implementation at build time.
* The :c:macro:`SO_RAI` socket option for Release Assistance Indication (RAI).
The socket option uses values ``RAI_NO_DATA``, ``RAI_LAST``, ``RAI_ONE_RESP``, ``RAI_ONGOING``, or ``RAI_WAIT_MORE`` to specify the desired indication.
This socket option substitutes the deprecated RAI (``SO_RAI_*``) socket options.

* Updated:

* The library by renaming ``lte_connectivity`` module to ``lte_net_if``.
All related Kconfig options have been renamed accordingly.
* The default value of the :kconfig:option:`CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_START`, :kconfig:option:`CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_CONNECT`, and :kconfig:option:`CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_DOWN` Kconfig options from enabled to disabled.
* The modem trace shell command implementation is moved from :ref:`modem_shell_application` sample into :ref:`nrf_modem_lib_readme` to be used by any application with the :kconfig:option:`CONFIG_NRF_MODEM_LIB_SHELL_TRACE` option enabled.
* The following socket options have been deprecated:

* :c:macro:`SO_RAI_NO_DATA`
* :c:macro:`SO_RAI_LAST`
* :c:macro:`SO_RAI_ONE_RESP`
* :c:macro:`SO_RAI_ONGOING`
* :c:macro:`SO_RAI_WAIT_MORE`

Use the :c:macro:`SO_RAI` socket option instead.

* The library by renaming ``lte_connectivity`` module to ``lte_net_if``.
All related Kconfig options have been renamed accordingly.
* The default value of the :kconfig:option:`CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_START`, :kconfig:option:`CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_CONNECT`, and :kconfig:option:`CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_DOWN` Kconfig options from enabled to disabled.
* The modem trace shell command implementation is moved from :ref:`modem_shell_application` sample into :ref:`nrf_modem_lib_readme` to be used by any application with the :kconfig:option:`CONFIG_NRF_MODEM_LIB_SHELL_TRACE` option enabled.

* Fixed:

Expand Down Expand Up @@ -979,6 +992,10 @@ Modem libraries

* The library to add PDP auto configuration to the :c:enumerator:`LTE_LC_FUNC_MODE_POWER_OFF` event.

* Removed:

* The dependency on the :ref:`lte_lc_readme` library.

* :ref:`lib_at_host` library:

* Added the :kconfig:option:`CONFIG_AT_HOST_STACK_SIZE` Kconfig option.
Expand Down
2 changes: 1 addition & 1 deletion doc/nrf/test_and_optimize/optimizing/power_nrf91.rst
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ Release Assistance Indication (RAI)

If you have low-level control over the protocol your IOT device uses, you might know when you should not expect more data.
In that case, you can request to skip the RRC idle mode using :term:`Release Assistance Indication (RAI)`.
The recommended way to do this is using setsockopt with an option like ``SO_RAI_LAST``.
The recommended way to do this is using :c:func:`setsockopt` with the option ``SO_RAI`` and value ``RAI_LAST``.

Low battery behavior
====================
Expand Down
4 changes: 2 additions & 2 deletions include/modem/lte_lc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ int lte_lc_edrx_get(struct lte_lc_edrx_cfg *edrx_cfg);
*
* For reference see 3GPP 24.301 Ch. 9.9.4.25.
*
* @deprecated Use @kconfig{CONFIG_LTE_RAI_REQ} and socket options SO_RAI_* instead.
* @deprecated Use @kconfig{CONFIG_LTE_RAI_REQ} and socket option ``SO_RAI`` instead.
*
* @note This feature is only supported by modem firmware versions < 2.0.0.
*
Expand All @@ -1600,7 +1600,7 @@ __deprecated int lte_lc_rai_param_set(const char *value);
* Used RAI value can be set using @kconfig{CONFIG_LTE_RAI_REQ_VALUE} or by calling
* lte_lc_rai_param_set().
*
* @deprecated Use @kconfig{CONFIG_LTE_RAI_REQ} and socket options SO_RAI_* instead.
* @deprecated Use @kconfig{CONFIG_LTE_RAI_REQ} and socket option ``SO_RAI`` instead.
*
* @note This feature is only supported by modem firmware versions < 2.0.0.
*
Expand Down
26 changes: 24 additions & 2 deletions include/modem/nrf_modem_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,19 @@ struct nrf_modem_lib_shutdown_cb {
void *context;
};

/**
* @brief AT CFUN callback entry.
*/
struct nrf_modem_lib_at_cfun_cb {
/** CFUN callback. */
void (*callback)(int mode, void *ctx);
/** User defined context */
void *context;
};

/**
* @brief Define a callback for DFU result @ref nrf_modem_lib_init calls.
*
* The callback function @p _callback is invoked after the library has been initialized.
*
* @note The @c NRF_MODEM_LIB_ON_DFU_RES callback can be used to subscribe to the result of a modem
* DFU operation.
*
Expand Down Expand Up @@ -188,6 +196,20 @@ struct nrf_modem_lib_shutdown_cb {
.context = _context, \
};

/**
* @brief Define a callback for successful AT CFUN calls.
*
* @param name Callback name
* @param _callback Callback function name
* @param _context User-defined context for the callback
*/
#define NRF_MODEM_LIB_ON_CFUN(name, _callback, _context) \
static void _callback(int mode, void *ctx); \
STRUCT_SECTION_ITERABLE(nrf_modem_lib_at_cfun_cb, nrf_modem_at_cfun_hook_##name) = { \
.callback = _callback, \
.context = _context, \
};

/**
* @brief Modem fault handler.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/lte_link_control/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ config LTE_RAI_REQ
bool "Release Assistance Indication (RAI) request"
help
Request use of RAI using AT%RAI. When RAI is enabled, the application needs to use
the RAI socket options (SO_RAI_*) to inform the modem when no more data is expected
the RAI socket option (SO_RAI) to inform the modem when no more data is expected
and the RRC connection can be released.

config LTE_RAI_REQ_VALUE
Expand Down
5 changes: 0 additions & 5 deletions lib/lte_link_control/lte_lc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1390,11 +1390,6 @@ int lte_lc_func_mode_set(enum lte_lc_func_mode mode)
return -EFAULT;
}

STRUCT_SECTION_FOREACH(lte_lc_cfun_cb, e) {
LOG_DBG("CFUN monitor callback: %p", e->callback);
e->callback(mode, e->context);
}

return 0;
}

Expand Down
16 changes: 16 additions & 0 deletions lib/lte_link_control/lte_lc_modem_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,19 @@ static void on_modem_shutdown(void *ctx)
(void)lte_lc_power_off();
}
}

#if CONFIG_UNITY
void lte_lc_on_modem_cfun(int mode, void *ctx)
#else
NRF_MODEM_LIB_ON_CFUN(lte_lc_cfun_hook, lte_lc_on_modem_cfun, NULL);

static void lte_lc_on_modem_cfun(int mode, void *ctx)
#endif
{
ARG_UNUSED(ctx);

STRUCT_SECTION_FOREACH(lte_lc_cfun_cb, e) {
LOG_DBG("CFUN monitor callback: %p", e->callback);
e->callback(mode, e->context);
}
}
2 changes: 2 additions & 0 deletions lib/nrf_modem_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
zephyr_library()
zephyr_library_sources(nrf_modem_lib.c)
zephyr_library_sources(nrf_modem_os.c)
zephyr_library_sources_ifdef(CONFIG_NRF_MODEM_LIB_CFUN_HOOKS cfun_hooks.c)
zephyr_library_sources_ifdef(CONFIG_NRF_MODEM_LIB_MEM_DIAG diag.c)
zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS nrf91_sockets.c)
zephyr_library_include_directories_ifdef(CONFIG_NET_SOCKETS ${ZEPHYR_BASE}/subsys/net/lib/sockets)
Expand All @@ -23,3 +24,4 @@ zephyr_library_sources(fault.c)
zephyr_library_sources(sanity.c)

zephyr_linker_sources(RODATA nrf_modem_lib.ld)
zephyr_linker_sources_IFDEF(CONFIG_NRF_MODEM_LIB_CFUN_HOOKS RODATA cfun_hooks.ld)
Loading

0 comments on commit b86721a

Please sign in to comment.