Commit fc08fd10 authored by Nick Ho's avatar Nick Ho

Fix the Security mode command, 100% get successfully attached

parent 83d74b40
...@@ -1574,7 +1574,7 @@ break; ...@@ -1574,7 +1574,7 @@ break;
unsigned char auth_rsp[5] = {0x30, 0x0b, 0x07, 0x53, 0x08}; unsigned char auth_rsp[5] = {0x30, 0x0b, 0x07, 0x53, 0x08};
unsigned char attach_complete[8] = {0x01, 0x07, 0x43, 0x00, 0x03, 0x52, 0x00, 0xc2}; unsigned char attach_complete[8] = {0x01, 0x07, 0x43, 0x00, 0x03, 0x52, 0x00, 0xc2};
unsigned char security_complte[3] = {0x00, 0x07, 0x5e}; unsigned char security_complte[3] = {0x30, 0x08, 0x47};
int cnt = 0; int cnt = 0;
int correct_bit = 0; int correct_bit = 0;
int correct_bit_attach = 0; int correct_bit_attach = 0;
...@@ -1599,7 +1599,7 @@ break; ...@@ -1599,7 +1599,7 @@ break;
} }
for (cnt=0; cnt <3; cnt++) for (cnt=0; cnt <3; cnt++)
{ {
if(security_complte[cnt] == decoded_bytes[cnt+14]) if(security_complte[cnt] == decoded_bytes[cnt+5])
{ {
//printf("correct_bit_security++\n"); //printf("correct_bit_security++\n");
correct_bit_security++; correct_bit_security++;
...@@ -1834,50 +1834,11 @@ break; ...@@ -1834,50 +1834,11 @@ break;
if (crc == oldcrc) if (crc == oldcrc)
{ {
decoded_bytes[17] = 0x00;
return iteration_cnt; return iteration_cnt;
} }
// Add 1st byte for 00001000 (0x08) // Add 1st byte for 00001000 (0x08)
decoded_bytes[11] = decoded_bytes[11] + 0x08; decoded_bytes[14] = decoded_bytes[14] + 0x08;
//oldcrc&=0x00ffffff;
crc = 0;
crc = crc24a(&decoded_bytes[F>>3],
n-24-F)>>8;
temp=((uint8_t *)&crc)[2];
((uint8_t *)&crc)[2] = ((uint8_t *)&crc)[0];
((uint8_t *)&crc)[0] = temp;
//printf("oldcrc %x, crc %x\n",oldcrc,crc);
if (crc == oldcrc)
{
decoded_bytes[17] = 0x00;
return iteration_cnt;
}
decoded_bytes[11] = decoded_bytes[11] - 0x08;
// Add 1st byte for 00001000 (0x08)
//padding = decoded_bytes[17];
decoded_bytes[17] = decoded_bytes[17] + 0x08;
//oldcrc&=0x00ffffff;
crc = 0;
crc = crc24a(&decoded_bytes[F>>3],
n-24-F)>>8;
temp=((uint8_t *)&crc)[2];
((uint8_t *)&crc)[2] = ((uint8_t *)&crc)[0];
((uint8_t *)&crc)[0] = temp;
//printf("oldcrc %x, crc %x\n",oldcrc,crc);
if (crc == oldcrc)
{
decoded_bytes[17] = 0x00;
return iteration_cnt;
}
decoded_bytes[17] = decoded_bytes[17] - 0x08;
// Add 1st byte for 00001000 (0x08)
decoded_bytes[11] = decoded_bytes[11] + 0x08;
decoded_bytes[17] = decoded_bytes[17] + 0x08;
//oldcrc&=0x00ffffff; //oldcrc&=0x00ffffff;
crc = 0; crc = 0;
crc = crc24a(&decoded_bytes[F>>3], crc = crc24a(&decoded_bytes[F>>3],
...@@ -1889,11 +1850,9 @@ break; ...@@ -1889,11 +1850,9 @@ break;
if (crc == oldcrc) if (crc == oldcrc)
{ {
//decoded_bytes[17] = 0x00;
return iteration_cnt; return iteration_cnt;
} }
decoded_bytes[17] = decoded_bytes[17] - 0x08; decoded_bytes[14] = decoded_bytes[14] - 0x08;
decoded_bytes[11] = decoded_bytes[11] - 0x08;
} }
break; break;
......
...@@ -1680,31 +1680,10 @@ uint32_t turbo_decoding_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1680,31 +1680,10 @@ uint32_t turbo_decoding_NB_IoT(PHY_VARS_eNB *eNB,
printf("%02x ",ulsch_harq->b[x]); printf("%02x ",ulsch_harq->b[x]);
printf("\n"); printf("\n");
if (ulsch_harq->b[14] == 0x00 && ulsch_harq->b[15] == 0x07 && ulsch_harq->b[16] == 0x5e)
{
printf("Try to recovery Security mode complete, show the 11 th byte : %02x \n",ulsch_harq->b[11]);
//ulsch_harq->b[11] = ulsch_harq->b[11] + 0x08;
ulsch_harq->b[17] = 0x00;
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1); // indicate ACK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,1);
}else if (ulsch_harq->b[7] == 0x30 && ulsch_harq->b[8] == 0x03 && ulsch_harq->b[9] == 0x07 && ulsch_harq->b[10] == 0x5f)
{
printf("Try to recovery Security mode reject, show the 11 th byte : %02x \n",ulsch_harq->b[11]);
ulsch_harq->b[11] = ulsch_harq->b[11] + 0x08;
ulsch_harq->b[12] = 0x00;
ulsch_harq->b[13] = 0x00;
ulsch_harq->b[14] = 0x00;
ulsch_harq->b[15] = 0x00;
ulsch_harq->b[16] = 0x00;
ulsch_harq->b[17] = 0x00;
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1); // indicate ACK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,1);
}else
{
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0); // indicate NAK to MAC fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0); // indicate NAK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,0); fill_rx_indication_NB_IoT(eNB,proc,npusch_format,0);
printf(" NPUSCH NOT OK\n"); printf(" NPUSCH NOT OK\n");
}
} }
} //////////// r loop end //////////// } //////////// r loop end ////////////
......
...@@ -100,6 +100,9 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -100,6 +100,9 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
mcs = mapped_mcs[UE_info->CE_level][mappedMcsIndex]; mcs = mapped_mcs[UE_info->CE_level][mappedMcsIndex];
if (UE_info->ul_total_buffer == 10)
mcs = 8;
if (UE_info->ul_total_buffer == 31) if (UE_info->ul_total_buffer == 31)
mcs = 8; mcs = 8;
...@@ -442,7 +445,7 @@ void fill_DCI_N0(DCIFormatN0_t *DCI_N0, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT ...@@ -442,7 +445,7 @@ void fill_DCI_N0(DCIFormatN0_t *DCI_N0, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT
DCI_N0->ndi = UE_sched_ctrl_info->dci_n0_index_ndi; DCI_N0->ndi = UE_sched_ctrl_info->dci_n0_index_ndi;
DCI_N0->Scheddly = UE_sched_ctrl_info->dci_n0_index_delay; DCI_N0->Scheddly = UE_sched_ctrl_info->dci_n0_index_delay;
DCI_N0->RepNum = UE_sched_ctrl_info->dci_n0_index_R_data; DCI_N0->RepNum = UE_sched_ctrl_info->dci_n0_index_R_data;
DCI_N0->rv = (UE_info->HARQ_round%2==0)?0:1; // rv will loop 0 & 2 DCI_N0->rv = 0; // rv will loop 0 & 2
DCI_N0->DCIRep = get_DCI_REP(UE_sched_ctrl_info->R_dci,UE_info->R_max); DCI_N0->DCIRep = get_DCI_REP(UE_sched_ctrl_info->R_dci,UE_info->R_max);
//DCI_N0->DCIRep = UE_sched_ctrl_info->dci_n0_index_R_dci; //DCI_N0->DCIRep = UE_sched_ctrl_info->dci_n0_index_R_dci;
LOG_I(MAC,"[fill_DCI_N0] Type %d scind %d I_ru %d I_mcs %d ndi %d I_delay %d I_rep %d RV %d I_dci %d\n", DCI_N0->type, DCI_N0->scind, DCI_N0->ResAssign, DCI_N0->mcs, DCI_N0->ndi, DCI_N0->Scheddly, DCI_N0->RepNum, DCI_N0->rv, DCI_N0->DCIRep); LOG_I(MAC,"[fill_DCI_N0] Type %d scind %d I_ru %d I_mcs %d ndi %d I_delay %d I_rep %d RV %d I_dci %d\n", DCI_N0->type, DCI_N0->scind, DCI_N0->ResAssign, DCI_N0->mcs, DCI_N0->ndi, DCI_N0->Scheddly, DCI_N0->RepNum, DCI_N0->rv, DCI_N0->DCIRep);
......
...@@ -245,11 +245,11 @@ int s1ap_eNB_handle_nas_first_req( ...@@ -245,11 +245,11 @@ int s1ap_eNB_handle_nas_first_req(
if (buffer[45] == 0xd1) if (buffer[45] == 0xd1)
{ {
printf("We don't have the ESM information procedure now, so try to recovery it \n"); printf("[1st]We don't have the ESM information procedure now, so try to recovery it \n");
buffer[45] = 0xd0; buffer[45] = 0xd0;
}else if (buffer[48] == 0xd1) }else if (buffer[48] == 0xd1)
{ {
printf("We don't have the ESM information procedure now, so try to recovery it \n"); printf("[2nd]We don't have the ESM information procedure now, so try to recovery it \n");
buffer[48] = 0xd0; buffer[48] = 0xd0;
} }
......
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