Commit 406cf9fe authored by Lionel Gauthier's avatar Lionel Gauthier

ADDED ITTI RLC PDU MESSAGES

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4884 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent df2a457d
...@@ -32,6 +32,9 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis ...@@ -32,6 +32,9 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
#include "platform_types.h" #include "platform_types.h"
#include "platform_constants.h" #include "platform_constants.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
#include "rlc_am.h" #include "rlc_am.h"
#include "rlc_am_segment.h" #include "rlc_am_segment.h"
#include "rlc_am_timer_poll_retransmit.h" #include "rlc_am_timer_poll_retransmit.h"
...@@ -47,33 +50,37 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis ...@@ -47,33 +50,37 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
//#define TRACE_RLC_AM_TX //#define TRACE_RLC_AM_TX
//#define TRACE_RLC_AM_RX //#define TRACE_RLC_AM_RX
//#define TRACE_RLC_AM_BO //#define TRACE_RLC_AM_BO
#define TRACE_RLC_AM_PDU 1
extern rlc_am_control_pdu_info_t g_rlc_am_control_pdu_info;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
u32_t u32_t
rlc_am_get_buffer_occupancy_in_bytes (rlc_am_entity_t *rlcP,u32 frame) rlc_am_get_buffer_occupancy_in_bytes (rlc_am_entity_t *rlc_pP,u32 frameP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
u32_t max_li_overhead; u32_t max_li_overhead;
u32_t header_overhead; u32_t header_overhead;
// priority of control trafic // priority of control trafic
if (rlcP->status_requested) { if (rlc_pP->status_requested) {
if (rlcP->t_status_prohibit.running == 0) { if (rlc_pP->t_status_prohibit.running == 0) {
#ifdef TRACE_RLC_AM_BO #ifdef TRACE_RLC_AM_BO
if (((15 + rlcP->num_nack_sn*(10+1) + rlcP->num_nack_so*(15+15+1) + 7) >> 3) > 0) { if (((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3) > 0) {
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : CONTROL PDU %d bytes \n", frame, rlcP->module_id, rlcP->rb_id, ((15 + rlcP->num_nack_sn*(10+1) + rlcP->num_nack_so*(15+15+1) + 7) >> 3)); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : CONTROL PDU %d bytes \n", frameP, rlc_pP->module_id, rlc_pP->rb_id, ((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3));
} }
#endif #endif
return ((15 + rlcP->num_nack_sn*(10+1) + rlcP->num_nack_so*(15+15+1) + 7) >> 3); return ((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3);
} }
} }
// data traffic // data traffic
if (rlcP->nb_sdu_no_segmented <= 1) { if (rlc_pP->nb_sdu_no_segmented <= 1) {
max_li_overhead = 0; max_li_overhead = 0;
} else { } else {
max_li_overhead = (((rlcP->nb_sdu_no_segmented - 1) * 3) / 2) + ((rlcP->nb_sdu_no_segmented - 1) % 2); max_li_overhead = (((rlc_pP->nb_sdu_no_segmented - 1) * 3) / 2) + ((rlc_pP->nb_sdu_no_segmented - 1) % 2);
} }
if (rlcP->sdu_buffer_occupancy == 0) { if (rlc_pP->sdu_buffer_occupancy == 0) {
header_overhead = 0; header_overhead = 0;
} else { } else {
header_overhead = 2; header_overhead = 2;
...@@ -81,26 +88,26 @@ rlc_am_get_buffer_occupancy_in_bytes (rlc_am_entity_t *rlcP,u32 frame) ...@@ -81,26 +88,26 @@ rlc_am_get_buffer_occupancy_in_bytes (rlc_am_entity_t *rlcP,u32 frame)
#ifdef TRACE_RLC_AM_BO #ifdef TRACE_RLC_AM_BO
if ((rlcP->status_buffer_occupancy + rlcP->retransmission_buffer_occupancy + rlcP->sdu_buffer_occupancy + max_li_overhead + header_overhead) > 0) { if ((rlc_pP->status_buffer_occupancy + rlc_pP->retransmission_buffer_occupancy + rlc_pP->sdu_buffer_occupancy + max_li_overhead + header_overhead) > 0) {
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : STATUS BUFFER %d bytes \n", frame, rlcP->module_id, rlcP->rb_id, rlcP->status_buffer_occupancy); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : STATUS BUFFER %d bytes \n", frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->status_buffer_occupancy);
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : RETRANS BUFFER %d bytes \n", frame, rlcP->module_id,rlcP->rb_id, rlcP->retransmission_buffer_occupancy); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : RETRANS BUFFER %d bytes \n", frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->retransmission_buffer_occupancy);
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : SDU BUFFER %d bytes + li_overhead %d bytes header_overhead %d bytes (nb sdu not segmented %d)\n", frame, rlcP->module_id,rlcP->rb_id, rlcP->sdu_buffer_occupancy, max_li_overhead, header_overhead, rlcP->nb_sdu_no_segmented); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BO : SDU BUFFER %d bytes + li_overhead %d bytes header_overhead %d bytes (nb sdu not segmented %d)\n", frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->sdu_buffer_occupancy, max_li_overhead, header_overhead, rlc_pP->nb_sdu_no_segmented);
} }
#endif #endif
return rlcP->status_buffer_occupancy + rlcP->retransmission_buffer_occupancy + rlcP->sdu_buffer_occupancy + max_li_overhead + header_overhead; return rlc_pP->status_buffer_occupancy + rlc_pP->retransmission_buffer_occupancy + rlc_pP->sdu_buffer_occupancy + max_li_overhead + header_overhead;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void rlc_am_release (rlc_am_entity_t *rlcP) void rlc_am_release (rlc_am_entity_t *rlc_pP)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void config_req_rlc_am (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP) void config_req_rlc_am (rlc_am_entity_t *rlc_pP, u32_t frameP, u8_t eNB_flagP, module_id_t module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_%s][MOD %02d][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %02d][RB %02d]\n", LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_%s][MOD %02d][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %02d][RB %02d]\n",
frame, frameP,
( Mac_rlc_xface->Is_cluster_head[module_idP] == 1) ? "eNB":"UE", ( Mac_rlc_xface->Is_cluster_head[module_idP] == 1) ? "eNB":"UE",
module_idP, module_idP,
config_amP->max_retx_threshold, config_amP->max_retx_threshold,
...@@ -112,9 +119,9 @@ void config_req_rlc_am (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, modu ...@@ -112,9 +119,9 @@ void config_req_rlc_am (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, modu
module_idP, module_idP,
rb_idP); rb_idP);
rlc_am_init(rlcP,frame); rlc_am_init(rlc_pP,frameP);
rlc_am_set_debug_infos(rlcP, frame, eNB_flagP, module_idP, rb_idP, rb_typeP); rlc_am_set_debug_infos(rlc_pP, frameP, eNB_flagP, module_idP, rb_idP, rb_typeP);
rlc_am_configure(rlcP,frame, rlc_am_configure(rlc_pP,frameP,
config_amP->max_retx_threshold, config_amP->max_retx_threshold,
config_amP->poll_pdu, config_amP->poll_pdu,
config_amP->poll_byte, config_amP->poll_byte,
...@@ -131,7 +138,7 @@ u32_t am_t_Reordering_tab[T_Reordering_spare1]={0,5,10,15,20,25,30,35,40,45,50,5 ...@@ -131,7 +138,7 @@ u32_t am_t_Reordering_tab[T_Reordering_spare1]={0,5,10,15,20,25,30,35,40,45,50,5
u32_t t_StatusProhibit_tab[T_StatusProhibit_spare8]={0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500}; u32_t t_StatusProhibit_tab[T_StatusProhibit_spare8]={0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP) void config_req_rlc_am_asn1 (rlc_am_entity_t *rlc_pP, u32_t frameP, u8_t eNB_flagP, module_id_t module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
if ( (config_amP->ul_AM_RLC.maxRetxThreshold <= UL_AM_RLC__maxRetxThreshold_t32) && if ( (config_amP->ul_AM_RLC.maxRetxThreshold <= UL_AM_RLC__maxRetxThreshold_t32) &&
...@@ -142,7 +149,7 @@ void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, ...@@ -142,7 +149,7 @@ void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP,
(config_amP->dl_AM_RLC.t_StatusProhibit<T_StatusProhibit_spare8) ){ (config_amP->dl_AM_RLC.t_StatusProhibit<T_StatusProhibit_spare8) ){
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_%s][MOD %02d][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %02d][RB %02d]\n", LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_%s][MOD %02d][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %02d][RB %02d]\n",
frame, frameP,
( Mac_rlc_xface->Is_cluster_head[module_idP] == 1) ? "eNB":"UE", ( Mac_rlc_xface->Is_cluster_head[module_idP] == 1) ? "eNB":"UE",
module_idP, module_idP,
maxRetxThreshold_tab[config_amP->ul_AM_RLC.maxRetxThreshold], maxRetxThreshold_tab[config_amP->ul_AM_RLC.maxRetxThreshold],
...@@ -154,9 +161,9 @@ void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, ...@@ -154,9 +161,9 @@ void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP,
module_idP, module_idP,
rb_idP); rb_idP);
rlc_am_init(rlcP,frame); rlc_am_init(rlc_pP,frameP);
rlc_am_set_debug_infos(rlcP, frame, eNB_flagP, module_idP, rb_idP, rb_typeP); rlc_am_set_debug_infos(rlc_pP, frameP, eNB_flagP, module_idP, rb_idP, rb_typeP);
rlc_am_configure(rlcP,frame, rlc_am_configure(rlc_pP,frameP,
maxRetxThreshold_tab[config_amP->ul_AM_RLC.maxRetxThreshold], maxRetxThreshold_tab[config_amP->ul_AM_RLC.maxRetxThreshold],
pollPDU_tab[config_amP->ul_AM_RLC.pollPDU], pollPDU_tab[config_amP->ul_AM_RLC.pollPDU],
pollByte_tab[config_amP->ul_AM_RLC.pollByte], pollByte_tab[config_amP->ul_AM_RLC.pollByte],
...@@ -167,7 +174,7 @@ void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, ...@@ -167,7 +174,7 @@ void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP,
} }
else { else {
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_%s][MOD %02d][][--- ILLEGAL CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %02d][RB %02d], RLC-AM NOT CONFIGURED\n", LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_%s][MOD %02d][][--- ILLEGAL CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %02d][RB %02d], RLC-AM NOT CONFIGURED\n",
frame, frameP,
( Mac_rlc_xface->Is_cluster_head[module_idP] == 1) ? "eNB":"UE", ( Mac_rlc_xface->Is_cluster_head[module_idP] == 1) ? "eNB":"UE",
module_idP, module_idP,
config_amP->ul_AM_RLC.maxRetxThreshold, config_amP->ul_AM_RLC.maxRetxThreshold,
...@@ -182,7 +189,7 @@ void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, ...@@ -182,7 +189,7 @@ void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP,
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void rlc_am_stat_req (rlc_am_entity_t *rlcP, void rlc_am_stat_req (rlc_am_entity_t *rlc_pP,
unsigned int* stat_tx_pdcp_sdu, unsigned int* stat_tx_pdcp_sdu,
unsigned int* stat_tx_pdcp_bytes, unsigned int* stat_tx_pdcp_bytes,
unsigned int* stat_tx_pdcp_sdu_discarded, unsigned int* stat_tx_pdcp_sdu_discarded,
...@@ -212,38 +219,38 @@ void rlc_am_stat_req (rlc_am_entity_t *rlcP, ...@@ -212,38 +219,38 @@ void rlc_am_stat_req (rlc_am_entity_t *rlcP,
unsigned int* stat_timer_status_prohibit_timed_out) unsigned int* stat_timer_status_prohibit_timed_out)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
*stat_tx_pdcp_sdu = rlcP->stat_tx_pdcp_sdu; *stat_tx_pdcp_sdu = rlc_pP->stat_tx_pdcp_sdu;
*stat_tx_pdcp_bytes = rlcP->stat_tx_pdcp_bytes; *stat_tx_pdcp_bytes = rlc_pP->stat_tx_pdcp_bytes;
*stat_tx_pdcp_sdu_discarded = rlcP->stat_tx_pdcp_sdu_discarded; *stat_tx_pdcp_sdu_discarded = rlc_pP->stat_tx_pdcp_sdu_discarded;
*stat_tx_pdcp_bytes_discarded = rlcP->stat_tx_pdcp_bytes_discarded; *stat_tx_pdcp_bytes_discarded = rlc_pP->stat_tx_pdcp_bytes_discarded;
*stat_tx_data_pdu = rlcP->stat_tx_data_pdu; *stat_tx_data_pdu = rlc_pP->stat_tx_data_pdu;
*stat_tx_data_bytes = rlcP->stat_tx_data_bytes; *stat_tx_data_bytes = rlc_pP->stat_tx_data_bytes;
*stat_tx_retransmit_pdu_by_status = rlcP->stat_tx_retransmit_pdu_by_status; *stat_tx_retransmit_pdu_by_status = rlc_pP->stat_tx_retransmit_pdu_by_status;
*stat_tx_retransmit_bytes_by_status = rlcP->stat_tx_retransmit_bytes_by_status; *stat_tx_retransmit_bytes_by_status = rlc_pP->stat_tx_retransmit_bytes_by_status;
*stat_tx_retransmit_pdu = rlcP->stat_tx_retransmit_pdu; *stat_tx_retransmit_pdu = rlc_pP->stat_tx_retransmit_pdu;
*stat_tx_retransmit_bytes = rlcP->stat_tx_retransmit_bytes; *stat_tx_retransmit_bytes = rlc_pP->stat_tx_retransmit_bytes;
*stat_tx_control_pdu = rlcP->stat_tx_control_pdu; *stat_tx_control_pdu = rlc_pP->stat_tx_control_pdu;
*stat_tx_control_bytes = rlcP->stat_tx_control_bytes; *stat_tx_control_bytes = rlc_pP->stat_tx_control_bytes;
*stat_rx_pdcp_sdu = rlcP->stat_rx_pdcp_sdu; *stat_rx_pdcp_sdu = rlc_pP->stat_rx_pdcp_sdu;
*stat_rx_pdcp_bytes = rlcP->stat_rx_pdcp_bytes; *stat_rx_pdcp_bytes = rlc_pP->stat_rx_pdcp_bytes;
*stat_rx_data_pdus_duplicate = rlcP->stat_rx_data_pdus_duplicate; *stat_rx_data_pdus_duplicate = rlc_pP->stat_rx_data_pdus_duplicate;
*stat_rx_data_bytes_duplicate = rlcP->stat_rx_data_bytes_duplicate; *stat_rx_data_bytes_duplicate = rlc_pP->stat_rx_data_bytes_duplicate;
*stat_rx_data_pdu = rlcP->stat_rx_data_pdu; *stat_rx_data_pdu = rlc_pP->stat_rx_data_pdu;
*stat_rx_data_bytes = rlcP->stat_rx_data_bytes; *stat_rx_data_bytes = rlc_pP->stat_rx_data_bytes;
*stat_rx_data_pdu_dropped = rlcP->stat_rx_data_pdu_dropped; *stat_rx_data_pdu_dropped = rlc_pP->stat_rx_data_pdu_dropped;
*stat_rx_data_bytes_dropped = rlcP->stat_rx_data_bytes_dropped; *stat_rx_data_bytes_dropped = rlc_pP->stat_rx_data_bytes_dropped;
*stat_rx_data_pdu_out_of_window = rlcP->stat_rx_data_pdu_out_of_window; *stat_rx_data_pdu_out_of_window = rlc_pP->stat_rx_data_pdu_out_of_window;
*stat_rx_data_bytes_out_of_window = rlcP->stat_rx_data_bytes_out_of_window; *stat_rx_data_bytes_out_of_window = rlc_pP->stat_rx_data_bytes_out_of_window;
*stat_rx_control_pdu = rlcP->stat_rx_control_pdu; *stat_rx_control_pdu = rlc_pP->stat_rx_control_pdu;
*stat_rx_control_bytes = rlcP->stat_rx_control_bytes; *stat_rx_control_bytes = rlc_pP->stat_rx_control_bytes;
*stat_timer_reordering_timed_out = rlcP->stat_timer_reordering_timed_out; *stat_timer_reordering_timed_out = rlc_pP->stat_timer_reordering_timed_out;
*stat_timer_poll_retransmit_timed_out = rlcP->stat_timer_poll_retransmit_timed_out; *stat_timer_poll_retransmit_timed_out = rlc_pP->stat_timer_poll_retransmit_timed_out;
*stat_timer_status_prohibit_timed_out = rlcP->stat_timer_status_prohibit_timed_out; *stat_timer_status_prohibit_timed_out = rlc_pP->stat_timer_status_prohibit_timed_out;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
rlc_am_get_pdus (rlc_am_entity_t *rlcP,u32_t frame) rlc_am_get_pdus (rlc_am_entity_t *rlc_pP,u32_t frameP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int display_flag = 0; int display_flag = 0;
...@@ -255,14 +262,14 @@ rlc_am_get_pdus (rlc_am_entity_t *rlcP,u32_t frame) ...@@ -255,14 +262,14 @@ rlc_am_get_pdus (rlc_am_entity_t *rlcP,u32_t frame)
// AMD PDUs. // AMD PDUs.
switch (rlcP->protocol_state) { switch (rlc_pP->protocol_state) {
case RLC_NULL_STATE: case RLC_NULL_STATE:
break; break;
case RLC_DATA_TRANSFER_READY_STATE: case RLC_DATA_TRANSFER_READY_STATE:
// TRY TO SEND CONTROL PDU FIRST // TRY TO SEND CONTROL PDU FIRST
if ((rlcP->nb_bytes_requested_by_mac > 2) && (rlcP->status_requested)) { if ((rlc_pP->nb_bytes_requested_by_mac > 2) && (rlc_pP->status_requested)) {
// When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall: // When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall:
// - if t-StatusProhibit is not running: // - if t-StatusProhibit is not running:
// - at the first transmission opportunity indicated by lower layer, construct a STATUS PDU and deliver it to lower layer; // - at the first transmission opportunity indicated by lower layer, construct a STATUS PDU and deliver it to lower layer;
...@@ -273,30 +280,30 @@ rlc_am_get_pdus (rlc_am_entity_t *rlcP,u32_t frame) ...@@ -273,30 +280,30 @@ rlc_am_get_pdus (rlc_am_entity_t *rlcP,u32_t frame)
// //
// When a STATUS PDU has been delivered to lower layer, the receiving side of an AM RLC entity shall: // When a STATUS PDU has been delivered to lower layer, the receiving side of an AM RLC entity shall:
// - start t-StatusProhibit. // - start t-StatusProhibit.
if (rlcP->t_status_prohibit.running == 0) { if (rlc_pP->t_status_prohibit.running == 0) {
rlc_am_send_status_pdu(rlcP,frame); rlc_am_send_status_pdu(rlc_pP,frameP);
mem_block_t* pdu = list_remove_head(&rlcP->control_pdu_list); mem_block_t* pdu = list_remove_head(&rlc_pP->control_pdu_list);
if (pdu) { if (pdu) {
list_add_tail_eurecom (pdu, &rlcP->pdus_to_mac_layer); list_add_tail_eurecom (pdu, &rlc_pP->pdus_to_mac_layer);
rlcP->status_requested = 0; rlc_pP->status_requested = 0;
rlc_am_start_timer_status_prohibit(rlcP,frame); rlc_am_start_timer_status_prohibit(rlc_pP,frameP);
return; return;
} }
} }
else { else {
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] DELAYED SENT STATUS PDU BECAUSE T-STATUS-PROHIBIT RUNNING (TIME-OUT FRAME %05d)\n",frame, rlcP->module_id, rlcP->rb_id, rlcP->t_status_prohibit.frame_time_out); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] DELAYED SENT STATUS PDU BECAUSE T-STATUS-PROHIBIT RUNNING (TIME-OUT FRAME %05d)\n",frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->t_status_prohibit.frame_time_out);
} }
} }
/*while ((rlcP->nb_bytes_requested_by_mac > 0) && (stay_on_this_list)) { /*while ((rlc_pP->nb_bytes_requested_by_mac > 0) && (stay_on_this_list)) {
mem_block_t* pdu = list_get_head(&rlcP->control_pdu_list); mem_block_t* pdu = list_get_head(&rlc_pP->control_pdu_list);
if (pdu != NULL { if (pdu != NULL {
if ( ((rlc_am_tx_control_pdu_management_t*)(pdu->data))->size <= rlcP->nb_bytes_requested_by_mac) { if ( ((rlc_am_tx_control_pdu_management_t*)(pdu->data))->size <= rlc_pP->nb_bytes_requested_by_mac) {
pdu = list_remove_head(&rlcP->control_pdu_list); pdu = list_remove_head(&rlc_pP->control_pdu_list);
#ifdef TRACE_RLC_AM_TX #ifdef TRACE_RLC_AM_TX
msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] SEND CONTROL PDU\n", ((rlc_am_entity_t *) rlcP)->module_id,((rlc_am_entity_t *) rlcP)->rb_id, frame); msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] SEND CONTROL PDU\n", ((rlc_am_entity_t *) rlc_pP)->module_id,((rlc_am_entity_t *) rlc_pP)->rb_id, frameP);
#endif #endif
list_add_tail_eurecom (pdu, &rlcP->pdus_to_mac_layer); list_add_tail_eurecom (pdu, &rlc_pP->pdus_to_mac_layer);
rlcP->nb_bytes_requested_by_mac = rlcP->nb_bytes_requested_by_mac - ((rlc_am_tx_control_pdu_management_t*)(pdu->data))->size; rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - ((rlc_am_tx_control_pdu_management_t*)(pdu->data))->size;
} else { } else {
stay_on_this_list = 0; stay_on_this_list = 0;
} }
...@@ -305,113 +312,113 @@ rlc_am_get_pdus (rlc_am_entity_t *rlcP,u32_t frame) ...@@ -305,113 +312,113 @@ rlc_am_get_pdus (rlc_am_entity_t *rlcP,u32_t frame)
} }
}*/ }*/
// THEN TRY TO SEND RETRANS PDU // THEN TRY TO SEND RETRANS PDU
if (rlcP->first_retrans_pdu_sn >= 0) { if (rlc_pP->first_retrans_pdu_sn >= 0) {
rlc_am_tx_data_pdu_management_t* tx_data_pdu_management; rlc_am_tx_data_pdu_management_t* tx_data_pdu_management;
// tx min 3 bytes because of the size of the RLC header // tx min 3 bytes because of the size of the RLC header
while ((rlcP->nb_bytes_requested_by_mac > 2) && while ((rlc_pP->nb_bytes_requested_by_mac > 2) &&
(rlcP->first_retrans_pdu_sn >= 0) && (rlc_pP->first_retrans_pdu_sn >= 0) &&
(rlcP->first_retrans_pdu_sn != rlcP->vt_s)) { (rlc_pP->first_retrans_pdu_sn != rlc_pP->vt_s)) {
tx_data_pdu_management = &rlcP->pdu_retrans_buffer[rlcP->first_retrans_pdu_sn]; tx_data_pdu_management = &rlc_pP->pdu_retrans_buffer[rlc_pP->first_retrans_pdu_sn];
if ((tx_data_pdu_management->header_and_payload_size <= rlcP->nb_bytes_requested_by_mac) && (tx_data_pdu_management->retx_count >= 0) && (tx_data_pdu_management->nack_so_start == 0) && (tx_data_pdu_management->nack_so_stop == 0x7FFF)) { if ((tx_data_pdu_management->header_and_payload_size <= rlc_pP->nb_bytes_requested_by_mac) && (tx_data_pdu_management->retx_count >= 0) && (tx_data_pdu_management->nack_so_start == 0) && (tx_data_pdu_management->nack_so_stop == 0x7FFF)) {
mem_block_t* copy = rlc_am_retransmit_get_copy(rlcP, frame,rlcP->first_retrans_pdu_sn); mem_block_t* copy = rlc_am_retransmit_get_copy(rlc_pP, frameP,rlc_pP->first_retrans_pdu_sn);
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RE-SEND DATA PDU SN %04d %d BYTES\n",frame, rlcP->module_id,rlcP->rb_id, rlcP->first_retrans_pdu_sn, tx_data_pdu_management->header_and_payload_size); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RE-SEND DATA PDU SN %04d %d BYTES\n",frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn, tx_data_pdu_management->header_and_payload_size);
rlcP->stat_tx_data_pdu += 1; rlc_pP->stat_tx_data_pdu += 1;
rlcP->stat_tx_retransmit_pdu += 1; rlc_pP->stat_tx_retransmit_pdu += 1;
rlcP->stat_tx_retransmit_pdu_by_status += 1; rlc_pP->stat_tx_retransmit_pdu_by_status += 1;
rlcP->stat_tx_data_bytes += tx_data_pdu_management->header_and_payload_size; rlc_pP->stat_tx_data_bytes += tx_data_pdu_management->header_and_payload_size;
rlcP->stat_tx_retransmit_bytes += tx_data_pdu_management->header_and_payload_size; rlc_pP->stat_tx_retransmit_bytes += tx_data_pdu_management->header_and_payload_size;
rlcP->stat_tx_retransmit_bytes_by_status += tx_data_pdu_management->header_and_payload_size; rlc_pP->stat_tx_retransmit_bytes_by_status += tx_data_pdu_management->header_and_payload_size;
list_add_tail_eurecom (copy, &rlcP->pdus_to_mac_layer); list_add_tail_eurecom (copy, &rlc_pP->pdus_to_mac_layer);
rlcP->nb_bytes_requested_by_mac = rlcP->nb_bytes_requested_by_mac - tx_data_pdu_management->header_and_payload_size; rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - tx_data_pdu_management->header_and_payload_size;
tx_data_pdu_management->retx_count += 1; tx_data_pdu_management->retx_count += 1;
return; return;
} else if ((tx_data_pdu_management->retx_count >= 0) && (rlcP->nb_bytes_requested_by_mac >= RLC_AM_MIN_SEGMENT_SIZE_REQUEST)) { } else if ((tx_data_pdu_management->retx_count >= 0) && (rlc_pP->nb_bytes_requested_by_mac >= RLC_AM_MIN_SEGMENT_SIZE_REQUEST)) {
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] SEND SEGMENT OF DATA PDU SN %04d MAC BYTES %d SIZE %d RTX COUNT %d nack_so_start %d nack_so_stop %04X(hex)\n", frame, rlcP->module_id,rlcP->rb_id, LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] SEND SEGMENT OF DATA PDU SN %04d MAC BYTES %d SIZE %d RTX COUNT %d nack_so_start %d nack_so_stop %04X(hex)\n", frameP, rlc_pP->module_id,rlc_pP->rb_id,
rlcP->first_retrans_pdu_sn, rlc_pP->first_retrans_pdu_sn,
rlcP->nb_bytes_requested_by_mac, rlc_pP->nb_bytes_requested_by_mac,
tx_data_pdu_management->header_and_payload_size, tx_data_pdu_management->header_and_payload_size,
tx_data_pdu_management->retx_count, tx_data_pdu_management->retx_count,
tx_data_pdu_management->nack_so_start, tx_data_pdu_management->nack_so_start,
tx_data_pdu_management->nack_so_stop); tx_data_pdu_management->nack_so_stop);
mem_block_t* copy = rlc_am_retransmit_get_subsegment(rlcP, frame, rlcP->first_retrans_pdu_sn, &rlcP->nb_bytes_requested_by_mac); mem_block_t* copy = rlc_am_retransmit_get_subsegment(rlc_pP, frameP, rlc_pP->first_retrans_pdu_sn, &rlc_pP->nb_bytes_requested_by_mac);
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] SEND SEGMENT OF DATA PDU SN %04d (NEW SO %05d)\n", frame, rlcP->module_id,rlcP->rb_id, rlcP->first_retrans_pdu_sn, tx_data_pdu_management->nack_so_start); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] SEND SEGMENT OF DATA PDU SN %04d (NEW SO %05d)\n", frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn, tx_data_pdu_management->nack_so_start);
rlcP->stat_tx_data_pdu += 1; rlc_pP->stat_tx_data_pdu += 1;
rlcP->stat_tx_retransmit_pdu += 1; rlc_pP->stat_tx_retransmit_pdu += 1;
rlcP->stat_tx_retransmit_pdu_by_status += 1; rlc_pP->stat_tx_retransmit_pdu_by_status += 1;
rlcP->stat_tx_data_bytes += (((struct mac_tb_req*)(copy->data))->tb_size_in_bits >> 3); rlc_pP->stat_tx_data_bytes += (((struct mac_tb_req*)(copy->data))->tb_size_in_bits >> 3);
rlcP->stat_tx_retransmit_bytes += (((struct mac_tb_req*)(copy->data))->tb_size_in_bits >> 3); rlc_pP->stat_tx_retransmit_bytes += (((struct mac_tb_req*)(copy->data))->tb_size_in_bits >> 3);
rlcP->stat_tx_retransmit_bytes_by_status += (((struct mac_tb_req*)(copy->data))->tb_size_in_bits >> 3); rlc_pP->stat_tx_retransmit_bytes_by_status += (((struct mac_tb_req*)(copy->data))->tb_size_in_bits >> 3);
list_add_tail_eurecom (copy, &rlcP->pdus_to_mac_layer); list_add_tail_eurecom (copy, &rlc_pP->pdus_to_mac_layer);
} else { } else {
break; break;
} }
// update first_retrans_pdu_sn // update first_retrans_pdu_sn
while ((rlcP->first_retrans_pdu_sn != rlcP->vt_s) && while ((rlc_pP->first_retrans_pdu_sn != rlc_pP->vt_s) &&
(!(rlcP->pdu_retrans_buffer[rlcP->first_retrans_pdu_sn].flags.retransmit))) { (!(rlc_pP->pdu_retrans_buffer[rlc_pP->first_retrans_pdu_sn].flags.retransmit))) {
rlcP->first_retrans_pdu_sn = (rlcP->first_retrans_pdu_sn+1) & RLC_AM_SN_MASK; rlc_pP->first_retrans_pdu_sn = (rlc_pP->first_retrans_pdu_sn+1) & RLC_AM_SN_MASK;
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] UPDATED first_retrans_pdu_sn SN %04d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->first_retrans_pdu_sn); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] UPDATED first_retrans_pdu_sn SN %04d\n", frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn);
}; };
display_flag = 1; display_flag = 1;
if (rlcP->first_retrans_pdu_sn == rlcP->vt_s) { if (rlc_pP->first_retrans_pdu_sn == rlc_pP->vt_s) {
// no more pdu to be retransmited // no more pdu to be retransmited
rlcP->first_retrans_pdu_sn = -1; rlc_pP->first_retrans_pdu_sn = -1;
display_flag = 0; display_flag = 0;
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] CLEAR first_retrans_pdu_sn\n",frame, rlcP->module_id, rlcP->rb_id); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] CLEAR first_retrans_pdu_sn\n",frameP, rlc_pP->module_id, rlc_pP->rb_id);
} }
if (display_flag > 0) { if (display_flag > 0) {
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] UPDATED first_retrans_pdu_sn %04d\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->first_retrans_pdu_sn); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] UPDATED first_retrans_pdu_sn %04d\n", frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn);
} }
return; return;
/* ONLY ONE TB PER TTI /* ONLY ONE TB PER TTI
if ((tx_data_pdu_management->retx_count >= 0) && (rlcP->nb_bytes_requested_by_mac < RLC_AM_MIN_SEGMENT_SIZE_REQUEST)) { if ((tx_data_pdu_management->retx_count >= 0) && (rlc_pP->nb_bytes_requested_by_mac < RLC_AM_MIN_SEGMENT_SIZE_REQUEST)) {
#ifdef TRACE_RLC_AM_TX #ifdef TRACE_RLC_AM_TX
msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BREAK LOOP ON RETRANSMISSION BECAUSE ONLY %d BYTES ALLOWED TO TRANSMIT BY MAC\n",frame, ((rlc_am_entity_t *) rlcP)->module_id,((rlc_am_entity_t *) rlcP)->rb_id, rlcP->nb_bytes_requested_by_mac); msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] BREAK LOOP ON RETRANSMISSION BECAUSE ONLY %d BYTES ALLOWED TO TRANSMIT BY MAC\n",frameP, ((rlc_am_entity_t *) rlc_pP)->module_id,((rlc_am_entity_t *) rlc_pP)->rb_id, rlc_pP->nb_bytes_requested_by_mac);
#endif #endif
break; break;
}*/ }*/
} }
} }
if ((rlcP->nb_bytes_requested_by_mac > 2) && (rlcP->vt_s != rlcP->vt_ms)) { if ((rlc_pP->nb_bytes_requested_by_mac > 2) && (rlc_pP->vt_s != rlc_pP->vt_ms)) {
rlc_am_segment_10(rlcP,frame); rlc_am_segment_10(rlc_pP,frameP);
list_add_list (&rlcP->segmentation_pdu_list, &rlcP->pdus_to_mac_layer); list_add_list (&rlc_pP->segmentation_pdu_list, &rlc_pP->pdus_to_mac_layer);
if (rlcP->pdus_to_mac_layer.head != NULL) { if (rlc_pP->pdus_to_mac_layer.head != NULL) {
rlcP->stat_tx_data_pdu += 1; rlc_pP->stat_tx_data_pdu += 1;
rlcP->stat_tx_data_bytes += (((struct mac_tb_req*)(rlcP->pdus_to_mac_layer.head->data))->tb_size_in_bits >> 3); rlc_pP->stat_tx_data_bytes += (((struct mac_tb_req*)(rlc_pP->pdus_to_mac_layer.head->data))->tb_size_in_bits >> 3);
return; return;
} }
} }
if ((rlcP->pdus_to_mac_layer.head == NULL) && (rlc_am_is_timer_poll_retransmit_timed_out(rlcP)) && (rlcP->nb_bytes_requested_by_mac > 2)) { if ((rlc_pP->pdus_to_mac_layer.head == NULL) && (rlc_am_is_timer_poll_retransmit_timed_out(rlc_pP)) && (rlc_pP->nb_bytes_requested_by_mac > 2)) {
rlc_am_retransmit_any_pdu(rlcP,frame); rlc_am_retransmit_any_pdu(rlc_pP,frameP);
return; return;
} else { } else {
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] COULD NOT RETRANSMIT ANY PDU BECAUSE ",frame, rlcP->module_id, rlcP->rb_id); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] COULD NOT RETRANSMIT ANY PDU BECAUSE ",frameP, rlc_pP->module_id, rlc_pP->rb_id);
if (rlcP->pdus_to_mac_layer.head != NULL) { if (rlc_pP->pdus_to_mac_layer.head != NULL) {
LOG_D(RLC, "THERE ARE SOME PDUS READY TO TRANSMIT "); LOG_D(RLC, "THERE ARE SOME PDUS READY TO TRANSMIT ");
} }
if (!(rlc_am_is_timer_poll_retransmit_timed_out(rlcP))) { if (!(rlc_am_is_timer_poll_retransmit_timed_out(rlc_pP))) {
LOG_D(RLC, "TIMER POLL DID NOT TIMED OUT (RUNNING = %d NUM PDUS TO RETRANS = %d NUM BYTES TO RETRANS = %d) ", rlcP->t_poll_retransmit.running, rlcP->retrans_num_pdus, rlcP->retrans_num_bytes_to_retransmit); LOG_D(RLC, "TIMER POLL DID NOT TIMED OUT (RUNNING = %d NUM PDUS TO RETRANS = %d NUM BYTES TO RETRANS = %d) ", rlc_pP->t_poll_retransmit.running, rlc_pP->retrans_num_pdus, rlc_pP->retrans_num_bytes_to_retransmit);
} }
if (rlcP->nb_bytes_requested_by_mac <= 2) { if (rlc_pP->nb_bytes_requested_by_mac <= 2) {
LOG_D(RLC, "NUM BYTES REQUESTED BY MAC = %d", rlcP->nb_bytes_requested_by_mac); LOG_D(RLC, "NUM BYTES REQUESTED BY MAC = %d", rlc_pP->nb_bytes_requested_by_mac);
} }
LOG_D(RLC, "\n"); LOG_D(RLC, "\n");
} }
break; break;
default: default:
LOG_E(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_DATA_REQ UNKNOWN PROTOCOL STATE 0x%02X\n", frame, rlcP->module_id, rlcP->rb_id, rlcP->protocol_state); LOG_E(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_DATA_REQ UNKNOWN PROTOCOL STATE 0x%02X\n", frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->protocol_state);
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
rlc_am_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP) rlc_am_rx (void *argP, u32_t frameP, u8_t eNB_flagP, struct mac_data_ind data_indP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -425,7 +432,7 @@ rlc_am_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP ...@@ -425,7 +432,7 @@ rlc_am_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP
break; break;
case RLC_DATA_TRANSFER_READY_STATE: case RLC_DATA_TRANSFER_READY_STATE:
rlc_am_receive_routing (rlc, frame, eNB_flag, data_indP); rlc_am_receive_routing (rlc, frameP, eNB_flagP, data_indP);
break; break;
default: default:
...@@ -435,14 +442,14 @@ rlc_am_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP ...@@ -435,14 +442,14 @@ rlc_am_rx (void *argP, u32_t frame, u8_t eNB_flag, struct mac_data_ind data_indP
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
struct mac_status_resp struct mac_status_resp
rlc_am_mac_status_indication (void *rlcP, u32 frame, u16 tb_sizeP, struct mac_status_ind tx_statusP) rlc_am_mac_status_indication (void *rlc_pP, u32 frameP, u16 tb_sizeP, struct mac_status_ind tx_statusP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
struct mac_status_resp status_resp; struct mac_status_resp status_resp;
u16_t sdu_size = 0; u16_t sdu_size = 0;
u16_t sdu_remaining_size = 0; u16_t sdu_remaining_size = 0;
s32_t diff_time=0; s32_t diff_time=0;
rlc_am_entity_t *rlc = (rlc_am_entity_t *) rlcP; rlc_am_entity_t *rlc = (rlc_am_entity_t *) rlc_pP;
status_resp.buffer_occupancy_in_bytes = 0; status_resp.buffer_occupancy_in_bytes = 0;
status_resp.buffer_occupancy_in_pdus = 0; status_resp.buffer_occupancy_in_pdus = 0;
...@@ -451,24 +458,24 @@ rlc_am_mac_status_indication (void *rlcP, u32 frame, u16 tb_sizeP, struct mac_st ...@@ -451,24 +458,24 @@ rlc_am_mac_status_indication (void *rlcP, u32 frame, u16 tb_sizeP, struct mac_st
status_resp.head_sdu_is_segmented = 0; status_resp.head_sdu_is_segmented = 0;
status_resp.rlc_info.rlc_protocol_state = rlc->protocol_state; status_resp.rlc_info.rlc_protocol_state = rlc->protocol_state;
if (rlc->last_frame_status_indication != frame) { if (rlc->last_frame_status_indication != frameP) {
rlc_am_check_timer_poll_retransmit(rlc,frame); rlc_am_check_timer_poll_retransmit(rlc,frameP);
rlc_am_check_timer_reordering(rlc,frame); rlc_am_check_timer_reordering(rlc,frameP);
rlc_am_check_timer_status_prohibit(rlc,frame); rlc_am_check_timer_status_prohibit(rlc,frameP);
} }
rlc->last_frame_status_indication = frame; rlc->last_frame_status_indication = frameP;
rlc->nb_bytes_requested_by_mac = tb_sizeP; rlc->nb_bytes_requested_by_mac = tb_sizeP;
status_resp.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(rlc,frame); status_resp.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(rlc,frameP);
if ((rlc->input_sdus[rlc->current_sdu_index].mem_block != NULL) && (status_resp.buffer_occupancy_in_bytes)) { if ((rlc->input_sdus[rlc->current_sdu_index].mem_block != NULL) && (status_resp.buffer_occupancy_in_bytes)) {
//status_resp.buffer_occupancy_in_bytes += ((rlc_am_entity_t *) rlc)->tx_header_min_length_in_bytes; //status_resp.buffer_occupancy_in_bytes += ((rlc_am_entity_t *) rlc)->tx_header_min_length_in_bytes;
status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu; status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu;
diff_time = frame - ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_creation_time; diff_time = frameP - ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_creation_time;
status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (u32_t) diff_time : (u32_t)(0xffffffff - diff_time + frame) ; status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (u32_t) diff_time : (u32_t)(0xffffffff - diff_time + frameP) ;
sdu_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_size; sdu_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_size;
sdu_remaining_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_remaining_size; sdu_remaining_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_remaining_size;
...@@ -487,14 +494,14 @@ rlc_am_mac_status_indication (void *rlcP, u32 frame, u16 tb_sizeP, struct mac_st ...@@ -487,14 +494,14 @@ rlc_am_mac_status_indication (void *rlcP, u32 frame, u16 tb_sizeP, struct mac_st
#ifdef TRACE_RLC_AM_TX_STATUS #ifdef TRACE_RLC_AM_TX_STATUS
if (tb_sizeP > 0) { if (tb_sizeP > 0) {
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_STATUS_INDICATION (DATA) %d bytes -> %d bytes\n", frame, rlc->module_id, rlc->rb_id, tb_sizeP, status_resp.buffer_occupancy_in_bytes); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_STATUS_INDICATION (DATA) %d bytes -> %d bytes\n", frameP, rlc->module_id, rlc->rb_id, tb_sizeP, status_resp.buffer_occupancy_in_bytes);
/*if ((tx_statusP.tx_status == MAC_TX_STATUS_SUCCESSFUL) && (tx_statusP.no_pdu)) { /*if ((tx_statusP.tx_status == MAC_TX_STATUS_SUCCESSFUL) && (tx_statusP.no_pdu)) {
msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n",rlc->module_id, msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n",rlc->module_id,
rlc->rb_id, frame, tx_statusP.no_pdu); rlc->rb_id, frameP, tx_statusP.no_pdu);
} }
if ((tx_statusP.tx_status == MAC_TX_STATUS_UNSUCCESSFUL) && (tx_statusP.no_pdu)) { if ((tx_statusP.tx_status == MAC_TX_STATUS_UNSUCCESSFUL) && (tx_statusP.no_pdu)) {
msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n",rlc->module_id, rlc->rb_id, msg ("[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n",rlc->module_id, rlc->rb_id,
frame, tx_statusP.no_pdu); frameP, tx_statusP.no_pdu);
}*/ }*/
} }
#endif #endif
...@@ -502,205 +509,340 @@ frame, tx_statusP.no_pdu); ...@@ -502,205 +509,340 @@ frame, tx_statusP.no_pdu);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
struct mac_data_req struct mac_data_req
rlc_am_mac_data_request (void *rlcP,u32 frame) rlc_am_mac_data_request (void *rlc_pP,u32 frameP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
struct mac_data_req data_req; struct mac_data_req data_req;
rlc_am_entity_t *l_rlc = (rlc_am_entity_t *) rlcP; rlc_am_entity_t *l_rlc_p = (rlc_am_entity_t *) rlc_pP;
unsigned int nb_bytes_requested_by_mac = ((rlc_am_entity_t *) rlcP)->nb_bytes_requested_by_mac; unsigned int nb_bytes_requested_by_mac = ((rlc_am_entity_t *) rlc_pP)->nb_bytes_requested_by_mac;
#ifdef TRACE_RLC_AM_PDU
rlc_am_pdu_info_t pdu_info;
rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p;
mem_block_t *tb_p;
s16_t tb_size_in_bytes;
int num_nack;
char message_string[9000];
size_t message_string_size = 0;
MessageDef *msg_p;
int octet_index, index;
#endif
rlc_am_get_pdus (rlcP,frame); rlc_am_get_pdus (rlc_pP,frameP);
list_init (&data_req.data, NULL); list_init (&data_req.data, NULL);
list_add_list (&l_rlc->pdus_to_mac_layer, &data_req.data); list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data);
//((rlc_am_entity_t *) rlcP)->tx_pdus += data_req.data.nb_elements; //((rlc_am_entity_t *) rlc_pP)->tx_pdus += data_req.data.nb_elements;
if ((nb_bytes_requested_by_mac + data_req.data.nb_elements) > 0) { if ((nb_bytes_requested_by_mac + data_req.data.nb_elements) > 0) {
LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_DATA_REQUEST %05d BYTES REQUESTED -> %d TBs\n", frame, l_rlc->module_id,l_rlc->rb_id, nb_bytes_requested_by_mac, data_req.data.nb_elements); LOG_D(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] MAC_DATA_REQUEST %05d BYTES REQUESTED -> %d TBs\n", frameP, l_rlc_p->module_id,l_rlc_p->rb_id, nb_bytes_requested_by_mac, data_req.data.nb_elements);
} }
data_req.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(l_rlc,frame); data_req.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(l_rlc_p,frameP);
data_req.rlc_info.rlc_protocol_state = l_rlc->protocol_state; data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state;
#ifdef TRACE_RLC_AM_PDU
if (data_req.data.nb_elements > 0) { if (data_req.data.nb_elements > 0) {
LOG_D(RLC, "[RLC_AM][MOD %d][RB %d][FRAME %05d] MAC_DATA_REQUEST %d TBs\n", l_rlc->module_id, l_rlc->rb_id, frame, data_req.data.nb_elements);
mem_block_t *tb; tb_p = data_req.data.head;
rlc[l_rlc->module_id].m_mscgen_trace_length = sprintf(rlc[l_rlc->module_id].m_mscgen_trace, "[MSC_MSG][FRAME %05d][RLC_AM][MOD %02d][RB %02d][--- MAC_DATA_REQ/ %d TB(s) ",
frame, while (tb_p != NULL) {
l_rlc->module_id,
l_rlc->rb_id, rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)((struct mac_tb_req *) (tb_p->data))->data_ptr;
data_req.data.nb_elements); tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size_in_bits >> 3;
tb = data_req.data.head; if ((((struct mac_tb_req *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) {
if (rlc_am_get_data_pdu_infos(frameP,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) {
while (tb != NULL) { # if defined(ENABLE_ITTI)
message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
if ((((struct mac_tb_req *) (tb->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) { message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], " SN %d %d Bytes ", message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
(((struct mac_tb_req *) (tb->data))->data_ptr[1]) + (((u16_t)((((struct mac_tb_req *) (tb->data))->data_ptr[0]) & 0x03)) << 8), message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
((struct mac_tb_req *) (tb->data))->tb_size_in_bits>>3); if (pdu_info.rf) {
message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: AMD PDU segment\n\n");
} else {
message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: AMD PDU\n\n");
}
message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", pdu_info.d_c);
message_string_size += sprintf(&message_string[message_string_size], " RF : %u\n", pdu_info.rf);
message_string_size += sprintf(&message_string[message_string_size], " P : %u\n", pdu_info.p);
message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
if (pdu_info.rf) {
message_string_size += sprintf(&message_string[message_string_size], " LSF : %u\n", pdu_info.lsf);
message_string_size += sprintf(&message_string[message_string_size], " SO : %u\n", pdu_info.so);
}
if (pdu_info.e) {
message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
for (index=0; index < pdu_info.num_li; index++) {
message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
}
}
message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
if ((octet_index % 16) == 0){
if (octet_index != 0) {
message_string_size += sprintf(&message_string[message_string_size], " |\n");
}
message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
}
/*
* Print every single octet in hexadecimal form
*/
message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
/*
* Align newline and pipes according to the octets in groups of 2
*/
}
/*
* Append enough spaces and put final pipe
*/
for (index = octet_index; index < 16; ++index) {
message_string_size += sprintf(&message_string[message_string_size], " ");
}
message_string_size += sprintf(&message_string[message_string_size], " |\n");
msg_p = itti_alloc_new_message_sized (l_rlc_p->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_DATA_PDU_REQ, message_string_size + sizeof (IttiMsgText));
msg_p->ittiMsg.rlc_am_data_pdu_req.size = message_string_size;
memcpy(&msg_p->ittiMsg.rlc_am_data_pdu_req.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->module_id + NB_eNB_INST, msg_p);
# else
rlc_am_display_data_pdu_infos(l_rlc_p, frameP, pdu_info);
# endif
}
} else { } else {
if ((((struct mac_tb_req *) (tb->data))->data_ptr[1] & 0x02) == 0 ) { if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, &tb_size_in_bytes, &g_rlc_am_control_pdu_info) >= 0) {
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], " STATUS ACK SN %d ... %d Bytes ", tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size_in_bits >> 3; //tb_size_in_bytes modified by rlc_am_get_control_pdu_infos!
(((struct mac_tb_req *) (tb->data))->data_ptr[1] >> 2) + (((u16_t)((((struct mac_tb_req *) (tb->data))->data_ptr[0]) & 0x0F)) << 8),
((struct mac_tb_req *) (tb->data))->tb_size_in_bits>>3); # if defined(ENABLE_ITTI)
} else { message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], " STATUS ACK SN %d %d Bytes ", message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
(((struct mac_tb_req *) (tb->data))->data_ptr[1] >> 2) + (((u16_t)((((struct mac_tb_req *) (tb->data))->data_ptr[0]) & 0x0F)) << 8), message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: STATUS PDU\n\n");
((struct mac_tb_req *) (tb->data))->tb_size_in_bits>>3); message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", g_rlc_am_control_pdu_info.d_c);
message_string_size += sprintf(&message_string[message_string_size], " CPT : %u\n", g_rlc_am_control_pdu_info.cpt);
message_string_size += sprintf(&message_string[message_string_size], " ACK_SN : %u\n", g_rlc_am_control_pdu_info.ack_sn);
message_string_size += sprintf(&message_string[message_string_size], " E1 : %u\n", g_rlc_am_control_pdu_info.e1);
for (num_nack = 0; num_nack < g_rlc_am_control_pdu_info.num_nack; num_nack++) {
if (g_rlc_am_control_pdu_info.nack_list[num_nack].e2) {
message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d SO START %05d SO END %05d",
g_rlc_am_control_pdu_info.nack_list[num_nack].nack_sn,
g_rlc_am_control_pdu_info.nack_list[num_nack].so_start,
g_rlc_am_control_pdu_info.nack_list[num_nack].so_end);
} else {
message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d", g_rlc_am_control_pdu_info.nack_list[num_nack].nack_sn);
}
}
msg_p = itti_alloc_new_message_sized (l_rlc_p->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_STATUS_PDU_REQ, message_string_size + sizeof (IttiMsgText));
msg_p->ittiMsg.rlc_am_status_pdu_req.size = message_string_size;
memcpy(&msg_p->ittiMsg.rlc_am_status_pdu_req.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->module_id + NB_eNB_INST, msg_p);
# endif
} }
} }
tb = tb->next; tb_p = tb_p->next;
} }
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], "BO=%d --->][MAC_%s][MOD %02d][]\n",
data_req.buffer_occupancy_in_bytes,
(l_rlc->is_enb) ? "eNB":"UE",
l_rlc->module_id);
rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length] = 0;
LOG_D(RLC, "%s", rlc[l_rlc->module_id].m_mscgen_trace);
} }
#endif
return data_req; return data_req;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
rlc_am_mac_data_indication (void *rlcP, u32_t frame, u8 eNB_flag, struct mac_data_ind data_indP) rlc_am_mac_data_indication (void *rlc_pP, u32_t frameP, u8 eNB_flagP, struct mac_data_ind data_indP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_am_entity_t *l_rlc = (rlc_am_entity_t *) rlcP; rlc_am_entity_t *l_rlc_p = (rlc_am_entity_t *) rlc_pP;
rlc_am_pdu_info_t pdu_info; /*rlc_am_control_pdu_info_t control_pdu_info;
rlc_am_control_pdu_info_t control_pdu_info;
mem_block_t *tb;
int num_li; int num_li;
int num_nack; s16_t tb_size;*/
s16_t tb_size; #ifdef TRACE_RLC_AM_PDU
rlc_am_pdu_info_t pdu_info;
if (data_indP.data.nb_elements > 0) { rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p;
LOG_D(RLC, "[RLC_AM][MOD %d][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n", l_rlc->module_id, l_rlc->rb_id, frame, data_indP.data.nb_elements); mem_block_t *tb_p;
rlc[l_rlc->module_id].m_mscgen_trace_length = sprintf(rlc[l_rlc->module_id].m_mscgen_trace, "[MSC_MSG][FRAME %05d][MAC_%s][MOD %02d][][--- MAC_DATA_IND/ %d TB(s) ", s16_t tb_size_in_bytes;
frame, int num_nack;
(l_rlc->is_enb) ? "eNB":"UE", char message_string[7000];
l_rlc->module_id, size_t message_string_size = 0;
data_indP.data.nb_elements); MessageDef *msg_p;
int octet_index, index;
tb = data_indP.data.head; #endif
while (tb != NULL) {
if ((((struct mac_tb_ind *) (tb->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) {
rlc_am_get_data_pdu_infos(frame,(rlc_am_pdu_sn_10_t*) ((struct mac_tb_ind *) (tb->data))->data_ptr, (s16_t) ((struct mac_tb_ind *) (tb->data))->size, &pdu_info);
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length],
"\\nSN %d %c%c%c%c%c",
(((struct mac_tb_ind *) (tb->data))->data_ptr[1]) + (((u16_t)((((struct mac_tb_ind *) (tb->data))->data_ptr[0]) & 0x03)) << 8),
(((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x40) ? 'R':'_',
(((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x20) ? 'P':'_',
(((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x10) ? '}':'{',
(((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x08) ? '{':'}',
(((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x04) ? 'E':'_');
num_li = 0;
if (pdu_info.num_li > 0) {
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], "/LI(");
while (num_li != (pdu_info.num_li - 1)) {
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], "%d,",
pdu_info.li_list[num_li]);
num_li += 1;
}
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], "%d)", pdu_info.li_list[num_li]);
}
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], #ifdef TRACE_RLC_AM_PDU
"/%d Bytes ", if (data_indP.data.nb_elements > 0) {
((struct mac_tb_ind *) (tb->data))->size);
} else { tb_p = data_indP.data.head;
tb_size = (s16_t) ((struct mac_tb_ind *) (tb->data))->size;
rlc_am_get_control_pdu_infos((rlc_am_pdu_sn_10_t*) ((struct mac_tb_ind *) (tb->data))->data_ptr, while (tb_p != NULL) {
&tb_size,
&control_pdu_info); rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)((struct mac_tb_ind *) (tb_p->data))->data_ptr;
tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length],
"\\nSTATUS ACK SN %d", if ((((struct mac_tb_ind *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) {
control_pdu_info.ack_sn); if (rlc_am_get_data_pdu_infos(frameP,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) {
num_nack = 0; # if defined(ENABLE_ITTI)
while (num_nack != control_pdu_info.num_nack) {
if (control_pdu_info.nack_list[num_nack].e2) {
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length],
"\\nNACK SN %d {%d:%d}", message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
control_pdu_info.nack_list[num_nack].nack_sn, message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
control_pdu_info.nack_list[num_nack].so_start, message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
control_pdu_info.nack_list[num_nack].so_end); message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
} else { if (pdu_info.rf) {
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: AMD PDU segment\n\n");
"\\nNACK SN %d", } else {
control_pdu_info.nack_list[num_nack].nack_sn); message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: AMD PDU\n\n");
} }
num_nack += 1; message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
} message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", pdu_info.d_c);
} message_string_size += sprintf(&message_string[message_string_size], " RF : %u\n", pdu_info.rf);
tb = tb->next; message_string_size += sprintf(&message_string[message_string_size], " P : %u\n", pdu_info.p);
} message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
rlc[l_rlc->module_id].m_mscgen_trace_length += sprintf(&rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length], " --->][RLC_AM][MOD %02d][RB %02d]\n", message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
l_rlc->module_id, message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
l_rlc->rb_id); if (pdu_info.rf) {
message_string_size += sprintf(&message_string[message_string_size], " LSF : %u\n", pdu_info.lsf);
rlc[l_rlc->module_id].m_mscgen_trace[rlc[l_rlc->module_id].m_mscgen_trace_length] = 0; message_string_size += sprintf(&message_string[message_string_size], " SO : %u\n", pdu_info.so);
LOG_D(RLC, "%s", rlc[l_rlc->module_id].m_mscgen_trace); }
} if (pdu_info.e) {
rlc_am_rx (rlcP, frame, eNB_flag, data_indP); message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
for (index=0; index < pdu_info.num_li; index++) {
message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
}
}
message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
if ((octet_index % 16) == 0){
if (octet_index != 0) {
message_string_size += sprintf(&message_string[message_string_size], " |\n");
}
message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
}
/*
* Print every single octet in hexadecimal form
*/
message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
/*
* Align newline and pipes according to the octets in groups of 2
*/
}
/*
* Append enough spaces and put final pipe
*/
for (index = octet_index; index < 16; ++index) {
message_string_size += sprintf(&message_string[message_string_size], " ");
}
message_string_size += sprintf(&message_string[message_string_size], " |\n");
msg_p = itti_alloc_new_message_sized (l_rlc_p->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_DATA_PDU_IND, message_string_size + sizeof (IttiMsgText));
msg_p->ittiMsg.rlc_am_data_pdu_ind.size = message_string_size;
memcpy(&msg_p->ittiMsg.rlc_am_data_pdu_ind.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->module_id + NB_eNB_INST, msg_p);
# else
rlc_am_display_data_pdu_infos(l_rlc_p, frameP, pdu_info);
# endif
}
} else {
if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, &tb_size_in_bytes, &g_rlc_am_control_pdu_info) >= 0) {
# if defined(ENABLE_ITTI)
message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: STATUS PDU\n\n");
message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", g_rlc_am_control_pdu_info.d_c);
message_string_size += sprintf(&message_string[message_string_size], " CPT : %u\n", g_rlc_am_control_pdu_info.cpt);
message_string_size += sprintf(&message_string[message_string_size], " ACK_SN : %u\n", g_rlc_am_control_pdu_info.ack_sn);
message_string_size += sprintf(&message_string[message_string_size], " E1 : %u\n", g_rlc_am_control_pdu_info.e1);
for (num_nack = 0; num_nack < g_rlc_am_control_pdu_info.num_nack; num_nack++) {
if (g_rlc_am_control_pdu_info.nack_list[num_nack].e2) {
message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d SO START %05d SO END %05d",
g_rlc_am_control_pdu_info.nack_list[num_nack].nack_sn,
g_rlc_am_control_pdu_info.nack_list[num_nack].so_start,
g_rlc_am_control_pdu_info.nack_list[num_nack].so_end);
} else {
message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d", g_rlc_am_control_pdu_info.nack_list[num_nack].nack_sn);
}
}
msg_p = itti_alloc_new_message_sized (l_rlc_p->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_STATUS_PDU_IND, message_string_size + sizeof (IttiMsgText));
msg_p->ittiMsg.rlc_am_status_pdu_ind.size = message_string_size;
memcpy(&msg_p->ittiMsg.rlc_am_status_pdu_ind.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->module_id + NB_eNB_INST, msg_p);
# endif
}
}
tb_p = tb_p->next;
}
}
#endif
rlc_am_rx (rlc_pP, frameP, eNB_flagP, data_indP);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
rlc_am_data_req (void *rlcP, u32_t frame, mem_block_t * sduP) rlc_am_data_req (void *rlc_pP, u32_t frameP, mem_block_t * sdu_pP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_am_entity_t *rlc = (rlc_am_entity_t *) rlcP; rlc_am_entity_t *rlc_p = (rlc_am_entity_t *) rlc_pP;
u32_t mui; u32_t mui;
u16_t data_offset; u16_t data_offset;
u16_t data_size; u16_t data_size;
u8_t conf; u8_t conf;
if ((rlc->input_sdus[rlc->next_sdu_index].mem_block == NULL) && if ((rlc_p->input_sdus[rlc_p->next_sdu_index].mem_block == NULL) &&
(rlc->input_sdus[rlc->next_sdu_index].flags.segmented == 0) && (rlc_p->input_sdus[rlc_p->next_sdu_index].flags.segmented == 0) &&
(((rlc->next_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE) != rlc->current_sdu_index)) { (((rlc_p->next_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE) != rlc_p->current_sdu_index)) {
memset(&rlc->input_sdus[rlc->next_sdu_index], 0, sizeof(rlc_am_tx_sdu_management_t)); memset(&rlc_p->input_sdus[rlc_p->next_sdu_index], 0, sizeof(rlc_am_tx_sdu_management_t));
rlc->input_sdus[rlc->next_sdu_index].mem_block = sduP; rlc_p->input_sdus[rlc_p->next_sdu_index].mem_block = sdu_pP;
mui = ((struct rlc_am_data_req *) (sduP->data))->mui; mui = ((struct rlc_am_data_req *) (sdu_pP->data))->mui;
data_offset = ((struct rlc_am_data_req *) (sduP->data))->data_offset; data_offset = ((struct rlc_am_data_req *) (sdu_pP->data))->data_offset;
data_size = ((struct rlc_am_data_req *) (sduP->data))->data_size; data_size = ((struct rlc_am_data_req *) (sdu_pP->data))->data_size;
conf = ((struct rlc_am_data_req *) (sduP->data))->conf; conf = ((struct rlc_am_data_req *) (sdu_pP->data))->conf;
rlc->stat_tx_pdcp_sdu += 1; rlc_p->stat_tx_pdcp_sdu += 1;
rlc->stat_tx_pdcp_bytes += data_size; rlc_p->stat_tx_pdcp_bytes += data_size;
rlc->input_sdus[rlc->next_sdu_index].mui = mui; rlc_p->input_sdus[rlc_p->next_sdu_index].mui = mui;
rlc->input_sdus[rlc->next_sdu_index].sdu_size = data_size; rlc_p->input_sdus[rlc_p->next_sdu_index].sdu_size = data_size;
//rlc->input_sdus[rlc->next_sdu_index].confirm = conf; //rlc_p->input_sdus[rlc_p->next_sdu_index].confirm = conf;
rlc->sdu_buffer_occupancy += data_size; rlc_p->sdu_buffer_occupancy += data_size;
rlc->nb_sdu += 1; rlc_p->nb_sdu += 1;
rlc->nb_sdu_no_segmented += 1; rlc_p->nb_sdu_no_segmented += 1;
rlc->input_sdus[rlc->next_sdu_index].first_byte = (u8_t*)(&sduP->data[data_offset]); rlc_p->input_sdus[rlc_p->next_sdu_index].first_byte = (u8_t*)(&sdu_pP->data[data_offset]);
rlc->input_sdus[rlc->next_sdu_index].sdu_remaining_size = rlc->input_sdus[rlc->next_sdu_index].sdu_size; rlc_p->input_sdus[rlc_p->next_sdu_index].sdu_remaining_size = rlc_p->input_sdus[rlc_p->next_sdu_index].sdu_size;
rlc->input_sdus[rlc->next_sdu_index].sdu_segmented_size = 0; rlc_p->input_sdus[rlc_p->next_sdu_index].sdu_segmented_size = 0;
rlc->input_sdus[rlc->next_sdu_index].sdu_creation_time = frame; rlc_p->input_sdus[rlc_p->next_sdu_index].sdu_creation_time = frameP;
rlc->input_sdus[rlc->next_sdu_index].nb_pdus = 0; rlc_p->input_sdus[rlc_p->next_sdu_index].nb_pdus = 0;
rlc->input_sdus[rlc->next_sdu_index].nb_pdus_ack = 0; rlc_p->input_sdus[rlc_p->next_sdu_index].nb_pdus_ack = 0;
//rlc->input_sdus[rlc->next_sdu_index].nb_pdus_time = 0; //rlc_p->input_sdus[rlc_p->next_sdu_index].nb_pdus_time = 0;
//rlc->input_sdus[rlc->next_sdu_index].nb_pdus_internal_use = 0; //rlc_p->input_sdus[rlc_p->next_sdu_index].nb_pdus_internal_use = 0;
rlc->input_sdus[rlc->next_sdu_index].flags.discarded = 0; rlc_p->input_sdus[rlc_p->next_sdu_index].flags.discarded = 0;
rlc->input_sdus[rlc->next_sdu_index].flags.segmented = 0; rlc_p->input_sdus[rlc_p->next_sdu_index].flags.segmented = 0;
rlc->input_sdus[rlc->next_sdu_index].flags.segmentation_in_progress = 0; rlc_p->input_sdus[rlc_p->next_sdu_index].flags.segmentation_in_progress = 0;
rlc->input_sdus[rlc->next_sdu_index].flags.no_new_sdu_segmented_in_last_pdu = 0; rlc_p->input_sdus[rlc_p->next_sdu_index].flags.no_new_sdu_segmented_in_last_pdu = 0;
//rlc->input_sdus[rlc->next_sdu_index].li_index_for_discard = -1; //rlc_p->input_sdus[rlc_p->next_sdu_index].li_index_for_discard = -1;
rlc->next_sdu_index = (rlc->next_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE; rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
LOG_I(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RLC_AM_DATA_REQ size %d Bytes, NB SDU %d current_sdu_index=%d next_sdu_index=%d conf %d mui %d\n", frame, rlc->module_id, rlc->rb_id, data_size, rlc->nb_sdu, rlc->current_sdu_index, rlc->next_sdu_index, conf, mui); LOG_I(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RLC_AM_DATA_REQ size %d Bytes, NB SDU %d current_sdu_index=%d next_sdu_index=%d conf %d mui %d\n", frameP, rlc_p->module_id, rlc_p->rb_id, data_size, rlc_p->nb_sdu, rlc_p->current_sdu_index, rlc_p->next_sdu_index, conf, mui);
} else { } else {
LOG_W(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RLC_AM_DATA_REQ BUFFER FULL, NB SDU %d current_sdu_index=%d next_sdu_index=%d size_input_sdus_buffer=%d\n", frame, rlc->module_id, rlc->rb_id, rlc->nb_sdu, rlc->current_sdu_index, rlc->next_sdu_index, RLC_AM_SDU_CONTROL_BUFFER_SIZE); LOG_W(RLC, "[FRAME %05d][RLC_AM][MOD %02d][RB %02d] RLC_AM_DATA_REQ BUFFER FULL, NB SDU %d current_sdu_index=%d next_sdu_index=%d size_input_sdus_buffer=%d\n", frameP, rlc_p->module_id, rlc_p->rb_id, rlc_p->nb_sdu, rlc_p->current_sdu_index, rlc_p->next_sdu_index, RLC_AM_SDU_CONTROL_BUFFER_SIZE);
LOG_W(RLC, " input_sdus[].mem_block=%p next input_sdus[].flags.segmented=%d\n", rlc->input_sdus[rlc->next_sdu_index].mem_block, rlc->input_sdus[rlc->next_sdu_index].flags.segmented); LOG_W(RLC, " input_sdus[].mem_block=%p next input_sdus[].flags.segmented=%d\n", rlc_p->input_sdus[rlc_p->next_sdu_index].mem_block, rlc_p->input_sdus[rlc_p->next_sdu_index].flags.segmented);
rlc->stat_tx_pdcp_sdu_discarded += 1; rlc_p->stat_tx_pdcp_sdu_discarded += 1;
rlc->stat_tx_pdcp_bytes_discarded += ((struct rlc_am_data_req *) (sduP->data))->data_size; rlc_p->stat_tx_pdcp_bytes_discarded += ((struct rlc_am_data_req *) (sdu_pP->data))->data_size;
free_mem_block (sduP); free_mem_block (sdu_pP);
} }
} }
...@@ -263,10 +263,6 @@ void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlcP, u32_t frame, u8_t e ...@@ -263,10 +263,6 @@ void rlc_am_receive_process_data_pdu (rlc_am_entity_t *rlcP, u32_t frame, u8_t e
if (rlc_am_get_data_pdu_infos(frame,rlc_am_pdu_sn_10, tb_size_in_bytesP, pdu_info) >= 0) { if (rlc_am_get_data_pdu_infos(frame,rlc_am_pdu_sn_10, tb_size_in_bytesP, pdu_info) >= 0) {
#ifdef TRACE_RLC_AM_RX
rlc_am_display_data_pdu_infos(rlcP, frame, pdu_info);
#endif
((rlc_am_rx_pdu_management_t*)(tbP->data))->all_segments_received = 0; ((rlc_am_rx_pdu_management_t*)(tbP->data))->all_segments_received = 0;
if (rlc_am_in_rx_window(rlcP, pdu_info->sn)) { if (rlc_am_in_rx_window(rlcP, pdu_info->sn)) {
......
...@@ -40,7 +40,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis ...@@ -40,7 +40,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
#include "UTIL/LOG/log.h" #include "UTIL/LOG/log.h"
#define TRACE_STATUS_CREATION #define TRACE_STATUS_CREATION
static rlc_am_control_pdu_info_t g_rlc_am_control_pdu_info; rlc_am_control_pdu_info_t g_rlc_am_control_pdu_info;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
u16_t rlc_am_read_bit_field(u8_t** dataP, unsigned int* bit_posP, signed int bits_to_readP) { u16_t rlc_am_read_bit_field(u8_t** dataP, unsigned int* bit_posP, signed int bits_to_readP) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment