Commit d93a2c43 authored by Anton Kozhemiachenko's avatar Anton Kozhemiachenko Committed by Jerome PERALDI

NR Paging support

- Add nrUE support (basic) for Paging
parent c66d3d14
...@@ -220,6 +220,7 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot) ...@@ -220,6 +220,7 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot)
int dl_tti_sfn_slot = NFAPI_SFNSLOT2HEX(dl_tti_request->SFN, dl_tti_request->Slot); int dl_tti_sfn_slot = NFAPI_SFNSLOT2HEX(dl_tti_request->SFN, dl_tti_request->Slot);
LOG_A(NR_MAC, "[%d %d] sfn/slot dl_tti_request received \n", LOG_A(NR_MAC, "[%d %d] sfn/slot dl_tti_request received \n",
NFAPI_SFNSLOT2SFN(dl_tti_sfn_slot), NFAPI_SFNSLOT2SLOT(dl_tti_sfn_slot)); NFAPI_SFNSLOT2SFN(dl_tti_sfn_slot), NFAPI_SFNSLOT2SLOT(dl_tti_sfn_slot));
LOG_E(NR_MAC, "@@@ BLABLA [%d %d] sfn/slot dl_tti_request received \n", NFAPI_SFNSLOT2SFN(dl_tti_sfn_slot), NFAPI_SFNSLOT2SLOT(dl_tti_sfn_slot)); //TODO:BLA
nfapi_nr_tx_data_request_t *tx_data_request = unqueue_matching(&nr_tx_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &dl_tti_sfn_slot); nfapi_nr_tx_data_request_t *tx_data_request = unqueue_matching(&nr_tx_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &dl_tti_sfn_slot);
if (!tx_data_request) { if (!tx_data_request) {
LOG_E(NR_MAC, "[%d %d] No corresponding tx_data_request for given dl_tti_request sfn/slot\n", LOG_E(NR_MAC, "[%d %d] No corresponding tx_data_request for given dl_tti_request sfn/slot\n",
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define FAPI_NR_DCI_IND 0x04 #define FAPI_NR_DCI_IND 0x04
#define FAPI_NR_RX_PDU_TYPE_RAR 0x05 #define FAPI_NR_RX_PDU_TYPE_RAR 0x05
#define FAPI_NR_CSIRS_IND 0x06 #define FAPI_NR_CSIRS_IND 0x06
#define FAPI_NR_RX_PDU_TYPE_PCH 0x07
#define FAPI_NR_SIBS_MASK_SIB1 0x1 #define FAPI_NR_SIBS_MASK_SIB1 0x1
......
...@@ -291,6 +291,8 @@ typedef struct { ...@@ -291,6 +291,8 @@ typedef struct {
bool index_has_sib[NR_MAX_HARQ_PROCESSES]; bool index_has_sib[NR_MAX_HARQ_PROCESSES];
bool expected_rar; bool expected_rar;
bool index_has_rar[NR_MAX_HARQ_PROCESSES]; bool index_has_rar[NR_MAX_HARQ_PROCESSES];
bool expected_paging;
bool index_has_paging[NR_MAX_HARQ_PROCESSES];
bool expected_dci; bool expected_dci;
bool index_has_dci[NR_MAX_HARQ_PROCESSES]; bool index_has_dci[NR_MAX_HARQ_PROCESSES];
emul_l1_harq_t harq[NR_MAX_HARQ_PROCESSES]; emul_l1_harq_t harq[NR_MAX_HARQ_PROCESSES];
......
...@@ -79,6 +79,14 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id, ...@@ -79,6 +79,14 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id,
uint8_t *pduP, uint8_t *pduP,
uint32_t pdu_len); uint32_t pdu_len);
int8_t nr_ue_decode_paging(module_id_t module_id,
int cc_id,
uint8_t gNB_index,
frame_t frame,
slot_t slot,
void *pduP,
uint32_t pdu_len);
/**\brief primitive from RRC layer to MAC layer to set if bearer exists for a logical channel. todo handle mac_LogicalChannelConfig /**\brief primitive from RRC layer to MAC layer to set if bearer exists for a logical channel. todo handle mac_LogicalChannelConfig
\param module_id module id \param module_id module id
\param cc_id component carrier id \param cc_id component carrier id
......
...@@ -409,6 +409,17 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id, ...@@ -409,6 +409,17 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id,
return 0; return 0;
} }
int8_t nr_ue_decode_paging(module_id_t module_id,
int cc_id,
uint8_t gNB_index,
frame_t frame,
slot_t slot,
void *pduP,
uint32_t pdu_len)
{
return nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, frame, slot, P_RNTI, PCCH, (uint8_t *) pduP, pdu_len);
}
// TODO: change to UE parameter, scs: 15KHz, slot duration: 1ms // TODO: change to UE parameter, scs: 15KHz, slot duration: 1ms
uint32_t get_ssb_frame(uint32_t test){ uint32_t get_ssb_frame(uint32_t test){
return test; return test;
...@@ -1005,7 +1016,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr ...@@ -1005,7 +1016,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
return -1; return -1;
} }
if(rnti != ra->ra_rnti && rnti != SI_RNTI) LOG_E(MAC, ">>> BLABLA [%d.%d] BEFORE ASSERT RNTI=%x!\n", frame, slot, rnti); //TODO:BLA
if(rnti != ra->ra_rnti && rnti != SI_RNTI && rnti != P_RNTI)
AssertFatal(1+dci->pdsch_to_harq_feedback_timing_indicator.val>=DURATION_RX_TO_TX,"PDSCH to HARQ feedback time (%d) cannot be less than DURATION_RX_TO_TX (%d).\n", AssertFatal(1+dci->pdsch_to_harq_feedback_timing_indicator.val>=DURATION_RX_TO_TX,"PDSCH to HARQ feedback time (%d) cannot be less than DURATION_RX_TO_TX (%d).\n",
1+dci->pdsch_to_harq_feedback_timing_indicator.val,DURATION_RX_TO_TX); 1+dci->pdsch_to_harq_feedback_timing_indicator.val,DURATION_RX_TO_TX);
...@@ -2763,7 +2775,8 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *u ...@@ -2763,7 +2775,8 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *u
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_IN);
LOG_D(MAC, "In %s [%d.%d] Handling DLSCH PDU...\n", __FUNCTION__, dl_info->frame, dl_info->slot); LOG_D(MAC, "In %s [%d.%d] Handling PDSCH PDU...\n", __FUNCTION__, dl_info->frame, dl_info->slot);
LOG_E(MAC, ">>> BLABLA In %s [%d.%d] Handling PDSCH PDU...\n", __FUNCTION__, dl_info->frame, dl_info->slot); //TODO:BLA
// Processing MAC PDU // Processing MAC PDU
// it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs // it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs
...@@ -2774,6 +2787,15 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *u ...@@ -2774,6 +2787,15 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *u
case FAPI_NR_RX_PDU_TYPE_RAR: case FAPI_NR_RX_PDU_TYPE_RAR:
nr_ue_process_rar(dl_info, ul_time_alignment, pdu_id); nr_ue_process_rar(dl_info, ul_time_alignment, pdu_id);
break; break;
case FAPI_NR_RX_PDU_TYPE_PCH:
nr_ue_decode_paging(dl_info->module_id,
dl_info->cc_id,
dl_info->gNB_index,
dl_info->frame,
dl_info->slot,
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.pdu,
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.pdu_length);
break;
default: default:
break; break;
} }
...@@ -3503,6 +3525,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, ...@@ -3503,6 +3525,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
} }
LOG_D(MAC, "In %s [%d.%d]: processing PDU %d (with length %d) of %d total number of PDUs...\n", __FUNCTION__, frameP, slot, pdu_id, pdu_len, dl_info->rx_ind->number_pdus); LOG_D(MAC, "In %s [%d.%d]: processing PDU %d (with length %d) of %d total number of PDUs...\n", __FUNCTION__, frameP, slot, pdu_id, pdu_len, dl_info->rx_ind->number_pdus);
LOG_E(MAC, ">>> BLABLA In %s [%d.%d]: processing PDU %d (with length %d) of %d total number of PDUs...\n", __FUNCTION__, frameP, slot, pdu_id, pdu_len, dl_info->rx_ind->number_pdus); //TODO:BLA
while (!done && pdu_len > 0){ while (!done && pdu_len > 0){
uint16_t mac_len = 0x0000; uint16_t mac_len = 0x0000;
...@@ -3510,6 +3533,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, ...@@ -3510,6 +3533,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID;
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len); LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len);
LOG_E(MAC, ">>> BLABLA [UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len); //TODO:BLA
bool ret; bool ret;
switch(rx_lcid){ switch(rx_lcid){
// MAC CE // MAC CE
......
...@@ -87,8 +87,10 @@ nr_pdcp_ue_t *nr_pdcp_manager_get_ue_ex(nr_pdcp_ue_manager_t *_m, int rnti) ...@@ -87,8 +87,10 @@ nr_pdcp_ue_t *nr_pdcp_manager_get_ue_ex(nr_pdcp_ue_manager_t *_m, int rnti)
} }
nr_pdcp_manager_lock(m); nr_pdcp_manager_lock(m);
LOG_E(PDCP, ">>>> BLABLABLA %s:%d:%s: CHECK RNTI count=%d rnti=%d \n", __FILE__, __LINE__, __FUNCTION__, m->ue_count, rnti); //TODO:BLA
for (i = 0; i < m->ue_count; i++) for (i = 0; i < m->ue_count; i++)
{ {
LOG_E(PDCP, ">>>> BLABLABLA %s:%d:%s: CHECK RNTI i=%d rnti=%d m->ue_list[i]->rntiMaybeUEid=%d \n", __FILE__, __LINE__, __FUNCTION__, i, rnti, m->ue_list[i]->rntiMaybeUEid); //TODO:BLA
if (m->ue_list[i]->rntiMaybeUEid == rnti) if (m->ue_list[i]->rntiMaybeUEid == rnti)
{ {
ret = m->ue_list[i]; ret = m->ue_list[i];
......
...@@ -372,6 +372,9 @@ static bool is_my_dci(NR_UE_MAC_INST_t *mac, nfapi_nr_dl_dci_pdu_t *received_pdu ...@@ -372,6 +372,9 @@ static bool is_my_dci(NR_UE_MAC_INST_t *mac, nfapi_nr_dl_dci_pdu_t *received_pdu
} }
if (get_softmodem_params()->sa) if (get_softmodem_params()->sa)
{ {
//TODO:BLA
if (received_pdu->RNTI == 0xFFFE)
return true;
if (received_pdu->RNTI != mac->crnti && mac->ra.ra_state == RA_SUCCEEDED) if (received_pdu->RNTI != mac->crnti && mac->ra.ra_state == RA_SUCCEEDED)
return false; return false;
if (received_pdu->RNTI != mac->ra.t_crnti && mac->ra.ra_state == WAIT_CONTENTION_RESOLUTION) if (received_pdu->RNTI != mac->ra.t_crnti && mac->ra.ra_state == WAIT_CONTENTION_RESOLUTION)
...@@ -391,6 +394,8 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ ...@@ -391,6 +394,8 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_
memset(mac->nr_ue_emul_l1.index_has_sib, 0, sizeof(mac->nr_ue_emul_l1.index_has_sib)); memset(mac->nr_ue_emul_l1.index_has_sib, 0, sizeof(mac->nr_ue_emul_l1.index_has_sib));
mac->nr_ue_emul_l1.expected_rar = false; mac->nr_ue_emul_l1.expected_rar = false;
memset(mac->nr_ue_emul_l1.index_has_rar, 0, sizeof(mac->nr_ue_emul_l1.index_has_rar)); memset(mac->nr_ue_emul_l1.index_has_rar, 0, sizeof(mac->nr_ue_emul_l1.index_has_rar));
mac->nr_ue_emul_l1.expected_paging = false;
memset(mac->nr_ue_emul_l1.index_has_paging, 0, sizeof(mac->nr_ue_emul_l1.index_has_paging));
mac->nr_ue_emul_l1.expected_dci = false; mac->nr_ue_emul_l1.expected_dci = false;
memset(mac->nr_ue_emul_l1.index_has_dci, 0, sizeof(mac->nr_ue_emul_l1.index_has_dci)); memset(mac->nr_ue_emul_l1.index_has_dci, 0, sizeof(mac->nr_ue_emul_l1.index_has_dci));
int pdu_idx = 0; int pdu_idx = 0;
...@@ -443,6 +448,13 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ ...@@ -443,6 +448,13 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_
mac->nr_ue_emul_l1.index_has_rar[j] = true; mac->nr_ue_emul_l1.index_has_rar[j] = true;
LOG_T(NR_MAC, "Setting index_has_rar[%d] = true\n", j); LOG_T(NR_MAC, "Setting index_has_rar[%d] = true\n", j);
} }
else if (dci_pdu_list->RNTI == 0xfffe)
{
mac->nr_ue_emul_l1.expected_paging = true;
mac->nr_ue_emul_l1.index_has_paging[j] = true;
LOG_T(NR_MAC, "Setting index_has_paging[%d] = true\n", j);
LOG_E(NR_PHY, ">>> BLABLABLA [%d, %d] PDSCH PDU for rnti %x -- %x !!!!! PAGING\n", dl_tti_request->SFN, dl_tti_request->Slot, pdu_list->pdsch_pdu.pdsch_pdu_rel15.rnti, dci_pdu_list->RNTI); //TODO:BLA
}
else else
{ {
mac->nr_ue_emul_l1.expected_dci = true; mac->nr_ue_emul_l1.expected_dci = true;
...@@ -490,6 +502,7 @@ static void fill_rx_ind(nfapi_nr_pdu_t *pdu_list, fapi_nr_rx_indication_t *rx_in ...@@ -490,6 +502,7 @@ static void fill_rx_ind(nfapi_nr_pdu_t *pdu_list, fapi_nr_rx_indication_t *rx_in
} }
LOG_D(NR_PHY, "%s: num_tlv %d and length %d, pdu index %d\n", LOG_D(NR_PHY, "%s: num_tlv %d and length %d, pdu index %d\n",
__FUNCTION__, pdu_list->num_TLV, length, pdu_idx); __FUNCTION__, pdu_list->num_TLV, length, pdu_idx);
LOG_E(NR_PHY, ">>> BLABLA %s: num_tlv %d and length %d, pdu index %d\n", __FUNCTION__, pdu_list->num_TLV, length, pdu_idx); //TODO:BLA
uint8_t *pdu = malloc(length); uint8_t *pdu = malloc(length);
AssertFatal(pdu != NULL, "%s: Out of memory in malloc", __FUNCTION__); AssertFatal(pdu != NULL, "%s: Out of memory in malloc", __FUNCTION__);
rx_ind->rx_indication_body[pdu_idx].pdsch_pdu.pdu = pdu; rx_ind->rx_indication_body[pdu_idx].pdsch_pdu.pdu = pdu;
...@@ -529,6 +542,7 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi ...@@ -529,6 +542,7 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
fapi_nr_rx_indication_t *rx_ind = dl_info->rx_ind; fapi_nr_rx_indication_t *rx_ind = dl_info->rx_ind;
rx_ind->sfn = tx_data_request->SFN; rx_ind->sfn = tx_data_request->SFN;
rx_ind->slot = tx_data_request->Slot; rx_ind->slot = tx_data_request->Slot;
LOG_E(NR_MAC, ">>> BLABLA copy_tx_data_req_to_dl_info [%d %d] num_pdus=%d\n", rx_ind->sfn, rx_ind->slot, num_pdus); //TODO:BLA
int pdu_idx = 0; int pdu_idx = 0;
...@@ -547,6 +561,12 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi ...@@ -547,6 +561,12 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_RAR); fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_RAR);
pdu_idx++; pdu_idx++;
} }
else if (mac->nr_ue_emul_l1.index_has_paging[i])
{
fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_PCH);
pdu_idx++;
LOG_E(NR_MAC, ">>> BLABLA copy_tx_data_req_to_dl_info [%d %d] num_pdus=%d !!! PAGING\n", rx_ind->sfn, rx_ind->slot, num_pdus); //TODO:BLA
}
else if (mac->nr_ue_emul_l1.index_has_dci[i]) else if (mac->nr_ue_emul_l1.index_has_dci[i])
{ {
fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_DLSCH); fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_DLSCH);
...@@ -555,6 +575,7 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi ...@@ -555,6 +575,7 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
else else
{ {
LOG_T(NR_MAC, "mac->nr_ue_emul_l1.index_has_dci[%d] = 0, so this index contained a DCI for a different UE\n", i); LOG_T(NR_MAC, "mac->nr_ue_emul_l1.index_has_dci[%d] = 0, so this index contained a DCI for a different UE\n", i);
LOG_E(NR_MAC, ">>> BLABLA mac->nr_ue_emul_l1.index_has_dci[%d] = 0, so this index contained a DCI for a different UE\n", i); //TODO:BLA
} }
} }
...@@ -749,6 +770,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, ...@@ -749,6 +770,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
if (tx_data_request) { if (tx_data_request) {
if (mac->nr_ue_emul_l1.expected_sib || if (mac->nr_ue_emul_l1.expected_sib ||
mac->nr_ue_emul_l1.expected_rar || mac->nr_ue_emul_l1.expected_rar ||
mac->nr_ue_emul_l1.expected_paging ||
mac->nr_ue_emul_l1.expected_dci) { mac->nr_ue_emul_l1.expected_dci) {
frame = tx_data_request->SFN; frame = tx_data_request->SFN;
slot = tx_data_request->Slot; slot = tx_data_request->Slot;
...@@ -758,6 +780,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, ...@@ -758,6 +780,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
} }
else { else {
LOG_D(NR_MAC, "Unexpected tx_data_req\n"); LOG_D(NR_MAC, "Unexpected tx_data_req\n");
LOG_E(NR_MAC, "!!! BLABLA Unexpected tx_data_req\n"); //TODO:BLA
} }
free_and_zero(tx_data_request); free_and_zero(tx_data_request);
} }
...@@ -864,6 +887,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea ...@@ -864,6 +887,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea
} }
LOG_D(NR_PHY, "Received an NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST message in sfn/slot %d %d. \n", LOG_D(NR_PHY, "Received an NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST message in sfn/slot %d %d. \n",
dl_tti_request->SFN, dl_tti_request->Slot); dl_tti_request->SFN, dl_tti_request->Slot);
LOG_E(NR_PHY, ">>> BLABLA Received an NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST message in sfn/slot %d %d. \n", dl_tti_request->SFN, dl_tti_request->Slot); //TODO:BLA
if (is_channel_modeling()) if (is_channel_modeling())
save_pdsch_pdu_for_crnti(dl_tti_request); save_pdsch_pdu_for_crnti(dl_tti_request);
...@@ -1184,6 +1208,23 @@ int8_t handle_csirs_measurements(module_id_t module_id, frame_t frame, int slot, ...@@ -1184,6 +1208,23 @@ int8_t handle_csirs_measurements(module_id_t module_id, frame_t frame, int slot,
return nr_ue_process_csirs_measurements(module_id, frame, slot, csirs_measurements); return nr_ue_process_csirs_measurements(module_id, frame, slot, csirs_measurements);
} }
int8_t handle_pch(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id){
/* L1 assigns harq_pid, but in emulated L1 mode we need to assign
the harq_pid based on the saved global g_harq_pid. Because we are
emulating L1, no antenna measurements are conducted to calculate
a harq_pid, therefore we must set it here. */
if (get_softmodem_params()->emulate_l1)
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid = g_harq_pid;
update_harq_status(dl_info->module_id,
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid,
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack);
if(dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack)
nr_ue_send_sdu(dl_info, ul_time_alignment, pdu_id);
return 0;
}
void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nack) { void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nack) {
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
...@@ -1289,7 +1330,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ ...@@ -1289,7 +1330,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
__FUNCTION__, __FUNCTION__,
dl_info->rx_ind->rx_indication_body[i].pdu_type, dl_info->rx_ind->rx_indication_body[i].pdu_type,
dl_info->rx_ind->number_pdus); dl_info->rx_ind->number_pdus);
LOG_E(NR_MAC, ">>BLABLABLA In %s sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs \n", __FUNCTION__, dl_info->rx_ind->rx_indication_body[i].pdu_type, dl_info->rx_ind->number_pdus); //TODO:BLA LOG_E(NR_MAC, ">>BLABLABLA In %s sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs --- frame=%d slot=%d \n", __FUNCTION__, dl_info->rx_ind->rx_indication_body[i].pdu_type, dl_info->rx_ind->number_pdus, dl_info->frame, dl_info->slot); //TODO:BLA
switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){ switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){
case FAPI_NR_RX_PDU_TYPE_SSB: case FAPI_NR_RX_PDU_TYPE_SSB:
...@@ -1324,7 +1365,11 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ ...@@ -1324,7 +1365,11 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
dl_info->slot, dl_info->slot,
&(dl_info->rx_ind->rx_indication_body+i)->csirs_measurements)) << FAPI_NR_CSIRS_IND; &(dl_info->rx_ind->rx_indication_body+i)->csirs_measurements)) << FAPI_NR_CSIRS_IND;
break; break;
case FAPI_NR_RX_PDU_TYPE_PCH:
ret_mask |= (handle_pch(dl_info, ul_time_alignment, i)) << FAPI_NR_RX_PDU_TYPE_RAR;
break;
default: default:
LOG_E(NR_MAC, ">>BLABLABLA NO SWITCH !!! In %s sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs --- frame=%d slot=%d \n", __FUNCTION__, dl_info->rx_ind->rx_indication_body[i].pdu_type, dl_info->rx_ind->number_pdus, dl_info->frame, dl_info->slot); //TODO:BLA
break; break;
} }
} }
......
...@@ -1966,7 +1966,7 @@ int16_t do_RRCReconfiguration( ...@@ -1966,7 +1966,7 @@ int16_t do_RRCReconfiguration(
} }
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, uint8_t *rv) { uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, uint8_t *rv, NR_EstablishmentCause_t establishmentCause) {
asn_enc_rval_t enc_rval; asn_enc_rval_t enc_rval;
uint8_t buf[5],buf2=0; uint8_t buf[5],buf2=0;
NR_UL_CCCH_Message_t ul_ccch_msg; NR_UL_CCCH_Message_t ul_ccch_msg;
...@@ -1997,7 +1997,7 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, ...@@ -1997,7 +1997,7 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.ng_5G_S_TMSI_Part1.buf[0] = 0x12; rrcSetupRequest->rrcSetupRequest.ue_Identity.choice.ng_5G_S_TMSI_Part1.buf[0] = 0x12;
} }
rrcSetupRequest->rrcSetupRequest.establishmentCause = NR_EstablishmentCause_mo_Signalling; //EstablishmentCause_mo_Data; rrcSetupRequest->rrcSetupRequest.establishmentCause = establishmentCause;
rrcSetupRequest->rrcSetupRequest.spare.buf = &buf2; rrcSetupRequest->rrcSetupRequest.spare.buf = &buf2;
rrcSetupRequest->rrcSetupRequest.spare.size=1; rrcSetupRequest->rrcSetupRequest.spare.size=1;
rrcSetupRequest->rrcSetupRequest.spare.bits_unused = 7; rrcSetupRequest->rrcSetupRequest.spare.bits_unused = 7;
...@@ -2011,6 +2011,8 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, ...@@ -2011,6 +2011,8 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size,
(void *)&ul_ccch_msg, (void *)&ul_ccch_msg,
buffer, buffer,
buffer_size); buffer_size);
LOG_E(NR_RRC,"!!! BLABLABLA [UE] RRCSetupRequest Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); //TODO:BLA
xer_fprint(stdout, &asn_DEF_NR_UL_CCCH_Message, (void *)&ul_ccch_msg); //TODO:BLA
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(NR_RRC,"[UE] RRCSetupRequest Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); LOG_D(NR_RRC,"[UE] RRCSetupRequest Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
......
...@@ -155,7 +155,7 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, ...@@ -155,7 +155,7 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id,
const int dedicatedInfoNASLength, const int dedicatedInfoNASLength,
const char *dedicatedInfoNAS); const char *dedicatedInfoNAS);
uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, uint8_t *rv); uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, uint8_t *rv, NR_EstablishmentCause_t establishmentCause);
uint8_t do_NR_RRCReconfigurationComplete_for_nsa(uint8_t *buffer, size_t buffer_size, NR_RRC_TransactionIdentifier_t Transaction_id); uint8_t do_NR_RRCReconfigurationComplete_for_nsa(uint8_t *buffer, size_t buffer_size, NR_RRC_TransactionIdentifier_t Transaction_id);
......
...@@ -108,6 +108,12 @@ nr_mac_rrc_data_ind_ue( ...@@ -108,6 +108,12 @@ nr_mac_rrc_data_ind_ue(
} }
break; break;
case PCCH:
LOG_T(NR_RRC, "[UE %d] Received SDU for PCCH from gNB %d, pdu_len=%d\n", module_id, gNB_index, pdu_len);
LOG_E(NR_RRC, "^^^^^^^^^^ BLABLABLA [UE %d] Received SDU for PCCH from gNB %d, pdu_len=%d\n", module_id, gNB_index, pdu_len); //TODO:BLA
AssertFatal(nr_rrc_ue_decode_NR_PCCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode PCCH error!\n");
break;
default: default:
LOG_E(NR_RRC, "^^^^ BLABLABLA invalid CHANNEL %x rnti %x pdu_len=%d!!!!!", channel, rnti, pdu_len); //TODO:BLA LOG_E(NR_RRC, "^^^^ BLABLABLA invalid CHANNEL %x rnti %x pdu_len=%d!!!!!", channel, rnti, pdu_len); //TODO:BLA
break; break;
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "NR_RRCReconfiguration.h" #include "NR_RRCReconfiguration.h"
#include "NR_MeasConfig.h" #include "NR_MeasConfig.h"
#include "NR_UL-DCCH-Message.h" #include "NR_UL-DCCH-Message.h"
#include "NR_PCCH-Message.h"
#include "rrc_list.h" #include "rrc_list.h"
#include "rrc_defs.h" #include "rrc_defs.h"
...@@ -61,6 +62,7 @@ ...@@ -61,6 +62,7 @@
#include "UTIL/OSA/osa_defs.h" #include "UTIL/OSA/osa_defs.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/vcd_signal_dumper.h"
#include "conversions.h"
#ifndef CELLULAR #ifndef CELLULAR
#include "RRC/NR/MESSAGES/asn1_msg.h" #include "RRC/NR/MESSAGES/asn1_msg.h"
...@@ -601,6 +603,94 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const u ...@@ -601,6 +603,94 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const u
return ret; return ret;
} }
static inline uint64_t bitStr_to_uint64(BIT_STRING_t *asn) {
uint64_t result = 0;
int index;
int shift;
DevCheck ((asn->size > 0) && (asn->size <= 8), asn->size, 0, 0);
shift = ((asn->size - 1) * 8) - asn->bits_unused;
for (index = 0; index < (asn->size - 1); index++) {
result |= (uint64_t)asn->buf[index] << shift;
shift -= 8;
}
result |= asn->buf[index] >> asn->bits_unused;
return result;
}
// TODO: temporary, to support paging from TTCN
static void nr_ue_check_paging(const module_id_t module_id, const uint8_t gNB_index, NR_PCCH_Message_t *pcch)
{
const uint64_t tsc_NG_TMSI1 = 0x41c2345678;
const uint64_t tsc_NR_I_RNTI_Value1 = 0x84f3184d01;
bool found = false;
NR_PagingRecordList_t *record = pcch->message.choice.c1->choice.paging->pagingRecordList;
int num = record->list.count;
for (int i = 0; i < num; i++) {
NR_PagingRecord_t *rec = record->list.array[i];
if (rec->ue_Identity.present == NR_PagingUE_Identity_PR_ng_5G_S_TMSI) {
uint64_t tmsi = bitStr_to_uint64(&rec->ue_Identity.choice.ng_5G_S_TMSI);
LOG_E(NR_RRC, "!!!!!!!! BLABLABLA %s: CHECK TMSI in PCCH: %lx == %lx\n", __FUNCTION__, tmsi, tsc_NG_TMSI1); //TODO:BLA
if (tmsi == tsc_NG_TMSI1) {
found = true;
break;
}
} else if (rec->ue_Identity.present == NR_PagingUE_Identity_PR_fullI_RNTI) {
uint64_t rnti = bitStr_to_uint64(&rec->ue_Identity.choice.fullI_RNTI);
LOG_E(NR_RRC, "!!!!!!!! BLABLABLA %s: CHECK RNTI in PCCH: %lx == %lx\n", __FUNCTION__, rnti, tsc_NR_I_RNTI_Value1); //TODO:BLA
if (rnti == tsc_NR_I_RNTI_Value1) {
found = true;
break;
}
} else {
abort();
}
}
if (found) {
LOG_D(NR_RRC, "%s: found ue_Identity in PCCH\n", __FUNCTION__);
LOG_E(NR_RRC, "!!!!!!!! BLABLABLA %s: found ue_Identity in PCCH\n", __FUNCTION__); //TODO:BLA
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
mac->ra.ra_state = RA_UE_IDLE;
}
}
/*brief decode NR PCCH (Paging) message*/
int8_t nr_rrc_ue_decode_NR_PCCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const buffer, const uint16_t size)
{
NR_PCCH_Message_t *pcch_message = NULL;
asn_dec_rval_t dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_PCCH_Message, (void **)&pcch_message, (const void *)buffer, size);
int ret;
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) {
LOG_E(NR_RRC, "NR_PCCH decode error\n");
ret = -1;
} else {
ret = 0;
LOG_D(NR_RRC, "[gNB %d] nr_rrc_ue_decode_NR_PCCH_Message: decoded PCCH Message\n", module_id);
LOG_E(NR_RRC, ">>> BLABLABLA [gNB %d] nr_rrc_ue_decode_NR_PCCH_Message: decoded PCCH Message\n", module_id); //TODO:BLA
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_PCCH_Message, pcch_message);
}
xer_fprint(stdout, &asn_DEF_NR_PCCH_Message, pcch_message); //TODO:BLA
nr_ue_check_paging(module_id, gNB_index, pcch_message);
}
ASN_STRUCT_FREE(asn_DEF_NR_PCCH_Message, pcch_message);
return ret;
}
const char *nr_SIBreserved( long value ) { const char *nr_SIBreserved( long value ) {
if (value < 0 || value > 1) if (value < 0 || value > 1)
return "ERR"; return "ERR";
...@@ -1717,6 +1807,9 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB ...@@ -1717,6 +1807,9 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
uint8_t i=0,rv[6]; uint8_t i=0,rv[6];
if(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) { if(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) {
nr_rrc_ue_RRCSetupRequest_count++;
LOG_E(NR_RRC,"!!!! BLABLABLA Generating RRCSetupRequest\n"); //TODO:BLA
// Get RRCConnectionRequest, fill random for now // Get RRCConnectionRequest, fill random for now
// Generate random byte stream for contention resolution // Generate random byte stream for contention resolution
for (i=0; i<6; i++) { for (i=0; i<6; i++) {
...@@ -1729,13 +1822,19 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB ...@@ -1729,13 +1822,19 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
LOG_T(NR_RRC,"%x.",rv[i]); LOG_T(NR_RRC,"%x.",rv[i]);
} }
NR_EstablishmentCause_t establishmentCause = NR_EstablishmentCause_mo_Signalling;
if (nr_rrc_ue_RRCSetupRequest_count > 1) {
establishmentCause = NR_EstablishmentCause_mt_Access;
}
LOG_T(NR_RRC,"\n"); LOG_T(NR_RRC,"\n");
NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size = NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size =
do_RRCSetupRequest( do_RRCSetupRequest(
module_id, module_id,
(uint8_t *)NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload, (uint8_t *)NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload,
sizeof(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload), sizeof(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload),
rv); rv, establishmentCause);
LOG_I(NR_RRC,"[UE %d] : Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, gNB %d)\n", LOG_I(NR_RRC,"[UE %d] : Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, gNB %d)\n",
module_id, NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index); module_id, NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index);
...@@ -1749,8 +1848,6 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB ...@@ -1749,8 +1848,6 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB
//printf("\n"); //printf("\n");
/*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff; /*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff;
UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */ UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */
nr_rrc_ue_RRCSetupRequest_count++;
} }
} }
...@@ -2283,14 +2380,13 @@ nr_rrc_ue_establish_srb2( ...@@ -2283,14 +2380,13 @@ nr_rrc_ue_establish_srb2(
} }
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p); itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
break; //TODO: BLA
/* simulate power OFF, to be able to send RRCSetupRequest to TTCN again */ /* simulate power OFF, to be able to send RRCSetupRequest to TTCN again */
LOG_W(NR_RRC, "todo, sleep before removing UE\n"); LOG_W(NR_RRC, "todo, sleep before removing UE\n");
sleep(3); sleep(3);
NR_UE_MAC_INST_t *mac = get_mac_inst(ctxt_pP->module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(ctxt_pP->module_id);
mac->ra.ra_state = RA_UE_IDLE; /* mac->ra.ra_state = RA_UE_IDLE; */
nr_rrc_set_state( ctxt_pP->module_id, RRC_STATE_IDLE_NR ); nr_rrc_set_state( ctxt_pP->module_id, RRC_STATE_IDLE_NR );
nr_rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_NR ); nr_rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_NR );
......
...@@ -114,6 +114,13 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(const module_id_t module_id, cons ...@@ -114,6 +114,13 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(const module_id_t module_id, cons
\param size length of buffer*/ \param size length of buffer*/
int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const uint8_t gNB_index, const uint8_t *buffer, const uint32_t size); int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const uint8_t gNB_index, const uint8_t *buffer, const uint32_t size);
/**\brief decode NR PCCH (Paging) message
\param module_id module id
\param gNB_index gNB index
\param buffer pointer to buffer of ASN message PCCH-PCH
\param size length of buffer*/
int8_t nr_rrc_ue_decode_NR_PCCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const buffer, const uint16_t size);
/**\brief interface between MAC and RRC thru SRB0 (RLC TM/no PDCP) /**\brief interface between MAC and RRC thru SRB0 (RLC TM/no PDCP)
\param module_id module id \param module_id module id
\param CC_id component carrier id \param CC_id component carrier id
......
...@@ -1508,6 +1508,21 @@ bool ss_task_sys_nr_handle_pdcpCount(struct NR_SYSTEM_CTRL_REQ *req) ...@@ -1508,6 +1508,21 @@ bool ss_task_sys_nr_handle_pdcpCount(struct NR_SYSTEM_CTRL_REQ *req)
if (ue == NULL) if (ue == NULL)
{ {
LOG_E(GNB_APP, "could not found suitable UE with rnti: %d\r\n", rnti); LOG_E(GNB_APP, "could not found suitable UE with rnti: %d\r\n", rnti);
// TODO: FIX
PdcpCount.v.Get.d = 1;
const size_t size = sizeof(struct NR_PdcpCountInfo_Type) * PdcpCount.v.Get.d;
PdcpCount.v.Get.v = (struct NR_PdcpCountInfo_Type *)acpMalloc(size);
PdcpCount.v.Get.v[0].RadioBearerId.d = NR_RadioBearerId_Type_Srb;
PdcpCount.v.Get.v[0].RadioBearerId.v.Srb = 0;
PdcpCount.v.Get.v[0].UL.d = true;
PdcpCount.v.Get.v[0].DL.d = true;
PdcpCount.v.Get.v[0].UL.v.Format = NR_PdcpCount_Srb;
PdcpCount.v.Get.v[0].DL.v.Format = NR_PdcpCount_Srb;
int_to_bin(0, 32, PdcpCount.v.Get.v[0].UL.v.Value);
int_to_bin(0, 32, PdcpCount.v.Get.v[0].DL.v.Value);
send_sys_cnf(ConfirmationResult_Type_Success, true, NR_SystemConfirm_Type_PdcpCount, (void *)&PdcpCount);
return false; return false;
} }
......
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