Skip to content

Commit 314231f

Browse files
ankunsrlubos
authored andcommitted
[nrf fromtree] drivers: ieee802154: add Kconfig IEEE802154_SELECTIVE_TXCHANNEL
The Kconfig `IEEE802154_SELECTIVE_TXCHANNEL` is added along with the new capability `IEEE802154_HW_SELECTIVE_TXCHANNEL`. The new capability of the ieee802154 drivers allows to schedule CSL transmissions as stated in IEEE 802.15.4-2020 chapter 6.12.2.7 CSL over multiple channels. The benefit of the new API is that additional call to `ieee802154_radio_api::set_channel()` is not required. The drivers will switch to the new channel as late as possible for CSL transmissions thus will not interrupt any reception that might be in progress until the very late moment when the transmission actually starts. This improves reception performance when CSL transmissions are used. Signed-off-by: Damian Krolik <[email protected]> Signed-off-by: Andrzej Kuroś <[email protected]> (cherry picked from commit 2fbba82)
1 parent a7fe5f7 commit 314231f

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed

drivers/ieee802154/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ config IEEE802154_CSL_DEBUG
9292
help
9393
Enable support for CSL debugging by avoiding sleep state in favor of receive state.
9494

95+
config IEEE802154_SELECTIVE_TXCHANNEL
96+
bool "Support for selective TX channel setting"
97+
help
98+
Enable support for selectively setting TX channel for every timed transmission request.
99+
The drivers MAY have the capability IEEE802154_HW_SELECTIVE_TXCHANNEL only if
100+
this Kconfig option is enabled. If the Kconfig option is disabled the drivers
101+
MUST NOT have the capability.
102+
95103
module = IEEE802154_DRIVER
96104
module-str = IEEE 802.15.4 driver
97105
module-help = Sets log level for IEEE 802.15.4 Device Drivers.

include/zephyr/net/ieee802154_pkt.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ struct net_pkt_cb_ieee802154 {
5959
*/
6060
uint8_t rssi;
6161
};
62+
struct {
63+
#if defined(CONFIG_IEEE802154_SELECTIVE_TXCHANNEL)
64+
/* The channel used for timed transmissions.
65+
*
66+
* Please refer to `ieee802154_radio_api::tx` documentation for
67+
* details.
68+
*/
69+
uint8_t txchannel;
70+
#endif /* CONFIG_IEEE802154_SELECTIVE_TXCHANNEL */
71+
};
6272
};
6373

6474
/* Flags */
@@ -179,6 +189,18 @@ static inline void net_pkt_set_ieee802154_rssi_dbm(struct net_pkt *pkt, int16_t
179189
CODE_UNREACHABLE;
180190
}
181191

192+
#if defined(CONFIG_IEEE802154_SELECTIVE_TXCHANNEL)
193+
static inline uint8_t net_pkt_ieee802154_txchannel(struct net_pkt *pkt)
194+
{
195+
return net_pkt_cb_ieee802154(pkt)->txchannel;
196+
}
197+
198+
static inline void net_pkt_set_ieee802154_txchannel(struct net_pkt *pkt, uint8_t channel)
199+
{
200+
net_pkt_cb_ieee802154(pkt)->txchannel = channel;
201+
}
202+
#endif /* CONFIG_IEEE802154_SELECTIVE_TXCHANNEL */
203+
182204
static inline bool net_pkt_ieee802154_ack_fpb(struct net_pkt *pkt)
183205
{
184206
return net_pkt_cb_ieee802154(pkt)->ack_fpb;

include/zephyr/net/ieee802154_radio.h

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,13 +520,26 @@ enum ieee802154_hw_caps {
520520
/** RxOnWhenIdle handling supported */
521521
IEEE802154_RX_ON_WHEN_IDLE = BIT(12),
522522

523+
/** Support for timed transmissions on selective channel.
524+
*
525+
* This capability informs that transmissions with modes
526+
* @ref IEEE802154_TX_MODE_TXTIME and @ref IEEE802154_TX_MODE_TXTIME_CCA support
527+
* scheduling of timed transmissions on selective tx channel.
528+
* The driver MAY have this capability only if the Kconfig option
529+
* `CONFIG_IEEE802154_SELECTIVE_TXCHANNEL` is set, otherwise the driver MUST
530+
* NOT have this capability.
531+
*
532+
* Please refer to the `ieee802154_radio_api::tx` documentation for details.
533+
*/
534+
IEEE802154_HW_SELECTIVE_TXCHANNEL = BIT(13),
535+
523536
/* Note: Update also IEEE802154_HW_CAPS_BITS_COMMON_COUNT when changing
524537
* the ieee802154_hw_caps type.
525538
*/
526539
};
527540

528541
/** @brief Number of bits used by ieee802154_hw_caps type. */
529-
#define IEEE802154_HW_CAPS_BITS_COMMON_COUNT (13)
542+
#define IEEE802154_HW_CAPS_BITS_COMMON_COUNT (14)
530543

531544
/** @brief This and higher values are specific to the protocol- or driver-specific extensions. */
532545
#define IEEE802154_HW_CAPS_BITS_PRIV_START IEEE802154_HW_CAPS_BITS_COMMON_COUNT
@@ -625,6 +638,8 @@ enum ieee802154_tx_mode {
625638
* Transmit packet in the future, at the specified time, no CCA.
626639
*
627640
* @note requires IEEE802154_HW_TXTIME capability.
641+
*
642+
* @note capability IEEE802154_HW_SELECTIVE_TXCHANNEL may apply.
628643
*/
629644
IEEE802154_TX_MODE_TXTIME,
630645

@@ -635,6 +650,8 @@ enum ieee802154_tx_mode {
635650
*
636651
* @note Required for Thread 1.2 Coordinated Sampled Listening feature
637652
* (see Thread specification 1.2.0, ch. 3.2.6.3).
653+
*
654+
* @note capability IEEE802154_HW_SELECTIVE_TXCHANNEL may apply.
638655
*/
639656
IEEE802154_TX_MODE_TXTIME_CCA,
640657

@@ -1657,6 +1674,23 @@ struct ieee802154_radio_api {
16571674
* considerable idle waiting time. SHALL return `-ENETDOWN` unless the
16581675
* interface is "UP".
16591676
*
1677+
* @note The transmission occurs on the radio channel set by the call to
1678+
* `set_channel()`. However, if the `CONFIG_IEEE802154_SELECTIVE_TXCHANNEL`
1679+
* is set and the driver has the capability `IEEE802154_HW_SELECTIVE_TXCHANNEL`
1680+
* then the transmissions requested with `mode` IEEE802154_TX_MODE_TXTIME
1681+
* or `IEEE802154_TX_MODE_TXTIME_CCA` SHALL use the radio channel
1682+
* returned by `net_pkt_ieee802154_txchannel()` to transmit the packet
1683+
* and receive an ACK on that channel if the frame requested it. After
1684+
* the operation the driver should return to the channel set previously by
1685+
* `set_channel()` call.
1686+
* It is responsibility of an upper layer to set the required radio channel
1687+
* for the packet by a call to `net_pkt_set_ieee802154_txchannel()`.
1688+
* This feature allows CSL transmissions as stated in IEEE 802.15.4-2020
1689+
* chapter 6.12.2.7 CSL over multiple channels. This feature allows to perform
1690+
* a switch of the radio channel as late as possible before transmission without
1691+
* interrupting possible reception that could occur if separate `set_channel()`
1692+
* was called.
1693+
*
16601694
* @param dev pointer to IEEE 802.15.4 driver device
16611695
* @param mode the transmission mode, some of which require specific
16621696
* offloading capabilities.

include/zephyr/net/ieee802154_radio_openthread.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ enum ieee802154_openthread_tx_mode {
6464
* section 11.3, table 11-2).
6565
*
6666
* Requires IEEE802154_OPENTHREAD_HW_MULTIPLE_CCA capability.
67+
*
68+
* @note Capability @ref IEEE802154_HW_SELECTIVE_TXCHANNEL applies as for
69+
* @ref IEEE802154_TX_MODE_TXTIME_CCA.
6770
*/
6871
IEEE802154_OPENTHREAD_TX_MODE_TXTIME_MULTIPLE_CCA = IEEE802154_TX_MODE_PRIV_START
6972
};

0 commit comments

Comments
 (0)