net: pkt: add IEEE 802.15.4 TX power field
This commit extends the `struct net_pkt` structure with `ieee802154_txpwr` field that contains signed value of the desired transmission power of a IEEE 802.15.4 frame in dBm. Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
This commit is contained in:
parent
a44664e95b
commit
644da741f4
3 changed files with 36 additions and 7 deletions
|
@ -142,6 +142,11 @@ config IEEE802154_CSL_ENDPOINT
|
|||
help
|
||||
Enable support for CSL Endpoint with delayed reception handling and CSL IE injection.
|
||||
|
||||
config IEEE802154_SELECTIVE_TXPOWER
|
||||
bool "Support selective TX power setting"
|
||||
help
|
||||
Enable support for selectively setting TX power for every transmission request.
|
||||
|
||||
module = IEEE802154_DRIVER
|
||||
module-str = IEEE 802.15.4 driver
|
||||
module-help = Sets log level for IEEE 802.15.4 Device Drivers.
|
||||
|
|
|
@ -243,8 +243,24 @@ struct net_pkt {
|
|||
#endif /* CONFIG_NET_IPV6 */
|
||||
|
||||
#if defined(CONFIG_IEEE802154)
|
||||
uint8_t ieee802154_rssi; /* Received Signal Strength Indication */
|
||||
#if defined(CONFIG_IEEE802154_2015)
|
||||
uint32_t ieee802154_ack_fc; /* Frame counter set in the ACK */
|
||||
uint8_t ieee802154_ack_keyid; /* Key index set in the ACK */
|
||||
#endif
|
||||
uint8_t ieee802154_lqi; /* Link Quality Indicator */
|
||||
union {
|
||||
uint8_t ieee802154_rssi; /* Received Signal Strength Indication */
|
||||
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
|
||||
int8_t ieee802154_txpwr; /* TX power in dBm. It should be clear from
|
||||
* the context which field of the union
|
||||
* is valid at the moment.
|
||||
*/
|
||||
#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */
|
||||
};
|
||||
#if defined(CONFIG_IEEE802154_2015)
|
||||
uint8_t ieee802154_fv2015 : 1; /* Frame version is IEEE 802.15.4-2015 */
|
||||
uint8_t ieee802154_ack_seb : 1; /* Security Enabled Bit was set in the ACK */
|
||||
#endif
|
||||
uint8_t ieee802154_arb : 1; /* ACK Request Bit is set in the frame */
|
||||
uint8_t ieee802154_ack_fpb : 1; /* Frame Pending Bit was set in the ACK */
|
||||
uint8_t ieee802154_frame_secured : 1; /* Frame is authenticated and
|
||||
|
@ -256,12 +272,6 @@ struct net_pkt {
|
|||
* it requires further modifications,
|
||||
* e.g. Frame Counter injection.
|
||||
*/
|
||||
#if defined(CONFIG_IEEE802154_2015)
|
||||
uint8_t ieee802154_fv2015 : 1; /* Frame version is IEEE 802.15.4-2015 */
|
||||
uint8_t ieee802154_ack_seb : 1; /* Security Enabled Bit was set in the ACK */
|
||||
uint32_t ieee802154_ack_fc; /* Frame counter set in the ACK */
|
||||
uint8_t ieee802154_ack_keyid; /* Key index set in the ACK */
|
||||
#endif
|
||||
#endif
|
||||
/* @endcond */
|
||||
};
|
||||
|
@ -1117,6 +1127,19 @@ static inline void net_pkt_set_ieee802154_ack_keyid(struct net_pkt *pkt,
|
|||
pkt->ieee802154_ack_keyid = keyid;
|
||||
}
|
||||
#endif /* CONFIG_IEEE802154_2015 */
|
||||
|
||||
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
|
||||
static inline int8_t net_pkt_ieee802154_txpwr(struct net_pkt *pkt)
|
||||
{
|
||||
return pkt->ieee802154_txpwr;
|
||||
}
|
||||
|
||||
static inline void net_pkt_set_ieee802154_txpwr(struct net_pkt *pkt,
|
||||
int8_t txpwr)
|
||||
{
|
||||
pkt->ieee802154_txpwr = txpwr;
|
||||
}
|
||||
#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */
|
||||
#endif /* CONFIG_IEEE802154 || CONFIG_IEEE802154_RAW_MODE */
|
||||
|
||||
#if defined(CONFIG_NET_IPV4_AUTO)
|
||||
|
|
|
@ -1793,6 +1793,7 @@ static void clone_pkt_attributes(struct net_pkt *pkt, struct net_pkt *clone_pkt)
|
|||
}
|
||||
|
||||
#if defined(CONFIG_IEEE802154)
|
||||
/* ieee802154_rssi and ieee802154_txpwr form a union, copying one of them is enough */
|
||||
net_pkt_set_ieee802154_rssi(clone_pkt, net_pkt_ieee802154_rssi(pkt));
|
||||
net_pkt_set_ieee802154_lqi(clone_pkt, net_pkt_ieee802154_lqi(pkt));
|
||||
net_pkt_set_ieee802154_arb(clone_pkt, net_pkt_ieee802154_arb(pkt));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue