-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
lib: nrf_modem: lte_connectivity
-> lte_net_if
#11604
Conversation
Test specificationCI/Jenkins/NRF
CI/Jenkins/integration
Detailed information of selected test modules Note: This message is automatically posted and updated by the CI |
lib/nrf_modem_lib/netif/netif.c
Outdated
@@ -452,3 +450,14 @@ int lte_connectivity_options_get(struct conn_mgr_conn_binding *const if_conn, in | |||
|
|||
return 0; | |||
} | |||
|
|||
/* Bind L2 connectity APIs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
/* Bind L2 connectity APIs. | |
/* Bind L2 connectivity APIs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact I would go so far as to suggest
/* Bind conn_mgr APIs */
L2 connectivity
is I think a mistaken reference to an old name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, will update
lib/nrf_modem_lib/nrf91_sockets.c
Outdated
CONN_MGR_BIND_CONN(nrf91_socket, LTE_CONNECTIVITY); | ||
#endif /* CONFIG_LTE_CONNECTIVITY */ | ||
#if defined(CONFIG_NRF_MODEM_LIB_NETIF) | ||
extern struct conn_mgr_conn_api conn_api; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this struct, as included as extern, should have a more explicit name, e.g. nrf_modem_lib_netif_conn_api
etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point
@@ -24,23 +24,23 @@ cmock_handle(${ZEPHYR_NRFXLIB_MODULE_DIR}/nrf_modem/include/nrf_gai_errors.h) | |||
cmock_handle(${ZEPHYR_NRFXLIB_MODULE_DIR}/nrf_modem/include/nrf_modem_os.h) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the folder with these tests should be renamed.
What are your thoughts on naming it I know you have placed it in the alternatively: Also, since |
You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds. Note: This comment is automatically posted by the Documentation Publishing GitHub Action. |
lib/nrf_modem_lib/netif/netif.c
Outdated
@@ -452,3 +450,14 @@ int lte_connectivity_options_get(struct conn_mgr_conn_binding *const if_conn, in | |||
|
|||
return 0; | |||
} | |||
|
|||
/* Bind L2 connectity APIs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact I would go so far as to suggest
/* Bind conn_mgr APIs */
L2 connectivity
is I think a mistaken reference to an old name
lib/nrf_modem_lib/nrf91_sockets.c
Outdated
CONN_MGR_CONN_DEFINE(NRF_MODEM_LIB_NETIF, &conn_api); | ||
CONN_MGR_BIND_CONN(nrf91_socket, NRF_MODEM_LIB_NETIF); | ||
#endif /* CONFIG_NRF_MODEM_LIB_NETIF */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I personally find these closure comments /* CONFIG_NRF_MODEM_LIB_NETIF */
helpful, even for short #if
spans
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I can add it back.
Also, just heads up, I'm not sure which of ours will merge first: |
Ah, one final thing to consider: It would be nice if both this and its Wi-Fi counterpart ended up with consistent naming: Currently it is named |
That's a good idea.
I think it's good to keep the two things separated, socket offloading and |
yes, definitely |
lib/nrf_modem_lib/netif/netif.c
Outdated
.disconnect = nrf_modem_lib_netif_disconnect, | ||
.set_opt = nrf_modem_lib_netif_options_set, | ||
.get_opt = nrf_modem_lib_netif_options_get, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the actual Zephyr net_if
definition for nRF91 also be moved here, if we want to abstract Zephyr integration stuff? Currently done in https://github.com/nrfconnect/sdk-nrf/blob/main/lib/nrf_modem_lib/nrf91_sockets.c#L1129
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be done but we'd need to extern all the nrf91 socket APIs, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually not; I'll look into this but ideally we should keep the two things separate, socket offloading and net_if wrapper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
`lte_connectivity` is not a good name for this component. It is possible to have full LTE connectivity without it. Rather, what it does is provide support for Zephyr net_if API, allowing the application to control the nRF91 as a Zephyr network interface. Rename to componenent `lte_net_if` and prefix Kconfig with `NRF_MODEM_LIB` to indicate that it belongs to the nrf_modem library NCS integration layer. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
The `lte_net_if` component (formerly `lte_connectivity`) does not need its own header, since it does not add any API for the use. Rather, it provides support for Zephyr's net_if API. Remove the `lte_net_if.h` file, and move the macros for the network interface options to `nrf_modem_lib.h`. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Include missing header, minor build system changes. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Move the Kconfig menu entry so that it doesn't appear below the entries that are deprecated. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Only show if component is selected. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Some thoughts.
|
NCS shall not support the auto-initialization of the nRF91 modem during system init (`SYS_INIT`). The initialization of the modem is a blocking operation that can take several minutes, during which the application has not even reached main() and is unable to do anything. Further, the initialization result must be known to the application, but `SYS_INIT` does not return anything to the application. This is simply not acceptable in real products, and we shall not provide such an option in NCS libraries. If the user wants, they can easily add that themselves. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
lte_connectivity
-> netif
lte_connectivity
-> lte_net_if
That seems reasonable to me -- @simensrostad do you have thoughts?
I'm not sure we should get rid of this flag -- it arises from a fundamental ambiguity about what the nature of Perspective 1: IF_DOWN_DISCONNECT user (net_if_xxx purist)From this perspective, In that case, Furthermore, from this perspective, the call to Perspective 2: IF_DOWN_SHUTDOWN user (functionality maximalist / symmetry purist)From this perspective, In that case, the call to Because both of these perspectives have their merits, I think it is probably reasonable to keep both options I'd be open to marking one option or the other as experimental, though, (assuming that is possible) until this solution becomes more mature. Maybe we will find that there really is no demand for one perspective or the other |
I think it's bad to have ambiguity as to what an API does; we should settle on what we want those to do for the LTE modem, and remove flags that modify the API behavior. If Otherwise, we accept that they manage the power status (always).
I do not agree with this, we should settle on what semantics we want for |
I think the last point is important, let me clarify what I mean about not knowing what APIs to use. These are all the different ways to turn on the modem (perhaps):
To turn off the modem:
To attach to the LTE network:
To detach from the LTE network:
I might have missed some, you can see why. The issue I see here is that there are too many APIs/ways to do the same thing; this is only further exacerbated by APIs that change behavior based on flags. |
lib/nrf_modem_lib/Kconfig.modemlib
Outdated
config NRF_MODEM_LIB_NET_IF_AUTO_START | ||
bool "Network interface auto-start" | ||
depends on NRF_MODEM_LIB_NET_IF | ||
default y | ||
help | ||
If this option is enabled, the modem is automatically initialized from the main context | ||
at SYS init. | ||
Initialization of the modem might take some time, so bear in mind that the main context | ||
will be blocked for that duration. | ||
If this option is disabled the modem must be manually initialized by bringing | ||
the network interface's administrative state up by calling net_if_up(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed this in my earlier reviews, I was confused -- Do not remove this, it has nothing to do with NRF_MODEM_LIB_SYS_INIT
It is a convenience KConfig that controls the value of NET_IF_NO_AUTO_START
for the LTE iface. We definitely don't want to get rid of it.
The description in KConfig is a bit misleading -- It's technically correct because net_if_up
does initialize the modem, and NET_IF_NO_AUTO_START
causes net_if_up
to be called by Zephyr on boot, but the setting is really about controlling NET_IF_NO_AUTO_START
.
If anything I think the description just needs to be updated to talk directly about net_if_up
and NET_IF_NO_AUTO_START
rather than the implicit consequences of that flag being set/unset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this line for where it is used:
sdk-nrf/lib/nrf_modem_lib/nrf91_sockets.c
Line 1106 in b88446c
if (!IS_ENABLED(CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_START)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's technically correct because net_if_up does initialize the modem, and NET_IF_NO_AUTO_START causes net_if_up to be called by Zephyr on boot
There is a big problem with that. I have tried to explain it in the comment below.
I am not really convinced that it is detrimental to allow the In my eyes, we have three pretty nice abstraction levels, and the user is free to choose which level of abstraction is appropriate for their application:
Everything else you list are just flags which cause some combination of I personally feel that as long as the descriptions are written clearly (IE: Always in terms of which I also strongly hesitate to conclude on a single behavior from among the two options. Generally the samples that the Portland team is responsible for don't actually need But I would not want to choose I would also not want to choose It isn't clear to me which of the above two scenarios is more likely. Arguably, both are quite likely, and so we cannot remove one of the two options without harming a reasonable use-case. But if we really must choose, I am inclined to suggest that we postpone that decision until later, when use cases are potentially more clear |
Automatically turning on the modem in Turning on the modem is an operation that blocks for up to two minutes due to the time it takes to execute the update. I cannot see a good reason why a product developer would want that. Finally, if the user is really inclined, they can just declare a one-line Automatically initializing the modem in To conclude, if Then onto the flags (shutdown/lte-disconnect) and Kconfig (auto-connect, auto-down).
That is what I am trying to achieve with this PR, currently, like I have shown above, there are 4 ways to do most things, for example attach/detach from the network:
The fourth way consist of As you can see, the This is not at all a clear abstraction; it creates confusion as to what these functions do each time they are called. I think we should at the very least remove the flags to change the behavior of There is a dedicated API to detach, so what do we achieve by extending another API with a flag to let it do the same thing? This would at least remove the ambiguity as to what Again, there is a dedicate API to attach, so what do we achieve by extending |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
I can unblock this if you remove the changes that aren't related to the rename We discussed offline that the other changes require a group meeting before moving forward |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
lte_connectivity
was not a good name, because LTE connectivity is possible regardless of this component.NRF_MODEM_LIB_NET_IF_AUTO_START
; this shouldn't be supported any longer in NCS.lte_connectivity.h
. I will add its contents to libmodem's documentation as part of this PR.Missing doc & changelog updates.