Commit dfc6dc13 authored by lfq's avatar lfq

add dpdkrf

parent 280e8c61
......@@ -2352,7 +2352,7 @@ if (${T_TRACER})
nr_ulschsim ldpctest polartest smallblocktest cu_test du_test
#all "add_library" definitions
ITTI lte_rrc nr_rrc s1ap x2ap m2ap m3ap f1ap
params_libconfig oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_iqplayer oai_oxgrfdevif
params_libconfig oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_iqplayer oai_oxgrfdevif oai_dpdkrfdevif
oai_eth_transpro oai_mobipass coding HASHTABLE UTIL OMG_SUMO
SECURITY SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL
NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB
......
......@@ -93,7 +93,7 @@ Options:
--UE-gen-nvram [output path]
Specify gen_nvram_path (default \"$gen_nvram_path\")
-w | --hardware
USRP, BLADERF, LMSSDR, IRIS, SIMU, AW2SORI, OXGRF, AERIAL, None (Default)
USRP, BLADERF, LMSSDR, IRIS, SIMU, AW2SORI, OXGRF, AERIAL, DPDKRF, None (Default)
Adds this RF board support (in external packages installation and in compilation)
-t | --transport
Selects the transport protocol type, options: None, Ethernet, benetel4g, benetel5g, oran_fhlib_5g
......@@ -276,7 +276,7 @@ function main() {
shift;;
-w | --hardware)
case "$2" in
"USRP" | "BLADERF" | "LMSSDR" | "IRIS" | "OXGRF")
"USRP" | "BLADERF" | "LMSSDR" | "IRIS" | "OXGRF" | "DPDKRF")
HW="OAI_"$2
TARGET_LIST="$TARGET_LIST oai_${2,,}devif" # ,, makes lowercase
CMAKE_CMD="$CMAKE_CMD -DOAI_$2=ON"
......@@ -482,6 +482,9 @@ function main() {
echo_info "installing packages for OXGRF support"
#check_install_oxgrf_driver
fi
if [ "$HW" == "OAI_DPDKRF" ] ; then
echo_info "installing packages for DPDKRF support"
fi
if [ "$HW" == "OAI_IRIS" ] ; then
echo_info "installing packages for IRIS support"
check_install_soapy
......
......@@ -444,8 +444,11 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action)
int tmp = openair0_write_reorder(&UE->rfdevice, proc->timestamp_tx, txp, rxtxD->writeBlockSize, fp->nb_antennas_tx, flags);
AssertFatal(tmp == rxtxD->writeBlockSize, "");
for (int i = 0; i < UE->frame_parms.nb_antennas_tx; i++)
txp[i] = (void *)&UE->common_vars.txData[i][UE->frame_parms.get_samples_slot_timestamp((slot+10)%20, &UE->frame_parms, 0)];
for (int i = 0; i < fp->nb_antennas_tx; i++)
memset(txp[i], 0, rxtxD->writeBlockSize);
memset(txp[i], 0, rxtxD->writeBlockSize*4);
}
void processSlotTX(void *arg)
......
......@@ -40,6 +40,7 @@
\param no_prefix if 1 prefix is removed by HW
\param reset_freq_est if non-zero it resets the frequency offset estimation loop
*/
uint cal_amp(int16_t *dataIn, int len);
int slot_fep(PHY_VARS_UE *phy_vars_ue,
unsigned char l,
......
......@@ -34,6 +34,18 @@
#define LOG_I(A,B...) printf(A)
#endif*/
uint cal_amp(int16_t *dataIn, int len)
{
int i;
uint sumA = 0;
for(i=0;i<len;i++)
{
sumA += abs(dataIn[i]);
}
sumA = sumA/len;
return sumA;
}
int sl_nr_slot_fep(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
unsigned char symbol,
......
......@@ -1297,6 +1297,22 @@ static void inner_rx(PHY_VARS_gNB *gNB,
frame_parms);
}
}
unsigned int pusch_amp;
if (symbol == (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols - 1)) {
static int cnt = 0;
//if (((cnt & 0x7F) == 0) || (cnt < 0x80))
//if ( (cnt < 0x100))
if (((cnt & 0xFF) == 0) )
{
pusch_amp = cal_amp(&rxFext[0][0], rel15_ul->rb_size * NR_NB_SC_PER_RB);
//LOG_I(PHY, "UL AMP frame %d %d, symbol %d, rbs %d, res %d, time %d, freq %d \n", frame, slot, symbol, nb_re_pusch/12, nb_re_pusch, g_ul_time_amp[symbol], g_ul_freq_amp[symbol], pusch_amp);
LOG_I(PHY, "UL AMP frame %d %d, symbols %d, rbs %d, mcs %d, pusch amp %d \n", 0, slot, rel15_ul->nr_of_symbols, rel15_ul->rb_size, rel15_ul->mcs_index, pusch_amp);
}
cnt++;
}
c16_t rho[nb_layer][nb_layer][buffer_length] __attribute__((aligned(32)));
c16_t rxF_ch_maga [nb_layer][buffer_length] __attribute__((aligned(32)));
c16_t rxF_ch_magb [nb_layer][buffer_length] __attribute__((aligned(32)));
......
......@@ -469,6 +469,20 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
dlsch_config->dlDmrsSymbPos,
csi_res_bitmap,
ue->chest_time);
if ((pilots == 0) && (first_symbol_flag == 1))
{
static int cnt = 0;
if ((cnt %1024) == 0)
{
unsigned int pdsch_amp;
pdsch_amp = cal_amp((int16_t *)&rxdataF_ext[0][0], nb_rb_pdsch * 12);
LOG_I(PHY, "frame %d %d, symbol %d pdsch_amp %d, rb %d, symbols %d rnti %d, mcs %d , tbs %d\n",
frame, nr_slot_rx, symbol, pdsch_amp, nb_rb_pdsch, dlsch[0].dlsch_config.number_symbols, dlsch[0].rnti, dlsch[0].dlsch_config.mcs, dlsch[0].dlsch_config.TBS);
}
cnt++;
}
if (meas_enabled) {
stop_meas(&meas);
LOG_D(PHY,
......
......@@ -88,6 +88,11 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
const char *begin = output;
const char *end = output + strlen;
static uint64_t dl_bytes_old = 0;
static uint64_t ul_bytes_old = 0;
uint64_t dl_bytes_new = 0;
uint64_t ul_bytes_new = 0;
/* this function is called from gNB_dlsch_ulsch_scheduler(), so assumes the
* scheduler to be locked*/
NR_SCHED_ENSURE_LOCKED(&gNB->sched_lock);
......@@ -98,6 +103,9 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
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;
dl_bytes_new = stats->dl.total_bytes;
ul_bytes_new = stats->ul.total_bytes;
output += snprintf(output, end - output, "UE RNTI %04x CU-UE-ID ", UE->rnti);
if (du_exists_f1_ue_data(UE->rnti)) {
f1_ue_data_t ued = du_get_f1_ue_data(UE->rnti);
......@@ -145,7 +153,18 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
sched_ctrl->dl_bler_stats.bler,
UE->current_DL_BWP.mcsTableIdx,
sched_ctrl->dl_bler_stats.mcs);
output += snprintf(output,
end - output,
"UE %04x: dl thoughtput %"PRIu64" kbps, dl_bytes_old %"PRIu64 "dl_bytes_new %"PRIu64 "\n",
UE->rnti, (uint64_t)((dl_bytes_new - dl_bytes_old) * 25 / 4000), dl_bytes_old, dl_bytes_new);
output += snprintf(output,
end - output,
"UE %04x: ul thoughtput %"PRIu64" kbps, ul_bytes_old %"PRIu64 "ul_bytes_new %"PRIu64 "\n",
UE->rnti, (uint64_t)((ul_bytes_new - ul_bytes_old) * 25 / 4000), ul_bytes_old, ul_bytes_new);
if (reset_rsrp) {
dl_bytes_old = dl_bytes_new;
ul_bytes_old = ul_bytes_new;
stats->num_rsrp_meas = 0;
stats->cumul_rsrp = 0;
}
......
......@@ -42,3 +42,8 @@ add_boolean_option(OAI_OXGRF OFF "Activate OAI's OXGRF driver" OFF)
if(OAI_OXGRF)
add_subdirectory(OXGRF)
endif()
add_boolean_option(OAI_DPDKRF OFF "Activate OAI's DPDKRF driver" OFF)
if(OAI_DPDKRF)
add_subdirectory(DPDKRF)
endif()
......@@ -45,7 +45,7 @@
#define MAX_GAP 100ULL
const char *const devtype_names[MAX_RF_DEV_TYPE] =
{"", "USRP B200", "USRP X300", "USRP N300", "USRP X400", "BLADERF", "OXGRF", "LMSSDR", "IRIS", "No HW", "UEDv2", "RFSIMULATOR"};
{"", "USRP B200", "USRP X300", "USRP N300", "USRP X400", "BLADERF", "OXGRF", "DPDKRF", "LMSSDR", "IRIS", "No HW", "UEDv2", "RFSIMULATOR"};
const char *get_devname(int devtype) {
if (devtype < MAX_RF_DEV_TYPE && devtype !=MIN_RF_DEV_TYPE )
......
......@@ -95,6 +95,7 @@ typedef enum {
BLADERF_DEV,
/*!\brief device is OXGRF pcie*/
OXGRF_DEV,
DPDKRF_DEV,
/*!\brief device is LMSSDR (SoDeRa)*/
LMSSDR_DEV,
/*!\brief device is Iris */
......
find_library(dpdkrf NAMES dpdkrf PATHS /usr/local/lib)
add_library(oai_dpdkrfdevif MODULE dpdkrf_oai.c)
target_link_libraries(oai_dpdkrfdevif PRIVATE dpdkrf)
target_link_libraries(oai_dpdkrfdevif PRIVATE UTIL)
set_target_properties(oai_dpdkrfdevif PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_custom_command(TARGET oai_dpdkrfdevif POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink liboai_dpdkrfdevif.so liboai_device.so
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
message(STATUS "CMAKE_LIBRARY_PATH: ${CMAKE_BINARY_DIR}")
message(STATUS "Libraries linked to your_target_name: ${oai_dpdkrfdevif}")
#ifndef DPDKRF_LIB_H
#define DPDKRF_LIB_H
#include <stdint.h>
#include <unistd.h>
/**
* init dpdk parameter, start dpdk thread.
* @param tx_buff
* 二维指针,指向4个天线的发射数据buffer。每个buffer应可存储FRAME_SAMPLE_NUM个数据
* @param rx_buff
* 二维指针,指向4个天线的接收数据buffer。
* @param dpdkLoopCoreId
* core ID at which dpdk thread run.
* @param startDelay_us
* dpdk thread start delay, unit is us.
* @return
* -
*/
void dpdk_device_start(int dpdkLoopCoreId, int startDelay, int antTxNum, int antRxNum);
/**
* 驱动回调函数,在接收到整slot的数据后,驱动调用这个函数.函数内容可由用户改写。
* @param rxSlotIdx
* 当前slot号,由驱动传入
* @param logBuf
* 驱动log,用于显示驱动运行信息。
* @return
* - 0
*/
int32_t trx_dpdkrf_read(uint8_t **buff, uint32_t nsamps, uint64_t *timestamp, int cc);
int32_t trx_dpdkrf_write(uint8_t **buff, int nsamps, uint64_t timestamp, int cc);
void trx_dpdkrf_gainRx(int g1, int g2, int g3, int g4, int op);
void trx_dpdkrf_gainTx(int g1, int g2, int g3, int g4, int op);
void trx_dpdkrf_setFreq(int64_t freqTx, int64_t freqRx, int op);
#endif // DPDKRF_LIB_H
\ No newline at end of file
This diff is collapsed.
#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
Active_gNBs = ( "gNB-OAI");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
gNBs = (
{
////////// Identification parameters:
gNB_ID = 0xe00;
gNB_name = "gNB-OAI";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 100;
plmn_list = ({ mcc = 466; mnc = 92; mnc_length = 2; snssaiList = ({ sst = 1; }); });
nr_cellid = 12345678L;
#sib1_tda = 15;
////////// Physical parameters:
min_rxtxtime = 6;
pdsch_AntennaPorts_XP = 1;
pusch_AntennaPorts = 1;
do_CSIRS = 0;
do_SRS = 0;
ul_prbblacklist = "135,136,137,138"
servingCellConfigCommon = (
{
# spCellConfigCommon
physCellId = 0;
# downlinkConfigCommon
# frequencyInfoDL
# this is 3900.60 MHz + (134 PRBs + 4 SCs)@30kHz SCS (GSCN: 8158)
absoluteFrequencySSB = 623232;
dl_frequencyBand = 78;
# this is 3900.60 MHz
dl_absoluteFrequencyPointA = 620016;
# scs-SpecificCarrierList
dl_offstToCarrier = 0;
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
dl_subcarrierSpacing = 1;
dl_carrierBandwidth = 273;
# initialDownlinkBWP
# genericParameters
initialDLBWPlocationAndBandwidth = 1099;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
# pdcch-ConfigCommon
initialDLBWPcontrolResourceSetZero = 12;
initialDLBWPsearchSpaceZero = 0;
# uplinkConfigCommon
# frequencyInfoUL
ul_frequencyBand = 78;
# scs-SpecificCarrierList
ul_offstToCarrier = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
ul_subcarrierSpacing = 1;
ul_carrierBandwidth = 273;
pMax = 20;
# initialUplinkBWP
# genericParameters
initialULBWPlocationAndBandwidth = 1099;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
# rach-ConfigCommon
# rach-ConfigGeneric
prach_ConfigurationIndex = 98;
# prach_msg1_FDM
# 0 = one, 1=two, 2=four, 3=eight
prach_msg1_FDM = 0;
prach_msg1_FrequencyStart = 0;
zeroCorrelationZoneConfig = 12;
preambleReceivedTargetPower = -90;
# preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
preambleTransMax = 6;
# powerRampingStep
# 0=dB0,1=dB2,2=dB4,3=dB6
powerRampingStep = 1;
# ra_ReponseWindow
# 1,2,4,8,10,20,40,80
ra_ResponseWindow = 4;
# ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
# 1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3;
# oneHalf (0..15) 4,8,12,16,...60,64
ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15;
# ra_ContentionResolutionTimer
# (0..7) 8,16,24,32,40,48,56,64
ra_ContentionResolutionTimer = 7;
rsrp_ThresholdSSB = 19;
# prach-RootSequenceIndex_PR
# 1 = 839, 2 = 139
prach_RootSequenceIndex_PR = 2;
prach_RootSequenceIndex = 1;
# SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
msg1_SubcarrierSpacing = 1,
# restrictedSetConfig
# 0=unrestricted, 1=restricted type A, 2=restricted type B
restrictedSetConfig = 0,
msg3_DeltaPreamble = 1;
p0_NominalWithGrant =-90;
# pucch-ConfigCommon
# pucchGroupHopping
# 0 = neither, 1= group hopping, 2=sequence hopping
pucchGroupHopping = 0;
hoppingId = 40;
p0_nominal = -70;
# dmrs_TypeA_position
# 0 = pos2, 1 = pos3
dmrs_TypeA_Position = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
subcarrierSpacing = 1;
# ssb_PositionsInBurs_BitmapPR
# 1=short, 2=medium, 3=long
ssb_PositionsInBurst_PR = 2;
ssb_PositionsInBurst_Bitmap = 1;
# ssb_periodicityServingCell
# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
ssb_periodicityServingCell = 2;
#tdd-UL-DL-ConfigurationCommon
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
referenceSubcarrierSpacing = 1;
# pattern1
# dl_UL_TransmissionPeriodicity
# 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
dl_UL_TransmissionPeriodicity = 6;
nrofDownlinkSlots = 7;
nrofDownlinkSymbols = 6;
nrofUplinkSlots = 2;
nrofUplinkSymbols = 4;
ssPBCH_BlockPower = -25;
}
);
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// AMF parameters:
amf_ip_address = (
{
ipv4 = "172.11.200.14";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
GNB_INTERFACE_NAME_FOR_NG_AMF = "docker-openxg";
GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.11.200.1/24";
GNB_INTERFACE_NAME_FOR_NGU = "docker-openxg";
GNB_IPV4_ADDRESS_FOR_NGU = "172.11.200.1/24";
GNB_PORT_FOR_S1U = 2152; # Spec 2152
}
}
);
MACRLCs = (
{
num_cc = 1;
tr_s_preference = "local_L1";
tr_n_preference = "local_RRC";
pusch_TargetSNRx10 = 300;
pucch_TargetSNRx10 = 200;
pusch_FailureThres = 1000;
ulsch_max_frame_inactivity = 0;
ul_max_mcs = 28;
}
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
prach_dtx_threshold = 300;
pucch0_dtx_threshold = 80;
#tx_amp_backoff_dB =26;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 10; # max 0, min 30 line: 10
att_rx = 0;
bands = [78];
# tp_cores = [6,7];
max_pdschReferenceSignalPower = -27;
max_rxgain = 20; #max 30, min 0 line 10
eNB_instances = [0];
#beamforming 1x4 matrix:
bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000];
sdr_addrs = "dev=pciex:0,auxdac1=1508";
clock_src = "internal";
# ru_thread_core = 2;
}
);
THREAD_STRUCT = (
{
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE";
}
);
rfsimulator :
{
serveraddr = "server";
serverport = "4043";
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs";
};
security = {
# preferred ciphering algorithms
# the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" );
# preferred integrity algorithms
# the first one of the list that an UE supports in chosen
# valid values: nia0, nia1, nia2, nia3
integrity_algorithms = ( "nia2", "nia0" );
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes";
drb_integrity = "no";
};
log_config :
{
global_log_level ="info";
hw_log_level ="info";
phy_log_level ="info";
mac_log_level ="info";
rlc_log_level ="info";
pdcp_log_level ="info";
rrc_log_level ="info";
ngap_log_level ="debug";
f1ap_log_level ="debug";
};
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