Commit d02ee6cf authored by Fabrice Nabet's avatar Fabrice Nabet

Merge branch '14-3gpp-alignement-l2' into 'develop1B'

UE L2 changes for 3GPP alignement

Closes #14

See merge request !3
parents 4e0e0191 a5210e4f
...@@ -151,7 +151,7 @@ unsigned char *parse_header(unsigned char *mac_header, ...@@ -151,7 +151,7 @@ unsigned char *parse_header(unsigned char *mac_header,
unsigned short tb_length) unsigned short tb_length)
{ {
unsigned char not_done=1,num_ces=0,num_sdus=0,lcid, num_sdu_cnt; unsigned char not_done=1,num_ces=0,num_cont_res = 0,num_padding = 0,num_sdus=0,lcid, num_sdu_cnt;
unsigned char *mac_header_ptr = mac_header; unsigned char *mac_header_ptr = mac_header;
unsigned short length,ce_len=0; unsigned short length,ce_len=0;
...@@ -165,6 +165,14 @@ unsigned char *parse_header(unsigned char *mac_header, ...@@ -165,6 +165,14 @@ unsigned char *parse_header(unsigned char *mac_header,
lcid = ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID; lcid = ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID;
if (lcid < UE_CONT_RES) { if (lcid < UE_CONT_RES) {
//FNA: Contention Resolution check according to Annex B of 36.321
// if this is for CCCH then a Contention Resolution must have been parsed before
if ((lcid == 0) && (num_cont_res == 0)) {
LOG_W(MAC,"[UE] Msg4 Wrong received format: CCCH received without Contention Resolution before\n");
// exit parsing
return NULL;
}
//printf("[MAC][UE] header %x.%x.%x\n",mac_header_ptr[0],mac_header_ptr[1],mac_header_ptr[2]); //printf("[MAC][UE] header %x.%x.%x\n",mac_header_ptr[0],mac_header_ptr[1],mac_header_ptr[2]);
if (not_done==0) {// last MAC SDU, length is implicit if (not_done==0) {// last MAC SDU, length is implicit
mac_header_ptr++; mac_header_ptr++;
...@@ -196,6 +204,7 @@ unsigned char *parse_header(unsigned char *mac_header, ...@@ -196,6 +204,7 @@ unsigned char *parse_header(unsigned char *mac_header,
num_sdus++; num_sdus++;
} else { // This is a control element subheader } else { // This is a control element subheader
if (lcid == SHORT_PADDING) { if (lcid == SHORT_PADDING) {
num_padding ++;
mac_header_ptr++; mac_header_ptr++;
} else { } else {
rx_ces[num_ces] = lcid; rx_ces[num_ces] = lcid;
...@@ -205,6 +214,23 @@ unsigned char *parse_header(unsigned char *mac_header, ...@@ -205,6 +214,23 @@ unsigned char *parse_header(unsigned char *mac_header,
if (lcid==TIMING_ADV_CMD) { if (lcid==TIMING_ADV_CMD) {
ce_len++; ce_len++;
} else if (lcid==UE_CONT_RES) { } else if (lcid==UE_CONT_RES) {
// FNA: check MAC Header is one of thoses defined in Annex B of 36.321
// Check there is only 1 Contention Resolution
if (num_cont_res) {
LOG_W(MAC,"[UE] Msg4 Wrong received format: More than 1 Contention Resolution\n");
// exit parsing
return NULL;
}
// UE_CONT_RES shall never be the last subheader unless this is the only MAC subheader
if ((not_done == 0) && ((num_sdus) || (num_ces > 1) || (num_padding))) {
LOG_W(MAC,"[UE] Msg4 Wrong received format: Contention Resolution after num_ces=%d num_sdus=%d num_padding=%d\n",num_ces,num_sdus,num_padding);
// exit parsing
return NULL;
}
num_cont_res ++;
ce_len+=6; ce_len+=6;
} }
} }
...@@ -343,6 +369,8 @@ ue_send_sdu(module_id_t module_idP, ...@@ -343,6 +369,8 @@ ue_send_sdu(module_id_t module_idP,
LOG_T(MAC,"\n"); LOG_T(MAC,"\n");
#endif #endif
if (payload_ptr != NULL) {
for (i=0; i<num_ce; i++) { for (i=0; i<num_ce; i++) {
// printf("ce %d : %d\n",i,rx_ces[i]); // printf("ce %d : %d\n",i,rx_ces[i]);
switch (rx_ces[i]) { switch (rx_ces[i]) {
...@@ -467,6 +495,7 @@ ue_send_sdu(module_id_t module_idP, ...@@ -467,6 +495,7 @@ ue_send_sdu(module_id_t module_idP,
} }
payload_ptr+= rx_lengths[i]; payload_ptr+= rx_lengths[i];
} }
} // end if (payload_ptr != NULL)
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_OUT);
stop_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu); stop_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu);
......
...@@ -420,8 +420,9 @@ rlc_am_receive_process_data_pdu ( ...@@ -420,8 +420,9 @@ rlc_am_receive_process_data_pdu (
rlc_am_rx_list_reassemble_rlc_sdus(ctxt_pP, rlc_pP); rlc_am_rx_list_reassemble_rlc_sdus(ctxt_pP, rlc_pP);
} }
//FNA: fix check VrX out of receiving window
if (rlc_pP->t_reordering.running) { if (rlc_pP->t_reordering.running) {
if ((rlc_pP->vr_x == rlc_pP->vr_r) || ((rlc_am_in_rx_window(ctxt_pP, rlc_pP, pdu_info_p->sn) == 0) && (rlc_pP->vr_x != rlc_pP->vr_mr))) { if ((rlc_pP->vr_x == rlc_pP->vr_r) || ((rlc_am_in_rx_window(ctxt_pP, rlc_pP, rlc_pP->vr_x) == 0) && (rlc_pP->vr_x != rlc_pP->vr_mr))) {
rlc_am_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP); rlc_am_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP);
} }
} }
......
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