Merge commit '8471bd14e2e400887e7419d3307921a1401e2823' into mu_with_tdd1

# Conflicts:
#	common/utils/itti/intertask_interface.c
#	openair1/SCHED/phy_procedures_lte_eNb.c
This commit is contained in:
Haruki NAOI
2018-05-29 14:52:19 +09:00
89 changed files with 5147 additions and 2487 deletions
+3
View File
@@ -601,6 +601,8 @@ add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchang
add_boolean_option(FLEXRAN_AGENT_SB_IF False "enable FlexRAN agent to inteface with a SDN controller") add_boolean_option(FLEXRAN_AGENT_SB_IF False "enable FlexRAN agent to inteface with a SDN controller")
add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE") add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE")
######################## ########################
# Include order # Include order
@@ -1197,6 +1199,7 @@ set (MAC_SRC
${MAC_DIR}/eNB_scheduler_bch.c ${MAC_DIR}/eNB_scheduler_bch.c
${MAC_DIR}/eNB_scheduler_primitives.c ${MAC_DIR}/eNB_scheduler_primitives.c
${MAC_DIR}/eNB_scheduler_RA.c ${MAC_DIR}/eNB_scheduler_RA.c
${MAC_DIR}/eNB_scheduler_fairRR.c
${MAC_DIR}/pre_processor.c ${MAC_DIR}/pre_processor.c
${MAC_DIR}/config.c ${MAC_DIR}/config.c
) )
+6
View File
@@ -526,6 +526,8 @@ function main() {
echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file
fi fi
echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file
echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
@@ -689,6 +691,8 @@ function main() {
echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file
fi fi
echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file
echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( PRINT_STATS $PRINT_STATS )" >> $cmake_file echo "set ( PRINT_STATS $PRINT_STATS )" >> $cmake_file
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
@@ -773,6 +777,8 @@ function main() {
echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file
fi fi
echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file
echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
+2
View File
@@ -35,9 +35,11 @@
#ifndef ASSERTIONS_H_ #ifndef ASSERTIONS_H_
#define ASSERTIONS_H_ #define ASSERTIONS_H_
void output_log_mem(void);
#define _Assert_Exit_ \ #define _Assert_Exit_ \
{ \ { \
fprintf(stderr, "\nExiting execution\n"); \ fprintf(stderr, "\nExiting execution\n"); \
output_log_mem(); \
display_backtrace(); \ display_backtrace(); \
fflush(stdout); \ fflush(stdout); \
fflush(stderr); \ fflush(stderr); \
-13
View File
@@ -54,9 +54,7 @@
#include "signals.h" #include "signals.h"
#include "timer.h" #include "timer.h"
#ifdef UE_EXPANSION
#include "log.h" #include "log.h"
#endif
/* ITTI DEBUG groups */ /* ITTI DEBUG groups */
#define ITTI_DEBUG_POLL (1<<0) #define ITTI_DEBUG_POLL (1<<0)
@@ -361,7 +359,6 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
/* Enqueue message in destination task queue */ /* Enqueue message in destination task queue */
if (lfds611_queue_enqueue(itti_desc.tasks[destination_task_id].message_queue, new) == 0) { if (lfds611_queue_enqueue(itti_desc.tasks[destination_task_id].message_queue, new) == 0) {
#ifdef UE_EXPANSION
LOG_I(UDP_, " Assertion Message %s(id:%d), number %lu with priority %d can not be sent from (%u:%s) to queue (%u:%s). discarding...\n", LOG_I(UDP_, " Assertion Message %s(id:%d), number %lu with priority %d can not be sent from (%u:%s) to queue (%u:%s). discarding...\n",
itti_desc.messages_info[message_id].name, itti_desc.messages_info[message_id].name,
message_id, message_id,
@@ -374,9 +371,6 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
int result = itti_free(origin_task_id, message); int result = itti_free(origin_task_id, message);
AssertFatal( result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); AssertFatal( result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
return 0; return 0;
#else
AssertFatal(0, "Error: lfds611_queue_enqueue returns 0, queue is full, exiting\n");
#endif
} }
{ {
@@ -530,14 +524,10 @@ static inline void itti_receive_msg_internal_event_fd(task_id_t task_id, uint8_t
if (lfds611_queue_dequeue (itti_desc.tasks[task_id].message_queue, (void **) &message) == 0) { if (lfds611_queue_dequeue (itti_desc.tasks[task_id].message_queue, (void **) &message) == 0) {
/* No element in list -> this should not happen */ /* No element in list -> this should not happen */
#ifdef UE_EXPANSION
LOG_I(UDP_, "Assertion No message in queue for task %d while there are %d events and some for the messages queue!\n", task_id, epoll_ret); LOG_I(UDP_, "Assertion No message in queue for task %d while there are %d events and some for the messages queue!\n", task_id, epoll_ret);
/* Mark that the event has been processed */ /* Mark that the event has been processed */
itti_desc.threads[thread_id].events[i].events &= ~EPOLLIN; itti_desc.threads[thread_id].events[i].events &= ~EPOLLIN;
return; return;
#else
AssertFatal (0, "No message in queue for task %d while there are %d events and some for the messages queue!\n", task_id, epoll_ret);
#endif
} }
AssertFatal(message != NULL, "Message from message queue is NULL!\n"); AssertFatal(message != NULL, "Message from message queue is NULL!\n");
@@ -650,8 +640,6 @@ void itti_mark_task_ready(task_id_t task_id)
/* Mark the thread as using LFDS queue */ /* Mark the thread as using LFDS queue */
lfds611_queue_use(itti_desc.tasks[task_id].message_queue); lfds611_queue_use(itti_desc.tasks[task_id].message_queue);
<<<<<<< HEAD
=======
#if defined(UE_EXPANSION) || defined(RTAI) #if defined(UE_EXPANSION) || defined(RTAI)
/* Assign low priority to created threads */ /* Assign low priority to created threads */
{ {
@@ -661,7 +649,6 @@ void itti_mark_task_ready(task_id_t task_id)
} }
#endif #endif
>>>>>>> remotes/origin/ues_test
itti_desc.threads[thread_id].task_state = TASK_STATE_READY; itti_desc.threads[thread_id].task_state = TASK_STATE_READY;
itti_desc.ready_tasks ++; itti_desc.ready_tasks ++;
+3
View File
@@ -117,16 +117,19 @@ int signal_handle(int *end)
case SIGUSR1: case SIGUSR1:
SIG_DEBUG("Received SIGUSR1\n"); SIG_DEBUG("Received SIGUSR1\n");
*end = 1; *end = 1;
output_log_mem();
break; break;
case SIGSEGV: /* Fall through */ case SIGSEGV: /* Fall through */
case SIGABRT: case SIGABRT:
SIG_DEBUG("Received SIGABORT\n"); SIG_DEBUG("Received SIGABORT\n");
output_log_mem();
backtrace_handle_signal(&info); backtrace_handle_signal(&info);
break; break;
case SIGINT: case SIGINT:
printf("Received SIGINT\n"); printf("Received SIGINT\n");
output_log_mem();
itti_send_terminate_message(TASK_UNKNOWN); itti_send_terminate_message(TASK_UNKNOWN);
*end = 1; *end = 1;
break; break;
+5 -1
View File
@@ -839,7 +839,11 @@ int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
LTE_eNB_DLSCH_t *dlsch0 = eNB->dlsch[UE_id][0]; LTE_eNB_DLSCH_t *dlsch0 = eNB->dlsch[UE_id][0];
//LTE_eNB_DLSCH_t *dlsch1 = eNB->dlsch[UE_id][1]; //LTE_eNB_DLSCH_t *dlsch1 = eNB->dlsch[UE_id][1];
int harq_pid = dlsch0->harq_ids[sf]; int harq_pid = dlsch0->harq_ids[sfn%2][sf];
if(harq_pid >= dlsch0->Mdlharq) {
LOG_E(PHY,"pnf_phy_dl_config_req illegal harq_pid %d\n", harq_pid);
return(-1);
}
uint8_t *dlsch_sdu = tx_pdus[UE_id][harq_pid]; uint8_t *dlsch_sdu = tx_pdus[UE_id][harq_pid];
memcpy(dlsch_sdu, tx_pdu->segments[0].segment_data, tx_pdu->segments[0].segment_length); memcpy(dlsch_sdu, tx_pdu->segments[0].segment_data, tx_pdu->segments[0].segment_length);
@@ -2218,6 +2218,7 @@ typedef struct {
uint8_t dl_assignment_index; uint8_t dl_assignment_index;
uint32_t tpc_bitmap; uint32_t tpc_bitmap;
uint16_t transmission_power; uint16_t transmission_power;
uint8_t harq_pid;
} nfapi_hi_dci0_dci_pdu_rel8_t; } nfapi_hi_dci0_dci_pdu_rel8_t;
#define NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG 0x2020 #define NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG 0x2020
+2 -6
View File
@@ -256,7 +256,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] > 0, AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0] > 0,
"prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]==0\n"); "prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]==0\n");
#else #else
LOG_E(PHY,"***DJP*** removed assert on preamble fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]:%d expecting >0 %s:%d\n\n\n", fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0], __FILE__, __LINE__); LOG_D(PHY,"***DJP*** removed assert on preamble fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0]:%d expecting >0 %s:%d\n\n\n", fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[0], __FILE__, __LINE__);
#endif #endif
fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[0] = cfg->emtc_config.prach_ce_level_0_configuration_index.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[0] = cfg->emtc_config.prach_ce_level_0_configuration_index.value;
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[0] = cfg->emtc_config.prach_ce_level_0_frequency_offset.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[0] = cfg->emtc_config.prach_ce_level_0_frequency_offset.value;
@@ -649,11 +649,7 @@ void phy_config_sib13_eNB(module_id_t Mod_id,int CC_id,int mbsfn_Area_idx,
void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB) void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB)
{ {
#ifndef UE_EXPANSION
uint8_t UE_id;
#else
uint16_t UE_id; uint16_t UE_id;
#endif
struct PhysicalConfigDedicated *physicalConfigDedicated; struct PhysicalConfigDedicated *physicalConfigDedicated;
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
@@ -1779,7 +1775,7 @@ int phy_init_RU(RU_t *ru) {
AssertFatal(RC.nb_L1_inst <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n", AssertFatal(RC.nb_L1_inst <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
RC.nb_L1_inst,NUMBER_OF_eNB_MAX); RC.nb_L1_inst,NUMBER_OF_eNB_MAX);
LOG_E(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst); LOG_D(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst);
for (i=0; i<RC.nb_L1_inst; i++) { for (i=0; i<RC.nb_L1_inst; i++) {
for (p=0;p<15;p++) { for (p=0;p<15;p++) {
+61 -69
View File
@@ -800,19 +800,11 @@ void generate_RIV_tables()
// n_tilde_PRB(2,3) = (3,5) // n_tilde_PRB(2,3) = (3,5)
// n_tilde_PRB(0,1) = (0,2) // n_tilde_PRB(0,1) = (0,2)
#ifndef UE_EXPANSION
int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
#else
int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
#endif
{ {
#ifndef UE_EXPANSION
uint8_t i;
int8_t first_free_index=-1;
#else
uint16_t i; uint16_t i;
int16_t first_free_index=-1; int16_t first_free_index=-1;
#endif
AssertFatal(eNB!=NULL,"eNB is null\n"); AssertFatal(eNB!=NULL,"eNB is null\n");
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
@@ -829,19 +821,10 @@ int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
return first_free_index; return first_free_index;
} }
#ifndef UE_EXPANSION
int8_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
#else
int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
#endif
{ {
#ifndef UE_EXPANSION
uint8_t i;
int8_t first_free_index=-1;
#else
uint16_t i; uint16_t i;
int16_t first_free_index=-1; int16_t first_free_index=-1;
#endif
AssertFatal(eNB!=NULL,"eNB is null\n"); AssertFatal(eNB!=NULL,"eNB is null\n");
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
@@ -1089,7 +1072,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
} }
dlsch0_harq->ndi = rel8->new_data_indicator_1; dlsch0_harq->ndi = rel8->new_data_indicator_1;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
@@ -1270,14 +1253,14 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
dlsch0_harq->mcs = rel8->mcs_1; dlsch0_harq->mcs = rel8->mcs_1;
dlsch0_harq->Qm = 2; dlsch0_harq->Qm = 2;
dlsch0_harq->TBS = TBStable[I_mcs][NPRB-1]; dlsch0_harq->TBS = TBStable[I_mcs][NPRB-1];
dlsch0->harq_ids[subframe] = rel8->harq_process; dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
#endif #endif
dlsch0->rnti = rel8->rnti; dlsch0->rnti = rel8->rnti;
dlsch0->harq_ids[subframe] = rel8->harq_process; //dlsch0->harq_ids[subframe] = rel8->harq_process;
if (dlsch0_harq->round == 0) if (dlsch0_harq->round == 0)
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
@@ -1289,7 +1272,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
case NFAPI_DL_DCI_FORMAT_1: case NFAPI_DL_DCI_FORMAT_1:
dci_alloc->format = format1; dci_alloc->format = format1;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
@@ -1438,7 +1421,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
dlsch0_harq->dl_power_off = 1; dlsch0_harq->dl_power_off = 1;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
@@ -1458,7 +1441,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
} }
LOG_D(PHY,"DCI: Set harq_ids[%d] to %d (%p)\n",subframe,rel8->harq_process,dlsch0); LOG_D(PHY,"DCI: Set harq_ids[%d] to %d (%p)\n",subframe,rel8->harq_process,dlsch0);
dlsch0->harq_ids[subframe] = rel8->harq_process; dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
dlsch0->harq_mask |= (1<<rel8->harq_process); dlsch0->harq_mask |= (1<<rel8->harq_process);
@@ -1625,8 +1608,8 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
dlsch0->subframe_tx[subframe] = 1; dlsch0->subframe_tx[subframe] = 1;
dlsch0->harq_ids[subframe] = rel8->harq_process; dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
dlsch1->harq_ids[subframe] = rel8->harq_process; dlsch1->harq_ids[frame%2][subframe] = rel8->harq_process;
// printf("Setting DLSCH harq id %d to subframe %d\n",harq_pid,subframe); // printf("Setting DLSCH harq id %d to subframe %d\n",harq_pid,subframe);
@@ -1653,7 +1636,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
// assume both TBs are active // assume both TBs are active
dlsch0_harq->Nl = 1; dlsch0_harq->Nl = 1;
dlsch1_harq->Nl = 1; dlsch1_harq->Nl = 1;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
dlsch1->active[subframe] = 1; dlsch1->active[subframe] = 1;
#else #else
@@ -1665,7 +1648,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
// check if either TB is disabled (see 36-213 V11.3 Section ) // check if either TB is disabled (see 36-213 V11.3 Section )
if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0)) { if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0)) {
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 0; dlsch0->active[subframe] = 0;
#else #else
dlsch0->active = 0; dlsch0->active = 0;
@@ -1674,7 +1657,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
} }
if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0)) { if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0)) {
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch1->active[subframe]= 0; dlsch1->active[subframe]= 0;
#else #else
dlsch1->active = 0; dlsch1->active = 0;
@@ -1690,7 +1673,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1];
dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch0_harq->nb_rb-1]; dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch0_harq->nb_rb-1];
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) { if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) {
#else #else
if ((dlsch0->active==1) && (dlsch1->active==1)) { if ((dlsch0->active==1) && (dlsch1->active==1)) {
@@ -1704,7 +1687,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
dlsch1_harq->mimo_mode = ALAMOUTI; dlsch1_harq->mimo_mode = ALAMOUTI;
} }
} else if (fp->nb_antenna_ports_eNB == 4) { // 4 antenna case } else if (fp->nb_antenna_ports_eNB == 4) { // 4 antenna case
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) { if ((dlsch0->active[subframe]==1) && (dlsch1->active[subframe]==1)) {
#else #else
if ((dlsch0->active==1) && (dlsch1->active==1)) { if ((dlsch0->active==1) && (dlsch1->active==1)) {
@@ -1748,7 +1731,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
LOG_E(PHY,"Illegal value (3) for TPMI in Format 2A DCI\n"); LOG_E(PHY,"Illegal value (3) for TPMI in Format 2A DCI\n");
break; break;
} }
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
} else if (dlsch0->active[subframe] == 1) { } else if (dlsch0->active[subframe] == 1) {
#else #else
} else if (dlsch0->active == 1) { } else if (dlsch0->active == 1) {
@@ -1772,7 +1755,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
LOG_E(PHY,"Illegal value %d for TPMI in Format 2A DCI with one transport block enabled\n",rel8->precoding_information); LOG_E(PHY,"Illegal value %d for TPMI in Format 2A DCI with one transport block enabled\n",rel8->precoding_information);
break; break;
} }
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
} else if (dlsch1->active[subframe] == 1) { } else if (dlsch1->active[subframe] == 1) {
#else #else
} else if (dlsch1->active == 1) { } else if (dlsch1->active == 1) {
@@ -1802,14 +1785,14 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
} }
// reset HARQ process if this is the first transmission // reset HARQ process if this is the first transmission
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
if ((dlsch0->active[subframe]==1) && (dlsch0_harq->round == 0)) if ((dlsch0->active[subframe]==1) && (dlsch0_harq->round == 0))
#else #else
if ((dlsch0->active==1) && (dlsch0_harq->round == 0)) if ((dlsch0->active==1) && (dlsch0_harq->round == 0))
#endif #endif
dlsch0_harq->status = ACTIVE; dlsch0_harq->status = ACTIVE;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
if ((dlsch1->active[subframe]==1) && (dlsch1_harq->round == 0)) if ((dlsch1->active[subframe]==1) && (dlsch1_harq->round == 0))
#else #else
if ((dlsch1->active==1) && (dlsch1_harq->round == 0)) if ((dlsch1->active==1) && (dlsch1_harq->round == 0))
@@ -1987,7 +1970,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
printf("RV0 = %d, RV1 = %d. MCS0 = %d, MCS1=%d\n", rel8->redundancy_version_1, rel8->redundancy_version_2, rel8->mcs_1, rel8->mcs_2); printf("RV0 = %d, RV1 = %d. MCS0 = %d, MCS1=%d\n", rel8->redundancy_version_1, rel8->redundancy_version_2, rel8->mcs_1, rel8->mcs_2);
#endif #endif
if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==0) { if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==0) {
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
dlsch1->active[subframe] = 1; dlsch1->active[subframe] = 1;
#else #else
@@ -2015,7 +1998,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
else if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==1) { else if (TB0_active && TB1_active && rel8->transport_block_to_codeword_swap_flag==1) {
dlsch0 = eNB->dlsch[UE_id][1]; dlsch0 = eNB->dlsch[UE_id][1];
dlsch1 = eNB->dlsch[UE_id][0]; dlsch1 = eNB->dlsch[UE_id][0];
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
dlsch1->active[subframe] = 1; dlsch1->active[subframe] = 1;
#else #else
@@ -2039,7 +2022,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
dlsch1_harq->codeword=0; dlsch1_harq->codeword=0;
} }
else if (TB0_active && (TB1_active==0)) { else if (TB0_active && (TB1_active==0)) {
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
@@ -2058,7 +2041,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
#endif #endif
} }
else if ((TB0_active==0) && TB1_active) { else if ((TB0_active==0) && TB1_active) {
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch1->active[subframe] = 1; dlsch1->active[subframe] = 1;
#else #else
dlsch1->active = 1; dlsch1->active = 1;
@@ -2080,11 +2063,11 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t
if (dlsch0 != NULL){ if (dlsch0 != NULL){
dlsch0->subframe_tx[subframe] = 1; dlsch0->subframe_tx[subframe] = 1;
dlsch0->harq_ids[subframe] = rel8->harq_process; dlsch0->harq_ids[frame%2][subframe] = rel8->harq_process;
} }
if (dlsch1_harq != NULL){ if (dlsch1_harq != NULL){
dlsch1->harq_ids[subframe] = rel8->harq_process; dlsch1->harq_ids[frame%2][subframe] = rel8->harq_process;
} }
@@ -2294,6 +2277,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL; LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL;
int UE_id; int UE_id;
int subframe = proc->subframe_tx; int subframe = proc->subframe_tx;
int frame = proc->frame_tx;
dci_alloc->firstCCE = rel13->ecce_index; dci_alloc->firstCCE = rel13->ecce_index;
dci_alloc->L = rel13->aggregation_level; dci_alloc->L = rel13->aggregation_level;
@@ -2329,7 +2313,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
case 10: // Format 6-1A case 10: // Format 6-1A
dci_alloc->format = format6_1A; dci_alloc->format = format6_1A;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
@@ -2389,7 +2373,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
break; break;
case 11: // Format 6-1B case 11: // Format 6-1B
dci_alloc->format = format6_1B; dci_alloc->format = format6_1B;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
@@ -2436,7 +2420,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
} }
case 12: // Format 6-2 case 12: // Format 6-2
dci_alloc->format = format6_2; dci_alloc->format = format6_2;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
@@ -2524,7 +2508,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
dlsch0_harq->dl_power_off = 1; dlsch0_harq->dl_power_off = 1;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[subframe] = 1; dlsch0->active[subframe] = 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
@@ -2541,7 +2525,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *d
} }
dlsch0->harq_ids[subframe] = rel13->harq_process; dlsch0->harq_ids[frame%2][subframe] = rel13->harq_process;
@@ -2572,6 +2556,8 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
uint32_t ndi = pdu->dci_pdu_rel8.new_data_indication_1; uint32_t ndi = pdu->dci_pdu_rel8.new_data_indication_1;
uint16_t UE_id = -1;
#ifdef T_TRACER #ifdef T_TRACER
T(T_ENB_PHY_ULSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T(T_ENB_PHY_ULSCH_UE_DCI, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
T_INT(pdu->dci_pdu_rel8.rnti), T_INT(((frame*10+subframe+4) % 8) /* TODO: correct harq pid */), T_INT(pdu->dci_pdu_rel8.rnti), T_INT(((frame*10+subframe+4) % 8) /* TODO: correct harq pid */),
@@ -2717,6 +2703,13 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,
DevParam (frame_parms->N_RB_DL, 0, 0); DevParam (frame_parms->N_RB_DL, 0, 0);
break; break;
} }
if(frame_parms->frame_type == TDD){
UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE);
if(UE_id != -1){
eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1;
}
}
} }
void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe) void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe)
@@ -2781,6 +2774,7 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu
ulsch->harq_processes[harq_pid]->ndi, ulsch_pdu->ulsch_pdu_rel8.new_data_indication, new_ulsch, ulsch->harq_processes[harq_pid]->status); ulsch->harq_processes[harq_pid]->ndi, ulsch_pdu->ulsch_pdu_rel8.new_data_indication, new_ulsch, ulsch->harq_processes[harq_pid]->status);
ulsch->harq_processes[harq_pid]->rvidx = ulsch_pdu->ulsch_pdu_rel8.redundancy_version; ulsch->harq_processes[harq_pid]->rvidx = ulsch_pdu->ulsch_pdu_rel8.redundancy_version;
if(ulsch_pdu->ulsch_pdu_rel8.modulation_type!=0)
ulsch->harq_processes[harq_pid]->Qm = ulsch_pdu->ulsch_pdu_rel8.modulation_type; ulsch->harq_processes[harq_pid]->Qm = ulsch_pdu->ulsch_pdu_rel8.modulation_type;
// Set O_ACK to 0 by default, will be set of DLSCH is scheduled and needs to be // Set O_ACK to 0 by default, will be set of DLSCH is scheduled and needs to be
ulsch->harq_processes[harq_pid]->O_ACK = 0; ulsch->harq_processes[harq_pid]->O_ACK = 0;
@@ -2802,15 +2796,11 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu
ulsch->harq_processes[harq_pid]->Or1 = 0; ulsch->harq_processes[harq_pid]->Or1 = 0;
ulsch->harq_processes[harq_pid]->Or2 = 0; ulsch->harq_processes[harq_pid]->Or2 = 0;
} }
#ifndef UE_EXPANSION
else ulsch->harq_processes[harq_pid]->round++;
#else
else { else {
ulsch->harq_processes[harq_pid]->round++; ulsch->harq_processes[harq_pid]->round++;
ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3; ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3;
ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks; ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
} }
#endif
ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti; ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti;
LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, status %d, handled %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n", LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, status %d, handled %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n",
ulsch->rnti, ulsch->rnti,
@@ -6594,12 +6584,7 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t
} else { } else {
switch (frame_parms->tdd_config) { switch (frame_parms->tdd_config) {
case 1: case 1:
if ((subframe==2) ||
(subframe==3) ||
(subframe==7) ||
(subframe==8))
switch (subframe) { switch (subframe) {
case 2: case 2:
case 3: case 3:
@@ -6667,10 +6652,13 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
uint8_t ul_subframe = 255; uint8_t ul_subframe = 255;
if ((frame_parms->frame_type == TDD) && if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 1) && (frame_parms->tdd_config == 1)) {
((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 if ((n==1)||(n==6)) { // tdd_config 0,1 SF 1,5
ul_subframe = ((n+6)%10); ul_subframe = ((n+6)%10);
else if ((frame_parms->frame_type == TDD) && } else if ((n==4)||(n==9)) {
ul_subframe = ((n+4)%10);
}
} else if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 6) && (frame_parms->tdd_config == 6) &&
((n==0)||(n==1)||(n==5)||(n==6))) ((n==0)||(n==1)||(n==5)||(n==6)))
ul_subframe = ((n+7)%10); ul_subframe = ((n+7)%10);
@@ -6690,10 +6678,13 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n) uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
{ {
if ((frame_parms->frame_type == TDD) && if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 1) && (frame_parms->tdd_config == 1)) {
((n==7)||(n==2))) // tdd_config 0,1 SF 1,5 if ((n==7)||(n==2)) { // tdd_config 0,1 SF 1,5
return((n==7)? 1 : 6); return((n==7)? 1 : 6);
else if ((frame_parms->frame_type == TDD) && } else if ((n==3)||(n==8)) {
return((n==3)? 9 : 4);
}
} else if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 6) && (frame_parms->tdd_config == 6) &&
((n==7)||(n==8)||(n==2)||(n==3))) ((n==7)||(n==8)||(n==2)||(n==3)))
return((n+3)%10); return((n+3)%10);
@@ -6707,13 +6698,14 @@ uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t
uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n) uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n)
{ {
uint32_t ul_frame; uint32_t ul_frame = frame;
if ((frame_parms->frame_type == TDD) && if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 1) && (frame_parms->tdd_config == 1)) {
((n==1)||(n==6))) // tdd_config 0,1 SF 1,5 if ((n==1)||(n==6)||(n==4)||(n==9)) { // tdd_config 0,1 SF 1,5
ul_frame = (frame + (n==1 ? 0 : 1)); ul_frame = (frame + (n < 5 ? 0 : 1));
else if ((frame_parms->frame_type == TDD) && }
} else if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 6) && (frame_parms->tdd_config == 6) &&
((n==0)||(n==1)||(n==5)||(n==6))) ((n==0)||(n==1)||(n==5)||(n==6)))
ul_frame = (frame + (n>=5 ? 1 : 0)); ul_frame = (frame + (n>=5 ? 1 : 0));
+4 -4
View File
@@ -184,7 +184,7 @@ typedef struct {
uint8_t first_layer; uint8_t first_layer;
/// codeword this transport block is mapped to /// codeword this transport block is mapped to
uint8_t codeword; uint8_t codeword;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
#ifdef Rel14 #ifdef Rel14
/// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling /// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling
uint8_t sib1_br_flag; uint8_t sib1_br_flag;
@@ -279,7 +279,7 @@ typedef struct {
/// Allocated RNTI (0 means DLSCH_t is not currently used) /// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t rnti; uint16_t rnti;
/// Active flag for baseband transmitter processing /// Active flag for baseband transmitter processing
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
uint8_t active[10]; uint8_t active[10];
#else #else
uint8_t active; uint8_t active;
@@ -291,7 +291,7 @@ typedef struct {
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK. /// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
uint8_t nCCE[10]; uint8_t nCCE[10];
/// Process ID's per subframe. Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids /// Process ID's per subframe. Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids
uint8_t harq_ids[10]; uint8_t harq_ids[2][10];
/// Window size (in outgoing transport blocks) for fine-grain rate adaptation /// Window size (in outgoing transport blocks) for fine-grain rate adaptation
uint8_t ra_window_size; uint8_t ra_window_size;
/// First-round error threshold for fine-grain rate adaptation /// First-round error threshold for fine-grain rate adaptation
@@ -314,7 +314,7 @@ typedef struct {
int16_t sqrt_rho_a; int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots /// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b; int16_t sqrt_rho_b;
#ifndef UE_EXPANSION #ifndef PHY_TX_THREAD
#ifdef Rel14 #ifdef Rel14
/// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling /// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling
uint8_t sib1_br_flag; uint8_t sib1_br_flag;
+15 -7
View File
@@ -167,8 +167,8 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
}*/ }*/
for (i=0; i<10; i++) for (i=0; i<20; i++)
dlsch->harq_ids[i] = Mdlharq; dlsch->harq_ids[i/10][i%10] = Mdlharq;
for (i=0; i<Mdlharq; i++) { for (i=0; i<Mdlharq; i++) {
dlsch->harq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t)); dlsch->harq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t));
@@ -246,7 +246,7 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
if (dlsch) { if (dlsch) {
Mdlharq = dlsch->Mdlharq; Mdlharq = dlsch->Mdlharq;
dlsch->rnti = 0; dlsch->rnti = 0;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
for (i=0; i<10; i++) for (i=0; i<10; i++)
dlsch->active[i] = 0; dlsch->active[i] = 0;
#else #else
@@ -254,8 +254,8 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
#endif #endif
dlsch->harq_mask = 0; dlsch->harq_mask = 0;
for (i=0; i<10; i++) for (i=0; i<20; i++)
dlsch->harq_ids[i] = Mdlharq; dlsch->harq_ids[i/10][i%10] = Mdlharq;
for (i=0; i<Mdlharq; i++) { for (i=0; i<Mdlharq; i++) {
if (dlsch->harq_processes[i]) { if (dlsch->harq_processes[i]) {
@@ -399,7 +399,11 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
unsigned int crc=1; unsigned int crc=1;
unsigned short iind; unsigned short iind;
unsigned char harq_pid = dlsch->harq_ids[subframe]; unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
if(harq_pid >= dlsch->Mdlharq) {
LOG_E(PHY,"dlsch_encoding_2threads illegal harq_pid %d\n", harq_pid);
return(-1);
}
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb; unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
unsigned int A; unsigned int A;
unsigned char mod_order; unsigned char mod_order;
@@ -583,7 +587,11 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
unsigned short iind; unsigned short iind;
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
unsigned char harq_pid = dlsch->harq_ids[subframe]; unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
if(harq_pid >= dlsch->Mdlharq) {
LOG_E(PHY,"dlsch_encoding illegal harq_pid %d\n", harq_pid);
return(-1);
}
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb; unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
unsigned int A; unsigned int A;
unsigned char mod_order; unsigned char mod_order;
@@ -1990,6 +1990,7 @@ inline int check_skip_dc(int rb,LTE_DL_FRAME_PARMS *frame_parms) {
int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
int32_t **txdataF, int32_t **txdataF,
int16_t amp, int16_t amp,
int frame,
uint32_t subframe_offset, uint32_t subframe_offset,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch0, LTE_eNB_DLSCH_t *dlsch0,
@@ -2062,7 +2063,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
if ((dlsch0 != NULL) && (dlsch1 != NULL)){ if ((dlsch0 != NULL) && (dlsch1 != NULL)){
harq_pid = dlsch0->harq_ids[subframe_offset]; harq_pid = dlsch0->harq_ids[frame%2][subframe_offset];
if(harq_pid >= dlsch0->Mdlharq) { if(harq_pid >= dlsch0->Mdlharq) {
LOG_E(PHY,"illegal harq_pid %d\n", harq_pid); LOG_E(PHY,"illegal harq_pid %d\n", harq_pid);
return(-1); return(-1);
@@ -2083,7 +2084,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
}else if ((dlsch0 != NULL) && (dlsch1 == NULL)){ }else if ((dlsch0 != NULL) && (dlsch1 == NULL)){
harq_pid = dlsch0->harq_ids[subframe_offset]; harq_pid = dlsch0->harq_ids[frame%2][subframe_offset];
if(harq_pid >= dlsch0->Mdlharq) { if(harq_pid >= dlsch0->Mdlharq) {
LOG_E(PHY,"illegal harq_pid %d\n", harq_pid); LOG_E(PHY,"illegal harq_pid %d\n", harq_pid);
return(-1); return(-1);
@@ -2104,7 +2105,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
}else if ((dlsch0 == NULL) && (dlsch1 != NULL)){ }else if ((dlsch0 == NULL) && (dlsch1 != NULL)){
harq_pid = dlsch1->harq_ids[subframe_offset]; harq_pid = dlsch1->harq_ids[frame%2][subframe_offset];
if(harq_pid >= dlsch1->Mdlharq) { if(harq_pid >= dlsch1->Mdlharq) {
LOG_E(PHY,"illegal harq_pid %d\n", harq_pid); LOG_E(PHY,"illegal harq_pid %d\n", harq_pid);
return(-1); return(-1);
@@ -92,19 +92,19 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t Nacc=4; uint8_t Nacc=4;
uint16_t j0,j,idelta; uint16_t j0,j,idelta;
uint16_t i = (Ns>>1) + (10*frame); uint16_t i = (Ns>>1) + (10*frame);
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
uint16_t i0 = dlsch->harq_processes[harq_pid]->i0; uint16_t i0 = dlsch->harq_processes[harq_pid]->i0;
#else #else
uint16_t i0 = dlsch->i0; uint16_t i0 = dlsch->i0;
#endif #endif
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
if (dlsch->harq_processes[harq_pid]->sib1_br_flag==1) Nacc=1; if (dlsch->harq_processes[harq_pid]->sib1_br_flag==1) Nacc=1;
#else #else
if (dlsch->sib1_br_flag==1) Nacc=1; if (dlsch->sib1_br_flag==1) Nacc=1;
#endif #endif
else if (dlsch->rnti == 0xFFFF || dlsch->rnti == 0xFFFE) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4; else if (dlsch->rnti == 0xFFFF || dlsch->rnti == 0xFFFE) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
// Note: above SC-RNTI will also have to be added when/if implemented // Note: above SC-RNTI will also have to be added when/if implemented
else if (dlsch->harq_processes[harq_pid]->CEmode == CEmodeA) Nacc=1; else if (dlsch->harq_processes[harq_pid]->CEmode == CEmodeA) Nacc=1;
else if (dlsch->harq_processes[harq_pid]->CEmode == CEmodeB) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4; else if (dlsch->harq_processes[harq_pid]->CEmode == CEmodeB) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4;
@@ -125,7 +125,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
// x1 is set in lte_gold_generic // x1 is set in lte_gold_generic
if (mbsfn_flag == 0) { if (mbsfn_flag == 0) {
#ifdef Rel14 #ifdef Rel14
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
if (dlsch->harq_processes[harq_pid]->i0 != 0xFFFF) { if (dlsch->harq_processes[harq_pid]->i0 != 0xFFFF) {
#else #else
if (dlsch->i0 != 0xFFFF) { if (dlsch->i0 != 0xFFFF) {
+1 -8
View File
@@ -290,6 +290,7 @@ int32_t allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
int32_t dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, int32_t dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
int32_t **txdataF, int32_t **txdataF,
int16_t amp, int16_t amp,
int frame,
uint32_t sub_frame_offset, uint32_t sub_frame_offset,
uint8_t num_pdcch_symbols, uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch0, LTE_eNB_DLSCH_t *dlsch0,
@@ -2259,18 +2260,10 @@ uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n); uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n);
#ifndef UE_EXPANSION
int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
int8_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
int8_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
#else
int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type);
int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type); int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type);
#endif
/**@}*/ /**@}*/
#endif #endif
+1 -9
View File
@@ -788,18 +788,10 @@ void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL)
} }
#ifndef UE_EXPANSION
int8_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) {
#else
int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) { int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) {
#endif
#ifndef UE_EXPANSION
uint8_t i;
int8_t first_free_index=-1;
#else
uint16_t i; uint16_t i;
int16_t first_free_index=-1; int16_t first_free_index=-1;
#endif
AssertFatal(eNB!=NULL,"eNB is null\n"); AssertFatal(eNB!=NULL,"eNB is null\n");
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
if ((eNB->uci_vars[i].active >0) && if ((eNB->uci_vars[i].active >0) &&
+2 -6
View File
@@ -934,9 +934,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
nb_rb); nb_rb);
//#endif //#endif
#ifndef UE_EXPANSION //if (ulsch_harq->round == 0) { // delete for RB shortage pattern
if (ulsch_harq->round == 0) {
#endif
// This is a new packet, so compute quantities regarding segmentation // This is a new packet, so compute quantities regarding segmentation
ulsch_harq->B = A+24; ulsch_harq->B = A+24;
lte_segmentation(NULL, lte_segmentation(NULL,
@@ -949,9 +947,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
&ulsch_harq->Kminus, &ulsch_harq->Kminus,
&ulsch_harq->F); &ulsch_harq->F);
// CLEAR LLR's HERE for first packet in process // CLEAR LLR's HERE for first packet in process
#ifndef UE_EXPANSION //}
}
#endif
// printf("after segmentation c[%d] = %p\n",0,ulsch_harq->c[0]); // printf("after segmentation c[%d] = %p\n",0,ulsch_harq->c[0]);
sumKr = 0; sumKr = 0;
+13 -11
View File
@@ -1035,6 +1035,11 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
#if defined(__x86_64__) || defined(__i386__)
__m128 avg128U;
#elif defined(__arm__)
int32x4_t avg128U;
#endif
void ulsch_channel_level(int32_t **drs_ch_estimates_ext, void ulsch_channel_level(int32_t **drs_ch_estimates_ext,
LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_FRAME_PARMS *frame_parms,
@@ -1045,24 +1050,21 @@ void ulsch_channel_level(int32_t **drs_ch_estimates_ext,
int16_t rb; int16_t rb;
uint8_t aarx; uint8_t aarx;
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
__m128i avg128U;
__m128i *ul_ch128; __m128i *ul_ch128;
#elif defined(__arm__) #elif defined(__arm__)
int16x4_t *ul_ch128; int16x4_t *ul_ch128;
int32x4_t avg128U;
#endif #endif
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
//clear average level //clear average level
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
avg128U = _mm_setzero_si128(); avg128U = _mm_setzero_ps();
ul_ch128=(__m128i *)drs_ch_estimates_ext[aarx]; ul_ch128=(__m128i *)drs_ch_estimates_ext[aarx];
for (rb=0; rb<nb_rb; rb++) { for (rb=0; rb<nb_rb; rb++) {
avg128U = _mm_add_epi32(avg128U,_mm_madd_epi16(ul_ch128[0],ul_ch128[0])); avg128U = _mm_add_ps(avg128U,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch128[0],ul_ch128[0])));
avg128U = _mm_add_epi32(avg128U,_mm_madd_epi16(ul_ch128[1],ul_ch128[1])); avg128U = _mm_add_ps(avg128U,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch128[1],ul_ch128[1])));
avg128U = _mm_add_epi32(avg128U,_mm_madd_epi16(ul_ch128[2],ul_ch128[2])); avg128U = _mm_add_ps(avg128U,_mm_cvtepi32_ps(_mm_madd_epi16(ul_ch128[2],ul_ch128[2])));
ul_ch128+=3; ul_ch128+=3;
@@ -1089,10 +1091,10 @@ void ulsch_channel_level(int32_t **drs_ch_estimates_ext,
#endif #endif
DevAssert( nb_rb ); DevAssert( nb_rb );
avg[aarx] = (((int*)&avg128U)[0] + avg[aarx] = (int)((((float*)&avg128U)[0] +
((int*)&avg128U)[1] + ((float*)&avg128U)[1] +
((int*)&avg128U)[2] + ((float*)&avg128U)[2] +
((int*)&avg128U)[3])/(nb_rb*12); ((float*)&avg128U)[3])/(float)(nb_rb*12));
} }
+2 -2
View File
@@ -422,7 +422,7 @@ typedef struct RU_proc_t_s {
int num_slaves; int num_slaves;
/// array of pointers to slaves /// array of pointers to slaves
struct RU_proc_t_s **slave_proc; struct RU_proc_t_s **slave_proc;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
/// pthread structure for PRACH thread /// pthread structure for PRACH thread
pthread_t pthread_phy_tx; pthread_t pthread_phy_tx;
pthread_mutex_t mutex_phy_tx; pthread_mutex_t mutex_phy_tx;
@@ -442,7 +442,7 @@ typedef struct RU_proc_t_s {
/// \internal This variable is protected by \ref mutex_rf_tx. /// \internal This variable is protected by \ref mutex_rf_tx.
int instance_cnt_rf_tx; int instance_cnt_rf_tx;
#endif #endif
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2) #if defined(PRE_SCD_THREAD)
pthread_t pthread_pre_scd; pthread_t pthread_pre_scd;
/// condition variable for time processing thread /// condition variable for time processing thread
pthread_cond_t cond_pre_scd; pthread_cond_t cond_pre_scd;
+1 -2
View File
@@ -637,9 +637,8 @@ typedef struct {
uint16_t phich_reg[MAX_NUM_PHICH_GROUPS][3]; uint16_t phich_reg[MAX_NUM_PHICH_GROUPS][3];
struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[MAX_MBSFN_AREA]; struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[MAX_MBSFN_AREA];
#ifdef UE_EXPANSION /// for fair RR scheduler
uint32_t ue_multiple_max; uint32_t ue_multiple_max;
#endif
} LTE_DL_FRAME_PARMS; } LTE_DL_FRAME_PARMS;
typedef enum { typedef enum {
-4
View File
@@ -511,11 +511,7 @@ LTE_DL_FRAME_PARMS *get_lte_frame_parms(module_id_t Mod_id, uint8_t CC_id);
MU_MIMO_mode* get_mu_mimo_mode (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti); MU_MIMO_mode* get_mu_mimo_mode (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti);
int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t harq_pid); int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t harq_pid);
#ifndef UE_EXPANSION
int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t harq_pid, uint8_t bw_factor);
#else
int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint16_t UE_id,uint8_t harq_pid, uint8_t bw_factor); int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint16_t UE_id,uint8_t harq_pid, uint8_t bw_factor);
#endif
int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid); int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid);
int16_t get_target_pusch_rx_power(module_id_t module_idP, uint8_t CC_id); int16_t get_target_pusch_rx_power(module_id_t module_idP, uint8_t CC_id);
+36 -31
View File
@@ -165,24 +165,24 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_pr
dlsch1 = eNB->dlsch[UE_id][1]; dlsch1 = eNB->dlsch[UE_id][1];
#ifdef Rel14 #ifdef Rel14
if ((rel13->pdsch_payload_type < 2) && (rel13->ue_type>0)) dlsch0->harq_ids[subframe] = 0; if ((rel13->pdsch_payload_type < 2) && (rel13->ue_type>0)) dlsch0->harq_ids[frame%2][subframe] = 0;
#endif #endif
harq_pid = dlsch0->harq_ids[subframe]; harq_pid = dlsch0->harq_ids[frame%2][subframe];
AssertFatal((harq_pid>=0) && (harq_pid<8),"harq_pid %d not in 0...7 frame:%d subframe:%d subframe(TX):%d rnti:%x UE_id:%d dlsch0[harq_ids:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d]\n", AssertFatal((harq_pid>=0) && (harq_pid<8),"harq_pid %d not in 0...7 frame:%d subframe:%d subframe(TX):%d rnti:%x UE_id:%d dlsch0[harq_ids:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d]\n",
harq_pid, harq_pid,
frame,subframe, frame,subframe,
proc->subframe_tx,rel8->rnti,UE_id, proc->subframe_tx,rel8->rnti,UE_id,
dlsch0->harq_ids[0], dlsch0->harq_ids[frame%2][0],
dlsch0->harq_ids[1], dlsch0->harq_ids[frame%2][1],
dlsch0->harq_ids[2], dlsch0->harq_ids[frame%2][2],
dlsch0->harq_ids[3], dlsch0->harq_ids[frame%2][3],
dlsch0->harq_ids[4], dlsch0->harq_ids[frame%2][4],
dlsch0->harq_ids[5], dlsch0->harq_ids[frame%2][5],
dlsch0->harq_ids[6], dlsch0->harq_ids[frame%2][6],
dlsch0->harq_ids[7], dlsch0->harq_ids[frame%2][7],
dlsch0->harq_ids[8], dlsch0->harq_ids[frame%2][8],
dlsch0->harq_ids[9] dlsch0->harq_ids[frame%2][9]
); );
dlsch0_harq = dlsch0->harq_processes[harq_pid]; dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid]; dlsch1_harq = dlsch1->harq_processes[harq_pid];
@@ -191,7 +191,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_pr
// compute DL power control parameters // compute DL power control parameters
eNB->pdsch_config_dedicated[UE_id].p_a = rel8->pa; eNB->pdsch_config_dedicated[UE_id].p_a = rel8->pa;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
if (dlsch0->active[proc->subframe_tx]){ if (dlsch0->active[proc->subframe_tx]){
# else # else
if (dlsch0->active){ if (dlsch0->active){
@@ -199,7 +199,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_pr
computeRhoA_eNB(&eNB->pdsch_config_dedicated[UE_id], dlsch0,dlsch0_harq->dl_power_off, eNB->frame_parms.nb_antenna_ports_eNB); computeRhoA_eNB(&eNB->pdsch_config_dedicated[UE_id], dlsch0,dlsch0_harq->dl_power_off, eNB->frame_parms.nb_antenna_ports_eNB);
computeRhoB_eNB(&eNB->pdsch_config_dedicated[UE_id],&(eNB->frame_parms.pdsch_config_common),eNB->frame_parms.nb_antenna_ports_eNB,dlsch0,dlsch0_harq->dl_power_off); computeRhoB_eNB(&eNB->pdsch_config_dedicated[UE_id],&(eNB->frame_parms.pdsch_config_common),eNB->frame_parms.nb_antenna_ports_eNB,dlsch0,dlsch0_harq->dl_power_off);
} }
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
if (dlsch1->active[proc->subframe_tx]){ if (dlsch1->active[proc->subframe_tx]){
#else #else
if (dlsch1->active){ if (dlsch1->active){
@@ -231,7 +231,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_pr
} }
#ifdef Rel14 #ifdef Rel14
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0_harq->sib1_br_flag=0; dlsch0_harq->sib1_br_flag=0;
#else #else
dlsch0->sib1_br_flag=0; dlsch0->sib1_br_flag=0;
@@ -243,7 +243,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_pr
dlsch0->Mdlharq = 4; dlsch0->Mdlharq = 4;
dlsch0->Nsoft = 25344; dlsch0->Nsoft = 25344;
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
if (rel13->pdsch_payload_type == 0) dlsch0_harq->sib1_br_flag=1; if (rel13->pdsch_payload_type == 0) dlsch0_harq->sib1_br_flag=1;
#else #else
if (rel13->pdsch_payload_type == 0) dlsch0->sib1_br_flag=1; if (rel13->pdsch_payload_type == 0) dlsch0->sib1_br_flag=1;
@@ -274,7 +274,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_pr
dlsch0_harq->rb_alloc[3] = localRIV2alloc_LUT100_3[rel8->resource_block_coding]; dlsch0_harq->rb_alloc[3] = localRIV2alloc_LUT100_3[rel8->resource_block_coding];
} }
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0->active[proc->subframe_tx]= 1; dlsch0->active[proc->subframe_tx]= 1;
#else #else
dlsch0->active = 1; dlsch0->active = 1;
@@ -294,21 +294,21 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_pr
dlsch0_harq->pdsch_start = rel10->pdsch_start; dlsch0_harq->pdsch_start = rel10->pdsch_start;
} }
else { else {
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0_harq->i0 = 0xFFFF; dlsch0_harq->i0 = 0xFFFF;
#else #else
dlsch0->i0 = 0xFFFF; dlsch0->i0 = 0xFFFF;
#endif #endif
} }
#endif #endif
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0_harq->i0 = rel13->initial_transmission_sf_io; dlsch0_harq->i0 = rel13->initial_transmission_sf_io;
#else #else
dlsch0->i0 = rel13->initial_transmission_sf_io; dlsch0->i0 = rel13->initial_transmission_sf_io;
#endif #endif
LOG_D(PHY,"dlsch->i0:%04x dlsch0_harq[pdsch_start:%d nb_rb:%d vrb_type:%d rvidx:%d Nl:%d mimo_mode:%d dl_power_off:%d round:%d status:%d TBS:%d Qm:%d codeword:%d rb_alloc:%d] rel8[length:%d]\n", LOG_D(PHY,"dlsch->i0:%04x dlsch0_harq[pdsch_start:%d nb_rb:%d vrb_type:%d rvidx:%d Nl:%d mimo_mode:%d dl_power_off:%d round:%d status:%d TBS:%d Qm:%d codeword:%d rb_alloc:%d] rel8[length:%d]\n",
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch0_harq->i0, dlsch0_harq->i0,
#else #else
dlsch0->i0, dlsch0->i0,
@@ -339,6 +339,9 @@ void handle_ulsch_harq_pdu(
ulsch_harq->subframe = subframe; ulsch_harq->subframe = subframe;
ulsch_harq->O_ACK = harq_information->harq_information_rel10.harq_size; ulsch_harq->O_ACK = harq_information->harq_information_rel10.harq_size;
ulsch->beta_offset_harqack_times8 = to_beta_offset_harqack[harq_information->harq_information_rel10.delta_offset_harq]; ulsch->beta_offset_harqack_times8 = to_beta_offset_harqack[harq_information->harq_information_rel10.delta_offset_harq];
if (harq_information->harq_information_rel10.ack_nack_mode==0) //bundling
ulsch->bundling = 1;
} }
uint16_t to_beta_offset_ri[16]={9,13,16,20,25,32,40,50,64,80,101,127,160,0,0,0}; uint16_t to_beta_offset_ri[16]={9,13,16,20,25,32,40,50,64,80,101,127,160,0,0,0};
@@ -563,11 +566,7 @@ void handle_nfapi_ul_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
uint16_t frame,uint8_t subframe,uint8_t srs_present) uint16_t frame,uint8_t subframe,uint8_t srs_present)
{ {
nfapi_ul_config_ulsch_pdu_rel8_t *rel8 = &ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8; nfapi_ul_config_ulsch_pdu_rel8_t *rel8 = &ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8;
#ifndef UE_EXPANSION
int8_t UE_id;
#else
int16_t UE_id; int16_t UE_id;
#endif
// check if we have received a dci for this ue and ulsch descriptor is configured // check if we have received a dci for this ue and ulsch descriptor is configured
@@ -686,13 +685,19 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
eNB->pdcch_vars[subframe&1].num_dci = 0; eNB->pdcch_vars[subframe&1].num_dci = 0;
eNB->phich_vars[subframe&1].num_hi = 0; eNB->phich_vars[subframe&1].num_hi = 0;
LOG_D(PHY,"NFAPI: Sched_INFO:SFN/SF:%04d%d DL_req:SFN/SF:%04d%d:dl_pdu:%d tx_req:SFN/SF:%04d%d:pdus:%d hi_dci0:SFN/SF:%04d%d:pdus:%d ul_cfg:SFN/SF:%04d%d:pdus:%d num_pdcch_symbols:%d\n", LOG_D(PHY,"NFAPI: Sched_INFO:SFN/SF:%04d%d DL_req:SFN/SF:%04d%d:dl_pdu:%d tx_req:SFN/SF:%04d%d:pdus:%d\n",
frame,subframe, frame,subframe,
NFAPI_SFNSF2SFN(DL_req->sfn_sf),NFAPI_SFNSF2SF(DL_req->sfn_sf),number_dl_pdu, NFAPI_SFNSF2SFN(DL_req->sfn_sf),NFAPI_SFNSF2SF(DL_req->sfn_sf),number_dl_pdu,
NFAPI_SFNSF2SFN(TX_req->sfn_sf),NFAPI_SFNSF2SF(TX_req->sfn_sf),TX_req->tx_request_body.number_of_pdus, NFAPI_SFNSF2SFN(TX_req->sfn_sf),NFAPI_SFNSF2SF(TX_req->sfn_sf),TX_req->tx_request_body.number_of_pdus
NFAPI_SFNSF2SFN(HI_DCI0_req->sfn_sf),NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf),number_hi_dci0_pdu, );
NFAPI_SFNSF2SFN(UL_req->sfn_sf),NFAPI_SFNSF2SF(UL_req->sfn_sf),number_ul_pdu, LOG_D(PHY,"NFAPI: hi_dci0:SFN/SF:%04d%d:pdus:%d\n",
eNB->pdcch_vars[subframe&1].num_pdcch_symbols); NFAPI_SFNSF2SFN(HI_DCI0_req->sfn_sf),NFAPI_SFNSF2SF(HI_DCI0_req->sfn_sf),number_hi_dci0_pdu
);
if(UL_req!=NULL)
LOG_D(PHY,"NFAPI: ul_cfg:SFN/SF:%04d%d:pdus:%d num_pdcch_symbols:%d\n",
NFAPI_SFNSF2SFN(UL_req->sfn_sf),NFAPI_SFNSF2SF(UL_req->sfn_sf),number_ul_pdu,
eNB->pdcch_vars[subframe&1].num_pdcch_symbols);
int do_oai =0; int do_oai =0;
int dont_send =0; int dont_send =0;
+40 -17
View File
@@ -336,6 +336,29 @@ unsigned char ul_ACK_subframe2_dl_subframe(LTE_DL_FRAME_PARMS *frame_parms,unsig
return(0); return(0);
} }
int ul_ACK_subframe2_dl_frame(LTE_DL_FRAME_PARMS *frame_parms,int frame, unsigned char subframe,unsigned char subframe_tx)
{
if (frame_parms->frame_type == FDD) {
return (((subframe_tx > subframe ) ? frame-1 : frame)+1024)%1024;
} else {
switch (frame_parms->tdd_config) {
case 1:
return(((subframe_tx > subframe ) ? frame-1 : frame)+1024)%1024;
break;
case 3:
//TODO
break;
case 4:
//TODO
break;
}
}
return(0);
}
unsigned char ul_ACK_subframe2_M(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) unsigned char ul_ACK_subframe2_M(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe)
{ {
@@ -343,6 +366,23 @@ unsigned char ul_ACK_subframe2_M(LTE_DL_FRAME_PARMS *frame_parms,unsigned char s
return(1); return(1);
} else { } else {
switch (frame_parms->tdd_config) { switch (frame_parms->tdd_config) {
case 1:
return 1; // don't ACK special subframe for now
if (subframe == 2) { // ACK subframes 5 and 6
return(2);
} else if (subframe == 3) { // ACK subframe 9
return(1); // To be updated
} else if (subframe == 7) { // ACK subframes 0 and 1
return(2); // To be updated
} else if (subframe == 8) { // ACK subframe 4
return(1); // To be updated
} else {
LOG_E(PHY,"phy_procedures_lte_common.c/subframe2_dl_harq_pid: illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config);
return(0);
}
break;
case 3: case 3:
if (subframe == 2) { // ACK subframes 5 and 6 if (subframe == 2) { // ACK subframes 5 and 6
return(2); // should be 3 return(2); // should be 3
@@ -381,23 +421,6 @@ unsigned char ul_ACK_subframe2_M(LTE_DL_FRAME_PARMS *frame_parms,unsigned char s
} }
break; break;
case 1:
if (subframe == 2) { // ACK subframes 5 and 6
return(2);
} else if (subframe == 3) { // ACK subframe 9
return(1); // To be updated
} else if (subframe == 7) { // ACK subframes 0 and 1
return(2); // To be updated
} else if (subframe == 8) { // ACK subframe 4
return(1); // To be updated
} else {
LOG_E(PHY,"phy_procedures_lte_common.c/subframe2_dl_harq_pid: illegal subframe %d for tdd_config %d\n",
subframe,frame_parms->tdd_config);
return(0);
}
break;
} }
} }
+88 -27
View File
@@ -149,10 +149,20 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) {
// generate Cell-Specific Reference Signals for both slots // generate Cell-Specific Reference Signals for both slots
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1);
if(subframe_select(fp,subframe) == SF_S)
generate_pilots_slot(eNB,
txdataF,
AMP,
subframe<<1,1);
else
generate_pilots_slot(eNB, generate_pilots_slot(eNB,
txdataF, txdataF,
AMP, AMP,
subframe<<1,0); subframe<<1,0);
// check that 2nd slot is for DL
// check that 2nd slot is for DL // check that 2nd slot is for DL
if (subframe_select(fp,subframe) == SF_DL) if (subframe_select(fp,subframe) == SF_DL)
generate_pilots_slot(eNB, generate_pilots_slot(eNB,
@@ -379,6 +389,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,
dlsch_modulation(eNB, dlsch_modulation(eNB,
eNB->common_vars.txdataF, eNB->common_vars.txdataF,
AMP, AMP,
frame,
subframe, subframe,
dlsch_harq->pdsch_start, dlsch_harq->pdsch_start,
dlsch, dlsch,
@@ -386,7 +397,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,
stop_meas(&eNB->dlsch_modulation_stats); stop_meas(&eNB->dlsch_modulation_stats);
} }
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
dlsch->active[subframe] = 0; dlsch->active[subframe] = 0;
#else #else
dlsch->active = 0; dlsch->active = 0;
@@ -409,11 +420,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
int subframe=proc->subframe_tx; int subframe=proc->subframe_tx;
uint32_t i,aa; uint32_t i,aa;
uint8_t harq_pid; uint8_t harq_pid;
#ifndef UE_EXPANSION
int8_t UE_id=0;
#else
int16_t UE_id=0; int16_t UE_id=0;
#endif
uint8_t num_pdcch_symbols=0; uint8_t num_pdcch_symbols=0;
uint8_t num_dci=0; uint8_t num_dci=0;
uint8_t ul_subframe; uint8_t ul_subframe;
@@ -533,14 +540,14 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
if ((dlsch0)&& if ((dlsch0)&&
(dlsch0->rnti>0)&& (dlsch0->rnti>0)&&
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
(dlsch0->active[subframe] == 1)) { (dlsch0->active[subframe] == 1)) {
#else #else
(dlsch0->active == 1)) { (dlsch0->active == 1)) {
#endif #endif
// get harq_pid // get harq_pid
harq_pid = dlsch0->harq_ids[subframe]; harq_pid = dlsch0->harq_ids[frame%2][subframe];
AssertFatal(harq_pid>=0,"harq_pid is negative\n"); AssertFatal(harq_pid>=0,"harq_pid is negative\n");
if (harq_pid>=8) if (harq_pid>=8)
@@ -565,7 +572,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
else if ((dlsch0)&& else if ((dlsch0)&&
(dlsch0->rnti>0)&& (dlsch0->rnti>0)&&
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
(dlsch0->active[subframe] == 0)) { (dlsch0->active[subframe] == 0)) {
#else #else
(dlsch0->active == 0)) { (dlsch0->active == 0)) {
@@ -878,7 +885,7 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
LOG_E(PHY,"Unknown number for N_RB_UL %d\n",fp->N_RB_UL); LOG_E(PHY,"Unknown number for N_RB_UL %d\n",fp->N_RB_UL);
break; break;
} }
SR_payload = 0;
switch (uci->type) { switch (uci->type) {
case SR: case SR:
case HARQ_SR: case HARQ_SR:
@@ -893,12 +900,13 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
frame, frame,
subframe, subframe,
PUCCH1_THRES); PUCCH1_THRES);
LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d Checking SR is %d (SR n1pucch is %d)\n", LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d Checking SR is %d (uci.type %d SR n1pucch is %d)\n",
eNB->Mod_id, eNB->Mod_id,
uci->rnti, uci->rnti,
frame, frame,
subframe, subframe,
SR_payload, SR_payload,
uci->type,
uci->n_pucch_1_0_sr[0]); uci->n_pucch_1_0_sr[0]);
if (uci->type == SR) { if (uci->type == SR) {
if (SR_payload == 1) { if (SR_payload == 1) {
@@ -961,8 +969,34 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
} }
else { // frame_type == TDD else { // frame_type == TDD
#if 1
metric[0] = rx_pucch(eNB,
uci->pucch_fmt,
i,
uci->n_pucch_1[0][0],
0, //n2_pucch
uci->srs_active, // shortened format
pucch_b0b1[0],
frame,
subframe,
PUCCH1a_THRES);
if (uci->type==HARQ_SR && metric[0] > metric_SR) SR_payload = 0;
else if (SR_payload == 1) fill_sr_indication(eNB,uci->rnti,frame,subframe,metric_SR);
if (uci->type==HARQ_SR && metric[0] <= metric_SR) {
SR_payload = 1;
metric[0] = rx_pucch(eNB,
pucch_format1b,
i,
uci->n_pucch_1_0_sr[0],
0, //n2_pucch
uci->srs_active, // shortened format
pucch_b0b1[0],
frame,
subframe,
PUCCH1a_THRES);
}
#else
// if SR was detected, use the n1_pucch from SR // if SR was detected, use the n1_pucch from SR
if (SR_payload==1) { if (SR_payload==1) {
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
@@ -1009,22 +1043,25 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
} }
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"RNTI %x type %d SR_payload %d Frame %d Subframe %d pucch_b0b1[0][0] %d pucch_b0b1[0][1] %d pucch_b0b1[1][0] %d pucch_b0b1[1][1] %d \n",
uci->rnti,uci->type,SR_payload,frame,subframe,pucch_b0b1[0][0],pucch_b0b1[0][1],pucch_b0b1[1][0],pucch_b0b1[1][1]);
#endif
#endif
if (SR_payload == 1) { // this implements Table 7.3.1 from 36.213 if (SR_payload == 1) { // this implements Table 7.3.1 from 36.213
if (pucch_b0b1[0][0] == 4) { // there isn't a likely transmission if (pucch_b0b1[0][0] == 4) { // there isn't a likely transmission
harq_ack[0] = 4; // DTX harq_ack[0] = 4; // DTX
} }
else if (pucch_b0b1[1][0] == 1 && pucch_b0b1[1][1] == 1) { // 1/4/7 ACKs else if (pucch_b0b1[0][0] == 1 && pucch_b0b1[0][1] == 1) { // 1/4/7 ACKs
harq_ack[0] = 1; harq_ack[0] = 1;
} }
else if (pucch_b0b1[1][0] == 1 && pucch_b0b1[1][1] != 1) { // 2/5/8 ACKs else if (pucch_b0b1[0][0] == 1 && pucch_b0b1[0][1] != 1) { // 2/5/8 ACKs
harq_ack[0] = 2; harq_ack[0] = 2;
} }
else if (pucch_b0b1[1][0] != 1 && pucch_b0b1[1][1] == 1) { // 3/6/9 ACKs else if (pucch_b0b1[0][0] != 1 && pucch_b0b1[0][1] == 1) { // 3/6/9 ACKs
harq_ack[0] = 3; harq_ack[0] = 3;
} }
else if (pucch_b0b1[1][0] != 1 && pucch_b0b1[1][1] != 1) { // 0 ACKs, or at least one DL assignment missed else if (pucch_b0b1[0][0] != 1 && pucch_b0b1[0][1] != 1) { // 0 ACKs, or at least one DL assignment missed
harq_ack[0] = 0; harq_ack[0] = 0;
} }
uci->stat = metric[0]; uci->stat = metric[0];
@@ -1340,8 +1377,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
const int subframe = proc->subframe_rx; const int subframe = proc->subframe_rx;
const int frame = proc->frame_rx; const int frame = proc->frame_rx;
if (fp->frame_type == FDD) harq_pid = ((10*frame) + subframe)&7; harq_pid = subframe2harq_pid(&eNB->frame_parms,frame,subframe);
else harq_pid = subframe%10;
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
ulsch = eNB->ulsch[i]; ulsch = eNB->ulsch[i];
@@ -1433,6 +1469,13 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
fill_ulsch_cqi_indication(eNB,frame,subframe, fill_ulsch_cqi_indication(eNB,frame,subframe,
ulsch_harq, ulsch_harq,
ulsch->rnti); ulsch->rnti);
RC.mac[eNB->Mod_id]->UE_list.UE_sched_ctrl[i].cqi_req_flag &= (~(1 << subframe));
}else{
if(RC.mac[eNB->Mod_id]->UE_list.UE_sched_ctrl[i].cqi_req_flag & (1 << subframe) ){
RC.mac[eNB->Mod_id]->UE_list.UE_sched_ctrl[i].cqi_req_flag &= (~(1 << subframe));
RC.mac[eNB->Mod_id]->UE_list.UE_sched_ctrl[i].cqi_req_timer=30;
LOG_D(PHY,"Frame %d,Subframe %d, We're supposed to get a cqi here. Set cqi_req_timer to 30.\n",frame,subframe);
}
} }
if (ret == (1+MAX_TURBO_ITERATIONS)) { if (ret == (1+MAX_TURBO_ITERATIONS)) {
@@ -1638,7 +1681,7 @@ void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subf
LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL; LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL;
LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL; LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL;
int harq_pid; int harq_pid;
int subframe_tx; int subframe_tx,frame_tx;
int M,m; int M,m;
AssertFatal(UE_id!=-1,"no existing dlsch context\n"); AssertFatal(UE_id!=-1,"no existing dlsch context\n");
@@ -1648,7 +1691,9 @@ void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subf
if (eNB->frame_parms.frame_type == FDD) { if (eNB->frame_parms.frame_type == FDD) {
subframe_tx = (subframe+6)%10; subframe_tx = (subframe+6)%10;
harq_pid = dlsch0->harq_ids[subframe_tx]; frame_tx = ul_ACK_subframe2_dl_frame(&eNB->frame_parms,frame,subframe,subframe_tx);
harq_pid = dlsch0->harq_ids[frame_tx%2][subframe_tx]; // or just use 0 for fdd?
AssertFatal((harq_pid>=0) && (harq_pid<10),"harq_pid %d not in 0...9\n",harq_pid); AssertFatal((harq_pid>=0) && (harq_pid<10),"harq_pid %d not in 0...9\n",harq_pid);
dlsch0_harq = dlsch0->harq_processes[harq_pid]; dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid]; dlsch1_harq = dlsch1->harq_processes[harq_pid];
@@ -1671,9 +1716,10 @@ void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subf
subframe_tx = ul_ACK_subframe2_dl_subframe(&eNB->frame_parms, subframe_tx = ul_ACK_subframe2_dl_subframe(&eNB->frame_parms,
subframe, subframe,
m); m);
frame_tx = ul_ACK_subframe2_dl_frame(&eNB->frame_parms,frame,subframe,subframe_tx);
if (((1<<m)&mask) > 0) { if (((1<<m)&mask) > 0) {
harq_pid = dlsch0->harq_ids[subframe_tx]; harq_pid = dlsch0->harq_ids[frame_tx%2][subframe_tx];
if ((harq_pid>=0) && (harq_pid<10)) { if ((harq_pid>=0) && (harq_pid<dlsch0->Mdlharq)) {
dlsch0_harq = dlsch0->harq_processes[harq_pid]; dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid]; dlsch1_harq = dlsch1->harq_processes[harq_pid];
AssertFatal(dlsch0_harq!=NULL,"dlsch0_harq is null\n"); AssertFatal(dlsch0_harq!=NULL,"dlsch0_harq is null\n");
@@ -1695,7 +1741,7 @@ int getM(PHY_VARS_eNB *eNB,int frame,int subframe) {
LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL; LTE_eNB_DLSCH_t *dlsch0=NULL,*dlsch1=NULL;
LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL; LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL;
int harq_pid; int harq_pid;
int subframe_tx; int subframe_tx,frame_tx;
int m; int m;
M=ul_ACK_subframe2_M(&eNB->frame_parms, M=ul_ACK_subframe2_M(&eNB->frame_parms,
@@ -1705,7 +1751,10 @@ int getM(PHY_VARS_eNB *eNB,int frame,int subframe) {
subframe_tx = ul_ACK_subframe2_dl_subframe(&eNB->frame_parms, subframe_tx = ul_ACK_subframe2_dl_subframe(&eNB->frame_parms,
subframe, subframe,
m); m);
harq_pid = dlsch0->harq_ids[subframe_tx]; frame_tx = ul_ACK_subframe2_dl_frame(&eNB->frame_parms,frame,
subframe,subframe_tx);
harq_pid = dlsch0->harq_ids[frame_tx%2][subframe_tx];
if (harq_pid>=0 && harq_pid<10) { if (harq_pid>=0 && harq_pid<10) {
dlsch0_harq = dlsch0->harq_processes[harq_pid]; dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid]; dlsch1_harq = dlsch1->harq_processes[harq_pid];
@@ -1809,7 +1858,7 @@ void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,
for (i=0;i<ulsch_harq->O_ACK;i++) { for (i=0;i<ulsch_harq->O_ACK;i++) {
AssertFatal(ulsch_harq->o_ACK[i] == 0 || ulsch_harq->o_ACK[i] == 1, "harq_ack[%d] is %d, should be 1,2 or 4\n",i,ulsch_harq->o_ACK[i]); AssertFatal(ulsch_harq->o_ACK[i] == 0 || ulsch_harq->o_ACK[i] == 1, "harq_ack[%d] is %d, should be 1,2 or 4\n",i,ulsch_harq->o_ACK[i]);
pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = 2-ulsch_harq->o_ACK[i]; pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 2-ulsch_harq->o_ACK[i];
// release DLSCH if needed // release DLSCH if needed
if (ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff); if (ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff);
if (M==1 && ulsch_harq->O_ACK==1 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff); if (M==1 && ulsch_harq->O_ACK==1 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff);
@@ -1911,7 +1960,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
pdu->harq_indication_tdd_rel13.mode = tdd_mapping_mode; pdu->harq_indication_tdd_rel13.mode = tdd_mapping_mode;
LOG_D(PHY,"%s(eNB, uci_harq format %d, rnti:%04x, frame:%d, subframe:%d, tdd_mapping_mode:%d) harq_ack[0]:%d harq_ack[1]:%d\n", __FUNCTION__, uci->pucch_fmt,uci->rnti, frame, subframe, tdd_mapping_mode,harq_ack[0],harq_ack[1]);
switch (tdd_mapping_mode) { switch (tdd_mapping_mode) {
case 0: // bundling case 0: // bundling
@@ -1973,31 +2022,43 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
case 2: // special bundling (SR collision) case 2: // special bundling (SR collision)
pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1; pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1;
pdu->harq_indication_tdd_rel13.mode = 0;
int tdd_config5_sf2scheds=0; int tdd_config5_sf2scheds=0;
if (eNB->frame_parms.tdd_config==5) tdd_config5_sf2scheds = getM(eNB,frame,subframe); if (eNB->frame_parms.tdd_config==5) tdd_config5_sf2scheds = getM(eNB,frame,subframe);
switch (harq_ack[0]) { switch (harq_ack[0]) {
case 0: case 0:
case 4:
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0;
break; break;
case 1: // check if M=1,4,7 case 1: // check if M=1,4,7
if (uci->num_pucch_resources == 1 || uci->num_pucch_resources == 4 || if (uci->num_pucch_resources == 1 || uci->num_pucch_resources == 4 ||
tdd_config5_sf2scheds == 1 || tdd_config5_sf2scheds == 4 || tdd_config5_sf2scheds == 7) { tdd_config5_sf2scheds == 1 || tdd_config5_sf2scheds == 4 || tdd_config5_sf2scheds == 7) {
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1;
release_harq(eNB,UE_id,0,frame,subframe,0xffff); release_harq(eNB,UE_id,0,frame,subframe,0xffff);
release_harq(eNB,UE_id,1,frame,subframe,0xffff); release_harq(eNB,UE_id,1,frame,subframe,0xffff);
}else{
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0;
} }
break; break;
case 2: // check if M=2,5,8 case 2: // check if M=2,5,8
if (uci->num_pucch_resources == 2 || tdd_config5_sf2scheds == 2 || if (uci->num_pucch_resources == 2 || tdd_config5_sf2scheds == 2 ||
tdd_config5_sf2scheds == 5 || tdd_config5_sf2scheds == 8) { tdd_config5_sf2scheds == 5 || tdd_config5_sf2scheds == 8) {
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1;
release_harq(eNB,UE_id,0,frame,subframe,0xffff); release_harq(eNB,UE_id,0,frame,subframe,0xffff);
release_harq(eNB,UE_id,1,frame,subframe,0xffff); release_harq(eNB,UE_id,1,frame,subframe,0xffff);
}else{
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0;
} }
break; break;
case 3: // check if M=3,6,9 case 3: // check if M=3,6,9
if (uci->num_pucch_resources == 3 || tdd_config5_sf2scheds == 3 || if (uci->num_pucch_resources == 3 || tdd_config5_sf2scheds == 3 ||
tdd_config5_sf2scheds == 6 || tdd_config5_sf2scheds == 9) { tdd_config5_sf2scheds == 6 || tdd_config5_sf2scheds == 9) {
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1;
release_harq(eNB,UE_id,0,frame,subframe,0xffff); release_harq(eNB,UE_id,0,frame,subframe,0xffff);
release_harq(eNB,UE_id,1,frame,subframe,0xffff); release_harq(eNB,UE_id,1,frame,subframe,0xffff);
}else{
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0;
} }
break; break;
} }
-8
View File
@@ -38,11 +38,7 @@
// This is the formula from Section 5.1.1.1 in 36.213 100*10*log10((2^(MPR*Ks)-1)), where MPR is in the range [0,6] and Ks=1.25 // This is the formula from Section 5.1.1.1 in 36.213 100*10*log10((2^(MPR*Ks)-1)), where MPR is in the range [0,6] and Ks=1.25
int16_t hundred_times_delta_TF[100] = {-32768,-1268,-956,-768,-631,-523,-431,-352,-282,-219,-161,-107,-57,-9,36,79,120,159,197,234,269,304,337,370,402,434,465,495,525,555,583,612,640,668,696,723,750,777,803,829,856,881,907,933,958,983,1008,1033,1058,1083,1108,1132,1157,1181,1205,1229,1254,1278,1302,1325,1349,1373,1397,1421,1444,1468,1491,1515,1538,1562,1585,1609,1632,1655,1679,1702,1725,1748,1772,1795,1818,1841,1864,1887,1910,1933,1956,1980,2003,2026,2049,2072,2095,2118,2141,2164,2186,2209,2232,2255}; int16_t hundred_times_delta_TF[100] = {-32768,-1268,-956,-768,-631,-523,-431,-352,-282,-219,-161,-107,-57,-9,36,79,120,159,197,234,269,304,337,370,402,434,465,495,525,555,583,612,640,668,696,723,750,777,803,829,856,881,907,933,958,983,1008,1033,1058,1083,1108,1132,1157,1181,1205,1229,1254,1278,1302,1325,1349,1373,1397,1421,1444,1468,1491,1515,1538,1562,1585,1609,1632,1655,1679,1702,1725,1748,1772,1795,1818,1841,1864,1887,1910,1933,1956,1980,2003,2026,2049,2072,2095,2118,2141,2164,2186,2209,2232,2255};
uint16_t hundred_times_log10_NPRB[100] = {0,301,477,602,698,778,845,903,954,1000,1041,1079,1113,1146,1176,1204,1230,1255,1278,1301,1322,1342,1361,1380,1397,1414,1431,1447,1462,1477,1491,1505,1518,1531,1544,1556,1568,1579,1591,1602,1612,1623,1633,1643,1653,1662,1672,1681,1690,1698,1707,1716,1724,1732,1740,1748,1755,1763,1770,1778,1785,1792,1799,1806,1812,1819,1826,1832,1838,1845,1851,1857,1863,1869,1875,1880,1886,1892,1897,1903,1908,1913,1919,1924,1929,1934,1939,1944,1949,1954,1959,1963,1968,1973,1977,1982,1986,1991,1995,2000}; uint16_t hundred_times_log10_NPRB[100] = {0,301,477,602,698,778,845,903,954,1000,1041,1079,1113,1146,1176,1204,1230,1255,1278,1301,1322,1342,1361,1380,1397,1414,1431,1447,1462,1477,1491,1505,1518,1531,1544,1556,1568,1579,1591,1602,1612,1623,1633,1643,1653,1662,1672,1681,1690,1698,1707,1716,1724,1732,1740,1748,1755,1763,1770,1778,1785,1792,1799,1806,1812,1819,1826,1832,1838,1845,1851,1857,1863,1869,1875,1880,1886,1892,1897,1903,1908,1913,1919,1924,1929,1934,1939,1944,1949,1954,1959,1963,1968,1973,1977,1982,1986,1991,1995,2000};
#ifndef UE_EXPANSION
int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint8_t UE_id,uint8_t harq_pid, uint8_t bw_factor)
#else
int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t harq_pid, uint8_t bw_factor) int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t harq_pid, uint8_t bw_factor)
#endif
{ {
uint32_t Nre,sumKr,MPR_x100,Kr,r; uint32_t Nre,sumKr,MPR_x100,Kr,r;
@@ -93,11 +89,7 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t
int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid) int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid)
{ {
#ifndef UE_EXPANSION
int8_t UE_id;
#else
int16_t UE_id; int16_t UE_id;
#endif
if ((RC.eNB == NULL) || (module_idP > RC.nb_inst) || (CC_id > RC.nb_CC[module_idP])) { if ((RC.eNB == NULL) || (module_idP > RC.nb_inst) || (CC_id > RC.nb_CC[module_idP])) {
LOG_E(PHY,"get_UE_stats: No eNB found (or not allocated) for Mod_id %d,CC_id %d\n",module_idP,CC_id); LOG_E(PHY,"get_UE_stats: No eNB found (or not allocated) for Mod_id %d,CC_id %d\n",module_idP,CC_id);
return -1; return -1;
+2 -2
View File
@@ -112,7 +112,7 @@ void feptx0(RU_t *ru,int slot) {
} }
*/ */
// TDD: turn on tx switch N_TA_offset before by setting buffer in these samples to 0 // TDD: turn on tx switch N_TA_offset before by setting buffer in these samples to 0
if ((slot == 0) && /* if ((slot == 0) &&
(fp->frame_type == TDD) && (fp->frame_type == TDD) &&
((fp->tdd_config==0) || ((fp->tdd_config==0) ||
(fp->tdd_config==1) || (fp->tdd_config==1) ||
@@ -129,7 +129,7 @@ void feptx0(RU_t *ru,int slot) {
ru->common.txdata[aa][tx_offset] = 0x00000000; ru->common.txdata[aa][tx_offset] = 0x00000000;
} }
} }*/
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+slot , 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+slot , 0);
} }
+1
View File
@@ -3426,6 +3426,7 @@ int main(int argc, char **argv)
re_allocated = dlsch_modulation(eNB, re_allocated = dlsch_modulation(eNB,
eNB->common_vars.txdataF[eNB_id], eNB->common_vars.txdataF[eNB_id],
AMP, AMP,
frame,
subframe, subframe,
num_pdcch_symbols, num_pdcch_symbols,
((TB0_active == 1)? eNB->dlsch[k][0]: NULL), ((TB0_active == 1)? eNB->dlsch[k][0]: NULL),
+1
View File
@@ -2679,6 +2679,7 @@ PMI_FEEDBACK:
re_allocated = dlsch_modulation(eNB, re_allocated = dlsch_modulation(eNB,
eNB->common_vars.txdataF[eNB_id], eNB->common_vars.txdataF[eNB_id],
AMP, AMP,
frame,
subframe, subframe,
num_pdcch_symbols, num_pdcch_symbols,
eNB->dlsch[k][0], eNB->dlsch[k][0],
-1
View File
@@ -191,7 +191,6 @@ struct mac_status_resp {
uint32_t head_sdu_remaining_size_to_send; uint32_t head_sdu_remaining_size_to_send;
unsigned char head_sdu_is_segmented; unsigned char head_sdu_is_segmented;
struct rlc_entity_info rlc_info; /*!< xxx*/ struct rlc_entity_info rlc_info; /*!< xxx*/
mui_t rrc_mui;
}; };
struct mac_tb_ind { struct mac_tb_ind {
-4
View File
@@ -68,11 +68,7 @@ typedef int32_t sdu_size_t;
typedef uint32_t frame_t; typedef uint32_t frame_t;
typedef int32_t sframe_t; typedef int32_t sframe_t;
typedef uint32_t sub_frame_t; typedef uint32_t sub_frame_t;
#ifndef UE_EXPANSION
typedef uint8_t module_id_t;
#else
typedef uint16_t module_id_t; typedef uint16_t module_id_t;
#endif
typedef uint8_t eNB_index_t; typedef uint8_t eNB_index_t;
typedef uint16_t ue_id_t; typedef uint16_t ue_id_t;
typedef int16_t smodule_id_t; typedef int16_t smodule_id_t;
-2
View File
@@ -166,9 +166,7 @@ typedef struct RrcConfigurationReq_s {
long ue_TimersAndConstants_n310[MAX_NUM_CCs]; long ue_TimersAndConstants_n310[MAX_NUM_CCs];
long ue_TimersAndConstants_n311[MAX_NUM_CCs]; long ue_TimersAndConstants_n311[MAX_NUM_CCs];
long ue_TransmissionMode[MAX_NUM_CCs]; long ue_TransmissionMode[MAX_NUM_CCs];
#ifdef UE_EXPANSION
long ue_multiple_max[MAX_NUM_CCs]; long ue_multiple_max[MAX_NUM_CCs];
#endif
} RrcConfigurationReq; } RrcConfigurationReq;
// UE: NAS -> RRC messages // UE: NAS -> RRC messages
+17 -18
View File
@@ -180,6 +180,8 @@ void RCconfig_RU(void) {
RC.ru[j]->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);; RC.ru[j]->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);;
RC.ru[j]->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr); RC.ru[j]->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr);
RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt; RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt;
RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
for (i=0;i<RC.ru[j]->num_bands;i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; for (i=0;i<RC.ru[j]->num_bands;i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i];
} //strcmp(local_rf, "yes") == 0 } //strcmp(local_rf, "yes") == 0
else { else {
@@ -215,7 +217,7 @@ void RCconfig_RU(void) {
RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF5_MOBIPASS; RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF5_MOBIPASS;
} }
RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
} /* strcmp(local_rf, "yes") != 0 */ } /* strcmp(local_rf, "yes") != 0 */
RC.ru[j]->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr); RC.ru[j]->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
@@ -383,6 +385,16 @@ void RCconfig_macrlc() {
} else { // other midhaul } else { // other midhaul
AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr)); AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
} }
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "default") == 0){
global_scheduler_mode=SCHED_MODE_DEFAULT;
printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
}else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "fairRR") == 0){
global_scheduler_mode=SCHED_MODE_FAIR_RR;
printf("sched mode = fairRR %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
}else{
global_scheduler_mode=SCHED_MODE_DEFAULT;
printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
}
}// j=0..num_inst }// j=0..num_inst
} else {// MacRLC_ParamList.numelt > 0 } else {// MacRLC_ParamList.numelt > 0
AssertFatal (0, AssertFatal (0,
@@ -866,21 +878,10 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
RC.config_file_name, i, prach_zero_correlation); RC.config_file_name, i, prach_zero_correlation);
RRC_CONFIGURATION_REQ (msg_p).prach_freq_offset[j] = prach_freq_offset; RRC_CONFIGURATION_REQ (msg_p).prach_freq_offset[j] = prach_freq_offset;
#ifndef UE_EXPANSION
if ((prach_freq_offset <0) || (prach_freq_offset > 94)) if ((prach_freq_offset <0) || (prach_freq_offset > 94))
AssertFatal (0, AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 0..94!\n", "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 0..94!\n",
RC.config_file_name, i, prach_freq_offset); RC.config_file_name, i, prach_freq_offset);
#else
if ((N_RB_DL == 25) && (prach_freq_offset != 2))
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 2(N_RB_DL %d)!\n",
RC.config_file_name, i, prach_freq_offset,N_RB_DL);
if (((N_RB_DL == 50) || (N_RB_DL == 100)) && (prach_freq_offset != 3))
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 3(N_RB_DL %d)!\n",
RC.config_file_name, i, prach_freq_offset,N_RB_DL);
#endif
RRC_CONFIGURATION_REQ (msg_p).pucch_delta_shift[j] = pucch_delta_shift-1; RRC_CONFIGURATION_REQ (msg_p).pucch_delta_shift[j] = pucch_delta_shift-1;
@@ -1766,7 +1767,6 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
break; break;
} }
#ifdef UE_EXPANSION
RRC_CONFIGURATION_REQ (msg_p).ue_multiple_max[j] = ue_multiple_max; RRC_CONFIGURATION_REQ (msg_p).ue_multiple_max[j] = ue_multiple_max;
switch (N_RB_DL) { switch (N_RB_DL) {
@@ -1777,15 +1777,15 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
RC.config_file_name, i, ue_multiple_max); RC.config_file_name, i, ue_multiple_max);
break; break;
case 50: case 50:
if ((ue_multiple_max < 1) || (ue_multiple_max > 6)) if ((ue_multiple_max < 1) || (ue_multiple_max > 8))
AssertFatal (0, AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..6!\n", "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..8!\n",
RC.config_file_name, i, ue_multiple_max); RC.config_file_name, i, ue_multiple_max);
break; break;
case 100: case 100:
if ((ue_multiple_max < 1) || (ue_multiple_max > 10)) if ((ue_multiple_max < 1) || (ue_multiple_max > 16))
AssertFatal (0, AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..10!\n", "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_multiple_max choice: 1..16!\n",
RC.config_file_name, i, ue_multiple_max); RC.config_file_name, i, ue_multiple_max);
break; break;
default: default:
@@ -1794,7 +1794,6 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
RC.config_file_name, i, N_RB_DL); RC.config_file_name, i, N_RB_DL);
break; break;
} }
#endif
} }
} }
char srb1path[MAX_OPTNAME_SIZE*2 + 8]; char srb1path[MAX_OPTNAME_SIZE*2 + 8];
+3
View File
@@ -652,6 +652,7 @@ static int DEFENBS[] = {0};
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTC "remote_s_portc" #define CONFIG_STRING_MACRLC_REMOTE_S_PORTC "remote_s_portc"
#define CONFIG_STRING_MACRLC_LOCAL_S_PORTD "local_s_portd" #define CONFIG_STRING_MACRLC_LOCAL_S_PORTD "local_s_portd"
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd" #define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd"
#define CONFIG_STRING_MACRLC_SCHED_MODE "scheduler_mode"
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -676,6 +677,7 @@ static int DEFENBS[] = {0};
{CONFIG_STRING_MACRLC_REMOTE_S_PORTC, NULL, 0, uptr:NULL, defintval:50020, TYPE_UINT, 0}, \ {CONFIG_STRING_MACRLC_REMOTE_S_PORTC, NULL, 0, uptr:NULL, defintval:50020, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \ {CONFIG_STRING_MACRLC_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \ {CONFIG_STRING_MACRLC_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_SCHED_MODE, NULL, 0, strptr:NULL, defintval:"default", TYPE_STRING, 0}, \
} }
#define MACRLC_CC_IDX 0 #define MACRLC_CC_IDX 0
#define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1 #define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1
@@ -694,4 +696,5 @@ static int DEFENBS[] = {0};
#define MACRLC_REMOTE_S_PORTC_IDX 14 #define MACRLC_REMOTE_S_PORTC_IDX 14
#define MACRLC_LOCAL_S_PORTD_IDX 15 #define MACRLC_LOCAL_S_PORTD_IDX 15
#define MACRLC_REMOTE_S_PORTD_IDX 16 #define MACRLC_REMOTE_S_PORTD_IDX 16
#define MACRLC_SCHED_MODE_IDX 17
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
+4 -3
View File
@@ -251,7 +251,7 @@ void config_mib(int Mod_idP,
cfg->rf_config.dl_channel_bandwidth.value = to_prb(dl_BandwidthP); cfg->rf_config.dl_channel_bandwidth.value = to_prb(dl_BandwidthP);
cfg->rf_config.dl_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG; cfg->rf_config.dl_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG;
cfg->num_tlv++; cfg->num_tlv++;
LOG_E(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, dl_BandwidthP); LOG_D(PHY,"%s() dl_BandwidthP:%d\n", __FUNCTION__, dl_BandwidthP);
cfg->rf_config.ul_channel_bandwidth.value = to_prb(dl_BandwidthP); cfg->rf_config.ul_channel_bandwidth.value = to_prb(dl_BandwidthP);
cfg->rf_config.ul_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG; cfg->rf_config.ul_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG;
@@ -762,7 +762,7 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
LOG_E(MAC, "RC.mac:%p mib:%p\n", RC.mac, mib); LOG_D(MAC, "RC.mac:%p mib:%p\n", RC.mac, mib);
if (mib != NULL) { if (mib != NULL) {
if (RC.mac == NULL) if (RC.mac == NULL)
@@ -997,7 +997,7 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP,
} }
#endif #endif
LOG_E(MAC, "%s() %s:%d RC.mac[Mod_idP]->if_inst->PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.mac[Mod_idP]->if_inst->PHY_config_req); LOG_D(MAC, "%s() %s:%d RC.mac[Mod_idP]->if_inst->PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.mac[Mod_idP]->if_inst->PHY_config_req);
// if in nFAPI mode // if in nFAPI mode
if ( if (
@@ -1021,6 +1021,7 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
} }
RC.mac[Mod_idP]->scheduler_mode = global_scheduler_mode;
return(0); return(0);
} }
+20 -45
View File
@@ -78,7 +78,7 @@
#define PCCH_PAYLOAD_SIZE_MAX 128 #define PCCH_PAYLOAD_SIZE_MAX 128
#define RAR_PAYLOAD_SIZE_MAX 128 #define RAR_PAYLOAD_SIZE_MAX 128
#define SCH_PAYLOAD_SIZE_MAX 4096 #define SCH_PAYLOAD_SIZE_MAX 8192
/// Logical channel ids from 36-311 (Note BCCH is not specified in 36-311, uses the same as first DRB) /// Logical channel ids from 36-311 (Note BCCH is not specified in 36-311, uses the same as first DRB)
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
@@ -432,6 +432,12 @@ typedef enum {
CBA_RS /// random allocation CBA_RS /// random allocation
} CBA_POLICY; } CBA_POLICY;
/*!\brief scheduler mode */
typedef enum {
SCHED_MODE_DEFAULT = 0, /// default cheduler
SCHED_MODE_FAIR_RR /// fair raund robin
} SCHEDULER_MODES;
/*! \brief temporary struct for ULSCH sched */ /*! \brief temporary struct for ULSCH sched */
typedef struct { typedef struct {
@@ -667,7 +673,7 @@ typedef struct {
/// mcs from last UL scheduling /// mcs from last UL scheduling
uint8_t mcs_UL[8]; uint8_t mcs_UL[8];
/// TBS from last UL scheduling /// TBS from last UL scheduling
uint8_t TBS_UL[8]; uint16_t TBS_UL[8];
/// Flag to indicate UL has been scheduled at least once /// Flag to indicate UL has been scheduled at least once
boolean_t ul_active; boolean_t ul_active;
/// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received) /// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received)
@@ -864,6 +870,7 @@ typedef struct {
uint8_t dl_cqi[NFAPI_CC_MAX]; uint8_t dl_cqi[NFAPI_CC_MAX];
int32_t uplane_inactivity_timer; int32_t uplane_inactivity_timer;
uint8_t crnti_reconfigurationcomplete_flag; uint8_t crnti_reconfigurationcomplete_flag;
uint8_t cqi_req_flag;
} UE_sched_ctrl; } UE_sched_ctrl;
/*! \brief eNB template for the Random access information */ /*! \brief eNB template for the Random access information */
typedef struct { typedef struct {
@@ -1094,9 +1101,9 @@ typedef struct eNB_MAC_INST_s {
nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10]; nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10];
/// Preallocated HI_DCI0 pdu list /// Preallocated HI_DCI0 pdu list
nfapi_hi_dci0_request_pdu_t nfapi_hi_dci0_request_pdu_t
hi_dci0_pdu_list[MAX_NUM_CCs][MAX_NUM_HI_DCI0_PDU]; hi_dci0_pdu_list[MAX_NUM_CCs][10][MAX_NUM_HI_DCI0_PDU];
/// NFAPI HI/DCI0 Config Request Structure /// NFAPI HI/DCI0 Config Request Structure
nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs]; nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs][10];
/// Prealocated TX pdu list /// Prealocated TX pdu list
nfapi_tx_request_pdu_t nfapi_tx_request_pdu_t
tx_request_pdu[MAX_NUM_CCs][MAX_NUM_TX_REQUEST_PDU]; tx_request_pdu[MAX_NUM_CCs][MAX_NUM_TX_REQUEST_PDU];
@@ -1137,6 +1144,9 @@ typedef struct eNB_MAC_INST_s {
time_stats_t schedule_pch; time_stats_t schedule_pch;
UE_free_list_t UE_free_list; UE_free_list_t UE_free_list;
/// for scheduling selection
SCHEDULER_MODES scheduler_mode;
} eNB_MAC_INST; } eNB_MAC_INST;
/* /*
@@ -1360,47 +1370,6 @@ typedef struct {
uint8_t n_adj_cells; uint8_t n_adj_cells;
} neigh_cell_id_t; } neigh_cell_id_t;
#ifdef UE_EXPANSION
enum SCH_UE_PRIORITY {
SCH_PRIORITY_NONE,
SCH_DL_SI,
SCH_DL_PAGING,
SCH_DL_MSG2,
SCH_DL_MSG4,
SCH_UL_PRACH,
SCH_UL_MSG3,
SCH_DL_RETRANS,
SCH_UL_RETRANS,
SCH_DL_FIRST,
SCH_UL_FIRST,
SCH_UL_INACTIVE
};
typedef struct {
int UE_id;
enum SCH_UE_PRIORITY ue_priority;
rnti_t rnti;
uint16_t nb_rb;
} DLSCH_UE_INFO;
typedef struct {
uint16_t ue_num;
DLSCH_UE_INFO list[20];
} DLSCH_UE_SELECT;
typedef struct {
int UE_id;
enum SCH_UE_PRIORITY ue_priority;
uint8_t start_rb;
uint8_t nb_rb;
uint16_t ul_total_buffer;
} ULSCH_UE_INFO;
typedef struct {
uint8_t ue_num;
ULSCH_UE_INFO list[20];
} ULSCH_UE_SELECT;
#endif
typedef struct { typedef struct {
volatile uint8_t flag; volatile uint8_t flag;
@@ -1412,6 +1381,12 @@ typedef struct {
uint16_t num_UEs; uint16_t num_UEs;
RRC_release_ctrl RRC_release_ctrl[NUMBER_OF_UE_MAX]; RRC_release_ctrl RRC_release_ctrl[NUMBER_OF_UE_MAX];
} RRC_release_list_t; } RRC_release_list_t;
typedef struct {
uint8_t rrc_mui_num;
mui_t rrc_mui[128];
}mac_rlc_am_muilist_t;
#include "proto.h" #include "proto.h"
/*@}*/ /*@}*/
#endif /*__LAYER2_MAC_DEFS_H__ */ #endif /*__LAYER2_MAC_DEFS_H__ */
+28 -14
View File
@@ -59,6 +59,9 @@
#include "flexran_agent_mac_proto.h" #include "flexran_agent_mac_proto.h"
#endif #endif
/* for fair round robin SCHED */
#include "eNB_scheduler_fairRR.h"
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
#include "intertask_interface.h" #include "intertask_interface.h"
#endif #endif
@@ -574,7 +577,7 @@ clear_nfapi_information(eNB_MAC_INST * eNB, int CC_idP,
{ {
nfapi_dl_config_request_t *DL_req = &eNB->DL_req[0]; nfapi_dl_config_request_t *DL_req = &eNB->DL_req[0];
nfapi_ul_config_request_t *UL_req = &eNB->UL_req[0]; nfapi_ul_config_request_t *UL_req = &eNB->UL_req[0];
nfapi_hi_dci0_request_t *HI_DCI0_req = &eNB->HI_DCI0_req[0]; nfapi_hi_dci0_request_t *HI_DCI0_req = &eNB->HI_DCI0_req[CC_idP][subframeP];
nfapi_tx_request_t *TX_req = &eNB->TX_req[0]; nfapi_tx_request_t *TX_req = &eNB->TX_req[0];
eNB->pdu_index[CC_idP] = 0; eNB->pdu_index[CC_idP] = 0;
@@ -587,8 +590,8 @@ clear_nfapi_information(eNB_MAC_INST * eNB, int CC_idP,
DL_req[CC_idP].dl_config_request_body.number_pdsch_rnti = 0; DL_req[CC_idP].dl_config_request_body.number_pdsch_rnti = 0;
DL_req[CC_idP].dl_config_request_body.transmission_power_pcfich = 6000; DL_req[CC_idP].dl_config_request_body.transmission_power_pcfich = 6000;
HI_DCI0_req[CC_idP].hi_dci0_request_body.sfnsf = subframeP + (frameP<<4); HI_DCI0_req->hi_dci0_request_body.sfnsf = subframeP + (frameP<<4);
HI_DCI0_req[CC_idP].hi_dci0_request_body.number_of_dci = 0; HI_DCI0_req->hi_dci0_request_body.number_of_dci = 0;
UL_req[CC_idP].ul_config_request_body.number_of_pdus = 0; UL_req[CC_idP].ul_config_request_body.number_of_pdus = 0;
@@ -768,7 +771,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
} }
#if (!defined(UE_EXPANSION_SIM2)) &&(!defined(UE_EXPANSION)) #if (!defined(PRE_SCD_THREAD))
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,
NOT_A_RNTI, frameP, subframeP, NOT_A_RNTI, frameP, subframeP,
module_idP); module_idP);
@@ -790,9 +793,21 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
} }
#endif #endif
#ifdef UE_EXPANSION static int debug_flag=0;
memset(dlsch_ue_select, 0, sizeof(dlsch_ue_select)); void (*schedule_ulsch_p)(module_id_t module_idP, frame_t frameP, sub_frame_t subframe);
#endif void (*schedule_ue_spec_p)(module_id_t module_idP, frame_t frameP, sub_frame_t subframe, int *mbsfn_flag);
if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_DEFAULT){
schedule_ulsch_p = schedule_ulsch;
schedule_ue_spec_p = schedule_ue_spec;
}else if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
memset(dlsch_ue_select, 0, sizeof(dlsch_ue_select));
schedule_ulsch_p = schedule_ulsch_fairRR;
schedule_ue_spec_p = schedule_ue_spec_fairRR;
}
if(debug_flag==0){
LOG_E(MAC,"SCHED_MODE=%d\n",RC.mac[module_idP]->scheduler_mode);
debug_flag=1;
}
// This schedules MIB // This schedules MIB
if ((subframeP == 0) && (frameP & 3) == 0) if ((subframeP == 0) && (frameP & 3) == 0)
schedule_mib(module_idP, frameP, subframeP); schedule_mib(module_idP, frameP, subframeP);
@@ -807,20 +822,19 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
// This schedules SRS in subframeP // This schedules SRS in subframeP
schedule_SRS(module_idP, frameP, subframeP); schedule_SRS(module_idP, frameP, subframeP);
// This schedules ULSCH in subframeP (dci0) // This schedules ULSCH in subframeP (dci0)
schedule_ulsch(module_idP, frameP, subframeP); schedule_ulsch_p(module_idP, frameP, subframeP);
// This schedules UCI_SR in subframeP // This schedules UCI_SR in subframeP
schedule_SR(module_idP, frameP, subframeP); schedule_SR(module_idP, frameP, subframeP);
// This schedules UCI_CSI in subframeP // This schedules UCI_CSI in subframeP
schedule_CSI(module_idP, frameP, subframeP); schedule_CSI(module_idP, frameP, subframeP);
// This schedules DLSCH in subframeP // This schedules DLSCH in subframeP
schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); schedule_ue_spec_p(module_idP, frameP, subframeP, mbsfn_status);
// Allocate CCEs for good after scheduling is done // Allocate CCEs for good after scheduling is done
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++){
allocate_CCEs(module_idP, CC_id, frameP, subframeP, 2); if(cc[CC_id].tdd_Config == NULL || !(is_UL_sf(&cc[CC_id],subframeP)))
allocate_CCEs(module_idP, CC_id, frameP, subframeP, 2);
}
stop_meas(&RC.mac[module_idP]->eNB_scheduler); stop_meas(&RC.mac[module_idP]->eNB_scheduler);
+45 -62
View File
@@ -106,10 +106,10 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP,
nfapi_ul_config_request_t *ul_req; nfapi_ul_config_request_t *ul_req;
nfapi_ul_config_request_body_t *ul_req_body; nfapi_ul_config_request_body_t *ul_req_body;
nfapi_ul_config_request_pdu_t *ul_config_pdu; nfapi_ul_config_request_pdu_t *ul_config_pdu;
nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_id]; nfapi_hi_dci0_request_t *hi_dci0_req;
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body; nfapi_hi_dci0_request_body_t *hi_dci0_req_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
uint8_t sf_ahead_dl;
uint8_t rvseq[4] = { 0, 2, 3, 1 }; uint8_t rvseq[4] = { 0, 2, 3, 1 };
@@ -234,6 +234,9 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP,
LOG_D(MAC, "MSG3: UL_CONFIG SFN/SF:%d number_of_pdus:%d ra->msg3_round:%d\n", NFAPI_SFNSF2DEC(ul_req->sfn_sf), ul_req_body->number_of_pdus, ra->msg3_round); LOG_D(MAC, "MSG3: UL_CONFIG SFN/SF:%d number_of_pdus:%d ra->msg3_round:%d\n", NFAPI_SFNSF2DEC(ul_req->sfn_sf), ul_req_body->number_of_pdus, ra->msg3_round);
if (ra->msg3_round != 0) { // program HI too if (ra->msg3_round != 0) { // program HI too
sf_ahead_dl = ul_subframe2_k_phich(cc, subframeP);
hi_dci0_req = &mac->HI_DCI0_req[CC_id][(subframeP+sf_ahead_dl)%10];
hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi]; hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
memset((void *) hi_dci0_pdu, 0, memset((void *) hi_dci0_pdu, 0,
sizeof(nfapi_hi_dci0_request_pdu_t)); sizeof(nfapi_hi_dci0_request_pdu_t));
@@ -249,7 +252,7 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP,
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(ra->Msg3_frame, ra->Msg3_subframe, 0); hi_dci0_req_body->sfnsf = sfnsf_add_subframe(ra->Msg3_frame, ra->Msg3_subframe, 0);
hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG; hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
hi_dci0_req->sfn_sf = sfnsf_add_subframe(ra->Msg3_frame, ra->Msg3_subframe, 4); hi_dci0_req->sfn_sf = hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP, subframeP, sf_ahead_dl);
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
if (nfapi_mode) { if (nfapi_mode) {
@@ -307,7 +310,7 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
LOG_D(MAC,"absSF:%d absSF_Msg2:%d ra->rach_resource_type:%d\n",absSF,absSF_Msg2,ra->rach_resource_type); LOG_D(MAC,"absSF:%d absSF_Msg2:%d ra->rach_resource_type:%d\n",absSF,absSF_Msg2,ra->rach_resource_type);
if (absSF > absSF_Msg2) if (absSF < absSF_Msg2)
return; // we're not ready yet, need to be to start == return; // we're not ready yet, need to be to start ==
if (cc[CC_idP].radioResourceConfigCommon_BR) { if (cc[CC_idP].radioResourceConfigCommon_BR) {
@@ -578,13 +581,9 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
TX_req->segments[0].segment_data = TX_req->segments[0].segment_data =
cc[CC_idP].RAR_pdu.payload; cc[CC_idP].RAR_pdu.payload;
mac->TX_req[CC_idP].tx_request_body.number_of_pdus++; mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
#ifdef UE_EXPANSION if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].ue_priority = SCH_DL_MSG2; set_dl_ue_select_msg2(CC_idP, 4, -1, ra->rnti);
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].nb_rb = 4; }
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].UE_id = -1;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].rnti = ra->rnti;
dlsch_ue_select[CC_idP].ue_num++;
#endif
} }
} }
@@ -716,13 +715,9 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
TX_req->segments[0].segment_data = TX_req->segments[0].segment_data =
cc[CC_idP].RAR_pdu.payload; cc[CC_idP].RAR_pdu.payload;
mac->TX_req[CC_idP].tx_request_body.number_of_pdus++; mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
#ifdef UE_EXPANSION if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].ue_priority = SCH_DL_MSG2; set_dl_ue_select_msg2(CC_idP, 4, -1, ra->rnti);
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].nb_rb = 4; }
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].UE_id = -1;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].rnti = ra->rnti;
dlsch_ue_select[CC_idP].ue_num++;
#endif
} // PDCCH CCE allocation is feasible } // PDCCH CCE allocation is feasible
} // Msg2 frame/subframe condition } // Msg2 frame/subframe condition
} // else BL/CE } // else BL/CE
@@ -850,10 +845,7 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
// set HARQ process round to 0 for this UE // set HARQ process round to 0 for this UE
if (cc->tdd_Config) ra->harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP);
ra->harq_pid = ((frameP * 10) + subframeP) % 10;
else
ra->harq_pid = ((frameP * 10) + subframeP) & 7;
// Get RRCConnectionSetup for Piggyback // Get RRCConnectionSetup for Piggyback
rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block
@@ -1211,13 +1203,9 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
UE_id), UE_id),
rrc_sdu_length); rrc_sdu_length);
} }
#ifdef UE_EXPANSION if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].ue_priority = SCH_DL_MSG4; set_dl_ue_select_msg4(CC_idP, 4, UE_id, ra->rnti);
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].nb_rb = 4; }
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].UE_id = UE_id;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].rnti = ra->rnti;
dlsch_ue_select[CC_idP].ue_num++;
#endif
} // Msg4 frame/subframe } // Msg4 frame/subframe
} // msg4_mpdcch_repetition_count } // msg4_mpdcch_repetition_count
} // rach_resource_type > 0 } // rach_resource_type > 0
@@ -1302,10 +1290,8 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
"Frame %d, Subframe %d: Preparing for Msg4 retransmission currently %d.%d\n", "Frame %d, Subframe %d: Preparing for Msg4 retransmission currently %d.%d\n",
frameP, subframeP, ra->Msg4_frame, frameP, subframeP, ra->Msg4_frame,
ra->Msg4_subframe); ra->Msg4_subframe);
if (ra->Msg4_subframe > 1) get_retransmission_timing(mac->common_channels[CC_idP].tdd_Config,&ra->Msg4_frame,&ra->Msg4_subframe);
ra->Msg4_frame++;
ra->Msg4_frame &= 1023;
ra->Msg4_subframe = (ra->Msg4_subframe + 8) % 10;
LOG_D(MAC, LOG_D(MAC,
"Frame %d, Subframe %d: Msg4 retransmission in %d.%d\n", "Frame %d, Subframe %d: Msg4 retransmission in %d.%d\n",
frameP, subframeP, ra->Msg4_frame, frameP, subframeP, ra->Msg4_frame,
@@ -1313,10 +1299,8 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
lcid = 0; lcid = 0;
// put HARQ process round to 0 // put HARQ process round to 0
if (cc->tdd_Config) ra->harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP);
ra->harq_pid = ((frameP * 10) + subframeP) % 10;
else
ra->harq_pid = ((frameP * 10) + subframeP) & 7;
UE_list->UE_sched_ctrl[UE_id].round[CC_idP][ra->harq_pid] = UE_list->UE_sched_ctrl[UE_id].round[CC_idP][ra->harq_pid] =
0; 0;
@@ -1423,13 +1407,9 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
UE_id), UE_id),
rrc_sdu_length); rrc_sdu_length);
} }
#ifdef UE_EXPANSION if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].ue_priority = SCH_DL_MSG4; set_dl_ue_select_msg4(CC_idP, 4, UE_id, ra->rnti);
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].nb_rb = 4; }
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].UE_id = UE_id;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].rnti = ra->rnti;
dlsch_ue_select[CC_idP].ue_num++;
#endif
} // CCE Allocation feasible } // CCE Allocation feasible
} // msg4 frame/subframe } // msg4 frame/subframe
} // else rach_resource_type } // else rach_resource_type
@@ -1573,13 +1553,9 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
(cc->p_eNB == 1) ? 1 : 2, // transmission mode (cc->p_eNB == 1) ? 1 : 2, // transmission mode
1, // num_bf_prb_per_subband 1, // num_bf_prb_per_subband
1); // num_bf_vector 1); // num_bf_vector
#ifdef UE_EXPANSION if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].ue_priority = SCH_DL_MSG4; set_dl_ue_select_msg4(CC_idP, 4, UE_id, ra->rnti);
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].nb_rb = 4; }
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].UE_id = UE_id;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].rnti = ra->rnti;
dlsch_ue_select[CC_idP].ue_num++;
#endif
} else } else
LOG_D(MAC, LOG_D(MAC,
"msg4 retransmission for rnti %x (round %d) fsf %d/%d CCE allocation failed!\n", "msg4 retransmission for rnti %x (round %d) fsf %d/%d CCE allocation failed!\n",
@@ -1596,10 +1572,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
dci_dl_pdu_rel8.cce_idx); dci_dl_pdu_rel8.cce_idx);
// prepare frame for retransmission // prepare frame for retransmission
if (ra->Msg4_subframe > 1) get_retransmission_timing(mac->common_channels[CC_idP].tdd_Config,&ra->Msg4_frame,&ra->Msg4_subframe);
ra->Msg4_frame++;
ra->Msg4_frame &= 1023;
ra->Msg4_subframe = (ra->Msg4_subframe + 8) % 10;
LOG_W(MAC, LOG_W(MAC,
"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Msg4 not acknowledged, adding ue specific dci (rnti %x) for RA (Msg4 Retransmission round %d in %d.%d)\n", "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Msg4 not acknowledged, adding ue specific dci (rnti %x) for RA (Msg4 Retransmission round %d in %d.%d)\n",
@@ -1649,7 +1622,7 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
if (ra->state == MSG2) if (ra->state == MSG2)
generate_Msg2(module_idP, CC_id, frameP, subframeP, ra); generate_Msg2(module_idP, CC_id, frameP, subframeP, ra);
else if (ra->state == MSG4) else if (ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP )
generate_Msg4(module_idP, CC_id, frameP, subframeP, ra); generate_Msg4(module_idP, CC_id, frameP, subframeP, ra);
else if (ra->state == WAITMSG4ACK) else if (ra->state == WAITMSG4ACK)
check_Msg4_retransmission(module_idP, CC_id, frameP, check_Msg4_retransmission(module_idP, CC_id, frameP,
@@ -1735,11 +1708,21 @@ initiate_ra_proc(module_id_t module_idP,
ra[i].msg4_mpdcch_repetition_cnt = 0; ra[i].msg4_mpdcch_repetition_cnt = 0;
#endif #endif
// DJP - this is because VNF is 2 subframes ahead of PNF and TX needs 4 subframes
if (nfapi_mode) //TODO Fill in other TDD config. What about nfapi_mode?
offset = 7; if(cc->tdd_Config!=NULL){
else switch(cc->tdd_Config->subframeAssignment){
offset = 5; case 1 :
offset = 6;
break;
}
}else{//FDD
// DJP - this is because VNF is 2 subframes ahead of PNF and TX needs 4 subframes
if (nfapi_mode)
offset = 7;
else
offset = 5;
}
add_subframe(&msg2_frame, &msg2_subframe, offset); add_subframe(&msg2_frame, &msg2_subframe, offset);
+57 -123
View File
@@ -338,6 +338,7 @@ set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP,
case 1: case 1:
switch (subframeP) { switch (subframeP) {
case 0:
case 1: case 1:
UE_list->UE_template[CC_idP][UE_idP].DAI_ul[7] = DAI; UE_list->UE_template[CC_idP][UE_idP].DAI_ul[7] = DAI;
break; break;
@@ -346,6 +347,7 @@ set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP,
UE_list->UE_template[CC_idP][UE_idP].DAI_ul[8] = DAI; UE_list->UE_template[CC_idP][UE_idP].DAI_ul[8] = DAI;
break; break;
case 5:
case 6: case 6:
UE_list->UE_template[CC_idP][UE_idP].DAI_ul[2] = DAI; UE_list->UE_template[CC_idP][UE_idP].DAI_ul[2] = DAI;
break; break;
@@ -411,10 +413,6 @@ set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP,
} }
#ifdef UE_EXPANSION
extern volatile int16_t phy_tx_txdataF_end;
extern int oai_exit;
#endif
// changes to pre-processor for eMTC // changes to pre-processor for eMTC
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -499,8 +497,7 @@ schedule_ue_spec(module_id_t module_idP,
break; break;
case 6: case 6:
case 7: case 7:
if ((tdd_sfa != 1) && (tdd_sfa != 2) && (tdd_sfa != 4) if ((tdd_sfa != 3)&& (tdd_sfa != 4) && (tdd_sfa != 5))
&& (tdd_sfa != 5))
return; return;
break; break;
case 8: case 8:
@@ -509,8 +506,7 @@ schedule_ue_spec(module_id_t module_idP,
return; return;
break; break;
case 9: case 9:
if ((tdd_sfa != 1) && (tdd_sfa != 3) && (tdd_sfa != 4) if (tdd_sfa == 0)
&& (tdd_sfa != 6))
return; return;
break; break;
@@ -553,11 +549,6 @@ schedule_ue_spec(module_id_t module_idP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_OUT);
#ifdef UE_EXPANSION
struct timespec time_req, time_rem;
time_req.tv_sec = 0;
time_req.tv_nsec = 10000;
#endif
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n",CC_id); LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n",CC_id);
@@ -566,53 +557,6 @@ schedule_ue_spec(module_id_t module_idP,
if (mbsfn_flag[CC_id]>0) if (mbsfn_flag[CC_id]>0)
continue; continue;
#ifdef UE_EXPANSION
for (i = 0; i < dlsch_ue_select[CC_id].ue_num; i++) {
if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG2){
continue;
}
if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG4){
continue;
}
UE_id = dlsch_ue_select[CC_id].list[i].UE_id;
rnti = UE_RNTI(module_idP,UE_id);
if (rnti==NOT_A_RNTI) {
LOG_E(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs);
continue;
}
eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
switch(get_tmode(module_idP,CC_id,UE_id)){
case 1:
case 2:
case 7:
aggregation = get_aggregation(get_bw_index(module_idP,CC_id),
ue_sched_ctl->dl_cqi[CC_id],
format1);
break;
case 3:
aggregation = get_aggregation(get_bw_index(module_idP,CC_id),
ue_sched_ctl->dl_cqi[CC_id],
format2A);
break;
default:
LOG_W(MAC,"Unsupported transmission mode %d\n", get_tmode(module_idP,CC_id,UE_id));
aggregation = 2;
break;
}
if (cc[CC_id].tdd_Config != NULL) { //TDD
set_ue_dai (subframeP,
UE_id,
CC_id,
cc[CC_id].tdd_Config->subframeAssignment,
UE_list);
// update UL DAI after DLSCH scheduling
set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP);
}
#else
for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
continue_flag=0; // reset the flag to allow allocation for the remaining UEs continue_flag=0; // reset the flag to allow allocation for the remaining UEs
@@ -677,7 +621,6 @@ schedule_ue_spec(module_id_t module_idP,
CC_id, UE_id, subframeP, S_DL_NONE); CC_id, UE_id, subframeP, S_DL_NONE);
continue; continue;
} }
#endif
#warning RK->CR This old API call has to be revisited for FAPI, or logic must be changed #warning RK->CR This old API call has to be revisited for FAPI, or logic must be changed
#if 0 #if 0
/* add "fake" DCI to have CCE_allocation_infeasible work properly for next allocations */ /* add "fake" DCI to have CCE_allocation_infeasible work properly for next allocations */
@@ -689,10 +632,7 @@ schedule_ue_spec(module_id_t module_idP,
nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id];
if (cc->tdd_Config) harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP);
harq_pid = ((frameP * 10) + subframeP) % 10;
else
harq_pid = ((frameP * 10) + subframeP) & 7;
round = ue_sched_ctl->round[CC_id][harq_pid]; round = ue_sched_ctl->round[CC_id][harq_pid];
@@ -758,7 +698,7 @@ schedule_ue_spec(module_id_t module_idP,
UE_list->UE_template[CC_id][UE_id].DAI++; UE_list->UE_template[CC_id][UE_id].DAI++;
update_ul_dci(module_idP, CC_id, rnti, update_ul_dci(module_idP, CC_id, rnti,
UE_list->UE_template[CC_id][UE_id]. UE_list->UE_template[CC_id][UE_id].
DAI); DAI,subframeP);
LOG_D(MAC, LOG_D(MAC,
"DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n", "DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n",
CC_id, subframeP, UE_id, CC_id, subframeP, UE_id,
@@ -983,30 +923,44 @@ schedule_ue_spec(module_id_t module_idP,
if (rlc_status.bytes_in_buffer > 0) { // There is DCCH to transmit if (rlc_status.bytes_in_buffer > 0) { // There is DCCH to transmit
LOG_D(MAC, LOG_D(MAC,
"[eNB %d] Frame %d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n", "[eNB %d] SFN/SF %d.%d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
module_idP, frameP, CC_id, module_idP, frameP, subframeP, CC_id,
TBS - header_len_dcch); TBS - header_len_dcch);
sdu_lengths[0] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, TBS, //not used sdu_lengths[0] = mac_rlc_data_req(module_idP, rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, TBS, //not used
(char *) (char *)
&dlsch_buffer &dlsch_buffer
[0]); [0]);
pthread_mutex_lock(&rrc_release_freelist); pthread_mutex_lock(&rrc_release_freelist);
if(rrc_release_info.num_UEs > 0){ if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)){
uint16_t release_total = 0; uint16_t release_total = 0;
for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){ for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){
if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0){
release_total++;
}else{
continue;
}
if(rrc_release_info.RRC_release_ctrl[release_num].flag == 1){ if(rrc_release_info.RRC_release_ctrl[release_num].flag == 1){
release_total++; if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti){
if( (rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti) && for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){
(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_status.rrc_mui)){ if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]){
rrc_release_info.RRC_release_ctrl[release_num].flag = 3; rrc_release_info.RRC_release_ctrl[release_num].flag = 3;
LOG_D(MAC,"DLSCH Release send:index %d rnti %x mui %d mui_num %d flag 1->3\n",release_num,rnti,rlc_am_mui.rrc_mui[mui_num],mui_num);
break;
}
}
} }
} }
if(rrc_release_info.RRC_release_ctrl[release_num].flag == 2){ if(rrc_release_info.RRC_release_ctrl[release_num].flag == 2){
release_total++; if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti){
if( (rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti) && for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){
(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_status.rrc_mui)){ if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]){
rrc_release_info.RRC_release_ctrl[release_num].flag = 4; rrc_release_info.RRC_release_ctrl[release_num].flag = 4;
LOG_D(MAC,"DLSCH Release send:index %d rnti %x mui %d mui_num %d flag 2->4\n",release_num,rnti,rlc_am_mui.rrc_mui[mui_num],mui_num);
break;
}
} }
}
} }
if(release_total >= rrc_release_info.num_UEs) if(release_total >= rrc_release_info.num_UEs)
break; break;
@@ -1016,21 +970,24 @@ schedule_ue_spec(module_id_t module_idP,
RA_t *ra = &eNB->common_channels[CC_id].ra[0]; RA_t *ra = &eNB->common_channels[CC_id].ra[0];
for (uint8_t ra_ii = 0; ra_ii < NB_RA_PROC_MAX; ra_ii++) { for (uint8_t ra_ii = 0; ra_ii < NB_RA_PROC_MAX; ra_ii++) {
if((ra[ra_ii].rnti == rnti) && (ra[ra_ii].state == MSGCRNTI) && if((ra[ra_ii].rnti == rnti) && (ra[ra_ii].state == MSGCRNTI)){
(ra[ra_ii].crnti_rrc_mui == rlc_status.rrc_mui)){ for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){
ra[ra_ii].crnti_harq_pid = harq_pid; if(ra[ra_ii].crnti_rrc_mui == rlc_am_mui.rrc_mui[mui_num]){
ra[ra_ii].state = MSGCRNTI_ACK; ra[ra_ii].crnti_harq_pid = harq_pid;
break; ra[ra_ii].state = MSGCRNTI_ACK;
break;
}
}
} }
} }
T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP),
T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(CC_id), T_INT(rnti), T_INT(frameP),
T_INT(subframeP), T_INT(harq_pid), T_INT(DCCH), T_INT(subframeP), T_INT(harq_pid), T_INT(DCCH),
T_INT(sdu_lengths[0])); T_INT(sdu_lengths[0]));
LOG_D(MAC,
"[eNB %d][DCCH] CC_id %d frame %d subframe %d UE_id %d/%x Got %d bytes bytes_in_buffer %d from release_num %d\n",
module_idP, CC_id, frameP, subframeP, UE_id, rnti, sdu_lengths[0],rlc_status.bytes_in_buffer,rrc_release_info.num_UEs);
LOG_D(MAC,
"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",
module_idP, CC_id, sdu_lengths[0]);
sdu_length_total = sdu_lengths[0]; sdu_length_total = sdu_lengths[0];
sdu_lcids[0] = DCCH; sdu_lcids[0] = DCCH;
UE_list->eNB_UE_stats[CC_id][UE_id]. UE_list->eNB_UE_stats[CC_id][UE_id].
@@ -1103,12 +1060,7 @@ schedule_ue_spec(module_id_t module_idP,
header_len_dtch = 0; header_len_dtch = 0;
header_len_dtch_last = 0; // the header length of the last mac sdu header_len_dtch_last = 0; // the header length of the last mac sdu
// lcid has to be sorted before the actual allocation (similar struct as ue_list). // lcid has to be sorted before the actual allocation (similar struct as ue_list).
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2)
lcid = DTCH;
{
#else
for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) { for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
#endif
// TBD: check if the lcid is active // TBD: check if the lcid is active
header_len_dtch += 3; header_len_dtch += 3;
@@ -1205,7 +1157,6 @@ schedule_ue_spec(module_id_t module_idP,
} else { } else {
nb_rb = min_rb_unit[CC_id]; nb_rb = min_rb_unit[CC_id];
} }
TBS = get_TBS_DL(mcs, nb_rb); TBS = get_TBS_DL(mcs, nb_rb);
while (TBS < while (TBS <
@@ -1310,13 +1261,6 @@ schedule_ue_spec(module_id_t module_idP,
post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len; // 1 is for the postpadding header post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len; // 1 is for the postpadding header
} }
#ifdef UE_EXPANSION
while((!oai_exit)&&(phy_tx_txdataF_end == 0)){
nanosleep(&time_req,&time_rem);
continue;
}
#endif
offset = generate_dlsch_header((unsigned char *) UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], num_sdus, //num_sdus offset = generate_dlsch_header((unsigned char *) UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], num_sdus, //num_sdus
sdu_lengths, // sdu_lengths, //
sdu_lcids, 255, // no drx sdu_lcids, 255, // no drx
@@ -1389,7 +1333,7 @@ schedule_ue_spec(module_id_t module_idP,
if (cc[CC_id].tdd_Config != NULL) { // TDD if (cc[CC_id].tdd_Config != NULL) { // TDD
UE_list->UE_template[CC_id][UE_id].DAI++; UE_list->UE_template[CC_id][UE_id].DAI++;
update_ul_dci(module_idP,CC_id,rnti,UE_list->UE_template[CC_id][UE_id].DAI); update_ul_dci(module_idP,CC_id,rnti,UE_list->UE_template[CC_id][UE_id].DAI,subframeP);
} }
// do PUCCH power control // do PUCCH power control
@@ -1469,7 +1413,10 @@ schedule_ue_spec(module_id_t module_idP,
ue_sched_ctl->round[CC_id][harq_pid] = 0; ue_sched_ctl->round[CC_id][harq_pid] = 0;
dl_req->number_dci++; dl_req->number_dci++;
dl_req->number_pdu++; dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP;
eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST;
// Toggle NDI for next time // Toggle NDI for next time
LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n",
CC_id, frameP,subframeP,UE_id, CC_id, frameP,subframeP,UE_id,
@@ -1515,9 +1462,6 @@ schedule_ue_spec(module_id_t module_idP,
eNB->pdu_index[CC_id]++; eNB->pdu_index[CC_id]++;
program_dlsch_acknak(module_idP,CC_id,UE_id,frameP,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx); program_dlsch_acknak(module_idP,CC_id,UE_id,frameP,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
#ifdef UE_EXPANSION
last_dlsch_ue_id[CC_id] = UE_id;
#endif
} }
else { else {
LOG_W(MAC,"Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d/%x, infeasible CCE allocations\n", LOG_W(MAC,"Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d/%x, infeasible CCE allocations\n",
@@ -1570,9 +1514,6 @@ fill_DLSCH_dci(
int N_RBG; int N_RBG;
int N_RB_DL; int N_RB_DL;
COMMON_channels_t *cc; COMMON_channels_t *cc;
#ifdef UE_EXPANSION
int j;
#endif
start_meas(&eNB->fill_DLSCH_dci); start_meas(&eNB->fill_DLSCH_dci);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,VCD_FUNCTION_IN);
@@ -1587,18 +1528,7 @@ fill_DLSCH_dci(
N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth); N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
// UE specific DCIs // UE specific DCIs
#ifdef UE_EXPANSION
for (j = 0; j < dlsch_ue_select[CC_id].ue_num; j++) {
if(dlsch_ue_select[CC_id].list[j].ue_priority == SCH_DL_MSG2){
continue;
}
if(dlsch_ue_select[CC_id].list[j].ue_priority == SCH_DL_MSG4){
continue;
}
UE_id = dlsch_ue_select[CC_id].list[j].UE_id;
#else
for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
#endif
LOG_T(MAC,"CC_id %d, UE_id: %d => status %d\n",CC_id,UE_id,eNB_dlsch_info[module_idP][CC_id][UE_id].status); LOG_T(MAC,"CC_id %d, UE_id: %d => status %d\n",CC_id,UE_id,eNB_dlsch_info[module_idP][CC_id][UE_id].status);
if (eNB_dlsch_info[module_idP][CC_id][UE_id].status == S_DL_SCHEDULED) { if (eNB_dlsch_info[module_idP][CC_id][UE_id].status == S_DL_SCHEDULED) {
@@ -1606,8 +1536,7 @@ fill_DLSCH_dci(
// clear scheduling flag // clear scheduling flag
eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_WAITING; eNB_dlsch_info[module_idP][CC_id][UE_id].status = S_DL_WAITING;
rnti = UE_RNTI(module_idP,UE_id); rnti = UE_RNTI(module_idP,UE_id);
if (cc->tdd_Config) harq_pid = ((frameP*10)+subframeP)%10; harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP ,subframeP);
else harq_pid = ((frameP*10)+subframeP)&7;
nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
@@ -1688,12 +1617,12 @@ unsigned char *get_dlsch_sdu(module_id_t module_idP,
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void void
update_ul_dci(module_id_t module_idP, update_ul_dci(module_id_t module_idP,
uint8_t CC_idP, rnti_t rntiP, uint8_t daiP) uint8_t CC_idP, rnti_t rntiP, uint8_t daiP, sub_frame_t subframe)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
nfapi_hi_dci0_request_t *HI_DCI0_req = nfapi_hi_dci0_request_t *HI_DCI0_req =
&RC.mac[module_idP]->HI_DCI0_req[CC_idP]; &RC.mac[module_idP]->HI_DCI0_req[CC_idP][subframe];
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
&HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list[0]; &HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list[0];
COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_idP]; COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_idP];
@@ -1704,7 +1633,7 @@ update_ul_dci(module_id_t module_idP,
for (i = 0; for (i = 0;
i < i <
HI_DCI0_req->hi_dci0_request_body.number_of_dci + HI_DCI0_req->hi_dci0_request_body.number_of_dci +
HI_DCI0_req->hi_dci0_request_body.number_of_dci; i++) { HI_DCI0_req->hi_dci0_request_body.number_of_hi; i++) {
if ((hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) && if ((hi_dci0_pdu[i].pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) &&
(hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti == rntiP)) (hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.rnti == rntiP))
@@ -1845,7 +1774,7 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
LOG_D(MAC,"[eNB %d] Frame %d subframe %d: PCCH->PCH CC_id %d UE_id %d, Received %d bytes \n", module_idP, frameP, subframeP, CC_id,i, pcch_sdu_length); LOG_D(MAC,"[eNB %d] Frame %d subframe %d: PCCH->PCH CC_id %d UE_id %d, Received %d bytes \n", module_idP, frameP, subframeP, CC_id,i, pcch_sdu_length);
#ifdef FORMAT1C #ifdef FORMAT1C
//NO SIB //NO SIB
if ((subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) || if ((subframeP == 0 || subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) ||
(subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) { (subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) {
switch (n_rb_dl) { switch (n_rb_dl) {
#if 0 #if 0
@@ -1964,7 +1893,7 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
} }
#else #else
//NO SIB //NO SIB
if ((subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) || if ((subframeP == 0 || subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) ||
(subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) { (subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) {
switch (n_rb_dl) { switch (n_rb_dl) {
case 25: case 25:
@@ -2052,6 +1981,10 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for P_RNTI\n", frameP,subframeP); LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for P_RNTI\n", frameP,subframeP);
dl_req->number_dci++; dl_req->number_dci++;
dl_req->number_pdu++; dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP;
eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST;
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t)); memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE; dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
@@ -2092,6 +2025,7 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
TX_req->num_segments = 1; TX_req->num_segments = 1;
TX_req->segments[0].segment_length = pcch_sdu_length; TX_req->segments[0].segment_length = pcch_sdu_length;
TX_req->segments[0].segment_data = cc[CC_id].PCCH_pdu.payload; TX_req->segments[0].segment_data = cc[CC_id].PCCH_pdu.payload;
eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
eNB->TX_req[CC_id].tx_request_body.number_of_pdus++; eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
} else { } else {
LOG_E(MAC,"[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A/1C for Paging\n",module_idP, CC_id, frameP, subframeP); LOG_E(MAC,"[eNB %d] CCid %d Frame %d, subframe %d : Cannot add DCI 1A/1C for Paging\n",module_idP, CC_id, frameP, subframeP);
File diff suppressed because it is too large Load Diff
+131
View File
@@ -0,0 +1,131 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file eNB_scheduler_fairRR.h
* \brief eNB scheduler fair round robin header
* \author Masayuki Harada
* \date 2018
* \email masayuki.harada@jp.fujitsu.com
* \version 1.0
* @ingroup _mac
*/
#ifndef __LAYER2_MAC_ENB_SCHEDULER_FAIRRR_H__
#define __LAYER2_MAC_ENB_SCHEDULER_FAIRRR_H__
/* define */
enum SCH_UE_PRIORITY {
SCH_PRIORITY_NONE,
SCH_DL_SI,
SCH_DL_PAGING,
SCH_DL_MSG2,
SCH_DL_MSG4,
SCH_UL_PRACH,
SCH_UL_MSG3,
SCH_DL_RETRANS,
SCH_UL_RETRANS,
SCH_DL_FIRST,
SCH_UL_FIRST,
SCH_UL_INACTIVE
};
typedef struct {
int UE_id;
enum SCH_UE_PRIORITY ue_priority;
rnti_t rnti;
uint16_t nb_rb;
} DLSCH_UE_INFO;
typedef struct {
uint16_t ue_num;
DLSCH_UE_INFO list[20];
} DLSCH_UE_SELECT;
typedef struct {
int UE_id;
enum SCH_UE_PRIORITY ue_priority;
uint8_t start_rb;
uint8_t nb_rb;
uint16_t ul_total_buffer;
} ULSCH_UE_INFO;
typedef struct {
uint8_t ue_num;
ULSCH_UE_INFO list[20];
} ULSCH_UE_SELECT;
/* proto */
void set_dl_ue_select_msg2(int CC_idP, uint16_t nb_rb, int UE_id, rnti_t rnti);
void set_dl_ue_select_msg4(int CC_idP, uint16_t nb_rb, int UE_id, rnti_t rnti);
void dlsch_scheduler_pre_ue_select_fairRR(
module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP,
int* mbsfn_flag,
uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs]);
void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id,
frame_t frameP,
sub_frame_t subframeP,
int N_RBG[MAX_NUM_CCs],
int *mbsfn_flag);
void fill_DLSCH_dci_fairRR(
module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP,
int* mbsfn_flagP);
void schedule_ue_spec_fairRR(module_id_t module_idP,
frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag);
void ulsch_scheduler_pre_ue_select_fairRR(
module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP,
sub_frame_t sched_subframeP,
ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]);
void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP,
sub_frame_t sched_subframeP,
ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]);
void schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP,
sub_frame_t subframeP);
void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP,
unsigned char sched_subframeP,
ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]);
/* extern */
extern DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs];
extern int last_dlsch_ue_id[MAX_NUM_CCs];
extern int last_ulsch_ue_id[MAX_NUM_CCs];
#endif
+307 -63
View File
@@ -60,6 +60,7 @@
#define ENABLE_MAC_PAYLOAD_DEBUG #define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1 #define DEBUG_eNB_SCHEDULER 1
extern uint16_t frame_cnt;
int choose(int n, int k) int choose(int n, int k)
{ {
@@ -579,6 +580,56 @@ int is_UL_sf(COMMON_channels_t * ccP, sub_frame_t subframeP)
} }
} }
int is_S_sf(COMMON_channels_t * ccP, sub_frame_t subframeP)
{
// if FDD return dummy value
if (ccP->tdd_Config == NULL)
return (0);
switch (subframeP) {
case 1:
return (1);
break;
case 6:
if(ccP->tdd_Config->subframeAssignment == 0 || ccP->tdd_Config->subframeAssignment == 1
|| ccP->tdd_Config->subframeAssignment == 2 || ccP->tdd_Config->subframeAssignment == 6)
return (1);
break;
default:
return (0);
break;
}
return 0;
}
uint8_t ul_subframe2_k_phich(COMMON_channels_t * cc, sub_frame_t ul_subframe){
if(cc->tdd_Config){//TODO fill other tdd config
switch(cc->tdd_Config->subframeAssignment){
case 0:
break;
case 1:
if(ul_subframe == 2 || ul_subframe == 7)
return 4;
else if(ul_subframe == 3 || ul_subframe == 8)
return 6;
else return 255;
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
}
}
return 4; //idk sf_ahead?
}
uint16_t get_pucch1_absSF(COMMON_channels_t * cc, uint16_t dlsch_absSF) uint16_t get_pucch1_absSF(COMMON_channels_t * cc, uint16_t dlsch_absSF)
{ {
uint16_t sf, f, nextf; uint16_t sf, f, nextf;
@@ -592,40 +643,52 @@ uint16_t get_pucch1_absSF(COMMON_channels_t * cc, uint16_t dlsch_absSF)
switch (cc->tdd_Config->subframeAssignment) { switch (cc->tdd_Config->subframeAssignment) {
case 0: case 0:
AssertFatal(1 == 0, "SFA 0 to be filled in now, :-)\n"); if ((sf == 0) || (sf == 5))
return ((10 * f) + sf + 4)% 10240; // ACK/NAK in SF 4,9 same frame
else if (sf == 6)
return ((10 * nextf) + 2)% 10240; // ACK/NAK in SF 2 next frame
else if (sf == 1)
return ((10 * f) + 7)% 10240; // ACK/NAK in SF 7 same frame
else
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 0\n",
sf);
break; break;
case 1: case 1:
if ((sf == 5) || (sf == 6)) if ((sf == 5) || (sf == 6))
return ((10 * nextf) + 2); // ACK/NAK in SF 2 next frame return ((10 * nextf) + 2)% 10240; // ACK/NAK in SF 2 next frame
else if (sf == 9) else if (sf == 9)
return ((10 * nextf) + 3); // ACK/NAK in SF 3 next frame return ((10 * nextf) + 3)% 10240; // ACK/NAK in SF 3 next frame
else if ((sf == 0) || (sf == 1)) else if ((sf == 0) || (sf == 1))
return ((10 * f) + 2); // ACK/NAK in SF 7 same frame return ((10 * f) + 7)% 10240; // ACK/NAK in SF 7 same frame
else if (sf == 4)
return ((10 * f) + 8)% 10240; // ACK/NAK in SF 8 same frame
else else
AssertFatal(1 == 0, AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 3\n", "Impossible dlsch subframe %d for TDD configuration 1\n",
sf); sf);
break; break;
case 2: case 2:
if ((sf == 4) || (sf == 5) || (sf == 6) || (sf == 8)) if ((sf == 4) || (sf == 5) || (sf == 6) || (sf == 8))
return ((10 * nextf) + 2); // ACK/NAK in SF 2 next frame return ((10 * nextf) + 2)% 10240; // ACK/NAK in SF 2 next frame
else if (sf == 9) else if (sf == 9)
return ((10 * nextf) + 7); // ACK/NAK in SF 7 next frame return ((10 * nextf) + 7)% 10240; // ACK/NAK in SF 7 next frame
else if ((sf == 0) || (sf == 1) || (sf == 3)) else if ((sf == 0) || (sf == 1) || (sf == 3))
return ((10 * f) + 7); // ACK/NAK in SF 7 same frame return ((10 * f) + 7)% 10240; // ACK/NAK in SF 7 same frame
else else
AssertFatal(1 == 0, AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 3\n", "Impossible dlsch subframe %d for TDD configuration 2\n",
sf); sf);
break; break;
case 3: case 3:
if ((sf == 5) || (sf == 6) || (sf == 7) || (sf == 8) if ((sf == 5) || (sf == 6) || (sf == 7) || (sf == 8)
|| (sf == 9)) || (sf == 9))
return ((10 * nextf) + (sf >> 1)); // ACK/NAK in 2,3,4 resp. next frame return ((10 * nextf) + ((sf-1) >> 1))% 10240; // ACK/NAK in 2,3,4 resp. next frame
else if (sf == 1) else if (sf == 1)
return ((10 * nextf) + 2); // ACK/NAK in 2 next frame return ((10 * nextf) + 2)% 10240; // ACK/NAK in 2 next frame
else if (sf == 0) else if (sf == 0)
return ((10 * f) + 4); // ACK/NAK in 4 same frame return ((10 * f) + 4)% 10240; // ACK/NAK in 4 same frame
else else
AssertFatal(1 == 0, AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 3\n", "Impossible dlsch subframe %d for TDD configuration 3\n",
@@ -653,7 +716,16 @@ uint16_t get_pucch1_absSF(COMMON_channels_t * cc, uint16_t dlsch_absSF)
sf); sf);
break; break;
case 6: case 6:
AssertFatal(1 == 0, "SFA 6 To be filled in now, :-)\n"); if ((sf == 5) || (sf == 6))
return ((10 * f) + sf + 7)% 10240; // ACK/NAK in SF 2,3 next frame
else if (sf == 9)
return ((10 * nextf) + 4)% 10240; // ACK/NAK in SF 4 next frame
else if ((sf == 1) || (sf == 0))
return ((10 * f) + sf + 7)% 10240; // ACK/NAK in SF 7 same frame
else
AssertFatal(1 == 0,
"Impossible dlsch subframe %d for TDD configuration 6\n",
sf);
break; break;
default: default:
AssertFatal(1 == 0, "Illegal TDD subframe Assigment %d\n", AssertFatal(1 == 0, "Illegal TDD subframe Assigment %d\n",
@@ -1228,7 +1300,7 @@ program_dlsch_acknak(module_id_t module_idP, int CC_idP, int UE_idP,
if (ulsch_harq_information) if (ulsch_harq_information)
fill_nfapi_ulsch_harq_information(module_idP, CC_idP, fill_nfapi_ulsch_harq_information(module_idP, CC_idP,
rnti, ulsch_harq_information); rnti, ulsch_harq_information,subframeP);
if (harq_information) if (harq_information)
fill_nfapi_harq_information(module_idP, CC_idP, fill_nfapi_harq_information(module_idP, CC_idP,
@@ -1237,10 +1309,10 @@ program_dlsch_acknak(module_id_t module_idP, int CC_idP, int UE_idP,
harq_information, cce_idx); harq_information, cce_idx);
} }
uint8_t get_V_UL_DAI(module_id_t module_idP, int CC_idP, uint16_t rntiP) uint8_t get_V_UL_DAI(module_id_t module_idP, int CC_idP, uint16_t rntiP,sub_frame_t subframeP)
{ {
nfapi_hi_dci0_request_body_t *HI_DCI0_req = nfapi_hi_dci0_request_body_t *HI_DCI0_req =
&RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body; &RC.mac[module_idP]->HI_DCI0_req[CC_idP][subframeP].hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
&HI_DCI0_req->hi_dci0_pdu_list[0]; &HI_DCI0_req->hi_dci0_pdu_list[0];
@@ -1258,7 +1330,8 @@ fill_nfapi_ulsch_harq_information(module_id_t module_idP,
int CC_idP, int CC_idP,
uint16_t rntiP, uint16_t rntiP,
nfapi_ul_config_ulsch_harq_information nfapi_ul_config_ulsch_harq_information
* harq_information) * harq_information,
sub_frame_t subframeP)
{ {
eNB_MAC_INST *eNB = RC.mac[module_idP]; eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP]; COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
@@ -1318,7 +1391,7 @@ fill_nfapi_ulsch_harq_information(module_id_t module_idP,
if (harq_information->harq_information_rel10.ack_nack_mode == if (harq_information->harq_information_rel10.ack_nack_mode ==
1) 1)
harq_information->harq_information_rel10.harq_size = harq_information->harq_information_rel10.harq_size =
get_V_UL_DAI(module_idP, CC_idP, rntiP); get_V_UL_DAI(module_idP, CC_idP, rntiP,subframeP);
else else
harq_information->harq_information_rel10.harq_size = 1; harq_information->harq_information_rel10.harq_size = 1;
} }
@@ -1330,7 +1403,7 @@ fill_nfapi_ulsch_harq_information(module_id_t module_idP,
if (harq_information->harq_information_rel10.ack_nack_mode == if (harq_information->harq_information_rel10.ack_nack_mode ==
1) 1)
harq_information->harq_information_rel10.harq_size = harq_information->harq_information_rel10.harq_size =
get_V_UL_DAI(module_idP, CC_idP, rntiP); get_V_UL_DAI(module_idP, CC_idP, rntiP,subframeP);
else else
harq_information->harq_information_rel10.harq_size = 2; harq_information->harq_information_rel10.harq_size = 2;
} }
@@ -1373,29 +1446,38 @@ fill_nfapi_harq_information(module_id_t module_idP,
case 6: case 6:
case 7: case 7:
if (cc->tdd_Config != NULL) { if (cc->tdd_Config != NULL) {
AssertFatal(UE_list-> // AssertFatal(UE_list->
UE_template[CC_idP] // UE_template[CC_idP]
[UE_id].physicalConfigDedicated-> // [UE_id].physicalConfigDedicated->
pucch_ConfigDedicated != NULL, // pucch_ConfigDedicated != NULL,
"pucch_ConfigDedicated is null for TDD!\n"); // "pucch_ConfigDedicated is null for TDD!\n");
if ((UE_list-> if (UE_list->
UE_template[CC_idP][UE_id].physicalConfigDedicated-> UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL){
pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL) if ((UE_list->
&& (*UE_list-> UE_template[CC_idP][UE_id].physicalConfigDedicated->
UE_template[CC_idP][UE_id].physicalConfigDedicated-> pucch_ConfigDedicated != NULL)
pucch_ConfigDedicated->tdd_AckNackFeedbackMode == && (UE_list->
PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing)) UE_template[CC_idP][UE_id].physicalConfigDedicated->
{ pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL)
harq_information->harq_information_rel10_tdd.harq_size = 2; // 2-bit ACK/NAK && (*UE_list->
harq_information->harq_information_rel10_tdd.ack_nack_mode = 1; // multiplexing UE_template[CC_idP][UE_id].physicalConfigDedicated->
} else { pucch_ConfigDedicated->tdd_AckNackFeedbackMode ==
harq_information->harq_information_rel10_tdd.harq_size = 1; // 1-bit ACK/NAK PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing))
harq_information->harq_information_rel10_tdd.ack_nack_mode = 0; // bundling {
} harq_information->harq_information_rel10_tdd.harq_size = 2; // 2-bit ACK/NAK
harq_information->harq_information_rel10_tdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG; harq_information->harq_information_rel10_tdd.ack_nack_mode = 1; // multiplexing
harq_information->harq_information_rel10_tdd.n_pucch_1_0 = } else {
cc->radioResourceConfigCommon->pucch_ConfigCommon. harq_information->harq_information_rel10_tdd.harq_size = 1; // 1-bit ACK/NAK
n1PUCCH_AN + cce_idxP; harq_information->harq_information_rel10_tdd.ack_nack_mode = 0; // bundling
}
} else {
harq_information->harq_information_rel10_tdd.harq_size = 1; // 1-bit ACK/NAK
harq_information->harq_information_rel10_tdd.ack_nack_mode = 0; // bundling
}
harq_information->harq_information_rel10_tdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG;
LTE_DL_FRAME_PARMS *frame_parms = &RC.eNB[module_idP][CC_idP]->frame_parms;
harq_information->harq_information_rel10_tdd.n_pucch_1_0 = get_Np(frame_parms->N_RB_DL,cce_idxP,0) +
cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + cce_idxP;
harq_information-> harq_information->
harq_information_rel10_tdd.number_of_pucch_resources = 1; harq_information_rel10_tdd.number_of_pucch_resources = 1;
} else { } else {
@@ -1629,8 +1711,10 @@ fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t *
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 2; ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 2;
else if (mcs < 21) else if (mcs < 21)
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 4; ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 4;
else else if(mcs < 29)
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 6; ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 6;
else
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 0;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms = ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms =
cyclic_shift_2_for_drms; cyclic_shift_2_for_drms;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8. ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.
@@ -2193,6 +2277,27 @@ int rrc_mac_remove_ue(module_id_t mod_idP, rnti_t rntiP)
cancel_ra_proc(mod_idP, pCC_id, 0, rntiP); cancel_ra_proc(mod_idP, pCC_id, 0, rntiP);
} }
pthread_mutex_lock(&rrc_release_freelist);
if(rrc_release_info.num_UEs > 0){
uint16_t release_total = 0;
for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){
if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0){
release_total++;
}else{
continue;
}
if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rntiP){
rrc_release_info.RRC_release_ctrl[release_num].flag = 0;
rrc_release_info.num_UEs--;
release_total--;
}
if(release_total >= rrc_release_info.num_UEs){
break;
}
}
}
pthread_mutex_unlock(&rrc_release_freelist);
return 0; return 0;
} }
@@ -3102,7 +3207,7 @@ allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP,
nfapi_dl_config_request_body_t *DL_req = nfapi_dl_config_request_body_t *DL_req =
&RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body; &RC.mac[module_idP]->DL_req[CC_idP].dl_config_request_body;
nfapi_hi_dci0_request_body_t *HI_DCI0_req = nfapi_hi_dci0_request_body_t *HI_DCI0_req =
&RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body; &RC.mac[module_idP]->HI_DCI0_req[CC_idP][subframeP].hi_dci0_request_body;
nfapi_dl_config_request_pdu_t *dl_config_pdu = nfapi_dl_config_request_pdu_t *dl_config_pdu =
&DL_req->dl_config_pdu_list[0]; &DL_req->dl_config_pdu_list[0];
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
@@ -3113,10 +3218,16 @@ allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP,
int fCCE; int fCCE;
int i, j, idci; int i, j, idci;
int nCCE = 0; int nCCE = 0;
int max_symbol;
eNB_MAC_INST *eNB = RC.mac[module_idP]; eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP]; COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
int ackNAK_absSF = get_pucch1_absSF(cc, (frameP*10+subframeP)); int ackNAK_absSF = get_pucch1_absSF(cc, (frameP*10+subframeP));
if (cc->tdd_Config!=NULL && is_S_sf(cc,subframeP) > 0)
max_symbol = 2;
else
max_symbol = 3;
nfapi_ul_config_request_body_t *ul_req = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF % 10].ul_config_request_body; nfapi_ul_config_request_body_t *ul_req = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF % 10].ul_config_request_body;
LOG_D(MAC, LOG_D(MAC,
@@ -3146,7 +3257,7 @@ allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP,
if (nCCE + if (nCCE +
(dl_config_pdu[i].dci_dl_pdu. (dl_config_pdu[i].dci_dl_pdu.
dci_dl_pdu_rel8.aggregation_level) > nCCE_max) { dci_dl_pdu_rel8.aggregation_level) > nCCE_max) {
if (DL_req->number_pdcch_ofdm_symbols == 3) if (DL_req->number_pdcch_ofdm_symbols == max_symbol)
goto failed; goto failed;
LOG_D(MAC, LOG_D(MAC,
"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n", "Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",
@@ -3168,7 +3279,7 @@ allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP,
dci_dl_pdu.dci_dl_pdu_rel8.rnti, dci_dl_pdu.dci_dl_pdu_rel8.rnti,
subframeP); subframeP);
if (fCCE == -1) { if (fCCE == -1) {
if (DL_req->number_pdcch_ofdm_symbols == 3) { if (DL_req->number_pdcch_ofdm_symbols == max_symbol) {
LOG_D(MAC, LOG_D(MAC,
"subframe %d: Dropping Allocation for RNTI %x\n", "subframe %d: Dropping Allocation for RNTI %x\n",
subframeP, subframeP,
@@ -3244,7 +3355,7 @@ allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP,
if (nCCE + if (nCCE +
(hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level) > (hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.aggregation_level) >
nCCE_max) { nCCE_max) {
if (DL_req->number_pdcch_ofdm_symbols == 3) if (DL_req->number_pdcch_ofdm_symbols == max_symbol)
goto failed; goto failed;
LOG_D(MAC, LOG_D(MAC,
"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n", "Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",
@@ -3266,7 +3377,7 @@ allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP,
hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8. hi_dci0_pdu[i].dci_pdu.dci_pdu_rel8.
rnti, subframeP); rnti, subframeP);
if (fCCE == -1) { if (fCCE == -1) {
if (DL_req->number_pdcch_ofdm_symbols == 3) { if (DL_req->number_pdcch_ofdm_symbols == max_symbol) {
LOG_D(MAC, LOG_D(MAC,
"subframe %d: Dropping Allocation for RNTI %x\n", "subframe %d: Dropping Allocation for RNTI %x\n",
subframeP, subframeP,
@@ -3334,7 +3445,7 @@ allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP,
if (nCCE + if (nCCE +
(dl_config_pdu[i].dci_dl_pdu. (dl_config_pdu[i].dci_dl_pdu.
dci_dl_pdu_rel8.aggregation_level) > nCCE_max) { dci_dl_pdu_rel8.aggregation_level) > nCCE_max) {
if (DL_req->number_pdcch_ofdm_symbols == 3) if (DL_req->number_pdcch_ofdm_symbols == max_symbol)
goto failed; goto failed;
LOG_D(MAC, LOG_D(MAC,
"Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n", "Can't fit DCI allocations with %d PDCCH symbols, increasing by 1\n",
@@ -3357,7 +3468,7 @@ allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP,
dci_dl_pdu.dci_dl_pdu_rel8.rnti, dci_dl_pdu.dci_dl_pdu_rel8.rnti,
subframeP); subframeP);
if (fCCE == -1) { if (fCCE == -1) {
if (DL_req->number_pdcch_ofdm_symbols == 3) { if (DL_req->number_pdcch_ofdm_symbols == max_symbol) {
LOG_I(MAC, LOG_I(MAC,
"subframe %d: Dropping Allocation for RNTI %x\n", "subframe %d: Dropping Allocation for RNTI %x\n",
subframeP, subframeP,
@@ -3366,7 +3477,7 @@ allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP,
for (j = 0; j <= i; j++) { for (j = 0; j <= i; j++) {
if (dl_config_pdu[j].pdu_type == if (dl_config_pdu[j].pdu_type ==
NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
LOG_I(MAC, LOG_D(MAC,
"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", "DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
j, j,
DL_req->number_dci + DL_req->number_dci +
@@ -3413,8 +3524,12 @@ allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP,
if(((ul_req->ul_config_pdu_list[ack_int].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE) || if(((ul_req->ul_config_pdu_list[ack_int].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE) ||
(ul_req->ul_config_pdu_list[ack_int].pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE)) && (ul_req->ul_config_pdu_list[ack_int].pdu_type == NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE)) &&
(ul_req->ul_config_pdu_list[ack_int].uci_harq_pdu.ue_information.ue_information_rel8.rnti == dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti)){ (ul_req->ul_config_pdu_list[ack_int].uci_harq_pdu.ue_information.ue_information_rel8.rnti == dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti)){
ul_req->ul_config_pdu_list[ack_int].uci_harq_pdu.harq_information.harq_information_rel9_fdd.n_pucch_1_0 = if (cc->tdd_Config==NULL)
ul_req->ul_config_pdu_list[ack_int].uci_harq_pdu.harq_information.harq_information_rel9_fdd.n_pucch_1_0 =
cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + fCCE; cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + fCCE;
else
ul_req->ul_config_pdu_list[ack_int].uci_harq_pdu.harq_information.harq_information_rel10_tdd.n_pucch_1_0 =
cc->radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN + fCCE + get_Np(to_prb(cc->mib->message.dl_Bandwidth),fCCE,0) ;
} }
} }
} }
@@ -3567,7 +3682,7 @@ CCE_allocation_infeasible(int module_idP,
nfapi_dl_config_request_pdu_t *dl_config_pdu = nfapi_dl_config_request_pdu_t *dl_config_pdu =
&DL_req->dl_config_pdu_list[DL_req->number_pdu]; &DL_req->dl_config_pdu_list[DL_req->number_pdu];
nfapi_hi_dci0_request_body_t *HI_DCI0_req = nfapi_hi_dci0_request_body_t *HI_DCI0_req =
&RC.mac[module_idP]->HI_DCI0_req[CC_idP].hi_dci0_request_body; &RC.mac[module_idP]->HI_DCI0_req[CC_idP][subframe].hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
&HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci + &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci +
HI_DCI0_req->number_of_hi]; HI_DCI0_req->number_of_hi];
@@ -3622,6 +3737,77 @@ CCE_allocation_infeasible(int module_idP,
return res; return res;
} }
void get_retransmission_timing(TDD_Config_t *tdd_Config, frame_t *frameP,
sub_frame_t *subframeP)
{
if (tdd_Config == NULL)
{
if (*subframeP > 1)
*frameP = (*frameP + 1) % 1024;
*subframeP = (*subframeP + 8) % 10;
}
else
{
switch (tdd_Config->subframeAssignment)//TODO fill in other TDD configs
{
case 1:
if (*subframeP == 0 || *subframeP == 5)
{
*subframeP += 19;
*frameP = (*frameP + *subframeP/10) % 1024;
*subframeP %= 10;
}
else if (*subframeP == 4 || *subframeP == 9)
{
*subframeP += 16;
*frameP = (*frameP + *subframeP/10) % 1024;
*subframeP %= 10;
}
else
{
AssertFatal(2 == 1,
"Illegal dl subframe %d for tdd config %d\n", *subframeP,
tdd_Config->subframeAssignment);
}
break;
}
}
}
uint8_t get_dl_subframe_count(int tdd_config_sfa, sub_frame_t subframeP){
uint8_t tdd1[10] = {1,-1,-1,-1,2,3,-1,-1,-1,4}; // special subframes 1,6 are excluded
switch(tdd_config_sfa){// TODO fill in other tdd configs
case 1 :
return tdd1[subframeP];
break;
}
return -1;
}
uint8_t frame_subframe2_dl_harq_pid(TDD_Config_t *tdd_Config, int abs_frameP, sub_frame_t subframeP){
int harq_pid;
if(tdd_Config){
switch(tdd_Config->subframeAssignment){ //TODO fill in other tdd config
case 1:
harq_pid = (((frame_cnt*1024 + abs_frameP) * 4) - 1 + get_dl_subframe_count(tdd_Config->subframeAssignment,subframeP))%7;//4 dl subframe in a frame
if(harq_pid < 0)
harq_pid += 7;
LOG_D(MAC,"[frame_subframe2_dl_harq_pid] (%d,%d) calculate harq_pid ((( %d * 1024 + %d) *4) - 1 + %d)%7 = %d \n",
(abs_frameP+1024)%1024,subframeP,frame_cnt,abs_frameP,
get_dl_subframe_count(tdd_Config->subframeAssignment,subframeP),harq_pid);
return harq_pid;
break;
}
}else{
return ((abs_frameP*10)+subframeP)&7;
}
return -1;
}
void void
extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
@@ -3639,8 +3825,12 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
int pCCid = UE_list->pCC_id[UE_id]; int pCCid = UE_list->pCC_id[UE_id];
int spatial_bundling = 0; int spatial_bundling = 0;
int tmode[5]; int tmode[5];
int i, j; int i, j, m;
uint8_t *pdu; uint8_t *pdu;
LTE_DL_FRAME_PARMS *fp;
sub_frame_t subframe_tx;
int frame_tx;
uint8_t harq_pid;
#ifdef Rel14 #ifdef Rel14
if (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated != NULL && if (UE_list->UE_template[pCCid][UE_id].physicalConfigDedicated != NULL &&
@@ -3660,22 +3850,64 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
&& (format == 1)))) && (format == 1))))
spatial_bundling = 1; spatial_bundling = 1;
#endif #endif
fp=&(RC.eNB[mod_idP][CC_idP]->frame_parms);
for (i = 0; i < numCC; i++) for (i = 0; i < numCC; i++)
tmode[i] = get_tmode(mod_idP, i, UE_id); tmode[i] = get_tmode(mod_idP, i, UE_id);
if (cc->tdd_Config) { if (cc->tdd_Config) {
harq_indication_tdd = harq_indication_tdd = (nfapi_harq_indication_tdd_rel13_t *) harq_indication;
(nfapi_harq_indication_tdd_rel13_t *) harq_indication;
// pdu = &harq_indication_tdd->harq_tb_n[0]; // pdu = &harq_indication_tdd->harq_tb_n[0];
num_ack_nak = harq_indication_tdd->number_of_ack_nack; num_ack_nak = harq_indication_tdd->number_of_ack_nack;
switch (harq_indication_tdd->mode) { switch (harq_indication_tdd->mode) {
case 0: // Format 1a/b case 0: // Format 1a/b bundling
AssertFatal(numCC == 1, AssertFatal(numCC == 1, "numCC %d > 1, should not be using Format1a/b\n", numCC);
"numCC %d > 1, should not be using Format1a/b\n", int M = ul_ACK_subframe2_M(fp,subframeP);
numCC); for(m=0;m<M;m++){
subframe_tx = ul_ACK_subframe2_dl_subframe(fp,subframeP,m);
if(frameP==1023&&subframeP>5)
frame_tx=-1;
else
frame_tx = subframeP < 4 ? frameP -1 : frameP;
harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frame_tx,subframe_tx);
RA_t *ra = &RC.mac[mod_idP]->common_channels[CC_idP].ra[0];
if(num_ack_nak==1){
if(harq_indication_tdd->harq_data[0].bundling.value_0==1){ //ack
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
LOG_D(MAC,"frame %d subframe %d Acking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
}else{ //nack
if( sched_ctl->round[CC_idP][harq_pid]<8)
sched_ctl->round[CC_idP][harq_pid]++;
LOG_D(MAC,"frame %d subframe %d Nacking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
if(sched_ctl->round[CC_idP][harq_pid] == 8){
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)){
//Msg NACK num to MAC ,remove UE
// add UE info to freeList
LOG_I(RRC, "put UE %x into freeList\n", rnti);
put_UE_in_freelist(mod_idP, rnti, 1);
}
}
}
}
}
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if ((ra[ra_i].rnti == rnti) && (ra[ra_i].state == MSGCRNTI_ACK) && (ra[ra_i].crnti_harq_pid == harq_pid)) {
LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",harq_indication_tdd->harq_data[0].bundling.value_0,rnti,sched_ctl->round[CC_idP][harq_pid],frameP,subframeP);
if(num_ack_nak == 1 && harq_indication_tdd->harq_data[0].bundling.value_0 == 1) {
cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
}else{
if(sched_ctl->round[CC_idP][harq_pid] == 7){
cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
}
}
break;
}
}
}
break; break;
case 1: // Channel Selection case 1: // Channel Selection
break; break;
@@ -3692,7 +3924,7 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
num_ack_nak = harq_indication_fdd->number_of_ack_nack; num_ack_nak = harq_indication_fdd->number_of_ack_nack;
pdu = &harq_indication_fdd->harq_tb_n[0]; pdu = &harq_indication_fdd->harq_tb_n[0];
uint8_t harq_pid = ((10 * frameP) + subframeP + 10236) & 7; harq_pid = ((10 * frameP) + subframeP + 10236) & 7;
LOG_D(MAC,"frame %d subframe %d harq_pid %d mode %d tmode[0] %d num_ack_nak %d round %d\n",frameP,subframeP,harq_pid,harq_indication_fdd->mode,tmode[0],num_ack_nak,sched_ctl->round[CC_idP][harq_pid]); LOG_D(MAC,"frame %d subframe %d harq_pid %d mode %d tmode[0] %d num_ack_nak %d round %d\n",frameP,subframeP,harq_pid,harq_indication_fdd->mode,tmode[0],num_ack_nak,sched_ctl->round[CC_idP][harq_pid]);
@@ -3735,8 +3967,19 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
if (pdu[0] == 1) { // ACK if (pdu[0] == 1) { // ACK
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0; sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
} else if (pdu[0] == 2 || pdu[0] == 4) // NAK (treat DTX as NAK) } else if (pdu[0] == 2 || pdu[0] == 4){ // NAK (treat DTX as NAK)
sched_ctl->round[CC_idP][harq_pid]++; // increment round sched_ctl->round[CC_idP][harq_pid]++; // increment round
if(sched_ctl->round[CC_idP][harq_pid] == 8){
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)){
//Msg NACK num to MAC ,remove UE
// add UE info to freeList
LOG_I(RRC, "put UE %x into freeList\n", rnti);
put_UE_in_freelist(mod_idP, rnti, 1);
}
}
}
}
} else { } else {
// one or two ACK/NAK bits // one or two ACK/NAK bits
AssertFatal(num_ack_nak > 2, AssertFatal(num_ack_nak > 2,
@@ -4424,6 +4667,7 @@ cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP,
extract_pusch_csi(mod_idP, CC_idP, UE_id, frameP, subframeP, extract_pusch_csi(mod_idP, CC_idP, UE_id, frameP, subframeP,
pdu, rel9->length); pdu, rel9->length);
LOG_D(MAC,"Frame %d Subframe %d update CQI:%d\n",frameP,subframeP,sched_ctl->dl_cqi[CC_idP]);
} }
// timing advance // timing advance
+140 -503
View File
@@ -73,7 +73,7 @@ extern uint8_t nfapi_mode;
// This table holds the allowable PRB sizes for ULSCH transmissions // This table holds the allowable PRB sizes for ULSCH transmissions
uint8_t rb_table[34] = uint8_t rb_table[34] =
{ 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32, { 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32,
36, 40, 45, 48, 50, 54, 60, 64, 72, 75, 80, 81, 90, 96, 100 36, 40, 45, 48, 50, 54, 60, 72, 75, 80, 81, 90, 96, 100, 100
}; };
extern mui_t rrc_eNB_mui; extern mui_t rrc_eNB_mui;
@@ -165,6 +165,9 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid], UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid],
ul_cqi); ul_cqi);
if(ul_cqi>200){ // too high energy pattern
UE_list->UE_sched_ctrl[UE_id].pusch_snr[CC_idP] = ul_cqi;
}
// AssertFatal(1==0,"ulsch in error\n"); // AssertFatal(1==0,"ulsch in error\n");
if (UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] == 3) { if (UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] == 3) {
UE_list->UE_sched_ctrl[UE_id].ul_scheduled &= (~(1 << harq_pid)); UE_list->UE_sched_ctrl[UE_id].ul_scheduled &= (~(1 << harq_pid));
@@ -175,6 +178,32 @@ rx_sdu(const module_id_t enb_mod_idP,
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
} else } else
UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]++; UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid]++;
first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid];
// Program NACK for PHICH
LOG_D(MAC,
"Programming PHICH NACK for rnti %x harq_pid %d (first_rb %d)\n",
current_rnti, harq_pid, first_rb);
nfapi_hi_dci0_request_t *hi_dci0_req;
uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP] , subframeP);
hi_dci0_req = &mac->HI_DCI0_req[CC_idP][(subframeP+sf_ahead_dl)%10];
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
&hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
memset((void *) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_hi_pdu);
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start = first_rb;
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = 0;
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value = 0;
hi_dci0_req_body->number_of_hi++;
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP,subframeP, 0);
hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP,sf_ahead_dl);
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
return; return;
} }
@@ -196,7 +225,7 @@ rx_sdu(const module_id_t enb_mod_idP,
if (sduP == NULL) { // we've got an error on Msg3 if (sduP == NULL) { // we've got an error on Msg3
LOG_D(MAC, LOG_D(MAC,
"[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n", "[eNB %d] CC_id %d, RA %d ULSCH in error in round(Msg3) %d/%d\n",
enb_mod_idP, CC_idP, RA_id, enb_mod_idP, CC_idP, RA_id,
ra[RA_id].msg3_round, ra[RA_id].msg3_round,
(int) mac->common_channels[CC_idP]. (int) mac->common_channels[CC_idP].
@@ -214,8 +243,9 @@ rx_sdu(const module_id_t enb_mod_idP,
first_rb_ul[harq_pid]; first_rb_ul[harq_pid];
ra[RA_id].msg3_round++; ra[RA_id].msg3_round++;
// prepare handling of retransmission // prepare handling of retransmission
ra[RA_id].Msg3_frame = (ra[RA_id].Msg3_frame + ((ra[RA_id].Msg3_subframe > 1) ? 1 : 0)) % 1024; get_Msg3allocret(&mac->common_channels[CC_idP],
ra[RA_id].Msg3_subframe = (ra[RA_id].Msg3_subframe + 8) % 10; ra[RA_id].Msg3_subframe, ra[RA_id].Msg3_frame,
&ra[RA_id].Msg3_frame, &ra[RA_id].Msg3_subframe);
add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP, add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP,
subframeP); subframeP);
} }
@@ -230,6 +260,11 @@ rx_sdu(const module_id_t enb_mod_idP,
payload_ptr = payload_ptr =
parse_ulsch_header(sduP, &num_ce, &num_sdu, rx_ces, rx_lcids, parse_ulsch_header(sduP, &num_ce, &num_sdu, rx_ces, rx_lcids,
rx_lengths, sdu_lenP); rx_lengths, sdu_lenP);
if(payload_ptr == NULL){
LOG_E(MAC,"[eNB %d][PUSCH %d] CC_id %d ulsch header unknown lcid(rnti %x, UE_id %d)\n",
enb_mod_idP, harq_pid, CC_idP,current_rnti, UE_id);
return;
}
T(T_ENB_MAC_UE_UL_PDU, T_INT(enb_mod_idP), T_INT(CC_idP), T(T_ENB_MAC_UE_UL_PDU, T_INT(enb_mod_idP), T_INT(CC_idP),
T_INT(current_rnti), T_INT(frameP), T_INT(subframeP), T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
@@ -623,8 +658,9 @@ rx_sdu(const module_id_t enb_mod_idP,
ra[ii].rach_resource_type ra[ii].rach_resource_type
#endif #endif
)) == -1) { )) == -1) {
AssertFatal(1 == 0, LOG_E(MAC,"[MAC][eNB] Max user count reached\n");
"[MAC][eNB] Max user count reached\n"); cancel_ra_proc(enb_mod_idP, CC_idP, frameP,current_rnti);
break;
// kill RA procedure // kill RA procedure
} else } else
LOG_D(MAC, LOG_D(MAC,
@@ -657,9 +693,20 @@ rx_sdu(const module_id_t enb_mod_idP,
if(mac->common_channels[CC_idP].tdd_Config!=NULL){
switch(mac->common_channels[CC_idP].tdd_Config->subframeAssignment){
case 1:
ra->Msg4_frame = frameP + ((subframeP > 2) ? 1 : 0);
ra->Msg4_subframe = (subframeP + 7) % 10;
break;
// TODO need to be complete for other tdd configs.
}
}else{
// Program Msg4 PDCCH+DLSCH/MPDCCH transmission 4 subframes from now, // Check if this is ok for BL/CE, or if the rule is different // Program Msg4 PDCCH+DLSCH/MPDCCH transmission 4 subframes from now, // Check if this is ok for BL/CE, or if the rule is different
ra->Msg4_frame = frameP + ((subframeP > 5) ? 1 : 0); ra->Msg4_frame = frameP + ((subframeP > 5) ? 1 : 0);
ra->Msg4_subframe = (subframeP + 4) % 10; ra->Msg4_subframe = (subframeP + 4) % 10;
}
UE_list->UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0; UE_list->UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0;
} // if process is active } // if process is active
} // loop on RA processes } // loop on RA processes
@@ -791,7 +838,10 @@ rx_sdu(const module_id_t enb_mod_idP,
LOG_D(MAC, LOG_D(MAC,
"Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n", "Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n",
current_rnti, harq_pid, first_rb); current_rnti, harq_pid, first_rb);
nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_idP]; nfapi_hi_dci0_request_t *hi_dci0_req;
uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP] , subframeP);
hi_dci0_req = &mac->HI_DCI0_req[CC_idP][(subframeP+sf_ahead_dl)%10];
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body; nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu =
&hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi]; &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
@@ -805,7 +855,7 @@ rx_sdu(const module_id_t enb_mod_idP,
hi_dci0_req_body->number_of_hi++; hi_dci0_req_body->number_of_hi++;
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP,subframeP, 0); hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP,subframeP, 0);
hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG; hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP, 4); hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP,subframeP,sf_ahead_dl);
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
/* NN--> FK: we could either check the payload, or use a phy helper to detect a false msg3 */ /* NN--> FK: we could either check the payload, or use a phy helper to detect a false msg3 */
@@ -929,7 +979,8 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header,
ce_len++; ce_len++;
} else { } else {
LOG_E(MAC, "unknown CE %d \n", lcid); LOG_E(MAC, "unknown CE %d \n", lcid);
AssertFatal(1 == 0, "unknown CE"); //AssertFatal(1 == 0, "unknown CE");
return NULL;
} }
} }
} }
@@ -970,9 +1021,7 @@ void
schedule_ulsch(module_id_t module_idP, frame_t frameP, schedule_ulsch(module_id_t module_idP, frame_t frameP,
sub_frame_t subframeP) sub_frame_t subframeP)
{ {
#ifndef UE_EXPANSION
uint16_t first_rb[MAX_NUM_CCs]; uint16_t first_rb[MAX_NUM_CCs];
#endif
uint16_t i; uint16_t i;
int CC_id; int CC_id;
eNB_MAC_INST *mac = RC.mac[module_idP]; eNB_MAC_INST *mac = RC.mac[module_idP];
@@ -982,7 +1031,6 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
start_meas(&mac->schedule_ulsch); start_meas(&mac->schedule_ulsch);
int sched_subframe = (subframeP+4)%10; int sched_subframe = (subframeP+4)%10;
if (sched_subframe < subframeP) sched_frame++;
cc = &mac->common_channels[0]; cc = &mac->common_channels[0];
int tdd_sfa; int tdd_sfa;
@@ -992,18 +1040,16 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
switch (subframeP) { switch (subframeP) {
case 0: case 0:
if ((tdd_sfa == 0)|| if ((tdd_sfa == 0)||
(tdd_sfa == 3)|| (tdd_sfa == 3)) sched_subframe = 4;
(tdd_sfa == 6)) sched_subframe = 4; else if (tdd_sfa==6) sched_subframe = 7;
else return; else return;
break; break;
case 1: case 1:
if ((tdd_sfa==0)|| if ((tdd_sfa==0)||
(tdd_sfa==1)) sched_subframe = 7; (tdd_sfa==1)) sched_subframe = 7;
else if (tdd_sfa==6) sched_subframe = 8; else if (tdd_sfa==6) sched_subframe = 8;
else return;
break; break;
default:
return;
case 2: // Don't schedule UL in subframe 2 for TDD case 2: // Don't schedule UL in subframe 2 for TDD
return; return;
case 3: case 3:
@@ -1016,18 +1062,18 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
break; break;
case 5: case 5:
if (tdd_sfa==0) sched_subframe = 9; if (tdd_sfa==0) sched_subframe = 9;
else if (tdd_sfa==6) sched_subframe = 3; else if (tdd_sfa==6) sched_subframe = 2;
else return; else return;
break; break;
case 6: case 6:
if (tdd_sfa==1) sched_subframe = 2; if (tdd_sfa==0 || tdd_sfa==1) sched_subframe = 2;
else if (tdd_sfa==6) sched_subframe = 3; else if (tdd_sfa==6) sched_subframe = 3;
else return; else return;
break; break;
case 7: case 7:
return; return;
case 8: case 8:
if ((tdd_sfa>=2) || (tdd_sfa<=5)) sched_subframe=2; if ((tdd_sfa>=2) && (tdd_sfa<=5)) sched_subframe=2;
else return; else return;
break; break;
case 9: case 9:
@@ -1037,8 +1083,8 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
break; break;
} }
} }
if (sched_subframe < subframeP) sched_frame++;
#ifndef UE_EXPANSION
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
@@ -1071,54 +1117,8 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
} }
schedule_ulsch_rnti(module_idP, frameP, subframeP, sched_subframe,first_rb); schedule_ulsch_rnti(module_idP, frameP, subframeP, sched_subframe,first_rb);
#else
ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs];
memset(ulsch_ue_select, 0, sizeof(ulsch_ue_select));
LTE_DL_FRAME_PARMS *frame_parms ;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
cc = &mac->common_channels[CC_id];
frame_parms= &RC.eNB[module_idP][CC_id]->frame_parms;
// output of scheduling, the UE numbers in RBs, where it is in the code???
// check if RA (Msg3) is active in this subframeP, if so skip the PRBs used for Msg3
// Msg3 is using 1 PRB so we need to increase first_rb accordingly
// not sure about the break (can there be more than 1 active RA procedure?)
for (i=0; i<NB_RA_PROC_MAX; i++) {
if ((cc->ra[i].state == WAITMSG3) &&(cc->ra[i].Msg3_subframe == sched_subframe)) {
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_MSG3;
if(frame_parms->N_RB_UL == 25){
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 1;
}else{
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 2;
}
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = 1;
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = -1;
ulsch_ue_select[CC_id].ue_num++;
break;
}
}
//PRACH
if (is_prach_subframe(frame_parms,sched_frame,sched_subframe)==1) {
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_PRACH;
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = get_prach_prb_offset(
frame_parms,
frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset,
0,//tdd_mapindex
frameP); //Nf
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = 6;
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = -1;
ulsch_ue_select[CC_id].ue_num++;
}
}
schedule_ulsch_rnti(module_idP, frameP, subframeP, sched_subframe,ulsch_ue_select);
#endif
stop_meas(&mac->schedule_ulsch); stop_meas(&mac->schedule_ulsch);
} }
#ifndef UE_EXPANSION
void void
schedule_ulsch_rnti(module_id_t module_idP, schedule_ulsch_rnti(module_id_t module_idP,
frame_t frameP, frame_t frameP,
@@ -1147,19 +1147,20 @@ schedule_ulsch_rnti(module_id_t module_idP,
UE_sched_ctrl *UE_sched_ctrl; UE_sched_ctrl *UE_sched_ctrl;
int sched_frame = frameP; int sched_frame = frameP;
int rvidx_tab[4] = { 0, 2, 3, 1 }; int rvidx_tab[4] = { 0, 2, 3, 1 };
uint16_t ul_req_index;
uint8_t dlsch_flag;
if (sched_subframeP < subframeP) if (sched_subframeP < subframeP)
sched_frame++; sched_frame++;
nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_id]; nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_id][subframeP];
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body; nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
nfapi_ul_config_request_t *ul_req_tmp = &mac->UL_req_tmp[CC_id][sched_subframeP]; nfapi_ul_config_request_t *ul_req_tmp = &mac->UL_req_tmp[CC_id][sched_subframeP];
nfapi_ul_config_request_body_t *ul_req_tmp_body = &ul_req_tmp->ul_config_request_body; nfapi_ul_config_request_body_t *ul_req_tmp_body = &ul_req_tmp->ul_config_request_body;
nfapi_ul_config_ulsch_harq_information *ulsch_harq_information;
//LOG_D(MAC, "entering ulsch preprocesor\n"); //LOG_D(MAC, "entering ulsch preprocesor\n");
ulsch_scheduler_pre_processor(module_idP, frameP, subframeP, first_rb); ulsch_scheduler_pre_processor(module_idP, frameP, subframeP,sched_subframeP, first_rb);
//LOG_D(MAC, "exiting ulsch preprocesor\n"); //LOG_D(MAC, "exiting ulsch preprocesor\n");
@@ -1296,6 +1297,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
cqi_req = 0; cqi_req = 0;
} else { } else {
cqi_req = 1; cqi_req = 1;
UE_sched_ctrl->cqi_req_flag |= 1 << sched_subframeP;
} }
UE_sched_ctrl->cqi_req_timer = 0; UE_sched_ctrl->cqi_req_timer = 0;
} else } else
@@ -1461,9 +1463,10 @@ schedule_ulsch_rnti(module_id_t module_idP,
cqi_req; cqi_req;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index =
UE_template->DAI_ul[sched_subframeP]; UE_template->DAI_ul[sched_subframeP];
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid;
hi_dci0_req_body->number_of_dci++; hi_dci0_req_body->number_of_dci++;
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP, subframeP, 4); hi_dci0_req_body->sfnsf = sfnsf_add_subframe(sched_frame, sched_subframeP, 0); //(frameP, subframeP, 4)
hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG; hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
hi_dci0_req->sfn_sf = frameP<<4|subframeP; // sfnsf_add_subframe(sched_frame, sched_subframeP, 0); // sunday! hi_dci0_req->sfn_sf = frameP<<4|subframeP; // sfnsf_add_subframe(sched_frame, sched_subframeP, 0); // sunday!
@@ -1474,9 +1477,17 @@ schedule_ulsch_rnti(module_id_t module_idP,
"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", "[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
harq_pid, frameP, subframeP, UE_id, rnti, harq_pid, frameP, subframeP, UE_id, rnti,
sched_frame, sched_subframeP); sched_frame, sched_subframeP);
ul_req_index = 0;
dlsch_flag = 0;
for(ul_req_index = 0;ul_req_index < ul_req_tmp_body->number_of_pdus;ul_req_index++){
if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE){
dlsch_flag = 1;
LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index);
break;
}
}
// Add UL_config PDUs // Add UL_config PDUs
fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, first_rb[CC_id], // resource_block_start fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, first_rb[CC_id], // resource_block_start
rb_table[rb_table_index], // number_of_resource_blocks rb_table[rb_table_index], // number_of_resource_blocks
UE_template->mcs_UL[harq_pid], cshift, // cyclic_shift_2_for_drms UE_template->mcs_UL[harq_pid], cshift, // cyclic_shift_2_for_drms
0, // frequency_hopping_enabled_flag 0, // frequency_hopping_enabled_flag
@@ -1494,22 +1505,41 @@ schedule_ulsch_rnti(module_id_t module_idP,
[rb_table_index])); [rb_table_index]));
#ifdef Rel14 #ifdef Rel14
if (UE_template->rach_resource_type > 0) { // This is a BL/CE UE allocation if (UE_template->rach_resource_type > 0) { // This is a BL/CE UE allocation
fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions
1, //repetition_number 1, //repetition_number
(frameP * (frameP *
10) + 10) +
subframeP); subframeP);
} }
#endif #endif
if(dlsch_flag == 1){
if(cqi_req == 1){
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE;
ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag=NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rb_table[rb_table_index];
}else{
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE;
ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = rb_table[rb_table_index];
}
fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP);
}else{
ul_req_tmp_body->number_of_pdus++;
}
ul_req_tmp->header.message_id = NFAPI_UL_CONFIG_REQUEST; ul_req_tmp->header.message_id = NFAPI_UL_CONFIG_REQUEST;
ul_req_tmp_body->number_of_pdus++;
ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
mac->ul_handle++; mac->ul_handle++;
uint16_t ul_sched_frame = sched_frame; uint16_t ul_sched_frame = sched_frame;
uint16_t ul_sched_subframeP = sched_subframeP; uint16_t ul_sched_subframeP = sched_subframeP;
add_subframe(&ul_sched_frame, &ul_sched_subframeP, 2); // add_subframe(&ul_sched_frame, &ul_sched_subframeP, 2);
ul_req_tmp->sfn_sf = ul_sched_frame<<4|ul_sched_subframeP; ul_req_tmp->sfn_sf = ul_sched_frame<<4|ul_sched_subframeP;
add_ue_ulsch_info(module_idP, add_ue_ulsch_info(module_idP,
@@ -1528,40 +1558,21 @@ schedule_ulsch_rnti(module_id_t module_idP,
T_INT(UE_template->mcs_UL[harq_pid]), T_INT(UE_template->mcs_UL[harq_pid]),
T_INT(first_rb[CC_id]), T_INT(first_rb[CC_id]),
T_INT(rb_table[rb_table_index]), T_INT(round)); T_INT(rb_table[rb_table_index]), T_INT(round));
// fill in NAK information
hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
memset((void *) hi_dci0_pdu, 0,
sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
hi_dci0_pdu->pdu_size =
2 + sizeof(nfapi_hi_dci0_hi_pdu);
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start =
UE_template->first_rb_ul[harq_pid];
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.
cyclic_shift_2_for_drms =
UE_template->cshift[harq_pid];
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value = 0;
hi_dci0_req_body->number_of_hi++;
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(sched_frame, sched_subframeP, 0);
hi_dci0_req->sfn_sf = frameP<<4|subframeP;
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
LOG_D(MAC,
"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled (PHICH) UE %d (mcs %d, first rb %d, nb_rb %d, TBS %d, round %d)\n",
module_idP, harq_pid, rnti, CC_id, frameP,
subframeP, UE_id, UE_template->mcs_UL[harq_pid],
UE_template->first_rb_ul[harq_pid],
UE_template->nb_rb_ul[harq_pid],
UE_template->TBS_UL[harq_pid], round);
// Add UL_config PDUs // Add UL_config PDUs
LOG_D(MAC, LOG_D(MAC,
"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", "[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
harq_pid, frameP, subframeP, UE_id, rnti, harq_pid, frameP, subframeP, UE_id, rnti,
sched_frame, sched_subframeP); sched_frame, sched_subframeP);
fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, UE_template->first_rb_ul[harq_pid], // resource_block_start ul_req_index = 0;
dlsch_flag = 0;
for(ul_req_index = 0;ul_req_index < ul_req_tmp_body->number_of_pdus;ul_req_index++){
if(ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE){
dlsch_flag = 1;
LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index);
break;
}
}
fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], cqi_req, cc, UE_template->physicalConfigDedicated, get_tmode(module_idP, CC_id, UE_id), mac->ul_handle, rnti, UE_template->first_rb_ul[harq_pid], // resource_block_start
UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks
UE_template->mcs_UL[harq_pid], cshift, // cyclic_shift_2_for_drms UE_template->mcs_UL[harq_pid], cshift, // cyclic_shift_2_for_drms
0, // frequency_hopping_enabled_flag 0, // frequency_hopping_enabled_flag
@@ -1576,14 +1587,33 @@ schedule_ulsch_rnti(module_id_t module_idP,
TBS_UL[harq_pid]); TBS_UL[harq_pid]);
#ifdef Rel14 #ifdef Rel14
if (UE_template->rach_resource_type > 0) { // This is a BL/CE UE allocation if (UE_template->rach_resource_type > 0) { // This is a BL/CE UE allocation
fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_tmp_body->number_of_pdus], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp_body->ul_config_pdu_list[ul_req_index], UE_template->rach_resource_type > 2 ? 2 : 1, 1, //total_number_of_repetitions
1, //repetition_number 1, //repetition_number
(frameP * (frameP *
10) + 10) +
subframeP); subframeP);
} }
#endif #endif
ul_req_tmp_body->number_of_pdus++; if(dlsch_flag == 1){
if(cqi_req == 1){
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE;
ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.harq_information;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag=NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_cqi_harq_ri_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = UE_template->nb_rb_ul[harq_pid];
}else{
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].pdu_type = NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE;
ulsch_harq_information = &ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.harq_information;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG;
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.n_srs_initial = 0; // last symbol not punctured
ul_req_tmp_body->ul_config_pdu_list[ul_req_index].ulsch_harq_pdu.initial_transmission_parameters.initial_transmission_parameters_rel8.initial_number_of_resource_blocks = UE_template->nb_rb_ul[harq_pid];
}
fill_nfapi_ulsch_harq_information(module_idP, CC_id,rnti, ulsch_harq_information,subframeP);
}else{
ul_req_tmp_body->number_of_pdus++;
}
mac->ul_handle++; mac->ul_handle++;
ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; ul_req_tmp_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
@@ -1627,396 +1657,3 @@ schedule_ulsch_rnti(module_id_t module_idP,
} // loop over UE_id } // loop over UE_id
} // loop of CC_id } // loop of CC_id
} }
#else
void schedule_ulsch_rnti(module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP,
unsigned char sched_subframeP,
ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs])
{
int16_t UE_id;
uint8_t aggregation = 2;
uint16_t first_rb[MAX_NUM_CCs];
uint8_t ULSCH_first_end;
rnti_t rnti = -1;
uint8_t round = 0;
uint8_t harq_pid = 0;
uint8_t status = 0;
uint8_t rb_table_index = -1;
uint32_t cqi_req,cshift,ndi,tpc;
int32_t normalized_rx_power;
int32_t target_rx_power=-90;
static int32_t tpc_accumulated=0;
int CC_id,ulsch_ue_num;
int N_RB_UL;
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc;
UE_list_t *UE_list=&eNB->UE_list;
UE_TEMPLATE *UE_template;
UE_sched_ctrl *UE_sched_ctrl;
int sched_frame=frameP;
int rvidx_tab[4] = {0,2,3,1};
if (sched_subframeP < subframeP) sched_frame++;
nfapi_hi_dci0_request_body_t *hi_dci0_req = &eNB->HI_DCI0_req[module_idP].hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
nfapi_ul_config_request_body_t *ul_req_tmp = &eNB->UL_req_tmp[module_idP][sched_subframeP].ul_config_request_body;
LOG_D(MAC,"entering ulsch preprocesor\n");
ulsch_scheduler_pre_processor(module_idP,
frameP,
subframeP,
ulsch_ue_select);
LOG_D(MAC,"exiting ulsch preprocesor\n");
eNB->HI_DCI0_req[module_idP].sfn_sf = (frameP<<4)+subframeP;
// loop over all active UEs
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
ULSCH_first_end = 0;
cc = &eNB->common_channels[CC_id];
// This is the actual CC_id in the list
N_RB_UL = to_prb(cc->mib->message.dl_Bandwidth);
//leave out first RB for PUCCH
if(N_RB_UL == 25){
first_rb[CC_id] = 1;
}else{
first_rb[CC_id] = 2;
}
for ( ulsch_ue_num = 0; ulsch_ue_num < ulsch_ue_select[CC_id].ue_num; ulsch_ue_num++ ) {
UE_id = ulsch_ue_select[CC_id].list[ulsch_ue_num].UE_id;
/* be sure that there are some free RBs */
if(N_RB_UL == 25){
if (first_rb[CC_id] >= N_RB_UL-1) {
LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n",
module_idP,frameP,subframeP,UE_id,rnti,CC_id);
break;
}
}else{
if (first_rb[CC_id] >= N_RB_UL-2) {
LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n",
module_idP,frameP,subframeP,UE_id,rnti,CC_id);
break;
}
}
//MSG3
if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_MSG3) {
first_rb[CC_id] ++;
continue;
}
//PRACH
if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_PRACH) {
first_rb[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb+ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb;
continue;
}
UE_template = &UE_list->UE_template[CC_id][UE_id];
UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id];
harq_pid = subframe2harqpid(cc,sched_frame,sched_subframeP);
rnti = UE_RNTI(CC_id,UE_id);
LOG_D(MAC,"[eNB %d] frame %d subframe %d,Checking PUSCH %d for UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n",
module_idP,frameP,subframeP,harq_pid,UE_id,rnti,CC_id, aggregation,N_RB_UL);
RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->ul_total_buffer;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO,RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP]);
status = mac_eNB_get_rrc_status(module_idP,rnti);
if (status < RRC_CONNECTED)
cqi_req = 0;
else if (UE_sched_ctrl->cqi_req_timer>30) {
cqi_req = 1;
UE_sched_ctrl->cqi_req_timer=0;
}
else
cqi_req = 0;
//power control
//compute the expected ULSCH RX power (for the stats)
// this is the normalized RX power and this should be constant (regardless of mcs
normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id];
target_rx_power = 178;
// this assumes accumulated tpc
// make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame*10+UE_template->pusch_tpc_tx_subframe;
if (((framex10psubframe+10)<=(frameP*10+subframeP)) || //normal case
((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=10)))) //frame wrap-around
{
UE_template->pusch_tpc_tx_frame=frameP;
UE_template->pusch_tpc_tx_subframe=subframeP;
if (normalized_rx_power>(target_rx_power+4)) {
tpc = 0; //-1
tpc_accumulated--;
} else if (normalized_rx_power<(target_rx_power-4)) {
tpc = 2; //+1
tpc_accumulated++;
} else {
tpc = 1; //0
}
} else {
tpc = 1; //0
}
if (tpc!=1) {
LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
module_idP,frameP,subframeP,harq_pid,tpc,
tpc_accumulated,normalized_rx_power,target_rx_power);
}
// new transmission
if ((ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST) ||
(ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE)) {
LOG_D(MAC,"[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x (SR %d,UL_inactivity timer %d,UL_failure timer %d,cqi_req_timer %d)\n",
module_idP,harq_pid,frameP,subframeP,UE_id,rnti,UE_template->ul_SR,
UE_sched_ctrl->ul_inactivity_timer,
UE_sched_ctrl->ul_failure_timer,
UE_sched_ctrl->cqi_req_timer);
ndi = 1-UE_template->oldNDI_UL[harq_pid];
UE_template->oldNDI_UL[harq_pid]=ndi;
UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=UE_template->pre_assigned_mcs_ul;
UE_template->mcs_UL[harq_pid] = UE_template->pre_assigned_mcs_ul;//cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS
if (UE_template->pre_allocated_rb_table_index_ul >=0) {
rb_table_index=UE_template->pre_allocated_rb_table_index_ul;
} else {
UE_template->mcs_UL[harq_pid]=10;//cmin (10, openair_daq_vars.target_ue_ul_mcs);
rb_table_index=5; // for PHR
}
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=UE_template->mcs_UL[harq_pid];
UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],rb_table[rb_table_index]);
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=rb_table[rb_table_index];
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS=UE_template->TBS_UL[harq_pid];
T(T_ENB_MAC_UE_UL_SCHEDULE, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP),
T_INT(subframeP), T_INT(harq_pid), T_INT(UE_template->mcs_UL[harq_pid]), T_INT(first_rb[CC_id]), T_INT(rb_table[rb_table_index]),
T_INT(UE_template->TBS_UL[harq_pid]), T_INT(ndi));
if (mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED)
LOG_D(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, rb_table_index %d, TBS %d, harq_pid %d)\n",
module_idP,harq_pid,rnti,CC_id,frameP,subframeP,UE_id,UE_template->mcs_UL[harq_pid],
first_rb[CC_id],rb_table[rb_table_index],
rb_table_index,UE_template->TBS_UL[harq_pid],harq_pid);
// bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB)
//store for possible retransmission
UE_template->nb_rb_ul[harq_pid] = rb_table[rb_table_index];
UE_template->first_rb_ul[harq_pid] = first_rb[CC_id];
UE_sched_ctrl->ul_scheduled |= (1<<harq_pid);
if (UE_id == UE_list->head)
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SCHEDULED,UE_sched_ctrl->ul_scheduled);
// adjust total UL buffer status by TBS, wait for UL sdus to do final update
/*LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,UE_template->TBS_UL[harq_pid]);
if (UE_template->ul_total_buffer > UE_template->TBS_UL[harq_pid])
UE_template->ul_total_buffer -= UE_template->TBS_UL[harq_pid];
else
UE_template->ul_total_buffer = 0;
LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer);*/
// Cyclic shift for DM RS
cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
// save it for a potential retransmission
UE_template->cshift[harq_pid] = cshift;
hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci+eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi];
memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE;
hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_dci_pdu);
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = first_rb[CC_id];
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block = rb_table[rb_table_index];
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.mcs_1 = UE_template->mcs_UL[harq_pid];
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = cshift;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = 0;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.new_data_indication_1 = ndi;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframeP];
eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci++;
LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP);
// Add UL_config PDUs
fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
cqi_req,
cc,
UE_template->physicalConfigDedicated,
get_tmode(module_idP,CC_id,UE_id),
eNB->ul_handle,
rnti,
first_rb[CC_id], // resource_block_start
rb_table[rb_table_index], // number_of_resource_blocks
UE_template->mcs_UL[harq_pid],
cshift, // cyclic_shift_2_for_drms
0, // frequency_hopping_enabled_flag
0, // frequency_hopping_bits
ndi, // new_data_indication
0, // redundancy_version
harq_pid, // harq_process_number
0, // ul_tx_mode
0, // current_tx_nb
0, // n_srs
get_TBS_UL(UE_template->mcs_UL[harq_pid],
rb_table[rb_table_index])
);
#ifdef Rel14
if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation
fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
UE_template->rach_resource_type>2 ? 2 : 1,
1, //total_number_of_repetitions
1, //repetition_number
(frameP*10)+subframeP);
}
#endif
ul_req_tmp->number_of_pdus++;
eNB->ul_handle++;
add_ue_ulsch_info(module_idP,
CC_id,
UE_id,
subframeP,
S_UL_SCHEDULED);
LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", module_idP,CC_id,frameP,subframeP,UE_id);
// increment first rb for next UE allocation
first_rb[CC_id]+=rb_table[rb_table_index];
if(ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST) {
LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,UE_template->TBS_UL[harq_pid]);
if(ulsch_ue_select[CC_id].list[ulsch_ue_num].ul_total_buffer > 0){
if (UE_template->ul_total_buffer > UE_template->TBS_UL[harq_pid])
UE_template->ul_total_buffer -= UE_template->TBS_UL[harq_pid];
else
UE_template->ul_total_buffer = 0;
} else {
UE_template->ul_SR = 0;
}
LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer);
}
if((ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE) && (ULSCH_first_end == 0)) {
ULSCH_first_end = 1;
last_ulsch_ue_id[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num-1].UE_id;
}
if((ulsch_ue_num == ulsch_ue_select[CC_id].ue_num-1) && (ULSCH_first_end == 0)) {
ULSCH_first_end = 1;
last_ulsch_ue_id[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num].UE_id;
}
}
else if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_RETRANS) { // round > 0 => retransmission
T(T_ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP),
T_INT(subframeP), T_INT(harq_pid), T_INT(UE_template->mcs_UL[harq_pid]), T_INT(first_rb[CC_id]), T_INT(rb_table[rb_table_index]),
T_INT(round));
round = UE_sched_ctrl->round_UL[CC_id][harq_pid];
UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power;
UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb);
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS=UE_template->TBS_UL[harq_pid];
if (mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED)
LOG_D(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled UE %d (mcs %d, first rb %d, nb_rb %d, rb_table_index %d, TBS %d, harq_pid %d)\n",
module_idP,harq_pid,rnti,CC_id,frameP,subframeP,UE_id,UE_template->mcs_UL[harq_pid],
first_rb[CC_id],rb_table[rb_table_index],
rb_table_index,UE_template->TBS_UL[harq_pid],harq_pid);
// bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB)
//store for possible retransmission
UE_template->nb_rb_ul[harq_pid] = ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb;
UE_template->first_rb_ul[harq_pid] = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb;
UE_sched_ctrl->ul_scheduled |= (1<<harq_pid);
// Cyclic shift for DM RS
cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci+eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi];
memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE;
hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_dci_pdu);
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block = ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.mcs_1 = UE_template->mcs_UL[harq_pid];
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cyclic_shift_2_for_drms = cshift;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.frequency_hopping_enabled_flag = 0;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.new_data_indication_1 = UE_template->oldNDI_UL[harq_pid];
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req;
hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframeP];
eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_dci++;
// fill in NAK information
hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi];
memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_hi_pdu);
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb;
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = UE_template->cshift[harq_pid];
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value = 0;
hi_dci0_req->number_of_hi++;
LOG_D(MAC,"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled (PHICH) UE %d (mcs %d, first rb %d, nb_rb %d, TBS %d, round %d)\n",
module_idP,harq_pid,rnti,CC_id,frameP,subframeP,UE_id,UE_template->mcs_UL[harq_pid],
ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb, ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb,
UE_template->TBS_UL[harq_pid],round);
// Add UL_config PDUs
LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP);
fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
cqi_req,
cc,
UE_template->physicalConfigDedicated,
get_tmode(module_idP,CC_id,UE_id),
eNB->ul_handle,
rnti,
ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb, // resource_block_start
ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb, // number_of_resource_blocks
UE_template->mcs_UL[harq_pid],
cshift, // cyclic_shift_2_for_drms
0, // frequency_hopping_enabled_flag
0, // frequency_hopping_bits
UE_template->oldNDI_UL[harq_pid], // new_data_indication
rvidx_tab[round&3], // redundancy_version
harq_pid, // harq_process_number
0, // ul_tx_mode
0, // current_tx_nb
0, // n_srs
get_TBS_UL(UE_template->mcs_UL[harq_pid],
ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb)
);
#ifdef Rel14
if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation
fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
UE_template->rach_resource_type>2 ? 2 : 1,
1, //total_number_of_repetitions
1, //repetition_number
(frameP*10)+subframeP);
}
#endif
ul_req_tmp->number_of_pdus++;
eNB->ul_handle++;
LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0(round >0)\n", module_idP,CC_id,frameP,subframeP,UE_id);
// increment first rb for next UE allocation
first_rb[CC_id]+=ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb;
}
} // loop over UE_id
} // loop of CC_id
}
#endif
+3 -7
View File
@@ -97,13 +97,7 @@ extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu1;
extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2; extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
extern DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E; extern DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
#ifdef UE_EXPANSION #if defined(PRE_SCD_THREAD)
extern DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs];
extern int last_dlsch_ue_id[MAX_NUM_CCs];
extern int last_ulsch_ue_id[MAX_NUM_CCs];
#endif
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2)
extern uint16_t pre_nb_rbs_required[2][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; extern uint16_t pre_nb_rbs_required[2][MAX_NUM_CCs][NUMBER_OF_UE_MAX];
extern uint8_t dlsch_ue_select_tbl_in_use; extern uint8_t dlsch_ue_select_tbl_in_use;
extern uint8_t new_dlsch_ue_select_tbl_in_use; extern uint8_t new_dlsch_ue_select_tbl_in_use;
@@ -111,4 +105,6 @@ extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX];
extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
#endif #endif
extern mac_rlc_am_muilist_t rlc_am_mui;
extern SCHEDULER_MODES global_scheduler_mode;
#endif //DEF_H #endif //DEF_H
@@ -1277,7 +1277,7 @@ flexran_schedule_ue_spec_common(mid_t mod_id,
PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) {
UE_list->UE_template[CC_id][UE_id].DAI++; UE_list->UE_template[CC_id][UE_id].DAI++;
update_ul_dci(mod_id, CC_id, rnti, update_ul_dci(mod_id, CC_id, rnti,
UE_list->UE_template[CC_id][UE_id].DAI); UE_list->UE_template[CC_id][UE_id].DAI,subframe);
LOG_D(MAC, LOG_D(MAC,
"DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n", "DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n",
CC_id, subframe, UE_id, CC_id, subframe, UE_id,
@@ -1642,7 +1642,7 @@ flexran_schedule_ue_spec_common(mid_t mod_id,
//#warning only for 5MHz channel //#warning only for 5MHz channel
update_ul_dci(mod_id, CC_id, rnti, update_ul_dci(mod_id, CC_id, rnti,
UE_list->UE_template[CC_id][UE_id]. UE_list->UE_template[CC_id][UE_id].
DAI); DAI,frame);
} }
// do PUCCH power control // do PUCCH power control
// this is the normalized RX power // this is the normalized RX power
+4 -3
View File
@@ -158,9 +158,10 @@ void mac_top_init_eNB(void)
RC.mac[i]->UL_req_tmp[j][k]. RC.mac[i]->UL_req_tmp[j][k].
ul_config_request_body.ul_config_pdu_list = ul_config_request_body.ul_config_pdu_list =
RC.mac[i]->ul_config_pdu_list_tmp[j][k]; RC.mac[i]->ul_config_pdu_list_tmp[j][k];
RC.mac[i]->HI_DCI0_req[j]. for(int sf=0;sf<10;sf++){
hi_dci0_request_body.hi_dci0_pdu_list = RC.mac[i]->HI_DCI0_req[j][sf].hi_dci0_request_body.hi_dci0_pdu_list =RC.mac[i]->hi_dci0_pdu_list[j][sf];
RC.mac[i]->hi_dci0_pdu_list[j]; }
RC.mac[i]->TX_req[j].tx_request_body.tx_pdu_list = RC.mac[i]->TX_req[j].tx_request_body.tx_pdu_list =
RC.mac[i]->tx_request_pdu[j]; RC.mac[i]->tx_request_pdu[j];
RC.mac[i]->ul_handle = 0; RC.mac[i]->ul_handle = 0;
File diff suppressed because it is too large Load Diff
+12 -19
View File
@@ -106,11 +106,7 @@ void schedule_ulsch(module_id_t module_idP, frame_t frameP,
@param subframe Subframe number on which to act @param subframe Subframe number on which to act
@param sched_subframe Subframe number where PUSCH is transmitted (for DAI lookup) @param sched_subframe Subframe number where PUSCH is transmitted (for DAI lookup)
*/ */
#ifndef UE_EXPANSION
void schedule_ulsch_rnti(module_id_t module_idP, frame_t frameP, sub_frame_t subframe, unsigned char sched_subframe, uint16_t *first_rb); void schedule_ulsch_rnti(module_id_t module_idP, frame_t frameP, sub_frame_t subframe, unsigned char sched_subframe, uint16_t *first_rb);
#else
void schedule_ulsch_rnti(module_id_t module_idP, frame_t frameP, sub_frame_t subframe, unsigned char sched_subframe, ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]);
#endif
/** \brief Second stage of DLSCH scheduling, after schedule_SI, schedule_RA and schedule_dlsch have been called. This routine first allocates random frequency assignments for SI and RA SDUs using distributed VRB allocations and adds the corresponding DCI SDU to the DCI buffer for PHY. It then loops over the UE specific DCIs previously allocated and fills in the remaining DCI fields related to frequency allocation. It assumes localized allocation of type 0 (DCI.rah=0). The allocation is done for tranmission modes 1,2,4. /** \brief Second stage of DLSCH scheduling, after schedule_SI, schedule_RA and schedule_dlsch have been called. This routine first allocates random frequency assignments for SI and RA SDUs using distributed VRB allocations and adds the corresponding DCI SDU to the DCI buffer for PHY. It then loops over the UE specific DCIs previously allocated and fills in the remaining DCI fields related to frequency allocation. It assumes localized allocation of type 0 (DCI.rah=0). The allocation is done for tranmission modes 1,2,4.
@param Mod_id Instance of eNB @param Mod_id Instance of eNB
@@ -227,13 +223,6 @@ void dlsch_scheduler_pre_processor_allocate (module_id_t Mod_id,
unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX], unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX],
unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]); unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]);
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2)
void pre_scd_nb_rbs_required(module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP,
int min_rb_unit[MAX_NUM_CCs],
uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]);
#endif
/* \brief Function to trigger the eNB scheduling procedure. It is called by PHY at the beginning of each subframe, \f$n$\f /* \brief Function to trigger the eNB scheduling procedure. It is called by PHY at the beginning of each subframe, \f$n$\f
and generates all DLSCH allocations for subframe \f$n\f$ and ULSCH allocations for subframe \f$n+k$\f. and generates all DLSCH allocations for subframe \f$n\f$ and ULSCH allocations for subframe \f$n+k$\f.
@param Mod_id Instance ID of eNB @param Mod_id Instance ID of eNB
@@ -642,12 +631,8 @@ int UE_PCCID(module_id_t mod_idP, int ue_idP);
rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP); rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP);
uint8_t find_rb_table_index(uint8_t average_rbs); uint8_t find_rb_table_index(uint8_t average_rbs);
#ifndef UE_EXPANSION void ulsch_scheduler_pre_processor(module_id_t module_idP, int frameP, sub_frame_t subframeP, unsigned char sched_subframeP,uint16_t *first_rb);
void ulsch_scheduler_pre_processor(module_id_t module_idP, int frameP, sub_frame_t subframeP, uint16_t *first_rb);
#else
void ulsch_scheduler_pre_processor(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]);
void ulsch_scheduler_pre_ue_select(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP,ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]);
#endif
void void
set_ul_DAI( set_ul_DAI(
int module_idP, int module_idP,
@@ -825,7 +810,7 @@ uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG,
uint8_t * rballoc); uint8_t * rballoc);
void update_ul_dci(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, void update_ul_dci(module_id_t module_idP, uint8_t CC_id, rnti_t rnti,
uint8_t dai); uint8_t dai, sub_frame_t subframe);
int get_bw_index(module_id_t module_id, uint8_t CC_id); int get_bw_index(module_id_t module_id, uint8_t CC_id);
@@ -1124,7 +1109,8 @@ void fill_nfapi_ulsch_harq_information(module_id_t module_idP,
int CC_idP, int CC_idP,
uint16_t rntiP, uint16_t rntiP,
nfapi_ul_config_ulsch_harq_information nfapi_ul_config_ulsch_harq_information
* harq_information); * harq_information,
sub_frame_t subframeP);
uint16_t fill_nfapi_uci_acknak(module_id_t module_idP, uint16_t fill_nfapi_uci_acknak(module_id_t module_idP,
int CC_idP, int CC_idP,
@@ -1173,6 +1159,13 @@ uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn);
int32_t get_uldl_offset(int eutra_bandP); int32_t get_uldl_offset(int eutra_bandP);
int l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, int l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
uint8_t HO_active); uint8_t HO_active);
#if defined(PRE_SCD_THREAD)
void pre_scd_nb_rbs_required( module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP,
int min_rb_unit[MAX_NUM_CCs],
uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]);
#endif
#endif #endif
/** @}*/ /** @}*/
+6 -1
View File
@@ -71,10 +71,15 @@ fill_rar(const module_id_t module_idP,
ra->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps ra->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps
rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4 rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4
rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4 rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4
COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
if(N_RB_UL == 25){ if(N_RB_UL == 25){
ra->msg3_first_rb = 1; ra->msg3_first_rb = 1;
}else{ }else{
ra->msg3_first_rb = 2; if (cc->tdd_Config && N_RB_UL == 100) {
ra->msg3_first_rb = 3;
} else {
ra->msg3_first_rb = 2;
}
} }
ra->msg3_nb_rb = 1; ra->msg3_nb_rb = 1;
uint16_t rballoc = mac_computeRIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb); // first PRB only for UL Grant uint16_t rballoc = mac_computeRIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb); // first PRB only for UL Grant
+2 -14
View File
@@ -142,18 +142,6 @@ DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E; DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
#ifdef UE_EXPANSION mac_rlc_am_muilist_t rlc_am_mui;
DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs]; SCHEDULER_MODES global_scheduler_mode;
int last_dlsch_ue_id[MAX_NUM_CCs] = {-1};
int last_ulsch_ue_id[MAX_NUM_CCs] = {-1};
#endif
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2)
uint16_t pre_nb_rbs_required[2][MAX_NUM_CCs][NUMBER_OF_UE_MAX];
uint8_t dlsch_ue_select_tbl_in_use;
uint8_t new_dlsch_ue_select_tbl_in_use;
boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX];
eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
#endif
#endif #endif
@@ -45,6 +45,7 @@ configure_pdcp_req (struct pdcp_entity *pdcpP, void *rlcP, uint8_t rlc_sap_typeP
mem_block *mb; mem_block *mb;
mb = get_free_mem_block (sizeof (struct cpdcp_primitive), __func__); mb = get_free_mem_block (sizeof (struct cpdcp_primitive), __func__);
if(mb==NULL) return;
((struct cpdcp_primitive *) mb->data)->type = CPDCP_CONFIG_REQ; ((struct cpdcp_primitive *) mb->data)->type = CPDCP_CONFIG_REQ;
((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_sap = rlcP; ((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_sap = rlcP;
((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_type_sap = rlc_sap_typeP; ((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_type_sap = rlc_sap_typeP;
-1
View File
@@ -588,7 +588,6 @@ rlc_am_mac_status_indication (
sdu_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_size; sdu_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_size;
sdu_remaining_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_remaining_size; sdu_remaining_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_remaining_size;
status_resp.rrc_mui = rlc->input_sdus[rlc->current_sdu_index].mui;
status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size; status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
if (sdu_size == sdu_remaining_size) { if (sdu_size == sdu_remaining_size) {
+16 -2
View File
@@ -42,8 +42,17 @@ void rlc_am_free_in_sdu(
{ {
if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) { if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
/* BugFix: SDU shall have been already freed during initial PDU segmentation or concatenation !! */ /* BugFix: SDU shall have been already freed during initial PDU segmentation or concatenation !! */
//Assertion(eNB)_PRAN_DesignDocument_annex No.761
if(rlcP->input_sdus[index_in_bufferP].mem_block != NULL)
{
LOG_E(RLC, "RLC AM Tx SDU Conf: Data Part is not empty index=%d LcId=%d\n",
index_in_bufferP,rlcP->channel_id);
return;
}
/*
AssertFatal(rlcP->input_sdus[index_in_bufferP].mem_block == NULL, "RLC AM Tx SDU Conf: Data Part is not empty index=%d LcId=%d\n", AssertFatal(rlcP->input_sdus[index_in_bufferP].mem_block == NULL, "RLC AM Tx SDU Conf: Data Part is not empty index=%d LcId=%d\n",
index_in_bufferP,rlcP->channel_id); index_in_bufferP,rlcP->channel_id);
*/
/* /*
if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) { if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) {
free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block, __func__); free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block, __func__);
@@ -121,8 +130,13 @@ rlc_am_pdu_sdu_data_cnf(
for (pdu_sdu_index = 0; pdu_sdu_index < rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].nb_sdus; pdu_sdu_index++) { for (pdu_sdu_index = 0; pdu_sdu_index < rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].nb_sdus; pdu_sdu_index++) {
sdu_index = rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].sdus_index[pdu_sdu_index]; sdu_index = rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].sdus_index[pdu_sdu_index];
assert(sdu_index >= 0); //assert(sdu_index >= 0);
assert(sdu_index < RLC_AM_SDU_CONTROL_BUFFER_SIZE); //assert(sdu_index < RLC_AM_SDU_CONTROL_BUFFER_SIZE);
if(sdu_index < 0 || sdu_index >= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
LOG_E(RLC, "sdu_index error. sdu_index %d, pdu_sdu_index %d\n", sdu_index, pdu_sdu_index);
continue;
}
rlc_pP->input_sdus[sdu_index].nb_pdus_ack += 1; rlc_pP->input_sdus[sdu_index].nb_pdus_ack += 1;
if ((rlc_pP->input_sdus[sdu_index].nb_pdus_ack == rlc_pP->input_sdus[sdu_index].nb_pdus) && if ((rlc_pP->input_sdus[sdu_index].nb_pdus_ack == rlc_pP->input_sdus[sdu_index].nb_pdus) &&
@@ -57,7 +57,12 @@ rlc_am_reassembly (
if (rlc_pP->output_sdu_in_construction == NULL) { if (rlc_pP->output_sdu_in_construction == NULL) {
rlc_pP->output_sdu_in_construction = get_free_mem_block (RLC_SDU_MAX_SIZE, __func__); rlc_pP->output_sdu_in_construction = get_free_mem_block (RLC_SDU_MAX_SIZE, __func__);
rlc_pP->output_sdu_size_to_write = 0; rlc_pP->output_sdu_size_to_write = 0;
assert(rlc_pP->output_sdu_in_construction != NULL); //assert(rlc_pP->output_sdu_in_construction != NULL);
if(rlc_pP->output_sdu_in_construction == NULL) {
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PAYLOAD] output_sdu_in_construction is NULL\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
return;
}
} }
if (rlc_pP->output_sdu_in_construction != NULL) { if (rlc_pP->output_sdu_in_construction != NULL) {
@@ -198,10 +203,16 @@ rlc_am_send_sdu (
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
//msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlc_pP->module_id); //msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlc_pP->module_id);
//free_mem_block (rlc_pP->output_sdu_in_construction, __func__); //free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
//Assertion(eNB)_PRAN_DesignDocument_annex No.764
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->output_sdu_size_to_write);
/*
AssertFatal(3==4, AssertFatal(3==4,
PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes", PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->output_sdu_size_to_write); rlc_pP->output_sdu_size_to_write);
*/
} }
rlc_pP->output_sdu_size_to_write = 0; rlc_pP->output_sdu_size_to_write = 0;
@@ -270,7 +281,9 @@ rlc_am_reassemble_pdu(
break; break;
default: default:
assert(0 != 0); //Assertion(eNB)_PRAN_DesignDocument_annex No.1428
LOG_E(RLC, "RLC_E_FIXED_PART_DATA_FIELD_FOLLOW error pdu_info->fi[%d]\n", pdu_info->fi);
// assert(0 != 0);
} }
} else { } else {
switch (pdu_info->fi) { switch (pdu_info->fi) {
@@ -386,7 +399,9 @@ rlc_am_reassemble_pdu(
break; break;
default: default:
assert(1 != 1); //Assertion(eNB)_PRAN_DesignDocument_annex No.1429
LOG_E(RLC, "not RLC_E_FIXED_PART_DATA_FIELD_FOLLOW error pdu_info->fi[%d]\n", pdu_info->fi);
// assert(1 != 1);
} }
} }
@@ -47,9 +47,15 @@ rlc_am_get_data_pdu_infos(
pdu_info_pP->d_c = header_pP->b1 >> 7; pdu_info_pP->d_c = header_pP->b1 >> 7;
pdu_info_pP->num_li = 0; pdu_info_pP->num_li = 0;
//Assertion(eNB)_PRAN_DesignDocument_annex No.766
if(pdu_info_pP->d_c == 0)
{
LOG_E(RLC, "RLC AM Rx PDU Data D/C Header Error LcId=%d\n", rlc_pP->channel_id);
return -2;
}
/*
AssertFatal (pdu_info_pP->d_c != 0, "RLC AM Rx PDU Data D/C Header Error LcId=%d\n", rlc_pP->channel_id); AssertFatal (pdu_info_pP->d_c != 0, "RLC AM Rx PDU Data D/C Header Error LcId=%d\n", rlc_pP->channel_id);
*/
pdu_info_pP->rf = (header_pP->b1 >> 6) & 0x01; pdu_info_pP->rf = (header_pP->b1 >> 6) & 0x01;
pdu_info_pP->p = (header_pP->b1 >> 5) & 0x01; pdu_info_pP->p = (header_pP->b1 >> 5) & 0x01;
pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03; pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03;
@@ -264,9 +270,17 @@ rlc_am_receive_routing (
rlc_pP->stat_rx_control_pdu += 1; rlc_pP->stat_rx_control_pdu += 1;
rlc_am_receive_process_control_pdu (ctxt_pP, rlc_pP, tb_p, &first_byte_p, &tb_size_in_bytes); rlc_am_receive_process_control_pdu (ctxt_pP, rlc_pP, tb_p, &first_byte_p, &tb_size_in_bytes);
// Test if remaining bytes not processed (up to know, highest probability is bug in MAC) // Test if remaining bytes not processed (up to know, highest probability is bug in MAC)
//Assertion(eNB)_PRAN_DesignDocument_annex No.767
if(tb_size_in_bytes != 0)
{
LOG_E(RLC, "Remaining %d bytes following a control PDU\n",
tb_size_in_bytes);
}
/*
AssertFatal( tb_size_in_bytes == 0, AssertFatal( tb_size_in_bytes == 0,
"Remaining %d bytes following a control PDU", "Remaining %d bytes following a control PDU",
tb_size_in_bytes); tb_size_in_bytes);
*/
} }
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RX ROUTING] VR(R)=%03d VR(MR)=%03d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RX ROUTING] VR(R)=%03d VR(MR)=%03d\n",
+175 -26
View File
@@ -60,10 +60,14 @@ boolean_t rlc_am_nack_pdu (
sdu_size_t pdu_data_to_retx = 0; sdu_size_t pdu_data_to_retx = 0;
if (mb_p != NULL) { if (mb_p != NULL) {
assert(so_startP <= so_endP); //assert(so_startP <= so_endP);
if(so_startP > so_endP) {
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] ERROR NACK MISSING PDU, so_startP %d, so_endP %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),so_startP, so_endP);
status = FALSE;
}
// Handle full PDU NACK first // Handle full PDU NACK first
if ((so_startP == 0) && (so_endP == 0x7FFF)) { else if ((so_startP == 0) && (so_endP == 0x7FFF)) {
if ((prev_nack_snP != snP) && (tx_data_pdu_buffer_p->flags.ack == 0) && (tx_data_pdu_buffer_p->flags.max_retransmit == 0)) { if ((prev_nack_snP != snP) && (tx_data_pdu_buffer_p->flags.ack == 0) && (tx_data_pdu_buffer_p->flags.max_retransmit == 0)) {
pdu_data_to_retx = tx_data_pdu_buffer_p->payload_size; pdu_data_to_retx = tx_data_pdu_buffer_p->payload_size;
/* Increment VtReTxNext if this is the first NACK or if some segments have already been transmitted */ /* Increment VtReTxNext if this is the first NACK or if some segments have already been transmitted */
@@ -82,12 +86,17 @@ boolean_t rlc_am_nack_pdu (
snP, snP,
so_stopP); so_stopP);
#endif #endif
assert(tx_data_pdu_buffer_p->nack_so_start < tx_data_pdu_buffer_p->payload_size); //assert(tx_data_pdu_buffer_p->nack_so_start < tx_data_pdu_buffer_p->payload_size);
if(tx_data_pdu_buffer_p->nack_so_start >= tx_data_pdu_buffer_p->payload_size){
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] ERROR NACK MISSING PDU, nack_so_start %d, payload_size %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),tx_data_pdu_buffer_p->nack_so_start, tx_data_pdu_buffer_p->payload_size);
status = FALSE;
}
} }
else { else {
status = FALSE; status = FALSE;
} }
} }
else if (tx_data_pdu_buffer_p->flags.max_retransmit == 0) { else if (tx_data_pdu_buffer_p->flags.max_retransmit == 0) {
// Handle Segment offset // Handle Segment offset
if (so_endP == 0x7FFF) { if (so_endP == 0x7FFF) {
@@ -225,9 +234,18 @@ void rlc_am_ack_pdu (
} }
if (tx_data_pdu_buffer->retx_payload_size) { if (tx_data_pdu_buffer->retx_payload_size) {
//Assertion(eNB)_PRAN_DesignDocument_annex No.768
if(tx_data_pdu_buffer->flags.ack != 0)
{
LOG_E(RLC, "RLC AM Rx Status Report sn=%d acked twice but is pending for Retx vtA=%d vtS=%d LcId=%d\n",
snP, rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
return;
}
/*
AssertFatal (tx_data_pdu_buffer->flags.ack == 0, AssertFatal (tx_data_pdu_buffer->flags.ack == 0,
"RLC AM Rx Status Report sn=%d acked twice but is pending for Retx vtA=%d vtS=%d LcId=%d\n", "RLC AM Rx Status Report sn=%d acked twice but is pending for Retx vtA=%d vtS=%d LcId=%d\n",
snP, rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); snP, rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
rlc_pP->retrans_num_bytes_to_retransmit -= tx_data_pdu_buffer->retx_payload_size; rlc_pP->retrans_num_bytes_to_retransmit -= tx_data_pdu_buffer->retx_payload_size;
tx_data_pdu_buffer->retx_payload_size = 0; tx_data_pdu_buffer->retx_payload_size = 0;
tx_data_pdu_buffer->num_holes = 0; tx_data_pdu_buffer->num_holes = 0;
@@ -256,15 +274,23 @@ mem_block_t* rlc_am_retransmit_get_copy (
const rlc_sn_t snP) const rlc_sn_t snP)
{ {
mem_block_t* mb_original_p = rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].mem_block; mem_block_t* mb_original_p = rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].mem_block;
//Assertion(eNB)_PRAN_DesignDocument_annex No.784
if(mb_original_p == NULL)
{
LOG_E(RLC,"RLC AM PDU Copy Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
snP,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (mb_original_p != NULL, "RLC AM PDU Copy Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n", AssertFatal (mb_original_p != NULL, "RLC AM PDU Copy Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
snP,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); snP,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
rlc_am_tx_data_pdu_management_t *pdu_mngt = &rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE]; rlc_am_tx_data_pdu_management_t *pdu_mngt = &rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE];
/* We need to allocate a new buffer and copy to it because header content may change for Polling bit */ /* We need to allocate a new buffer and copy to it because header content may change for Polling bit */
int size = pdu_mngt->header_and_payload_size + sizeof(struct mac_tb_req); int size = pdu_mngt->header_and_payload_size + sizeof(struct mac_tb_req);
mem_block_t* mb_copy = get_free_mem_block(size, __func__); mem_block_t* mb_copy = get_free_mem_block(size, __func__);
if(mb_copy == NULL) return NULL;
memcpy(mb_copy->data, mb_original_p->data, size); memcpy(mb_copy->data, mb_original_p->data, size);
rlc_am_pdu_sn_10_t *pdu_p = (rlc_am_pdu_sn_10_t*) (&mb_copy->data[sizeof(struct mac_tb_req)]); rlc_am_pdu_sn_10_t *pdu_p = (rlc_am_pdu_sn_10_t*) (&mb_copy->data[sizeof(struct mac_tb_req)]);
@@ -295,20 +321,43 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
uint8_t li_bit_offset = 4; /* toggle between 0 and 4 */ uint8_t li_bit_offset = 4; /* toggle between 0 and 4 */
uint8_t li_jump_offset = 1; /* toggle between 1 and 2 */ uint8_t li_jump_offset = 1; /* toggle between 1 and 2 */
//Assertion(eNB)_PRAN_DesignDocument_annex No.774
if(mb_original_p == NULL)
{
LOG_E(RLC,"RLC AM PDU Segment Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (mb_original_p != NULL, "RLC AM PDU Segment Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n", AssertFatal (mb_original_p != NULL, "RLC AM PDU Segment Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
//Assertion(eNB)_PRAN_DesignDocument_annex No.775
if(pdu_mngt->payload != mb_original_p->data + sizeof(struct mac_tb_req) + pdu_mngt->header_and_payload_size - pdu_mngt->payload_size)
{
LOG_E(RLC,"RLC AM PDU Segment Error: Inconsistent data pointers p1=%p p2=%p sn = %d total size = %d data size = %d LcId=%d !\n",
pdu_mngt->payload,mb_original_p->data + sizeof(struct mac_tb_req),pdu_mngt->header_and_payload_size,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (pdu_mngt->payload == mb_original_p->data + sizeof(struct mac_tb_req) + pdu_mngt->header_and_payload_size - pdu_mngt->payload_size, AssertFatal (pdu_mngt->payload == mb_original_p->data + sizeof(struct mac_tb_req) + pdu_mngt->header_and_payload_size - pdu_mngt->payload_size,
"RLC AM PDU Segment Error: Inconsistent data pointers p1=%p p2=%p sn = %d total size = %d data size = %d LcId=%d !\n", "RLC AM PDU Segment Error: Inconsistent data pointers p1=%p p2=%p sn = %d total size = %d data size = %d LcId=%d !\n",
pdu_mngt->payload,mb_original_p->data + sizeof(struct mac_tb_req),pdu_mngt->header_and_payload_size,pdu_mngt->payload_size,sn,rlc_pP->channel_id); pdu_mngt->payload,mb_original_p->data + sizeof(struct mac_tb_req),pdu_mngt->header_and_payload_size,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
*/
/* Init ReTx Hole list if not configured, ie the whole PDU has to be retransmitted */ /* Init ReTx Hole list if not configured, ie the whole PDU has to be retransmitted */
if (pdu_mngt->num_holes == 0) if (pdu_mngt->num_holes == 0)
{ {
//Assertion(eNB)_PRAN_DesignDocument_annex No.776
if(pdu_mngt->retx_payload_size != pdu_mngt->payload_size)
{
LOG_E(RLC,"RLC AM PDU ReTx Segment: Expecting full PDU size ReTxSize=%d DataSize=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
pdu_mngt->retx_payload_size,pdu_mngt->payload_size,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (pdu_mngt->retx_payload_size == pdu_mngt->payload_size,"RLC AM PDU ReTx Segment: Expecting full PDU size ReTxSize=%d DataSize=%d sn=%d vtA=%d vtS=%d LcId=%d !\n", AssertFatal (pdu_mngt->retx_payload_size == pdu_mngt->payload_size,"RLC AM PDU ReTx Segment: Expecting full PDU size ReTxSize=%d DataSize=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
pdu_mngt->retx_payload_size,pdu_mngt->payload_size,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); pdu_mngt->retx_payload_size,pdu_mngt->payload_size,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
pdu_mngt->retx_hole_index = 0; pdu_mngt->retx_hole_index = 0;
pdu_mngt->hole_so_start[0] = 0; pdu_mngt->hole_so_start[0] = 0;
pdu_mngt->hole_so_stop[0] = pdu_mngt->payload_size - 1; pdu_mngt->hole_so_stop[0] = pdu_mngt->payload_size - 1;
@@ -318,11 +367,18 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
/* Init SO Start and SO Stop */ /* Init SO Start and SO Stop */
retx_so_start = pdu_mngt->hole_so_start[pdu_mngt->retx_hole_index]; retx_so_start = pdu_mngt->hole_so_start[pdu_mngt->retx_hole_index];
retx_so_stop = pdu_mngt->hole_so_stop[pdu_mngt->retx_hole_index]; retx_so_stop = pdu_mngt->hole_so_stop[pdu_mngt->retx_hole_index];
//Assertion(eNB)_PRAN_DesignDocument_annex No.777
if((retx_so_start > retx_so_stop) || (retx_so_stop - retx_so_start + 1 > pdu_mngt->payload_size))
{
LOG_E(RLC,"RLC AM Tx PDU Segment Data SO Error: retx_so_start=%d retx_so_stop=%d OriginalPDUDataLength=%d sn=%d LcId=%d!\n",
retx_so_start,retx_so_stop,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal ((retx_so_start <= retx_so_stop) && (retx_so_stop - retx_so_start + 1 <= pdu_mngt->payload_size), AssertFatal ((retx_so_start <= retx_so_stop) && (retx_so_stop - retx_so_start + 1 <= pdu_mngt->payload_size),
"RLC AM Tx PDU Segment Data SO Error: retx_so_start=%d retx_so_stop=%d OriginalPDUDataLength=%d sn=%d LcId=%d!\n", "RLC AM Tx PDU Segment Data SO Error: retx_so_start=%d retx_so_stop=%d OriginalPDUDataLength=%d sn=%d LcId=%d!\n",
retx_so_start,retx_so_stop,pdu_mngt->payload_size,sn,rlc_pP->channel_id); retx_so_start,retx_so_stop,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
*/
/* Init FI to the same value as original PDU */ /* Init FI to the same value as original PDU */
fi_start = (!(RLC_AM_PDU_GET_FI_START(*(pdu_mngt->first_byte)))); fi_start = (!(RLC_AM_PDU_GET_FI_START(*(pdu_mngt->first_byte))));
fi_end = (!(RLC_AM_PDU_GET_FI_END(*(pdu_mngt->first_byte)))); fi_end = (!(RLC_AM_PDU_GET_FI_END(*(pdu_mngt->first_byte))));
@@ -339,6 +395,7 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
*payload_sizeP = retx_so_stop - retx_so_start + 1; *payload_sizeP = retx_so_stop - retx_so_start + 1;
mem_pdu_segment_p = get_free_mem_block((*payload_sizeP + RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE + sizeof(struct mac_tb_req)), __func__); mem_pdu_segment_p = get_free_mem_block((*payload_sizeP + RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE + sizeof(struct mac_tb_req)), __func__);
if(mem_pdu_segment_p == NULL) return NULL;
pdu_segment_header_p = (uint8_t *)&mem_pdu_segment_p->data[sizeof(struct mac_tb_req)]; pdu_segment_header_p = (uint8_t *)&mem_pdu_segment_p->data[sizeof(struct mac_tb_req)];
((struct mac_tb_req*)(mem_pdu_segment_p->data))->data_ptr = pdu_segment_header_p; ((struct mac_tb_req*)(mem_pdu_segment_p->data))->data_ptr = pdu_segment_header_p;
((struct mac_tb_req*)(mem_pdu_segment_p->data))->tb_size = RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE + *payload_sizeP; ((struct mac_tb_req*)(mem_pdu_segment_p->data))->tb_size = RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE + *payload_sizeP;
@@ -408,8 +465,17 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
/* Set FI Start if retx_so_start = cumulated data size */ /* Set FI Start if retx_so_start = cumulated data size */
fi_start = TRUE; fi_start = TRUE;
/* there must be at least one SDU more */ /* there must be at least one SDU more */
//Assertion(eNB)_PRAN_DesignDocument_annex No.778
if(sdu_index >= pdu_mngt->nb_sdus)
{
LOG_E(RLC,"RLC AM Tx PDU Segment Error: sdu_index=%d nb_sdus=%d sn=%d LcId=%d !\n",
sdu_index,pdu_mngt->nb_sdus,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (sdu_index < pdu_mngt->nb_sdus, "RLC AM Tx PDU Segment Error: sdu_index=%d nb_sdus=%d sn=%d LcId=%d !\n", AssertFatal (sdu_index < pdu_mngt->nb_sdus, "RLC AM Tx PDU Segment Error: sdu_index=%d nb_sdus=%d sn=%d LcId=%d !\n",
sdu_index,pdu_mngt->nb_sdus,sn,rlc_pP->channel_id); sdu_index,pdu_mngt->nb_sdus,sn,rlc_pP->channel_id);
*/
if (sdu_index < pdu_mngt->nb_sdus - 1) if (sdu_index < pdu_mngt->nb_sdus - 1)
{ {
temp_read = ((*pdu_original_header_p) << 8) | (*(pdu_original_header_p + 1)); temp_read = ((*pdu_original_header_p) << 8) | (*(pdu_original_header_p + 1));
@@ -487,17 +553,33 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
/* Set number of LIs in the segment */ /* Set number of LIs in the segment */
num_LIs_pdu_segment = sdu_segment_index - 1; num_LIs_pdu_segment = sdu_segment_index - 1;
//Assertion(eNB)_PRAN_DesignDocument_annex No.779
if(num_LIs_pdu_segment > pdu_mngt->nb_sdus - 1)
{
LOG_E(RLC, "RLC AM Tx PDU Segment Data Error: nbLISegment=%d nbLIPDU=%d sn=%d LcId=%d !\n",
num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (num_LIs_pdu_segment <= pdu_mngt->nb_sdus - 1, "RLC AM Tx PDU Segment Data Error: nbLISegment=%d nbLIPDU=%d sn=%d LcId=%d !\n", AssertFatal (num_LIs_pdu_segment <= pdu_mngt->nb_sdus - 1, "RLC AM Tx PDU Segment Data Error: nbLISegment=%d nbLIPDU=%d sn=%d LcId=%d !\n",
num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id); num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
*/
/* Bound to available TBS taking into account min PDU segment header*/ /* Bound to available TBS taking into account min PDU segment header*/
sdu_segment_index = 0; sdu_segment_index = 0;
while ((sdu_segment_index < num_LIs_pdu_segment + 1) && (rlc_pP->nb_bytes_requested_by_mac > *payload_sizeP + RLC_AM_PDU_SEGMENT_HEADER_SIZE(sdu_segment_index))) while ((sdu_segment_index < num_LIs_pdu_segment + 1) && (rlc_pP->nb_bytes_requested_by_mac > *payload_sizeP + RLC_AM_PDU_SEGMENT_HEADER_SIZE(sdu_segment_index)))
{ {
//Assertion(eNB)_PRAN_DesignDocument_annex No.780
if(sdus_segment_size[sdu_segment_index] <= 0)
{
LOG_E(RLC, "RLC AM Tx PDU Segment Data Error: EMpty LI index=%d numLISegment=%d numLIPDU=%d PDULength=%d SOStart=%d SOStop=%d sn=%d LcId=%d !\n",
sdu_segment_index,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,pdu_mngt->payload_size,retx_so_start,retx_so_stop,sn,rlc_pP->channel_id);
sdu_segment_index++;
continue;
}
/*
AssertFatal (sdus_segment_size[sdu_segment_index] > 0, "RLC AM Tx PDU Segment Data Error: EMpty LI index=%d numLISegment=%d numLIPDU=%d PDULength=%d SOStart=%d SOStop=%d sn=%d LcId=%d !\n", AssertFatal (sdus_segment_size[sdu_segment_index] > 0, "RLC AM Tx PDU Segment Data Error: EMpty LI index=%d numLISegment=%d numLIPDU=%d PDULength=%d SOStart=%d SOStop=%d sn=%d LcId=%d !\n",
sdu_segment_index,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,pdu_mngt->payload_size,retx_so_start,retx_so_stop,sn,rlc_pP->channel_id); sdu_segment_index,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,pdu_mngt->payload_size,retx_so_start,retx_so_stop,sn,rlc_pP->channel_id);
*/
/* Add next sdu_segment_index to data part */ /* Add next sdu_segment_index to data part */
if (RLC_AM_PDU_SEGMENT_HEADER_SIZE(sdu_segment_index) + (*payload_sizeP) + sdus_segment_size[sdu_segment_index] <= rlc_pP->nb_bytes_requested_by_mac) if (RLC_AM_PDU_SEGMENT_HEADER_SIZE(sdu_segment_index) + (*payload_sizeP) + sdus_segment_size[sdu_segment_index] <= rlc_pP->nb_bytes_requested_by_mac)
{ {
@@ -519,11 +601,18 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
/* update retx_so_stop */ /* update retx_so_stop */
retx_so_stop = retx_so_start + (*payload_sizeP) - 1; retx_so_stop = retx_so_start + (*payload_sizeP) - 1;
//Assertion(eNB)_PRAN_DesignDocument_annex No.781
if((retx_so_stop > pdu_mngt->payload_size - 1) || (retx_so_stop - retx_so_start + 1 >= pdu_mngt->payload_size))
{
LOG_E(RLC,"RLC AM Tx PDU Segment Data Error: retx_so_stop=%d OriginalPDUDataLength=%d SOStart=%d SegmentLength=%d numLISegment=%d numLIPDU=%d sn=%d LcId=%d !\n",
retx_so_stop,pdu_mngt->payload_size,retx_so_start,*payload_sizeP,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal ((retx_so_stop <= pdu_mngt->payload_size - 1) && (retx_so_stop - retx_so_start + 1 < pdu_mngt->payload_size), AssertFatal ((retx_so_stop <= pdu_mngt->payload_size - 1) && (retx_so_stop - retx_so_start + 1 < pdu_mngt->payload_size),
"RLC AM Tx PDU Segment Data Error: retx_so_stop=%d OriginalPDUDataLength=%d SOStart=%d SegmentLength=%d numLISegment=%d numLIPDU=%d sn=%d LcId=%d !\n", "RLC AM Tx PDU Segment Data Error: retx_so_stop=%d OriginalPDUDataLength=%d SOStart=%d SegmentLength=%d numLISegment=%d numLIPDU=%d sn=%d LcId=%d !\n",
retx_so_stop,pdu_mngt->payload_size,retx_so_start,*payload_sizeP,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id); retx_so_stop,pdu_mngt->payload_size,retx_so_start,*payload_sizeP,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
*/
/* init FI End to FALSE if retx_so_stop is not end of PDU */ /* init FI End to FALSE if retx_so_stop is not end of PDU */
if (retx_so_stop != pdu_mngt->payload_size - 1) if (retx_so_stop != pdu_mngt->payload_size - 1)
{ {
@@ -541,16 +630,33 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
fi_end = TRUE; fi_end = TRUE;
} }
} }
//Assertion(eNB)_PRAN_DesignDocument_annex No.782
if(data_size != *payload_sizeP)
{
LOG_E(RLC,"RLC AM Tx PDU Segment Data Error: SduSum=%d Data=%d sn=%d LcId=%d !\n",
data_size,*payload_sizeP,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (data_size == *payload_sizeP, "RLC AM Tx PDU Segment Data Error: SduSum=%d Data=%d sn=%d LcId=%d !\n", AssertFatal (data_size == *payload_sizeP, "RLC AM Tx PDU Segment Data Error: SduSum=%d Data=%d sn=%d LcId=%d !\n",
data_size,*payload_sizeP,sn,rlc_pP->channel_id); data_size,*payload_sizeP,sn,rlc_pP->channel_id);
*/
/* Allocation */ /* Allocation */
//Assertion(eNB)_PRAN_DesignDocument_annex No.783
if(header_segment_length + *payload_sizeP > pdu_mngt->header_and_payload_size + 2)
{
LOG_E(RLC, "RLC AM PDU Segment Error: Hdr=%d Data=%d Original Hdr+Data =%d sn=%d LcId=%d !\n",
header_segment_length,*payload_sizeP,pdu_mngt->header_and_payload_size,sn,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal (header_segment_length + *payload_sizeP <= pdu_mngt->header_and_payload_size + 2, "RLC AM PDU Segment Error: Hdr=%d Data=%d Original Hdr+Data =%d sn=%d LcId=%d !\n", AssertFatal (header_segment_length + *payload_sizeP <= pdu_mngt->header_and_payload_size + 2, "RLC AM PDU Segment Error: Hdr=%d Data=%d Original Hdr+Data =%d sn=%d LcId=%d !\n",
header_segment_length,*payload_sizeP,pdu_mngt->header_and_payload_size,sn,rlc_pP->channel_id); header_segment_length,*payload_sizeP,pdu_mngt->header_and_payload_size,sn,rlc_pP->channel_id);
*/
mem_pdu_segment_p = get_free_mem_block((*payload_sizeP + header_segment_length + sizeof(struct mac_tb_req)), __func__); mem_pdu_segment_p = get_free_mem_block((*payload_sizeP + header_segment_length + sizeof(struct mac_tb_req)), __func__);
if(mem_pdu_segment_p == NULL) return NULL;
pdu_segment_header_p = (uint8_t *)&mem_pdu_segment_p->data[sizeof(struct mac_tb_req)]; pdu_segment_header_p = (uint8_t *)&mem_pdu_segment_p->data[sizeof(struct mac_tb_req)];
((struct mac_tb_req*)(mem_pdu_segment_p->data))->data_ptr = pdu_segment_header_p; ((struct mac_tb_req*)(mem_pdu_segment_p->data))->data_ptr = pdu_segment_header_p;
((struct mac_tb_req*)(mem_pdu_segment_p->data))->tb_size = header_segment_length + *payload_sizeP; ((struct mac_tb_req*)(mem_pdu_segment_p->data))->tb_size = header_segment_length + *payload_sizeP;
@@ -718,6 +824,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
if (mb_original_p != NULL) { if (mb_original_p != NULL) {
mem_block_t* mb_sub_segment_p = get_free_mem_block(*sizeP + sizeof(struct mac_tb_req), __func__); mem_block_t* mb_sub_segment_p = get_free_mem_block(*sizeP + sizeof(struct mac_tb_req), __func__);
if(mb_sub_segment_p == NULL) return NULL;
rlc_am_pdu_sn_10_t* pdu_original_p = (rlc_am_pdu_sn_10_t*) (&mb_original_p->data[sizeof(struct mac_tb_req)]); rlc_am_pdu_sn_10_t* pdu_original_p = (rlc_am_pdu_sn_10_t*) (&mb_original_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_sn_10_t* pdu_sub_segment_p = (rlc_am_pdu_sn_10_t*) (&mb_sub_segment_p->data[sizeof(struct mac_tb_req)]); rlc_am_pdu_sn_10_t* pdu_sub_segment_p = (rlc_am_pdu_sn_10_t*) (&mb_sub_segment_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_info_t pdu_info; rlc_am_pdu_info_t pdu_info;
@@ -1170,7 +1277,11 @@ void rlc_am_tx_buffer_display (
LOG_D(RLC, "SO:%04d->%04d)\t", tx_data_pdu_buffer_p->nack_so_start, tx_data_pdu_buffer_p->nack_so_stop); LOG_D(RLC, "SO:%04d->%04d)\t", tx_data_pdu_buffer_p->nack_so_start, tx_data_pdu_buffer_p->nack_so_stop);
} else { } else {
for (i=0; i<tx_data_pdu_buffer_p->num_holes; i++) { for (i=0; i<tx_data_pdu_buffer_p->num_holes; i++) {
assert(i < RLC_AM_MAX_HOLES_REPORT_PER_PDU); //assert(i < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
if(i >= RLC_AM_MAX_HOLES_REPORT_PER_PDU) {
LOG_E(RLC, "num_holes error. %d %d %d\n", tx_data_pdu_buffer_p->num_holes, i, RLC_AM_MAX_HOLES_REPORT_PER_PDU);
break;
}
LOG_D(RLC, "SO:%04d->%04d)\t", tx_data_pdu_buffer_p->hole_so_start[i], tx_data_pdu_buffer_p->hole_so_stop[i]); LOG_D(RLC, "SO:%04d->%04d)\t", tx_data_pdu_buffer_p->hole_so_start[i], tx_data_pdu_buffer_p->hole_so_stop[i]);
} }
} }
@@ -1193,22 +1304,50 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
rlc_sn_t sn_end = rlc_pP->vt_s; rlc_sn_t sn_end = rlc_pP->vt_s;
mem_block_t* pdu_p = NULL; mem_block_t* pdu_p = NULL;
rlc_am_tx_data_pdu_management_t* tx_data_pdu_management; rlc_am_tx_data_pdu_management_t* tx_data_pdu_management;
//Assertion(eNB)_PRAN_DesignDocument_annex No.769
if((rlc_pP->retrans_num_pdus <= 0) || (rlc_pP->vt_a == rlc_pP->vt_s))
{
LOG_E(RLC, "RLC AM ReTx start process Error: NbPDUtoRetx=%d vtA=%d vtS=%d LcId=%d !\n",
rlc_pP->retrans_num_pdus,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
return NULL;
}
/*
AssertFatal ((rlc_pP->retrans_num_pdus > 0) && (rlc_pP->vt_a != rlc_pP->vt_s), "RLC AM ReTx start process Error: NbPDUtoRetx=%d vtA=%d vtS=%d LcId=%d !\n", AssertFatal ((rlc_pP->retrans_num_pdus > 0) && (rlc_pP->vt_a != rlc_pP->vt_s), "RLC AM ReTx start process Error: NbPDUtoRetx=%d vtA=%d vtS=%d LcId=%d !\n",
rlc_pP->retrans_num_pdus,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); rlc_pP->retrans_num_pdus,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
do do
{ {
tx_data_pdu_management = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE]; tx_data_pdu_management = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE];
if ((tx_data_pdu_management->flags.retransmit) && (tx_data_pdu_management->flags.max_retransmit == 0)) if ((tx_data_pdu_management->flags.retransmit) && (tx_data_pdu_management->flags.max_retransmit == 0))
{ {
//Assertion(eNB)_PRAN_DesignDocument_annex No.770
if(tx_data_pdu_management->sn != sn)
{
LOG_E(RLC, "RLC AM ReTx PDU Error: SN Error pdu_sn=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
tx_data_pdu_management->sn,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
}
//Assertion(eNB)_PRAN_DesignDocument_annex No.771
else if(tx_data_pdu_management->flags.transmitted != 1)
{
LOG_E(RLC, "RLC AM ReTx PDU Error: State Error sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
}
//Assertion(eNB)_PRAN_DesignDocument_annex No.772
else if(tx_data_pdu_management->retx_payload_size <= 0)
{
LOG_E(RLC, "RLC AM ReTx PDU Error: No Data to Retx sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
}
else
{
/*
AssertFatal (tx_data_pdu_management->sn == sn, "RLC AM ReTx PDU Error: SN Error pdu_sn=%d sn=%d vtA=%d vtS=%d LcId=%d !\n", AssertFatal (tx_data_pdu_management->sn == sn, "RLC AM ReTx PDU Error: SN Error pdu_sn=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
tx_data_pdu_management->sn,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); tx_data_pdu_management->sn,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
AssertFatal (tx_data_pdu_management->flags.transmitted == 1, "RLC AM ReTx PDU Error: State Error sn=%d vtA=%d vtS=%d LcId=%d !\n", AssertFatal (tx_data_pdu_management->flags.transmitted == 1, "RLC AM ReTx PDU Error: State Error sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
AssertFatal (tx_data_pdu_management->retx_payload_size > 0, "RLC AM ReTx PDU Error: No Data to Retx sn=%d vtA=%d vtS=%d LcId=%d !\n", AssertFatal (tx_data_pdu_management->retx_payload_size > 0, "RLC AM ReTx PDU Error: No Data to Retx sn=%d vtA=%d vtS=%d LcId=%d !\n",
sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
*/
/* Either the whole RLC PDU is to be transmitted and there is enough MAC TBS or there is minimum TBS size for transmitting 1 AM PDU segment */ /* Either the whole RLC PDU is to be transmitted and there is enough MAC TBS or there is minimum TBS size for transmitting 1 AM PDU segment */
if ((tx_data_pdu_management->retx_payload_size == tx_data_pdu_management->payload_size) && (rlc_pP->nb_bytes_requested_by_mac >= tx_data_pdu_management->header_and_payload_size)) if ((tx_data_pdu_management->retx_payload_size == tx_data_pdu_management->payload_size) && (rlc_pP->nb_bytes_requested_by_mac >= tx_data_pdu_management->header_and_payload_size))
{ {
@@ -1256,9 +1395,18 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
if (pdu_p != NULL) if (pdu_p != NULL)
{ {
//Assertion(eNB)_PRAN_DesignDocument_annex No.773
if((tx_data_pdu_management->retx_payload_size < pdu_data_size)|| (rlc_pP->retrans_num_bytes_to_retransmit < pdu_data_size))
{
LOG_E(RLC, "RLC AM ReTx PDU Segment Error: DataSize=%d PDUReTxsize=%d TotalReTxsize=%d sn=%d LcId=%d !\n",
pdu_data_size,tx_data_pdu_management->retx_payload_size,rlc_pP->retrans_num_bytes_to_retransmit,sn,rlc_pP->channel_id);
}
else
{
/*
AssertFatal ((tx_data_pdu_management->retx_payload_size >= pdu_data_size) && (rlc_pP->retrans_num_bytes_to_retransmit >= pdu_data_size), "RLC AM ReTx PDU Segment Error: DataSize=%d PDUReTxsize=%d TotalReTxsize=%d sn=%d LcId=%d !\n", AssertFatal ((tx_data_pdu_management->retx_payload_size >= pdu_data_size) && (rlc_pP->retrans_num_bytes_to_retransmit >= pdu_data_size), "RLC AM ReTx PDU Segment Error: DataSize=%d PDUReTxsize=%d TotalReTxsize=%d sn=%d LcId=%d !\n",
pdu_data_size,tx_data_pdu_management->retx_payload_size,rlc_pP->retrans_num_bytes_to_retransmit,sn,rlc_pP->channel_id); pdu_data_size,tx_data_pdu_management->retx_payload_size,rlc_pP->retrans_num_bytes_to_retransmit,sn,rlc_pP->channel_id);
*/
tx_data_pdu_management->retx_payload_size -= pdu_data_size; tx_data_pdu_management->retx_payload_size -= pdu_data_size;
rlc_pP->retrans_num_bytes_to_retransmit -= pdu_data_size; rlc_pP->retrans_num_bytes_to_retransmit -= pdu_data_size;
if (tx_data_pdu_management->retx_payload_size == 0) if (tx_data_pdu_management->retx_payload_size == 0)
@@ -1276,6 +1424,7 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
rlc_pP->stat_tx_retransmit_bytes += pdu_data_size; rlc_pP->stat_tx_retransmit_bytes += pdu_data_size;
rlc_pP->stat_tx_retransmit_bytes_by_status += pdu_data_size; rlc_pP->stat_tx_retransmit_bytes_by_status += pdu_data_size;
}//Assertion(eNB)_PRAN_DesignDocument_annex No.773
} }
} }
else else
@@ -1300,8 +1449,8 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
break; break;
} }
}//Assertion(eNB)_PRAN_DesignDocument_annex No.770 No.771 No.772
} }
sn = RLC_AM_NEXT_SN(sn); sn = RLC_AM_NEXT_SN(sn);
} while((sn != sn_end) && (rlc_pP->retrans_num_pdus > 0)); } while((sn != sn_end) && (rlc_pP->retrans_num_pdus > 0));
+108 -10
View File
@@ -53,8 +53,17 @@ boolean_t rlc_am_rx_check_vr_reassemble(
if (pdu_info_p->rf) { if (pdu_info_p->rf) {
pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data); pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
next_waited_so = 0; next_waited_so = 0;
//Assertion(eNB)_PRAN_DesignDocument_annex No.785
if(pdu_cursor_mgnt_p->all_segments_received <= 0)
{
LOG_E(RLC, "AM Rx Check Reassembly head SN=%d with PDU segments != vrR=%d should be fully received LCID=%d\n",
sn_ref,rlc_pP->vr_r,rlc_pP->channel_id);
return FALSE;
}
/*
AssertFatal(pdu_cursor_mgnt_p->all_segments_received > 0,"AM Rx Check Reassembly head SN=%d with PDU segments != vrR=%d should be fully received LCID=%d\n", AssertFatal(pdu_cursor_mgnt_p->all_segments_received > 0,"AM Rx Check Reassembly head SN=%d with PDU segments != vrR=%d should be fully received LCID=%d\n",
sn_ref,rlc_pP->vr_r,rlc_pP->channel_id); sn_ref,rlc_pP->vr_r,rlc_pP->channel_id);
*/
while ((cursor_p != NULL) && (pdu_info_p->sn == sn_ref) && (pdu_info_p->so == next_waited_so)) { while ((cursor_p != NULL) && (pdu_info_p->sn == sn_ref) && (pdu_info_p->so == next_waited_so)) {
if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) { if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) {
pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING; pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING;
@@ -80,8 +89,17 @@ boolean_t rlc_am_rx_check_vr_reassemble(
if ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r)) { if ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r)) {
pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data); pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
next_waited_so = 0; next_waited_so = 0;
//Assertion(eNB)_PRAN_DesignDocument_annex No.786
if(pdu_cursor_mgnt_p->all_segments_received != 0)
{
LOG_E(RLC, "AM Rx Check Reassembly vr=%d should be partly received SNHead=%d LCID=%d\n",
rlc_pP->vr_r,sn_ref,rlc_pP->channel_id);
return FALSE;
}
/*
AssertFatal(pdu_cursor_mgnt_p->all_segments_received == 0,"AM Rx Check Reassembly vr=%d should be partly received SNHead=%d LCID=%d\n", AssertFatal(pdu_cursor_mgnt_p->all_segments_received == 0,"AM Rx Check Reassembly vr=%d should be partly received SNHead=%d LCID=%d\n",
rlc_pP->vr_r,sn_ref,rlc_pP->channel_id); rlc_pP->vr_r,sn_ref,rlc_pP->channel_id);
*/
while ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r) && (pdu_info_p->so == next_waited_so)) { while ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r) && (pdu_info_p->so == next_waited_so)) {
if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) { if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) {
pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING; pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING;
@@ -100,8 +118,17 @@ boolean_t rlc_am_rx_check_vr_reassemble(
pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data); pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
next_waited_so = 0; next_waited_so = 0;
//Assertion(eNB)_PRAN_DesignDocument_annex No.787
if(pdu_cursor_mgnt_p->all_segments_received != 0)
{
LOG_E(RLC, "AM Rx Check Reassembly SNHead=vr=%d should be partly received LCID=%d\n",
rlc_pP->vr_r,rlc_pP->channel_id);
return FALSE;
}
/*
AssertFatal(pdu_cursor_mgnt_p->all_segments_received == 0,"AM Rx Check Reassembly SNHead=vr=%d should be partly received LCID=%d\n", AssertFatal(pdu_cursor_mgnt_p->all_segments_received == 0,"AM Rx Check Reassembly SNHead=vr=%d should be partly received LCID=%d\n",
rlc_pP->vr_r,rlc_pP->channel_id); rlc_pP->vr_r,rlc_pP->channel_id);
*/
while ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r) && (pdu_info_p->so == next_waited_so)) { while ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r) && (pdu_info_p->so == next_waited_so)) {
if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) { if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) {
pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING; pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING;
@@ -333,8 +360,15 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu_segment(
/*****************************************************/ /*****************************************************/
// 1) Find previous cursor to the PDU to insert // 1) Find previous cursor to the PDU to insert
/*****************************************************/ /*****************************************************/
//Assertion(eNB)_PRAN_DesignDocument_annex No.791
if(cursor_p == NULL)
{
LOG_E(RLC, "AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
return RLC_AM_DATA_PDU_STATUS_HEADER_ERROR;
}
/*
AssertFatal(cursor_p != NULL,"AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id); AssertFatal(cursor_p != NULL,"AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
*/
do { do {
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info; pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
@@ -483,11 +517,20 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu_segment(
} }
} }
//Assertion(eNB)_PRAN_DesignDocument_annex No.792
if((so_start_segment > so_end_segment) || (pdu_rx_info_p->so > so_start_segment) ||
(so_end_segment > pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
{
LOG_E(RLC, " AM RX PDU Segment Duplicate elimination error FirstSO=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
}
/*
AssertFatal((so_start_segment <= so_end_segment) && (pdu_rx_info_p->so <= so_start_segment) && AssertFatal((so_start_segment <= so_end_segment) && (pdu_rx_info_p->so <= so_start_segment) &&
(so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1), (so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
" AM RX PDU Segment Duplicate elimination error FirstSO=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n", " AM RX PDU Segment Duplicate elimination error FirstSO=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn); pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
*/
} // end pdu_info_cursor_p->so == 0 } // end pdu_info_cursor_p->so == 0
else { else {
// Handle most likely case : PDU Segment without duplicate is inserted before first stored PDU segment // Handle most likely case : PDU Segment without duplicate is inserted before first stored PDU segment
@@ -527,12 +570,20 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu_segment(
so_end_segment = pdu_info_cursor_p->so - 1; so_end_segment = pdu_info_cursor_p->so - 1;
} }
} }
//Assertion(eNB)_PRAN_DesignDocument_annex No.793
if((so_start_segment > so_end_segment) ||
(so_end_segment > pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
{
LOG_E(RLC, " AM RX PDU Segment Duplicate elimination at the end error FirstSO!=0 SOStart=%d OldSOEnd=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_end_segment,pdu_rx_info_p->sn);
return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
}
/*
AssertFatal((so_start_segment <= so_end_segment) && AssertFatal((so_start_segment <= so_end_segment) &&
(so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1), (so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
" AM RX PDU Segment Duplicate elimination at the end error FirstSO!=0 SOStart=%d OldSOEnd=%d newSOEnd =%d SN=%d\n", " AM RX PDU Segment Duplicate elimination at the end error FirstSO!=0 SOStart=%d OldSOEnd=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_end_segment,pdu_rx_info_p->sn); pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_end_segment,pdu_rx_info_p->sn);
*/
} }
else { else {
// Second Case: Duplicate at the begining and potentially at the end // Second Case: Duplicate at the begining and potentially at the end
@@ -618,21 +669,38 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu_segment(
so_end_segment = pdu_info_cursor_p->so - 1; so_end_segment = pdu_info_cursor_p->so - 1;
} }
} }
//Assertion(eNB)_PRAN_DesignDocument_annex No.794
if((so_start_segment > so_end_segment) || (pdu_rx_info_p->so > so_start_segment) ||
(so_end_segment > pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
{
LOG_E(RLC, " AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
}
/*
AssertFatal((so_start_segment <= so_end_segment) && (pdu_rx_info_p->so <= so_start_segment) && AssertFatal((so_start_segment <= so_end_segment) && (pdu_rx_info_p->so <= so_start_segment) &&
(so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1), (so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
" AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n", " AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn); pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
*/
} }
} // end pdu_info_cursor_p->so != 0 } // end pdu_info_cursor_p->so != 0
/* Last step : duplicate bytes had been removed, build a new PDU segment */ /* Last step : duplicate bytes had been removed, build a new PDU segment */
//Assertion(eNB)_PRAN_DesignDocument_annex No.795
if((pdu_rx_info_p->so == so_start_segment) && (so_end_segment == pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
{
LOG_E(RLC, " AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
}
/*
AssertFatal((pdu_rx_info_p->so != so_start_segment) || (so_end_segment != pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1), AssertFatal((pdu_rx_info_p->so != so_start_segment) || (so_end_segment != pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
" AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n", " AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn); pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
*/
mem_block_t* trunc_segment = create_new_segment_from_pdu(tb_pP,so_start_segment - pdu_rx_info_p->so,so_end_segment - so_start_segment + 1); mem_block_t* trunc_segment = create_new_segment_from_pdu(tb_pP,so_start_segment - pdu_rx_info_p->so,so_end_segment - so_start_segment + 1);
if (trunc_segment != NULL) { if (trunc_segment != NULL) {
LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT] CREATE SEGMENT FROM SEGMENT OFFSET=%d DATA LENGTH=%d SN=%d\n", LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT] CREATE SEGMENT FROM SEGMENT OFFSET=%d DATA LENGTH=%d SN=%d\n",
@@ -672,8 +740,15 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu(
/*****************************************************/ /*****************************************************/
// 1) Find previous cursor to the PDU to insert // 1) Find previous cursor to the PDU to insert
/*****************************************************/ /*****************************************************/
//Assertion(eNB)_PRAN_DesignDocument_annex No.788
if(cursor_p == NULL)
{
LOG_E(RLC, "AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
return RLC_AM_DATA_PDU_STATUS_HEADER_ERROR;
}
/*
AssertFatal(cursor_p != NULL,"AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id); AssertFatal(cursor_p != NULL,"AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
*/
do { do {
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info; pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
@@ -749,9 +824,25 @@ rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu(
else { else {
/* First update cursor until discontinuity */ /* First update cursor until discontinuity */
previous_cursor_p = cursor_p; previous_cursor_p = cursor_p;
//Assertion(eNB)_PRAN_DesignDocument_annex No.789
if(pdu_info_cursor_p->rf == 0)
{
LOG_E(RLC, "AM Rx PDU Error, stored SN=%d should be a PDU segment\n",pdu_info_cursor_p->sn);
return RLC_AM_DATA_PDU_STATUS_HEADER_ERROR;
}
/*
AssertFatal(pdu_info_cursor_p->rf != 0,"AM Rx PDU Error, stored SN=%d should be a PDU segment\n",pdu_info_cursor_p->sn); AssertFatal(pdu_info_cursor_p->rf != 0,"AM Rx PDU Error, stored SN=%d should be a PDU segment\n",pdu_info_cursor_p->sn);
*/
//Assertion(eNB)_PRAN_DesignDocument_annex No.790
if(((rlc_am_rx_pdu_management_t *) (cursor_p->data))->all_segments_received != 0)
{
LOG_E(RLC, "AM Rx PDU Error, stored SN=%d already fully received\n",pdu_info_cursor_p->sn);
return RLC_AM_DATA_PDU_STATUS_SN_DUPLICATE;
}
/*
AssertFatal(((rlc_am_rx_pdu_management_t *) (cursor_p->data))->all_segments_received == 0, AssertFatal(((rlc_am_rx_pdu_management_t *) (cursor_p->data))->all_segments_received == 0,
"AM Rx PDU Error, stored SN=%d already fully received\n",pdu_info_cursor_p->sn); "AM Rx PDU Error, stored SN=%d already fully received\n",pdu_info_cursor_p->sn);
*/
sdu_size_t next_waited_so = 0; sdu_size_t next_waited_so = 0;
while ((cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn) && (pdu_info_cursor_p->so == next_waited_so)) { while ((cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn) && (pdu_info_cursor_p->so == next_waited_so)) {
next_waited_so += pdu_info_cursor_p->payload_size; next_waited_so += pdu_info_cursor_p->payload_size;
@@ -1558,7 +1649,8 @@ list2_insert_before_element (
return element_to_insert_pP; return element_to_insert_pP;
} else { } else {
assert(2==1); //assert(2==1);
LOG_E(RLC, "list2_insert_before_element error. element_to_insert_pP %p, element_pP %p\n", element_to_insert_pP,element_pP);
return NULL; return NULL;
} }
} }
@@ -1585,7 +1677,8 @@ list2_insert_after_element (
return element_to_insert_pP; return element_to_insert_pP;
} else { } else {
assert(2==1); //assert(2==1);
LOG_E(RLC, "list2_insert_after_element error. element_to_insert_pP %p, element_pP %p\n", element_to_insert_pP,element_pP);
return NULL; return NULL;
} }
} }
@@ -1635,7 +1728,12 @@ rlc_am_rx_list_display (
//if (cursor_p == cursor_p->next) { //if (cursor_p == cursor_p->next) {
// rlc_am_v9_3_0_test_print_trace(); // rlc_am_v9_3_0_test_print_trace();
//} //}
assert(cursor_p != cursor_p->next); //assert(cursor_p != cursor_p->next);
if(cursor_p == cursor_p->next)
{
LOG_E(RLC, "rlc_am_rx_list_display error. cursor_p %p, cursor_p->next %p\n", cursor_p, cursor_p->next);
break;
}
cursor_p = cursor_p->next; cursor_p = cursor_p->next;
loop++; loop++;
} }
+23 -4
View File
@@ -299,7 +299,12 @@ void rlc_am_segment_10 (
pdu_mngt_p->sdus_index[pdu_mngt_p->nb_sdus++] = sdu_buffer_index; pdu_mngt_p->sdus_index[pdu_mngt_p->nb_sdus++] = sdu_buffer_index;
sdu_mngt_p->pdus_index[sdu_mngt_p->nb_pdus++] = rlc_pP->vt_s % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE; sdu_mngt_p->pdus_index[sdu_mngt_p->nb_pdus++] = rlc_pP->vt_s % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE;
assert(sdu_mngt_p->nb_pdus < RLC_AM_MAX_SDU_FRAGMENTS); //assert(sdu_mngt_p->nb_pdus < RLC_AM_MAX_SDU_FRAGMENTS);
if(sdu_mngt_p->nb_pdus >= RLC_AM_MAX_SDU_FRAGMENTS) {
LOG_E(RLC,PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] loop error. %d %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), sdu_mngt_p->nb_pdus, RLC_AM_MAX_SDU_FRAGMENTS);
break;
}
sdu_buffer_index = (sdu_buffer_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE; sdu_buffer_index = (sdu_buffer_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
} }
@@ -353,6 +358,8 @@ void rlc_am_segment_10 (
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_remaining_size); pdu_remaining_size);
//msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] pdu_mem_p %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n", rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame, pdu_mem_p, pdu_p, pdu_p->data, data, data_sdu_p,pdu_remaining_size); //msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] pdu_mem_p %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n", rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame, pdu_mem_p, pdu_p, pdu_p->data, data, data_sdu_p,pdu_remaining_size);
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
memcpy(data, data_sdu_p, pdu_remaining_size); memcpy(data, data_sdu_p, pdu_remaining_size);
pdu_mngt_p->payload_size += pdu_remaining_size; pdu_mngt_p->payload_size += pdu_remaining_size;
@@ -371,6 +378,9 @@ void rlc_am_segment_10 (
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Exactly Filling remaining PDU with %d remaining bytes of SDU\n", LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Exactly Filling remaining PDU with %d remaining bytes of SDU\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_remaining_size); pdu_remaining_size);
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
memcpy(data, data_sdu_p, pdu_remaining_size); memcpy(data, data_sdu_p, pdu_remaining_size);
pdu_mngt_p->payload_size += pdu_remaining_size; pdu_mngt_p->payload_size += pdu_remaining_size;
@@ -387,6 +397,8 @@ void rlc_am_segment_10 (
continue_fill_pdu_with_sdu = 0; continue_fill_pdu_with_sdu = 0;
pdu_remaining_size = 0; pdu_remaining_size = 0;
} else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) { } else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) {
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
if (fill_num_li == (RLC_AM_MAX_SDU_IN_PDU - 1)) { if (fill_num_li == (RLC_AM_MAX_SDU_IN_PDU - 1)) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] [SIZE %d] REACHING RLC_AM_MAX_SDU_IN_PDU LIs -> STOP SEGMENTATION FOR THIS PDU SDU\n", LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] [SIZE %d] REACHING RLC_AM_MAX_SDU_IN_PDU LIs -> STOP SEGMENTATION FOR THIS PDU SDU\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
@@ -462,11 +474,14 @@ void rlc_am_segment_10 (
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE; rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
} }
} else { } else {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n", LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
sdu_mngt_p->sdu_remaining_size, sdu_mngt_p->sdu_remaining_size,
pdu_remaining_size - sdu_mngt_p->sdu_remaining_size); pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
assert(1!=1); //assert(1!=1);
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size); memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size; pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size;
pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size; pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size;
@@ -520,7 +535,11 @@ void rlc_am_segment_10 (
pdu_tb_req_p->data_ptr = (unsigned char*)pdu_p; pdu_tb_req_p->data_ptr = (unsigned char*)pdu_p;
pdu_tb_req_p->tb_size = data_pdu_size - pdu_remaining_size; pdu_tb_req_p->tb_size = data_pdu_size - pdu_remaining_size;
//#warning "why 3000: changed to RLC_SDU_MAX_SIZE " //#warning "why 3000: changed to RLC_SDU_MAX_SIZE "
assert(pdu_tb_req_p->tb_size < RLC_SDU_MAX_SIZE ); //assert(pdu_tb_req_p->tb_size < RLC_SDU_MAX_SIZE );
if(pdu_tb_req_p->tb_size >= RLC_SDU_MAX_SIZE) {
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] tb_size error. %d, %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_tb_req_p->tb_size, RLC_SDU_MAX_SIZE);
}
rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_p, pdu_mngt_p->payload_size,true); rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_p, pdu_mngt_p->payload_size,true);
//list_add_tail_eurecom (pdu_mem_p, &rlc_pP->segmentation_pdu_list); //list_add_tail_eurecom (pdu_mem_p, &rlc_pP->segmentation_pdu_list);
@@ -154,7 +154,10 @@ rlc_am_write16_bit_field(
signed int bits_to_writeP, signed int bits_to_writeP,
const uint16_t valueP) const uint16_t valueP)
{ {
assert(bits_to_writeP <= 16); //assert(bits_to_writeP <= 16);
if(bits_to_writeP > 16) {
LOG_E(RLC, "bits_to_writeP error. %d\n", bits_to_writeP);
}
if (bits_to_writeP > 8) { if (bits_to_writeP > 8) {
rlc_am_write8_bit_field(data_ppP,bit_pos_pP, bits_to_writeP - 8, (uint8_t)(valueP >> 8)); rlc_am_write8_bit_field(data_ppP,bit_pos_pP, bits_to_writeP - 8, (uint8_t)(valueP >> 8));
@@ -212,6 +215,9 @@ rlc_am_get_control_pdu_infos(
if (!pdu_info_pP->nack_list[pdu_info_pP->num_nack - 1].e1) { if (!pdu_info_pP->nack_list[pdu_info_pP->num_nack - 1].e1) {
nack_to_read = 0; nack_to_read = 0;
*total_size_pP = *total_size_pP - (sdu_size_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP); *total_size_pP = *total_size_pP - (sdu_size_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
if (*total_size_pP != 0) {
LOG_E(RLC, "[RLC_AM_GET_CONTROL_PDU_INFOS][FIRST]header_pP->b1=%d,header_pP->b2=%d\n",header_pP->b1,header_pP->b2);
}
return 0; return 0;
} }
@@ -225,7 +231,9 @@ rlc_am_get_control_pdu_infos(
} else { } else {
*total_size_pP = *total_size_pP - 2; *total_size_pP = *total_size_pP - 2;
} }
if (*total_size_pP != 0) {
LOG_E(RLC, "[RLC_AM_GET_CONTROL_PDU_INFOS][SECOND]header_pP->b1=%d,header_pP->b2=%d\n",header_pP->b1,header_pP->b2);
}
return 0; return 0;
} else { } else {
return -1; return -1;
@@ -309,8 +317,13 @@ rlc_am_receive_process_control_pdu(
// POLL_SN: // POLL_SN:
// - if t-PollRetransmit is running: // - if t-PollRetransmit is running:
// - stop and reset t-PollRetransmit. // - stop and reset t-PollRetransmit.
assert(ack_sn < RLC_AM_SN_MODULO); //assert(ack_sn < RLC_AM_SN_MODULO);
assert(rlc_pP->control_pdu_info.num_nack < RLC_AM_MAX_NACK_IN_STATUS_PDU); //assert(rlc_pP->control_pdu_info.num_nack < RLC_AM_MAX_NACK_IN_STATUS_PDU);
if(ack_sn >= RLC_AM_SN_MODULO || rlc_pP->control_pdu_info.num_nack >= RLC_AM_MAX_NACK_IN_STATUS_PDU) {
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" illegal ack_sn %d, num_nack %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), ack_sn, rlc_pP->control_pdu_info.num_nack);
return;
}
/* Note : ackSn can be equal to current vtA only in case the status pdu contains a list of nack_sn with same value = vtA with SOStart/SOEnd */ /* Note : ackSn can be equal to current vtA only in case the status pdu contains a list of nack_sn with same value = vtA with SOStart/SOEnd */
/* and meaning the report is not complete due to not enough ressources to fill all SOStart/SOEnd of this NACK_SN */ /* and meaning the report is not complete due to not enough ressources to fill all SOStart/SOEnd of this NACK_SN */
@@ -388,13 +401,15 @@ rlc_am_receive_process_control_pdu(
} else { } else {
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT" WARNING CONTROL PDU ACK SN %d OUT OF WINDOW vtA=%d vtS=%d\n", LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" WARNING CONTROL PDU ACK SN %d OUT OF WINDOW vtA=%d vtS=%d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,rlc_pP->vt_a,rlc_pP->vt_s); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,rlc_pP->vt_a,rlc_pP->vt_s);
*tb_size_in_bytes_pP = 0;
status = FALSE; status = FALSE;
} }
} else { } else {
LOG_W(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR IN DECODING CONTROL PDU\n", LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR IN DECODING CONTROL PDU\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
*tb_size_in_bytes_pP = 0;
status = FALSE; status = FALSE;
} }
@@ -611,10 +626,13 @@ rlc_am_send_status_pdu(
/* Now process all Segments of sn_cursor if PDU not fully received */ /* Now process all Segments of sn_cursor if PDU not fully received */
if ((!status_report_completed) && (all_segments_received == 0) && (sn_cursor != rlc_pP->vr_ms)) { if ((!status_report_completed) && (all_segments_received == 0) && (sn_cursor != rlc_pP->vr_ms)) {
AssertFatal (sn_nack == sn_cursor, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id); //AssertFatal (sn_nack == sn_cursor, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id);
if(sn_nack != sn_cursor){
LOG_E(RLC, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id);
}
/* First ensure there is enough TBS for at least 1 SOStart/SOEnd, else break */ /* First ensure there is enough TBS for at least 1 SOStart/SOEnd, else break */
if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) { else if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) {
/* Init loop flags */ /* Init loop flags */
/* Check lsf */ /* Check lsf */
segment_loop_end = (pdu_info_cursor_p->lsf == 1); segment_loop_end = (pdu_info_cursor_p->lsf == 1);
@@ -757,8 +775,14 @@ rlc_am_send_status_pdu(
} // End main while NACK_SN } // End main while NACK_SN
/* Clear E1 of last nack_sn entry */ /* Clear E1 of last nack_sn entry */
AssertFatal ((control_pdu_info.num_nack) || (all_segments_received == 0), "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n", // AssertFatal ((control_pdu_info.num_nack) || (all_segments_received == 0), "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n",
rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id); // rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id);
if (!((control_pdu_info.num_nack) || (all_segments_received == 0))){
LOG_E(RLC, "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n",
rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id);
return;
}
if (control_pdu_info.num_nack) { if (control_pdu_info.num_nack) {
control_pdu_info.nack_list[control_pdu_info.num_nack - 1].e1 = 0; control_pdu_info.nack_list[control_pdu_info.num_nack - 1].e1 = 0;
} }
@@ -796,8 +820,13 @@ rlc_am_send_status_pdu(
/* encode the control pdu */ /* encode the control pdu */
pdu_size = (nb_bits_transmitted + 7) >> 3; pdu_size = (nb_bits_transmitted + 7) >> 3;
AssertFatal (pdu_size <= rlc_pP->nb_bytes_requested_by_mac, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n", // AssertFatal (pdu_size <= rlc_pP->nb_bytes_requested_by_mac, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n",
// pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id);
if(pdu_size > rlc_pP->nb_bytes_requested_by_mac){
LOG_E(RLC, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n",
pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id); pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id);
return;
}
#if TRACE_RLC_AM_STATUS_CREATION #if TRACE_RLC_AM_STATUS_CREATION
@@ -807,6 +836,7 @@ rlc_am_send_status_pdu(
pdu_size); pdu_size);
#endif #endif
tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__); tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__);
if(tb_p == NULL) return;
memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size); memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
//estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size; //estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]); ((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]);
@@ -825,8 +855,14 @@ rlc_am_send_status_pdu(
nb_bits_to_transmit >> 3); nb_bits_to_transmit >> 3);
#endif #endif
AssertFatal (pdu_size == ((nb_bits_transmitted + 7) >> 3), "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n", // AssertFatal (pdu_size == ((nb_bits_transmitted + 7) >> 3), "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n",
// pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id);
if(pdu_size != ((nb_bits_transmitted + 7) >> 3)){
LOG_E(RLC, "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n",
pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id); pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id);
pdu_size = 0;
return;
}
// remaining bytes to transmit for RLC (retrans pdus and new data pdus) // remaining bytes to transmit for RLC (retrans pdus and new data pdus)
rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - pdu_size; rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - pdu_size;
@@ -1151,6 +1187,7 @@ end_push_nack:
pdu_size); pdu_size);
#endif #endif
tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__); tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__);
if(tb_p == NULL) return;
memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size); memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
//estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size; //estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]); ((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]);
+2 -2
View File
@@ -534,7 +534,7 @@ void rlc_am_v9_3_0_test_send_sdu(rlc_am_entity_t *am_txP, int sdu_indexP)
assert(g_send_id_write_index[am_txP->rb_id] < TEST_MAX_SEND_SDU); assert(g_send_id_write_index[am_txP->rb_id] < TEST_MAX_SEND_SDU);
} else { } else {
printf("Out of memory error\n"); printf("Out of memory error\n");
exit(-1); // exit(-1);
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -577,7 +577,7 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma
data_indP->no_tb += 1; data_indP->no_tb += 1;
} else { } else {
printf("Out of memory error\n"); printf("Out of memory error\n");
exit(-1); // exit(-1);
} }
} else { } else {
printf("[RLC-LOOP] DROPPING 1 TB\n"); printf("[RLC-LOOP] DROPPING 1 TB\n");
@@ -87,9 +87,16 @@ rlc_am_check_timer_poll_retransmit(
/* Look for the first retransmittable PDU starting from vtS - 1 */ /* Look for the first retransmittable PDU starting from vtS - 1 */
while (sn != sn_end) { while (sn != sn_end) {
tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE]; tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE];
AssertFatal (tx_data_pdu_buffer_p->mem_block != NULL, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n", //AssertFatal (tx_data_pdu_buffer_p->mem_block != NULL, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n",
sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); // sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
if(tx_data_pdu_buffer_p->mem_block == NULL){
LOG_E(RLC, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n",
sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
sn = RLC_AM_PREV_SN(sn);
continue;
}
if ((tx_data_pdu_buffer_p->flags.ack == 0) && (tx_data_pdu_buffer_p->flags.max_retransmit == 0)) { if ((tx_data_pdu_buffer_p->flags.ack == 0) && (tx_data_pdu_buffer_p->flags.max_retransmit == 0)) {
tx_data_pdu_buffer_p->flags.retransmit = 1; tx_data_pdu_buffer_p->flags.retransmit = 1;
tx_data_pdu_buffer_p->retx_payload_size = tx_data_pdu_buffer_p->payload_size; tx_data_pdu_buffer_p->retx_payload_size = tx_data_pdu_buffer_p->payload_size;
@@ -70,7 +70,12 @@ rlc_am_check_timer_reordering(
PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP));
#endif #endif
AssertFatal (rlc_pP->vr_x != RLC_SN_UNDEFINED, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id); //AssertFatal (rlc_pP->vr_x != RLC_SN_UNDEFINED, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id);
if(rlc_pP->vr_x == RLC_SN_UNDEFINED){
LOG_E(RLC, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id);
return;
}
rlc_pP->t_reordering.running = 0; rlc_pP->t_reordering.running = 0;
rlc_pP->t_reordering.timed_out = 1; rlc_pP->t_reordering.timed_out = 1;
@@ -81,7 +86,11 @@ rlc_am_check_timer_reordering(
cursor = rlc_pP->receiver_buffer.head; cursor = rlc_pP->receiver_buffer.head;
rlc_usn_t vr_ms_new = rlc_pP->vr_x; rlc_usn_t vr_ms_new = rlc_pP->vr_x;
AssertFatal (cursor != NULL, "RLC AM TReordering Expiry Rx PDU list empty LcId=%d\n", rlc_pP->channel_id); //AssertFatal (cursor != NULL, "RLC AM TReordering Expiry Rx PDU list empty LcId=%d\n", rlc_pP->channel_id);
if(cursor == NULL){
LOG_E(RLC, "RLC AM TReordering Expiry Rx PDU list empty LcId=%d\n", rlc_pP->channel_id);
return;
}
/* go to memblock up to vrX*/ /* go to memblock up to vrX*/
pdu_info = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info; pdu_info = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
@@ -83,6 +83,7 @@ void rlc_tm_init (
if ((rlcP->input_sdus_alloc == NULL) && (rlcP->size_input_sdus_buffer > 0)) { if ((rlcP->input_sdus_alloc == NULL) && (rlcP->size_input_sdus_buffer > 0)) {
rlcP->input_sdus_alloc = get_free_mem_block (rlcP->size_input_sdus_buffer * sizeof (void *), __func__); rlcP->input_sdus_alloc = get_free_mem_block (rlcP->size_input_sdus_buffer * sizeof (void *), __func__);
if(rlcP->input_sdus_alloc == NULL) return;
rlcP->input_sdus = (mem_block_t **) (rlcP->input_sdus_alloc->data); rlcP->input_sdus = (mem_block_t **) (rlcP->input_sdus_alloc->data);
memset (rlcP->input_sdus, 0, rlcP->size_input_sdus_buffer * sizeof (void *)); memset (rlcP->input_sdus, 0, rlcP->size_input_sdus_buffer * sizeof (void *));
} }
+7 -1
View File
@@ -568,7 +568,13 @@ rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP,cons
l_rlc_p->stat_tx_data_pdu += 1; l_rlc_p->stat_tx_data_pdu += 1;
l_rlc_p->stat_tx_data_bytes += tb_size_in_bytes; l_rlc_p->stat_tx_data_bytes += tb_size_in_bytes;
AssertFatal( tb_size_in_bytes > 0 , "RLC UM PDU LENGTH %d", tb_size_in_bytes); //AssertFatal( tb_size_in_bytes > 0 , "RLC UM PDU LENGTH %d", tb_size_in_bytes);
if(tb_size_in_bytes <= 0) {
LOG_E(RLC, "RLC UM PDU LENGTH %d\n", tb_size_in_bytes);
tb_p = tb_p->next;
continue;
}
#if TRACE_RLC_UM_PDU || MESSAGE_CHART_GENERATOR #if TRACE_RLC_UM_PDU || MESSAGE_CHART_GENERATOR
rlc_um_get_pdu_infos(ctxt_pP, l_rlc_p,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_req*) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length); rlc_um_get_pdu_infos(ctxt_pP, l_rlc_p,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_req*) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
#endif #endif
@@ -106,28 +106,48 @@ void config_req_rlc_um_asn1 (
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
if (mbms_flagP) { if (mbms_flagP) {
AssertFatal(dl_rlc_pP, "No RLC UM DL config"); //AssertFatal(dl_rlc_pP, "No RLC UM DL config");
AssertFatal(ul_rlc_pP == NULL, "RLC UM UL config present"); if(dl_rlc_pP == NULL) {
LOG_E(RLC, "No RLC UM DL config\n");
return;
}
//AssertFatal(ul_rlc_pP == NULL, "RLC UM UL config present");
if(ul_rlc_pP != NULL) {
LOG_E(RLC, "RLC UM UL config present\n");
return;
}
key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP); key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP);
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u", //AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u",
ctxt_pP->module_id, // ctxt_pP->module_id,
ctxt_pP->rnti, // ctxt_pP->rnti,
ctxt_pP->enb_flag, // ctxt_pP->enb_flag,
mbms_service_idP, // mbms_service_idP,
mbms_session_idP); // mbms_session_idP);
if(h_rc != HASH_TABLE_OK) {
LOG_E(RLC, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u\n",
ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP);
return;
}
rlc_p = &rlc_union_p->rlc.um; rlc_p = &rlc_union_p->rlc.um;
} else } else
#endif #endif
{ {
key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u", //AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u",
ctxt_pP->module_id, // ctxt_pP->module_id,
ctxt_pP->rnti, // ctxt_pP->rnti,
ctxt_pP->enb_flag, // ctxt_pP->enb_flag,
rb_idP, // rb_idP,
srb_flagP); // srb_flagP);
if(h_rc != HASH_TABLE_OK) {
LOG_E(RLC, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u\n",
ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
return;
}
rlc_p = &rlc_union_p->rlc.um; rlc_p = &rlc_union_p->rlc.um;
} }
@@ -269,7 +289,11 @@ rlc_um_init (
) )
{ {
AssertFatal(rlc_pP, "Bad RLC UM pointer (NULL)"); //AssertFatal(rlc_pP, "Bad RLC UM pointer (NULL)");
if(rlc_pP == NULL) {
LOG_E(RLC, "Bad RLC UM pointer (NULL)\n");
return;
}
if (rlc_pP->initialized) { if (rlc_pP->initialized) {
LOG_D(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [INIT] ALREADY DONE, DOING NOTHING\n", LOG_D(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [INIT] ALREADY DONE, DOING NOTHING\n",
+57 -21
View File
@@ -47,7 +47,11 @@ signed int rlc_um_get_pdu_infos(
pdu_info_pP->num_li = 0; pdu_info_pP->num_li = 0;
AssertFatal( total_sizeP > 0 , "RLC UM PDU LENGTH %d", total_sizeP); //AssertFatal( total_sizeP > 0 , "RLC UM PDU LENGTH %d", total_sizeP);
if(total_sizeP <= 0) {
LOG_E(RLC, "RLC UM PDU LENGTH %d\n", total_sizeP);
return -1;
}
if (sn_lengthP == 10) { if (sn_lengthP == 10) {
pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03; pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03;
@@ -62,7 +66,11 @@ signed int rlc_um_get_pdu_infos(
pdu_info_pP->header_size = 1; pdu_info_pP->header_size = 1;
pdu_info_pP->payload = &header_pP->b2; pdu_info_pP->payload = &header_pP->b2;
} else { } else {
AssertFatal( sn_lengthP == 5 || sn_lengthP == 10, "RLC UM SN LENGTH %d", sn_lengthP); //AssertFatal( sn_lengthP == 5 || sn_lengthP == 10, "RLC UM SN LENGTH %d", sn_lengthP);
if(!(sn_lengthP == 5 || sn_lengthP == 10)) {
LOG_E(RLC, "RLC UM SN LENGTH %d\n", sn_lengthP);
return -1;
}
} }
@@ -77,15 +85,23 @@ signed int rlc_um_get_pdu_infos(
li_length_in_bytes = li_length_in_bytes ^ 3; li_length_in_bytes = li_length_in_bytes ^ 3;
if (li_length_in_bytes == 2) { if (li_length_in_bytes == 2) {
AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b2) - (uint64_t)header_pP), //AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b2) - (uint64_t)header_pP),
"DECODING PDU TOO FAR PDU size %d", total_sizeP); // "DECODING PDU TOO FAR PDU size %d", total_sizeP);
if(total_sizeP < ((uint64_t)(&e_li_p->b2) - (uint64_t)header_pP)) {
LOG_E(RLC, "DECODING PDU TOO FAR PDU size %d\n", total_sizeP);
return -1;
}
pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li_p->b1 << 4)) & 0x07F0; pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li_p->b1 << 4)) & 0x07F0;
pdu_info_pP->li_list[pdu_info_pP->num_li] |= (((uint8_t)(e_li_p->b2 >> 4)) & 0x000F); pdu_info_pP->li_list[pdu_info_pP->num_li] |= (((uint8_t)(e_li_p->b2 >> 4)) & 0x000F);
li_to_read = e_li_p->b1 & 0x80; li_to_read = e_li_p->b1 & 0x80;
pdu_info_pP->header_size += 2; pdu_info_pP->header_size += 2;
} else { } else {
AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b3) - (uint64_t)header_pP), //AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b3) - (uint64_t)header_pP),
"DECODING PDU TOO FAR PDU size %d", total_sizeP); // "DECODING PDU TOO FAR PDU size %d", total_sizeP);
if(total_sizeP < ((uint64_t)(&e_li_p->b3) - (uint64_t)header_pP)) {
LOG_E(RLC, "DECODING PDU TOO FAR PDU size %d\n", total_sizeP);
return -1;
}
pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li_p->b2 << 8)) & 0x0700; pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li_p->b2 << 8)) & 0x0700;
pdu_info_pP->li_list[pdu_info_pP->num_li] |= e_li_p->b3; pdu_info_pP->li_list[pdu_info_pP->num_li] |= e_li_p->b3;
li_to_read = e_li_p->b2 & 0x08; li_to_read = e_li_p->b2 & 0x08;
@@ -93,10 +109,16 @@ signed int rlc_um_get_pdu_infos(
pdu_info_pP->header_size += 1; pdu_info_pP->header_size += 1;
} }
AssertFatal( pdu_info_pP->num_li <= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU, //AssertFatal( pdu_info_pP->num_li <= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU,
PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs ", // PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs ",
// PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
// pdu_info_pP->sn);
if(pdu_info_pP->num_li > RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU) {
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs \n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
pdu_info_pP->sn); pdu_info_pP->sn);
return -1;
}
sum_li += pdu_info_pP->li_list[pdu_info_pP->num_li]; sum_li += pdu_info_pP->li_list[pdu_info_pP->num_li];
pdu_info_pP->num_li = pdu_info_pP->num_li + 1; pdu_info_pP->num_li = pdu_info_pP->num_li + 1;
@@ -308,9 +330,17 @@ rlc_um_try_reassembly(
__LINE__); __LINE__);
#endif #endif
} }
AssertFatal(size >= 0, "invalid size!"); //AssertFatal(size >= 0, "invalid size!");
AssertFatal((e==0) || (e==1), "invalid e!"); //AssertFatal((e==0) || (e==1), "invalid e!");
AssertFatal((fi >= 0) && (fi <= 3), "invalid fi!"); //AssertFatal((fi >= 0) && (fi <= 3), "invalid fi!");
if((size < 0) || ((e!=0) && (e!=1)) || ((fi < 0) || (fi > 3))){
LOG_E(RLC, "invalid size %d, e %d, fi %d\n", size, e, fi);
sn = (sn + 1) % rlc_pP->rx_sn_modulo;
if ((sn == rlc_pP->vr_uh) || (sn == end_snP)) {
continue_reassembly = 0;
}
continue;
}
if (e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) { if (e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) {
switch (fi) { switch (fi) {
@@ -400,11 +430,14 @@ rlc_um_try_reassembly(
break; break;
default: default:
AssertFatal( 0 , PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n", //AssertFatal( 0 , PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), // PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
fi, // fi,
__FILE__, // __FILE__,
__LINE__); // __LINE__);
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), fi, __FILE__, __LINE__);
} }
} else { } else {
if (rlc_um_read_length_indicators(&data_p, e_li_p, li_array, &num_li, &size ) >= 0) { if (rlc_um_read_length_indicators(&data_p, e_li_p, li_array, &num_li, &size ) >= 0) {
@@ -543,11 +576,14 @@ rlc_um_try_reassembly(
// data_p is already ok, done by last loop above // data_p is already ok, done by last loop above
rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size); rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size);
} else { } else {
AssertFatal( 0 !=0, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n", //AssertFatal( 0 !=0, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), // PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
size, // size,
__FILE__, // __FILE__,
__LINE__); // __LINE__);
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), size, __FILE__, __LINE__);
//rlc_pP->stat_rx_data_pdu_dropped += 1; //rlc_pP->stat_rx_data_pdu_dropped += 1;
rlc_pP->stat_rx_data_bytes_dropped += size; rlc_pP->stat_rx_data_bytes_dropped += size;
} }
+1 -1
View File
@@ -52,7 +52,7 @@ rlc_um_fsm_notify_event (
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM NULL_STATE\n", LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM NULL_STATE\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
eventP); eventP);
AssertFatal(1==0,"RLC-UM FSM WARNING PROTOCOL ERROR - EVENT NOT EXPECTED FROM NULL_STATE"); //AssertFatal(1==0,"RLC-UM FSM WARNING PROTOCOL ERROR - EVENT NOT EXPECTED FROM NULL_STATE");
return 0; return 0;
} }
+12 -6
View File
@@ -411,7 +411,11 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
#if TRACE_RLC_PAYLOAD #if TRACE_RLC_PAYLOAD
rlc_util_print_hex_octets(RLC, pdu_mem_p->data, data_pdu_size); rlc_util_print_hex_octets(RLC, pdu_mem_p->data, data_pdu_size);
#endif #endif
AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT10: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size); //AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT10: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size);
if(pdu_tb_req_p->tb_size <= 0) {
LOG_E(RLC, "SEGMENT10: FINAL RLC UM PDU LENGTH %d\n", pdu_tb_req_p->tb_size);
break;
}
pdu_p = NULL; pdu_p = NULL;
pdu_mem_p = NULL; pdu_mem_p = NULL;
@@ -744,13 +748,11 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
} else { } else {
#if TRACE_RLC_UM_SEGMENT LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n",
LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
sdu_mngt_p->sdu_remaining_size, sdu_mngt_p->sdu_remaining_size,
pdu_remaining_size - sdu_mngt_p->sdu_remaining_size); pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
#endif //assert(1!=1);
assert(1!=1);
memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size); memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
// reduce the size of the PDU // reduce the size of the PDU
continue_fill_pdu_with_sdu = 0; continue_fill_pdu_with_sdu = 0;
@@ -792,7 +794,11 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
#if TRACE_RLC_PAYLOAD #if TRACE_RLC_PAYLOAD
rlc_util_print_hex_octets(RLC, (unsigned char*)pdu_mem_p->data, data_pdu_size); rlc_util_print_hex_octets(RLC, (unsigned char*)pdu_mem_p->data, data_pdu_size);
#endif #endif
AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT5: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size); //AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT5: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size);
if(pdu_tb_req_p->tb_size <= 0) {
LOG_E(RLC, "SEGMENT5: FINAL RLC UM PDU LENGTH %d\n", pdu_tb_req_p->tb_size);
break;
}
pdu_p = NULL; pdu_p = NULL;
pdu_mem_p = NULL; pdu_mem_p = NULL;
+3 -4
View File
@@ -317,7 +317,7 @@ void rlc_um_v9_3_0_test_send_sdu(rlc_um_entity_t *um_txP, int sdu_indexP)
assert(g_send_id_write_index[um_txP->rb_id] < TEST_MAX_SEND_SDU); assert(g_send_id_write_index[um_txP->rb_id] < TEST_MAX_SEND_SDU);
} else { } else {
printf("Out of memory error\n"); printf("Out of memory error\n");
exit(-1); // exit(-1);
} }
} }
@@ -406,9 +406,8 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma
if (*drop_countP == 0) { if (*drop_countP == 0) {
tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size, __func__); tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size, __func__);
memset(tb_dst->data, 0, sizeof (mac_rlc_max_rx_header_size_t) + tb_size);
if (tb_dst != NULL) { if (tb_dst != NULL) {
memset(tb_dst->data, 0, sizeof (mac_rlc_max_rx_header_size_t) + tb_size);
//printf("[RLC-LOOP] Testing tb_dst (1)\n"); //printf("[RLC-LOOP] Testing tb_dst (1)\n");
check_free_mem_block(tb_dst, __func__); check_free_mem_block(tb_dst, __func__);
tb_dst->next = NULL; tb_dst->next = NULL;
@@ -427,7 +426,7 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma
check_free_mem_block(tb_dst, __func__); check_free_mem_block(tb_dst, __func__);
} else { } else {
printf("Out of memory error\n"); printf("Out of memory error\n");
exit(-1); // exit(-1);
} }
} else { } else {
printf("[RLC-LOOP] DROPPING 1 TB\n"); printf("[RLC-LOOP] DROPPING 1 TB\n");
+35 -7
View File
@@ -135,7 +135,12 @@ rlc_op_status_t rlc_stat_req (
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_rc; hashtable_rc_t h_rc;
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
if(rb_idP >= NB_RB_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
return RLC_OP_STATUS_BAD_PARAMETER;
}
key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
@@ -348,13 +353,30 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
#endif #endif
if (MBMS_flagP) { if (MBMS_flagP) {
AssertFatal (rb_idP < NB_RB_MBMS_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX); //AssertFatal (rb_idP < NB_RB_MBMS_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
if(rb_idP >= NB_RB_MBMS_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
return RLC_OP_STATUS_BAD_PARAMETER;
}
} else { } else {
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
if(rb_idP >= NB_RB_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
return RLC_OP_STATUS_BAD_PARAMETER;
}
} }
DevAssert(sdu_pP != NULL); //DevAssert(sdu_pP != NULL);
DevCheck(sdu_sizeP > 0, sdu_sizeP, 0, 0); if(sdu_pP == NULL){
LOG_E(RLC, "sdu_pP == NULL\n");
return RLC_OP_STATUS_BAD_PARAMETER;
}
//DevCheck(sdu_sizeP > 0, sdu_sizeP, 0, 0);
if(sdu_sizeP <= 0) {
LOG_E(RLC, "sdu_sizeP %d, file %s, line %d\n", sdu_sizeP, __FILE__ ,__LINE__);
return RLC_OP_STATUS_BAD_PARAMETER;
}
#if !defined(Rel10) && !defined(Rel14) #if !defined(Rel10) && !defined(Rel14)
DevCheck(MBMS_flagP == 0, MBMS_flagP, 0, 0); DevCheck(MBMS_flagP == 0, MBMS_flagP, 0, 0);
@@ -386,7 +408,9 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
rlc_mode = rlc_union_p->mode; rlc_mode = rlc_union_p->mode;
} else { } else {
rlc_mode = RLC_MODE_NONE; rlc_mode = RLC_MODE_NONE;
AssertFatal (0 , "RLC not configured key %ju\n", key); //AssertFatal (0 , "RLC not configured key %ju\n", key);
LOG_E(RLC, "not configured key %lu\n", key);
return RLC_OP_STATUS_OUT_OF_RESSOURCES;
} }
if (MBMS_flagP == 0) { if (MBMS_flagP == 0) {
@@ -608,7 +632,11 @@ rlc_module_init (void)
rlc_rrc_data_conf = NULL; rlc_rrc_data_conf = NULL;
rlc_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, rb_free_rlc_union); rlc_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, rb_free_rlc_union);
AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed"); //AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed");
if(rlc_coll_p == NULL) {
LOG_E(RLC, "UNRECOVERABLE error, RLC hashtable_create failed\n");
return -1;
}
for (module_id1=0; module_id1 < NUMBER_OF_UE_MAX; module_id1++) { for (module_id1=0; module_id1 < NUMBER_OF_UE_MAX; module_id1++) {
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
-1
View File
@@ -151,7 +151,6 @@ typedef struct {
frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */ frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */
sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */ sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */
boolean_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmented */ boolean_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmented */
mui_t rrc_mui;
} mac_rlc_status_resp_t; } mac_rlc_status_resp_t;
+18 -5
View File
@@ -152,9 +152,17 @@ tbs_size_t mac_rlc_data_req(
#endif // DEBUG_MAC_INTERFACE #endif // DEBUG_MAC_INTERFACE
if (MBMS_flagP) { if (MBMS_flagP) {
AssertFatal (channel_idP < RLC_MAX_MBMS_LC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC); //AssertFatal (channel_idP < RLC_MAX_MBMS_LC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC);
if(channel_idP >= RLC_MAX_MBMS_LC){
LOG_E(RLC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC);
return 0;
}
} else { } else {
AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX); //AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX);
if(channel_idP >= NB_RB_MAX){
LOG_E(RLC, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX);
return 0;
}
} }
if (MBMS_flagP) { if (MBMS_flagP) {
@@ -174,7 +182,8 @@ tbs_size_t mac_rlc_data_req(
rlc_mode = rlc_union_p->mode; rlc_mode = rlc_union_p->mode;
} else { } else {
rlc_mode = RLC_MODE_NONE; rlc_mode = RLC_MODE_NONE;
AssertFatal (0 , "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP); //AssertFatal (0 , "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP);
LOG_E(RLC, "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP);
} }
switch (rlc_mode) { switch (rlc_mode) {
@@ -183,6 +192,7 @@ tbs_size_t mac_rlc_data_req(
break; break;
case RLC_MODE_AM: case RLC_MODE_AM:
rlc_am_mui.rrc_mui_num = 0;
if (!enb_flagP) rlc_am_set_nb_bytes_requested_by_mac(&rlc_union_p->rlc.am,tb_sizeP); if (!enb_flagP) rlc_am_set_nb_bytes_requested_by_mac(&rlc_union_p->rlc.am,tb_sizeP);
data_request = rlc_am_mac_data_request(&ctxt, &rlc_union_p->rlc.am,enb_flagP); data_request = rlc_am_mac_data_request(&ctxt, &rlc_union_p->rlc.am,enb_flagP);
ret_tb_size =mac_rlc_serialize_tb(buffer_pP, data_request.data); ret_tb_size =mac_rlc_serialize_tb(buffer_pP, data_request.data);
@@ -363,7 +373,6 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time; mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send; mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented; mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
mac_rlc_status_resp.rrc_mui = status_resp.rrc_mui;
//return mac_rlc_status_resp; //return mac_rlc_status_resp;
break; break;
@@ -419,7 +428,11 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(
/* Assumptions : for UE only */ /* Assumptions : for UE only */
/* At each TTI, Buffer Occupancy is first computed in mac_rlc_status_ind called by MAC ue_scheduler() function */ /* At each TTI, Buffer Occupancy is first computed in mac_rlc_status_ind called by MAC ue_scheduler() function */
/* Then this function is called during MAC multiplexing ue_get_sdu(), and it may be call several times for the same bearer if it is in AM mode and there are several PDU types to transmit */ /* Then this function is called during MAC multiplexing ue_get_sdu(), and it may be call several times for the same bearer if it is in AM mode and there are several PDU types to transmit */
AssertFatal(enb_flagP == FALSE,"RLC Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%d\n", channel_idP); //AssertFatal(enb_flagP == FALSE,"RLC Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%d\n", channel_idP);
if(enb_flagP != FALSE){
LOG_E(RLC, "Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%u\n", channel_idP);
return 0;
}
key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag); key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag);
+31 -7
View File
@@ -373,7 +373,10 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
rb_id, rb_id,
lc_id, lc_id,
RLC_MODE_UM); RLC_MODE_UM);
AssertFatal(rlc_union_p != NULL, "ADD MBMS RLC UM FAILED"); //AssertFatal(rlc_union_p != NULL, "ADD MBMS RLC UM FAILED");
if(rlc_union_p == NULL){
LOG_E(RLC, "ADD MBMS RLC UM FAILED\n");
}
} }
LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ MBMS ASN1 LC ID %u RB ID %u SESSION ID %u SERVICE ID %u\n", LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ MBMS ASN1 LC ID %u RB ID %u SESSION ID %u SERVICE ID %u\n",
@@ -511,7 +514,11 @@ rlc_op_status_t rrc_rlc_remove_rlc (
} }
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
if(rb_idP >= NB_RB_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
return RLC_OP_STATUS_BAD_PARAMETER;
}
h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
@@ -585,8 +592,17 @@ rlc_union_t* rrc_rlc_add_rlc (
#endif #endif
if (MBMS_flagP == FALSE) { if (MBMS_flagP == FALSE) {
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC); //AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
if(rb_idP >= NB_RB_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
return NULL;
}
if(chan_idP >= RLC_MAX_LC){
LOG_E(RLC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
return NULL;
}
} }
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
@@ -623,8 +639,12 @@ rlc_union_t* rrc_rlc_add_rlc (
(srb_flagP) ? "SRB" : "DRB", (srb_flagP) ? "SRB" : "DRB",
rb_idP, rb_idP,
(srb_flagP) ? "SRB" : "DRB"); (srb_flagP) ? "SRB" : "DRB");
AssertFatal(rlc_union_p->mode == rlc_modeP, "Error rrc_rlc_add_rlc , already exist but RLC mode differ"); //AssertFatal(rlc_union_p->mode == rlc_modeP, "Error rrc_rlc_add_rlc , already exist but RLC mode differ");
return rlc_union_p; if(rlc_union_p->mode != rlc_modeP){
LOG_E(RLC, "Error rrc_rlc_add_rlc , already exist but RLC mode differ\n");
return NULL;
}
return rlc_union_p;
} else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) {
rlc_union_p = calloc(1, sizeof(rlc_union_t)); rlc_union_p = calloc(1, sizeof(rlc_union_t));
h_rc = hashtable_insert(rlc_coll_p, key, rlc_union_p); h_rc = hashtable_insert(rlc_coll_p, key, rlc_union_p);
@@ -687,7 +707,11 @@ rlc_op_status_t rrc_rlc_config_req (
PROTOCOL_CTXT_ARGS(ctxt_pP), PROTOCOL_CTXT_ARGS(ctxt_pP),
rb_idP); rb_idP);
AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
if(rb_idP >= NB_RB_MAX){
LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
return RLC_OP_STATUS_BAD_PARAMETER;
}
switch (actionP) { switch (actionP) {
+12 -4
View File
@@ -17,7 +17,7 @@ extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
extern uint8_t nfapi_mode; extern uint8_t nfapi_mode;
extern uint16_t sf_ahead; extern uint16_t sf_ahead;
uint16_t frame_cnt=0;
void handle_rach(UL_IND_t *UL_info) { void handle_rach(UL_IND_t *UL_info) {
int i; int i;
@@ -546,6 +546,10 @@ void UL_indication(UL_IND_t *UL_info)
UL_info->frame,UL_info->subframe, UL_info->frame,UL_info->subframe,
module_id,CC_id, module_id,CC_id,
UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.number_of_cqis, UL_info->rach_ind.rach_indication_body.number_of_preambles, UL_info->sr_ind.sr_indication_body.number_of_srs); UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.number_of_cqis, UL_info->rach_ind.rach_indication_body.number_of_preambles, UL_info->sr_ind.sr_indication_body.number_of_srs);
if(UL_info->frame==1023&&UL_info->subframe==6){ // dl scheduling (0,0)
frame_cnt= (frame_cnt + 1)%7; // to prevent frame_cnt get too big
LOG_D(MAC,"current (%d,%d) frame count dl is %d\n",UL_info->frame,UL_info->subframe,frame_cnt);
}
if (nfapi_mode != 1) if (nfapi_mode != 1)
{ {
@@ -574,7 +578,11 @@ void UL_indication(UL_IND_t *UL_info)
handle_harq(UL_info); handle_harq(UL_info);
// clear HI prior to handling ULSCH // clear HI prior to handling ULSCH
mac->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi = 0; uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_id] , UL_info->subframe);
if(sf_ahead_dl!=255){
mac->HI_DCI0_req[CC_id][(UL_info->subframe+sf_ahead_dl)%10].hi_dci0_request_body.number_of_hi = 0;
LOG_D(MAC,"current (%d,%d) clear HI_DCI0_req[0][%d]\n",UL_info->frame,UL_info->subframe,(UL_info->subframe+sf_ahead_dl)%10);
}
handle_ulsch(UL_info); handle_ulsch(UL_info);
@@ -593,9 +601,9 @@ void UL_indication(UL_IND_t *UL_info)
sched_info->frame = (UL_info->frame + ((UL_info->subframe>(9-sf_ahead)) ? 1 : 0)) % 1024; sched_info->frame = (UL_info->frame + ((UL_info->subframe>(9-sf_ahead)) ? 1 : 0)) % 1024;
sched_info->subframe = (UL_info->subframe+sf_ahead)%10; sched_info->subframe = (UL_info->subframe+sf_ahead)%10;
sched_info->DL_req = &mac->DL_req[CC_id]; sched_info->DL_req = &mac->DL_req[CC_id];
sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id]; sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id][sched_info->subframe];
if ((mac->common_channels[CC_id].tdd_Config==NULL) || if ((mac->common_channels[CC_id].tdd_Config==NULL) ||
(is_UL_sf(&mac->common_channels[CC_id],(sched_info->subframe+sf_ahead)%10)>0)) (is_UL_sf(&mac->common_channels[CC_id],sched_info->subframe)>0))
sched_info->UL_req = &mac->UL_req[CC_id]; sched_info->UL_req = &mac->UL_req[CC_id];
else else
sched_info->UL_req = NULL; sched_info->UL_req = NULL;
+5
View File
@@ -613,6 +613,11 @@ rrc_data_req(
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
if(sdu_sizeP == 255)
{
LOG_I(RRC,"sdu_sizeP == 255");
return FALSE;
}
MSC_LOG_TX_MESSAGE( MSC_LOG_TX_MESSAGE(
ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE, ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE,
ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE, ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE,
+84 -38
View File
@@ -1267,6 +1267,8 @@ do_RRCConnectionSetup(
RRCConnectionSetup_t* rrcConnectionSetup = NULL; RRCConnectionSetup_t* rrcConnectionSetup = NULL;
LTE_DL_FRAME_PARMS *frame_parms = &RC.eNB[ctxt_pP->module_id][CC_id]->frame_parms;
memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t)); memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t));
dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1;
dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionSetup; dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionSetup;
@@ -1532,11 +1534,28 @@ do_RRCConnectionSetup(
// SchedulingRequestConfig // SchedulingRequestConfig
physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup; physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup;
#ifdef UE_EXPANSION if (carrier->sib1->tdd_Config == NULL) {
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 31 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid; physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 31 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid;
#else } else {
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 71 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid; switch (carrier->sib1->tdd_Config->subframeAssignment) {
#endif case 1:
switch(frame_parms->N_RB_UL){
case 25:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 15 - ue_context_pP->local_uid/4;
break;
case 50:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 31 - ue_context_pP->local_uid/4;
break;
case 100:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 63 - ue_context_pP->local_uid/4;
break;
}
break;
default:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 71 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid;
break;
}
}
if (carrier->sib1->tdd_Config == NULL) { // FDD if (carrier->sib1->tdd_Config == NULL) { // FDD
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5+(ue_context_pP->local_uid%10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5+(ue_context_pP->local_uid%10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3)
@@ -1595,9 +1614,12 @@ do_RRCConnectionSetup(
(void*)&dl_ccch_msg, (void*)&dl_ccch_msg,
buffer, buffer,
100); 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", if(enc_rval.encoded == -1)
enc_rval.failed_type->name, enc_rval.encoded); {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT) # if !defined(DISABLE_XER_SPRINT)
{ {
@@ -1666,9 +1688,12 @@ do_SecurityModeCommand(
(void*)&dl_dcch_msg, (void*)&dl_dcch_msg,
buffer, buffer,
100); 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", if(enc_rval.encoded == -1)
enc_rval.failed_type->name, enc_rval.encoded); {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT) # if !defined(DISABLE_XER_SPRINT)
{ {
@@ -1742,9 +1767,12 @@ do_UECapabilityEnquiry(
(void*)&dl_dcch_msg, (void*)&dl_dcch_msg,
buffer, buffer,
100); 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", if(enc_rval.encoded == -1)
enc_rval.failed_type->name, enc_rval.encoded); {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT) # if !defined(DISABLE_XER_SPRINT)
{ {
@@ -1902,9 +1930,12 @@ do_RRCConnectionReconfiguration(
(void*)&dl_dcch_msg, (void*)&dl_dcch_msg,
buffer, buffer,
RRC_BUF_SIZE); RRC_BUF_SIZE);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %zd)!\n", if(enc_rval.encoded == -1)
enc_rval.failed_type->name, enc_rval.encoded); {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
#ifdef XER_PRINT #ifdef XER_PRINT
xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)&dl_dcch_msg); xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)&dl_dcch_msg);
#endif #endif
@@ -2115,9 +2146,12 @@ do_RRCConnectionReestablishment(
(void*)&dl_ccch_msg, (void*)&dl_ccch_msg,
buffer, buffer,
100); 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", if(enc_rval.encoded == -1)
enc_rval.failed_type->name, enc_rval.encoded); {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT) # if !defined(DISABLE_XER_SPRINT)
{ {
@@ -2173,9 +2207,12 @@ do_RRCConnectionReestablishmentReject(
(void*)&dl_ccch_msg, (void*)&dl_ccch_msg,
buffer, buffer,
100); 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", if(enc_rval.encoded == -1)
enc_rval.failed_type->name, enc_rval.encoded); {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT) # if !defined(DISABLE_XER_SPRINT)
{ {
@@ -2232,9 +2269,12 @@ do_RRCConnectionReject(
(void*)&dl_ccch_msg, (void*)&dl_ccch_msg,
buffer, buffer,
100); 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %ld)!\n", if(enc_rval.encoded == -1)
enc_rval.failed_type->name, enc_rval.encoded); {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT) # if !defined(DISABLE_XER_SPRINT)
{ {
@@ -2421,9 +2461,12 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
(void*)mcch_message, (void*)mcch_message,
buffer, buffer,
100); 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", if(enc_rval.encoded == -1)
enc_rval.failed_type->name, enc_rval.encoded); {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT) # if !defined(DISABLE_XER_SPRINT)
{ {
@@ -2550,12 +2593,12 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
(void*)&ul_dcch_msg, (void*)&ul_dcch_msg,
buffer, buffer,
100); 100);
if(enc_rval.encoded == -1)
{
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
enc_rval.failed_type->name, enc_rval.encoded); return -1;
}
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT) # if !defined(DISABLE_XER_SPRINT)
{ {
@@ -2681,9 +2724,12 @@ uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_pagin
Mod_id, paging_record_p->cn_Domain, ue_paging_identity.presenceMask, pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count); Mod_id, paging_record_p->cn_Domain, ue_paging_identity.presenceMask, pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count);
enc_rval = uper_encode_to_buffer(&asn_DEF_PCCH_Message, (void*)&pcch_msg, buffer, RRC_BUF_SIZE); enc_rval = uper_encode_to_buffer(&asn_DEF_PCCH_Message, (void*)&pcch_msg, buffer, RRC_BUF_SIZE);
if(enc_rval.encoded == -1)
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", {
enc_rval.failed_type->name, enc_rval.encoded); LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
#ifdef XER_PRINT #ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_PCCH_Message, (void*)&pcch_msg); xer_fprint(stdout, &asn_DEF_PCCH_Message, (void*)&pcch_msg);
#endif #endif
+1 -2
View File
@@ -333,6 +333,7 @@ rrc_rx_tx(
// check for UL failure // check for UL failure
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
ctxt_pP->rnti = ue_context_p->ue_id_rnti;
if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) { if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n", LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n",
@@ -505,9 +506,7 @@ rrc_rx_tx(
ue_context_p->ue_context.ue_release_timer_thres) { 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\n",ue_context_p->ue_context.rnti);
ue_to_be_removed = ue_context_p; ue_to_be_removed = ue_context_p;
#ifdef UE_EXPANSION
ue_context_p->ue_context.ue_release_timer = 0; ue_context_p->ue_context.ue_release_timer = 0;
#endif
break; break;
} }
} }
+32 -93
View File
@@ -574,18 +574,6 @@ rrc_eNB_get_next_free_ue_context(
ctxt_pP->rnti); ctxt_pP->rnti);
if (ue_context_p == NULL) { if (ue_context_p == NULL) {
#ifndef UE_EXPANSION
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
if (ue_context_p->ue_context.random_ue_identity == ue_identityP) {
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist rand UE id 0x%"PRIx64", uid %u\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_identityP,
ue_context_p->local_uid);
return NULL;
}
}
#endif
ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[ctxt_pP->module_id]); ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[ctxt_pP->module_id]);
if (ue_context_p == NULL) { if (ue_context_p == NULL) {
@@ -805,16 +793,10 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
(void)ue_module_id; (void)ue_module_id;
#endif #endif
rnti_t rnti = ue_context_pP->ue_context.rnti; rnti_t rnti = ue_context_pP->ue_context.rnti;
#ifndef UE_EXPANSION if (enb_mod_idP >= NB_eNB_INST) {
int i, j , CC_id, pdu_number; LOG_I(RRC, "eNB inst invalid (%d/%d) for UE %x!\n",enb_mod_idP, NB_eNB_INST,rnti);
LTE_eNB_ULSCH_t *ulsch = NULL; return;
LTE_eNB_DLSCH_t *dlsch = NULL; }
nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
PHY_VARS_eNB *eNB_PHY = NULL;
eNB_MAC_INST *eNB_MAC = RC.mac[enb_mod_idP];
#endif
AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %x!", enb_mod_idP, NB_eNB_INST, rnti);
/* ue_context_p = rrc_eNB_get_ue_context( /* ue_context_p = rrc_eNB_get_ue_context(
&RC.rrc[enb_mod_idP], &RC.rrc[enb_mod_idP],
rntiP rntiP
@@ -825,7 +807,8 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", enb_mod_idP, rnti); LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", enb_mod_idP, rnti);
#if defined(ENABLE_USE_MME) #if defined(ENABLE_USE_MME)
if( ue_context_pP->ue_context.ul_failure_timer >= 20000 ) { if((ue_context_pP->ue_context.ul_failure_timer >= 20000) &&
(mac_eNB_get_rrc_status(enb_mod_idP,rnti) >= RRC_CONNECTED)) {
LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti); LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti);
rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost
/* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered) /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered)
@@ -837,57 +820,9 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
return; return;
} }
#endif #endif
#ifndef UE_EXPANSION
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
eNB_PHY = RC.eNB[enb_mod_idP][CC_id];
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
ulsch = eNB_PHY->ulsch[i];
if((ulsch != NULL) && (ulsch->rnti == rnti)){
LOG_I(RRC, "clean_eNb_ulsch UE %x \n", rnti);
clean_eNb_ulsch(ulsch);
}
}
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
dlsch = eNB_PHY->dlsch[i][0];
if((dlsch != NULL) && (dlsch->rnti == rnti)){
LOG_I(RRC, "clean_eNb_dlsch UE %x \n", rnti);
clean_eNb_dlsch(dlsch);
}
}
for(j = 0; j < 10; j++){
ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body;
if(ul_req_tmp){
pdu_number = ul_req_tmp->number_of_pdus;
for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){
if((ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti) ||
(ul_req_tmp->ul_config_pdu_list[pdu_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti) ||
(ul_req_tmp->ul_config_pdu_list[pdu_index].uci_cqi_pdu.ue_information.ue_information_rel8.rnti == rnti) ||
(ul_req_tmp->ul_config_pdu_list[pdu_index].uci_sr_pdu.ue_information.ue_information_rel8.rnti == rnti) ||
(ul_req_tmp->ul_config_pdu_list[pdu_index].srs_pdu.srs_pdu_rel8.rnti == rnti)){
LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number);
if(pdu_index < pdu_number -1){
memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
}
ul_req_tmp->number_of_pdus--;
}
}
}
}
}
rrc_mac_remove_ue(enb_mod_idP,rnti);
rrc_rlc_remove_ue(&ctxt);
pdcp_remove_UE(&ctxt);
rrc_eNB_remove_ue_context(
&ctxt,
RC.rrc[enb_mod_idP],
(struct rrc_eNB_ue_context_s*) ue_context_pP);
#else
// add UE info to freeList // add UE info to freeList
LOG_I(RRC, "put UE %x into freeList\n", rnti); LOG_I(RRC, "put UE %x into freeList\n", rnti);
put_UE_in_freelist(enb_mod_idP, rnti, 1); put_UE_in_freelist(enb_mod_idP, rnti, 1);
#endif
} }
} }
@@ -2051,7 +1986,7 @@ rrc_eNB_generate_RRCConnectionRelease(
// ue_context_pP->ue_context.ue_release_timer_thres_rrc = 100; // ue_context_pP->ue_context.ue_release_timer_thres_rrc = 100;
ue_context_pP->ue_context.ue_reestablishment_timer = 0; ue_context_pP->ue_context.ue_reestablishment_timer = 0;
ue_context_pP->ue_context.ue_release_timer = 0; ue_context_pP->ue_context.ue_release_timer = 0;
ue_context_pP->ue_context.ue_release_timer_s1 = 0; //ue_context_pP->ue_context.ue_release_timer_s1 = 0;
LOG_I(RRC, LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCConnectionRelease (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCConnectionRelease (bytes %d)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
@@ -2085,6 +2020,8 @@ rrc_eNB_generate_RRCConnectionRelease(
rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt_pP->rnti; rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt_pP->rnti;
rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = rrc_eNB_mui; rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = rrc_eNB_mui;
rrc_release_info.num_UEs++; rrc_release_info.num_UEs++;
LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num,
ctxt_pP->rnti, rrc_eNB_mui,rrc_release_info.RRC_release_ctrl[release_num].flag);
break; break;
} }
} }
@@ -3922,7 +3859,11 @@ check_handovers(
ue_context_p->ue_context.handover_info->size, ue_context_p->ue_context.handover_info->size,
ue_context_p->ue_context.handover_info->buf, ue_context_p->ue_context.handover_info->buf,
PDCP_TRANSMISSION_MODE_CONTROL); PDCP_TRANSMISSION_MODE_CONTROL);
AssertFatal(result == TRUE, "PDCP data request failed!\n"); if(result != TRUE)
{
LOG_I(RRC, "PDCP data request failed!\n");
return;
}
ue_context_p->ue_context.handover_info->ho_complete = 0xF2; ue_context_p->ue_context.handover_info->ho_complete = 0xF2;
} }
} }
@@ -5820,33 +5761,24 @@ rrc_eNB_decode_ccch(
rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8;
{ {
if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) { if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) {
AssertFatal(rrcConnectionRequest->ue_Identity.choice.randomValue.size == 5, if(rrcConnectionRequest->ue_Identity.choice.randomValue.size != 5)
"wrong InitialUE-Identity randomValue size, expected 5, provided %d", {
rrcConnectionRequest->ue_Identity.choice.randomValue.size); LOG_I(RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %d",
rrcConnectionRequest->ue_Identity.choice.randomValue.size);
return -1;
}
memcpy(((uint8_t*) & random_value) + 3, memcpy(((uint8_t*) & random_value) + 3,
rrcConnectionRequest->ue_Identity.choice.randomValue.buf, rrcConnectionRequest->ue_Identity.choice.randomValue.buf,
rrcConnectionRequest->ue_Identity.choice.randomValue.size); rrcConnectionRequest->ue_Identity.choice.randomValue.size);
/* if there is already a registered UE (with another RNTI) with this random_value, /* if there is already a registered UE (with another RNTI) with this random_value,
* the current one must be removed from MAC/PHY (zombie UE) * the current one must be removed from MAC/PHY (zombie UE)
*/ */
#ifndef UE_EXPANSION
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",
ctxt_pP->rnti, ue_context_p->ue_context.rnti, ctxt_pP->rnti);
rrc_mac_remove_ue(ctxt_pP->module_id, ctxt_pP->rnti);
ue_context_p = NULL;
return 0;
} else {
ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value);
}
#else
if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { 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_W(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); ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti);
ue_context_p->ue_context.ul_failure_timer = 20000; ue_context_p->ue_context.ul_failure_timer = 20000;
} }
ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value);
#endif
} else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) { } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) {
/* Save s-TMSI */ /* Save s-TMSI */
S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI; S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI;
@@ -6829,9 +6761,10 @@ rrc_enb_task(
LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n",
instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
AssertFatal(RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size < RRC_BUFFER_SIZE_MAX, if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= RRC_BUFFER_SIZE_MAX) {
"CCCH message has size %d > %d\n", LOG_I(RRC, "CCCH message has size %d > %d\n",RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX);
RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); break;
}
memcpy(srb_info_p->Rx_buffer.Payload, memcpy(srb_info_p->Rx_buffer.Payload,
RRC_MAC_CCCH_DATA_IND(msg_p).sdu, RRC_MAC_CCCH_DATA_IND(msg_p).sdu,
RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
@@ -6859,7 +6792,10 @@ rrc_enb_task(
// Message buffer has been processed, free it now. // Message buffer has been processed, free it now.
result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND(msg_p).sdu_p); result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND(msg_p).sdu_p);
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); if (result != EXIT_SUCCESS) {
LOG_I(RRC, "Failed to free memory (%d)!\n",result);
break;
}
break; break;
# if defined(ENABLE_USE_MME) # if defined(ENABLE_USE_MME)
@@ -6928,7 +6864,10 @@ rrc_enb_task(
} }
result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); if (result != EXIT_SUCCESS) {
LOG_I(RRC, "Failed to free memory (%d)!\n",result);
continue;
}
msg_p = NULL; msg_p = NULL;
} }
} }
+5
View File
@@ -1957,6 +1957,11 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance
buffer, buffer,
S1AP_PAGING_IND(msg_p).ue_paging_identity, S1AP_PAGING_IND(msg_p).ue_paging_identity,
S1AP_PAGING_IND(msg_p).cn_domain); S1AP_PAGING_IND(msg_p).cn_domain);
if(length == -1)
{
LOG_I(RRC, "do_Paging error");
return -1;
}
message_buffer = itti_malloc (TASK_RRC_ENB, TASK_PDCP_ENB, length); message_buffer = itti_malloc (TASK_RRC_ENB, TASK_PDCP_ENB, length);
/* Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). */ /* Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). */
memcpy (message_buffer, buffer, length); memcpy (message_buffer, buffer, length);
+163
View File
@@ -48,6 +48,26 @@
// main log variables // main log variables
log_t *g_log; log_t *g_log;
typedef struct {
char* buf_p;
int buf_index;
int enable_flag;
} log_mem_cnt_t;
log_mem_cnt_t log_mem_d[2];
int log_mem_flag=0;
int log_mem_multi=1;
volatile int log_mem_side=0;
pthread_mutex_t log_mem_lock;
pthread_cond_t log_mem_notify;
pthread_t log_mem_thread;
int log_mem_file_cnt=0;
volatile int log_mem_write_flag=0;
volatile int log_mem_write_side=0;
char __log_mem_filename[1024]={0};
char * log_mem_filename = &__log_mem_filename[0];
mapping log_level_names[] = { mapping log_level_names[] = {
{"emerg", LOG_EMERG}, {"emerg", LOG_EMERG},
{"alert", LOG_ALERT}, {"alert", LOG_ALERT},
@@ -494,6 +514,81 @@ int logInit (void)
return 0; return 0;
} }
extern int oai_exit;
void * log_mem_write(void)
{
int *fp;
char f_name[1024];
struct timespec slp_tm;
slp_tm.tv_sec = 0;
slp_tm.tv_nsec = 10000;
pthread_setname_np( pthread_self(), "log_mem_write");
while (!oai_exit) {
pthread_mutex_lock(&log_mem_lock);
log_mem_write_flag=0;
pthread_cond_wait(&log_mem_notify, &log_mem_lock);
log_mem_write_flag=1;
pthread_mutex_unlock(&log_mem_lock);
// write!
if(log_mem_d[log_mem_write_side].enable_flag==0){
if(log_mem_file_cnt>1){
log_mem_file_cnt=1;
printf("log over write!!!\n");
}
snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt);
fp=open(f_name, O_WRONLY | O_CREAT, 0666);
write(fp, log_mem_d[log_mem_write_side].buf_p, log_mem_d[log_mem_write_side].buf_index);
close(fp);
log_mem_file_cnt++;
log_mem_d[log_mem_write_side].buf_index=0;
log_mem_d[log_mem_write_side].enable_flag=1;
}else{
printf("If you'd like to write log, you should set enable flag to 0!!!\n");
nanosleep(&slp_tm,NULL);
}
}
}
int logInit_log_mem (void)
{
if(log_mem_flag==1){
if(log_mem_multi==1){
printf("log-mem multi!!!\n");
log_mem_d[0].buf_p = malloc(LOG_MEM_SIZE);
log_mem_d[0].buf_index=0;
log_mem_d[0].enable_flag=1;
log_mem_d[1].buf_p = malloc(LOG_MEM_SIZE);
log_mem_d[1].buf_index=0;
log_mem_d[1].enable_flag=1;
log_mem_side=0;
if ((pthread_mutex_init (&log_mem_lock, NULL) != 0)
|| (pthread_cond_init (&log_mem_notify, NULL) != 0)) {
log_mem_d[1].enable_flag=0;
return;
}
pthread_create(&log_mem_thread, NULL, log_mem_write, (void*)NULL);
}else{
printf("log-mem single!!!\n");
log_mem_d[0].buf_p = malloc(LOG_MEM_SIZE);
log_mem_d[0].buf_index=0;
log_mem_d[0].enable_flag=1;
log_mem_d[1].enable_flag=0;
log_mem_side=0;
}
}else{
log_mem_d[0].buf_p=NULL;
log_mem_d[1].buf_p=NULL;
log_mem_d[0].enable_flag=0;
log_mem_d[1].enable_flag=0;
}
printf("log init done\n");
return 0;
}
void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args) void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args)
{ {
//logRecord_mt(file,func,line, pthread_self(), comp, level, format, ##args) //logRecord_mt(file,func,line, pthread_self(), comp, level, format, ##args)
@@ -1295,6 +1390,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
* big enough so that the buffer is never full. * big enough so that the buffer is never full.
*/ */
char log_buffer[MAX_LOG_TOTAL]; char log_buffer[MAX_LOG_TOTAL];
int temp_index;
/* for no gcc warnings */ /* for no gcc warnings */
(void)log_start; (void)log_start;
@@ -1392,7 +1488,41 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
// OAI printf compatibility // OAI printf compatibility
if ((g_log->onlinelog == 1) && (level != LOG_FILE)) if ((g_log->onlinelog == 1) && (level != LOG_FILE))
if(log_mem_flag==1){
if(log_mem_d[log_mem_side].enable_flag==1){
temp_index=log_mem_d[log_mem_side].buf_index;
if(temp_index+len+1 < LOG_MEM_SIZE){
log_mem_d[log_mem_side].buf_index+=len;
memcpy(&log_mem_d[log_mem_side].buf_p[temp_index],log_buffer,len);
}else{
log_mem_d[log_mem_side].enable_flag=0;
if(log_mem_d[1-log_mem_side].enable_flag==1){
temp_index=log_mem_d[1-log_mem_side].buf_index;
if(temp_index+len+1 < LOG_MEM_SIZE){
log_mem_d[1-log_mem_side].buf_index+=len;
log_mem_side=1-log_mem_side;
memcpy(&log_mem_d[log_mem_side].buf_p[temp_index],log_buffer,len);
/* write down !*/
if (pthread_mutex_lock(&log_mem_lock) != 0) {
return;
}
if(log_mem_write_flag==0){
log_mem_write_side=1-log_mem_side;
if(pthread_cond_signal(&log_mem_notify) != 0) {
}
}
if(pthread_mutex_unlock(&log_mem_lock) != 0) {
return;
}
}else{
log_mem_d[1-log_mem_side].enable_flag=0;
}
}
}
}
}else{
fwrite(log_buffer, len, 1, stdout); fwrite(log_buffer, len, 1, stdout);
}
if (g_log->syslog) { if (g_log->syslog) {
syslog(g_log->level, "%s", log_buffer); syslog(g_log->level, "%s", log_buffer);
@@ -1720,6 +1850,39 @@ void log_set_instance_type (log_instance_type_t instance)
} }
#endif #endif
void output_log_mem(void){
int cnt,cnt2;
int *fp;
char f_name[1024];
if(log_mem_flag==1){
log_mem_d[0].enable_flag=0;
log_mem_d[1].enable_flag=0;
usleep(10); // wait for log writing
while(log_mem_write_flag==1){
usleep(100);
}
if(log_mem_multi==1){
snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt);
fp=open(f_name, O_WRONLY | O_CREAT, 0666);
write(fp, log_mem_d[0].buf_p, log_mem_d[0].buf_index);
close(fp);
free(log_mem_d[0].buf_p);
snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt);
fp=open(f_name, O_WRONLY | O_CREAT, 0666);
write(fp, log_mem_d[1].buf_p, log_mem_d[1].buf_index);
close(fp);
free(log_mem_d[1].buf_p);
}else{
fp=open(log_mem_filename, O_WRONLY | O_CREAT, 0666);
write(fp, log_mem_d[0].buf_p, log_mem_d[0].buf_index);
close(fp);
free(log_mem_d[0].buf_p);
}
}
}
#ifdef LOG_TEST #ifdef LOG_TEST
int main(int argc, char *argv[]) int main(int argc, char *argv[])
+4
View File
@@ -253,6 +253,10 @@ typedef enum log_instance_type_e {
void log_set_instance_type (log_instance_type_t instance); void log_set_instance_type (log_instance_type_t instance);
#endif #endif
#define LOG_MEM_SIZE 100*1024*1024
#define LOG_MEM_FILE "./logmem.log"
int logInit_log_mem(void);
void output_log_mem(void);
/*--- INCLUDES ---------------------------------------------------------------*/ /*--- INCLUDES ---------------------------------------------------------------*/
# include "log_if.h" # include "log_if.h"
+3
View File
@@ -32,3 +32,6 @@ extern int log_shutdown;
extern mapping log_level_names[]; extern mapping log_level_names[];
extern mapping log_verbosity_names[]; extern mapping log_verbosity_names[];
extern int log_mem_flag;
extern char * log_mem_filename;
+3 -3
View File
@@ -275,9 +275,9 @@ get_free_mem_block (uint32_t sizeP, const char* caller)
} while (pool_selected++ < 12); } while (pool_selected++ < 12);
LOG_E(PHY, "[MEM_MNGT][ERROR][FATAL] failed allocating MEM_BLOCK size %d byes (pool_selected=%d size=%d)\n", sizeP, pool_selected, size); LOG_E(PHY, "[MEM_MNGT][ERROR][FATAL] failed allocating MEM_BLOCK size %d byes (pool_selected=%d size=%d)\n", sizeP, pool_selected, size);
display_mem_load(); // display_mem_load();
AssertFatal(1==0,"get_free_mem_block failed"); // AssertFatal(1==0,"get_free_mem_block failed");
LOG_E(MAC,"[MEM_MNGT][ERROR][FATAL] get_free_mem_block failed!!!\n");
#ifdef MEMBLOCK_BIG_LOCK #ifdef MEMBLOCK_BIG_LOCK
if (pthread_mutex_unlock(&mtex)) abort(); if (pthread_mutex_unlock(&mtex)) abort();
#endif #endif
+1 -1
View File
@@ -91,7 +91,7 @@ private_mem_block(void check_free_mem_block (mem_block_t * leP);)
# define MEM_MNGT_MB5_BLOCK_SIZE MEM_MNGT_MB0_BLOCK_SIZE*32 # define MEM_MNGT_MB5_BLOCK_SIZE MEM_MNGT_MB0_BLOCK_SIZE*32
// 2048 // 2048
# define MEM_MNGT_MB5_NB_BLOCKS 1024 * MEM_SCALE // LG WAS 1024 # define MEM_MNGT_MB5_NB_BLOCKS 1024 * MEM_SCALE * 50 // LG WAS 1024
# define MEM_MNGT_POOL_ID5 5 # define MEM_MNGT_POOL_ID5 5
# define MEM_MNGT_MB6_BLOCK_SIZE MEM_MNGT_MB0_BLOCK_SIZE*64 # define MEM_MNGT_MB6_BLOCK_SIZE MEM_MNGT_MB0_BLOCK_SIZE*64
+1
View File
@@ -94,6 +94,7 @@ umts_add_timer_list_up (list2_t * atimer_listP, void (*procP) (void *, void *),
uint8_t inserted = 0; uint8_t inserted = 0;
mb = get_free_mem_block (sizeof (struct timer_unit), __func__); mb = get_free_mem_block (sizeof (struct timer_unit), __func__);
if(mb==NULL) return NULL;
((struct timer_unit *) (mb->data))->proc = procP; ((struct timer_unit *) (mb->data))->proc = procP;
((struct timer_unit *) (mb->data))->protocol = protocolP; ((struct timer_unit *) (mb->data))->protocol = protocolP;
((struct timer_unit *) (mb->data))->timer_id = timer_idP; ((struct timer_unit *) (mb->data))->timer_id = timer_idP;
@@ -376,6 +376,7 @@ static void trx_usrp_end(openair0_device *device) {
s->tx_md.end_of_burst = true; s->tx_md.end_of_burst = true;
s->tx_stream->send("", 0, s->tx_md); s->tx_stream->send("", 0, s->tx_md);
s->tx_md.end_of_burst = false; s->tx_md.end_of_burst = false;
sleep(1);
#if defined(USRP_REC_PLAY) #if defined(USRP_REC_PLAY)
} }
#endif #endif
+5 -12
View File
@@ -164,13 +164,6 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) { static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
static double cpu_freq_GHz = 0.0;
if (cpu_freq_GHz == 0.0)
cpu_freq_GHz = get_cpu_freq_GHz();
start_meas(&softmodem_stats_rxtx_sf); start_meas(&softmodem_stats_rxtx_sf);
// ******************************************************************* // *******************************************************************
@@ -250,7 +243,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
//if (wait_CCs(proc)<0) return(-1); //if (wait_CCs(proc)<0) return(-1);
if (oai_exit) return(-1); if (oai_exit) return(-1);
#if (!defined(UE_EXPANSION_SIM2)) &&(!defined(UE_EXPANSION)) #ifndef PHY_TX_THREAD
phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1); phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1);
#endif #endif
if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) return(-1); if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) return(-1);
@@ -513,7 +506,7 @@ void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) {
if (is_prach_subframe(fp,frame,subframe)>0) { if (is_prach_subframe(fp,frame,subframe)>0) {
LOG_D(PHY,"Triggering prach processing, frame %d, subframe %d\n",frame,subframe); LOG_D(PHY,"Triggering prach processing, frame %d, subframe %d\n",frame,subframe);
if (proc->instance_cnt_prach == 0) { if (proc->instance_cnt_prach == 0) {
LOG_W(PHY,"[eNB] Frame %d Subframe %d, dropping PRACH\n", frame,subframe); //LOG_W(PHY,"[eNB] Frame %d Subframe %d, dropping PRACH\n", frame,subframe);
return; return;
} }
@@ -573,7 +566,7 @@ void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) {
if (is_prach_subframe(fp,frame,subframe)>0) { if (is_prach_subframe(fp,frame,subframe)>0) {
LOG_D(PHY,"Triggering prach br processing, frame %d, subframe %d\n",frame,subframe); LOG_D(PHY,"Triggering prach br processing, frame %d, subframe %d\n",frame,subframe);
if (proc->instance_cnt_prach_br == 0) { if (proc->instance_cnt_prach_br == 0) {
LOG_W(PHY,"[eNB] Frame %d Subframe %d, dropping PRACH BR\n", frame,subframe); //LOG_W(PHY,"[eNB] Frame %d Subframe %d, dropping PRACH BR\n", frame,subframe);
return; return;
} }
@@ -902,7 +895,7 @@ void init_transport(PHY_VARS_eNB *eNB) {
LOG_I(PHY, "Initialise transport\n"); LOG_I(PHY, "Initialise transport\n");
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH, UE %d\n",i); LOG_D(PHY,"Allocating Transport Channel Buffers for DLSCH, UE %d\n",i);
for (j=0; j<2; j++) { for (j=0; j<2; j++) {
eNB->dlsch[i][j] = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL,0,fp); eNB->dlsch[i][j] = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL,0,fp);
if (!eNB->dlsch[i][j]) { if (!eNB->dlsch[i][j]) {
@@ -914,7 +907,7 @@ void init_transport(PHY_VARS_eNB *eNB) {
} }
} }
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i); LOG_D(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0); eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0);
if (!eNB->ulsch[1+i]) { if (!eNB->ulsch[1+i]) {
+32 -29
View File
@@ -110,9 +110,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "T.h" #include "T.h"
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2)
#include "pdcp.h" #include "pdcp.h"
#endif
extern volatile int oai_exit; extern volatile int oai_exit;
@@ -736,7 +734,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10; proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10;
// synchronize first reception to frame 0 subframe 0 // synchronize first reception to frame 0 subframe 0
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
proc->timestamp_phy_tx = proc->timestamp_rx+(3*fp->samples_per_tti); proc->timestamp_phy_tx = proc->timestamp_rx+(3*fp->samples_per_tti);
proc->subframe_phy_tx = (proc->subframe_rx+3)%10; proc->subframe_phy_tx = (proc->subframe_rx+3)%10;
proc->frame_phy_tx = (proc->subframe_rx>6) ? (proc->frame_rx+1)&1023 : proc->frame_rx; proc->frame_phy_tx = (proc->subframe_rx>6) ? (proc->frame_rx+1)&1023 : proc->frame_rx;
@@ -817,7 +815,7 @@ void tx_rf(RU_t *ru) {
(prevSF_type == SF_UL) && (prevSF_type == SF_UL) &&
(nextSF_type == SF_DL)) { (nextSF_type == SF_DL)) {
flags = 2; // start of burst flags = 2; // start of burst
sf_extension = ru->N_TA_offset<<1; sf_extension = ru->N_TA_offset;
} }
if ((fp->frame_type == TDD) && if ((fp->frame_type == TDD) &&
@@ -825,8 +823,17 @@ void tx_rf(RU_t *ru) {
(prevSF_type == SF_UL) && (prevSF_type == SF_UL) &&
(nextSF_type == SF_UL)) { (nextSF_type == SF_UL)) {
flags = 4; // start of burst and end of burst (only one DL SF between two UL) flags = 4; // start of burst and end of burst (only one DL SF between two UL)
sf_extension = ru->N_TA_offset<<1; sf_extension = ru->N_TA_offset;
} }
#if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__
sf_extension = (sf_extension)&0xfffffff8;
#else
sf_extension = (sf_extension)&0xfffffffc;
#endif
#elif defined(__arm__)
sf_extension = (sf_extension)&0xfffffffc;
#endif
for (i=0; i<ru->nb_tx; i++) for (i=0; i<ru->nb_tx; i++)
txp[i] = (void*)&ru->common.txdata[i][(proc->subframe_tx*fp->samples_per_tti)-sf_extension]; txp[i] = (void*)&ru->common.txdata[i][(proc->subframe_tx*fp->samples_per_tti)-sf_extension];
@@ -1308,8 +1315,8 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
cfg->tx_freq[i] = (double)fp->dl_CarrierFreq; cfg->tx_freq[i] = (double)fp->dl_CarrierFreq;
cfg->rx_freq[i] = (double)fp->ul_CarrierFreq; cfg->rx_freq[i] = (double)fp->ul_CarrierFreq;
cfg->tx_gain[i] = (double)fp->att_tx; cfg->tx_gain[i] = (double)ru->att_tx;
cfg->rx_gain[i] = ru->max_rxgain-(double)fp->att_rx; cfg->rx_gain[i] = ru->max_rxgain-(double)ru->att_rx;
cfg->configFilename = rf_config_file; cfg->configFilename = rf_config_file;
printf("channel %d, Setting tx_gain offset %f, rx_gain offset %f, tx_freq %f, rx_freq %f\n", printf("channel %d, Setting tx_gain offset %f, rx_gain offset %f, tx_freq %f, rx_freq %f\n",
@@ -1407,7 +1414,7 @@ static void* ru_stats_thread(void* param) {
return(NULL); return(NULL);
} }
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
int first_phy_tx = 1; int first_phy_tx = 1;
volatile int16_t phy_tx_txdataF_end; volatile int16_t phy_tx_txdataF_end;
volatile int16_t phy_tx_end; volatile int16_t phy_tx_end;
@@ -1425,15 +1432,13 @@ static void* ru_thread( void* param ) {
// set default return value // set default return value
ru_thread_status = 0; ru_thread_status = 0;
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2) #if defined(PRE_SCD_THREAD)
dlsch_ue_select_tbl_in_use = 1; dlsch_ue_select_tbl_in_use = 1;
#endif #endif
#ifdef UE_EXPANSION
struct timespec time_req, time_rem; struct timespec time_req, time_rem;
time_req.tv_sec = 0; time_req.tv_sec = 0;
time_req.tv_nsec = 10000; time_req.tv_nsec = 10000;
#endif
// set default return value // set default return value
thread_top_init("ru_thread",0,870000,1000000,1000000); thread_top_init("ru_thread",0,870000,1000000,1000000);
@@ -1513,7 +1518,7 @@ static void* ru_thread( void* param ) {
if (ru->fh_south_in) ru->fh_south_in(ru,&frame,&subframe); if (ru->fh_south_in) ru->fh_south_in(ru,&frame,&subframe);
else AssertFatal(1==0, "No fronthaul interface at south port"); else AssertFatal(1==0, "No fronthaul interface at south port");
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
if(first_phy_tx == 0) if(first_phy_tx == 0)
{ {
phy_tx_end = 0; phy_tx_end = 0;
@@ -1570,7 +1575,7 @@ static void* ru_thread( void* param ) {
// If this proc is to provide synchronization, do so // If this proc is to provide synchronization, do so
wakeup_slaves(proc); wakeup_slaves(proc);
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2) #if defined(PRE_SCD_THREAD)
new_dlsch_ue_select_tbl_in_use = dlsch_ue_select_tbl_in_use; new_dlsch_ue_select_tbl_in_use = dlsch_ue_select_tbl_in_use;
dlsch_ue_select_tbl_in_use = !dlsch_ue_select_tbl_in_use; dlsch_ue_select_tbl_in_use = !dlsch_ue_select_tbl_in_use;
memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX); memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
@@ -1605,7 +1610,7 @@ static void* ru_thread( void* param ) {
wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread"); wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread");
#ifndef UE_EXPANSION #ifndef PHY_TX_THREAD
// do TX front-end processing if needed (precoding and/or IDFTs) // do TX front-end processing if needed (precoding and/or IDFTs)
if (ru->feptx_prec) ru->feptx_prec(ru); if (ru->feptx_prec) ru->feptx_prec(ru);
@@ -1711,7 +1716,7 @@ void *ru_thread_synch(void *arg) {
} }
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2) #if defined(PRE_SCD_THREAD)
void* pre_scd_thread( void* param ){ void* pre_scd_thread( void* param ){
static int eNB_pre_scd_status; static int eNB_pre_scd_status;
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
@@ -1765,7 +1770,7 @@ void* pre_scd_thread( void* param ){
} }
#endif #endif
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
/*! /*!
* \brief The phy tx thread of eNB. * \brief The phy tx thread of eNB.
* \param param is a \ref eNB_proc_t structure which contains the info what to process. * \param param is a \ref eNB_proc_t structure which contains the info what to process.
@@ -1799,9 +1804,6 @@ static void* eNB_thread_phy_tx( void* param ) {
proc_rxtx.subframe_tx = proc->subframe_phy_tx; proc_rxtx.subframe_tx = proc->subframe_phy_tx;
proc_rxtx.frame_tx = proc->frame_phy_tx; proc_rxtx.frame_tx = proc->frame_phy_tx;
phy_procedures_eNB_TX(eNB_list[0], &proc_rxtx, no_relay, NULL, 1); phy_procedures_eNB_TX(eNB_list[0], &proc_rxtx, no_relay, NULL, 1);
ru->proc.frame_tx = proc->frame_phy_tx;
ru->proc.subframe_tx = proc->subframe_phy_tx;
ru->proc.timestamp_tx = proc->timestamp_phy_tx;
phy_tx_txdataF_end = 1; phy_tx_txdataF_end = 1;
if(pthread_mutex_lock(&ru->proc.mutex_rf_tx) != 0){ if(pthread_mutex_lock(&ru->proc.mutex_rf_tx) != 0){
LOG_E( PHY, "[RU] ERROR pthread_mutex_lock for rf tx thread (IC %d)\n", ru->proc.instance_cnt_rf_tx); LOG_E( PHY, "[RU] ERROR pthread_mutex_lock for rf tx thread (IC %d)\n", ru->proc.instance_cnt_rf_tx);
@@ -1809,12 +1811,15 @@ static void* eNB_thread_phy_tx( void* param ) {
} }
if (ru->proc.instance_cnt_rf_tx==-1) { if (ru->proc.instance_cnt_rf_tx==-1) {
++ru->proc.instance_cnt_rf_tx; ++ru->proc.instance_cnt_rf_tx;
ru->proc.frame_tx = proc->frame_phy_tx;
ru->proc.subframe_tx = proc->subframe_phy_tx;
ru->proc.timestamp_tx = proc->timestamp_phy_tx;
// the thread can now be woken up // the thread can now be woken up
AssertFatal(pthread_cond_signal(&ru->proc.cond_rf_tx) == 0, "ERROR pthread_cond_signal for rf_tx thread\n"); AssertFatal(pthread_cond_signal(&ru->proc.cond_rf_tx) == 0, "ERROR pthread_cond_signal for rf_tx thread\n");
}else{ }else{
LOG_E(PHY,"rf tx thread busy, skipping\n"); LOG_E(PHY,"rf tx thread busy, skipping\n");
ru->proc.instance_cnt_rf_tx++; late_control=STATE_BURST_TERMINATE;
} }
pthread_mutex_unlock( &ru->proc.mutex_rf_tx ); pthread_mutex_unlock( &ru->proc.mutex_rf_tx );
} }
@@ -1943,7 +1948,7 @@ void init_RU_proc(RU_t *ru) {
pthread_attr_init( &proc->attr_prach_br); pthread_attr_init( &proc->attr_prach_br);
#endif #endif
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
proc->instance_cnt_phy_tx = -1; proc->instance_cnt_phy_tx = -1;
pthread_mutex_init( &proc->mutex_phy_tx, NULL); pthread_mutex_init( &proc->mutex_phy_tx, NULL);
pthread_cond_init( &proc->cond_phy_tx, NULL); pthread_cond_init( &proc->cond_phy_tx, NULL);
@@ -1963,7 +1968,7 @@ void init_RU_proc(RU_t *ru) {
#endif #endif
pthread_create( &proc->pthread_FH, attr_FH, ru_thread, (void*)ru ); pthread_create( &proc->pthread_FH, attr_FH, ru_thread, (void*)ru );
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2) #if defined(PRE_SCD_THREAD)
proc->instance_pre_scd = -1; proc->instance_pre_scd = -1;
pthread_mutex_init( &proc->mutex_pre_scd, NULL); pthread_mutex_init( &proc->mutex_pre_scd, NULL);
pthread_cond_init( &proc->cond_pre_scd, NULL); pthread_cond_init( &proc->cond_pre_scd, NULL);
@@ -1971,7 +1976,7 @@ void init_RU_proc(RU_t *ru) {
pthread_setname_np(proc->pthread_pre_scd, "pre_scd_thread"); pthread_setname_np(proc->pthread_pre_scd, "pre_scd_thread");
#endif #endif
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
pthread_create( &proc->pthread_phy_tx, NULL, eNB_thread_phy_tx, (void*)ru ); pthread_create( &proc->pthread_phy_tx, NULL, eNB_thread_phy_tx, (void*)ru );
pthread_setname_np( proc->pthread_phy_tx, "phy_tx_thread" ); pthread_setname_np( proc->pthread_phy_tx, "phy_tx_thread" );
pthread_create( &proc->pthread_rf_tx, NULL, rf_tx, (void*)ru ); pthread_create( &proc->pthread_rf_tx, NULL, rf_tx, (void*)ru );
@@ -2230,7 +2235,7 @@ void init_RU(char *rf_config_file) {
} }
else else
{ {
LOG_E(PHY,"DJP - delete code above this %s:%d\n", __FILE__, __LINE__); LOG_D(PHY,"DJP - delete code above this %s:%d\n", __FILE__, __LINE__);
} }
eNB0 = ru->eNB_list[0]; eNB0 = ru->eNB_list[0];
@@ -2419,11 +2424,9 @@ void init_RU(char *rf_config_file) {
void stop_ru(RU_t *ru) { void stop_ru(RU_t *ru) {
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2) int *status;
int *status;
#endif
printf("Stopping RU %p processing threads\n",(void*)ru); printf("Stopping RU %p processing threads\n",(void*)ru);
#if defined(UE_EXPANSION) || defined(UE_EXPANSION_SIM2) #if defined(PRE_SCD_THREAD)
if(ru){ if(ru){
ru->proc.instance_pre_scd = 0; ru->proc.instance_pre_scd = 0;
pthread_cond_signal( &ru->proc.cond_pre_scd ); pthread_cond_signal( &ru->proc.cond_pre_scd );
@@ -2432,7 +2435,7 @@ void stop_ru(RU_t *ru) {
pthread_cond_destroy(&ru->proc.cond_pre_scd ); pthread_cond_destroy(&ru->proc.cond_pre_scd );
} }
#endif #endif
#ifdef UE_EXPANSION #ifdef PHY_TX_THREAD
if(ru){ if(ru){
ru->proc.instance_cnt_phy_tx = 0; ru->proc.instance_cnt_phy_tx = 0;
pthread_cond_signal(&ru->proc.cond_phy_tx); pthread_cond_signal(&ru->proc.cond_phy_tx);
+30 -18
View File
@@ -144,8 +144,7 @@ static char threequarter_fs=0;
uint32_t downlink_frequency[MAX_NUM_CCs][4]; uint32_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
char logmem_filename[1024] = {0};
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
static char *itti_dump_file = NULL; static char *itti_dump_file = NULL;
#endif #endif
@@ -333,10 +332,14 @@ void exit_fun(const char* s)
if (UE_flag==0) { if (UE_flag==0) {
for (ru_id=0; ru_id<RC.nb_RU;ru_id++) { for (ru_id=0; ru_id<RC.nb_RU;ru_id++) {
if (RC.ru[ru_id]->rfdevice.trx_end_func) if (RC.ru[ru_id]->rfdevice.trx_end_func) {
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice); RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
if (RC.ru[ru_id]->ifdevice.trx_end_func) RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice); }
if (RC.ru[ru_id]->ifdevice.trx_end_func) {
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
}
} }
} }
@@ -347,8 +350,10 @@ void exit_fun(const char* s)
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if (UE_flag == 0) { if (UE_flag == 0) {
} else { } else {
if (PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func) if (PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func) {
PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice); PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice);
PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func = NULL;
}
} }
} }
@@ -605,6 +610,12 @@ static void get_options(void) {
if (start_telnetsrv) { if (start_telnetsrv) {
load_module_shlib("telnetsrv",NULL,0); load_module_shlib("telnetsrv",NULL,0);
} }
if (strlen(logmem_filename) > 0) {
log_mem_filename = &logmem_filename[0];
log_mem_flag = 1;
printf("Enabling OPT for log save at memory %s\n",log_mem_filename);
logInit_log_mem();
}
if (UE_flag > 0) { if (UE_flag > 0) {
@@ -1126,8 +1137,6 @@ int main( int argc, char **argv )
printf("Runtime table\n"); printf("Runtime table\n");
fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx); fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx);
cpuf=get_cpu_freq_GHz();
#ifndef DEADLINE_SCHEDULER #ifndef DEADLINE_SCHEDULER
@@ -1451,11 +1460,9 @@ int main( int argc, char **argv )
// cleanup // cleanup
if (UE_flag == 1) { if (UE_flag == 1) {
} else { } else {
#ifdef UE_EXPANSION
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) { for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
stop_ru(RC.ru[ru_id]); stop_ru(RC.ru[ru_id]);
} }
#endif
stop_eNB(1); stop_eNB(1);
} }
@@ -1470,16 +1477,21 @@ int main( int argc, char **argv )
// *** Handle per CC_id openair0 // *** Handle per CC_id openair0
if (UE_flag==1) { if (UE_flag==1) {
if (PHY_vars_UE_g[0][0]->rfdevice.trx_end_func) if (PHY_vars_UE_g[0][0]->rfdevice.trx_end_func) {
PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice); PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice);
PHY_vars_UE_g[0][0]->rfdevice.trx_end_func = NULL;
}
} }
else { else {
for(ru_id=0; ru_id<NB_RU; ru_id++) { for(ru_id=0; ru_id<NB_RU; ru_id++) {
if (RC.ru[ru_id]->rfdevice.trx_end_func) if (RC.ru[ru_id]->rfdevice.trx_end_func) {
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice); RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
if (RC.ru[ru_id]->ifdevice.trx_end_func) RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice); }
if (RC.ru[ru_id]->ifdevice.trx_end_func) {
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
}
} }
} }
if (ouput_vcd) if (ouput_vcd)
+1 -2
View File
@@ -182,6 +182,7 @@ extern int16_t dlsch_demod_shift;
{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ {"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
{"G" , CONFIG_HLP_LOGV, 0, uptr:&glog_verbosity, defintval:0, TYPE_UINT16, 0}, \ {"G" , CONFIG_HLP_LOGV, 0, uptr:&glog_verbosity, defintval:0, TYPE_UINT16, 0}, \
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
{"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:"./logmem.log", TYPE_STRING, sizeof(logmem_filename)}, \
} }
#define CMDLINE_ONLINELOG_IDX 0 #define CMDLINE_ONLINELOG_IDX 0
#define CMDLINE_GLOGLEVEL_IDX 1 #define CMDLINE_GLOGLEVEL_IDX 1
@@ -244,9 +245,7 @@ extern void kill_eNB_proc(int inst);
// In lte-ru.c // In lte-ru.c
extern void init_RU(const char*); extern void init_RU(const char*);
#ifdef UE_EXPANSION
extern void stop_ru(RU_t *ru); extern void stop_ru(RU_t *ru);
#endif
// In lte-ue.c // In lte-ue.c
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg); extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
+1 -1
View File
@@ -148,7 +148,7 @@ void pdcp_rlc_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_dat
data_indP->no_tb += 1; data_indP->no_tb += 1;
} else { } else {
printf("Out of memory error\n"); printf("Out of memory error\n");
exit(-1); // exit(-1);
} }
} else { } else {
printf("[RLC-LOOP] DROPPING 1 TB\n"); printf("[RLC-LOOP] DROPPING 1 TB\n");