//----------------------------------------------------------------------------- void rlc_um_receive ( const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indP) { //----------------------------------------------------------------------------- mem_block_t *tb_p = NULL; uint8_t *first_byte_p = NULL; uint16_t tb_size_in_bytes = 0; while ((tb_p = list_remove_head (&data_indP.data))) { first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr; tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size; rlc_pP->stat_rx_data_bytes += tb_size_in_bytes; rlc_pP->stat_rx_data_pdu += 1; if (tb_size_in_bytes > 0) { rlc_um_receive_process_dar (ctxt_pP, rlc_pP, tb_p, (rlc_um_pdu_sn_10_t*)first_byte_p, tb_size_in_bytes); #if defined(TRACE_RLC_UM_RX) LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d\n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP), rlc_pP->vr_ur, rlc_pP->vr_ux, rlc_pP->vr_uh); //rlc_um_display_rx_window(rlc_pP); commented because bad display #endif } } }
//#define RLC_UM_GENERATE_ERRORS //----------------------------------------------------------------------------- void rlc_um_receive (struct rlc_um_entity *rlcP, struct mac_data_ind data_indP) { //----------------------------------------------------------------------------- mem_block_t *tb; u8_t *first_byte; u16_t tb_size_in_bytes; while ((tb = list_remove_head (&data_indP.data))) { #ifdef DEBUG_RLC_STATS rlcP->rx_pdus += 1; #endif #ifdef DEBUG_RLC_UM_DISPLAY_TB_DATA msg ("[RLC_UM][MOD %d][RB %d][FRAME %05d] DUMP RX PDU(%d bytes):", rlcP->module_id, rlcP->rb_id, mac_xface->frame, ((struct mac_tb_ind *) (tb->data))->size); for (tb_size_in_bytes = 0; tb_size_in_bytes < ((struct mac_tb_ind *) (tb->data))->size; tb_size_in_bytes++) { msg ("%02X.", ((struct mac_tb_ind *) (tb->data))->data_ptr[tb_size_in_bytes]); } msg ("\n"); #endif #ifdef RLC_UM_GENERATE_ERRORS if (random() % 10 == 4) { ((struct mac_tb_ind *) (tb->data))->error_indication = 1; msg ("[RLC_UM][MOD %d][RB %d][FRAME %05d] RX PDU GENERATE ERROR", rlcP->module_id, rlcP->rb_id, mac_xface->frame); } #endif if (!(((struct mac_tb_ind *) (tb->data))->error_indication)) { first_byte = ((struct mac_tb_ind *) (tb->data))->data_ptr; tb_size_in_bytes = ((struct mac_tb_ind *) (tb->data))->size; if (tb_size_in_bytes > 0) { rlc_um_receive_process_dar (rlcP, tb, first_byte, tb_size_in_bytes); msg ("[RLC_UM][MOD %d][RB %d][FRAME %05d] VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d\n", rlcP->module_id, rlcP->rb_id, mac_xface->frame, rlcP->vr_ur, rlcP->vr_ux, rlcP->vr_uh); } } else { #ifdef DEBUG_RLC_STATS rlcP->rx_pdus_in_error += 1; #endif #ifdef DEBUG_RLC_UM_RX msg ("[RLC_UM][MOD %d][RB %d][FRAME %05d] RX PDU WITH ERROR INDICATED BY LOWER LAYERS -> GARBAGE\n", rlcP->module_id, rlcP->rb_id, mac_xface->frame); #endif } free_mem_block (tb); } // end while }