Skip to content

Commit b956d9e

Browse files
author
Jarkko Paso
authored
Revert "Improved transmission in high traffic (ARMmbed#2511)" (ARMmbed#2512)
This reverts commit 01749c2.
1 parent 01749c2 commit b956d9e

File tree

4 files changed

+31
-57
lines changed

4 files changed

+31
-57
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* Added trace for mbed TLS errors
1212
* Optimized medium size network MPL parameters for 40 seconds multicast interval
1313
* Added traces to EAPOL TX failure
14-
* Improved handling of packet transmissions under heavy load
1514
* Added traces to Adaptation layer for Direct TX queue level decrease or increase by 20
1615
* New Network statitis info for Randon early detetction dropped packet at Adaptation layer.
1716

source/MAC/IEEE802_15_4/mac_mcps_sap.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,9 +2321,8 @@ static mac_pre_build_frame_t *mcps_sap_pd_req_queue_read(protocol_interface_rf_m
23212321
// With FHSS, check TX conditions
23222322
if (rf_mac_setup->fhss_api) {
23232323
while (buffer) {
2324-
uint16_t frame_length = buffer->mac_payload_length + buffer->headerIeLength + buffer->payloadsIeLength;
23252324
if (buffer->asynch_request || (flush == true) || (rf_mac_setup->fhss_api->check_tx_conditions(rf_mac_setup->fhss_api, !mac_is_ack_request_set(buffer),
2326-
buffer->msduHandle, mac_convert_frame_type_to_fhss(buffer->fcf_dsn.frametype), frame_length,
2325+
buffer->msduHandle, mac_convert_frame_type_to_fhss(buffer->fcf_dsn.frametype), buffer->mac_payload_length,
23272326
rf_mac_setup->dev_driver->phy_driver->phy_header_length, rf_mac_setup->dev_driver->phy_driver->phy_tail_length) == true)) {
23282327
break;
23292328
}

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,6 @@ void fhss_set_txrx_slot_length(fhss_structure_t *fhss_structure)
233233

234234
static uint32_t fhss_get_number_of_tx_slots(fhss_structure_t *fhss_structure)
235235
{
236-
if (!fhss_structure->ws->txrx_slot_length_ms) {
237-
return 0;
238-
}
239236
return ((fhss_structure->ws->fhss_configuration.fhss_broadcast_interval - fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval) / fhss_structure->ws->txrx_slot_length_ms) / 2;
240237
}
241238

@@ -367,40 +364,23 @@ static void fhss_broadcast_handler(const fhss_api_t *fhss_api, uint16_t delay)
367364
next_channel = fhss_structure->rx_channel;
368365
/* Start timer with random timeout to trigger unicast TX queue poll event.
369366
* For hops 0,1,4,5,8,9,...
370-
* In high traffic:
371-
* Min random is 1/1000 of the TX slot length.
372-
* Max random is 1/100 of the TX slot length.
373-
* Otherwise:
374367
* Min random is 1/100 of the TX slot length.
375368
* Max random is 1/5 of the TX slot length.
376369
*
377370
* For hops 2,3,6,7,10,11,...
378-
* Min random is 1/1000 of the TX slot length plus 0.5*TX slot length.
379-
* Max random is 1/100 of the TX slot length plus 0.5*TX slot length.
371+
* Min random is 1/100 of the TX slot length plus 0.5*TX slot length.
372+
* Max random is 1/10 of the TX slot length plus 0.5*TX slot length.
380373
* Event timer resolution is 50us.
381374
*/
375+
// returns 1 if polling of TX queue is done on latter half of the TX slot
376+
uint8_t own_tx_trig_slot = calc_own_tx_trig_slot(fhss_structure->own_hop);
382377
uint32_t txrx_slot_length_us = MS_TO_US(fhss_structure->ws->txrx_slot_length_ms);
383-
uint16_t queue_size = fhss_structure->callbacks.read_tx_queue_size(fhss_structure->fhss_api, false);
384-
uint16_t uc_min_random, uc_max_random;
385-
uint32_t tx_slot_shift_us = (txrx_slot_length_us) / 50;
386-
uint32_t half_tx_slot_shift_us = tx_slot_shift_us / 2;
387-
// For busy or latter half of the TX slot polling devices, use short random
388-
if (queue_size >= QUEUE_SIZE_HIGH || calc_own_tx_trig_slot(fhss_structure->own_hop)) {
389-
uc_min_random = ((txrx_slot_length_us / 1000) / 50);
390-
uc_max_random = ((txrx_slot_length_us / 100) / 50);
391-
} else {
392-
uc_min_random = ((txrx_slot_length_us / 100) / 50);
393-
uc_max_random = ((txrx_slot_length_us / 5) / 50);
394-
}
395-
// Shift for latter half of the TX slot
396-
if (calc_own_tx_trig_slot(fhss_structure->own_hop)) {
397-
uc_min_random += half_tx_slot_shift_us;
398-
uc_max_random += half_tx_slot_shift_us;
399-
}
400-
// Shift for own TX slot
401-
if (!fhss_ws_check_tx_allowed(fhss_structure)) {
402-
uc_min_random += tx_slot_shift_us;
403-
uc_max_random += tx_slot_shift_us;
378+
uint16_t uc_min_random = (((txrx_slot_length_us / 2) * own_tx_trig_slot) / 50) + ((txrx_slot_length_us / 100) / 50);
379+
uint16_t uc_max_random = (((txrx_slot_length_us / 2) * own_tx_trig_slot) / 50) + ((txrx_slot_length_us / 5) / 50);
380+
bool tx_allowed = fhss_ws_check_tx_allowed(fhss_structure);
381+
if (!tx_allowed) {
382+
uc_min_random += (txrx_slot_length_us) / 50;
383+
uc_max_random += (txrx_slot_length_us) / 50;
404384
}
405385
eventOS_callback_timer_start(fhss_structure->fhss_event_timer, randLIB_get_random_in_range(uc_min_random, uc_max_random));
406386

@@ -730,28 +710,26 @@ static bool fhss_ws_check_tx_allowed(fhss_structure_t *fhss_structure)
730710

731711
static bool fhss_ws_check_tx_time(fhss_structure_t *fhss_structure, uint16_t tx_length, uint8_t phy_header_length, uint8_t phy_tail_length)
732712
{
733-
bool retval = true;
734-
if (fhss_structure->own_hop != 0xff && fhss_structure->ws->fhss_configuration.fhss_broadcast_interval && fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval && fhss_get_number_of_tx_slots(fhss_structure)) {
735-
uint32_t tx_time_ms = US_TO_MS(fhss_get_tx_time(fhss_structure, tx_length, phy_header_length, phy_tail_length));
736-
// Check if there is enough time for transmitting before the next RX slot. Check only for devices which are polling TX queue in the beginning of TX slot.
737-
if (!calc_own_tx_trig_slot(fhss_structure->own_hop)) {
738-
uint32_t remaining_time_ms = get_remaining_slots_us(fhss_structure, fhss_broadcast_handler, MS_TO_US(fhss_structure->ws->fhss_configuration.fhss_broadcast_interval)) / 1000;
739-
uint32_t tx_slot_begin_ms = (fhss_structure->ws->fhss_configuration.fhss_broadcast_interval - fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval) - (fhss_structure->ws->txrx_slot_length_ms * (fhss_structure->own_hop & 1));
740-
tx_slot_begin_ms = tx_slot_begin_ms - (((tx_slot_begin_ms - remaining_time_ms) / (2 * fhss_structure->ws->txrx_slot_length_ms)) * (2 * fhss_structure->ws->txrx_slot_length_ms));
741-
uint32_t rx_slot_begin_ms = tx_slot_begin_ms - fhss_structure->ws->txrx_slot_length_ms;
742-
if ((remaining_time_ms < rx_slot_begin_ms) || ((remaining_time_ms - rx_slot_begin_ms) < tx_time_ms)) {
743-
retval = false;
744-
}
745-
}
746-
// Check if there is enough time for transmitting before the next multicast slot.
713+
/*
714+
* Check if there is enough time for transmitting before the next multicast slot.
715+
*/
747716
#ifdef FHSS_WS_PROTECT_MC_SLOTS
748-
uint32_t time_to_bc_channel_ms = US_TO_MS(get_remaining_slots_us(fhss_structure, fhss_broadcast_handler, MS_TO_US(fhss_structure->ws->fhss_configuration.fhss_broadcast_interval)));
749-
if (tx_time_ms > time_to_bc_channel_ms) {
750-
retval = false;
751-
}
752-
#endif
717+
if (!fhss_structure->ws->fhss_configuration.fhss_broadcast_interval || !fhss_structure->ws->fhss_configuration.fhss_bc_dwell_interval) {
718+
return true;
753719
}
754-
return retval;
720+
uint32_t tx_time = fhss_get_tx_time(fhss_structure, tx_length, phy_header_length, phy_tail_length);
721+
uint32_t time_to_bc_channel_us = get_remaining_slots_us(fhss_structure, fhss_broadcast_handler, MS_TO_US(fhss_structure->ws->fhss_configuration.fhss_broadcast_interval));
722+
if (tx_time > time_to_bc_channel_us) {
723+
return false;
724+
}
725+
return true;
726+
#else
727+
(void) fhss_structure;
728+
(void) tx_length;
729+
(void) phy_header_length;
730+
(void) phy_tail_length;
731+
return true;
732+
#endif
755733
}
756734

757735
static bool fhss_ws_check_tx_conditions_callback(const fhss_api_t *api, bool is_broadcast_addr, uint8_t handle, int frame_type, uint16_t frame_length, uint8_t phy_header_length, uint8_t phy_tail_length)

source/Service_Libs/fhss/fhss_ws.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@
1818
#define FHSS_WS_H_
1919

2020
// TX slot length is optimised to this packet length
21-
#define OPTIMAL_PACKET_LENGTH 700
21+
#define OPTIMAL_PACKET_LENGTH 500
2222
// Default TX/RX slot length in milliseconds. Is used when datarate is not given by PHY.
23-
#define WS_TXRX_SLOT_LEN_MS 205
23+
#define WS_TXRX_SLOT_LEN_MS 100
2424
// Default minimum broadcast synchronization interval in seconds
2525
#define DEFAULT_MIN_SYNCH_INTERVAL 60
2626
// Drift compensation allowed if at least SYNCH_COMPENSATION_MIN_INTERVAL (seconds) since last synchronization
2727
#define SYNCH_COMPENSATION_MIN_INTERVAL 60
2828
// MAX compensation per received synchronization info in ns
2929
#define MAX_DRIFT_COMPENSATION_STEP 10
30-
// Goes to more rapid transmission mode when this limit is exceeded
31-
#define QUEUE_SIZE_HIGH 5
3230
typedef struct fhss_ws fhss_ws_t;
3331

3432
struct fhss_ws {

0 commit comments

Comments
 (0)