Commit 3f3c4bb5ec7c645d1151e1e8d6e56c71a050cf85
Committed by
Marcel Holtmann
1 parent
022d07e3d8
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
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 <alex.aring@gmail.com> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Showing 2 changed files with 14 additions and 1 deletions Side-by-side Diff
include/linux/ieee802154.h
... | ... | @@ -30,6 +30,7 @@ |
30 | 30 | #define IEEE802154_MTU 127 |
31 | 31 | #define IEEE802154_ACK_PSDU_LEN 5 |
32 | 32 | #define IEEE802154_MIN_PSDU_LEN 9 |
33 | +#define IEEE802154_FCS_LEN 2 | |
33 | 34 | |
34 | 35 | #define IEEE802154_PAN_ID_BROADCAST 0xffff |
35 | 36 | #define IEEE802154_ADDR_SHORT_BROADCAST 0xffff |
... | ... | @@ -39,6 +40,7 @@ |
39 | 40 | |
40 | 41 | #define IEEE802154_LIFS_PERIOD 40 |
41 | 42 | #define IEEE802154_SIFS_PERIOD 12 |
43 | +#define IEEE802154_MAX_SIFS_FRAME_SIZE 18 | |
42 | 44 | |
43 | 45 | #define IEEE802154_MAX_CHANNEL 26 |
44 | 46 | #define IEEE802154_MAX_PAGE 31 |
net/mac802154/util.c
... | ... | @@ -65,8 +65,19 @@ |
65 | 65 | { |
66 | 66 | if (ifs_handling) { |
67 | 67 | struct ieee802154_local *local = hw_to_local(hw); |
68 | + u8 max_sifs_size; | |
68 | 69 | |
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) | |
70 | 81 | hrtimer_start(&local->ifs_timer, |
71 | 82 | ktime_set(0, hw->phy->lifs_period * NSEC_PER_USEC), |
72 | 83 | HRTIMER_MODE_REL); |