Commit 907b4f80 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

[RRC] support SIB18 (partially)

parents 77072adf c64f9cd8
......@@ -1831,8 +1831,10 @@ static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePacked
{
nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0)
if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0){
printf("Panos-D: pack_crc_indication_body_value 0 \n");
return 0;
}
uint16_t i = 0;
uint16_t total_number_of_pdus = value->number_of_crcs;
......@@ -1841,12 +1843,16 @@ static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePacked
nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
uint8_t* instance_length_p = *ppWritePackedMsg;
if(!push16(pdu->instance_length, ppWritePackedMsg, end))
if(!push16(pdu->instance_length, ppWritePackedMsg, end)){
printf("Panos-D: pack_crc_indication_body_value 1 \n");
return 0;
}
if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body)))
pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body))){
printf("Panos-D: pack_crc_indication_body_value 2 \n");
return 0;
}
// calculate the instance length subtracting the size of the instance
// length feild
......@@ -1887,8 +1893,10 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
//printf("RX ULSCH BODY\n");
if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0){
//printf("Panos-D: pack_rx_ulsch_indication_body_value 0 \n");
return 0;
}
// need to calculate the data offset's.
uint16_t i = 0;
......@@ -1939,9 +1947,11 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
pack_tlv(NFAPI_RX_INDICATION_REL8_TAG, &pdu->rx_indication_rel8, ppWritePackedMsg, end, pack_rx_indication_rel8_value) &&
pack_tlv(NFAPI_RX_INDICATION_REL9_TAG, &pdu->rx_indication_rel9, ppWritePackedMsg, end, pack_rx_indication_rel9_value)))
pack_tlv(NFAPI_RX_INDICATION_REL9_TAG, &pdu->rx_indication_rel9, ppWritePackedMsg, end, pack_rx_indication_rel9_value))) {
//printf("Panos-D: pack_rx_ulsch_indication_body_value() 1 about to return error because of failure in packing tlv tags \n");
return 0;
}
}
// Write out the pdu data
for(i = 0; i < total_number_of_pdus; ++i)
......@@ -1954,9 +1964,11 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
length = pdu->rx_indication_rel8.length;
}
if( pusharray8(value->rx_pdu_list[i].data, length, length, ppWritePackedMsg, end) == 0)
if( pusharray8(value->rx_pdu_list[i].data, length, length, ppWritePackedMsg, end) == 0){
printf("Panos-D: pack_rx_ulsch_indication_body_value() 2 about to return error \n");
return 0;
}
}
return 1;
}
......@@ -2624,6 +2636,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
if (pMessageBuf == NULL || pPackedBuf == NULL)
{
//printf("Panos-D: P7 Pack supplied pointers are null\n");
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
return -1;
}
......@@ -2636,6 +2649,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) &&
push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end)))
{
//printf("Panos-D: P7 Pack header failed\n");
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n");
return -1;
}
......@@ -2734,11 +2748,13 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
}
else
{
//printf("Panos-D: %s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id);
}
}
else
{
//printf("Panos-D: %s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
}
}
......@@ -2747,6 +2763,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
if(result == 0)
{
//printf( "Panos-D: P7 Pack failed to pack message\n");
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
return -1;
}
......@@ -2758,6 +2775,7 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
uint16_t packedMsgLen16;
if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
{
//printf("Panos-D: Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
return -1;
}
......@@ -2769,14 +2787,17 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
// Update the message length in the header
pMessageHeader->message_length = packedMsgLen16;
if(!push16(packedMsgLen16, &pPackedLengthField, end))
if(!push16(packedMsgLen16, &pPackedLengthField, end)){
printf("Panos-D: Pack function failed. Returning... \n");
return -1;
}
if(1)
{
//quick test
if(pMessageHeader->message_length != packedMsgLen)
{
printf("Panos-D: nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
}
}
......
......@@ -416,12 +416,14 @@ int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t len)
int sendto_result;
if ((sendto_result = sendto((int)pnf_p7->p7_sock, (const char*)msg, len, 0, (const struct sockaddr*)&remote_addr, remote_addr_len)) < 0)
{
printf("Panos-D: %s %s:%d sendto(%d, %p, %d) %d failed errno: %d\n", __FUNCTION__, pnf_p7->_public.remote_p7_addr, pnf_p7->_public.remote_p7_port, (int)pnf_p7->p7_sock, (const char*)msg, len, remote_addr_len, errno);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s %s:%d sendto(%d, %p, %d) %d failed errno: %d\n", __FUNCTION__, pnf_p7->_public.remote_p7_addr, pnf_p7->_public.remote_p7_port, (int)pnf_p7->p7_sock, (const char*)msg, len, remote_addr_len, errno);
return -1;
}
if(sendto_result != len)
{
printf("Panos-D: %s sendto failed to send the entire message %d %d\n", __FUNCTION__, sendto_result, len);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s sendto failed to send the entire message %d %d\n", __FUNCTION__, sendto_result, len);
}
return 0;
......@@ -434,6 +436,7 @@ int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t*
// Need to guard against different threads calling the encode function at the same time
if(pthread_mutex_lock(&(pnf_p7->pack_mutex)) != 0)
{
printf("Panos-D: failed to lock mutex 1\n");
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
return -1;
}
......@@ -444,10 +447,12 @@ int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t*
{
if(pthread_mutex_unlock(&(pnf_p7->pack_mutex)) != 0)
{
printf("Panos-D: failed to unlock mutex 2\n");
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
return -1;
}
printf("Panos-D: nfapi_p7_message_pack failed with return %d\n", len);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p7_message_pack failed with return %d\n", len );
return -1;
}
......@@ -461,6 +466,7 @@ int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t*
int segment = 0;
int offset = NFAPI_P7_HEADER_LENGTH;
uint8_t buffer[pnf_p7->_public.segment_size];
printf("Panos-D: pnf_p7_pack_and_send_p7_message sending through multiple segments \n");
for(segment = 0; segment < segment_count; ++segment)
{
uint8_t last = 0;
......
......@@ -116,6 +116,7 @@ int nfapi_pnf_p7_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_crc_indication_t*
{
if(config == NULL || ind == NULL)
{
printf("Panos-D: %s: invalid input params\n", __FUNCTION__);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1;
}
......@@ -127,6 +128,7 @@ int nfapi_pnf_p7_rx_ind(nfapi_pnf_p7_config_t* config, nfapi_rx_indication_t* in
{
if(config == NULL || ind == NULL)
{
printf("Panos-D: %s: invalid input params\n", __FUNCTION__);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
return -1;
}
......
......@@ -356,6 +356,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
if (physicalConfigDedicated != NULL) {
if(nfapi_mode!=3)
phy_config_dedicated_ue(Mod_idP, 0, eNB_index,
physicalConfigDedicated);
UE_mac_inst[Mod_idP].physicalConfigDedicated = physicalConfigDedicated; // for SR proc
......
......@@ -486,6 +486,7 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
}
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer++;
//LOG_I(MAC, "Panos-D: check_ul_failure(), ul_failure_timer: %d \n", UE_list->UE_sched_ctrl[UE_id].ul_failure_timer);
// check threshold
if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 20000) {
// inform RRC of failure and clear timer
......
......@@ -670,6 +670,7 @@ rx_sdu(const module_id_t enb_mod_idP,
enb_mod_idP, CC_idP, frameP, rx_lengths[i], UE_id,
rx_lcids[i]);
LOG_I(MAC, "Panos-D: rx_sdu before mac_rlc_data_ind 1, frame:%d, subframe: %d \n", frameP, subframeP);
mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL); //(unsigned int*)crc_status);
UE_list->eNB_UE_stats[CC_idP][UE_id].
num_pdu_rx[rx_lcids[i]] += 1;
......@@ -728,6 +729,7 @@ rx_sdu(const module_id_t enb_mod_idP,
[rx_lcids[i]]] = 0;
if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX)
&& (rx_lengths[i] > 0)) { // MAX SIZE OF transport block
LOG_I(MAC, "Panos-D: rx_sdu before mac_rlc_data_ind 2 \n");
mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL); //(unsigned int*)crc_status);
UE_list->eNB_UE_stats[CC_idP][UE_id].
......
......@@ -480,6 +480,7 @@ ue_send_sdu(module_id_t module_idP,
if(nfapi_mode == 3) { // Panos: phy_stub mode
// Panos: Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to
// PRACH state.
LOG_I(MAC, "nfapi_mode3: Setting UE_mode BACK to PRACH 1\n");
UE_mac_inst[module_idP].UE_mode[eNB_index] = PRACH;
//ra_failed(module_idP,CC_id,eNB_index);UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0;
}
......@@ -1624,6 +1625,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t * ulsch_buffer, uint16_t buflen, uint8_t * access_mode)
{
LOG_I(MAC, "Panos-D: In ue_get_sdu() 1 \n");
uint8_t total_rlc_pdu_header_len = 0, rlc_pdu_header_len_last = 0;
uint16_t buflen_remain = 0;
uint8_t bsr_len = 0, bsr_ce_len = 0, bsr_header_len = 0;
......@@ -1653,7 +1655,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
rlc_buffer_occupancy_t lcid_buffer_occupancy_old =
0, lcid_buffer_occupancy_new = 0;
LOG_D(MAC,
LOG_I(MAC,
"[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n",
module_idP, frameP, subframe, buflen);
......@@ -1996,7 +1998,15 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
}
// build PHR and update the timers
if (phr_ce_len == sizeof(POWER_HEADROOM_CMD)) {
if(nfapi_mode ==3){
//Panos: Substitute with a static value for the MAC layer abstraction (phy_stub mode)
phr_p->PH = 40;
}
else{
phr_p->PH = get_phr_mapping(module_idP, CC_id, eNB_index);
}
phr_p->R = 0;
LOG_D(MAC,
"[UE %d] Frame %d report PHR with mapping (%d->%d) for LCID %d\n",
......@@ -2196,7 +2206,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
bsr_s, // short bsr
bsr_l, post_padding); // long_bsr
LOG_D(MAC,
LOG_I(MAC,
"[UE %d] Generate header :bufflen %d sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d, total_rlc_pdu_header_len %d, padding %d,post_padding %d, bsr len %d, phr len %d, reminder %d \n",
module_idP, buflen, sdu_length_total, num_sdus, sdu_lengths[0],
sdu_lcids[0], payload_offset, total_rlc_pdu_header_len,
......@@ -2204,6 +2214,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
buflen - sdu_length_total - payload_offset);
// cycle through SDUs and place in ulsch_buffer
if (sdu_length_total) {
LOG_I(MAC, "Panos-D: ue_get_sdu() 2 before copying to ulsch_buffer");
memcpy(&ulsch_buffer[payload_offset], ulsch_buff,
sdu_length_total);
}
......@@ -2460,6 +2471,7 @@ ue_scheduler(const module_id_t module_idP,
if(nfapi_mode == 3) { // Panos: phy_stub mode
// Panos: Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to
// PRACH state.
LOG_I(MAC, "nfapi_mode3: Setting UE_mode to PRACH 2 \n");
UE_mac_inst[module_idP].UE_mode[eNB_indexP] = PRACH;
//ra_failed(module_idP,CC_id,eNB_index);UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0;
}
......
......@@ -369,6 +369,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
rlc_mode = rlc_union_p->mode;
} else {
rlc_mode = RLC_MODE_NONE;
//LOG_D(RLC , "Panos-D: mac_rlc_status_ind() In RLC_MODE_NONE \n");
//LOG_W(RLC , "[%s] RLC not configured lcid %u module %u!\n", __FUNCTION__, channel_idP, module_idP);
//LOG_D(RLC , "[%s] RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP);
}
......
......@@ -179,16 +179,17 @@ void handle_ulsch(UL_IND_t *UL_info) {
else
{
//LOG_I(MAC, "Panos-D: handle_ulsch() rx_ind # of pdus: %d, crc_ind # of pdus: %d \n", UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->crc_ind.crc_indication_body.number_of_crcs);
if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->crc_ind.crc_indication_body.number_of_crcs>0) {
for (i=0;i<UL_info->rx_ind.rx_indication_body.number_of_pdus;i++) {
for (j=0;j<UL_info->crc_ind.crc_indication_body.number_of_crcs;j++) {
// find crc_indication j corresponding rx_indication i
LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].rx_ue_information.rnti:%04x UL_info->rx_ind.rx_indication_body.rx_pdu_list[%d].rx_ue_information.rnti:%04x\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti, i, UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti);
//LOG_I(MAC,"Panos-D: UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].rx_ue_information.rnti:%04x UL_info->rx_ind.rx_indication_body.rx_pdu_list[%d].rx_ue_information.rnti:%04x\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti, i, UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti);
if (UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti ==
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti) {
LOG_D(PHY, "UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag);
//LOG_I(MAC, "Panos-D: UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag);
if (UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag == 1) { // CRC error indication
LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->subframe);
LOG_I(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->subframe);
rx_sdu(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
......@@ -200,7 +201,7 @@ void handle_ulsch(UL_IND_t *UL_info) {
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
}
else {
LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->subframe);
//LOG_I(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->subframe);
rx_sdu(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
......@@ -219,6 +220,8 @@ void handle_ulsch(UL_IND_t *UL_info) {
UL_info->crc_ind.crc_indication_body.number_of_crcs=0;
UL_info->rx_ind.rx_indication_body.number_of_pdus = 0;
} // UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->subframe && UL_info->crc_ind.crc_indication_body.number_of_crcs>0
else if (UL_info->rx_ind.rx_indication_body.number_of_pdus!=0 || UL_info->crc_ind.crc_indication_body.number_of_crcs!=0) {
LOG_E(PHY,"hoping not to have mis-match between CRC ind and RX ind - hopefully the missing message is coming shortly rx_ind:%d(SFN/SF:%05d) crc_ind:%d(SFN/SF:%05d) UL_info(SFN/SF):%04d%d\n",
UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf),
......
......@@ -131,6 +131,8 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND
void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint16_t rnti) {
LOG_I(MAC, "Panos-D: fill_sr_indication_UE_MAC 1 \n");
pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
nfapi_sr_indication_t *sr_ind = &UL_INFO->sr_ind;
......@@ -203,7 +205,7 @@ void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_
void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t ra_PreambleIndex, uint16_t ra_RNTI) {
//LOG_I(MAC, "Panos-D: fill_rach_indication_UE_MAC 1 \n");
LOG_I(MAC, "Panos-D: fill_rach_indication_UE_MAC 1 \n");
pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t));
......@@ -1152,8 +1154,8 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req)
// Last parameter is 1 if first time synchronization and zero otherwise. Not sure which value to put
// for our case.
LOG_E(MAC,"dl_config_req_UE_MAC 4 Received MIB: sfn/sf: %d.%d \n", sfn, sf);
dl_phy_sync_success(Mod_id,sfn,0, 0);
if(UE_mac_inst[Mod_id].UE_mode[0] == NOT_SYNCHED){
dl_phy_sync_success(Mod_id,sfn,0, 0);
LOG_E(MAC,"dl_config_req_UE_MAC 5 Received MIB: UE_mode: %d\n", UE_mac_inst[Mod_id].UE_mode[0]);
UE_mac_inst[Mod_id].UE_mode[0]=PRACH;
}
......@@ -1241,7 +1243,7 @@ int hi_dci0_req_UE_MAC(nfapi_hi_dci0_request_t* req)
// This is meaningful only after ACKnowledging the first ULSCH Txon (i.e. Msg3)
if(hi_dci0_req_pdu->hi_pdu.hi_pdu_rel8.hi_value == 1 && UE_mac_inst[Mod_id].first_ULSCH_Tx == 1){
//LOG_I(MAC,"[UE-PHY_STUB] HI_DCI0_REQ 2 sfn_sf:%d PDU[%d] - NFAPI_HI_DCI0_HI_PDU_TYPE\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
LOG_I(MAC,"[UE-PHY_STUB] HI_DCI0_REQ 2 sfn_sf:%d PDU[%d] - NFAPI_HI_DCI0_HI_PDU_TYPE\n", NFAPI_SFNSF2DEC(req->sfn_sf), i);
UE_mac_inst[Mod_id].UE_mode[0] = PUSCH;
UE_mac_inst[Mod_id].first_ULSCH_Tx = 0;
}
......@@ -1298,7 +1300,10 @@ int memcpy_dl_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = req->dl_config_request_body.number_pdcch_ofdm_symbols;
UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.number_pdsch_rnti = req->dl_config_request_body.number_pdsch_rnti;
UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.number_pdu = req->dl_config_request_body.number_pdu;
UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.tl = req->dl_config_request_body.tl;
//UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.tl = req->dl_config_request_body.tl;
UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.tl.tag = req->dl_config_request_body.tl.tag;
UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.tl.length = req->dl_config_request_body.tl.length;
UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*) malloc(req->dl_config_request_body.number_pdu*sizeof(nfapi_dl_config_request_pdu_t));
for(int i=0; i<UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.number_pdu; i++) {
......@@ -1329,7 +1334,10 @@ int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request
UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.number_of_pdus = req->ul_config_request_body.number_of_pdus;
UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.rach_prach_frequency_resources = req->ul_config_request_body.rach_prach_frequency_resources;
UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.srs_present = req->ul_config_request_body.srs_present;
UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.tl = req->ul_config_request_body.tl;
//UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.tl = req->ul_config_request_body.tl;
UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.tl.tag = req->ul_config_request_body.tl.tag;
UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.tl.length = req->ul_config_request_body.tl.length;
//LOG_D(MAC, "Panos-D: memcpy_ul_config_req 1 #ofULPDUs: %d \n", UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.number_of_pdus); //req->ul_config_request_body.number_of_pdus);
UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*) malloc(req->ul_config_request_body.number_of_pdus*sizeof(nfapi_ul_config_request_pdu_t));
......@@ -1401,7 +1409,11 @@ int memcpy_hi_dci0_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t*
UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.number_of_dci = req->hi_dci0_request_body.number_of_dci;
UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.number_of_hi = req->hi_dci0_request_body.number_of_hi;
UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.sfnsf = req->hi_dci0_request_body.sfnsf;
UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.tl = req->hi_dci0_request_body.tl;
//UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.tl = req->hi_dci0_request_body.tl;
UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.tl.tag = req->hi_dci0_request_body.tl.tag;
UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.tl.length = req->hi_dci0_request_body.tl.length;
int total_pdus = UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.number_of_dci + UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.number_of_hi;
//LOG_I(MAC, "Original hi_dci0 req. #:%d, Copy #: %d \n",req->hi_dci0_request_body.number_of_dci + req->hi_dci0_request_body.number_of_hi, total_pdus);
......
......@@ -722,6 +722,7 @@ void rrc_eNB_emulation_notify_ue_module_id(
const uint8_t cell_identity_byte2P,
const uint8_t cell_identity_byte3P)
{
LOG_I(RRC, "Panos-D: rrc_eNB_emulation_notify_ue_module_id 1 \n");
module_id_t enb_module_id;
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
int CC_id;
......@@ -732,21 +733,21 @@ void rrc_eNB_emulation_notify_ue_module_id(
return;
}
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
//<<<<<<< HEAD
/*<<<<<<< HEAD
if (RC.rrc[enb_module_id]->carrier[CC_id].sib1 != NULL) {
if (
(RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[0] == cell_identity_byte0P) &&
(RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[1] == cell_identity_byte1P) &&
(RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) &&
(RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P)
/*=======
/*=======*/
if (&RC.rrc[enb_module_id]->carrier[CC_id].sib1 != NULL) {
if (
(&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[0] == cell_identity_byte0P) &&
(&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[1] == cell_identity_byte1P) &&
(&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) &&
(&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P)
>>>>>>> main/develop*/
//>>>>>>> main/develop
) {
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[enb_module_id],
......@@ -4855,8 +4856,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8)
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
LOG_I(RRC,
"[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n",
LOG_E(RRC,
"[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n \n \n",
ctxt_pP->module_id,
ctxt_pP->frame,
ctxt_pP->rnti,
......@@ -5667,7 +5668,7 @@ rrc_eNB_decode_ccch(
}
#endif
if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) {
LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n",
LOG_I(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n",
ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti);
ue_context_p->ue_context.ul_failure_timer = 20000;
}
......@@ -7037,6 +7038,7 @@ rrc_rx_tx(
}
if (ue_context_p->ue_context.ul_failure_timer>0) {
ue_context_p->ue_context.ul_failure_timer++;
LOG_I(RRC, "Panos-D: rrc_rx_tx(), ul_failure_timer: %d \n", ue_context_p->ue_context.ul_failure_timer);
if (ue_context_p->ue_context.ul_failure_timer >= 20000) {
// remove UE after 20 seconds after MAC has indicated UL failure
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
......@@ -7046,9 +7048,10 @@ rrc_rx_tx(
}
if (ue_context_p->ue_context.ue_release_timer>0) {
ue_context_p->ue_context.ue_release_timer++;
LOG_I(RRC, "Panos-D: rrc_rx_tx(), release timer: %d \n", ue_context_p->ue_context.ue_release_timer);
if (ue_context_p->ue_context.ue_release_timer >=
ue_context_p->ue_context.ue_release_timer_thres) {
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
LOG_I(RRC,"Removing UE %x instance, Release timer: %d, Release timer thres.: %d \n",ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer, ue_context_p->ue_context.ue_release_timer_thres);
ue_to_be_removed = ue_context_p;
break;
}
......
......@@ -106,6 +106,8 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "system.h"
static char *in_ip_xx = in_ip;
#ifdef XFORMS
#include "PHY/TOOLS/lte_phy_scope.h"
#include "stats.h"
......
......@@ -101,6 +101,8 @@ unsigned short config_frames[4] = {2,9,11,13};
#endif
#include "lte-softmodem.h"
static char *in_ip_xx = in_ip;
#ifdef XFORMS
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
// at eNB 0, an UL scope for every UE
......
......@@ -163,7 +163,7 @@ extern int16_t dlsch_demod_shift;
{"U" , CONFIG_HLP_UE, PARAMFLAG_BOOL, i8ptr:&UE_flag, defintval:0, TYPE_INT8, 0}, \
{"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
{"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
{"W" , CONFIG_HLP_L2MONW, 0, strptr:(char **)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, sizeof(in_ip)}, \
{"W" , CONFIG_HLP_L2MONW, 0, strptr:&in_ip_xx, defstrval:"127.0.0.1", TYPE_STRING, sizeof(in_ip)}, \
{"P" , CONFIG_HLP_L2MONP, 0, strptr:(char **)&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, sizeof(in_path)}, \
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&ouput_vcd, defintval:0, TYPE_INT, 0}, \
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
......
......@@ -868,7 +868,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
while (phy_stub_ticking->ticking_var < 0) {
// most of the time, the thread is waiting here
//pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx )
LOG_D(MAC,"Waiting for ticking_var\n",phy_stub_ticking->ticking_var);
LOG_D(MAC,"Waiting for ticking_var\n");
pthread_cond_wait( &phy_stub_ticking->cond_ticking, &phy_stub_ticking->mutex_ticking);
}
phy_stub_ticking->ticking_var--;
......@@ -966,13 +966,13 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
//stop_meas(&UE->timer_stats);
//t_diff = get_time_meas_us(&UE->timer_stats);
//LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff);
if (nfapi_mode != 3)
phy_procedures_UE_SL_TX(UE,proc);
//#endif
}
//>>>>>>> Stashed changes
#if UE_TIMING_TRACE
start_meas(&UE->generic_stat);
#endif
......@@ -2021,7 +2021,7 @@ int init_timer_thread(void) {
PHY_VARS_UE *UE=PHY_vars_UE_g[0][0];
phy_stub_ticking = (SF_ticking*)malloc(sizeof(SF_ticking));
pthread_mutex_init(&UE->timer_mutex,NULL);
pthread_mutex_init(&UE->timer_cond,NULL);
pthread_cond_init(&UE->timer_cond,NULL);
UE->instance_cnt_timer = -1;
pthread_mutex_init(&phy_stub_ticking->mutex_ticking,NULL);
pthread_cond_init(&phy_stub_ticking->cond_ticking,NULL);
......
......@@ -401,6 +401,7 @@ u16 attach_ue3(char *dcch_sdu_ue, char dcch_sdu_ue_len, char *dcch_sdu_eNB)
// simulation reception of RRCConnectionSetupComplete
//LOG_D(RLC, "Panos-D: attach_ue3 before mac_rlc_data_ind 1 \n");
mac_rlc_data_ind(0,134,1,
DCCH,
dcch_sdu_ue,
......@@ -418,6 +419,7 @@ u16 attach_ue3(char *dcch_sdu_ue, char dcch_sdu_ue_len, char *dcch_sdu_eNB)
DCCH,
dcch_sdu_eNB);
//LOG_D(RLC, "Panos-D: attach_ue3 before mac_rlc_data_ind 2 \n");
mac_rlc_data_ind(1,135,1,
DCCH,
dcch_sdu_eNB,
......
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