From b818f12c6d661333960ec221c189a9c48134ecf3 Mon Sep 17 00:00:00 2001 From: Juha Heiuskanen Date: Tue, 1 Dec 2020 23:32:51 -0800 Subject: [PATCH] Extented network status for support dropped tx congestion packet. --- nanostack/nwk_stats_api.h | 1 + source/6LoWPAN/adaptation_interface.c | 2 +- source/NWK_INTERFACE/Include/protocol_stats.h | 3 ++- source/NWK_INTERFACE/protocol_stats.c | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/nanostack/nwk_stats_api.h b/nanostack/nwk_stats_api.h index 5b05715d1d35..a59d062e430b 100644 --- a/nanostack/nwk_stats_api.h +++ b/nanostack/nwk_stats_api.h @@ -73,6 +73,7 @@ typedef struct nwk_stats_t { /* MAC */ uint16_t adapt_layer_tx_queue_size; /**< Adaptation layer direct TX queue size. */ uint16_t adapt_layer_tx_queue_peak; /**< Adaptation layer direct TX queue size peak. */ + uint32_t adapt_layer_tx_congestion_drop; /**< Adaptation layer direct TX randon early detection drop packet. */ } nwk_stats_t; /** diff --git a/source/6LoWPAN/adaptation_interface.c b/source/6LoWPAN/adaptation_interface.c index 3df00c44106c..a97283cab55a 100644 --- a/source/6LoWPAN/adaptation_interface.c +++ b/source/6LoWPAN/adaptation_interface.c @@ -1055,7 +1055,7 @@ int8_t lowpan_adaptation_interface_tx(protocol_interface_info_entry_t *cur, buff if (cur->random_early_detection && buf->priority == QOS_NORMAL) { if (random_early_detection_packet(cur->random_early_detection, interface_ptr->directTxQueue_size)) { - //TODO Update Statisdic drop by congestion + protocol_stats_update(STATS_AL_TX_CONGESTION_DROP, 1); goto tx_error_handler; } } diff --git a/source/NWK_INTERFACE/Include/protocol_stats.h b/source/NWK_INTERFACE/Include/protocol_stats.h index e8ee77f2ca5f..193a9538e9af 100644 --- a/source/NWK_INTERFACE/Include/protocol_stats.h +++ b/source/NWK_INTERFACE/Include/protocol_stats.h @@ -44,7 +44,8 @@ typedef enum { STATS_BUFFER_HEADROOM_FAIL, STATS_ETX_1ST_PARENT, STATS_ETX_2ND_PARENT, - STATS_AL_TX_QUEUE_SIZE + STATS_AL_TX_QUEUE_SIZE, + STATS_AL_TX_CONGESTION_DROP } nwk_stats_type_t; diff --git a/source/NWK_INTERFACE/protocol_stats.c b/source/NWK_INTERFACE/protocol_stats.c index aedec1cbae33..074dc079519e 100644 --- a/source/NWK_INTERFACE/protocol_stats.c +++ b/source/NWK_INTERFACE/protocol_stats.c @@ -152,6 +152,9 @@ void protocol_stats_update(nwk_stats_type_t type, uint16_t update_val) nwk_stats_ptr->adapt_layer_tx_queue_peak = nwk_stats_ptr->adapt_layer_tx_queue_size; } break; + case STATS_AL_TX_CONGESTION_DROP: + nwk_stats_ptr->adapt_layer_tx_congestion_drop++; + break; } } }