Commit 34057af7 authored by 黄灏's avatar 黄灏

DPDKRF

parent f7c7f0be
......@@ -472,6 +472,15 @@ target_link_libraries(params_libconfig PRIVATE ${libconfig_LIBRARIES})
add_library(shlib_loader OBJECT common/utils/load_module_shlib.c)
target_link_libraries(shlib_loader PRIVATE CONFIG_LIB)
include_directories("${OPENAIR_DIR}/radio/DPDKRF/")
set(HWLIB_DPDKRF_SOURCE
${OPENAIR_DIR}/radio/DPDKRF/dpdkrf_oai.c
)
add_library(oai_dpdkrfdevif MODULE ${HWLIB_DPDKRF_SOURCE} )
target_link_libraries(oai_dpdkrfdevif dpdkrf)
##########################################################
# LDPC offload library
......
......@@ -272,7 +272,7 @@ function main() {
shift;;
-w | --hardware)
case "$2" in
"USRP" | "BLADERF" | "LMSSDR" | "IRIS")
"USRP" | "BLADERF" | "LMSSDR" | "IRIS" | "DPDKRF")
HW="OAI_"$2
TARGET_LIST="$TARGET_LIST oai_${2,,}devif" # ,, makes lowercase
CMAKE_CMD="$CMAKE_CMD -DOAI_$2=ON"
......@@ -552,6 +552,20 @@ function main() {
echo_success "BUILD SHOULD BE SUCCESSFUL"
fi
if [ "$HW" == "OAI_DPDKRF" ] ; then
if [ ! -f "/usr/local/include/dpdkrf_lib.h" ] ; then
sudo cp $THIS_SCRIPT_PATH/../radio/DPDKRF/dpdkrf_lib.h /usr/local/include/dpdkrf_lib.h
sudo cp $THIS_SCRIPT_PATH/../radio/DPDKRF/libdpdkrf.so /usr/local/lib/libdpdkrf.so
sudo chmod +x /usr/local/lib/libdpdkrf.so
sudo ldconfig /usr/local/lib
fi
compilations $BUILD_DIR oai_dpdkrfdevif.txt oai_dpdkrfdevif
ln -sf liboai_dpdkrfdevif.so liboai_device.so
echo_info "liboai_device.so is linked to DPDKRF device library"
fi
}
main "$@"
......@@ -55,16 +55,16 @@ void *gnbSendToManager_task(void *args_p)
{
sem_wait(&gnbSendToManager_sem);
printf("message_flag %d\n", message_flag);
// printf("message_flag %d\n", message_flag);
if (message_flag == 1){
printf("data_len %d\n", sim_rrc_signaling_socket.data_len);
//printf("data_len %d\n", sim_rrc_signaling_socket.data_len);
send_len = write(sockfd, &sim_rrc_signaling_socket, GNBSENDTOMANAGER_MAX_RRC_SIGNALING_LEN);
}
else if (message_flag == 2){
send_len = write(sockfd, &sim_socket_manager, GNBSENDTOMANAGER_MAX_RE_SCHDULE_LEN);
}
printf("send_len=%d\n", send_len);
//printf("send_len=%d\n", send_len);
}
close(sockfd);
......
......@@ -247,7 +247,7 @@
#ifdef BIT8_TX
#define AMP_SHIFT 7
#else
#define AMP_SHIFT 9
#define AMP_SHIFT 11
#endif
#define AMP ((1)<<AMP_SHIFT)
......
......@@ -1940,7 +1940,7 @@ int get_nr_prach_info_from_index(uint8_t index,
if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1)
format2 = (uint8_t) table_6_3_3_2_3_prachConfig_Index[index][1];
*format = ((uint8_t) table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2<<8);
LOG_I(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %lu) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u \n", frame,
LOG_D(MAC,"Frame %d slot %d: Getting PRACH info from index %d (col 6 %lu) absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_slot %u RA_sfn_index %u \n", frame,
slot,
index, table_6_3_3_2_3_prachConfig_Index[index][6],
pointa,
......
......@@ -217,14 +217,14 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_
sim_socket_manager.slot = slot;
sim_socket_manager.frame = frame;
// sim_socket_manager.acknack_frame = sim_socket_manager.acknack_slot
LOG_I(NR_MAC, "frame %d slot %d\n", sim_socket_manager.frame, sim_socket_manager.slot);
//LOG_I(NR_MAC, "frame %d slot %d\n", sim_socket_manager.frame, sim_socket_manager.slot);
// if (RC.nrmac[module_idP]->UE_info.list[0]){
// sim_socket_manager.dl_recv_bytes = RC.nrmac[module_idP]->UE_info.list[0]->mac_stats.dl.total_bytes;
// sim_socket_manager.ul_recv_bytes = RC.nrmac[module_idP]->UE_info.list[0]->mac_stats.ul.total_bytes;
// }
}
if ((slot == 0) && (frame & 100) == 0) {
if ((slot == 0) && (frame & 127) == 0) {
char stats_output[16000] = {0};
dump_mac_stats(gNB, stats_output, sizeof(stats_output), true);
LOG_I(NR_MAC, "Frame.Slot %d.%d\n%s\n", frame, slot, stats_output);
......@@ -301,24 +301,24 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_
sim_socket_manager.data_len = sizeof(sim_socket_t);
sim_socket_manager.message = 2;
// gnbSendToManager_len = sim_socket_manager.data_len;
printf("data_len %d\n", sim_socket_manager.data_len);
printf("[%d.%d] measurement_flag %x prach_sched_flag %x dl_sched_flag %x ul_sched_flag %x msg1 %d.%d msg2 %d.%d msg3 %d.%d msg4 %d.%d pdcch %d.%d pdsch %d.%d "
"csirs %d.%d ulsch %d.%d acknack %d.%d csi_report %d.%d sr %d.%d srs %d.%d\n",
sim_socket_manager.frame, sim_socket_manager.slot,
sim_socket_manager.measurement_flag, sim_socket_manager.prach_sched_flag,sim_socket_manager.dl_sched_flag, sim_socket_manager.ul_sched_flag,
sim_socket_manager.msg1_frame, sim_socket_manager.msg1_slot,sim_socket_manager.msg2_frame, sim_socket_manager.msg2_slot,
sim_socket_manager.msg3_frame, sim_socket_manager.msg3_slot, sim_socket_manager.msg4_frame, sim_socket_manager.msg4_slot,
sim_socket_manager.pdcch_frame, sim_socket_manager.pdcch_slot, sim_socket_manager.pdsch_frame, sim_socket_manager.pdsch_slot,
sim_socket_manager.csirs_frame, sim_socket_manager.csirs_slot,
sim_socket_manager.ulsch_frame, sim_socket_manager.ulsch_slot, sim_socket_manager.acknack_frame, sim_socket_manager.acknack_slot,
sim_socket_manager.csi_report_frame, sim_socket_manager.csi_report_slot, sim_socket_manager.sr_frame, sim_socket_manager.sr_slot,
sim_socket_manager.srs_frame, sim_socket_manager.srs_slot);
printf("%d.%d: dl_recv_bytes %dbytes, ul_recv_bytes %dbytes, dl_mcs %d, ul_mcs %d, dl_bler %d, ul_bler %d, pucch_snr %ddB, pusch_snr %ddB, rsrp %ddBm\n",
sim_socket_manager.frame, sim_socket_manager.slot,
(sim_socket_manager.dl_recv_bytes_high16<<16)+sim_socket_manager.dl_recv_bytes_low16,
(sim_socket_manager.ul_recv_bytes_high16<<16)+sim_socket_manager.ul_recv_bytes_low16,
sim_socket_manager.dl_mcs, sim_socket_manager.ul_mcs, sim_socket_manager.dl_bler,sim_socket_manager.ul_bler, sim_socket_manager.pucch_snr,
sim_socket_manager.pusch_snr,sim_socket_manager.rsrp);
//printf("data_len %d\n", sim_socket_manager.data_len);
// printf("[%d.%d] measurement_flag %x prach_sched_flag %x dl_sched_flag %x ul_sched_flag %x msg1 %d.%d msg2 %d.%d msg3 %d.%d msg4 %d.%d pdcch %d.%d pdsch %d.%d "
// "csirs %d.%d ulsch %d.%d acknack %d.%d csi_report %d.%d sr %d.%d srs %d.%d\n",
// sim_socket_manager.frame, sim_socket_manager.slot,
// sim_socket_manager.measurement_flag, sim_socket_manager.prach_sched_flag,sim_socket_manager.dl_sched_flag, sim_socket_manager.ul_sched_flag,
// sim_socket_manager.msg1_frame, sim_socket_manager.msg1_slot,sim_socket_manager.msg2_frame, sim_socket_manager.msg2_slot,
// sim_socket_manager.msg3_frame, sim_socket_manager.msg3_slot, sim_socket_manager.msg4_frame, sim_socket_manager.msg4_slot,
// sim_socket_manager.pdcch_frame, sim_socket_manager.pdcch_slot, sim_socket_manager.pdsch_frame, sim_socket_manager.pdsch_slot,
// sim_socket_manager.csirs_frame, sim_socket_manager.csirs_slot,
// sim_socket_manager.ulsch_frame, sim_socket_manager.ulsch_slot, sim_socket_manager.acknack_frame, sim_socket_manager.acknack_slot,
// sim_socket_manager.csi_report_frame, sim_socket_manager.csi_report_slot, sim_socket_manager.sr_frame, sim_socket_manager.sr_slot,
// sim_socket_manager.srs_frame, sim_socket_manager.srs_slot);
// printf("%d.%d: dl_recv_bytes %dbytes, ul_recv_bytes %dbytes, dl_mcs %d, ul_mcs %d, dl_bler %d, ul_bler %d, pucch_snr %ddB, pusch_snr %ddB, rsrp %ddBm\n",
// sim_socket_manager.frame, sim_socket_manager.slot,
// (sim_socket_manager.dl_recv_bytes_high16<<16)+sim_socket_manager.dl_recv_bytes_low16,
// (sim_socket_manager.ul_recv_bytes_high16<<16)+sim_socket_manager.ul_recv_bytes_low16,
// sim_socket_manager.dl_mcs, sim_socket_manager.ul_mcs, sim_socket_manager.dl_bler,sim_socket_manager.ul_bler, sim_socket_manager.pucch_snr,
// sim_socket_manager.pusch_snr,sim_socket_manager.rsrp);
pthread_mutex_unlock(&sim_mutex_socket);
sem_post(&gnbSendToManager_sem);
}
......
......@@ -344,7 +344,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP
sim_socket_manager.msg1_frame = frameP;
sim_socket_manager.msg1_slot = slotP;
sim_socket_manager.prach_sched_flag |= 0x01;
LOG_I(NR_MAC, "Frame %d, Slot %d: Prach Occasion id = %u fdm index = %u start symbol = %u slot index = %u subframe index = %u \n",
LOG_D(NR_MAC, "Frame %d, Slot %d: Prach Occasion id = %u fdm index = %u start symbol = %u slot index = %u subframe index = %u \n",
frameP, slotP,
prach_occasion_id, prach_pdu->num_ra,
prach_pdu->prach_start_symbol,
......@@ -688,18 +688,18 @@ void nr_initiate_ra_proc(module_id_t module_idP,
ra->preamble_index = preamble_index;
ra->beam_id = cc->ssb_index[beam_index];
LOG_I(NR_MAC,
"[gNB %d][RAPROC] CC_id %d Frame %d Activating Msg2 generation in frame %d, slot %d using RA rnti %x SSB, new rnti %04x "
"index %u RA index %d\n",
module_idP,
CC_id,
frameP,
ra->Msg2_frame,
ra->Msg2_slot,
ra->RA_rnti,
ra->rnti,
cc->ssb_index[beam_index],
i);
// LOG_D(NR_MAC,
// "[gNB %d][RAPROC] CC_id %d Frame %d Activating Msg2 generation in frame %d, slot %d using RA rnti %x SSB, new rnti %04x "
// "index %u RA index %d\n",
// module_idP,
// CC_id,
// frameP,
// ra->Msg2_frame,
// ra->Msg2_slot,
// ra->RA_rnti,
// ra->rnti,
// cc->ssb_index[beam_index],
// i);
NR_SCHED_UNLOCK(&nr_mac->sched_lock);
return;
......@@ -770,8 +770,8 @@ static void nr_generate_Msg3_retransmission(module_id_t module_idP,
return;
}
LOG_I(NR_MAC, "[gNB %d][RAPROC] Frame %d, Slot %d : CC_id %d Scheduling retransmission of Msg3 in (%d,%d)\n",
module_idP, frame, slot, CC_id, sched_frame, sched_slot);
// LOG_D(NR_MAC, "[gNB %d][RAPROC] Frame %d, Slot %d : CC_id %d Scheduling retransmission of Msg3 in (%d,%d)\n",
// module_idP, frame, slot, CC_id, sched_frame, sched_slot);
buffer_index = ul_buffer_index(sched_frame, sched_slot, mu, nr_mac->UL_tti_req_ahead_size);
nfapi_nr_ul_tti_request_t *future_ul_tti_req = &nr_mac->UL_tti_req_ahead[CC_id][buffer_index];
......@@ -933,8 +933,8 @@ static void nr_get_Msg3alloc(module_id_t module_id,
startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength;
SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols);
k2 = *pusch_TimeDomainAllocationList->list.array[i]->k2;
LOG_I(NR_MAC,"Checking Msg3 TDA %d for Msg3_slot %d Msg3_start %d Msg3_nsymb %d: k2 %d, sliv %d,S %d L %d\n",
i, msg3_slot, Msg3start, Msg3maxsymb, (int)k2, (int)pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength, StartSymbolIndex, NrOfSymbols);
// LOG_D(NR_MAC,"Checking Msg3 TDA %d for Msg3_slot %d Msg3_start %d Msg3_nsymb %d: k2 %d, sliv %d,S %d L %d\n",
// i, msg3_slot, Msg3start, Msg3maxsymb, (int)k2, (int)pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength, StartSymbolIndex, NrOfSymbols);
// we want to transmit in the uplink symbols of mixed slot or the first uplink slot
abs_slot = (current_slot + k2 + DELTA[mu]);
int temp_slot = abs_slot % nr_slots_per_frame[mu]; // msg3 slot according to 8.3 in 38.213
......@@ -976,7 +976,7 @@ static void nr_get_Msg3alloc(module_id_t module_id,
tdd_beam_association[num_tdd_period] = ra->beam_id;
}
LOG_I(NR_MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id);
LOG_D(NR_MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id);
const int buffer_index = ul_buffer_index(ra->Msg3_frame, ra->Msg3_slot, mu, mac->vrb_map_UL_size);
uint16_t *vrb_map_UL = &mac->common_channels[CC_id].vrb_map_UL[buffer_index * MAX_BWP_SIZE];
......@@ -1163,7 +1163,7 @@ static void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_f
const int startSymbolAndLength = ul_bwp->tdaList_Common->list.array[ra->Msg3_tda_id]->startSymbolAndLength;
const int mappingtype = ul_bwp->tdaList_Common->list.array[ra->Msg3_tda_id]->mappingType;
LOG_I(NR_MAC, "Frame %d, Slot %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n",
LOG_D(NR_MAC, "Frame %d, Slot %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n",
frameP,
slotP,
ra->Msg3_frame,
......@@ -1245,7 +1245,7 @@ static void nr_generate_Msg2(module_id_t module_idP,
// Checking if the DCI allocation is feasible in current subframe
nfapi_nr_dl_tti_request_body_t *dl_req = &DL_req->dl_tti_request_body;
if (dl_req->nPDUs > NFAPI_NR_MAX_DL_TTI_PDUS - 2) {
LOG_I(NR_MAC, "[RAPROC] Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", slotP, ra->RA_rnti);
LOG_D(NR_MAC, "[RAPROC] Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", slotP, ra->RA_rnti);
return;
}
......@@ -1719,7 +1719,7 @@ static void nr_generate_Msg4(module_id_t module_idP,
// Need to wait until data for Msg4 is ready
if (srb_status.bytes_in_buffer == 0)
return;
LOG_I(NR_MAC, "(%4d.%2d) SRB%d has %d bytes\n", frameP, slotP, lcid, srb_status.bytes_in_buffer);
LOG_D(NR_MAC, "(%4d.%2d) SRB%d has %d bytes\n", frameP, slotP, lcid, srb_status.bytes_in_buffer);
mac_sdu_length = srb_status.bytes_in_buffer;
}
......@@ -1753,7 +1753,7 @@ static void nr_generate_Msg4(module_id_t module_idP,
// Checking if the DCI allocation is feasible in current subframe
nfapi_nr_dl_tti_request_body_t *dl_req = &DL_req->dl_tti_request_body;
if (dl_req->nPDUs > NFAPI_NR_MAX_DL_TTI_PDUS - 2) {
LOG_I(NR_MAC, "[RAPROC] Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", slotP, ra->rnti);
LOG_D(NR_MAC, "[RAPROC] Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", slotP, ra->rnti);
return;
}
......@@ -1909,7 +1909,7 @@ static void nr_generate_Msg4(module_id_t module_idP,
TX_req->SFN = frameP;
TX_req->Number_of_PDUs++;
TX_req->Slot = slotP;
LOG_I(PHY, "Msg4 send %d.%d\n", frameP, slotP);
LOG_D(PHY, "Msg4 send %d.%d\n", frameP, slotP);
sim_socket_manager.msg4_frame = frameP;
sim_socket_manager.msg4_slot = slotP;
sim_socket_manager.prach_sched_flag |= 0x08;
......@@ -1943,7 +1943,7 @@ static void nr_generate_Msg4(module_id_t module_idP,
}
ra->state = WAIT_Msg4_ACK;
LOG_I(NR_MAC,"UE %04x Generate msg4: feedback at %4d.%2d, payload %d bytes, next state WAIT_Msg4_ACK\n", ra->rnti, pucch->frame, pucch->ul_slot, harq->tb_size);
LOG_D(NR_MAC,"UE %04x Generate msg4: feedback at %4d.%2d, payload %d bytes, next state WAIT_Msg4_ACK\n", ra->rnti, pucch->frame, pucch->ul_slot, harq->tb_size);
}
}
......@@ -1977,9 +1977,9 @@ static void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, s
NR_RRC_SETUP_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_SETUP_DELAY_MS;
sched_ctrl->rrc_processing_timer = (delay_ms << ra->DL_BWP.scs);
LOG_I(NR_MAC, "(%d.%d) Activating RRC processing timer for UE %04x with %d ms\n", frame, slot, UE->rnti, delay_ms);
LOG_D(NR_MAC, "(%d.%d) Activating RRC processing timer for UE %04x with %d ms\n", frame, slot, UE->rnti, delay_ms);
} else {
LOG_I(NR_MAC, "(ue rnti 0x%04x) RA Procedure failed at Msg4!\n", ra->rnti);
LOG_D(NR_MAC, "(ue rnti 0x%04x) RA Procedure failed at Msg4!\n", ra->rnti);
}
nr_clear_ra_proc(module_id, CC_id, frame, ra);
......@@ -1987,7 +1987,7 @@ static void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, s
remove_nr_list(&sched_ctrl->retrans_dl_harq, current_harq_pid);
}
} else {
LOG_I(NR_MAC, "(UE %04x) Received Nack of RA-Msg4. Preparing retransmission!\n", ra->rnti);
LOG_D(NR_MAC, "(UE %04x) Received Nack of RA-Msg4. Preparing retransmission!\n", ra->rnti);
ra->state = Msg4;
}
}
......@@ -2096,18 +2096,18 @@ static void nr_fill_rar(uint8_t Mod_idP, NR_RA_t *ra, uint8_t *dlsch_buffer, nfa
rar->UL_GRANT_4 = (uint8_t) ul_grant & 0xff;
#ifdef DEBUG_RAR
LOG_I(NR_MAC, "rarh->E = 0x%x\n", rarh->E);
LOG_I(NR_MAC, "rarh->T = 0x%x\n", rarh->T);
LOG_I(NR_MAC, "rarh->RAPID = 0x%x (%i)\n", rarh->RAPID, rarh->RAPID);
LOG_I(NR_MAC, "rar->R = 0x%x\n", rar->R);
LOG_I(NR_MAC, "rar->TA1 = 0x%x\n", rar->TA1);
LOG_I(NR_MAC, "rar->TA2 = 0x%x\n", rar->TA2);
LOG_I(NR_MAC, "rar->UL_GRANT_1 = 0x%x\n", rar->UL_GRANT_1);
LOG_I(NR_MAC, "rar->UL_GRANT_2 = 0x%x\n", rar->UL_GRANT_2);
LOG_I(NR_MAC, "rar->UL_GRANT_3 = 0x%x\n", rar->UL_GRANT_3);
LOG_I(NR_MAC, "rar->UL_GRANT_4 = 0x%x\n", rar->UL_GRANT_4);
LOG_I(NR_MAC, "rar->TCRNTI_1 = 0x%x\n", rar->TCRNTI_1);
LOG_I(NR_MAC, "rar->TCRNTI_2 = 0x%x\n", rar->TCRNTI_2);
LOG_D(NR_MAC, "rarh->E = 0x%x\n", rarh->E);
LOG_D(NR_MAC, "rarh->T = 0x%x\n", rarh->T);
LOG_D(NR_MAC, "rarh->RAPID = 0x%x (%i)\n", rarh->RAPID, rarh->RAPID);
LOG_D(NR_MAC, "rar->R = 0x%x\n", rar->R);
LOG_D(NR_MAC, "rar->TA1 = 0x%x\n", rar->TA1);
LOG_D(NR_MAC, "rar->TA2 = 0x%x\n", rar->TA2);
LOG_D(NR_MAC, "rar->UL_GRANT_1 = 0x%x\n", rar->UL_GRANT_1);
LOG_D(NR_MAC, "rar->UL_GRANT_2 = 0x%x\n", rar->UL_GRANT_2);
LOG_D(NR_MAC, "rar->UL_GRANT_3 = 0x%x\n", rar->UL_GRANT_3);
LOG_D(NR_MAC, "rar->UL_GRANT_4 = 0x%x\n", rar->UL_GRANT_4);
LOG_D(NR_MAC, "rar->TCRNTI_1 = 0x%x\n", rar->TCRNTI_1);
LOG_D(NR_MAC, "rar->TCRNTI_2 = 0x%x\n", rar->TCRNTI_2);
#endif
int mcs = (unsigned char) (rar->UL_GRANT_4 >> 4);
......
......@@ -1019,7 +1019,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
sim_socket_manager.dl_sched_flag |= 0x01;
sim_socket_manager.pdcch_slot = sim_socket_manager.pdsch_slot = slot;
sim_socket_manager.dl_sched_flag |= 0x02;
LOG_I(NR_MAC,
LOG_D(NR_MAC,
"%4d.%2d [DLSCH/PDSCH/PUCCH] RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d nrOfLayers %d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) PUCCH allocation %d TPC %d\n",
frame,
slot,
......@@ -1238,7 +1238,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
sched_ctrl->coreset,
gNB_mac->cset0_bwp_size);
LOG_I(NR_MAC,
LOG_D(NR_MAC,
"coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
(unsigned long long)pdcch_pdu->FreqDomainResource,
pdcch_pdu->StartSymbolIndex,
......
......@@ -2206,32 +2206,32 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n
sim_socket_manager.ulsch_slot = sched_pusch->slot;
sim_socket_manager.ul_sched_flag |= 0x01;
LOG_I(NR_MAC,
"ULSCH/PUSCH: %4d.%2d RNTI %04x UL sched %4d.%2d DCI L %d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS Table %2d MCS %2d nrOfLayers %2d num_dmrs_cdm_grps_no_data %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d TPC %d\n",
frame,
slot,
rnti,
sched_pusch->frame,
sched_pusch->slot,
sched_ctrl->aggregation_level,
sched_pusch->rbStart,
sched_pusch->rbSize,
sched_pusch->tda_info.startSymbolIndex,
sched_pusch->tda_info.nrOfSymbols,
sched_pusch->dmrs_info.ul_dmrs_symb_pos,
current_BWP->mcs_table,
sched_pusch->mcs,
sched_pusch->nrOfLayers,
sched_pusch->dmrs_info.num_dmrs_cdm_grps_no_data,
sched_pusch->tb_size,
harq_id,
cur_harq->round,
nr_rv_round_map[cur_harq->round%4],
cur_harq->ndi,
sched_ctrl->estimated_ul_buffer,
sched_ctrl->sched_ul_bytes,
sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes,
sched_ctrl->tpc0);
// LOG_I(NR_MAC,
// "ULSCH/PUSCH: %4d.%2d RNTI %04x UL sched %4d.%2d DCI L %d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS Table %2d MCS %2d nrOfLayers %2d num_dmrs_cdm_grps_no_data %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d TPC %d\n",
// frame,
// slot,
// rnti,
// sched_pusch->frame,
// sched_pusch->slot,
// sched_ctrl->aggregation_level,
// sched_pusch->rbStart,
// sched_pusch->rbSize,
// sched_pusch->tda_info.startSymbolIndex,
// sched_pusch->tda_info.nrOfSymbols,
// sched_pusch->dmrs_info.ul_dmrs_symb_pos,
// current_BWP->mcs_table,
// sched_pusch->mcs,
// sched_pusch->nrOfLayers,
// sched_pusch->dmrs_info.num_dmrs_cdm_grps_no_data,
// sched_pusch->tb_size,
// harq_id,
// cur_harq->round,
// nr_rv_round_map[cur_harq->round%4],
// cur_harq->ndi,
// sched_ctrl->estimated_ul_buffer,
// sched_ctrl->sched_ul_bytes,
// sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes,
// sched_ctrl->tpc0);
/* PUSCH in a later slot, but corresponding DCI now! */
const int index = ul_buffer_index(sched_pusch->frame, sched_pusch->slot, current_BWP->scs, nr_mac->UL_tti_req_ahead_size);
......
......@@ -101,28 +101,28 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
NR_mac_stats_t *stats = &UE->mac_stats;
const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0;
printf("stats->dl.total_bytes %ld stats->ul.total_bytes %ld\n", stats->dl.total_bytes, stats->ul.total_bytes);
sim_socket_manager.dl_recv_bytes_high16 = (stats->dl.total_bytes>>16)&0x0000ffff;
sim_socket_manager.dl_recv_bytes_low16 = stats->dl.total_bytes&0x0000ffff;
sim_socket_manager.ul_recv_bytes_high16 = (stats->ul.total_bytes>>16)&0x0000ffff;
sim_socket_manager.ul_recv_bytes_low16 = stats->ul.total_bytes&0x0000ffff;
printf("sim_socket_manager.dl_recv_bytes_high16 %d sim_socket_manager.dl_recv_bytes_low16 %d sim_socket_manager.ul_recv_bytes_high16 %d sim_socket_manager.ul_recv_bytes_low16 %d\n",
sim_socket_manager.dl_recv_bytes_high16,sim_socket_manager.dl_recv_bytes_low16,
sim_socket_manager.ul_recv_bytes_high16,sim_socket_manager.ul_recv_bytes_low16);
sim_socket_manager.dl_mcs = sched_ctrl->dl_bler_stats.mcs;
sim_socket_manager.ul_mcs = sched_ctrl->ul_bler_stats.mcs;
sim_socket_manager.dl_bler = sched_ctrl->dl_bler_stats.bler*10000;
sim_socket_manager.ul_bler = sched_ctrl->ul_bler_stats.bler*10000;
sim_socket_manager.pucch_snr = sched_ctrl->pucch_snrx10/10;
sim_socket_manager.pusch_snr = sched_ctrl->pusch_snrx10/10;
sim_socket_manager.rsrp = avg_rsrp;
sim_socket_manager.measurement_flag |= 0x01;
printf("%d.%d: dl_recv_bytes %dbytes, ul_recv_bytes %dbytes, dl_mcs %d, ul_mcs %d, dl_bler %d, ul_bler %d, pucch_snr %ddB, pusch_snr %ddB, rsrp %ddBm\n",
sim_socket_manager.frame, sim_socket_manager.slot,
(sim_socket_manager.dl_recv_bytes_high16<<16)+sim_socket_manager.dl_recv_bytes_low16,
(sim_socket_manager.ul_recv_bytes_high16<<16)+sim_socket_manager.ul_recv_bytes_low16,
sim_socket_manager.dl_mcs, sim_socket_manager.ul_mcs, sim_socket_manager.dl_bler,sim_socket_manager.ul_bler, sim_socket_manager.pucch_snr,
sim_socket_manager.pusch_snr,sim_socket_manager.rsrp);
// printf("stats->dl.total_bytes %ld stats->ul.total_bytes %ld\n", stats->dl.total_bytes, stats->ul.total_bytes);
// sim_socket_manager.dl_recv_bytes_high16 = (stats->dl.total_bytes>>16)&0x0000ffff;
// sim_socket_manager.dl_recv_bytes_low16 = stats->dl.total_bytes&0x0000ffff;
// sim_socket_manager.ul_recv_bytes_high16 = (stats->ul.total_bytes>>16)&0x0000ffff;
// sim_socket_manager.ul_recv_bytes_low16 = stats->ul.total_bytes&0x0000ffff;
// printf("sim_socket_manager.dl_recv_bytes_high16 %d sim_socket_manager.dl_recv_bytes_low16 %d sim_socket_manager.ul_recv_bytes_high16 %d sim_socket_manager.ul_recv_bytes_low16 %d\n",
// sim_socket_manager.dl_recv_bytes_high16,sim_socket_manager.dl_recv_bytes_low16,
// sim_socket_manager.ul_recv_bytes_high16,sim_socket_manager.ul_recv_bytes_low16);
// sim_socket_manager.dl_mcs = sched_ctrl->dl_bler_stats.mcs;
// sim_socket_manager.ul_mcs = sched_ctrl->ul_bler_stats.mcs;
// sim_socket_manager.dl_bler = sched_ctrl->dl_bler_stats.bler*10000;
// sim_socket_manager.ul_bler = sched_ctrl->ul_bler_stats.bler*10000;
// sim_socket_manager.pucch_snr = sched_ctrl->pucch_snrx10/10;
// sim_socket_manager.pusch_snr = sched_ctrl->pusch_snrx10/10;
// sim_socket_manager.rsrp = avg_rsrp;
// sim_socket_manager.measurement_flag |= 0x01;
// printf("%d.%d: dl_recv_bytes %dbytes, ul_recv_bytes %dbytes, dl_mcs %d, ul_mcs %d, dl_bler %d, ul_bler %d, pucch_snr %ddB, pusch_snr %ddB, rsrp %ddBm\n",
// sim_socket_manager.frame, sim_socket_manager.slot,
// (sim_socket_manager.dl_recv_bytes_high16<<16)+sim_socket_manager.dl_recv_bytes_low16,
// (sim_socket_manager.ul_recv_bytes_high16<<16)+sim_socket_manager.ul_recv_bytes_low16,
// sim_socket_manager.dl_mcs, sim_socket_manager.ul_mcs, sim_socket_manager.dl_bler,sim_socket_manager.ul_bler, sim_socket_manager.pucch_snr,
// sim_socket_manager.pusch_snr,sim_socket_manager.rsrp);
output += snprintf(output,
end - output,
"UE RNTI %04x (%d) PH %d dB PCMAX %d dBm, average RSRP %d (%d meas)\n",
......
......@@ -12,7 +12,7 @@
#define MAX_UE_NUMBER_MAP_SOCKET 1
#define VRB_MAP_TEST_MANAGER
// #define VRB_MAP_TEST_MANAGER
typedef struct {
uint16_t data_len;
......
......@@ -1340,7 +1340,7 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r
*/
if ((ue_context_p = rrc_gNB_ue_context_random_exist(gnb_rrc_inst, random_value))) {
LOG_W(NR_RRC, "new UE rnti (coming with random value) is already there, removing UE %x from MAC/PHY\n", rnti);
AssertFatal(false, "not implemented\n");
//AssertFatal(false, "not implemented\n");
}
ue_context_p = rrc_gNB_create_ue_context(rnti, gnb_rrc_inst, random_value, msg->gNB_DU_ue_id);
......@@ -2681,7 +2681,7 @@ void *rrc_gnb_task(void *args_p) {
itti_receive_msg(TASK_RRC_GNB, &msg_p);
const char *msg_name_p = ITTI_MSG_NAME(msg_p);
instance = ITTI_MSG_DESTINATION_INSTANCE(msg_p);
LOG_I(NR_RRC, "Received Msg %s\n", msg_name_p);
//LOG_I(NR_RRC, "Received Msg %s\n", msg_name_p);
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
LOG_W(NR_RRC, " *** Exiting NR_RRC thread\n");
......
......@@ -44,7 +44,7 @@
#include "executables/softmodem-common.h"
const char *const devtype_names[MAX_RF_DEV_TYPE] =
{"", "USRP B200", "USRP X300", "USRP N300", "USRP X400", "BLADERF", "LMSSDR", "IRIS", "No HW", "UEDv2", "RFSIMULATOR"};
{"", "USRP B200", "USRP X300", "USRP N300", "USRP X400", "BLADERF", "LMSSDR", "IRIS", "No HW", "UEDv2", "RFSIMULATOR","DPDKRF"};
const char *get_devname(int devtype) {
if (devtype < MAX_RF_DEV_TYPE && devtype !=MIN_RF_DEV_TYPE )
......
......@@ -100,6 +100,7 @@ typedef enum {
/*!\brief device is NONE*/
NONE_DEV,
/*!\brief device is UEDv2 */
DPDKRF_DEV,
UEDv2_DEV,
RFSIMULATOR,
MAX_RF_DEV_TYPE
......
#ifndef DPDKRF_H
#define DPDKRF_H
#include <sys/socket.h>
#include <unistd.h>
#define SAMPLE_PER_PACKAGE 960
#define TX_DATA_BUF_SLOTS 10
#define RX_DATA_BUF_SLOTS 10
#define CTRL_CMD_ID_CFG 0x1111
typedef struct
{
uint32_t header; // 0x12345678
uint16_t cmdType; // 0x1111
uint16_t enable; // 1-enable whole msg, 0-disable.
uint8_t rfState; // 0-rf disable; 1-enable; other value will disable this para.
uint8_t digLoopMode; // 0-normal work; 1-digital loop back mode. other value will disable this para.
uint8_t pad[6];
uint8_t rxGain[4]; // valid range is [0~30],other value will disable this para.
uint8_t txGain[4]; // valid range is [0~30],other value will disable this para.
uint64_t rxFreq; // unit is Hz; <1000 will disable this para.
uint64_t txFreq; // unit is Hz; <1000 will disable this para.
uint32_t crc;
uint32_t tail; // 0xA5A5A5A5
} STRUCT_CTRL_CMD_CFG_REQ;
typedef struct
{
uint32_t header; // 0x87654321
uint16_t cmdType; // 0x1111
uint16_t enable; // 1-enable whole msg, 0-disable.
uint8_t rfState; // 0-rf disable; 1-enable; other value will disable this para.
uint8_t digLoopMode; // 0-normal work; 1-digital loop back mode. other value will disable this para.
uint8_t pad[6];
uint8_t rxGain[4]; // valid range is [0~30],other value will disable this para.
uint8_t txGain[4]; // valid range is [0~30],other value will disable this para.
uint64_t rxFreq; // unit is Hz; <1000 will disable this para.
uint64_t txFreq; // unit is Hz; <1000 will disable this para.
uint32_t crc;
uint32_t tail; // 0x5A5A5A5A
} STRUCT_CTRL_CMD_CFG_ACK;
int32_t Dpdk_trx_rw(uint8_t **rx_buff, uint8_t **tx_buff,uint32_t nsamps,uint64_t *timestamp);
void Dpdk_device_init(int lcore_id, int antNum, int startDelay, int logEnable);
/**
* receive 1 package data from port. the package may DATA or CTRL frame.
* this function is blocked until receive 1 package.
* @param sockId
* sock ID, can only be 0 or 1.
* @param buf
* 2 level buffer pointer. buf[0] will store antenna 0 data, and buf[1] will store antenna 1 data.
* these 2 buffer should be malloc before call this function.
* @param timestamp
* a pointer to store the timestamp.
* @return
* - the received data sample num.
*/
int dpdkrf_recvDataPack(int sockfd, uint8_t **buf, int *timestamp);
/**
* send 1 package data. the package may DATA or CTRL frame.
* for data frame, 1 package hold 2 antenna data, each antenna has half.
* @param sockId
* sock ID, can only be 0 or 1.
* @param buf
* 2 level buffer pointer. buf[0] store antenna 0 data, and buf[1] store antenna 1 data.
* @param nsamps
* package sample Number.
* @param ctrlFlag
* - 0 data frame, else control frame.
* @param timestamp
* package sequence Number, at which the data will appear at air.
* @return
* - 0: Success;
* - others: send failed.
*/
int dpdkrf_sendDataPack(int sockfd, uint8_t **buf, int nsamps, int flags, int sn);
int32_t trx_dpdkrf_read(uint8_t **buff, uint32_t nsamps, uint64_t *timestamp);
int32_t trx_dpdkrf_write(uint8_t **buff, int nsamps, uint64_t timestamp);
int32_t trx_dpdkrf_write_ctrl(uint8_t **buff);
void *trx_dpdkrf_read_ctrl();
void plot(int type, void *data, int len);
#endif // HELLO_HELLO_H
\ No newline at end of file
#include <rte_eal.h>
#include <rte_ethdev.h>
#include <rte_mbuf.h>
#include <rte_malloc.h>
#include <rte_timer.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include <stdlib.h>
#include<unistd.h>
#include <sched.h>
#include <pthread.h>
#include <string.h> /**> memset */
#include <signal.h>
#include <termios.h>
#include <rte_eal.h> /**> rte_eal_init */
#include <rte_debug.h> /**> for rte_panic */
#include <rte_errno.h> /**> rte_errno global var */
#include <rte_memzone.h> /**> rte_memzone_dump */
#include <rte_memcpy.h>
#include <rte_string_fns.h>
#include <rte_spinlock.h>
#include <time.h> /** For SLEEP **/
#include <getopt.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <stdbool.h>
#include <inttypes.h>
#include <sys/time.h>
#include <math.h>
#include "dpdkrf_oai.h"
#include "dpdkrf_lib.h"
#include "common/utils/LOG/log.h"
#define SAMPLE_PER_PACKAGE 960
#define ANT_PORT_NUM 2
int num_devices = 0;
#define DEFAULT_NUM 61440
static uint8_t cache_rx[4][SAMPLE_PER_PACKAGE*512];
static uint8_t cache_tx[4][SAMPLE_PER_PACKAGE*512];
#define CTRL_BUF_NUM 64
int32_t gTxCtrlBuf[SAMPLE_PER_PACKAGE * 2 * CTRL_BUF_NUM] __attribute__((aligned(8)));
int32_t gRxCtrlBuf[SAMPLE_PER_PACKAGE * 2 * CTRL_BUF_NUM] __attribute__((aligned(8)));
int gRxCtrlIdx = 0;
int gRxCtrlIdxRead = 0;
void trx_setMsgGainRx(void*buf, int g1, int g2, int g3, int g4)
{
STRUCT_CTRL_CMD_CFG_REQ *msg = buf;
memset(msg, 0, sizeof(STRUCT_CTRL_CMD_CFG_REQ));
msg->header = 0x12345678;
msg->cmdType = CTRL_CMD_ID_CFG;
msg->enable = 1;
msg->rfState = 1; // NO effect;
msg->digLoopMode = 3; // NO effect;
msg->rxGain[0] = g1;
msg->rxGain[1] = g2;
msg->rxGain[2] = g3;
msg->rxGain[3] = g4;
msg->txGain[0] = 100;
msg->txGain[1] = 100;
msg->txGain[2] = 100;
msg->txGain[3] = 100;
msg->txFreq = 0;
msg->rxFreq = 0;
return;
}
void trx_setMsgGainTx(void*buf, int g1, int g2, int g3, int g4)
{
STRUCT_CTRL_CMD_CFG_REQ *msg = buf;
memset(msg, 0, sizeof(STRUCT_CTRL_CMD_CFG_REQ));
msg->header = 0x12345678;
msg->cmdType = CTRL_CMD_ID_CFG;
msg->enable = 1;
msg->rfState = 1; // NO effect;
msg->digLoopMode = 3; // NO effect;
msg->rxGain[0] = 30;
msg->rxGain[1] = 30;
msg->rxGain[2] = 30;
msg->rxGain[3] = 30;
msg->txGain[0] = g1;
msg->txGain[1] = g2;
msg->txGain[2] = g3;
msg->txGain[3] = g4;
msg->txFreq = 0;
msg->rxFreq = 0;
return;
}
void* trx_dpdkrf_read_ctrl()
{
int t = (gRxCtrlIdx - gRxCtrlIdxRead + CTRL_BUF_NUM) % CTRL_BUF_NUM;
if (t != 0)
{
void*buff = &gRxCtrlBuf[gRxCtrlIdxRead * SAMPLE_PER_PACKAGE * 2];
gRxCtrlIdxRead++;
if (gRxCtrlIdxRead >= CTRL_BUF_NUM)
gRxCtrlIdxRead = 0;
return buff;
}
return 0;
}
int32_t trx_dpdkrf_write_ctrl(uint8_t **buff)
{
dpdkrf_sendDataPack(0, &buff[0], SAMPLE_PER_PACKAGE, 1, 0);
return 0;
}
int32_t test_dpdkrf_read (openair0_device *device, openair0_timestamp *ptimestamp, void **buff1, int nsamps, int cc){
void *buff[4];
for (int i = 0; i < ANT_PORT_NUM; i++)
{
buff[i] = buff1[i];
}
if (ANT_PORT_NUM == 1)
{
buff[1] = cache_rx[1];
}
int32_t rr = trx_dpdkrf_read(buff, nsamps, ptimestamp);
return nsamps;
}
int32_t test_dpdkrf_write (openair0_device *device,openair0_timestamp timestamp, void **buff1, int nsamps, int cc, int flags){
void *buff[4];
for (int i = 0; i < ANT_PORT_NUM; i++)
{
buff[i] = buff1[i];
}
if (ANT_PORT_NUM == 1)
{
buff[1] = cache_tx[1];
}
int32_t rr = trx_dpdkrf_write(buff,nsamps, timestamp);
return nsamps;
}
int trx_dpdkrf_start(openair0_device *device) {
uint8_t **txpCtrlgain = rte_malloc(NULL, 4 * sizeof(uint8_t), 0);
for (int i = 0; i < 4; i++)
{
txpCtrlgain[i] = (uint8_t *)gTxCtrlBuf;
}
LOG_I(HW, "[dpdkrf] Start dpdkrf ...\n");
Dpdk_device_init(15, 2, 5000000 * 5, 1);
trx_setMsgGainTx(gTxCtrlBuf, 0, 0, 0, 0);
txpCtrlgain[0] = (uint8_t *)gTxCtrlBuf;
trx_dpdkrf_write_ctrl(txpCtrlgain);
return 0;
}
void trx_dpdkrf_end(openair0_device *device){
}
int trx_dpdkrf_get_stats(openair0_device* device) {
return(0);
}
int trx_dpdkrf_reset_stats(openair0_device* device) {
return(0);
}
int trx_dpdkrf_stop(openair0_device* device) {
return(0);
}
int trx_dpdkrf_set_freq(openair0_device* device, openair0_config_t *openair0_cfg1) {
// printf("1freq = %ld %ld\n\n",openair0_cfg->rx_freq[0],openair0_cfg->tx_freq[0]);
// uint8_t **txpCtrl = rte_malloc(NULL, 4 * sizeof(uint8_t), 0);
// trx_setMsgFreq(gTxCtrlBuf, (uint64_t)(openair0_cfg->rx_freq[0]),(uint64_t)(openair0_cfg->tx_freq[0]));
// txpCtrl[0] = (uint8_t *)gTxCtrlBuf;
// trx_dpdkrf_write_ctrl(txpCtrl);
return(0);
}
int trx_dpdkrf_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) {
if (openair0_cfg->rx_gain[0] > 65+openair0_cfg->rx_gain_offset[0]) {
LOG_E(HW, "[oxgrf] Reduce RX Gain 0 by %f dB\n", openair0_cfg->rx_gain[0] - openair0_cfg->rx_gain_offset[0] - 65);
return -1;
}
uint8_t **txpCtrl = rte_malloc(NULL, 4 * sizeof(uint8_t), 0);
trx_setMsgGainRx(gTxCtrlBuf,(uint32_t)(openair0_cfg->rx_gain[0] > 65?65:openair0_cfg->rx_gain[0]),(uint32_t)(openair0_cfg->rx_gain[1] > 65?65:openair0_cfg->rx_gain[1]),100,100 );
int tx_gain1 = ((uint32_t)openair0_cfg->tx_gain[0] > 90?90:(uint32_t)openair0_cfg->tx_gain[0]);
int tx_gain2 = ((uint32_t)openair0_cfg->tx_gain[1] > 90?90:(uint32_t)openair0_cfg->tx_gain[1]);
trx_setMsgGainTx(gTxCtrlBuf, (90 - tx_gain1) * 1000,(90 - tx_gain2) * 1000,100,100);
txpCtrl[0] = (uint8_t *)gTxCtrlBuf;
trx_dpdkrf_write_ctrl(txpCtrl);
return(0);
}
int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
dpdkrf_state_t *dpdkrf = (dpdkrf_state_t*)malloc(sizeof(dpdkrf_state_t));
memset(dpdkrf, 0, sizeof(dpdkrf_state_t));
LOG_I(HW, "[dpdkrf] openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs);
LOG_I(HW, "[dpdkrf] openair0_cfg[0].rx_num_channels == '%d'\n", openair0_cfg[0].rx_num_channels);
LOG_I(HW, "[dpdkrf] openair0_cfg[0].tx_num_channels == '%d'\n", openair0_cfg[0].tx_num_channels);
// init required params
switch ((int)openair0_cfg->sample_rate) {
case 122880000:
openair0_cfg->samples_per_packet = 122880;
openair0_cfg->tx_sample_advance = 1232;//1232;
openair0_cfg[0].tx_bw = 100e6;
openair0_cfg[0].rx_bw = 100e6;
break;
case 61440000:
openair0_cfg->samples_per_packet = 61440;
openair0_cfg->tx_sample_advance = 70;
openair0_cfg[0].tx_bw = 40e6;
openair0_cfg[0].rx_bw = 40e6;
break;
case 30720000:
openair0_cfg->samples_per_packet = 30720;
openair0_cfg->tx_sample_advance = 70;
openair0_cfg[0].tx_bw = 20e6;
openair0_cfg[0].rx_bw = 20e6;
break;
case 15360000:
openair0_cfg->samples_per_packet = 15360;
openair0_cfg->tx_sample_advance = 68;
openair0_cfg[0].tx_bw = 10e6;
openair0_cfg[0].rx_bw = 10e6;
break;
case 7680000:
openair0_cfg->samples_per_packet = 7680;
openair0_cfg->tx_sample_advance = 34;
openair0_cfg[0].tx_bw = 5e6;
openair0_cfg[0].rx_bw = 5e6;
break;
case 1920000:
openair0_cfg->samples_per_packet = 1920;
openair0_cfg->tx_sample_advance = 9;
openair0_cfg[0].tx_bw = 1.25e6;
openair0_cfg[0].rx_bw = 1.25e6;
break;
default:
LOG_I(HW, "[dpdkrf] Error: unknown sampling rate %f\n", openair0_cfg->sample_rate);
free(dpdkrf);
exit(-1);
break;
}
dpdkrf->sample_rate = (unsigned int)openair0_cfg->sample_rate;
LOG_I(HW, "[rf] sampling_rate %d\n", dpdkrf->sample_rate);
dpdkrf->rx_num_channels = openair0_cfg[0].rx_num_channels;
dpdkrf->tx_num_channels = openair0_cfg[0].tx_num_channels;
for (int i = 0; i < 1920 * 2; i++)
gTxCtrlBuf[i] = i;
char *arg[1] = {"./nr-softmodem"};
if (rte_eal_init(1,arg) < 0) {
rte_exit(EXIT_FAILURE, "Error with EAL init\n");
}
device->Mod_id = num_devices++;
device->type = DPDKRF_DEV;
device->trx_start_func = trx_dpdkrf_start;
device->trx_end_func = trx_dpdkrf_end;
device->trx_read_func = test_dpdkrf_read;
device->trx_write_func = test_dpdkrf_write;
device->trx_get_stats_func = trx_dpdkrf_get_stats;
device->trx_reset_stats_func = trx_dpdkrf_reset_stats;
device->trx_stop_func = trx_dpdkrf_stop;
device->trx_set_freq_func = trx_dpdkrf_set_freq;
device->trx_set_gains_func = trx_dpdkrf_set_gains;
device->openair0_cfg = openair0_cfg;
device->priv = (void *)dpdkrf;
// rte_timer_setup();
return 0;
}
#include "common_lib.h"
#include "nr-softmodem.h"
typedef struct {
//! Sample rate
unsigned int sample_rate;
int rx_num_channels;
int tx_num_channels;
//! Number of underflows
int num_underflows;
//! Number of overflows
int num_overflows;
//! number of RX errors
int num_rx_errors;
//! Number of TX errors
int num_tx_errors;
//! timestamp of current TX
uint64_t tx_current_ts;
//! timestamp of current RX
uint64_t rx_current_ts;
//! number of TX samples
uint64_t tx_nsamps;
//! number of RX samples
uint64_t rx_nsamps;
//! number of TX count
uint64_t tx_count;
//! number of RX count
uint64_t rx_count;
//! timestamp of RX packet
openair0_timestamp rx_timestamp;
}dpdkrf_state_t;
#define REMOVE_SUBSTRING_WITHCOMAS(S, TOREMOVE) \
remove_substring(S, TOREMOVE ","); \
remove_substring(S, TOREMOVE ", "); \
remove_substring(S, "," TOREMOVE); \
remove_substring(S, ", " TOREMOVE); \
remove_substring(S, TOREMOVE)
static inline void remove_substring(char* s, const char* toremove)
{
while ((s = strstr(s, toremove))) {
memmove(s, s + strlen(toremove), 1 + strlen(s + strlen(toremove)));
}
}
static inline void copy_subdev_string(char* dst, char* src)
{
int n = 0;
int len = (int)strlen(src);
/* Copy until end of string or comma */
while (n < len && src[n] != '\0' && src[n] != ',') {
dst[n] = src[n];
n++;
}
dst[n] = '\0';
}
\ No newline at end of file
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