Skip to content

Commit 5767998

Browse files
edmontcarlescufi
authored andcommitted
drivers: ieee802154: nrf: make selective tx power the default
Remove `IEEE802154_SELECTIVE_TXPOWER` option. Cache the tx power value in nRF5 driver and make use of it on each operation. Signed-off-by: Eduardo Montoya <[email protected]> Signed-off-by: Jędrzej Ciupis <[email protected]>
1 parent 1bbaaef commit 5767998

File tree

6 files changed

+17
-42
lines changed

6 files changed

+17
-42
lines changed

doc/releases/release-notes-3.6.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ Drivers and Sensors
182182

183183
* IEEE 802.15.4
184184

185+
* Removed :kconfig:option:`CONFIG_IEEE802154_SELECTIVE_TXPOWER` Kconfig option.
186+
185187
* Interrupt Controller
186188

187189
* Input

drivers/ieee802154/Kconfig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ config IEEE802154_CSL_DEBUG
9898
help
9999
Enable support for CSL debugging by avoiding sleep state in favor of receive state.
100100

101-
config IEEE802154_SELECTIVE_TXPOWER
102-
bool "Support selective TX power setting"
103-
help
104-
Enable support for selectively setting TX power for every transmission request.
105-
106101
module = IEEE802154_DRIVER
107102
module-str = IEEE 802.15.4 driver
108103
module-help = Sets log level for IEEE 802.15.4 Device Drivers.

drivers/ieee802154/ieee802154_nrf5.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static int nrf5_set_txpower(const struct device *dev, int16_t dbm)
375375

376376
LOG_DBG("%d", dbm);
377377

378-
nrf_802154_tx_power_set(dbm);
378+
nrf5_data.txpwr = dbm;
379379

380380
return 0;
381381
}
@@ -454,10 +454,8 @@ static bool nrf5_tx_immediate(struct net_pkt *pkt, uint8_t *payload, bool cca)
454454
},
455455
.cca = cca,
456456
.tx_power = {
457-
.use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER),
458-
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
459-
.power = net_pkt_ieee802154_txpwr(pkt),
460-
#endif
457+
.use_metadata_value = true,
458+
.power = nrf5_data.txpwr,
461459
},
462460
};
463461

@@ -473,10 +471,8 @@ static bool nrf5_tx_csma_ca(struct net_pkt *pkt, uint8_t *payload)
473471
.dynamic_data_is_set = net_pkt_ieee802154_mac_hdr_rdy(pkt),
474472
},
475473
.tx_power = {
476-
.use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER),
477-
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
478-
.power = net_pkt_ieee802154_txpwr(pkt),
479-
#endif
474+
.use_metadata_value = true,
475+
.power = nrf5_data.txpwr,
480476
},
481477
};
482478

@@ -519,10 +515,8 @@ static bool nrf5_tx_at(struct nrf5_802154_data *nrf5_radio, struct net_pkt *pkt,
519515
.cca = cca,
520516
.channel = nrf_802154_channel_get(),
521517
.tx_power = {
522-
.use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER),
523-
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
524-
.power = net_pkt_ieee802154_txpwr(pkt),
525-
#endif
518+
.use_metadata_value = true,
519+
.power = nrf5_data.txpwr,
526520
},
527521
#if defined(CONFIG_IEEE802154_NRF5_MULTIPLE_CCA)
528522
.extra_cca_attempts = max_extra_cca_attempts,
@@ -660,6 +654,8 @@ static int nrf5_start(const struct device *dev)
660654
{
661655
ARG_UNUSED(dev);
662656

657+
nrf_802154_tx_power_set(nrf5_data.txpwr);
658+
663659
if (!nrf_802154_receive()) {
664660
LOG_ERR("Failed to enter receive state");
665661
return -EIO;
@@ -702,6 +698,8 @@ static int nrf5_continuous_carrier(const struct device *dev)
702698
{
703699
ARG_UNUSED(dev);
704700

701+
nrf_802154_tx_power_set(nrf5_data.txpwr);
702+
705703
if (!nrf_802154_continuous_carrier()) {
706704
LOG_ERR("Failed to enter continuous carrier state");
707705
return -EIO;

drivers/ieee802154/ieee802154_nrf5.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ struct nrf5_802154_data {
9797
uint8_t max_extra_cca_attempts;
9898
#endif
9999

100+
/* The TX power in dBm. */
101+
int8_t txpwr;
102+
100103
#if defined(CONFIG_NRF_802154_SER_HOST) && defined(CONFIG_IEEE802154_CSL_ENDPOINT)
101104
/* The last configured value of CSL period in units of 10 symbols. */
102105
uint32_t csl_period;

include/zephyr/net/ieee802154_pkt.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ struct net_pkt_cb_ieee802154 {
5959
*/
6060
uint8_t rssi;
6161
};
62-
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
63-
/* TX packets */
64-
struct {
65-
int8_t txpwr; /* TX power in dBm. */
66-
};
67-
#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */
6862
};
6963

7064
/* Flags */
@@ -185,18 +179,6 @@ static inline void net_pkt_set_ieee802154_rssi_dbm(struct net_pkt *pkt, int16_t
185179
CODE_UNREACHABLE;
186180
}
187181

188-
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
189-
static inline int8_t net_pkt_ieee802154_txpwr(struct net_pkt *pkt)
190-
{
191-
return net_pkt_cb_ieee802154(pkt)->txpwr;
192-
}
193-
194-
static inline void net_pkt_set_ieee802154_txpwr(struct net_pkt *pkt, int8_t txpwr)
195-
{
196-
net_pkt_cb_ieee802154(pkt)->txpwr = txpwr;
197-
}
198-
#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */
199-
200182
static inline bool net_pkt_ieee802154_ack_fpb(struct net_pkt *pkt)
201183
{
202184
return net_pkt_cb_ieee802154(pkt)->ack_fpb;

modules/openthread/platform/radio.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,8 @@ void transmit_message(struct k_work *tx_job)
384384

385385
channel = sTransmitFrame.mChannel;
386386

387-
radio_api->set_channel(radio_dev, sTransmitFrame.mChannel);
388-
389-
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
390-
net_pkt_set_ieee802154_txpwr(tx_pkt, get_transmit_power_for_channel(channel));
391-
#else
387+
radio_api->set_channel(radio_dev, channel);
392388
radio_api->set_txpower(radio_dev, get_transmit_power_for_channel(channel));
393-
#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */
394389

395390
net_pkt_set_ieee802154_frame_secured(tx_pkt,
396391
sTransmitFrame.mInfo.mTxInfo.mIsSecurityProcessed);

0 commit comments

Comments
 (0)