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

Bluetooth: Mesh: Added support for randomly delaying publications #66498

Merged
merged 1 commit into from Dec 18, 2023

Conversation

PavelVPV
Copy link
Collaborator

The section 3.7.3.1 of the mesh specification recommends to delay a message publication in certain cases:

  • at power-up or upon state change for a time between 20 to 500 ms
  • for periodic publications for a time between 20 to 50 ms

This change implements this recommendation by adding the CONFIG_BT_MESH_DELAYABLE_PUBLICATION Kconfig option which enables the randomization code and by adding the bt_mesh_model_pub.delayable bit field which allows each model decide whether the publications should be delayed for this model or not.

Copy link
Collaborator

@akredalen akredalen left a comment

Choose a reason for hiding this comment

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

LGTM :) Just a couple of small doc edits

* Between 20 to 50 milliseconds for periodically published messages

This feature is optional and enabled with the :kconfig:option:`CONFIG_BT_MESH_DELAYABLE_PUBLICATION`
Kconfig option. When enabled, each model can enable or the delayable publication by setting the
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Kconfig option. When enabled, each model can enable or the delayable publication by setting the
Kconfig option. When enabled, each model can enable or disable the delayable publication by setting the

help
When enabled, the periodic publications are randomly delayed by 20 to 50ms. Publications
triggered at the start of the stack or by the bt_mesh_model_publish() call are delayed by
20 to 500ms. This option reduces probability of collisions when multiple nodes publish at
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
20 to 500ms. This option reduces probability of collisions when multiple nodes publish at
20 to 500ms. This option reduces the probability of collisions when multiple nodes publish at

Comment on lines 261 to 262
The delayable publication functionality implements the specification recommendations that delays
a message publication in the following cases:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The delayable publication functionality implements the specification recommendations that delays
a message publication in the following cases:
The delayable publication functionality implements the specification recommendations for message
publication delays in the following cases:

subsys/bluetooth/mesh/Kconfig Show resolved Hide resolved
subsys/bluetooth/mesh/access.c Show resolved Hide resolved
return 0;
}

uint8_t num = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm... whether uint8_t type wide is sufficient to represent random value above 256? Shouldn't it be uint16_t?

Copy link
Collaborator

@alxelax alxelax Dec 15, 2023

Choose a reason for hiding this comment

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

but function still returns uint8_t value. It is still not possible to get random values in range 256 ... 500.

tests/bsim/bluetooth/mesh/src/test_access.c Outdated Show resolved Hide resolved
akredalen
akredalen previously approved these changes Dec 15, 2023
Copy link
Collaborator

@alxelax alxelax left a comment

Choose a reason for hiding this comment

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

still needs a bit more work

subsys/bluetooth/mesh/access.c Outdated Show resolved Hide resolved
subsys/bluetooth/mesh/access.c Outdated Show resolved Hide resolved
@PavelVPV PavelVPV force-pushed the pub_rand branch 2 times, most recently from 6980766 to 5b0bced Compare December 15, 2023 15:40
The section 3.7.3.1 of the mesh specification recommends to delay
a message publication in certain cases:
- at power-up or upon state change for a time between 20 to 500 ms
- for periodic publications for a time between 20 to 50 ms

This change implements this recommendation by adding the
`CONFIG_BT_MESH_DELAYABLE_PUBLICATION` Kconfig option which enables
the randomization code and by adding the `bt_mesh_model_pub.delayable`
bit field which allows each model decide whether the publications
should be delayed for this model or not.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
@carlescufi carlescufi merged commit fe70e50 into zephyrproject-rtos:main Dec 18, 2023
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants