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

lib: lte_link_control: refactor into modules #17266

Merged
merged 3 commits into from
Oct 23, 2024

Conversation

MirkoCovizzi
Copy link
Contributor

@MirkoCovizzi MirkoCovizzi commented Sep 11, 2024

Divides the LTE Link Controller into modules.

Tasks:

  • Modularize: make the architecture modular (rather than monolithic) and easy to understand. Streamline the introduction of new AT commands/functionalities. I have a couple of AT commands I need to add so this is important

  • Identify potential configuration problems that might arise from lte_net_if stack, lte_lc API usage within NCS, or custom overlays

Benefits:

  • Improved structure
  • Improved efficiency because of the increased granularity

What has been changed compared to main:

  • Each AT command (or a subset of adjacent AT commands) sits in its own module that can be toggled with a Kconfig option
  • The work queue and the event handler list have been moved to a common folder and are shared between the modules

TODOs:

  • Add docstrings/comments to new functions
  • Update changelog
  • Update migration guide
  • Extend library documentation to clarify the need to enable Kconfigs for certain features
  • Add missing descriptions/prompts for new Kconfigs

@MirkoCovizzi MirkoCovizzi self-assigned this Sep 11, 2024
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Sep 11, 2024
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Sep 11, 2024

CI Information

To view the history of this post, clich the 'edited' button above
Build number: 109

Inputs:

Sources:

sdk-nrf: PR head: 0101c536961218edf748be9edf1b3a91570ddf84

more details

sdk-nrf:

PR head: 0101c536961218edf748be9edf1b3a91570ddf84
merge base: b2fbe4262015a1219b0e1fc7dde50bb1c7f80296
target head (main): 4b32dada658b7c84a5a7b2e1d59a6a0eefb35419
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (70)
applications
│  ├── asset_tracker_v2
│  │  ├── overlay-lwm2m.conf
│  │  │ prj.conf
doc
│  ├── nrf
│  │  ├── libraries
│  │  │  ├── modem
│  │  │  │  │ lte_lc.rst
│  │  ├── nrf.doxyfile.in
│  │  ├── releases_and_maturity
│  │  │  ├── migration
│  │  │  │  │ migration_guide_2.8.rst
│  │  │  ├── releases
│  │  │  │  │ release-notes-changelog.rst
include
│  ├── modem
│  │  │ lte_lc.h
lib
│  ├── location
│  │  │ Kconfig
│  ├── lte_link_control
│  │  ├── CMakeLists.txt
│  │  ├── Kconfig
│  │  ├── common
│  │  │  ├── CMakeLists.txt
│  │  │  ├── event_handler_list.c
│  │  │  ├── helpers.c
│  │  │  │ work_q.c
│  │  ├── include
│  │  │  ├── common
│  │  │  │  ├── event_handler_list.h
│  │  │  │  ├── helpers.h
│  │  │  │  │ work_q.h
│  │  │  ├── modules
│  │  │  │  ├── cereg.h
│  │  │  │  ├── cfun.h
│  │  │  │  ├── coneval.h
│  │  │  │  ├── cscon.h
│  │  │  │  ├── edrx.h
│  │  │  │  ├── mdmev.h
│  │  │  │  ├── ncellmeas.h
│  │  │  │  ├── periodicsearchconf.h
│  │  │  │  ├── psm.h
│  │  │  │  ├── rai.h
│  │  │  │  ├── redmob.h
│  │  │  │  ├── xfactoryreset.h
│  │  │  │  ├── xmodemsleep.h
│  │  │  │  ├── xsystemmode.h
│  │  │  │  │ xt3412.h
│  │  ├── lte_lc.c
│  │  ├── lte_lc_helpers.c
│  │  ├── lte_lc_helpers.h
│  │  ├── lte_lc_modem_hooks.c
│  │  ├── modules
│  │  │  ├── CMakeLists.txt
│  │  │  ├── Kconfig
│  │  │  ├── cereg.c
│  │  │  ├── cfun.c
│  │  │  ├── coneval.c
│  │  │  ├── cscon.c
│  │  │  ├── edrx.c
│  │  │  ├── mdmev.c
│  │  │  ├── ncellmeas.c
│  │  │  ├── periodicsearchconf.c
│  │  │  ├── psm.c
│  │  │  ├── rai.c
│  │  │  ├── redmob.c
│  │  │  ├── xfactoryreset.c
│  │  │  ├── xmodemsleep.c
│  │  │  ├── xsystemmode.c
│  │  │  │ xt3412.c
modules
│  ├── memfault-firmware-sdk
│  │  │ Kconfig
samples
│  ├── cellular
│  │  ├── battery
│  │  │  │ prj.conf
│  │  ├── gnss
│  │  │  ├── prj.conf
│  │  │  │ sample.yaml
│  │  ├── location
│  │  │  │ prj.conf
│  │  ├── lwm2m_client
│  │  │  ├── overlay-aggressive-psm.conf
│  │  │  │ prj.conf
│  │  ├── modem_shell
│  │  │  │ prj.conf
│  │  ├── nrf_cloud_multi_service
│  │  │  │ prj.conf
│  │  ├── nrf_cloud_rest_cell_location
│  │  │  │ prj.conf
│  │  ├── udp
│  │  │  │ prj.conf
subsys
│  ├── net
│  │  ├── lib
│  │  │  ├── lwm2m_client_utils
│  │  │  │  │ Kconfig
tests
│  ├── lib
│  │  ├── location
│  │  │  ├── Kconfig
│  │  │  │ prj.conf
│  │  ├── lte_lc_api
│  │  │  │ prj.conf
│  ├── subsys
│  │  ├── net
│  │  │  ├── lib
│  │  │  │  ├── lwm2m_client_utils
│  │  │  │  │  │ CMakeLists.txt
│  │  │  │  ├── lwm2m_fota_utils
│  │  │  │  │  │ CMakeLists.txt

Outputs:

Toolchain

Version: 3dd8985b56
Build docker image: docker-dtr.nordicsemi.no/sw-production/ncs-build:3dd8985b56_912848a074

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain - Skipped: existing toolchain is used
  • ✅ Build twister
    • sdk-nrf test count: 314
  • ✅ Integration tests
    • ✅ test-fw-nrfconnect-nrf-iot_cloud
    • ✅ test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
    • ✅ test-fw-nrfconnect-nrf-iot_samples
    • ✅ test-fw-nrfconnect-nrf-iot_lwm2m
    • ✅ test-fw-nrfconnect-nrf-iot_thingy91
    • ✅ test-fw-nrfconnect-nrf-iot_mosh
    • ✅ test-fw-nrfconnect-nrf-iot_positioning
    • ⚠️ test-fw-nrfconnect-fw-update
Disabled integration tests
    • desktop52_verification
    • doc-internal
    • test_ble_nrf_config
    • test-fw-nrfconnect-apps
    • test-fw-nrfconnect-ble_mesh
    • test-fw-nrfconnect-ble_samples
    • test-fw-nrfconnect-boot
    • test-fw-nrfconnect-chip
    • test-fw-nrfconnect-fem
    • test-fw-nrfconnect-nfc
    • test-fw-nrfconnect-nrf-iot_libmodem-nrf
    • test-fw-nrfconnect-nrf-iot_nrf_provisioning
    • test-fw-nrfconnect-nrf-iot_serial_lte_modem
    • test-fw-nrfconnect-nrf_crypto
    • test-fw-nrfconnect-proprietary_esb
    • test-fw-nrfconnect-ps
    • test-fw-nrfconnect-rpc
    • test-fw-nrfconnect-rs
    • test-fw-nrfconnect-tfm
    • test-fw-nrfconnect-thread
    • test-fw-nrfconnect-zigbee
    • test-low-level
    • test-sdk-audio
    • test-sdk-dfu
    • test-sdk-find-my
    • test-sdk-mcuboot
    • test-sdk-pmic-samples
    • test-sdk-sidewalk
    • test-sdk-wifi

Note: This message is automatically posted and updated by the CI

@NordicBuilder
Copy link
Contributor

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.

@MirkoCovizzi MirkoCovizzi force-pushed the llc-refactor branch 4 times, most recently from 00fe095 to 62d626e Compare September 13, 2024 14:09
@MirkoCovizzi MirkoCovizzi changed the title [WIP] lib: lte_link_control: divide into modules [WIP] lib: lte_link_control: refactor into modules Sep 13, 2024
@MirkoCovizzi MirkoCovizzi force-pushed the llc-refactor branch 4 times, most recently from ab799b5 to 1a17a8d Compare September 16, 2024 08:29
@MirkoCovizzi MirkoCovizzi marked this pull request as ready for review September 16, 2024 08:33
@MirkoCovizzi MirkoCovizzi requested review from jhn-nordic and simensrostad and removed request for a team September 16, 2024 08:57
@MirkoCovizzi MirkoCovizzi marked this pull request as draft September 16, 2024 10:20
Copy link
Contributor

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

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

looking much better.

Some questions to reply, and depending on answer / followup jira issues, then I believe it can get a +1.

Comment on lines +49 to +52
-DCONFIG_LTE_LC_EDRX_MODULE=1
-DCONFIG_LTE_LC_NEIGHBOR_CELL_MEAS_MODULE=1
-DCONFIG_LTE_LC_PSM_MODULE=1
-DCONFIG_LTE_LC_TAU_PRE_WARNING_MODULE=1
Copy link
Contributor

Choose a reason for hiding this comment

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

placing a comment to remember why this has been accepted.

This construct is not optimal. This is something to be addressed in future, see: #17266 (comment)

Comment on lines +10 to +13
imply LTE_LC_EDRX_MODULE
imply LTE_LC_NEIGHBOR_CELL_MEAS_MODULE
imply LTE_LC_PSM_MODULE
imply LTE_LC_TAU_PRE_WARNING_MODULE
Copy link
Contributor

Choose a reason for hiding this comment

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

as raised else-where in comments, then I'm a bit unsure if lwm2m actually depends on lte lc modules or not.

And if lwm2m works just as fine with lte lc modules as without, then why the imply ?
I do notice that changing this to a depends on seems to open pandoras box of circular dependencies (including select and imply deps), so far seem to be originating at a bad select FLASH somewhere (still investigating).

But I would like some more reasoning regarding those imply, than just, this makes it work.

Copy link
Contributor Author

@MirkoCovizzi MirkoCovizzi Oct 22, 2024

Choose a reason for hiding this comment

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

@tejlmand lwm2m_client_utils depends on the link controller, but it doesn't show. This is happening because, as far as I understand, the way it is used indirectly brings in the link controller from other components. This is a design flaw because each component should export a contract of its dependencies (in this case via Kconfig), at minimum to document them. This should be addressed, but it requires more work because its tests seem to depend on this design.

Copy link
Contributor

Choose a reason for hiding this comment

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

accepted. To be addressed later.
Please create internal ticket.

@MirkoCovizzi MirkoCovizzi force-pushed the llc-refactor branch 3 times, most recently from fe06404 to 1df0844 Compare October 22, 2024 14:27
Copy link
Contributor

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

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

approved. see conditions in comments.

@MirkoCovizzi
Copy link
Contributor Author

looking much better.

Some questions to reply, and depending on answer / followup jira issues, then I believe it can get a +1.

NCSDK-29864

Copy link
Contributor

@trantanen trantanen left a comment

Choose a reason for hiding this comment

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

Good ~12kB flash improvement for those using just the core features.
And nice code restructuring for maintenance.

@MirkoCovizzi MirkoCovizzi added the CI-all-test Run All integration tests label Oct 23, 2024
@MirkoCovizzi MirkoCovizzi force-pushed the llc-refactor branch 2 times, most recently from 16d92c4 to a8080e6 Compare October 23, 2024 11:01
@MirkoCovizzi MirkoCovizzi removed the CI-all-test Run All integration tests label Oct 23, 2024
MirkoCovizzi and others added 2 commits October 23, 2024 15:42
Divides the LTE Link Controller into modules.

Signed-off-by: Mirko Covizzi <[email protected]>
Co-authored-by: divya pillai <[email protected]>
Removes linking to removed functions in the LTE link
controller.

Signed-off-by: Mirko Covizzi <[email protected]>
Use the proper macro instead of a hardcoded string.

Signed-off-by: Mirko Covizzi <[email protected]>
@rlubos rlubos merged commit cbf1d39 into nrfconnect:main Oct 23, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-required PR must not be merged without tech writer approval.
Projects
None yet
Development

Successfully merging this pull request may close these issues.