Commit 8713e749 authored by Raymond Knopp's avatar Raymond Knopp

changes from Cedric

parent 215a27c1
...@@ -124,7 +124,7 @@ endmacro(add_list_string_option) ...@@ -124,7 +124,7 @@ endmacro(add_list_string_option)
#################################################### ####################################################
# compilation flags # compilation flags
############################################# #############################################
set(CMAKE_BUILD_TYPE "Debug") #set(CMAKE_BUILD_TYPE "Debug")
if (CMAKE_BUILD_TYPE STREQUAL "") if (CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "RelWithDebInfo") set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif() endif()
...@@ -1106,6 +1106,15 @@ set (MAC_SRC ...@@ -1106,6 +1106,15 @@ set (MAC_SRC
${MAC_DIR}/config.c ${MAC_DIR}/config.c
) )
set_source_files_properties(${RLC_DIR}/rlc_mac.c PROPERTIES COMPILE_FLAGS "-g -O0")
set_source_files_properties(${RLC_AM_DIR}/rlc_am.c PROPERTIES COMPILE_FLAGS "-g -O0")
set_source_files_properties(${RLC_AM_DIR}/rlc_am_status_report.c PROPERTIES COMPILE_FLAGS "-g -O0")
set_source_files_properties(${RLC_AM_DIR}/rlc_am_receiver.c PROPERTIES COMPILE_FLAGS "-g -O0")
set_source_files_properties(${RLC_AM_DIR}/rlc_am_retransmit.c PROPERTIES COMPILE_FLAGS "-g -O0")
set_source_files_properties(${MAC_DIR}/ue_procedures.c PROPERTIES COMPILE_FLAGS "-g -O0")
set_source_files_properties(${MAC_DIR}/eNB_scheduler.c PROPERTIES COMPILE_FLAGS "-g -O0")
set_source_files_properties(${MAC_DIR}/eNB_scheduler_primitives.c PROPERTIES COMPILE_FLAGS "-g -O0")
if (${FAPI}) if (${FAPI})
set (MAC_SRC ${MAC_SRC} set (MAC_SRC ${MAC_SRC}
${MAC_DIR}/ff-mac.c ${MAC_DIR}/ff-mac.c
...@@ -1113,6 +1122,8 @@ set (MAC_SRC ${MAC_SRC} ...@@ -1113,6 +1122,8 @@ set (MAC_SRC ${MAC_SRC}
) )
endif (${FAPI}) endif (${FAPI})
set_source_files_properties(${MAC_DIR}/ff-mac.c PROPERTIES COMPILE_FLAGS "-g -O0")
if (${FAPI_TRACER}) if (${FAPI_TRACER})
set (MAC_SRC ${MAC_SRC} set (MAC_SRC ${MAC_SRC}
${MAC_DIR}/ffdebug.c ${MAC_DIR}/ffdebug.c
...@@ -1699,7 +1710,7 @@ target_link_libraries (lte-softmodem-nos1 ...@@ -1699,7 +1710,7 @@ target_link_libraries (lte-softmodem-nos1
target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ) target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} )
target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 ${T_LIB}) target_link_libraries (lte-softmodem ${T_LIB})
# rrh # rrh
################################ ################################
......
...@@ -99,6 +99,14 @@ ID = ENB_MAC_UE_DL_PDU_WITH_DATA ...@@ -99,6 +99,14 @@ ID = ENB_MAC_UE_DL_PDU_WITH_DATA
DESC = MAC downlink PDU for an UE DESC = MAC downlink PDU for an UE
GROUP = ALL:MAC:ENB GROUP = ALL:MAC:ENB
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
ID = UE_MAC_UE_UL_PDU_WITH_DATA
DESC = MAC uplink sent PDU by the UE
GROUP = ALL:MAC:UE:HEAVY
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,sdu_length : int,num_ce : int,num_sdu : buffer,data
ID = UE_MAC_UE_DL_PDU_WITH_DATA
DESC = MAC downlink received PDU by the UE
GROUP = ALL:MAC:UE:HEAVY
FORMAT = int,UE_ID : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
#RLC logs #RLC logs
ID = ENB_RLC_DL ID = ENB_RLC_DL
......
...@@ -51,7 +51,7 @@ void ul(void *_d, event e) ...@@ -51,7 +51,7 @@ void ul(void *_d, event e)
/* for newer version of wireshark? */ /* for newer version of wireshark? */
fsf = (e.e[d->ul_frame].i << 4) + e.e[d->ul_subframe].i; fsf = (e.e[d->ul_frame].i << 4) + e.e[d->ul_subframe].i;
/* for older version? */ /* for older version? */
fsf = e.e[d->ul_subframe].i; //fsf = e.e[d->ul_subframe].i;
PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG); PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
PUTC(&d->buf, (fsf>>8) & 255); PUTC(&d->buf, (fsf>>8) & 255);
PUTC(&d->buf, fsf & 255); PUTC(&d->buf, fsf & 255);
...@@ -86,7 +86,7 @@ void dl(void *_d, event e) ...@@ -86,7 +86,7 @@ void dl(void *_d, event e)
/* for newer version of wireshark? */ /* for newer version of wireshark? */
fsf = (e.e[d->dl_frame].i << 4) + e.e[d->dl_subframe].i; fsf = (e.e[d->dl_frame].i << 4) + e.e[d->dl_subframe].i;
/* for older version? */ /* for older version? */
fsf = e.e[d->dl_subframe].i; //fsf = e.e[d->dl_subframe].i;
PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG); PUTC(&d->buf, MAC_LTE_FRAME_SUBFRAME_TAG);
PUTC(&d->buf, (fsf>>8) & 255); PUTC(&d->buf, (fsf>>8) & 255);
PUTC(&d->buf, fsf & 255); PUTC(&d->buf, fsf & 255);
...@@ -177,7 +177,7 @@ void usage(void) ...@@ -177,7 +177,7 @@ void usage(void)
printf( printf(
"options:\n" "options:\n"
" -d <database file> this option is mandatory\n" " -d <database file> this option is mandatory\n"
" -in <dump file> read events from this dump file\n" " -i <dump file> read events from this dump file\n"
" -ip <IP address> send packets to this IP address (default %s)\n" " -ip <IP address> send packets to this IP address (default %s)\n"
" -p <port> send packets to this port (default %d)\n", " -p <port> send packets to this port (default %d)\n",
DEFAULT_IP, DEFAULT_IP,
...@@ -205,7 +205,7 @@ int main(int n, char **v) ...@@ -205,7 +205,7 @@ int main(int n, char **v)
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage(); if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
if (!strcmp(v[i], "-d")) if (!strcmp(v[i], "-d"))
{ if (i > n-2) usage(); database_filename = v[++i]; continue; } { if (i > n-2) usage(); database_filename = v[++i]; continue; }
if (!strcmp(v[i], "-in")) if (!strcmp(v[i], "-i"))
{ if (i > n-2) usage(); input_filename = v[++i]; continue; } { if (i > n-2) usage(); input_filename = v[++i]; continue; }
if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; } if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
if (!strcmp(v[i], "-p")) {if(i>n-2)usage(); port=atoi(v[++i]); continue; } if (!strcmp(v[i], "-p")) {if(i>n-2)usage(); port=atoi(v[++i]); continue; }
...@@ -231,6 +231,7 @@ int main(int n, char **v) ...@@ -231,6 +231,7 @@ int main(int n, char **v)
h = new_handler(database); h = new_handler(database);
ul_id = event_id_from_name(database, "ENB_MAC_UE_UL_PDU_WITH_DATA"); ul_id = event_id_from_name(database, "ENB_MAC_UE_UL_PDU_WITH_DATA");
//dl_id = event_id_from_name(database, "UE_MAC_UE_DL_PDU_WITH_DATA");
dl_id = event_id_from_name(database, "ENB_MAC_UE_DL_PDU_WITH_DATA"); dl_id = event_id_from_name(database, "ENB_MAC_UE_DL_PDU_WITH_DATA");
setup_data(&d, database, ul_id, dl_id); setup_data(&d, database, ul_id, dl_id);
......
...@@ -80,6 +80,7 @@ int main(int n, char **v) ...@@ -80,6 +80,7 @@ int main(int n, char **v)
{ on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=1; continue; } { on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=1; continue; }
if (!strcmp(v[i], "-OFF")) if (!strcmp(v[i], "-OFF"))
{ on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=0; continue; } { on_off_name[on_off_n]=NULL; on_off_action[on_off_n++]=0; continue; }
printf("unknown option %s\n", v[i]);
usage(); usage();
} }
......
...@@ -18,6 +18,7 @@ static void append(view *_this, char *s) ...@@ -18,6 +18,7 @@ static void append(view *_this, char *s)
struct stdout *this = (struct stdout *)_this; struct stdout *this = (struct stdout *)_this;
if (pthread_mutex_lock(&this->lock)) abort(); if (pthread_mutex_lock(&this->lock)) abort();
printf("%s\n", s); printf("%s\n", s);
fflush(stdout);
if (pthread_mutex_unlock(&this->lock)) abort(); if (pthread_mutex_unlock(&this->lock)) abort();
} }
......
...@@ -194,6 +194,7 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t ...@@ -194,6 +194,7 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
if ((rb_alloc&1) != 0) if ((rb_alloc&1) != 0)
rb_alloc2[0] |= (1<<24); rb_alloc2[0] |= (1<<24);
} else { } else {
#if 0
subset = rb_alloc&1; subset = rb_alloc&1;
shift = (rb_alloc>>1)&1; shift = (rb_alloc>>1)&1;
...@@ -203,6 +204,14 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t ...@@ -203,6 +204,14 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
//printf("rb_alloc2 (type 1) %x\n",rb_alloc2); //printf("rb_alloc2 (type 1) %x\n",rb_alloc2);
} }
#endif
subset = (rb_alloc>>12)&1;
shift = (rb_alloc>>11)&1;
for (i=0; i<11; i++) {
if ((rb_alloc&(1<<(10-i))) != 0)
rb_alloc2[0] |= (1<<(2*i));
}
if ((shift == 0) && (subset == 1)) if ((shift == 0) && (subset == 1))
rb_alloc2[0]<<=1; rb_alloc2[0]<<=1;
...@@ -210,6 +219,7 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t ...@@ -210,6 +219,7 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
rb_alloc2[0]<<=4; rb_alloc2[0]<<=4;
else if ((shift == 1) && (subset == 1)) else if ((shift == 1) && (subset == 1))
rb_alloc2[0]<<=3; rb_alloc2[0]<<=3;
printf("YOYO rb_alloc2 %x (from %x)\n", rb_alloc2[0], rb_alloc);
} }
break; break;
...@@ -7223,7 +7233,9 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu, ...@@ -7223,7 +7233,9 @@ int generate_eNB_ulsch_params_from_dci(void *dci_pdu,
if (cqi_req == 1) { if (cqi_req == 1) {
fprintf(stderr, "cqi_req = 1 in dci_tools!\n");
ulsch->harq_processes[harq_pid]->O_RI = 1; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table ulsch->harq_processes[harq_pid]->O_RI = 1; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table
ulsch->harq_processes[harq_pid]->O_RI = 0; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table
switch(transmission_mode) { switch(transmission_mode) {
// The aperiodic CQI reporting mode is fixed for every transmission mode instead of being configured by higher layer signaling // The aperiodic CQI reporting mode is fixed for every transmission mode instead of being configured by higher layer signaling
......
...@@ -423,6 +423,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -423,6 +423,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
Qprime = Qprime/(8*sumKr); Qprime = Qprime/(8*sumKr);
} }
if (Qprime > nb_rb * 12 * ulsch_harq->Nsymb_pusch) { fprintf(stderr, "reduce Qprime %d -> %d\n", Qprime, nb_rb * 12 * ulsch_harq->Nsymb_pusch); Qprime = nb_rb * 12 * ulsch_harq->Nsymb_pusch; }
G = nb_rb * (12 * Q_m) * (ulsch_harq->Nsymb_pusch); G = nb_rb * (12 * Q_m) * (ulsch_harq->Nsymb_pusch);
...@@ -432,6 +434,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -432,6 +434,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
msg("ulsch_decoding: G %d, Q_RI %d, Q_CQI %d (L %d, Or1 %d) O_ACK %d\n",G,Q_RI,Q_CQI,L,ulsch_harq->Or1,ulsch_harq->O_ACK); msg("ulsch_decoding: G %d, Q_RI %d, Q_CQI %d (L %d, Or1 %d) O_ACK %d\n",G,Q_RI,Q_CQI,L,ulsch_harq->Or1,ulsch_harq->O_ACK);
#endif #endif
if (Q_CQI) fprintf(stderr, "G %d Q_CQI %d Q_RI %d\n", G, Q_CQI, Q_RI);
G = G - Q_RI - Q_CQI; G = G - Q_RI - Q_CQI;
if ((int)G < 0) { if ((int)G < 0) {
...@@ -919,6 +923,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, ...@@ -919,6 +923,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
// CQI // CQI
// printf("before cqi c[%d] = %p\n",0,ulsch_harq->c[0]); // printf("before cqi c[%d] = %p\n",0,ulsch_harq->c[0]);
ulsch_harq->cqi_crc_status = 0;
if (Q_CQI>0) { if (Q_CQI>0) {
memset((void *)&dummy_w_cc[0],0,3*(ulsch_harq->Or1+8+32)); memset((void *)&dummy_w_cc[0],0,3*(ulsch_harq->Or1+8+32));
......
...@@ -190,6 +190,7 @@ int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rntiP) { ...@@ -190,6 +190,7 @@ int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rntiP) {
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
LOG_I(PHY,"eNB %d removing UE %d with rnti %x\n",phy_vars_eNB->Mod_id,i,rnti); LOG_I(PHY,"eNB %d removing UE %d with rnti %x\n",phy_vars_eNB->Mod_id,i,rnti);
#endif #endif
LOG_I(PHY,"eNB %d removing UE %d with rnti %x\n",phy_vars_eNB->Mod_id,i,rntiP);
//msg("[PHY] UE_id %d\n",i); //msg("[PHY] UE_id %d\n",i);
clean_eNb_dlsch(phy_vars_eNB->dlsch_eNB[i][0]); clean_eNb_dlsch(phy_vars_eNB->dlsch_eNB[i][0]);
clean_eNb_ulsch(phy_vars_eNB->ulsch_eNB[i]); clean_eNb_ulsch(phy_vars_eNB->ulsch_eNB[i]);
...@@ -2143,7 +2144,7 @@ void prach_procedures(PHY_VARS_eNB *phy_vars_eNB,uint8_t sched_subframe,uint8_t ...@@ -2143,7 +2144,7 @@ void prach_procedures(PHY_VARS_eNB *phy_vars_eNB,uint8_t sched_subframe,uint8_t
phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].UE_timing_offset = preamble_delay_list[preamble_max]&0x1FFF; //limit to 13 (=11+2) bits phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].UE_timing_offset = preamble_delay_list[preamble_max]&0x1FFF; //limit to 13 (=11+2) bits
phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].sector = 0; phy_vars_eNB->eNB_UE_stats[(uint32_t)UE_id].sector = 0;
LOG_D(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure (UE_id %d) with preamble %d, energy %d.%d dB, delay %d\n", LOG_E(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure (UE_id %d) with preamble %d, energy %d.%d dB, delay %d\n",
phy_vars_eNB->Mod_id, phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id, phy_vars_eNB->CC_id,
frame, frame,
...@@ -2944,7 +2945,18 @@ printf("PHY RX f/sf %d/%d sched_sf %d\n", frame, subframe, sched_subframe); ...@@ -2944,7 +2945,18 @@ printf("PHY RX f/sf %d/%d sched_sf %d\n", frame, subframe, sched_subframe);
#endif #endif
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->subframe_scheduling_flag=0; phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->subframe_scheduling_flag=0;
#if FAPI
/* a hack to report nice CQI all the time it's asked */
if (phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->Or1) {
int cqi_subband[13];
int k;
for (k = 0; k < 13; k++)
cqi_subband[k] = 15;
mac_xface->fapi_dl_cqi_report(phy_vars_eNB->Mod_id, phy_vars_eNB->ulsch_eNB[i]->rnti, frame, subframe, 15, cqi_subband, 0);
}
#endif
if (phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->cqi_crc_status == 1) { if (phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->cqi_crc_status == 1) {
fprintf(stderr, "extract CQI! Or1 = %d\n", phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->Or1);
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
//if (((phy_vars_eNB->proc[sched_subframe].frame_tx%10) == 0) || (phy_vars_eNB->proc[sched_subframe].frame_tx < 50)) //if (((phy_vars_eNB->proc[sched_subframe].frame_tx%10) == 0) || (phy_vars_eNB->proc[sched_subframe].frame_tx < 50))
print_CQI(phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o,phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->uci_format,0,phy_vars_eNB->lte_frame_parms.N_RB_DL); print_CQI(phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o,phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->uci_format,0,phy_vars_eNB->lte_frame_parms.N_RB_DL);
...@@ -2988,7 +3000,7 @@ printf("PHY RX f/sf %d/%d sched_sf %d\n", frame, subframe, sched_subframe); ...@@ -2988,7 +3000,7 @@ printf("PHY RX f/sf %d/%d sched_sf %d\n", frame, subframe, sched_subframe);
LOG_D(PHY,"[eNB][PUSCH %d] Increasing to round %d\n",harq_pid,phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->round); LOG_D(PHY,"[eNB][PUSCH %d] Increasing to round %d\n",harq_pid,phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->round);
if (phy_vars_eNB->ulsch_eNB[i]->Msg3_flag == 1) { if (phy_vars_eNB->ulsch_eNB[i]->Msg3_flag == 1) {
LOG_D(PHY,"[eNB %d/%d][RAPROC] frame %d, subframe %d, UE %d: Error receiving ULSCH (Msg3), round %d/%d\n", LOG_E(PHY,"[eNB %d/%d][RAPROC] frame %d, subframe %d, UE %d: Error receiving ULSCH (Msg3), round %d/%d\n",
phy_vars_eNB->Mod_id, phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id, phy_vars_eNB->CC_id,
frame,subframe, i, frame,subframe, i,
...@@ -3011,7 +3023,7 @@ printf("PHY RX f/sf %d/%d sched_sf %d\n", frame, subframe, sched_subframe); ...@@ -3011,7 +3023,7 @@ printf("PHY RX f/sf %d/%d sched_sf %d\n", frame, subframe, sched_subframe);
if (phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->round == if (phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->round ==
phy_vars_eNB->lte_frame_parms.maxHARQ_Msg3Tx) { phy_vars_eNB->lte_frame_parms.maxHARQ_Msg3Tx) {
LOG_D(PHY,"[eNB %d][RAPROC] maxHARQ_Msg3Tx reached, abandoning RA procedure for UE %d\n", LOG_E(PHY,"[eNB %d][RAPROC] maxHARQ_Msg3Tx reached, abandoning RA procedure for UE %d\n",
phy_vars_eNB->Mod_id, i); phy_vars_eNB->Mod_id, i);
phy_vars_eNB->eNB_UE_stats[i].mode = PRACH; phy_vars_eNB->eNB_UE_stats[i].mode = PRACH;
if (phy_vars_eNB->mac_enabled==1) { if (phy_vars_eNB->mac_enabled==1) {
...@@ -3259,6 +3271,17 @@ printf("PHY RX f/sf %d/%d sched_sf %d\n", frame, subframe, sched_subframe); ...@@ -3259,6 +3271,17 @@ printf("PHY RX f/sf %d/%d sched_sf %d\n", frame, subframe, sched_subframe);
0, 0,
0); 0);
LOG_I(PHY,"[eNB %d] Frame %d subframe %d, sect %d: received ULSCH harq_pid %d for UE %d, ret = %d, CQI CRC Status %d, ACK %d,%d, ulsch_errors %d/%d\n",
phy_vars_eNB->Mod_id,frame,subframe,
phy_vars_eNB->eNB_UE_stats[i].sector,
harq_pid,
i,
ret,
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->cqi_crc_status,
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o_ACK[0],
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->o_ACK[1],
phy_vars_eNB->eNB_UE_stats[i].ulsch_errors[harq_pid],
phy_vars_eNB->eNB_UE_stats[i].ulsch_decoding_attempts[harq_pid][0]);
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d] Frame %d subframe %d, sect %d: received ULSCH harq_pid %d for UE %d, ret = %d, CQI CRC Status %d, ACK %d,%d, ulsch_errors %d/%d\n", LOG_D(PHY,"[eNB %d] Frame %d subframe %d, sect %d: received ULSCH harq_pid %d for UE %d, ret = %d, CQI CRC Status %d, ACK %d,%d, ulsch_errors %d/%d\n",
phy_vars_eNB->Mod_id,frame,subframe, phy_vars_eNB->Mod_id,frame,subframe,
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
* \warning * \warning
*/ */
#include "T.h"
#include "assertions.h" #include "assertions.h"
#include "defs.h" #include "defs.h"
#include "PHY/defs.h" #include "PHY/defs.h"
...@@ -2690,6 +2692,10 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac ...@@ -2690,6 +2692,10 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
#endif #endif
#endif #endif
if (phy_vars_ue->mac_enabled == 1) { if (phy_vars_ue->mac_enabled == 1) {
T(T_UE_MAC_UE_DL_PDU_WITH_DATA, T_INT(phy_vars_ue->Mod_id), T_INT(phy_vars_ue->dlsch_ue[eNB_id][0]->rnti),
T_INT(frame_rx), T_INT(subframe_prev), T_INT(phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid),
T_BUFFER(phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->b,
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->TBS>>3));
mac_xface->ue_send_sdu(phy_vars_ue->Mod_id, mac_xface->ue_send_sdu(phy_vars_ue->Mod_id,
CC_id, CC_id,
frame_rx, frame_rx,
......
...@@ -63,6 +63,8 @@ ...@@ -63,6 +63,8 @@
# include "intertask_interface.h" # include "intertask_interface.h"
#endif #endif
#include "T.h"
#define ENABLE_MAC_PAYLOAD_DEBUG #define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1 #define DEBUG_eNB_SCHEDULER 1
//#define DEBUG_HEADER_PARSING 1 //#define DEBUG_HEADER_PARSING 1
...@@ -77,7 +79,6 @@ ...@@ -77,7 +79,6 @@
#if FAPI #if FAPI
/* global variables to deal with TPC command - we send one only once per frame maximum */ /* global variables to deal with TPC command - we send one only once per frame maximum */
...@@ -93,6 +94,12 @@ static void fapi_dl_tpc(int module_id, int CC_id, struct DlDciListElement_s *dci ...@@ -93,6 +94,12 @@ static void fapi_dl_tpc(int module_id, int CC_id, struct DlDciListElement_s *dci
int32_t target_rx_power; int32_t target_rx_power;
static int tpc_accumulated = 0; static int tpc_accumulated = 0;
if (UE_id == -1) {
printf("SCHEDULER fapi_dl_tpc rnti %x (%d) not existing in MAC\n", dci->rnti, dci->rnti);
dci->tpc = 0;
return;
}
if (UE_id == -1) { printf("%s:%d: rnti %x not found\n", __FILE__, __LINE__, dci->rnti); abort(); } if (UE_id == -1) { printf("%s:%d: rnti %x not found\n", __FILE__, __LINE__, dci->rnti); abort(); }
// this assumes accumulated tpc // this assumes accumulated tpc
...@@ -134,6 +141,12 @@ static void fapi_ul_tpc(int module_id, int CC_id, struct UlDciListElement_s *dci ...@@ -134,6 +141,12 @@ static void fapi_ul_tpc(int module_id, int CC_id, struct UlDciListElement_s *dci
int32_t target_rx_power; int32_t target_rx_power;
static int tpc_accumulated = 0; static int tpc_accumulated = 0;
if (UE_id == -1) {
printf("SCHEDULER fapi_ul_tpc rnti %x (%d) not existing in MAC\n", dci->rnti, dci->rnti);
dci->tpc = 0;
return;
}
if (UE_id == -1) { printf("%s:%d: rnti %x not found\n", __FILE__, __LINE__, dci->rnti); abort(); } if (UE_id == -1) { printf("%s:%d: rnti %x not found\n", __FILE__, __LINE__, dci->rnti); abort(); }
// this assumes accumulated tpc // this assumes accumulated tpc
...@@ -218,6 +231,12 @@ printf("GOT DOWNLINK ack %d for rnti %x harq_pid %d transport_block %d\n", ack, ...@@ -218,6 +231,12 @@ printf("GOT DOWNLINK ack %d for rnti %x harq_pid %d transport_block %d\n", ack,
fapi_dl_ack_nack_data.count++; fapi_dl_ack_nack_data.count++;
} }
/* this array is used to deal with Msg4 ack/nack
* once we get an ACK, the UE is considered configured
* if we get a NACK, we have to deal with retransmission of Msg4 (TODO)
*/
unsigned char waiting_for_msg4_ack[65536];
/* this function is called by the PHY to inform about correct or wrong /* this function is called by the PHY to inform about correct or wrong
* reception by the eNodeB of an uplink UE transmission * reception by the eNodeB of an uplink UE transmission
*/ */
...@@ -235,6 +254,27 @@ printf("GOT UPLINK ack %d for rnti %x harq_pid %d (f/sf %d/%d)\n", ack, rnti, ha ...@@ -235,6 +254,27 @@ printf("GOT UPLINK ack %d for rnti %x harq_pid %d (f/sf %d/%d)\n", ack, rnti, ha
fapi_ul_ack_nack_data[subframe].ack[pos].rnti = rnti; fapi_ul_ack_nack_data[subframe].ack[pos].rnti = rnti;
fapi_ul_ack_nack_data[subframe].ack[pos].ack = ack; fapi_ul_ack_nack_data[subframe].ack[pos].ack = ack;
if (waiting_for_msg4_ack[rnti] == 1) {
/* TODO: deal with module_id != 0, CC_id != 0 */
eNB_MAC_INST *eNB = &eNB_mac_inst[0 /*module_idP*/];
RA_TEMPLATE *RA_template;
int i, UE_id;
waiting_for_msg4_ack[rnti] = 0;
for (i = 0; i < NB_RA_PROC_MAX; i++) {
RA_template = (RA_TEMPLATE *)&eNB->common_channels[0 /* CC_id */].RA_template[i];
if (RA_template->RA_active != TRUE) continue;
if (RA_template->rnti != rnti) continue;
break;
}
if (i == NB_RA_PROC_MAX) { printf("%s:%d:%s: possible?\n", __FILE__, __LINE__, __FUNCTION__); abort(); }
RA_template->RA_active = FALSE;
RA_template->wait_ack_Msg4=0;
fprintf(stderr, "f/sf %d/%d got ack value %d for RA Msg4 for UE %d\n", frame, subframe, ack, rnti);
UE_id = find_UE_id(0 /*module_idP */,RA_template->rnti);
if (UE_id == -1) abort();
eNB_mac_inst[0 /* module_idP */].UE_list.UE_template[UE_PCCID(0 /* module_idP */,UE_id)][UE_id].configured=TRUE;
}
/* the values in length are set later in the function fapi_ul_lc_length */ /* the values in length are set later in the function fapi_ul_lc_length */
memset(fapi_ul_ack_nack_data[subframe].ack[pos].length, 0, sizeof(int) * MAX_LC_LIST+1); memset(fapi_ul_ack_nack_data[subframe].ack[pos].length, 0, sizeof(int) * MAX_LC_LIST+1);
...@@ -296,6 +336,9 @@ void fapi_dl_cqi_report(int module_id, int rnti, int frame, int subframe, int cq ...@@ -296,6 +336,9 @@ void fapi_dl_cqi_report(int module_id, int rnti, int frame, int subframe, int cq
params.nr_vendorSpecificList = 0; params.nr_vendorSpecificList = 0;
params.vendorSpecificList = NULL; params.vendorSpecificList = NULL;
fprintf(stderr, "fsf %d/%d CQI wideband %d rank_indication %d\n", frame, subframe, cqi_wideband, rank_indication);
for (i = 0; i < MAX_HL_SB; i++)
fprintf(stderr, " subband %d: %d\n", i, cqi_subband[i]);
SchedDlCqiInfoReq(fapi->sched, &params); SchedDlCqiInfoReq(fapi->sched, &params);
} }
...@@ -331,7 +374,7 @@ CONVERT_DL_1A_FDD(10); /* defines fapi_convert_dl_1A_10MHz_FDD */ ...@@ -331,7 +374,7 @@ CONVERT_DL_1A_FDD(10); /* defines fapi_convert_dl_1A_10MHz_FDD */
CONVERT_DL_1A_FDD(20); /* defines fapi_convert_dl_1A_20MHz_FDD */ CONVERT_DL_1A_FDD(20); /* defines fapi_convert_dl_1A_20MHz_FDD */
static uint32_t revert(uint32_t x, int len) static uint32_t revert(uint32_t x, int len)
{ {return x;
int i; int i;
int ret = 0; int ret = 0;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
...@@ -342,6 +385,8 @@ static uint32_t revert(uint32_t x, int len) ...@@ -342,6 +385,8 @@ static uint32_t revert(uint32_t x, int len)
return ret; return ret;
} }
int cqi_ready[65536];
#define CONVERT_DL_1_FDD(bandwidth) \ #define CONVERT_DL_1_FDD(bandwidth) \
static void fapi_convert_dl_1_ ## bandwidth ## MHz_FDD(struct DlDciListElement_s *dci, DCI_ALLOC_t *a) \ static void fapi_convert_dl_1_ ## bandwidth ## MHz_FDD(struct DlDciListElement_s *dci, DCI_ALLOC_t *a) \
{ \ { \
...@@ -380,6 +425,8 @@ static void fapi_convert_dl_dci(int module_id, int CC_id, ...@@ -380,6 +425,8 @@ static void fapi_convert_dl_dci(int module_id, int CC_id,
if (dci->rnti != 0) if (dci->rnti != 0)
fapi_dl_tpc(module_id, CC_id, dci); fapi_dl_tpc(module_id, CC_id, dci);
// if (dci->format == ONE && dci->resAlloc != 0) { printf("ERROR: resAlloc must be 0\n"); abort(); }
/* TODO: handle all bandwidths */ /* TODO: handle all bandwidths */
switch (PHY_vars_eNB_g[module_id][CC_id]->lte_frame_parms.N_RB_DL) { switch (PHY_vars_eNB_g[module_id][CC_id]->lte_frame_parms.N_RB_DL) {
case 25: case 25:
...@@ -435,6 +482,9 @@ static void fapi_convert_ul_ ## bandwidth ## MHz_FDD(module_id_t module_idP, int ...@@ -435,6 +482,9 @@ static void fapi_convert_ul_ ## bandwidth ## MHz_FDD(module_id_t module_idP, int
/* see openair1/PHY/LTE_TRANSPORT/dci_tools.c:generate_eNB_ulsch_params_from_dci */ \ /* see openair1/PHY/LTE_TRANSPORT/dci_tools.c:generate_eNB_ulsch_params_from_dci */ \
/* there is a translation between those */ \ /* there is a translation between those */ \
d->cqi_req = dci->cqiRequest; \ d->cqi_req = dci->cqiRequest; \
if (!cqi_ready[dci->rnti]) d->cqi_req = 0; \
d->cqi_req = 0; \
if (dci->cqiRequest) fprintf(stderr, "cqi req (ready %d) (d->cqi_req %d)!!\n", cqi_ready[dci->rnti], d->cqi_req); \
d->padding = 0; \ d->padding = 0; \
\ \
a->dci_length = sizeof_DCI0_ ## bandwidth ## MHz_FDD_t; \ a->dci_length = sizeof_DCI0_ ## bandwidth ## MHz_FDD_t; \
...@@ -452,6 +502,8 @@ static void fapi_convert_ul_dci(module_id_t module_idP, int CC_id, ...@@ -452,6 +502,8 @@ static void fapi_convert_ul_dci(module_id_t module_idP, int CC_id,
/* TODO: remove it if/when the scheduler does it */ /* TODO: remove it if/when the scheduler does it */
fapi_ul_tpc(module_idP, CC_id, dci); fapi_ul_tpc(module_idP, CC_id, dci);
if (dci->hopping != 0) { printf("ERROR: hopping must be 0\n"); abort(); }
/* TODO: handle all bandwidths */ /* TODO: handle all bandwidths */
switch (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RB_UL) { switch (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.N_RB_UL) {
case 25: fapi_convert_ul_5MHz_FDD(module_idP, CC_id, dci, a); break; case 25: fapi_convert_ul_5MHz_FDD(module_idP, CC_id, dci, a); break;
...@@ -468,6 +520,8 @@ static void fapi_convert_ul_dci(module_id_t module_idP, int CC_id, ...@@ -468,6 +520,8 @@ static void fapi_convert_ul_dci(module_id_t module_idP, int CC_id,
a->firstCCE = dci->cceIndex; a->firstCCE = dci->cceIndex;
a->ra_flag = 0; a->ra_flag = 0;
a->rnti = dci->rnti; a->rnti = dci->rnti;
printf("FAPI to MAC ul DCI ue %d rbStart %d rbLen %d tbs %d CCE %d mcs %d ndi %d tpc %d cshift %d cqi_req %d aggrLevel %d\n",
dci->rnti, dci->rbStart, dci->rbLen, dci->tbSize, dci->cceIndex, dci->mcs, dci->ndi, dci->tpc, dci->n2Dmrs, dci->cqiRequest, dci->aggrLevel);
} }
/* index 0 for SIB1, 1 for SIB23 */ /* index 0 for SIB1, 1 for SIB23 */
...@@ -521,6 +575,12 @@ static void fapi_schedule_RAR(int module_idP, int CC_id, frame_t frameP, ...@@ -521,6 +575,12 @@ static void fapi_schedule_RAR(int module_idP, int CC_id, frame_t frameP,
} }
if (i == NB_RA_PROC_MAX) { printf("%s:%d:%s: possible?\n", __FILE__, __LINE__, __FUNCTION__); abort(); } if (i == NB_RA_PROC_MAX) { printf("%s:%d:%s: possible?\n", __FILE__, __LINE__, __FUNCTION__); abort(); }
if (grant & 0x80000) {
LOG_E(MAC, "uplink grant has hopping flag set (0x%x)\n", grant);
exit(1);
grant &= ~0x80000;
}
RA_template->generate_rar = 1; RA_template->generate_rar = 1;
RA_template->UL_grant = grant; RA_template->UL_grant = grant;
...@@ -553,6 +613,7 @@ static void fapi_schedule_RA_Msg4(int module_idP, int CC_id, int RA, ...@@ -553,6 +613,7 @@ static void fapi_schedule_RA_Msg4(int module_idP, int CC_id, int RA,
RA_template = (RA_TEMPLATE *)&eNB->common_channels[CC_id].RA_template[RA]; RA_template = (RA_TEMPLATE *)&eNB->common_channels[CC_id].RA_template[RA];
UE_id = find_UE_id(module_idP,RA_template->rnti); UE_id = find_UE_id(module_idP,RA_template->rnti);
if (UE_id == -1) abort();
rrc_sdu_length = mac_rrc_data_req(module_idP, rrc_sdu_length = mac_rrc_data_req(module_idP,
CC_id, CC_id,
frameP, frameP,
...@@ -568,13 +629,15 @@ static void fapi_schedule_RA_Msg4(int module_idP, int CC_id, int RA, ...@@ -568,13 +629,15 @@ static void fapi_schedule_RA_Msg4(int module_idP, int CC_id, int RA,
} }
if (rrc_sdu_length > pdu_maxsize) { if (rrc_sdu_length > pdu_maxsize) {
LOG_E(MAC, "fapi_schedule_RA_Msg4: rrc_sdu_length (%d) > pdu_maxsize (%d)\n", rrc_sdu_length, pdu_maxsize); LOG_E(MAC, "fapi_schedule_RA_Msg4: rrc_sdu_length (%d) > pdu_maxsize (%d)\n", rrc_sdu_length, pdu_maxsize);
abort(); // abort();
} }
msg4_header_length = 1+6+1; // CR header, CR CE, SDU header msg4_header_length = 1+6+1; // CR header, CR CE, SDU header
TBsize = dci->tbsSize[CC_id] / 8; TBsize = dci->tbsSize[CC_id] / 8;
if (TBsize < msg4_header_length+rrc_sdu_length) abort();
if ((TBsize - rrc_sdu_length - msg4_header_length) <= 2) { if ((TBsize - rrc_sdu_length - msg4_header_length) <= 2) {
msg4_padding = TBsize - rrc_sdu_length - msg4_header_length; msg4_padding = TBsize - rrc_sdu_length - msg4_header_length;
msg4_post_padding = 0; msg4_post_padding = 0;
...@@ -583,7 +646,7 @@ static void fapi_schedule_RA_Msg4(int module_idP, int CC_id, int RA, ...@@ -583,7 +646,7 @@ static void fapi_schedule_RA_Msg4(int module_idP, int CC_id, int RA,
msg4_post_padding = TBsize - rrc_sdu_length - msg4_header_length -1; msg4_post_padding = TBsize - rrc_sdu_length - msg4_header_length -1;
} }
LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n", LOG_I(RRC,"[eNB %d][RAPROC] CC_id %d Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n",
module_idP, CC_id, frameP, subframeP, TBsize, rrc_sdu_length, msg4_header_length, msg4_padding, msg4_post_padding); module_idP, CC_id, frameP, subframeP, TBsize, rrc_sdu_length, msg4_header_length, msg4_padding, msg4_post_padding);
lcid = 0; lcid = 0;
...@@ -601,13 +664,18 @@ static void fapi_schedule_RA_Msg4(int module_idP, int CC_id, int RA, ...@@ -601,13 +664,18 @@ static void fapi_schedule_RA_Msg4(int module_idP, int CC_id, int RA,
&eNB->common_channels[CC_id].CCCH_pdu.payload[0], &eNB->common_channels[CC_id].CCCH_pdu.payload[0],
rrc_sdu_length); rrc_sdu_length);
T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(RA_template->rnti), T_INT(frameP), T_INT(subframeP),
T_INT(0), T_BUFFER(&eNB->UE_list.DLSCH_pdu[CC_id][0][UE_id].payload[0], TBsize));
RA_template->generate_Msg4=0; RA_template->generate_Msg4=0;
RA_template->wait_ack_Msg4=1; RA_template->wait_ack_Msg4=1;
RA_template->RA_active = FALSE; //RA_template->RA_active = FALSE;
/* we can increment Num_common_dci or Num_ue_spec_dci, there is no difference */ /* we can increment Num_common_dci or Num_ue_spec_dci, there is no difference */
dci_pdu->Num_common_dci++; dci_pdu->Num_common_dci++;
waiting_for_msg4_ack[RA_template->rnti] = 1;
fapi_convert_dl_dci(module_idP, CC_id, dci, a); fapi_convert_dl_dci(module_idP, CC_id, dci, a);
} }
...@@ -659,13 +727,17 @@ static void fapi_schedule_retransmission_ue(int module_id, int CC_id, int frame, ...@@ -659,13 +727,17 @@ static void fapi_schedule_retransmission_ue(int module_id, int CC_id, int frame,
fapi_convert_dl_dci(module_id, CC_id, &d->dci, a); fapi_convert_dl_dci(module_id, CC_id, &d->dci, a);
printf("RUN fapi_schedule_retransmission_ue\n"); printf("RUN fapi_schedule_retransmission_ue\n");
if (d->nr_rlcPDU_List[0] != 0) { printf("%s:%d:%s: error?\n", __FILE__, __LINE__, __FUNCTION__); abort(); } if (d->nr_rlcPDU_List[0] != 0) { printf("%s:%d:%s: error?\n", __FILE__, __LINE__, __FUNCTION__); /*abort();*/ }
if (d->nr_rlcPDU_List[1] != 0) { printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); abort(); } if (d->nr_rlcPDU_List[1] != 0) { printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); abort(); }
if (d->ceBitmap[0]) { printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); abort(); } if (d->ceBitmap[0]) { printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); abort(); }
if (d->ceBitmap[1]) { printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); abort(); } if (d->ceBitmap[1]) { printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); abort(); }
if (d->servCellIndex != 0) { printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); abort(); } if (d->servCellIndex != 0) { printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); abort(); }
UE_id = find_UE_id(module_id, d->rnti); UE_id = find_UE_id(module_id, d->rnti);
if (UE_id == -1) {
printf("SCHEDULER fapi_schedule_retransmission_ue rnti %x (%d) not existing in MAC\n", d->rnti, d->rnti);
abort();
}
add_ue_dlsch_info(module_id, add_ue_dlsch_info(module_id,
CC_id, CC_id,
...@@ -702,6 +774,8 @@ static void fapi_schedule_ue(int module_id, int CC_id, int frame, int subframe, ...@@ -702,6 +774,8 @@ static void fapi_schedule_ue(int module_id, int CC_id, int frame, int subframe,
return; return;
} }
if (d->nr_rlcPDU_List[0] != 1) { printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); return; }
/* generate DCI */ /* generate DCI */
if (dci_pdu->Num_common_dci >= NUM_DCI_MAX) { printf("%s:%d:%s: too much DCIs\n", __FILE__, __LINE__, __FUNCTION__); abort(); } if (dci_pdu->Num_common_dci >= NUM_DCI_MAX) { printf("%s:%d:%s: too much DCIs\n", __FILE__, __LINE__, __FUNCTION__); abort(); }
...@@ -738,12 +812,15 @@ printf("RUN fapi_schedule_ue\n"); ...@@ -738,12 +812,15 @@ printf("RUN fapi_schedule_ue\n");
d->rlcPduList[0][i].logicalChannelIdentity, d->rlcPduList[0][i].logicalChannelIdentity,
d->rlcPduList[0][i].size); d->rlcPduList[0][i].size);
printf("RLC_SIZE in fapi_schedule_ue %d (asked %d) lcid %d rnti %x f/sf %d/%d\n", rlc_status.bytes_in_buffer, d->rlcPduList[0][i].size, d->rlcPduList[0][i].logicalChannelIdentity, d->rnti, frame, subframe); printf("RLC_SIZE in fapi_schedule_ue %d (asked %d) lcid %d rnti %x f/sf %d/%d\n", rlc_status.bytes_in_buffer, d->rlcPduList[0][i].size, d->rlcPduList[0][i].logicalChannelIdentity, d->rnti, frame, subframe);
if (rlc_status.bytes_in_buffer <= 0) { printf("%s:%d:%s: error\n", __FILE__, __LINE__, __FUNCTION__); abort(); } if (rlc_status.bytes_in_buffer < 0) { printf("%s:%d:%s: error\n", __FILE__, __LINE__, __FUNCTION__); abort(); }
if (rlc_status.bytes_in_buffer > d->rlcPduList[0][i].size) abort(); /* that can't happen */ // if (rlc_status.bytes_in_buffer > d->rlcPduList[0][i].size) abort(); /* that can't happen */
if (dlsch_filled + d->rlcPduList[0][i].size > MAX_DLSCH_PAYLOAD_BYTES) { if (dlsch_filled + d->rlcPduList[0][i].size > MAX_DLSCH_PAYLOAD_BYTES) {
printf("dlsch buffer filled too much\n"); printf("dlsch buffer filled too much\n");
abort(); abort();
} }
if (d->rlcPduList[0][i].size == 2) {
printf("yo\n");
}
output_length = mac_rlc_data_req( output_length = mac_rlc_data_req(
module_id, module_id,
d->rnti, d->rnti,
...@@ -753,7 +830,11 @@ printf("RLC_SIZE in fapi_schedule_ue %d (asked %d) lcid %d rnti %x f/sf %d/%d\n" ...@@ -753,7 +830,11 @@ printf("RLC_SIZE in fapi_schedule_ue %d (asked %d) lcid %d rnti %x f/sf %d/%d\n"
MBMS_FLAG_NO, MBMS_FLAG_NO,
d->rlcPduList[0][i].logicalChannelIdentity, d->rlcPduList[0][i].logicalChannelIdentity,
(char *)&dlsch_buffer[dlsch_filled]); (char *)&dlsch_buffer[dlsch_filled]);
if (output_length <= 0 || output_length > d->rlcPduList[0][i].size) abort(); if (output_length == 0)
LOG_W(MAC, "FAPI f/sf %d/%d: RLC returned length 0 while asked %d for channel ID %d\n",
frame, subframe,
d->rlcPduList[0][i].size, d->rlcPduList[0][i].logicalChannelIdentity);
if (output_length < 0 || output_length > d->rlcPduList[0][i].size) abort();
d->rlcPduList[0][i].size = output_length; d->rlcPduList[0][i].size = output_length;
dlsch_filled += output_length; dlsch_filled += output_length;
sdu_lengths[num_sdus] = output_length; sdu_lengths[num_sdus] = output_length;
...@@ -784,6 +865,10 @@ printf("FILLED %d bytes\n", output_length); ...@@ -784,6 +865,10 @@ printf("FILLED %d bytes\n", output_length);
printf("PADDING_SIZE %d\n", padding_size); printf("PADDING_SIZE %d\n", padding_size);
UE_id = find_UE_id(module_id, d->rnti); UE_id = find_UE_id(module_id, d->rnti);
if (UE_id == -1) {
printf("SCHEDULER fapi_schedule_ue rnti %x (%d) not existing in MAC\n", d->rnti, d->rnti);
abort();
}
/* generate dlsch header */ /* generate dlsch header */
offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
...@@ -799,6 +884,9 @@ printf("PADDING_SIZE %d\n", padding_size); ...@@ -799,6 +884,9 @@ printf("PADDING_SIZE %d\n", padding_size);
/* fill payload */ /* fill payload */
memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset], dlsch_buffer, dlsch_filled); memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset], dlsch_buffer, dlsch_filled);
T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(d->rnti), T_INT(frame), T_INT(subframe),
T_INT(d->dci.harqProcess), T_BUFFER(UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], tbs));
add_ue_dlsch_info(module_id, add_ue_dlsch_info(module_id,
CC_id, CC_id,
UE_id, UE_id,
...@@ -854,8 +942,16 @@ static char *dci_format_to_string(DCI_format_t f) ...@@ -854,8 +942,16 @@ static char *dci_format_to_string(DCI_format_t f)
abort(); abort();
} }
static int next_frame = 0;
static int next_subframe = 0;
static pthread_mutex_t fmut = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t fcond = PTHREAD_COND_INITIALIZER;
void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP) //, int calibration_flag) { void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP) //, int calibration_flag) {
{ {
if (pthread_mutex_lock(&fmut)) abort();
int CC_id; int CC_id;
int i, j; int i, j;
DCI_PDU *DCI_pdu[MAX_NUM_CCs]; DCI_PDU *DCI_pdu[MAX_NUM_CCs];
...@@ -951,7 +1047,7 @@ printf("SCHEDULER called for f/sf %d/%d\n", frameP, subframeP); ...@@ -951,7 +1047,7 @@ printf("SCHEDULER called for f/sf %d/%d\n", frameP, subframeP);
memset(&rlc, 0, sizeof(rlc)); memset(&rlc, 0, sizeof(rlc));
rlc.rnti = eNB->common_channels[CC_id].RA_template[i].rnti; rlc.rnti = eNB->common_channels[CC_id].RA_template[i].rnti;
rlc.logicalChannelIdentity = CCCH; rlc.logicalChannelIdentity = CCCH;
rlc.rlcTransmissionQueueSize = mac_rrc_get_ccch_size(module_idP, CC_id); rlc.rlcTransmissionQueueSize = mac_rrc_get_ccch_size(module_idP, CC_id) + 1;
LOG_I(MAC, "calling SchedDlRlcBufferReq on CCCH rnti %x queue_size %d\n", rlc.rnti, rlc.rlcTransmissionQueueSize); LOG_I(MAC, "calling SchedDlRlcBufferReq on CCCH rnti %x queue_size %d\n", rlc.rnti, rlc.rlcTransmissionQueueSize);
printf("MAC to FAPI downlink BUF CCCH %d\n", rlc.rlcTransmissionQueueSize); printf("MAC to FAPI downlink BUF CCCH %d\n", rlc.rlcTransmissionQueueSize);
SchedDlRlcBufferReq(fapi->sched, &rlc); SchedDlRlcBufferReq(fapi->sched, &rlc);
...@@ -977,6 +1073,7 @@ printf("MAC to FAPI downlink BUF CCCH %d\n", rlc.rlcTransmissionQueueSize); ...@@ -977,6 +1073,7 @@ printf("MAC to FAPI downlink BUF CCCH %d\n", rlc.rlcTransmissionQueueSize);
rlc_status = mac_rlc_status_ind(module_idP, rlc.rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, 0); rlc_status = mac_rlc_status_ind(module_idP, rlc.rnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH, 0);
rlc.logicalChannelIdentity = DCCH; rlc.logicalChannelIdentity = DCCH;
rlc.rlcTransmissionQueueSize = rlc_status.bytes_in_buffer; rlc.rlcTransmissionQueueSize = rlc_status.bytes_in_buffer;
if (rlc.rlcTransmissionQueueSize == 2) rlc.rlcTransmissionQueueSize = 10;
LOG_I(MAC, "calling SchedDlRlcBufferReq on DCCH rnti %x queue_size %d\n", rlc.rnti, rlc_status.bytes_in_buffer); LOG_I(MAC, "calling SchedDlRlcBufferReq on DCCH rnti %x queue_size %d\n", rlc.rnti, rlc_status.bytes_in_buffer);
SchedDlRlcBufferReq(fapi->sched, &rlc); SchedDlRlcBufferReq(fapi->sched, &rlc);
printf("MAC to FAPI downlink BUF DCCH %d\n", rlc_status.bytes_in_buffer); printf("MAC to FAPI downlink BUF DCCH %d\n", rlc_status.bytes_in_buffer);
...@@ -1050,7 +1147,7 @@ printf("FAPI to MAC downlink schedule ue %x channel %d f/sf %d/%d\n", dlind.buil ...@@ -1050,7 +1147,7 @@ printf("FAPI to MAC downlink schedule ue %x channel %d f/sf %d/%d\n", dlind.buil
break; break;
} }
} }
if (j == NB_RA_PROC_MAX) { printf("%s:%d:%s: possible?\n", __FILE__, __LINE__, __FUNCTION__); abort(); } if (j == NB_RA_PROC_MAX) { printf("%s:%d:%s: possible?\n", __FILE__, __LINE__, __FUNCTION__); /*abort();*/ }
break; break;
case 1: /* DCCH (SRB1) */ case 1: /* DCCH (SRB1) */
case 2: /* DCCH+1 (SRB2) */ case 2: /* DCCH+1 (SRB2) */
...@@ -1066,6 +1163,7 @@ printf("FAPI to MAC downlink schedule ue %x channel %d f/sf %d/%d\n", dlind.buil ...@@ -1066,6 +1163,7 @@ printf("FAPI to MAC downlink schedule ue %x channel %d f/sf %d/%d\n", dlind.buil
if (dlind.nr_buildRARList != 1) { printf("%s:%d: more than 1 RAR, todo\n", __FUNCTION__, __LINE__); exit(0); } if (dlind.nr_buildRARList != 1) { printf("%s:%d: more than 1 RAR, todo\n", __FUNCTION__, __LINE__); exit(0); }
if (dlind.buildRarList[0].carrierIndex != 0) { printf("%s:%d: 2nd CC: todo properly\n", __FUNCTION__, __LINE__); exit(0); } if (dlind.buildRarList[0].carrierIndex != 0) { printf("%s:%d: 2nd CC: todo properly\n", __FUNCTION__, __LINE__); exit(0); }
printf("FAPI to MAC downlink schedule RAR ue %x f/sf %d/%d\n", dlind.buildRarList[0].rnti, frameP, subframeP); printf("FAPI to MAC downlink schedule RAR ue %x f/sf %d/%d\n", dlind.buildRarList[0].rnti, frameP, subframeP);
dlind.buildRarList[0].grant &= ~1;
fapi_schedule_RAR(module_idP, dlind.buildRarList[0].carrierIndex, frameP, subframeP, fapi_schedule_RAR(module_idP, dlind.buildRarList[0].carrierIndex, frameP, subframeP,
dlind.buildRarList[0].rnti, dlind.buildRarList[0].grant, &dlind.buildRarList[0].dci); dlind.buildRarList[0].rnti, dlind.buildRarList[0].grant, &dlind.buildRarList[0].dci);
} }
...@@ -1114,7 +1212,7 @@ printf("FAPI to MAC downlink DCI_pdu[%d]->num_pdcch_symbols %d f/sf %d/%d\n", cc ...@@ -1114,7 +1212,7 @@ printf("FAPI to MAC downlink DCI_pdu[%d]->num_pdcch_symbols %d f/sf %d/%d\n", cc
ulreq.nr_ulInfoList = fapi_ul_ack_nack_data[ulsf].count; ulreq.nr_ulInfoList = fapi_ul_ack_nack_data[ulsf].count;
ulreq.ulInfoList = ulinfo; ulreq.ulInfoList = ulinfo;
for (i = 0; i < ulreq.nr_ulInfoList; i++) { for (i = 0; i < ulreq.nr_ulInfoList; i++) {
printf("MAC to FAPI uplink acknack ue %x f/sf %d/%d ulsf %d [reception_subframe %d] ack %d\n", fapi_ul_ack_nack_data[ulsf].ack[i].rnti, frameP, subframeP, ulsf, fapi_ul_ack_nack_data[ulsf].ack[i].reception_subframe, fapi_ul_ack_nack_data[ulsf].ack[i].ack); printf("MAC to FAPI uplink acknack ue %x f/sf %d/%d ulsf %d [reception frame/subframe %d/%d] ack %d\n", fapi_ul_ack_nack_data[ulsf].ack[i].rnti, frameP, subframeP, ulsf, fapi_ul_ack_nack_data[ulsf].ack[i].reception_frame, fapi_ul_ack_nack_data[ulsf].ack[i].reception_subframe, fapi_ul_ack_nack_data[ulsf].ack[i].ack);
ulinfo[i].puschTransmissionTimestamp = fapi_ul_ack_nack_data[ulsf].ack[i].reception_frame * 16 ulinfo[i].puschTransmissionTimestamp = fapi_ul_ack_nack_data[ulsf].ack[i].reception_frame * 16
+ fapi_ul_ack_nack_data[ulsf].ack[i].reception_subframe; + fapi_ul_ack_nack_data[ulsf].ack[i].reception_subframe;
ulinfo[i].rnti = fapi_ul_ack_nack_data[ulsf].ack[i].rnti; ulinfo[i].rnti = fapi_ul_ack_nack_data[ulsf].ack[i].rnti;
...@@ -1135,6 +1233,18 @@ printf("MAC to FAPI uplink ue %x f/sf %d/%d lcid %d size acked %d\n", fapi_ul_ac ...@@ -1135,6 +1233,18 @@ printf("MAC to FAPI uplink ue %x f/sf %d/%d lcid %d size acked %d\n", fapi_ul_ac
LOG_I(MAC, "calling SchedUlConfigInd\n"); LOG_I(MAC, "calling SchedUlConfigInd\n");
SchedUlConfigInd(fapi, &ulind); SchedUlConfigInd(fapi, &ulind);
/* a hack to report nice CQI all the time it's asked */
for (i = 0; i < ulind.nr_dciList; i++) {
struct UlDciListElement_s *dci = &ulind.dciList[i];
if (dci->cqiRequest) {
int cqi_subband[13];
int k;
for (k = 0; k < 13; k++)
cqi_subband[k] = 14;
fapi_dl_cqi_report(0, dci->rnti, frameP + (subframeP > 6 ? 1 : 0), (subframeP + 4) % 10, 14, cqi_subband, 0);
}
}
printf("FAPI to MAC uplink nr_dclList %d nr_phichList %d\n", ulind.nr_dciList, ulind.nr_phichList); printf("FAPI to MAC uplink nr_dclList %d nr_phichList %d\n", ulind.nr_dciList, ulind.nr_phichList);
for (i = 0; i < ulind.nr_dciList; i++) { for (i = 0; i < ulind.nr_dciList; i++) {
/* TODO: get the right CC_id from servCellIndex, depending on the UE rnti/pcell/scell settings */ /* TODO: get the right CC_id from servCellIndex, depending on the UE rnti/pcell/scell settings */
...@@ -1159,6 +1269,9 @@ printf(" RECAP %i rnti %x %s\n", i, ...@@ -1159,6 +1269,9 @@ printf(" RECAP %i rnti %x %s\n", i,
} }
global_subframe++; global_subframe++;
if (pthread_mutex_unlock(&fmut)) abort();
} }
#else /* FAPI */ #else /* FAPI */
......
...@@ -1180,7 +1180,8 @@ void SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, rnti_t rntiP ...@@ -1180,7 +1180,8 @@ void SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, rnti_t rntiP
UE_id = find_UE_id(mod_idP, rntiP); UE_id = find_UE_id(mod_idP, rntiP);
if (UE_id == -1) { if (UE_id == -1) {
LOG_E(MAC, "%s:%d:%s: rnti %x: no such UE\n", __FILE__, __LINE__, __FUNCTION__, rntiP); LOG_E(MAC, "%s:%d:%s: rnti %x: no such UE\n", __FILE__, __LINE__, __FUNCTION__, rntiP);
abort(); return;
//abort();
} }
fapi = eNB_mac_inst[mod_idP].fapi; fapi = eNB_mac_inst[mod_idP].fapi;
......
...@@ -326,7 +326,7 @@ rlc_am_get_pdus ( ...@@ -326,7 +326,7 @@ rlc_am_get_pdus (
case RLC_DATA_TRANSFER_READY_STATE: case RLC_DATA_TRANSFER_READY_STATE:
// TRY TO SEND CONTROL PDU FIRST // TRY TO SEND CONTROL PDU FIRST
if ((rlc_pP->nb_bytes_requested_by_mac > 2) && (rlc_pP->status_requested)) { if ((rlc_pP->nb_bytes_requested_by_mac >= 2) && (rlc_pP->status_requested)) {
// When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall: // When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall:
// - if t-StatusProhibit is not running: // - if t-StatusProhibit is not running:
// - at the first transmission opportunity indicated by lower layer, construct a STATUS PDU and deliver it to lower layer; // - at the first transmission opportunity indicated by lower layer, construct a STATUS PDU and deliver it to lower layer;
......
...@@ -653,6 +653,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment( ...@@ -653,6 +653,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
// fill the segment pdu_p with Lis and data // fill the segment pdu_p with Lis and data
//--------------------------------------------------------------- //---------------------------------------------------------------
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] fill the segment pdu_p with Lis and data, test_num_li %d\n", LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] fill the segment pdu_p with Lis and data, test_num_li %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
test_num_li); test_num_li);
if (test_num_li > 0) { if (test_num_li > 0) {
......
...@@ -3445,6 +3445,9 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ...@@ -3445,6 +3445,9 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
#ifdef FAPI
extern int cqi_ready[65536]; cqi_ready[ctxt_pP->rnti] = 1;
#endif
int i; int i;
#ifdef PDCP_USE_NETLINK #ifdef PDCP_USE_NETLINK
int oip_ifup = 0; int oip_ifup = 0;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <nettle/nettle-meta.h> #include <nettle/nettle-meta.h>
#include <nettle/aes.h> #include <nettle/aes.h>
#include <nettle/ctr.h> #include <nettle/ctr.h>
//#include <nettle/version.h>
#include "UTIL/LOG/log.h" #include "UTIL/LOG/log.h"
...@@ -199,8 +200,12 @@ int stream_encrypt_eea2(stream_cipher_t *stream_cipher, uint8_t **out) ...@@ -199,8 +200,12 @@ int stream_encrypt_eea2(stream_cipher_t *stream_cipher, uint8_t **out)
} }
#endif #endif
#if NETTLE_VERSION_MAJOR >= 3
nettle_aes128.set_encrypt_key(ctx, stream_cipher->key);
#else
nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length, nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length,
stream_cipher->key); stream_cipher->key);
#endif
nettle_ctr_crypt(ctx, nettle_aes128.encrypt, nettle_ctr_crypt(ctx, nettle_aes128.encrypt,
nettle_aes128.block_size, m, nettle_aes128.block_size, m,
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <nettle/nettle-meta.h> #include <nettle/nettle-meta.h>
#include <nettle/aes.h> #include <nettle/aes.h>
#include <nettle/ctr.h> #include <nettle/ctr.h>
//#include <nettle/version.h>
#include "assertions.h" #include "assertions.h"
#include "conversions.h" #include "conversions.h"
...@@ -85,8 +86,12 @@ int nas_stream_encrypt_eea2(nas_stream_cipher_t *stream_cipher, uint8_t *out) ...@@ -85,8 +86,12 @@ int nas_stream_encrypt_eea2(nas_stream_cipher_t *stream_cipher, uint8_t *out)
} }
#endif #endif
#if NETTLE_VERSION_MAJOR >= 3
nettle_aes128.set_encrypt_key(ctx, stream_cipher->key);
#else
nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length, nettle_aes128.set_encrypt_key(ctx, stream_cipher->key_length,
stream_cipher->key); stream_cipher->key);
#endif
nettle_ctr_crypt(ctx, nettle_aes128.encrypt, nettle_ctr_crypt(ctx, nettle_aes128.encrypt,
nettle_aes128.block_size, m, nettle_aes128.block_size, m,
......
...@@ -172,6 +172,7 @@ static void trx_usrp_end(openair0_device *device) ...@@ -172,6 +172,7 @@ static void trx_usrp_end(openair0_device *device)
*/ */
static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags)
{ {
int ret;
usrp_state_t *s = (usrp_state_t*)device->priv; usrp_state_t *s = (usrp_state_t*)device->priv;
s->tx_md.time_spec = uhd::time_spec_t::from_ticks(timestamp, s->sample_rate); s->tx_md.time_spec = uhd::time_spec_t::from_ticks(timestamp, s->sample_rate);
if(flags) if(flags)
...@@ -182,13 +183,13 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, ...@@ -182,13 +183,13 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
if (cc>1) { if (cc>1) {
std::vector<void *> buff_ptrs; std::vector<void *> buff_ptrs;
for (int i=0;i<cc;i++) buff_ptrs.push_back(buff[i]); for (int i=0;i<cc;i++) buff_ptrs.push_back(buff[i]);
s->tx_stream->send(buff_ptrs, nsamps, s->tx_md); ret = s->tx_stream->send(buff_ptrs, nsamps, s->tx_md);
} }
else else
s->tx_stream->send(buff[0], nsamps, s->tx_md); ret = s->tx_stream->send(buff[0], nsamps, s->tx_md);
s->tx_md.start_of_burst = false; s->tx_md.start_of_burst = false;
return 0; return ret;
} }
/*! \brief Receive samples from hardware. /*! \brief Receive samples from hardware.
......
...@@ -52,7 +52,7 @@ eNBs = ...@@ -52,7 +52,7 @@ eNBs =
pusch_n_SB = 1; pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE"; pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame"; pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0; pusch_hoppingOffset = 1;
pusch_groupHoppingEnabled = "ENABLE"; pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0; pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE"; pusch_sequenceHoppingEnabled = "DISABLE";
...@@ -65,7 +65,7 @@ eNBs = ...@@ -65,7 +65,7 @@ eNBs =
srs_ackNackST =; srs_ackNackST =;
srs_MaxUpPts =;*/ srs_MaxUpPts =;*/
pusch_p0_Nominal = -108; pusch_p0_Nominal = -90; //-108;
pusch_alpha = "AL1"; pusch_alpha = "AL1";
pucch_p0_Nominal = -96; //-108; pucch_p0_Nominal = -96; //-108;
msg3_delta_Preamble = 6; msg3_delta_Preamble = 6;
......
...@@ -2210,6 +2210,7 @@ static void* eNB_thread( void* arg ) ...@@ -2210,6 +2210,7 @@ static void* eNB_thread( void* arg )
#endif #endif
/* TODO: is it the right place for master tick? */ /* TODO: is it the right place for master tick? */
T(T_ENB_MASTER_TICK, T_INT(0), T_INT(frame % 1024), T_INT(sf)); T(T_ENB_MASTER_TICK, T_INT(0), T_INT(frame % 1024), T_INT(sf));
#if 0
if (frame>50) { if (frame>50) {
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
#ifdef EXMIMO #ifdef EXMIMO
...@@ -2258,6 +2259,38 @@ static void* eNB_thread( void* arg ) ...@@ -2258,6 +2259,38 @@ static void* eNB_thread( void* arg )
} }
} }
} }
#endif
/* do TX */
int CC_id;
for (CC_id=0; CC_id < MAX_NUM_CCs; CC_id++) {
eNB_proc_t *proc = &PHY_vars_eNB_g[0][CC_id]->proc[sf];
// printf("call phy_procedures_eNB_TX CC_id %d sf %d %lu\n", proc->CC_id, sf, daclock());
phy_procedures_eNB_TX( proc->subframe, PHY_vars_eNB_g[0][proc->CC_id], 0, no_relay, NULL );
// printf("done phy_procedures_eNB_TX CC_id %d sf %d %lu\n", proc->CC_id, sf, daclock());
// printf("call do_OFDM_mod_rt CC_id %d sf %d %ld\n", proc->CC_id, sf, daclock());
do_OFDM_mod_rt( proc->subframe_tx, PHY_vars_eNB_g[0][proc->CC_id] );
// printf("done do_OFDM_mod_rt CC_id %d sf %d %ld\n", proc->CC_id, sf, daclock());
proc->frame_tx++;
if (proc->frame_tx==1024)
proc->frame_tx=0;
}
/* do RX */
for (CC_id=0; CC_id < MAX_NUM_CCs; CC_id++) {
if (CC_id != 0) continue;
eNB_proc_t *proc = &PHY_vars_eNB_g[0][CC_id]->proc[sf];
// printf("call phy_procedures_eNB_RX CC_id %d sf %d %lu\n", proc->CC_id, sf, daclock());
phy_procedures_eNB_RX( proc->subframe, PHY_vars_eNB_g[0][proc->CC_id], 0, no_relay );
if ((subframe_select(&PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms,proc->subframe_rx) == SF_S)) {
phy_procedures_eNB_S_RX( proc->subframe, PHY_vars_eNB_g[0][proc->CC_id], 0, no_relay );
}
// printf("done phy_procedures_eNB_RX CC_id %d sf %d %lu\n", proc->CC_id, sf, daclock());
proc->frame_rx++;
if (proc->frame_rx==1024)
proc->frame_rx=0;
}
} }
#ifdef EXMIMO #ifdef EXMIMO
...@@ -3747,6 +3780,8 @@ int main( int argc, char **argv ) ...@@ -3747,6 +3780,8 @@ int main( int argc, char **argv )
#ifdef RTAI #ifdef RTAI
main_eNB_thread = rt_thread_create(eNB_thread, NULL, PTHREAD_STACK_MIN); main_eNB_thread = rt_thread_create(eNB_thread, NULL, PTHREAD_STACK_MIN);
#else #else
if (pthread_attr_setstacksize( &attr_dlsch_threads, 1024*PTHREAD_STACK_MIN ) != 0) abort();
error_code = pthread_create( &main_eNB_thread, &attr_dlsch_threads, eNB_thread, NULL ); error_code = pthread_create( &main_eNB_thread, &attr_dlsch_threads, eNB_thread, NULL );
if (error_code!= 0) { if (error_code!= 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment