Skip to content

Commit

Permalink
net: openthread: make receive sensitivity configurable
Browse files Browse the repository at this point in the history
OpenThread route cost calculations are dependent on this
being accurate for the hardware design.

(cherry picked from commit 89b7336)

Original-Signed-off-by: Nick Ward <[email protected]>
GitOrigin-RevId: 89b7336
Cr-Build-Id: 8733565196572304993
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8733565196572304993
Copybot-Job-Name: zephyr-main-copybot-downstream
Change-Id: I0e9470729f85f8c7f94471bac5b0192f286e37f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5934668
Tested-by: Dawid Niedźwiecki <[email protected]>
Reviewed-by: Dawid Niedźwiecki <[email protected]>
Reviewed-by: Jeremy Bettis <[email protected]>
Commit-Queue: Dawid Niedźwiecki <[email protected]>
  • Loading branch information
nixward authored and Chromeos LUCI committed Oct 21, 2024
1 parent 1b32502 commit d8d40f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 7 additions & 0 deletions modules/openthread/Kconfig.thread
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ config OPENTHREAD_MAC_STAY_AWAKE_BETWEEN_FRAGMENTS
help
This optimization is done at the expense of power consumption on SED/SSED devices.

config OPENTHREAD_DEFAULT_RX_SENSITIVITY
int "OpenThread default RX sensitivity in dBm"
range $(INT8_MIN) $(INT8_MAX)
default -100
help
Set the default receive sensitivity [dBm] in radio driver.

config OPENTHREAD_DEFAULT_TX_POWER
int "OpenThread default tx power in dBm"
range -40 20 if NRF_802154_RADIO_DRIVER
Expand Down
4 changes: 1 addition & 3 deletions modules/openthread/platform/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_OPENTHREAD_L2_LOG_LEVEL);
*/
#define PHR_DURATION_US 32U

#define DEFAULT_SENSITIVITY -100

enum pending_events {
PENDING_EVENT_FRAME_TO_SEND, /* There is a tx frame to send */
PENDING_EVENT_FRAME_RECEIVED, /* Radio has received new frame */
Expand Down Expand Up @@ -1173,7 +1171,7 @@ int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
ARG_UNUSED(aInstance);

return DEFAULT_SENSITIVITY;
return CONFIG_OPENTHREAD_DEFAULT_RX_SENSITIVITY;
}

otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
Expand Down
1 change: 1 addition & 0 deletions tests/subsys/openthread/radio_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define OT_WORKER_PRIORITY K_PRIO_COOP(CONFIG_OPENTHREAD_THREAD_PRIORITY)
#define CONFIG_NET_L2_OPENTHREAD 1
#define CONFIG_OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE 512
#define CONFIG_OPENTHREAD_DEFAULT_RX_SENSITIVITY -100
#define CONFIG_OPENTHREAD_DEFAULT_TX_POWER 0

/* file itself */
Expand Down

0 comments on commit d8d40f6

Please sign in to comment.