diff options
author | Alexander Aring <alex.aring@gmail.com> | 2015-04-30 11:45:02 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-04-30 12:48:11 -0400 |
commit | 8500920317813ed420311d9cf16c345fc216fb86 (patch) | |
tree | c840fca0c012a80117ebe29c949b4812037748fa | |
parent | 2f8cdd95097bdcd8d1e2b02edb0a9deb1e034a7e (diff) |
at86rf230: change state change if from trx_off
If a transmit ends in a calibration which means the transceiver do a
TRX_OFF state change, we can directly change into TX_ARET state instead
doing a TX_ON to TX_ARET statechange.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | drivers/net/ieee802154/at86rf230.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 6285145545a7..05ef56d5a710 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c | |||
@@ -95,6 +95,7 @@ struct at86rf230_local { | |||
95 | unsigned long cal_timeout; | 95 | unsigned long cal_timeout; |
96 | s8 max_frame_retries; | 96 | s8 max_frame_retries; |
97 | bool is_tx; | 97 | bool is_tx; |
98 | bool is_tx_from_off; | ||
98 | u8 tx_retry; | 99 | u8 tx_retry; |
99 | struct sk_buff *tx_skb; | 100 | struct sk_buff *tx_skb; |
100 | struct at86rf230_state_change tx; | 101 | struct at86rf230_state_change tx; |
@@ -991,12 +992,21 @@ at86rf230_xmit_start(void *context) | |||
991 | * are in STATE_TX_ON. The pfad differs here, so we change | 992 | * are in STATE_TX_ON. The pfad differs here, so we change |
992 | * the complete handler. | 993 | * the complete handler. |
993 | */ | 994 | */ |
994 | if (lp->tx_aret) | 995 | if (lp->tx_aret) { |
995 | at86rf230_async_state_change(lp, ctx, STATE_TX_ON, | 996 | if (lp->is_tx_from_off) { |
996 | at86rf230_xmit_tx_on, false); | 997 | lp->is_tx_from_off = false; |
997 | else | 998 | at86rf230_async_state_change(lp, ctx, STATE_TX_ARET_ON, |
999 | at86rf230_xmit_tx_on, | ||
1000 | false); | ||
1001 | } else { | ||
1002 | at86rf230_async_state_change(lp, ctx, STATE_TX_ON, | ||
1003 | at86rf230_xmit_tx_on, | ||
1004 | false); | ||
1005 | } | ||
1006 | } else { | ||
998 | at86rf230_async_state_change(lp, ctx, STATE_TX_ON, | 1007 | at86rf230_async_state_change(lp, ctx, STATE_TX_ON, |
999 | at86rf230_write_frame, false); | 1008 | at86rf230_write_frame, false); |
1009 | } | ||
1000 | } | 1010 | } |
1001 | 1011 | ||
1002 | static int | 1012 | static int |
@@ -1015,11 +1025,13 @@ at86rf230_xmit(struct ieee802154_hw *hw, struct sk_buff *skb) | |||
1015 | * to TX_ON, the lp->cal_timeout should be reinit by state_delay | 1025 | * to TX_ON, the lp->cal_timeout should be reinit by state_delay |
1016 | * function then to start in the next 5 minutes. | 1026 | * function then to start in the next 5 minutes. |
1017 | */ | 1027 | */ |
1018 | if (time_is_before_jiffies(lp->cal_timeout)) | 1028 | if (time_is_before_jiffies(lp->cal_timeout)) { |
1029 | lp->is_tx_from_off = true; | ||
1019 | at86rf230_async_state_change(lp, ctx, STATE_TRX_OFF, | 1030 | at86rf230_async_state_change(lp, ctx, STATE_TRX_OFF, |
1020 | at86rf230_xmit_start, false); | 1031 | at86rf230_xmit_start, false); |
1021 | else | 1032 | } else { |
1022 | at86rf230_xmit_start(ctx); | 1033 | at86rf230_xmit_start(ctx); |
1034 | } | ||
1023 | 1035 | ||
1024 | return 0; | 1036 | return 0; |
1025 | } | 1037 | } |