net: ieee802154: Fix ack check

15.4 MHR is no longer set in net_buf pointed by net_pkt, but in a
separate net_buf, hence we need to check that net_buf now to
determine if we need to wait for ACK or not.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2019-01-16 14:29:05 +01:00 committed by Jukka Rissanen
commit 635191ac8c
4 changed files with 8 additions and 8 deletions

View file

@ -606,7 +606,7 @@ static int kw41z_tx(struct device *dev, struct net_pkt *pkt,
*/ */
/* Perform automatic reception of ACK frame, if required */ /* Perform automatic reception of ACK frame, if required */
if (ieee802154_is_ar_flag_set(pkt)) { if (ieee802154_is_ar_flag_set(frag)) {
tx_timeout = kw41z->tx_warmup_time + KW41Z_SHR_PHY_TIME + tx_timeout = kw41z->tx_warmup_time + KW41Z_SHR_PHY_TIME +
payload_len * KW41Z_PER_BYTE_TIME + 10 + payload_len * KW41Z_PER_BYTE_TIME + 10 +
KW41Z_ACK_WAIT_TIME; KW41Z_ACK_WAIT_TIME;

View file

@ -1098,8 +1098,8 @@ static int mcr20a_tx(struct device *dev,
struct net_buf *frag) struct net_buf *frag)
{ {
struct mcr20a_context *mcr20a = dev->driver_data; struct mcr20a_context *mcr20a = dev->driver_data;
u8_t seq = ieee802154_is_ar_flag_set(pkt) ? MCR20A_XCVSEQ_TX_RX : u8_t seq = ieee802154_is_ar_flag_set(frag) ? MCR20A_XCVSEQ_TX_RX :
MCR20A_XCVSEQ_TX; MCR20A_XCVSEQ_TX;
int retval; int retval;
k_mutex_lock(&mcr20a->phy_mutex, K_FOREVER); k_mutex_lock(&mcr20a->phy_mutex, K_FOREVER);

View file

@ -114,16 +114,16 @@ struct ieee802154_radio_api {
/** /**
* @brief Check if AR flag is set on the frame inside given net_pkt * @brief Check if AR flag is set on the frame inside given net_pkt
* *
* @param pkt A valid pointer on a net_pkt structure, must not be NULL, * @param frag A valid pointer on a net_buf structure, must not be NULL,
* and its length should be at least made of 1 byte (ACK frames * and its length should be at least made of 1 byte (ACK frames
* are the smallest frames on 15.4 and made of 3 bytes, not * are the smallest frames on 15.4 and made of 3 bytes, not
* not counting the FCS part). * not counting the FCS part).
* *
* @return True if AR flag is set, False otherwise * @return True if AR flag is set, False otherwise
*/ */
static inline bool ieee802154_is_ar_flag_set(struct net_pkt *pkt) static inline bool ieee802154_is_ar_flag_set(struct net_buf *frag)
{ {
return (*net_pkt_data(pkt) & IEEE802154_AR_FLAG_SET); return (*frag->data & IEEE802154_AR_FLAG_SET);
} }
#ifndef CONFIG_IEEE802154_RAW_MODE #ifndef CONFIG_IEEE802154_RAW_MODE

View file

@ -25,10 +25,10 @@ static inline bool prepare_for_ack(struct ieee802154_context *ctx,
struct net_pkt *pkt, struct net_pkt *pkt,
struct net_buf *frag) struct net_buf *frag)
{ {
if (ieee802154_is_ar_flag_set(pkt)) { if (ieee802154_is_ar_flag_set(frag)) {
struct ieee802154_fcf_seq *fs; struct ieee802154_fcf_seq *fs;
fs = (struct ieee802154_fcf_seq *)net_pkt_data(pkt); fs = (struct ieee802154_fcf_seq *)frag->data;
ctx->ack_seq = fs->sequence; ctx->ack_seq = fs->sequence;
ctx->ack_received = false; ctx->ack_received = false;