Skip to content

Commit 3f3c4bb

Browse files
alexaringholtmann
authored andcommitted
mac802154: correct max sifs size handling
This patch fix the max sifs size correction when the IEEE802154_HW_TX_OMIT_CKSUM flag is set. With this flag the sk_buff doesn't contain the CRC, because the transceiver will add the CRC while transmit. Also add some defines for the max sifs frame size value and frame check sequence according to 802.15.4 standard. Signed-off-by: Alexander Aring <[email protected]> Acked-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 022d07e commit 3f3c4bb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

include/linux/ieee802154.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#define IEEE802154_MTU 127
3131
#define IEEE802154_ACK_PSDU_LEN 5
3232
#define IEEE802154_MIN_PSDU_LEN 9
33+
#define IEEE802154_FCS_LEN 2
3334

3435
#define IEEE802154_PAN_ID_BROADCAST 0xffff
3536
#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff
@@ -39,6 +40,7 @@
3940

4041
#define IEEE802154_LIFS_PERIOD 40
4142
#define IEEE802154_SIFS_PERIOD 12
43+
#define IEEE802154_MAX_SIFS_FRAME_SIZE 18
4244

4345
#define IEEE802154_MAX_CHANNEL 26
4446
#define IEEE802154_MAX_PAGE 31

net/mac802154/util.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,19 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
6565
{
6666
if (ifs_handling) {
6767
struct ieee802154_local *local = hw_to_local(hw);
68+
u8 max_sifs_size;
6869

69-
if (skb->len > 18)
70+
/* If transceiver sets CRC on his own we need to use lifs
71+
* threshold len above 16 otherwise 18, because it's not
72+
* part of skb->len.
73+
*/
74+
if (hw->flags & IEEE802154_HW_TX_OMIT_CKSUM)
75+
max_sifs_size = IEEE802154_MAX_SIFS_FRAME_SIZE -
76+
IEEE802154_FCS_LEN;
77+
else
78+
max_sifs_size = IEEE802154_MAX_SIFS_FRAME_SIZE;
79+
80+
if (skb->len > max_sifs_size)
7081
hrtimer_start(&local->ifs_timer,
7182
ktime_set(0, hw->phy->lifs_period * NSEC_PER_USEC),
7283
HRTIMER_MODE_REL);

0 commit comments

Comments
 (0)