|
@@ -231,9 +235,13 @@ UE on machine 2:
This image shows an example of gNB 5G MIMO logical antenna port configuration. It has to be noted that logical antenna ports might not directly correspond to physical antenna ports and each logical antenna port might consist of a sub-array of antennas.
-The basic element is a dual-polarized antenna, therefore the minimal DL MIMO setup with two logical antenna ports would consist of two cross-polarized antenna elements. In a single panel configuration, as the one in the picture, this element can be repeated vertiacally and/or horizontally to form an equi-spaced 1D or 2D array. The values N1 and N2 represent the number of antenna ports in the two dimensions and the supported configurations are specified in Section 5.2.2.2.1 of TS 38.214.
+In 5G the basic element is a dual-polarized antenna, therefore the minimal DL MIMO setup with two logical antenna ports would consist of two cross-polarized antenna elements. In a single panel configuration, as the one in the picture, this element can be repeated vertically and/or horizontally to form an equi-spaced 1D or 2D array. The values N1 and N2 represent the number of antenna ports in the two dimensions and the supported configurations are specified in Section 5.2.2.2.1 of TS 38.214.
-The DL logical antenna port configuration can be selected through configuration file. `pdsch_AntennaPorts_N1` can be used to set N1 parameter, `pdsch_AntennaPorts_N2` to set N2 and `pdsch_AntennaPorts_XP` to set the cross-polarization configuration (1 for single pol, 2 for cross-pol). To be noted that if XP is 1 but N1 and/or N2 are larger than 1, this would result in a non-standard configuration and the PMI selected would be the identity matrix regardless of CSI report. The default value for each of these parameters is 1.
+The DL logical antenna port configuration can be selected through configuration file. `pdsch_AntennaPorts_N1` can be used to set N1 parameter, `pdsch_AntennaPorts_N2` to set N2 and `pdsch_AntennaPorts_XP` to set the cross-polarization configuration (1 for single pol, 2 for cross-pol). To be noted that if XP is 1 but N1 and/or N2 are larger than 1, this would result in a non-standard configuration and the PMI selected would be the identity matrix regardless of CSI report. The default value for each of these parameters is 1. The total number of PDSCH logical antenna ports is the multiplication of those 3 parameters.
+
+Finally the number of TX physical antenna in the RU part of the configuration file, `nb_tx`, should be equal or larger than the total number of PDSCH logical antenna ports.
+
+[Example of configuration file with parameters for 2-layer MIMO](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf)
# Additional links
diff --git a/doc/RUN_NR_NFAPI.md b/doc/RUN_NR_NFAPI.md
index ea7c2590c7..e294703d44 100644
--- a/doc/RUN_NR_NFAPI.md
+++ b/doc/RUN_NR_NFAPI.md
@@ -21,12 +21,12 @@ sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up
### VNF command
```
-sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi 2 --noS1 --phy-test
+sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi VNF --noS1 --phy-test
```
### PNF command
```
-sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi 1 --rfsim --phy-test --rfsimulator.serveraddr server
+sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi PNF --rfsim --phy-test --rfsimulator.serveraddr server
```
### UE command
@@ -38,12 +38,12 @@ sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --rfsim --phy-test --rrc_config_path
### VNF command
```
-sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi 2 --noS1 --phy-test
+sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi VNF --noS1 --phy-test
```
### PNF command
```
-sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi 1 --phy-test
+sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi PNF --phy-test
```
### UE command
diff --git a/executables/lte-ru.c b/executables/lte-ru.c
index 8d54d13ded..80a4162f00 100644
--- a/executables/lte-ru.c
+++ b/executables/lte-ru.c
@@ -742,7 +742,8 @@ void tx_rf(RU_t *ru,
if ((SF_type == SF_DL) ||
(SF_type == SF_S) ) {
- int siglen=fp->samples_per_tti,flags=1;
+ int siglen=fp->samples_per_tti;
+ radio_tx_burst_flag_t flags = TX_BURST_MIDDLE;
if (SF_type == SF_S) {
int txsymb = fp->dl_symbols_in_S_subframe+(ru->is_slave==0 ? 1 : 0);
@@ -757,13 +758,13 @@ void tx_rf(RU_t *ru,
siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0)
+ (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples)
+ ru->end_of_burst_delay;
- flags=3; // end of burst
+ flags = TX_BURST_END;
}
if (fp->frame_type == TDD &&
SF_type == SF_DL &&
prevSF_type == SF_UL) {
- flags = 2; // start of burst
+ flags = TX_BURST_START;
sf_extension = ru->sf_extension;
}
@@ -781,24 +782,24 @@ void tx_rf(RU_t *ru,
LOG_E(PHY,"%d.%d late_control : %d\n",frame,subframe,late_control);
switch (late_control) {
case STATE_BURST_TERMINATE:
- flags=10; // end of burst and no time spec
+ flags = TX_BURST_END_NO_TIME_SPEC;
late_control=STATE_BURST_STOP_1;
break;
case STATE_BURST_STOP_1:
- flags=0; // no send
+ flags = TX_BURST_INVALID;
late_control=STATE_BURST_STOP_2;
return;//no send
break;
case STATE_BURST_STOP_2:
- flags=0; // no send
+ flags = TX_BURST_INVALID;
late_control=STATE_BURST_RESTART;
return;//no send
break;
case STATE_BURST_RESTART:
- flags=2; // start burst
+ flags = TX_BURST_START;
late_control=STATE_BURST_NORMAL;
break;
diff --git a/executables/main-ocp.c b/executables/main-ocp.c
index 8cd23b7159..2912ec7648 100644
--- a/executables/main-ocp.c
+++ b/executables/main-ocp.c
@@ -694,7 +694,8 @@ void ocp_tx_rf(RU_t *ru, L1_rxtx_proc_t *proc) {
if ((SF_type == SF_DL) ||
(SF_type == SF_S)) {
- int siglen=fp->samples_per_tti,flags=1;
+ int siglen=fp->samples_per_tti;
+ radio_tx_burst_flag_t flags = TX_BURST_MIDDLE;
if (SF_type == SF_S) {
/* end_of_burst_delay is used to stop TX only "after a while".
@@ -707,13 +708,13 @@ void ocp_tx_rf(RU_t *ru, L1_rxtx_proc_t *proc) {
siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0)
+ (fp->dl_symbols_in_S_subframe - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples)
+ ru->end_of_burst_delay;
- flags=3; // end of burst
+ flags = TX_BURST_END;
}
if (fp->frame_type == TDD &&
SF_type == SF_DL &&
prevSF_type == SF_UL) {
- flags = 2; // start of burst
+ flags = TX_BURST_START;
sf_extension = ru->sf_extension;
}
diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c
index 852e805e6d..395f1bece3 100644
--- a/executables/nr-gnb.c
+++ b/executables/nr-gnb.c
@@ -254,7 +254,7 @@ void rx_func(void *param) {
stop_meas(&gNB->ul_indication_stats);
int tx_slot_type = nr_slot_select(cfg,frame_rx,slot_tx);
- if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) {
+ if ((tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) && NFAPI_MODE != NFAPI_MODE_PNF) {
notifiedFIFO_elt_t *res;
processingData_L1tx_t *syncMsg;
// Its a FIFO so it maitains the order in which the MAC fills the messages
@@ -470,7 +470,7 @@ void init_gNB_Tpool(int inst) {
pushNotifiedFIFO(&gNB->L1_tx_free, msgL1Tx); // to unblock the process in the beginning
}
- if ((!get_softmodem_params()->emulate_l1) && (!IS_SOFTMODEM_NOSTATS_BIT))
+ if ((!get_softmodem_params()->emulate_l1) && (!IS_SOFTMODEM_NOSTATS_BIT) && (NFAPI_MODE!=NFAPI_MODE_VNF))
threadCreate(&proc->L1_stats_thread,nrL1_stats_thread,(void*)gNB,"L1_stats",-1,OAI_PRIORITY_RT_LOW);
LOG_I(PHY,"Creating thread for TX reordering and dispatching to RU\n");
diff --git a/executables/nr-ru.c b/executables/nr-ru.c
index 96ec7e2759..48cf6ebe31 100644
--- a/executables/nr-ru.c
+++ b/executables/nr-ru.c
@@ -733,7 +733,8 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
T_INT(0), T_BUFFER(&ru->common.txdata[0][fp->get_samples_slot_timestamp(slot,fp,0)], fp->samples_per_subframe * 4));
int sf_extension = 0;
int siglen=fp->get_samples_per_slot(slot,fp);
- int flags = 0;
+ radio_tx_burst_flag_t flags_burst = TX_BURST_INVALID;
+ radio_tx_gpio_flag_t flags_gpio = 0;
if (cfg->cell_config.frame_duplex_type.value == TDD && !get_softmodem_params()->continuous_tx) {
int slot_type = nr_slot_select(cfg,frame,slot%fp->slots_per_frame);
@@ -760,49 +761,41 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
}
//+ ru->end_of_burst_delay;
- flags = 3; // end of burst
+ flags_burst = TX_BURST_END;
} else if (slot_type == NR_DOWNLINK_SLOT) {
int prevslot_type = nr_slot_select(cfg,frame,(slot+(fp->slots_per_frame-1))%fp->slots_per_frame);
int nextslot_type = nr_slot_select(cfg,frame,(slot+1)%fp->slots_per_frame);
if (prevslot_type == NR_UPLINK_SLOT) {
- flags = 2; // start of burst
+ flags_burst = TX_BURST_START;
sf_extension = ru->sf_extension;
} else if (nextslot_type == NR_UPLINK_SLOT) {
- flags = 3; // end of burst
+ flags_burst = TX_BURST_END;
} else {
- flags = 1; // middle of burst
+ flags_burst = TX_BURST_MIDDLE;
}
}
} else { // FDD
- if (proc->first_tx == 1) {
- flags = 2; // start of burst
- } else {
- flags = 1; // middle of burst
- }
+ flags_burst = proc->first_tx == 1 ? TX_BURST_START : TX_BURST_MIDDLE;
}
- if (flags) {
if (fp->freq_range==nr_FR2) {
- // the beam index is written in bits 8-10 of the flags
- // bit 11 enables the gpio programming
- // currently we switch beams every 10 slots (should = 1 TDD period in FR2) and we take the beam index of the first symbol of the first slot of this period
- int beam=0;
+ // currently we switch beams at the beginning of a slot and we take the beam index of the first symbol of this slot
+ // we only send the beam to the gpio if the beam is different from the previous slot
- if (slot%10==0) {
- if ( ru->common.beam_id && (ru->common.beam_id[0][slot*fp->symbols_per_slot] < 8)) {
- beam = ru->common.beam_id[0][slot*fp->symbols_per_slot] | 8;
+ if ( ru->common.beam_id) {
+ int prev_slot = (slot - 1 + fp->slots_per_frame) % fp->slots_per_frame;
+ const uint8_t *beam_ids = ru->common.beam_id[0];
+ int prev_beam = beam_ids[prev_slot * fp->symbols_per_slot];
+ int beam = beam_ids[slot * fp->symbols_per_slot];
+ if (prev_beam != beam) {
+ flags_gpio = beam | TX_GPIO_CHANGE; // enable change of gpio
+ LOG_D(HW, "slot %d, beam %d\n", slot, ru->common.beam_id[0][slot * fp->symbols_per_slot]);
}
}
-
- /*
- if (slot==0 || slot==40) beam=0|8;
- if (slot==10 || slot==50) beam=1|8;
- if (slot==20 || slot==60) beam=2|8;
- if (slot==30 || slot==70) beam=3|8;
- */
- flags |= beam<<8;
- LOG_D(HW,"slot %d, beam %d\n",slot,ru->common.beam_id[0][slot*fp->symbols_per_slot]);
}
+
+ const int flags = flags_burst | flags_gpio << 4;
+
if (proc->first_tx == 1) proc->first_tx = 0;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_WRITE_FLAGS, flags );
@@ -825,7 +818,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
(long long unsigned int)(timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension),frame,slot,proc->frame_tx_unwrap,slot, flags, siglen+sf_extension, txs,10*log10((double)signal_energy(txp[0],siglen+sf_extension)));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 );
//AssertFatal(txs == 0,"trx write function error %d\n", txs);
- }
+
}
// this is for RU with local RF unit
diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c
index 0ecd46e5e0..2cbea144cf 100644
--- a/executables/nr-softmodem.c
+++ b/executables/nr-softmodem.c
@@ -581,8 +581,10 @@ int main( int argc, char **argv ) {
RCconfig_NR_L1();
// don't create if node doesn't connect to RRC/S1/GTP
- int ret=create_gNB_tasks(1);
- AssertFatal(ret==0,"cannot create ITTI tasks\n");
+ if (NFAPI_MODE != NFAPI_MODE_PNF) {
+ int ret = create_gNB_tasks(1);
+ AssertFatal(ret == 0, "cannot create ITTI tasks\n");
+ }
// init UE_PF_PO and mutex lock
pthread_mutex_init(&ue_pf_po_mutex, NULL);
@@ -598,28 +600,6 @@ int main( int argc, char **argv ) {
pthread_mutex_init(&sync_mutex, NULL);
}
- const char *nfapi_mode_str = "";
-
- switch(NFAPI_MODE) {
- case 0:
- nfapi_mode_str = "MONOLITHIC";
- break;
-
- case 1:
- nfapi_mode_str = "PNF";
- break;
-
- case 2:
- nfapi_mode_str = "VNF";
- break;
-
- default:
- nfapi_mode_str = "";
- break;
- }
-
- printf("NFAPI MODE:%s\n", nfapi_mode_str);
-
printf("START MAIN THREADS\n");
// start the main threads
number_of_cards = 1;
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index cd64a66287..61e12a158f 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -509,7 +509,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD) {
txp[i] = (void *)&UE->common_vars.txdata[i][UE->frame_parms.get_samples_slot_timestamp(
proc->nr_slot_tx, &UE->frame_parms, 0)];
- radio_tx_flag_t flags = Invalid;
+ radio_tx_burst_flag_t flags = TX_BURST_INVALID;
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
@@ -531,13 +531,13 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD) {
uint8_t first_tx_slot = tdd_period - num_UL_slots;
if (slot_tx_usrp % tdd_period == first_tx_slot)
- flags = StartOfBurst;
+ flags = TX_BURST_START;
else if (slot_tx_usrp % tdd_period == first_tx_slot + num_UL_slots - 1)
- flags = EndOfBurst;
+ flags = TX_BURST_END;
else if (slot_tx_usrp % tdd_period > first_tx_slot)
- flags = MiddleOfBurst;
+ flags = TX_BURST_MIDDLE;
} else {
- flags = MiddleOfBurst;
+ flags = TX_BURST_MIDDLE;
}
if (flags || IS_SOFTMODEM_RFSIM)
diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c
index e1a3583bb0..7c0b9cd1cd 100644
--- a/executables/softmodem-common.c
+++ b/executables/softmodem-common.c
@@ -98,17 +98,25 @@ void get_common_options(uint32_t execmask) {
uint32_t start_websrv = 0;
uint32_t noS1 = 0, nokrnmod = 1, nonbiot = 0;
uint32_t rfsim = 0, do_forms = 0;
+ int nfapi_index = 0;
char *logmem_filename = NULL;
- paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
+ check_execmask(execmask);
+
+ paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC;
+ checkedparam_t cmdline_CheckParams[] = CMDLINE_PARAMS_CHECK_DESC;
+ int numparams = sizeof(cmdline_params) / sizeof(paramdef_t);
+ config_set_checkfunctions(cmdline_params, cmdline_CheckParams, numparams);
+ config_get(cmdline_params, sizeof(cmdline_params) / sizeof(paramdef_t), NULL);
+ nfapi_index = config_paramidx_fromname(cmdline_params, sizeof(cmdline_params) / sizeof(paramdef_t),"nfapi");
+ AssertFatal(nfapi_index != -1,"Index for nfapi config option not found!");
+ nfapi_mode = config_get_processedint(&cmdline_params[nfapi_index]);
+
paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
- check_execmask(execmask);
- config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
-
- int numparams=sizeof(cmdline_logparams)/sizeof(paramdef_t);
- config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,numparams);
- config_get( cmdline_logparams,numparams,NULL);
-
+ int numlogparams = sizeof(cmdline_logparams) / sizeof(paramdef_t);
+ config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams, numlogparams);
+ config_get(cmdline_logparams, numlogparams, NULL);
+
if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_FLOG_OPT))) {
set_glog_onlinelog(online_log_messages);
}
diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h
index 752b64bb38..1263d9713b 100644
--- a/executables/softmodem-common.h
+++ b/executables/softmodem-common.h
@@ -97,7 +97,7 @@ extern "C"
#define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n"
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n"
-#define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR\n"
+#define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR 'MONOLITHIC', 'PNF', 'VNF','UE_STUB_PNF','UE_STUB_OFFNET','STANDALONE_PNF'\n"
#define CONFIG_L1_EMULATOR "Run in L1 emulated mode (disable PHY layer)\n"
#define CONFIG_HLP_CONTINUOUS_TX "perform continuous transmission, even in TDD mode (to work around USRP issues)\n"
#define CONFIG_HLP_STATS_DISABLE "disable globally the stats generation and persistence"
@@ -167,13 +167,58 @@ extern int usrp_tx_thread;
{"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \
{"node-number", NULL, 0, u16ptr:&NODE_NUMBER, defuintval:0, TYPE_UINT16, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
- {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \
+ {"nfapi", CONFIG_HLP_NFAPI, 0, strptr:NULL, defstrval:"MONOLITHIC", TYPE_STRING, 0}, \
{"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \
{"emulate-l1", CONFIG_L1_EMULATOR, PARAMFLAG_BOOL, iptr:&EMULATE_L1, defintval:0, TYPE_INT, 0}, \
{"continuous-tx", CONFIG_HLP_CONTINUOUS_TX,PARAMFLAG_BOOL, iptr:&CONTINUOUS_TX, defintval:0, TYPE_INT, 0}, \
{"disable-stats", CONFIG_HLP_STATS_DISABLE, PARAMFLAG_BOOL, iptr:&stats_disabled, defintval:0, TYPE_INT, 0}, \
}
+
+
+#define CMDLINE_PARAMS_CHECK_DESC { \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s3a = { config_checkstr_assign_integer, \
+ {"MONOLITHIC", "PNF", "VNF","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF"}, \
+ {NFAPI_MONOLITHIC, NFAPI_MODE_PNF, NFAPI_MODE_VNF,NFAPI_UE_STUB_PNF,NFAPI_UE_STUB_OFFNET,NFAPI_MODE_STANDALONE_PNF}, \
+ 6 } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+ { .s5 = { NULL } }, \
+}
+
#define CONFIG_HLP_NSA "Enable NSA mode \n"
#define CONFIG_HLP_FLOG "Enable online log \n"
#define CONFIG_HLP_LOGL "Set the global log level, valid options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n"
diff --git a/maketags b/maketags
index 5c7232320a..87f445dd21 100755
--- a/maketags
+++ b/maketags
@@ -1,4 +1,4 @@
#!/bin/sh
echo "building ctags for openair1 and openair2 ..."
-ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair1/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 openair3 targets cmake_targets common nfapi executables
+ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair1/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 openair3 targets cmake_targets common nfapi executables sdr
diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c
index 864791141f..cfed33b77d 100644
--- a/nfapi/oai_integration/nfapi_pnf.c
+++ b/nfapi/oai_integration/nfapi_pnf.c
@@ -548,13 +548,12 @@ int pnf_stop_request(nfapi_pnf_config_t *config, nfapi_pnf_stop_request_t *req)
int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_param_request_t *req) {
printf("[PNF] Received NFAPI_PARAM_REQUEST phy_id:%d\n", req->header.phy_id);
- //pnf_info* pnf = (pnf_info*)(config->user_data);
nfapi_param_response_t nfapi_resp;
pnf_info *pnf = (pnf_info *)(config->user_data);
memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_PARAM_RESPONSE;
nfapi_resp.header.phy_id = req->header.phy_id;
- nfapi_resp.error_code = 0; // DJP - what value???
+ nfapi_resp.error_code = 0;
struct sockaddr_in pnf_p7_sockaddr;
pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr);
nfapi_resp.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG;
@@ -562,7 +561,7 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
nfapi_resp.num_tlv++;
// P7 PNF Port
nfapi_resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG;
- nfapi_resp.nfapi_config.p7_pnf_port.value = 32123; // DJP - hard code alert!!!! FIXME TODO
+ nfapi_resp.nfapi_config.p7_pnf_port.value = htons(pnf->phys[0].udp.rx_port);
nfapi_resp.num_tlv++;
nfapi_pnf_param_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_PARAM_RESPONSE phy_id:%d number_of_tlvs:%u\n", req->header.phy_id, nfapi_resp.num_tlv);
@@ -572,13 +571,12 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
int nr_param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nr_param_request_scf_t *req) {
printf("[PNF] Received NFAPI_PARAM_REQUEST phy_id:%d\n", req->header.phy_id);
- //pnf_info* pnf = (pnf_info*)(config->user_data);
nfapi_nr_param_response_scf_t nfapi_resp;
pnf_info *pnf = (pnf_info *)(config->user_data);
memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE;
nfapi_resp.header.phy_id = req->header.phy_id;
- nfapi_resp.error_code = 0; // DJP - what value???
+ nfapi_resp.error_code = 0;
struct sockaddr_in pnf_p7_sockaddr;
// ASSIGN TAGS
@@ -775,7 +773,7 @@ int nr_param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nf
nfapi_resp.num_tlv++;
}
- nfapi_resp.nfapi_config.p7_pnf_port.value = 32123; //pnf->phys[0].local_port; DJP - hard code alert!!!! FIXME TODO
+ nfapi_resp.nfapi_config.p7_pnf_port.value = htons(pnf->phys[0].udp.rx_port);
nfapi_resp.num_tlv++;
pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr);
@@ -877,7 +875,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
num_tlv++;
}
- fp->num_MBSFN_config = 0; // DJP - hard code alert
+ fp->num_MBSFN_config = 0; // hard code alert
if (req->sch_config.physical_cell_id.tl.tag == NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG) {
fp->Nid_cell = req->sch_config.physical_cell_id.value;
@@ -929,13 +927,13 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
}
if (req->pusch_config.hopping_mode.tl.tag == NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG) {
- } // DJP - not being handled?
+ } // not being handled?
if (req->pusch_config.hopping_offset.tl.tag == NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG) {
- } // DJP - not being handled?
+ } // not being handled?
if (req->pusch_config.number_of_subbands.tl.tag == NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG) {
- } // DJP - not being handled?
+ } // not being handled?
if (req->prach_config.configuration_index.tl.tag == NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG) {
fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=req->prach_config.configuration_index.value;
@@ -964,7 +962,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
- printf("[PNF] Simulating PHY CONFIG - DJP\n");
+ printf("[PNF] Simulating PHY CONFIG\n");
PHY_Config_t phy_config;
phy_config.Mod_id = 0;
phy_config.CC_id=0;
@@ -982,7 +980,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_CONFIG_RESPONSE;
nfapi_resp.header.phy_id = phy_info->id;
- nfapi_resp.error_code = 0; // DJP - some value resp->error_code;
+ nfapi_resp.error_code = 0;
nfapi_pnf_config_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
@@ -1058,7 +1056,7 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
- printf("[PNF] Simulating PHY CONFIG - DJP\n");
+ printf("[PNF] Simulating PHY CONFIG\n");
NR_PHY_Config_t nr_phy_config;
nr_phy_config.Mod_id = 0;
nr_phy_config.CC_id=0;
@@ -1076,7 +1074,7 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE;
nfapi_resp.header.phy_id = phy_info->id;
- nfapi_resp.error_code = 0; // DJP - some value resp->error_code;
+ nfapi_resp.error_code = 0;
nfapi_nr_pnf_config_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_PNF_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
@@ -1630,8 +1628,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
p7_config->phy_id = phy->phy_id;
p7_config->remote_p7_port = phy_info->remote_port;
p7_config->remote_p7_addr = phy_info->remote_addr;
- p7_config->local_p7_port = 32123;//phy_info->local_port;//50010; // DJP - good grief cannot seem to get the right answer phy_info->local_port;
- //DJP p7_config->local_p7_addr = (char*)phy_info->local_addr.c_str();
+ p7_config->local_p7_port = phy_info->udp.rx_port;
p7_config->local_p7_addr = phy_info->local_addr;
printf("[PNF] P7 remote:%s:%d local:%s:%d\n", p7_config->remote_p7_addr, p7_config->remote_p7_port, p7_config->local_p7_addr, p7_config->local_p7_port);
p7_config->user_data = phy_info;
@@ -1702,7 +1699,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
//((pnf_phy_user_data_t*)(phy_info->fapi->user_data))->p7_config = p7_config;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__);
l1_north_init_eNB();
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
p7_config_g = p7_config;
// Need to wait for main thread to create RU structures
@@ -1736,7 +1733,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
printf("[PNF] Sending PNF_START_RESP\n");
nfapi_send_pnf_start_resp(config, p7_config->phy_id);
printf("[PNF] Sending first P7 subframe ind\n");
- nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // DJP - SFN_SF set to zero - correct???
+ nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // SFN_SF set to zero - correct???
printf("[PNF] Sent first P7 subframe ind\n");
return 0;
}
@@ -1749,9 +1746,8 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
p7_config->phy_id = phy->phy_id;
p7_config->remote_p7_port = phy_info->remote_port;
p7_config->remote_p7_addr = phy_info->remote_addr;
- // TODO: remove this hardcoded port
- p7_config->local_p7_port = 32123; // DJP - good grief cannot seem to get the right answer phy_info->local_port;
- //DJP p7_config->local_p7_addr = (char*)phy_info->local_addr.c_str();
+
+ p7_config->local_p7_port = phy_info->udp.rx_port;
p7_config->local_p7_addr = phy_info->local_addr;
printf("[PNF] P7 remote:%s:%d local:%s:%d\n", p7_config->remote_p7_addr, p7_config->remote_p7_port, p7_config->local_p7_addr, p7_config->local_p7_port);
p7_config->user_data = phy_info;
@@ -1827,10 +1823,9 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating P7 thread %s\n", __FUNCTION__);
pthread_t p7_thread;
pthread_create(&p7_thread, NULL, &pnf_nr_p7_thread_start, p7_config);
- //((pnf_phy_user_data_t*)(phy_info->fapi->user_data))->p7_config = p7_config;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__);
l1_north_init_gNB();
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
p7_config_g = p7_config;
// Need to wait for main thread to create RU structures
@@ -1868,7 +1863,7 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
nfapi_pnf_p7_slot_ind(p7_config, p7_config->phy_id, 0, 0);
printf("[PNF] Sent first P7 slot ind\n");
#else
- nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // DJP - SFN_SF set to zero - correct???
+ nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // SFN_SF set to zero - correct???
printf("[PNF] Sent first P7 subframe ind\n");
#endif
@@ -1982,8 +1977,6 @@ int broadcast_detect_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t
case NFAPI_RAT_TYPE_UTRAN: {
ind.utran_broadcast_detect_indication.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG;
ind.utran_broadcast_detect_indication.mib_length = 4;
- //ind.utran_broadcast_detect_indication.mib...
- // ind.utran_broadcast_detect_indication.sfn_offset; DJP - nonsense line
}
break;
}
@@ -2149,7 +2142,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
config->vnf_ip_addr = vnf_ip_addr;
config->vnf_p5_port = vnf_p5_port;
pnf.phys[0].udp.enabled = 1;
- pnf.phys[0].udp.rx_port = 32123;//pnf_p7_port;
+ pnf.phys[0].udp.rx_port = pnf_p7_port;
pnf.phys[0].udp.tx_port = vnf_p7_port;
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
@@ -2200,7 +2193,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
config->vnf_ip_addr = vnf_ip_addr;
config->vnf_p5_port = vnf_p5_port;
pnf.phys[0].udp.enabled = 1;
- pnf.phys[0].udp.rx_port = 32123;//pnf_p7_port;
+ pnf.phys[0].udp.rx_port = pnf_p7_port;
pnf.phys[0].udp.tx_port = vnf_p7_port;
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
@@ -2242,7 +2235,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
void oai_subframe_ind(uint16_t sfn, uint16_t sf) {
//LOG_D(PHY,"%s(sfn:%d, sf:%d)\n", __FUNCTION__, sfn, sf);
- //TODO FIXME - HACK - DJP - using a global to bodge it in
+ //TODO FIXME - HACK - using a global to bodge it in
if (p7_config_g != NULL && sync_var==0) {
uint16_t sfn_sf_tx = sfn<<4 | sf;
@@ -2282,13 +2275,13 @@ void handle_nr_slot_ind(uint16_t sfn, uint16_t slot) {
}
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {
- rach_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ rach_ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
LOG_D(PHY, "%s() sfn_sf:%d preambles:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(rach_ind->sfn_sf), rach_ind->rach_indication_body.number_of_preambles);
return nfapi_pnf_p7_rach_ind(p7_config_g, rach_ind);
}
int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind) {
- harq_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ harq_ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
harq_ind->header.message_id = NFAPI_HARQ_INDICATION;
LOG_D(PHY, "%s() sfn_sf:%d number_of_harqs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(harq_ind->sfn_sf), harq_ind->harq_indication_body.number_of_harqs);
int retval = nfapi_pnf_p7_harq_ind(p7_config_g, harq_ind);
@@ -2300,21 +2293,21 @@ int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind) {
}
int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind) {
- crc_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ crc_ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
crc_ind->header.message_id = NFAPI_CRC_INDICATION;
//LOG_D(PHY, "%s() sfn_sf:%d number_of_crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(crc_ind->sfn_sf), crc_ind->crc_indication_body.number_of_crcs);
return nfapi_pnf_p7_crc_ind(p7_config_g, crc_ind);
}
int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *ind) {
- ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_RX_CQI_INDICATION;
//LOG_D(PHY, "%s() sfn_sf:%d number_of_cqis:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
return nfapi_pnf_p7_cqi_ind(p7_config_g, ind);
}
int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind) {
- ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_RX_ULSCH_INDICATION;
int retval = nfapi_pnf_p7_rx_ind(p7_config_g, ind);
//LOG_D(PHY,"%s() SFN/SF:%d pdus:%d retval:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, retval);
@@ -2323,7 +2316,7 @@ int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind) {
}
int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind) {
- ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
int retval = nfapi_pnf_p7_sr_ind(p7_config_g, ind);
//LOG_D(PHY,"%s() SFN/SF:%d srs:%d retval:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs, retval);
//free(ind.rx_indication_body.rx_pdu_list);
@@ -2339,31 +2332,31 @@ int oai_nfapi_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind) {
}
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) {
- ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION;
return nfapi_pnf_p7_nr_rx_data_ind(p7_config_g, ind);
}
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) {
- ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION;
return nfapi_pnf_p7_nr_crc_ind(p7_config_g, ind);
}
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) {
- ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION;
return nfapi_pnf_p7_nr_srs_ind(p7_config_g, ind);
}
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) {
- ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION;
return nfapi_pnf_p7_nr_uci_ind(p7_config_g, ind);
}
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) {
- ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION;
return nfapi_pnf_p7_nr_rach_ind(p7_config_g, ind);
}
diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c
index a83f87ec8a..750b31da98 100644
--- a/nfapi/oai_integration/nfapi_vnf.c
+++ b/nfapi/oai_integration/nfapi_vnf.c
@@ -335,8 +335,8 @@ int pnf_nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_pa
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
- req.pnf_phy_rf_config.number_phy_rf_config_info = 2; // DJP pnf.phys.size();
- NFAPI_TRACE(NFAPI_TRACE_INFO, "DJP:Hard coded num phy rf to 2\n");
+ req.pnf_phy_rf_config.number_phy_rf_config_info = 2; // pnf.phys.size();
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "Hard coded num phy rf to 2\n");
for(unsigned i = 0; i < 2; ++i) {
req.pnf_phy_rf_config.phy_rf_config[i].phy_id = pnf->phys[i].id;
@@ -378,8 +378,8 @@ int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_re
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
- req.pnf_phy_rf_config.number_phy_rf_config_info = 2; // DJP pnf.phys.size();
- NFAPI_TRACE(NFAPI_TRACE_INFO, "DJP:Hard coded num phy rf to 2\n");
+ req.pnf_phy_rf_config.number_phy_rf_config_info = 2; // pnf.phys.size();
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "Hard coded num phy rf to 2\n");
for(unsigned i = 0; i < 2; ++i) {
req.pnf_phy_rf_config.phy_rf_config[i].phy_id = pnf->phys[i].id;
@@ -1574,7 +1574,7 @@ int nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_resp
phy_info *phy = pnf->phys;
struct sockaddr_in pnf_p7_sockaddr;
nfapi_nr_config_request_scf_t *req = &RC.nrmac[0]->config[0]; // check
- phy->remote_port = 50610;//resp->nfapi_config.p7_pnf_port.value;
+ phy->remote_port = resp->nfapi_config.p7_pnf_port.value;
//phy->remote_port = 32123;//resp->nfapi_config.p7_pnf_port.value;
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
@@ -1589,13 +1589,13 @@ int nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_resp
req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NR_NFAPI_P7_VNF_PORT_TAG;
req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port;
req->num_tlv++;
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] DJP local_port:%d\n", p7_vnf->local_port);
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Local_port:%d\n", ntohs(p7_vnf->local_port));
req->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
struct sockaddr_in vnf_p7_sockaddr;
vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf->local_addr);
memcpy(&(req->nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4);
req->num_tlv++;
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] DJP local_addr:%s\n", p7_vnf->local_addr);
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Local_addr:%s\n", p7_vnf->local_addr);
req->nfapi_config.timing_window.tl.tag = NFAPI_NR_NFAPI_TIMING_WINDOW_TAG;
req->nfapi_config.timing_window.value = p7_vnf->timing_window;
NFAPI_TRACE(NFAPI_TRACE_INFO, "\n[VNF]Timing window tag : %d Timing window:%u\n",NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, p7_vnf->timing_window);
@@ -1637,7 +1637,7 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t
phy_info *phy = pnf->phys;
struct sockaddr_in pnf_p7_sockaddr;
nfapi_config_request_t *req = &RC.mac[0]->config[0];
- phy->remote_port = 32123;//resp->nfapi_config.p7_pnf_port.value;
+ phy->remote_port = resp->nfapi_config.p7_pnf_port.value;
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
// for now just 1
@@ -1649,13 +1649,13 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t
req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NFAPI_P7_VNF_PORT_TAG;
req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port;
req->num_tlv++;
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] DJP local_port:%d\n", p7_vnf->local_port);
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Local_port:%d\n", ntohs(p7_vnf->local_port));
req->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
struct sockaddr_in vnf_p7_sockaddr;
vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf->local_addr);
memcpy(&(req->nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4);
req->num_tlv++;
- NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] DJP local_addr:%s\n", p7_vnf->local_addr);
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Local_addr:%s\n", p7_vnf->local_addr);
req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
req->nfapi_config.timing_window.value = p7_vnf->timing_window;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Timing window:%u\n", p7_vnf->timing_window);
@@ -1788,7 +1788,7 @@ void vnf_start_thread(void *ptr) {
static vnf_info vnf;
-void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
+void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) {
nfapi_setmode(NFAPI_MODE_VNF);
memset(&vnf, 0, sizeof(vnf));
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
@@ -1799,9 +1799,7 @@ void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port);
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
- //vnf.p7_vnfs[0].local_port = vnf.p7_vnfs[0].local_port; // 50001; // TODO: remove hardcode
- vnf.p7_vnfs[0].local_port = 50611;
- //vnf.p7_vnfs[0].local_port = 50011;
+ vnf.p7_vnfs[0].local_port = vnf_p7_port;
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
config->malloc = malloc;
@@ -1839,7 +1837,7 @@ void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
}
-void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
+void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) {
nfapi_setmode(NFAPI_MODE_VNF);
memset(&vnf, 0, sizeof(vnf));
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
@@ -1850,8 +1848,7 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port);
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
- //vnf.p7_vnfs[0].local_port = vnf.p7_vnfs[0].local_port; // 50001; // TODO: remove hardcode
- vnf.p7_vnfs[0].local_port = 50011;
+ vnf.p7_vnfs[0].local_port = vnf_p7_port;
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
config->malloc = malloc;
@@ -1890,7 +1887,7 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
- dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ dl_config_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
LOG_D(PHY, "[VNF] %s() DL_CONFIG_REQ sfn_sf:%d_%d number_of_pdus:%d\n", __FUNCTION__,
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_config_req->dl_config_request_body.number_pdu);
@@ -1927,7 +1924,7 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
LOG_D(NR_PHY, "Entering oai_nfapi_nr_dl_config_req sfn:%d,slot:%d\n", dl_config_req->SFN, dl_config_req->Slot);
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
dl_config_req->header.message_id= NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST;
- dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ dl_config_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
int retval = nfapi_vnf_p7_nr_dl_config_req(p7_config, dl_config_req);
@@ -1945,7 +1942,7 @@ int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
{
LOG_D(NR_PHY, "Entering oai_nfapi_nr_tx_data_req sfn:%d,slot:%d\n", tx_data_req->SFN, tx_data_req->Slot);
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
- tx_data_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ tx_data_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
tx_data_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST;
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
int retval = nfapi_vnf_p7_tx_data_req(p7_config, tx_data_req);
@@ -1962,7 +1959,7 @@ int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
{
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
- tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ tx_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
tx_req->header.message_id = NFAPI_TX_REQUEST;
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req);
@@ -1978,7 +1975,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
- ul_dci_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ul_dci_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ul_dci_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST;
//LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
int retval = nfapi_vnf_p7_ul_dci_req(p7_config, ul_dci_req);
@@ -1994,7 +1991,7 @@ int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req) {
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
- hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ hi_dci0_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
//LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
int retval = nfapi_vnf_p7_hi_dci0_req(p7_config, hi_dci0_req);
@@ -2031,7 +2028,7 @@ static void remove_ul_config_req_pdu(int index, nfapi_ul_config_request_t *ul_co
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
- ul_tti_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ul_tti_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ul_tti_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST;
int retval = nfapi_vnf_p7_ul_tti_req(p7_config, ul_tti_req);
@@ -2050,7 +2047,7 @@ int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req) {
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
- ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ ul_config_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ul_config_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
//LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id);
//LOG_D(PHY, "[VNF] %s() UL_CONFIG sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present);
@@ -2111,7 +2108,7 @@ int oai_nfapi_ue_release_req(nfapi_ue_release_request_t *release_req){
return 0;
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
- release_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
+ release_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
release_req->header.message_id = NFAPI_UE_RELEASE_REQUEST;
release_req->ue_release_request_body.tl.tag = NFAPI_UE_RELEASE_BODY_TAG;
diff --git a/nfapi/oai_integration/nfapi_vnf.h b/nfapi/oai_integration/nfapi_vnf.h
index 478956f75c..12126465fe 100644
--- a/nfapi/oai_integration/nfapi_vnf.h
+++ b/nfapi/oai_integration/nfapi_vnf.h
@@ -20,8 +20,8 @@
*/
-void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port);
-void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port);
+void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
+void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
uint32_t sfnslot_add_slot(uint16_t sfn, uint16_t slot, int offset);
diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c
index 0ce847a735..a7e7e0cb6e 100644
--- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c
+++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c
@@ -967,7 +967,7 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
slot = shifted_slot;
//
- // DJP - why does the shift not apply to pnf_p7->sfn_sf???
+ // why does the shift not apply to pnf_p7->sfn_sf???
//
pnf_p7->slot_shift = 0;
@@ -1219,7 +1219,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
sfn_sf = shifted_sfn_sf;
//
- // DJP - why does the shift not apply to pnf_p7->sfn_sf???
+ // why does the shift not apply to pnf_p7->sfn_sf???
//
pnf_p7->sfn_sf_shift = 0;
@@ -2908,7 +2908,7 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, pnf_p7->rx_message_buffer_size,
MSG_DONTWAIT | MSG_TRUNC, (struct sockaddr*)&remote_addr, &remote_addr_size);
- now_hr_time = pnf_get_current_time_hr(); //DJP - moved to here - get closer timestamp???
+ now_hr_time = pnf_get_current_time_hr(); //moved to here - get closer timestamp???
if(recvfrom_result > 0)
{
@@ -2975,7 +2975,7 @@ void pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_tim
// read the segment
recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, header.message_length, MSG_DONTWAIT, (struct sockaddr*)&remote_addr, &remote_addr_size);
- now_hr_time = pnf_get_current_time_hr(); //DJP - moved to here - get closer timestamp???
+ now_hr_time = pnf_get_current_time_hr(); //moved to here - get closer timestamp???
if(recvfrom_result > 0)
{
@@ -3060,7 +3060,7 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7)
struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
- addr.sin_port = pnf_p7->_public.local_p7_port;
+ addr.sin_port = htons(pnf_p7->_public.local_p7_port);
if(pnf_p7->_public.local_p7_addr == 0)
{
@@ -3232,7 +3232,7 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
- addr.sin_port = pnf_p7->_public.local_p7_port;
+ addr.sin_port = htons(pnf_p7->_public.local_p7_port);
if(pnf_p7->_public.local_p7_addr == 0)
{
diff --git a/openair1/PHY/MODULATION/modulation_UE.h b/openair1/PHY/MODULATION/modulation_UE.h
index 147e0855d0..420cf07e3d 100644
--- a/openair1/PHY/MODULATION/modulation_UE.h
+++ b/openair1/PHY/MODULATION/modulation_UE.h
@@ -50,7 +50,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
int nr_slot_fep(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
- unsigned char l,
+ unsigned char symbol,
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]);
int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
index 2b858e9a91..6b988393d3 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
@@ -722,11 +722,10 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
return(0);
}
-
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
int estimateSz,
- struct complex16 dl_ch_estimates [][estimateSz],
- struct complex16 dl_ch_estimates_time [][ue->frame_parms.ofdm_symbol_size],
+ struct complex16 dl_ch_estimates[][estimateSz],
+ struct complex16 dl_ch_estimates_time[][ue->frame_parms.ofdm_symbol_size],
UE_nr_rxtx_proc_t *proc,
unsigned char symbol,
int dmrss,
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h
index cf4917369a..b779882c86 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h
@@ -69,8 +69,8 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
int estimateSz,
- struct complex16 dl_ch_estimates [][estimateSz],
- struct complex16 dl_ch_estimates_time [][estimateSz],
+ struct complex16 dl_ch_estimates[][estimateSz],
+ struct complex16 dl_ch_estimates_time[][ue->frame_parms.ofdm_symbol_size],
UE_nr_rxtx_proc_t *proc,
unsigned char symbol,
int dmrss,
@@ -90,7 +90,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pdsch,
uint32_t pdsch_est_size,
- int32_t pdsch_dl_ch_estimates[][pdsch_est_size],
+ int32_t dl_ch_estimates[][pdsch_est_size],
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]);
void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
diff --git a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c
index 6768c8bc37..08aa58d5f9 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c
@@ -43,6 +43,9 @@
// 10*log10(pow(2,30))
#define pow_2_30_dB 90
+// Additional memory allocation, because of applying the filter and the memory offset to ensure memory alignment
+#define FILTER_MARGIN 32
+
//#define NR_CSIRS_DEBUG
//#define NR_CSIIM_DEBUG
@@ -291,8 +294,9 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
const uint8_t *j_cdm,
const uint8_t *k_overline,
const uint8_t *l_overline,
+ uint8_t mem_offset,
int32_t csi_rs_ls_estimated_channel[][N_ports][ue->frame_parms.ofdm_symbol_size],
- int32_t csi_rs_estimated_channel_freq[][N_ports][ue->frame_parms.ofdm_symbol_size],
+ int32_t csi_rs_estimated_channel_freq[][N_ports][ue->frame_parms.ofdm_symbol_size + FILTER_MARGIN],
int16_t *log2_re,
int16_t *log2_maxh,
uint32_t *noise_power) {
@@ -376,7 +380,7 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
/// Channel interpolation
for(uint16_t port_tx = 0; port_txofdm_symbol_size*sizeof(int32_t));
+ memset(csi_rs_estimated_channel_freq[ant_rx][port_tx], 0, (frame_parms->ofdm_symbol_size + FILTER_MARGIN) * sizeof(int32_t));
}
for (int rb = csirs_config_pdu->start_rb; rb < (csirs_config_pdu->start_rb+csirs_config_pdu->nr_of_rbs); rb++) {
@@ -389,9 +393,10 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
count++;
uint16_t k = (frame_parms->first_carrier_offset + rb*NR_NB_SC_PER_RB) % frame_parms->ofdm_symbol_size;
+ uint16_t k_offset = k + mem_offset;
for(uint16_t port_tx = 0; port_txfirst_carrier_offset) ) { // Start of OFDM symbol case or first occupied subcarrier case
multadd_real_vector_complex_scalar(filt24_start, csi_rs_ls_estimated_channel16, csi_rs_estimated_channel16, 24);
} else if( ( (k + NR_NB_SC_PER_RB) >= frame_parms->ofdm_symbol_size) ||
@@ -411,9 +416,10 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
continue;
}
uint16_t k = (frame_parms->first_carrier_offset + rb*NR_NB_SC_PER_RB) % frame_parms->ofdm_symbol_size;
+ uint16_t k_offset = k + mem_offset;
for(uint16_t port_tx = 0; port_txstart_rb] = abs(csi_rs_ls_estimated_channel16->r-csi_rs_estimated_channel16->r);
noise_imag[ant_rx][port_tx][rb-csirs_config_pdu->start_rb] = abs(csi_rs_ls_estimated_channel16->i-csi_rs_estimated_channel16->i);
maxh = cmax3(maxh, abs(csi_rs_estimated_channel16->r), abs(csi_rs_estimated_channel16->i));
@@ -431,7 +437,7 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
LOG_I(NR_PHY, "(k = %4d) |\t", k);
for(uint16_t port_tx = 0; port_tx ant_rx %d : ls (%4d,%4d), int (%4d,%4d), noise (%4d,%4d) | ",
port_tx+3000, ant_rx,
csi_rs_ls_estimated_channel16[k].r, csi_rs_ls_estimated_channel16[k].i,
@@ -460,7 +466,8 @@ int nr_csi_rs_ri_estimation(const PHY_VARS_NR_UE *ue,
const fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu,
const nr_csi_info_t *nr_csi_info,
const uint8_t N_ports,
- int32_t csi_rs_estimated_channel_freq[][N_ports][ue->frame_parms.ofdm_symbol_size],
+ uint8_t mem_offset,
+ int32_t csi_rs_estimated_channel_freq[][N_ports][ue->frame_parms.ofdm_symbol_size + FILTER_MARGIN],
const int16_t log2_maxh,
uint8_t *rank_indicator) {
@@ -482,12 +489,11 @@ int nr_csi_rs_ri_estimation(const PHY_VARS_NR_UE *ue,
* | conjch01 conjch11 | | ch10 ch11 | | conjch01*ch00+conjch11*ch10 conjch01*ch01+conjch11*ch11 |
*/
- int32_t csi_rs_estimated_conjch_ch[frame_parms->nb_antennas_rx][N_ports][frame_parms->nb_antennas_rx][N_ports][frame_parms->ofdm_symbol_size] __attribute__((aligned(32)));
- int32_t csi_rs_estimated_A_MF[N_ports][N_ports][frame_parms->ofdm_symbol_size] __attribute__((aligned(32)));
- int32_t csi_rs_estimated_A_MF_sq[N_ports][N_ports][frame_parms->ofdm_symbol_size] __attribute__((aligned(32)));
- int32_t csi_rs_estimated_determ_fin[frame_parms->ofdm_symbol_size] __attribute__((aligned(32)));
- int32_t csi_rs_estimated_numer_fin[frame_parms->ofdm_symbol_size] __attribute__((aligned(32)));
-
+ int32_t csi_rs_estimated_conjch_ch[frame_parms->nb_antennas_rx][N_ports][frame_parms->nb_antennas_rx][N_ports][frame_parms->ofdm_symbol_size + FILTER_MARGIN] __attribute__((aligned(32)));
+ int32_t csi_rs_estimated_A_MF[N_ports][N_ports][frame_parms->ofdm_symbol_size + FILTER_MARGIN] __attribute__((aligned(32)));
+ int32_t csi_rs_estimated_A_MF_sq[N_ports][N_ports][frame_parms->ofdm_symbol_size + FILTER_MARGIN] __attribute__((aligned(32)));
+ int32_t csi_rs_estimated_determ_fin[frame_parms->ofdm_symbol_size + FILTER_MARGIN] __attribute__((aligned(32)));
+ int32_t csi_rs_estimated_numer_fin[frame_parms->ofdm_symbol_size + FILTER_MARGIN] __attribute__((aligned(32)));
const uint8_t sum_shift = 1; // log2(2x2) = 2, which is a shift of 1 bit
for (int rb = csirs_config_pdu->start_rb; rb < (csirs_config_pdu->start_rb+csirs_config_pdu->nr_of_rbs); rb++) {
@@ -496,6 +502,7 @@ int nr_csi_rs_ri_estimation(const PHY_VARS_NR_UE *ue,
continue;
}
uint16_t k = (frame_parms->first_carrier_offset + rb*NR_NB_SC_PER_RB) % frame_parms->ofdm_symbol_size;
+ uint16_t k_offset = k + mem_offset;
for (int ant_rx_conjch = 0; ant_rx_conjch < frame_parms->nb_antennas_rx; ant_rx_conjch++) {
for(uint16_t port_tx_conjch = 0; port_tx_conjch < N_ports; port_tx_conjch++) {
@@ -503,16 +510,16 @@ int nr_csi_rs_ri_estimation(const PHY_VARS_NR_UE *ue,
for(uint16_t port_tx_ch = 0; port_tx_ch < N_ports; port_tx_ch++) {
// conjch x ch computation
- nr_conjch0_mult_ch1(&csi_rs_estimated_channel_freq[ant_rx_conjch][port_tx_conjch][k],
- &csi_rs_estimated_channel_freq[ant_rx_ch][port_tx_ch][k],
- &csi_rs_estimated_conjch_ch[ant_rx_conjch][port_tx_conjch][ant_rx_ch][port_tx_ch][k],
+ nr_conjch0_mult_ch1(&csi_rs_estimated_channel_freq[ant_rx_conjch][port_tx_conjch][k_offset],
+ &csi_rs_estimated_channel_freq[ant_rx_ch][port_tx_ch][k_offset],
+ &csi_rs_estimated_conjch_ch[ant_rx_conjch][port_tx_conjch][ant_rx_ch][port_tx_ch][k_offset],
1,
log2_maxh);
// construct Hh x H elements
if(ant_rx_conjch == ant_rx_ch) {
- nr_a_sum_b((__m128i *)&csi_rs_estimated_A_MF[port_tx_conjch][port_tx_ch][k],
- (__m128i *)&csi_rs_estimated_conjch_ch[ant_rx_conjch][port_tx_conjch][ant_rx_ch][port_tx_ch][k],
+ nr_a_sum_b((__m128i *)&csi_rs_estimated_A_MF[port_tx_conjch][port_tx_ch][k_offset],
+ (__m128i *)&csi_rs_estimated_conjch_ch[ant_rx_conjch][port_tx_conjch][ant_rx_ch][port_tx_ch][k_offset],
1);
}
}
@@ -521,44 +528,44 @@ int nr_csi_rs_ri_estimation(const PHY_VARS_NR_UE *ue,
}
// compute the determinant of A_MF (denominator)
- nr_det_A_MF_2x2(&csi_rs_estimated_A_MF[0][0][k],
- &csi_rs_estimated_A_MF[0][1][k],
- &csi_rs_estimated_A_MF[1][0][k],
- &csi_rs_estimated_A_MF[1][1][k],
- &csi_rs_estimated_determ_fin[k],
+ nr_det_A_MF_2x2(&csi_rs_estimated_A_MF[0][0][k_offset],
+ &csi_rs_estimated_A_MF[0][1][k_offset],
+ &csi_rs_estimated_A_MF[1][0][k_offset],
+ &csi_rs_estimated_A_MF[1][1][k_offset],
+ &csi_rs_estimated_determ_fin[k_offset],
1);
// compute the square of A_MF (numerator)
- nr_squared_matrix_element(&csi_rs_estimated_A_MF[0][0][k], &csi_rs_estimated_A_MF_sq[0][0][k], 1);
- nr_squared_matrix_element(&csi_rs_estimated_A_MF[0][1][k], &csi_rs_estimated_A_MF_sq[0][1][k], 1);
- nr_squared_matrix_element(&csi_rs_estimated_A_MF[1][0][k], &csi_rs_estimated_A_MF_sq[1][0][k], 1);
- nr_squared_matrix_element(&csi_rs_estimated_A_MF[1][1][k], &csi_rs_estimated_A_MF_sq[1][1][k], 1);
- nr_numer_2x2(&csi_rs_estimated_A_MF_sq[0][0][k],
- &csi_rs_estimated_A_MF_sq[0][1][k],
- &csi_rs_estimated_A_MF_sq[1][0][k],
- &csi_rs_estimated_A_MF_sq[1][1][k],
- &csi_rs_estimated_numer_fin[k],
+ nr_squared_matrix_element(&csi_rs_estimated_A_MF[0][0][k_offset], &csi_rs_estimated_A_MF_sq[0][0][k_offset], 1);
+ nr_squared_matrix_element(&csi_rs_estimated_A_MF[0][1][k_offset], &csi_rs_estimated_A_MF_sq[0][1][k_offset], 1);
+ nr_squared_matrix_element(&csi_rs_estimated_A_MF[1][0][k_offset], &csi_rs_estimated_A_MF_sq[1][0][k_offset], 1);
+ nr_squared_matrix_element(&csi_rs_estimated_A_MF[1][1][k_offset], &csi_rs_estimated_A_MF_sq[1][1][k_offset], 1);
+ nr_numer_2x2(&csi_rs_estimated_A_MF_sq[0][0][k_offset],
+ &csi_rs_estimated_A_MF_sq[0][1][k_offset],
+ &csi_rs_estimated_A_MF_sq[1][0][k_offset],
+ &csi_rs_estimated_A_MF_sq[1][1][k_offset],
+ &csi_rs_estimated_numer_fin[k_offset],
1);
#ifdef NR_CSIRS_DEBUG
for(uint16_t port_tx_conjch = 0; port_tx_conjch < N_ports; port_tx_conjch++) {
for(uint16_t port_tx_ch = 0; port_tx_ch < N_ports; port_tx_ch++) {
- c16_t *csi_rs_estimated_A_MF_k = (c16_t *) &csi_rs_estimated_A_MF[port_tx_conjch][port_tx_ch][k];
+ c16_t *csi_rs_estimated_A_MF_k = (c16_t *) &csi_rs_estimated_A_MF[port_tx_conjch][port_tx_ch][k_offset];
LOG_I(NR_PHY, "(%i) csi_rs_estimated_A_MF[%i][%i] = (%i, %i)\n",
k, port_tx_conjch, port_tx_ch, csi_rs_estimated_A_MF_k->r, csi_rs_estimated_A_MF_k->i);
- c16_t *csi_rs_estimated_A_MF_sq_k = (c16_t *) &csi_rs_estimated_A_MF_sq[port_tx_conjch][port_tx_ch][k];
+ c16_t *csi_rs_estimated_A_MF_sq_k = (c16_t *) &csi_rs_estimated_A_MF_sq[port_tx_conjch][port_tx_ch][k_offset];
LOG_I(NR_PHY, "(%i) csi_rs_estimated_A_MF_sq[%i][%i] = (%i, %i)\n",
k, port_tx_conjch, port_tx_ch, csi_rs_estimated_A_MF_sq_k->r, csi_rs_estimated_A_MF_sq_k->i);
}
}
- LOG_I(NR_PHY, "(%i) csi_rs_estimated_determ_fin = %i\n", k, csi_rs_estimated_determ_fin[k]);
- LOG_I(NR_PHY, "(%i) csi_rs_estimated_numer_fin = %i\n", k, csi_rs_estimated_numer_fin[k]>>sum_shift);
+ LOG_I(NR_PHY, "(%i) csi_rs_estimated_determ_fin = %i\n", k, csi_rs_estimated_determ_fin[k_offset]);
+ LOG_I(NR_PHY, "(%i) csi_rs_estimated_numer_fin = %i\n", k, csi_rs_estimated_numer_fin[k_offset]>>sum_shift);
#endif
// compute the conditional number
for (int sc_idx=0; sc_idx < NR_NB_SC_PER_RB; sc_idx++) {
- int8_t csi_rs_estimated_denum_db = dB_fixed(csi_rs_estimated_determ_fin[k + sc_idx]);
- int8_t csi_rs_estimated_numer_db = dB_fixed(csi_rs_estimated_numer_fin[k + sc_idx]>>sum_shift);
+ int8_t csi_rs_estimated_denum_db = dB_fixed(csi_rs_estimated_determ_fin[k_offset + sc_idx]);
+ int8_t csi_rs_estimated_numer_db = dB_fixed(csi_rs_estimated_numer_fin[k_offset + sc_idx]>>sum_shift);
int8_t cond_db = csi_rs_estimated_numer_db - csi_rs_estimated_denum_db;
#ifdef NR_CSIRS_DEBUG
@@ -592,7 +599,8 @@ int nr_csi_rs_pmi_estimation(const PHY_VARS_NR_UE *ue,
const fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu,
const nr_csi_info_t *nr_csi_info,
const uint8_t N_ports,
- const int32_t csi_rs_estimated_channel_freq[][N_ports][ue->frame_parms.ofdm_symbol_size],
+ uint8_t mem_offset,
+ const int32_t csi_rs_estimated_channel_freq[][N_ports][ue->frame_parms.ofdm_symbol_size + FILTER_MARGIN],
const uint32_t interference_plus_noise_power,
const uint8_t rank_indicator,
const int16_t log2_re,
@@ -631,11 +639,10 @@ int nr_csi_rs_pmi_estimation(const PHY_VARS_NR_UE *ue,
continue;
}
uint16_t k = (frame_parms->first_carrier_offset + rb * NR_NB_SC_PER_RB) % frame_parms->ofdm_symbol_size;
-
+ uint16_t k_offset = k + mem_offset;
for (int ant_rx = 0; ant_rx < frame_parms->nb_antennas_rx; ant_rx++) {
-
- c16_t *csi_rs_estimated_channel_p0 = (c16_t *) &csi_rs_estimated_channel_freq[ant_rx][0][k];
- c16_t *csi_rs_estimated_channel_p1 = (c16_t *) &csi_rs_estimated_channel_freq[ant_rx][1][k];
+ c16_t *csi_rs_estimated_channel_p0 = (c16_t *) &csi_rs_estimated_channel_freq[ant_rx][0][k_offset];
+ c16_t *csi_rs_estimated_channel_p1 = (c16_t *) &csi_rs_estimated_channel_freq[ant_rx][1][k_offset];
// H_p0 + 1*H_p1 = (H_p0_re + H_p1_re) + 1j*(H_p0_im + H_p1_im)
sum_re[0] += (csi_rs_estimated_channel_p0->r+csi_rs_estimated_channel_p1->r);
@@ -773,9 +780,12 @@ int nr_csi_im_power_estimation(const PHY_VARS_NR_UE *ue,
for (int sc_idx = 0; sc_idx<4; sc_idx++) {
uint16_t sc = sc0_offset + csiim_config_pdu->k_csiim[sc_idx];
+ if (sc >= frame_parms->ofdm_symbol_size) {
+ sc -= frame_parms->ofdm_symbol_size;
+ }
#ifdef NR_CSIIM_DEBUG
- LOG_I(NR_PHY, "(ant_rx %i, sc %i) real %i, imag %i\n", ant_rx, rb, rx_signal[sc].r, rx_signal[sc].i);
+ LOG_I(NR_PHY, "(ant_rx %i, sc %i) real %i, imag %i\n", ant_rx, sc, rx_signal[sc].r, rx_signal[sc].i);
#endif
sum_re += rx_signal[sc].r;
@@ -888,7 +898,12 @@ int nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t r
l_overline);
int32_t csi_rs_ls_estimated_channel[frame_parms->nb_antennas_rx][N_ports][frame_parms->ofdm_symbol_size];
- int32_t csi_rs_estimated_channel_freq[frame_parms->nb_antennas_rx][N_ports][frame_parms->ofdm_symbol_size];
+ int32_t csi_rs_estimated_channel_freq[frame_parms->nb_antennas_rx][N_ports][frame_parms->ofdm_symbol_size + FILTER_MARGIN];
+
+ // (long)&csi_rs_estimated_channel_freq[0][0][frame_parms->first_carrier_offset] & 0x1F gives us the remainder of the integer division by 32 of the memory address
+ // By subtracting the previous value of 32, we know how much is left to have a multiple of 32.
+ // Doing >> 2 <=> /sizeof(int32_t), we know what is the index offset of the array.
+ uint8_t mem_offset = (((32 - ((long)&csi_rs_estimated_channel_freq[0][0][frame_parms->first_carrier_offset])) & 0x1F) >> 2);
nr_get_csi_rs_signal(ue,
proc,
@@ -920,6 +935,7 @@ int nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t r
j_cdm,
k_overline,
l_overline,
+ mem_offset,
csi_rs_ls_estimated_channel,
csi_rs_estimated_channel_freq,
&log2_re,
@@ -930,6 +946,7 @@ int nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t r
csirs_config_pdu,
ue->nr_csi_info,
N_ports,
+ mem_offset,
csi_rs_estimated_channel_freq,
log2_maxh,
&rank_indicator);
@@ -938,6 +955,7 @@ int nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t r
csirs_config_pdu,
ue->nr_csi_info,
N_ports,
+ mem_offset,
csi_rs_estimated_channel_freq,
ue->nr_csi_info->csi_im_meas_computed ? ue->nr_csi_info->interference_plus_noise_power : noise_power,
rank_indicator,
diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
index 5293d13f90..b4c10d373f 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
@@ -686,7 +686,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
get_coreset_rballoc(rel15->coreset.frequency_domain_resource,&n_rb,&rb_offset);
// Pointers to extracted PDCCH symbols in frequency-domain.
- int32_t rx_size = 4*n_rb*12;
+ int32_t rx_size = ((4 * frame_parms->N_RB_DL * 12 + 31) >> 5) << 5;
__attribute__ ((aligned(32))) int32_t rxdataF_ext[frame_parms->nb_antennas_rx][rx_size];
__attribute__ ((aligned(32))) int32_t rxdataF_comp[frame_parms->nb_antennas_rx][rx_size];
__attribute__ ((aligned(32))) int32_t pdcch_dl_ch_estimates_ext[frame_parms->nb_antennas_rx][rx_size];
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
index 39d45a82d8..af1980f820 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
@@ -283,6 +283,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
nr_dlsch_extract_rbs(ue->frame_parms.samples_per_slot_wCP,
rxdataF,
rx_size,
+ pdsch_est_size,
dl_ch_estimates,
rxdataF_ext,
dl_ch_estimates_ext,
@@ -1599,8 +1600,9 @@ void nr_dlsch_channel_level_median(uint32_t rx_size,
void nr_dlsch_extract_rbs(uint32_t rxdataF_sz,
c16_t rxdataF[][rxdataF_sz],
- uint32_t rx_size,
- int32_t dl_ch_estimates[][rx_size],
+ const uint32_t rx_size,
+ const uint32_t pdsch_est_size,
+ int32_t dl_ch_estimates[][pdsch_est_size],
int32_t rxdataF_ext[][rx_size],
int32_t dl_ch_estimates_ext[][rx_size],
unsigned char symbol,
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
index 921be85002..746c4ff5ca 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
@@ -545,8 +545,9 @@ void nr_dlsch_256qam_llr(NR_DL_FRAME_PARMS *frame_parms,
*/
void nr_dlsch_extract_rbs(uint32_t rxdataF_sz,
c16_t rxdataF[][rxdataF_sz],
- uint32_t rx_size,
- int32_t dl_ch_estimates[][rx_size],
+ const uint32_t rx_size,
+ const uint32_t pdsch_est_size,
+ int32_t dl_ch_estimates[][pdsch_est_size],
int32_t rxdataF_ext[][rx_size],
int32_t dl_ch_estimates_ext[][rx_size],
unsigned char symbol,
diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c
index 91b9d6fc37..5d03d68c57 100644
--- a/openair1/PHY/TOOLS/calibration_test.c
+++ b/openair1/PHY/TOOLS/calibration_test.c
@@ -3,9 +3,10 @@
#include
#include
#include
+#include "nfapi/oai_integration/vendor_ext.h"
-volatile int oai_exit=false;
+int oai_exit=false;
unsigned int mmapped_dma=0;
int single_thread_flag;
uint32_t timing_advance;
@@ -21,6 +22,9 @@ uint64_t dlsch_slot_bitmap = (1<<1);
uint64_t ulsch_slot_bitmap = (1<<8);
uint32_t target_ul_bw = 50;
uint32_t target_dl_bw = 50;
+uint32_t target_dl_Nl;
+uint32_t target_ul_Nl;
+char *uecap_file;
#include
int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) {return 0;}
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index 01e4cbefd9..056b986cf1 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -579,8 +579,8 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
ue->Mod_id,nr_slot_rx,harq_pid,dlsch0_harq->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->dlsch_config.dlDmrsSymbPos, dlsch0->Nl);
const uint32_t pdsch_est_size = ((ue->frame_parms.symbols_per_slot*ue->frame_parms.ofdm_symbol_size+15)/16)*16;
- __attribute__ ((aligned(32))) int32_t pdsch_dl_ch_estimates[ue->frame_parms.nb_antennas_rx][pdsch_est_size];
- memset(pdsch_dl_ch_estimates, 0, sizeof(int32_t)*ue->frame_parms.nb_antennas_rx*pdsch_est_size);
+ __attribute__ ((aligned(32))) int32_t pdsch_dl_ch_estimates[ue->frame_parms.nb_antennas_rx*dlsch0->Nl][pdsch_est_size];
+ memset(pdsch_dl_ch_estimates, 0, sizeof(int32_t)*ue->frame_parms.nb_antennas_rx*dlsch0->Nl*pdsch_est_size);
for (m = s0; m < (s0 +s1); m++) {
if (dlsch0->dlsch_config.dlDmrsSymbPos & (1 << m)) {
@@ -645,26 +645,25 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
uint32_t dl_valid_re[NR_SYMBOLS_PER_SLOT] = {0};
uint32_t llr_offset[NR_SYMBOLS_PER_SLOT] = {0};
- const uint32_t rx_size = NR_SYMBOLS_PER_SLOT*
- dlsch[0].dlsch_config.number_rbs*
- NR_NB_SC_PER_RB;
- __attribute__ ((aligned(32))) int32_t dl_ch_estimates_ext[ue->frame_parms.nb_antennas_rx][rx_size];
- memset(dl_ch_estimates_ext, 0, ue->frame_parms.nb_antennas_rx*rx_size*sizeof(int32_t));
+ const uint32_t rx_size = ((NR_SYMBOLS_PER_SLOT * dlsch[0].dlsch_config.number_rbs * NR_NB_SC_PER_RB + 15) >> 4) << 4;
- __attribute__ ((aligned(32))) int32_t rxdataF_ext[ue->frame_parms.nb_antennas_rx][rx_size];
- memset(rxdataF_ext, 0, ue->frame_parms.nb_antennas_rx*rx_size*sizeof(int32_t));
+ __attribute__ ((aligned(32))) int32_t dl_ch_estimates_ext[ue->frame_parms.nb_antennas_rx*dlsch0->Nl][rx_size];
+ memset(dl_ch_estimates_ext, 0, ue->frame_parms.nb_antennas_rx*dlsch0->Nl*rx_size*sizeof(int32_t));
- __attribute__ ((aligned(32))) int32_t rxdataF_comp[ue->frame_parms.nb_antennas_rx][rx_size];
- memset(rxdataF_comp, 0, ue->frame_parms.nb_antennas_rx*rx_size*sizeof(int32_t));
+ __attribute__ ((aligned(32))) int32_t rxdataF_ext[ue->frame_parms.nb_antennas_rx*dlsch0->Nl][rx_size];
+ memset(rxdataF_ext, 0, ue->frame_parms.nb_antennas_rx*dlsch0->Nl*rx_size*sizeof(int32_t));
- __attribute__ ((aligned(32))) int32_t dl_ch_mag[ue->frame_parms.nb_antennas_rx][rx_size];
- memset(dl_ch_mag, 0, ue->frame_parms.nb_antennas_rx*rx_size*sizeof(int32_t));
+ __attribute__ ((aligned(32))) int32_t rxdataF_comp[ue->frame_parms.nb_antennas_rx*dlsch0->Nl][rx_size];
+ memset(rxdataF_comp, 0, ue->frame_parms.nb_antennas_rx*dlsch0->Nl*rx_size*sizeof(int32_t));
- __attribute__ ((aligned(32))) int32_t dl_ch_magb[ue->frame_parms.nb_antennas_rx][rx_size];
- memset(dl_ch_magb, 0, ue->frame_parms.nb_antennas_rx*rx_size*sizeof(int32_t));
+ __attribute__ ((aligned(32))) int32_t dl_ch_mag[ue->frame_parms.nb_antennas_rx*dlsch0->Nl][rx_size];
+ memset(dl_ch_mag, 0, ue->frame_parms.nb_antennas_rx*dlsch0->Nl*rx_size*sizeof(int32_t));
- __attribute__ ((aligned(32))) int32_t dl_ch_magr[ue->frame_parms.nb_antennas_rx][rx_size];
- memset(dl_ch_magr, 0, ue->frame_parms.nb_antennas_rx*rx_size*sizeof(int32_t));
+ __attribute__ ((aligned(32))) int32_t dl_ch_magb[ue->frame_parms.nb_antennas_rx*dlsch0->Nl][rx_size];
+ memset(dl_ch_magb, 0, ue->frame_parms.nb_antennas_rx*dlsch0->Nl*rx_size*sizeof(int32_t));
+
+ __attribute__ ((aligned(32))) int32_t dl_ch_magr[ue->frame_parms.nb_antennas_rx*dlsch0->Nl][rx_size];
+ memset(dl_ch_magr, 0, ue->frame_parms.nb_antennas_rx*dlsch0->Nl*rx_size*sizeof(int32_t));
int32_t log2_maxh = 0;
start_meas(&ue->rx_pdsch_stats);
@@ -714,16 +713,16 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
} // CRNTI active
stop_meas(&ue->rx_pdsch_stats);
- UEscopeCopy(ue, pdschRxdataF_comp, rxdataF_comp, sizeof(struct complex16), ue->frame_parms.nb_antennas_rx, rx_size);
+ UEscopeCopy(ue, pdschRxdataF_comp, rxdataF_comp, sizeof(struct complex16), ue->frame_parms.nb_antennas_rx*dlsch0->Nl, rx_size);
if (ue->phy_sim_pdsch_rxdataF_comp)
- memcpy(ue->phy_sim_pdsch_rxdataF_comp, rxdataF_comp, sizeof(int32_t)*rx_size*ue->frame_parms.nb_antennas_rx);
+ memcpy(ue->phy_sim_pdsch_rxdataF_comp, rxdataF_comp, sizeof(int32_t)*rx_size*ue->frame_parms.nb_antennas_rx*dlsch0->Nl);
if (ue->phy_sim_pdsch_rxdataF_ext)
- memcpy(ue->phy_sim_pdsch_rxdataF_ext, rxdataF_ext, sizeof(int32_t)*rx_size*ue->frame_parms.nb_antennas_rx);
+ memcpy(ue->phy_sim_pdsch_rxdataF_ext, rxdataF_ext, sizeof(int32_t)*rx_size*ue->frame_parms.nb_antennas_rx*dlsch0->Nl);
if (ue->phy_sim_pdsch_dl_ch_estimates_ext)
- memcpy(ue->phy_sim_pdsch_dl_ch_estimates_ext, dl_ch_estimates_ext, sizeof(int32_t)*rx_size*ue->frame_parms.nb_antennas_rx);
+ memcpy(ue->phy_sim_pdsch_dl_ch_estimates_ext, dl_ch_estimates_ext, sizeof(int32_t)*rx_size*ue->frame_parms.nb_antennas_rx*dlsch0->Nl);
if (ue->phy_sim_pdsch_dl_ch_estimates)
- memcpy(ue->phy_sim_pdsch_dl_ch_estimates, dl_ch_estimates_ext, sizeof(int32_t)*rx_size*ue->frame_parms.nb_antennas_rx);
+ memcpy(ue->phy_sim_pdsch_dl_ch_estimates, dl_ch_estimates_ext, sizeof(int32_t)*rx_size*ue->frame_parms.nb_antennas_rx*dlsch0->Nl);
}
return 0;
}
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c
index 0002981f78..c4ff82c22b 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim.c
@@ -37,6 +37,7 @@
#include
#include "common/config/config_load_configmodule.h"
#include "common/utils/LOG/log.h"
+#include "common/utils/var_array.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
@@ -52,7 +53,6 @@
#include "SCHED/sched_eNB.h"
#include "SCHED_UE/sched_UE.h"
#include "SIMULATION/TOOLS/sim.h"
-#include "UTIL/LISTS/list.h"
#include "OCG_vars.h"
#include "unitary_defs.h"
#include "dummy_functions.c"
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index 27a8722ea5..c03d081387 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -33,6 +33,7 @@
#include
#include
#include
+#include "common/utils/var_array.h"
#include "PHY/types.h"
#include "PHY/defs_common.h"
#include "PHY/defs_eNB.h"
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index 134174e7cf..da5bbbffdf 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -28,6 +28,7 @@
#include "common/ran_context.h"
#include "common/config/config_userapi.h"
#include "common/utils/nr/nr_common.h"
+#include "common/utils/var_array.h"
#include "common/utils/LOG/log.h"
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include "LAYER2/NR_MAC_UE/mac_defs.h"
@@ -81,7 +82,6 @@ const char *__asan_default_options()
}
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
-rlc_info_t Rlc_info_um,Rlc_info_am_config;
PHY_VARS_gNB *gNB;
PHY_VARS_NR_UE *UE;
@@ -1042,12 +1042,13 @@ int main(int argc, char **argv)
memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t));
// Buffers to store internal memory of slot process
- UE->phy_sim_rxdataF = calloc(frame_parms->samples_per_slot_wCP*sizeof(int32_t), frame_parms->nb_antennas_rx);
- UE->phy_sim_pdsch_llr = calloc((8*(3*8*8448))*sizeof(int16_t), 1); //Max length
- UE->phy_sim_pdsch_rxdataF_ext = calloc(14*frame_parms->N_RB_DL*12*sizeof(int32_t), frame_parms->nb_antennas_rx);
- UE->phy_sim_pdsch_rxdataF_comp = calloc(14*frame_parms->N_RB_DL*12*sizeof(int32_t), frame_parms->nb_antennas_rx);
- UE->phy_sim_pdsch_dl_ch_estimates = calloc(14*frame_parms->ofdm_symbol_size*sizeof(int32_t), frame_parms->nb_antennas_rx);
- UE->phy_sim_pdsch_dl_ch_estimates_ext = calloc(14*frame_parms->N_RB_DL*12*sizeof(int32_t), frame_parms->nb_antennas_rx);
+ int rx_size = (((14 * frame_parms->N_RB_DL * 12 * sizeof(int32_t)) + 15) >> 4) << 4;
+ UE->phy_sim_rxdataF = calloc(sizeof(int32_t *) * frame_parms->nb_antennas_rx * g_nrOfLayers, frame_parms->samples_per_slot_wCP * sizeof(int32_t));
+ UE->phy_sim_pdsch_llr = calloc(1, (8 * (3 * 8 * 8448)) * sizeof(int16_t)); // Max length
+ UE->phy_sim_pdsch_rxdataF_ext = calloc(sizeof(int32_t *) * frame_parms->nb_antennas_rx * g_nrOfLayers, rx_size);
+ UE->phy_sim_pdsch_rxdataF_comp = calloc(sizeof(int32_t *) * frame_parms->nb_antennas_rx * g_nrOfLayers, rx_size);
+ UE->phy_sim_pdsch_dl_ch_estimates = calloc(sizeof(int32_t *) * frame_parms->nb_antennas_rx * g_nrOfLayers, rx_size);
+ UE->phy_sim_pdsch_dl_ch_estimates_ext = calloc(sizeof(int32_t *) * frame_parms->nb_antennas_rx * g_nrOfLayers, rx_size);
for (SNR = snr0; SNR < snr1; SNR += .2) {
diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c
index 7d0be09585..2cbe2ae97f 100644
--- a/openair1/SIMULATION/NR_PHY/pbchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pbchsim.c
@@ -751,11 +751,12 @@ int main(int argc, char **argv)
UE->rx_offset=0;
uint8_t ssb_index = 0;
- const int estimateSz=7*2*sizeof(int)*frame_parms->ofdm_symbol_size;
- __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz];
- __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][estimateSz];
- while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb
- UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms,ssb_index);
+ const int estimateSz = frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size;
+ __attribute__((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz];
+ __attribute__((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][frame_parms->ofdm_symbol_size];
+ while (!((SSB_positions >> ssb_index) & 0x01))
+ ssb_index++; // to select the first transmitted ssb
+ UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms, ssb_index);
int ssb_slot = (UE->symbol_offset/14)+(n_hf*(frame_parms->slots_per_frame>>1));
proc.nr_slot_rx = ssb_slot;
diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c
index fd145c568f..f0ac036926 100644
--- a/openair1/SIMULATION/NR_PHY/prachsim.c
+++ b/openair1/SIMULATION/NR_PHY/prachsim.c
@@ -59,7 +59,6 @@
#define PRACH_WRITE_OUTPUT_DEBUG 1
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
-rlc_info_t Rlc_info_um,Rlc_info_am_config;
char *uecap_file;
PHY_VARS_gNB *gNB;
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index 210b33774e..11c131a5c2 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -29,6 +29,7 @@
#include "common/config/config_userapi.h"
#include "common/utils/LOG/log.h"
#include "common/utils/nr/nr_common.h"
+#include "common/utils/var_array.h"
#include "PHY/defs_gNB.h"
#include "PHY/defs_nr_common.h"
#include "PHY/defs_nr_UE.h"
@@ -76,7 +77,6 @@ const char *__asan_default_options()
}
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
-rlc_info_t Rlc_info_um,Rlc_info_am_config;
PHY_VARS_gNB *gNB;
PHY_VARS_NR_UE *UE;
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index 3f935c3770..fbb5fd0225 100644
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -112,7 +112,7 @@ void RCconfig_L1(void) {
// This is used by init_eNB_afterRU()
RC.nb_CC = (int *)malloc((1+RC.nb_inst)*sizeof(int));
RC.nb_CC[0]=1;
- RC.nb_inst =1; // DJP - feptx_prec uses num_eNB but phy_init_RU uses nb_inst
+ RC.nb_inst =1; // feptx_prec uses num_eNB but phy_init_RU uses nb_inst
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_inst=1 this is because phy_init_RU() uses that to index and not RC.num_eNB - why the 2 similar variables?\n", __FUNCTION__);
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_CC[0]=%d for init_eNB_afterRU()\n", __FUNCTION__, RC.nb_CC[0]);
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_macrlc_inst:%d because used by mac_top_init_eNB()\n", __FUNCTION__, RC.nb_macrlc_inst);
@@ -142,10 +142,10 @@ void RCconfig_L1(void) {
l1_north_init_eNB();
} else {
LOG_I(PHY,"No " CONFIG_STRING_L1_LIST " configuration found");
- // DJP need to create some structures for VNF
+ // need to create some structures for VNF
j = 0;
- RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int)); // DJP - 1 lot then???
- RC.nb_L1_CC[j]=1; // DJP - hmmm
+ RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int));
+ RC.nb_L1_CC[j]=1;
if (RC.eNB[j] == NULL) {
RC.eNB[j] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB **));
@@ -224,7 +224,7 @@ void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]) {
RC.mac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
RC.mac[j]->eth_params_s.transp_preference = ETH_UDP_MODE;
LOG_I(ENB_APP,"**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
- configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc);
+ configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc,RC.mac[j]->eth_params_s.remote_addr,RC.mac[j]->eth_params_s.remote_portd,RC.mac[j]->eth_params_s.my_portd);
LOG_I(ENB_APP,"**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
} else { // other midhaul
AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c
index 2c5db19d6d..e4a855acda 100644
--- a/openair2/GNB_APP/gnb_config.c
+++ b/openair2/GNB_APP/gnb_config.c
@@ -86,6 +86,7 @@
#include "RRC/NR/MESSAGES/asn1_msg.h"
#include "RRC/NR/nr_rrc_extern.h"
#include "openair2/LAYER2/nr_pdcp/nr_pdcp.h"
+#include "nfapi/oai_integration/vendor_ext.h"
extern uint16_t sf_ahead;
int macrlc_has_f1 = 0;
@@ -684,226 +685,234 @@ void RCconfig_nr_prs(void)
}
}
-void RCconfig_NR_L1(void) {
- int j;
- paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
- ////////// Identification parameters
- paramdef_t GNBParams[] = GNBPARAMS_DESC;
+void RCconfig_NR_L1(void)
+{
+ int j = 0;
- paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0};
+ if (RC.gNB == NULL) {
+ RC.gNB = (PHY_VARS_gNB **)malloc((1 + NUMBER_OF_gNB_MAX) * sizeof(PHY_VARS_gNB *));
+ LOG_I(NR_PHY, "RC.gNB = %p\n", RC.gNB);
+ memset(RC.gNB, 0, (1 + NUMBER_OF_gNB_MAX) * sizeof(PHY_VARS_gNB *));
- config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
- int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
- AssertFatal (num_gnbs > 0,"Failed to parse config file no gnbs %s \n",GNB_CONFIG_STRING_ACTIVE_GNBS);
+ if (RC.gNB[j] == NULL) {
+ RC.gNB[j] = calloc(1, sizeof(PHY_VARS_gNB));
+ }
+ }
+ if (NFAPI_MODE != NFAPI_MODE_PNF) {
+ paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
+ ////////// Identification parameters
+ paramdef_t GNBParams[] = GNBPARAMS_DESC;
- config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
- int N1 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr;
- int N2 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr;
- int XP = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr;
- char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr;
- if (ulprbbl) LOG_I(NR_PHY,"PRB blacklist %s\n",ulprbbl);
- char *save = NULL;
- char *pt = strtok_r(ulprbbl, ",", &save);
- int prbbl[275];
- int num_prbbl=0;
- memset(prbbl,0,275*sizeof(int));
+ paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0};
- while (pt) {
- const int rb = atoi(pt);
- AssertFatal(rb < 275, "RB %d out of bounds (max 275)\n", rb);
- prbbl[rb] = 0x3FFF; // all symbols taken
- LOG_I(NR_PHY,"Blacklisting prb %d\n",atoi(pt));
- pt = strtok_r(NULL, ",", &save);
- num_prbbl++;
+ config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL);
+ int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
+ AssertFatal(num_gnbs > 0, "Failed to parse config file no gnbs %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS);
+
+ config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL);
+ int N1 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr;
+ int N2 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr;
+ int XP = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr;
+ char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr;
+ if (ulprbbl)
+ LOG_I(NR_PHY, "PRB blacklist %s\n", ulprbbl);
+ char *save = NULL;
+ char *pt = strtok_r(ulprbbl, ",", &save);
+ int prbbl[275];
+ int num_prbbl = 0;
+ memset(prbbl, 0, 275 * sizeof(int));
+
+ while (pt) {
+ const int rb = atoi(pt);
+ AssertFatal(rb < 275, "RB %d out of bounds (max 275)\n", rb);
+ prbbl[rb] = 0x3FFF; // all symbols taken
+ LOG_I(NR_PHY, "Blacklisting prb %d\n", atoi(pt));
+ pt = strtok_r(NULL, ",", &save);
+ num_prbbl++;
+ }
+
+ RC.gNB[j]->num_ulprbbl = num_prbbl;
+ LOG_I(NR_PHY, "Copying %d blacklisted PRB to L1 context\n", num_prbbl);
+ memcpy(RC.gNB[j]->ulprbbl, prbbl, 275 * sizeof(int));
+
+ RC.gNB[j]->ap_N1 = N1;
+ RC.gNB[j]->ap_N2 = N2;
+ RC.gNB[j]->ap_XP = XP;
}
paramdef_t L1_Params[] = L1PARAMS_DESC;
- paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST,NULL,0};
+ paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST, NULL, 0};
-
- if (RC.gNB == NULL) {
- RC.gNB = (PHY_VARS_gNB **)malloc((1+NUMBER_OF_gNB_MAX)*sizeof(PHY_VARS_gNB*));
- LOG_I(NR_PHY,"RC.gNB = %p\n",RC.gNB);
- memset(RC.gNB,0,(1+NUMBER_OF_gNB_MAX)*sizeof(PHY_VARS_gNB*));
- }
-
- config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL);
+ config_getlist(&L1_ParamList, L1_Params, sizeof(L1_Params) / sizeof(paramdef_t), NULL);
if (L1_ParamList.numelt > 0) {
-
for (j = 0; j < RC.nb_nr_L1_inst; j++) {
-
if (RC.gNB[j] == NULL) {
- RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB));
- LOG_I(NR_PHY,"RC.gNB[%d] = %p\n",j,RC.gNB[j]);
- memset(RC.gNB[j],0,sizeof(PHY_VARS_gNB));
- RC.gNB[j]->Mod_id = j;
+ RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB));
+ LOG_I(NR_PHY, "RC.gNB[%d] = %p\n", j, RC.gNB[j]);
+ memset(RC.gNB[j], 0, sizeof(PHY_VARS_gNB));
+ RC.gNB[j]->Mod_id = j;
}
- AssertFatal(*L1_ParamList.paramarray[j][L1_THREAD_POOL_SIZE].uptr == 2022,
- "thread_pool_size removed, please use --thread-pool\n");
+ AssertFatal(*L1_ParamList.paramarray[j][L1_THREAD_POOL_SIZE].uptr == 2022, "thread_pool_size removed, please use --thread-pool\n");
RC.gNB[j]->ofdm_offset_divisor = *(L1_ParamList.paramarray[j][L1_OFDM_OFFSET_DIVISOR].uptr);
- RC.gNB[j]->pucch0_thres = *(L1_ParamList.paramarray[j][L1_PUCCH0_DTX_THRESHOLD].uptr);
- RC.gNB[j]->prach_thres = *(L1_ParamList.paramarray[j][L1_PRACH_DTX_THRESHOLD].uptr);
- RC.gNB[j]->pusch_thres = *(L1_ParamList.paramarray[j][L1_PUSCH_DTX_THRESHOLD].uptr);
- RC.gNB[j]->srs_thres = *(L1_ParamList.paramarray[j][L1_SRS_DTX_THRESHOLD].uptr);
+ RC.gNB[j]->pucch0_thres = *(L1_ParamList.paramarray[j][L1_PUCCH0_DTX_THRESHOLD].uptr);
+ RC.gNB[j]->prach_thres = *(L1_ParamList.paramarray[j][L1_PRACH_DTX_THRESHOLD].uptr);
+ RC.gNB[j]->pusch_thres = *(L1_ParamList.paramarray[j][L1_PUSCH_DTX_THRESHOLD].uptr);
+ RC.gNB[j]->srs_thres = *(L1_ParamList.paramarray[j][L1_SRS_DTX_THRESHOLD].uptr);
RC.gNB[j]->max_ldpc_iterations = *(L1_ParamList.paramarray[j][L1_MAX_LDPC_ITERATIONS].uptr);
- RC.gNB[j]->num_ulprbbl = num_prbbl;
- RC.gNB[j]->ap_N1 = N1;
- RC.gNB[j]->ap_N2 = N2;
- RC.gNB[j]->ap_XP = XP;
- LOG_I(NR_PHY,"Copying %d blacklisted PRB to L1 context\n",num_prbbl);
- memcpy(RC.gNB[j]->ulprbbl,prbbl,275*sizeof(int));
- if(strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
- //sf_ahead = 2; // Need 4 subframe gap between RX and TX
- }else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
- RC.gNB[j]->eth_params_n.local_if_name = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
- RC.gNB[j]->eth_params_n.my_addr = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr));
- RC.gNB[j]->eth_params_n.remote_addr = strdup(*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr));
- RC.gNB[j]->eth_params_n.my_portc = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr);
- RC.gNB[j]->eth_params_n.remote_portc = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr);
- RC.gNB[j]->eth_params_n.my_portd = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr);
- RC.gNB[j]->eth_params_n.remote_portd = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
- RC.gNB[j]->eth_params_n.transp_preference = ETH_UDP_MODE;
+ if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
+ // sf_ahead = 2; // Need 4 subframe gap between RX and TX
+ } else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
+ RC.gNB[j]->eth_params_n.local_if_name = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
+ RC.gNB[j]->eth_params_n.my_addr = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr));
+ RC.gNB[j]->eth_params_n.remote_addr = strdup(*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr));
+ RC.gNB[j]->eth_params_n.my_portc = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr);
+ RC.gNB[j]->eth_params_n.remote_portc = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr);
+ RC.gNB[j]->eth_params_n.my_portd = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr);
+ RC.gNB[j]->eth_params_n.remote_portd = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
+ RC.gNB[j]->eth_params_n.transp_preference = ETH_UDP_MODE;
- //sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
+ // sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
- RC.nb_nr_macrlc_inst = 1; // This is used by mac_top_init_gNB()
+ RC.nb_nr_macrlc_inst = 1; // This is used by mac_top_init_gNB()
// This is used by init_gNB_afterRU()
- RC.nb_nr_CC = (int *)malloc((1+RC.nb_nr_inst)*sizeof(int));
- RC.nb_nr_CC[0]=1;
+ RC.nb_nr_CC = (int *)malloc((1 + RC.nb_nr_inst) * sizeof(int));
+ RC.nb_nr_CC[0] = 1;
- LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_nr_inst=1 this is because phy_init_RU() uses that to index and not RC.num_gNB - why the 2 similar variables?\n", __FUNCTION__);
- LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_nr_CC[0]=%d for init_gNB_afterRU()\n", __FUNCTION__, RC.nb_nr_CC[0]);
- LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_nr_macrlc_inst:%d because used by mac_top_init_gNB()\n", __FUNCTION__, RC.nb_nr_macrlc_inst);
+ LOG_I(PHY, "%s() NFAPI PNF mode - RC.nb_nr_inst=1 this is because phy_init_RU() uses that to index and not RC.num_gNB - why the 2 similar variables?\n", __FUNCTION__);
+ LOG_I(PHY, "%s() NFAPI PNF mode - RC.nb_nr_CC[0]=%d for init_gNB_afterRU()\n", __FUNCTION__, RC.nb_nr_CC[0]);
+ LOG_I(PHY, "%s() NFAPI PNF mode - RC.nb_nr_macrlc_inst:%d because used by mac_top_init_gNB()\n", __FUNCTION__, RC.nb_nr_macrlc_inst);
configure_nr_nfapi_pnf(RC.gNB[j]->eth_params_n.remote_addr,
RC.gNB[j]->eth_params_n.remote_portc,
RC.gNB[j]->eth_params_n.my_addr,
RC.gNB[j]->eth_params_n.my_portd,
RC.gNB[j]->eth_params_n.remote_portd);
- }else { // other midhaul
- }
- }// for (j = 0; j < RC.nb_nr_L1_inst; j++)
+ } else { // other midhaul
+ }
+ } // for (j = 0; j < RC.nb_nr_L1_inst; j++)
printf("Initializing northbound interface for L1\n");
l1_north_init_gNB();
- }else{
- LOG_I(PHY,"No " CONFIG_STRING_L1_LIST " configuration found");
+ } else {
+ LOG_I(PHY, "No " CONFIG_STRING_L1_LIST " configuration found");
- // DJP need to create some structures for VNF
+ // need to create some structures for VNF
j = 0;
-
if (RC.gNB[j] == NULL) {
RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB));
- memset((void*)RC.gNB[j],0,sizeof(PHY_VARS_gNB));
- LOG_I(PHY,"RC.gNB[%d] = %p\n",j,RC.gNB[j]);
- RC.gNB[j]->Mod_id = j;
- }
+ memset((void *)RC.gNB[j], 0, sizeof(PHY_VARS_gNB));
+ LOG_I(PHY, "RC.gNB[%d] = %p\n", j, RC.gNB[j]);
+ RC.gNB[j]->Mod_id = j;
+ }
}
}
void RCconfig_nr_macrlc() {
- int j;
+ int j = 0;
+ uint16_t prbbl[275] = {0};
+ int num_prbbl = 0;
+ if (NFAPI_MODE != NFAPI_MODE_PNF) {
+ paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
+ ////////// Identification parameters
+ paramdef_t GNBParams[] = GNBPARAMS_DESC;
- paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
- ////////// Identification parameters
- paramdef_t GNBParams[] = GNBPARAMS_DESC;
+ paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0};
- paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0};
- ngran_node_t node_type = get_node_type();
+ config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL);
+ int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
+ AssertFatal(num_gnbs > 0, "Failed to parse config file no gnbs %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS);
- config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
- int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
- AssertFatal (num_gnbs > 0,"Failed to parse config file no gnbs %s \n",GNB_CONFIG_STRING_ACTIVE_GNBS);
-
- config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
- char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr;
- char *save = NULL;
- char *pt = strtok_r(ulprbbl, ",", &save);
- uint16_t prbbl[275];
- int num_prbbl=0;
- memset(prbbl,0,sizeof(prbbl));
- while (pt) {
- const int prb = atoi(pt);
- AssertFatal(prb < 275, "RB %d out of bounds (max 275)\n", prb);
- prbbl[prb] = 0x3FFF; // all symbols taken
- pt = strtok_r(NULL, ",", &save);
- num_prbbl++;
+ config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL);
+ char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr;
+ char *save = NULL;
+ char *pt = strtok_r(ulprbbl, ",", &save);
+ memset(prbbl, 0, sizeof(prbbl));
+ while (pt) {
+ const int prb = atoi(pt);
+ AssertFatal(prb < 275, "RB %d out of bounds (max 275)\n", prb);
+ prbbl[prb] = 0x3FFF; // all symbols taken
+ pt = strtok_r(NULL, ",", &save);
+ num_prbbl++;
+ }
}
paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC;
- paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0};
+ paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST, NULL, 0};
/* map parameter checking array instances to parameter definition array instances */
- checkedparam_t config_check_MacRLCParams [] = MACRLCPARAMS_CHECK;
+ checkedparam_t config_check_MacRLCParams[] = MACRLCPARAMS_CHECK;
for (int i = 0; i < sizeof(MacRLC_Params) / sizeof(paramdef_t); ++i)
MacRLC_Params[i].chkPptr = &(config_check_MacRLCParams[i]);
- config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL);
-
- if ( MacRLC_ParamList.numelt > 0) {
+ config_getlist(&MacRLC_ParamList, MacRLC_Params, sizeof(MacRLC_Params) / sizeof(paramdef_t), NULL);
- RC.nb_nr_macrlc_inst=MacRLC_ParamList.numelt;
+ if (MacRLC_ParamList.numelt > 0) {
+ RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt;
+ ngran_node_t node_type = get_node_type();
mac_top_init_gNB(node_type);
- RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int));
+ RC.nb_nr_mac_CC = (int *)malloc(RC.nb_nr_macrlc_inst * sizeof(int));
- for (j=0;jpusch_target_snrx10 = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHTARGETSNRX10_IDX].iptr);
- RC.nrmac[j]->pucch_target_snrx10 = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHTARGETSNRX10_IDX].iptr);
- RC.nrmac[j]->ul_prbblack_SNR_threshold = *(MacRLC_ParamList.paramarray[j][MACRLC_UL_PRBBLACK_SNR_THRESHOLD_IDX].iptr);
- RC.nrmac[j]->pucch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHFAILURETHRES_IDX].iptr);
- RC.nrmac[j]->pusch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHFAILURETHRES_IDX].iptr);
-
- LOG_I(NR_MAC,"PUSCH Target %d, PUCCH Target %d, PUCCH Failure %d, PUSCH Failure %d\n",
- RC.nrmac[j]->pusch_target_snrx10,
+ RC.nrmac[j]->pusch_target_snrx10 = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHTARGETSNRX10_IDX].iptr);
+ RC.nrmac[j]->pucch_target_snrx10 = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHTARGETSNRX10_IDX].iptr);
+ RC.nrmac[j]->ul_prbblack_SNR_threshold = *(MacRLC_ParamList.paramarray[j][MACRLC_UL_PRBBLACK_SNR_THRESHOLD_IDX].iptr);
+ RC.nrmac[j]->pucch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHFAILURETHRES_IDX].iptr);
+ RC.nrmac[j]->pusch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHFAILURETHRES_IDX].iptr);
+
+ LOG_I(NR_MAC,
+ "PUSCH Target %d, PUCCH Target %d, PUCCH Failure %d, PUSCH Failure %d\n",
+ RC.nrmac[j]->pusch_target_snrx10,
RC.nrmac[j]->pucch_target_snrx10,
RC.nrmac[j]->pucch_failure_thres,
- RC.nrmac[j]->pusch_failure_thres);
+ RC.nrmac[j]->pusch_failure_thres);
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) {
- // check number of instances is same as RRC/PDCP
-
- }else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) {
+ // check number of instances is same as RRC/PDCP
+
+ } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) {
printf("Configuring F1 interfaces for MACRLC\n");
- RC.nrmac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
- RC.nrmac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
- RC.nrmac[j]->eth_params_n.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr));
- RC.nrmac[j]->eth_params_n.my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr);
- RC.nrmac[j]->eth_params_n.remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr);
- RC.nrmac[j]->eth_params_n.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr);
- RC.nrmac[j]->eth_params_n.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);;
- RC.nrmac[j]->eth_params_n.transp_preference = ETH_UDP_MODE;
- macrlc_has_f1 = 1;
- }else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "cudu") == 0) {
- RC.nrmac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
- RC.nrmac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
- RC.nrmac[j]->eth_params_n.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr));
- RC.nrmac[j]->eth_params_n.my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr);
- RC.nrmac[j]->eth_params_n.remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr);
- RC.nrmac[j]->eth_params_n.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr);
- RC.nrmac[j]->eth_params_n.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);;
- RC.nrmac[j]->eth_params_n.transp_preference = ETH_UDP_MODE;
- }else { // other midhaul
- AssertFatal(1==0,"MACRLC %d: %s unknown northbound midhaul\n",j, *(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr));
- }
+ RC.nrmac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
+ RC.nrmac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
+ RC.nrmac[j]->eth_params_n.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr));
+ RC.nrmac[j]->eth_params_n.my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr);
+ RC.nrmac[j]->eth_params_n.remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr);
+ RC.nrmac[j]->eth_params_n.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr);
+ RC.nrmac[j]->eth_params_n.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);
+ ;
+ RC.nrmac[j]->eth_params_n.transp_preference = ETH_UDP_MODE;
+ macrlc_has_f1 = 1;
+ } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "cudu") == 0) {
+ RC.nrmac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
+ RC.nrmac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
+ RC.nrmac[j]->eth_params_n.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr));
+ RC.nrmac[j]->eth_params_n.my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr);
+ RC.nrmac[j]->eth_params_n.remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr);
+ RC.nrmac[j]->eth_params_n.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr);
+ RC.nrmac[j]->eth_params_n.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);
+ ;
+ RC.nrmac[j]->eth_params_n.transp_preference = ETH_UDP_MODE;
+ } else { // other midhaul
+ AssertFatal(1 == 0, "MACRLC %d: %s unknown northbound midhaul\n", j, *(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr));
+ }
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_L1") == 0) {
-
- }else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "nfapi") == 0) {
- RC.nrmac[j]->eth_params_s.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_IF_NAME_IDX].strptr));
- RC.nrmac[j]->eth_params_s.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_ADDRESS_IDX].strptr));
- RC.nrmac[j]->eth_params_s.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_ADDRESS_IDX].strptr));
- RC.nrmac[j]->eth_params_s.my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTC_IDX].iptr);
- RC.nrmac[j]->eth_params_s.remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTC_IDX].iptr);
- RC.nrmac[j]->eth_params_s.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr);
- RC.nrmac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
- RC.nrmac[j]->eth_params_s.transp_preference = ETH_UDP_MODE;
+ } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "nfapi") == 0) {
+ RC.nrmac[j]->eth_params_s.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_IF_NAME_IDX].strptr));
+ RC.nrmac[j]->eth_params_s.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_ADDRESS_IDX].strptr));
+ RC.nrmac[j]->eth_params_s.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_ADDRESS_IDX].strptr));
+ RC.nrmac[j]->eth_params_s.my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTC_IDX].iptr);
+ RC.nrmac[j]->eth_params_s.remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTC_IDX].iptr);
+ RC.nrmac[j]->eth_params_s.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr);
+ RC.nrmac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
+ RC.nrmac[j]->eth_params_s.transp_preference = ETH_UDP_MODE;
printf("**************** vnf_port:%d\n", RC.nrmac[j]->eth_params_s.my_portc);
- configure_nr_nfapi_vnf(RC.nrmac[j]->eth_params_s.my_addr, RC.nrmac[j]->eth_params_s.my_portc);
+ configure_nr_nfapi_vnf(
+ RC.nrmac[j]->eth_params_s.my_addr, RC.nrmac[j]->eth_params_s.my_portc, RC.nrmac[j]->eth_params_s.remote_addr, RC.nrmac[j]->eth_params_s.remote_portd, RC.nrmac[j]->eth_params_s.my_portd);
printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.nrmac[j]->eth_params_s.my_portc);
- }else { // other midhaul
- AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
- }
+ } else { // other midhaul
+ AssertFatal(1 == 0, "MACRLC %d: %s unknown southbound midhaul\n", j, *(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
+ }
RC.nrmac[j]->ulsch_max_frame_inactivity = *(MacRLC_ParamList.paramarray[j][MACRLC_ULSCH_MAX_FRAME_INACTIVITY].uptr);
NR_bler_options_t *dl_bler_options = &RC.nrmac[j]->dl_bler;
dl_bler_options->upper = *(MacRLC_ParamList.paramarray[j][MACRLC_DL_BLER_TARGET_UPPER_IDX].dblptr);
@@ -918,13 +927,12 @@ void RCconfig_nr_macrlc() {
RC.nrmac[j]->min_grant_prb = *(MacRLC_ParamList.paramarray[j][MACRLC_MIN_GRANT_PRB_IDX].u8ptr);
RC.nrmac[j]->min_grant_mcs = *(MacRLC_ParamList.paramarray[j][MACRLC_MIN_GRANT_MCS_IDX].u8ptr);
RC.nrmac[j]->num_ulprbbl = num_prbbl;
- memcpy(RC.nrmac[j]->ulprbbl,prbbl,275*sizeof(prbbl[0]));
- }// for (j=0;j 0
- LOG_E(PHY,"No %s configuration found\n", CONFIG_STRING_MACRLC_LIST);
- // AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found");
+ memcpy(RC.nrmac[j]->ulprbbl, prbbl, 275 * sizeof(prbbl[0]));
+ } // for (j=0;j 0
+ LOG_E(PHY, "No %s configuration found\n", CONFIG_STRING_MACRLC_LIST);
+ // AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found");
}
-
}
void config_security(gNB_RRC_INST *rrc)
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
index 8ddb01a053..619f64dee9 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
@@ -3645,7 +3645,14 @@ int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, sl
else return(slot_in_period >= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
}
-int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, mappingType_t mappingtype, int length) {
+int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,
+ int dci_format,
+ int dmrs_TypeA_Position,
+ int NrOfSymbols,
+ int startSymbol,
+ mappingType_t mappingtype,
+ int length)
+{
int dmrs_AdditionalPosition = 0;
NR_DMRS_DownlinkConfig_t *dmrs_config = NULL;
@@ -3654,8 +3661,8 @@ int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Posi
int l0 = 0; // type B
if (mappingtype == typeA) {
- if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2) l0=2;
- else if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos3) l0=3;
+ if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2) l0 = 2;
+ else if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos3) l0 = 3;
else AssertFatal(1==0,"Illegal dmrs_TypeA_Position %d\n",(int)dmrs_TypeA_Position);
}
// in case of DCI FORMAT 1_0 or dedicated pdsch config not received additionposition = pos2, len1 should be used
@@ -3664,7 +3671,8 @@ int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Posi
if (pdsch_Config != NULL) {
if (mappingtype == typeA) { // Type A
- if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA && pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup)
+ if (dci_format != NR_DL_DCI_FORMAT_1_0 &&
+ pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA && pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup)
dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup;
} else if (mappingtype == typeB) {
if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB && pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup)
@@ -3673,10 +3681,9 @@ int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Posi
AssertFatal(1==0,"Incorrect Mappingtype\n");
}
- AssertFatal(dmrs_config != NULL," DMRS configs not present in PDSCH DMRS Downlink config\n");
-
// default values of additionalposition is pos2
- if (dmrs_config->dmrs_AdditionalPosition != NULL) dmrs_AdditionalPosition = *dmrs_config->dmrs_AdditionalPosition;
+ if (dmrs_config && dmrs_config->dmrs_AdditionalPosition != NULL)
+ dmrs_AdditionalPosition = *dmrs_config->dmrs_AdditionalPosition;
}
uint8_t ld, row, column;
@@ -3727,12 +3734,36 @@ int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Posi
return l_prime;
}
+uint8_t get_pdsch_mcs_table(long *mcs_Table, int dci_format, int rnti_type, int ss_type)
+{
+
+ // Set downlink MCS table (Semi-persistent scheduling ignored for now)
+ uint8_t mcsTableIdx = 0; // default value
+ if (mcs_Table &&
+ *mcs_Table == NR_PDSCH_Config__mcs_Table_qam256 &&
+ dci_format == NR_DL_DCI_FORMAT_1_1 &&
+ rnti_type == NR_RNTI_C)
+ mcsTableIdx = 1;
+ else if (rnti_type != NR_RNTI_MCS_C &&
+ mcs_Table &&
+ *mcs_Table == NR_PDSCH_Config__mcs_Table_qam64LowSE &&
+ ss_type == NR_SearchSpace__searchSpaceType_PR_ue_Specific)
+ mcsTableIdx = 2;
+ else if (rnti_type == NR_RNTI_MCS_C)
+ mcsTableIdx = 2;
+
+ LOG_D(NR_MAC,"DL MCS Table Index: %d\n", mcsTableIdx);
+ return mcsTableIdx;
+
+}
+
uint8_t get_pusch_mcs_table(long *mcs_Table,
int is_tp,
int dci_format,
int rnti_type,
int target_ss,
- bool config_grant) {
+ bool config_grant)
+{
// implementing 6.1.4.1 in 38.214
if (mcs_Table != NULL) {
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
index 9b98ed82f5..d5663e8032 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
@@ -61,7 +61,13 @@ uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
-int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,mappingType_t mappingtype,int length);
+int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,
+ int dci_format,
+ int dmrs_TypeA_Position,
+ int NrOfSymbols,
+ int startSymbol,
+ mappingType_t mappingtype,
+ int length);
int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP);
@@ -151,6 +157,8 @@ uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config,
int ul_ant_bits(NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig,long transformPrecoder);
+uint8_t get_pdsch_mcs_table(long *mcs_Table, int dci_format, int rnti_type, int ss_type);
+
int get_format0(uint8_t index, uint8_t unpaired,frequency_range_t);
int64_t *get_prach_config_info(frequency_range_t freq_range,
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index 93ea3472e2..17dde4c9c9 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -897,6 +897,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
/* dmrs symbol positions*/
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
+ NR_DL_DCI_FORMAT_1_0,
(get_softmodem_params()->nsa) ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position,
dlsch_config_pdu_1_0->number_symbols,
dlsch_config_pdu_1_0->start_symbol,
@@ -1306,6 +1307,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
/* dmrs symbol positions*/
dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_Config,
+ NR_DL_DCI_FORMAT_1_1,
mac->scc? mac->scc->dmrs_TypeA_Position:mac->mib->dmrs_TypeA_Position,
dlsch_config_pdu_1_1->number_symbols,
dlsch_config_pdu_1_1->start_symbol,
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
index d5b2b79036..2c52d3f52d 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
@@ -539,7 +539,9 @@ void pf_dl(module_id_t module_id,
NR_UE_info_t **UE_list,
int max_num_ue,
int n_rb_sched,
- uint16_t *rballoc_mask) {
+ uint16_t *rballoc_mask)
+{
+
gNB_MAC_INST *mac = RC.nrmac[module_id];
NR_ServingCellConfigCommon_t *scc=mac->common_channels[0].ServingCellConfigCommon;
// UEs that could be scheduled
@@ -748,7 +750,8 @@ void pf_dl(module_id_t module_id,
}
}
-void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot) {
+void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot)
+{
NR_UEs_t *UE_info = &RC.nrmac[module_id]->UE_info;
if (UE_info->list[0] == NULL)
@@ -791,12 +794,17 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
/* Retrieve amount of data to send for this UE */
nr_store_dlsch_buffer(module_id, frame, slot);
+
+ int bw = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+ int average_agg_level = 4; // TODO find a better estimation
+ int max_sched_ues = bw / (average_agg_level * NR_NB_REG_PER_CCE);
+
/* proportional fair scheduling algorithm */
pf_dl(module_id,
frame,
slot,
UE_info->list,
- MAX_MOBILES_PER_GNB,
+ max_sched_ues,
n_rb_sched,
rballoc_mask);
}
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
index 9eaa5a0a61..e35b1cda71 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
@@ -268,7 +268,7 @@ NR_pdsch_dmrs_t get_dl_dmrs_params(const NR_ServingCellConfigCommon_t *scc,
dmrs.dmrsConfigType = NFAPI_NR_DMRS_TYPE1;
dmrs.N_PRB_DMRS = dmrs.numDmrsCdmGrpsNoData * (dmrs.dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4);
- dmrs.dl_dmrs_symb_pos = fill_dmrs_mask(pdsch_Config, scc->dmrs_TypeA_Position, tda_info->nrOfSymbols, tda_info->startSymbolIndex, tda_info->mapping_type, frontloaded_symb);
+ dmrs.dl_dmrs_symb_pos = fill_dmrs_mask(pdsch_Config, dci_format, scc->dmrs_TypeA_Position, tda_info->nrOfSymbols, tda_info->startSymbolIndex, tda_info->mapping_type, frontloaded_symb);
dmrs.N_DMRS_SLOT = get_num_dmrs(dmrs.dl_dmrs_symb_pos);
LOG_D(NR_MAC,"Filling dmrs info, ps->N_PRB_DMRS %d, ps->dl_dmrs_symb_pos %x, ps->N_DMRS_SLOT %d\n",dmrs.N_PRB_DMRS,dmrs.dl_dmrs_symb_pos,dmrs.N_DMRS_SLOT);
return dmrs;
@@ -680,224 +680,6 @@ int get_mcs_from_bler(const NR_bler_options_t *bler_options,
return new_mcs;
}
-void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
- nr_scs_e scs_common,
- nr_scs_e pdcch_scs,
- frequency_range_t freq_range,
- uint8_t rmsi_pdcch_config,
- uint8_t ssb_idx,
- uint8_t k_ssb,
- uint16_t sfn_ssb,
- uint8_t n_ssb, /*slot index overlapping the corresponding SSB index*/
- uint16_t nb_slots_per_frame,
- uint16_t N_RB)
-{
- // uint8_t O, M;
- // uint8_t ss_idx = rmsi_pdcch_config&0xf;
- // uint8_t cset_idx = (rmsi_pdcch_config>>4)&0xf;
- // uint8_t mu = scs_common;
- // uint8_t O_scale=0, M_scale=0; // used to decide if the values of O and M need to be divided by 2
-
- AssertFatal(1==0,"todo\n");
- /*
- /// Coreset params
- switch(scs_common) {
-
- case kHz15:
-
- switch(pdcch_scs) {
- case kHz15:
- AssertFatal(cset_idx<15,"Coreset index %d reserved for scs kHz15/kHz15\n", cset_idx);
- pdcch_pdu->mux_pattern = NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE1;
- pdcch_pdu->n_rb = (cset_idx < 6)? 24 : (cset_idx < 12)? 48 : 96;
- pdcch_pdu->n_symb = nr_coreset_nsymb_pdcch_type_0_scs_15_15[cset_idx];
- pdcch_pdu->rb_offset = nr_coreset_rb_offset_pdcch_type_0_scs_15_15[cset_idx];
- break;
-
- case kHz30:
- AssertFatal(cset_idx<14,"Coreset index %d reserved for scs kHz15/kHz30\n", cset_idx);
- pdcch_pdu->mux_pattern = NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE1;
- pdcch_pdu->n_rb = (cset_idx < 8)? 24 : 48;
- pdcch_pdu->n_symb = nr_coreset_nsymb_pdcch_type_0_scs_15_30[cset_idx];
- pdcch_pdu->rb_offset = nr_coreset_rb_offset_pdcch_type_0_scs_15_15[cset_idx];
- break;
-
- default:
- AssertFatal(1==0,"Invalid scs_common/pdcch_scs combination %d/%d \n", scs_common, pdcch_scs);
-
- }
- break;
-
- case kHz30:
-
- if (N_RB < 106) { // Minimum 40Mhz bandwidth not satisfied
- switch(pdcch_scs) {
- case kHz15:
- AssertFatal(cset_idx<9,"Coreset index %d reserved for scs kHz30/kHz15\n", cset_idx);
- pdcch_pdu->mux_pattern = NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE1;
- pdcch_pdu->n_rb = (cset_idx < 10)? 48 : 96;
- pdcch_pdu->n_symb = nr_coreset_nsymb_pdcch_type_0_scs_30_15_b40Mhz[cset_idx];
- pdcch_pdu->rb_offset = nr_coreset_rb_offset_pdcch_type_0_scs_30_15_b40Mhz[cset_idx];
- break;
-
- case kHz30:
- pdcch_pdu->mux_pattern = NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE1;
- pdcch_pdu->n_rb = (cset_idx < 6)? 24 : 48;
- pdcch_pdu->n_symb = nr_coreset_nsymb_pdcch_type_0_scs_30_30_b40Mhz[cset_idx];
- pdcch_pdu->rb_offset = nr_coreset_rb_offset_pdcch_type_0_scs_30_30_b40Mhz[cset_idx];
- break;
-
- default:
- AssertFatal(1==0,"Invalid scs_common/pdcch_scs combination %d/%d \n", scs_common, pdcch_scs);
- }
- }
-
- else { // above 40Mhz
- switch(pdcch_scs) {
- case kHz15:
- AssertFatal(cset_idx<9,"Coreset index %d reserved for scs kHz30/kHz15\n", cset_idx);
- pdcch_pdu->mux_pattern = NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE1;
- pdcch_pdu->n_rb = (cset_idx < 3)? 48 : 96;
- pdcch_pdu->n_symb = nr_coreset_nsymb_pdcch_type_0_scs_30_15_a40Mhz[cset_idx];
- pdcch_pdu->rb_offset = nr_coreset_rb_offset_pdcch_type_0_scs_30_15_a40Mhz[cset_idx];
- break;
-
- case kHz30:
- AssertFatal(cset_idx<10,"Coreset index %d reserved for scs kHz30/kHz30\n", cset_idx);
- pdcch_pdu->mux_pattern = NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE1;
- pdcch_pdu->n_rb = (cset_idx < 4)? 24 : 48;
- pdcch_pdu->n_symb = nr_coreset_nsymb_pdcch_type_0_scs_30_30_a40Mhz[cset_idx];
- pdcch_pdu->rb_offset = nr_coreset_rb_offset_pdcch_type_0_scs_30_30_a40Mhz[cset_idx];
- break;
-
- default:
- AssertFatal(1==0,"Invalid scs_common/pdcch_scs combination %d/%d \n", scs_common, pdcch_scs);
- }
- }
- break;
-
- case kHz120:
- switch(pdcch_scs) {
- case kHz60:
- AssertFatal(cset_idx<12,"Coreset index %d reserved for scs kHz120/kHz60\n", cset_idx);
- pdcch_pdu->mux_pattern = (cset_idx < 8)?NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE1 : NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE2;
- pdcch_pdu->n_rb = (cset_idx < 6)? 48 : (cset_idx < 8)? 96 : (cset_idx < 10)? 48 : 96;
- pdcch_pdu->n_symb = nr_coreset_nsymb_pdcch_type_0_scs_120_60[cset_idx];
- pdcch_pdu->rb_offset = (nr_coreset_rb_offset_pdcch_type_0_scs_120_60[cset_idx]>0)?nr_coreset_rb_offset_pdcch_type_0_scs_120_60[cset_idx] :
- (k_ssb == 0)? -41 : -42;
- break;
-
- case kHz120:
- AssertFatal(cset_idx<8,"Coreset index %d reserved for scs kHz120/kHz120\n", cset_idx);
- pdcch_pdu->mux_pattern = (cset_idx < 4)?NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE1 : NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE3;
- pdcch_pdu->n_rb = (cset_idx < 2)? 24 : (cset_idx < 4)? 48 : (cset_idx < 6)? 24 : 48;
- pdcch_pdu->n_symb = (cset_idx == 2)? 1 : 2;
- pdcch_pdu->rb_offset = (nr_coreset_rb_offset_pdcch_type_0_scs_120_120[cset_idx]>0)? nr_coreset_rb_offset_pdcch_type_0_scs_120_120[cset_idx] :
- (k_ssb == 0)? -20 : -21;
- break;
-
- default:
- AssertFatal(1==0,"Invalid scs_common/pdcch_scs combination %d/%d \n", scs_common, pdcch_scs);
- }
- break;
-
- case kHz240:
- switch(pdcch_scs) {
- case kHz60:
- AssertFatal(cset_idx<4,"Coreset index %d reserved for scs kHz240/kHz60\n", cset_idx);
- pdcch_pdu->mux_pattern = NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE1;
- pdcch_pdu->n_rb = 96;
- pdcch_pdu->n_symb = (cset_idx < 2)? 1 : 2;
- pdcch_pdu->rb_offset = (cset_idx&1)? 16 : 0;
- break;
-
- case kHz120:
- AssertFatal(cset_idx<8,"Coreset index %d reserved for scs kHz240/kHz120\n", cset_idx);
- pdcch_pdu->mux_pattern = (cset_idx < 4)? NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE1 : NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE2;
- pdcch_pdu->n_rb = (cset_idx < 4)? 48 : (cset_idx < 6)? 24 : 48;
- pdcch_pdu->n_symb = ((cset_idx==2)||(cset_idx==3))? 2 : 1;
- pdcch_pdu->rb_offset = (nr_coreset_rb_offset_pdcch_type_0_scs_240_120[cset_idx]>0)? nr_coreset_rb_offset_pdcch_type_0_scs_240_120[cset_idx] :
- (k_ssb == 0)? -41 : -42;
- break;
-
- default:
- AssertFatal(1==0,"Invalid scs_common/pdcch_scs combination %d/%d \n", scs_common, pdcch_scs);
- }
- break;
-
- default:
- AssertFatal(1==0,"Invalid common subcarrier spacing %d\n", scs_common);
-
- }
-
- /// Search space params
- switch(pdcch_pdu->mux_pattern) {
-
- case NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE1:
- if (freq_range == nr_FR1) {
- O = nr_ss_param_O_type_0_mux1_FR1[ss_idx];
- pdcch_pdu->nb_ss_sets_per_slot = nr_ss_sets_per_slot_type_0_FR1[ss_idx];
- M = nr_ss_param_M_type_0_mux1_FR1[ss_idx];
- M_scale = nr_ss_scale_M_mux1_FR1[ss_idx];
- pdcch_pdu->first_symbol = (ss_idx < 8)? ( (ssb_idx&1)? pdcch_pdu->n_symb : 0 ) : nr_ss_first_symb_idx_type_0_mux1_FR1[ss_idx - 8];
- }
-
- else {
- AssertFatal(ss_idx<14 ,"Invalid search space index for multiplexing type 1 and FR2 %d\n", ss_idx);
- O = nr_ss_param_O_type_0_mux1_FR2[ss_idx];
- O_scale = nr_ss_scale_O_mux1_FR2[ss_idx];
- pdcch_pdu->nb_ss_sets_per_slot = nr_ss_sets_per_slot_type_0_FR2[ss_idx];
- M = nr_ss_param_M_type_0_mux1_FR2[ss_idx];
- M_scale = nr_ss_scale_M_mux1_FR2[ss_idx];
- pdcch_pdu->first_symbol = (ss_idx < 12)? ( (ss_idx&1)? 7 : 0 ) : 0;
- }
- pdcch_pdu->nb_slots = 2;
- pdcch_pdu->sfn_mod2 = (CEILIDIV( (((O<>O_scale) + ((ssb_idx*M)>>M_scale)), nb_slots_per_frame ) & 1)? 1 : 0;
- pdcch_pdu->first_slot = (((O<>O_scale) + ((ssb_idx*M)>>M_scale)) % nb_slots_per_frame;
-
- break;
-
- case NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE2:
- AssertFatal( ((scs_common==kHz120)&&(pdcch_scs==kHz60)) || ((scs_common==kHz240)&&(pdcch_scs==kHz120)),
- "Invalid scs_common/pdcch_scs combination %d/%d for Mux type 2\n", scs_common, pdcch_scs );
- AssertFatal(ss_idx==0, "Search space index %d reserved for scs_common/pdcch_scs combination %d/%d", ss_idx, scs_common, pdcch_scs);
-
- pdcch_pdu->nb_slots = 1;
-
- if ((scs_common==kHz120)&&(pdcch_scs==kHz60)) {
- pdcch_pdu->first_symbol = nr_ss_first_symb_idx_scs_120_60_mux2[ssb_idx&3];
- // Missing in pdcch_pdu sfn_C and n_C here and in else case
- }
- else {
- pdcch_pdu->first_symbol = ((ssb_idx&7)==4)?12 : ((ssb_idx&7)==4)?13 : nr_ss_first_symb_idx_scs_240_120_set1_mux2[ssb_idx&7]; //???
- }
-
- break;
-
- case NFAPI_NR_SSB_AND_CSET_MUX_PATTERN_TYPE3:
- AssertFatal( (scs_common==kHz120)&&(pdcch_scs==kHz120),
- "Invalid scs_common/pdcch_scs combination %d/%d for Mux type 3\n", scs_common, pdcch_scs );
- AssertFatal(ss_idx==0, "Search space index %d reserved for scs_common/pdcch_scs combination %d/%d", ss_idx, scs_common, pdcch_scs);
-
- pdcch_pdu->first_symbol = nr_ss_first_symb_idx_scs_120_120_mux3[ssb_idx&3];
-
- break;
-
- default:
- AssertFatal(1==0, "Invalid SSB and coreset multiplexing pattern %d\n", pdcch_pdu->mux_pattern);
- }
- pdcch_pdu->config_type = NFAPI_NR_CSET_CONFIG_MIB_SIB1;
- pdcch_pdu->cr_mapping_type = NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED;
- pdcch_pdu->precoder_granularity = NFAPI_NR_CSET_SAME_AS_REG_BUNDLE;
- pdcch_pdu->reg_bundle_size = 6;
- pdcch_pdu->interleaver_size = 2;
- // set initial banwidth part to full bandwidth
- pdcch_pdu->n_RB_BWP = N_RB;
-
- */
-
-}
-
void config_uldci(const NR_SIB1_t *sib1,
const NR_ServingCellConfigCommon_t *scc,
const nfapi_nr_pusch_pdu_t *pusch_pdu,
@@ -2445,17 +2227,6 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac,
UL_BWP->initial_BWPSize = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
UL_BWP->initial_BWPStart = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
- // Set downlink MCS table
- if (DL_BWP->pdsch_Config &&
- DL_BWP->pdsch_Config->mcs_Table) {
- if (*DL_BWP->pdsch_Config->mcs_Table == 0)
- DL_BWP->mcsTableIdx = 1;
- else
- DL_BWP->mcsTableIdx = 2;
- } else
- DL_BWP->mcsTableIdx = 0;
- LOG_D(NR_MAC,"DL MCS Table Index: %d\n",DL_BWP->mcsTableIdx);
-
if (UL_BWP->pusch_Config == NULL || !UL_BWP->pusch_Config->transformPrecoder)
UL_BWP->transform_precoding = !scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder;
else
@@ -2539,14 +2310,17 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac,
DL_BWP->dci_format = NR_DL_DCI_FORMAT_1_0;
}
- // Set uplink MCS table
- long *mcs_Table = NULL;
- if (UL_BWP->pusch_Config)
- mcs_Table = UL_BWP->transform_precoding ?
- UL_BWP->pusch_Config->mcs_Table :
- UL_BWP->pusch_Config->mcs_TableTransformPrecoder;
+ // Set MCS tables
+ long *dl_mcs_Table = DL_BWP->pdsch_Config ? DL_BWP->pdsch_Config->mcs_Table : NULL;
+ DL_BWP->mcsTableIdx = get_pdsch_mcs_table(dl_mcs_Table, DL_BWP->dci_format, NR_RNTI_C, target_ss);
- UL_BWP->mcs_table = get_pusch_mcs_table(mcs_Table,
+ long *ul_mcs_Table = NULL;
+ if (UL_BWP->pusch_Config)
+ ul_mcs_Table = UL_BWP->transform_precoding ?
+ UL_BWP->pusch_Config->mcs_Table :
+ UL_BWP->pusch_Config->mcs_TableTransformPrecoder;
+
+ UL_BWP->mcs_table = get_pusch_mcs_table(ul_mcs_Table,
UL_BWP->transform_precoding ? 0 : 1,
UL_BWP->dci_format,
NR_RNTI_C,
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
index f2d4c7946d..d3a9e5ae92 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
@@ -680,7 +680,8 @@ void evaluate_cqi_report(uint8_t *payload,
int cumul_bits,
uint8_t ri,
NR_UE_info_t *UE,
- long *cqi_Table){
+ uint8_t cqi_Table)
+{
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
@@ -692,10 +693,7 @@ void evaluate_cqi_report(uint8_t *payload,
// NR_CSI_ReportConfig__cqi_Table_table1 = 0
// NR_CSI_ReportConfig__cqi_Table_table2 = 1
// NR_CSI_ReportConfig__cqi_Table_table3 = 2
- if (cqi_Table)
- sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.cqi_table = *cqi_Table;
- else
- AssertFatal(1==0,"CQI Table not present in RRC configuration\n");
+ sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.cqi_table = cqi_Table;
sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb = temp_cqi;
LOG_D(MAC,"Wide-band CQI for the first TB %d\n", temp_cqi);
if (cqi_bitlen > 4) {
@@ -707,8 +705,7 @@ void evaluate_cqi_report(uint8_t *payload,
// TODO for wideband case and multiple TB
const int cqi_idx = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb;
const int mcs_table = UE->current_DL_BWP.mcsTableIdx;
- const int cqi_table = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.cqi_table;
- sched_ctrl->dl_max_mcs = get_mcs_from_cqi(mcs_table, cqi_table, cqi_idx);
+ sched_ctrl->dl_max_mcs = get_mcs_from_cqi(mcs_table, cqi_Table, cqi_idx);
}
@@ -785,6 +782,7 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig,
NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING;
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP;
+ NR_UE_DL_BWP_t *dl_bwp = &UE->current_DL_BWP;
const int n_slots_frame = nr_slots_per_frame[ul_bwp->scs];
int cumul_bits = 0;
int r_index = -1;
@@ -796,6 +794,7 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig,
uint8_t li_bitlen = 0;
uint8_t pmi_bitlen = 0;
NR_CSI_ReportConfig_t *csirep = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id];
+ uint8_t cqi_table = (dl_bwp->dci_format == NR_DL_DCI_FORMAT_1_1 && csirep->cqi_Table) ? *csirep->cqi_Table : NR_CSI_ReportConfig__cqi_Table_table1;
const NR_PUCCH_CSI_Resource_t *pucchcsires = csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[0];
if(pucchcsires->uplinkBandwidthPartId != ul_bwp->bwp_id)
continue;
@@ -823,7 +822,7 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig,
cumul_bits += ri_bitlen;
if (r_index != -1)
skip_zero_padding(&cumul_bits,csi_report,r_index,bitlen);
- evaluate_cqi_report(payload,csi_report,cumul_bits,r_index,UE,csirep->cqi_Table);
+ evaluate_cqi_report(payload,csi_report,cumul_bits,r_index,UE,cqi_table);
break;
case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI:
cri_bitlen = csi_report->csi_meas_bitlen.cri_bitlen;
@@ -839,7 +838,7 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig,
pmi_bitlen = evaluate_pmi_report(payload,csi_report,cumul_bits,r_index,sched_ctrl);
sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.csi_report_id = csi_report_id;
cumul_bits += pmi_bitlen;
- evaluate_cqi_report(payload,csi_report,cumul_bits,r_index,UE,csirep->cqi_Table);
+ evaluate_cqi_report(payload,csi_report,cumul_bits,r_index,UE,cqi_table);
break;
case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI:
cri_bitlen = csi_report->csi_meas_bitlen.cri_bitlen;
@@ -857,7 +856,7 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig,
pmi_bitlen = evaluate_pmi_report(payload,csi_report,cumul_bits,r_index,sched_ctrl);
sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.csi_report_id = csi_report_id;
cumul_bits += pmi_bitlen;
- evaluate_cqi_report(payload,csi_report,cumul_bits,r_index,UE,csirep->cqi_Table);
+ evaluate_cqi_report(payload,csi_report,cumul_bits,r_index,UE,cqi_table);
break;
default:
AssertFatal(1==0, "Invalid or not supported CSI measurement report\n");
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
index 1f5a6ce6f5..4321d4f949 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
@@ -1549,7 +1549,8 @@ void pf_ul(module_id_t module_id,
NR_UE_info_t *UE_list[],
int max_num_ue,
int n_rb_sched,
- uint16_t *rballoc_mask) {
+ uint16_t *rballoc_mask)
+{
const int CC_id = 0;
gNB_MAC_INST *nrmac = RC.nrmac[module_id];
@@ -1887,12 +1888,16 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
for (int i = 0; i < bwpSize; i++)
rballoc_mask[i] = (i >= st && i <= e)*SL_to_bitmap(startSymbolIndex, nrOfSymbols);
+ int bw = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+ int average_agg_level = 4; // TODO find a better estimation
+ int max_sched_ues = bw / (average_agg_level * NR_NB_REG_PER_CCE);
+
/* proportional fair scheduling algorithm */
pf_ul(module_id,
frame,
slot,
nr_mac->UE_info.list,
- 2,
+ max_sched_ues,
len,
rballoc_mask);
return true;
diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
index cae73f091a..7e9a66ca7f 100644
--- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
@@ -221,25 +221,6 @@ int get_pdsch_to_harq_feedback(NR_PUCCH_Config_t *pucch_Config,
nr_dci_format_t dci_format,
uint8_t *pdsch_to_harq_feedback);
-void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
- nr_scs_e scs_common,
- nr_scs_e pdcch_scs,
- frequency_range_t freq_range,
- uint8_t rmsi_pdcch_config,
- uint8_t ssb_idx,
- uint8_t k_ssb,
- uint16_t sfn_ssb,
- uint8_t n_ssb,
- uint16_t nb_slots_per_frame,
- uint16_t N_RB);
-/*
-int nr_is_dci_opportunity(nfapi_nr_search_space_t search_space,
- nfapi_nr_coreset_t coreset,
- uint16_t frame,
- uint16_t slot,
- nfapi_nr_config_request_scf_t cfg);
-*/
-
int nr_get_pucch_resource(NR_ControlResourceSet_t *coreset,
NR_PUCCH_Config_t *pucch_Config,
int CCEIndex);
diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c
index e2ec1567be..3213143db9 100644
--- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c
+++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c
@@ -130,7 +130,6 @@ int dl_rrc_message_rrcSetup(module_id_t module_id, const f1ap_dl_rrc_message_t *
ue_context_p->ue_context.SRB_configList,
NULL,
NULL,
- NULL,
cellGroup->rlc_BearerToAddModList);
return 0;
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
deleted file mode 100644
index aed00e578a..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
+++ /dev/null
@@ -1,948 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_C 1
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-#include "common/platform_constants.h"
-//-----------------------------------------------------------------------------
-
-#include "assertions.h"
-#include "hashtable.h"
-#include "rlc_am.h"
-#include "rlc_am_segment.h"
-#include "rlc_am_timer_poll_retransmit.h"
-#include "mac_primitives.h"
-#include "rlc_primitives.h"
-#include "list.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-#include "LTE_UL-AM-RLC.h"
-#include "LTE_DL-AM-RLC.h"
-
-//-----------------------------------------------------------------------------
-uint32_t
-rlc_am_get_status_pdu_buffer_occupancy(
- rlc_am_entity_t *const rlc_pP) {
- //Compute Max Status PDU size according to what has been received and not received in the window [vrR vrMS[
- // minimum header size in bits to be transmitted: D/C + CPT + ACK_SN + E1
- uint32_t nb_bits_to_transmit = RLC_AM_PDU_D_C_BITS + RLC_AM_STATUS_PDU_CPT_LENGTH + RLC_AM_SN_BITS + RLC_AM_PDU_E_BITS;
- mem_block_t *cursor_p = rlc_pP->receiver_buffer.head;
- rlc_am_pdu_info_t *pdu_info_cursor_p = NULL;
- int waited_so = 0;
- rlc_sn_t sn_cursor = rlc_pP->vr_r;
- rlc_sn_t sn_prev = rlc_pP->vr_r;
- rlc_sn_t sn_end = rlc_pP->vr_ms;
- bool segment_loop_end = false;
-
- if (sn_prev != sn_end) {
- while ((RLC_AM_DIFF_SN(sn_prev,rlc_pP->vr_r) < RLC_AM_DIFF_SN(sn_end,rlc_pP->vr_r)) && (cursor_p != NULL)) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
- sn_cursor = pdu_info_cursor_p->sn;
-
- // Add holes between sn_prev and sn_cursor
- while ((sn_prev != sn_cursor) && (sn_prev != sn_end)) {
- /* Add 1 NACK_SN + E1 + E2 */
- nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1));
- sn_prev = RLC_AM_NEXT_SN(sn_prev);
- } //end while (sn_prev != sn_cursor)
-
- /* Handle case sn_cursor is partially received */
- /* Each gap will add NACK_SN + E1 + E2 + SOStart + SOEnd */
- if ((((rlc_am_rx_pdu_management_t *)(cursor_p->data))->all_segments_received == 0) && (RLC_AM_DIFF_SN(sn_cursor,rlc_pP->vr_r) < RLC_AM_DIFF_SN(sn_end,rlc_pP->vr_r))) {
- /* Check lsf */
- segment_loop_end = (pdu_info_cursor_p->lsf == 1);
-
- /* Fill for [0 SO[ if SO not null */
- if (pdu_info_cursor_p->so) {
- nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
- waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
- } else {
- waited_so = pdu_info_cursor_p->payload_size;
- }
-
- /* Go to next segment */
- cursor_p = cursor_p->next;
-
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
- }
-
- /* Fill following gaps if any */
- while (!segment_loop_end) {
- if ((cursor_p != NULL) && (pdu_info_cursor_p->sn == sn_cursor)) {
- /* Check lsf */
- segment_loop_end = (pdu_info_cursor_p->lsf == 1);
-
- if (waited_so < pdu_info_cursor_p->so) {
- nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
- } else {
- /* contiguous segment: only update waited_so */
- /* Assuming so and payload_size updated according to duplication removal done at reception ... */
- waited_so += pdu_info_cursor_p->payload_size;
- }
-
- /* Go to next received PDU or PDU Segment */
- cursor_p = cursor_p->next;
-
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
- }
- } else {
- /* Fill last gap assuming LSF is not received */
- nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
- segment_loop_end = true;
- }
- } // end while (!segment_loop_end)
- } // end if segments
- else {
- /* Go to next received PDU or PDU segment with different SN */
- do {
- cursor_p = cursor_p->next;
- } while ((cursor_p != NULL) && (((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info.sn == sn_cursor));
- }
-
- sn_prev = RLC_AM_NEXT_SN(sn_cursor);
- }
- } // end if (sn_prev != sn_end)
-
- // round up to the greatest byte
- return ((nb_bits_to_transmit + 7) >> 3);
-}
-
-//-----------------------------------------------------------------------------
-uint32_t
-rlc_am_get_buffer_occupancy_in_bytes (
- const protocol_ctxt_t *const ctxt_pP,
- rlc_am_entity_t *const rlc_pP) {
- // priority of control trafic
- rlc_pP->status_buffer_occupancy = 0;
-
- if ((rlc_pP->status_requested) && !(rlc_pP->status_requested & RLC_AM_STATUS_NO_TX_MASK)) {
- rlc_pP->status_buffer_occupancy = rlc_am_get_status_pdu_buffer_occupancy(rlc_pP);
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : CONTROL PDU %d bytes \n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->status_buffer_occupancy);
- }
-
- if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
- if ((rlc_pP->status_buffer_occupancy + rlc_pP->retrans_num_bytes_to_retransmit + rlc_pP->sdu_buffer_occupancy ) > 0) {
- LOG_UI(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : STATUS BUFFER %d bytes \n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), rlc_pP->status_buffer_occupancy);
- LOG_UI(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : RETRANS BUFFER %d bytes \n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), rlc_pP->retrans_num_bytes_to_retransmit);
- LOG_UI(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : SDU BUFFER %d bytes + li_overhead %d bytes header_overhead %d bytes (nb sdu not segmented %d)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->sdu_buffer_occupancy,
- 0,
- 0,
- rlc_pP->nb_sdu_no_segmented);
- }
- }
-
- return rlc_pP->status_buffer_occupancy + rlc_pP->retrans_num_bytes_to_retransmit + rlc_pP->sdu_buffer_occupancy;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_release (
- const protocol_ctxt_t *const ctxt_pP,
- rlc_am_entity_t *const rlc_pP
-) {
- // empty
-}
-//-----------------------------------------------------------------------------
-void
-config_req_rlc_am (
- const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const rlc_am_info_t *config_am_pP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP
-) {
- rlc_union_t *rlc_union_p = NULL;
- rlc_am_entity_t *l_rlc_p = NULL;
- hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- hashtable_rc_t h_rc;
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- l_rlc_p = &rlc_union_p->rlc.am;
- LOG_D(RLC,
- PROTOCOL_RLC_AM_CTXT_FMT" CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- config_am_pP->max_retx_threshold,
- config_am_pP->poll_pdu,
- config_am_pP->poll_byte,
- config_am_pP->t_poll_retransmit,
- config_am_pP->t_reordering,
- config_am_pP->t_status_prohibit);
- rlc_am_init(ctxt_pP, l_rlc_p);
- rlc_am_set_debug_infos(ctxt_pP, l_rlc_p, srb_flagP, rb_idP, chan_idP);
- rlc_am_configure(ctxt_pP, l_rlc_p,
- config_am_pP->max_retx_threshold,
- config_am_pP->poll_pdu,
- config_am_pP->poll_byte,
- config_am_pP->t_poll_retransmit,
- config_am_pP->t_reordering,
- config_am_pP->t_status_prohibit);
- } else {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" CONFIG_REQ RLC NOT FOUND\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p));
- }
-}
-uint16_t pollPDU_tab[LTE_PollPDU_pInfinity+1]= {4,8,16,32,64,128,256,RLC_AM_POLL_PDU_INFINITE}; //PollPDU_pInfinity is chosen to 0xFFFF for now
-uint32_t maxRetxThreshold_tab[LTE_UL_AM_RLC__maxRetxThreshold_t32+1]= {1,2,3,4,6,8,16,32};
-uint32_t pollByte_tab[LTE_PollByte_spare1]= {25000,50000,75000,100000,125000,250000,375000,500000,750000,1000000,1250000,1500000,2000000,3000000,RLC_AM_POLL_BYTE_INFINITE}; // PollByte_kBinfinity is chosen to 0xFFFFFFFF for now
-uint32_t PollRetransmit_tab[LTE_T_PollRetransmit_spare5]= {5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500,800,1000,2000,4000};
-uint32_t am_t_Reordering_tab[32]= {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200,1600};
-uint32_t t_StatusProhibit_tab[LTE_T_StatusProhibit_spare2]= {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,300,350,400,450,500,800,1000,1200,1600,2000,2400};
-
-
-//-----------------------------------------------------------------------------
-void config_req_rlc_am_asn1 (
- const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const struct LTE_RLC_Config__am *const config_am_pP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP) {
- rlc_union_t *rlc_union_p = NULL;
- rlc_am_entity_t *l_rlc_p = NULL;
- hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- hashtable_rc_t h_rc;
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- l_rlc_p = &rlc_union_p->rlc.am;
-
- if ((config_am_pP->ul_AM_RLC.maxRetxThreshold <= LTE_UL_AM_RLC__maxRetxThreshold_t32) &&
- (config_am_pP->ul_AM_RLC.pollPDU<=LTE_PollPDU_pInfinity) &&
- (config_am_pP->ul_AM_RLC.pollByteul_AM_RLC.t_PollRetransmitdl_AM_RLC.t_Reordering<32) &&
- (config_am_pP->dl_AM_RLC.t_StatusProhibitul_AM_RLC.maxRetxThreshold],
- pollPDU_tab[config_am_pP->ul_AM_RLC.pollPDU],
- pollByte_tab[config_am_pP->ul_AM_RLC.pollByte],
- PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit],
- am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering],
- t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit]);
- rlc_am_init(ctxt_pP, l_rlc_p);
- rlc_am_set_debug_infos(ctxt_pP, l_rlc_p, srb_flagP, rb_idP, chan_idP);
- rlc_am_configure(ctxt_pP, l_rlc_p,
- maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold],
- pollPDU_tab[config_am_pP->ul_AM_RLC.pollPDU],
- pollByte_tab[config_am_pP->ul_AM_RLC.pollByte],
- PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit],
- am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering],
- t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit]);
- } else {
- LOG_D(RLC,
- PROTOCOL_RLC_AM_CTXT_FMT"ILLEGAL CONFIG_REQ (max_retx_threshold=%ld poll_pdu=%ld poll_byte=%ld t_poll_retransmit=%ld t_reord=%ld t_status_prohibit=%ld), RLC-AM NOT CONFIGURED\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- config_am_pP->ul_AM_RLC.maxRetxThreshold,
- config_am_pP->ul_AM_RLC.pollPDU,
- config_am_pP->ul_AM_RLC.pollByte,
- config_am_pP->ul_AM_RLC.t_PollRetransmit,
- config_am_pP->dl_AM_RLC.t_Reordering,
- config_am_pP->dl_AM_RLC.t_StatusProhibit);
- }
- } else {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"CONFIG_REQ RLC NOT FOUND\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p));
- }
-}
-
-//-----------------------------------------------------------------------------
-void rlc_am_stat_req (
- const protocol_ctxt_t *const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- unsigned int *stat_tx_pdcp_sdu,
- unsigned int *stat_tx_pdcp_bytes,
- unsigned int *stat_tx_pdcp_sdu_discarded,
- unsigned int *stat_tx_pdcp_bytes_discarded,
- unsigned int *stat_tx_data_pdu,
- unsigned int *stat_tx_data_bytes,
- unsigned int *stat_tx_retransmit_pdu_by_status,
- unsigned int *stat_tx_retransmit_bytes_by_status,
- unsigned int *stat_tx_retransmit_pdu,
- unsigned int *stat_tx_retransmit_bytes,
- unsigned int *stat_tx_control_pdu,
- unsigned int *stat_tx_control_bytes,
- unsigned int *stat_rx_pdcp_sdu,
- unsigned int *stat_rx_pdcp_bytes,
- unsigned int *stat_rx_data_pdus_duplicate,
- unsigned int *stat_rx_data_bytes_duplicate,
- unsigned int *stat_rx_data_pdu,
- unsigned int *stat_rx_data_bytes,
- unsigned int *stat_rx_data_pdu_dropped,
- unsigned int *stat_rx_data_bytes_dropped,
- unsigned int *stat_rx_data_pdu_out_of_window,
- unsigned int *stat_rx_data_bytes_out_of_window,
- unsigned int *stat_rx_control_pdu,
- unsigned int *stat_rx_control_bytes,
- unsigned int *stat_timer_reordering_timed_out,
- unsigned int *stat_timer_poll_retransmit_timed_out,
- unsigned int *stat_timer_status_prohibit_timed_out) {
- *stat_tx_pdcp_sdu = rlc_pP->stat_tx_pdcp_sdu;
- *stat_tx_pdcp_bytes = rlc_pP->stat_tx_pdcp_bytes;
- *stat_tx_pdcp_sdu_discarded = rlc_pP->stat_tx_pdcp_sdu_discarded;
- *stat_tx_pdcp_bytes_discarded = rlc_pP->stat_tx_pdcp_bytes_discarded;
- *stat_tx_data_pdu = rlc_pP->stat_tx_data_pdu;
- *stat_tx_data_bytes = rlc_pP->stat_tx_data_bytes;
- *stat_tx_retransmit_pdu_by_status = rlc_pP->stat_tx_retransmit_pdu_by_status;
- *stat_tx_retransmit_bytes_by_status = rlc_pP->stat_tx_retransmit_bytes_by_status;
- *stat_tx_retransmit_pdu = rlc_pP->stat_tx_retransmit_pdu;
- *stat_tx_retransmit_bytes = rlc_pP->stat_tx_retransmit_bytes;
- *stat_tx_control_pdu = rlc_pP->stat_tx_control_pdu;
- *stat_tx_control_bytes = rlc_pP->stat_tx_control_bytes;
- *stat_rx_pdcp_sdu = rlc_pP->stat_rx_pdcp_sdu;
- *stat_rx_pdcp_bytes = rlc_pP->stat_rx_pdcp_bytes;
- *stat_rx_data_pdus_duplicate = rlc_pP->stat_rx_data_pdus_duplicate;
- *stat_rx_data_bytes_duplicate = rlc_pP->stat_rx_data_bytes_duplicate;
- *stat_rx_data_pdu = rlc_pP->stat_rx_data_pdu;
- *stat_rx_data_bytes = rlc_pP->stat_rx_data_bytes;
- *stat_rx_data_pdu_dropped = rlc_pP->stat_rx_data_pdu_dropped;
- *stat_rx_data_bytes_dropped = rlc_pP->stat_rx_data_bytes_dropped;
- *stat_rx_data_pdu_out_of_window = rlc_pP->stat_rx_data_pdu_out_of_window;
- *stat_rx_data_bytes_out_of_window = rlc_pP->stat_rx_data_bytes_out_of_window;
- *stat_rx_control_pdu = rlc_pP->stat_rx_control_pdu;
- *stat_rx_control_bytes = rlc_pP->stat_rx_control_bytes;
- *stat_timer_reordering_timed_out = rlc_pP->stat_timer_reordering_timed_out;
- *stat_timer_poll_retransmit_timed_out = rlc_pP->stat_timer_poll_retransmit_timed_out;
- *stat_timer_status_prohibit_timed_out = rlc_pP->stat_timer_status_prohibit_timed_out;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_get_pdus (
- const protocol_ctxt_t *const ctxt_pP,
- rlc_am_entity_t *const rlc_pP
-) {
- //int display_flag = 0;
- // 5.1.3.1 Transmit operations
- // 5.1.3.1.1
- // General
- // The transmitting side of an AM RLC entity shall prioritize transmission of RLC control PDUs over RLC data PDUs.
- // The transmitting side of an AM RLC entity shall prioritize retransmission of RLC data PDUs over transmission of new
- // AMD PDUs.
- switch (rlc_pP->protocol_state) {
- case RLC_NULL_STATE:
- break;
-
- case RLC_DATA_TRANSFER_READY_STATE:
-
- // TRY TO SEND CONTROL PDU FIRST
- if ((rlc_pP->nb_bytes_requested_by_mac >= 2) &&
- ((rlc_pP->status_requested) && !(rlc_pP->status_requested & RLC_AM_STATUS_NO_TX_MASK))) {
- // When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall:
- // - 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;
- // - else:
- // - at the first transmission opportunity indicated by lower layer after t-StatusProhibit expires, construct a single
- // STATUS PDU even if status reporting was triggered several times while t-StatusProhibit was running and
- // deliver it to lower layer;
- //
- // When a STATUS PDU has been delivered to lower layer, the receiving side of an AM RLC entity shall:
- // - start t-StatusProhibit.
- rlc_am_send_status_pdu(ctxt_pP, rlc_pP);
- mem_block_t *pdu = list_remove_head(&rlc_pP->control_pdu_list);
-
- if (pdu) {
- list_add_tail_eurecom (pdu, &rlc_pP->pdus_to_mac_layer);
- RLC_AM_CLEAR_ALL_STATUS(rlc_pP->status_requested);
- rlc_pP->status_buffer_occupancy = 0;
- rlc_am_start_timer_status_prohibit(ctxt_pP, rlc_pP);
- return;
- }
- } else {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" DELAYED SENT STATUS PDU (Available MAC Data %u)(T-PROHIBIT %u) (DELAY FLAG %u)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->nb_bytes_requested_by_mac,rlc_pP->t_status_prohibit.ms_time_out,(rlc_pP->status_requested & RLC_AM_STATUS_TRIGGERED_DELAYED));
- }
-
- // THEN TRY TO SEND RETRANS PDU
- if ((rlc_pP->retrans_num_bytes_to_retransmit) && (rlc_pP->nb_bytes_requested_by_mac > 2)) {
- /* Get 1 AM data PDU or PDU segment to retransmit */
- mem_block_t *pdu_retx = rlc_am_get_pdu_to_retransmit(ctxt_pP, rlc_pP);
-
- if (pdu_retx != NULL) {
- list_add_tail_eurecom (pdu_retx, &rlc_pP->pdus_to_mac_layer);
- return;
- }
- }
-
- // THEN TRY TO SEND NEW DATA PDU
- if ((rlc_pP->nb_bytes_requested_by_mac > 2) && (rlc_pP->sdu_buffer_occupancy) && (rlc_pP->vt_s != rlc_pP->vt_ms)) {
- rlc_am_segment_10(ctxt_pP, rlc_pP);
- list_add_list (&rlc_pP->segmentation_pdu_list, &rlc_pP->pdus_to_mac_layer);
-
- if (rlc_pP->pdus_to_mac_layer.head != NULL) {
- rlc_pP->stat_tx_data_pdu += 1;
- rlc_pP->stat_tx_data_bytes += (((struct mac_tb_req *)(rlc_pP->pdus_to_mac_layer.head->data))->tb_size);
- return;
- }
- }
-
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" MAC_DATA_REQ UNKNOWN PROTOCOL STATE 0x%02X\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->protocol_state);
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_rx (
- const protocol_ctxt_t *const ctxt_pP,
- void *const arg_pP,
- struct mac_data_ind data_indP
-) {
- rlc_am_entity_t *rlc = (rlc_am_entity_t *) arg_pP;
-
- switch (rlc->protocol_state) {
- case RLC_NULL_STATE:
- LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP, rlc));
- list_free (&data_indP.data);
- break;
-
- case RLC_DATA_TRANSFER_READY_STATE:
- rlc_am_receive_routing (ctxt_pP, rlc, data_indP);
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE 0x%02X\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP, rlc), rlc->protocol_state);
- list_free (&data_indP.data);
- }
-}
-
-//-----------------------------------------------------------------------------
-struct mac_status_resp
-rlc_am_mac_status_indication (
- const protocol_ctxt_t *const ctxt_pP,
- void *const rlc_pP,
- struct mac_status_ind tx_statusP,
- const eNB_flag_t enb_flagP) {
- struct mac_status_resp status_resp;
- uint16_t sdu_size = 0;
- uint16_t sdu_remaining_size = 0;
- int32_t diff_time=0;
- rlc_am_entity_t *rlc = (rlc_am_entity_t *) rlc_pP;
- status_resp.buffer_occupancy_in_bytes = 0;
- status_resp.buffer_occupancy_in_pdus = 0;
- status_resp.head_sdu_remaining_size_to_send = 0;
- status_resp.head_sdu_creation_time = 0;
- status_resp.head_sdu_is_segmented = 0;
- status_resp.rlc_info.rlc_protocol_state = rlc->protocol_state;
-
- /* TODO: remove this hack. Problem is: there is a race.
- * UE comes. SRB2 is configured via message to RRC.
- * At some point the RLC AM is created but not configured yet.
- * At this moment (I think) MAC calls mac_rlc_status_ind
- * which calls this function. But the init was not finished yet
- * and we have a crash below when testing mem_block != NULL.
- */
- if (rlc->input_sdus == NULL) return status_resp;
-
- if (rlc->last_absolute_subframe_status_indication != (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP))) {
- rlc_am_check_timer_poll_retransmit(ctxt_pP, rlc);
- rlc_am_check_timer_reordering(ctxt_pP, rlc);
- rlc_am_check_timer_status_prohibit(ctxt_pP, rlc);
- }
-
- rlc->last_absolute_subframe_status_indication = PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP);
-
- status_resp.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(ctxt_pP, rlc);
-
- // For eNB scheduler : Add Max RLC header size for new PDU
- // For UE : do not add RLC header part to be compliant with BSR definition in 36.321
- if (enb_flagP == ENB_FLAG_YES) {
- uint32_t max_li_overhead = 0;
- uint32_t header_overhead = 0;
-
- if (rlc->nb_sdu_no_segmented > 1) {
- /* This computation assumes there is no SDU with size greater than 2047 bytes, otherwise a new PDU must be built except for LI15 configuration from Rel12*/
- uint32_t num_li = rlc->nb_sdu_no_segmented - 1;
- max_li_overhead = num_li + (num_li >> 1) + (num_li & 1);
- }
-
- if (rlc->sdu_buffer_occupancy > 0) {
- header_overhead = 2;
- }
-
- status_resp.buffer_occupancy_in_bytes += (header_overhead + max_li_overhead);
- }
-
- if ((rlc->input_sdus[rlc->current_sdu_index].mem_block != NULL) && (status_resp.buffer_occupancy_in_bytes)) {
- //status_resp.buffer_occupancy_in_bytes += ((rlc_am_entity_t *) rlc)->tx_header_min_length_in_bytes;
- status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu;
- diff_time = ctxt_pP->frame - ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_creation_time;
- status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (uint32_t) diff_time : (uint32_t)(0xffffffff - diff_time + ctxt_pP->frame) ;
- sdu_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_size;
- sdu_remaining_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_remaining_size;
- status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
-
- if (sdu_size == sdu_remaining_size) {
- status_resp.head_sdu_is_segmented = 0;
- } else {
- status_resp.head_sdu_is_segmented = 1;
- }
- } else {
- /* Not so many possibilities ... */
- /* either buffer_occupancy_in_bytes = 0 and that's it */
- /* or we have segmented all received SDUs and buffer occupancy is then made of retransmissions and/or status pdu pending */
- /* then consider only retransmission buffer for the specific BO values used by eNB scheduler (not used up to now...) */
- if (rlc->retrans_num_bytes_to_retransmit) {
- status_resp.buffer_occupancy_in_pdus = rlc->retrans_num_pdus;
- status_resp.head_sdu_remaining_size_to_send = rlc->retrans_num_bytes_to_retransmit;
- status_resp.head_sdu_is_segmented = 1;
- }
- }
-
- if (LOG_DEBUGFLAG(DEBUG_RLC)) {
- LOG_UI(RLC, PROTOCOL_RLC_AM_CTXT_FMT" MAC_STATUS_INDICATION (DATA) -> %d bytes\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc),
- status_resp.buffer_occupancy_in_bytes);
- }
-
- return status_resp;
-}
-
-//-----------------------------------------------------------------------------
-struct mac_data_req
-rlc_am_mac_data_request (
- const protocol_ctxt_t *const ctxt_pP,
- void *const rlc_pP,
- const eNB_flag_t enb_flagP
-) {
- struct mac_data_req data_req;
- rlc_am_entity_t *l_rlc_p = (rlc_am_entity_t *) rlc_pP;
- unsigned int nb_bytes_requested_by_mac = ((rlc_am_entity_t *) rlc_pP)->nb_bytes_requested_by_mac;
- rlc_am_pdu_info_t pdu_info;
- rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p;
- mem_block_t *tb_p;
- tb_size_t tb_size_in_bytes;
- int num_nack;
- char message_string[9000];
- size_t message_string_size = 0;
- int octet_index, index;
- /* for no gcc warnings */
- (void)num_nack;
- (void)message_string;
- (void)message_string_size;
- (void)octet_index;
- (void)index;
- list_init (&data_req.data, NULL);
- rlc_am_get_pdus (ctxt_pP, l_rlc_p);
- list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data);
-
- //((rlc_am_entity_t *) rlc_pP)->tx_pdus += data_req.data.nb_elements;
- if ((nb_bytes_requested_by_mac + data_req.data.nb_elements) > 0) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" MAC_DATA_REQUEST %05d BYTES REQUESTED -> %d TBs\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- nb_bytes_requested_by_mac,
- data_req.data.nb_elements);
- }
-
- if (enb_flagP) {
- // redundant in UE MAC Tx processing and not used in eNB ...
- data_req.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(ctxt_pP, l_rlc_p);
- }
-
- data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state;
-
- if ( (LOG_DEBUGFLAG(DEBUG_RLC))&& data_req.data.nb_elements > 0) {
- tb_p = data_req.data.head;
-
- while (tb_p != NULL) {
- rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t *)((struct mac_tb_req *) (tb_p->data))->data_ptr;
- tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size;
-
- if ((((struct mac_tb_req *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) {
- if (rlc_am_get_data_pdu_infos(ctxt_pP,l_rlc_p,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) {
- if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
- message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
- message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
-
- if (pdu_info.rf) {
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: AMD PDU segment\n\n");
- } else {
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: AMD PDU\n\n");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", pdu_info.d_c);
- message_string_size += sprintf(&message_string[message_string_size], " RF : %u\n", pdu_info.rf);
- message_string_size += sprintf(&message_string[message_string_size], " P : %u\n", pdu_info.p);
- message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
- message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
- message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
-
- if (pdu_info.rf) {
- message_string_size += sprintf(&message_string[message_string_size], " LSF : %u\n", pdu_info.lsf);
- message_string_size += sprintf(&message_string[message_string_size], " SO : %u\n", pdu_info.so);
- }
-
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
-
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
- }
- }
-
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
- }
-
- /*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
-
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- LOG_UI(RLC,"%s\n",message_string);
- } /* LOG_DEBUGFLAG(DEBUG_RLC) */
- }
- } else {
- if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, &tb_size_in_bytes, &l_rlc_p->control_pdu_info) >= 0) {
- tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size; //tb_size_in_bytes modified by rlc_am_get_control_pdu_infos!
-
- if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: STATUS PDU\n\n");
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", l_rlc_p->control_pdu_info.d_c);
- message_string_size += sprintf(&message_string[message_string_size], " CPT : %u\n", l_rlc_p->control_pdu_info.cpt);
- message_string_size += sprintf(&message_string[message_string_size], " ACK_SN : %u\n", l_rlc_p->control_pdu_info.ack_sn);
- message_string_size += sprintf(&message_string[message_string_size], " E1 : %u\n", l_rlc_p->control_pdu_info.e1);
-
- for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) {
- if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d SO START %05d SO END %05d",
- l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_start,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_end);
- } else {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d", l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn);
- }
- }
-
- LOG_UI(RLC,"%s\n",message_string);
- } /* LOG_DEBUGFLAG(DEBUG_RLC) */
- }
- }
-
- tb_p = tb_p->next;
- } /* while */
- } /* data_req.data.nb_elements > 0 */
-
- data_req.buffer_occupancy_in_pdus = 0;
- return data_req;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_mac_data_indication (
- const protocol_ctxt_t *const ctxt_pP,
- void *const rlc_pP,
- struct mac_data_ind data_indP
-) {
- rlc_am_entity_t *l_rlc_p = (rlc_am_entity_t *) rlc_pP;
- /*rlc_am_control_pdu_info_t control_pdu_info;
- int num_li;
- int16_t tb_size;*/
- rlc_am_pdu_info_t pdu_info;
- rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p;
- mem_block_t *tb_p;
- sdu_size_t tb_size_in_bytes;
- int num_nack;
- char message_string[7000];
- size_t message_string_size = 0;
- int octet_index, index;
- /* for no gcc warnings */
- (void)num_nack;
- (void)message_string;
- (void)message_string_size;
- (void)octet_index;
- (void)index;
- (void)l_rlc_p; /* avoid gcc warning "unused variable" */
-
- if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
- if (data_indP.data.nb_elements > 0) {
- tb_p = data_indP.data.head;
-
- while (tb_p != NULL) {
- rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t *)((struct mac_tb_ind *) (tb_p->data))->data_ptr;
- tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
-
- if ((((struct mac_tb_ind *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) {
- if (rlc_am_get_data_pdu_infos(ctxt_pP,l_rlc_p,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) {
- if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
- message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
- message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
-
- if (pdu_info.rf) {
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: AMD PDU segment\n\n");
- } else {
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: AMD PDU\n\n");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", pdu_info.d_c);
- message_string_size += sprintf(&message_string[message_string_size], " RF : %u\n", pdu_info.rf);
- message_string_size += sprintf(&message_string[message_string_size], " P : %u\n", pdu_info.p);
- message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
- message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
- message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
-
- if (pdu_info.rf) {
- message_string_size += sprintf(&message_string[message_string_size], " LSF : %u\n", pdu_info.lsf);
- message_string_size += sprintf(&message_string[message_string_size], " SO : %u\n", pdu_info.so);
- }
-
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
-
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
- }
- }
-
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
- }
-
- /*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
-
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- LOG_UI(RLC,"%s\n",message_string);
- } /* LOG_DEBUGFLAG */
- }
- } else {
- if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, &tb_size_in_bytes, &l_rlc_p->control_pdu_info) >= 0) {
- if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", ((struct mac_tb_ind *) (tb_p->data))->size);
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: STATUS PDU\n\n");
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", l_rlc_p->control_pdu_info.d_c);
- message_string_size += sprintf(&message_string[message_string_size], " CPT : %u\n", l_rlc_p->control_pdu_info.cpt);
- message_string_size += sprintf(&message_string[message_string_size], " ACK_SN : %u\n", l_rlc_p->control_pdu_info.ack_sn);
- message_string_size += sprintf(&message_string[message_string_size], " E1 : %u\n", l_rlc_p->control_pdu_info.e1);
-
- for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) {
- if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d SO START %05d SO END %05d",
- l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_start,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_end);
- } else {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d", l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn);
- }
- }
-
- LOG_UI(RLC, "%s\n",message_string);
- }
- }
- }
-
- tb_p = tb_p->next;
- }
- }
- } /* LOG_DEBUGFLAG(RLC) || MESSAGE_TRACE_GENERATOR) */
-
- rlc_am_rx (ctxt_pP, rlc_pP, data_indP);
-}
-
-//-----------------------------------------------------------------------------
-void
-rlc_am_data_req (
- const protocol_ctxt_t *const ctxt_pP,
- void *const rlc_pP,
- mem_block_t *const sdu_pP) {
- rlc_am_entity_t *l_rlc_p = (rlc_am_entity_t *) rlc_pP;
- uint32_t mui;
- uint16_t data_offset;
- uint16_t data_size;
- char message_string[7000];
- size_t message_string_size = 0;
- int octet_index, index;
- RLC_AM_MUTEX_LOCK(&l_rlc_p->lock_input_sdus, ctxt_pP, l_rlc_p);
-
- if ((l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mem_block == NULL) &&
- (l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.segmented == 0) &&
- (((l_rlc_p->next_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE) != l_rlc_p->current_sdu_index)) {
- memset(&l_rlc_p->input_sdus[l_rlc_p->next_sdu_index], 0, sizeof(rlc_am_tx_sdu_management_t));
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mem_block = sdu_pP;
- mui = ((struct rlc_am_data_req *) (sdu_pP->data))->mui;
- data_offset = ((struct rlc_am_data_req *) (sdu_pP->data))->data_offset;
- data_size = ((struct rlc_am_data_req *) (sdu_pP->data))->data_size;
-
- if (LOG_DEBUGFLAG(DEBUG_RLC)) {
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "SDU size : %u\n", data_size);
- message_string_size += sprintf(&message_string[message_string_size], "MUI : %u\n", mui);
- message_string_size += sprintf(&message_string[message_string_size], "CONF : %u\n", ((struct rlc_am_data_req *) (sdu_pP->data))->conf);
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < data_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
- }
-
- /*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size], " %02x", ((uint8_t *)(&sdu_pP->data[data_offset]))[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
-
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
- LOG_UI(RLC, "%s\n", message_string);
- } /* LOG_DEBUGFLAG(RLC) */
-
- l_rlc_p->stat_tx_pdcp_sdu += 1;
- l_rlc_p->stat_tx_pdcp_bytes += data_size;
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mui = mui;
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_size = data_size;
- l_rlc_p->sdu_buffer_occupancy += data_size;
- l_rlc_p->nb_sdu += 1;
- l_rlc_p->nb_sdu_no_segmented += 1;
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].first_byte = (uint8_t *)(&sdu_pP->data[data_offset]);
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_remaining_size = l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_size;
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_segmented_size = 0;
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_creation_time = ctxt_pP->frame;
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].nb_pdus = 0;
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].nb_pdus_ack = 0;
- //l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].nb_pdus_time = 0;
- //l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].nb_pdus_internal_use = 0;
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.discarded = 0;
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.segmented = 0;
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.segmentation_in_progress = 0;
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.no_new_sdu_segmented_in_last_pdu = 0;
- //l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].li_index_for_discard = -1;
- l_rlc_p->next_sdu_index = (l_rlc_p->next_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
-
- if (l_rlc_p->channel_id <3) {
- LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_REQ size %d Bytes, NB SDU %d current_sdu_index=%d next_sdu_index=%d conf %d mui %d vtA %d vtS %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- data_size,
- l_rlc_p->nb_sdu,
- l_rlc_p->current_sdu_index,
- l_rlc_p->next_sdu_index,
- ((struct rlc_am_data_req *) (sdu_pP->data))->conf,
- mui,
- l_rlc_p->vt_a,
- l_rlc_p->vt_s);
- }
- } else {
- LOG_W(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_REQ BUFFER FULL, NB SDU %d current_sdu_index=%d next_sdu_index=%d size_input_sdus_buffer=%d vtA=%d vtS=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- l_rlc_p->nb_sdu,
- l_rlc_p->current_sdu_index,
- l_rlc_p->next_sdu_index,
- RLC_AM_SDU_CONTROL_BUFFER_SIZE,
- l_rlc_p->vt_a,
- l_rlc_p->vt_s);
- LOG_W(RLC, " input_sdus[].mem_block=%p next input_sdus[].flags.segmented=%d\n",
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mem_block, l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.segmented);
- l_rlc_p->stat_tx_pdcp_sdu_discarded += 1;
- l_rlc_p->stat_tx_pdcp_bytes_discarded += ((struct rlc_am_data_req *) (sdu_pP->data))->data_size;
- free_mem_block (sdu_pP, __func__);
-#if STOP_ON_IP_TRAFFIC_OVERLOAD
- AssertFatal(0, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_REQ size %d Bytes, SDU DROPPED, INPUT BUFFER OVERFLOW NB SDU %d current_sdu_index=%d next_sdu_index=%d \n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- data_size,
- l_rlc_p->nb_sdu,
- l_rlc_p->current_sdu_index,
- l_rlc_p->next_sdu_index);
-#endif
- }
-
- RLC_AM_MUTEX_UNLOCK(&l_rlc_p->lock_input_sdus);
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
deleted file mode 100644
index b4073303dd..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am.h
-* \brief This file, and only this file must be included by code that interact with RLC AM layer.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_impl_ RLC AM Layer Reference Implementation
-* @ingroup _rlc_impl_
-* @{
-*/
-
-# ifndef __RLC_AM_H__
-# define __RLC_AM_H__
-# include "platform_types.h"
-# include "rlc_def.h"
-# include "rlc_def_lte.h"
-# include "rlc_am_constants.h"
-# include "rlc_am_structs.h"
-# include "rlc_am_entity.h"
-# include "rlc_am_windows.h"
-# include "mem_block.h"
-# include "rlc_am_in_sdu.h"
-# include "rlc_am_segment.h"
-# include "rlc_am_segments_holes.h"
-# include "rlc_am_timer_poll_retransmit.h"
-# include "rlc_am_timer_reordering.h"
-# include "rlc_am_timer_status_prohibit.h"
-# include "rlc_am_retransmit.h"
-# include "rlc_am_receiver.h"
-# include "rlc_am_status_report.h"
-# include "rlc_am_rx_list.h"
-# include "rlc_am_reassembly.h"
-# include "rlc_am_init.h"
-# include "LTE_RLC-Config.h"
-# include "assertions.h"
-//# include "rlc_am_test.h"
-
-
-#define PROTOCOL_RLC_AM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02ld]"
-#define PROTOCOL_RLC_AM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
- (rLC_Pp->is_data_plane) ? "DRB AM" : "SRB AM",\
- rLC_Pp->rb_id
-
-#define PROTOCOL_RLC_AM_MSC_FMT "[RNTI %" PRIx16 " %s %02ld]"
-#define PROTOCOL_RLC_AM_MSC_ARGS(CTXT_Pp, rLC_Pp) \
- CTXT_Pp->rnti,\
- (rLC_Pp->is_data_plane) ? "DRB AM" : "SRB AM",\
- rLC_Pp->rb_id
-
-
-#if defined(TRACE_RLC_MUTEX)
-#define RLC_AM_MUTEX_LOCK(mUTEX, cTXT, rLC) \
- do {\
- int pmtl_rc = pthread_mutex_trylock(mUTEX);\
- if (pmtl_rc != 0){\
- if (pmtl_rc == EBUSY) {\
- pthread_mutex_lock(mUTEX);\
- }\
- }\
- } while (0);
-#else
-#define RLC_AM_MUTEX_LOCK(mUTEX, cTXT, rLC) pthread_mutex_lock(mUTEX)
-#endif
-
-#define RLC_AM_MUTEX_UNLOCK(mUTEX) pthread_mutex_unlock(mUTEX)
-
-/*! \fn void rlc_am_release (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP)
-* \brief Empty function, TO DO.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_release (
- const protocol_ctxt_t* const ctxtP,
- rlc_am_entity_t * const rlc_pP);
-
-/** @addtogroup _rlc_am_init_impl_
-* @{
-*/
-
-/*! \fn void config_req_rlc_am (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, rlc_am_info_t * config_amP, rb_id_t rb_idP, logical_chan_id_t chan_idP)
-* \brief Configure the UL and DL parameters of the RLC AM
-* \param[in] ctxt_pP Running context.
-* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
-* \param[in] config_amP Configuration parameters for RLC AM instance.
-* \param[in] rb_idP Radio bearer identifier.
-* \param[in] chan_idP Transport channel identifier.
-*/
-void
-config_req_rlc_am (
- const protocol_ctxt_t* const ctxt_pP,
- const srb_flag_t srb_flagP,
- const rlc_am_info_t * config_am_pP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP
-);
-
-/*! \fn void config_req_rlc_am_asn1 (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, logical_chan_id_t chan_idP)
-* \brief Configure the UL and DL parameters of the RLC AM with the asn1c autogenerated pameters structs
-* \param[in] ctxt_pP Running context.
-* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
-* \param[in] config_amP Configuration parameters for RLC AM instance.
-* \param[in] rb_idP Radio bearer identifier.
-* \param[in] chan_idP Transport channel identifier.
-*/
-void config_req_rlc_am_asn1 (
- const protocol_ctxt_t* const ctxtP,
- const srb_flag_t srb_flagP,
- const struct LTE_RLC_Config__am * const config_amP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP);
-
-/** @} */
-
-/*! \fn void rlc_am_stat_req (
- const protocol_ctxt_t* const ctxtP,
- rlc_am_entity_t * const rlc_pP,
- unsigned int* stat_tx_pdcp_sdu,
- unsigned int* stat_tx_pdcp_bytes,
- unsigned int* stat_tx_pdcp_sdu_discarded,
- unsigned int* stat_tx_pdcp_bytes_discarded,
- unsigned int* stat_tx_data_pdu,
- unsigned int* stat_tx_data_bytes,
- unsigned int* stat_tx_retransmit_pdu_by_status,
- unsigned int* stat_tx_retransmit_bytes_by_status,
- unsigned int* stat_tx_retransmit_pdu,
- unsigned int* stat_tx_retransmit_bytes,
- unsigned int* stat_tx_control_pdu,
- unsigned int* stat_tx_control_bytes,
- unsigned int* stat_rx_pdcp_sdu,
- unsigned int* stat_rx_pdcp_bytes,
- unsigned int* stat_rx_data_pdus_duplicate,
- unsigned int* stat_rx_data_bytes_duplicate,
- unsigned int* stat_rx_data_pdu,
- unsigned int* stat_rx_data_bytes,
- unsigned int* stat_rx_data_pdu_dropped,
- unsigned int* stat_rx_data_bytes_dropped,
- unsigned int* stat_rx_data_pdu_out_of_window,
- unsigned int* stat_rx_data_bytes_out_of_window,
- unsigned int* stat_rx_control_pdu,
- unsigned int* stat_rx_control_bytes,
- unsigned int* stat_timer_reordering_timed_out,
- unsigned int* stat_timer_poll_retransmit_timed_out,
- unsigned int* stat_timer_status_prohibit_timed_out)
-* \brief Request TX and RX statistics of a RLC AM protocol instance.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[out] stat_tx_pdcp_sdu Number of SDUs coming from upper layers.
-* \param[out] stat_tx_pdcp_bytes Number of bytes coming from upper layers.
-* \param[out] stat_tx_pdcp_sdu_discarded Number of discarded SDUs coming from upper layers.
-* \param[out] stat_tx_pdcp_bytes_discarded Number of discarded bytes coming from upper layers.
-* \param[out] stat_tx_data_pdu Number of transmitted data PDUs to lower layers.
-* \param[out] stat_tx_data_bytes Number of transmitted data bytes to lower layers.
-* \param[out] stat_tx_retransmit_pdu_by_status Number of re-transmitted data PDUs due to status reception.
-* \param[out] stat_tx_retransmit_bytes_by_status Number of re-transmitted data bytes due to status reception.
-* \param[out] stat_tx_retransmit_pdu Number of re-transmitted data PDUs to lower layers.
-* \param[out] stat_tx_retransmit_bytes Number of re-transmitted data bytes to lower layers.
-* \param[out] stat_tx_control_pdu Number of transmitted control PDUs to lower layers.
-* \param[out] stat_tx_control_bytes Number of transmitted control bytes to lower layers.
-* \param[out] stat_rx_pdcp_sdu Number of SDUs delivered to upper layers.
-* \param[out] stat_rx_pdcp_bytes Number of bytes delivered to upper layers.
-* \param[out] stat_rx_data_pdus_duplicate Number of duplicate PDUs received.
-* \param[out] stat_rx_data_bytes_duplicate Number of duplicate bytes received.
-* \param[out] stat_rx_data_pdu Number of received PDUs from lower layers.
-* \param[out] stat_rx_data_bytes Number of received bytes from lower layers.
-* \param[out] stat_rx_data_pdu_dropped Number of received PDUs from lower layers, then dropped.
-* \param[out] stat_rx_data_bytes_dropped Number of received bytes from lower layers, then dropped.
-* \param[out] stat_rx_data_pdu_out_of_window Number of data PDUs received out of the receive window.
-* \param[out] stat_rx_data_bytes_out_of_window Number of data bytes received out of the receive window.
-* \param[out] stat_rx_control_pdu Number of control PDUs received.
-* \param[out] stat_rx_control_bytes Number of control bytes received.
-* \param[out] stat_timer_reordering_timed_out Number of times the timer "reordering" has timed-out.
-* \param[out] stat_timer_poll_retransmit_timed_out Number of times the timer "poll_retransmit" has timed-out.
-* \param[out] stat_timer_status_prohibit_timed_out Number of times the timer "status_prohibit" has timed-out.
-*/
-void rlc_am_stat_req (
- const protocol_ctxt_t* const ctxtP,
- rlc_am_entity_t * const rlc_pP,
- unsigned int* stat_tx_pdcp_sdu,
- unsigned int* stat_tx_pdcp_bytes,
- unsigned int* stat_tx_pdcp_sdu_discarded,
- unsigned int* stat_tx_pdcp_bytes_discarded,
- unsigned int* stat_tx_data_pdu,
- unsigned int* stat_tx_data_bytes,
- unsigned int* stat_tx_retransmit_pdu_by_status,
- unsigned int* stat_tx_retransmit_bytes_by_status,
- unsigned int* stat_tx_retransmit_pdu,
- unsigned int* stat_tx_retransmit_bytes,
- unsigned int* stat_tx_control_pdu,
- unsigned int* stat_tx_control_bytes,
- unsigned int* stat_rx_pdcp_sdu,
- unsigned int* stat_rx_pdcp_bytes,
- unsigned int* stat_rx_data_pdus_duplicate,
- unsigned int* stat_rx_data_bytes_duplicate,
- unsigned int* stat_rx_data_pdu,
- unsigned int* stat_rx_data_bytes,
- unsigned int* stat_rx_data_pdu_dropped,
- unsigned int* stat_rx_data_bytes_dropped,
- unsigned int* stat_rx_data_pdu_out_of_window,
- unsigned int* stat_rx_data_bytes_out_of_window,
- unsigned int* stat_rx_control_pdu,
- unsigned int* stat_rx_control_bytes,
- unsigned int* stat_timer_reordering_timed_out,
- unsigned int* stat_timer_poll_retransmit_timed_out,
- unsigned int* stat_timer_status_prohibit_timed_out);
-
-/*! \fn void rlc_am_get_pdus (const protocol_ctxt_t* const ctxtP, void * const rlc_pP)
-* \brief Request the segmentation of SDUs based on status previously sent by MAC.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void
-rlc_am_get_pdus (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP
-);
-
-/*! \fn void rlc_am_rx (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind data_indication)
-* \brief Process the received PDUs from lower layer.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] data_indication PDUs from MAC.
-*/
-void rlc_am_rx (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind);
-
-/*! \fn struct mac_status_resp rlc_am_mac_status_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_status_ind tx_statusP,const eNB_flag_t enb_flagP)
-* \brief Request the maximum number of bytes that can be served by RLC instance to MAC and fix the amount of bytes requested by MAC for next RLC transmission.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU.
-* \param[in] enb_flagP eNB or UE flag indication.
-* \return The maximum number of bytes that can be served by RLC instance to MAC.
-*/
-struct mac_status_resp rlc_am_mac_status_indication (const protocol_ctxt_t* const ctxtP, void * const rlc_pP, struct mac_status_ind tx_statusP,const eNB_flag_t enb_flagP);
-
-/*! \fn struct mac_data_req rlc_am_mac_data_request (const protocol_ctxt_t* const ctxtP,void * const rlc_pP,const eNB_flag_t enb_flagP)
-* \brief Gives PDUs to lower layer MAC.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] enb_flagP eNB or UE flag
-* \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission.
-*/
-struct mac_data_req rlc_am_mac_data_request (const protocol_ctxt_t* const ctxtP,void * const rlc_pP,const eNB_flag_t enb_flagP);
-
-/*! \fn void rlc_am_mac_data_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind data_indP)
-* \brief Receive PDUs from lower layer MAC.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] data_indP PDUs from MAC.
-*/
-void rlc_am_mac_data_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind data_indP);
-
-/*! \fn uint32_t rlc_am_get_buffer_occupancy_in_bytes (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP)
-* \brief Get Tx Buffer Occupancy.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-uint32_t rlc_am_get_buffer_occupancy_in_bytes (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP);
-
-/*! \fn void rlc_am_data_req (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, mem_block_t *sduP)
-* \brief Interface with higher layers, buffer higher layer SDUS for transmission.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] sduP SDU. (A struct rlc_am_data_req is mapped on sduP->data.)
-*/
-void rlc_am_data_req (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, mem_block_t *sduP);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_constants.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_constants.h
deleted file mode 100644
index 674b8c244e..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_constants.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_constants.h
-* \brief This file defines constant values used in RLC AM.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/**
-* @addtogroup _rlc_am_internal_impl_
-* @{
-*/
-#ifndef __RLC_AM_CONSTANT_H__
-# define __RLC_AM_CONSTANT_H__
-
-/** The sequence numbering modulo (10 bits). */
-# define RLC_AM_SN_MODULO 1024
-
-/** The sequence numbering binary mask (10 bits). */
-# define RLC_AM_SN_MASK 0x3FF
-
-/** FROM Spec: This constant is used by both the transmitting side and the receiving side of each AM RLC entity to calculate VT(MS) from VT(A), and VR(MR) from VR(R). AM_Window_Size = 512.. */
-# define RLC_AM_WINDOW_SIZE 512
-
-/** Max number of bytes of incoming SDUs from upper layer that can be buffered in a RLC AM protocol instance. */
-# define RLC_AM_SDU_DATA_BUFFER_SIZE 64*1024
-
-/** Max number of incoming SDUs from upper layer that can be buffered in a RLC AM protocol instance. */
-# define RLC_AM_SDU_CONTROL_BUFFER_SIZE 1024
-
-/** Size of the retransmission buffer (number of PDUs). */
-# define RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE RLC_AM_WINDOW_SIZE
-
-/** PDU minimal header size in bytes. */
-# define RLC_AM_HEADER_MIN_SIZE 2
-
-/** PDU Segment minimal header size in bytes = PDU header + SOStart + SOEnd. */
-# define RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE 4
-
-/** If we want to send a segment of a PDU, then the min transport block size requested by MAC should be this amount. */
-# define RLC_AM_MIN_SEGMENT_SIZE_REQUEST 8
-
-/** Max SDUs that can fit in a PDU. */
-# define RLC_AM_MAX_SDU_IN_PDU 128
-
-/** Max fragments for a SDU. */
-# define RLC_AM_MAX_SDU_FRAGMENTS 32
-
-/** Max Negative Acknowledgment SN (NACK_SN) fields in a STATUS PDU. */
-# define RLC_AM_MAX_NACK_IN_STATUS_PDU 1023
-
-/** Max holes created by NACK_SN with segment offsets for a PDU in the retransmission buffer. */
-# define RLC_AM_MAX_HOLES_REPORT_PER_PDU 16
-/** @} */
-
-#define RLC_AM_POLL_PDU_INFINITE 0xFFFF
-#define RLC_AM_POLL_BYTE_INFINITE 0xFFFFFFFF
-
-/* MACRO DEFINITIONS */
-
-#define RLC_AM_NEXT_SN(sn) (((sn)+1) & (RLC_AM_SN_MASK))
-#define RLC_AM_PREV_SN(sn) (((sn)+(RLC_AM_SN_MODULO)-1) & (RLC_AM_SN_MASK))
-
-#define RLC_DIFF_SN(sn,snref,modulus) ((sn+(modulus)-snref) & ((modulus)-1))
-#define RLC_SN_IN_WINDOW(sn,snref,modulus) ((RLC_DIFF_SN(sn,snref,modulus)) < ((modulus) >> 1))
-
-#define RLC_AM_DIFF_SN(sn,snref) (RLC_DIFF_SN(sn,snref,RLC_AM_SN_MODULO))
-#define RLC_AM_SN_IN_WINDOW(sn,snref) (RLC_SN_IN_WINDOW(sn,snref,RLC_AM_SN_MODULO))
-
-#define RLC_SET_BIT(x,offset) ((x) |= (1 << (offset)))
-#define RLC_GET_BIT(x,offset) (((x) & (1 << (offset))) >> (offset))
-#define RLC_CLEAR_BIT(x,offset) ((x) &= ~(1 << (offset)))
-
-#define RLC_SET_EVENT(x,event) ((x) |= (event))
-#define RLC_GET_EVENT(x,event) ((x) & (event))
-#define RLC_CLEAR_EVENT(x,event) ((x) &= (~(event)))
-
-/* Common to Data and Status PDU */
-#define RLC_AM_SN_BITS 10
-#define RLC_AM_PDU_D_C_BITS 1
-#define RLC_AM_PDU_E_BITS 1
-#define RLC_AM_PDU_FI_BITS 2
-#define RLC_AM_PDU_POLL_BITS 1
-#define RLC_AM_PDU_RF_BITS 1
-
-
-#define RLC_AM_LI_BITS 11
-#define RLC_AM_LI_MASK 0x7FF
-
-
-/* AM Data PDU */
-#define RLC_AM_PDU_E_OFFSET 2
-#define RLC_AM_PDU_FI_OFFSET (RLC_AM_PDU_E_OFFSET + RLC_AM_PDU_E_BITS)
-#define RLC_AM_PDU_POLL_OFFSET (RLC_AM_PDU_FI_OFFSET + RLC_AM_PDU_FI_BITS)
-#define RLC_AM_PDU_RF_OFFSET (RLC_AM_PDU_POLL_OFFSET + RLC_AM_PDU_POLL_BITS)
-#define RLC_AM_PDU_D_C_OFFSET (RLC_AM_PDU_RF_OFFSET + RLC_AM_PDU_RF_BITS)
-
-#define RLC_AM_PDU_GET_FI_START(px) (RLC_GET_BIT((px),RLC_AM_PDU_FI_OFFSET + 1))
-#define RLC_AM_PDU_GET_FI_END(px) (RLC_GET_BIT((px),RLC_AM_PDU_FI_OFFSET))
-
-#define RLC_AM_PDU_GET_LI(x,offset) (((x) >> (offset)) & RLC_AM_LI_MASK)
-#define RLC_AM_PDU_SET_LI(x,li,offset) ((x) |= (((li) & RLC_AM_LI_MASK) << (offset)))
-
-#define RLC_AM_PDU_SET_E(px) (RLC_SET_BIT((px),RLC_AM_PDU_E_OFFSET))
-#define RLC_AM_PDU_SET_D_C(px) (RLC_SET_BIT((px),RLC_AM_PDU_D_C_OFFSET))
-#define RLC_AM_PDU_SET_RF(px) (RLC_SET_BIT((px),RLC_AM_PDU_RF_OFFSET))
-#define RLC_AM_PDU_SET_POLL(px) (RLC_SET_BIT((px),RLC_AM_PDU_POLL_OFFSET))
-#define RLC_AM_PDU_CLEAR_POLL(px) (RLC_CLEAR_BIT((px),RLC_AM_PDU_POLL_OFFSET))
-
-#define RLC_AM_PDU_SEGMENT_SO_LENGTH 15
-#define RLC_AM_PDU_SEGMENT_SO_BYTES 2
-#define RLC_AM_PDU_SEGMENT_SO_OFFSET 0
-#define RLC_AM_PDU_LSF_OFFSET (RLC_AM_PDU_SEGMENT_SO_OFFSET + RLC_AM_PDU_SEGMENT_SO_LENGTH)
-
-#define RLC_AM_PDU_SET_LSF(px) (RLC_SET_BIT((px),RLC_AM_PDU_LSF_OFFSET))
-
-#define RLC_AM_HEADER_LI_LENGTH(li) ((li) + ((li)>>1) + ((li)&1))
-#define RLC_AM_PDU_SEGMENT_HEADER_SIZE(numLis) (RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE + RLC_AM_HEADER_LI_LENGTH(numLis))
-
-/* STATUS PDU */
-#define RLC_AM_STATUS_PDU_CPT_STATUS 0
-
-#define RLC_AM_STATUS_PDU_CPT_OFFSET 4
-#define RLC_AM_STATUS_PDU_CPT_LENGTH 3
-
-#define RLC_AM_STATUS_PDU_ACK_SN_OFFSET 2
-
-#define RLC_AM_STATUS_PDU_SO_LENGTH 15
-
-#define RLC_AM_STATUS_PDU_SO_END_ALL_BYTES 0x7FFF
-
-
-/* Uplink STATUS PDU trigger events */
-#define RLC_AM_STATUS_NOT_TRIGGERED 0
-#define RLC_AM_STATUS_TRIGGERED_POLL 0x01 /* Status Report is triggered by a received poll */
-#define RLC_AM_STATUS_TRIGGERED_T_REORDERING 0x02 /* Status Report is triggered by Timer Reordering Expiry */
-#define RLC_AM_STATUS_TRIGGERED_DELAYED 0x10 /* Status is delayed until SN(receivedPoll) < VR(MS) */
-#define RLC_AM_STATUS_PROHIBIT 0x20 /* TimerStatusProhibit still running */
-#define RLC_AM_STATUS_NO_TX_MASK (RLC_AM_STATUS_PROHIBIT | RLC_AM_STATUS_TRIGGERED_DELAYED)
-
-/* Status triggered (bit 5-7) will be concatenated with Poll triggered (bit 0-4) for RLCdec. RLC_AM_STATUS_TRIGGERED_DELAYED is not recorded. */
-#define RLC_AM_SET_STATUS(x,event) (RLC_SET_EVENT(x,event))
-#define RLC_AM_GET_STATUS(x,event) (RLC_GET_EVENT(x,event))
-#define RLC_AM_CLEAR_STATUS(x,event) (RLC_CLEAR_EVENT(x,event))
-#define RLC_AM_CLEAR_ALL_STATUS(x) ((x) = (RLC_AM_STATUS_NOT_TRIGGERED))
-
-
-#endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h
deleted file mode 100644
index e6bcd0f4ba..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_entity.h
-* \brief This file defines the RLC AM variables stored in a struct called rlc_am_entity_t.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note The rlc_am_entity_t structure store protocol variables, statistic variables, allocation variables, buffers and other miscellaneous variables.
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_internal_impl_ RLC AM Layer Internal Reference Implementation
-* @ingroup _rlc_am_impl_
-* @{
-*/
-
-# ifndef __RLC_AM_ENTITY_H__
-# define __RLC_AM_ENTITY_H__
-//-----------------------------------------------------------------------------
-# include
-# include "platform_types.h"
-#include "common/platform_constants.h"
-# include "list.h"
-# include "rlc_primitives.h"
-# include "rlc_def_lte.h"
-# include "rlc_def.h"
-# include "rlc_am_structs.h"
-# include "rlc_am_constants.h"
-//-----------------------------------------------------------------------------
-/*! \struct rlc_am_entity_t
-* \brief Structure containing a RLC AM instance protocol variables, statistic variables, allocation variables, buffers and other miscellaneous variables.
-*/
-typedef struct rlc_am_entity_s {
-
-
- rb_id_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */
- logical_chan_id_t channel_id; /*!< \brief Transport channel identifier. */
- bool is_data_plane; /*!< \brief To know if the RLC belongs to a data radio bearer or a signalling radio bearer, for statistics and trace purpose. */
-
- rlc_buffer_occupancy_t sdu_buffer_occupancy; /*!< \brief Number of bytes of unsegmented SDUs. */
- rlc_buffer_occupancy_t status_buffer_occupancy; /*!< \brief Number of bytes of control PDUs waiting for transmission. */
-
- rlc_am_control_pdu_info_t control_pdu_info;
-
- //---------------------------------------------------------------------
- // TX BUFFERS
- //---------------------------------------------------------------------
- //pthread_spinlock_t lock_input_sdus;
- pthread_mutex_t lock_input_sdus;
- rlc_am_tx_sdu_management_t *input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). */
- signed int nb_sdu; /*!< \brief Total number of valid rlc_am_tx_sdu_management_t in input_sdus[]. */
- signed int nb_sdu_no_segmented; /*!< \brief Total number of SDUs not segmented and partially segmented. nb_sdu_no_segmented = next_sdu_index - current_sdu_index */
- signed int next_sdu_index; /*!< \brief Next SDU index in input_sdus array where for a new incoming SDU. */
- signed int current_sdu_index; /*!< \brief Current SDU index in input_sdus array to be segmented which is not segmented or partially segmented. */
-
-
- rlc_am_tx_data_pdu_management_t *tx_data_pdu_buffer; /*!< \brief Transmission PDU data buffer. Used also for retransmissions */
- signed int retrans_num_pdus; /*!< \brief Number of PDUs in the retransmission buffer. */
- signed int retrans_num_bytes_to_retransmit; /*!< \brief Number of bytes in the retransmission buffer to be retransmitted. Only payload is taken into account */
- bool force_poll; /*!< \brief force poll due to t_poll_retransmit time-out. */
-
- //---------------------------------------------------------------------
- // RX BUFFERS
- //---------------------------------------------------------------------
- list2_t receiver_buffer; /*!< \brief Receiver buffer implemented with a list. */
- mem_block_t *output_sdu_in_construction; /*!< \brief Memory area where a complete SDU is reassemblied before being send to upper layers. */
- sdu_size_t output_sdu_size_to_write; /*!< \brief Size of the reassemblied SDU. */
-
-
- //---------------------------------------------------------------------
- // PROTOCOL VARIABLES
- //---------------------------------------------------------------------
- rlc_protocol_state_t protocol_state; /*!< \brief Protocol state, can be RLC_NULL_STATE, RLC_DATA_TRANSFER_READY_STATE. */
- //-----------------------------
- // TX STATE VARIABLES
- //-----------------------------
- rlc_usn_t
- vt_a; /*!< \brief Acknowledgement state variable. This state variable holds the value of the SN of the next AMD PDU for which a positive acknowledgment is to be received in-sequence, and it serves as the lower edge of the transmitting window. It is initially set to 0, and is updated whenever the AM RLC entity receives a positive acknowledgment for an AMD PDU with SN = VT(A).*/
- rlc_usn_t vt_ms; /*!< \brief Maximum send state variable. This state variable equals VT(A) + AM_Window_Size, and it serves as the higher edge of the transmitting window. */
- rlc_usn_t
- vt_s; /*!< \brief Send state variable. This state variable holds the value of the SN to be assigned for the next newly generated AMD PDU. It is initially set to 0, and is updated whenever the AM RLC entity delivers an AMD PDU with SN = VT(S).*/
- rlc_usn_t
- poll_sn; /*!< \brief Poll send state variable. This state variable holds the value of VT(S)-1 upon the most recent transmission of a RLC data PDU with the poll bit set to “1”. It is initially set to 0.*/
-
- //-----------------------------
- // RX STATE VARIABLES
- //-----------------------------
- rlc_usn_t
- vr_r; /*!< \brief Receive state variable. This state variable holds the value of the SN following the last in-sequence completely received AMD PDU, and it serves as the lower edge of the receiving window. It is initially set to 0, and is updated whenever the AM RLC entity receives an AMD PDU with SN = VR(R). */
- rlc_usn_t
- vr_mr; /*!< \brief Maximum acceptable receive state variable. This state variable equals VR(R) + AM_Window_Size, and it holds the value of the SN of the first AMD PDU that is beyond the receiving window and serves as the higher edge of the receiving window. */
- rlc_usn_t vr_x; /*!< \brief t-Reordering state variable. This state variable holds the value of the SN following the SN of the RLC data PDU which triggered t-Reordering. */
- rlc_usn_t
- vr_ms; /*!< \brief Maximum STATUS transmit state variable. This state variable holds the highest possible value of the SN which can be indicated by “ACK_SN” when a STATUS PDU needs to be constructed. It is initially set to 0. */
- rlc_usn_t
- vr_h; /*!< \brief Highest received state variable. This state variable holds the value of the SN following the SN of the RLC data PDU with the highest SN among received RLC data PDUs. It is initially set to 0. */
-
- //-----------------------------
- // TIMERS CONFIGURED BY RRC
- //-----------------------------
- rlc_am_timer_t t_poll_retransmit; /*!< \brief This timer is used by the transmitting side of an AM RLC entity in order to retransmit a poll. */
- rlc_am_timer_t
- t_reordering; /*!< \brief This timer is used by the receiving side of an AM RLC entity and receiving UM RLC entity in order to detect loss of RLC PDUs at lower layer (see sub clauses 5.1.2.2 and 5.1.3.2). If t-Reordering is running, t-Reordering shall not be started additionally, i.e. only one t-Reordering per RLC entity is running at a given time. */
- rlc_am_timer_t t_status_prohibit; /*!< \brief This timer is used by the receiving side of an AM RLC entity in order to prohibit transmission of a STATUS PDU. */
-
- //-----------------------------
- // COUNTERS
- //-----------------------------
- unsigned int c_pdu_without_poll; /*!< \brief This counter is initially set to 0. It counts the number of AMD PDUs sent since the most recent poll bit was transmitted. */
- unsigned int c_byte_without_poll;/*!< \brief This counter is initially set to 0. It counts the number of data bytes sent since the most recent poll bit was transmitted. */
-
- //-----------------------------
- // PARAMETERS CONFIGURED BY RRC
- //-----------------------------
- uint16_t max_retx_threshold; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to limit the number of retransmissions of an AMD PDU. */
- uint16_t poll_pdu; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to trigger a poll for every pollPDU PDUs. */
- uint32_t poll_byte; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to trigger a poll for every pollByte bytes. */
-
- //---------------------------------------------------------------------
- // STATISTICS
- //---------------------------------------------------------------------
- unsigned int stat_tx_pdcp_sdu; /*!< \brief Number of SDUs received from upper layers. */
- unsigned int stat_tx_pdcp_bytes; /*!< \brief Number of SDU bytes received from upper layers. */
- unsigned int stat_tx_pdcp_sdu_discarded; /*!< \brief Number of SDUs received from upper layers that have been discarded. */
- unsigned int stat_tx_pdcp_bytes_discarded; /*!< \brief Number of SDU bytes received from upper layers that have been discarded. */
-
- unsigned int stat_tx_data_pdu; /*!< \brief For statistic report, number of transmitted PDUs to lower layers. */
- unsigned int stat_tx_data_bytes; /*!< \brief For statistic report, number of transmitted bytes to lower layers. */
- unsigned int stat_tx_retransmit_pdu_by_status; /*!< \brief Not updated. */
- unsigned int stat_tx_retransmit_bytes_by_status; /*!< \brief Not updated. */
- unsigned int stat_tx_retransmit_pdu; /*!< \brief Not updated. */
- unsigned int stat_tx_retransmit_bytes; /*!< \brief Not updated. */
- unsigned int stat_tx_control_pdu; /*!< \brief Not updated. */
- unsigned int stat_tx_control_bytes; /*!< \brief Not updated. */
-
- unsigned int stat_rx_pdcp_sdu; /*!< \brief For statistic report, number of reassemblied SDUs, sent to upper layers. */
- unsigned int stat_rx_pdcp_bytes; /*!< \brief For statistic report, number of reassemblied bytes, sent to upper layers. */
- unsigned int stat_rx_data_pdus_duplicate; /*!< \brief For statistic report, number of received duplicated PDUs from lower layers. */
- unsigned int stat_rx_data_bytes_duplicate; /*!< \brief For statistic report, number of received duplicated bytes from lower layers. */
- unsigned int stat_rx_data_pdu; /*!< \brief For statistic report, number of received PDUs from lower layers. */
- unsigned int stat_rx_data_bytes; /*!< \brief For statistic report, number of received bytes from lower layers. */
- unsigned int stat_rx_data_pdu_dropped; /*!< \brief For statistic report, number of dropped received PDUs from lower layers. Does not include out of window stat. */
- unsigned int stat_rx_data_bytes_dropped; /*!< \brief For statistic report, number of dropped received bytes from lower layers. Does not include out of window stat. */
- unsigned int stat_rx_data_pdu_out_of_window; /*!< \brief Number of data PDUs received out of the receive window. */
- unsigned int stat_rx_data_bytes_out_of_window; /*!< \brief Number of data bytes received out of the receive window. */
- unsigned int stat_rx_control_pdu; /*!< \brief Number of control PDUs received. */
- unsigned int stat_rx_control_bytes; /*!< \brief Number of control bytes received. */
-
- unsigned int stat_timer_reordering_timed_out;
- unsigned int stat_timer_poll_retransmit_timed_out;
- unsigned int stat_timer_status_prohibit_timed_out;
-
- //---------------------------------------------------------------------
- // OUTPUTS
- //---------------------------------------------------------------------
- sdu_size_t nb_bytes_requested_by_mac; /*!< \brief Number of remaining bytes available for transmission of any RLC PDU indicated by lower layer */
- list_t pdus_to_mac_layer; /*!< \brief PDUs buffered for transmission to MAC layer. */
- list_t control_pdu_list; /*!< \brief Control PDUs buffered for transmission to MAC layer. */
- list_t segmentation_pdu_list; /*!< \brief List of "freshly" segmented PDUs. */
-
- uint8_t status_requested; /*!< \brief Status bitmap requested by peer. */
- rlc_sn_t sn_status_triggered_delayed; /*!< \brief SN of the last received poll for which Status is delayed until SN is out of Rx Window. */
- uint32_t last_absolute_subframe_status_indication; /*!< \brief The last absolute subframe number a MAC status indication has been received by RLC. */
- //-----------------------------
- // buffer occupancy measurements sent to MAC
- //-----------------------------
- // note occupancy of other buffers is deducted from nb elements in lists
- rlc_buffer_occupancy_t buffer_occupancy_retransmission_buffer; /*!< \brief Number of PDUs. */
-
- bool initialized; /*!< \brief Boolean for rlc_am_entity_t struct initialization. */
- bool configured; /*!< \brief Boolean for rlc_am_entity_t struct configuration. */
-} rlc_am_entity_t;
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c
deleted file mode 100644
index af2cbb97bd..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/***************************************************************************
- rlc_am_in_sdu.c -
- -------------------
- AUTHOR : Lionel GAUTHIER
- COMPANY : EURECOM
- EMAIL : Lionel.Gauthier@eurecom.fr
- ***************************************************************************/
-#define RLC_AM_MODULE 1
-#define RLC_AM_IN_SDU_C 1
-//-----------------------------------------------------------------------------
-#include "rlc_am.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-
-#define TRACE_RLC_AM_FREE_SDU 0
-//-----------------------------------------------------------------------------
-void rlc_am_free_in_sdu(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlcP,
- const unsigned int index_in_bufferP)
-{
- if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
- /* BugFix: SDU shall have been already freed during initial PDU segmentation or concatenation !! */
-//Assertion(eNB)_PRAN_DesignDocument_annex No.761
- if(rlcP->input_sdus[index_in_bufferP].mem_block != NULL)
- {
- LOG_E(RLC, "RLC AM Tx SDU Conf: Data Part is not empty index=%d LcId=%d\n",
- index_in_bufferP,rlcP->channel_id);
- return;
- }
-/*
- AssertFatal(rlcP->input_sdus[index_in_bufferP].mem_block == NULL, "RLC AM Tx SDU Conf: Data Part is not empty index=%d LcId=%d\n",
- index_in_bufferP,rlcP->channel_id);
-*/
- /*
- if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) {
- free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block, __func__);
- rlcP->input_sdus[index_in_bufferP].mem_block = NULL;
- rlcP->nb_sdu_no_segmented -= 1;
- rlcP->input_sdus[index_in_bufferP].sdu_remaining_size = 0;
- }
- */
-
- rlcP->nb_sdu -= 1;
- memset(&rlcP->input_sdus[index_in_bufferP], 0, sizeof(rlc_am_tx_sdu_management_t));
- rlcP->input_sdus[index_in_bufferP].flags.transmitted_successfully = 1;
-
- // case when either one SDU needs to be removed from segmentation or SDU buffer is full
- if (rlcP->current_sdu_index == index_in_bufferP) {
- rlcP->current_sdu_index = (rlcP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
- }
-
- // wrapping and reset current_sdu_index to next_sdu_index when all transmitted SDUs have been acknowledged
- while ((rlcP->current_sdu_index != rlcP->next_sdu_index) &&
- (rlcP->input_sdus[rlcP->current_sdu_index].flags.transmitted_successfully == 1)) {
- rlcP->current_sdu_index = (rlcP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
- }
- }
-
-#if TRACE_RLC_AM_FREE_SDU
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[FREE SDU] SDU INDEX %03u current_sdu_index=%u next_sdu_index=%u nb_sdu_no_segmented=%u\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlcP),
- index_in_bufferP,
- rlcP->current_sdu_index,
- rlcP->next_sdu_index,
- rlcP->nb_sdu_no_segmented);
-#endif
-}
-// called when segmentation is done
-//-----------------------------------------------------------------------------
-void
-rlc_am_free_in_sdu_data(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlcP,
- const unsigned int index_in_bufferP)
-{
- if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
- if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) {
- free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block, __func__);
- rlcP->input_sdus[index_in_bufferP].mem_block = NULL;
- rlcP->input_sdus[index_in_bufferP].sdu_remaining_size = 0;
- rlcP->nb_sdu_no_segmented -= 1;
- }
- }
-}
-//-----------------------------------------------------------------------------
-signed int
-rlc_am_in_sdu_is_empty(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlcP)
-{
- if (rlcP->nb_sdu == 0) {
- return 1;
- }
-
- return 0;
-}
-
-// called when PDU is ACKED
-//-----------------------------------------------------------------------------
-void
-rlc_am_pdu_sdu_data_cnf(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t snP)
-{
- int pdu_sdu_index;
- int sdu_index;
-
- for (pdu_sdu_index = 0; pdu_sdu_index < rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].nb_sdus; pdu_sdu_index++) {
- sdu_index = rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].sdus_index[pdu_sdu_index];
- //assert(sdu_index >= 0);
- //assert(sdu_index < RLC_AM_SDU_CONTROL_BUFFER_SIZE);
- if(sdu_index < 0 || sdu_index >= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
- LOG_E(RLC, "sdu_index error. sdu_index %d, pdu_sdu_index %d\n", sdu_index, pdu_sdu_index);
- continue;
- }
-
- rlc_pP->input_sdus[sdu_index].nb_pdus_ack += 1;
-
- if ((rlc_pP->input_sdus[sdu_index].nb_pdus_ack == rlc_pP->input_sdus[sdu_index].nb_pdus) &&
- (rlc_pP->input_sdus[sdu_index].sdu_remaining_size == 0)) {
- #if TEST_RLC_AM
- rlc_am_v9_3_0_test_data_conf (
- rlc_pP->module_id,
- rlc_pP->rb_id,
- rlc_pP->input_sdus[sdu_index].mui,
- RLC_SDU_CONFIRM_YES);
- #else
- rlc_data_conf(
- ctxt_pP,
- rlc_pP->rb_id,
- rlc_pP->input_sdus[sdu_index].mui,
- RLC_SDU_CONFIRM_YES,
- rlc_pP->is_data_plane);
- #endif
- rlc_am_free_in_sdu(ctxt_pP, rlc_pP, sdu_index);
- }
- }
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.h
deleted file mode 100644
index bc97490c90..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_in_sdu.h
-* \brief This file defines the prototypes of the utility functions manipulating the incoming SDU buffer.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_internal_input_sdu_impl_ RLC AM Input SDU buffer Internal Reference Implementation
-* @ingroup _rlc_am_internal_impl_
-* @{
-*/
-# ifndef __RLC_AM_IN_SDU_H__
-# define __RLC_AM_IN_SDU_H__
-/*! \fn void rlc_am_free_in_sdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP)
-* \brief Free a higher layer SDU stored in input_sdus[] buffer.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] index_in_bufferP Position index of the SDU.
-* \note Update also the RLC AM instance variables nb_sdu, current_sdu_index, nb_sdu_no_segmented.
-*/
-void rlc_am_free_in_sdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP);
-
-
-/*! \fn void rlc_am_free_in_sdu_data (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP)
-* \brief Free a higher layer SDU data part, the SDU is stored in input_sdus[] buffer.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] index_in_bufferP Position index of the SDU.
-* \note This procedure is called when the SDU segmentation is done for this SDU. Update also the RLC AM instance variable nb_sdu_no_segmented.
-*/
-void rlc_am_free_in_sdu_data (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP);
-
-
-/*! \fn signed int rlc_am_in_sdu_is_empty(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP)
-* \brief Indicates if the input SDU buffer for incoming higher layer SDUs is empty or not.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \return 1 if the buffer is empty, else 0.
-*/
-signed int rlc_am_in_sdu_is_empty(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP);
-
-/*! \fn void rlc_am_pdu_sdu_data_cnf(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* const rlc_pP,const rlc_sn_t snP)
-* \brief Process SDU cnf of a ACKED PDU for all SDUs concatenated in this PDU.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number of the PDU.
-*/
-void rlc_am_pdu_sdu_data_cnf(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* const rlc_pP,const rlc_sn_t snP);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c
deleted file mode 100644
index 8ff29fa44b..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_INIT_C 1
-#include
-//-----------------------------------------------------------------------------
-#include "rlc_am.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-//-----------------------------------------------------------------------------
-void
-rlc_am_init(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP)
-{
- if (rlc_pP->initialized == true) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] INITIALIZATION ALREADY DONE, DOING NOTHING\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- } else {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] INITIALIZATION: STATE VARIABLES, BUFFERS, LISTS\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- memset(rlc_pP, 0, sizeof(rlc_am_entity_t));
-
- list2_init(&rlc_pP->receiver_buffer, "RX BUFFER");
- list_init(&rlc_pP->pdus_to_mac_layer, "PDUS TO MAC");
- list_init(&rlc_pP->control_pdu_list, "CONTROL PDU LIST");
- list_init(&rlc_pP->segmentation_pdu_list, "SEGMENTATION PDU LIST");
- //LOG_D(RLC,"RLC_AM_SDU_CONTROL_BUFFER_SIZE %d sizeof(rlc_am_tx_sdu_management_t) %d \n", RLC_AM_SDU_CONTROL_BUFFER_SIZE, sizeof(rlc_am_tx_sdu_management_t));
-
- pthread_mutex_init(&rlc_pP->lock_input_sdus, NULL);
- rlc_pP->input_sdus = calloc(1, RLC_AM_SDU_CONTROL_BUFFER_SIZE*sizeof(rlc_am_tx_sdu_management_t));
-//#warning "cast the rlc retrans buffer to uint32"
- // rlc_pP->tx_data_pdu_buffer = calloc(1, (uint16_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(rlc_am_tx_data_pdu_management_t)));
- rlc_pP->tx_data_pdu_buffer = calloc(1, (uint32_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(
- rlc_am_tx_data_pdu_management_t)));
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] input_sdus[] = %p element size=%zu\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->input_sdus,
- sizeof(rlc_am_tx_sdu_management_t));
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] tx_data_pdu_buffer[] = %p element size=%zu\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->tx_data_pdu_buffer,
- sizeof(rlc_am_tx_data_pdu_management_t));
-
- // TX state variables
- //rlc_pP->vt_a = 0;
- rlc_pP->vt_ms = rlc_pP->vt_a + RLC_AM_WINDOW_SIZE;
- //rlc_pP->vt_s = 0;
- //rlc_pP->poll_sn = 0;
- // TX counters
- //rlc_pP->c_pdu_without_poll = 0;
- //rlc_pP->c_byte_without_poll = 0;
- // RX state variables
- //rlc_pP->vr_r = 0;
- rlc_pP->vr_mr = rlc_pP->vr_r + RLC_AM_WINDOW_SIZE;
- rlc_pP->vr_x = RLC_SN_UNDEFINED;
- //rlc_pP->vr_ms = 0;
- //rlc_pP->vr_h = 0;
- rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED;
-
- rlc_pP->last_absolute_subframe_status_indication = 0xFFFFFFFF; // any value > 1
-
- rlc_pP->initialized = true;
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_reestablish(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP)
-{
- /*
- * RLC re-establishment is performed upon request by RRC, and the function
- * is applicable for AM, UM and TM RLC entities.
- * When RRC indicates that an RLC entity should be re-established, the RLC entity shall:
- * - if it is an AM RLC entity:
- * - when possible, reassemble RLC SDUs from any byte segments of AMD PDUs with SN < VR(MR) in the
- * receiving side, remove RLC headers when doing so and deliver all reassembled RLC SDUs to upper layer in
- * ascending order of the RLC SN, if not delivered before;
- * - discard the remaining AMD PDUs and byte segments of AMD PDUs in the receiving side;
- * - discard all RLC SDUs and AMD PDUs in the transmitting side;
- * - discard all RLC control PDUs.
- * - stop and reset all timers;
- * - reset all state variables to their initial values.
- */
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM REESTABLISH] RE-INIT STATE VARIABLES, BUFFERS, LISTS\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-
-//#warning TODO when possible reassemble RLC SDUs from any byte segments of AMD PDUs with SN inf VR(MR)
- list2_free(&rlc_pP->receiver_buffer);
-
- list_free(&rlc_pP->pdus_to_mac_layer);
- list_free(&rlc_pP->control_pdu_list);
- list_free(&rlc_pP->segmentation_pdu_list);
-
-
- // TX state variables
- rlc_pP->vt_a = 0;
- rlc_pP->vt_ms = rlc_pP->vt_a + RLC_AM_WINDOW_SIZE;
- rlc_pP->vt_s = 0;
- rlc_pP->poll_sn = 0;
-
- // TX counters
- rlc_pP->c_pdu_without_poll = 0;
- rlc_pP->c_byte_without_poll = 0;
-
- // RX state variables
- rlc_pP->vr_r = 0;
- rlc_pP->vr_mr = rlc_pP->vr_r + RLC_AM_WINDOW_SIZE;
- rlc_pP->vr_x = RLC_SN_UNDEFINED;
- rlc_pP->vr_ms = 0;
- rlc_pP->vr_h = 0;
- rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED;
- rlc_pP->status_requested = RLC_AM_STATUS_NOT_TRIGGERED;
-
- rlc_pP->last_absolute_subframe_status_indication = 0xFFFFFFFF; // any value > 1
-
- rlc_pP->initialized = true;
-
-}
-
-//-----------------------------------------------------------------------------
-void
-rlc_am_cleanup(
- rlc_am_entity_t* const rlc_pP
-)
-{
- list2_free(&rlc_pP->receiver_buffer);
- list_free(&rlc_pP->pdus_to_mac_layer);
- list_free(&rlc_pP->control_pdu_list);
- list_free(&rlc_pP->segmentation_pdu_list);
-
-
- if (rlc_pP->output_sdu_in_construction != NULL) {
- free_mem_block(rlc_pP->output_sdu_in_construction, __func__);
- rlc_pP->output_sdu_in_construction = NULL;
- }
-
- unsigned int i;
-
- if (rlc_pP->input_sdus != NULL) {
- for (i=0; i < RLC_AM_SDU_CONTROL_BUFFER_SIZE; i++) {
- if (rlc_pP->input_sdus[i].mem_block != NULL) {
- free_mem_block(rlc_pP->input_sdus[i].mem_block, __func__);
- rlc_pP->input_sdus[i].mem_block = NULL;
- }
- }
-
- free(rlc_pP->input_sdus);
- rlc_pP->input_sdus = NULL;
- }
-
- pthread_mutex_destroy(&rlc_pP->lock_input_sdus);
-
- if (rlc_pP->tx_data_pdu_buffer != NULL) {
- for (i=0; i < RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE; i++) {
- if (rlc_pP->tx_data_pdu_buffer[i % RLC_AM_WINDOW_SIZE].mem_block != NULL) {
- free_mem_block(rlc_pP->tx_data_pdu_buffer[i % RLC_AM_WINDOW_SIZE].mem_block, __func__);
- rlc_pP->tx_data_pdu_buffer[i % RLC_AM_WINDOW_SIZE].mem_block = NULL;
- }
- }
-
- free(rlc_pP->tx_data_pdu_buffer);
- rlc_pP->tx_data_pdu_buffer = NULL;
- }
-
- memset(rlc_pP, 0, sizeof(rlc_am_entity_t));
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_configure(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- const uint16_t max_retx_thresholdP,
- const uint16_t poll_pduP,
- const uint16_t poll_byteP,
- const uint32_t t_poll_retransmitP,
- const uint32_t t_reorderingP,
- const uint32_t t_status_prohibitP)
-{
- if (rlc_pP->configured == true) {
- LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RECONFIGURE] max_retx_threshold %d poll_pdu %d poll_byte %d t_poll_retransmit %d t_reordering %d t_status_prohibit %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- max_retx_thresholdP,
- poll_pduP,
- poll_byteP,
- t_poll_retransmitP,
- t_reorderingP,
- t_status_prohibitP);
-
- rlc_pP->max_retx_threshold = max_retx_thresholdP;
- rlc_pP->poll_pdu = poll_pduP;
- rlc_pP->poll_byte = poll_byteP;
- rlc_pP->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
- rlc_pP->t_poll_retransmit.ms_duration = t_poll_retransmitP;
- rlc_pP->t_reordering.ms_duration = t_reorderingP;
- rlc_pP->t_status_prohibit.ms_duration = t_status_prohibitP;
-
- } else {
- LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[CONFIGURE] max_retx_threshold %d poll_pdu %d poll_byte %d t_poll_retransmit %d t_reordering %d t_status_prohibit %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- max_retx_thresholdP,
- poll_pduP,
- poll_byteP,
- t_poll_retransmitP,
- t_reorderingP,
- t_status_prohibitP);
-
- rlc_pP->max_retx_threshold = max_retx_thresholdP;
- rlc_pP->poll_pdu = poll_pduP;
- rlc_pP->poll_byte = poll_byteP;
- rlc_pP->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
-
-
- rlc_am_init_timer_poll_retransmit(ctxt_pP, rlc_pP, t_poll_retransmitP);
- rlc_am_init_timer_reordering (ctxt_pP, rlc_pP, t_reorderingP);
- rlc_am_init_timer_status_prohibit(ctxt_pP, rlc_pP, t_status_prohibitP);
-
- rlc_pP->configured = true;
- }
-
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_set_debug_infos(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- const srb_flag_t srb_flagP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP)
-{
- rlc_pP->rb_id = rb_idP;
- rlc_pP->channel_id = chan_idP;
-
- if (srb_flagP) {
- rlc_pP->is_data_plane = 0;
- } else {
- rlc_pP->is_data_plane = 1;
- }
-
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SET DEBUG INFOS]\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h
deleted file mode 100644
index df140f0326..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_init.h
-* \brief This file defines the prototypes of the functions initializing a RLC AM protocol instance.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_init_impl_ RLC AM Init Reference Implementation
-* @ingroup _rlc_am_impl_
-* @{
-*/
-#ifndef __RLC_AM_INIT_H__
-# define __RLC_AM_INIT_H__
-
-# include "UTIL/MEM/mem_block.h"
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-#include "common/platform_constants.h"
-//#include "PHY/defs.h"
-
-
-/*! \struct rlc_am_info_t
-* \brief Structure containing RLC AM configuration parameters.
-*/
-typedef volatile struct {
- uint16_t max_retx_threshold; /*!< \brief Maximum number of retransmissions for one RLC AM PDU. */
- uint16_t poll_pdu; /*!< \brief Generate a status each poll_pdu pdu sent. */
- uint16_t poll_byte; /*!< \brief Generate a status each time poll_byte bytes have been sent. */
- uint32_t t_poll_retransmit; /*!< \brief t-PollRetransmit timer initial value. */
- uint32_t t_reordering; /*!< \brief t-Reordering timer initial value. */
- uint32_t t_status_prohibit; /*!< \brief t-StatusProhibit timer initial value. */
-} rlc_am_info_t;
-
-//-----------------------------------------------------------------------------
-/*! \fn void rlc_am_init (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP)
-* \brief Initialize the RLC AM protocol instance, reset variables, allocate buffers, lists, then, the next step in order have a running RLC AM instance is to configure and set debug informations for this RLC instance.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_init (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t* rlc_pP);
-
-/*! \fn void rlc_am_cleanup(rlc_am_entity_t *const rlc_pP)
-* \brief Free all memory resources allocated and kept by this RLC AM instance.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_cleanup(rlc_am_entity_t* rlc_pP);
-
-/*! \fn void rlc_am_configure(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, uint16_t max_retx_thresholdP, uint16_t poll_pduP, uint16_t poll_byteP, uint32_t t_poll_retransmitP, uint32_t t_reorderingP, uint32_t t_status_prohibitP)
-* \brief Set RLC AM protocol parameters.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] max_retx_thresholdP Limit the number of retransmissions of an
-AMD PDU.
-* \param[in] poll_pduP Trigger a poll for every poll_pduP PDUs.
-* \param[in] poll_byteP Trigger a poll for every pollByte bytes.
-* \param[in] t_poll_retransmitP This timer is used by the transmitting side of an AM RLC entity in order to retransmit a poll, value in frames.
-* \param[in] t_reorderingP This timer is used by the receiving side of an AM RLC entity in order to detect loss of RLC PDUs at lower layer, value in frames.
-* \param[in] t_status_prohibitP This timer is used by the receiving side of an AM RLC entity in order to prohibit transmission of a STATUS PDU, value in frames.
-*/
-void rlc_am_configure(const protocol_ctxt_t* const ctxtP,
- rlc_am_entity_t * const rlc_pP,
- const uint16_t max_retx_thresholdP,
- const uint16_t poll_pduP,
- const uint16_t poll_byteP,
- const uint32_t t_poll_retransmitP,
- const uint32_t t_reorderingP,
- const uint32_t t_status_prohibitP);
-
-
-/*! \fn void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP)
-* \brief Set informations that will be displayed in traces, helping the debug process.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
-* \param[in] rb_idP Radio bearer identifier.
-* \param[in] chan_idP Transport channel identifier.
-*/
-void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const logical_chan_id_t chan_idP);
-/** @} */
-#endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c
deleted file mode 100644
index a5f0b4f9ef..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_REASSEMBLY_C 1
-#include "platform_types.h"
-//-----------------------------------------------------------------------------
-
-#include "assertions.h"
-#include "rlc.h"
-#include "rlc_am.h"
-#include "list.h"
-//#include "LAYER2/MAC/extern.h"
-#include "common/utils/LOG/log.h"
-
-//-----------------------------------------------------------------------------
-inline void
-rlc_am_clear_rx_sdu (
- const protocol_ctxt_t *const ctxt_pP,
- rlc_am_entity_t *const rlc_pP) {
- rlc_pP->output_sdu_size_to_write = 0;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_reassembly (
- const protocol_ctxt_t *const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- uint8_t *src_pP,
- const int32_t lengthP) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PAYLOAD] reassembly() %d bytes\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- lengthP);
-
- if (rlc_pP->output_sdu_in_construction == NULL) {
- rlc_pP->output_sdu_in_construction = get_free_mem_block (RLC_SDU_MAX_SIZE, __func__);
- rlc_pP->output_sdu_size_to_write = 0;
-
- //assert(rlc_pP->output_sdu_in_construction != NULL);
- if(rlc_pP->output_sdu_in_construction == NULL) {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PAYLOAD] output_sdu_in_construction is NULL\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- return;
- }
- }
-
- if (rlc_pP->output_sdu_in_construction != NULL) {
- // check if no overflow in size
- if ((rlc_pP->output_sdu_size_to_write + lengthP) <= RLC_SDU_MAX_SIZE) {
- memcpy (&rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write], src_pP, lengthP);
- rlc_pP->output_sdu_size_to_write += lengthP;
- } else {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PAYLOAD] ERROR SDU SIZE OVERFLOW SDU GARBAGED\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-#if STOP_ON_IP_TRAFFIC_OVERLOAD
- AssertFatal(0, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_IND, SDU SIZE OVERFLOW SDU GARBAGED\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-#endif
- // erase SDU
- rlc_pP->output_sdu_size_to_write = 0;
- }
- } else {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PAYLOAD] ERROR OUTPUT SDU IS NULL\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-#if STOP_ON_IP_TRAFFIC_OVERLOAD
- AssertFatal(0, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_IND, SDU DROPPED, OUT OF MEMORY\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-#endif
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_send_sdu (
- const protocol_ctxt_t *const ctxt_pP,
- rlc_am_entity_t *const rlc_pP) {
- if ((rlc_pP->output_sdu_in_construction)) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND_SDU] %d bytes sdu %p\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->output_sdu_size_to_write,
- rlc_pP->output_sdu_in_construction);
-
- if (rlc_pP->output_sdu_size_to_write > 0) {
- rlc_pP->stat_rx_pdcp_sdu += 1;
- rlc_pP->stat_rx_pdcp_bytes += rlc_pP->output_sdu_size_to_write;
-#if TEST_RLC_AM
- rlc_am_v9_3_0_test_data_ind (rlc_pP->module_id,
- rlc_pP->rb_id,
- rlc_pP->output_sdu_size_to_write,
- rlc_pP->output_sdu_in_construction);
-#else
-
- if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
- char message_string[7000];
- size_t message_string_size = 0;
- int octet_index, index;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", rlc_pP->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "SDU size : %u\n", rlc_pP->output_sdu_size_to_write);
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < rlc_pP->output_sdu_size_to_write; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
- }
-
- /*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size],
- " %02x",
- rlc_pP->output_sdu_in_construction->data[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
-
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
- LOG_T(RLC, "%s", message_string);
- }
-
-#if !ENABLE_ITTI
- RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus);
-#endif
- rlc_data_ind (ctxt_pP,
- BOOL_NOT(rlc_pP->is_data_plane),
- MBMS_FLAG_NO,
- rlc_pP->rb_id,
- rlc_pP->output_sdu_size_to_write,
- rlc_pP->output_sdu_in_construction);
-#if !ENABLE_ITTI
- RLC_AM_MUTEX_LOCK(&rlc_pP->lock_input_sdus, ctxt_pP, rlc_pP);
-#endif
-#endif
- rlc_pP->output_sdu_in_construction = NULL;
- } else {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- //msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlc_pP->module_id);
- //free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
- //Assertion(eNB)_PRAN_DesignDocument_annex No.764
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->output_sdu_size_to_write);
- /*
- AssertFatal(3==4,
- PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->output_sdu_size_to_write);
- */
- }
-
- rlc_pP->output_sdu_size_to_write = 0;
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_am_reassemble_pdu(const protocol_ctxt_t *const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- mem_block_t *const tb_pP,
- bool free_rlc_pdu) {
- int i,j;
- rlc_am_pdu_info_t *pdu_info = &((rlc_am_rx_pdu_management_t *)(tb_pP->data))->pdu_info;
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU SN=%03d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_info->sn);
-
- if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
- rlc_am_display_data_pdu_infos(ctxt_pP, rlc_pP, pdu_info);
- }
-
- if (pdu_info->e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) {
- switch (pdu_info->fi) {
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=11 (00)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- // one complete SDU
- rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary
- rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size);
- rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=10 (01)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- // one beginning segment of SDU in PDU
- rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary
- rlc_am_reassembly (ctxt_pP, rlc_pP,pdu_info->payload, pdu_info->payload_size);
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=01 (10)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- // one last segment of SDU
- //if (rlc_pP->reassembly_missing_sn_detected == 0) {
- rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- //} // else { clear sdu already done
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=00 (11)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- //if (rlc_pP->reassembly_missing_sn_detected == 0) {
- // one whole segment of SDU in PDU
- rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size);
- //} else {
- // rlc_pP->reassembly_missing_sn_detected = 1; // not necessary but for readability of the code
- //}
- break;
-
- default:
- //Assertion(eNB)_PRAN_DesignDocument_annex No.1428
- LOG_E(RLC, "RLC_E_FIXED_PART_DATA_FIELD_FOLLOW error pdu_info->fi[%d]\n", pdu_info->fi);
- // assert(0 != 0);
- }
- } else {
- switch (pdu_info->fi) {
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=11 (00) Li=",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-
- for (i=0; i < pdu_info->num_li; i++) {
- LOG_D(RLC, "%d ",pdu_info->li_list[i]);
- }
-
- LOG_D(RLC, "\n");
- //msg(" remaining size %d\n",size);
- // N complete SDUs
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = 0;
-
- for (i = 0; i < pdu_info->num_li; i++) {
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = j + pdu_info->li_list[i];
- }
-
- if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
- // data is already ok, done by last loop above
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- }
-
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=10 (01) Li=",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-
- for (i=0; i < pdu_info->num_li; i++) {
- LOG_D(RLC, "%d ",pdu_info->li_list[i]);
- }
-
- LOG_D(RLC, "\n");
- //msg(" remaining size %d\n",size);
- // N complete SDUs + one segment of SDU in PDU
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = 0;
-
- for (i = 0; i < pdu_info->num_li; i++) {
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = j + pdu_info->li_list[i];
- }
-
- if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
- // data is already ok, done by last loop above
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
- }
-
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=01 (10) Li=",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-
- for (i=0; i < pdu_info->num_li; i++) {
- LOG_D(RLC, "%d ",pdu_info->li_list[i]);
- }
-
- LOG_D(RLC, "\n");
- //msg(" remaining size %d\n",size);
- // one last segment of SDU + N complete SDUs in PDU
- j = 0;
-
- for (i = 0; i < pdu_info->num_li; i++) {
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = j + pdu_info->li_list[i];
- }
-
- if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
- // data is already ok, done by last loop above
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- }
-
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=00 (11) Li=",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-
- for (i=0; i < pdu_info->num_li; i++) {
- LOG_D(RLC, "%d ",pdu_info->li_list[i]);
- }
-
- LOG_D(RLC, "\n");
- //msg(" remaining size %d\n",size);
- j = 0;
-
- for (i = 0; i < pdu_info->num_li; i++) {
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = j + pdu_info->li_list[i];
- }
-
- if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
- // data is already ok, done by last loop above
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
- }
-
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- default:
- //Assertion(eNB)_PRAN_DesignDocument_annex No.1429
- LOG_E(RLC, "not RLC_E_FIXED_PART_DATA_FIELD_FOLLOW error pdu_info->fi[%d]\n", pdu_info->fi);
- // assert(1 != 1);
- }
- }
-
- if (free_rlc_pdu) {
- free_mem_block(tb_pP, __func__);
- }
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.h
deleted file mode 100644
index 839e7d9304..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_reassembly.h
-* \brief This file defines the prototypes of the functions dealing with the reassembly of segments.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_internal_reassembly_impl_ RLC AM Reassembly Internal Reference Implementation
-* @ingroup _rlc_am_internal_impl_
-* @{
-*/
-#ifndef __RLC_AM_REASSEMBLY_H__
-# define __RLC_AM_REASSEMBLY_H__
-/*! \fn void rlc_am_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP)
-* \brief Reset the data cursor index in the output SDU buffer to zero.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP);
-
-/*! \fn void rlc_am_reassembly (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pPuint8_t * srcP, int32_t lengthP)
-* \brief Concatenate datas at the tail of the output SDU in construction. This SDU in construction will be sent to higher layer.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] srcP Pointer on data to be reassemblied.
-* \param[in] lengthP Length of data to be reassemblied.
-*/
-void rlc_am_reassembly (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, uint8_t * srcP, int32_t lengthP);
-
-/*! \fn void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP)
-* \brief Send the output SDU in construction to higher layer.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP);
-
-/*! \fn void rlc_am_reassemble_pdu(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const mem_block_t* const tb_pP, bool free_rlc_pdu)
-* \brief Reassembly a RLC AM PDU, depending of the content of this PDU, data will be reassemblied to the current output SDU, the current will be sent to higher layers or not, after or before the reassembly, or no send of SDU will be triggered, depending on FI field in PDU header.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] tb_pP RLC AM PDU embedded in a mem_block_t.
-* \param[in] free_rlc_pdu Flag for freeing RLC AM PDU after reassembly.
-*/
-void rlc_am_reassemble_pdu(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, mem_block_t* const tb_pP, bool free_rlc_pdu);
-/** @} */
-#endif
-
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c
deleted file mode 100644
index a749aa035e..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c
+++ /dev/null
@@ -1,533 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_RECEIVER_C 1
-#include "platform_types.h"
-//-----------------------------------------------------------------------------
-#include "assertions.h"
-#include "rlc.h"
-#include "rlc_am.h"
-#include "list.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-
-
-//-----------------------------------------------------------------------------
-signed int
-rlc_am_get_data_pdu_infos(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- rlc_am_pdu_sn_10_t* header_pP,
- int16_t total_sizeP,
- rlc_am_pdu_info_t* pdu_info_pP)
-{
- memset(pdu_info_pP, 0, sizeof (rlc_am_pdu_info_t));
-
- int16_t sum_li = 0;
- pdu_info_pP->d_c = header_pP->b1 >> 7;
- pdu_info_pP->num_li = 0;
-
-//Assertion(eNB)_PRAN_DesignDocument_annex No.766
- if(pdu_info_pP->d_c == 0)
- {
- LOG_E(RLC, "RLC AM Rx PDU Data D/C Header Error LcId=%d\n", rlc_pP->channel_id);
- return -2;
- }
-/*
- AssertFatal (pdu_info_pP->d_c != 0, "RLC AM Rx PDU Data D/C Header Error LcId=%d\n", rlc_pP->channel_id);
-*/
- pdu_info_pP->rf = (header_pP->b1 >> 6) & 0x01;
- pdu_info_pP->p = (header_pP->b1 >> 5) & 0x01;
- pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03;
- pdu_info_pP->e = (header_pP->b1 >> 2) & 0x01;
- pdu_info_pP->sn = header_pP->b2 + (((uint16_t)(header_pP->b1 & 0x03)) << 8);
-
- pdu_info_pP->header_size = 2;
-
- if (pdu_info_pP->rf) {
- pdu_info_pP->lsf = (header_pP->data[0] >> 7) & 0x01;
- pdu_info_pP->so = header_pP->data[1] + (((uint16_t)(header_pP->data[0] & 0x7F)) << 8);
- pdu_info_pP->payload = &header_pP->data[2];
- pdu_info_pP->header_size += 2;
- } else {
- pdu_info_pP->payload = &header_pP->data[0];
- }
-
- if (pdu_info_pP->e) {
- rlc_am_e_li_t *e_li;
- unsigned int li_length_in_bytes = 1;
- unsigned int li_to_read = 1;
-
- if (pdu_info_pP->rf) {
- e_li = (rlc_am_e_li_t*)(&header_pP->data[2]);
- } else {
- e_li = (rlc_am_e_li_t*)(header_pP->data);
- }
-
- while (li_to_read) {
- li_length_in_bytes = li_length_in_bytes ^ 3;
-
- if (li_length_in_bytes == 2) {
- pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li->b1 << 4)) & 0x07F0;
- pdu_info_pP->li_list[pdu_info_pP->num_li] |= (((uint8_t)(e_li->b2 >> 4)) & 0x000F);
- li_to_read = e_li->b1 & 0x80;
- pdu_info_pP->header_size += 2;
- } else {
- pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li->b2 << 8)) & 0x0700;
- pdu_info_pP->li_list[pdu_info_pP->num_li] |= e_li->b3;
- li_to_read = e_li->b2 & 0x08;
- e_li++;
- pdu_info_pP->header_size += 1;
- }
-
- sum_li += pdu_info_pP->li_list[pdu_info_pP->num_li];
- pdu_info_pP->num_li = pdu_info_pP->num_li + 1;
-
- if (pdu_info_pP->num_li > RLC_AM_MAX_SDU_IN_PDU) {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs ",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_info_pP->sn);
- return -2;
- }
- }
-
- if (li_length_in_bytes == 2) {
- pdu_info_pP->payload = &e_li->b3;
- } else {
- pdu_info_pP->payload = &e_li->b1;
- }
- }
-
- pdu_info_pP->payload_size = total_sizeP - pdu_info_pP->header_size;
-
- if (pdu_info_pP->payload_size > sum_li) {
- pdu_info_pP->hidden_size = pdu_info_pP->payload_size - sum_li;
- }
-
- return 0;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_display_data_pdu_infos(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP,
- rlc_am_pdu_info_t* pdu_info_pP)
-{
- int num_li;
-
- if (pdu_info_pP->d_c) {
- if (pdu_info_pP->rf) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d SO %05d LSF %01d POLL %1d ",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_info_pP->sn,
- pdu_info_pP->fi,
- pdu_info_pP->so,
- pdu_info_pP->lsf, pdu_info_pP->p);
- } else {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d POLL %1d ",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_info_pP->sn,
- pdu_info_pP->fi,
- pdu_info_pP->p);
- }
-
- for (num_li = 0; num_li < pdu_info_pP->num_li; num_li++) {
- LOG_D(RLC, "LI %05d ", pdu_info_pP->li_list[num_li]);
- }
-
- if (pdu_info_pP->hidden_size > 0) {
- LOG_D(RLC, "hidden size %05d ", pdu_info_pP->hidden_size);
- }
-
- LOG_D(RLC, "\n");
- } else {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[DISPLAY DATA PDU] ERROR RX CONTROL PDU\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- }
-}
-// assumed the sn of the tb_p is equal to VR(MS)
-//-----------------------------------------------------------------------------
-void
-rlc_am_rx_update_vr_ms(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP,
- mem_block_t* tb_pP)
-{
- //rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
- rlc_am_pdu_info_t* pdu_info_cursor_p = NULL;
- mem_block_t* cursor_p;
-
- cursor_p = tb_pP;
-
- if (cursor_p) {
- do {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
-
- if ((((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received == 0) ||
- (rlc_pP->vr_ms != pdu_info_cursor_p->sn)) {
-
-#if TRACE_RLC_AM_RX
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[UPDATE VR(MS)] UPDATED VR(MS) %04d -> %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->vr_ms, pdu_info_cursor_p->sn);
-#endif
-
- return;
- }
-
- rlc_pP->vr_ms = RLC_AM_NEXT_SN(pdu_info_cursor_p->sn);
- cursor_p = cursor_p->next;
- } while ((cursor_p != NULL) && (rlc_pP->vr_ms != rlc_pP->vr_h));
-
- }
-}
-// assumed the sn of the tb_p is equal to VR(R)
-//-----------------------------------------------------------------------------
-void
-rlc_am_rx_update_vr_r(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP,
- mem_block_t* tb_pP)
-{
- rlc_am_pdu_info_t* pdu_info_cursor_p = NULL;
- mem_block_t* cursor_p;
-
- cursor_p = tb_pP;
-
- if (cursor_p) {
- do {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
-
- if ((((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received == 0) ||
- (rlc_pP->vr_r != pdu_info_cursor_p->sn)) {
- return;
- }
-
-#if TRACE_RLC_AM_RX
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[UPDATE VR(R)] UPDATED VR(R) %04d -> %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->vr_r,
- (pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK);
-#endif
-
- if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.rf == 1) {
- if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.lsf == 1) {
- rlc_pP->vr_r = (rlc_pP->vr_r + 1) & RLC_AM_SN_MASK;
- }
- } else {
- rlc_pP->vr_r = (rlc_pP->vr_r + 1) & RLC_AM_SN_MASK;
- }
-
- cursor_p = cursor_p->next;
- } while (cursor_p != NULL);
-
- //rlc_pP->vr_r = (pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK;
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_receive_routing (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP,
- struct mac_data_ind data_indP)
-{
- mem_block_t *tb_p = NULL;
- uint8_t *first_byte_p = NULL;
- sdu_size_t tb_size_in_bytes;
- RLC_AM_MUTEX_LOCK(&rlc_pP->lock_input_sdus, ctxt_pP, rlc_pP);
-
- while ((tb_p = list_remove_head (&data_indP.data))) {
- first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr;
- tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
-
- if (tb_size_in_bytes > 0) {
- if ((*first_byte_p & 0x80) == 0x80) {
- rlc_pP->stat_rx_data_bytes += tb_size_in_bytes;
- rlc_pP->stat_rx_data_pdu += 1;
- rlc_am_receive_process_data_pdu (ctxt_pP, rlc_pP, tb_p, first_byte_p, tb_size_in_bytes);
- } else {
- rlc_pP->stat_rx_control_bytes += tb_size_in_bytes;
- rlc_pP->stat_rx_control_pdu += 1;
- rlc_am_receive_process_control_pdu (ctxt_pP, rlc_pP, tb_p, &first_byte_p, &tb_size_in_bytes);
- // Test if remaining bytes not processed (up to know, highest probability is bug in MAC)
-//Assertion(eNB)_PRAN_DesignDocument_annex No.767
- if(tb_size_in_bytes != 0)
- {
- LOG_E(RLC, "Remaining %d bytes following a control PDU\n",
- tb_size_in_bytes);
- }
-/*
- AssertFatal( tb_size_in_bytes == 0,
- "Remaining %d bytes following a control PDU",
- tb_size_in_bytes);
-*/
- }
-
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RX ROUTING] VR(R)=%03d VR(MR)=%03d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->vr_r,
- rlc_pP->vr_mr);
- }
- } // end while
- RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus);
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_receive_process_data_pdu (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP,
- mem_block_t* tb_pP,
- uint8_t* first_byte_pP,
- uint16_t tb_size_in_bytesP)
-{
- // 5.1.3.2 Receive operations
- // 5.1.3.2.1 General
- // The receiving side of an AM RLC entity shall maintain a receiving window according to state variables VR(R) and
- // VR(MR) as follows:
- // - a SN falls within the receiving window if VR(R) <= SN < VR(MR);
- // - a SN falls outside of the receiving window otherwise.
- //
- // When receiving a RLC data PDU from lower layer, the receiving side of an AM RLC entity shall:
- // - either discard the received RLC data PDU or place it in the reception buffer (see sub clause 5.1.3.2.2);
- // - if the received RLC data PDU was placed in the reception buffer:
- // - update state variables, reassemble and deliver RLC SDUs to upper layer and start/stop t-Reordering as
- // needed (see sub clause 5.1.3.2.3).
- // When t-Reordering expires, the receiving side of an AM RLC entity shall:
- // - update state variables and start t-Reordering as needed (see sub clause 5.1.3.2.4).
-
-
- // 5.1.3.2.2 Actions when a RLC data PDU is received from lower layer
- // When a RLC data PDU is received from lower layer, where the RLC data PDU contains byte segment numbers y to z of
- // an AMD PDU with SN = x, the receiving side of an AM RLC entity shall:
- // - if x falls outside of the receiving window; or
- // - if byte segment numbers y to z of the AMD PDU with SN = x have been received before:
- // - discard the received RLC data PDU;
- // - else:
- // - place the received RLC data PDU in the reception buffer;
- // - if some byte segments of the AMD PDU contained in the RLC data PDU have been received before:
- // - discard the duplicate byte segments.
- rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
- rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)first_byte_pP;
- rlc_am_rx_pdu_status_t pdu_status = RLC_AM_DATA_PDU_STATUS_OK;
- bool reassemble = false;
-
- if (rlc_am_get_data_pdu_infos(ctxt_pP,rlc_pP, rlc_am_pdu_sn_10_p, tb_size_in_bytesP, pdu_info_p) >= 0) {
-
- ((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received = 0;
-
- if (RLC_AM_SN_IN_WINDOW(pdu_info_p->sn, rlc_pP->vr_r)) {
-
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SN=%04d] VR(R) %04d VR(H) %04d VR(MR) %04d VR(MS) %04d VR(X) %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_info_p->sn,
- rlc_pP->vr_r,
- rlc_pP->vr_h,
- rlc_pP->vr_mr,
- rlc_pP->vr_ms,
- rlc_pP->vr_x);
-
- pdu_status = rlc_am_rx_list_check_duplicate_insert_pdu(ctxt_pP, rlc_pP,tb_pP);
- if (pdu_status != RLC_AM_DATA_PDU_STATUS_OK) {
- rlc_pP->stat_rx_data_pdu_dropped += 1;
- rlc_pP->stat_rx_data_bytes_dropped += tb_size_in_bytesP;
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU DISCARDED CAUSE=%d SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_status,pdu_info_p->sn);
-#if RLC_STOP_ON_LOST_PDU
- AssertFatal( 0 == 1,
- PROTOCOL_RLC_AM_CTXT_FMT" LOST PDU DETECTED\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-#endif
- } else {
- // 5.1.3.2.3
- // Actions when a RLC data PDU is placed in the reception buffer
- //
- // When a RLC data PDU with SN = x is placed in the reception buffer, the receiving side of an AM RLC entity shall:
- // - if x >= VR(H)
- // - update VR(H) to x+ 1;
- //
- // - if all byte segments of the AMD PDU with SN = VR(MS) are received:
- // - update VR(MS) to the SN of the first AMD PDU with SN > current VR(MS) for which not all byte segments
- // have been received;
- //
- // - if x = VR(R):
- // - if all byte segments of the AMD PDU with SN = VR(R) are received:
- // - update VR(R) to the SN of the first AMD PDU with SN > current VR(R) for which not all byte segments
- // have been received;
- // - update VR(MR) to the updated VR(R) + AM_Window_Size;
- //
- // - reassemble RLC SDUs from any byte segments of AMD PDUs with SN that falls outside of the receiving
- // window and in-sequence byte segments of the AMD PDU with SN = VR(R), remove RLC headers when
- // doing so and deliver the reassembled RLC SDUs to upper layer in sequence if not delivered before;
- //
- // - if t-Reordering is running:
- // - if VR(X) = VR(R); or
- // - if VR(X) falls outside of the receiving window and VR(X) is not equal to VR(MR):
- // - stop and reset t-Reordering;
- //
- // - if t-Reordering is not running (includes the case t-Reordering is stopped due to actions above):
- // - if VR (H) > VR(R):
- // - start t-Reordering;
- // - set VR(X) to VR(H).
-
-
-#if TRACE_RLC_AM_RX
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] RX LIST AFTER INSERTION:\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- rlc_am_rx_list_display(rlc_pP, "rlc_am_receive_process_data_pdu AFTER INSERTION ");
-#endif
-
- /* 1) Update vrH if sn >= vrH */
- if (RLC_AM_DIFF_SN(pdu_info_p->sn,rlc_pP->vr_r) >= RLC_AM_DIFF_SN(rlc_pP->vr_h,rlc_pP->vr_r))
- {
- rlc_pP->vr_h = RLC_AM_NEXT_SN(pdu_info_p->sn);
- }
-
- rlc_am_rx_check_all_byte_segments(ctxt_pP, rlc_pP, tb_pP);
-
- /* 2) Reordering Window Processing: Update vr_ms if sn = vr_ms and all bytes received for sn */
- if ((pdu_info_p->sn == rlc_pP->vr_ms) && (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received)) {
- rlc_am_rx_update_vr_ms(ctxt_pP, rlc_pP, tb_pP);
- }
-
- if (pdu_info_p->sn == rlc_pP->vr_r) {
-mem_block_t* cursor_p = rlc_pP->receiver_buffer.head;
-rlc_am_rx_pdu_management_t * pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
-if( (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received) == (pdu_cursor_mgnt_p->all_segments_received)){
- if (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received) {
- rlc_am_rx_update_vr_r(ctxt_pP, rlc_pP, tb_pP);
- rlc_pP->vr_mr = (rlc_pP->vr_r + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
- }
- reassemble = rlc_am_rx_check_vr_reassemble(ctxt_pP, rlc_pP);
- //TODO : optimization : check whether a reassembly is needed by looking at LI, FI, SO, etc...
-}else{
- LOG_E(RLC, "BAD all_segments_received!!! discard buffer!!!\n");
- /* Discard received block if out of window, duplicate or header error */
- free_mem_block (tb_pP, __func__);
-}
- }
-
- //FNA: fix check VrX out of receiving window
- if ((rlc_pP->t_reordering.running) || ((rlc_pP->t_reordering.ms_duration == 0) && (rlc_pP->vr_x != RLC_SN_UNDEFINED))) {
- if ((rlc_pP->vr_x == rlc_pP->vr_r) || (!(RLC_AM_SN_IN_WINDOW(rlc_pP->vr_x, rlc_pP->vr_r)) && (rlc_pP->vr_x != rlc_pP->vr_mr))) {
- rlc_am_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP);
- rlc_pP->vr_x = RLC_SN_UNDEFINED;
- }
- }
-
- if (!(rlc_pP->t_reordering.running)) {
- if (rlc_pP->vr_h != rlc_pP->vr_r) { // - if VR (H) > VR(R) translated to - if VR (H) != VR(R)
- rlc_pP->vr_x = rlc_pP->vr_h;
- if (rlc_pP->t_reordering.ms_duration != 0) {
- rlc_am_start_timer_reordering(ctxt_pP, rlc_pP);
- }
- else {
- /* specific case for no timer reordering configured */
- /* reordering window directly advances with vrH */
- rlc_pP->vr_ms = rlc_pP->vr_h;
-
- /* Trigger a Status and clear any existing Delay Flag */
- RLC_AM_SET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_T_REORDERING);
- RLC_AM_CLEAR_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED);
- rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED;
- }
- }
- }
- }
-
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SN=%04d] NEW VR(R) %04d VR(H) %04d VR(MS) %04d VR(MR) %04d VR(X) %04d reassemble=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_info_p->sn,
- rlc_pP->vr_r,
- rlc_pP->vr_h,
- rlc_pP->vr_ms,
- rlc_pP->vr_mr,
- rlc_pP->vr_x,
- reassemble);
- } else {
- rlc_pP->stat_rx_data_pdu_out_of_window += 1;
- rlc_pP->stat_rx_data_bytes_out_of_window += tb_size_in_bytesP;
- pdu_status = RLC_AM_DATA_PDU_STATUS_SN_OUTSIDE_WINDOW;
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU OUT OF RX WINDOW, DISCARDED, SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_info_p->sn);
- }
-
- /* 3) Check for triggering a Tx Status PDU if a poll is received or if a pending status was delayed */
- if ((pdu_info_p->p) && (pdu_status < RLC_AM_DATA_PDU_STATUS_BUFFER_FULL)) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] POLL BIT SET, STATUS REQUESTED:\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-
- /* Polling Info Saving for In and Out of Window PDU */
- /* avoid multi status trigger */
- if ((RLC_AM_GET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED)) ||
- !(RLC_AM_GET_STATUS(rlc_pP->status_requested,(RLC_AM_STATUS_TRIGGERED_POLL | RLC_AM_STATUS_TRIGGERED_T_REORDERING))))
- {
- RLC_AM_SET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_POLL);
-
- if ((pdu_status != RLC_AM_DATA_PDU_STATUS_OK) || ((pdu_status == RLC_AM_DATA_PDU_STATUS_OK) &&
- (!(RLC_AM_SN_IN_WINDOW(pdu_info_p->sn,rlc_pP->vr_r)) ||
- (RLC_AM_DIFF_SN(pdu_info_p->sn,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r)))
- )
- )
- {
- /* Conditions are met for sending a Status Report */
- /* Then clear Delay Flag and reset its corresponding sn */
- RLC_AM_CLEAR_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED);
- rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED;
- }
- else if (rlc_pP->sn_status_triggered_delayed == RLC_SN_UNDEFINED)
- {
- /* Delay status trigger if pdustatus OK and sn>= vr_ms */
- /* Note: vr_r and vr_ms have been updated */
- RLC_AM_SET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED);
- rlc_pP->sn_status_triggered_delayed = pdu_info_p->sn;
- }
- }
- }
-
- /* ReEnable a previously delayed Status Trigger if PDU discarded or */
- /* sn no more in RxWindow due to RxWindow advance or sn < vr_ms */
- if ((RLC_AM_GET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED)) &&
- (pdu_status == RLC_AM_DATA_PDU_STATUS_OK) &&
- (!(RLC_AM_SN_IN_WINDOW(rlc_pP->sn_status_triggered_delayed,rlc_pP->vr_r)) ||
- (RLC_AM_DIFF_SN(rlc_pP->sn_status_triggered_delayed,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r)))
- )
- {
- RLC_AM_CLEAR_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED);
- rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED;
- }
-
-
- } else {
- pdu_status = RLC_AM_DATA_PDU_STATUS_HEADER_ERROR;
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU DISCARDED BAD HEADER FORMAT SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_info_p->sn);
- }
-
- if (pdu_status != RLC_AM_DATA_PDU_STATUS_OK) {
- /* Discard received block if out of window, duplicate or header error */
- free_mem_block (tb_pP, __func__);
- }
- else if (reassemble) {
- /* Reassemble SDUs */
- rlc_am_rx_list_reassemble_rlc_sdus(ctxt_pP, rlc_pP);
- }
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.h
deleted file mode 100644
index fdbd95873d..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_receiver.h
-* \brief This file defines the prototypes of the functions dealing with the first stage of the receiving process.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_internal_receiver_impl_ RLC AM Receiver Internal Reference Implementation
-* @ingroup _rlc_am_internal_impl_
-* @{
-*/
-# ifndef __RLC_AM_RECEIVER_H__
-# define __RLC_AM_RECEIVER_H__
-/*! \fn signed int rlc_am_get_data_pdu_infos( const protocol_ctxt_t* const ctxt_pP, const rlc_am_entity_t * const rlc_pP,rlc_am_pdu_sn_10_t* headerP, int16_t sizeP, rlc_am_pdu_info_t* pdu_infoP)
-* \brief Extract PDU informations (header fields, data size, etc) from the serialized PDU.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] headerP RLC AM header PDU pointer.
-* \param[in] sizeP Size of RLC AM PDU.
-* \param[in] pdu_infoP Structure containing extracted informations from PDU.
-* \return 0 if no error was encountered during the parsing of the PDU, else -1;
-*/
-signed int rlc_am_get_data_pdu_infos(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t * const rlc_pP,
- rlc_am_pdu_sn_10_t* headerP,
- int16_t sizeP,
- rlc_am_pdu_info_t* pdu_infoP);
-
-/*! \fn void rlc_am_display_data_pdu_infos(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, rlc_am_pdu_info_t* pdu_infoP)
-* \brief Display RLC AM PDU informations.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] pdu_infoP Structure containing extracted informations of a PDU.
-*/
-void rlc_am_display_data_pdu_infos(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t * const rlc_pP, rlc_am_pdu_info_t* pdu_infoP);
-
-/*! \fn void rlc_am_rx_update_vr_ms(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t * const rlc_pP,mem_block_t* tb_pP)
-* \brief Update RLC AM protocol variable VR(MS).
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] tb_pP PDU embedded in a mem_block_t struct.
-* \note It is assumed that the sequence number of the transport block is equal to VR(MS)
-*/
-void rlc_am_rx_update_vr_ms(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP);
-
-/*! \fn void rlc_am_rx_update_vr_r (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP,mem_block_t* tb_pP)
-* \brief Update RLC AM protocol variable VR(R).
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] tb_pP PDU embedded in a mem_block_t struct.
-* \note It is assumed that the sequence number of the transport block is equal to VR(R)
-*/
-void rlc_am_rx_update_vr_r (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP);
-
-/*! \fn void rlc_am_receive_routing (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, struct mac_data_ind data_indP)
-* \brief Convert transport blocks received from MAC layer into RLC AM PDUs, and dispatch to the right processing block these PDUS upon their type (CONTROL/DATA).
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] data_indP Transport blocks received from MAC layer.
-*/
-void rlc_am_receive_routing (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, struct mac_data_ind data_indP);
-
-/*! \fn void rlc_am_receive_process_data_pdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP, uint8_t* first_byteP, uint16_t tb_size_in_bytesP)
-* \brief Process an incoming data PDU received from MAC layer.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] tb_pP PDU embedded in a mem_block_t struct.
-* \param[in] first_byteP Pointer on first byte of the PDU.
-* \param[in] tb_size_in_bytesP Transport block size in bytes (same as PDU size in bytes).
-*/
-void rlc_am_receive_process_data_pdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP, uint8_t* first_byteP,
- uint16_t tb_size_in_bytesP);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c
deleted file mode 100644
index 7129307739..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c
+++ /dev/null
@@ -1,977 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_RETRANSMIT_C 1
-//-----------------------------------------------------------------------------
-//#include "rtos_header.h"
-//-----------------------------------------------------------------------------
-#include "rlc_am.h"
-#include "rlc.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-//-----------------------------------------------------------------------------
-bool rlc_am_nack_pdu(const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- const rlc_sn_t snP,
- const rlc_sn_t prev_nack_snP,
- sdu_size_t so_startP,
- sdu_size_t so_endP)
-{
- // 5.2.1 Retransmission
- // ...
- // When an AMD PDU or a portion of an AMD PDU is considered for retransmission, the transmitting side of the AM
- // RLC entity shall:
- // - if the AMD PDU is considered for retransmission for the first time:
- // - set the RETX_COUNT associated with the AMD PDU to zero;
- // - else, if it (the AMD PDU or the portion of the AMD PDU that is considered for retransmission) is not pending
- // for retransmission already, or a portion of it is not pending for retransmission already:
- // - increment the RETX_COUNT;
- // - if RETX_COUNT = maxRetxThreshold:
- // - indicate to upper layers that max retransmission has been reached.
-
-
- mem_block_t* mb_p = rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].mem_block;
- rlc_am_tx_data_pdu_management_t *tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE];
- //int pdu_sdu_index;
- //int sdu_index;
- bool status = true;
- bool retx_count_increment = false;
- sdu_size_t pdu_data_to_retx = 0;
-
- if (mb_p != NULL) {
- //assert(so_startP <= so_endP);
- if(so_startP > so_endP) {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] ERROR NACK MISSING PDU, so_startP %d, so_endP %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),so_startP, so_endP);
- status = false;
- }
- // Handle full PDU NACK first
- else if ((so_startP == 0) && (so_endP == 0x7FFF)) {
- if ((prev_nack_snP != snP) && (tx_data_pdu_buffer_p->flags.ack == 0) && (tx_data_pdu_buffer_p->flags.max_retransmit == 0)) {
- pdu_data_to_retx = tx_data_pdu_buffer_p->payload_size;
- /* Increment VtReTxNext if this is the first NACK or if some segments have already been transmitted */
- if ((tx_data_pdu_buffer_p->flags.retransmit == 0) || (tx_data_pdu_buffer_p->nack_so_start))
- retx_count_increment = true;
-
- tx_data_pdu_buffer_p->nack_so_start = 0;
- tx_data_pdu_buffer_p->num_holes = 0;
- tx_data_pdu_buffer_p->retx_hole_index = 0;
- tx_data_pdu_buffer_p->nack_so_stop = tx_data_pdu_buffer_p->payload_size - 1;
- #if TRACE_RLC_AM_HOLE
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] SN %04d GLOBAL NACK 0->%05d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- snP,
- so_stopP);
- #endif
- //assert(tx_data_pdu_buffer_p->nack_so_start < tx_data_pdu_buffer_p->payload_size);
- if(tx_data_pdu_buffer_p->nack_so_start >= tx_data_pdu_buffer_p->payload_size){
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] ERROR NACK MISSING PDU, nack_so_start %d, payload_size %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),tx_data_pdu_buffer_p->nack_so_start, tx_data_pdu_buffer_p->payload_size);
- status = false;
- }
- }
- else {
- status = false;
- }
- }
- else if (tx_data_pdu_buffer_p->flags.max_retransmit == 0) {
- // Handle Segment offset
- if (so_endP == 0x7FFF) {
- so_endP = tx_data_pdu_buffer_p->payload_size - 1;
- }
-
- // Check consistency
- if ((so_startP <= so_endP) && (so_endP < tx_data_pdu_buffer_p->payload_size)) {
- if (prev_nack_snP != snP) {
- /* New NACK_SN with SO */
- /* check whether a new segment is to be placed in Retransmission Buffer, then increment vrReTx */
- if ((tx_data_pdu_buffer_p->flags.retransmit == 0) || (so_startP < tx_data_pdu_buffer_p->nack_so_start))
- retx_count_increment = true;
-
- tx_data_pdu_buffer_p->num_holes = 1;
- tx_data_pdu_buffer_p->retx_hole_index = 0;
- tx_data_pdu_buffer_p->hole_so_start[0] = so_startP;
- tx_data_pdu_buffer_p->hole_so_stop[0] = so_endP;
- tx_data_pdu_buffer_p->nack_so_start = so_startP;
- tx_data_pdu_buffer_p->nack_so_stop = so_endP;
- pdu_data_to_retx = so_endP - so_startP + 1;
-
- }
- else if ((tx_data_pdu_buffer_p->num_holes) && (tx_data_pdu_buffer_p->num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU)) {
- /* New SOStart/SOEnd for the same NACK_SN than before */
- /* check discontinuity */
- if (so_startP > tx_data_pdu_buffer_p->hole_so_stop[tx_data_pdu_buffer_p->num_holes - 1]) {
- tx_data_pdu_buffer_p->hole_so_start[tx_data_pdu_buffer_p->num_holes] = so_startP;
- tx_data_pdu_buffer_p->hole_so_stop[tx_data_pdu_buffer_p->num_holes] = so_endP;
- tx_data_pdu_buffer_p->nack_so_stop = so_endP;
- tx_data_pdu_buffer_p->num_holes ++;
- pdu_data_to_retx = so_endP - so_startP + 1;
- } else {
- status = false;
- }
- } else {
- status = false;
- }
- }
- else {
- status = false;
- }
- } else {
- status = false;
- }
-
- if (status) {
- tx_data_pdu_buffer_p->flags.nack = 1;
- if ((retx_count_increment) && (tx_data_pdu_buffer_p->retx_count == tx_data_pdu_buffer_p->retx_count_next)) {
- tx_data_pdu_buffer_p->retx_count_next ++;
- }
- if (tx_data_pdu_buffer_p->flags.retransmit == 1) {
- if (prev_nack_snP != snP) {
- /* if first process of this NACK_SN and data already pending for retx */
- rlc_pP->retrans_num_bytes_to_retransmit += (pdu_data_to_retx - tx_data_pdu_buffer_p->retx_payload_size);
- tx_data_pdu_buffer_p->retx_payload_size = pdu_data_to_retx;
- }
- else if (tx_data_pdu_buffer_p->num_holes > 1) {
- /* Segment case : SOStart and SOEnd already received for same NACK_SN */
- /* filter case where a NACK_SN is received twice with SO first time and no SO second time */
- rlc_pP->retrans_num_bytes_to_retransmit += pdu_data_to_retx;
- tx_data_pdu_buffer_p->retx_payload_size += pdu_data_to_retx;
- }
- }
- else {
- tx_data_pdu_buffer_p->flags.retransmit = 1;
- rlc_pP->retrans_num_bytes_to_retransmit += pdu_data_to_retx;
- tx_data_pdu_buffer_p->retx_payload_size = pdu_data_to_retx;
- rlc_pP->retrans_num_pdus ++;
- }
- }
- } else {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] ERROR NACK MISSING PDU SN %05d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- snP);
- status = false;
- }
-
- return status;
-}
-//-----------------------------------------------------------------------------
-void rlc_am_ack_pdu(const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- const rlc_sn_t snP,
- bool free_pdu)
-{
- mem_block_t* mb_p = rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].mem_block;
- rlc_am_tx_data_pdu_management_t *tx_data_pdu_buffer = &rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE];
-
- tx_data_pdu_buffer->flags.retransmit = 0;
-
- if (mb_p != NULL) {
- if (free_pdu) {
- free_mem_block(mb_p, __func__);
- tx_data_pdu_buffer->mem_block = NULL;
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] ACK PDU SN %05d previous retx_count %d \n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- snP,
- tx_data_pdu_buffer->retx_count);
- }
-
- if (tx_data_pdu_buffer->retx_payload_size) {
-//Assertion(eNB)_PRAN_DesignDocument_annex No.768
- if(tx_data_pdu_buffer->flags.ack != 0)
- {
- LOG_E(RLC, "RLC AM Rx Status Report sn=%d acked twice but is pending for Retx vtA=%d vtS=%d LcId=%d\n",
- snP, rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- return;
- }
-/*
- AssertFatal (tx_data_pdu_buffer->flags.ack == 0,
- "RLC AM Rx Status Report sn=%d acked twice but is pending for Retx vtA=%d vtS=%d LcId=%d\n",
- snP, rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
-*/
- rlc_pP->retrans_num_bytes_to_retransmit -= tx_data_pdu_buffer->retx_payload_size;
- tx_data_pdu_buffer->retx_payload_size = 0;
- tx_data_pdu_buffer->num_holes = 0;
- rlc_pP->retrans_num_pdus --;
- }
-
- } else {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] WARNING ACK PDU SN %05d -> NO PDU TO ACK\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- snP);
-
- if (mb_p != NULL) {
- free_mem_block(mb_p, __func__);
- tx_data_pdu_buffer->mem_block = NULL;
- }
- }
- tx_data_pdu_buffer->flags.ack = 1;
- tx_data_pdu_buffer->flags.transmitted = 0;
- tx_data_pdu_buffer->flags.retransmit = 0;
-
-}
-//-----------------------------------------------------------------------------
-mem_block_t* rlc_am_retransmit_get_copy (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- const rlc_sn_t snP)
-{
- mem_block_t* mb_original_p = rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].mem_block;
-//Assertion(eNB)_PRAN_DesignDocument_annex No.784
- if(mb_original_p == NULL)
- {
- LOG_E(RLC,"RLC AM PDU Copy Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
- snP,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- return NULL;
- }
-/*
- AssertFatal (mb_original_p != NULL, "RLC AM PDU Copy Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
- snP,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
-*/
- rlc_am_tx_data_pdu_management_t *pdu_mngt = &rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE];
-
- /* We need to allocate a new buffer and copy to it because header content may change for Polling bit */
- int size = pdu_mngt->header_and_payload_size + sizeof(struct mac_tb_req);
- mem_block_t* mb_copy = get_free_mem_block(size, __func__);
- if(mb_copy == NULL) return NULL;
- memcpy(mb_copy->data, mb_original_p->data, size);
-
- rlc_am_pdu_sn_10_t *pdu_p = (rlc_am_pdu_sn_10_t*) (&mb_copy->data[sizeof(struct mac_tb_req)]);
- ((struct mac_tb_req*)(mb_copy->data))->data_ptr = (uint8_t*)pdu_p;
-
- return mb_copy;
-}
-
-//-----------------------------------------------------------------------------
-mem_block_t* rlc_am_retransmit_get_am_segment(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- rlc_am_tx_data_pdu_management_t *const pdu_mngt,
- sdu_size_t * const payload_sizeP /* in-out*/)
-{
- int16_t sdus_segment_size[RLC_AM_MAX_SDU_IN_PDU];
- mem_block_t* mb_original_p = pdu_mngt->mem_block;
- mem_block_t* mem_pdu_segment_p = NULL;
- uint8_t *pdu_original_header_p = NULL;
- uint8_t *pdu_segment_header_p = NULL;
- sdu_size_t retx_so_start,retx_so_stop; //starting and ending SO for retransmission in this PDU
- rlc_sn_t sn = pdu_mngt->sn;
- uint16_t header_so_part;
- bool fi_start, fi_end;
- uint8_t sdu_index = 0;
- uint8_t sdu_segment_index = 0;
- uint8_t num_LIs_pdu_segment = pdu_mngt->nb_sdus - 1;
- uint8_t li_bit_offset = 4; /* toggle between 0 and 4 */
- uint8_t li_jump_offset = 1; /* toggle between 1 and 2 */
-
-//Assertion(eNB)_PRAN_DesignDocument_annex No.774
- if(mb_original_p == NULL)
- {
- LOG_E(RLC,"RLC AM PDU Segment Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
- sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- return NULL;
- }
-/*
- AssertFatal (mb_original_p != NULL, "RLC AM PDU Segment Error: Empty block sn=%d vtA=%d vtS=%d LcId=%d !\n",
- sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
-*/
-//Assertion(eNB)_PRAN_DesignDocument_annex No.775
- if(pdu_mngt->payload != mb_original_p->data + sizeof(struct mac_tb_req) + pdu_mngt->header_and_payload_size - pdu_mngt->payload_size)
- {
- LOG_E(RLC,"RLC AM PDU Segment Error: Inconsistent data pointers p1=%p p2=%p sn = %d total size = %d data size = %d LcId=%d !\n",
- pdu_mngt->payload,mb_original_p->data + sizeof(struct mac_tb_req),pdu_mngt->header_and_payload_size,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
- return NULL;
- }
-/*
- AssertFatal (pdu_mngt->payload == mb_original_p->data + sizeof(struct mac_tb_req) + pdu_mngt->header_and_payload_size - pdu_mngt->payload_size,
- "RLC AM PDU Segment Error: Inconsistent data pointers p1=%p p2=%p sn = %d total size = %d data size = %d LcId=%d !\n",
- pdu_mngt->payload,mb_original_p->data + sizeof(struct mac_tb_req),pdu_mngt->header_and_payload_size,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
-*/
- /* Init ReTx Hole list if not configured, ie the whole PDU has to be retransmitted */
- if (pdu_mngt->num_holes == 0)
- {
-//Assertion(eNB)_PRAN_DesignDocument_annex No.776
- if(pdu_mngt->retx_payload_size != pdu_mngt->payload_size)
- {
- LOG_E(RLC,"RLC AM PDU ReTx Segment: Expecting full PDU size ReTxSize=%d DataSize=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
- pdu_mngt->retx_payload_size,pdu_mngt->payload_size,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- return NULL;
- }
-/*
- AssertFatal (pdu_mngt->retx_payload_size == pdu_mngt->payload_size,"RLC AM PDU ReTx Segment: Expecting full PDU size ReTxSize=%d DataSize=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
- pdu_mngt->retx_payload_size,pdu_mngt->payload_size,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
-*/
- pdu_mngt->retx_hole_index = 0;
- pdu_mngt->hole_so_start[0] = 0;
- pdu_mngt->hole_so_stop[0] = pdu_mngt->payload_size - 1;
- pdu_mngt->num_holes = 1;
- }
-
- /* Init SO Start and SO Stop */
- retx_so_start = pdu_mngt->hole_so_start[pdu_mngt->retx_hole_index];
- retx_so_stop = pdu_mngt->hole_so_stop[pdu_mngt->retx_hole_index];
-//Assertion(eNB)_PRAN_DesignDocument_annex No.777
- if((retx_so_start > retx_so_stop) || (retx_so_stop - retx_so_start + 1 > pdu_mngt->payload_size))
- {
- LOG_E(RLC,"RLC AM Tx PDU Segment Data SO Error: retx_so_start=%d retx_so_stop=%d OriginalPDUDataLength=%d sn=%d LcId=%d!\n",
- retx_so_start,retx_so_stop,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
- return NULL;
- }
-/*
- AssertFatal ((retx_so_start <= retx_so_stop) && (retx_so_stop - retx_so_start + 1 <= pdu_mngt->payload_size),
- "RLC AM Tx PDU Segment Data SO Error: retx_so_start=%d retx_so_stop=%d OriginalPDUDataLength=%d sn=%d LcId=%d!\n",
- retx_so_start,retx_so_stop,pdu_mngt->payload_size,sn,rlc_pP->channel_id);
-*/
- /* Init FI to the same value as original PDU */
- fi_start = (!(RLC_AM_PDU_GET_FI_START(*(pdu_mngt->first_byte))));
- fi_end = (!(RLC_AM_PDU_GET_FI_END(*(pdu_mngt->first_byte))));
-
- /* Handle no LI case first */
- if (num_LIs_pdu_segment == 0)
- {
- /* Bound retx_so_stop to available TBS */
- if (retx_so_stop - retx_so_start + 1 + RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE > rlc_pP->nb_bytes_requested_by_mac)
- {
- retx_so_stop = retx_so_start + rlc_pP->nb_bytes_requested_by_mac - RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE - 1;
- }
-
- *payload_sizeP = retx_so_stop - retx_so_start + 1;
-
- mem_pdu_segment_p = get_free_mem_block((*payload_sizeP + RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE + sizeof(struct mac_tb_req)), __func__);
- if(mem_pdu_segment_p == NULL) return NULL;
- pdu_segment_header_p = (uint8_t *)&mem_pdu_segment_p->data[sizeof(struct mac_tb_req)];
- ((struct mac_tb_req*)(mem_pdu_segment_p->data))->data_ptr = pdu_segment_header_p;
- ((struct mac_tb_req*)(mem_pdu_segment_p->data))->tb_size = RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE + *payload_sizeP;
-
- /* clear all PDU segment */
- memset(pdu_segment_header_p, 0, *payload_sizeP + RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE);
- /* copy data part */
- memcpy(pdu_segment_header_p + RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE, pdu_mngt->payload + retx_so_start, *payload_sizeP);
-
- /* Set FI part to false if SO Start and SO End are different from PDU boundaries */
- if (retx_so_start)
- {
- fi_start = false;
- }
- if (retx_so_stop < pdu_mngt->payload_size - 1)
- {
- fi_end = false;
- }
-
- /* Header content is filled at the end */
- }
- else
- {
- /* Step 1 */
- /* Find the SDU index in the original PDU containing retx_so_start */
- sdu_size_t sdu_size = 0;
- sdu_size_t data_size = 0;
- *payload_sizeP = 0;
- sdu_size_t header_segment_length = RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE;
- pdu_original_header_p = pdu_mngt->first_byte + 2;
- li_bit_offset = 4; /* toggle between 0 and 4 */
- li_jump_offset = 1; /* toggle between 1 and 2 */
- uint16_t temp_read = ((*pdu_original_header_p) << 8) | (*(pdu_original_header_p + 1));
-
-
- /* Read first LI */
- sdu_size = RLC_AM_PDU_GET_LI(temp_read,li_bit_offset);
- pdu_original_header_p += li_jump_offset;
- li_bit_offset ^= 0x4;
- li_jump_offset ^= 0x3;
- data_size += sdu_size;
- sdu_index = 1;
-
- /* Loop on all original LIs */
- while ((data_size < retx_so_start + 1) && (sdu_index < pdu_mngt->nb_sdus))
- {
- if (sdu_index < pdu_mngt->nb_sdus - 1)
- {
- temp_read = ((*pdu_original_header_p) << 8) | (*(pdu_original_header_p + 1));
- sdu_size = RLC_AM_PDU_GET_LI(temp_read,li_bit_offset);
- pdu_original_header_p += li_jump_offset;
- li_bit_offset ^= 0x4;
- li_jump_offset ^= 0x3;
- data_size += sdu_size;
- }
- else
- {
- /* if retx_so_start is still not included then set data_size with full original PDU data size */
- /* Set fi_start to false in this case */
- data_size = pdu_mngt->payload_size;
- }
- sdu_index ++;
- }
-
- if (retx_so_start == data_size)
- {
- /* Set FI Start if retx_so_start = cumulated data size */
- fi_start = true;
- /* there must be at least one SDU more */
-//Assertion(eNB)_PRAN_DesignDocument_annex No.778
- if(sdu_index >= pdu_mngt->nb_sdus)
- {
- LOG_E(RLC,"RLC AM Tx PDU Segment Error: sdu_index=%d nb_sdus=%d sn=%d LcId=%d !\n",
- sdu_index,pdu_mngt->nb_sdus,sn,rlc_pP->channel_id);
- return NULL;
- }
-/*
- AssertFatal (sdu_index < pdu_mngt->nb_sdus, "RLC AM Tx PDU Segment Error: sdu_index=%d nb_sdus=%d sn=%d LcId=%d !\n",
- sdu_index,pdu_mngt->nb_sdus,sn,rlc_pP->channel_id);
-*/
- if (sdu_index < pdu_mngt->nb_sdus - 1)
- {
- temp_read = ((*pdu_original_header_p) << 8) | (*(pdu_original_header_p + 1));
- sdu_size = RLC_AM_PDU_GET_LI(temp_read,li_bit_offset);
- pdu_original_header_p += li_jump_offset;
- li_bit_offset ^= 0x4;
- li_jump_offset ^= 0x3;
- data_size += sdu_size;
- }
- else
- {
- /* It was the last LI, then set data_size to full original PDU size */
- data_size = pdu_mngt->payload_size;
- }
- /* Go to next SDU */
- sdu_index ++;
- }
- else if (retx_so_start != 0)
- {
- /* in all other cases set fi_start to false if it SO Start is not 0 */
- fi_start = false;
- }
-
- /* Set first SDU portion of the segment */
- sdus_segment_size[0] = data_size - retx_so_start;
-
- /* Check if so end is in the first SDU portion */
- if (sdus_segment_size[0] >= retx_so_stop - retx_so_start + 1)
- {
- sdus_segment_size[0] = retx_so_stop - retx_so_start + 1;
- *payload_sizeP = sdus_segment_size[0];
- num_LIs_pdu_segment = 0;
- }
-
- /* Bound first SDU segment to available TBS if necessary */
- if (sdus_segment_size[0] + RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE >= rlc_pP->nb_bytes_requested_by_mac)
- {
- sdus_segment_size[0] = rlc_pP->nb_bytes_requested_by_mac - RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE;
- *payload_sizeP = sdus_segment_size[0];
- num_LIs_pdu_segment = 0;
- }
-
-
- /* Now look for the end if it was not set previously */
- if (*payload_sizeP == 0)
- {
- sdu_segment_index ++;
- while ((sdu_index < pdu_mngt->nb_sdus) && (data_size < retx_so_stop + 1))
- {
- if (sdu_index < pdu_mngt->nb_sdus - 1)
- {
- temp_read = ((*pdu_original_header_p) << 8) | (*(pdu_original_header_p + 1));
- sdu_size = RLC_AM_PDU_GET_LI(temp_read,li_bit_offset);
- pdu_original_header_p += li_jump_offset;
- li_bit_offset ^= 0x4;
- li_jump_offset ^= 0x3;
- data_size += sdu_size;
- }
- else
- {
- sdu_size = pdu_mngt->payload_size - data_size;
- data_size = pdu_mngt->payload_size;
- }
-
- sdus_segment_size[sdu_segment_index] = sdu_size;
- sdu_index ++;
- sdu_segment_index ++;
- }
-
-
- if (data_size > retx_so_stop + 1)
- {
- sdus_segment_size[sdu_segment_index - 1] = retx_so_stop - (data_size - sdu_size) + 1;
- }
-
- /* Set number of LIs in the segment */
- num_LIs_pdu_segment = sdu_segment_index - 1;
-//Assertion(eNB)_PRAN_DesignDocument_annex No.779
- if(num_LIs_pdu_segment > pdu_mngt->nb_sdus - 1)
- {
- LOG_E(RLC, "RLC AM Tx PDU Segment Data Error: nbLISegment=%d nbLIPDU=%d sn=%d LcId=%d !\n",
- num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
- return NULL;
- }
-/*
- AssertFatal (num_LIs_pdu_segment <= pdu_mngt->nb_sdus - 1, "RLC AM Tx PDU Segment Data Error: nbLISegment=%d nbLIPDU=%d sn=%d LcId=%d !\n",
- num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
-*/
- /* Bound to available TBS taking into account min PDU segment header*/
- sdu_segment_index = 0;
- while ((sdu_segment_index < num_LIs_pdu_segment + 1) && (rlc_pP->nb_bytes_requested_by_mac > *payload_sizeP + RLC_AM_PDU_SEGMENT_HEADER_SIZE(sdu_segment_index)))
- {
-//Assertion(eNB)_PRAN_DesignDocument_annex No.780
- if(sdus_segment_size[sdu_segment_index] <= 0)
- {
- LOG_E(RLC, "RLC AM Tx PDU Segment Data Error: EMpty LI index=%d numLISegment=%d numLIPDU=%d PDULength=%d SOStart=%d SOStop=%d sn=%d LcId=%d !\n",
- sdu_segment_index,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,pdu_mngt->payload_size,retx_so_start,retx_so_stop,sn,rlc_pP->channel_id);
- sdu_segment_index++;
- continue;
- }
-/*
- AssertFatal (sdus_segment_size[sdu_segment_index] > 0, "RLC AM Tx PDU Segment Data Error: EMpty LI index=%d numLISegment=%d numLIPDU=%d PDULength=%d SOStart=%d SOStop=%d sn=%d LcId=%d !\n",
- sdu_segment_index,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,pdu_mngt->payload_size,retx_so_start,retx_so_stop,sn,rlc_pP->channel_id);
-*/
- /* Add next sdu_segment_index to data part */
- if (RLC_AM_PDU_SEGMENT_HEADER_SIZE(sdu_segment_index) + (*payload_sizeP) + sdus_segment_size[sdu_segment_index] <= rlc_pP->nb_bytes_requested_by_mac)
- {
- (*payload_sizeP) += sdus_segment_size[sdu_segment_index];
- }
- else
- {
- /* bound to available TBS size */
- sdus_segment_size[sdu_segment_index] = rlc_pP->nb_bytes_requested_by_mac - RLC_AM_PDU_SEGMENT_HEADER_SIZE(sdu_segment_index) - (*payload_sizeP);
- (*payload_sizeP) += sdus_segment_size[sdu_segment_index];
- }
- header_segment_length = RLC_AM_PDU_SEGMENT_HEADER_SIZE(sdu_segment_index);
- sdu_segment_index ++;
- }
-
- num_LIs_pdu_segment = sdu_segment_index - 1;
- }
-
-
- /* update retx_so_stop */
- retx_so_stop = retx_so_start + (*payload_sizeP) - 1;
-//Assertion(eNB)_PRAN_DesignDocument_annex No.781
- if((retx_so_stop > pdu_mngt->payload_size - 1) || (retx_so_stop - retx_so_start + 1 >= pdu_mngt->payload_size))
- {
- LOG_E(RLC,"RLC AM Tx PDU Segment Data Error: retx_so_stop=%d OriginalPDUDataLength=%d SOStart=%d SegmentLength=%d numLISegment=%d numLIPDU=%d sn=%d LcId=%d !\n",
- retx_so_stop,pdu_mngt->payload_size,retx_so_start,*payload_sizeP,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
- return NULL;
- }
-/*
- AssertFatal ((retx_so_stop <= pdu_mngt->payload_size - 1) && (retx_so_stop - retx_so_start + 1 < pdu_mngt->payload_size),
- "RLC AM Tx PDU Segment Data Error: retx_so_stop=%d OriginalPDUDataLength=%d SOStart=%d SegmentLength=%d numLISegment=%d numLIPDU=%d sn=%d LcId=%d !\n",
- retx_so_stop,pdu_mngt->payload_size,retx_so_start,*payload_sizeP,num_LIs_pdu_segment,pdu_mngt->nb_sdus - 1,sn,rlc_pP->channel_id);
-*/
- /* init FI End to false if retx_so_stop is not end of PDU */
- if (retx_so_stop != pdu_mngt->payload_size - 1)
- {
- fi_end = false;
- }
-
- /* Check consistency between sdus_segment_size and payload_sizeP */
- /* And Set FI End if retx_so_stop = cumulated data size and this is not last SDU */
- data_size = 0;
- for (int i = 0; i < num_LIs_pdu_segment + 1; i++)
- {
- data_size += sdus_segment_size[i];
- if ((retx_so_stop == data_size - 1) && (i < num_LIs_pdu_segment))
- {
- fi_end = true;
- }
- }
-//Assertion(eNB)_PRAN_DesignDocument_annex No.782
- if(data_size != *payload_sizeP)
- {
- LOG_E(RLC,"RLC AM Tx PDU Segment Data Error: SduSum=%d Data=%d sn=%d LcId=%d !\n",
- data_size,*payload_sizeP,sn,rlc_pP->channel_id);
- return NULL;
- }
-/*
- AssertFatal (data_size == *payload_sizeP, "RLC AM Tx PDU Segment Data Error: SduSum=%d Data=%d sn=%d LcId=%d !\n",
- data_size,*payload_sizeP,sn,rlc_pP->channel_id);
-*/
-
-
- /* Allocation */
-//Assertion(eNB)_PRAN_DesignDocument_annex No.783
- if(header_segment_length + *payload_sizeP > pdu_mngt->header_and_payload_size + 2)
- {
- LOG_E(RLC, "RLC AM PDU Segment Error: Hdr=%d Data=%d Original Hdr+Data =%d sn=%d LcId=%d !\n",
- header_segment_length,*payload_sizeP,pdu_mngt->header_and_payload_size,sn,rlc_pP->channel_id);
- return NULL;
- }
-/*
- AssertFatal (header_segment_length + *payload_sizeP <= pdu_mngt->header_and_payload_size + 2, "RLC AM PDU Segment Error: Hdr=%d Data=%d Original Hdr+Data =%d sn=%d LcId=%d !\n",
- header_segment_length,*payload_sizeP,pdu_mngt->header_and_payload_size,sn,rlc_pP->channel_id);
-*/
- mem_pdu_segment_p = get_free_mem_block((*payload_sizeP + header_segment_length + sizeof(struct mac_tb_req)), __func__);
- if(mem_pdu_segment_p == NULL) return NULL;
- pdu_segment_header_p = (uint8_t *)&mem_pdu_segment_p->data[sizeof(struct mac_tb_req)];
- ((struct mac_tb_req*)(mem_pdu_segment_p->data))->data_ptr = pdu_segment_header_p;
- ((struct mac_tb_req*)(mem_pdu_segment_p->data))->tb_size = header_segment_length + *payload_sizeP;
-
- /* clear all PDU segment */
- memset(pdu_segment_header_p, 0, *payload_sizeP + header_segment_length);
- /* copy data part */
- memcpy(pdu_segment_header_p + header_segment_length, pdu_mngt->payload + retx_so_start, *payload_sizeP);
- }
-
- /* Last step : update contexts and fill PDU Segment Header */
- if (mem_pdu_segment_p != NULL)
- {
- /* Update PDU Segment contexts */
- if (*payload_sizeP == pdu_mngt->hole_so_stop[pdu_mngt->retx_hole_index] - pdu_mngt->hole_so_start[pdu_mngt->retx_hole_index] + 1)
- {
- /* All data in the segment are transmitted : switch to next one */
- pdu_mngt->retx_hole_index ++;
- if (pdu_mngt->retx_hole_index < pdu_mngt->num_holes)
- {
- /* Set min SOStart to the value of next hole : assumption is holes are ordered by increasing SOStart */
- pdu_mngt->nack_so_start = pdu_mngt->hole_so_start[pdu_mngt->retx_hole_index];
- }
- else
- {
- /* no more scheduled Retx: reset values */
- /* Retx size is reset in the calling function */
- pdu_mngt->num_holes = 0;
- pdu_mngt->retx_hole_index = 0;
- pdu_mngt->nack_so_start = 0;
- }
- }
- else
- {
- /* not all segment data could be transmitted, just update SoStart */
- pdu_mngt->hole_so_start[pdu_mngt->retx_hole_index] += (*payload_sizeP);
- pdu_mngt->nack_so_start = pdu_mngt->hole_so_start[pdu_mngt->retx_hole_index];
- }
-
- /* Content is supposed to be init with 0 so with FIStart=FIEnd=true */
- RLC_AM_PDU_SET_D_C(*pdu_segment_header_p);
- RLC_AM_PDU_SET_RF(*pdu_segment_header_p);
- /* Change FI */
- if (!fi_start)
- {
- // Set to not starting
- (*pdu_segment_header_p) |= (1 << (RLC_AM_PDU_FI_OFFSET + 1));
- }
- if (!fi_end)
- {
- // Set to not starting
- (*pdu_segment_header_p) |= (1 << (RLC_AM_PDU_FI_OFFSET));
- }
- /* Set SN */
- (*pdu_segment_header_p) |= ((sn >> 8) & 0x3);
- (*(pdu_segment_header_p + 1)) |= (sn & 0xFF);
-
- /* Segment Offset */
- header_so_part = retx_so_start;
-
- /* Last Segment Flag (LSF) */
- if (retx_so_stop == pdu_mngt->payload_size - 1)
- {
- RLC_AM_PDU_SET_LSF(header_so_part);
- }
-
- /* Store SO bytes */
- * (pdu_segment_header_p + 2) = (header_so_part >> 8) & 0xFF;
- * (pdu_segment_header_p + 3) = header_so_part & 0xFF;
-
- /* Fill LI part */
- if (num_LIs_pdu_segment)
- {
- uint16_t index = 0;
- uint16_t temp = 0;
- /* Set Extension bit in first byte */
- RLC_AM_PDU_SET_E(*pdu_segment_header_p);
-
- /* loop on nb of LIs */
- pdu_segment_header_p += RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE;
- li_bit_offset = 4; /* toggle between 0 and 4 */
- li_jump_offset = 1; /* toggle between 1 and 2 */
-
- while (index < num_LIs_pdu_segment)
- {
- /* Set E bit for next LI if present */
- if (index < num_LIs_pdu_segment - 1)
- RLC_SET_BIT(temp,li_bit_offset + RLC_AM_LI_BITS);
- /* Set LI */
- RLC_AM_PDU_SET_LI(temp,sdus_segment_size[index],li_bit_offset);
- *pdu_segment_header_p = temp >> 8;
- *(pdu_segment_header_p + 1) = temp & 0xFF;
- pdu_segment_header_p += li_jump_offset;
- li_bit_offset ^= 0x4;
- li_jump_offset ^= 0x3;
-
- temp = ((*pdu_segment_header_p) << 8) | (*(pdu_segment_header_p + 1));
- index ++;
- }
- }
- }
- else
- {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] OUT OF MEMORY PDU SN %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sn);
- }
-
- return mem_pdu_segment_p;
-}
-
-//-----------------------------------------------------------------------------
-void rlc_am_tx_buffer_display (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP,
- char* const message_pP)
-{
- rlc_sn_t sn = rlc_pP->vt_a;
- int i, loop = 0;
- rlc_am_tx_data_pdu_management_t *tx_data_pdu_buffer_p;
-
- if (message_pP) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" Retransmission buffer %s VT(A)=%04d VT(S)=%04d:",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- message_pP,
- rlc_pP->vt_a,
- rlc_pP->vt_s);
- } else {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" Retransmission buffer VT(A)=%04d VT(S)=%04d:",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->vt_a,
- rlc_pP->vt_s);
- }
-
- while (rlc_pP->vt_s != sn) {
- tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE];
- if (tx_data_pdu_buffer_p->mem_block) {
- if ((loop % 1) == 0) {
- LOG_D(RLC, "\nTX SN:\t");
- }
-
- if (tx_data_pdu_buffer_p->flags.retransmit) {
- LOG_D(RLC, "%04d %d/%d Bytes (NACK RTX:%02d ",sn, tx_data_pdu_buffer_p->header_and_payload_size, tx_data_pdu_buffer_p->payload_size,
- tx_data_pdu_buffer_p->retx_count);
- } else {
- LOG_D(RLC, "%04d %d/%d Bytes (RTX:%02d ",sn, tx_data_pdu_buffer_p->header_and_payload_size, tx_data_pdu_buffer_p->payload_size,
- tx_data_pdu_buffer_p->retx_count);
- }
-
- if (tx_data_pdu_buffer_p->num_holes == 0) {
- LOG_D(RLC, "SO:%04d->%04d)\t", tx_data_pdu_buffer_p->nack_so_start, tx_data_pdu_buffer_p->nack_so_stop);
- } else {
- for (i=0; inum_holes; i++) {
- //assert(i < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
- if(i >= RLC_AM_MAX_HOLES_REPORT_PER_PDU) {
- LOG_E(RLC, "num_holes error. %d %d %d\n", tx_data_pdu_buffer_p->num_holes, i, RLC_AM_MAX_HOLES_REPORT_PER_PDU);
- break;
- }
- LOG_D(RLC, "SO:%04d->%04d)\t", tx_data_pdu_buffer_p->hole_so_start[i], tx_data_pdu_buffer_p->hole_so_stop[i]);
- }
- }
-
- loop++;
- }
-
- sn = (sn + 1) & RLC_AM_SN_MASK;
- }
-
- LOG_D(RLC, "\n");
-}
-
-//-----------------------------------------------------------------------------
-mem_block_t * rlc_am_get_pdu_to_retransmit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP)
-{
- rlc_sn_t sn = rlc_pP->vt_a;
- rlc_sn_t sn_end = rlc_pP->vt_s;
- mem_block_t* pdu_p = NULL;
- mem_block_t* mb_p = NULL;
- rlc_am_tx_data_pdu_management_t* tx_data_pdu_management;
-//Assertion(eNB)_PRAN_DesignDocument_annex No.769
- if((rlc_pP->retrans_num_pdus <= 0) || (rlc_pP->vt_a == rlc_pP->vt_s))
- {
- LOG_E(RLC, "RLC AM ReTx start process Error: NbPDUtoRetx=%d vtA=%d vtS=%d LcId=%d !\n",
- rlc_pP->retrans_num_pdus,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- return NULL;
- }
-/*
- AssertFatal ((rlc_pP->retrans_num_pdus > 0) && (rlc_pP->vt_a != rlc_pP->vt_s), "RLC AM ReTx start process Error: NbPDUtoRetx=%d vtA=%d vtS=%d LcId=%d !\n",
- rlc_pP->retrans_num_pdus,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
-*/
- do
- {
- tx_data_pdu_management = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE];
- if ((tx_data_pdu_management->flags.retransmit) && (tx_data_pdu_management->flags.max_retransmit == 0))
- {
-//Assertion(eNB)_PRAN_DesignDocument_annex No.770
- if(tx_data_pdu_management->sn != sn)
- {
- LOG_E(RLC, "RLC AM ReTx PDU Error: SN Error pdu_sn=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
- tx_data_pdu_management->sn,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- }
-//Assertion(eNB)_PRAN_DesignDocument_annex No.771
- else if(tx_data_pdu_management->flags.transmitted != 1)
- {
- LOG_E(RLC, "RLC AM ReTx PDU Error: State Error sn=%d vtA=%d vtS=%d LcId=%d !\n",
- sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- }
-//Assertion(eNB)_PRAN_DesignDocument_annex No.772
- else if(tx_data_pdu_management->retx_payload_size <= 0)
- {
- LOG_E(RLC, "RLC AM ReTx PDU Error: No Data to Retx sn=%d vtA=%d vtS=%d LcId=%d !\n",
- sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- }
- else
- {
-/*
- AssertFatal (tx_data_pdu_management->sn == sn, "RLC AM ReTx PDU Error: SN Error pdu_sn=%d sn=%d vtA=%d vtS=%d LcId=%d !\n",
- tx_data_pdu_management->sn,sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- AssertFatal (tx_data_pdu_management->flags.transmitted == 1, "RLC AM ReTx PDU Error: State Error sn=%d vtA=%d vtS=%d LcId=%d !\n",
- sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- AssertFatal (tx_data_pdu_management->retx_payload_size > 0, "RLC AM ReTx PDU Error: No Data to Retx sn=%d vtA=%d vtS=%d LcId=%d !\n",
- sn,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
-*/
- /* Either the whole RLC PDU is to be transmitted and there is enough MAC TBS or there is minimum TBS size for transmitting 1 AM PDU segment */
- if ((tx_data_pdu_management->retx_payload_size == tx_data_pdu_management->payload_size) && (rlc_pP->nb_bytes_requested_by_mac >= tx_data_pdu_management->header_and_payload_size))
- {
- /* check maxretx is not hit */
- if (tx_data_pdu_management->retx_count_next <= rlc_pP->max_retx_threshold)
- {
- pdu_p = rlc_am_retransmit_get_copy(ctxt_pP, rlc_pP, sn);
-
- if (pdu_p != NULL)
- {
- rlc_pP->retrans_num_bytes_to_retransmit -= tx_data_pdu_management->retx_payload_size;
- rlc_pP->retrans_num_pdus --;
- tx_data_pdu_management->retx_payload_size = 0;
- tx_data_pdu_management->flags.retransmit = 0;
-
- // update stats
- rlc_pP->stat_tx_data_pdu += 1;
- rlc_pP->stat_tx_retransmit_pdu += 1;
- rlc_pP->stat_tx_retransmit_pdu_by_status += 1;
- rlc_pP->stat_tx_data_bytes += tx_data_pdu_management->payload_size;
- rlc_pP->stat_tx_retransmit_bytes += tx_data_pdu_management->payload_size;
- rlc_pP->stat_tx_retransmit_bytes_by_status += tx_data_pdu_management->payload_size;
-
- }
- }
- else
- {
- // TO DO : RLC Notification to RRC + ReEstablishment procedure
- tx_data_pdu_management->flags.max_retransmit = 1;
- LOG_W(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RLC AM MAX RETX=%d] SN %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- tx_data_pdu_management->retx_count_next,
- sn);
- mb_p = rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE].mem_block;
- if(mb_p != NULL){
- free_mem_block(mb_p, __func__);
- tx_data_pdu_management->mem_block = NULL;
- tx_data_pdu_management->flags.retransmit = 0;
- tx_data_pdu_management->flags.ack = 1;
- tx_data_pdu_management->flags.transmitted = 0;
- rlc_pP->retrans_num_bytes_to_retransmit -= tx_data_pdu_management->retx_payload_size;
- tx_data_pdu_management->retx_payload_size = 0;
- tx_data_pdu_management->num_holes = 0;
- rlc_pP->retrans_num_pdus --;
- }
- }
- }
- else if (rlc_pP->nb_bytes_requested_by_mac >= 5)
- {
- /* Resegmentation case */
- /* check maxretx is not hit */
- if (tx_data_pdu_management->retx_count_next <= rlc_pP->max_retx_threshold)
- {
- sdu_size_t pdu_data_size = 0;
-
- pdu_p = rlc_am_retransmit_get_am_segment(ctxt_pP, rlc_pP, tx_data_pdu_management,&pdu_data_size);
-
- if (pdu_p != NULL)
- {
-//Assertion(eNB)_PRAN_DesignDocument_annex No.773
- if((tx_data_pdu_management->retx_payload_size < pdu_data_size)|| (rlc_pP->retrans_num_bytes_to_retransmit < pdu_data_size))
- {
- LOG_E(RLC, "RLC AM ReTx PDU Segment Error: DataSize=%d PDUReTxsize=%d TotalReTxsize=%d sn=%d LcId=%d !\n",
- pdu_data_size,tx_data_pdu_management->retx_payload_size,rlc_pP->retrans_num_bytes_to_retransmit,sn,rlc_pP->channel_id);
- }
- else
- {
-/*
- AssertFatal ((tx_data_pdu_management->retx_payload_size >= pdu_data_size) && (rlc_pP->retrans_num_bytes_to_retransmit >= pdu_data_size), "RLC AM ReTx PDU Segment Error: DataSize=%d PDUReTxsize=%d TotalReTxsize=%d sn=%d LcId=%d !\n",
- pdu_data_size,tx_data_pdu_management->retx_payload_size,rlc_pP->retrans_num_bytes_to_retransmit,sn,rlc_pP->channel_id);
-*/
- tx_data_pdu_management->retx_payload_size -= pdu_data_size;
- rlc_pP->retrans_num_bytes_to_retransmit -= pdu_data_size;
- if (tx_data_pdu_management->retx_payload_size == 0)
- {
- rlc_pP->retrans_num_pdus --;
- tx_data_pdu_management->retx_payload_size = 0;
- tx_data_pdu_management->flags.retransmit = 0;
- }
-
- // update stats
- rlc_pP->stat_tx_data_pdu += 1;
- rlc_pP->stat_tx_retransmit_pdu += 1;
- rlc_pP->stat_tx_retransmit_pdu_by_status += 1;
- rlc_pP->stat_tx_data_bytes += pdu_data_size;
- rlc_pP->stat_tx_retransmit_bytes += pdu_data_size;
- rlc_pP->stat_tx_retransmit_bytes_by_status += pdu_data_size;
-
- }//Assertion(eNB)_PRAN_DesignDocument_annex No.773
- }
- }
- else
- {
- // TO DO : RLC Notification to RRC + ReEstablishment procedure
- tx_data_pdu_management->flags.max_retransmit = 1;
- LOG_W(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RLC AM MAX RETX=%d] SN %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- tx_data_pdu_management->retx_count_next,
- sn);
- mb_p = rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE].mem_block;
- if(mb_p != NULL){
- free_mem_block(mb_p, __func__);
- tx_data_pdu_management->mem_block = NULL;
- tx_data_pdu_management->flags.retransmit = 0;
- tx_data_pdu_management->flags.ack = 1;
- tx_data_pdu_management->flags.transmitted = 0;
- rlc_pP->retrans_num_bytes_to_retransmit -= tx_data_pdu_management->retx_payload_size;
- tx_data_pdu_management->retx_payload_size = 0;
- tx_data_pdu_management->num_holes = 0;
- rlc_pP->retrans_num_pdus --;
- }
- }
- }
-
- if (pdu_p != NULL)
- {
- /* check polling */
- rlc_am_pdu_sn_10_t* pdu_header_p = (rlc_am_pdu_sn_10_t*) (&pdu_p->data[sizeof(struct mac_tb_req)]);
- rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_header_p, tx_data_pdu_management->payload_size,false);
-
- tx_data_pdu_management->retx_count = tx_data_pdu_management->retx_count_next;
-
- break;
- }
-
- }//Assertion(eNB)_PRAN_DesignDocument_annex No.770 No.771 No.772
- }
- sn = RLC_AM_NEXT_SN(sn);
- } while((sn != sn_end) && (rlc_pP->retrans_num_pdus > 0));
-
- return pdu_p;
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h
deleted file mode 100644
index c34d06337d..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_retransmit.h
-* \brief This file defines the prototypes of the functions dealing with the retransmission.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_internal_retransmit_impl_ RLC AM Retransmitter Internal Reference Implementation
-* @ingroup _rlc_am_internal_impl_
-* @{
-*/
-# ifndef __RLC_AM_RETRANSMIT_H__
-# define __RLC_AM_RETRANSMIT_H__
-//-----------------------------------------------------------------------------
-/*! \fn bool rlc_am_nack_pdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, int16_t snP, int16_t prev_nack_snP,sdu_size_t so_startP, sdu_size_t so_endP)
-* \brief The RLC AM PDU which have the sequence number snP is marked NACKed with segment offset fields.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number of the PDU that is negative acknowledged.
-* \param[in] prev_nack_snP Sequence number of previous PDU that is negative acknowledged.
-* \param[in] so_startP Start of the segment offset of the PDU that .
-* \param[in] so_endP Transport blocks received from MAC layer.
-* \return OK/KO
-* \note It may appear a new hole in the retransmission buffer depending on the segment offset informations. Depending on the state of the retransmission buffer, negative confirmation can be sent to higher layers about the drop by the RLC AM instance of a particular SDU.
-*/
-bool rlc_am_nack_pdu(const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlcP,
- const rlc_sn_t snP,
- const rlc_sn_t prev_nack_snP,
- sdu_size_t so_startP,
- sdu_size_t so_endP);
-
-/*! \fn void rlc_am_ack_pdu (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t *rlcP, rlc_sn_t snP)
-* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number of the PDU that is acknowledged.
-* \param[in] free_pdu Boolean indicating that the PDU can be freed because smaller than new vtA.
-* \note Depending on the state of the retransmission buffer, positive confirmation can be sent to higher layers about the receiving by the peer RLC AM instance of a particular SDU.
-*/
-void rlc_am_ack_pdu(const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlcP,
- const rlc_sn_t snP,
- bool free_pdu);
-
-/*! \fn mem_block_t* rlc_am_retransmit_get_copy (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, rlc_sn_t snP)
-* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number of the PDU to be copied.
-* \return A copy of the PDU having sequence number equal to parameter snP.
-*/
-mem_block_t* rlc_am_retransmit_get_copy (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlcP,
- const rlc_sn_t snP);
-/*! \fn mem_block_t* rlc_am_retransmit_get_subsegment (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t *rlcP,rlc_sn_t snP, sdu_size_t *sizeP)
-* \brief The RLC AM PDU which have the sequence number snP is marked ACKed.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number of the PDU to be copied.
-* \param[in,out] sizeP Maximum size allowed for the subsegment, it is updated with the amount of bytes not used (sizeP[out] = sizeP[in] - size of segment).
-* \return A copy of a segment of the PDU having sequence number equal to parameter snP.
-*/
-mem_block_t* rlc_am_retransmit_get_subsegment (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlcP,
- const rlc_sn_t snP,
- sdu_size_t *const sizeP);
-/*! \fn mem_block_t* rlc_am_get_pdu_to_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* rlcP)
-* \brief Find a PDU or PDU segment to retransmit.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \return A copy of the retransmitted PDU or PDU segment or NULL if TBS was not big enough
-*/
-mem_block_t* rlc_am_get_pdu_to_retransmit(
- const protocol_ctxt_t* const ctxt_pP,
-
- rlc_am_entity_t* const rlcP);
-/*! \fn void rlc_am_retransmit_any_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* rlcP)
-* \brief Retransmit any PDU in order to unblock peer entity, if no suitable PDU is found (depending on requested MAC size) to be retransmitted, then try to retransmit a subsegment of any PDU.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-*/
-void rlc_am_retransmit_any_pdu(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlcP);
-
-/*! \fn void rlc_am_tx_buffer_display (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* rlcP, char* message_pP)
-* \brief Display the dump of the retransmission buffer.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] message_pP Message to be displayed along with the display of the dump of the retransmission buffer.
-*/
-void rlc_am_tx_buffer_display (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlcP,
- char* const message_pP);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c
deleted file mode 100644
index bd578abab2..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c
+++ /dev/null
@@ -1,1297 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_RX_LIST_C 1
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-//-----------------------------------------------------------------------------
-#include "assertions.h"
-#include "list.h"
-#include "rlc_am.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-
-
-bool rlc_am_rx_check_vr_reassemble(const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP)
-{
- mem_block_t* cursor_p = rlc_pP->receiver_buffer.head;
- rlc_am_rx_pdu_management_t * pdu_cursor_mgnt_p = NULL;
- sdu_size_t next_waited_so = 0;
- bool reassemble = false;
-
- if (cursor_p != NULL) {
-
- rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- rlc_usn_t sn_ref = pdu_info_p->sn;
-
- if (sn_ref != rlc_pP->vr_r) {
- /* Case vrR has advanced from head : most likely case */
-
- reassemble = true;
- /* Handle first SN if it is made of PDU segments : set them all to be reassembled */
- if (pdu_info_p->rf) {
- pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
- next_waited_so = 0;
-//Assertion(eNB)_PRAN_DesignDocument_annex No.785
- if(pdu_cursor_mgnt_p->all_segments_received <= 0)
- {
- LOG_E(RLC, "AM Rx Check Reassembly head SN=%d with PDU segments != vrR=%d should be fully received LCID=%d\n",
- sn_ref,rlc_pP->vr_r,rlc_pP->channel_id);
- return false;
- }
-/*
- AssertFatal(pdu_cursor_mgnt_p->all_segments_received > 0,"AM Rx Check Reassembly head SN=%d with PDU segments != vrR=%d should be fully received LCID=%d\n",
- sn_ref,rlc_pP->vr_r,rlc_pP->channel_id);
-*/
- while ((cursor_p != NULL) && (pdu_info_p->sn == sn_ref) && (pdu_info_p->so == next_waited_so)) {
- if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) {
- pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING;
- }
- next_waited_so += pdu_info_p->payload_size;
- cursor_p = cursor_p->next;
- if (cursor_p != NULL) {
- pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
- pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- }
- }
-
- /* Now jump up to vrR */
- while ((RLC_AM_DIFF_SN(pdu_info_p->sn,sn_ref) < RLC_AM_DIFF_SN(rlc_pP->vr_r,sn_ref)) && (cursor_p != NULL)) {
- cursor_p = cursor_p->next;
- if (cursor_p != NULL) {
- pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- }
-
- /* Handle vrR if it is made of incomplete PDU Segments */
- if ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r)) {
- pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
- next_waited_so = 0;
-//Assertion(eNB)_PRAN_DesignDocument_annex No.786
- if(pdu_cursor_mgnt_p->all_segments_received != 0)
- {
- LOG_E(RLC, "AM Rx Check Reassembly vr=%d should be partly received SNHead=%d LCID=%d\n",
- rlc_pP->vr_r,sn_ref,rlc_pP->channel_id);
- return false;
- }
-/*
- AssertFatal(pdu_cursor_mgnt_p->all_segments_received == 0,"AM Rx Check Reassembly vr=%d should be partly received SNHead=%d LCID=%d\n",
- rlc_pP->vr_r,sn_ref,rlc_pP->channel_id);
-*/
- while ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r) && (pdu_info_p->so == next_waited_so)) {
- if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) {
- pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING;
- }
- next_waited_so += pdu_info_p->payload_size;
- cursor_p = cursor_p->next;
- if (cursor_p != NULL) {
- pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
- pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- }
- }
- } /* end sn_ref != rlc_pP->vr_r */
- else {
- /* case vrR = partially received */
-
- pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
- next_waited_so = 0;
-//Assertion(eNB)_PRAN_DesignDocument_annex No.787
- if(pdu_cursor_mgnt_p->all_segments_received != 0)
- {
- LOG_E(RLC, "AM Rx Check Reassembly SNHead=vr=%d should be partly received LCID=%d\n",
- rlc_pP->vr_r,rlc_pP->channel_id);
- return false;
- }
-/*
- AssertFatal(pdu_cursor_mgnt_p->all_segments_received == 0,"AM Rx Check Reassembly SNHead=vr=%d should be partly received LCID=%d\n",
- rlc_pP->vr_r,rlc_pP->channel_id);
-*/
- while ((cursor_p != NULL) && (pdu_info_p->sn == rlc_pP->vr_r) && (pdu_info_p->so == next_waited_so)) {
- if (pdu_cursor_mgnt_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO) {
- pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING;
- reassemble = true;
- }
- next_waited_so += pdu_info_p->payload_size;
- cursor_p = cursor_p->next;
- if (cursor_p != NULL) {
- pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
- pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- }
- } /*end sn_ref == rlc_pP->vr_r */
- }
- return reassemble;
-}
-
-mem_block_t * create_new_segment_from_pdu(
- mem_block_t* const tb_pP,
- uint16_t so_offset, /* offset from the data part of the PDU to copy */
- sdu_size_t data_length_to_copy)
-{
- rlc_am_pdu_info_t* pdu_rx_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
- rlc_am_pdu_info_t* pdu_new_segment_info_p = NULL;
- mem_block_t * new_segment_p = NULL;
- int16_t new_li_list[RLC_AM_MAX_SDU_IN_PDU];
- int16_t header_size = 0;
- uint8_t num_li = 0;
- bool fi_start, fi_end, lsf;
-
- /* Init some PDU Segment header fixed parameters */
- fi_start = !((pdu_rx_info_p->fi & 0x2) >> 1);
- fi_end = !(pdu_rx_info_p->fi & 0x1);
- lsf = ((pdu_rx_info_p->lsf == 1) || (pdu_rx_info_p->rf == 0));
-
- /* Handle NO Li case fist */
- if (pdu_rx_info_p->num_li == 0) {
-
- header_size = RLC_AM_PDU_SEGMENT_HEADER_MIN_SIZE;
-
- if (so_offset) {
- fi_start = false;
- }
- if (so_offset + data_length_to_copy != pdu_rx_info_p->payload_size) {
- fi_end = false;
- lsf = false;
- }
- } // end no LI in original segment
- else {
-
- uint8_t li_index = 0;
- uint16_t li_sum = 0;
- num_li = pdu_rx_info_p->num_li;
-
- /* set LSF to false if we know that end of the original segment will not be copied */
- if (so_offset + data_length_to_copy != pdu_rx_info_p->payload_size) {
- lsf = false;
- }
-
- /* catch the first LI containing so_offset */
- while ((li_index < pdu_rx_info_p->num_li) && (li_sum + pdu_rx_info_p->li_list[li_index] <= so_offset)) {
- li_sum += pdu_rx_info_p->li_list[li_index];
- num_li --;
- li_index ++;
- }
-
- /* set FI start if so_offset = LI sum and at least one LI have been read */
- if ((li_index) && (so_offset == li_sum)) {
- fi_start = TRUE;
- }
-
- /* Fill LI until the end */
- if (num_li) {
- sdu_size_t remaining_size = data_length_to_copy;
- uint8_t j = 0;
- new_li_list[0] = li_sum + pdu_rx_info_p->li_list[li_index] - so_offset;
- if (data_length_to_copy <= new_li_list[0]) {
- num_li = 0;
- }
- else {
- remaining_size -= new_li_list[0];
- j++;
- li_index ++;
- while ((li_index < pdu_rx_info_p->num_li) && (remaining_size >= pdu_rx_info_p->li_list[li_index])) {
- remaining_size -= pdu_rx_info_p->li_list[li_index];
- new_li_list[j] = pdu_rx_info_p->li_list[li_index];
- j++;
- li_index ++;
- }
-
- /* update number of LI in the segment */
- num_li = j;
- /* set FI End if remaining size = 0 */
- if (remaining_size == 0) {
- fi_end = true;
- }
- }
- }
-
- /* compute header size */
- header_size = RLC_AM_PDU_SEGMENT_HEADER_SIZE(num_li);
-
- } // end LIs in original segment
-
- /* Allocate new buffer */
- new_segment_p = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + header_size + data_length_to_copy, __func__);
-
- /* Fill PDU Segment Infos and Header */
- if (new_segment_p != NULL) {
- pdu_new_segment_info_p = &((rlc_am_rx_pdu_management_t*)(new_segment_p->data))->pdu_info;
- rlc_am_rx_pdu_management_t * pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (new_segment_p->data);
- uint8_t *pdu_segment_header_p = (uint8_t *)&(new_segment_p->data[sizeof (mac_rlc_max_rx_header_size_t)]);
-
- pdu_cursor_mgnt_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO; //to be updated after if SN = vrR
-
- pdu_new_segment_info_p->d_c = pdu_rx_info_p->d_c;
- pdu_new_segment_info_p->sn = pdu_rx_info_p->sn;
- pdu_new_segment_info_p->p = pdu_rx_info_p->p;
- pdu_new_segment_info_p->rf = 1;
- pdu_new_segment_info_p->fi = (((fi_start ? 0: 1) << 1) | (fi_end ? 0: 1));
- pdu_new_segment_info_p->num_li = num_li;
- pdu_new_segment_info_p->e = (num_li ? 1: 0);
- pdu_new_segment_info_p->lsf = (lsf ? 1: 0);
- pdu_new_segment_info_p->so = pdu_rx_info_p->so + so_offset;
- pdu_new_segment_info_p->payload = pdu_segment_header_p + header_size;
- pdu_new_segment_info_p->header_size = header_size;
- pdu_new_segment_info_p->payload_size = data_length_to_copy;
- pdu_new_segment_info_p->hidden_size = data_length_to_copy;
- for (int i=0; i < num_li; i++) {
- pdu_new_segment_info_p->li_list[i] = new_li_list[i];
- pdu_new_segment_info_p->hidden_size -= new_li_list[i];
- }
-
- /* Fill Header part in the buffer */
- /* Content is supposed to be init with 0 so with FIStart=FIEnd=true */
- /* copy first two bytes from original: D/C + RF + FI + E+ SN*/
- memset(pdu_segment_header_p, 0, header_size);
- RLC_AM_PDU_SET_D_C(*pdu_segment_header_p);
- RLC_AM_PDU_SET_RF(*pdu_segment_header_p);
- if (pdu_new_segment_info_p->p) {
- RLC_AM_PDU_SET_POLL(*pdu_segment_header_p);
- }
- /* Change FI */
- if (!fi_start)
- {
- // Set to not starting
- (*pdu_segment_header_p) |= (1 << (RLC_AM_PDU_FI_OFFSET + 1));
-
- }
- if (!fi_end)
- {
- // Set to not starting
- (*pdu_segment_header_p) |= (1 << (RLC_AM_PDU_FI_OFFSET));
-
- }
- /* E */
- if (pdu_new_segment_info_p->e) {
- RLC_AM_PDU_SET_E(*pdu_segment_header_p);
- }
- /* SN */
- (*pdu_segment_header_p) |= ((pdu_new_segment_info_p->sn >> 8) & 0x3);
- *(pdu_segment_header_p + 1) = (pdu_new_segment_info_p->sn & 0xFF);
-
- pdu_segment_header_p += 2;
-
- /* Last Segment Flag (LSF) */
- if (lsf)
- {
- RLC_AM_PDU_SET_LSF(*pdu_segment_header_p);
- }
- /* Store SO bytes */
- * (pdu_segment_header_p ) |= ((pdu_new_segment_info_p->so >> 8) & 0x7F);
- * (pdu_segment_header_p + 1) = pdu_new_segment_info_p->so & 0xFF;
-
- if (num_li) {
- uint16_t index = 0;
- uint16_t temp = 0;
- uint8_t li_bit_offset = 4; /* toggle between 0 and 4 */
- uint8_t li_jump_offset = 1; /* toggle between 1 and 2 */
-
- /* loop on nb of LIs */
- pdu_segment_header_p += 2;
-
- while (index < num_li)
- {
- /* Set E bit for next LI if present */
- if (index < num_li - 1)
- RLC_SET_BIT(temp,li_bit_offset + RLC_AM_LI_BITS);
- /* Set LI */
- RLC_AM_PDU_SET_LI(temp,new_li_list[index],li_bit_offset);
- *pdu_segment_header_p = temp >> 8;
- *(pdu_segment_header_p + 1) = temp & 0xFF;
- pdu_segment_header_p += li_jump_offset;
- li_bit_offset ^= 0x4;
- li_jump_offset ^= 0x3;
-
- temp = ((*pdu_segment_header_p) << 8) | (*(pdu_segment_header_p + 1));
- index ++;
- }
- }
-
- /* copy data part */
- /* Fill mem_block contexts */
- ((struct mac_tb_ind *) (new_segment_p->data))->first_bit = 0;
- ((struct mac_tb_ind *) (new_segment_p->data))->data_ptr = (uint8_t*)&new_segment_p->data[sizeof (mac_rlc_max_rx_header_size_t)];
- ((struct mac_tb_ind *) (new_segment_p->data))->size = data_length_to_copy + header_size;
- memcpy(pdu_new_segment_info_p->payload,pdu_rx_info_p->payload + so_offset,data_length_to_copy);
- }
-
- return new_segment_p;
-}
-
-rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu_segment(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP,
- mem_block_t* const tb_pP)
-{
- rlc_am_pdu_info_t* pdu_rx_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
- rlc_am_pdu_info_t* pdu_info_cursor_p = NULL;
- rlc_am_pdu_info_t* pdu_info_previous_cursor_p = NULL;
- mem_block_t* cursor_p = rlc_pP->receiver_buffer.head;
- mem_block_t* previous_cursor_p = NULL;
- mem_block_t* next_cursor_p = NULL;
- uint16_t so_start_min = 0;
- uint16_t so_end = 0;
- uint16_t so_start_segment = pdu_rx_info_p->so;
- uint16_t so_end_segment = pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1;
-
- /*****************************************************/
- // 1) Find previous cursor to the PDU to insert
- /*****************************************************/
-//Assertion(eNB)_PRAN_DesignDocument_annex No.791
- if(cursor_p == NULL)
- {
- LOG_E(RLC, "AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
- return RLC_AM_DATA_PDU_STATUS_HEADER_ERROR;
- }
-/*
- AssertFatal(cursor_p != NULL,"AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
-*/
- do {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
-
- // Stop if Cursor SN >= Received SN
- if (RLC_AM_DIFF_SN(pdu_info_cursor_p->sn,rlc_pP->vr_r) >= RLC_AM_DIFF_SN(pdu_rx_info_p->sn,rlc_pP->vr_r)) {
- break;
- }
-
- previous_cursor_p = cursor_p;
- pdu_info_previous_cursor_p = pdu_info_cursor_p;
- cursor_p = cursor_p->next;
- } while (cursor_p != NULL);
-
- /*****************************************************/
- // 2) Store the received Segment
- /*****************************************************/
- // First case : cursor_p is NULL or its SN is different from the received one, it means the SN is received for the first time
- // Insert PDU after previous_cursor_p
- if ((cursor_p == NULL) || (pdu_info_cursor_p->sn != pdu_rx_info_p->sn)) {
- if (previous_cursor_p != NULL) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT SN=%d] PDU SEGMENT INSERTED AFTER PDU SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_rx_info_p->sn,
- pdu_info_previous_cursor_p->sn);
- list2_insert_after_element(tb_pP, previous_cursor_p, &rlc_pP->receiver_buffer);
- }
- else { /* SN of head of Rx PDU list is higher than received PDU SN */
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT SN=%d] PDU SEGMENT INSERTED BEFORE PDU SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_rx_info_p->sn,
- pdu_info_cursor_p->sn);
- list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
- }
-
- return RLC_AM_DATA_PDU_STATUS_OK;
- }
-
- /********************************************/
- /* Now handle case cursor->sn = received SN */
- /********************************************/
-
- rlc_am_rx_pdu_management_t * pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
-
- // Filter out SN duplicate
- if (pdu_cursor_mgnt_p->all_segments_received) {
- return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
- }
-
- // Try to catch a segment duplicate
- next_cursor_p = cursor_p;
- while ((next_cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn)) {
- if ((so_start_segment >= pdu_info_cursor_p->so) && (so_end_segment <= pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size - 1)) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT] DISCARD : DUPLICATE SEGMENT SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_rx_info_p->sn);
- return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
- }
- next_cursor_p = next_cursor_p->next;
- if (next_cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(next_cursor_p->data))->pdu_info;
- }
- }
-
- // Reset pdu_info_cursor_p because of the loop before
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
-
- // Try to Handle the most likely cases first
- if (pdu_info_cursor_p->so == 0) {
-
- /* Loop on stored segments and find the stored segment containing received SOStart */
- previous_cursor_p = cursor_p;
- pdu_info_previous_cursor_p = pdu_info_cursor_p;
- while ((cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn)
- && ((pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size) <= so_start_segment)) {
- previous_cursor_p = cursor_p;
- pdu_info_previous_cursor_p = pdu_info_cursor_p;
- cursor_p = cursor_p->next;
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- }
-
- // Most likely case : no duplicate, the segment is put after all stored segments which are contiguous
- if ((cursor_p == NULL) || (pdu_info_cursor_p->sn != pdu_rx_info_p->sn) || (pdu_info_cursor_p->so > so_end_segment)) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT SN=%d SOSTART=%d] PDU SEGMENT INSERTED AFTER PDU SEGMENT WITH SOEND=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_rx_info_p->sn,so_start_segment,
- pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1);
-
- list2_insert_after_element(tb_pP, previous_cursor_p, &rlc_pP->receiver_buffer);
- return RLC_AM_DATA_PDU_STATUS_OK;
- }
-
- // Duplicate case : Resume contiguous scan and update previous_cursor_p
- so_start_min = pdu_info_previous_cursor_p->so;
- so_end = so_start_min + pdu_info_previous_cursor_p->payload_size;
- cursor_p = previous_cursor_p->next;
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- while ((cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn)
- && (pdu_info_cursor_p->so == so_end)) {
- previous_cursor_p = cursor_p;
- pdu_info_previous_cursor_p = pdu_info_cursor_p;
- so_end += pdu_info_cursor_p->payload_size;
- cursor_p = cursor_p->next;
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- }
-
- /* Now discard the PDU segment if it is within so_start_min and so_end */
- if ((so_start_min <= so_start_segment) && (so_end_segment <= so_end - 1)) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT] DISCARD : DUPLICATE SEGMENT SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_rx_info_p->sn);
- return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
- }
-
- // Discard potential embedded segments in the received PDU segment
- // The first one is discontigous
- next_cursor_p = cursor_p;
- while ((next_cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn) &&
- (so_end_segment >= pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size - 1)) {
- /* Discard the segment */
- cursor_p = next_cursor_p;
- next_cursor_p = next_cursor_p->next;
- list2_remove_element (cursor_p, &rlc_pP->receiver_buffer);
- free_mem_block(cursor_p, __func__);
-
- if (next_cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(next_cursor_p->data))->pdu_info;
- }
- }
- cursor_p = next_cursor_p;
-
- //Remove duplicate at the begining
- if (so_start_segment < pdu_info_previous_cursor_p->so) {
- so_start_segment = pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size;
- }
- else if (so_start_segment < pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size){
- so_start_segment += (pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - so_start_segment);
- }
-
- // Now remove duplicate at the end, only valid if cursor_p SN has the same received SN
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(next_cursor_p->data))->pdu_info;
-
- if ((pdu_info_cursor_p->sn == pdu_rx_info_p->sn) && (so_end_segment >= pdu_info_cursor_p->so)) {
- so_end_segment = pdu_info_cursor_p->so - 1;
- }
- }
-
-//Assertion(eNB)_PRAN_DesignDocument_annex No.792
- if((so_start_segment > so_end_segment) || (pdu_rx_info_p->so > so_start_segment) ||
- (so_end_segment > pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
- {
- LOG_E(RLC, " AM RX PDU Segment Duplicate elimination error FirstSO=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
- pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
- return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
- }
-/*
- AssertFatal((so_start_segment <= so_end_segment) && (pdu_rx_info_p->so <= so_start_segment) &&
- (so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
- " AM RX PDU Segment Duplicate elimination error FirstSO=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
- pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
-*/
- } // end pdu_info_cursor_p->so == 0
- else {
- // Handle most likely case : PDU Segment without duplicate is inserted before first stored PDU segment
- if (so_end_segment < pdu_info_cursor_p->so) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT SN=%d SOSTART=%d SOEND=%d] PDU SEGMENT INSERTED BEFORE PDU SEGMENT WITH SOSTART=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_rx_info_p->sn,so_start_segment,so_end_segment,
- pdu_info_cursor_p->so);
-
- list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
- return RLC_AM_DATA_PDU_STATUS_OK;
- }
-
- // Handle duplicate case
- if (so_start_segment < pdu_info_cursor_p->so) {
- // First Case : only duplicate at the end
- // Scan for embedded segments to be discarded
- next_cursor_p = cursor_p;
- while ((next_cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn) &&
- (so_end_segment >= pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size - 1)) {
- /* Discard the segment */
- cursor_p = next_cursor_p;
- next_cursor_p = next_cursor_p->next;
- list2_remove_element (cursor_p, &rlc_pP->receiver_buffer);
- free_mem_block(cursor_p, __func__);
-
- if (next_cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(next_cursor_p->data))->pdu_info;
- }
- }
- cursor_p = next_cursor_p;
-
- // Now remove duplicate at the end, only valid if cursor_p SN has the same received SN
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(next_cursor_p->data))->pdu_info;
-
- if ((pdu_info_cursor_p->sn == pdu_rx_info_p->sn) && (so_end_segment >= pdu_info_cursor_p->so)) {
- so_end_segment = pdu_info_cursor_p->so - 1;
- }
- }
-//Assertion(eNB)_PRAN_DesignDocument_annex No.793
- if((so_start_segment > so_end_segment) ||
- (so_end_segment > pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
- {
- LOG_E(RLC, " AM RX PDU Segment Duplicate elimination at the end error FirstSO!=0 SOStart=%d OldSOEnd=%d newSOEnd =%d SN=%d\n",
- pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_end_segment,pdu_rx_info_p->sn);
- return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
- }
-/*
- AssertFatal((so_start_segment <= so_end_segment) &&
- (so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
- " AM RX PDU Segment Duplicate elimination at the end error FirstSO!=0 SOStart=%d OldSOEnd=%d newSOEnd =%d SN=%d\n",
- pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_end_segment,pdu_rx_info_p->sn);
-*/
- }
- else {
- // Second Case: Duplicate at the begining and potentially at the end
- /* Loop on stored segments and find the stored segment containing received SOStart */
-
- previous_cursor_p = cursor_p;
- pdu_info_previous_cursor_p = pdu_info_cursor_p;
- while ((cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn)
- && ((pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size) <= so_start_segment)) {
- previous_cursor_p = cursor_p;
- pdu_info_previous_cursor_p = pdu_info_cursor_p;
- cursor_p = cursor_p->next;
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- }
-
- // Most likely case : no duplicate, the segment is put after all stored segments which are contiguous
- if ((cursor_p == NULL) || (pdu_info_cursor_p->sn != pdu_rx_info_p->sn) || (pdu_info_cursor_p->so > so_end_segment)) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT SN=%d SOSTART=%d] PDU SEGMENT INSERTED AFTER PDU SEGMENT WITH SOEND=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_rx_info_p->sn,so_start_segment,
- pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1);
-
- list2_insert_after_element(tb_pP, previous_cursor_p, &rlc_pP->receiver_buffer);
- return RLC_AM_DATA_PDU_STATUS_OK;
- }
-
- // Now look for contiguous segments to check whether the received segment is not fully duplicate
- so_start_min = pdu_info_previous_cursor_p->so;
- so_end = so_start_min + pdu_info_previous_cursor_p->payload_size;
- cursor_p = previous_cursor_p->next;
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- while ((cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn)
- && (pdu_info_cursor_p->so == so_end)) {
- previous_cursor_p = cursor_p;
- pdu_info_previous_cursor_p = pdu_info_cursor_p;
- so_end += pdu_info_cursor_p->payload_size;
- cursor_p = cursor_p->next;
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- }
-
- /* Now discard the PDU segment if it is within so_start_min and so_end */
- if ((so_start_min <= so_start_segment) && (so_end_segment < so_end)) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT] DISCARD : DUPLICATE SEGMENT SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_rx_info_p->sn);
- return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
- }
-
- //Remove duplicate at the begining
- if (so_start_segment < pdu_info_previous_cursor_p->so) {
- so_start_segment = pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size;
- }
- else if (so_start_segment < pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size){
- so_start_segment += (pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - so_start_segment);
- }
-
-
- // Now Scan for embedded segments to be discarded
- next_cursor_p = cursor_p;
- while ((next_cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn) &&
- (so_end_segment >= pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size - 1)) {
- /* Discard the segment */
- cursor_p = next_cursor_p;
- next_cursor_p = next_cursor_p->next;
- list2_remove_element (cursor_p, &rlc_pP->receiver_buffer);
- free_mem_block(cursor_p, __func__);
-
- if (next_cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(next_cursor_p->data))->pdu_info;
- }
- }
- cursor_p = next_cursor_p;
-
- // Now remove duplicate at the end, only valid if cursor_p SN has the same received SN
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(next_cursor_p->data))->pdu_info;
-
- if ((pdu_info_cursor_p->sn == pdu_rx_info_p->sn) && (so_end_segment >= pdu_info_cursor_p->so)) {
- so_end_segment = pdu_info_cursor_p->so - 1;
- }
- }
-//Assertion(eNB)_PRAN_DesignDocument_annex No.794
- if((so_start_segment > so_end_segment) || (pdu_rx_info_p->so > so_start_segment) ||
- (so_end_segment > pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
- {
- LOG_E(RLC, " AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
- pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
- return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
- }
-/*
- AssertFatal((so_start_segment <= so_end_segment) && (pdu_rx_info_p->so <= so_start_segment) &&
- (so_end_segment <= pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
- " AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
- pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
-*/
- }
-
- } // end pdu_info_cursor_p->so != 0
-
-
- /* Last step : duplicate bytes had been removed, build a new PDU segment */
-//Assertion(eNB)_PRAN_DesignDocument_annex No.795
- if((pdu_rx_info_p->so == so_start_segment) && (so_end_segment == pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1))
- {
- LOG_E(RLC, " AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
- pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
- return RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE;
- }
-/*
- AssertFatal((pdu_rx_info_p->so != so_start_segment) || (so_end_segment != pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1),
- " AM RX PDU Segment Duplicate elimination error FirstSO!=0 OldSOStart=%d OldSOEnd=%d newSOStart=%d newSOEnd =%d SN=%d\n",
- pdu_rx_info_p->so,pdu_rx_info_p->so + pdu_rx_info_p->payload_size - 1,so_start_segment,so_end_segment,pdu_rx_info_p->sn);
-*/
- mem_block_t* trunc_segment = create_new_segment_from_pdu(tb_pP,so_start_segment - pdu_rx_info_p->so,so_end_segment - so_start_segment + 1);
- if (trunc_segment != NULL) {
- LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SEGMENT] CREATE SEGMENT FROM SEGMENT OFFSET=%d DATA LENGTH=%d SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),so_start_segment - pdu_rx_info_p->so,so_end_segment - so_start_segment + 1,pdu_rx_info_p->sn);
-
- if (previous_cursor_p != NULL) {
- list2_insert_after_element(trunc_segment, previous_cursor_p, &rlc_pP->receiver_buffer);
- }
- else {
- list2_insert_before_element(trunc_segment, rlc_pP->receiver_buffer.head, &rlc_pP->receiver_buffer);
- }
-
- /* Free original PDU Segment */
- free_mem_block(tb_pP, __func__);
-
- return RLC_AM_DATA_PDU_STATUS_OK;
- }
- else {
- return RLC_AM_DATA_PDU_STATUS_BUFFER_FULL;
- }
-
-}
-
-rlc_am_rx_pdu_status_t rlc_am_rx_list_handle_pdu(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP,
- mem_block_t* const tb_pP)
-{
- rlc_am_pdu_info_t* pdu_rx_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
- rlc_am_pdu_info_t* pdu_info_cursor_p = NULL;
- mem_block_t* cursor_p = rlc_pP->receiver_buffer.head;
- mem_block_t* previous_cursor_p = NULL;
- rlc_am_rx_pdu_status_t pdu_status = RLC_AM_DATA_PDU_STATUS_OK;
- // it is assumed this pdu is in rx window
-
-
- /*****************************************************/
- // 1) Find previous cursor to the PDU to insert
- /*****************************************************/
-//Assertion(eNB)_PRAN_DesignDocument_annex No.788
- if(cursor_p == NULL)
- {
- LOG_E(RLC, "AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
- return RLC_AM_DATA_PDU_STATUS_HEADER_ERROR;
- }
-/*
- AssertFatal(cursor_p != NULL,"AM Rx PDU Error, received buffer empty LcID=%d\n",rlc_pP->channel_id);
-*/
- do {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
-
- // Stop if Cursor SN >= Received SN
- if (RLC_AM_DIFF_SN(pdu_info_cursor_p->sn,rlc_pP->vr_r) >= RLC_AM_DIFF_SN(pdu_rx_info_p->sn,rlc_pP->vr_r)) {
- break;
- }
-
- previous_cursor_p = cursor_p;
- cursor_p = cursor_p->next;
- } while (cursor_p != NULL);
-
- /*****************************************************/
- // 2) Insert PDU by removing byte duplicate if required
- /*****************************************************/
- // First case : cursor_p is NULL or SN are different, it means the SN is received for the first time
- // Insert PDU after previous_cursor_p
- if ((cursor_p == NULL) || (pdu_info_cursor_p->sn != pdu_rx_info_p->sn)) {
- if (previous_cursor_p != NULL) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SN=%d] PDU INSERTED AFTER PDU SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_rx_info_p->sn,
- ((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info.sn);
- list2_insert_after_element(tb_pP, previous_cursor_p, &rlc_pP->receiver_buffer);
- }
- else { /* SN of head of Rx PDU list is higher than received PDU SN */
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU SN=%d] PDU INSERTED BEFORE PDU SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_rx_info_p->sn,
- pdu_info_cursor_p->sn);
- list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
- }
-
- return pdu_status;
- }
-
- // Filter out SN duplicate
- // SN of received PDU has already data stored
- rlc_am_rx_pdu_management_t * pdu_cursor_mgnt_p = (rlc_am_rx_pdu_management_t *) (cursor_p->data);
-
- if (pdu_cursor_mgnt_p->all_segments_received) {
- return RLC_AM_DATA_PDU_STATUS_SN_DUPLICATE;
- }
-
- /* check if the received PDU is equal to vrR */
- if ((pdu_rx_info_p->sn != rlc_pP->vr_r) || (pdu_info_cursor_p->so != 0)) {
- /* The full received PDU can replace the allready received PDU Segments. */
- /* clean them and append this PDU */
- mem_block_t* cursor_next_p = cursor_p;
- while (cursor_next_p) {
- cursor_p = cursor_next_p;
- cursor_next_p = cursor_next_p->next;
- list2_remove_element (cursor_p, &rlc_pP->receiver_buffer);
- free_mem_block(cursor_p, __func__);
- if (cursor_next_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_next_p->data))->pdu_info;
- if (pdu_info_cursor_p->sn != pdu_rx_info_p->sn) {
- break;
- }
- }
- }
-
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU REPLACES STORED PDU SEGMENTS SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_rx_info_p->sn);
-
- if (previous_cursor_p != NULL) {
- list2_insert_after_element(tb_pP, previous_cursor_p, &rlc_pP->receiver_buffer);
- }
- else {
- list2_insert_before_element(tb_pP, cursor_next_p, &rlc_pP->receiver_buffer);
- }
-
- return pdu_status;
- } // End SN != vrR or SO != 0
- else {
- /* First update cursor until discontinuity */
- previous_cursor_p = cursor_p;
-//Assertion(eNB)_PRAN_DesignDocument_annex No.789
- if(pdu_info_cursor_p->rf == 0)
- {
- LOG_E(RLC, "AM Rx PDU Error, stored SN=%d should be a PDU segment\n",pdu_info_cursor_p->sn);
- return RLC_AM_DATA_PDU_STATUS_HEADER_ERROR;
- }
-/*
- AssertFatal(pdu_info_cursor_p->rf != 0,"AM Rx PDU Error, stored SN=%d should be a PDU segment\n",pdu_info_cursor_p->sn);
-*/
-//Assertion(eNB)_PRAN_DesignDocument_annex No.790
- if(((rlc_am_rx_pdu_management_t *) (cursor_p->data))->all_segments_received != 0)
- {
- LOG_E(RLC, "AM Rx PDU Error, stored SN=%d already fully received\n",pdu_info_cursor_p->sn);
- return RLC_AM_DATA_PDU_STATUS_SN_DUPLICATE;
- }
-/*
- AssertFatal(((rlc_am_rx_pdu_management_t *) (cursor_p->data))->all_segments_received == 0,
- "AM Rx PDU Error, stored SN=%d already fully received\n",pdu_info_cursor_p->sn);
-*/
- sdu_size_t next_waited_so = 0;
- while ((cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn) && (pdu_info_cursor_p->so == next_waited_so)) {
- next_waited_so += pdu_info_cursor_p->payload_size;
- previous_cursor_p = cursor_p;
- cursor_p = cursor_p->next;
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- }
- /* Create a new PDU segment by removing first next_waited_so bytes */
- mem_block_t* trunc_pdu = create_new_segment_from_pdu(tb_pP,next_waited_so,pdu_rx_info_p->payload_size - next_waited_so);
-
- if (trunc_pdu != NULL) {
- /* Insert PDU Segment */
- list2_insert_after_element(trunc_pdu, previous_cursor_p, &rlc_pP->receiver_buffer);
-
- LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] CREATE PDU SEGMENT FROM PDU OFFSET =%d SN=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),next_waited_so,pdu_rx_info_p->sn);
-
- /* clean previous stored segments in duplicate */
- if ((cursor_p != NULL) && (pdu_info_cursor_p->sn == pdu_rx_info_p->sn)) {
- mem_block_t* cursor_next_p = cursor_p;
- while (cursor_next_p) {
- cursor_p = cursor_next_p;
- cursor_next_p = cursor_next_p->next;
- list2_remove_element (cursor_p, &rlc_pP->receiver_buffer);
- free_mem_block(cursor_p, __func__);
- if (cursor_next_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_next_p->data))->pdu_info;
- if (pdu_info_cursor_p->sn != pdu_rx_info_p->sn) {
- break;
- }
- }
- }
- }
-
- /* Free original PDU */
- free_mem_block(tb_pP, __func__);
-
- return pdu_status;
- }
- else {
- return RLC_AM_DATA_PDU_STATUS_BUFFER_FULL;
- }
- }
-}
-
-// returns 0 if success
-// returns neg value if failure
-//-----------------------------------------------------------------------------
-rlc_am_rx_pdu_status_t
-rlc_am_rx_list_check_duplicate_insert_pdu(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP,
- mem_block_t* const tb_pP)
-{
- rlc_am_pdu_info_t* pdu_rx_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
- mem_block_t* cursor_p = NULL;
- cursor_p = rlc_pP->receiver_buffer.head;
- rlc_am_rx_pdu_status_t pdu_status = RLC_AM_DATA_PDU_STATUS_OK;
- // it is assumed this pdu is in rx window
-
- /* Init Reassembly status */
- ((rlc_am_rx_pdu_management_t*)(tb_pP->data))->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO;
-
- if (cursor_p == NULL) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (only inserted)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- pdu_rx_info_p->sn);
- list2_add_head(tb_pP, &rlc_pP->receiver_buffer);
- return pdu_status;
- }
-
-
- if (pdu_rx_info_p->rf == 0) { // Case normal PDU received
- pdu_status = rlc_am_rx_list_handle_pdu(ctxt_pP,rlc_pP,tb_pP);
- }
- else {
- pdu_status = rlc_am_rx_list_handle_pdu_segment(ctxt_pP,rlc_pP,tb_pP);
- }
-
- return pdu_status;
-}
-
-//-----------------------------------------------------------------------------
-void
-rlc_am_rx_check_all_byte_segments(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP,
- mem_block_t* const tb_pP)
-{
- rlc_am_pdu_info_t *pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
- mem_block_t *cursor_p = NULL;
- mem_block_t *first_cursor_p = NULL;
- rlc_usn_t sn = pdu_info_p->sn;
- sdu_size_t next_waited_so;
- sdu_size_t last_end_so;
-
- //msg("rlc_am_rx_check_all_byte_segments(%d) @0\n",sn);
- if (pdu_info_p->rf == 0) {
- ((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received = 1;
- return;
- }
-
- // for re-segmented AMD PDUS
- cursor_p = tb_pP;
- //list2_init(&list, NULL);
- //list2_add_head(cursor_p, &list);
- //msg("rlc_am_rx_check_all_byte_segments(%d) @1\n",sn);
-
- // get all previous PDU with same SN
- while (cursor_p->previous != NULL) {
- if (((rlc_am_rx_pdu_management_t*)(cursor_p->previous->data))->pdu_info.sn == sn) {
- //list2_add_head(cursor_p->previous, &list);
- cursor_p = cursor_p->previous;
- //msg("rlc_am_rx_check_all_byte_segments(%d) @2\n",sn);
- } else {
- break;
- }
- }
-
- // in case all first segments up to tb_pP are in list
- // the so field of the first PDU should be 0
- //cursor_p = list.head;
- //we start from the first stored PDU segment of this SN
- if(cursor_p->data == NULL){
- return;
- }
- pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
-
- // if the first segment does not have SO = 0 then no need to continue
- if (pdu_info_p->so != 0) {
- return;
- }
-
- //msg("rlc_am_rx_check_all_byte_segments(%d) @3\n",sn);
- next_waited_so = pdu_info_p->payload_size;
- first_cursor_p = cursor_p;
- // then check if all segments are contiguous
- last_end_so = pdu_info_p->payload_size;
-
- while (cursor_p->next != NULL) {
- //msg("rlc_am_rx_check_all_byte_segments(%d) @4\n",sn);
- cursor_p = cursor_p->next;
- if(cursor_p->data == NULL){
- return;
- }
- pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
-
- if (pdu_info_p->sn == sn) {
- // extra check normally not necessary
- if (
- !(pdu_info_p->rf == 1) ||
- !(pdu_info_p->so <= last_end_so)
- ) {
- //msg("rlc_am_rx_check_all_byte_segments(%d) @5 pdu_info_p->rf %d pdu_info_p->so %d\n",sn, pdu_info_p->rf, pdu_info_p->so);
- return;
- } else {
- if (pdu_info_p->so == next_waited_so) {
- next_waited_so = next_waited_so + pdu_info_p->payload_size;
- //msg("rlc_am_rx_check_all_byte_segments(%d) @6\n",sn);
- } else { // assumed pdu_info_p->so + pdu_info_p->payload_size > next_waited_so
- //next_waited_so = (next_waited_so + pdu_info_p->payload_size) - (next_waited_so - pdu_info_p->so);
- //msg("rlc_am_rx_check_all_byte_segments(%d) @7\n",sn);
- return;
- }
-
- if (pdu_info_p->lsf > 0) {
- //msg("rlc_am_rx_check_all_byte_segments(%d) @8\n",sn);
- rlc_am_rx_mark_all_segments_received(ctxt_pP, rlc_pP, first_cursor_p);
- return;
- }
- }
-
- last_end_so = pdu_info_p->so + pdu_info_p->payload_size;
- } else {
- //msg("rlc_am_rx_check_all_byte_segments(%d) @9\n",sn);
- return;
- }
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_rx_mark_all_segments_received(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP,
- mem_block_t* const fisrt_segment_tbP)
-{
- rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(fisrt_segment_tbP->data))->pdu_info;
- rlc_am_pdu_info_t* pdu_info_cursor_p = NULL;
- mem_block_t* cursor_p = NULL;
- rlc_sn_t sn = pdu_info_p->sn;
-
- cursor_p = fisrt_segment_tbP;
-
- if (cursor_p) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] ALL SEGMENTS RECEIVED SN %04d:\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sn);
-
- do {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
-
- if (pdu_info_cursor_p->sn == sn) {
- ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received = 1;
- } else {
- return;
- }
-
- cursor_p = cursor_p->next;
- } while (cursor_p != NULL);
- }
-}
-//-----------------------------------------------------------------------------
-//#define RLC_AM_DEBUG_REASSEMBLY
-void
-rlc_am_rx_list_reassemble_rlc_sdus(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP)
-{
- mem_block_t* cursor_p = NULL;
- rlc_am_rx_pdu_management_t* rlc_am_rx_old_pdu_management = NULL;
- rlc_am_pdu_info_t* pdu_info_p = NULL;
-
- cursor_p = list2_get_head(&rlc_pP->receiver_buffer);
-
- if (cursor_p == NULL) {
- return;
- }
-
- rlc_am_rx_pdu_management_t* rlc_am_rx_pdu_management_p = ((rlc_am_rx_pdu_management_t*)(cursor_p->data));
- pdu_info_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
-#ifdef RLC_AM_DEBUG_REASSEMBLY
- rlc_usn_t sn_reass_start = pdu_info_p->sn;
-#endif
-
- /* Specific process for the first SN if all PDU segments had been reassembled but not freed */
- if ((rlc_am_rx_pdu_management_p->all_segments_received > 0) && (pdu_info_p->rf != 0)) {
- rlc_sn_t sn = pdu_info_p->sn;
- while ((cursor_p != NULL) && (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLED)
- && ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.sn == sn) {
- cursor_p = list2_remove_head(&rlc_pP->receiver_buffer);
- free_mem_block(cursor_p, __func__);
- cursor_p = list2_get_head(&rlc_pP->receiver_buffer);
- }
-
- /* Reset Management pointers */
- if (cursor_p != NULL) {
- rlc_am_rx_pdu_management_p = ((rlc_am_rx_pdu_management_t*)(cursor_p->data));
- /* Next SN must be the same or SN+1 */
- if (RLC_AM_DIFF_SN(rlc_am_rx_pdu_management_p->pdu_info.sn,sn) > 1) {
- return;
- }
- }
- else {
- return;
- }
- }
-
- do {
- if (rlc_am_rx_pdu_management_p->all_segments_received > 0) {
- cursor_p = list2_remove_head(&rlc_pP->receiver_buffer);
- rlc_am_reassemble_pdu(ctxt_pP, rlc_pP, cursor_p, true);
- rlc_am_rx_old_pdu_management = rlc_am_rx_pdu_management_p;
- cursor_p = list2_get_head(&rlc_pP->receiver_buffer);
-
- if (cursor_p == NULL) {
-#ifdef RLC_AM_DEBUG_REASSEMBLY
- LOG_D(RLC, "RLC AM REASSEMBLY from sn=%d to ALL, vrR=%d vrMS=%d\n",
- sn_reass_start,rlc_pP->vr_r,rlc_pP->vr_ms);
-#endif
- return;
- }
-
- rlc_am_rx_pdu_management_p = ((rlc_am_rx_pdu_management_t*)(cursor_p->data));
- }
- else if (rlc_am_rx_pdu_management_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING) {
- rlc_am_rx_pdu_management_p->segment_reassembled = RLC_AM_RX_PDU_SEGMENT_REASSEMBLED;
-
- rlc_am_reassemble_pdu(ctxt_pP, rlc_pP, cursor_p, false);
- rlc_am_rx_old_pdu_management = rlc_am_rx_pdu_management_p;
- cursor_p = cursor_p->next;
-
- if (cursor_p == NULL) {
-#ifdef RLC_AM_DEBUG_REASSEMBLY
- LOG_D(RLC, "RLC AM REASSEMBLY from sn=%d to ALL, Last is Segment, vrR=%d vrMS=%d\n",
- sn_reass_start,rlc_pP->vr_r,rlc_pP->vr_ms);
-#endif
- return;
- }
-
- rlc_am_rx_pdu_management_p = ((rlc_am_rx_pdu_management_t*)(cursor_p->data));
- }
- else if (rlc_am_rx_pdu_management_p->segment_reassembled == RLC_AM_RX_PDU_SEGMENT_REASSEMBLED) {
- rlc_am_rx_old_pdu_management = rlc_am_rx_pdu_management_p;
- cursor_p = cursor_p->next;
-
- if (cursor_p == NULL) {
- return;
- }
-
- rlc_am_rx_pdu_management_p = ((rlc_am_rx_pdu_management_t*)(cursor_p->data));
- }
- else {
-#if RLC_STOP_ON_LOST_PDU
-
- if (list2_get_head(&rlc_pP->receiver_buffer) != cursor_p) {
- AssertFatal( 0 == 1,
- PROTOCOL_RLC_AM_CTXT_FMT" LOST PDU DETECTED\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- }
-
-#endif
-#ifdef RLC_AM_DEBUG_REASSEMBLY
- LOG_D(RLC, "RLC AM REASSEMBLY from sn=%d to ALL, vrR=%d vrMS=%d\n",
- sn_reass_start,rlc_pP->vr_r,rlc_pP->vr_ms);
-#endif
- return;
- }
-
- } while (((RLC_AM_DIFF_SN(rlc_am_rx_pdu_management_p->pdu_info.sn,rlc_am_rx_old_pdu_management->pdu_info.sn) < 2) && (rlc_am_rx_old_pdu_management->all_segments_received > 0))
- || ((rlc_am_rx_pdu_management_p->pdu_info.sn == rlc_am_rx_old_pdu_management->pdu_info.sn) && (rlc_am_rx_pdu_management_p->segment_reassembled != RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO)));
-
-#ifdef RLC_AM_DEBUG_REASSEMBLY
- mem_block_t* cursor_head_p = list2_get_head(&rlc_pP->receiver_buffer);
- if (cursor_head_p == NULL) {
- return;
- }
-
- rlc_am_pdu_info_t* pdu_info_head_p = &((rlc_am_rx_pdu_management_t*)(cursor_head_p->data))->pdu_info;
-
- LOG_D(RLC, "RLC AM REASSEMBLY from sn=%d to sn=%d, next_sn=%d head sn=%d vrR=%d vrMS=%d\n",
- sn_reass_start,rlc_am_rx_old_pdu_management->pdu_info.sn,rlc_am_rx_pdu_management_p->pdu_info.sn,pdu_info_head_p->sn,rlc_pP->vr_r,rlc_pP->vr_ms);
-#endif
-
-}
-//-----------------------------------------------------------------------------
-mem_block_t *
-list2_insert_before_element (
- mem_block_t * element_to_insert_pP,
- mem_block_t * element_pP,
- list2_t * list_pP)
-{
- if ((element_to_insert_pP != NULL) && (element_pP != NULL)) {
- list_pP->nb_elements = list_pP->nb_elements + 1;
- mem_block_t *previous = element_pP->previous;
- element_to_insert_pP->previous = previous;
- element_to_insert_pP->next = element_pP;
- element_pP->previous = element_to_insert_pP;
-
- if (previous != NULL) {
- previous->next = element_to_insert_pP;
- } else if (list_pP->head == element_pP) {
- list_pP->head = element_to_insert_pP;
- }
-
- return element_to_insert_pP;
- } else {
- //assert(2==1);
- LOG_E(RLC, "list2_insert_before_element error. element_to_insert_pP %p, element_pP %p\n", element_to_insert_pP,element_pP);
- return NULL;
- }
-}
-//-----------------------------------------------------------------------------
-mem_block_t *
-list2_insert_after_element (
- mem_block_t * element_to_insert_pP,
- mem_block_t * element_pP,
- list2_t * list_pP)
-{
-
- if ((element_to_insert_pP != NULL) && (element_pP != NULL)) {
- list_pP->nb_elements = list_pP->nb_elements + 1;
- mem_block_t *next = element_pP->next;
- element_to_insert_pP->previous = element_pP;
- element_to_insert_pP->next = next;
- element_pP->next = element_to_insert_pP;
-
- if (next != NULL) {
- next->previous = element_to_insert_pP;
- } else if (list_pP->tail == element_pP) {
- list_pP->tail = element_to_insert_pP;
- }
-
- return element_to_insert_pP;
- } else {
- //assert(2==1);
- LOG_E(RLC, "list2_insert_after_element error. element_to_insert_pP %p, element_pP %p\n", element_to_insert_pP,element_pP);
- return NULL;
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_rx_list_display (
- const rlc_am_entity_t* const rlc_pP,
- char* message_pP)
-{
- mem_block_t *cursor_p = NULL;
- unsigned int loop = 0;
-
- cursor_p = rlc_pP->receiver_buffer.head;
-
- if (message_pP) {
- LOG_T(RLC, "Display list %s %s VR(R)=%04d:\n", rlc_pP->receiver_buffer.name, message_pP, rlc_pP->vr_r);
- } else {
- LOG_T(RLC, "Display list %s VR(R)=%04d:\n", rlc_pP->receiver_buffer.name, rlc_pP->vr_r);
- }
-
- if (cursor_p) {
- // almost one element
- while (cursor_p != NULL) {
- //if (((loop % 16) == 0) && (loop > 0)) {
- if ((loop % 4) == 0) {
- LOG_T(RLC, "\nRX SN:\t");
- }
-
- if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.rf) {
- if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.lsf) {
- LOG_T(RLC, "%04d (%04d->%04d LSF)\t",
- ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.sn,
- ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.so,
- ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.so + ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.payload_size - 1);
- } else {
- LOG_T(RLC, "%04d (%04d->%04d)\t",
- ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.sn,
- ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.so,
- ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.so + ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.payload_size - 1);
- }
- } else {
- LOG_T(RLC, "%04d (%04d NOSEG)\t",
- ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.sn,
- ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.payload_size);
- }
-
- //if (cursor_p == cursor_p->next) {
- // rlc_am_v9_3_0_test_print_trace();
- //}
- //assert(cursor_p != cursor_p->next);
- if(cursor_p == cursor_p->next)
- {
- LOG_E(RLC, "rlc_am_rx_list_display error. cursor_p %p, cursor_p->next %p\n", cursor_p, cursor_p->next);
- break;
- }
- cursor_p = cursor_p->next;
- loop++;
- }
-
- LOG_T(RLC, "\n");
- } else {
- LOG_T(RLC, "\nNO ELEMENTS\n");
- }
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h
deleted file mode 100644
index f86b1810ca..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_rx_list.h
-* \brief This file defines the prototypes of the functions dealing with a RX list data structure supporting re-segmentation.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_internal_rx_list_impl_ RLC AM RX List Reference Implementation
-* @ingroup _rlc_am_internal_receiver_impl_
-* @{
-*/
-
-#ifndef __RLC_AM_RX_LIST_H__
-# define __RLC_AM_RX_LIST_H__
-
-# include "UTIL/MEM/mem_block.h"
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-#include "common/platform_constants.h"
-//#include "PHY/defs.h"
-
-//-----------------------------------------------------------------------------
-/*! \fn rlc_am_rx_pdu_status_t rlc_am_rx_list_check_duplicate_insert_pdu(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* const rlc_pP,mem_block_t* const tb_pP)
-* \brief Insert a PDU in the RX buffer after removing byte duplicate (implemented with a list).
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] tbP A PDU embedded in a mem_block_t.
-* \return Zero if the PDU could be inserted in the RX buffer, a negative value if the PDU could not be inserted.
-*/
-rlc_am_rx_pdu_status_t rlc_am_rx_list_check_duplicate_insert_pdu(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* const rlc_pP,mem_block_t* const tb_pP);
-
-/*! \fn signed int rlc_am_rx_list_insert_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP , mem_block_t* const tbP)
-* \brief Insert a PDU in the RX buffer (implemented with a list).
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] tbP A PDU embedded in a mem_block_t.
-* \return Zero if the PDU could be inserted in the RX buffer, a negative value if the PDU could not be inserted.
-*/
-signed int rlc_am_rx_list_insert_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP);
-
-/*! \fn bool rlc_am_rx_check_vr_reassemble(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP)
-* \brief Check if reassembly taking into account potential new vrR value
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \return true if reassembly must be done, false else
-*/
-bool rlc_am_rx_check_vr_reassemble(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP);
-
-/*! \fn void rlc_am_rx_check_all_byte_segments(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP)
-* \brief Check if all sub-segments of a PDU are received, if yes then call rlc_am_rx_mark_all_segments_received() procedure.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] tbP A PDU embedded in a mem_block_t.
-*/
-void rlc_am_rx_check_all_byte_segments(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP);
-
-/*! \fn void rlc_am_rx_mark_all_segments_received (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const first_segment_tbP)
-* \brief Mark all PDUs having the same sequence number as first_segment_tbP with the information that all segments have been received.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] first_segment_tbP A PDU embedded in a mem_block_t, it is the first PDU in the RX buffer (list) that have its sequence number.
-*/
-void rlc_am_rx_mark_all_segments_received(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const first_segment_tbP);
-
-/*! \fn void rlc_am_rx_list_reassemble_rlc_sdus(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP)
-* \brief Reassembly all SDUS that it is possible to reassembly by parsing the RX buffer and looking for PDUs having the flag 'all segments received'.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-*/
-void rlc_am_rx_list_reassemble_rlc_sdus(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP);
-
-/*! \fn mem_block_t* list2_insert_before_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP)
-* \brief Insert a PDU embedded in a mem_block_t in a list at a position before a designated element of the list.
-* \param[in] element_to_insertP Element to insert in the list listP, before elementP position.
-* \param[in] elementP Element in the list.
-* \param[in] listP List where elements are linked.
-*/
-mem_block_t* list2_insert_before_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP);
-
-/*! \fn mem_block_t* list2_insert_after_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP)
-* \brief Insert a PDU embedded in a mem_block_t in a list at a position after a designated element of the list.
-* \param[in] element_to_insertP Element to insert in the list listP, after elementP position.
-* \param[in] elementP Element in the list.
-* \param[in] listP List where elements are linked.
-*/
-mem_block_t* list2_insert_after_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP);
-
-/*! \fn void rlc_am_rx_list_display (const rlc_am_entity_t* const rlcP, char* messageP)
-* \brief Display the dump of the RX buffer.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] messageP Message to be displayed along with the display of the dump of the RX buffer.
-*/
-void rlc_am_rx_list_display (const rlc_am_entity_t* const rlcP, char* messageP);
-/** @} */
-#endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c
deleted file mode 100644
index 9e7c3338f8..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c
+++ /dev/null
@@ -1,566 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_SEGMENT_C 1
-//-----------------------------------------------------------------------------
-#include
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-//-----------------------------------------------------------------------------
-#include "list.h"
-#include "rlc_am.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-
-//-----------------------------------------------------------------------------
-void rlc_am_pdu_polling(const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- rlc_am_pdu_sn_10_t *const pdu_pP,
- const int16_t payload_sizeP,
- bool is_new_pdu)
-{
- // 5.2.2 Polling
- // An AM RLC entity can poll its peer AM RLC entity in order to trigger STATUS reporting at the peer AM RLC entity.
- // 5.2.2.1 Transmission of a AMD PDU or AMD PDU segment
- // Upon assembly of a new AMD PDU, the transmitting side of an AM RLC entity shall:
- // - increment PDU_WITHOUT_POLL by one;
- // - increment BYTE_WITHOUT_POLL by every new byte of Data field element that it maps to the Data field of
- // the RLC data PDU;
- // - if PDU_WITHOUT_POLL >= pollPDU; or
- // - if BYTE_WITHOUT_POLL >= pollByte;
- // -include a poll in the RLC data PDU as described below.
- // Upon assembly of an AMD PDU or AMD PDU segment, the transmitting side of an AM RLC entity shall:
- // - if both the transmission buffer and the retransmission buffer becomes empty (excluding transmitted RLC data
- // PDU awaiting for acknowledgements) after the transmission of the RLC data PDU; or
- // - if no new RLC data PDU can be transmitted after the transmission of the RLC data PDU (e.g. due to window
- // stalling);
- // - include a poll in the RLC data PDU as described below.
- // To include a poll in a RLC data PDU, the transmitting side of an AM RLC entity shall:
- // - set the P field of the RLC data PDU to "1";
- // - set PDU_WITHOUT_POLL to 0;
- // - set BYTE_WITHOUT_POLL to 0;
- // After delivering a RLC data PDU including a poll to lower layer and after incrementing of VT(S) if necessary, the
- // transmitting side of an AM RLC entity shall:
- // - set POLL_SN to VT(S) – 1;
- // - if t-PollRetransmit is not running:
- // - start t-PollRetransmit;
- // - else:
- // - restart t-PollRetransmit;
-
- if (is_new_pdu) {
- if (rlc_pP->poll_pdu != RLC_AM_POLL_PDU_INFINITE) {
- rlc_pP->c_pdu_without_poll += 1;
- }
-
- if (rlc_pP->poll_byte != RLC_AM_POLL_BYTE_INFINITE) {
- rlc_pP->c_byte_without_poll += payload_sizeP;
- }
- }
-
- if (
- ((is_new_pdu) && ((rlc_pP->c_pdu_without_poll >= rlc_pP->poll_pdu) ||
- (rlc_pP->c_byte_without_poll >= rlc_pP->poll_byte))) ||
- ((rlc_pP->sdu_buffer_occupancy == 0) && (rlc_pP->retrans_num_bytes_to_retransmit == 0)) ||
- (rlc_pP->vt_s == rlc_pP->vt_ms) ||
- (rlc_pP->force_poll == true)
- ) {
- rlc_pP->force_poll = false;
-
- if ((is_new_pdu) && (rlc_pP->c_pdu_without_poll >= rlc_pP->poll_pdu)) {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[POLL] SET POLL BECAUSE TX NUM PDU THRESHOLD %d HAS BEEN REACHED\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->poll_pdu);
- }
- if ((is_new_pdu) && (rlc_pP->c_byte_without_poll >= rlc_pP->poll_byte)) {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[POLL] SET POLL BECAUSE TX NUM BYTES THRESHOLD %d HAS BEEN REACHED\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->poll_byte);
- }
- if ((rlc_pP->sdu_buffer_occupancy == 0) && (rlc_pP->retrans_num_bytes_to_retransmit == 0)) {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[POLL] SET POLL BECAUSE TX BUFFERS ARE EMPTY\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- }
- if (rlc_pP->vt_s == rlc_pP->vt_ms) {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[POLL] SET POLL BECAUSE OF WINDOW STALLING\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- }
-
- RLC_AM_PDU_SET_POLL(pdu_pP->b1);
- rlc_pP->c_pdu_without_poll = 0;
- rlc_pP->c_byte_without_poll = 0;
-
- // vt_s shall have been updated before in case of new transmission
- rlc_pP->poll_sn = RLC_AM_PREV_SN(rlc_pP->vt_s);
- //optimisation if (!rlc_pP->t_poll_retransmit.running) {
- rlc_am_start_timer_poll_retransmit(ctxt_pP, rlc_pP);
- //optimisation } else {
- //optimisation rlc_pP->t_poll_retransmit.frame_time_out = ctxt_pP->frame + rlc_pP->t_poll_retransmit.time_out;
- //optimisation }
- } else {
- // Need to clear poll bit as it may be a copy(retransmission case) of the original RLC PDU which was containing a poll
- RLC_AM_PDU_CLEAR_POLL(pdu_pP->b1);
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_am_segment_10 (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP)
-{
- list_t pdus;
- sdu_size_t pdu_remaining_size = 0;
- sdu_size_t test_pdu_remaining_size = 0;
-
- sdu_size_t nb_bytes_to_transmit = rlc_pP->nb_bytes_requested_by_mac;
- rlc_am_pdu_sn_10_t *pdu_p = NULL;
- struct mac_tb_req *pdu_tb_req_p = NULL;
- mem_block_t *pdu_mem_p = NULL;
- unsigned char *data = NULL;
- unsigned char *data_sdu_p = NULL;
- rlc_am_e_li_t *e_li_p = NULL;
- rlc_am_tx_sdu_management_t *sdu_mngt_p = NULL;
- rlc_am_tx_data_pdu_management_t *pdu_mngt_p = NULL;
-
- sdu_size_t li_length_in_bytes = 0;
- sdu_size_t test_li_length_in_bytes = 0;
- sdu_size_t test_remaining_size_to_substract= 0;
- unsigned int test_remaining_num_li_to_substract = 0;
- unsigned int continue_fill_pdu_with_sdu = 0;
- unsigned int num_fill_sdu = 0;
- unsigned int test_num_li = 0;
- unsigned int fill_num_li = 0;
- unsigned int sdu_buffer_index = 0;
- sdu_size_t data_pdu_size = 0;
-
- unsigned int fi_first_byte_pdu_is_first_byte_sdu = 0;
- unsigned int fi_last_byte_pdu_is_last_byte_sdu = 0;
- unsigned int fi = 0;
- signed int max_li_overhead = 0;
-
- LOG_T(RLC,
- PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] rlc_pP->current_sdu_index %d rlc_pP->next_sdu_index %d rlc_pP->input_sdus[rlc_pP->current_sdu_index].mem_block %p sdu_buffer_occupancy %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->current_sdu_index,
- rlc_pP->next_sdu_index,
- rlc_pP->input_sdus[rlc_pP->current_sdu_index].mem_block,
- rlc_pP->sdu_buffer_occupancy);
-
- if (rlc_pP->sdu_buffer_occupancy <= 0) {
- return;
- }
-
- //msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT]\n", rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame);
- list_init (&pdus, NULL); // param string identifying the list is NULL
- pdu_mem_p = NULL;
-
-
- RLC_AM_MUTEX_LOCK(&rlc_pP->lock_input_sdus, ctxt_pP, rlc_pP);
-
- while ((rlc_pP->input_sdus[rlc_pP->current_sdu_index].mem_block) && (nb_bytes_to_transmit > 0) ) {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] nb_bytes_to_transmit %d BO %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- nb_bytes_to_transmit,
- rlc_pP->sdu_buffer_occupancy);
-
- // pdu_p management
- if (!pdu_mem_p) {
- if (rlc_pP->nb_sdu_no_segmented <= 1) {
- max_li_overhead = 0;
- } else {
- /* This computation assumes there is no SDU with size greater than 2047 bytes, otherwise a new PDU must be built except for LI15 configuration from Rel12*/
- test_num_li = rlc_pP->nb_sdu_no_segmented - 1;
- max_li_overhead = test_num_li + (test_num_li >> 1) + (test_num_li & 1);
- }
-
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] max_li_overhead %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- max_li_overhead);
-
- if (nb_bytes_to_transmit >= (rlc_pP->sdu_buffer_occupancy + RLC_AM_HEADER_MIN_SIZE + max_li_overhead)) {
- data_pdu_size = rlc_pP->sdu_buffer_occupancy + RLC_AM_HEADER_MIN_SIZE + max_li_overhead;
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] alloc PDU size %d bytes to contain not all bytes requested by MAC but all BO of RLC@1\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- data_pdu_size);
- } else {
- data_pdu_size = nb_bytes_to_transmit;
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] alloc PDU size %d bytes to contain all bytes requested by MAC@1\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- data_pdu_size);
- }
-
- if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req), __func__))) {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus);
- return;
- }
-
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] get new PDU %d bytes\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- data_pdu_size);
- pdu_remaining_size = data_pdu_size - RLC_AM_HEADER_MIN_SIZE;
- pdu_p = (rlc_am_pdu_sn_10_t*) (&pdu_mem_p->data[sizeof(struct mac_tb_req)]);
- pdu_tb_req_p = (struct mac_tb_req*) (pdu_mem_p->data);
- pdu_mngt_p = &rlc_pP->tx_data_pdu_buffer[rlc_pP->vt_s % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE];
- memset(pdu_mngt_p, 0, sizeof (rlc_am_tx_data_pdu_management_t));
-
- memset (pdu_mem_p->data, 0, sizeof (rlc_am_pdu_sn_10_t)+sizeof(struct mac_tb_req));
- li_length_in_bytes = 1;
- }
-
- //----------------------------------------
- // compute how many SDUS can fill the PDU
- //----------------------------------------
- continue_fill_pdu_with_sdu = 1;
- num_fill_sdu = 0;
- test_num_li = 0;
- sdu_buffer_index = rlc_pP->current_sdu_index;
- test_pdu_remaining_size = pdu_remaining_size;
- test_li_length_in_bytes = 1;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
-
-
- while ((rlc_pP->input_sdus[sdu_buffer_index].mem_block) && (continue_fill_pdu_with_sdu > 0)) {
- sdu_mngt_p = &rlc_pP->input_sdus[sdu_buffer_index];
-
- if (sdu_mngt_p->sdu_remaining_size > test_pdu_remaining_size) {
- // no LI
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- } else if (sdu_mngt_p->sdu_remaining_size == test_pdu_remaining_size) {
- // fi will indicate end of PDU is end of SDU, no need for LI
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- } else if ((sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3)) == test_pdu_remaining_size ) {
- // no LI
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- pdu_remaining_size = pdu_remaining_size - (test_li_length_in_bytes ^ 3);
- } else if ((sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3)) < test_pdu_remaining_size ) {
- if (pdu_mngt_p->nb_sdus >= (RLC_AM_MAX_SDU_IN_PDU-1)) {
- continue_fill_pdu_with_sdu = 0;
- //num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- pdu_remaining_size = pdu_remaining_size - 1;
- } else {
- test_num_li += 1;
- num_fill_sdu += 1;
- test_pdu_remaining_size = test_pdu_remaining_size - (sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3));
- test_remaining_size_to_substract = test_li_length_in_bytes ^ 3;
- test_remaining_num_li_to_substract = 1;
- test_li_length_in_bytes = test_li_length_in_bytes ^ 3;
- }
- } else {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] sdu_mngt_p->sdu_remaining_size=%d test_pdu_remaining_size=%d test_li_length_in_bytes=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p->sdu_remaining_size,
- test_pdu_remaining_size,
- test_li_length_in_bytes ^ 3);
- // reduce the size of the PDU
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- pdu_remaining_size = pdu_remaining_size - 1;
- }
-
- pdu_mngt_p->sdus_index[pdu_mngt_p->nb_sdus++] = sdu_buffer_index;
- sdu_mngt_p->pdus_index[sdu_mngt_p->nb_pdus++] = rlc_pP->vt_s % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE;
- //assert(sdu_mngt_p->nb_pdus < RLC_AM_MAX_SDU_FRAGMENTS);
- if(sdu_mngt_p->nb_pdus >= RLC_AM_MAX_SDU_FRAGMENTS) {
- LOG_E(RLC,PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] loop error. %d %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), sdu_mngt_p->nb_pdus, RLC_AM_MAX_SDU_FRAGMENTS);
- break;
- }
- sdu_buffer_index = (sdu_buffer_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
- }
-
- if (test_remaining_num_li_to_substract > 0) {
- // there is a LI that is not necessary
- test_num_li = test_num_li - 1;
- pdu_remaining_size = pdu_remaining_size - test_remaining_size_to_substract;
- }
-
- //----------------------------------------
- // Do the real filling of the pdu_p
- //----------------------------------------
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT" data shift %d Bytes num_li %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- ((test_num_li*3) +1) >> 1,
- test_num_li);
- data = ((unsigned char*)(&pdu_p->data[((test_num_li*3) +1) >> 1]));
- pdu_mngt_p->payload = data;
- e_li_p = (rlc_am_e_li_t*)(pdu_p->data);
- continue_fill_pdu_with_sdu = 1;
- li_length_in_bytes = 1;
- fill_num_li = 0;
- fi_first_byte_pdu_is_first_byte_sdu = 0;
- fi_last_byte_pdu_is_last_byte_sdu = 0;
-
- if (rlc_pP->input_sdus[rlc_pP->current_sdu_index].sdu_remaining_size ==
- rlc_pP->input_sdus[rlc_pP->current_sdu_index].sdu_size) {
- fi_first_byte_pdu_is_first_byte_sdu = 1;
- }
-
- while ((rlc_pP->input_sdus[rlc_pP->current_sdu_index].mem_block) && (continue_fill_pdu_with_sdu > 0)) {
- sdu_mngt_p = &rlc_pP->input_sdus[rlc_pP->current_sdu_index];
-
- if (sdu_mngt_p->sdu_segmented_size == 0) {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] GET NEW SDU %p AVAILABLE SIZE %d Bytes\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p,
- sdu_mngt_p->sdu_remaining_size);
- } else {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] GET AGAIN SDU %p REMAINING AVAILABLE SIZE %d Bytes / %d Bytes LENGTH \n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p,
- sdu_mngt_p->sdu_remaining_size,
- sdu_mngt_p->sdu_size);
- }
-
- data_sdu_p = &sdu_mngt_p->first_byte[sdu_mngt_p->sdu_segmented_size];
-
- if (sdu_mngt_p->sdu_remaining_size > pdu_remaining_size) {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Filling all remaining PDU with %d bytes\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_remaining_size);
- //msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] pdu_mem_p %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n", rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame, pdu_mem_p, pdu_p, pdu_p->data, data, data_sdu_p,pdu_remaining_size);
-
- memcpy(data, data_sdu_p, pdu_remaining_size);
- pdu_mngt_p->payload_size += pdu_remaining_size;
- sdu_mngt_p->sdu_remaining_size = sdu_mngt_p->sdu_remaining_size - pdu_remaining_size;
- sdu_mngt_p->sdu_segmented_size = sdu_mngt_p->sdu_segmented_size + pdu_remaining_size;
- fi_last_byte_pdu_is_last_byte_sdu = 0;
- // no LI
- rlc_pP->sdu_buffer_occupancy -= pdu_remaining_size;
- continue_fill_pdu_with_sdu = 0;
- pdu_remaining_size = 0;
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] sdu_remaining_size %d bytes sdu_segmented_size %d bytes\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p->sdu_remaining_size,
- sdu_mngt_p->sdu_segmented_size);
- } else if (sdu_mngt_p->sdu_remaining_size == pdu_remaining_size) {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Exactly Filling remaining PDU with %d remaining bytes of SDU\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_remaining_size);
- rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
- rlc_am_mui.rrc_mui_num++;
-
- memcpy(data, data_sdu_p, pdu_remaining_size);
- pdu_mngt_p->payload_size += pdu_remaining_size;
-
- // free SDU
- rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
- rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index);
- //free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index], __func__);
- //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
- //rlc_pP->nb_sdu -= 1;
- rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
-
- fi_last_byte_pdu_is_last_byte_sdu = 1;
- // fi will indicate end of PDU is end of SDU, no need for LI
- continue_fill_pdu_with_sdu = 0;
- pdu_remaining_size = 0;
- } else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) {
- if (fill_num_li == (RLC_AM_MAX_SDU_IN_PDU - 1)) {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] [SIZE %d] REACHING RLC_AM_MAX_SDU_IN_PDU LIs -> STOP SEGMENTATION FOR THIS PDU SDU\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p->sdu_remaining_size);
- memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
- pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size;
- pdu_remaining_size = 0; //Forced to 0 pdu_remaining_size - sdu_mngt_p->sdu_remaining_size;
- // free SDU
- rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
- rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index);
- //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
- //rlc_pP->nb_sdu -= 1;
- rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
-
- // reduce the size of the PDU
- continue_fill_pdu_with_sdu = 0;
- fi_last_byte_pdu_is_last_byte_sdu = 1;
- rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
- rlc_am_mui.rrc_mui_num++;
- } else {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Filling PDU with %d all remaining bytes of SDU\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p->sdu_remaining_size);
- memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
- pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size;
- data = &data[sdu_mngt_p->sdu_remaining_size];
- li_length_in_bytes = li_length_in_bytes ^ 3;
- fill_num_li += 1;
-
- if (li_length_in_bytes == 2) {
- if (fill_num_li == test_num_li) {
- //e_li_p->e1 = 0;
- e_li_p->b1 = 0;
- } else {
- //e_li_p->e1 = 1;
- e_li_p->b1 = 0x80;
- }
-
- //e_li_p->li1 = sdu_mngt_p->sdu_remaining_size;
- e_li_p->b1 = e_li_p->b1 | (sdu_mngt_p->sdu_remaining_size >> 4);
- e_li_p->b2 = sdu_mngt_p->sdu_remaining_size << 4;
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] set e_li_p->b1=0x%02X set e_li_p->b2=0x%02X fill_num_li=%d test_num_li=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- e_li_p->b1,
- e_li_p->b2,
- fill_num_li,
- test_num_li);
- } else {
- if (fill_num_li != test_num_li) {
- //e_li_p->e2 = 1;
- e_li_p->b2 = e_li_p->b2 | 0x08;
- }
-
- //e_li_p->li2 = sdu_mngt_p->sdu_remaining_size;
- e_li_p->b2 = e_li_p->b2 | (sdu_mngt_p->sdu_remaining_size >> 8);
- e_li_p->b3 = sdu_mngt_p->sdu_remaining_size & 0xFF;
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] set e_li_p->b2=0x%02X set e_li_p->b3=0x%02X fill_num_li=%d test_num_li=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- e_li_p->b2,
- e_li_p->b3,
- fill_num_li,
- test_num_li);
- e_li_p++;
- }
-
- pdu_remaining_size = pdu_remaining_size - (sdu_mngt_p->sdu_remaining_size + li_length_in_bytes);
- // free SDU
- rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
- sdu_mngt_p->sdu_remaining_size = 0;
-
- rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index);
- //free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index], __func__);
- //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
- //rlc_pP->nb_sdu -= 1;
- rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
- }
- } else {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p->sdu_remaining_size,
- pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
- //assert(1!=1);
- rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
- rlc_am_mui.rrc_mui_num++;
-
- memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
- pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size;
- pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size;
- // free SDU
- rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
- rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index);
- //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
- //rlc_pP->nb_sdu -= 1;
- rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
-
- // reduce the size of the PDU
- continue_fill_pdu_with_sdu = 0;
- fi_last_byte_pdu_is_last_byte_sdu = 1;
- }
- }
-
- // set framing info
- if (fi_first_byte_pdu_is_first_byte_sdu) {
- fi = 0;
- } else {
- fi = 2;
- }
-
- if (!fi_last_byte_pdu_is_last_byte_sdu) {
- fi = fi + 1;
- }
-
- pdu_p->b1 = pdu_p->b1 | (fi << RLC_AM_PDU_FI_OFFSET);
-
- // set fist e bit
- if (fill_num_li > 0) {
- RLC_AM_PDU_SET_E(pdu_p->b1);
- }
-
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] SEND PDU SN %04d SIZE %d BYTES PAYLOAD SIZE %d BYTES\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->vt_s,
- data_pdu_size - pdu_remaining_size,
- pdu_mngt_p->payload_size);
-
- rlc_pP->stat_tx_data_pdu += 1;
- rlc_pP->stat_tx_data_bytes += (data_pdu_size - pdu_remaining_size);
-
- // set DATA/CONTROL field is DATA PDU(1)
- RLC_AM_PDU_SET_D_C(pdu_p->b1);
- // set sn = rlc_pP->vt_s;
- pdu_p->b1 = pdu_p->b1 | (rlc_pP->vt_s >> 8);
- pdu_p->b2 = rlc_pP->vt_s & 0xFF;
- rlc_pP->vt_s = (rlc_pP->vt_s+1) & RLC_AM_SN_MASK;
-
- pdu_tb_req_p->data_ptr = (unsigned char*)pdu_p;
- pdu_tb_req_p->tb_size = data_pdu_size - pdu_remaining_size;
-//#warning "why 3000: changed to RLC_SDU_MAX_SIZE "
- //assert(pdu_tb_req_p->tb_size < RLC_SDU_MAX_SIZE );
- if(pdu_tb_req_p->tb_size >= RLC_SDU_MAX_SIZE) {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] tb_size error. %d, %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),pdu_tb_req_p->tb_size, RLC_SDU_MAX_SIZE);
- }
- rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_p, pdu_mngt_p->payload_size,true);
-
- //list_add_tail_eurecom (pdu_mem_p, &rlc_pP->segmentation_pdu_list);
- pdu_mngt_p->mem_block = pdu_mem_p;
- pdu_mngt_p->first_byte = (unsigned char*)pdu_p;
- pdu_mngt_p->header_and_payload_size = data_pdu_size - pdu_remaining_size;
- pdu_mngt_p->retx_count = 0;
- pdu_mngt_p->retx_count_next = 0;
- pdu_mngt_p->flags.retransmit = 0;
- pdu_mngt_p->flags.transmitted = 1;
- pdu_mngt_p->sn = RLC_AM_PREV_SN(rlc_pP->vt_s);
-
-
- //TBC: What for resetting local pointers at the end ??
- pdu_p = NULL;
- pdu_mem_p = NULL;
-
- //nb_bytes_to_transmit = nb_bytes_to_transmit - data_pdu_size;
- nb_bytes_to_transmit = 0; // 1 PDU only
-
- /* We need to copy the PDU to pass to MAC in order to keep it in the buffer for potential retransmissions */
- mem_block_t* copy = rlc_am_retransmit_get_copy (ctxt_pP, rlc_pP, RLC_AM_PREV_SN(rlc_pP->vt_s));
- list_add_tail_eurecom (copy, &rlc_pP->segmentation_pdu_list);
-
- }
-
- RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus);
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.h
deleted file mode 100644
index 1e472302c8..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_segment.h
-* \brief This file defines the prototypes of the functions dealing with the segmentation of PDCP SDUs.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_internal_segment_impl_ RLC AM Segmentation Internal Reference Implementation
-* @ingroup _rlc_am_internal_impl_
-* @{
-*/
-# ifndef __RLC_AM_SEGMENT_H__
-# define __RLC_AM_SEGMENT_H__
-//-----------------------------------------------------------------------------
-
-/*! \fn void rlc_am_pdu_polling (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *const rlcP, rlc_am_pdu_sn_10_t *pduP, int16_t payload_sizeP, bool is_new_pdu)
-* \brief Set or not the poll bit in the PDU header depending on RLC AM protocol variables.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] pduP Pointer on the header of the PDU in order to be able to set the poll bit if necessary.
-* \param[in] payload_sizeP Size of the payload of the PDU.
-*/
-void rlc_am_pdu_polling (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *const rlcP, rlc_am_pdu_sn_10_t *pduP, int16_t payload_sizeP, bool is_new_pdu);
-
-/*! \fn void rlc_am_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP)
-* \brief Segment a PDU with 10 bits sequence number, based on segmentation information given by MAC (size to transmit).
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-*/
-void rlc_am_segment_10 (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t *const rlcP);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.c
deleted file mode 100644
index a696f9a9f1..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/* This file is empty. Might be deleted ? */
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.h
deleted file mode 100644
index 0b237b07f4..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_segments_holes.h
-* \brief This file defines the prototypes of the functions dealing with the re-segmentation of RLC PDUs stored in the retransmission buffer,.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_segment_holes_impl_ RLC AM Resegmentation Implementation
-* @ingroup _rlc_am_internal_segment_impl_
-* @{
-*/
-#ifndef __RLC_AM_SEGMENT_HOLES_H__
-# define __RLC_AM_SEGMENT_HOLES_H__
-//-----------------------------------------------------------------------------
-/*! \fn void rlc_am_clear_holes (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP)
-* \brief Remove all marked holes for PDU with sequence number "snP".
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number.
-*/
-void rlc_am_clear_holes (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlcP,
- const rlc_sn_t snP);
-
-/*! \fn void rlc_am_remove_hole (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP)
-* \brief Remove for PDU with sequence number "snP" a NACK for byte segment offset [so_startP, so_stopP].
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number.
-* \param[in] so_startP Start of segment offset.
-* \param[in] so_stopP End of segment offset.
-*/
-void rlc_am_remove_hole (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlcP,
- const rlc_sn_t snP,
- const sdu_size_t so_startP,
- const sdu_size_t so_stopP);
-
-/*! \fn void rlc_am_get_next_hole (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP, sdu_size_t* so_startP, sdu_size_t* so_stopP)
-* \brief Get for PDU with sequence number "snP" the first hole start and stop parameters.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number.
-* \param[in,out] so_startP Start of segment offset.
-* \param[in,out] so_stopP End of segment offset.
-*/
-void rlc_am_get_next_hole (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlcP,
- const rlc_sn_t snP,
- sdu_size_t* const so_startP,
- sdu_size_t* const so_stopP);
-
-/*! \fn void rlc_am_add_hole (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP)
-* \brief Mark for PDU with sequence number "snP" a NACK for byte segment offset [so_startP, so_stopP].
-* \param[in] ctxt_pP Running context.
-* \param[in] rlcP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number.
-* \param[in,out] so_startP Start of segment offset.
-* \param[in,out] so_stopP End of segment offset.
-*/
-void rlc_am_add_hole (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlcP,
- const rlc_sn_t snP,
- const sdu_size_t so_startP,
- sdu_size_t so_stopP);
-/** @} */
-#endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
deleted file mode 100644
index f1e6c961e7..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
+++ /dev/null
@@ -1,764 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_STATUS_REPORT_C 1
-//-----------------------------------------------------------------------------
-#include
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-//-----------------------------------------------------------------------------
-#include "intertask_interface.h"
-#include "assertions.h"
-#include "list.h"
-#include "rlc_am.h"
-#include "common/utils/LOG/log.h"
-
-
-//-----------------------------------------------------------------------------
-uint16_t rlc_am_read_bit_field(
- uint8_t **data_ppP,
- unsigned int *bit_pos_pP,
- const signed int bits_to_readP) {
- uint16_t value = 0;
- unsigned int bits_read = 0;
- signed int bits_to_read = bits_to_readP;
-
- do {
- // bits read > bits to read
- if ((8 - *bit_pos_pP) > bits_to_read) {
- bits_read = 8 - *bit_pos_pP;
- value = (value << bits_to_read) | ((((uint16_t)(**data_ppP)) & (uint16_t)(0x00FF >> *bit_pos_pP)) >> (bits_read -
- bits_to_read));
- *bit_pos_pP = *bit_pos_pP + bits_to_read;
- return value;
- // bits read == bits to read
- } else if ((8 - *bit_pos_pP) == bits_to_read) {
- value = (value << bits_to_read) | (((uint16_t)(**data_ppP)) & (uint16_t)(0x00FF >> *bit_pos_pP));
- *bit_pos_pP = 0;
- *data_ppP = *data_ppP + 1;
- return value;
- // bits read < bits to read
- } else {
- bits_read = 8 - *bit_pos_pP;
- value = (value << bits_read) | ((((uint16_t)(**data_ppP)) & (uint16_t)(0x00FF >> *bit_pos_pP)));
- *bit_pos_pP = 0;
- *data_ppP = *data_ppP + 1;
- bits_to_read = bits_to_read - bits_read;
- }
- } while (bits_to_read > 0);
-
- return value;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_write8_bit_field(
- uint8_t **data_ppP,
- unsigned int *bit_pos_pP,
- const signed int bits_to_writeP,
- const uint8_t valueP) {
- unsigned int available_bits;
- signed int bits_to_write= bits_to_writeP;
-
- do {
- available_bits = 8 - *bit_pos_pP;
-
- // available_bits > bits to write
- if (available_bits > bits_to_write) {
- **data_ppP = **data_ppP | (((valueP & (((uint8_t)0xFF) >> (available_bits - bits_to_write)))) << (available_bits -
- bits_to_write));
- *bit_pos_pP = *bit_pos_pP + bits_to_write;
- return;
- // bits read == bits to read
- } else if (available_bits == bits_to_write) {
- **data_ppP = **data_ppP | (valueP & (((uint8_t)0xFF) >> (8 - bits_to_write)));
- *bit_pos_pP = 0;
- *data_ppP = *data_ppP + 1;
- return;
- // available_bits < bits to write
- } else {
- **data_ppP = **data_ppP | (valueP >> (bits_to_write - available_bits));
- *bit_pos_pP = 0;
- *data_ppP = *data_ppP + 1;
- bits_to_write = bits_to_write - available_bits;
- }
- } while (bits_to_write > 0);
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_write16_bit_field(
- uint8_t **data_ppP,
- unsigned int *bit_pos_pP,
- signed int bits_to_writeP,
- const uint16_t valueP) {
- //assert(bits_to_writeP <= 16);
- if(bits_to_writeP > 16) {
- LOG_E(RLC, "bits_to_writeP error. %d\n", bits_to_writeP);
- }
-
- if (bits_to_writeP > 8) {
- rlc_am_write8_bit_field(data_ppP,bit_pos_pP, bits_to_writeP - 8, (uint8_t)(valueP >> 8));
- rlc_am_write8_bit_field(data_ppP,bit_pos_pP, 8, (uint8_t)(valueP & 0x00FF));
- } else {
- rlc_am_write8_bit_field(data_ppP,bit_pos_pP, bits_to_writeP, (uint8_t)(valueP & 0x00FF));
- }
-}
-//-----------------------------------------------------------------------------
-signed int
-rlc_am_get_control_pdu_infos(
- rlc_am_pdu_sn_10_t *const header_pP,
- sdu_size_t *const total_size_pP,
- rlc_am_control_pdu_info_t *const pdu_info_pP) {
- memset(pdu_info_pP, 0, sizeof (rlc_am_control_pdu_info_t));
- pdu_info_pP->d_c = header_pP->b1 >> 7;
-
- if (!pdu_info_pP->d_c) {
- pdu_info_pP->cpt = (header_pP->b1 >> 4) & 0x07;
-
- if (pdu_info_pP->cpt != 0x00) {
- return -3;
- }
-
- pdu_info_pP->ack_sn = ((header_pP->b2 >> 2) & 0x3F) | (((uint16_t)(header_pP->b1 & 0x0F)) << 6);
- pdu_info_pP->e1 = (header_pP->b2 >> 1) & 0x01;
- //*total_size_pP -= 1;
-
- if (pdu_info_pP->e1) {
- unsigned int nack_to_read = 1;
- unsigned int bit_pos = 7; // range from 0 (MSB/left) to 7 (LSB/right)
- uint8_t *byte_pos_p = &header_pP->b2;
-
- while (nack_to_read) {
- pdu_info_pP->nack_list[pdu_info_pP->num_nack].nack_sn = rlc_am_read_bit_field(&byte_pos_p, &bit_pos, 10);
- pdu_info_pP->nack_list[pdu_info_pP->num_nack].e1 = rlc_am_read_bit_field(&byte_pos_p, &bit_pos, 1);
- pdu_info_pP->nack_list[pdu_info_pP->num_nack].e2 = rlc_am_read_bit_field(&byte_pos_p, &bit_pos, 1);
-
- // READ SOstart, SOend field
- if (pdu_info_pP->nack_list[pdu_info_pP->num_nack].e2) {
- pdu_info_pP->nack_list[pdu_info_pP->num_nack].so_start = rlc_am_read_bit_field(&byte_pos_p, &bit_pos, 15);
- pdu_info_pP->nack_list[pdu_info_pP->num_nack].so_end = rlc_am_read_bit_field(&byte_pos_p, &bit_pos, 15);
- } else {
- pdu_info_pP->nack_list[pdu_info_pP->num_nack].so_start = 0;
- // all 15 bits set to 1 (indicate that the missing portion of the AMD PDU includes all bytes
- // to the last byte of the AMD PDU)
- pdu_info_pP->nack_list[pdu_info_pP->num_nack].so_end = 0x7FFF;
- }
-
- pdu_info_pP->num_nack = pdu_info_pP->num_nack + 1;
-
- if (!pdu_info_pP->nack_list[pdu_info_pP->num_nack - 1].e1) {
- nack_to_read = 0;
- *total_size_pP = *total_size_pP - (sdu_size_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
-
- if (*total_size_pP != 0) {
- LOG_E(RLC, "[RLC_AM_GET_CONTROL_PDU_INFOS][FIRST]header_pP->b1=%d,header_pP->b2=%d\n",header_pP->b1,header_pP->b2);
- }
-
- return 0;
- }
-
- if (pdu_info_pP->num_nack == RLC_AM_MAX_NACK_IN_STATUS_PDU) {
- *total_size_pP = *total_size_pP - (sdu_size_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
- return -2;
- }
- }
-
- *total_size_pP = *total_size_pP - (sdu_size_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
- } else {
- *total_size_pP = *total_size_pP - 2;
- }
-
- if (*total_size_pP != 0) {
- LOG_E(RLC, "[RLC_AM_GET_CONTROL_PDU_INFOS][SECOND]header_pP->b1=%d,header_pP->b2=%d\n",header_pP->b1,header_pP->b2);
- }
-
- return 0;
- } else {
- return -1;
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_display_control_pdu_infos(
- const rlc_am_control_pdu_info_t *const pdu_info_pP
-) {
- int num_nack;
-
- if (!pdu_info_pP->d_c) {
- LOG_T(RLC, "CONTROL PDU ACK SN %04d", pdu_info_pP->ack_sn);
-
- for (num_nack = 0; num_nack < pdu_info_pP->num_nack; num_nack++) {
- if (pdu_info_pP->nack_list[num_nack].e2) {
- LOG_T(RLC, "\n\tNACK SN %04d SO START %05d SO END %05d", pdu_info_pP->nack_list[num_nack].nack_sn,
- pdu_info_pP->nack_list[num_nack].so_start,
- pdu_info_pP->nack_list[num_nack].so_end);
- } else {
- LOG_T(RLC, "\n\tNACK SN %04d", pdu_info_pP->nack_list[num_nack].nack_sn);
- }
- }
-
- LOG_T(RLC, "\n");
- } else {
- LOG_E(RLC, "CAN'T DISPLAY CONTROL INFO: PDU IS DATA PDU\n");
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_receive_process_control_pdu(
- const protocol_ctxt_t *const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- mem_block_t *const tb_pP,
- uint8_t **first_byte_ppP,
- sdu_size_t *const tb_size_in_bytes_pP) {
- rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t *)*first_byte_ppP;
- sdu_size_t initial_pdu_size = *tb_size_in_bytes_pP;
- rlc_sn_t ack_sn = RLC_AM_NEXT_SN(rlc_pP->vt_a);
- rlc_sn_t sn_cursor = rlc_pP->vt_a;
- rlc_sn_t vt_a_new = rlc_pP->vt_a;
- rlc_sn_t sn_data_cnf = (rlc_sn_t) 0;
- rlc_sn_t nack_sn,prev_nack_sn;
- sdu_size_t data_cnf_so_stop = 0x7FFF;
- unsigned int nack_index;
- bool status = true;
-
- if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, tb_size_in_bytes_pP, &rlc_pP->control_pdu_info) >= 0) {
- rlc_am_tx_buffer_display(ctxt_pP, rlc_pP, " TX BUFFER BEFORE PROCESS OF STATUS PDU");
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RX CONTROL PDU VT(A) %04d VT(S) %04d POLL_SN %04d ACK_SN %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->vt_a,
- rlc_pP->vt_s,
- rlc_pP->poll_sn,
- rlc_pP->control_pdu_info.ack_sn);
- rlc_am_display_control_pdu_infos(&rlc_pP->control_pdu_info);
- ack_sn = rlc_pP->control_pdu_info.ack_sn;
- // 5.2.1 Retransmission
- //
- // The transmitting side of an AM RLC entity can receive a negative acknowledgement (notification of reception failure
- // by its peer AM RLC entity) for an AMD PDU or a portion of an AMD PDU by the following:
- // - STATUS PDU from its peer AM RLC entity.
- //
- // When receiving a negative acknowledgement for an AMD PDU or a portion of an AMD PDU by a STATUS PDU from
- // its peer AM RLC entity, the transmitting side of the AM RLC entity shall:
- // - if the SN of the corresponding AMD PDU falls within the range VT(A) <= SN < VT(S):
- // - consider the AMD PDU or the portion of the AMD PDU for which a negative acknowledgement was
- // received for retransmission.
-
- // 5.2.2.2 Reception of a STATUS report
- // Upon reception of a STATUS report from the receiving RLC AM entity the
- // transmitting side of an AM RLC entity shall:
- // - if the STATUS report comprises a positive or negative
- // acknowledgement for the RLC data PDU with sequence number equal to
- // POLL_SN:
- // - if t-PollRetransmit is running:
- // - stop and reset t-PollRetransmit.
- //assert(ack_sn < RLC_AM_SN_MODULO);
- //assert(rlc_pP->control_pdu_info.num_nack < RLC_AM_MAX_NACK_IN_STATUS_PDU);
- if(ack_sn >= RLC_AM_SN_MODULO || rlc_pP->control_pdu_info.num_nack >= RLC_AM_MAX_NACK_IN_STATUS_PDU) {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" illegal ack_sn %d, num_nack %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), ack_sn, rlc_pP->control_pdu_info.num_nack);
- return;
- }
-
- /* Note : ackSn can be equal to current vtA only in case the status pdu contains a list of nack_sn with same value = vtA with SOStart/SOEnd */
- /* and meaning the report is not complete due to not enough ressources to fill all SOStart/SOEnd of this NACK_SN */
- if (RLC_AM_DIFF_SN(rlc_pP->vt_s,rlc_pP->vt_a) >= RLC_AM_DIFF_SN(ack_sn,rlc_pP->vt_a)) {
- if (rlc_pP->control_pdu_info.num_nack == 0) {
- while (sn_cursor != ack_sn) {
- rlc_am_ack_pdu(ctxt_pP, rlc_pP, sn_cursor, true);
- sn_cursor = RLC_AM_NEXT_SN(sn_cursor);
- }
-
- vt_a_new = ack_sn;
- sn_data_cnf = RLC_AM_PREV_SN(vt_a_new);
- } else {
- nack_index = 0;
- nack_sn = rlc_pP->control_pdu_info.nack_list[nack_index].nack_sn;
- prev_nack_sn = 0x3FFF;
-
- while (sn_cursor != nack_sn) {
- rlc_am_ack_pdu(ctxt_pP, rlc_pP, sn_cursor, true);
- sn_cursor = RLC_AM_NEXT_SN(sn_cursor);
- }
-
- vt_a_new = nack_sn;
- // catch DataCfn
- rlc_am_tx_data_pdu_management_t *tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[nack_sn % RLC_AM_WINDOW_SIZE];
-
- if (tx_data_pdu_buffer_p->retx_payload_size == tx_data_pdu_buffer_p->payload_size) {
- sn_data_cnf = RLC_AM_PREV_SN(nack_sn);
- } else if (tx_data_pdu_buffer_p->nack_so_start != 0) {
- sn_data_cnf = nack_sn;
- data_cnf_so_stop = tx_data_pdu_buffer_p->nack_so_start - 1;
- } else {
- sn_data_cnf = RLC_AM_PREV_SN(nack_sn);
- }
-
- while ((sn_cursor != ack_sn) && (status)) {
- if (sn_cursor != nack_sn) {
- rlc_am_ack_pdu(ctxt_pP,
- rlc_pP,
- sn_cursor,
- false);
- } else {
- status = rlc_am_nack_pdu (ctxt_pP,
- rlc_pP,
- nack_sn,
- prev_nack_sn,
- rlc_pP->control_pdu_info.nack_list[nack_index].so_start,
- rlc_pP->control_pdu_info.nack_list[nack_index].so_end);
- nack_index = nack_index + 1;
- prev_nack_sn = nack_sn;
-
- if (nack_index < rlc_pP->control_pdu_info.num_nack) {
- nack_sn = rlc_pP->control_pdu_info.nack_list[nack_index].nack_sn;
- } else if (nack_sn != ack_sn) {
- /* general case*/
- nack_sn = ack_sn;
- } else {
- /*specific case when the sender did not have enough TBS to fill all SOStart SOEnd for this NACK_SN */
- break;
- }
- }
-
- if (prev_nack_sn != nack_sn) {
- /* do not increment sn_cursor in case of several informations for the same nack_sn */
- sn_cursor = (sn_cursor + 1) & RLC_AM_SN_MASK;
- }
- }
- }
- } else {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" WARNING CONTROL PDU ACK SN %d OUT OF WINDOW vtA=%d vtS=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,rlc_pP->vt_a,rlc_pP->vt_s);
- *tb_size_in_bytes_pP = 0;
- status = false;
- }
- } else {
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR IN DECODING CONTROL PDU\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- *tb_size_in_bytes_pP = 0;
- status = false;
- }
-
- if (status) {
- /* Check for Stopping TpollReTx */
- if ((rlc_pP->poll_sn != RLC_SN_UNDEFINED) &&
- (RLC_AM_DIFF_SN(ack_sn,rlc_pP->vt_a) > RLC_AM_DIFF_SN(rlc_pP->poll_sn,rlc_pP->vt_a))) {
- rlc_am_stop_and_reset_timer_poll_retransmit(ctxt_pP, rlc_pP);
- rlc_pP->poll_sn = RLC_SN_UNDEFINED;
- }
-
- //TODO : this part does not cover all cases of Data Cnf and move it at the end of Status PDU processing
- sn_cursor = rlc_pP->vt_a;
-
- // Fix Issue 238 : check sn_data_cnf has been transmitted
- if ((rlc_pP->tx_data_pdu_buffer[sn_data_cnf % RLC_AM_WINDOW_SIZE].flags.transmitted) &&
- (rlc_pP->tx_data_pdu_buffer[sn_data_cnf % RLC_AM_WINDOW_SIZE].sn == sn_data_cnf)) {
- /* Handle all acked PDU up to and excluding sn_data_cnf */
- while (sn_cursor != sn_data_cnf) {
- rlc_am_pdu_sdu_data_cnf(ctxt_pP,rlc_pP,sn_cursor);
- sn_cursor = RLC_AM_NEXT_SN(sn_cursor);
- }
-
- // Handle last SN. TO DO : case of PDU partially ACKED with SDU to be data conf
- if (data_cnf_so_stop == 0x7FFF) {
- rlc_am_pdu_sdu_data_cnf(ctxt_pP,rlc_pP,sn_data_cnf);
- }
-
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RECEIVE STATUS PDU ACK_SN=%d NewvtA=%d OldvtA=%d SnDataCnf=%d DataCnfSOStop=%d vtS=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,vt_a_new,rlc_pP->vt_a,sn_data_cnf,data_cnf_so_stop,rlc_pP->vt_s);
- } else {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RECEIVE STATUS PDU WITH NO SDU CNF ACK_SN=%d NewvtA=%d OldvtA=%d vtS=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,vt_a_new,rlc_pP->vt_a,rlc_pP->vt_s);
- }
-
- /* Update vtA and vtMS */
- rlc_pP->vt_a = vt_a_new;
- rlc_pP->vt_ms = (rlc_pP->vt_a + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
- }
-
- *first_byte_ppP = (uint8_t *)((uint64_t)*first_byte_ppP + initial_pdu_size - *tb_size_in_bytes_pP);
- free_mem_block(tb_pP, __func__);
- rlc_am_tx_buffer_display(ctxt_pP, rlc_pP, NULL);
-}
-//-----------------------------------------------------------------------------
-int
-rlc_am_write_status_pdu(
- const protocol_ctxt_t *const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- rlc_am_pdu_sn_10_t *const rlc_am_pdu_sn_10_pP,
- rlc_am_control_pdu_info_t *const pdu_info_pP) {
- unsigned int bit_pos = 4; // range from 0 (MSB/left) to 7 (LSB/right)
- uint8_t *byte_pos_p = &rlc_am_pdu_sn_10_pP->b1;
- unsigned int index = 0;
- unsigned int num_bytes = 0;
- rlc_am_write16_bit_field(&byte_pos_p, &bit_pos, 10, pdu_info_pP->ack_sn);
-
- if (pdu_info_pP->num_nack > 0) {
- rlc_am_write8_bit_field(&byte_pos_p, &bit_pos, 1, 1);
- } else {
- rlc_am_write8_bit_field(&byte_pos_p, &bit_pos, 1, 0);
- }
-
- for (index = 0; index < pdu_info_pP->num_nack ; index++) {
- rlc_am_write16_bit_field(&byte_pos_p, &bit_pos, 10, pdu_info_pP->nack_list[index].nack_sn);
- rlc_am_write8_bit_field(&byte_pos_p, &bit_pos, 1, pdu_info_pP->nack_list[index].e1);
- rlc_am_write8_bit_field(&byte_pos_p, &bit_pos, 1, pdu_info_pP->nack_list[index].e2);
-
- // if SO_START SO_END fields
- if (pdu_info_pP->nack_list[index].e2 > 0) {
- rlc_am_write16_bit_field(&byte_pos_p, &bit_pos, 15, pdu_info_pP->nack_list[index].so_start);
- rlc_am_write16_bit_field(&byte_pos_p, &bit_pos, 15, pdu_info_pP->nack_list[index].so_end);
- }
- }
-
- ptrdiff_t diff = byte_pos_p - &rlc_am_pdu_sn_10_pP->b1; // this is the difference in terms of typeof(byte_pos_p), which is uint8_t
- num_bytes = diff;
-
- if (bit_pos > 0) {
- num_bytes += 1;
- }
-
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" WROTE STATUS PDU %d BYTES\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- num_bytes);
- return num_bytes;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_send_status_pdu(
- const protocol_ctxt_t *const ctxt_pP,
- rlc_am_entity_t *const rlc_pP
-) {
- // When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall:
- // - 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;
- // - else:
- // - at the first transmission opportunity indicated by lower layer after t-StatusProhibit expires, construct a single
- // STATUS PDU even if status reporting was triggered several times while t-StatusProhibit was running and
- // deliver it to lower layer;
- //
- // When a STATUS PDU has been delivered to lower layer, the receiving side of an AM RLC entity shall:
- // - start t-StatusProhibit.
- //
- // When constructing a STATUS PDU, the AM RLC entity shall:
- // - for the AMD PDUs with SN such that VR(R) <= SN < VR(MR) that has not been completely received yet, in
- // increasing SN of PDUs and increasing byte segment order within PDUs, starting with SN = VR(R) up to
- // the point where the resulting STATUS PDU still fits to the total size of RLC PDU(s) indicated by lower layer:
- // - for an AMD PDU for which no byte segments have been received yet::
- // - include in the STATUS PDU a NACK_SN which is set to the SN of the AMD PDU;
- // - for a continuous sequence of byte segments of a partly received AMD PDU that have not been received yet:
- // - include in the STATUS PDU a set of NACK_SN, SOstart and SOend
- // - set the ACK_SN to the SN of the next not received RLC Data PDU which is not indicated as missing in the
- // resulting STATUS PDU.
- signed int nb_bits_to_transmit = rlc_pP->nb_bytes_requested_by_mac << 3;
- // minimum header size in bits to be transmitted: D/C + CPT + ACK_SN + E1
- signed int nb_bits_transmitted = RLC_AM_PDU_D_C_BITS + RLC_AM_STATUS_PDU_CPT_LENGTH + RLC_AM_SN_BITS + RLC_AM_PDU_E_BITS;
- rlc_am_control_pdu_info_t control_pdu_info;
- rlc_am_pdu_info_t *pdu_info_cursor_p = NULL;
- rlc_sn_t sn_cursor = 0;
- rlc_sn_t sn_nack = rlc_pP->vr_r;
- mem_block_t *cursor_p = rlc_pP->receiver_buffer.head;
- int all_segments_received = 0;
- int waited_so = 0;
- mem_block_t *tb_p = NULL;
- sdu_size_t pdu_size = 0;
- bool status_report_completed = false;
- bool segment_loop_end = false;
- memset(&control_pdu_info, 0, sizeof(rlc_am_control_pdu_info_t));
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] nb_bits_to_transmit %d (15 already allocated for header)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- nb_bits_to_transmit);
- rlc_am_rx_list_display(rlc_pP, " DISPLAY BEFORE CONSTRUCTION OF STATUS REPORT");
-
- /* Handle no NACK first */
- if (rlc_pP->vr_r == rlc_pP->vr_ms) {
- control_pdu_info.ack_sn = rlc_pP->vr_ms;
- status_report_completed = true;
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d ALL ACK WITH ACK_SN %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- rlc_pP->vr_ms);
- } else if ((cursor_p != NULL) && ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1)) <= nb_bits_to_transmit)) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
- sn_cursor = pdu_info_cursor_p->sn;
- /* Set E1 bit for the presence of first NACK_SN/E1/E2 */
- control_pdu_info.e1 = 1;
-
- // 12 bits = size of NACK_SN field + E1, E2 bits
- // 42 bits = size of NACK_SN field + SO_START, SO_END fields, E1, E2 bits
- while ((!status_report_completed) && (RLC_AM_DIFF_SN(sn_nack,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r))
- && (cursor_p != NULL) && (nb_bits_transmitted <= nb_bits_to_transmit)) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
- sn_cursor = pdu_info_cursor_p->sn;
- all_segments_received = ((rlc_am_rx_pdu_management_t *)(cursor_p->data))->all_segments_received;
-
- /* First fill NACK_SN with each missing PDU between current sn_nack and sn_cursor */
- while ((sn_nack != sn_cursor) && (RLC_AM_DIFF_SN(sn_nack,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r))) {
- if (nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) <= nb_bits_to_transmit) {
- /* Fill NACK_SN infos */
- control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_nack;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = 0;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = RLC_AM_STATUS_PDU_SO_END_ALL_BYTES;
- control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 0;
- /* Set E1 for next NACK_SN. The last one will be cleared */
- control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
- control_pdu_info.num_nack += 1;
- nb_bits_transmitted += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1));
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- sn_nack);
- sn_nack = RLC_AM_NEXT_SN(sn_nack);
- } else {
- /* Not enough UL TBS*/
- /* latest value of sn_nack shall be used as ACK_SN */
- control_pdu_info.ack_sn = sn_nack;
- status_report_completed = true;
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d NOT ENOUGH TBS STOP WITH ACK_SN %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- sn_nack);
- break;
- }
- }
-
- if (sn_nack == rlc_pP->vr_ms) {
- break;
- }
-
- /* Now process all Segments of sn_cursor if PDU not fully received */
- if ((!status_report_completed) && (all_segments_received == 0) && (sn_cursor != rlc_pP->vr_ms)) {
- //AssertFatal (sn_nack == sn_cursor, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id);
- if(sn_nack != sn_cursor) {
- LOG_E(RLC, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id);
- }
- /* First ensure there is enough TBS for at least 1 SOStart/SOEnd, else break */
- else if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) {
- /* Init loop flags */
- /* Check lsf */
- segment_loop_end = (pdu_info_cursor_p->lsf == 1);
-
- /* Init first SO Start according to first segment */
- if (pdu_info_cursor_p->so) {
- /* Fill the first SO */
- control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_cursor;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = 0;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = pdu_info_cursor_p->so - 1;
- control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
- /* Set E1 for next NACK_SN. The last one will be cleared */
- control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
- control_pdu_info.num_nack += 1;
- nb_bits_transmitted += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- sn_cursor,
- 0,
- pdu_info_cursor_p->so - 1);
- waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
- } else {
- waited_so = pdu_info_cursor_p->payload_size;
- }
-
- /* Go to next segment */
- cursor_p = cursor_p->next;
-
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
- }
-
- /* Find the first discontinuity and then fill SOStart/SOEnd */
- while (!segment_loop_end) {
- if ((cursor_p != NULL) && (pdu_info_cursor_p->sn == sn_cursor)) {
- /* PDU segment is for the same SN*/
- /* Check lsf */
- segment_loop_end = (pdu_info_cursor_p->lsf == 1);
-
- if (waited_so < pdu_info_cursor_p->so) {
- /* SO is greater than previous received portion : gap identified to fill */
- if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) {
- control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_cursor;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = waited_so;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = pdu_info_cursor_p->so - 1;
- control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
- /* Set E1 for next NACK_SN. The last one will be cleared */
- control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
- control_pdu_info.num_nack += 1;
- nb_bits_transmitted += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- sn_cursor,
- waited_so,
- pdu_info_cursor_p->so);
- } else {
- /* Not enough resources to set a SOStart/SEnd, then set ACK_SN to current NACK_SN and stop Status PDU build */
- control_pdu_info.ack_sn = sn_cursor;
- status_report_completed = true;
- segment_loop_end = true;
- break;
- }
- } else {
- /* contiguous segment: only update waited_so */
- /* Assuming so and payload_size updated according to duplication removal done at reception ... */
- waited_so += pdu_info_cursor_p->payload_size;
- }
-
- /* Go to next received PDU or PDU Segment */
- cursor_p = cursor_p->next;
-
- if (cursor_p != NULL) {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
- }
- } //end if (cursor_p != NULL) && (pdu_info_cursor_p->sn == sn_cursor)
- else {
- /* Previous PDU segment was the last one and did not have lsf indication : fill the latest gap */
- if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) {
- control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_cursor;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = waited_so;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = RLC_AM_STATUS_PDU_SO_END_ALL_BYTES;
- control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
- /* Set E1 for next NACK_SN. The last one will be cleared */
- control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
- control_pdu_info.num_nack += 1;
- nb_bits_transmitted += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING LAST NACK %04d SO START %05d SO END %05d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- sn_cursor,
- waited_so,
- RLC_AM_STATUS_PDU_SO_END_ALL_BYTES);
- } else {
- /* Not enough resources to set a SOStart/SEnd, then set ACK_SN to current NACK_SN and stop Status PDU build */
- control_pdu_info.ack_sn = sn_cursor;
- status_report_completed = true;
- }
-
- segment_loop_end = true;
- }
- } //end while (!segment_loop_end)
- } // end if enough resource for transmitting at least one SOStart/SOEnd
- else {
- /* Not enough UL TBS to set at least one SOStart/SOEnd */
- /* latest value of sn_nack shall be used as ACK_SN */
- control_pdu_info.ack_sn = sn_nack;
- status_report_completed = true;
- }
- } // end while on all PDU segments of sn_cursor
- else {
- /* Go to next received PDU or PDU segment with different SN */
- do {
- cursor_p = cursor_p->next;
- } while ((cursor_p != NULL) && (((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info.sn == sn_cursor));
- }
-
- /* Increment sn_nack except if sn_cursor = vrMS and if current SN was not fully received */
- if (RLC_AM_DIFF_SN(sn_cursor,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r)) {
- sn_nack = RLC_AM_NEXT_SN(sn_cursor);
- } else {
- sn_nack = rlc_pP->vr_ms;
- }
- } // End main while NACK_SN
-
- /* Clear E1 of last nack_sn entry */
- // AssertFatal ((control_pdu_info.num_nack) || (all_segments_received == 0), "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n",
- // rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id);
- if (!((control_pdu_info.num_nack) || (all_segments_received == 0))) {
- LOG_E(RLC, "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n",
- rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id);
- return;
- }
-
- if (control_pdu_info.num_nack) {
- control_pdu_info.nack_list[control_pdu_info.num_nack - 1].e1 = 0;
- }
-
- /* Set ACK_SN unless it was set before */
- if (!status_report_completed) {
- control_pdu_info.ack_sn = sn_nack;
- }
- } else {
- /* reception buffer empty or not enough TBS for filling at least 1 NACK_SN + E1 + E2 */
- control_pdu_info.ack_sn = rlc_pP->vr_r;
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK %04d = VR(R)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- control_pdu_info.ack_sn);
- }
-
- //msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] nb_bits_to_transmit %d\n",
- // rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame,nb_bits_to_transmit);
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK %04d NUM NACK %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- control_pdu_info.ack_sn,
- control_pdu_info.num_nack);
- /* encode the control pdu */
- pdu_size = (nb_bits_transmitted + 7) >> 3;
-
- // AssertFatal (pdu_size <= rlc_pP->nb_bytes_requested_by_mac, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n",
- // pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id);
- if(pdu_size > rlc_pP->nb_bytes_requested_by_mac) {
- LOG_E(RLC, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n",
- pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id);
- return;
- }
-
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d forecast pdu_size %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- pdu_size);
- tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__);
-
- if(tb_p == NULL) return;
-
- memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
- //estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
- ((struct mac_tb_req *)(tb_p->data))->data_ptr = (uint8_t *)&(tb_p->data[sizeof(struct mac_tb_req)]);
- // warning reuse of pdu_size
- // TODO : rlc_am_write_status_pdu should be rewritten as not very tested ...
- pdu_size = rlc_am_write_status_pdu(ctxt_pP, rlc_pP,(rlc_am_pdu_sn_10_t *)(((struct mac_tb_req *)(tb_p->data))->data_ptr), &control_pdu_info);
- ((struct mac_tb_req *)(tb_p->data))->tb_size = pdu_size;
- //assert((((struct mac_tb_req*)(tb_p->data))->tb_size) < 3000);
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] SEND STATUS PDU SIZE %d, rlc_pP->nb_bytes_requested_by_mac %d, nb_bits_to_transmit>>3 %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_size,
- rlc_pP->nb_bytes_requested_by_mac,
- nb_bits_to_transmit >> 3);
-
- // AssertFatal (pdu_size == ((nb_bits_transmitted + 7) >> 3), "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n",
- // pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id);
- if(pdu_size != ((nb_bits_transmitted + 7) >> 3)) {
- LOG_E(RLC, "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n",
- pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id);
- pdu_size = 0;
- return;
- }
-
- // remaining bytes to transmit for RLC (retrans pdus and new data pdus)
- rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - pdu_size;
- // put pdu in trans
- list_add_head(tb_p, &rlc_pP->control_pdu_list);
- rlc_pP->stat_tx_control_pdu += 1;
- rlc_pP->stat_tx_control_bytes += pdu_size;
-}
-
-
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h
deleted file mode 100644
index 861e152123..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_status_report.h
-* \brief This file defines the prototypes of the functions dealing with the reading/writting of informations from/in RLC AM control PDUs, and the processing of received control PDUs.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_status_report_impl_ RLC AM Status Report Reference Implementation
-* @ingroup _rlc_am_internal_impl_
-* @{
-*/
-#ifndef __RLC_AM_STATUS_REPORT_H__
-# define __RLC_AM_STATUS_REPORT_H__
-
-# include "UTIL/MEM/mem_block.h"
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-#include "common/platform_constants.h"
-//#include "PHY/defs.h"
-
-//-----------------------------------------------------------------------------
-/*! \fn uint16_t rlc_am_read_bit_field (uint8_t** dataP, unsigned int* bit_posP, const signed int bits_to_readP)
-* \brief Read N bits in a byte area seen as a bit-field with the help of a byte index and a modulo 8 bit index.
-* \param[in,out] dataP Data pointer on area to read, updated after the read.
-* \param[in,out] bit_posP Last ending read bit position, updated after the read.
-* \param[in] bits_to_readP Number of bits to read (max 16).
-* \return Value read on 16 bits, bits read are shifted to least significant bits of returned short value.
-*/
-uint16_t rlc_am_read_bit_field (uint8_t** dataP, unsigned int* bit_posP, const signed int bits_to_readP);
-
-/*! \fn void rlc_am_write8_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, const uint8_t valueP)
-* \brief Write N bits (max 8) in a byte area seen as a bit-field with the help of a byte index and a modulo 8 bit index.
-* \param[in,out] dataP Data pointer on area to write, updated after the write.
-* \param[in,out] bit_posP Last ending read write position, updated after the write.
-* \param[in] bits_to_writeP Number of bits to write (max 8).
-* \param[in] valueP Value to write.
-*/
-void rlc_am_write8_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, const uint8_t valueP);
-
-/*! \fn void rlc_am_write16_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, const uint16_t valueP)
-* \brief Write N bits (max 16) in a byte area seen as a bit-field with the help of a byte index and a modulo 8 bit index.
-* \param[in,out] dataP Data pointer on area to write, updated after the write.
-* \param[in,out] bit_posP Last ending read write position, updated after the write.
-* \param[in] bits_to_writeP Number of bits to write (max 16).
-* \param[in] valueP Value to write.
-*/
-void rlc_am_write16_bit_field(
- uint8_t** dataP,
- unsigned int* bit_posP,
- signed int bits_to_writeP,
- const uint16_t valueP);
-
-/*! \fn signed int rlc_am_get_control_pdu_infos (rlc_am_pdu_sn_10_t* const headerP, sdu_size_t * const total_sizeP, rlc_am_control_pdu_info_t* const pdu_infoP)
-* \brief Retrieve control PDU informations from a serialized control PDU.
-* \param[in] headerP Pointer on the header of the RLC AM PDU.
-* \param[in] total_size_pP Pointer on PDU size in bytes.
-* \param[in,out] pdu_infoP Struct containing interpreted PDU control informations.
-*/
-signed int rlc_am_get_control_pdu_infos (
- rlc_am_pdu_sn_10_t* const headerP,
- sdu_size_t * const total_size_pP,
- rlc_am_control_pdu_info_t* const pdu_infoP);
-
-/*! \fn void rlc_am_display_control_pdu_infos(const rlc_am_control_pdu_info_t* const pdu_infoP)
-* \brief Dump on LOG output the informations contained in the pdu_infoP structure.
-* \param[in] pdu_infoP Struct containing interpreted PDU control informations.
-*/
-void rlc_am_display_control_pdu_infos(const rlc_am_control_pdu_info_t* const pdu_infoP);
-
-/*! \fn void rlc_am_receive_process_control_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, mem_block_t* const tbP, uint8_t* first_byte, const uint16_t tb_size_in_bytes)
-* \brief Process the informations contained in the control PDU.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] tbP Control PDU embedded in a mem_block_t structure.
-* \param[in] first_byte Pointer on first byte of control PDU.
-* \param[in] tb_size_in_bytes Pointer on size of serialized control PDU in bytes.
-*/
-void rlc_am_receive_process_control_pdu(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP,
- mem_block_t* const tbP,
- uint8_t** first_byte,
- sdu_size_t * const tb_size_in_bytes);
-
-/*! \fn int rlc_am_write_status_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, rlc_am_pdu_sn_10_t* const rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* const pdu_infoP)
-* \brief Remove all marked holes for PDU with sequence number "snP".
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] rlc_am_pdu_sn_10P Pointer on the header of the RLC AM control PDU.
-* \param[in] pdu_infoP Struct containing PDU control informations elements.
-* \return The number of bytes that have been written.
-*/
-int rlc_am_write_status_pdu(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- rlc_am_pdu_sn_10_t* const rlc_am_pdu_sn_10P,
- rlc_am_control_pdu_info_t* const pdu_infoP);
-
-/*! \fn void rlc_am_send_status_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
-* \brief Send a status PDU based on the receiver buffer content.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_send_status_pdu(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP);
-/** @} */
-#endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h
deleted file mode 100644
index cc2e3b9c1b..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_structs.h
-* \brief This file defines structures used inside the RLC AM.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-# ifndef __RLC_AM_STRUCTS_H__
-# define __RLC_AM_STRUCTS_H__
-
-# include "platform_types.h"
-#include "common/platform_constants.h"
-# include "list.h"
-# include "mem_block.h"
-# include "rlc_am_constants.h"
-# include "mac_rlc_primitives.h"
-# include "mac_primitives.h"
-# include "rlc_primitives.h"
-/**
-* @addtogroup _rlc_am_internal_input_sdu_impl_
-* @{
-*/
-//-----------------------------------------------------------------------------
-// SDU MANAGEMENT
-//-----------------------------------------------------------------------------
-/*! \struct sdu_management_flags_t
-* \brief Structure containing SDU bit-field flags (for memory optimization purpose) related to its segmentation and transmission.
-*/
-typedef struct sdu_management_flags {
- uint8_t discarded:1; /*!< \brief Boolean telling if this SDU is discarded, actually unused. */
- uint8_t segmented:1; /*!< \brief Boolean telling if the segmentation of this SDU is completed, actually unused. */
- uint8_t segmentation_in_progress:1; /*!< \brief Boolean telling if the segmentation of this SDU is started but not completed, actually unused. */
- uint8_t no_new_sdu_segmented_in_last_pdu:1; /*!< \brief Actually unused. */
- uint8_t transmitted_successfully:1; /*!< \brief SDU acknowledged by peer RLC AM. */
- uint8_t dummy:3; /*!< \brief Free bits. */
-} sdu_management_flags_t;
-
-/*! \struct rlc_am_tx_sdu_management_t
-* \brief Structure containing SDU variables related to its segmentation and transmission.
-*/
-typedef struct rlc_am_tx_sdu_management {
- mem_block_t *mem_block; /*!< \brief SDU embedded in a mem_block_t. */
- uint8_t *first_byte; /*!< \brief Pointer on SDU payload. */
- frame_t sdu_creation_time; /*!< \brief Time stamped with mac_xface->frame. */
- mui_t mui; /*!< \brief Message Unit Identifier, still here for historical reasons (no LTE-PDCP compliant now). */
- sdu_size_t sdu_remaining_size; /*!< \brief Remaining size in bytes to be filled in a PDU. */
- sdu_size_t sdu_segmented_size; /*!< \brief Bytes already segmented in a/several PDU(s). */
- sdu_size_t sdu_size; /*!< \brief SDU size in bytes. */
- int16_t pdus_index[RLC_AM_MAX_SDU_FRAGMENTS]; /*!< \brief Array containing the sequence numbers of the PDU in which the SDU has been segmented. */
- uint8_t nb_pdus; /*!< \brief Number of referenced PDUs in pdus_index[] array. */
- uint8_t nb_pdus_ack; /*!< \brief Number of referenced PDUs in pdus_index[] array that have been acknowledged. (used for confirmation and MaxDat discard)*/
- sdu_management_flags_t flags; /*!< \brief bit-field flags related to SDU segmentation and transmission */
-} rlc_am_tx_sdu_management_t;
-
-/** @} */
-
-/**
-* @addtogroup _rlc_am_internal_retransmit_impl_
-* @{
-*/
-
-/*! \struct pdu_management_flags_t
-* \brief Structure containing PDU variables related to its retransmission.
-*/
-typedef struct pdu_management_flags {
- uint8_t transmitted:1; /*!< \brief Boolean telling that this PDU is not empty and has been at least transmitted once. */
- uint8_t ack:1; /*!< \brief Boolean telling that this PDU has been acknowledged. */
- uint8_t nack:1; /*!< \brief Boolean telling that this PDU has been acknowledged negatively. */
- uint8_t retransmit:1; /*!< \brief Boolean telling a retransmission is scheduled for this PDU. */
- uint8_t max_retransmit:1; /*!< \brief Boolean telling max retransmission has been hit for this PDU. */
- uint8_t dummy:3; /*!< \brief Free bits. */
-} pdu_management_flags_t;
-
-
-
-/*! \struct rlc_am_tx_data_pdu_management_t
-* \brief Structure containing PDU variables related to its acknowlegment, non acknowlegment, resegmentation and retransmission.
-*/
-typedef struct rlc_am_tx_data_pdu_management {
- mem_block_t *mem_block; /*!< \brief PDU embedded in a mem_block_t struct */
- uint8_t *first_byte; /*!< \brief Pointer on the PDU including header, LIs, data */
- uint8_t *payload; /*!< \brief Pointer on the PDU payload */
- int16_t sdus_index[RLC_AM_MAX_SDU_IN_PDU]; /*!< \brief Index of SDU(s) having segments in this pdu (index in rlc_am_entity.input_sdus[]) */
- frame_t last_nack_time; /*!< \brief Last frame this PDU was negative acknowledged, for not nacking several times in the same frame */
- sdu_size_t hole_so_start [RLC_AM_MAX_HOLES_REPORT_PER_PDU]; /*!< \brief Array containing the start segment offsets for marking a hole (negative acknowledged area) in the PDU. */
- sdu_size_t hole_so_stop [RLC_AM_MAX_HOLES_REPORT_PER_PDU]; /*!< \brief Array containing the stop segment offsets for marking a hole (negative acknowledged area) in the PDU. */
- uint8_t num_holes; /*!< \brief Number of registereg holes in hole_so_start[], hole_so_stop[]. */
- uint8_t retx_hole_index; /*!< \brief Next index of registered holes to retransmit. */
- sdu_size_t header_and_payload_size; /*!< \brief Size of the PDU in bytes, including header and payload. */
- sdu_size_t payload_size; /*!< \brief Size of the PDU payload in bytes. */
- sdu_size_t retx_payload_size; /*!< \brief Size of the PDU payload to be retransmitted in bytes including all Segment portions. */
- rlc_sn_t sn; /*!< \brief Sequence number of the PDU. */
- sdu_size_t nack_so_start; /*!< \brief Lowest NACK start segment offset, must be set to 0 if global NACK. */
- sdu_size_t nack_so_stop; /*!< \brief Highest NACK stop segment offset, must be set to data_size - 1 if global NACK */
-
- int8_t nb_sdus; /*!< \brief Number of sdu having segments in this pdu. */
- int8_t retx_count; /*!< \brief Counts the number of already occurred retransmissions of an AMD PDU (see subclause 5.2.1). */
- int8_t retx_count_next; /*!< \brief Counts the number of already occurred retransmissions plus the latest pending one. */
-
- pdu_management_flags_t flags; /*!< \brief PDU variables related to its retransmission. */
-} rlc_am_tx_data_pdu_management_t;
-
-/** @} */
-
-/**
-* @addtogroup _rlc_am_status_report_impl_
-* @{
-*/
-
-/*! \struct nack_sn_t
-* \brief Structure containing Status PDU information element.
-*/
-typedef struct nack_sn {
- uint16_t nack_sn:10; /*!< \brief NACK sequence number field. */
- uint16_t e1:1; /*!< \brief Extension bit 1 field. */
- uint16_t e2:1; /*!< \brief Extension bit 2 field. */
- uint32_t so_start:15; /*!< \brief Optional SOstart field (depending on e2 bit). */
- uint32_t so_end:15; /*!< \brief Optional SOend field (depending on e2 bit). */
-} nack_sn_t;
-
-/*! \struct rlc_am_control_pdu_info_t
-* \brief Structure containing Status PDU information element.
-*/
-typedef struct rlc_am_control_pdu_info {
- uint16_t d_c:1; /*!< \brief Data/Control field. */
- uint16_t cpt:3; /*!< \brief Control PDU type. */
- uint16_t ack_sn:10; /*!< \brief Acknowledgment SN field. */
- uint16_t e1:1; /*!< \brief Extension bit 1 field. */
- uint16_t dummy:2; /*!< \brief Unused bits. */
- uint16_t num_nack; /*!< \brief Number of nack_sn_t fields in nack_list[]. */
- nack_sn_t nack_list[RLC_AM_MAX_NACK_IN_STATUS_PDU]; /*!< \brief List of NACK_SN fields. */
-} rlc_am_control_pdu_info_t ;
-
-/*! \struct rlc_am_e_li_t
-* \brief Structure helping coding and decoding LI and e bits in AMD PDUs and AMD PDU segments.
-*/
-typedef struct rlc_am_e_li {
- uint8_t b1; /*!< \brief 1st byte. */
- uint8_t b2; /*!< \brief 2nd byte. */
- uint8_t b3; /*!< \brief 3rd byte. */
-} rlc_am_e_li_t;
-
-/** @} */
-
-/**
-* @addtogroup _rlc_am_internal_impl_
-* @{
-*/
-/*! \struct rlc_am_pdu_sn_10_t
-* \brief Structure helping coding and decoding the first 2 bytes of a AMD PDU or AMD PDU segment.
-*/
-typedef struct rlc_am_pdu_sn_10 {
- uint8_t b1; /*!< \brief 1st byte. */
- uint8_t b2; /*!< \brief 2nd byte. */
- uint8_t data[2];/*!< \brief Following bytes. */
-} __attribute__((__packed__)) rlc_am_pdu_sn_10_t ;
-/** @} */
-
-
-/**
-* @addtogroup _rlc_am_internal_receiver_impl_
-* @{
-*/
-/*! \struct rlc_am_pdu_info_t
-* \brief Structure for storing decoded informations from the header of a AMD PDU or AMD PDU segment.
-*/
-typedef struct rlc_am_pdu_info {
- uint32_t d_c:1; /*!< \brief Data/Control field. */
- uint32_t rf:1; /*!< \brief Resegmentation Flag field. */
- uint32_t p:1; /*!< \brief Polling bit field. */
- uint32_t fi:2; /*!< \brief Framing Info field. */
- uint32_t e:1; /*!< \brief Extension bit field. */
- uint32_t sn:10; /*!< \brief Sequence Number field. */
- uint32_t lsf:1; /*!< \brief Last Segment Flag field. */
- uint32_t so:15; /*!< \brief Segment Offset field. */
- uint16_t num_li; /*!< \brief Number of Length Indicators. */
- int16_t li_list[RLC_AM_MAX_SDU_IN_PDU]; /*!< \brief List of Length Indicators. */
- int16_t hidden_size /*!< \brief Part of payload size in bytes that is not included in the sum of LI fields. */;
- uint8_t* payload; /*!< \brief Pointer on PDU payload. */
- int16_t payload_size;/*!< \brief Size of payload in bytes. */
- int16_t header_size; /*!< \brief Size of header in bytes (including SO field and LI fields). */
-} rlc_am_pdu_info_t ;
-/** @} */
-
-
-/**
-* @addtogroup _rlc_am_timers_impl_
-* @{
-*/
-/*! \struct rlc_am_timer_t
-* \brief Generic structure for implementing a timer.
-*/
-typedef struct rlc_am_timer {
- uint32_t ms_time_out; /*!< \brief When set, indicate the time in milliseconds the timer will time-out. */
- uint32_t ms_start; /*!< \brief indicate the time in milliseconds the timer has been started. */
- uint32_t ms_duration; /*!< \brief Configured timer duration in milliseconds. */
- uint32_t running:1; /*!< \brief The timer is running. */
- uint32_t timed_out:1; /*!< \brief The timer has timed-out. */
- uint32_t dummy:30; /*!< \brief Bits not used. */
-} rlc_am_timer_t ;
-/** @} */
-
-//-----------------------------------------------------------------------------
-// DATA PDU
-//-----------------------------------------------------------------------------
-/**
-* @addtogroup _rlc_am_internal_receiver_impl_
-* @{
-*/
-
-typedef enum rlc_am_rx_segment_reassemble_info
-{
- /** No Reassembly scheduled */
- RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_NO = 0,
- /** Reassembly scheduled */
- RLC_AM_RX_PDU_SEGMENT_REASSEMBLE_PENDING = 1,
- /** Reassembly done */
- RLC_AM_RX_PDU_SEGMENT_REASSEMBLED = 2
-
-} rlc_am_rx_segment_reassemble_info_t;
-
-/*! \struct rlc_am_rx_pdu_management_t
-* \brief Structure for storing decoded informations from the header of a AMD PDU or AMD PDU segment and information on reassembly.
-*/
-typedef struct rlc_am_rx_pdu_management {
- rlc_am_pdu_info_t pdu_info; /*!< \brief Field for storing decoded informations from the header of a AMD PDU or AMD PDU segment. */
- uint8_t all_segments_received; /*!< \brief Is all segments of PDU SN have been received. */
- rlc_am_rx_segment_reassemble_info_t segment_reassembled; /*!< \brief if the segment for SN=vrR is reassembled but not discarded yet. */
-} rlc_am_rx_pdu_management_t;
-/** @} */
-
-typedef enum rlc_am_rx_pdu_status
-{
- /** PDU okay. */
- RLC_AM_DATA_PDU_STATUS_OK = 0,
- /** SN outside RX window */
- RLC_AM_DATA_PDU_STATUS_SN_OUTSIDE_WINDOW = 1,
- /** SN already available */
- RLC_AM_DATA_PDU_STATUS_SN_DUPLICATE = 2,
- /** SN already available */
- RLC_AM_DATA_PDU_STATUS_AM_SEGMENT_DUPLICATE = 3,
- /** Buffer full */
- RLC_AM_DATA_PDU_STATUS_BUFFER_FULL = 4,
- /** Header Error (LI,SO...) */
- RLC_AM_DATA_PDU_STATUS_HEADER_ERROR = 5,
- /** Unknown bearer */
- RLC_AM_DATA_PDU_STATUS_INVALID_BEARER = 6,
- /** RLC in wrong state */
- RLC_AM_DATA_PDU_STATUS_WRONG_STATE = 7
-
-} rlc_am_rx_pdu_status_t;
-
-/*! \cond PRIVATE */
-//-----------------------------------------------------------------------------
-// interlayers optimizations
-//-----------------------------------------------------------------------------
-struct rlc_am_tx_data_pdu_allocation {
- union {
- struct rlc_am_tx_data_pdu_management rlc_am_tx_pdu_mngmnt;
- struct mac_tb_req tb_req;
- struct mac_tx_tb_management tb_mngt;
- } dummy;
-};
-
-/*struct rlc_am_tx_control_pdu_allocation {
- union {
- struct mac_tb_req tb_req;
- struct mac_tx_tb_management tb_mngt;
- } dummy;
-};*/
-
-struct rlc_am_data_req_alloc { // alloc enought bytes for sdu mngt also
- union {
- struct rlc_am_data_req dummy1;
- struct rlc_am_tx_sdu_management dummy2;
- } dummy;
-};
-/*! \endcond */
-# endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c
deleted file mode 100644
index e898a601c2..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c
+++ /dev/null
@@ -1,1183 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_TEST_C 1
-#define RLC_C 1
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-#include "platform_types.h"
-//-----------------------------------------------------------------------------
-#include "rlc.h"
-#include "rlc_am.h"
-#include "rlc_am_test.h"
-#include "list.h"
-#include "LAYER2/MAC/extern.h"
-
-
-
-
-
-
-
-
-#define TEST1
-#define TEST2
-#define TEST3
-#define TEST4
-#define TEST5
-#define TEST6
-#define TEST7
-
-#define TEST_MAX_SEND_SDU 8192
-#define TARGET_MAX_RX_ERROR_RATE 10
-#define TARGET_MAX_TX_ERROR_RATE 10
-static int g_frame = 0;
-static int g_random_sdu;
-static int g_random_nb_frames;
-static int g_random_tx_pdu_size;
-static int g_random_rx_pdu_size;
-static int g_target_tx_error_rate;
-static int g_target_rx_error_rate;
-static int g_tx_packets = 0;
-static int g_dropped_tx_packets = 0;
-static int g_rx_packets = 0;
-static int g_dropped_rx_packets = 0;
-static int g_drop_rx = 0;
-static int g_drop_tx = 0;
-static int g_mui = 0;
-static int g_send_sdu_ids[TEST_MAX_SEND_SDU][2];
-static int g_send_id_write_index[2];
-static int g_send_id_read_index[2];
-static uint8_t g_buffer[32];
-static int8_t *g_sdus[] = {"En dépit de son volontarisme affiché, le premier ministre est de plus en plus décrié pour son incompétence. La tension politique et dans l'opinion publique est encore montée d'un cran au Japon, sur fond d'inquiétantes nouvelles, avec du plutonium détecté dans le sol autour de la centrale de Fukushima. Le premier ministre Naoto Kan a solennellement déclaré que son gouvernement était «en état d'alerte maximum». Tout en reconnaissant que la situation restait «imprévisible». Ce volontarisme affiché par le premier ministre - que Nicolas Sarkozy rencontrera demain lors d'une visite au Japon - ne l'a pas empêché d'être la cible de violentes critiques de la part de parlementaires sur sa gestion de la crise. Attaqué sur le manque de transparence, il a assuré qu'il rendait publiques toutes les informations en sa possession. Un député de l'opposition, Yosuke Isozaki, a aussi reproché à Naoto Kan de ne pas avoir ordonné l'évacuation des populations dans la zone comprise entre 20 et 30 km autour de la centrale. «Peut-il y avoir quelque chose de plus irresponsable que cela ?», a-t-il lancé. Pour l'heure, la zone d'évacuation est limitée à un rayon de 20 km, seul le confinement étant recommandé pour les 10 km suivants. Sur ce sujet, les autorités japonaises ont été fragilisées mardi par les déclarations de Greenpeace, affirmant que ses experts avaient détecté une radioactivité dangereuse à 40 km de la centrale. L'organisation écologiste a appelé à une extension de la zone d'évacuation, exhortant Tokyo à «cesser de privilégier la politique aux dépens de la science». L'Agence japonaise de sûreté nucléaire a balayé ces critiques.",
-
- "La pâquerette (Bellis perennis) est une plante vivace des prés, des pelouses, des bords de chemins et des prairies, haute de dix à vingt centimètres, de la famille des Astéracées, dont les fleurs naissent sur des inflorescences appelées capitules : celles du pourtour, que l'on croit à tort être des pétales, appelées fleurs ligulées, parce qu'elles ont la forme d'une languette, ou demi-fleurons, sont des fleurs femelles, dont la couleur varie du blanc au rose plus ou moins prononcé ; celles du centre, jaunes, appelées fleurs tubuleuses, parce que leur corolle forme un tube, ou fleurons, sont hermaphrodites. Ainsi, contrairement à l'opinion populaire, ce qu'on appelle une « fleur » de pâquerette n'est en réalité pas « une » fleur mais un capitule portant des fleurs très nombreuses.Leurs fruits s'envolent grâce au vent et dégagent des odeurs qui attirent les insectes.Une variété muricole peut pousser sur des murs humides verticaux.Les pâquerettes sont des fleurs rustiques et très communes en Europe, sur les gazons, les prairies, les chemins et les zones d'herbe rase.Elles ont la particularité, comme certaines autres fleurs de plantes herbacées, de se fermer la nuit et de s'ouvrir le matin pour s'épanouir au soleil ; elles peuvent aussi se fermer pendant les averses, voire un peu avant, ce qui permet dans les campagnes de prédire la pluie légèrement à l'avance.",
-
- "La pâquerette",
- " (Bellis perennis)",
- " est une plante vivace des prés,",
- " des pelouses,",
- " des bords de chemins et des prairies,",
- "haute de dix à",
- " vingt centimètres",
- ", de la",
- " famille des",
- " Astéracées",
- ", dont",
- " les",
- " fleurs",
- " naissent",
- " sur",
- " des",
- " inflorescences",
- " appelées",
- " capitules",
- " : celles",
- " du pourtour",
- ", que l'on",
- " croit à",
- " tort",
- " être",
- " des pétales",
- ", appelées",
- " fleurs ligulées",
- ", parce qu'elles",
- " ont la forme d'une languette, ou demi-fleurons, sont",
- " des fleurs femelles,",
- " dont la couleur varie du blanc au rose plus ou moins prononcé ; celles du centre, jaunes,",
- " appelées ",
- "fleurs tubuleuses",
- ", parce que leur corolle forme un tube, ou fleurons, sont hermaphrodites."
- };
-
-/* Returns the x-y size of the terminal */
-
-//-----------------------------------------------------------------------------
-void rlc_am_v9_3_0_test_windows()
-//-----------------------------------------------------------------------------
-{
- rlc_am_entity_t am1;
- rlc_am_entity_t am2;
- unsigned int i;
- unsigned int j;
- memset(am1,0,sizeof(rlc_am_entity_t));
- memset(am2,0,sizeof(rlc_am_entity_t));
-
- rlc_am_init(&am1, g_frame);
- rlc_am_init(&am2, g_frame);
-
- // TX window with vt_ms > vt_a
- for (j = 0; j < RLC_AM_SN_MODULO-RLC_AM_WINDOW_SIZE; j++) {
- am1.vt_a = j;
- am1.vt_s = j;
- am1.vt_ms = (am1.vt_a + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
-
- for (i = 0 ; i < am1.vt_a; i ++) {
- assert(rlc_am_in_tx_window(&am1, i) == 0);
- }
-
- for (i = j ; i < am1.vt_ms; i ++) {
- assert(rlc_am_in_tx_window(&am1, i) > 0);
- }
-
- for (i = am1.vt_ms ; i <= 0xFFFF; i ++) {
- //printf("assert(rlc_am_in_tx_window(&am1, %d) == 0)) vt(s)=%d vt(ms)=%d\n", i, am1.vt_s, am1.vt_ms);
- assert(rlc_am_in_tx_window(&am1, i) == 0);
- }
- }
-
- // TX window with vt_ms < vt_a
- for (j = RLC_AM_SN_MODULO-RLC_AM_WINDOW_SIZE; j < RLC_AM_SN_MODULO; j++) {
- am1.vt_a = j;
- am1.vt_s = j;
- am1.vt_ms = (am1.vt_a + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
-
- for (i = 0 ; i < am1.vt_ms; i ++) {
- assert(rlc_am_in_tx_window(&am1, i) > 0);
- }
-
- for (i = j ; i < am1.vt_a; i ++) {
- assert(rlc_am_in_tx_window(&am1, i) == 0);
- }
-
- for (i = am1.vt_a ; i < RLC_AM_SN_MODULO; i ++) {
- assert(rlc_am_in_tx_window(&am1, i) > 0);
- }
-
- for (i = RLC_AM_SN_MODULO ; i < 0xFFFF; i ++) {
- assert(rlc_am_in_tx_window(&am1, i) == 0);
- }
- }
-
- // RX window with vr_mr > vr_r
- for (j = 0; j < RLC_AM_SN_MODULO-RLC_AM_WINDOW_SIZE; j++) {
- am1.vr_r = j;
- am1.vr_mr = (am1.vr_r + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
-
- for (i = 0 ; i < am1.vr_r; i ++) {
- assert(rlc_am_in_rx_window(&am1, i) == 0);
- }
-
- for (i = j ; i < am1.vr_mr; i ++) {
- //printf("assert(rlc_am_in_rx_window(&am1, %d) == 0)) vr(r)=%d vr(mr)=%d\n", i, am1.vr_r, am1.vr_mr);
- assert(rlc_am_in_rx_window(&am1, i) > 0);
- }
-
- for (i = am1.vr_mr ; i <= 0xFFFF; i ++) {
- assert(rlc_am_in_rx_window(&am1, i) == 0);
- }
- }
-
- // RX window with vr_mr < vr_r
- for (j = RLC_AM_SN_MODULO-RLC_AM_WINDOW_SIZE; j < RLC_AM_SN_MODULO; j++) {
- am1.vr_r = j;
- am1.vr_mr = (am1.vr_r + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
-
- for (i = 0 ; i < am1.vr_mr; i ++) {
- assert(rlc_am_in_rx_window(&am1, i) > 0);
- }
-
- for (i = j ; i < am1.vr_r; i ++) {
- assert(rlc_am_in_rx_window(&am1, i) == 0);
- }
-
- for (i = am1.vr_r ; i < RLC_AM_SN_MODULO; i ++) {
- assert(rlc_am_in_rx_window(&am1, i) > 0);
- }
-
- for (i = RLC_AM_SN_MODULO ; i < 0xFFFF; i ++) {
- assert(rlc_am_in_rx_window(&am1, i) == 0);
- }
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_am_v9_3_0_test_read_write_bit_field()
-//-----------------------------------------------------------------------------
-{
- unsigned int bit_pos_write = 0; // range from 0 (MSB/left) to 7 (LSB/right)
- uint8_t *byte_pos_write = g_buffer;
- unsigned int bit_pos_read = 0; // range from 0 (MSB/left) to 7 (LSB/right)
- uint8_t *byte_pos_read = g_buffer;
- uint16_t read_value;
- memset (g_buffer, 0, sizeof(g_buffer));
- // byte 0
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- assert(g_buffer[0] == 0x96);
- assert(g_buffer[1] == 0x00);
- // byte 1
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
- assert(g_buffer[0] == 0x96);
- assert(g_buffer[1] == 0xD9);
- assert(g_buffer[2] == 0x00);
- // byte 2
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 1);
- assert(g_buffer[0] == 0x96);
- assert(g_buffer[1] == 0xD9);
- assert(g_buffer[2] == 0x11);
- assert(g_buffer[3] == 0x00);
- // byte 3 & 4
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 2, 0x2);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 2, 0x1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 2, 0x2);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0x0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 2, 0x3);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0x0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 2, 0x2);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 2, 0x1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 2, 0x3);
- assert(g_buffer[0] == 0x96);
- assert(g_buffer[1] == 0xD9);
- assert(g_buffer[2] == 0x11);
- assert(g_buffer[3] == 0x99);
- assert(g_buffer[4] == 0xA7);
- assert(g_buffer[5] == 0x00);
- // byte 5 & 6
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 3, 0x7);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 3, 0x5);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 3, 0x1);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 3, 0x0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 3, 0x3);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0x0);
- assert(g_buffer[0] == 0x96);
- assert(g_buffer[1] == 0xD9);
- assert(g_buffer[2] == 0x11);
- assert(g_buffer[3] == 0x99);
- assert(g_buffer[4] == 0xA7);
- assert(g_buffer[5] == 0xF4);
- assert(g_buffer[6] == 0x86);
- assert(g_buffer[7] == 0x00);
- // byte 7 & 8 & 9
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 4, 0xC);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 4, 0xD);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 1, 0x0);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 4, 0xF);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 4, 0xA);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 4, 0xB);
- rlc_am_write8_bit_field(&byte_pos_write, &bit_pos_write, 3, 0x0);
- assert(g_buffer[0] == 0x96);
- assert(g_buffer[1] == 0xD9);
- assert(g_buffer[2] == 0x11);
- assert(g_buffer[3] == 0x99);
- assert(g_buffer[4] == 0xA7);
- assert(g_buffer[5] == 0xF4);
- assert(g_buffer[6] == 0x86);
- assert(g_buffer[7] == 0xCD);
- assert(g_buffer[8] == 0x7D);
- assert(g_buffer[9] == 0x58);
- assert(g_buffer[10] == 0x00);
- // byte 10 & 11 & 12 & 13 & 14
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 10, 0x2AB);
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 10, 0x1BA);
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 10, 0x2AF);
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 10, 0x134);
- assert(g_buffer[0] == 0x96);
- assert(g_buffer[1] == 0xD9);
- assert(g_buffer[2] == 0x11);
- assert(g_buffer[3] == 0x99);
- assert(g_buffer[4] == 0xA7);
- assert(g_buffer[5] == 0xF4);
- assert(g_buffer[6] == 0x86);
- assert(g_buffer[7] == 0xCD);
- assert(g_buffer[8] == 0x7D);
- assert(g_buffer[9] == 0x58);
- assert(g_buffer[10] == 0xAA);
- assert(g_buffer[11] == 0xDB);
- assert(g_buffer[12] == 0xAA);
- assert(g_buffer[13] == 0xBD);
- assert(g_buffer[14] == 0x34);
- assert(g_buffer[15] == 0x00);
- // byte 15 - 29
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 15, 0x701F);
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 15, 0x612E);
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 15, 0x523D);
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 15, 0x434C);
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 15, 0x345B);
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 15, 0x256A);
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 15, 0x1679);
- rlc_am_write16_bit_field(&byte_pos_write, &bit_pos_write, 15, 0x0788);
- assert(g_buffer[0] == 0x96);
- assert(g_buffer[1] == 0xD9);
- assert(g_buffer[2] == 0x11);
- assert(g_buffer[3] == 0x99);
- assert(g_buffer[4] == 0xA7);
- assert(g_buffer[5] == 0xF4);
- assert(g_buffer[6] == 0x86);
- assert(g_buffer[7] == 0xCD);
- assert(g_buffer[8] == 0x7D);
- assert(g_buffer[9] == 0x58);
- assert(g_buffer[10] == 0xAA);
- assert(g_buffer[11] == 0xDB);
- assert(g_buffer[12] == 0xAA);
- assert(g_buffer[13] == 0xBD);
- assert(g_buffer[14] == 0x34);
- assert(g_buffer[15] == 0xE0);
- assert(g_buffer[16] == 0x3F);
- assert(g_buffer[17] == 0x84);
- assert(g_buffer[18] == 0xBA);
- assert(g_buffer[19] == 0x91);
- assert(g_buffer[20] == 0xEC);
- assert(g_buffer[21] == 0x34);
- assert(g_buffer[22] == 0xC6);
- assert(g_buffer[23] == 0x8B);
- assert(g_buffer[24] == 0x69);
- assert(g_buffer[25] == 0x5A);
- assert(g_buffer[26] == 0x8B);
- assert(g_buffer[27] == 0x3C);
- assert(g_buffer[28] == 0x87);
- assert(g_buffer[29] == 0x88);
- assert(g_buffer[30] == 0x00);
- // 0x96 0xD9
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b0
- assert(read_value == 1);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b1
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b2
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b3
- assert(read_value == 1);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b4
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b5
- assert(read_value == 1);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b6
- assert(read_value == 1);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b7
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b8
- assert(read_value == 1);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b9
- assert(read_value == 1);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b10
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b11
- assert(read_value == 1);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b12
- assert(read_value == 1);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b13
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b14
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);// b15
- assert(read_value == 1);
- // 0x11 0x99
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 2);
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 2);
- assert(read_value == 1);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 2);
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 2);
- assert(read_value == 3);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 2);
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);
- assert(read_value == 1);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 2);
- assert(read_value == 2);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 2);
- assert(read_value == 1);
- // 0xA7 0xF4 0x86 0xCD 0x7D;
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x29F);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x348);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x1B3);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x17D);
- // 0x58 0xAA 0xDB 0xAA 0xBD 0x34
- // 0xE0 0x3F 0x84 0xBA 0x91 0xEC
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x2C5);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x15B);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x1D5);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x17A);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 1);
- assert(read_value == 0);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x34E);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x00F);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x384);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x2EA);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 10);
- assert(read_value == 0x11E);
- bit_pos_read = 0;
- byte_pos_read = g_buffer;
- // 0x96 0xD9 0x11 0x99 0xA7 0xF4 0x86 0xCD 0x7D 0x58 0xAA 0xDB 0xAA 0xBD 0x34
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 15);
- assert(read_value == 0x4B6C);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 15);
- assert(read_value == 0x4466);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 15);
- assert(read_value == 0x34FE);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 15);
- assert(read_value == 0x486C);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 15);
- assert(read_value == 0x6BEA);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 15);
- assert(read_value == 0x62AB);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 15);
- assert(read_value == 0x3755);
- read_value = rlc_am_read_bit_field(&byte_pos_read, &bit_pos_read, 15);
- assert(read_value == 0x3D34);
-}
-//-----------------------------------------------------------------------------
-void rlc_am_v9_3_0_test_reset_sdus()
-//-----------------------------------------------------------------------------
-{
- int i, j;
-
- for (j = 0; j < 2; j++) {
- for (i = 0; i < TEST_MAX_SEND_SDU; i++) {
- g_send_sdu_ids[i][j]= -1;
- }
-
- g_send_id_write_index[j] = 0;
- g_send_id_read_index[j] = 0;
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_am_v9_3_0_test_send_sdu(rlc_am_entity_t *am_txP, int sdu_indexP)
-//-----------------------------------------------------------------------------
-{
- mem_block_t *sdu;
- sdu = get_free_mem_block (strlen(g_sdus[sdu_indexP]) + 1 + sizeof (struct rlc_am_data_req_alloc), __func__);
-
- if (sdu != NULL) {
- // PROCESS OF COMPRESSION HERE:
- printf("[FRAME %05d][RLC][MOD %02d][RB %02d] TX SDU %d %04d bytes\n",g_frame,am_txP->module_id, am_txP->rb_id, sdu_indexP, strlen(g_sdus[sdu_indexP]) + 1);
- memset (sdu->data, 0, sizeof (struct rlc_am_data_req_alloc));
- strcpy (&sdu->data[sizeof (struct rlc_am_data_req_alloc)],g_sdus[sdu_indexP]);
- ((struct rlc_am_data_req *) (sdu->data))->data_size = strlen(g_sdus[sdu_indexP])+ 1;
- ((struct rlc_am_data_req *) (sdu->data))->conf = 1;
- ((struct rlc_am_data_req *) (sdu->data))->mui = g_mui++;
- ((struct rlc_am_data_req *) (sdu->data))->data_offset = sizeof (struct rlc_am_data_req_alloc);
- rlc_am_data_req(am_txP, g_frame, sdu);
- g_send_sdu_ids[g_send_id_write_index[am_txP->rb_id]++][am_txP->rb_id] = sdu_indexP;
- assert(g_send_id_write_index[am_txP->rb_id] < TEST_MAX_SEND_SDU);
- } else {
- printf("Out of memory error\n");
- // exit(-1);
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int *drop_countP, int *tx_packetsP,
- int *dropped_tx_packetsP) { //-----------------------------------------------------------------------------
- mem_block_t *tb_src;
- mem_block_t *tb_dst;
- unsigned int tb_size;
- data_indP->no_tb = 0;
-
- while (data_requestP->data.nb_elements > 0) {
- tb_src = list_remove_head (&data_requestP->data);
-
- if (tb_src != NULL) {
- tb_size = ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits >> 3;
- printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %u sizeof (mac_rlc_max_rx_header_size_t) %d\n",
- ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits,
- tb_size, sizeof (mac_rlc_max_rx_header_size_t));
- *tx_packetsP = *tx_packetsP + 1;
-
- if (*drop_countP == 0) {
- tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size, __func__);
-
- if (tb_dst != NULL) {
- ((struct mac_tb_ind *) (tb_dst->data))->first_bit = 0;
- ((struct mac_tb_ind *) (tb_dst->data))->data_ptr = &tb_dst->data[sizeof (mac_rlc_max_rx_header_size_t)];
- ((struct mac_tb_ind *) (tb_dst->data))->size = tb_size;
- ((struct mac_tb_ind *) (tb_dst->data))->error_indication = 0;
- memcpy(((struct mac_tb_ind *) (tb_dst->data))->data_ptr,
- &((struct mac_tb_req *) (tb_src->data))->data_ptr[0],
- tb_size);
- list_add_tail_eurecom(tb_dst, &data_indP->data);
- data_indP->no_tb += 1;
- } else {
- printf("Out of memory error\n");
- // exit(-1);
- }
- } else {
- printf("[RLC-LOOP] DROPPING 1 TB\n");
- *drop_countP = *drop_countP - 1;
- *dropped_tx_packetsP = *dropped_tx_packetsP + 1;
- }
-
- free_mem_block(tb_src, __func__);
-
- if (data_indP->no_tb > 0) {
- printf("[RLC-LOOP] Exchange %d TBs\n",data_indP->no_tb);
- }
- }
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_am_v9_3_0_test_exchange_pdus(rlc_am_entity_t *am_txP,
- rlc_am_entity_t *am_rxP,
- uint16_t bytes_txP,
- uint16_t bytes_rxP)
-//-----------------------------------------------------------------------------
-{
- struct mac_data_req data_request_tx;
- struct mac_data_req data_request_rx;
- struct mac_data_ind data_ind_tx;
- struct mac_data_ind data_ind_rx;
- struct mac_status_ind tx_status;
- struct mac_status_resp mac_rlc_status_resp_tx;
- struct mac_status_resp mac_rlc_status_resp_rx;
- memset(&data_request_tx, 0, sizeof(struct mac_data_req));
- memset(&data_request_rx, 0, sizeof(struct mac_data_req));
- memset(&data_ind_tx, 0, sizeof(struct mac_data_ind));
- memset(&data_ind_rx, 0, sizeof(struct mac_data_ind));
- memset(&tx_status, 0, sizeof(struct mac_status_ind));
- memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp));
- memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp));
- mac_rlc_status_resp_tx = rlc_am_mac_status_indication(am_txP, g_frame, bytes_txP, tx_status);
- data_request_tx = rlc_am_mac_data_request(am_txP, g_frame);
- mac_rlc_status_resp_rx = rlc_am_mac_status_indication(am_rxP, g_frame, bytes_rxP, tx_status);
- data_request_rx = rlc_am_mac_data_request(am_rxP, g_frame);
- rlc_am_v9_3_0_test_mac_rlc_loop(&data_ind_rx, &data_request_tx, &g_drop_tx, &g_tx_packets, &g_dropped_tx_packets);
- rlc_am_v9_3_0_test_mac_rlc_loop(&data_ind_tx, &data_request_rx, &g_drop_rx, &g_rx_packets, &g_dropped_rx_packets);
- rlc_am_mac_data_indication(am_rxP, g_frame, am_txP->is_enb, data_ind_rx);
- rlc_am_mac_data_indication(am_txP, g_frame, am_txP->is_enb, data_ind_tx);
- g_frame += 1;
- //rlc_am_tx_buffer_display(am_txP,NULL);
- //assert(am_txP->t_status_prohibit.time_out != 1);
- //assert(am_rxP->t_status_prohibit.time_out != 1);
- //assert(!((am_txP->vt_a == 954) && (am_txP->vt_s == 53)));
- //assert(g_frame <= 151);
- //check_mem_area(NULL);
- //display_mem_load();
-}
-//-----------------------------------------------------------------------------
-void rlc_am_v9_3_0_test_data_conf(module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP)
-//-----------------------------------------------------------------------------
-{
- if (statusP == RLC_SDU_CONFIRM_YES) {
- printf("[FRAME %05d][RLC][MOD %02d][RB %02d] CONFIRM SEND SDU MUI %05d\n",g_frame,module_idP, rb_idP, muiP);
- } else {
- printf("[FRAME %05d][RLC][MOD %02d][RB %02d] CONFIRM LOST SDU MUI %05d\n",g_frame,module_idP, rb_idP, muiP);
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_am_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_size_t sizeP, mem_block_t *sduP)
-//-----------------------------------------------------------------------------
-{
- int i;
-
- for (i = 0; i < 37; i++) {
- if (strcmp(g_sdus[i], sduP->data) == 0) {
- printf("[FRAME %05d][RLC][MOD %02d][RB %02d] RX SDU %d %04d bytes\n",g_frame,module_idP, rb_idP, i, sizeP);
- assert(TEST_MAX_SEND_SDU > g_send_id_read_index[rb_idP]);
- assert(g_send_id_write_index[rb_idP^1] > g_send_id_read_index[rb_idP]);
-
- if (g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1] != i) {
- printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP]-2,
- g_send_sdu_ids[g_send_id_read_index[rb_idP]-2][rb_idP^1]);
- printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP]-1,
- g_send_sdu_ids[g_send_id_read_index[rb_idP]-1][rb_idP^1]);
- printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP],
- g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1]);
- printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_id_read_index = %d sdu sent = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP], i);
- }
-
- assert(g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1] == i);
- g_send_id_read_index[rb_idP] += 1;
- free_mem_block(sduP, __func__);
- return;
- }
- }
-
- printf("[FRAME %05d][RLC][MOD %d][RB %d] RX UNKNOWN SDU %04d bytes\n",g_frame,module_idP, rb_idP, sizeP);
- free_mem_block(sduP, __func__);
- assert(1==2);
-}
-//-----------------------------------------------------------------------------
-void rlc_am_v9_3_0_test_tx_rx()
-//-----------------------------------------------------------------------------
-{
- uint16_t max_retx_threshold = 255;
- uint16_t poll_pdu = 8;
- uint16_t poll_byte = 1000;
- uint32_t t_poll_retransmit = 15;
- uint32_t t_reordering = 5000;
- uint32_t t_status_prohibit = 10;
- int i,j,r;
- srand (0);
- rlc_am_init(&g_am_tx, g_frame);
- rlc_am_init(&g_am_rx, g_frame);
- rlc_am_set_debug_infos(&g_am_tx, g_frame, 0, 0, 0, 1, 1 /* LC-id = DRB-id */);
- rlc_am_set_debug_infos(&g_am_rx, g_frame, 1, 1, 1, 1, 1 /* LC-id = DRB-id */);
- rlc_am_configure(&g_am_tx, g_frame, max_retx_threshold, poll_pdu, poll_byte, t_poll_retransmit, t_reordering, t_status_prohibit);
- rlc_am_configure(&g_am_rx, g_frame, max_retx_threshold, poll_pdu, poll_byte, t_poll_retransmit, t_reordering, t_status_prohibit);
-#ifdef TEST1
- srand (0);
- rlc_am_v9_3_0_test_reset_sdus();
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 1);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 8000, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 8000, 200);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 2);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 8000, 200);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 1);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 2);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 8000, 200);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 1);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 2);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 3);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 4);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 5);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 6);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 1000, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 1000, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 1000, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 1000, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 1000, 200);
- rlc_am_rx_list_display(&g_am_tx, "RLC-AM TX:");
- rlc_am_rx_list_display(&g_am_rx, "RLC-AM RX:");
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_am_v9_3_0_test 1: END OF SIMPLE TEST SEVERAL SDUs IN PDU\n\n\n\n");
- rlc_am_v9_3_0_test_reset_sdus();
-
- // RANDOM TESTS
- for (i = g_send_id_write_index[0]; g_send_id_write_index[0] < TEST_MAX_SEND_SDU-12; i++) {
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 1);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 8000, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 8000, 200);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 2);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 8000, 200);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 1);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 2);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 8000, 200);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 1);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 2);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 3);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 4);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 5);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 6);
-
- for (i = 0; i < 50; i++) {
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 200, 200);
- }
-
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- }
-
- rlc_am_rx_list_display(&g_am_tx, "RLC-AM TX:");
- rlc_am_rx_list_display(&g_am_rx, "RLC-AM RX:");
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_am_v9_3_0_test 1: END OF TEST SEVERAL SDUs IN PDU\n\n\n\n");
-#endif
-#ifdef TEST2
- srand (0);
- rlc_am_v9_3_0_test_reset_sdus();
- // BIG SDU SMALL PDUS NO ERRORS
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 1);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 3, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 3, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 3, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 4, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 5, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 6, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 7, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 8, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 9, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 10, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 11, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 12, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 13, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 16, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 17, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 18, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 19, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 20, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 21, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 22, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 23, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 24, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 25, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 26, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 27, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 28, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 29, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 2000, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 2000, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 2000, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 2000, 200);
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 1);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 30, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 31, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 32, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 33, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 34, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 35, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 36, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 37, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 38, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 39, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 40, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 41, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 42, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 43, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 44, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 45, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 46, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 47, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 48, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 49, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 50, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 51, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 52, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 53, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 54, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 55, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 56, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 57, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 58, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 59, 200);
-
- //rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 60, 200); if uncomment: error because too many segments of SDU
- for (i = 0; i < 24; i++) {
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 2000, 200);
- }
-
- rlc_am_rx_list_display(&g_am_tx, "RLC-AM TX:");
- rlc_am_rx_list_display(&g_am_rx, "RLC-AM RX:");
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_am_v9_3_0_test 2: END OF TEST BIG SDU SMALL PDUs\n\n\n\n");
-#endif
-#ifdef TEST3
- srand (0);
- rlc_am_v9_3_0_test_reset_sdus();
- // BIG SDU SMALL PDUS ERRORs ()
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, 1);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 3, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 3, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 3, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 4, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 5, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 6, 200);
- g_drop_tx = 1;
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 7, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 8, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 9, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 10, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 11, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 12, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 13, 200);
- g_drop_tx = 2;
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 16, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 17, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 18, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 19, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 20, 200);
- g_drop_tx = 4;
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 21, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 22, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 23, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 24, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 25, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 26, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
-
- for (i = 0; i < 30; i++) {
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 500, 200);
- }
-
- // Purge
- for (i = 0; i < 24; i++) {
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, i);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
- }
-
- for (i = 0; i < 100; i++) {
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 200);
- }
-
- rlc_am_rx_list_display(&g_am_tx, "RLC-AM TX:");
- rlc_am_rx_list_display(&g_am_rx, "RLC-AM RX:");
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_am_v9_3_0_test 3: END OF TEST BIG SDU SMALL PDUs WITH ERRORS ON PHY LAYER\n\n\n\n");
-#endif
-#ifdef TEST4
- srand (0);
- rlc_am_v9_3_0_test_reset_sdus();
-
- for (i = 2 ; i < 37 ; i++) {
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, i);
- }
-
- for (i = 2 ; i < 37 ; i++) {
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, i);
- }
-
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 30, 100);
- g_drop_tx = 4;
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 100, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 100, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 100, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 300, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 20, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 20, 100);
- g_drop_tx = 4;
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 20, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 15, 100);
- t_poll_retransmit = 6;
- rlc_am_configure(&g_am_tx, g_frame, max_retx_threshold, poll_pdu, poll_byte, t_poll_retransmit, t_reordering, t_status_prohibit);
-
- for (i = 0 ; i < 50 ; i++) {
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 100, 100);
- }
-
- //exit(0);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 400, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 400, 100);
- //exit(0);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 400, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- //exit(0);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 14, 100);
- rlc_am_rx_list_display(&g_am_tx, "RLC-AM TX:");
- rlc_am_rx_list_display(&g_am_rx, "RLC-AM RX:");
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_am_v9_3_0_test 4: END OF TEST SEVERAL SDUS IN PDUs WITH ERRORS ON PHY LAYER\n\n\n\n");
- assert (g_send_id_write_index[0] < TEST_MAX_SEND_SDU);
-#endif
-#ifdef TEST5
- srand (0);
- rlc_am_v9_3_0_test_reset_sdus();
-
- // RANDOM TESTS
- for (i = 0; g_send_id_write_index < TEST_MAX_SEND_SDU-1; i++) {
- //for (i = 0; g_send_id_write_index < 434; i++) {
- printf("AM.TX SDU %d\n", g_am_tx.nb_sdu);
-
- if (g_am_tx.nb_sdu < (RLC_AM_SDU_CONTROL_BUFFER_SIZE - 16)) {
- g_random_sdu = rand() % 37;
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, g_random_sdu);
- }
-
- //g_random_nb_frames = (rand() % 2) + 1;
- g_random_nb_frames = 1;
-
- for (j = 0; j < g_random_nb_frames; j++) {
- g_random_tx_pdu_size = rand() % RLC_SDU_MAX_SIZE;
- g_random_rx_pdu_size = rand() % RLC_SDU_MAX_SIZE;
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
- }
-
- rlc_am_rx_list_display(&g_am_tx, "RLC-AM TX:");
- rlc_am_rx_list_display(&g_am_rx, "RLC-AM RX:");
- printf("g_send_id_read_index %d g_send_id_write_index %d\n", g_send_id_read_index[1], g_send_id_write_index[0]);
-
- for (j = 0; j < 100; j++) {
- g_random_tx_pdu_size = rand() % RLC_SDU_MAX_SIZE;
- g_random_rx_pdu_size = rand() % RLC_SDU_MAX_SIZE;
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
-
- rlc_am_rx_list_display(&g_am_tx, "RLC-AM TX:");
- rlc_am_rx_list_display(&g_am_rx, "RLC-AM RX:");
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_am_v9_3_0_test 5: END OF TEST RANDOM TX ONLY WITH NO ERRORS ON PHY LAYER\n\n\n\n");
-#endif
-
- for (r = 0; r < 128; r++) {
- srand (r);
-#ifdef TEST6
-
- for (g_target_tx_error_rate = 0; g_target_tx_error_rate < TARGET_MAX_TX_ERROR_RATE; g_target_tx_error_rate++) {
- for (g_target_rx_error_rate = 0; g_target_rx_error_rate < TARGET_MAX_RX_ERROR_RATE; g_target_rx_error_rate++) {
- g_tx_packets = 0;
- g_dropped_tx_packets = 0;
- g_rx_packets = 0;
- g_dropped_rx_packets = 0;
- rlc_am_v9_3_0_test_reset_sdus();
-
- // RANDOM TESTS
- for (i = g_send_id_write_index[0]; g_send_id_write_index[0] < TEST_MAX_SEND_SDU-1; i++) {
- printf("AM.TX SDU %d\n", g_am_tx.nb_sdu);
-
- if (g_am_tx.nb_sdu < (RLC_AM_SDU_CONTROL_BUFFER_SIZE - 2)) {
- g_random_sdu = rand() % 37;
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, g_random_sdu);
- }
-
- g_random_nb_frames = (rand() % 10) + 1;
-
- //g_random_nb_frames = 1;
- for (j = 0; j < g_random_nb_frames; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
-
- int dropped = (rand() % 3);
-
- if ((dropped == 0) && (g_tx_packets > 0)) {
- if ((((g_dropped_tx_packets + 1)*100) / g_tx_packets) <= g_target_tx_error_rate) {
- g_drop_tx = 1;
- }
- }
-
- dropped = (rand() % 3);
-
- if ((dropped == 0) && (g_rx_packets > 0)) {
- if ((((g_dropped_rx_packets + 1)*100) / g_rx_packets) <= g_target_rx_error_rate) {
- g_drop_rx = 1;
- }
- }
- }
-
- for (j = 0; j < 400; j++) {
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, 500, 500);
- }
-
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_am_v9_3_0_test 6: END OF TEST RANDOM (SEED=%d BLER TX=%d BLER RX=%d) TX ONLY WITH ERRORS ON PHY LAYER:\n\n\n\n",
- r, g_target_tx_error_rate, g_target_rx_error_rate);
- rlc_am_rx_list_display(&g_am_tx, "RLC-AM TX:");
- rlc_am_rx_list_display(&g_am_rx, "RLC-AM RX:");
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("REAL BLER TX=%d (TARGET=%d) BLER RX=%d (TARGET=%d) \n",(g_dropped_tx_packets*100)/g_tx_packets, g_target_tx_error_rate,
- (g_dropped_rx_packets*100)/g_rx_packets, g_target_rx_error_rate);
- }
- }
-
-#endif
-#ifdef TEST7
-
- for (g_target_tx_error_rate = 0; g_target_tx_error_rate < TARGET_MAX_TX_ERROR_RATE; g_target_tx_error_rate++) {
- for (g_target_rx_error_rate = 0; g_target_rx_error_rate < TARGET_MAX_RX_ERROR_RATE; g_target_rx_error_rate++) {
- g_tx_packets = 0;
- g_dropped_tx_packets = 0;
- g_rx_packets = 0;
- g_dropped_rx_packets = 0;
- rlc_am_v9_3_0_test_reset_sdus();
-
- for (i = g_send_id_write_index[0]; g_send_id_write_index[0] < TEST_MAX_SEND_SDU-1; i++) {
- if (g_am_tx.nb_sdu < (RLC_AM_SDU_CONTROL_BUFFER_SIZE - 2)) {
- g_random_sdu = rand() % 37;
- rlc_am_v9_3_0_test_send_sdu(&g_am_tx, g_random_sdu);
-
- if (g_am_rx.nb_sdu < (RLC_AM_SDU_CONTROL_BUFFER_SIZE - 2)) {
- g_random_sdu = rand() % 37;
- rlc_am_v9_3_0_test_send_sdu(&g_am_rx, g_random_sdu);
- } else {
- i = i-1;
- }
- } else {
- if (g_am_rx.nb_sdu < (RLC_AM_SDU_CONTROL_BUFFER_SIZE - 2)) {
- g_random_sdu = rand() % 37;
- rlc_am_v9_3_0_test_send_sdu(&g_am_rx, g_random_sdu);
- } else {
- i = i-1;
- }
- }
-
- g_random_nb_frames = rand() % 4;
-
- for (j = 0; j < g_random_nb_frames; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
-
- int dropped = (rand() % 3);
-
- if ((dropped == 0) && (g_tx_packets > 0)) {
- if ((((g_dropped_tx_packets + 1)*100) / g_tx_packets) <= g_target_tx_error_rate) {
- g_drop_tx = 1;
- }
- }
-
- dropped = (rand() % 3);
-
- if ((dropped == 0) && (g_rx_packets > 0)) {
- if ((((g_dropped_rx_packets + 1)*100) / g_rx_packets) <= g_target_rx_error_rate) {
- g_drop_rx = 1;
- }
- }
- }
-
- for (j = 0; j < 100; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_am_v9_3_0_test_exchange_pdus(&g_am_tx, &g_am_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
-
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_am_v9_3_0_test 7: END OF TEST RANDOM (SEED=%d BLER TX=%d BLER RX=%d ) TX RX WITH ERRORS ON PHY LAYER:\n\n\n\n",
- r, g_target_tx_error_rate, g_target_rx_error_rate);
- rlc_am_rx_list_display(&g_am_tx, "RLC-AM TX:");
- rlc_am_rx_list_display(&g_am_rx, "RLC-AM RX:");
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- assert (g_send_id_read_index[0] == g_send_id_write_index[1]);
- printf("REAL BLER TX=%d (TARGET=%d) BLER RX=%d (TARGET=%d) \n",(g_dropped_tx_packets*100)/g_tx_packets, g_target_tx_error_rate,
- (g_dropped_rx_packets*100)/g_rx_packets, g_target_rx_error_rate);
- }
- }
-
-#endif
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_am_v9_3_0_test_print_trace (void)
-//-----------------------------------------------------------------------------
-{
- void *array[100];
- size_t size;
- char **strings;
- size_t i;
- size = backtrace (array, 100);
- strings = backtrace_symbols (array, size);
- printf ("Obtained %lu stack frames.\n", (unsigned long)size);
-
-
- for (i = 0; i < size; i++) {
- printf ("%s\n", strings[i]);
- }
-
- free (strings);
-}
-
-//-----------------------------------------------------------------------------
-void rlc_am_v9_3_0_test(void)
-//-----------------------------------------------------------------------------
-{
- // initscr();
- // cbreak();
- // keypad(stdscr, true);
- // under test
- pool_buffer_init();
- set_comp_log(RLC, LOG_ERR, LOG_MED, 1);
- rlc_am_v9_3_0_test_tx_rx();
- // already tested
- rlc_am_v9_3_0_test_windows();
- rlc_am_v9_3_0_test_read_write_bit_field();
- printf("rlc_am_v9_3_0_test: END OF TESTS\n");
- exit(0);
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.h
deleted file mode 100644
index 6be3867b10..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_test.h
-* \brief This file defines the prototypes of RLC AM test functions.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-* \note
-* \bug
-* \warning
-*/
-# ifndef __RLC_AM_TEST_H__
-# define __RLC_AM_TEST_H__
-rlc_am_entity_t g_am_tx;
-rlc_am_entity_t g_am_rx;
-
-void rlc_am_v9_3_0_test_windows();
-void rlc_am_v9_3_0_test_read_write_bit_field();
-void rlc_am_v9_3_0_test_data_conf(module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP);
-void rlc_am_v9_3_0_test_send_sdu(rlc_am_entity_t *am_txP, int sdu_indexP);
-void rlc_am_v9_3_0_test_exchange_pdus(rlc_am_entity_t *am_txP,rlc_am_entity_t *am_RxP,
- uint16_t bytes_txP,uint16_t bytes_rxP);
-void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int* drop_countP, int *tx_packetsP, int* dropped_tx_packetsP);
-void rlc_am_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_size_t sizeP,
- mem_block_t *sduP);
-void rlc_am_v9_3_0_test_tx_rx();
-void rlc_am_v9_3_0_test_print_trace (void);
-void rlc_am_v9_3_0_test();
-# endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c
deleted file mode 100644
index 7e3e120477..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_TIMER_POLL_RETRANSMIT_C 1
-//-----------------------------------------------------------------------------
-//#include "rtos_header.h"
-#include "platform_types.h"
-#include "common/platform_constants.h"
-//-----------------------------------------------------------------------------
-#include "rlc_am.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-//-----------------------------------------------------------------------------
-void
-rlc_am_check_timer_poll_retransmit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP
-)
-{
- // 5.2.2.3 Expiry of t-PollRetransmit
- // Upon expiry of t-PollRetransmit, the transmitting side of an AM RLC entity shall:
- // - if both the transmission buffer and the retransmission buffer are empty (excluding transmitted RLC data PDU
- // awaiting for acknowledgements); or
- // - if no new RLC data PDU can be transmitted (e.g. due to window stalling):
- // - consider the AMD PDU with SN = VT(S) – 1 for retransmission; or
- // - consider any AMD PDU which has not been positively acknowledged for retransmission;
- // - include a poll in a RLC data PDU as described in section 5.2.2.1.
-
- if (rlc_pP->t_poll_retransmit.running) {
- if (
- // CASE 1: start time out
- // +-----------+------------------+----------+
- // | |******************| |
- // +-----------+------------------+----------+
- //FRAME # 0 FRAME MAX
- ((rlc_pP->t_poll_retransmit.ms_start < rlc_pP->t_poll_retransmit.ms_time_out) &&
- ((PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) >= rlc_pP->t_poll_retransmit.ms_time_out) ||
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) < rlc_pP->t_poll_retransmit.ms_start))) ||
- // CASE 2: time out start
- // +-----------+------------------+----------+
- // |***********| |**********|
- // +-----------+------------------+----------+
- //FRAME # 0 FRAME MAX VALUE
- ((rlc_pP->t_poll_retransmit.ms_start > rlc_pP->t_poll_retransmit.ms_time_out) &&
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) < rlc_pP->t_poll_retransmit.ms_start) &&
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) >= rlc_pP->t_poll_retransmit.ms_time_out))
- ) {
- //if (rlc_pP->t_poll_retransmit.frame_time_out <= ctxt_pP->frame) {
- rlc_pP->t_poll_retransmit.running = 0;
- rlc_pP->t_poll_retransmit.timed_out = 1;
- rlc_pP->stat_timer_poll_retransmit_timed_out += 1;
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T_POLL_RETRANSMIT] TIME-OUT\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
-
- /* Check for any retransmittable PDU if Buffer Occupancy empty or window stall */
- if (((rlc_pP->sdu_buffer_occupancy == 0) && (rlc_pP->retrans_num_bytes_to_retransmit == 0)) ||
- (rlc_pP->vt_s == rlc_pP->vt_ms)) {
- // force BO to be > 0
- rlc_sn_t sn = RLC_AM_PREV_SN(rlc_pP->vt_s);
- rlc_sn_t sn_end = RLC_AM_PREV_SN(rlc_pP->vt_a);
- rlc_am_tx_data_pdu_management_t *tx_data_pdu_buffer_p;
-
- /* Look for the first retransmittable PDU starting from vtS - 1 */
- while (sn != sn_end) {
- tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE];
- //AssertFatal (tx_data_pdu_buffer_p->mem_block != NULL, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n",
- // sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- if(tx_data_pdu_buffer_p->mem_block == NULL){
- LOG_E(RLC, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n",
- sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id);
- sn = RLC_AM_PREV_SN(sn);
- continue;
- }
-
- if ((tx_data_pdu_buffer_p->flags.ack == 0) && (tx_data_pdu_buffer_p->flags.max_retransmit == 0)) {
- tx_data_pdu_buffer_p->flags.retransmit = 1;
- tx_data_pdu_buffer_p->retx_payload_size = tx_data_pdu_buffer_p->payload_size;
- if (tx_data_pdu_buffer_p->retx_count == tx_data_pdu_buffer_p->retx_count_next) {
- tx_data_pdu_buffer_p->retx_count_next ++;
- }
- rlc_pP->retrans_num_pdus += 1;
- rlc_pP->retrans_num_bytes_to_retransmit += tx_data_pdu_buffer_p->payload_size;
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T_POLL_RETRANSMIT] TIME-OUT PUT SN=%d in ReTx Buffer\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),tx_data_pdu_buffer_p->sn);
- break;
- }
- else
- {
- sn = RLC_AM_PREV_SN(sn);
- }
- }
- }
-
-
- rlc_pP->force_poll = true;
- //BugFix : new ms_time_out is computed when next poll is transmitter
- }
- }
-}
-//-----------------------------------------------------------------------------
-int
-rlc_am_is_timer_poll_retransmit_timed_out(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP
-)
-{
- return rlc_pP->t_poll_retransmit.timed_out;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_stop_and_reset_timer_poll_retransmit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP
-)
-{
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T_POLL_RETRANSMIT] STOPPED AND RESET\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- rlc_pP->t_poll_retransmit.running = 0;
- rlc_pP->t_poll_retransmit.ms_time_out = 0;
- rlc_pP->t_poll_retransmit.ms_start = 0;
- rlc_pP->t_poll_retransmit.timed_out = 0;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_start_timer_poll_retransmit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP
-)
-{
- /* Stop timer if it was previously running */
- rlc_am_stop_and_reset_timer_poll_retransmit(ctxt_pP,rlc_pP);
-
- if (rlc_pP->t_poll_retransmit.ms_duration > 0) {
- rlc_pP->t_poll_retransmit.running = 1;
- rlc_pP->t_poll_retransmit.ms_time_out = PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) + rlc_pP->t_poll_retransmit.ms_duration;
- rlc_pP->t_poll_retransmit.ms_start = PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP);
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T_POLL_RETRANSMIT] STARTED (TIME-OUT = FRAME %05d)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->t_poll_retransmit.ms_time_out);
- } else {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T_POLL_RETRANSMIT] NOT STARTED, CAUSE CONFIGURED 0 ms\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- }
-
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_init_timer_poll_retransmit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP,
- const uint32_t ms_durationP)
-{
- rlc_pP->t_poll_retransmit.running = 0;
- rlc_pP->t_poll_retransmit.ms_time_out = 0;
- rlc_pP->t_poll_retransmit.ms_start = 0;
- rlc_pP->t_poll_retransmit.ms_duration = ms_durationP;
- rlc_pP->t_poll_retransmit.timed_out = 0;
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.h
deleted file mode 100644
index 5f8fd5bedc..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_timer_poll_retransmit.h
-* \brief This file defines the prototypes of the functions manipulating the t-PollRetransmit timer.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_timers_impl_ RLC AM Timers Reference Implementation
-* @ingroup _rlc_am_internal_impl_
-* @{
-*/
-
-#ifndef __RLC_AM_TIMER_POLL_RETRANSMIT_H__
-# define __RLC_AM_TIMER_POLL_RETRANSMIT_H__
-
-/*! \fn void rlc_am_check_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
-* \brief Check if timer Poll-retransmit has timed-out, if so it is stopped and has the status "timed-out".
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-
-*/
-void rlc_am_check_timer_poll_retransmit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP);
-
-/*! \fn int rlc_am_is_timer_poll_retransmit_timed_out(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
-* \brief Boolean function, check if timer Poll-retransmit has timed-out.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \return 1 if timer Poll-retransmit has timed-out, else 0.
-*/
-int rlc_am_is_timer_poll_retransmit_timed_out(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP);
-
-/*! \fn void rlc_am_stop_and_reset_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
-* \brief Stop and reset the timer Poll-retransmit.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-
-*/
-void rlc_am_stop_and_reset_timer_poll_retransmit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP);
-
-/*! \fn void rlc_am_start_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
-* \brief Re-arm (based on RLC AM config parameter) and start timer Poll-retransmit.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] frame Frame index
-*/
-void rlc_am_start_timer_poll_retransmit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP);
-
-/*! \fn void rlc_am_init_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP)
-* \brief Initialize the timer Poll-retransmit with RLC AM time-out config parameter.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] time_outP Time-out in frame units.
-*/
-void rlc_am_init_timer_poll_retransmit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP,
- const uint32_t time_outP);
-/** @} */
-#endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c
deleted file mode 100644
index e46f9c5377..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_TIMER_POLL_REORDERING_C 1
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-#include "common/platform_constants.h"
-//-----------------------------------------------------------------------------
-#include "rlc_am.h"
-# include "LAYER2/MAC/mac_extern.h"
-#include "common/utils//LOG/log.h"
-//-----------------------------------------------------------------------------
-void
-rlc_am_check_timer_reordering(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP)
-{
-
- if (rlc_pP->t_reordering.running) {
- if (
- // CASE 1: start time out
- // +-----------+------------------+----------+
- // | |******************| |
- // +-----------+------------------+----------+
- //FRAME # 0 FRAME MAX
- ((rlc_pP->t_reordering.ms_start < rlc_pP->t_reordering.ms_time_out) &&
- ((PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) >= rlc_pP->t_reordering.ms_time_out) ||
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) < rlc_pP->t_reordering.ms_start))) ||
- // CASE 2: time out start
- // +-----------+------------------+----------+
- // |***********| |**********|
- // +-----------+------------------+----------+
- //FRAME # 0 FRAME MAX VALUE
- ((rlc_pP->t_reordering.ms_start > rlc_pP->t_reordering.ms_time_out) &&
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) < rlc_pP->t_reordering.ms_start) &&
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) >= rlc_pP->t_reordering.ms_time_out))
- ) {
- //if (rlc_pP->t_reordering.frame_time_out == ctxt_pP->frame) {
- // 5.1.3.2.4 Actions when t-Reordering expires
- // When t-Reordering expires, the receiving side of an AM RLC entity shall:
- // - update VR(MS) to the SN of the first AMD PDU with SN >= VR(X) for which not all byte segments have been
- // received;
- // - if VR(H) > VR(MS):
- // - start t-Reordering;
- // - set VR(X) to VR(H).
-
- //AssertFatal (rlc_pP->vr_x != RLC_SN_UNDEFINED, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id);
- if(rlc_pP->vr_x == RLC_SN_UNDEFINED){
- LOG_E(RLC, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id);
- return;
- }
-
-
- rlc_pP->t_reordering.running = 0;
- rlc_pP->t_reordering.timed_out = 1;
- rlc_pP->stat_timer_reordering_timed_out += 1;
-
- rlc_am_pdu_info_t* pdu_info;
- mem_block_t* cursor;
- cursor = rlc_pP->receiver_buffer.head;
- rlc_usn_t vr_ms_new = rlc_pP->vr_x;
-
- //AssertFatal (cursor != NULL, "RLC AM TReordering Expiry Rx PDU list empty LcId=%d\n", rlc_pP->channel_id);
- if(cursor == NULL){
- LOG_E(RLC, "RLC AM TReordering Expiry Rx PDU list empty LcId=%d\n", rlc_pP->channel_id);
- return;
- }
-
- /* go to memblock up to vrX*/
- pdu_info = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
- while ((cursor != NULL) && (RLC_AM_DIFF_SN(pdu_info->sn,rlc_pP->vr_r) < RLC_AM_DIFF_SN(vr_ms_new,rlc_pP->vr_r))) {
- cursor = cursor->next;
- if (cursor != NULL) {
- pdu_info = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
- }
- }
-
- /* Now find a SN for which either no PDU is received or partially received */
- while ((cursor != NULL) && (vr_ms_new != rlc_pP->vr_h) && (pdu_info->sn == vr_ms_new) && (((rlc_am_rx_pdu_management_t*)(cursor->data))->all_segments_received > 0)) {
- /* Increment vrMS if the PDU is fully received or if this is the last PDU segment */
- if ((pdu_info->rf == 0) || (pdu_info->lsf == 1)) {
- vr_ms_new = RLC_AM_NEXT_SN(vr_ms_new);
- }
- cursor = cursor->next;
- if (cursor != NULL) {
- pdu_info = &((rlc_am_rx_pdu_management_t*)(cursor->data))->pdu_info;
- }
- }
-
- /* Update vr_ms */
- rlc_pP->vr_ms = vr_ms_new;
-
-
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-REORDERING] TIME-OUT UPDATED VR(MS) %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->vr_ms);
-
- /* if new vrMS is lower than vrH, update vrX and restart timerReordering */
- if (rlc_pP->vr_ms != rlc_pP->vr_h) {
- rlc_pP->vr_x = rlc_pP->vr_h;
- rlc_pP->t_reordering.ms_time_out = PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) + rlc_pP->t_reordering.ms_duration;
-
-
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-REORDERING] TIME-OUT, RESTARTED T-REORDERING, UPDATED VR(X) to VR(R) %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->vr_x);
- }
-
- /* Trigger a STATUS report */
- RLC_AM_SET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_T_REORDERING);
- // Clear Delay flag if it was setup as it is useless due to Status PDU to be sent for TReordering expiry
- RLC_AM_CLEAR_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_TRIGGERED_DELAYED);
- rlc_pP->sn_status_triggered_delayed = RLC_SN_UNDEFINED;
-
- }
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_stop_and_reset_timer_reordering(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP)
-{
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-REORDERING] STOPPED AND RESET\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- rlc_pP->t_reordering.running = 0;
- rlc_pP->t_reordering.ms_time_out = 0;
- rlc_pP->t_reordering.ms_start = 0;
- rlc_pP->t_reordering.timed_out = 0;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_start_timer_reordering(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP)
-{
- rlc_pP->t_reordering.timed_out = 0;
-
- if (rlc_pP->t_reordering.running == 0){
- if (rlc_pP->t_reordering.ms_duration > 0) {
- rlc_pP->t_reordering.running = 1;
- rlc_pP->t_reordering.ms_time_out = PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) + rlc_pP->t_reordering.ms_duration;
- rlc_pP->t_reordering.ms_start = PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP);
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-REORDERING] STARTED (TIME-OUT = %5u ms)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->t_reordering.ms_time_out);
- } else {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-REORDERING] NOT STARTED, CAUSE CONFIGURED 0 ms\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- }
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_init_timer_reordering(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP,
- const uint32_t ms_durationP)
-{
- rlc_pP->t_reordering.running = 0;
- rlc_pP->t_reordering.ms_time_out = 0;
- rlc_pP->t_reordering.ms_start = 0;
- rlc_pP->t_reordering.ms_duration = ms_durationP;
- rlc_pP->t_reordering.timed_out = 0;
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.h
deleted file mode 100644
index bca3e83763..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_timer_reordering.h
-* \brief This file defines the prototypes of the functions manipulating the t-Reordering timer.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_timers_impl_ RLC AM Timers Reference Implementation
-* @ingroup _rlc_am_internal_impl_
-* @{
-*/
-#ifndef __RLC_AM_TIMER_REORDERING_H__
-# define __RLC_AM_TIMER_REORDERING_H__
-
-/*! \fn void rlc_am_check_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
-* \brief Check if timer reordering has timed-out, if so it is stopped and has the status "timed-out".
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_check_timer_reordering(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP);
-
-/*! \fn void rlc_am_stop_and_reset_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
-* \brief Stop and reset the timer reordering.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_stop_and_reset_timer_reordering(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP);
-
-/*! \fn void rlc_am_start_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
-* \brief Re-arm (based on RLC AM config parameter) and start timer reordering.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_start_timer_reordering(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP);
-
-/*! \fn void rlc_am_init_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP)
-* \brief Initialize the timer reordering with RLC AM time-out config parameter.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] time_outP Time-out in frameP units.
-*/
-void rlc_am_init_timer_reordering(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t* const rlc_pP,
- const uint32_t time_outP);
-/** @} */
-#endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c
deleted file mode 100644
index 7359b6a07f..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_TIMER_STATUS_PROHIBIT_C 1
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-#include "common/platform_constants.h"
-//-----------------------------------------------------------------------------
-#include "rlc_am.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-//-----------------------------------------------------------------------------
-void
-rlc_am_check_timer_status_prohibit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP)
-{
- if (rlc_pP->t_status_prohibit.ms_duration > 0) {
- if (rlc_pP->t_status_prohibit.running) {
- if (
- // CASE 1: start time out
- // +-----------+------------------+----------+
- // | |******************| |
- // +-----------+------------------+----------+
- //FRAME # 0 FRAME MAX
- ((rlc_pP->t_status_prohibit.ms_start < rlc_pP->t_status_prohibit.ms_time_out) &&
- ((PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) >= rlc_pP->t_status_prohibit.ms_time_out) ||
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) < rlc_pP->t_status_prohibit.ms_start))) ||
- // CASE 2: time out start
- // +-----------+------------------+----------+
- // |***********| |**********|
- // +-----------+------------------+----------+
- //FRAME # 0 FRAME MAX VALUE
- ((rlc_pP->t_status_prohibit.ms_start > rlc_pP->t_status_prohibit.ms_time_out) &&
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) < rlc_pP->t_status_prohibit.ms_start) &&
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) >= rlc_pP->t_status_prohibit.ms_time_out))
- ) {
-
- //if ((rlc_pP->t_status_prohibit.frame_time_out <= ctxt_pP->frame) && (rlc_pP->t_status_prohibit.frame_start)) {
- rlc_pP->t_status_prohibit.running = 0;
- rlc_pP->t_status_prohibit.timed_out = 1;
- rlc_pP->stat_timer_status_prohibit_timed_out += 1;
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-STATUS-PROHIBIT] TIME-OUT\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- //#warning TO DO rlc_am_check_timer_status_prohibit
- rlc_am_stop_and_reset_timer_status_prohibit(ctxt_pP, rlc_pP);
- /* Clear StatusProhibit flag */
- RLC_AM_CLEAR_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_PROHIBIT);
- //rlc_pP->t_status_prohibit.frame_time_out = ctxt_pP->frame + rlc_pP->t_status_prohibit.time_out;
- }
- }
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_stop_and_reset_timer_status_prohibit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP
-)
-{
- if (rlc_pP->t_status_prohibit.ms_duration > 0) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-STATUS-PROHIBIT] STOPPED AND RESET\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- rlc_pP->t_status_prohibit.running = 0;
- rlc_pP->t_status_prohibit.ms_time_out = 0;
- rlc_pP->t_status_prohibit.ms_start = 0;
- rlc_pP->t_status_prohibit.timed_out = 0;
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_am_start_timer_status_prohibit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP
-)
-{
- rlc_pP->t_status_prohibit.timed_out = 0;
-
- if (rlc_pP->t_status_prohibit.running == 0){
- if (rlc_pP->t_status_prohibit.ms_duration > 0) {
- rlc_pP->t_status_prohibit.running = 1;
- rlc_pP->t_status_prohibit.ms_time_out = rlc_pP->t_status_prohibit.ms_duration + PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP);
- rlc_pP->t_status_prohibit.ms_start = PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP);
- RLC_AM_SET_STATUS(rlc_pP->status_requested,RLC_AM_STATUS_PROHIBIT);
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-STATUS-PROHIBIT] STARTED (TIME-OUT = %u ms)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->t_status_prohibit.ms_time_out);
- LOG_D(RLC, "TIME-OUT = FRAME %u\n", rlc_pP->t_status_prohibit.ms_time_out);
- } else {
- LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-STATUS-PROHIBIT] NOT STARTED, CAUSE CONFIGURED 0 ms\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- }
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_am_init_timer_status_prohibit(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t *const rlc_pP,
- const uint32_t ms_durationP)
-{
- rlc_pP->t_status_prohibit.running = 0;
- rlc_pP->t_status_prohibit.ms_time_out = 0;
- rlc_pP->t_status_prohibit.ms_start = 0;
- rlc_pP->t_status_prohibit.ms_duration = ms_durationP;
- rlc_pP->t_status_prohibit.timed_out = 0;
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.h
deleted file mode 100644
index 0480741859..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_timer_status_prohibit.h
-* \brief This file defines the prototypes of the functions manipulating the t-StatusProhibit timer.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_timers_impl_ RLC AM Timers Reference Implementation
-* @ingroup _rlc_am_internal_impl_
-* @{
-*/
-#ifndef __RLC_AM_TIMER_STATUS_PROHIBIT_H__
-# define __RLC_AM_TIMER_STATUS_PROHIBIT_H__
-
-
-/*! \fn void rlc_am_check_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
-* \brief Check if timer status-prohibit has timed-out, if so it is stopped and has the status "timed-out".
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_check_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP);
-
-/*! \fn void rlc_am_stop_and_reset_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
-* \brief Stop and reset the timer status-prohibit.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_stop_and_reset_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP);
-
-/*! \fn void rlc_am_start_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)
-* \brief Re-arm (based on RLC AM config parameter) and start timer status-prohibit.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-*/
-void rlc_am_start_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP);
-
-/*! \fn void rlc_am_init_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP)
-* \brief Initialize the timer status-prohibit with RLC AM time-out config parameter.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] time_outP Time-out in frameP units.
-*/
-void rlc_am_init_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP);
-/** @} */
-#endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c
deleted file mode 100644
index 24f0b12214..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_AM_MODULE 1
-#define RLC_AM_WINDOWS_C 1
-//-----------------------------------------------------------------------------
-#include
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-//-----------------------------------------------------------------------------
-#include "rlc_am.h"
-#include "common/utils/LOG/log.h"
-//-----------------------------------------------------------------------------
-signed int rlc_am_in_tx_window(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t snP)
-{
- rlc_usn_t shifted_sn;
- rlc_usn_t upper_bound;
-
- if (snP >= RLC_AM_SN_MODULO) {
- return 0;
- }
-
- shifted_sn = ((rlc_usn_t)(snP - rlc_pP->vt_a)) % RLC_AM_SN_MODULO;
- upper_bound = ((rlc_usn_t)(rlc_pP->vt_ms - rlc_pP->vt_a)) % RLC_AM_SN_MODULO;
-
- if ((shifted_sn >= 0) && (shifted_sn < upper_bound)) {
- return 1;
- } else {
- return 0;
- }
-}
-//-----------------------------------------------------------------------------
-signed int
-rlc_am_in_rx_window(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t snP)
-{
- rlc_usn_t shifted_sn;
- rlc_usn_t upper_bound;
-
- if (snP >= RLC_AM_SN_MODULO) {
- return 0;
- }
-
- shifted_sn = ((rlc_usn_t)(snP - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
- upper_bound = ((rlc_usn_t)(rlc_pP->vr_mr - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
-
- if ((shifted_sn >= 0) && (shifted_sn < upper_bound)) {
- return 1;
- } else {
- return 0;
- }
-}
-//-----------------------------------------------------------------------------
-signed int
-rlc_am_sn_gte_vr_h(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t snP)
-{
- rlc_usn_t shifted_sn;
- rlc_usn_t upper_bound;
-
- if (snP >= RLC_AM_SN_MODULO) {
- return 0;
- }
-
- shifted_sn = ((rlc_usn_t)(snP - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
- upper_bound = ((rlc_usn_t)(rlc_pP->vr_h - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
-
- if (shifted_sn >= upper_bound) {
- return 1;
- } else {
- return 0;
- }
-}
-//-----------------------------------------------------------------------------
-signed int rlc_am_sn_gte_vr_x(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t snP)
-{
- rlc_usn_t shifted_sn;
- rlc_usn_t upper_bound;
-
- if (snP >= RLC_AM_SN_MODULO) {
- return 0;
- }
-
- shifted_sn = ((rlc_usn_t)(snP - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
- upper_bound = ((rlc_usn_t)(rlc_pP->vr_x - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
-
- if (shifted_sn >= upper_bound) {
- return 1;
- } else {
- return 0;
- }
-}
-//-----------------------------------------------------------------------------
-signed int
-rlc_am_sn_gt_vr_ms(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t snP)
-{
- rlc_usn_t shifted_sn;
- rlc_usn_t upper_bound;
-
- if (snP >= RLC_AM_SN_MODULO) {
- return 0;
- }
-
- shifted_sn = ((rlc_usn_t)(snP - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
- upper_bound = ((rlc_usn_t)(rlc_pP->vr_ms - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
-
- if (shifted_sn > upper_bound) {
- return 1;
- } else {
- return 0;
- }
-}
-//-----------------------------------------------------------------------------
-signed int
-rlc_am_tx_sn1_gt_sn2(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t sn1P,
- const rlc_sn_t sn2P)
-{
- rlc_usn_t shifted_sn;
- rlc_usn_t upper_bound;
-
- if ((sn1P >= RLC_AM_SN_MODULO) || (sn2P >= RLC_AM_SN_MODULO)) {
- return 0;
- }
-
- shifted_sn = ((rlc_usn_t)(sn1P - rlc_pP->vt_a)) % RLC_AM_SN_MODULO;
- upper_bound = ((rlc_usn_t)(sn2P - rlc_pP->vt_a)) % RLC_AM_SN_MODULO;
-
- if (shifted_sn > upper_bound) {
- return 1;
- } else {
- return 0;
- }
-}
-//-----------------------------------------------------------------------------
-signed int
-rlc_am_rx_sn1_gt_sn2(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t sn1P,
- const rlc_sn_t sn2P)
-{
- rlc_usn_t shifted_sn;
- rlc_usn_t upper_bound;
-
- if ((sn1P >= RLC_AM_SN_MODULO) || (sn2P >= RLC_AM_SN_MODULO)) {
- return 0;
- }
-
- shifted_sn = ((rlc_usn_t)(sn1P - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
- upper_bound = ((rlc_usn_t)(sn2P - rlc_pP->vr_r)) % RLC_AM_SN_MODULO;
-
- if (shifted_sn > upper_bound) {
- return 1;
- } else {
- return 0;
- }
-}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.h
deleted file mode 100644
index be49e94120..0000000000
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_am_windows.h
-* \brief This file defines the prototypes of the functions testing window, based on SN modulo and rx and tx protocol state variables.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_am_windowing_impl_ RLC AM Windowing Reference Implementation
-* @ingroup _rlc_am_internal_impl_
-* @{
-*/
-# ifndef __RLC_AM_WINDOWS_H__
-# define __RLC_AM_WINDOWS_H__
-//-----------------------------------------------------------------------------
-
-/*! \fn signed int rlc_am_in_tx_window(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP)
-* \brief Boolean function, check if sequence number is VT(A) <= snP < VT(MS).
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number.
-* \return 1 if snP in tx window, else 0.
-*/
-signed int rlc_am_in_tx_window(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t snP);
-
-/*! \fn signed int rlc_am_in_rx_window(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP)
-* \brief Boolean function, check if sequence number is VR(R) <= snP < VR(MR).
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number.
-* \return 1 if snP in rx window, else 0.
-*/
-signed int rlc_am_in_rx_window(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t snP);
-
-/*! \fn signed int rlc_am_sn_gte_vr_h (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP)
-* \brief Boolean function, check if sequence number is greater than or equal VR(R).
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number.
-* \return 1 if sequence number is greater than or equal VR(R), else 0.
-*/
-signed int rlc_am_sn_gte_vr_h (
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t snP);
-
-/*! \fn signed int rlc_am_sn_gte_vr_x (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP)
-* \brief Boolean function, check if sequence number is greater than or equal VR(X).
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number.
-* \return 1 if sequence number is greater than or equal VR(X), else 0.
-*/
-signed int rlc_am_sn_gte_vr_x (
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t snP);
-
-/*! \fn signed int rlc_am_sn_gt_vr_ms (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP)
-* \brief Boolean function, check if sequence number is greater than VR(MS).
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] snP Sequence number.
-* \return 1 if sequence number is greater than VR(MS), else 0.
-*/
-signed int rlc_am_sn_gt_vr_ms(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t snP);
-
-/*! \fn signed int rlc_am_tx_sn1_gt_sn2 (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t sn1P, const rlc_sn_t sn2P)
-* \brief Boolean function, in the context of the tx window, check if sn1P is greater than sn2P.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] sn1P Sequence number.
-* \param[in] sn2P Sequence number.
-* \return 1 if sn1P is greater than sn2P, else 0.
-*/
-signed int rlc_am_tx_sn1_gt_sn2(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t sn1P,
- const rlc_sn_t sn2P);
-
-/*! \fn signed int rlc_am_rx_sn1_gt_sn2(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t sn1P, const rlc_sn_t sn2P)
-* \brief Boolean function, in the context of the rx window, check if sn1P is greater than sn2P.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC AM protocol instance pointer.
-* \param[in] sn1P Sequence number.
-* \param[in] sn2P Sequence number.
-* \return 1 if sn1P is greater than sn2P, else 0.
-*/
-signed int rlc_am_rx_sn1_gt_sn2(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t* const rlc_pP,
- const rlc_sn_t sn1P,
- const rlc_sn_t sn2P);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c
deleted file mode 100644
index d699d1d6a4..0000000000
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_TM_MODULE 1
-#define RLC_TM_C 1
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-#include "common/platform_constants.h"
-//-----------------------------------------------------------------------------
-#include "rlc_tm.h"
-#include "mac_primitives.h"
-#include "rlc_primitives.h"
-#include "list.h"
-#include "LAYER2/MAC/mac_extern.h"
-//-----------------------------------------------------------------------------
-void rlc_tm_send_sdu(const protocol_ctxt_t* const ctxt_pP,
- rlc_tm_entity_t * const rlc_pP,
- const bool error_indicationP,
- uint8_t * const srcP,
- const sdu_size_t length_in_bitsP)
-{
- int length_in_bytes;
-#if DEBUG_RLC_TM_DISPLAY_ASCII_DATA
- int index;
-#endif
-#if DEBUG_RLC_TM_REASSEMBLY
- LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT"[SEND_SDU] %d bits\n",
- PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_pP),
- length_in_bitsP);
-#endif
- length_in_bytes = (length_in_bitsP + 7) >> 3;
-
- if (rlc_pP->output_sdu_in_construction == NULL) {
- rlc_pP->output_sdu_in_construction = get_free_mem_block (length_in_bytes, __func__);
- }
-
- if ((rlc_pP->output_sdu_in_construction)) {
-#if DEBUG_RLC_TM_DISPLAY_ASCII_DATA
- LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT"[SEND_SDU] DATA :",
- PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_pP));
-
- for (index = 0; index < length_in_bytes; index++) {
- LOG_T (RLC,"%c", srcP[index]);
- }
-
- LOG_T (RLC,"\n");
-#endif
-
- memcpy (&rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write], srcP, length_in_bytes);
-
- rlc_data_ind (
- ctxt_pP,
- BOOL_NOT(rlc_pP->is_data_plane),
- MBMS_FLAG_NO,
- rlc_pP->rb_id,
- length_in_bytes,
- rlc_pP->output_sdu_in_construction);
- rlc_pP->output_sdu_in_construction = NULL;
- } else {
- LOG_D (RLC,"[RLC_TM %p][SEND_SDU] ERROR OUTPUT SDU IS NULL\n", rlc_pP);
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_tm_no_segment (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_tm_entity_t *const rlc_pP
-)
-{
- mem_block_t *pdu_p = NULL;
- struct rlc_tm_tx_sdu_management *sdu_mngt_p = NULL;
- struct rlc_tm_tx_pdu_management *pdu_mngt_p = NULL;
- int nb_pdu_to_transmit = 1;
-
- // only one SDU per TTI
- while ((rlc_pP->input_sdus[rlc_pP->current_sdu_index]) && (nb_pdu_to_transmit > 0)) {
-
- sdu_mngt_p = ((struct rlc_tm_tx_sdu_management *) (rlc_pP->input_sdus[rlc_pP->current_sdu_index]->data));
-
- if (!(pdu_p = get_free_mem_block (((rlc_pP->rlc_pdu_size + 7) >> 3) + sizeof (struct rlc_tm_tx_data_pdu_struct) + GUARD_CRC_LIH_SIZE, __func__))) {
- LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT"[SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n",
- PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_pP));
- return;
- }
-
- // SHOULD BE OPTIMIZED...SOON
- pdu_mngt_p = (struct rlc_tm_tx_pdu_management *) (pdu_p->data);
- memset (pdu_p->data, 0, sizeof (struct rlc_tm_tx_pdu_management));
- pdu_mngt_p->first_byte = (uint8_t*)&pdu_p->data[sizeof (struct rlc_tm_tx_data_pdu_struct)];
-
- memcpy (pdu_mngt_p->first_byte, sdu_mngt_p->first_byte, ((rlc_pP->rlc_pdu_size + 7) >> 3));
- ((struct mac_tb_req *) (pdu_p->data))->rlc = NULL;
- ((struct mac_tb_req *) (pdu_p->data))->data_ptr = pdu_mngt_p->first_byte;
- ((struct mac_tb_req *) (pdu_p->data))->first_bit = 0;
- ((struct mac_tb_req *) (pdu_p->data))->tb_size = rlc_pP->rlc_pdu_size >> 3;
- list_add_tail_eurecom (pdu_p, &rlc_pP->pdus_to_mac_layer);
-
- rlc_pP->buffer_occupancy -= (sdu_mngt_p->sdu_size >> 3);
- free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index], __func__);
- rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
- rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % rlc_pP->size_input_sdus_buffer;
- rlc_pP->nb_sdu -= 1;
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_tm_rx (
- const protocol_ctxt_t* const ctxt_pP,
- void * const argP,
- struct mac_data_ind data_indP)
-{
-
- rlc_tm_entity_t * const rlc_p = (rlc_tm_entity_t *) argP;
- mem_block_t *tb_p;
- uint8_t *first_byte_p;
-
- rlc_p->output_sdu_size_to_write = 0; // size of sdu reassemblied
-
- while ((tb_p = list_remove_head (&data_indP.data))) {
- first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr;
-
- ((struct rlc_tm_rx_pdu_management *) (tb_p->data))->first_byte = first_byte_p;
-
- rlc_tm_send_sdu (ctxt_pP, rlc_p, (((struct mac_tb_ind *) (tb_p->data))->error_indication), first_byte_p, data_indP.tb_size);
- free_mem_block (tb_p, __func__);
- }
-}
-
-//-----------------------------------------------------------------------------
-struct mac_status_resp
-rlc_tm_mac_status_indication (
- const protocol_ctxt_t* const ctxt_pP,
- void * const rlc_pP,
- struct mac_status_ind tx_statusP)
-{
- struct mac_status_resp status_resp;
-
- status_resp.buffer_occupancy_in_bytes = ((rlc_tm_entity_t *) rlc_pP)->buffer_occupancy;
- status_resp.buffer_occupancy_in_pdus = status_resp.buffer_occupancy_in_bytes / ((rlc_tm_entity_t *) rlc_pP)->rlc_pdu_size;
- status_resp.rlc_info.rlc_protocol_state = ((rlc_tm_entity_t *) rlc_pP)->protocol_state;
- status_resp.head_sdu_creation_time = 0;
- return status_resp;
-}
-
-//-----------------------------------------------------------------------------
-struct mac_data_req
-rlc_tm_mac_data_request (
- const protocol_ctxt_t* const ctxt_pP,
- void * const rlc_pP)
-{
- rlc_tm_entity_t* rlc_p = (rlc_tm_entity_t*) rlc_pP;
- struct mac_data_req data_req;
-
- rlc_tm_no_segment (ctxt_pP, rlc_p);
- list_init (&data_req.data, NULL);
- list_add_list (&rlc_p->pdus_to_mac_layer, &data_req.data);
- data_req.buffer_occupancy_in_bytes = rlc_p->buffer_occupancy;
- data_req.buffer_occupancy_in_pdus = data_req.buffer_occupancy_in_bytes / rlc_p->rlc_pdu_size;
- data_req.rlc_info.rlc_protocol_state = rlc_p->protocol_state;
-
- if (data_req.data.nb_elements > 0) {
- LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT" MAC_DATA_REQUEST %d TBs\n",
- PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_p),
- data_req.data.nb_elements);
- }
- data_req.ue_id_type_indicator = 0;
-
- return data_req;
-}
-
-//-----------------------------------------------------------------------------
-void
-rlc_tm_mac_data_indication (
- const protocol_ctxt_t* const ctxt_pP,
- void * const rlc_pP,
- struct mac_data_ind data_indP)
-{
-
- if (data_indP.data.nb_elements > 0) {
- LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT" MAC_DATA_IND %d TBs\n",
- PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, ((rlc_tm_entity_t*) rlc_pP)),
- data_indP.data.nb_elements);
- }
-
- rlc_tm_rx (ctxt_pP, rlc_pP, data_indP);
-}
-
-//-----------------------------------------------------------------------------
-void
-rlc_tm_data_req (
- const protocol_ctxt_t* const ctxt_pP,
- void *const rlc_pP,
- mem_block_t *const sdu_pP)
-{
- rlc_tm_entity_t *rlc_p = (rlc_tm_entity_t *) rlc_pP;
-
-#if DEBUG_RLC_TM_DATA_REQUEST
- LOG_D (RLC, PROTOCOL_RLC_TM_CTXT_FMT" RLC_TM_DATA_REQ size %d Bytes, BO %ld , NB SDU %d current_sdu_index=%d next_sdu_index=%d\n",
- PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_p),
- ((struct rlc_um_data_req *) (sdu_pP->data))->data_size,
- rlc_p->buffer_occupancy,
- rlc_p->nb_sdu,
- rlc_p->current_sdu_index,
- rlc_p->next_sdu_index);
-#endif
-
- // not in 3GPP specification but the buffer may be full if not correctly configured
- if (rlc_p->input_sdus[rlc_p->next_sdu_index] == NULL) {
- ((struct rlc_tm_tx_sdu_management *) (sdu_pP->data))->sdu_size = ((struct rlc_tm_data_req *) (sdu_pP->data))->data_size;
- rlc_p->buffer_occupancy += ((struct rlc_tm_tx_sdu_management *) (sdu_pP->data))->sdu_size >> 3;
- rlc_p->nb_sdu += 1;
- ((struct rlc_tm_tx_sdu_management *) (sdu_pP->data))->first_byte = (uint8_t*)&sdu_pP->data[sizeof (struct rlc_tm_data_req_alloc)];
- rlc_p->input_sdus[rlc_p->next_sdu_index] = sdu_pP;
- rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer;
- } else {
- free_mem_block (sdu_pP, __func__);
- }
-}
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h
deleted file mode 100644
index de7b9b8170..0000000000
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_tm.h
-* \brief This file, and only this file must be included by code that interact with RLC TM layer.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_tm_impl_ RLC TM Layer Reference Implementation
-* @ingroup _rlc_impl_
-* @{
-*/
-# ifndef __RLC_TM_H__
-# define __RLC_TM_H__
-# include "platform_types.h"
-# include "rlc_def.h"
-# include "rlc_def_lte.h"
-# include "rlc_tm_structs.h"
-# include "rlc_tm_entity.h"
-# include "mem_block.h"
-# include "rlc_tm_init.h"
-
-#define PROTOCOL_RLC_TM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02ld]"
-#define PROTOCOL_RLC_TM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
- (rLC_Pp->is_data_plane) ? "DRB TM" : "SRB TM",\
- rLC_Pp->rb_id
-
-
-/*! \fn void rlc_tm_send_sdu (
-* const protocol_ctxt_t* const ctxt_pP,
-* rlc_tm_entity_t * const rlc_pP,
-* const bool error_indicationP,
-* uint8_t * const srcP,
-* const sdu_size_t length_in_bitsP)
-* \brief Send SDU if any reassemblied to upper layer.
-* \param[in] rlcP RLC TM protocol instance pointer.
-* \param[in] error_indicationP Error indicated by lower layers for this SDU.
-* \param[in] srcP SDU data pointer.
-* \param[in] length_in_bitsP Length of SDU in bits.
-*/
-void rlc_tm_send_sdu(const protocol_ctxt_t* const ctxt_pP,
- rlc_tm_entity_t * const rlc_pP,
- const bool error_indicationP,
- uint8_t * const srcP,
- const sdu_size_t length_in_bitsP);
-
-/*! \fn void rlc_tm_no_segment (const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP)
-* \brief Schedule a SDU to be transmited by lower layers.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC TM protocol instance pointer.
-*/
-void rlc_tm_no_segment (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_tm_entity_t *const rlcP);
-
-/*! \fn void rlc_tm_rx (const protocol_ctxt_t* const ctxt_pP,void *const rlcP, struct mac_data_ind data_indP)
-* \brief Process the received PDUs from lower layer.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC TM protocol instance pointer.
-* \param[in] data_indP PDUs from MAC.
-*/
-void rlc_tm_rx (
- const protocol_ctxt_t* const ctxt_pP,
- void *const rlcP,
- struct mac_data_ind data_indP);
-
-
-/*! \fn struct mac_status_resp rlc_tm_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void * const rlcP, struct mac_status_ind tx_statusP)
-* \brief Request the maximum number of bytes that can be served by RLC instance to MAC and fix the amount of bytes requested by MAC for next RLC transmission.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC TM protocol instance pointer.
-* \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU.
-* \return The maximum number of bytes that can be served by RLC instance to MAC.
-*/
-struct mac_status_resp
-rlc_tm_mac_status_indication (
- const protocol_ctxt_t* const ctxt_pP,
- void * const rlc_pP,
- struct mac_status_ind tx_statusP);
-
-
-/*! \fn struct mac_data_req rlc_tm_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void * const rlcP)
-* \brief Gives PDUs to lower layer MAC.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC TM protocol instance pointer.
-* \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission.
-*/
-struct mac_data_req rlc_tm_mac_data_request (
- const protocol_ctxt_t* const ctxt_pP,
- void * const rlcP);
-
-
-/*! \fn void rlc_tm_mac_data_indication (const protocol_ctxt_t* const ctxt_pP,void * const rlcP, struct mac_data_ind data_indP)
-* \brief Receive PDUs from lower layer MAC.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC TM protocol instance pointer.
-* \param[in] data_indP PDUs from MAC.
-*/
-void rlc_tm_mac_data_indication (
- const protocol_ctxt_t* const ctxt_pP,
- void * const rlcP,
- struct mac_data_ind data_indP);
-
-
-/*! \fn void rlc_tm_data_req (const protocol_ctxt_t* const ctxt_pP,void * const rlcP, mem_block_t * const sduP)
-* \brief Interface with higher layers, buffer higher layer SDUS for transmission.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC TM protocol instance pointer.
-* \param[in] sduP SDU. (A struct rlc_tm_data_req is mapped on sduP->data.)
-*/
-void rlc_tm_data_req (
- const protocol_ctxt_t* const ctxt_pP,
- void * const rlcP,
- mem_block_t * const sduP);
-
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h
deleted file mode 100644
index b6795d4488..0000000000
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_tm_entity.h
-* \brief This file defines the RLC TM variables stored in a struct called rlc_tm_entity_t.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note The rlc_tm_entity_t structure store protocol variables, statistic variables, allocation variables, buffers and other miscellaneous variables.
-* \bug
-* \warning
-*/
-# ifndef __RLC_TM_ENTITY_H__
-# define __RLC_TM_ENTITY_H__
-//-----------------------------------------------------------------------------
-# include "platform_types.h"
-#include "common/platform_constants.h"
-# include "rlc_tm_structs.h"
-# include "rlc_def.h"
-//-----------------------------------------------------------------------------
-/*! \struct rlc_tm_entity_t
-* \brief Structure containing a RLC TM instance protocol variables, allocation variables, buffers and other miscellaneous variables.
-*/
-typedef struct rlc_tm_entity {
- bool allocation; /*!< \brief Boolean for rlc_tm_entity_t struct allocation. */
- rlc_protocol_state_t protocol_state; /*!< \brief Protocol state, can be RLC_NULL_STATE, RLC_DATA_TRANSFER_READY_STATE, RLC_LOCAL_SUSPEND_STATE. */
- bool is_uplink_downlink; /*!< \brief Is this instance is a transmitter, a receiver or both? */
- bool is_data_plane; /*!< \brief To know if the RLC belongs to a data radio bearer or a signalling radio bearer, for statistics and trace purpose. */
- // for stats and trace purpose :
- logical_chan_id_t channel_id; /*!< \brief Transport channel identifier. */
- rb_id_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */
- //-----------------------------
- // tranmission
- //-----------------------------
- // sdu communication;
- mem_block_t **input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). Should be accessed as an array. */
- mem_block_t *input_sdus_alloc; /*!< \brief Allocated memory for the input SDU buffer (for SDUs coming from upper layers). */
- uint16_t size_input_sdus_buffer; /*!< \brief Size of the input SDU buffer. */
- uint16_t nb_sdu; /*!< \brief Total number of SDUs in input_sdus[] */
- uint16_t next_sdu_index; /*!< \brief Next SDU index for a new incomin SDU in input_sdus[]. */
- uint16_t current_sdu_index; /*!< \brief Current SDU index in input_sdus array to be segmented. */
- list_t pdus_to_mac_layer; /*!< \brief PDUs buffered for transmission to MAC layer. */
- sdu_size_t rlc_pdu_size;
- rlc_buffer_occupancy_t buffer_occupancy; /*!< \brief Number of bytes contained in input_sdus buffer.*/
- //-----------------------------
- // receiver
- //-----------------------------
- unsigned int output_sdu_size_to_write; /*!< \brief Size of the reassemblied SDU. */
- mem_block_t *output_sdu_in_construction; /*!< \brief Memory area where a complete SDU is reassemblied before being send to upper layers. */
-} rlc_tm_entity_t;
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c
deleted file mode 100644
index a838b2a006..0000000000
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_TM_MODULE 1
-#define RLC_TM_INIT_C 1
-//-----------------------------------------------------------------------------
-#include "rlc_tm.h"
-#include "LAYER2/MAC/mac_extern.h"
-//-----------------------------------------------------------------------------
-void config_req_rlc_tm (
- const protocol_ctxt_t* const ctxt_pP,
- const srb_flag_t srb_flagP,
- const rlc_tm_info_t * const config_tmP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP
-)
-{
- rlc_union_t *rlc_union_p = NULL;
- rlc_tm_entity_t *rlc_p = NULL;
- hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- hashtable_rc_t h_rc;
-
- h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- rlc_p = &rlc_union_p->rlc.tm;
- LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT" CONFIG_REQ (is_uplink_downlink=%d) RB %ld\n",
- PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_p),
- config_tmP->is_uplink_downlink,
- rb_idP);
-
- rlc_tm_init(ctxt_pP, rlc_p);
- rlc_p->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
- rlc_tm_set_debug_infos(ctxt_pP, rlc_p, srb_flagP, rb_idP, chan_idP);
- rlc_tm_configure(ctxt_pP, rlc_p, config_tmP->is_uplink_downlink);
- } else {
- LOG_E(RLC, PROTOCOL_RLC_TM_CTXT_FMT" CONFIG_REQ RB %ld RLC NOT FOUND\n",
- PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_p),
- rb_idP);
- }
-}
-
-//-----------------------------------------------------------------------------
-void rlc_tm_init (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_tm_entity_t * const rlcP
-)
-{
- int saved_allocation = rlcP->allocation;
- memset (rlcP, 0, sizeof (struct rlc_tm_entity));
- rlcP->allocation = saved_allocation;
- // TX SIDE
- list_init (&rlcP->pdus_to_mac_layer, NULL);
-
- rlcP->protocol_state = RLC_NULL_STATE;
- rlcP->nb_sdu = 0;
- rlcP->next_sdu_index = 0;
- rlcP->current_sdu_index = 0;
-
- rlcP->output_sdu_size_to_write = 0;
- rlcP->buffer_occupancy = 0;
-
- // SPARE : not 3GPP
- rlcP->size_input_sdus_buffer = 16;
-
- if ((rlcP->input_sdus_alloc == NULL) && (rlcP->size_input_sdus_buffer > 0)) {
- rlcP->input_sdus_alloc = get_free_mem_block (rlcP->size_input_sdus_buffer * sizeof (void *), __func__);
- if(rlcP->input_sdus_alloc == NULL) return;
- rlcP->input_sdus = (mem_block_t **) (rlcP->input_sdus_alloc->data);
- memset (rlcP->input_sdus, 0, rlcP->size_input_sdus_buffer * sizeof (void *));
- }
-}
-
-//-----------------------------------------------------------------------------
-void
-rlc_tm_reset_state_variables (
- const protocol_ctxt_t* const ctxt_pP,
- struct rlc_tm_entity * const rlcP
-)
-{
- rlcP->output_sdu_size_to_write = 0;
- rlcP->buffer_occupancy = 0;
- rlcP->nb_sdu = 0;
- rlcP->next_sdu_index = 0;
- rlcP->current_sdu_index = 0;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_tm_cleanup (
- rlc_tm_entity_t * const rlcP
-)
-{
- int index;
- // TX SIDE
- list_free (&rlcP->pdus_to_mac_layer);
-
- if (rlcP->input_sdus_alloc) {
- for (index = 0; index < rlcP->size_input_sdus_buffer; index++) {
- if (rlcP->input_sdus[index]) {
- free_mem_block (rlcP->input_sdus[index], __func__);
- }
- }
-
- free_mem_block (rlcP->input_sdus_alloc, __func__);
- rlcP->input_sdus_alloc = NULL;
- }
-
- // RX SIDE
- if ((rlcP->output_sdu_in_construction)) {
- free_mem_block (rlcP->output_sdu_in_construction, __func__);
- rlcP->output_sdu_in_construction = NULL;
- }
-
- memset(rlcP, 0, sizeof(rlc_tm_entity_t));
-}
-
-//-----------------------------------------------------------------------------
-void rlc_tm_configure(const protocol_ctxt_t* const ctxt_pP,
- rlc_tm_entity_t * const rlcP,
- const bool is_uplink_downlinkP)
-{
- rlcP->is_uplink_downlink = is_uplink_downlinkP;
- rlc_tm_reset_state_variables (ctxt_pP, rlcP);
-}
-
-//-----------------------------------------------------------------------------
-void rlc_tm_set_debug_infos(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_tm_entity_t * const rlcP,
- const srb_flag_t srb_flagP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP)
-{
- rlcP->rb_id = rb_idP;
- rlcP->channel_id = chan_idP;
-
- if (srb_flagP) {
- rlcP->is_data_plane = 0;
- } else {
- rlcP->is_data_plane = 1;
- }
-}
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h
deleted file mode 100644
index f315a0311a..0000000000
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_tm_init.h
-* \brief This file defines the prototypes of the functions dealing with the control primitives and initialization.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_tm_init_impl_ RLC TM Init Reference Implementation
-* @ingroup _rlc_tm_impl_
-* @{
-*/
-# ifndef __RLC_TM_INIT_H__
-# define __RLC_TM_INIT_H__
-//-----------------------------------------------------------------------------
-# include "rlc_tm_entity.h"
-# include "mem_block.h"
-# include "rlc_tm_structs.h"
-//# include "rlc.h"
-# include "platform_types.h"
-//-----------------------------------------------------------------------------
-
-typedef volatile struct rlc_tm_info_s {
- uint8_t is_uplink_downlink;
-} rlc_tm_info_t;
-
-
-/*! \fn void config_req_rlc_tm (void config_req_rlc_tm (
- const protocol_ctxt_t* const ctxt_pP,
- const srb_flag_t srb_flagP,
- const rlc_tm_info_t * const config_tmP,
- const rb_id_t rb_idP,
- const srb_flag_t srb_flagP)
-* \brief Allocate memory for RLC TM instance, reset protocol variables, and set protocol parameters.
-* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0)
-* \param[in] config_tmP Configuration parameters for RLC TM instance.
-* \param[in] rb_idP Radio bearer identifier.
-* \param[in] chan_idP Transport channel identifier.
-*/
-void config_req_rlc_tm (
- const protocol_ctxt_t* const ctxt_pP,
- const srb_flag_t srb_flagP,
- const rlc_tm_info_t * const config_tmP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP);
-
-/*! \fn void rlc_tm_init (const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP)
-* \brief Initialize a RLC TM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC TM protocol instance will be in RLC_NULL_STATE state.
-* \param[in] rlcP RLC TM protocol instance pointer.
-*/
-void rlc_tm_init (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_tm_entity_t * const rlcP);
-
-/*! \fn void rlc_tm_reset_state_variables (const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP)
-* \brief Reset protocol variables and state variables to initial values.
-* \param[in] rlcP RLC TM protocol instance pointer.
-*/
-void rlc_tm_reset_state_variables(const protocol_ctxt_t* const ctxt_pP,
- rlc_tm_entity_t * const rlcP);
-
-/*! \fn void rlc_tm_cleanup(rlc_tm_entity_t * const rlcP)
-* \brief Free all allocated memory (lists and buffers) previously allocated by this RLC TM instance.
-* \param[in] rlcP RLC TM protocol instance pointer.
-*/
-void rlc_tm_cleanup(rlc_tm_entity_t * const rlcP);
-
-/*! \fn void rlc_tm_configure(const protocol_ctxt_t* const ctxt_pP,rlc_tm_entity_t * const rlcP, const bool is_uplink_downlinkP)
-* \brief Configure RLC TM protocol parameters.
-* \param[in] rlcP RLC TM protocol instance pointer.
-* \param[in] is_uplink_downlinkP Is this instance is TRANSMITTER_ONLY,
-RECEIVER_ONLY, or TRANSMITTER_AND_RECEIVER.
-*/
-void rlc_tm_configure(const protocol_ctxt_t* const ctxt_pP,
- rlc_tm_entity_t * const rlcP,
- const bool is_uplink_downlinkP);
-
-/*! \fn void rlc_tm_set_debug_infos(const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP, const rb_id_t rb_idP, const srb_flag_t srb_flagP)
-* \brief Set debug informations for a RLC TM protocol instance, these informations are only for trace purpose.
-* \param[in] rlcP RLC TM protocol instance pointer.
-* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
-* \param[in] rb_idP Radio bearer identifier.
-* \param[in] chan_idP Transport channel identifier
-*/
-void rlc_tm_set_debug_infos(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_tm_entity_t * const rlcP,
- const srb_flag_t srb_flagP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP);
-
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_structs.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_structs.h
deleted file mode 100644
index ee9d5268d4..0000000000
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_structs.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_tm_structs.h
-* \brief This file defines structures used inside the RLC TM.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-* \note
-* \bug
-* \warning
-*/
-# ifndef __RLC_TM_STRUCTS_H__
-# define __RLC_TM_STRUCTS_H__
-# include "platform_types.h"
-# include "list.h"
-# include "mac_primitives.h"
-# include "rlc_primitives.h"
-# include "mac_rlc_primitives.h"
-//-----------------------
-struct rlc_tm_tx_sdu_management {
- uint8_t *first_byte;
- int32_t sdu_creation_time;
- uint16_t sdu_size;
-};
-//-----------------------
-struct rlc_tm_tx_pdu_management {
- uint8_t *first_byte;
- uint8_t dummy[MAC_HEADER_MAX_SIZE];
-};
-//-----------------------
-struct rlc_tm_rx_pdu_management {
- uint8_t *first_byte;
-};
-//-----------------------
-struct rlc_tm_tx_data_pdu_struct {
- union {
- struct rlc_tm_tx_pdu_management tx_pdu_mngmnt;
- struct mac_tb_req tb_req;
- struct mac_tx_tb_management tb_mngt;
-# ifdef BYPASS_L1
- struct rlc_tm_rx_pdu_management dummy1;
- struct mac_tb_ind dummy2;
- struct mac_rx_tb_management dummy3;
- struct rlc_indication dummy4;
-# endif
- } dummy;
- uint8_t data[1];
-};
-//-----------------------
-struct rlc_tm_data_req_alloc { // alloc enought bytes for sdu mngt also
- union {
- struct rlc_tm_data_req dummy1;
- struct rlc_tm_tx_sdu_management dummy2;
- } dummy;
-};
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/README b/openair2/LAYER2/RLC/UM_v9.3.0/README
deleted file mode 100644
index 05297ce9c0..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/README
+++ /dev/null
@@ -1,12 +0,0 @@
-#######################################
-WHAT IS IMPLEMENTED:
-#######################################
-All RLC specification 36.322 v9.3.0 concerning UM mode,
-except:
-The segmentation and the reception of PDU
-with a sequence number length of 5 bits.
-
-#######################################
-KNOWN BUGS AND LIMITATION:
-#######################################
-
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
deleted file mode 100644
index a77280ffd2..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
+++ /dev/null
@@ -1,579 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_UM_MODULE 1
-#define RLC_UM_C 1
-//-----------------------------------------------------------------------------
-//#include "rtos_header.h"
-#include "platform_types.h"
-#include "common/platform_constants.h"
-//-----------------------------------------------------------------------------
-#if ENABLE_ITTI
- #include "intertask_interface.h"
-#endif
-#include "assertions.h"
-#include "rlc_um.h"
-#include "list.h"
-#include "rlc_primitives.h"
-#include "mac_primitives.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-
-
-#include "rlc_um_very_simple_test.h"
-
-//-----------------------------------------------------------------------------
-void rlc_um_stat_req (rlc_um_entity_t *rlc_pP,
- unsigned int *stat_tx_pdcp_sdu,
- unsigned int *stat_tx_pdcp_bytes,
- unsigned int *stat_tx_pdcp_sdu_discarded,
- unsigned int *stat_tx_pdcp_bytes_discarded,
- unsigned int *stat_tx_data_pdu,
- unsigned int *stat_tx_data_bytes,
- unsigned int *stat_rx_pdcp_sdu,
- unsigned int *stat_rx_pdcp_bytes,
- unsigned int *stat_rx_data_pdus_duplicate,
- unsigned int *stat_rx_data_bytes_duplicate,
- unsigned int *stat_rx_data_pdu,
- unsigned int *stat_rx_data_bytes,
- unsigned int *stat_rx_data_pdu_dropped,
- unsigned int *stat_rx_data_bytes_dropped,
- unsigned int *stat_rx_data_pdu_out_of_window,
- unsigned int *stat_rx_data_bytes_out_of_window,
- unsigned int *stat_timer_reordering_timed_out) {
- *stat_tx_pdcp_sdu = rlc_pP->stat_tx_pdcp_sdu;
- *stat_tx_pdcp_bytes = rlc_pP->stat_tx_pdcp_bytes;
- *stat_tx_pdcp_sdu_discarded = rlc_pP->stat_tx_pdcp_sdu_discarded;
- *stat_tx_pdcp_bytes_discarded = rlc_pP->stat_tx_pdcp_bytes_discarded;
- *stat_tx_data_pdu = rlc_pP->stat_tx_data_pdu;
- *stat_tx_data_bytes = rlc_pP->stat_tx_data_bytes;
- *stat_rx_pdcp_sdu = rlc_pP->stat_rx_pdcp_sdu;
- *stat_rx_pdcp_bytes = rlc_pP->stat_rx_pdcp_bytes;
- *stat_rx_data_pdus_duplicate = rlc_pP->stat_rx_data_pdus_duplicate;
- *stat_rx_data_bytes_duplicate = rlc_pP->stat_rx_data_bytes_duplicate;
- *stat_rx_data_pdu = rlc_pP->stat_rx_data_pdu;
- *stat_rx_data_bytes = rlc_pP->stat_rx_data_bytes;
- *stat_rx_data_pdu_dropped = rlc_pP->stat_rx_data_pdu_dropped;
- *stat_rx_data_bytes_dropped = rlc_pP->stat_rx_data_bytes_dropped;
- *stat_rx_data_pdu_out_of_window = rlc_pP->stat_rx_data_pdu_out_of_window;
- *stat_rx_data_bytes_out_of_window = rlc_pP->stat_rx_data_bytes_out_of_window;
- *stat_timer_reordering_timed_out = rlc_pP->stat_timer_reordering_timed_out;
-}
-//-----------------------------------------------------------------------------
-uint32_t
-rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP) {
- if (rlc_pP->buffer_occupancy > 0) {
- return rlc_pP->buffer_occupancy;
- } else {
- return 0;
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_get_pdus (const protocol_ctxt_t *const ctxt_pP, void *argP) {
- rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) argP;
-
- switch (rlc_p->protocol_state) {
- case RLC_NULL_STATE:
- // from 3GPP TS 25.322 V9.2.0 p43
- // In the NULL state the RLC entity does not exist and therefore it is
- // not possible to transfer any data through it.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // establishment, the RLC entity:
- // - is created; and
- // - enters the DATA_TRANSFER_READY state.
- break;
-
- case RLC_DATA_TRANSFER_READY_STATE:
-
- // from 3GPP TS 25.322 V9.2.0 p43-44
- // In the DATA_TRANSFER_READY state, unacknowledged mode data can be
- // exchanged between the entities according to subclause 11.2.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // release, the RLC entity:
- // -enters the NULL state; and
- // -is considered as being terminated.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // modification, the RLC entity:
- // - stays in the DATA_TRANSFER_READY state;
- // - modifies only the protocol parameters and timers as indicated by
- // upper layers.
- // Upon reception of a CRLC-SUSPEND-Req from upper layers, the RLC
- // entity:
- // - enters the LOCAL_SUSPEND state.
-
- // SEND DATA TO MAC
- if (rlc_p->tx_sn_length == 10) {
- rlc_um_segment_10 (ctxt_pP, rlc_p);
- }
-
- if (rlc_p->tx_sn_length == 5) {
- rlc_um_segment_5 (ctxt_pP, rlc_p);
- }
-
- break;
-
- case RLC_LOCAL_SUSPEND_STATE:
- // from 3GPP TS 25.322 V9.2.0 p44
- // In the LOCAL_SUSPEND state, the RLC entity is suspended, i.e. it does
- // not send UMD PDUs with "Sequence Number" greater than or equal to a
- // certain specified value (see subclause 9.7.5).
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // release, the RLC entity:
- // - enters the NULL state; and
- // - is considered as being terminated.
- // Upon reception of a CRLC-RESUME-Req from upper layers, the RLC entity:
- // - enters the DATA_TRANSFER_READY state; and
- // - resumes the data transmission.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // modification, the RLC entity:
- // - stays in the LOCAL_SUSPEND state;
- // - modifies only the protocol parameters and timers as indicated by
- // upper layers.
- // TO DO TAKE CARE OF SN : THE IMPLEMENTATION OF THIS FUNCTIONNALITY IS NOT CRITICAL
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_DATA_REQ UNKNOWN PROTOCOL STATE %02X hex\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- rlc_p->protocol_state);
- }
-}
-
-//-----------------------------------------------------------------------------
-void
-rlc_um_rx (const protocol_ctxt_t *const ctxt_pP, void *argP, struct mac_data_ind data_indP) {
- rlc_um_entity_t *l_rlc_p = (rlc_um_entity_t *) argP;
- char message_string[10000];
- mem_block_t *tb_p;
- int16_t tb_size_in_bytes;
- rlc_um_pdu_info_t pdu_info;
- int index;
- int octet_index;
-
- switch (l_rlc_p->protocol_state) {
- case RLC_NULL_STATE:
- // from 3GPP TS 25.322 V9.2.0 p43
- // In the NULL state the RLC entity does not exist and therefore it is
- // not possible to transfer any data through it.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // establishment, the RLC entity:
- // - is created; and
- // - enters the DATA_TRANSFER_READY state.
- LOG_I(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR MAC_DATA_IND IN RLC_NULL_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p));
-
- if (data_indP.data.nb_elements > 0) {
- tb_p = data_indP.data.head;
-
- while (tb_p != NULL) {
- tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
- rlc_um_get_pdu_infos(ctxt_pP,l_rlc_p,(rlc_um_pdu_sn_10_t *) ((struct mac_tb_ind *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
- tb_p = tb_p->next;
- }
- }
-
- list_free (&data_indP.data);
- break;
-
- case RLC_DATA_TRANSFER_READY_STATE:
- // from 3GPP TS 25.322 V9.2.0 p43-44
- // In the DATA_TRANSFER_READY state, unacknowledged mode data can be
- // exchanged between the entities according to subclause 11.2.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // release, the RLC entity:
- // -enters the NULL state; and
- // -is considered as being terminated.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // modification, the RLC entity:
- // - stays in the DATA_TRANSFER_READY state;
- // - modifies only the protocol parameters and timers as indicated by
- // upper layers.
- // Upon reception of a CRLC-SUSPEND-Req from upper layers, the RLC
- // entity:
- // - enters the LOCAL_SUSPEND state.
- data_indP.tb_size = data_indP.tb_size >> 3;
-
- if (data_indP.data.nb_elements > 0 && (LOG_DEBUGFLAG(DEBUG_RLC))) {
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_DATA_IND %d TBs\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- data_indP.data.nb_elements);
- tb_p = data_indP.data.head;
-
- while (tb_p != NULL) {
- tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
- rlc_um_get_pdu_infos(ctxt_pP,
- l_rlc_p,(rlc_um_pdu_sn_10_t *) ((struct mac_tb_ind *) (tb_p->data))->data_ptr,
- tb_size_in_bytes,
- &pdu_info,
- l_rlc_p->rx_sn_length);
-
- if (LOG_DEBUGFLAG(DEBUG_RLC)) {
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
- message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
- message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC UM DATA IND: UMD PDU\n\n");
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
- message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
- message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
-
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
-
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
- }
- }
-
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
- }
-
- /*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
-
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
- LOG_UI(RLC, "%s|\n", message_string);
- }
-
- tb_p = tb_p->next;
- }
- }
-
- rlc_um_receive (ctxt_pP, l_rlc_p, data_indP);
- break;
-
- case RLC_LOCAL_SUSPEND_STATE:
- // from 3GPP TS 25.322 V9.2.0 p44
- // In the LOCAL_SUSPEND state, the RLC entity is suspended, i.e. it does
- // not send UMD PDUs with "Sequence Number" greater than or equal to a
- // certain specified value (see subclause 9.7.5).
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // release, the RLC entity:
- // - enters the NULL state; and
- // - is considered as being terminated.
- // Upon reception of a CRLC-RESUME-Req from upper layers, the RLC entity:
- // - enters the DATA_TRANSFER_READY state; and
- // - resumes the data transmission.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // modification, the RLC entity:
- // - stays in the LOCAL_SUSPEND state;
- // - modifies only the protocol parameters and timers as indicated by
- // upper layers.
- LOG_I(RLC, PROTOCOL_RLC_UM_CTXT_FMT" RLC_LOCAL_SUSPEND_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p));
- list_free (&data_indP.data);
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE %02X hex\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- l_rlc_p->protocol_state);
- list_free (&data_indP.data);
- }
-}
-
-//-----------------------------------------------------------------------------
-struct mac_status_resp
-rlc_um_mac_status_indication (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP, struct mac_status_ind tx_statusP,const eNB_flag_t enb_flagP) {
- struct mac_status_resp status_resp;
- uint16_t sdu_size = 0;
- uint16_t sdu_remaining_size = 0;
- int32_t diff_time=0;
- rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) rlc_pP;
- mem_block_t *mb_p = NULL;
- status_resp.buffer_occupancy_in_pdus = 0;
- status_resp.buffer_occupancy_in_bytes = 0;
- status_resp.head_sdu_remaining_size_to_send = 0;
- status_resp.head_sdu_creation_time = 0;
- status_resp.head_sdu_is_segmented = 0;
-
- if (rlc_pP) {
- status_resp.rlc_info.rlc_protocol_state = rlc_p->protocol_state;
- rlc_um_check_timer_dar_time_out(ctxt_pP, rlc_p);
- status_resp.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (rlc_p);
-
- if ((status_resp.buffer_occupancy_in_bytes > 0) && ((mb_p = list_get_head(&rlc_p->input_sdus)) != NULL)) {
- if (enb_flagP == ENB_FLAG_YES) {
- /* For eNB: add minimum RLC UM header size for the scheduler */
- /* For UE : RLC header part is not taken into account for BSR reporting (cf 36.321) */
- status_resp.buffer_occupancy_in_bytes += rlc_p->tx_header_min_length_in_bytes;
- }
-
- status_resp.buffer_occupancy_in_pdus = rlc_p->input_sdus.nb_elements;
- diff_time = ctxt_pP->frame - ((struct rlc_um_tx_sdu_management *)mb_p->data)->sdu_creation_time;
- status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (uint32_t) diff_time : (uint32_t)(0xffffffff - diff_time + ctxt_pP->frame) ;
- //msg("rlc_p status for ctxt_pP->frame %d diff time %d resp %d\n", ctxt_pP->frame, diff_time,status_resp.head_sdu_creation_time) ;
- sdu_size = ((struct rlc_um_tx_sdu_management *) mb_p->data)->sdu_size;
- sdu_remaining_size = ((struct rlc_um_tx_sdu_management *) mb_p->data)->sdu_remaining_size;
- status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
-
- if (sdu_size == sdu_remaining_size) {
- status_resp.head_sdu_is_segmented = 0;
- } else {
- status_resp.head_sdu_is_segmented = 1;
- }
- } else {
- }
-
- status_resp.rlc_info.rlc_protocol_state = rlc_p->protocol_state;
-
- if (LOG_DEBUGFLAG(DEBUG_RLC)) {
- if (( rlc_p->rb_id > 0) && (status_resp.buffer_occupancy_in_bytes > 0)) {
- LOG_UI(RLC, PROTOCOL_RLC_UM_CTXT_FMT"MAC_STATUS_INDICATION (DATA) -> %d bytes available\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- status_resp.buffer_occupancy_in_bytes);
-
- if ((tx_statusP.tx_status == MAC_TX_STATUS_SUCCESSFUL) && (tx_statusP.no_pdu)) {
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- tx_statusP.no_pdu);
- }
-
- if ((tx_statusP.tx_status == MAC_TX_STATUS_UNSUCCESSFUL) && (tx_statusP.no_pdu)) {
- LOG_UI(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- tx_statusP.no_pdu);
- }
- }
- }
- } else {
- LOG_E(RLC, "[RLC] rlc_um_mac_status_indication RLC NULL!!!\n");
- }
-
- return status_resp;
-}
-
-//-----------------------------------------------------------------------------
-struct mac_data_req
-rlc_um_mac_data_request (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP,const eNB_flag_t enb_flagP) {
- struct mac_data_req data_req;
- int16_t tb_size_in_bytes;
- mem_block_t *tb_p;
- char message_string[10000];
- size_t message_string_size = 0;
- rlc_um_pdu_info_t pdu_info;
- int octet_index, index;
- rlc_um_entity_t *l_rlc_p = (rlc_um_entity_t *) rlc_pP;
- rlc_um_get_pdus(ctxt_pP, l_rlc_p);
- list_init (&data_req.data, NULL);
- list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data);
-
- if (enb_flagP) {
- // redundant in UE MAC Tx processing and not used in eNB scheduler ...
- data_req.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (l_rlc_p);
-
- if (data_req.buffer_occupancy_in_bytes > 0) {
- data_req.buffer_occupancy_in_bytes += l_rlc_p->tx_header_min_length_in_bytes;
- }
- }
-
- data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state;
-
- if (data_req.data.nb_elements > 0) {
- tb_p = data_req.data.head;
-
- while (tb_p != NULL) {
- tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size;
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_DATA_REQUEST TB SIZE %u\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- ((struct mac_tb_req *) (tb_p->data))->tb_size);
- l_rlc_p->stat_tx_data_pdu += 1;
- l_rlc_p->stat_tx_data_bytes += tb_size_in_bytes;
-
- //AssertFatal( tb_size_in_bytes > 0 , "RLC UM PDU LENGTH %d", tb_size_in_bytes);
- if(tb_size_in_bytes <= 0) {
- LOG_E(RLC, "RLC UM PDU LENGTH %d\n", tb_size_in_bytes);
- tb_p = tb_p->next;
- continue;
- }
-
- if (LOG_DEBUGFLAG(DEBUG_RLC) ) {
- rlc_um_get_pdu_infos(ctxt_pP, l_rlc_p,(rlc_um_pdu_sn_10_t *) ((struct mac_tb_req *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
-
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
- message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
- message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC UM DATA IND: UMD PDU\n\n");
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
- message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
- message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
-
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
-
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
- }
- }
-
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
- }
-
- /*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
-
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
- LOG_UI(RLC, "%s\n", message_string);
- } /* LOG_DEBUGFLAG(DEBUG_RLC) */
-
- tb_p = tb_p->next;
- } /* while (tb_p != NULL) */
- } /* if (data_req.data.nb_elements > 0) */
-
- data_req.buffer_occupancy_in_pdus = 0;
- return data_req;
-}
-
-//-----------------------------------------------------------------------------
-void
-rlc_um_mac_data_indication (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP, struct mac_data_ind data_indP) {
- rlc_um_rx (ctxt_pP, rlc_pP, data_indP);
- rlc_um_check_timer_dar_time_out(ctxt_pP, rlc_pP);
-}
-
-//-----------------------------------------------------------------------------
-void
-rlc_um_data_req (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP, mem_block_t *sdu_pP) {
- rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) rlc_pP;
- uint16_t data_offset;
- uint16_t data_size;
- size_t message_string_size = 0;
- int octet_index, index;
- char message_string[7000];
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" RLC_UM_DATA_REQ size %d Bytes, BO %d , NB SDU %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- ((struct rlc_um_data_req *) (sdu_pP->data))->data_size,
- rlc_p->buffer_occupancy,
- rlc_p->input_sdus.nb_elements);
- // IMPORTANT : do not change order of affectations
- ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size = ((struct rlc_um_data_req *) (sdu_pP->data))->data_size;
- //rlc_p->nb_sdu += 1;
- ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->first_byte = (uint8_t *)&sdu_pP->data[sizeof (struct rlc_um_data_req_alloc)];
- ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_remaining_size = ((struct rlc_um_tx_sdu_management *)
- (sdu_pP->data))->sdu_size;
- ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_segmented_size = 0;
- ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_creation_time = ctxt_pP->frame;
- //rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer;
- rlc_p->stat_tx_pdcp_sdu += 1;
- rlc_p->stat_tx_pdcp_bytes += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size;
-
- if (LOG_DEBUGFLAG(DEBUG_RLC) ) {
- data_offset = sizeof (struct rlc_um_data_req_alloc);
- data_size = ((struct rlc_um_tx_sdu_management *)(sdu_pP->data))->sdu_size;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "SDU size : %u\n", data_size);
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < data_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
- }
-
- /*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size], " %02x", ((uint8_t *)(&sdu_pP->data[data_offset]))[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
-
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- LOG_UI(RLC, "%s|\n", message_string);
- }
-
- RLC_UM_MUTEX_LOCK(&rlc_p->lock_input_sdus, ctxt_pP, rlc_p);
- rlc_p->buffer_occupancy += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size;
- list_add_tail_eurecom(sdu_pP, &rlc_p->input_sdus);
- RLC_UM_MUTEX_UNLOCK(&rlc_p->lock_input_sdus);
-
- LOG_T(RLC, PROTOCOL_RLC_UM_CTXT_FMT" BO %d , NB SDU %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- rlc_p->buffer_occupancy,
- rlc_p->input_sdus.nb_elements);
-}
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h
deleted file mode 100644
index bd04ff3ece..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_um.h
-* \brief This file, and only this file must be included by code that interact with RLC UM layer.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_um_impl_ RLC UM Layer Reference Implementation
-* @ingroup _rlc_impl_
-* @{
-*/
-# ifndef __RLC_UM_H__
-# define __RLC_UM_H__
-# include
-# include "platform_types.h"
-# include "rlc_def.h"
-# include "rlc_def_lte.h"
-# include "rlc_um_constants.h"
-# include "rlc_um_structs.h"
-# include "rlc_um_entity.h"
-# include "mem_block.h"
-# include "rlc_um_control_primitives.h"
-# include "rlc_um_dar.h"
-# include "rlc_um_fsm.h"
-# include "rlc_um_reassembly.h"
-# include "rlc_um_receiver.h"
-# include "rlc_um_segment.h"
-# include "rlc_um_test.h"
-
-#define PROTOCOL_RLC_UM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02ld] %s()"
-#define PROTOCOL_RLC_UM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
- (rLC_Pp->is_data_plane) ? "DRB UM" : "SRB UM",\
- rLC_Pp->rb_id,\
- __FUNCTION__
-
-#if defined(TRACE_RLC_MUTEX)
-#define RLC_UM_MUTEX_LOCK(mUTEX, cTXT, rLC) \
- do {\
- int pmtl_rc = pthread_mutex_trylock(mUTEX);\
- if (pmtl_rc != 0){\
- if (pmtl_rc == EBUSY) {\
- pthread_mutex_lock(mUTEX);\
- }\
- }\
- } while (0);
-#else
-#define RLC_UM_MUTEX_LOCK(mUTEX, cTXT, rLC) pthread_mutex_lock(mUTEX)
-#endif
-
-#define RLC_UM_MUTEX_UNLOCK(mUTEX) pthread_mutex_unlock(mUTEX)
-
-/*! \fn void rlc_um_stat_req (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,
- unsigned int* stat_tx_pdcp_sdu,
- unsigned int* stat_tx_pdcp_bytes,
- unsigned int* stat_tx_pdcp_sdu_discarded,
- unsigned int* stat_tx_pdcp_bytes_discarded,
- unsigned int* stat_tx_data_pdu,
- unsigned int* stat_tx_data_bytes,
- unsigned int* stat_rx_pdcp_sdu,
- unsigned int* stat_rx_pdcp_bytes,
- unsigned int* stat_rx_data_pdus_duplicate,
- unsigned int* stat_rx_data_bytes_duplicate,
- unsigned int* stat_rx_data_pdu,
- unsigned int* stat_rx_data_bytes,
- unsigned int* stat_rx_data_pdu_dropped,
- unsigned int* stat_rx_data_bytes_dropped,
- unsigned int* stat_rx_data_pdu_out_of_window,
- unsigned int* stat_rx_data_bytes_out_of_window,
- unsigned int* stat_timer_reordering_timed_out)
-* \brief Request TX and RX statistics of a RLC AM protocol instance.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[out] stat_tx_pdcp_sdu Number of SDUs coming from upper layers.
-* \param[out] stat_tx_pdcp_bytes Number of bytes coming from upper layers.
-* \param[out] stat_tx_pdcp_sdu_discarded Number of discarded SDUs coming from upper layers.
-* \param[out] stat_tx_pdcp_bytes_discarded Number of discarded bytes coming from upper layers.
-* \param[out] stat_tx_data_pdu Number of transmitted data PDUs to lower layers.
-* \param[out] stat_tx_data_bytes Number of transmitted data bytes to lower layers.
-* \param[out] stat_rx_pdcp_sdu Number of SDUs delivered to upper layers.
-* \param[out] stat_rx_pdcp_bytes Number of bytes delivered to upper layers.
-* \param[out] stat_rx_data_pdus_duplicate Number of duplicate PDUs received.
-* \param[out] stat_rx_data_bytes_duplicate Number of duplicate bytes received.
-* \param[out] stat_rx_data_pdu Number of received PDUs from lower layers.
-* \param[out] stat_rx_data_bytes Number of received bytes from lower layers.
-* \param[out] stat_rx_data_pdu_dropped Number of received PDUs from lower layers, then dropped.
-* \param[out] stat_rx_data_bytes_dropped Number of received bytes from lower layers, then dropped.
-* \param[out] stat_rx_data_pdu_out_of_window Number of data PDUs received out of the receive window.
-* \param[out] stat_rx_data_bytes_out_of_window Number of data bytes received out of the receive window.
-* \param[out] stat_timer_reordering_timed_out Number of times the timer "reordering" has timed-out.
-*/
-void rlc_um_stat_req (rlc_um_entity_t *rlc_pP,
- unsigned int* stat_tx_pdcp_sdu,
- unsigned int* stat_tx_pdcp_bytes,
- unsigned int* stat_tx_pdcp_sdu_discarded,
- unsigned int* stat_tx_pdcp_bytes_discarded,
- unsigned int* stat_tx_data_pdu,
- unsigned int* stat_tx_data_bytes,
- unsigned int* stat_rx_pdcp_sdu,
- unsigned int* stat_rx_pdcp_bytes,
- unsigned int* stat_rx_data_pdus_duplicate,
- unsigned int* stat_rx_data_bytes_duplicate,
- unsigned int* stat_rx_data_pdu,
- unsigned int* stat_rx_data_bytes,
- unsigned int* stat_rx_data_pdu_dropped,
- unsigned int* stat_rx_data_bytes_dropped,
- unsigned int* stat_rx_data_pdu_out_of_window,
- unsigned int* stat_rx_data_bytes_out_of_window,
- unsigned int* stat_timer_reordering_timed_out);
-
-/*! \fn void rlc_um_get_pdus (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)
-* \brief Request the segmentation of SDUs based on status previously sent by MAC.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-*/
-void
-rlc_um_get_pdus (const protocol_ctxt_t* const ctxt_pP, void *argP);
-/*! \fn void rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indication)
-* \brief Process the received PDUs from lower layer.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] data_indication PDUs from MAC.
-*/
-void
-rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, void *argP, struct mac_data_ind data_indP);
-/*! \fn struct mac_status_resp rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, struct mac_status_ind tx_statusP)
-* \brief Request the maximum number of bytes that can be served by RLC instance to MAC and fix the amount of bytes requested by MAC for next RLC transmission.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU.
-* \return The maximum number of bytes that can be served by RLC instance to MAC.
-*/
-struct mac_status_resp
-rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, struct mac_status_ind tx_statusP,const eNB_flag_t enb_flagP);
-
-/*! \fn struct mac_data_req rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,const eNB_flag_t enb_flagP)
-* \brief Gives PDUs to lower layer MAC.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] enb_flagP eNB or UE flag.
-* \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission.
-*/
-struct mac_data_req
-rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP,const eNB_flag_t enb_flagP);
-
-/*! \fn void rlc_um_mac_data_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,struct mac_data_ind data_indP)
-* \brief Receive PDUs from lower layer MAC.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] data_indP PDUs from MAC.
-*/
-
-/*! \fn uint32_t rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP)
-* \brief Gets Tx Buffer Occupancy.
-* \param[in] rlc_pP RLC UM protocol instance pointer.)
-*/
-uint32_t rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP);
-
-/*! \fn void rlc_um_data_req (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t *sduP)
-* \brief Interface with higher layers, buffer higher layer SDUS for transmission.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] sduP SDU. (A struct rlc_um_data_req is mapped on sduP->data.)
-*/
-void
-rlc_um_mac_data_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, struct mac_data_ind data_indP);
-void
-rlc_um_data_req (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP, mem_block_t *sdu_pP) ;
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_constants.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_constants.h
deleted file mode 100644
index 5f210dbe7b..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_constants.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_um_constants.h
-* \brief This file defines constant values used inside RLC UM.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/**
-* @addtogroup _rlc_um_internal_impl_
-* @{
-*/
-# ifndef __RLC_UM_CONSTANTS_H__
-# define __RLC_UM_CONSTANTS_H__
-
-/** The sequence numbering modulo (10 bits). */
-# define RLC_UM_SN_10_BITS_MODULO 1024
-/** The sequence numbering binary mask (10 bits). */
-# define RLC_UM_SN_10_BITS_MASK 0x03FF
-/** UM_Window_Size = 512 when a 10 bit SN is configured. */
-# define RLC_UM_WINDOW_SIZE_SN_10_BITS 512
-/** The sequence numbering modulo (5 bits). */
-# define RLC_UM_SN_5_BITS_MODULO 32
-/** The sequence numbering binary mask (5 bits). */
-# define RLC_UM_SN_5_BITS_MASK 0x1F
-/** UM_Window_Size = 16 when a 5 bit SN is configured. */
-# define RLC_UM_WINDOW_SIZE_SN_5_BITS 16
-// This constant is used by the receiving UM RLC entity to define SNs of those
-// UMD PDUs that can be received without causing an advancement of the
-// receiving window. UM_Window_Size = 16 when a 5 bit SN is configured,
-// UM_Window_Size = 512 when a 10 bit SN is configured and UM_Window_Size = 0
-// when the receiving UM RLC entity is configured for MCCH or MTCH.
-// li field (values shifted 1 bit left)
-# define RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU 128
-//----------------------------------------------------------
-// Events defined for state model of the acknowledged mode entity
-/** Internal event defined for state model of the RLC UM. */
-# define RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_NULL_STATE_EVENT 0x00
-
-/** Internal event defined for state model of the RLC UM. */
-# define RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT 0x01
-
-/** Internal event defined for state model of the RLC UM. */
-# define RLC_UM_RECEIVE_CRLC_SUSPEND_REQ_EVENT 0x10
-
-/** Internal event defined for state model of the RLC UM. */
-# define RLC_UM_TRANSMIT_CRLC_SUSPEND_CNF_EVENT 0x11
-
-/** Internal event defined for state model of the RLC UM. */
-# define RLC_UM_RECEIVE_CRLC_RESUME_REQ_EVENT 0x12
-
-/** Marker in RX buffer meaning that a PDU has been received. */
-# define RLC_UM_PDU_PREVIOUSLY_RECEIVED 0x01
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c
deleted file mode 100644
index f2cb4f09b1..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_UM_MODULE 1
-#define RLC_UM_CONTROL_PRIMITIVES_C 1
-#include "platform_types.h"
-#include "assertions.h"
-//-----------------------------------------------------------------------------
-#include "rlc_um.h"
-#include "rlc_primitives.h"
-#include "list.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-
-#include "rlc_um_control_primitives.h"
-#include "LTE_T-Reordering.h"
-
-//-----------------------------------------------------------------------------
-void config_req_rlc_um (
- const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const rlc_um_info_t *const config_um_pP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP) {
- rlc_union_t *rlc_union_p = NULL;
- rlc_um_entity_t *rlc_p = NULL;
- hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- hashtable_rc_t h_rc;
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- rlc_p = &rlc_union_p->rlc.um;
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" CONFIG_REQ timer_reordering=%d sn_field_length=%d is_mXch=%d RB %ld\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- config_um_pP->timer_reordering,
- config_um_pP->sn_field_length,
- config_um_pP->is_mXch,
- rb_idP);
- rlc_um_init(ctxt_pP, rlc_p);
-
- if (rlc_um_fsm_notify_event (ctxt_pP, rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) {
- rlc_um_set_debug_infos(ctxt_pP, rlc_p, srb_flagP, rb_idP, chan_idP);
- rlc_um_configure(
- ctxt_pP,
- rlc_p,
- config_um_pP->timer_reordering,
- config_um_pP->sn_field_length,
- config_um_pP->sn_field_length,
- config_um_pP->is_mXch);
- }
- } else {
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" CONFIG_REQ RB %ld RLC UM NOT FOUND\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- rb_idP);
- }
-}
-//-----------------------------------------------------------------------------
-const uint32_t t_Reordering_tab[32] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200,1600};
-
-
-void config_req_rlc_um_asn1 (
- const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const MBMS_flag_t mbms_flagP,
- const mbms_session_id_t mbms_session_idP,
- const mbms_service_id_t mbms_service_idP,
- const LTE_UL_UM_RLC_t *const ul_rlc_pP,
- const LTE_DL_UM_RLC_t *const dl_rlc_pP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP,
- const uint32_t sourceL2Id,
- const uint32_t destinationL2Id
-) {
- uint32_t ul_sn_FieldLength = 0;
- uint32_t dl_sn_FieldLength = 0;
- uint32_t t_Reordering = 0;
- rlc_union_t *rlc_union_p = NULL;
- rlc_um_entity_t *rlc_p = NULL;
- hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- hashtable_rc_t h_rc;
-
- if (mbms_flagP) {
- //AssertFatal(dl_rlc_pP, "No RLC UM DL config");
- if(dl_rlc_pP == NULL) {
- LOG_E(RLC, "No RLC UM DL config\n");
- return;
- }
-
- //AssertFatal(ul_rlc_pP == NULL, "RLC UM UL config present");
- if(ul_rlc_pP != NULL) {
- LOG_E(RLC, "RLC UM UL config present\n");
- return;
- }
-
- key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP);
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- //AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u",
- // ctxt_pP->module_id,
- // ctxt_pP->rnti,
- // ctxt_pP->enb_flag,
- // mbms_service_idP,
- // mbms_session_idP);
- if(h_rc != HASH_TABLE_OK) {
- LOG_E(RLC, "RLC NOT FOUND enb id %u rnti %i enb flag %u service id %u, session id %u\n",
- ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP);
- return;
- }
-
- rlc_p = &rlc_union_p->rlc.um;
- } else if ((sourceL2Id >0 ) && (destinationL2Id >0)) {
- key = RLC_COLL_KEY_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, sourceL2Id, destinationL2Id, srb_flagP);
- } else {
- key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- }
-
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- //AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u",
- // ctxt_pP->module_id,
- // ctxt_pP->rnti,
- // ctxt_pP->enb_flag,
- // rb_idP,
- // srb_flagP);
- if(h_rc != HASH_TABLE_OK) {
- LOG_E(RLC, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %ld, srb flag %u\n",
- ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- return;
- }
-
- rlc_p = &rlc_union_p->rlc.um;
- //-----------------------------------------------------------------------------
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" CONFIG_REQ timer_reordering=%dms sn_field_length= RB %ld \n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- (dl_rlc_pP && dl_rlc_pP->t_Reordering<31)?t_Reordering_tab[dl_rlc_pP->t_Reordering]:-1,
- rb_idP);
- rlc_um_init(ctxt_pP, rlc_p);
-
- if (rlc_um_fsm_notify_event (ctxt_pP, rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) {
- rlc_um_set_debug_infos(ctxt_pP,rlc_p, srb_flagP, rb_idP, chan_idP);
-
- if (ul_rlc_pP != NULL) {
- switch (ul_rlc_pP->sn_FieldLength) {
- case LTE_SN_FieldLength_size5:
- ul_sn_FieldLength = 5;
- break;
-
- case LTE_SN_FieldLength_size10:
- ul_sn_FieldLength = 10;
- break;
-
- default:
- LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %ld INVALID UL sn_FieldLength %ld, RLC NOT CONFIGURED\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- rlc_p->rb_id,
- ul_rlc_pP->sn_FieldLength);
- return;
- }
- }
-
- if (dl_rlc_pP != NULL) {
- switch (dl_rlc_pP->sn_FieldLength) {
- case LTE_SN_FieldLength_size5:
- dl_sn_FieldLength = 5;
- break;
-
- case LTE_SN_FieldLength_size10:
- dl_sn_FieldLength = 10;
- break;
-
- default:
- LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %ld INVALID DL sn_FieldLength %ld, RLC NOT CONFIGURED\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- rlc_p->rb_id,
- dl_rlc_pP->sn_FieldLength);
- return;
- }
-
- if (dl_rlc_pP->t_Reordering<32) {
- t_Reordering = t_Reordering_tab[dl_rlc_pP->t_Reordering];
- } else {
- LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %ld INVALID T_Reordering %ld, RLC NOT CONFIGURED\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- rlc_p->rb_id,
- dl_rlc_pP->t_Reordering);
- return;
- }
- }
-
- if (ctxt_pP->enb_flag > 0) {
- rlc_um_configure(ctxt_pP,rlc_p,
- t_Reordering,
- ul_sn_FieldLength,
- dl_sn_FieldLength,
- mbms_flagP);
- } else {
- rlc_um_configure(ctxt_pP,rlc_p,
- t_Reordering,
- dl_sn_FieldLength,
- ul_sn_FieldLength,
- mbms_flagP);
- }
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_init (
- const protocol_ctxt_t *const ctxt_pP,
- rlc_um_entity_t *const rlc_pP
-) {
- //AssertFatal(rlc_pP, "Bad RLC UM pointer (NULL)");
- if(rlc_pP == NULL) {
- LOG_E(RLC, "Bad RLC UM pointer (NULL)\n");
- return;
- }
-
- if (rlc_pP->initialized) {
- LOG_D(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [INIT] ALREADY DONE, DOING NOTHING\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
- } else {
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [INIT] STATE VARIABLES, BUFFERS, LISTS\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
- memset (rlc_pP, 0, sizeof (rlc_um_entity_t));
- // TX SIDE
- list_init (&rlc_pP->pdus_to_mac_layer, NULL);
- pthread_mutex_init(&rlc_pP->lock_input_sdus, NULL);
- list_init (&rlc_pP->input_sdus, NULL);
- rlc_pP->protocol_state = RLC_NULL_STATE;
- //rlc_pP->vt_us = 0;
- // RX SIDE
- list_init (&rlc_pP->pdus_from_mac_layer, NULL);
- //rlc_pP->vr_ur = 0;
- //rlc_pP->vr_ux = 0;
- //rlc_pP->vr_uh = 0;
- //rlc_pP->output_sdu_size_to_write = 0;
- //rlc_pP->output_sdu_in_construction = NULL;
- rlc_pP->rx_sn_length = 10;
- rlc_pP->rx_header_min_length_in_bytes = 2;
- rlc_pP->tx_sn_length = 10;
- rlc_pP->tx_header_min_length_in_bytes = 2;
- pthread_mutex_init(&rlc_pP->lock_dar_buffer, NULL);
-
- if (rlc_pP->dar_buffer == NULL) {
- rlc_pP->dar_buffer = calloc (1, 1024 * sizeof (void *));
- }
-
- rlc_pP->first_pdu = 1;
- rlc_pP->initialized = true;
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_reset_state_variables (
- const protocol_ctxt_t *const ctxt_pP,
- rlc_um_entity_t *const rlc_pP
-) {
- rlc_pP->buffer_occupancy = 0;
- // TX SIDE
- rlc_pP->vt_us = 0;
- // RX SIDE
- rlc_pP->vr_ur = 0;
- rlc_pP->vr_ux = 0;
- rlc_pP->vr_uh = 0;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_cleanup (
- rlc_um_entity_t *const rlc_pP) {
- int index;
- // TX SIDE
- list_free (&rlc_pP->pdus_to_mac_layer);
- pthread_mutex_destroy(&rlc_pP->lock_input_sdus);
- list_free (&rlc_pP->input_sdus);
- // RX SIDE
- list_free (&rlc_pP->pdus_from_mac_layer);
-
- if ((rlc_pP->output_sdu_in_construction)) {
- free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
- rlc_pP->output_sdu_in_construction = NULL;
- }
-
- if (rlc_pP->dar_buffer) {
- for (index = 0; index < 1024; index++) {
- if (rlc_pP->dar_buffer[index]) {
- free_mem_block (rlc_pP->dar_buffer[index], __func__);
- }
- }
-
- free (rlc_pP->dar_buffer);
- rlc_pP->dar_buffer = NULL;
- }
-
- pthread_mutex_destroy(&rlc_pP->lock_dar_buffer);
- memset(rlc_pP, 0, sizeof(rlc_um_entity_t));
-}
-
-//-----------------------------------------------------------------------------
-void rlc_um_configure(
- const protocol_ctxt_t *const ctxt_pP,
- rlc_um_entity_t *const rlc_pP,
- const uint32_t timer_reorderingP,
- const uint32_t rx_sn_field_lengthP,
- const uint32_t tx_sn_field_lengthP,
- const uint32_t is_mXchP) {
- if (rx_sn_field_lengthP == 10) {
- rlc_pP->rx_sn_length = 10;
- rlc_pP->rx_sn_modulo = RLC_UM_SN_10_BITS_MODULO;
- rlc_pP->rx_um_window_size = RLC_UM_WINDOW_SIZE_SN_10_BITS;
- rlc_pP->rx_header_min_length_in_bytes = 2;
- } else if (rx_sn_field_lengthP == 5) {
- rlc_pP->rx_sn_length = 5;
- rlc_pP->rx_sn_modulo = RLC_UM_SN_5_BITS_MODULO;
- rlc_pP->rx_um_window_size = RLC_UM_WINDOW_SIZE_SN_5_BITS;
- rlc_pP->rx_header_min_length_in_bytes = 1;
- } else if (rx_sn_field_lengthP != 0) {
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %ld INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->rb_id,
- rx_sn_field_lengthP);
- return;
- }
-
- if (tx_sn_field_lengthP == 10) {
- rlc_pP->tx_sn_length = 10;
- rlc_pP->tx_sn_modulo = RLC_UM_SN_10_BITS_MODULO;
- rlc_pP->tx_um_window_size = RLC_UM_WINDOW_SIZE_SN_10_BITS;
- rlc_pP->tx_header_min_length_in_bytes = 2;
- } else if (tx_sn_field_lengthP == 5) {
- rlc_pP->tx_sn_length = 5;
- rlc_pP->tx_sn_modulo = RLC_UM_SN_5_BITS_MODULO;
- rlc_pP->tx_um_window_size = RLC_UM_WINDOW_SIZE_SN_5_BITS;
- rlc_pP->tx_header_min_length_in_bytes = 1;
- } else if (tx_sn_field_lengthP != 0) {
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %ld INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->rb_id,
- tx_sn_field_lengthP);
- return;
- }
-
- if (is_mXchP > 0) {
- rlc_pP->tx_um_window_size = 0;
- rlc_pP->rx_um_window_size = 0;
- }
-
- rlc_pP->is_mxch = is_mXchP;
- rlc_pP->last_reassemblied_sn = rlc_pP->rx_sn_modulo - 1;
- rlc_pP->last_reassemblied_missing_sn = rlc_pP->rx_sn_modulo - 1;
- rlc_pP->reassembly_missing_sn_detected = 0;
- // timers
- rlc_um_init_timer_reordering(ctxt_pP,rlc_pP, timer_reorderingP);
- rlc_pP->first_pdu = 1;
- rlc_um_reset_state_variables (ctxt_pP,rlc_pP);
-}
-//-----------------------------------------------------------------------------
-void rlc_um_set_debug_infos(
- const protocol_ctxt_t *const ctxt_pP,
- rlc_um_entity_t *const rlc_pP,
- const srb_flag_t srb_flagP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP) {
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [SET DEBUG INFOS] rb_id %ld srb_flag %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rb_idP,
- srb_flagP);
- rlc_pP->rb_id = rb_idP;
- rlc_pP->channel_id = chan_idP;
-
- if (srb_flagP) {
- rlc_pP->is_data_plane = 0;
- } else {
- rlc_pP->is_data_plane = 1;
- }
-}
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h
deleted file mode 100644
index 45d7c4b3af..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_um_control_primitives.h
-* \brief This file defines the prototypes of the functions dealing with the control primitives and initialization.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_um_init_impl_ RLC UM Init Reference Implementation
-* @ingroup _rlc_um_impl_
-* @{
-*/
-# ifndef __RLC_UM_CONTROL_PRIMITIVES_H__
-# define __RLC_UM_CONTROL_PRIMITIVES_H__
-//-----------------------------------------------------------------------------
-# include "rlc_um_entity.h"
-# include "mem_block.h"
-# include "rlc_um_structs.h"
-# include "rlc_um_constants.h"
-# include "platform_types.h"
-# include "LTE_DL-UM-RLC.h"
-# include "LTE_UL-UM-RLC.h"
-//-----------------------------------------------------------------------------
-
-typedef volatile struct {
- uint32_t is_uplink_downlink;
- uint32_t timer_reordering;
- uint32_t sn_field_length; // 5 or 10
- uint32_t is_mXch; // boolean, true if configured for MTCH or MCCH
-} rlc_um_info_t;
-
-
-/*! \fn void config_req_rlc_um (
- * const protocol_ctxt_t* const ctxt_pP,
- * const srb_flag_t srb_flagP,
- * const rlc_um_info_t * const config_umP,
- * const rb_id_t rb_idP)
-* \brief Allocate memory for RLC UM instance, reset protocol variables, and set protocol parameters. After this configuration the RLC UM protocol instance will be in RLC_DATA_TRANSFER_READY_STATE state.
-* \param[in] ctxt_pP Running context.
-* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
-* \param[in] config_umP Configuration parameters for RLC UM instance.
-* \param[in] rb_idP Radio bearer identifier.
-* \param[in] chan_idP Transport channel identifier.
-*/
-void config_req_rlc_um (
- const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const rlc_um_info_t *const config_umP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP);
-
-/*! \fn void config_req_rlc_um_asn1 (
- * const protocol_ctxt_t* const ctxt_pP,
- * const srb_flag_t srb_flagP,
- * const MBMS_flag_t mbms_flagP,
- * const mbms_session_id_t mbms_session_idP,
- * const mbms_service_id_t mbms_service_idP,
- * const UL_UM_RLC_t* const ul_rlc_pP,
- * const DL_UM_RLC_t* const dl_rlc_pP,
- * const rb_id_t rb_idP)
-* \brief Allocate memory for RLC UM instance, reset protocol variables, and set protocol parameters. After this configuration the RLC UM protocol instance will be in RLC_DATA_TRANSFER_READY_STATE state.
-* \param[in] ctxt_pP Running context.
-* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
-* \param[in] mbms_flagP Flag to indicate if this RLC is configured for MBMS.
-* \param[in] mbms_session_idP MBMS session id.
-* \param[in] mbms_service_idP MBMS service id.
-* \param[in] ul_rlc_pP Configuration parameters for RLC UM UL instance.
-* \param[in] dl_rlc_pP Configuration parameters for RLC UM DL instance.
-* \param[in] rb_idP Radio bearer identifier.
-* \param[in] chan_idP Transport channel identifier.
-*/
-void config_req_rlc_um_asn1 (
- const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const MBMS_flag_t mbms_flagP,
- const mbms_session_id_t mbms_session_idP,
- const mbms_service_id_t mbms_service_idP,
- const LTE_UL_UM_RLC_t *const ul_rlc_pP,
- const LTE_DL_UM_RLC_t *const dl_rlc_pP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP,
- const uint32_t sourceL2Id,
- const uint32_t destinationL2Id
-);
-
-/*! \fn void rlc_um_init (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)
-* \brief Initialize a RLC UM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC UM protocol instance will be in RLC_NULL_STATE state.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-*/
-void rlc_um_init (
- const protocol_ctxt_t *const ctxt_pP,
- rlc_um_entity_t *const rlc_pP);
-
-/*! \fn void rlc_um_reset_state_variables (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)
-* \brief Reset protocol variables and state variables to initial values.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-*/
-void rlc_um_reset_state_variables (
- const protocol_ctxt_t *const ctxt_pP,
- rlc_um_entity_t *const rlc_pP);
-
-/*! \fn void rlc_um_cleanup(rlc_um_entity_t * const rlc_pP)
-* \brief Free all allocated memory (lists and buffers) previously allocated by this RLC UM instance.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-*/
-void rlc_um_cleanup(
- rlc_um_entity_t *const rlc_pP);
-
-/*! \fn void rlc_um_configure(
- * const protocol_ctxt_t* const ctxt_pP,
- * rlc_um_entity_t * const rlc_pP,
- * const uint32_t timer_reorderingP,
- * const uint32_t rx_sn_field_lengthP,
- * const uint32_t tx_sn_field_lengthP,
- * const uint32_t is_mXchP)
-* \brief Configure RLC UM protocol parameters.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] timer_reorderingP t-Reordering timer initialization value, units in frameP.
-* \param[in] rx_sn_field_lengthP Length of the sequence number, 5 or 10 bits in reception.
-* \param[in] tx_sn_field_lengthP Length of the sequence number, 5 or 10 bits in transmission.
-* \param[in] is_mXchP Is the radio bearer for MCCH, MTCH.
-*/
-void rlc_um_configure(
- const protocol_ctxt_t *const ctxt_pP,
- rlc_um_entity_t *const rlc_pP,
- const uint32_t timer_reorderingP,
- const uint32_t rx_sn_field_lengthP,
- const uint32_t tx_sn_field_lengthP,
- const uint32_t is_mXchP);
-
-/*! \fn void rlc_um_set_debug_infos(
-* const protocol_ctxt_t* const ctxt_pP,
-* rlc_um_entity_t * const rlc_pP,
-* const srb_flag_t srb_flagP,
-* const rb_id_t rb_idP)
-* \brief Set debug informations for a RLC UM protocol instance, these informations are only for trace purpose.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0).
-* \param[in] rb_idP Radio bearer identifier.
-* \param[in] chan_idP Transport channel identifier.
-*/
-void rlc_um_set_debug_infos(
- const protocol_ctxt_t *const ctxt_pP,
- rlc_um_entity_t *const rlc_pP,
- const srb_flag_t srb_flagP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c
deleted file mode 100644
index 6d2380d4ff..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c
+++ /dev/null
@@ -1,1220 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_UM_MODULE 1
-#define RLC_UM_DAR_C 1
-#include "platform_types.h"
-#include "assertions.h"
-//-----------------------------------------------------------------------------
-#include "rlc.h"
-#include "rlc_um.h"
-#include "rlc_primitives.h"
-#include "mac_primitives.h"
-#include "list.h"
-#include "common/utils/LOG/log.h"
-#include "common/utils/LOG/vcd_signal_dumper.h"
-//-----------------------------------------------------------------------------
-signed int rlc_um_get_pdu_infos(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_um_entity_t* const rlc_pP,
- rlc_um_pdu_sn_10_t * const header_pP,
- const sdu_size_t total_sizeP,
- rlc_um_pdu_info_t * const pdu_info_pP,
- const uint8_t sn_lengthP)
-{
- sdu_size_t sum_li = 0;
- memset(pdu_info_pP, 0, sizeof (rlc_um_pdu_info_t));
-
- pdu_info_pP->num_li = 0;
-
- //AssertFatal( total_sizeP > 0 , "RLC UM PDU LENGTH %d", total_sizeP);
- if(total_sizeP <= 0) {
- LOG_E(RLC, "RLC UM PDU LENGTH %d\n", total_sizeP);
- return -1;
- }
-
- if (sn_lengthP == 10) {
- pdu_info_pP->fi = (header_pP->b1 >> 3) & 0x03;
- pdu_info_pP->e = (header_pP->b1 >> 2) & 0x01;
- pdu_info_pP->sn = header_pP->b2 + (((uint16_t)(header_pP->b1 & 0x03)) << 8);
- pdu_info_pP->header_size = 2;
- pdu_info_pP->payload = &header_pP->data[0];
- } else if (sn_lengthP == 5) {
- pdu_info_pP->fi = (header_pP->b1 >> 6) & 0x03;
- pdu_info_pP->e = (header_pP->b1 >> 5) & 0x01;
- pdu_info_pP->sn = header_pP->b1 & 0x1F;
- pdu_info_pP->header_size = 1;
- pdu_info_pP->payload = &header_pP->b2;
- } else {
- //AssertFatal( sn_lengthP == 5 || sn_lengthP == 10, "RLC UM SN LENGTH %d", sn_lengthP);
- if(!(sn_lengthP == 5 || sn_lengthP == 10)) {
- LOG_E(RLC, "RLC UM SN LENGTH %d\n", sn_lengthP);
- return -1;
- }
- }
-
-
- if (pdu_info_pP->e) {
- rlc_am_e_li_t *e_li_p;
- unsigned int li_length_in_bytes = 1;
- unsigned int li_to_read = 1;
-
- e_li_p = (rlc_am_e_li_t*)(pdu_info_pP->payload);
-
- while (li_to_read) {
- li_length_in_bytes = li_length_in_bytes ^ 3;
-
- if (li_length_in_bytes == 2) {
- //AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b2) - (uint64_t)header_pP),
- // "DECODING PDU TOO FAR PDU size %d", total_sizeP);
- if(total_sizeP < ((uint64_t)(&e_li_p->b2) - (uint64_t)header_pP)) {
- LOG_E(RLC, "DECODING PDU TOO FAR PDU size %d\n", total_sizeP);
- return -1;
- }
- pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li_p->b1 << 4)) & 0x07F0;
- pdu_info_pP->li_list[pdu_info_pP->num_li] |= (((uint8_t)(e_li_p->b2 >> 4)) & 0x000F);
- li_to_read = e_li_p->b1 & 0x80;
- pdu_info_pP->header_size += 2;
- } else {
- //AssertFatal( total_sizeP >= ((uint64_t)(&e_li_p->b3) - (uint64_t)header_pP),
- // "DECODING PDU TOO FAR PDU size %d", total_sizeP);
- if(total_sizeP < ((uint64_t)(&e_li_p->b3) - (uint64_t)header_pP)) {
- LOG_E(RLC, "DECODING PDU TOO FAR PDU size %d\n", total_sizeP);
- return -1;
- }
- pdu_info_pP->li_list[pdu_info_pP->num_li] = ((uint16_t)(e_li_p->b2 << 8)) & 0x0700;
- pdu_info_pP->li_list[pdu_info_pP->num_li] |= e_li_p->b3;
- li_to_read = e_li_p->b2 & 0x08;
- e_li_p++;
- pdu_info_pP->header_size += 1;
- }
-
- //AssertFatal( pdu_info_pP->num_li <= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU,
- // PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs ",
- // PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- // pdu_info_pP->sn);
- if(pdu_info_pP->num_li >= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU) {
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[GET PDU INFO] SN %04d TOO MANY LIs \n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- pdu_info_pP->sn);
- return -1;
- }
-
- sum_li += pdu_info_pP->li_list[pdu_info_pP->num_li];
- pdu_info_pP->num_li = pdu_info_pP->num_li + 1;
-
- if (pdu_info_pP->num_li > RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU) {
- return -2;
- }
- }
-
- if (li_length_in_bytes == 2) {
- pdu_info_pP->payload = &e_li_p->b3;
- } else {
- pdu_info_pP->payload = &e_li_p->b1;
- }
- }
-
- pdu_info_pP->payload_size = total_sizeP - pdu_info_pP->header_size;
-
- if (pdu_info_pP->payload_size > sum_li) {
- pdu_info_pP->hidden_size = pdu_info_pP->payload_size - sum_li;
- }
-
- return 0;
-}
-//-----------------------------------------------------------------------------
-int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_liP, unsigned int* li_array_pP, unsigned int *num_li_pP, sdu_size_t *data_size_pP)
-{
- int continue_loop = 1;
- unsigned int e1 = 0;
- unsigned int li1 = 0;
- unsigned int e2 = 0;
- unsigned int li2 = 0;
- *num_li_pP = 0;
-
- while ((continue_loop)) {
- //msg("[RLC_UM] e_liP->b1 = %02X\n", e_liP->b1);
- //msg("[RLC_UM] e_liP->b2 = %02X\n", e_liP->b2);
- e1 = ((unsigned int)e_liP->b1 & 0x00000080) >> 7;
- li1 = (((unsigned int)e_liP->b1 & 0x0000007F) << 4) + (((unsigned int)e_liP->b2 & 0x000000F0) >> 4);
- li_array_pP[*num_li_pP] = li1;
- *data_size_pP = *data_size_pP - li1 - 2;
- *num_li_pP = *num_li_pP +1;
-
- if ((e1)) {
- e2 = ((unsigned int)e_liP->b2 & 0x00000008) >> 3;
- li2 = (((unsigned int)e_liP->b2 & 0x00000007) << 8) + ((unsigned int)e_liP->b3 & 0x000000FF);
- li_array_pP[*num_li_pP] = li2;
- *data_size_pP = *data_size_pP - li2 - 1;
- *num_li_pP = *num_li_pP +1;
-
- if (!(*data_size_pP >= 0)) LOG_E(RLC, "Invalid data_size=%d! (pdu_size=%d loop=%d e1=%d e2=%d li2=%d e_liP=%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x)\n",
- *data_size_pP, *data_size_pP, continue_loop, e1, e2, li2,
- (e_liP-(continue_loop-1)+0)->b1,
- (e_liP-(continue_loop-1)+0)->b2,
- (e_liP-(continue_loop-1)+0)->b3,
- (e_liP-(continue_loop-1)+1)->b1,
- (e_liP-(continue_loop-1)+1)->b2,
- (e_liP-(continue_loop-1)+1)->b3,
- (e_liP-(continue_loop-1)+2)->b1,
- (e_liP-(continue_loop-1)+2)->b2,
- (e_liP-(continue_loop-1)+2)->b3);
- // AssertFatal(*data_size_pP >= 0, "Invalid data_size!");
-
- if (e2 == 0) {
- continue_loop = 0;
- } else {
- e_liP++;
- continue_loop++;
- }
- } else {
- if (!(*data_size_pP >= 0)) LOG_E(RLC, "Invalid data_size=%d! (pdu_size=%d loop=%d e1=%d li1=%d e_liP=%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x)\n",
- *data_size_pP, *data_size_pP, continue_loop, e1, li1,
- (e_liP-(continue_loop-1)+0)->b1,
- (e_liP-(continue_loop-1)+0)->b2,
- (e_liP-(continue_loop-1)+0)->b3,
- (e_liP-(continue_loop-1)+1)->b1,
- (e_liP-(continue_loop-1)+1)->b2,
- (e_liP-(continue_loop-1)+1)->b3,
- (e_liP-(continue_loop-1)+2)->b1,
- (e_liP-(continue_loop-1)+2)->b2,
- (e_liP-(continue_loop-1)+2)->b3);
- continue_loop = 0;
- // AssertFatal(*data_size_pP >= 0, "Invalid data_size!");
- }
-
- if (*num_li_pP > RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU) {
- return -1;
- }
- }
-
- *data_ppP = *data_ppP + (((*num_li_pP*3) +1) >> 1);
- if (*data_size_pP > 0) {
- return 0;
- } else if (*data_size_pP == 0) {
- LOG_W(RLC, "Last RLC SDU size is zero!\n");
- return -1;
- } else {
- LOG_W(RLC, "Last RLC SDU size is negative %d!\n", *data_size_pP);
- return -1;
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_try_reassembly(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * rlc_pP,
- rlc_sn_t start_snP,
- rlc_sn_t end_snP)
-{
- mem_block_t *pdu_mem_p = NULL;
- struct mac_tb_ind *tb_ind_p = NULL;
- rlc_um_e_li_t *e_li_p = NULL;
- unsigned char *data_p = NULL;
- int e = 0;
- int fi = 0;
- sdu_size_t size = 0;
- rlc_sn_t sn = 0;
- unsigned int continue_reassembly = 0;
- unsigned int num_li = 0;
- unsigned int li_array[RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU];
- int i = 0;
- int reassembly_start_index = 0;
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_TRY_REASSEMBLY,VCD_FUNCTION_IN);
-
- if (end_snP < 0) {
- end_snP = end_snP + rlc_pP->rx_sn_modulo;
- }
-
- if (start_snP < 0) {
- start_snP = start_snP + rlc_pP->rx_sn_modulo;
- }
-
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY FROM PDU SN=%03d+1 TO PDU SN=%03d SN Length = %d bits (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->last_reassemblied_sn,
- end_snP,
- rlc_pP->rx_sn_length,
- __FILE__,
- __LINE__);
-#endif
-
- // nothing to be reassemblied
- if (start_snP == end_snP) {
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_TRY_REASSEMBLY,VCD_FUNCTION_OUT);
- return;
- }
-
- continue_reassembly = 1;
- //sn = (rlc_pP->last_reassemblied_sn + 1) % rlc_pP->rx_sn_modulo;
- sn = start_snP;
-
- //check_mem_area();
-
- while (continue_reassembly) {
- if ((pdu_mem_p = rlc_pP->dar_buffer[sn])) {
-
- if ((rlc_pP->last_reassemblied_sn+1)%rlc_pP->rx_sn_modulo != sn) {
-#if TRACE_RLC_UM_DAR
- LOG_W(RLC,
- PROTOCOL_RLC_UM_CTXT_FMT" FINDING a HOLE in RLC UM SN: CLEARING OUTPUT SDU BECAUSE NEW SN (%03d) TO REASSEMBLY NOT CONTIGUOUS WITH LAST REASSEMBLIED SN (%03d) (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn,
- rlc_pP->last_reassemblied_sn,
- __FILE__,
- __LINE__);
-#endif
- rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP);
- }
-
- rlc_pP->last_reassemblied_sn = sn;
- tb_ind_p = (struct mac_tb_ind *)(pdu_mem_p->data);
-
- if (rlc_pP->rx_sn_length == 10) {
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY 10 PDU SN=%03d\n (%s:%u)",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn,
- __FILE__,
- __LINE__);
-#endif
- e = (((rlc_um_pdu_sn_10_t*)(tb_ind_p->data_ptr))->b1 & 0x04) >> 2;
- fi = (((rlc_um_pdu_sn_10_t*)(tb_ind_p->data_ptr))->b1 & 0x18) >> 3;
- e_li_p = (rlc_um_e_li_t*)((rlc_um_pdu_sn_10_t*)(tb_ind_p->data_ptr))->data;
- size = tb_ind_p->size - 2;
- data_p = &tb_ind_p->data_ptr[2];
- } else {
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY 5 PDU SN=%03d Byte 0=%02X (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn,
- ((rlc_um_pdu_sn_5_t*)(tb_ind_p->data_ptr))->b1,
- __FILE__,
- __LINE__);
-#endif
- e = (((rlc_um_pdu_sn_5_t*)(tb_ind_p->data_ptr))->b1 & 0x00000020) >> 5;
- fi = (((rlc_um_pdu_sn_5_t*)(tb_ind_p->data_ptr))->b1 & 0x000000C0) >> 6;
- e_li_p = (rlc_um_e_li_t*)((rlc_um_pdu_sn_5_t*)(tb_ind_p->data_ptr))->data;
- size = tb_ind_p->size - 1;
- data_p = &tb_ind_p->data_ptr[1];
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" e=%01X fi=%01X\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- e,
- fi,
- __FILE__,
- __LINE__);
-#endif
- }
- //AssertFatal(size >= 0, "invalid size!");
- //AssertFatal((e==0) || (e==1), "invalid e!");
- //AssertFatal((fi >= 0) && (fi <= 3), "invalid fi!");
- if((size < 0) || ((e!=0) && (e!=1)) || ((fi < 0) || (fi > 3))){
- LOG_E(RLC, "invalid size %d, e %d, fi %d\n", size, e, fi);
- sn = (sn + 1) % rlc_pP->rx_sn_modulo;
- if ((sn == rlc_pP->vr_uh) || (sn == end_snP)) {
- continue_reassembly = 0;
- }
- continue;
- }
-
- if (e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) {
- switch (fi) {
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY PDU NO E_LI FI=11 (00) (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- __FILE__,
- __LINE__);
-#endif
- // one complete SDU
- //LGrlc_um_send_sdu(rlc_pP,ctxt_pP->frame,ctxt_pP->enb_flag); // may be not necessary
- rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP);
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size);
- rlc_um_send_sdu(ctxt_pP, rlc_pP);
- rlc_pP->reassembly_missing_sn_detected = 0;
-
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY PDU NO E_LI FI=10 (01) (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- __FILE__,
- __LINE__);
-#endif
- // one beginning segment of SDU in PDU
- //LG rlc_um_send_sdu(rlc_pP,ctxt_pP->frame,ctxt_pP->enb_flag); // may be not necessary
- rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP);
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size);
- rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY PDU NO E_LI FI=01 (10) (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- __FILE__,
- __LINE__);
-#endif
-
- // one last segment of SDU
- if (rlc_pP->reassembly_missing_sn_detected == 0) {
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size);
- rlc_um_send_sdu(ctxt_pP, rlc_pP);
- } else {
- //clear sdu already done
- rlc_pP->stat_rx_data_pdu_dropped += 1;
- rlc_pP->stat_rx_data_bytes_dropped += tb_ind_p->size;
- }
-
- rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY PDU NO E_LI FI=00 (11) (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- __FILE__,
- __LINE__);
-#endif
-
- if (rlc_pP->reassembly_missing_sn_detected == 0) {
- // one whole segment of SDU in PDU
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size);
- } else {
-#if TRACE_RLC_UM_DAR
- LOG_W(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY PDU NO E_LI FI=00 (11) MISSING SN DETECTED (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- __FILE__,
- __LINE__);
-#endif
- //LOG_D(RLC, "[MSC_NBOX][FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u][Missing SN detected][RLC_UM][MOD %u/%u][RB %u]\n",
- // ctxt_pP->frame, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->module_id,rlc_pP->rb_id);
- rlc_pP->reassembly_missing_sn_detected = 1; // not necessary but for readability of the code
- rlc_pP->stat_rx_data_pdu_dropped += 1;
- rlc_pP->stat_rx_data_bytes_dropped += tb_ind_p->size;
-#if RLC_STOP_ON_LOST_PDU
- AssertFatal( rlc_pP->reassembly_missing_sn_detected == 1,
- PROTOCOL_RLC_UM_CTXT_FMT" MISSING PDU DETECTED (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- __FILE__,
- __LINE__);
-#endif
- }
-
- break;
-
- default:
- //AssertFatal( 0 , PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n",
- // PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- // fi,
- // __FILE__,
- // __LINE__);
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" fi=%d! TRY REASSEMBLY SHOULD NOT GO HERE (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), fi, __FILE__, __LINE__);
-
- }
- } else {
- if (rlc_um_read_length_indicators(&data_p, e_li_p, li_array, &num_li, &size ) >= 0) {
- switch (fi) {
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY PDU FI=11 (00) Li=",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
-
- for (i=0; i < num_li; i++) {
- LOG_D(RLC, "%d ",li_array[i]);
- }
-
- LOG_D(RLC, " remaining size %d\n",size);
-#endif
- // N complete SDUs
- //LGrlc_um_send_sdu(rlc_pP,ctxt_pP->frame,ctxt_pP->enb_flag);
- rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP);
-
- for (i = 0; i < num_li; i++) {
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, li_array[i]);
- rlc_um_send_sdu(ctxt_pP, rlc_pP);
- data_p = &data_p[li_array[i]];
- }
-
- if (size > 0) { // normally should always be > 0 but just for help debug
- // data_p is already ok, done by last loop above
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size);
- rlc_um_send_sdu(ctxt_pP, rlc_pP);
- }
-
- rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY PDU FI=10 (01) Li=",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
-
- for (i=0; i < num_li; i++) {
- LOG_D(RLC, "%d ",li_array[i]);
- }
-
- LOG_D(RLC, " remaining size %d\n",size);
-#endif
- // N complete SDUs + one segment of SDU in PDU
- //LG rlc_um_send_sdu(rlc_pP,ctxt_pP->frame,ctxt_pP->enb_flag);
- rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP);
-
- for (i = 0; i < num_li; i++) {
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, li_array[i]);
- rlc_um_send_sdu(ctxt_pP, rlc_pP);
- data_p = &data_p[li_array[i]];
- }
-
- if (size > 0) { // normally should always be > 0 but just for help debug
- // data_p is already ok, done by last loop above
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size);
- }
-
- rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY PDU FI=01 (10) Li=",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
-
- for (i=0; i < num_li; i++) {
- LOG_D(RLC, "%d ",li_array[i]);
- }
-
- LOG_D(RLC, " remaining size %d\n",size);
-#endif
-
- if (rlc_pP->reassembly_missing_sn_detected) {
- reassembly_start_index = 1;
- data_p = &data_p[li_array[0]];
- //rlc_pP->stat_rx_data_pdu_dropped += 1;
- rlc_pP->stat_rx_data_bytes_dropped += li_array[0];
- } else {
- reassembly_start_index = 0;
- }
-
- // one last segment of SDU + N complete SDUs in PDU
- for (i = reassembly_start_index; i < num_li; i++) {
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, li_array[i]);
- rlc_um_send_sdu(ctxt_pP, rlc_pP);
- data_p = &data_p[li_array[i]];
- }
-
- if (size > 0) { // normally should always be > 0 but just for help debug
- // data_p is already ok, done by last loop above
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size);
- rlc_um_send_sdu(ctxt_pP, rlc_pP);
- }
-
- rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRY REASSEMBLY PDU FI=00 (11) Li=",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
-
- for (i=0; i < num_li; i++) {
- LOG_D(RLC, "%d ",li_array[i]);
- }
-
- LOG_D(RLC, " remaining size %d\n",size);
-#endif
-
- if (rlc_pP->reassembly_missing_sn_detected) {
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" DISCARD FIRST LI %d (%s:%u)",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- li_array[0],
- __FILE__,
- __LINE__);
-#endif
- reassembly_start_index = 1;
- data_p = &data_p[li_array[0]];
- //rlc_pP->stat_rx_data_pdu_dropped += 1;
- rlc_pP->stat_rx_data_bytes_dropped += li_array[0];
- } else {
- reassembly_start_index = 0;
- }
-
- for (i = reassembly_start_index; i < num_li; i++) {
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, li_array[i]);
- rlc_um_send_sdu(ctxt_pP, rlc_pP);
- data_p = &data_p[li_array[i]];
- }
-
- if (size > 0) { // normally should always be > 0 but just for help debug
- // data_p is already ok, done by last loop above
- rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size);
- } else {
- //AssertFatal( 0 !=0, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n",
- // PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- // size,
- // __FILE__,
- // __LINE__);
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" size=%d! SHOULD NOT GO HERE (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP), size, __FILE__, __LINE__);
-
- //rlc_pP->stat_rx_data_pdu_dropped += 1;
- rlc_pP->stat_rx_data_bytes_dropped += size;
- }
-
- rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- default:
-#if TRACE_RLC_UM_DAR
- LOG_W(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Missing SN detected (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- __FILE__,
- __LINE__);
-#endif
- rlc_pP->stat_rx_data_pdu_dropped += 1;
- rlc_pP->stat_rx_data_bytes_dropped += tb_ind_p->size;
-
- rlc_pP->reassembly_missing_sn_detected = 1;
-#if RLC_STOP_ON_LOST_PDU
- AssertFatal( rlc_pP->reassembly_missing_sn_detected == 1,
- PROTOCOL_RLC_UM_CTXT_FMT" MISSING PDU DETECTED (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- __FILE__,
- __LINE__);
-#endif
- }
- } else {
- rlc_pP->stat_rx_data_pdu_dropped += 1;
- rlc_pP->stat_rx_data_bytes_dropped += tb_ind_p->size;
- rlc_pP->reassembly_missing_sn_detected = 1;
-
- LOG_W(RLC, "[SN %d] Bad RLC header! Discard this RLC PDU (size=%d)\n", sn, size);
- }
- }
-
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" REMOVE PDU FROM DAR BUFFER SN=%03d (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn,
- __FILE__,
- __LINE__);
-#endif
- free_mem_block(rlc_pP->dar_buffer[sn], __func__);
- rlc_pP->dar_buffer[sn] = NULL;
- } else {
- rlc_pP->last_reassemblied_missing_sn = sn;
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Missing SN %04d detected, clearing RX SDU (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn,
- __FILE__,
- __LINE__);
-#endif
- rlc_pP->reassembly_missing_sn_detected = 1;
- rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP);
-#if RLC_STOP_ON_LOST_PDU
- AssertFatal( rlc_pP->reassembly_missing_sn_detected == 1,
- PROTOCOL_RLC_UM_CTXT_FMT" MISSING PDU DETECTED (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- __FILE__,
- __LINE__);
-#endif
- }
-
- sn = (sn + 1) % rlc_pP->rx_sn_modulo;
-
- if ((sn == rlc_pP->vr_uh) || (sn == end_snP)) {
- continue_reassembly = 0;
- }
- }
-
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TRIED REASSEMBLY VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d (%s:%u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->vr_ur,
- rlc_pP->vr_ux,
- rlc_pP->vr_uh,
- __FILE__,
- __LINE__);
-#endif
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_TRY_REASSEMBLY,VCD_FUNCTION_OUT);
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_stop_and_reset_timer_reordering(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * rlc_pP)
-{
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [T-REORDERING] STOPPED AND RESET\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
-#endif
- rlc_pP->t_reordering.running = 0;
- rlc_pP->t_reordering.ms_time_out = 0;
- rlc_pP->t_reordering.ms_start = 0;
- rlc_pP->t_reordering.timed_out = 0;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_start_timer_reordering(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * rlc_pP)
-{
- rlc_pP->t_reordering.timed_out = 0;
-
- if (rlc_pP->t_reordering.ms_duration > 0) {
- rlc_pP->t_reordering.running = 1;
- rlc_pP->t_reordering.ms_time_out = PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) + rlc_pP->t_reordering.ms_duration;
- rlc_pP->t_reordering.ms_start = PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP);
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [T-REORDERING] STARTED (TIME-OUT = FRAME %05u)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->t_reordering.ms_time_out);
-#endif
- } else {
- LOG_T(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[T-REORDERING] NOT STARTED, CAUSE CONFIGURED 0 ms\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
- }
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_init_timer_reordering(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * const rlc_pP,
- const uint32_t ms_durationP)
-{
- rlc_pP->t_reordering.running = 0;
- rlc_pP->t_reordering.ms_time_out = 0;
- rlc_pP->t_reordering.ms_start = 0;
- rlc_pP->t_reordering.ms_duration = ms_durationP;
- rlc_pP->t_reordering.timed_out = 0;
-}
-//-----------------------------------------------------------------------------
-void rlc_um_check_timer_dar_time_out(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * const rlc_pP)
-{
- signed int in_window;
- rlc_usn_t old_vr_ur;
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_CHECK_TIMER_DAR_TIME_OUT,VCD_FUNCTION_IN);
-
- if ((rlc_pP->t_reordering.running)) {
- if (
- // CASE 1: start time out
- // +-----------+------------------+----------+
- // | |******************| |
- // +-----------+------------------+----------+
- //FRAME # 0 FRAME MAX
- ((rlc_pP->t_reordering.ms_start < rlc_pP->t_reordering.ms_time_out) &&
- ((PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) >= rlc_pP->t_reordering.ms_time_out) ||
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) < rlc_pP->t_reordering.ms_start))) ||
- // CASE 2: time out start
- // +-----------+------------------+----------+
- // |***********| |**********|
- // +-----------+------------------+----------+
- //FRAME # 0 FRAME MAX VALUE
- ((rlc_pP->t_reordering.ms_start > rlc_pP->t_reordering.ms_time_out) &&
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) < rlc_pP->t_reordering.ms_start) &&
- (PROTOCOL_CTXT_TIME_MILLI_SECONDS(ctxt_pP) >= rlc_pP->t_reordering.ms_time_out))
- ) {
-
- //if ((uint32_t)((uint32_t)rlc_pP->timer_reordering + (uint32_t)rlc_pP->timer_reordering_init) <= ctxt_pP->frame) {
- // 5.1.2.2.4 Actions when t-Reordering expires
- // When t-Reordering expires, the receiving UM RLC entity shall:
- // -update VR(UR) to the SN of the first UMD PDU with SN >= VR(UX) that has not been received;
- // -reassemble RLC SDUs from any UMD PDUs with SN < updated VR(UR), remove RLC headers when doing so and deliver the reassembled RLC SDUs to upper layer in ascending order of the RLC SN if not delivered before;
- // -if VR(UH) > VR(UR):
- // -start t-Reordering;
- // -set VR(UX) to VR(UH).
- rlc_pP->stat_timer_reordering_timed_out += 1;
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT"*****************************************************\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT"* T I M E - O U T *\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT"*****************************************************\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TIMER t-Reordering expiration\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" timer_reordering=%d frame=%d expire ms %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->t_reordering.ms_duration,
- ctxt_pP->frame,
- rlc_pP->t_reordering.ms_time_out);
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" set VR(UR)=%03d to",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->vr_ur);
-#endif
-
- if (pthread_mutex_trylock(&rlc_pP->lock_dar_buffer) == 0) {
- old_vr_ur = rlc_pP->vr_ur;
-
- rlc_pP->vr_ur = rlc_pP->vr_ux;
-
- while (rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, rlc_pP->vr_ur)) {
- rlc_pP->vr_ur = (rlc_pP->vr_ur+1)%rlc_pP->rx_sn_modulo;
- }
-
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, " %d", rlc_pP->vr_ur);
- LOG_D(RLC, "\n");
-#endif
- rlc_um_try_reassembly(ctxt_pP, rlc_pP ,old_vr_ur, rlc_pP->vr_ur);
-
- in_window = rlc_um_in_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur, rlc_pP->vr_uh, rlc_pP->vr_uh);
-
- if (in_window == 2) {
- rlc_um_start_timer_reordering(ctxt_pP, rlc_pP);
- rlc_pP->vr_ux = rlc_pP->vr_uh;
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" restarting t-Reordering set VR(UX) to %d (VR(UH)>VR(UR))\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->vr_ux);
-#endif
- } else {
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" STOP t-Reordering VR(UX) = %03d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->vr_ux);
-#endif
- rlc_um_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP);
- }
-
- RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer);
- }
- }
- }
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_CHECK_TIMER_DAR_TIME_OUT,VCD_FUNCTION_OUT);
-}
-//-----------------------------------------------------------------------------
-mem_block_t*
-rlc_um_remove_pdu_from_dar_buffer(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * const rlc_pP,
- rlc_usn_t snP)
-{
- mem_block_t * pdu_p = rlc_pP->dar_buffer[snP];
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" REMOVE PDU FROM DAR BUFFER SN=%03d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- snP);
-#endif
- rlc_pP->dar_buffer[snP] = NULL;
- return pdu_p;
-}
-//-----------------------------------------------------------------------------
-mem_block_t*
-rlc_um_get_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, rlc_usn_t snP)
-{
- return rlc_pP->dar_buffer[snP];
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_store_pdu_in_dar_buffer(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * const rlc_pP,
- mem_block_t *pdu_pP,
- rlc_usn_t snP)
-{
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" STORE PDU IN DAR BUFFER SN=%03d VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- snP,
- rlc_pP->vr_ur,
- rlc_pP->vr_ux,
- rlc_pP->vr_uh);
-#endif
- rlc_pP->dar_buffer[snP] = pdu_pP;
-}
-//-----------------------------------------------------------------------------
-// returns -2 if lower_bound > sn
-// returns -1 if higher_bound < sn
-// returns 0 if lower_bound < sn < higher_bound
-// returns 1 if lower_bound == sn
-// returns 2 if higher_bound == sn
-// returns 3 if higher_bound == sn == lower_bound
-signed int
-rlc_um_in_window(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * const rlc_pP,
- rlc_sn_t lower_boundP,
- rlc_sn_t snP,
- rlc_sn_t higher_boundP)
-{
- rlc_sn_t modulus = (rlc_sn_t)rlc_pP->vr_uh - rlc_pP->rx_um_window_size;
-#if TRACE_RLC_UM_RX
- rlc_sn_t lower_bound = lower_boundP;
- rlc_sn_t higher_bound = higher_boundP;
- rlc_sn_t sn = snP;
-#endif
- lower_boundP = (lower_boundP - modulus) % rlc_pP->rx_sn_modulo;
- higher_boundP = (higher_boundP - modulus) % rlc_pP->rx_sn_modulo;
- snP = (snP - modulus) % rlc_pP->rx_sn_modulo;
-
- if ( lower_boundP > snP) {
-#if TRACE_RLC_UM_RX
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" %d not in WINDOW[%03d:%03d] (SNHIGHER BOUND) <=> %d not in WINDOW[%03d:%03d]\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn,
- lower_bound,
- higher_bound,
- snP,
- lower_boundP,
- higher_boundP);
-#endif
- return -1;
- }
-
- if ( lower_boundP == snP) {
- if ( higher_boundP == snP) {
-#if TRACE_RLC_UM_RX
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" %d in WINDOW[%03d:%03d] (SN=HIGHER BOUND=LOWER BOUND)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn,
- lower_bound,
- higher_bound);
-#endif
- return 3;
- }
-
-#if TRACE_RLC_UM_RX
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" %d in WINDOW[%03d:%03d] (SN=LOWER BOUND)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn,
- lower_bound,
- higher_bound);
-#endif
- return 1;
- }
-
- if ( higher_boundP == snP) {
-#if TRACE_RLC_UM_RX
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" %d in WINDOW[%03d:%03d] (SN=HIGHER BOUND)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn,
- lower_bound,
- higher_bound);
-#endif
- return 2;
- }
-
- return 0;
-
-}
-//-----------------------------------------------------------------------------
-signed int
-rlc_um_in_reordering_window(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * const rlc_pP,
- const rlc_sn_t snP)
-{
- rlc_sn_t modulus = (signed int)rlc_pP->vr_uh - rlc_pP->rx_um_window_size;
- rlc_sn_t sn_mod = (snP - modulus) % rlc_pP->rx_sn_modulo;
-
- if ( 0 <= sn_mod) {
- if (sn_mod < rlc_pP->rx_um_window_size) {
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" %d IN REORDERING WINDOW[%03d:%03d[ SN %d IN [%03d:%03d[ VR(UR)=%03d VR(UH)=%03d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn_mod,
- 0,
- rlc_pP->rx_um_window_size,
- snP,
- (signed int)rlc_pP->vr_uh - rlc_pP->rx_um_window_size,
- rlc_pP->vr_uh,
- rlc_pP->vr_ur,
- rlc_pP->vr_uh);
-#endif
- return 0;
- }
- }
-
-#if TRACE_RLC_UM_DAR
-
- if (modulus < 0) {
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" %d NOT IN REORDERING WINDOW[%03d:%03d[ SN %d NOT IN [%03d:%03d[ VR(UR)=%03d VR(UH)=%03d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn_mod,
- modulus + 1024,
- rlc_pP->rx_um_window_size,
- snP,
- modulus + 1024 ,
- rlc_pP->vr_uh,
- rlc_pP->vr_ur,
- rlc_pP->vr_uh);
- } else {
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" %d NOT IN REORDERING WINDOW[%03d:%03d[ SN %d NOT IN [%03d:%03d[ VR(UR)=%03d VR(UH)=%03d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn_mod,
- modulus,
- rlc_pP->rx_um_window_size,
- snP,
- modulus ,
- rlc_pP->vr_uh,
- rlc_pP->vr_ur,
- rlc_pP->vr_uh);
- }
-
-#endif
- return -1;
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_receive_process_dar (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * const rlc_pP,
- mem_block_t * pdu_mem_pP,
- rlc_um_pdu_sn_10_t * const pdu_pP,
- const sdu_size_t tb_sizeP)
-{
- // 36.322v9.3.0 section 5.1.2.2.1:
- // The receiving UM RLC entity shall maintain a reordering window according to state variable VR(UH) as follows:
- // -a SN falls within the reordering window if (VR(UH) – UM_Window_Size) <= SN < VR(UH);
- // -a SN falls outside of the reordering window otherwise.
- // When receiving an UMD PDU from lower layer, the receiving UM RLC entity shall:
- // -either discard the received UMD PDU or place it in the reception buffer (see sub clause 5.1.2.2.2);
- // -if the received UMD PDU was placed in the reception buffer:
- // -update state variables, reassemble and deliver RLC SDUs to upper layer and start/stop t-Reordering as needed (see sub clause 5.1.2.2.3);
- // When t-Reordering expires, the receiving UM RLC entity shall:
- // - update state variables, reassemble and deliver RLC SDUs to upper layer and start t-Reordering as needed (see sub clause 5.1.2.2.4).
-
-
-
- // When an UMD PDU with SN = x is received from lower layer, the receiving UM RLC entity shall:
- // -if VR(UR) < x < VR(UH) and the UMD PDU with SN = x has been received before; or
- // -if (VR(UH) – UM_Window_Size) <= x < VR(UR):
- // -discard the received UMD PDU;
- // -else:
- // -place the received UMD PDU in the reception buffer.
-
- rlc_sn_t sn = -1;
- signed int in_window;
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_IN);
-
- if (rlc_pP->rx_sn_length == 10) {
- sn = ((pdu_pP->b1 & 0x00000003) << 8) + pdu_pP->b2;
- } else if (rlc_pP->rx_sn_length == 5) {
- sn = pdu_pP->b1 & 0x1F;
- } else {
- free_mem_block(pdu_mem_pP, __func__);
- pdu_mem_pP = NULL;
- return;
- }
-
- RLC_UM_MUTEX_LOCK(&rlc_pP->lock_dar_buffer, ctxt_pP, rlc_pP);
-
- in_window = rlc_um_in_window(ctxt_pP, rlc_pP, rlc_pP->vr_uh - rlc_pP->rx_um_window_size, sn, rlc_pP->vr_ur);
-
-#if TRACE_RLC_PAYLOAD
- rlc_util_print_hex_octets(RLC, &pdu_pP->b1, tb_sizeP);
-#endif
-
- // rlc_um_in_window() returns -2 if lower_bound > sn
- // rlc_um_in_window() returns -1 if higher_bound < sn
- // rlc_um_in_window() returns 0 if lower_bound < sn < higher_bound
- // rlc_um_in_window() returns 1 if lower_bound == sn
- // rlc_um_in_window() returns 2 if higher_bound == sn
- // rlc_um_in_window() returns 3 if higher_bound == sn == lower_bound
- if ((in_window == 1) || (in_window == 0)) {
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" RX PDU VR(UH) – UM_Window_Size) <= SN %d < VR(UR) -> GARBAGE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn);
-#endif
- rlc_pP->stat_rx_data_pdu_out_of_window += 1;
- rlc_pP->stat_rx_data_bytes_out_of_window += tb_sizeP;
- free_mem_block(pdu_mem_pP, __func__);
- pdu_mem_pP = NULL;
- RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT);
- return;
- }
-
- if ((rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, sn))) {
- in_window = rlc_um_in_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur, sn, rlc_pP->vr_uh);
-
- if (in_window == 0) {
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" RX PDU VR(UR) < SN %d < VR(UH) and RECEIVED BEFORE-> GARBAGE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn);
-#endif
- //discard the PDU
- rlc_pP->stat_rx_data_pdus_duplicate += 1;
- rlc_pP->stat_rx_data_bytes_duplicate += tb_sizeP;
- free_mem_block(pdu_mem_pP, __func__);
- pdu_mem_pP = NULL;
- RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT);
- return;
- }
-
- // 2 lines to avoid memory leaks
- rlc_pP->stat_rx_data_pdus_duplicate += 1;
- rlc_pP->stat_rx_data_bytes_duplicate += tb_sizeP;
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" RX PDU SN %03d REMOVE OLD PDU BEFORE STORING NEW PDU\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn);
-#endif
- mem_block_t *pdu = rlc_um_remove_pdu_from_dar_buffer(ctxt_pP, rlc_pP, sn);
- free_mem_block(pdu, __func__);
- }
-
- rlc_um_store_pdu_in_dar_buffer(ctxt_pP, rlc_pP, pdu_mem_pP, sn);
-
-
- // -if x falls outside of the reordering window:
- // -update VR(UH) to x + 1;
- // -reassemble RLC SDUs from any UMD PDUs with SN that falls outside of
- // the reordering window, remove RLC headers when doing so and deliver
- // the reassembled RLC SDUs to upper layer in ascending order of the
- // RLC SN if not delivered before;
- //
- // -if VR(UR) falls outside of the reordering window:
- // -set VR(UR) to (VR(UH) – UM_Window_Size);
- if (rlc_um_in_reordering_window(ctxt_pP, rlc_pP, sn) < 0) {
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" RX PDU SN %d OUTSIDE REORDERING WINDOW VR(UH)=%d UM_Window_Size=%d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- sn,
- rlc_pP->vr_uh,
- rlc_pP->rx_um_window_size);
-#endif
- rlc_pP->vr_uh = (sn + 1) % rlc_pP->rx_sn_modulo;
-
- if (rlc_um_in_reordering_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur) != 0) {
- in_window = rlc_pP->vr_uh - rlc_pP->rx_um_window_size;
-
- if (in_window < 0) {
- in_window = in_window + rlc_pP->rx_sn_modulo;
- }
- rlc_um_try_reassembly(ctxt_pP, rlc_pP, rlc_pP->vr_ur, in_window);
- }
-
-
- if (rlc_um_in_reordering_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur) < 0) {
- //LOG_I(RLC, "[rlc_um_receive_process_dar] Problematic case 4 \n");
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" VR(UR) %d OUTSIDE REORDERING WINDOW SET TO VR(UH) – UM_Window_Size = %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->vr_ur,
- in_window);
-#endif
- rlc_pP->vr_ur = in_window;
- }
- }
-
- // -if the reception buffer contains an UMD PDU with SN = VR(UR):
- // -update VR(UR) to the SN of the first UMD PDU with SN > current
- // VR(UR) that has not been received;
- // -reassemble RLC SDUs from any UMD PDUs with SN < updated VR(UR),
- // remove RLC headers when doing so and deliver the reassembled RLC
- // SDUs to upper layer in ascending order of the RLC SN if not
- // delivered before;
- if ((sn == rlc_pP->vr_ur) && rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, rlc_pP->vr_ur)) {
- //sn_tmp = rlc_pP->vr_ur;
- do {
- rlc_pP->vr_ur = (rlc_pP->vr_ur+1) % rlc_pP->rx_sn_modulo;
- } while (rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, rlc_pP->vr_ur) && (rlc_pP->vr_ur != rlc_pP->vr_uh));
- rlc_um_try_reassembly(ctxt_pP, rlc_pP, sn, rlc_pP->vr_ur);
- }
-
- // -if t-Reordering is running:
- // -if VR(UX) <= VR(UR); or
- // -if VR(UX) falls outside of the reordering window and VR(UX) is not
- // equal to VR(UH)::
- // -stop and reset t-Reordering;
- if (rlc_pP->t_reordering.running) {
- if (rlc_pP->vr_uh != rlc_pP->vr_ux) {
- in_window = rlc_um_in_reordering_window(ctxt_pP, rlc_pP, rlc_pP->vr_ux);
-
- if (in_window < 0) {
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC,
- PROTOCOL_RLC_UM_CTXT_FMT" STOP and RESET t-Reordering because VR(UX) falls outside of the reordering window and VR(UX)=%d is not equal to VR(UH)=%d -or- VR(UX) <= VR(UR)\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->vr_ux,
- rlc_pP->vr_uh);
-#endif
- rlc_um_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP);
- }
- }
- }
-
- if (rlc_pP->t_reordering.running) {
- in_window = rlc_um_in_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur, rlc_pP->vr_ux, rlc_pP->vr_uh);
-
- if ((in_window == -2) || (in_window == 1)) {
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC,
- PROTOCOL_RLC_UM_CTXT_FMT" STOP and RESET t-Reordering because VR(UX) falls outside of the reordering window and VR(UX)=%d is not equal to VR(UH)=%d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->vr_ux,
- rlc_pP->vr_uh);
-#endif
- rlc_um_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP);
- }
- }
-
- // -if t-Reordering is not running (includes the case when t-Reordering is
- // stopped due to actions above):
- // -if VR(UH) > VR(UR):
- // -start t-Reordering;
- // -set VR(UX) to VR(UH).
- if (rlc_pP->t_reordering.running == 0) {
- in_window = rlc_um_in_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur, rlc_pP->vr_uh, rlc_pP->vr_uh);
-
- if (in_window == 2) {
- rlc_um_start_timer_reordering(ctxt_pP, rlc_pP);
- rlc_pP->vr_ux = rlc_pP->vr_uh;
-#if TRACE_RLC_UM_DAR
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" RESTART t-Reordering set VR(UX) to VR(UH) =%d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->vr_ux);
-#endif
- }
- }
-
- RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT);
-}
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h
deleted file mode 100644
index e0dccf2eee..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_um_dar.h
-* \brief This file defines the prototypes of the functions dealing with the reassembly buffer.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_um_receiver_impl_ RLC UM Receiver Implementation
-* @ingroup _rlc_um_impl_
-* @{
-*/
-# ifndef __RLC_UM_DAR_H__
-# define __RLC_UM_DAR_H__
-//-----------------------------------------------------------------------------
-# include "rlc_um_entity.h"
-# include "rlc_um_structs.h"
-# include "rlc_um_constants.h"
-# include "list.h"
-//-----------------------------------------------------------------------------
-/*! \fn signed int rlc_um_get_pdu_infos(const protocol_ctxt_t* const ctxt_pP,const rlc_um_entity_t * const rlc_pP,rlc_um_pdu_sn_10_t* header_pP, int16_t total_sizeP, rlc_um_pdu_info_t* pdu_info_pP, uint8_t sn_lengthP)
-* \brief Extract PDU informations (header fields, data size, etc) from the serialized PDU.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer..
-* \param[in] header_pP RLC UM header PDU pointer.
-* \param[in] total_sizeP Size of RLC UM PDU.
-* \param[in] pdu_info_pP Structure containing extracted informations from PDU.
-* \param[in] sn_lengthP Sequence number length in bits in PDU header (5 or 10).
-* \return 0 if no error was encountered during the parsing of the PDU, else -1;
-*/
-signed int rlc_um_get_pdu_infos(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_um_entity_t * const rlc_pP,
- rlc_um_pdu_sn_10_t * const header_pP,
- const sdu_size_t total_sizeP,
- rlc_um_pdu_info_t * const pdu_info_pP,
- const uint8_t sn_lengthP);
-
-/*! \fn int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_li_pP, unsigned int* li_array_pP, unsigned int *num_li_pP, sdu_size_t *data_size_pP)
-* \brief Reset protocol variables and state variables to initial values.
-* \param[in,out] data_ppP Pointer on data payload.
-* \param[in] e_li_pP Pointer on first LI + e bit in PDU.
-* \param[in,out] li_array_pP Array containing read LI.
-* \param[in,out] num_li_pP Pointer on number of LI read.
-* \param[in,out] data_size_pP Pointer on data size.
-* \return 0 if no error was encountered during the parsing of the PDU, else -1;
-*/
-int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_li_pP, unsigned int* li_array_pP, unsigned int *num_li_pP, sdu_size_t *data_size_pP);
-
-/*! \fn void rlc_um_try_reassembly (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, rlc_sn_t start_snP, rlc_sn_t end_snP)
-* \brief Try reassembly PDUs from DAR buffer, starting at sequence number snP.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] frameP Frame index.
-* \param[in] start_snP First PDU to be reassemblied if possible.
-* \param[in] end_snP Last excluded highest sequence number of PDU to be reassemblied.
-*/
-void rlc_um_try_reassembly (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t start_snP, const rlc_sn_t end_snP);
-
-/*! \fn void rlc_um_check_timer_reordering(rlc_um_entity_t * const rlc_pP,frame_t frameP)
-* \brief Check if timer reordering has timed-out, if so it is stopped and has the status "timed-out".
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] frameP Frame index
-*/
-void rlc_um_check_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *const rlc_pP);
-
-/*! \fn void rlc_um_stop_and_reset_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)
-* \brief Stop and reset the timer reordering.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] frameP Frame index.
-*/
-void rlc_um_stop_and_reset_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *const rlc_pP);
-
-/*! \fn void rlc_um_start_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)
-* \brief Re-arm (based on RLC UM config parameter) and start timer reordering.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] frameP Frame index.
-*/
-void rlc_um_start_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP);
-
-/*! \fn void rlc_um_init_timer_reordering(rlc_um_entity_t * const rlc_pP, const uint32_t ms_durationP)
-* \brief Initialize the timer reordering with RLC UM time-out config parameter.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] ms_durationP Duration in milliseconds units.
-*/
-void rlc_um_init_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint32_t ms_durationP);
-
-/*! \fn void rlc_um_check_timer_dar_time_out(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,)
-* \brief Check if t-Reordering expires and take the appropriate actions as described in 3GPP specifications.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-*/
-void rlc_um_check_timer_dar_time_out(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP);
-
-/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t * const rlc_pP, uint16_t snP)
-* \brief Remove the PDU with sequence number snP from the DAR buffer and return it.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] snP Sequence number.
-* \return The PDU stored in the DAR buffer having sequence number snP, else return NULL.
-*/
-mem_block_t *rlc_um_remove_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP);
-
-/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP)
-* \brief Get the PDU with sequence number snP from the DAR buffer.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] snP Sequence number.
-* \return The PDU stored in the DAR buffer having sequence number snP, else return NULL.
-*/
-mem_block_t* rlc_um_get_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP);
-
-/*! \fn signed int rlc_um_in_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,rlc_sn_t lower_boundP, rlc_sn_t snP, rlc_sn_t higher_boundP)
-* \brief Compute if the sequence number of a PDU is in a window .
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] lower_boundP Lower bound of a window.
-* \param[in] snP Sequence number of a theorical PDU.
-* \param[in] higher_boundP Higher bound of a window.
-* \return -2 if lower_boundP > sn, -1 if higher_boundP < sn, 0 if lower_boundP < sn < higher_boundP, 1 if lower_boundP == sn, 2 if higher_boundP == sn, 3 if higher_boundP == sn == lower_boundP.
-*/
-signed int rlc_um_in_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t lower_boundP, const rlc_sn_t snP, const rlc_sn_t higher_boundP);
-
-/*! \fn signed int rlc_um_in_reordering_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t snP)
-* \brief Compute if the sequence number of a PDU is in a window .
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] snP Sequence number of a theorical PDU.
-* \return 0 if snP is in reordering window, else -1.
-*/
-signed int rlc_um_in_reordering_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t snP);
-
-/*! \fn void rlc_um_receive_process_dar (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t *pdu_mem_pP,rlc_um_pdu_sn_10_t * const pdu_pP, const sdu_size_t tb_sizeP)
-* \brief Apply the DAR process for a PDU: put it in DAR buffer and try to reassembly or discard it.
-* \param[in] ctxt_pP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] pdu_mem_pP mem_block_t wrapper for a UM PDU .
-* \param[in] pdu_pP Pointer on the header of the UM PDU.
-* \param[in] tb_sizeP Size of the UM PDU.
-*/
-void rlc_um_receive_process_dar (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t * pdu_mem_pP,rlc_um_pdu_sn_10_t * const pdu_pP,
- const sdu_size_t tb_sizeP);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h
deleted file mode 100644
index 34ead65822..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_um_entity.h
-* \brief This file defines the RLC UM variables stored in a struct called rlc_um_entity_t.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note The rlc_um_entity_t structure store protocol variables, statistic variables, allocation variables, buffers and other miscellaneous variables.
-* \bug
-* \warning
-*/
-# ifndef __RLC_UM_ENTITY_H__
-# define __RLC_UM_ENTITY_H__
-
-# include
-# include "platform_types.h"
-#include "common/platform_constants.h"
-# include "list.h"
-# include "rlc_primitives.h"
-# include "rlc_def.h"
-
-typedef struct rlc_um_timer_s {
- uint32_t ms_time_out; /*!< \brief When set, indicate the time the timer will time-out. */
- uint32_t ms_start; /*!< \brief indicate the time the timer has been started. */
- uint32_t ms_duration; /*!< \brief Configured timer duration in frames. */
- uint32_t running:1; /*!< \brief The timer is running. */
- uint32_t timed_out:1; /*!< \brief The timer has timed-out. */
- uint32_t dummy:30; /*!< \brief Bits not used. */
-} rlc_um_timer_t ;
-
-
-/*! \struct rlc_um_entity_s
-* \brief Structure containing a RLC UM instance protocol variables, statistic variables, allocation variables, buffers and other miscellaneous variables.
-*/
-
-typedef struct rlc_um_entity_s {
- bool initialized; /*!< \brief Boolean for rlc_am_entity_t struct initialization. */
- bool is_uplink_downlink; /*!< \brief Is this instance is a transmitter, a receiver or both? */
- rlc_protocol_state_t protocol_state; /*!< \brief Protocol state, can be RLC_NULL_STATE, RLC_DATA_TRANSFER_READY_STATE, RLC_LOCAL_SUSPEND_STATE. */
- bool is_data_plane; /*!< \brief To know if the RLC belongs to a data radio bearer or a signalling radio bearer, for statistics and trace purpose. */
- bool is_mxch; /*!< \brief To know if the RLC belongs to a MBMS bearer. */
- //-----------------------------
- // PROTOCOL VARIABLES
- //-----------------------------
- rlc_usn_t
- vt_us; /*!< \brief This state variable holds the value of the SN to be assigned for the next newly generated UMD PDU. It is initially set to 0, and is updated whenever the UM RLC entity delivers an UMD PDU with SN = VT(US). */
- rlc_usn_t
- vr_ur; /*!< \brief UM receive state variable. This state variable holds the value of the SN of the earliest UMD PDU that is still considered for reordering. It is initially set to 0. */
- rlc_usn_t vr_ux; /*!< \brief UM t-Reordering state variable. This state variable holds the value of the SN following the SN of the UMD PDU which triggered t-Reordering. */
- rlc_usn_t
- vr_uh; /*!< \brief UM highest received state variable. This state variable holds the value of the SN following the SN of the UMD PDU with the highest SN among received UMD PDUs, and it serves as the higher edge of the reordering window. It is initially set to 0. */
- //-----------------------------
- // TIMERS
- //-----------------------------
- struct rlc_um_timer_s t_reordering;
- //*****************************************************************************
- // CONFIGURATION PARAMETERS
- //*****************************************************************************
- uint8_t tx_sn_length; /*!< \brief Length of sequence number in bits, can be 5 or 10. */
- uint8_t rx_sn_length; /*!< \brief Length of sequence number in bits, can be 5 or 10. */
- uint8_t tx_header_min_length_in_bytes; /*!< \brief Length of PDU header, can be 1 or 2 bytes. */
- uint8_t rx_header_min_length_in_bytes; /*!< \brief Length of PDU header, can be 1 or 2 bytes. */
- rlc_sn_t tx_sn_modulo; /*!< \brief Module of the sequence number of PDU, can be RLC_UM_SN_5_BITS_MODULO or RLC_UM_SN_10_BITS_MODULO. */
- rlc_sn_t rx_sn_modulo; /*!< \brief Module of the sequence number of PDU, can be RLC_UM_SN_5_BITS_MODULO or RLC_UM_SN_10_BITS_MODULO. */
- rlc_sn_t rx_um_window_size;
- rlc_sn_t tx_um_window_size;
- //-----------------------------
- // tranmission
- //-----------------------------
- // sdu communication;
- //pthread_spinlock_t lock_input_sdus;
- pthread_mutex_t lock_input_sdus;
- list_t input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). Should be accessed as an array. */
- rlc_buffer_occupancy_t buffer_occupancy; /*!< \brief Number of bytes contained in input_sdus buffer.*/
- uint32_t nb_bytes_requested_by_mac; /*!< \brief Number of bytes requested by lower layer for next transmission. */
- list_t pdus_to_mac_layer; /*!< \brief PDUs buffered for transmission to MAC layer. */
- //*****************************************************************************
- // RECEIVER
- //*****************************************************************************
- mem_block_t *output_sdu_in_construction; /*!< \brief Memory area where a complete SDU is reassemblied before being send to upper layers. */
- sdu_size_t output_sdu_size_to_write; /*!< \brief Size of the reassemblied SDU. */
-
-
- //pthread_spinlock_t lock_dar_buffer;
- pthread_mutex_t lock_dar_buffer;
- mem_block_t **dar_buffer; /*!< \brief Array of rx PDUs. */
- list_t pdus_from_mac_layer; /*!< \brief Not Used. */
-
- logical_chan_id_t channel_id; /*!< \brief Transport channel identifier. */
- rb_id_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */
- rlc_usn_t last_reassemblied_sn; /*!< \brief Sequence number of the last reassemblied PDU. */
- rlc_usn_t last_reassemblied_missing_sn; /*!< \brief Sequence number of the last found missing PDU. */
- rlc_usn_t reassembly_missing_sn_detected; /*!< \brief Act as a boolean, set if a hole in the sequence numbering of received PDUs has been found. */
- //-----------------------------
- // STATISTICS
- //-----------------------------
- bool first_pdu; /*!< \brief Act as a boolean, tells if the next PDU is the first PDU to be received. */
-
- unsigned int stat_tx_pdcp_sdu; /*!< \brief Number of SDUs received from upper layers. */
- unsigned int stat_tx_pdcp_bytes; /*!< \brief Number of SDU bytes received from upper layers. */
- unsigned int stat_tx_pdcp_sdu_discarded; /*!< \brief Number of SDUs received from upper layers that have been discarded. */
- unsigned int stat_tx_pdcp_bytes_discarded; /*!< \brief Number of SDU bytes received from upper layers that have been discarded. */
-
- unsigned int stat_tx_data_pdu; /*!< \brief For statistic report, number of transmitted PDUs to lower layers. */
- unsigned int stat_tx_data_bytes; /*!< \brief For statistic report, number of transmitted bytes to lower layers. */
- unsigned int stat_rx_pdcp_sdu; /*!< \brief For statistic report, number of reassemblied SDUs, sent to upper layers. */
- unsigned int stat_rx_pdcp_bytes; /*!< \brief For statistic report, number of reassemblied bytes, sent to upper layers. */
- unsigned int stat_rx_data_pdus_duplicate; /*!< \brief For statistic report, number of received duplicated PDUs from lower layers. */
- unsigned int stat_rx_data_bytes_duplicate; /*!< \brief For statistic report, number of received duplicated bytes from lower layers. */
- unsigned int stat_rx_data_pdu; /*!< \brief For statistic report, number of received PDUs from lower layers. */
- unsigned int stat_rx_data_bytes; /*!< \brief For statistic report, number of received bytes from lower layers. */
- unsigned int stat_rx_data_pdu_dropped; /*!< \brief For statistic report, number of dropped received PDUs from lower layers. Does not include out of window stat. */
- unsigned int stat_rx_data_bytes_dropped; /*!< \brief For statistic report, number of dropped received bytes from lower layers. Does not include out of window stat. */
- unsigned int stat_rx_data_pdu_out_of_window; /*!< \brief Number of data PDUs received out of the receive window. */
- unsigned int stat_rx_data_bytes_out_of_window; /*!< \brief Number of data bytes received out of the receive window. */
- unsigned int stat_timer_reordering_timed_out;
-} rlc_um_entity_t;
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c
deleted file mode 100644
index b8ac29fca4..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_UM_MODULE 1
-#define RLC_UM_FSM_C 1
-#include "platform_types.h"
-//-----------------------------------------------------------------------------
-#include "rlc_um.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-
-
-//-----------------------------------------------------------------------------
-int
-rlc_um_fsm_notify_event (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t *rlc_pP, uint8_t eventP)
-{
-
- switch (rlc_pP->protocol_state) {
- //-------------------------------
- // RLC_NULL_STATE
- //-------------------------------
- case RLC_NULL_STATE:
- switch (eventP) {
- case RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT:
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM RLC_NULL_STATE -> RLC_DATA_TRANSFER_READY_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
- rlc_pP->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
- return 1;
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM NULL_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- eventP);
- //AssertFatal(1==0,"RLC-UM FSM WARNING PROTOCOL ERROR - EVENT NOT EXPECTED FROM NULL_STATE");
- return 0;
- }
-
- break;
-
- //-------------------------------
- // RLC_DATA_TRANSFER_READY_STATE
- //-------------------------------
- case RLC_DATA_TRANSFER_READY_STATE:
- switch (eventP) {
- case RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_NULL_STATE_EVENT:
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM RLC_DATA_TRANSFER_READY_STATE -> RLC_NULL_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
- rlc_pP->protocol_state = RLC_NULL_STATE;
- return 1;
- break;
-
- case RLC_UM_RECEIVE_CRLC_SUSPEND_REQ_EVENT:
- case RLC_UM_TRANSMIT_CRLC_SUSPEND_CNF_EVENT:
- LOG_I(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM RLC_DATA_TRANSFER_READY_STATE -> RLC_LOCAL_SUSPEND_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
- rlc_pP->protocol_state = RLC_LOCAL_SUSPEND_STATE;
- return 1;
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM DATA_TRANSFER_READY_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- eventP);
- return 0;
- }
-
- break;
-
- //-------------------------------
- // RLC_LOCAL_SUSPEND_STATE
- //-------------------------------
- case RLC_LOCAL_SUSPEND_STATE:
- switch (eventP) {
- case RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_NULL_STATE_EVENT:
- LOG_I(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM RLC_LOCAL_SUSPEND_STATE -> RLC_NULL_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
- rlc_pP->protocol_state = RLC_NULL_STATE;
- return 1;
- break;
-
- case RLC_UM_RECEIVE_CRLC_RESUME_REQ_EVENT:
- LOG_I(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM RLC_LOCAL_SUSPEND_STATE -> RLC_DATA_TRANSFER_READY_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP));
- rlc_pP->protocol_state = RLC_DATA_TRANSFER_READY_STATE;
- return 1;
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM RLC_LOCAL_SUSPEND_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- eventP);
- return 0;
- }
-
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" FSM ERROR UNKNOWN STATE %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP, rlc_pP),
- rlc_pP->protocol_state);
- return 0;
- }
-}
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.h
deleted file mode 100644
index 14ad253dcc..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_um_fsm.h
-* \brief This file defines the prototypes of the functions dealing with the finite state machine of the RLC UM protocol instance.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_um_fsm_impl_ RLC UM FSM Implementation
-* @ingroup _rlc_um_impl_
-* @{
-*/
-# ifndef __RLC_UM_FSM_PROTO_EXTERN_H__
-# define __RLC_UM_FSM_PROTO_EXTERN_H__
-//-----------------------------------------------------------------------------
-# include "platform_types.h"
-# include "rlc_um_entity.h"
-//-----------------------------------------------------------------------------
-/*! \fn int rlc_um_fsm_notify_event (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP, uint8_t eventP)
-* \brief Send an event to the RLC UM finite state machine.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC UM protocol instance pointer.
-* \param[in] eventP Event (#RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_NULL_STATE_EVENT,
-* #RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT,
-* #RLC_UM_RECEIVE_CRLC_SUSPEND_REQ_EVENT,
-* #RLC_UM_TRANSMIT_CRLC_SUSPEND_CNF_EVENT,
-* #RLC_UM_RECEIVE_CRLC_RESUME_REQ_EVENT).
-* \return 1 if no error was encountered, 0 if the event was not processed.
-* \Note This FSM is not LTE 9.3.0 compliant, it has to be modified or removed.
-*/
-int rlc_um_fsm_notify_event (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP, uint8_t eventP);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c
deleted file mode 100644
index ca43dab667..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_UM_MODULE 1
-#define RLC_UM_REASSEMBLY_C 1
-#include "platform_types.h"
-//-----------------------------------------------------------------------------
-#include
-#if ENABLE_ITTI
-# include "platform_types.h"
-# include "intertask_interface.h"
-#endif
-#include "assertions.h"
-#include "rlc.h"
-#include "rlc_um.h"
-#include "rlc_primitives.h"
-#include "list.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-
-//-----------------------------------------------------------------------------
-inline void
-rlc_um_clear_rx_sdu (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t* rlc_pP)
-{
- rlc_pP->output_sdu_size_to_write = 0;
-}
-
-//-----------------------------------------------------------------------------
-void
-rlc_um_reassembly (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP, uint8_t * src_pP, int32_t lengthP)
-{
- sdu_size_t sdu_max_size;
-
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[REASSEMBLY] reassembly() %d bytes %d bytes already reassemblied\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- lengthP,
- rlc_pP->output_sdu_size_to_write);
-
- if (lengthP <= 0) {
- return;
- }
-
- if ((rlc_pP->is_data_plane)) {
- sdu_max_size = RLC_SDU_MAX_SIZE_DATA_PLANE;
- } else {
- sdu_max_size = RLC_SDU_MAX_SIZE_CONTROL_PLANE;
- }
-
- if (rlc_pP->output_sdu_in_construction == NULL) {
- // msg("[RLC_UM_LITE] Getting mem_block ...\n");
- rlc_pP->output_sdu_in_construction = get_free_mem_block (sdu_max_size, __func__);
- rlc_pP->output_sdu_size_to_write = 0;
- }
-
- if ((rlc_pP->output_sdu_in_construction)) {
- // check if no overflow in size
- if ((rlc_pP->output_sdu_size_to_write + lengthP) <= sdu_max_size) {
- memcpy (&rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write], src_pP, lengthP);
- rlc_pP->output_sdu_size_to_write += lengthP;
-#if TRACE_RLC_UM_DISPLAY_ASCII_DATA
- rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write] = 0;
- LOG_T(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[REASSEMBLY] DATA :",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
- rlc_util_print_hex_octets(RLC, (unsigned char*)rlc_pP->output_sdu_in_construction->data, rlc_pP->output_sdu_size_to_write);
-#endif
- } else {
-#if STOP_ON_IP_TRAFFIC_OVERLOAD
- AssertFatal(0, PROTOCOL_RLC_UM_CTXT_FMT" RLC_UM_DATA_IND, SDU TOO BIG, DROPPED\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
-#endif
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[REASSEMBLY] [max_sdu size %d] ERROR SDU SIZE OVERFLOW SDU GARBAGED\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_max_size);
- // erase SDU
- rlc_pP->output_sdu_size_to_write = 0;
- }
- } else {
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[REASSEMBLY]ERROR OUTPUT SDU IS NULL\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
-#if STOP_ON_IP_TRAFFIC_OVERLOAD
- AssertFatal(0, PROTOCOL_RLC_UM_CTXT_FMT" RLC_UM_DATA_IND, SDU DROPPED, OUT OF MEMORY\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
-#endif
- }
-
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_send_sdu (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
-{
- if ((rlc_pP->output_sdu_in_construction)) {
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" SEND_SDU to upper layers %d bytes sdu %p\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->output_sdu_size_to_write,
- rlc_pP->output_sdu_in_construction);
-
- if (rlc_pP->output_sdu_size_to_write > 0) {
- rlc_pP->stat_rx_pdcp_sdu += 1;
- rlc_pP->stat_rx_pdcp_bytes += rlc_pP->output_sdu_size_to_write;
-
-#if TEST_RLC_UM
-#if TRACE_RLC_UM_DISPLAY_ASCII_DATA
- rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write] = 0;
- LOG_T(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[SEND_SDU] DATA :",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
- rlc_util_print_hex_octets(RLC, rlc_pP->output_sdu_in_construction->data, rlc_pP->output_sdu_size_to_write);
-#endif
- rlc_um_v9_3_0_test_data_ind (rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_in_construction);
-#else
- // msg("[RLC] DATA IND ON MOD_ID %d RB ID %d, size %d\n",rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame,rlc_pP->output_sdu_size_to_write);
- rlc_data_ind (
- ctxt_pP,
- BOOL_NOT(rlc_pP->is_data_plane),
- rlc_pP->is_mxch,
- rlc_pP->rb_id,
- rlc_pP->output_sdu_size_to_write,
- rlc_pP->output_sdu_in_construction);
-#endif
- rlc_pP->output_sdu_in_construction = NULL;
- } else {
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT"[SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
- }
-
- rlc_pP->output_sdu_size_to_write = 0;
- }
-}
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.h
deleted file mode 100644
index defdd1364e..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_um_reassembly.h
-* \brief This file defines the prototypes of the functions dealing with the reassembly of segments.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_um_receiver_impl_ RLC UM Receiver Implementation
-* @ingroup _rlc_um_impl_
-* @{
-*/
-# ifndef __RLC_UM_REASSEMBLY_PROTO_EXTERN_H__
-# define __RLC_UM_REASSEMBLY_PROTO_EXTERN_H__
-//-----------------------------------------------------------------------------
-# include "rlc_um_entity.h"
-//-----------------------------------------------------------------------------
-/*! \fn void rlc_um_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)
-* \brief Erase the SDU in construction.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC UM protocol instance pointer.
-*/
-void rlc_um_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP);
-
-/*! \fn void rlc_um_reassembly (uint8_t * srcP, int32_t lengthP, rlc_um_entity_t *rlcP, frame_t frame)
-* \brief Reassembly lengthP bytes to the end of the SDU in construction.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC UM protocol instance pointer.
-* \param[in] srcP Pointer on data to be reassemblied.
-* \param[in] lengthP Length to reassembly.
-*/
-void rlc_um_reassembly (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP, uint8_t * srcP, int32_t lengthP);
-
-/*! \fn void rlc_um_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)
-* \brief Send SDU if any reassemblied to upper layer.
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC UM protocol instance pointer.
-*/
-void rlc_um_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c
deleted file mode 100644
index 90e006cd17..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_UM_MODULE 1
-#define RLC_UM_RECEIVER_C 1
-#include "platform_types.h"
-//-----------------------------------------------------------------------------
-#include "rlc.h"
-#include "rlc_um.h"
-#include "rlc_um_structs.h"
-#include "rlc_primitives.h"
-#include "mac_primitives.h"
-#include "list.h"
-#include "common/utils/LOG/log.h"
-
-//-----------------------------------------------------------------------------
-void
-rlc_um_display_rx_window(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * const rlc_pP
-)
-{
- unsigned long sn = 0;
- unsigned long end_sn = 0;
- LOG_USEDINLOG_VAR(char,str[4]);
- char time_out_str[11];
- int str_index;
- char color[32];
-
- LOG_T(RLC, "\n");
- LOG_T(RLC, "+-------------------------------------------------------------------------------------------------------+");
- LOG_T(RLC, "\n");
- sprintf(time_out_str, "%010d", rlc_pP->t_reordering.ms_duration);
- time_out_str[10] = 0;
- LOG_T(RLC, "| RLC UM RB %02ld VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d t-Reordering: %s %s %s |",
- rlc_pP->rb_id, rlc_pP->vr_ur, rlc_pP->vr_ux, rlc_pP->vr_uh,
- (rlc_pP->t_reordering.running)?" ON":"OFF",
- (rlc_pP->t_reordering.running)?"Time-out frameP:":" ",
- (rlc_pP->t_reordering.running)?time_out_str:" ");
- LOG_T(RLC, "\n");
- LOG_T(RLC, "+------+------------------------------------------------------------------------------------------------+");
- LOG_T(RLC, "\n");
- LOG_T(RLC, "| |00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |");
- LOG_T(RLC, "\n");
- LOG_T(RLC, "+------+------------------------------------------------------------------------------------------------+");
- LOG_T(RLC, "\n");
-
- if (rlc_pP->rx_sn_length == 10) {
- end_sn = RLC_UM_SN_10_BITS_MODULO;
- } else {
- end_sn = RLC_UM_SN_5_BITS_MODULO;
- }
-
-
- for (sn = 0; sn < end_sn; sn++) {
- str[0] = ' ';
- str[1] = ' ';
- str[2] = ' ';
- str[3] = 0;
- str_index = 0;
-
- if ((sn % 32) == 0) {
- if ((sn != 0)) {
- LOG_T(RLC, "%s%s|", RLC_FG_COLOR_DEFAULT, RLC_NORMAL_VIDEO);
- LOG_T(RLC, "\n");
- }
-
- LOG_T(RLC, "%s%s| %04lu |", RLC_FG_COLOR_DEFAULT, RLC_NORMAL_VIDEO, sn);
- }
-
- strcpy(color, RLC_FG_COLOR_DEFAULT);
-
- if (sn == rlc_pP->vr_ur) {
- str[str_index++] = 'R';
- strcpy(color, RLC_FG_COLOR_BLUE);
- }
-
- if (sn == rlc_pP->vr_ux) {
- str[str_index++] = 'X';
- strcpy(color, RLC_FG_COLOR_ORANGE);
- }
-
- if (sn == rlc_pP->vr_uh) {
- str[str_index++] = 'H';
- strcpy(color, RLC_FG_COLOR_RED);
- }
-
- if (rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, sn)) {
- // test RLC_REVERSE_VIDEO
- if (str_index <= 2) {
- str[str_index] = '.';
- }
-
- LOG_T(RLC, "%s%s%s", color, RLC_REVERSE_VIDEO, str);
- } else {
- LOG_T(RLC, "%s%s%s", color, RLC_NORMAL_VIDEO, str);
- }
- }
-
- LOG_T(RLC, "%s%s|", RLC_FG_COLOR_DEFAULT, RLC_NORMAL_VIDEO);
- LOG_T(RLC, "\n");
- LOG_T(RLC, "+------+------------------------------------------------------------------------------------------------+");
- LOG_T(RLC, "\n");
-}
-
-//-----------------------------------------------------------------------------
-void
-rlc_um_receive (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_um_entity_t * const rlc_pP,
- struct mac_data_ind data_indP)
-{
-
- mem_block_t *tb_p = NULL;
- uint8_t *first_byte_p = NULL;
- uint16_t tb_size_in_bytes = 0;
-
- while ((tb_p = list_remove_head (&data_indP.data))) {
-
- first_byte_p = ((struct mac_tb_ind *) (tb_p->data))->data_ptr;
- tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
-
- rlc_pP->stat_rx_data_bytes += tb_size_in_bytes;
- rlc_pP->stat_rx_data_pdu += 1;
-
- if (tb_size_in_bytes > 0) {
- rlc_um_receive_process_dar (ctxt_pP, rlc_pP, tb_p, (rlc_um_pdu_sn_10_t*)first_byte_p, tb_size_in_bytes);
-#if defined(TRACE_RLC_UM_RX)
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->vr_ur,
- rlc_pP->vr_ux,
- rlc_pP->vr_uh);
- //rlc_um_display_rx_window(rlc_pP); commented because bad display
-#endif
- }
- }
-}
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.h
deleted file mode 100644
index 84df8ac77c..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_um_receiver.h
-* \brief This file defines the prototypes of the functions dealing with the first stage of the receiving process.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @addtogroup _rlc_um_receiver_impl_ RLC UM Receiver Implementation
-* @{
-*/
-# ifndef __RLC_UM_RECEIVER_PROTO_EXTERN_H__
-# define __RLC_UM_RECEIVER_PROTO_EXTERN_H__
-# include "rlc_um_entity.h"
-# include "mac_primitives.h"
-
-/*! \fn void rlc_um_display_rx_window(const protocol_ctxt_t* const ctxtP,rlc_um_entity_t * const rlc_pP)
-* \brief Display the content of the RX buffer, the output stream is targeted to TTY terminals because of escape sequences.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-*/
-void rlc_um_display_rx_window(const protocol_ctxt_t* const ctxtP, rlc_um_entity_t * const rlc_pP);
-
-/*! \fn void rlc_um_receive (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indP)
-* \brief Handle the MAC data indication, retreive the transport blocks and send them one by one to the DAR process.
-* \param[in] ctxtP Running context.
-* \param[in] rlc_pP RLC UM protocol instance pointer.
-* \param[in] data_indP Data indication structure containing transport block received from MAC layer.
-*/
-void rlc_um_receive (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indP);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c
deleted file mode 100644
index 5252a8a121..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c
+++ /dev/null
@@ -1,808 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_UM_MODULE 1
-#define RLC_UM_SEGMENT_C 1
-//-----------------------------------------------------------------------------
-#include "platform_types.h"
-#include "common/platform_constants.h"
-//-----------------------------------------------------------------------------
-#include
-#include "assertions.h"
-#include "list.h"
-#include "rlc_um.h"
-#include "rlc_primitives.h"
-#include "common/utils/LOG/log.h"
-
-//-----------------------------------------------------------------------------
-void
-rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
-{
- list_t pdus;
- signed int pdu_remaining_size;
- signed int test_pdu_remaining_size;
-
- int nb_bytes_to_transmit = rlc_pP->nb_bytes_requested_by_mac;
- rlc_um_pdu_sn_10_t *pdu_p;
- struct mac_tb_req *pdu_tb_req_p;
- mem_block_t *pdu_mem_p;
- char *data;
- char *data_sdu_p;
- rlc_um_e_li_t *e_li_p;
- struct rlc_um_tx_sdu_management *sdu_mngt_p;
- unsigned int li_length_in_bytes;
- unsigned int test_li_length_in_bytes;
- unsigned int test_remaining_size_to_substract;
- unsigned int test_remaining_num_li_to_substract;
- unsigned int continue_fill_pdu_with_sdu;
- unsigned int num_fill_sdu;
- unsigned int test_num_li;
- unsigned int fill_num_li;
- mem_block_t *sdu_in_buffer = NULL;
- unsigned int data_pdu_size;
-
- unsigned int fi_first_byte_pdu_is_first_byte_sdu;
- unsigned int fi_last_byte_pdu_is_last_byte_sdu;
- unsigned int fi;
- unsigned int max_li_overhead;
-
- if (nb_bytes_to_transmit < 3) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" NO SEGMENTATION nb_bytes to transmit = %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- nb_bytes_to_transmit);
-#endif
- return;
- }
-
- list_init (&pdus, NULL); // param string identifying the list is NULL
- pdu_mem_p = NULL;
-
- // not fine locking
- RLC_UM_MUTEX_LOCK(&rlc_pP->lock_input_sdus, ctxt_pP, rlc_pP);
-
- while ((list_get_head(&rlc_pP->input_sdus)) && (nb_bytes_to_transmit > 0)) {
-
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" nb_bytes_to_transmit %d BO %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- nb_bytes_to_transmit,
- rlc_pP->buffer_occupancy);
-#endif
-
- // pdu_p management
- if (!pdu_mem_p) {
- if (rlc_pP->input_sdus.nb_elements <= 1) {
- max_li_overhead = 0;
- } else {
- max_li_overhead = (((rlc_pP->input_sdus.nb_elements - 1) * 3) / 2) + ((rlc_pP->input_sdus.nb_elements - 1) % 2);
- }
-
- if (nb_bytes_to_transmit >= (rlc_pP->buffer_occupancy + rlc_pP->tx_header_min_length_in_bytes + max_li_overhead)) {
- data_pdu_size = rlc_pP->buffer_occupancy + rlc_pP->tx_header_min_length_in_bytes + max_li_overhead;
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" alloc PDU size %d bytes to contain not all bytes requested by MAC but all BO of RLC@1\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- data_pdu_size);
-#endif
- } else {
- data_pdu_size = nb_bytes_to_transmit;
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" alloc PDU size %d bytes to contain all bytes requested by MAC@1\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- data_pdu_size);
-#endif
- }
-
- if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req), __func__))) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR COULD NOT GET NEW PDU, EXIT\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
-#endif
- RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus);
- return;
- }
-
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" get new PDU %d bytes\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- data_pdu_size);
-#endif
- pdu_remaining_size = data_pdu_size - 2;
- pdu_p = (rlc_um_pdu_sn_10_t*) (&pdu_mem_p->data[sizeof(struct mac_tb_req)]);
- pdu_tb_req_p = (struct mac_tb_req*) (pdu_mem_p->data);
-
- memset (pdu_mem_p->data, 0, sizeof (rlc_um_pdu_sn_10_t)+sizeof(struct mac_tb_req));
- li_length_in_bytes = 1;
- }
-
- //----------------------------------------
- // compute how many SDUS can fill the PDU
- //----------------------------------------
- continue_fill_pdu_with_sdu = 1;
- num_fill_sdu = 0;
- test_num_li = 0;
- sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
- test_pdu_remaining_size = pdu_remaining_size;
- test_li_length_in_bytes = 1;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
-
-
- while ((sdu_in_buffer) && (continue_fill_pdu_with_sdu > 0)) {
- sdu_mngt_p = ((struct rlc_um_tx_sdu_management *) (sdu_in_buffer->data));
-
- if (sdu_mngt_p->sdu_remaining_size > test_pdu_remaining_size) {
- // no LI
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- } else if (sdu_mngt_p->sdu_remaining_size == test_pdu_remaining_size) {
- // fi will indicate end of PDU is end of SDU, no need for LI
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- } else if ((sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3)) == test_pdu_remaining_size ) {
- // no LI
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- //pdu_remaining_size = pdu_remaining_size - (test_li_length_in_bytes ^ 3);
- } else if ((sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3)) < test_pdu_remaining_size ) {
- test_num_li += 1;
- num_fill_sdu += 1;
- test_pdu_remaining_size = test_pdu_remaining_size - (sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3));
- test_remaining_size_to_substract = test_li_length_in_bytes ^ 3;
- test_remaining_num_li_to_substract = 1;
- test_li_length_in_bytes = test_li_length_in_bytes ^ 3;
- } else {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" sdu_mngt_p->sdu_remaining_size=%d test_pdu_remaining_size=%d test_li_length_in_bytes=%d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p->sdu_remaining_size,
- test_pdu_remaining_size,
- test_li_length_in_bytes ^ 3);
-#endif
- // reduce the size of the PDU
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- pdu_remaining_size = pdu_remaining_size - 1;
- }
-
- sdu_in_buffer = sdu_in_buffer->next;
- }
-
- if (test_remaining_num_li_to_substract > 0) {
- // there is a LI that is not necessary
- test_num_li = test_num_li - 1;
- pdu_remaining_size = pdu_remaining_size - test_remaining_size_to_substract;
- }
-
- //----------------------------------------
- // Do the real filling of the pdu_p
- //----------------------------------------
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" data shift %d Bytes num_li %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- ((test_num_li*3) +1) >> 1,
- test_num_li);
-#endif
-
- data = ((char*)(&pdu_p->data[((test_num_li*3) +1) >> 1]));
- e_li_p = (rlc_um_e_li_t*)(pdu_p->data);
- continue_fill_pdu_with_sdu = 1;
- li_length_in_bytes = 1;
- fill_num_li = 0;
- fi_first_byte_pdu_is_first_byte_sdu = 0;
- fi_last_byte_pdu_is_last_byte_sdu = 0;
-
- sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
-
- if (
- ((struct rlc_um_tx_sdu_management *) (sdu_in_buffer->data))->sdu_remaining_size ==
- ((struct rlc_um_tx_sdu_management *) (sdu_in_buffer->data))->sdu_size) {
- fi_first_byte_pdu_is_first_byte_sdu = 1;
- }
-
- while ((sdu_in_buffer) && (continue_fill_pdu_with_sdu > 0)) {
- sdu_mngt_p = ((struct rlc_um_tx_sdu_management *) (sdu_in_buffer->data));
-
- if (sdu_mngt_p->sdu_segmented_size == 0) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" GET NEW SDU %p AVAILABLE SIZE %d Bytes\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p,
- sdu_mngt_p->sdu_remaining_size);
-#endif
- } else {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" GET AGAIN SDU %p REMAINING AVAILABLE SIZE %d Bytes / %d Bytes \n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p,
- sdu_mngt_p->sdu_remaining_size,
- sdu_mngt_p->sdu_size);
-#endif
- }
-
- data_sdu_p = (char *) &(sdu_in_buffer->data[sizeof (struct rlc_um_tx_sdu_management) + sdu_mngt_p->sdu_segmented_size]);
-
- if (sdu_mngt_p->sdu_remaining_size > pdu_remaining_size) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Filling all remaining PDU with %d bytes\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_remaining_size);
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" pdu_mem_p %p pdu_mem_p->data %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_mem_p,
- pdu_mem_p->data,
- pdu_p,
- pdu_p->data,
- data,
- data_sdu_p,
- pdu_remaining_size);
-#endif
-
- memcpy(data, data_sdu_p, pdu_remaining_size);
- sdu_mngt_p->sdu_remaining_size = sdu_mngt_p->sdu_remaining_size - pdu_remaining_size;
- sdu_mngt_p->sdu_segmented_size = sdu_mngt_p->sdu_segmented_size + pdu_remaining_size;
- fi_last_byte_pdu_is_last_byte_sdu = 0;
- // no LI
- rlc_pP->buffer_occupancy -= pdu_remaining_size;
- continue_fill_pdu_with_sdu = 0;
- pdu_remaining_size = 0;
- } else if (sdu_mngt_p->sdu_remaining_size == pdu_remaining_size) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Exactly Filling remaining PDU with %d remaining bytes of SDU\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_remaining_size);
-#endif
- memcpy(data, data_sdu_p, pdu_remaining_size);
-
- // free SDU
- rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
- sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
- free_mem_block (sdu_in_buffer, __func__);
- sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
- sdu_mngt_p = NULL;
-
-
- fi_last_byte_pdu_is_last_byte_sdu = 1;
- // fi will indicate end of PDU is end of SDU, no need for LI
- continue_fill_pdu_with_sdu = 0;
- pdu_remaining_size = 0;
- } else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Filling PDU with %d all remaining bytes of SDU\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p->sdu_remaining_size);
-#endif
- memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
- data = &data[sdu_mngt_p->sdu_remaining_size];
- li_length_in_bytes = li_length_in_bytes ^ 3;
- fill_num_li += 1;
-
- if (li_length_in_bytes == 2) {
- if (fill_num_li == test_num_li) {
- //e_li_p->e1 = 0;
- e_li_p->b1 = 0;
- } else {
- //e_li_p->e1 = 1;
- e_li_p->b1 = 0x80;
- }
-
- //e_li_p->li1 = sdu_mngt_p->sdu_remaining_size;
- e_li_p->b1 = e_li_p->b1 | (sdu_mngt_p->sdu_remaining_size >> 4);
- e_li_p->b2 = sdu_mngt_p->sdu_remaining_size << 4;
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" set e_li_p->b1=%02X set e_li_p->b2=%02X fill_num_li=%d test_num_li=%d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- e_li_p->b1,
- e_li_p->b2,
- fill_num_li,
- test_num_li);
-#endif
- } else {
- if (fill_num_li != test_num_li) {
- //e_li_p->e2 = 1;
- e_li_p->b2 = e_li_p->b2 | 0x08;
- }
-
- //e_li_p->li2 = sdu_mngt_p->sdu_remaining_size;
- e_li_p->b2 = e_li_p->b2 | (sdu_mngt_p->sdu_remaining_size >> 8);
- e_li_p->b3 = sdu_mngt_p->sdu_remaining_size & 0xFF;
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" set e_li_p->b2=%02X set e_li_p->b3=%02X fill_num_li=%d test_num_li=%d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- e_li_p->b2,
- e_li_p->b3,
- fill_num_li,
- test_num_li);
-#endif
- e_li_p++;
- }
-
- pdu_remaining_size = pdu_remaining_size - (sdu_mngt_p->sdu_remaining_size + li_length_in_bytes);
-
- // free SDU
- rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
- sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
- free_mem_block (sdu_in_buffer, __func__);
- sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
- sdu_mngt_p = NULL;
-
- } else {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p->sdu_remaining_size,
- pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
-#endif
- memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
- // reduce the size of the PDU
- continue_fill_pdu_with_sdu = 0;
- fi_last_byte_pdu_is_last_byte_sdu = 1;
- pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size;
- // free SDU
- rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
- sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
- free_mem_block (sdu_in_buffer, __func__);
- sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
- sdu_mngt_p = NULL;
-
- }
- }
-
- // set framing info
- if (fi_first_byte_pdu_is_first_byte_sdu) {
- fi = 0;
- } else {
- fi = 2;
- }
-
- if (!fi_last_byte_pdu_is_last_byte_sdu) {
- fi = fi + 1;
- }
-
- pdu_p->b1 = (fi << 3); //pdu_p->b1 |
-
- // set fist e bit
- if (fill_num_li > 0) {
- pdu_p->b1 = pdu_p->b1 | 0x04;
- }
-
- pdu_p->b1 = pdu_p->b1 | ((rlc_pP->vt_us >> 8) & 0x03);
- pdu_p->b2 = rlc_pP->vt_us & 0xFF;
- rlc_pP->vt_us = rlc_pP->vt_us+1;
-
- pdu_tb_req_p->data_ptr = (unsigned char*)pdu_p;
- pdu_tb_req_p->tb_size = data_pdu_size - pdu_remaining_size;
- list_add_tail_eurecom (pdu_mem_p, &rlc_pP->pdus_to_mac_layer);
-#if TRACE_RLC_PAYLOAD
- rlc_util_print_hex_octets(RLC, pdu_mem_p->data, data_pdu_size);
-#endif
- //AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT10: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size);
- if(pdu_tb_req_p->tb_size <= 0) {
- LOG_E(RLC, "SEGMENT10: FINAL RLC UM PDU LENGTH %d\n", pdu_tb_req_p->tb_size);
- break;
- }
- pdu_p = NULL;
- pdu_mem_p = NULL;
-
- //nb_bytes_to_transmit = nb_bytes_to_transmit - data_pdu_size;
- nb_bytes_to_transmit = 0; // 1 PDU only
- }
-
- RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus);
-}
-//-----------------------------------------------------------------------------
-void
-rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
-{
- list_t pdus;
- signed int pdu_remaining_size = 0;
- signed int test_pdu_remaining_size = 0;
-
- int nb_bytes_to_transmit = rlc_pP->nb_bytes_requested_by_mac;
- rlc_um_pdu_sn_5_t *pdu_p = NULL;
- struct mac_tb_req *pdu_tb_req_p = NULL;
- mem_block_t *pdu_mem_p = NULL;
- char *data = NULL;
- char *data_sdu_p = NULL;
- rlc_um_e_li_t *e_li_p = NULL;
- struct rlc_um_tx_sdu_management *sdu_mngt_p = NULL;
- unsigned int li_length_in_bytes = 0;
- unsigned int test_li_length_in_bytes = 0;
- unsigned int test_remaining_size_to_substract = 0;
- unsigned int test_remaining_num_li_to_substract = 0;
- unsigned int continue_fill_pdu_with_sdu = 0;
- unsigned int num_fill_sdu = 0;
- unsigned int test_num_li = 0;
- unsigned int fill_num_li = 0;
- mem_block_t *sdu_in_buffer = NULL;
- unsigned int data_pdu_size = 0;
-
- unsigned int fi_first_byte_pdu_is_first_byte_sdu = 0;
- unsigned int fi_last_byte_pdu_is_last_byte_sdu = 0;
- unsigned int fi = 0;
- unsigned int max_li_overhead = 0;
-
- if (nb_bytes_to_transmit < 2) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" NO SEGMENTATION5 nb_bytes to transmit = %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- nb_bytes_to_transmit);
-#endif
- return;
- }
-
- list_init (&pdus, NULL); // param string identifying the list is NULL
- pdu_mem_p = NULL;
-
- RLC_UM_MUTEX_LOCK(&rlc_pP->lock_input_sdus, ctxt_pP, rlc_pP);
-
- while ((list_get_head(&rlc_pP->input_sdus)) && (nb_bytes_to_transmit > 0)) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT"nb_bytes_to_transmit %d BO %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- nb_bytes_to_transmit,
- rlc_pP->buffer_occupancy);
-#endif
-
- // pdu_p management
- if (!pdu_mem_p) {
- if (rlc_pP->input_sdus.nb_elements <= 1) {
- max_li_overhead = 0;
- } else {
- max_li_overhead = (((rlc_pP->input_sdus.nb_elements - 1) * 3) / 2) + ((rlc_pP->input_sdus.nb_elements - 1) % 2);
- }
-
- if (nb_bytes_to_transmit >= (rlc_pP->buffer_occupancy + rlc_pP->tx_header_min_length_in_bytes + max_li_overhead)) {
- data_pdu_size = rlc_pP->buffer_occupancy + rlc_pP->tx_header_min_length_in_bytes + max_li_overhead;
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" alloc PDU size %d bytes to contain not all bytes requested by MAC but all BO of RLC@1\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- data_pdu_size);
-#endif
- } else {
- data_pdu_size = nb_bytes_to_transmit;
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" alloc PDU size %d bytes to contain all bytes requested by MAC@1\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- data_pdu_size);
-#endif
- }
-
- if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req), __func__))) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR COULD NOT GET NEW PDU, EXIT\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
-#endif
- RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus);
- return;
- }
-
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" get new PDU %d bytes\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- data_pdu_size);
-#endif
- pdu_remaining_size = data_pdu_size - 1;
- pdu_p = (rlc_um_pdu_sn_5_t*) (&pdu_mem_p->data[sizeof(struct mac_tb_req)]);
- pdu_tb_req_p = (struct mac_tb_req*) (pdu_mem_p->data);
-
- memset (pdu_mem_p->data, 0, sizeof (rlc_um_pdu_sn_5_t)+sizeof(struct mac_tb_req));
- li_length_in_bytes = 1;
- }
-
- //----------------------------------------
- // compute how many SDUS can fill the PDU
- //----------------------------------------
- continue_fill_pdu_with_sdu = 1;
- num_fill_sdu = 0;
- test_num_li = 0;
- sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
- test_pdu_remaining_size = pdu_remaining_size;
- test_li_length_in_bytes = 1;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
-
-
- while ((sdu_in_buffer) && (continue_fill_pdu_with_sdu > 0)) {
- sdu_mngt_p = ((struct rlc_um_tx_sdu_management *) (sdu_in_buffer->data));
-
- if (sdu_mngt_p->sdu_remaining_size > test_pdu_remaining_size) {
- // no LI
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- } else if (sdu_mngt_p->sdu_remaining_size == test_pdu_remaining_size) {
- // fi will indicate end of PDU is end of SDU, no need for LI
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- } else if ((sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3)) == test_pdu_remaining_size ) {
- // no LI
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- pdu_remaining_size = pdu_remaining_size - (test_li_length_in_bytes ^ 3);
- data_pdu_size -= (test_li_length_in_bytes ^ 3);//modifier pour duy
- } else if ((sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3)) < test_pdu_remaining_size ) {
- test_num_li += 1;
- num_fill_sdu += 1;
- test_pdu_remaining_size = test_pdu_remaining_size - (sdu_mngt_p->sdu_remaining_size + (test_li_length_in_bytes ^ 3));
- test_remaining_size_to_substract = test_li_length_in_bytes ^ 3;
- test_remaining_num_li_to_substract = 1;
- test_li_length_in_bytes = test_li_length_in_bytes ^ 3;
- } else {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" sdu_mngt_p->sdu_remaining_size=%d test_pdu_remaining_size=%d test_li_length_in_bytes=%d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p->sdu_remaining_size,
- test_pdu_remaining_size,
- test_li_length_in_bytes ^ 3);
-#endif
- // reduce the size of the PDU
- continue_fill_pdu_with_sdu = 0;
- num_fill_sdu += 1;
- test_pdu_remaining_size = 0;
- test_remaining_size_to_substract = 0;
- test_remaining_num_li_to_substract = 0;
- pdu_remaining_size = pdu_remaining_size - 1;
- data_pdu_size -= 1;//modifier pour duy
- }
-
- sdu_in_buffer = sdu_in_buffer->next;
- }
-
- if (test_remaining_num_li_to_substract > 0) {
- // there is a LI that is not necessary
- test_num_li = test_num_li - 1;
- pdu_remaining_size = pdu_remaining_size - test_remaining_size_to_substract;
- }
-
- //----------------------------------------
- // Do the real filling of the pdu_p
- //----------------------------------------
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" data shift %d Bytes num_li %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- ((test_num_li*3) +1) >> 1,
- test_num_li);
-#endif
-
- data = ((char*)(&pdu_p->data[((test_num_li*3) +1) >> 1]));
- e_li_p = (rlc_um_e_li_t*)(pdu_p->data);
- continue_fill_pdu_with_sdu = 1;
- li_length_in_bytes = 1;
- fill_num_li = 0;
- fi_first_byte_pdu_is_first_byte_sdu = 0;
- fi_last_byte_pdu_is_last_byte_sdu = 0;
-
- sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
-
- if (
- ((struct rlc_um_tx_sdu_management *) (sdu_in_buffer->data))->sdu_remaining_size ==
- ((struct rlc_um_tx_sdu_management *) (sdu_in_buffer->data))->sdu_size) {
- fi_first_byte_pdu_is_first_byte_sdu = 1;
- }
-
- while ((sdu_in_buffer) && (continue_fill_pdu_with_sdu > 0)) {
- sdu_mngt_p = ((struct rlc_um_tx_sdu_management *) (sdu_in_buffer->data));
-
- if (sdu_mngt_p->sdu_segmented_size == 0) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" GET NEW SDU %p AVAILABLE SIZE %d Bytes\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p,
- sdu_mngt_p->sdu_remaining_size);
-#endif
- } else {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" GET AGAIN SDU %p REMAINING AVAILABLE SIZE %d Bytes / %d Bytes \n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p,
- sdu_mngt_p->sdu_remaining_size,
- sdu_mngt_p->sdu_size);
-#endif
- }
-
- data_sdu_p = (char*) &(sdu_in_buffer->data[sizeof (struct rlc_um_tx_sdu_management) + sdu_mngt_p->sdu_segmented_size]);
-
- if (sdu_mngt_p->sdu_remaining_size > pdu_remaining_size) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Filling all remaining PDU with %d bytes\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_remaining_size);
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" pdu_mem_p %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_mem_p,
- pdu_p,
- pdu_p->data,
- data,
- data_sdu_p,
- pdu_remaining_size);
-#endif
-
- memcpy(data, data_sdu_p, pdu_remaining_size);
- sdu_mngt_p->sdu_remaining_size = sdu_mngt_p->sdu_remaining_size - pdu_remaining_size;
- sdu_mngt_p->sdu_segmented_size = sdu_mngt_p->sdu_segmented_size + pdu_remaining_size;
- fi_last_byte_pdu_is_last_byte_sdu = 0;
- // no LI
- rlc_pP->buffer_occupancy -= pdu_remaining_size;
- continue_fill_pdu_with_sdu = 0;
- pdu_remaining_size = 0;
- } else if (sdu_mngt_p->sdu_remaining_size == pdu_remaining_size) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Exactly Filling remaining PDU with %d remaining bytes of SDU\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- pdu_remaining_size);
-#endif
- memcpy(data, data_sdu_p, pdu_remaining_size);
- // free SDU
- rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
- sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
- free_mem_block (sdu_in_buffer, __func__);
- sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
- sdu_mngt_p = NULL;
-
- fi_last_byte_pdu_is_last_byte_sdu = 1;
- // fi will indicate end of PDU is end of SDU, no need for LI
- continue_fill_pdu_with_sdu = 0;
- pdu_remaining_size = 0;
- } else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) {
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Filling PDU with %d all remaining bytes of SDU\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p->sdu_remaining_size);
-#endif
- memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
- data = &data[sdu_mngt_p->sdu_remaining_size];
- li_length_in_bytes = li_length_in_bytes ^ 3;
- fill_num_li += 1;
-
- if (li_length_in_bytes == 2) {
- if (fill_num_li == test_num_li) {
- //e_li_p->e1 = 0;
- e_li_p->b1 = 0;
- } else {
- //e_li_p->e1 = 1;
- e_li_p->b1 = 0x80;
- }
-
- //e_li_p->li1 = sdu_mngt_p->sdu_remaining_size;
- e_li_p->b1 = e_li_p->b1 | (sdu_mngt_p->sdu_remaining_size >> 4);
- e_li_p->b2 = sdu_mngt_p->sdu_remaining_size << 4;
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" set e_li_p->b1=%02X set e_li_p->b2=%02X fill_num_li=%d test_num_li=%d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- e_li_p->b1,
- e_li_p->b2,
- fill_num_li,
- test_num_li);
-#endif
- } else {
- if (fill_num_li != test_num_li) {
- //e_li_p->e2 = 1;
- e_li_p->b2 = e_li_p->b2 | 0x08;
- }
-
- //e_li_p->li2 = sdu_mngt_p->sdu_remaining_size;
- e_li_p->b2 = e_li_p->b2 | (sdu_mngt_p->sdu_remaining_size >> 8);
- e_li_p->b3 = sdu_mngt_p->sdu_remaining_size & 0xFF;
-#if TRACE_RLC_UM_SEGMENT
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" set e_li_p->b2=%02X set e_li_p->b3=%02X fill_num_li=%d test_num_li=%d\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- e_li_p->b2,
- e_li_p->b3,
- fill_num_li,
- test_num_li);
-#endif
- e_li_p++;
- }
-
- pdu_remaining_size = pdu_remaining_size - (sdu_mngt_p->sdu_remaining_size + li_length_in_bytes);
-
- // free SDU
- rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
- sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
- free_mem_block (sdu_in_buffer, __func__);
- sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
- sdu_mngt_p = NULL;
-
- } else {
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- sdu_mngt_p->sdu_remaining_size,
- pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
- //assert(1!=1);
- memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
- // reduce the size of the PDU
- continue_fill_pdu_with_sdu = 0;
- fi_last_byte_pdu_is_last_byte_sdu = 1;
- pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size;
- // free SDU
- rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
- sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
- free_mem_block (sdu_in_buffer, __func__);
- sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
- sdu_mngt_p = NULL;
- }
- }
-
- // set framing info
- if (fi_first_byte_pdu_is_first_byte_sdu) {
- fi = 0;
- } else {
- fi = 2;
- }
-
- if (!fi_last_byte_pdu_is_last_byte_sdu) {
- fi = fi + 1;
- }
-
- pdu_p->b1 = (fi << 6); //pdu_p->b1 |
-
- // set fist e bit
- if (fill_num_li > 0) {
- pdu_p->b1 = pdu_p->b1 | 0x20;
- }
-
- pdu_p->b1 = pdu_p->b1 | (rlc_pP->vt_us & 0x1F);
- rlc_pP->vt_us = rlc_pP->vt_us+1;
-
- pdu_tb_req_p->data_ptr = (unsigned char*)pdu_p;
- pdu_tb_req_p->tb_size = data_pdu_size - pdu_remaining_size;
- list_add_tail_eurecom (pdu_mem_p, &rlc_pP->pdus_to_mac_layer);
-#if TRACE_RLC_PAYLOAD
- rlc_util_print_hex_octets(RLC, (unsigned char*)pdu_mem_p->data, data_pdu_size);
-#endif
- //AssertFatal( pdu_tb_req_p->tb_size > 0 , "SEGMENT5: FINAL RLC UM PDU LENGTH %d", pdu_tb_req_p->tb_size);
- if(pdu_tb_req_p->tb_size <= 0) {
- LOG_E(RLC, "SEGMENT5: FINAL RLC UM PDU LENGTH %d\n", pdu_tb_req_p->tb_size);
- break;
- }
-
- pdu_p = NULL;
- pdu_mem_p = NULL;
-
- //nb_bytes_to_transmit = nb_bytes_to_transmit - data_pdu_size;
- nb_bytes_to_transmit = 0; // 1 PDU only
- }
-
- RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus);
-}
-
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.h
deleted file mode 100644
index 0d52f1a896..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_um_segment.h
-* \brief This file defines the prototypes of the functions dealing with the segmentation of PDCP SDUs.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-/** @defgroup _rlc_um_segment_impl_ RLC UM Segmentation Implementation
-* @ingroup _rlc_um_impl_
-* @{
-*/
-# ifndef __RLC_UM_SEGMENT_PROTO_EXTERN_H__
-# define __RLC_UM_SEGMENT_PROTO_EXTERN_H__
-//-----------------------------------------------------------------------------
-# include "rlc_um_entity.h"
-# include "rlc_um_structs.h"
-# include "rlc_um_constants.h"
-# include "list.h"
-//-----------------------------------------------------------------------------
-/*! \fn void rlc_um_segment_10 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)
-* \brief Segmentation procedure with 10 bits sequence number, segment the first SDU in buffer and create a PDU of the size (nb_bytes_to_transmit) requested by MAC if possible and put it in the list "pdus_to_mac_layer".
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC UM protocol instance pointer.
-*/
-void rlc_um_segment_10 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP);
-
-
-/*! \fn void rlc_um_segment_5 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)
-* \brief Segmentation procedure with 5 bits sequence number, segment the first SDU in buffer and create a PDU of the size (nb_bytes_to_transmit) requested by MAC if possible and put it in the list "pdus_to_mac_layer".
-* \param[in] ctxtP Running context.
-* \param[in] rlcP RLC UM protocol instance pointer.
-*/
-void rlc_um_segment_5 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP);
-/** @} */
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_structs.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_structs.h
deleted file mode 100644
index 7ab9798a38..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_structs.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_um_structs.h
-* \brief This file defines structures used inside the RLC UM.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-# ifndef __RLC_UM_STRUCTS_H__
-# define __RLC_UM_STRUCTS_H__
-
-# include "platform_types.h"
-# include "list.h"
-# include "rlc_um_constants.h"
-# include "mac_primitives.h"
-# include "rlc_primitives.h"
-# include "mac_rlc_primitives.h"
-//-----------------------
-/**
-* @addtogroup _rlc_um_impl_
-* @{
-*/
-/*! \struct rlc_um_tx_sdu_management_t
-* \brief Structure containing SDU variables related to its segmentation and transmission.
-*/
-typedef struct rlc_um_tx_sdu_management {
- uint8_t *first_byte; /*!< \brief Pointer on SDU payload. */
- int32_t sdu_creation_time; /*!< \brief Time stamped with mac_xface->frame. */
- uint16_t sdu_remaining_size; /*!< \brief Remaining size in bytes to be filled in a PDU. */
- uint16_t sdu_test_remaining_size;
- uint16_t sdu_segmented_size; /*!< \brief Bytes already segmented in a/several PDU(s). */
- uint16_t sdu_size; /*!< \brief SDU size in bytes. */
-} rlc_um_tx_sdu_management_t;
-/** @} */
-
-/**
-* @addtogroup _rlc_um_segment_impl_
-* @{
-*/
-/*! \struct rlc_um_pdu_sn_5_t
-* \brief Structure helping coding and decoding the first byte of a UMD PDU.
-*/
-typedef struct rlc_um_pdu_sn_5 {
- uint8_t b1; /*!< \brief 1st byte. */
- uint8_t data[3]; /*!< \brief Following bytes. */
-} __attribute__((__packed__)) rlc_um_pdu_sn_5_t ;
-
-/*! \struct rlc_um_pdu_sn_10_t
-* \brief Structure helping coding and decoding the first 2 bytes of a UMD PDU.
-*/
-typedef struct rlc_um_pdu_sn_10 {
- uint8_t b1; /*!< \brief 1st byte. */
- uint8_t b2; /*!< \brief 2nd byte. */
- uint8_t data[2]; /*!< \brief Following bytes. */
-} __attribute__((__packed__)) rlc_um_pdu_sn_10_t ;
-
-
-/*! \struct rlc_am_e_li_t
-* \brief Structure helping coding and decoding LI and e bits in UMD PDUs.
-*/
-typedef struct rlc_um_e_li {
- uint8_t b1; /*!< \brief 1st byte. */
- uint8_t b2; /*!< \brief 2nd byte. */
- uint8_t b3; /*!< \brief 3rd byte. */
-} rlc_um_e_li_t;
-/** @} */
-/**
-* @addtogroup _rlc_um_segment_impl_
-* @{
-*/
-/*! \struct rlc_um_pdu_info_t
-* \brief Structure for storing decoded informations from the header of a UMD PDU.
-*/
-typedef struct rlc_um_pdu_info {
- uint16_t free_bits:3; /*!< \brief unused bits in bitfield. */
- uint16_t fi:2; /*!< \brief Framing Info field. */
- uint16_t e:1; /*!< \brief Extension bit field. */
- uint16_t sn:10; /*!< \brief Sequence Number field. */
- uint16_t num_li; /*!< \brief Number of Length Indicators. */
- int16_t li_list[RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU]; /*!< \brief List of Length Indicators. */
- int16_t hidden_size; /*!< \brief Part of payload size in bytes that is not included in the sum of LI fields. */;
- uint8_t* payload; /*!< \brief Pointer on PDU payload. */
- int16_t payload_size;/*!< \brief Size of payload in bytes. */
- int16_t header_size; /*!< \brief Size of header in bytes (including SO field and LI fields). */
-} rlc_um_pdu_info_t ;
-/** @} */
-
-
-struct rlc_um_data_req_alloc { // alloc enought bytes for sdu mngt also
- union {
- struct rlc_um_data_req dummy1;
- struct rlc_um_tx_sdu_management dummy2;
- } dummy;
-};
-
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c
deleted file mode 100644
index cf77f9ec37..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c
+++ /dev/null
@@ -1,1331 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_UM_MODULE
-#define RLC_C
-#define RLC_UM_TEST_C
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-//#include
-
-#include "platform_types.h"
-//-----------------------------------------------------------------------------
-#include "rlc.h"
-#include "rlc_um.h"
-#include "list.h"
-#include "rlc_um_control_primitives.h"
-#include "LAYER2/MAC/extern.h"
-
-
-#define TEST1
-#define TEST2
-#define TEST3
-#define TEST4
-#define TEST5
-
-#define INCREMENT_FRAME_YES 1
-#define INCREMENT_FRAME_NO 0
-
-#define TEST_MAX_SEND_SDU 8192
-#define TARGET_MAX_RX_ERROR_RATE 10
-#define TARGET_MAX_TX_ERROR_RATE 10
-static int g_frame = 0;
-static int g_error_on_phy = 0;
-static int g_random_sdu;
-static int g_random_nb_frames;
-
-static int g_random_tx_pdu_size;
-static int g_random_rx_pdu_size;
-
-static int g_target_tx_error_rate;
-static int g_target_rx_error_rate;
-
-static int g_tx_packets = 0;
-static int g_dropped_tx_packets = 0;
-static int g_rx_packets = 0;
-static int g_dropped_rx_packets = 0;
-static int g_drop_rx = 0;
-static int g_drop_tx = 0;
-
-static int g_send_sdu_ids[TEST_MAX_SEND_SDU][2];
-static int g_send_id_write_index[2];
-static int g_send_id_read_index[2];
-
-// time in frame numbers
-#define MAX_TIME_DELAYED_PDU_DUE_TO_HARQ 256
-static struct mac_data_ind g_tx_delayed_indications[MAX_TIME_DELAYED_PDU_DUE_TO_HARQ];
-static struct mac_data_ind g_rx_delayed_indications[MAX_TIME_DELAYED_PDU_DUE_TO_HARQ];
-
-static rlc_um_entity_t um_tx;
-static rlc_um_entity_t um_rx;
-
-static int8_t *g_sdus[] = {"En dépit de son volontarisme affiché, le premier ministre est de plus en plus décrié pour son incompétence. La tension politique et dans l'opinion publique est encore montée d'un cran au Japon, sur fond d'inquiétantes nouvelles, avec du plutonium détecté dans le sol autour de la centrale de Fukushima. Le premier ministre Naoto Kan a solennellement déclaré que son gouvernement était «en état d'alerte maximum». Tout en reconnaissant que la situation restait «imprévisible». Ce volontarisme affiché par le premier ministre - que Nicolas Sarkozy rencontrera demain lors d'une visite au Japon - ne l'a pas empêché d'être la cible de violentes critiques de la part de parlementaires sur sa gestion de la crise. Attaqué sur le manque de transparence, il a assuré qu'il rendait publiques toutes les informations en sa possession. Un député de l'opposition, Yosuke Isozaki, a aussi reproché à Naoto Kan de ne pas avoir ordonné l'évacuation des populations dans la zone comprise entre 20 et 30 km autour de la centrale. «Peut-il y avoir quelque chose de plus irresponsable que cela ?», a-t-il lancé. Pour l'heure, la zone d'évacuation est limitée à un rayon de 20 km, seul le confinement étant recommandé pour les 10 km suivants. Sur ce sujet, les autorités japonaises ont été fragilisées mardi par les déclarations de Greenpeace, affirmant que ses experts avaient détecté une radioactivité dangereuse à 40 km de la centrale. L'organisation écologiste a appelé à une extension de la zone d'évacuation, exhortant Tokyo à «cesser de privilégier la politique aux dépens de la science». L'Agence japonaise de sûreté nucléaire a balayé ces critiques.",
-
- "La pâquerette (Bellis perennis) est une plante vivace des prés, des pelouses, des bords de chemins et des prairies, haute de dix à vingt centimètres, de la famille des Astéracées, dont les fleurs naissent sur des inflorescences appelées capitules : celles du pourtour, que l'on croit à tort être des pétales, appelées fleurs ligulées, parce qu'elles ont la forme d'une languette, ou demi-fleurons, sont des fleurs femelles, dont la couleur varie du blanc au rose plus ou moins prononcé ; celles du centre, jaunes, appelées fleurs tubuleuses, parce que leur corolle forme un tube, ou fleurons, sont hermaphrodites. Ainsi, contrairement à l'opinion populaire, ce qu'on appelle une « fleur » de pâquerette n'est en réalité pas « une » fleur mais un capitule portant des fleurs très nombreuses.Leurs fruits s'envolent grâce au vent et dégagent des odeurs qui attirent les insectes.Une variété muricole peut pousser sur des murs humides verticaux.Les pâquerettes sont des fleurs rustiques et très communes en Europe, sur les gazons, les prairies, les chemins et les zones d'herbe rase.Elles ont la particularité, comme certaines autres fleurs de plantes herbacées, de se fermer la nuit et de s'ouvrir le matin pour s'épanouir au soleil ; elles peuvent aussi se fermer pendant les averses, voire un peu avant, ce qui permet dans les campagnes de prédire la pluie légèrement à l'avance.",
-
- "La pâquerette",
- " (Bellis perennis)",
- " est une plante vivace des prés,",
- " des pelouses,",
- " des bords de chemins et des prairies,",
- "haute de dix à",
- " vingt centimètres",
- ", de la",
- " famille des",
- " Astéracées",
- ", dont",
- " les",
- " fleurs",
- " naissent",
- " sur",
- " des",
- " inflorescences",
- " appelées",
- " capitules",
- " : celles",
- " du pourtour",
- ", que l'on",
- " croit à",
- " tort",
- " être",
- " des pétales",
- ", appelées",
- " fleurs ligulées",
- ", parce qu'elles",
- " ont la forme d'une languette, ou demi-fleurons, sont",
- " des fleurs femelles,",
- " dont la couleur varie du blanc au rose plus ou moins prononcé ; celles du centre, jaunes,",
- " appelées ",
- "fleurs tubuleuses",
- ", parce que leur corolle forme un tube, ou fleurons, sont hermaphrodites."
- };
-
-#define RLC_2_PRINT_BUFFER_LEN 10000
-static char rlc_2_print_buffer[RLC_2_PRINT_BUFFER_LEN];
-//-----------------------------------------------------------------------------
-void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, unsigned long sizeP)
-//-----------------------------------------------------------------------------
-{
- unsigned long octet_index = 0;
- unsigned long buffer_marker = 0;
- unsigned char aindex;
-
- if (dataP == NULL) {
- return;
- }
-
- LOG_D(RLC, "------+-------------------------------------------------|\n");
- LOG_D(RLC, " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- LOG_D(RLC, "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < sizeP; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- buffer_marker+=snprintf(&rlc_2_print_buffer[buffer_marker], RLC_2_PRINT_BUFFER_LEN - buffer_marker, " |\n");
- LOG_D(RLC, "%s", rlc_2_print_buffer);
- buffer_marker = 0;
- }
-
- buffer_marker+=snprintf(&rlc_2_print_buffer[buffer_marker], RLC_2_PRINT_BUFFER_LEN - buffer_marker,
- " %04lu |", octet_index);
- }
-
- /*
- * Print every single octet in hexadecimal form
- */
- buffer_marker+=snprintf(&rlc_2_print_buffer[buffer_marker], RLC_2_PRINT_BUFFER_LEN - buffer_marker, " %02x", dataP[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
-
- /*
- * Append enough spaces and put final pipe
- */
- for (aindex = octet_index; aindex < 16; ++aindex) {
- buffer_marker+=snprintf(&rlc_2_print_buffer[buffer_marker], RLC_2_PRINT_BUFFER_LEN - buffer_marker, " ");
- }
-
- // LOG_D(RLC, " ");
- buffer_marker+=snprintf(&rlc_2_print_buffer[buffer_marker], RLC_2_PRINT_BUFFER_LEN - buffer_marker, " |\n");
- LOG_D(RLC, "%s",rlc_2_print_buffer);
-}
-
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_windows_10()
-//-----------------------------------------------------------------------------
-{
- rlc_um_entity_t um1;
- rlc_um_entity_t um2;
- unsigned int h,w, sn, result;
- uint32_t timer_reordering = 2000;
- uint32_t sn_field_length = 10;
- uint32_t is_mXch = 0; // boolean, true if configured for MTCH or MCCH
- rlc_um_init(&um1);
- rlc_um_init(&um2);
- rlc_um_set_debug_infos(&um1, g_frame, 0, 0, 0, 1, 1 /*LC-id = RAB-id*/);
- rlc_um_set_debug_infos(&um2, g_frame, 1, 1, 1, 1, 1 /*LC-id = RAB-id*/);
- rlc_um_configure(&um1, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch);
- rlc_um_configure(&um2, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch);
-
- // RX window with vr_uh > vr_ur
- for (h = 0; h < RLC_UM_SN_10_BITS_MODULO; h++) {
- um1.vr_uh = h;
-
- for (w = 1; w < RLC_UM_WINDOW_SIZE_SN_10_BITS; w++) {
- um1.vr_ur = (um1.vr_uh - w) & RLC_UM_SN_10_BITS_MASK;
-
- for (sn = ((um1.vr_uh - um1.rx_um_window_size) & RLC_UM_SN_10_BITS_MASK) ; sn != um1.vr_uh; sn = ((sn+1) & RLC_UM_SN_10_BITS_MASK)) {
- assert(rlc_um_in_reordering_window(&um1, g_frame, sn) >= 0);
- // returns -2 if lower_bound > sn
- // returns -1 if higher_bound < sn
- // returns 0 if lower_bound < sn < higher_bound
- // returns 1 if lower_bound == sn
- // returns 2 if higher_bound == sn
- // returns 3 if higher_bound == sn == lower_bound
- result = rlc_um_in_window(&um1, g_frame, (um1.vr_uh - um1.rx_um_window_size) & RLC_UM_SN_10_BITS_MASK, sn, um1.vr_uh);
- assert((result < 2) && (result >=0));
- }
-
- for (sn = um1.vr_uh ; sn != ((um1.vr_uh - um1.rx_um_window_size) & RLC_UM_SN_10_BITS_MASK) ; sn = ((sn+1) & RLC_UM_SN_10_BITS_MASK)) {
- // returns -2 if lower_bound > sn
- // returns -1 if higher_bound < sn
- // returns 0 if lower_bound < sn < higher_bound
- // returns 1 if lower_bound == sn
- // returns 2 if higher_bound == sn
- // returns 3 if higher_bound == sn == lower_bound
- assert(rlc_um_in_window(&um1, g_frame, (um1.vr_uh - um1.rx_um_window_size) & RLC_UM_SN_10_BITS_MASK, sn, (um1.vr_uh -1) & RLC_UM_SN_10_BITS_MASK) < 0);
- assert(rlc_um_in_reordering_window(&um1, g_frame, sn) < 0);
- }
- }
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_windows_5()
-//-----------------------------------------------------------------------------
-{
- rlc_um_entity_t um1;
- rlc_um_entity_t um2;
- unsigned int h,w, sn, result;
- uint32_t timer_reordering = 2000;
- uint32_t sn_field_length = 5;
- uint32_t is_mXch = 0; // boolean, true if configured for MTCH or MCCH
- rlc_um_init(&um1);
- rlc_um_init(&um2);
- rlc_um_set_debug_infos(&um1, g_frame, 0, 0, 0, 1, 1 /* LC-id = DRB-id */);
- rlc_um_set_debug_infos(&um2, g_frame, 1, 1, 1, 1, 1 /* LC-id = DRB-id */);
- rlc_um_configure(&um1, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch);
- rlc_um_configure(&um2, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch);
-
- // RX window with vr_uh > vr_ur
- for (h = 0; h < RLC_UM_SN_5_BITS_MODULO; h++) {
- um1.vr_uh = h;
-
- for (w = 1; w < RLC_UM_WINDOW_SIZE_SN_5_BITS; w++) {
- um1.vr_ur = (um1.vr_uh - w) & RLC_UM_SN_5_BITS_MASK;
-
- for (sn = ((um1.vr_uh - um1.rx_um_window_size) & RLC_UM_SN_5_BITS_MASK) ; sn != um1.vr_uh; sn = ((sn+1) & RLC_UM_SN_5_BITS_MASK)) {
- assert(rlc_um_in_reordering_window(&um1, g_frame, sn) >= 0);
- // returns -2 if lower_bound > sn
- // returns -1 if higher_bound < sn
- // returns 0 if lower_bound < sn < higher_bound
- // returns 1 if lower_bound == sn
- // returns 2 if higher_bound == sn
- // returns 3 if higher_bound == sn == lower_bound
- result = rlc_um_in_window(&um1, g_frame, (um1.vr_uh - um1.rx_um_window_size) & RLC_UM_SN_5_BITS_MASK, sn, um1.vr_uh);
- assert((result < 2) && (result >=0));
- }
-
- for (sn = um1.vr_uh ; sn != ((um1.vr_uh - um1.rx_um_window_size) & RLC_UM_SN_5_BITS_MASK) ; sn = ((sn+1) & RLC_UM_SN_5_BITS_MASK)) {
- // returns -2 if lower_bound > sn
- // returns -1 if higher_bound < sn
- // returns 0 if lower_bound < sn < higher_bound
- // returns 1 if lower_bound == sn
- // returns 2 if higher_bound == sn
- // returns 3 if higher_bound == sn == lower_bound
- assert(rlc_um_in_window(&um1, g_frame, (um1.vr_uh - um1.rx_um_window_size) & RLC_UM_SN_5_BITS_MASK, sn, (um1.vr_uh -1) & RLC_UM_SN_5_BITS_MASK) < 0);
- assert(rlc_um_in_reordering_window(&um1, g_frame, sn) < 0);
- }
- }
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_reset_sdus()
-//-----------------------------------------------------------------------------
-{
- int i, j;
-
- for (j = 0; j < 2; j++) {
- for (i = 0; i < TEST_MAX_SEND_SDU; i++) {
- g_send_sdu_ids[i][j]= -1;
- }
-
- g_send_id_write_index[j] = 0;
- g_send_id_read_index[j] = 0;
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_send_sdu(rlc_um_entity_t *um_txP, int sdu_indexP)
-//-----------------------------------------------------------------------------
-{
- mem_block_t *sdu;
- sdu = get_free_mem_block (strlen(g_sdus[sdu_indexP]) + 1 + sizeof (struct rlc_um_data_req_alloc), __func__);
-
- if (sdu != NULL) {
- // PROCESS OF COMPRESSION HERE:
- printf("[FRAME %05d][RLC][MOD %02d][RB %02d] TX SDU %d %04d bytes\n",g_frame,um_txP->module_id, um_txP->rb_id, sdu_indexP, strlen(g_sdus[sdu_indexP]) + 1);
- memset (sdu->data, 0, sizeof (struct rlc_um_data_req_alloc));
- strcpy (&sdu->data[sizeof (struct rlc_um_data_req_alloc)],g_sdus[sdu_indexP]);
- ((struct rlc_um_data_req *) (sdu->data))->data_size = strlen(g_sdus[sdu_indexP])+ 1;
- ((struct rlc_um_data_req *) (sdu->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
- rlc_um_data_req(um_txP, g_frame, sdu);
- g_send_sdu_ids[g_send_id_write_index[um_txP->rb_id]++][um_txP->rb_id] = sdu_indexP;
- assert(g_send_id_write_index[um_txP->rb_id] < TEST_MAX_SEND_SDU);
- } else {
- printf("Out of memory error\n");
- // exit(-1);
- }
-}
-
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_buffer_delayed_rx_mac_data_ind(struct mac_data_ind *data_indP, signed int time_delayedP)
-//-----------------------------------------------------------------------------
-{
- int frame_modulo;
- mem_block_t *tb;
-
- if (time_delayedP <= 0) {
- frame_modulo = g_frame % MAX_TIME_DELAYED_PDU_DUE_TO_HARQ;
- } else {
- frame_modulo = (g_frame + time_delayedP) % MAX_TIME_DELAYED_PDU_DUE_TO_HARQ;
- }
-
- while (data_indP->data.nb_elements > 0) {
- tb = list_remove_head (&data_indP->data);
-
- if (tb != NULL) {
- if (time_delayedP < 0) {
- list_add_head(tb, &g_rx_delayed_indications[frame_modulo].data);
- } else {
- list_add_tail_eurecom(tb, &g_rx_delayed_indications[frame_modulo].data);
- }
-
- g_rx_delayed_indications[frame_modulo].no_tb += 1;
- }
- }
-
- assert(data_indP->data.head == NULL);
-}
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_buffer_delayed_tx_mac_data_ind(struct mac_data_ind *data_indP, signed int time_delayedP)
-//-----------------------------------------------------------------------------
-{
- int frame_modulo;
- mem_block_t *tb;
-
- if (time_delayedP <= 0) {
- frame_modulo = g_frame % MAX_TIME_DELAYED_PDU_DUE_TO_HARQ;
- } else {
- frame_modulo = (g_frame + time_delayedP) % MAX_TIME_DELAYED_PDU_DUE_TO_HARQ;
- }
-
- while (data_indP->data.nb_elements > 0) {
- tb = list_remove_head (&data_indP->data);
-
- if (tb != NULL) {
- if (time_delayedP < 0) {
- list_add_head(tb, &g_rx_delayed_indications[frame_modulo].data);
- } else {
- list_add_tail_eurecom(tb, &g_rx_delayed_indications[frame_modulo].data);
- }
-
- g_rx_delayed_indications[frame_modulo].no_tb += 1;
- }
- }
-
- assert(data_indP->data.head == NULL);
-}
-
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int *drop_countP, int *tx_packetsP,
- int *dropped_tx_packetsP)
-//-----------------------------------------------------------------------------
-{
- mem_block_t *tb_src;
- mem_block_t *tb_dst;
- unsigned int tb_size;
- data_indP->no_tb = 0;
-
- while (data_requestP->data.nb_elements > 0) {
- tb_src = list_remove_head (&data_requestP->data);
-
- if (tb_src != NULL) {
- tb_size = ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits >> 3;
- printf("[RLC-LOOP] FOUND TB SIZE IN BITS %d IN BYTES %u sizeof (mac_rlc_max_rx_header_size_t) %d\n",
- ((struct mac_tb_req *) (tb_src->data))->tb_size_in_bits,
- tb_size, sizeof (mac_rlc_max_rx_header_size_t));
- *tx_packetsP = *tx_packetsP + 1;
-
- if (*drop_countP == 0) {
- tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size, __func__);
-
- if (tb_dst != NULL) {
- memset(tb_dst->data, 0, sizeof (mac_rlc_max_rx_header_size_t) + tb_size);
- //printf("[RLC-LOOP] Testing tb_dst (1)\n");
- check_free_mem_block(tb_dst, __func__);
- tb_dst->next = NULL;
- ((struct mac_tb_ind *) (tb_dst->data))->first_bit = 0;
- ((struct mac_tb_ind *) (tb_dst->data))->data_ptr = &tb_dst->data[sizeof (mac_rlc_max_rx_header_size_t)];
- ((struct mac_tb_ind *) (tb_dst->data))->size = tb_size;
- ((struct mac_tb_ind *) (tb_dst->data))->error_indication = 0;
- memcpy(((struct mac_tb_ind *) (tb_dst->data))->data_ptr,
- &((struct mac_tb_req *) (tb_src->data))->data_ptr[0],
- tb_size);
- list_add_tail_eurecom(tb_dst, &data_indP->data);
- data_indP->no_tb += 1;
- //printf("[RLC-LOOP] Testing tb_dst (2)\n");
- check_free_mem_block(tb_dst, __func__);
- } else {
- printf("Out of memory error\n");
- // exit(-1);
- }
- } else {
- printf("[RLC-LOOP] DROPPING 1 TB\n");
- *drop_countP = *drop_countP - 1;
- *dropped_tx_packetsP = *dropped_tx_packetsP + 1;
- }
-
- //printf("[RLC-LOOP] Testing tb_src\n");
- check_free_mem_block(tb_src, __func__);
- free_mem_block(tb_src, __func__);
-
- if (data_indP->no_tb > 0) {
- printf("[RLC-LOOP] Exchange %d TBs\n",data_indP->no_tb);
- }
- }
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_exchange_pdus(rlc_um_entity_t *um_txP,
- rlc_um_entity_t *um_rxP,
- uint16_t bytes_txP,
- uint16_t bytes_rxP)
-//-----------------------------------------------------------------------------
-{
- struct mac_data_req data_request_tx;
- struct mac_data_req data_request_rx;
- struct mac_data_ind data_ind_tx;
- struct mac_data_ind data_ind_rx;
- struct mac_status_ind tx_status;
- struct mac_status_resp mac_rlc_status_resp_tx;
- struct mac_status_resp mac_rlc_status_resp_rx;
- memset(&data_request_tx, 0, sizeof(struct mac_data_req));
- memset(&data_request_rx, 0, sizeof(struct mac_data_req));
- memset(&data_ind_tx, 0, sizeof(struct mac_data_ind));
- memset(&data_ind_rx, 0, sizeof(struct mac_data_ind));
- memset(&tx_status, 0, sizeof(struct mac_status_ind));
- memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp));
- memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp));
- mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status,ENB_FLAG_YES);
- data_request_tx = rlc_um_mac_data_request(um_txP, g_frame);
- mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status,ENB_FLAG_YES);
- data_request_rx = rlc_um_mac_data_request(um_rxP, g_frame);
- rlc_um_v9_3_0_test_mac_rlc_loop(&data_ind_rx, &data_request_tx, &g_drop_tx, &g_tx_packets, &g_dropped_tx_packets);
- rlc_um_v9_3_0_test_mac_rlc_loop(&data_ind_tx, &data_request_rx, &g_drop_rx, &g_rx_packets, &g_dropped_rx_packets);
- rlc_um_mac_data_indication(um_rxP, g_frame, um_rxP->is_enb, data_ind_rx);
- rlc_um_mac_data_indication(um_txP, g_frame, um_txP->is_enb, data_ind_tx);
- g_frame += 1;
- //check_mem_area();
- //display_mem_load();
-}
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_exchange_delayed_pdus(rlc_um_entity_t *um_txP,
- rlc_um_entity_t *um_rxP,
- uint16_t bytes_txP,
- uint16_t bytes_rxP,
- signed int time_tx_delayedP, // if -1 added to the head of current frame tx mac data ind if any
- // if 0 added to the tail of current frame tx mac data ind if any
- // if > 0 added to the tail of frame+time_tx_delayedP mac data ind if any
- signed int time_rx_delayedP, // if -1 added to the head of current frame rx mac data ind if any
- // if 0 added to the tail of current frame rx mac data ind if any
- // if > 0 added to the tail of frame+time_rx_delayedP mac data ind if any
- int is_frame_incrementedP)
-//-----------------------------------------------------------------------------
-{
- struct mac_data_req data_request_tx;
- struct mac_data_req data_request_rx;
- struct mac_data_ind data_ind_tx;
- struct mac_data_ind data_ind_rx;
- struct mac_status_ind tx_status;
- struct mac_status_resp mac_rlc_status_resp_tx;
- struct mac_status_resp mac_rlc_status_resp_rx;
- int frame_modulo = g_frame % MAX_TIME_DELAYED_PDU_DUE_TO_HARQ;
- memset(&data_request_tx, 0, sizeof(struct mac_data_req));
- memset(&data_request_rx, 0, sizeof(struct mac_data_req));
- memset(&data_ind_tx, 0, sizeof(struct mac_data_ind));
- memset(&data_ind_rx, 0, sizeof(struct mac_data_ind));
- memset(&tx_status, 0, sizeof(struct mac_status_ind));
- memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp));
- memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp));
- mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status,ENB_FLAG_YES);
- data_request_tx = rlc_um_mac_data_request(um_txP, g_frame);
- mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status,ENB_FLAG_YES);
- data_request_rx = rlc_um_mac_data_request(um_rxP, g_frame);
- rlc_um_v9_3_0_test_mac_rlc_loop(&data_ind_rx, &data_request_tx, &g_drop_tx, &g_tx_packets, &g_dropped_tx_packets);
- rlc_um_v9_3_0_test_mac_rlc_loop(&data_ind_tx, &data_request_rx, &g_drop_rx, &g_rx_packets, &g_dropped_rx_packets);
- rlc_um_v9_3_0_buffer_delayed_rx_mac_data_ind(&data_ind_rx, time_tx_delayedP);
- rlc_um_v9_3_0_buffer_delayed_tx_mac_data_ind(&data_ind_tx, time_rx_delayedP);
- rlc_um_mac_data_indication(um_rxP, g_frame, um_rxP->is_enb, g_rx_delayed_indications[frame_modulo]);
- memset(&g_rx_delayed_indications[frame_modulo], 0, sizeof(struct mac_data_ind));
- rlc_um_mac_data_indication(um_txP, g_frame, um_txP->is_enb, g_tx_delayed_indications[frame_modulo]);
- memset(&g_tx_delayed_indications[frame_modulo], 0, sizeof(struct mac_data_ind));
-
- if (is_frame_incrementedP) {
- g_frame += 1;
- }
-}
-
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_data_conf(module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP)
-//-----------------------------------------------------------------------------
-{
- if (statusP == RLC_SDU_CONFIRM_YES) {
- printf("[FRAME %05d][RLC][MOD %02d][RB %02d] CONFIRM SEND SDU MUI %05d\n",g_frame,module_idP, rb_idP, muiP);
- } else {
- printf("[FRAME %05d][RLC][MOD %02d][RB %02d] CONFIRM LOST SDU MUI %05d\n",g_frame,module_idP, rb_idP, muiP);
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_size_t sizeP, mem_block_t *sduP)
-//-----------------------------------------------------------------------------
-{
- int i;
-
- if (g_error_on_phy == 0) {
- for (i = 0; i < 37; i++) {
- if (strcmp(g_sdus[i], sduP->data) == 0) {
- printf("[FRAME %05d][RLC][MOD %02d][RB %02d] RX SDU %d %04d bytes\n",g_frame,module_idP, rb_idP, i, sizeP);
- assert(TEST_MAX_SEND_SDU > g_send_id_read_index[rb_idP]);
- assert(g_send_id_write_index[rb_idP^1] > g_send_id_read_index[rb_idP]);
-
- if (g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1] != i) {
- printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP]-2,
- g_send_sdu_ids[g_send_id_read_index[rb_idP]-2][rb_idP^1]);
- printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP]-1,
- g_send_sdu_ids[g_send_id_read_index[rb_idP]-1][rb_idP^1]);
- printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_sdu_ids[%d] = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP],
- g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1]);
- printf("[FRAME %05d][RLC][MOD %d][RB %d][DATA-IND] g_send_id_read_index = %d sdu sent = %d\n",g_frame,module_idP, rb_idP, g_send_id_read_index[rb_idP], i);
- }
-
- assert(g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1] == i);
- g_send_id_read_index[rb_idP] += 1;
- free_mem_block(sduP, __func__);
- return;
- }
- }
-
- printf("[FRAME %05d][RLC][MOD %d][RB %d] RX UNKNOWN SDU %04d bytes\n",g_frame,module_idP, rb_idP, sizeP);
- free_mem_block(sduP, __func__);
- assert(1==2);
- } else {
- for (i = 0; i < 37; i++) {
- if (strcmp(g_sdus[i], sduP->data) == 0) {
- printf("[FRAME %05d][RLC][MOD %02d][RB %02d] RX SDU %d %04d bytes\n",g_frame,module_idP, rb_idP, i, sizeP);
- assert(TEST_MAX_SEND_SDU > g_send_id_read_index[rb_idP]);
- g_send_id_read_index[rb_idP] += 1;
- free_mem_block(sduP, __func__);
- return;
- }
- }
-
- printf("[FRAME %05d][RLC][MOD %d][RB %d] RX UNKNOWN SDU %04d bytes\n",g_frame,module_idP, rb_idP, sizeP);
- free_mem_block(sduP, __func__);
- return;
- }
-}
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_reordering(uint32_t sn_field_lengthP)
-//-----------------------------------------------------------------------------
-{
- rlc_um_info_t um_info;
- int i,j,r;
- um_info.timer_reordering = (32 * sn_field_lengthP * sn_field_lengthP)/100;
- um_info.sn_field_length = sn_field_lengthP;
- um_info.is_mXch = 0;
- srand (0);
- config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
- config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
- rlc_um_display_rx_window(&um_tx);
- rlc_um_display_rx_window(&um_rx);
- srand (0);
- // BIG SDU SMALL PDUS NO ERRORS
- rlc_um_v9_3_0_test_reset_sdus();
-
- for (i = 0; i < 128; i++) {
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, um_info.timer_reordering - 5, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 4, 200, 7, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 5, 200, 5, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 6, 200, 3, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 7, 200, 1, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 8, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 9, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 10, 200, 7, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 11, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 12, 200, 5, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 13, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 14, 200, 3, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 15, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 16, 200, 1, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 17, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 18, 200, 3, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 19, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 20, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 21, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 22, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 23, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 24, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 25, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 26, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 27, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 28, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 29, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n\n\n");
- }
-
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test_reordering 3: END OF TEST BIG SDU, SMALL PDUs\n\n\n\n");
- rlc_um_v9_3_0_test_reset_sdus();
-
- for (j = 0; j < 16; j++) {
- //i = getchar();
- rlc_um_v9_3_0_test_reset_sdus();
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
-
- for (i = 0; i < 32; i++) {
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, 0, 0, INCREMENT_FRAME_YES);
- }
-
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, 0, 0, INCREMENT_FRAME_YES);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, um_info.timer_reordering + 5, 0, INCREMENT_FRAME_YES);
-
- for (i = 0; i < 600; i++) {
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, 0, 0, INCREMENT_FRAME_YES);
- }
-
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
- printf("g_send_id_read_index[1]=%d g_send_id_write_index[0]=%d Loop %d (1)\n", g_send_id_read_index[1], g_send_id_write_index[0], j);
- assert (g_send_id_read_index[1] != g_send_id_write_index[0]);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, 0, 0, INCREMENT_FRAME_YES);
-
- for (i = 0; i < 600; i++) {
- if ((i % 32) == 0) {
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, um_info.timer_reordering + 5, 0, INCREMENT_FRAME_YES);
- } else {
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 3, 200, 0, 0, INCREMENT_FRAME_YES);
- }
- }
-
- rlc_um_v9_3_0_test_exchange_delayed_pdus(&um_tx, &um_rx, 2000, 200, 0, 0, INCREMENT_FRAME_YES);
- printf("g_send_id_read_index[1]=%d g_send_id_write_index[0]=%d Loop %d (2)\n", g_send_id_read_index[1], g_send_id_write_index[0], j);
- assert (g_send_id_read_index[1] != g_send_id_write_index[0]);
- }
-
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test_reordering 4: END OF TEST BIG SDU, SMALL PDUs\n\n\n\n");
-}
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_tx_rx_10(void)
-//-----------------------------------------------------------------------------
-{
- rlc_um_info_t um_info;
- int i,j,r;
- um_info.timer_reordering = 32;
- um_info.sn_field_length = 10;
- um_info.is_mXch = 0;
- srand (0);
- config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
- config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
- rlc_um_display_rx_window(&um_tx);
- rlc_um_display_rx_window(&um_rx);
-#ifdef TEST1
- srand (0);
- rlc_um_v9_3_0_test_reset_sdus();
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 3);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 4);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 5);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 6);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 1: END OF SIMPLE TEST SEVERAL SDUs IN PDU\n\n\n\n");
- sleep(2);
- rlc_um_v9_3_0_test_reset_sdus();
-
- // RANDOM TESTS
- for (i = g_send_id_write_index[0]; g_send_id_write_index[0] < TEST_MAX_SEND_SDU-12; i++) {
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 3);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 4);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 5);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 6);
-
- for (i = 0; i < 50; i++) {
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 200, 200);
- }
-
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- }
-
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 1: END OF TEST SEVERAL SDUs IN PDU\n\n\n\n");
- sleep(2);
-#endif
-#ifdef TEST2
- srand (0);
- rlc_um_v9_3_0_test_reset_sdus();
- // BIG SDU SMALL PDUS NO ERRORS
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 3, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 3, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 3, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 4, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 5, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 6, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 7, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 9, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 10, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 11, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 12, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 13, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 14, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 15, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 16, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 17, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 18, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 19, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 20, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 21, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 22, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 23, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 24, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 25, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 26, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 27, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 28, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 29, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 30, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 31, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 32, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 33, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 34, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 35, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 36, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 37, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 38, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 39, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 40, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 41, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 42, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 43, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 44, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 45, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 46, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 47, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 48, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 49, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 50, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 51, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 52, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 53, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 54, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 55, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 56, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 57, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 58, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 59, 200);
-
- //rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 60, 200); if uncomment: error because too many segments of SDU
- for (i = 0; i < 24; i++) {
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
- }
-
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 2: END OF TEST BIG SDU SMALL PDUs\n\n\n\n");
-#endif
-
- for (r = 0; r < 32; r++) {
- //for (r = 0; r < 1024; r++) {
- srand (r);
-#ifdef TEST3
- g_error_on_phy = 0;
- g_tx_packets = 0;
- g_rx_packets = 0;
- rlc_um_v9_3_0_test_reset_sdus();
-
- // RANDOM TESTS
- for (i = g_send_id_write_index[0]; g_send_id_write_index[0] < TEST_MAX_SEND_SDU-1; i++) {
- printf("UM.TX SDU %d\n", um_tx.nb_sdu);
-
- if (um_tx.nb_sdu < (um_tx.size_input_sdus_buffer - 2)) {
- g_random_sdu = rand() % 37;
- rlc_um_v9_3_0_test_send_sdu(&um_tx, g_random_sdu);
- }
-
- g_random_nb_frames = (rand() % 10) + 1;
-
- //g_random_nb_frames = 1;
- for (j = 0; j < g_random_nb_frames; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
- }
-
- for (j = 0; j < 400; j++) {
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 500, 500);
- }
-
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 3: END OF TEST RANDOM (SEED=%d ) TX ONLY :\n\n\n\n",
- r);
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
-#endif
-#ifdef TEST4
- g_error_on_phy = 0;
- g_tx_packets = 0;
- g_rx_packets = 0;
- rlc_um_v9_3_0_test_reset_sdus();
-
- for (i = g_send_id_write_index[0]; g_send_id_write_index[0] < TEST_MAX_SEND_SDU-1; i++) {
- if (um_tx.nb_sdu < (um_rx.size_input_sdus_buffer - 2)) {
- g_random_sdu = rand() % 37;
- rlc_um_v9_3_0_test_send_sdu(&um_tx, g_random_sdu);
-
- if (um_rx.nb_sdu < (um_rx.size_input_sdus_buffer - 2)) {
- g_random_sdu = rand() % 37;
- rlc_um_v9_3_0_test_send_sdu(&um_rx, g_random_sdu);
- } else {
- i = i-1;
- }
- } else {
- if (um_rx.nb_sdu < (um_rx.size_input_sdus_buffer - 2)) {
- g_random_sdu = rand() % 37;
- rlc_um_v9_3_0_test_send_sdu(&um_rx, g_random_sdu);
- } else {
- i = i-1;
- }
- }
-
- g_random_nb_frames = rand() % 4;
-
- for (j = 0; j < g_random_nb_frames; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
- }
-
- for (j = 0; j < 100; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
-
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 4: END OF TEST RANDOM (SEED=%d) TX RX:\n\n\n\n",r);
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- assert (g_send_id_read_index[0] == g_send_id_write_index[1]);
-#endif
- }
-
-#ifdef TEST5
- rlc_um_display_rx_window(&um_tx);
- rlc_um_display_rx_window(&um_rx);
-
- for (r = 0; r < 1024; r++) {
- srand (r);
- g_error_on_phy = 1;
-
- for (g_target_tx_error_rate = 0; g_target_tx_error_rate < TARGET_MAX_TX_ERROR_RATE; g_target_tx_error_rate++) {
- for (g_target_rx_error_rate = 0; g_target_rx_error_rate < TARGET_MAX_RX_ERROR_RATE; g_target_rx_error_rate++) {
- g_tx_packets = 0;
- g_dropped_tx_packets = 0;
- g_rx_packets = 0;
- g_dropped_rx_packets = 0;
- rlc_um_v9_3_0_test_reset_sdus();
-
- for (i = g_send_id_write_index[0]; g_send_id_write_index[0] < TEST_MAX_SEND_SDU-1; i++) {
- g_random_sdu = rand() % 37;
- rlc_um_v9_3_0_test_send_sdu(&um_tx, g_random_sdu);
- g_random_sdu = rand() % 37;
- //rlc_um_v9_3_0_test_send_sdu(&um_rx, g_random_sdu);
- g_random_nb_frames = rand() % 4;
-
- for (j = 0; j < g_random_nb_frames; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
-
- //rlc_um_display_rx_window(&um_tx);
- rlc_um_display_rx_window(&um_rx);
- int dropped = (rand() % 3);
-
- if ((dropped == 0) && (g_tx_packets > 0)) {
- if ((((g_dropped_tx_packets + 1)*100) / g_tx_packets) <= g_target_tx_error_rate) {
- g_drop_tx = 1;
- }
- }
-
- dropped = (rand() % 3);
-
- if ((dropped == 0) && (g_rx_packets > 0)) {
- if ((((g_dropped_rx_packets + 1)*100) / g_rx_packets) <= g_target_rx_error_rate) {
- g_drop_rx = 1;
- }
- }
- }
-
- for (j = 0; j < 100; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
-
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 5: END OF TEST RANDOM (SEED=%d BLER TX=%d BLER RX=%d ) TX RX WITH ERRORS ON PHY LAYER:\n\n\n\n",
- r, g_target_tx_error_rate, g_target_rx_error_rate);
- //assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- //assert (g_send_id_read_index[0] == g_send_id_write_index[1]);
- printf("REAL BLER TX=%d (TARGET=%d) BLER RX=%d (TARGET=%d) \n",
- (g_tx_packets >0)?(g_dropped_tx_packets*100)/g_tx_packets:0,
- g_target_tx_error_rate,
- (g_rx_packets >0)?(g_dropped_rx_packets*100)/g_rx_packets:0,
- g_target_rx_error_rate);
- }
- }
-
- g_drop_tx = 0;
- g_drop_rx = 0;
- g_tx_packets = 0;
- g_dropped_tx_packets = 0;
- g_rx_packets = 0;
- g_dropped_rx_packets = 0;
- rlc_um_v9_3_0_test_reset_sdus();
-
- for (j = 0; j < 100; j++) {
- rlc_um_v9_3_0_test_send_sdu(&um_rx, 1);
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
- }
-
- g_error_on_phy = 0;
-#endif
-}
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_tx_rx_5(void)
-//-----------------------------------------------------------------------------
-{
- rlc_um_info_t um_info;
- int i,j,r;
- um_info.timer_reordering = 32;
- um_info.sn_field_length = 5;
- um_info.is_mXch = 0;
- srand (0);
- config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
- config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/);
- rlc_um_display_rx_window(&um_tx);
- rlc_um_display_rx_window(&um_rx);
-#ifdef TEST1
- srand (0);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test_5 1: START OF SIMPLE TEST SEVERAL SDUs IN PDU\n\n\n\n");
- rlc_um_v9_3_0_test_reset_sdus();
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 3);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 4);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 5);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 6);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 1000, 200);
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test_5 1: END OF SIMPLE TEST SEVERAL SDUs IN PDU\n\n\n\n");
- sleep(2);
- rlc_um_v9_3_0_test_reset_sdus();
-
- // RANDOM TESTS
- for (i = g_send_id_write_index[0]; g_send_id_write_index[0] < TEST_MAX_SEND_SDU-12; i++) {
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 2);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 3);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 4);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 5);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 6);
-
- for (i = 0; i < 50; i++) {
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 400, 200);
- }
-
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- }
-
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 1: END OF TEST SEVERAL SDUs IN PDU\n\n\n\n");
- sleep(2);
-#endif
-#ifdef TEST2
- srand (0);
- rlc_um_v9_3_0_test_reset_sdus();
- // BIG SDU SMALL PDUS NO ERRORS
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 3, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 3, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 3, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 4, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 5, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 6, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 7, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 8, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 9, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 10, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 11, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 12, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 13, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 14, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 15, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 16, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 17, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 18, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 19, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 20, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 21, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 22, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 23, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 24, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 25, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
- rlc_um_v9_3_0_test_send_sdu(&um_tx, 1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 26, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 27, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 28, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 29, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 30, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 31, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 32, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 33, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 34, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 35, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 36, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 37, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 38, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 39, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 40, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 41, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 42, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 43, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 44, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 45, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 46, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 47, 200);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 48, 200);
-
- //rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 60, 200); if uncomment: error because too many segments of SDU
- for (i = 0; i < 24; i++) {
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 2000, 200);
- }
-
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 2: END OF TEST BIG SDU SMALL PDUs\n\n\n\n");
-#endif
-
- for (r = 0; r < 32; r++) {
- //for (r = 0; r < 1024; r++) {
- srand (r);
-#ifdef TEST3
- g_error_on_phy = 0;
- g_tx_packets = 0;
- g_rx_packets = 0;
- rlc_um_v9_3_0_test_reset_sdus();
-
- // RANDOM TESTS
- for (i = g_send_id_write_index[0]; g_send_id_write_index[0] < TEST_MAX_SEND_SDU-1; i++) {
- printf("UM.TX SDU %d\n", um_tx.nb_sdu);
-
- if (um_tx.nb_sdu < (um_tx.size_input_sdus_buffer - 2)) {
- g_random_sdu = rand() % 37;
- rlc_um_v9_3_0_test_send_sdu(&um_tx, g_random_sdu);
- }
-
- g_random_nb_frames = (rand() % 10) + 1;
-
- //g_random_nb_frames = 1;
- for (j = 0; j < g_random_nb_frames; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
- }
-
- for (j = 0; j < 400; j++) {
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, 500, 500);
- }
-
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 3: END OF TEST RANDOM (SEED=%d ) TX ONLY :\n\n\n\n",r);
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
-#endif
-#ifdef TEST4
- g_error_on_phy = 0;
- g_tx_packets = 0;
- g_rx_packets = 0;
- rlc_um_v9_3_0_test_reset_sdus();
-
- for (i = g_send_id_write_index[0]; g_send_id_write_index[0] < TEST_MAX_SEND_SDU-1; i++) {
- if (um_tx.nb_sdu < (um_rx.size_input_sdus_buffer - 2)) {
- g_random_sdu = rand() % 37;
- rlc_um_v9_3_0_test_send_sdu(&um_tx, g_random_sdu);
-
- if (um_rx.nb_sdu < (um_rx.size_input_sdus_buffer - 2)) {
- g_random_sdu = rand() % 37;
- rlc_um_v9_3_0_test_send_sdu(&um_rx, g_random_sdu);
- } else {
- i = i-1;
- }
- } else {
- if (um_rx.nb_sdu < (um_rx.size_input_sdus_buffer - 2)) {
- g_random_sdu = rand() % 37;
- rlc_um_v9_3_0_test_send_sdu(&um_rx, g_random_sdu);
- } else {
- i = i-1;
- }
- }
-
- g_random_nb_frames = rand() % 4;
-
- for (j = 0; j < g_random_nb_frames; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
- }
-
- for (j = 0; j < 100; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
-
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 4: END OF TEST RANDOM (SEED=%d) TX RX:\n\n\n\n",r);
- assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- assert (g_send_id_read_index[0] == g_send_id_write_index[1]);
-#endif
- }
-
-#ifdef TEST5
- rlc_um_display_rx_window(&um_tx);
- rlc_um_display_rx_window(&um_rx);
-
- for (r = 0; r < 1024; r++) {
- srand (r);
- g_error_on_phy = 1;
-
- for (g_target_tx_error_rate = 0; g_target_tx_error_rate < TARGET_MAX_TX_ERROR_RATE; g_target_tx_error_rate++) {
- for (g_target_rx_error_rate = 0; g_target_rx_error_rate < TARGET_MAX_RX_ERROR_RATE; g_target_rx_error_rate++) {
- g_tx_packets = 0;
- g_dropped_tx_packets = 0;
- g_rx_packets = 0;
- g_dropped_rx_packets = 0;
- rlc_um_v9_3_0_test_reset_sdus();
-
- for (i = g_send_id_write_index[0]; g_send_id_write_index[0] < TEST_MAX_SEND_SDU-1; i++) {
- g_random_sdu = rand() % 37;
- rlc_um_v9_3_0_test_send_sdu(&um_tx, g_random_sdu);
- g_random_sdu = rand() % 37;
- //rlc_um_v9_3_0_test_send_sdu(&um_rx, g_random_sdu);
- g_random_nb_frames = rand() % 4;
-
- for (j = 0; j < g_random_nb_frames; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
-
- //rlc_um_display_rx_window(&um_tx);
- rlc_um_display_rx_window(&um_rx);
- int dropped = (rand() % 3);
-
- if ((dropped == 0) && (g_tx_packets > 0)) {
- if ((((g_dropped_tx_packets + 1)*100) / g_tx_packets) <= g_target_tx_error_rate) {
- g_drop_tx = 1;
- }
- }
-
- dropped = (rand() % 3);
-
- if ((dropped == 0) && (g_rx_packets > 0)) {
- if ((((g_dropped_rx_packets + 1)*100) / g_rx_packets) <= g_target_rx_error_rate) {
- g_drop_rx = 1;
- }
- }
- }
-
- for (j = 0; j < 100; j++) {
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
-
- printf("\n\n\n\n\n\n-----------------------------------------------------------------------------------------rlc_um_v9_3_0_test 5: END OF TEST RANDOM (SEED=%d BLER TX=%d BLER RX=%d ) TX RX WITH ERRORS ON PHY LAYER:\n\n\n\n",
- r, g_target_tx_error_rate, g_target_rx_error_rate);
- //assert (g_send_id_read_index[1] == g_send_id_write_index[0]);
- //assert (g_send_id_read_index[0] == g_send_id_write_index[1]);
- printf("REAL BLER TX=%d (TARGET=%d) BLER RX=%d (TARGET=%d) \n",
- (g_tx_packets >0)?(g_dropped_tx_packets*100)/g_tx_packets:0,
- g_target_tx_error_rate,
- (g_rx_packets >0)?(g_dropped_rx_packets*100)/g_rx_packets:0,
- g_target_rx_error_rate);
- }
- }
-
- g_drop_tx = 0;
- g_drop_rx = 0;
- g_tx_packets = 0;
- g_dropped_tx_packets = 0;
- g_rx_packets = 0;
- g_dropped_rx_packets = 0;
- rlc_um_v9_3_0_test_reset_sdus();
-
- for (j = 0; j < 100; j++) {
- rlc_um_v9_3_0_test_send_sdu(&um_rx, 1);
- g_random_tx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- g_random_rx_pdu_size = (rand() % RLC_SDU_MAX_SIZE) / ((rand () % 4)+1);
- rlc_um_v9_3_0_test_exchange_pdus(&um_tx, &um_rx, g_random_tx_pdu_size, g_random_rx_pdu_size);
- }
- }
-
- g_error_on_phy = 0;
-#endif
-}
-
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test_print_trace (void)
-//-----------------------------------------------------------------------------
-{
- void *array[100];
- size_t size;
- char **strings;
- size_t i;
- size = backtrace (array, 100);
- strings = backtrace_symbols (array, size);
- printf ("Obtained %lu stack frames.\n", (unsigned long)size);
-
- for (i = 0; i < size; i++) {
- printf ("%s\n", strings[i]);
- }
-
- free (strings);
-}
-//-----------------------------------------------------------------------------
-void rlc_um_v9_3_0_test(void)
-//-----------------------------------------------------------------------------
-{
- pool_buffer_init();
- set_comp_log(RLC, LOG_TRACE, LOG_MED, 1);
- // tested OK
- rlc_um_v9_3_0_test_reordering(10);
- rlc_um_v9_3_0_test_tx_rx_10();
- // tested OK
- rlc_um_v9_3_0_test_windows_10();
- rlc_um_v9_3_0_test_tx_rx_5();
- rlc_um_v9_3_0_test_windows_5();
- rlc_um_v9_3_0_test_reordering(5);
- printf("rlc_um_v9_3_0_test: END OF TESTS\n");
- exit(0);
-}
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h
deleted file mode 100644
index bfde1b31f3..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-# ifndef __RLC_UM_TEST_H__
-# define __RLC_UM_TEST_H__
-
-void rlc_um_v9_3_0_test_windows_5(void);
-void rlc_um_v9_3_0_test_windows_10(void);
-void rlc_um_v9_3_0_test_data_conf(module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP);
-void rlc_um_v9_3_0_test_send_sdu(rlc_um_entity_t *um_txP, int sdu_indexP);
-void rlc_um_v9_3_0_test_exchange_pdus(rlc_um_entity_t *um_txP,rlc_um_entity_t *um_RxP, uint16_t bytes_txP,uint16_t bytes_rxP);
-void rlc_um_v9_3_0_test_exchange_delayed_pdus(rlc_um_entity_t *um_txP, rlc_um_entity_t *um_rxP, uint16_t bytes_txP, uint16_t bytes_rxP, signed int time_tx_delayedP,
- signed int time_rx_delayedP, int is_frame_incrementedP);
-void rlc_um_v9_3_0_buffer_delayed_rx_mac_data_ind(struct mac_data_ind* data_ind_rxP, signed int time_tx_delayedP);
-void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int* drop_countP, int *tx_packetsP, int* dropped_tx_packetsP);
-void rlc_um_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_size_t sizeP,
- mem_block_t *sduP);
-void rlc_um_v9_3_0_test_tx_rx_10(void);
-void rlc_um_v9_3_0_test_tx_rx_5(void);
-void rlc_um_v9_3_0_test_print_trace (void);
-void rlc_um_v9_3_0_test(void);
-# endif
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.c
deleted file mode 100644
index 91985e4800..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#define RLC_UM_MODULE
-#define RLC_UM_VERY_SIMPLE_TEST_C
-#include
-//#include "rtos_header.h"
-#include "platform_types.h"
-
-#include "list.h"
-#include "rlc_um.h"
-#include "rlc.h"
-#include "rlc_primitives.h"
-#include "mac_primitives.h"
-#include "LAYER2/MAC/extern.h"
-#include "rlc_um_very_simple_test.h"
-
-
-
-//-----------------------------------------------------------------------------
-void
-rlc_um_test_send_sdu (rlc_um_entity_t* rlcP, uint32_t frame, unsigned int sdu_typeP)
-{
- //-----------------------------------------------------------------------------
- mem_block_t *sdu_mem;
-
- switch (sdu_typeP) {
- case RLC_UM_TEST_SDU_TYPE_TCPIP:
- sdu_mem = get_free_mem_block (strlen(tcip_sdu)+ 1 + sizeof (struct rlc_um_data_req_alloc), __func__);
-
- if (sdu_mem != NULL) {
- memset (sdu_mem->data, 0, sizeof (struct rlc_um_data_req_alloc));
- ((struct rlc_um_data_req*)(sdu_mem->data))->data_size = strlen(tcip_sdu)+ 1;
- ((struct rlc_um_data_req*)(sdu_mem->data))->data_offset = 0;
- ((struct rlc_um_data_req*)(sdu_mem->data))->use_special_li = sizeof (struct rlc_um_data_req_alloc) - sizeof (struct rlc_um_data_req);
- strcpy (&sdu_mem->data[sizeof (struct rlc_um_data_req_alloc)], tcip_sdu);
- sdu_mem->data[sizeof (struct rlc_um_data_req_alloc)+ strlen(tcip_sdu)+1] = 0;
- rlc_um_data_req (rlcP, frame, sdu_mem);
- }
-
- break;
-
- case RLC_UM_TEST_SDU_TYPE_VOIP:
- sdu_mem = get_free_mem_block (strlen(voip_sdu)+ 1 + sizeof (struct rlc_um_data_req_alloc), __func__);
-
- if (sdu_mem != NULL) {
- memset (sdu_mem->data, 0, sizeof (struct rlc_um_data_req_alloc));
- ((struct rlc_um_data_req*)(sdu_mem->data))->data_size = strlen(voip_sdu)+ 1;
- ((struct rlc_um_data_req*)(sdu_mem->data))->data_offset = sizeof (struct rlc_um_data_req_alloc) - sizeof (struct rlc_um_data_req);
- ((struct rlc_um_data_req*)(sdu_mem->data))->use_special_li = 0;
- strcpy (&sdu_mem->data[sizeof (struct rlc_um_data_req_alloc)], voip_sdu);
- sdu_mem->data[sizeof (struct rlc_um_data_req_alloc)+ strlen(voip_sdu)+1] = 0;
- rlc_um_data_req (rlcP, frame, sdu_mem);
- }
-
- break;
-
- case RLC_UM_TEST_SDU_TYPE_SMALL:
- sdu_mem = get_free_mem_block (strlen(very_small_sdu)+ 1 + sizeof (struct rlc_um_data_req_alloc), __func__);
-
- if (sdu_mem != NULL) {
- memset (sdu_mem->data, 0, sizeof (struct rlc_um_data_req_alloc));
- ((struct rlc_um_data_req*)(sdu_mem->data))->data_size = strlen(very_small_sdu)+ 1;
- ((struct rlc_um_data_req*)(sdu_mem->data))->data_offset = sizeof (struct rlc_um_data_req_alloc) - sizeof (struct rlc_um_data_req);
- ((struct rlc_um_data_req*)(sdu_mem->data))->use_special_li = 0;
- strcpy (&sdu_mem->data[sizeof (struct rlc_um_data_req_alloc)], very_small_sdu);
- sdu_mem->data[sizeof (struct rlc_um_data_req_alloc)+ strlen(very_small_sdu)+1] = 0;
- rlc_um_data_req (rlcP, frame, sdu_mem);
- }
-
- break;
-
- default:
- ;
- }
-}
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.h
deleted file mode 100644
index b762a4fdb4..0000000000
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_very_simple_test.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_um_very_simple_test.h
-* \brief This file defines the prototypes of the functions dealing with the sending of self generated packet for very basic test or debug of RLC or lower layers.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-# ifndef __RLC_UM_VERY_SIMPLE_TEST_H__
-# define __RLC_UM_VERY_SIMPLE_TEST_H__
-//-----------------------------------------------------------------------------
-# include "rlc_um_entity.h"
-# include "mem_block.h"
-# include "rlc_um_structs.h"
-# include "rlc_um_constants.h"
-//-----------------------------------------------------------------------------
-#define RLC_UM_TEST_SDU_TYPE_TCPIP 0
-#define RLC_UM_TEST_SDU_TYPE_VOIP 1
-#define RLC_UM_TEST_SDU_TYPE_SMALL 2
-
-#define tcip_sdu "NOS TESTS MONTRENT QUE LE NOUVEAU TOSHIBA MK7559GSXP, UN DISQUE DUR DE 750 GO FONCTIONNANT AVEC DES SECTEURS DE 4 KO, EST AU MOINS AUSSI RAPIDE QUE SON PRÉDÉCESSEUR, LE MK6465GSX 640 GO, DANS TOUS LES BENCHMARKS THÉORIQUES. SES PERFORMANCES EN E/S ET SON TEMPS D’ACCÈS SONT COMPARABLES ET SON DÉBIT RÉEL EST MÊME NETTEMENT PLUS ÉLEVÉ. SES RÉSULTATS SOUS PCMARK VANTAGE, PAR CONTRE, SONT QUELQUE PEU MOINS BONS. DANS CE CAS, LEQUEL CHOISIR ? LES SCORES OBTENUS DANS LES TESTS THÉORIQUES NOUS CONFIRMENT QUE LE NOUVEAU MODÈLE SE COMPORTE CONVENABLEMENT « MALGRÉ » SES SECTEURS DE 4 KO ET QUE LA RAISON DU LÉGER RECUL DE SES PERFORMANCES SOUS PCMARK VANTAGE SE TROUVE AILLEURS. L’ALIGNEMENT DES SECTEURS N’EST PAS NON PLUS EN CAUSE, ÉTANT DONNÉ QUE WINDOWS VISTA (NOTRE OS DE TEST) ET WINDOWS 7 EN TIENNENT COMPTE LORS DE LA CRÉATION DES PARTITIONS — CE QUE NOUS AVONS BIEN ENTENDU VÉRIFIÉ INDÉPENDAMMENT.IL NOUS EST TOUTEFOIS IMPOSSIBLE DE CONTRÔLER L’EXÉCUTION ET L’ORGANISATION DE L’ÉCRITURE DES DONNÉES. PCMARK VANTAGE N’A EN EFFET JAMAIS ÉTÉ OPTIMISÉ POUR L’ÉCRITURE DE BLOCS DE DONNÉES DE GRANDE TAILLE ; DANS LA VIE RÉELLE, SI VOUS ÉCRIVEZ SURTOUT DE GROS FICHIERS, LE NOUVEAU DISQUE DUR DE 750 GO VA S’AVÉRER PLUS RAPIDE QUE LE 640 GO ET SURTOUT QUE LES RÉSULTATS ENREGISTRÉS DANS NOTRE BENCHMARK PCMARK, CAR SES SECTEURS DE 4 KO SERONT TOUJOURS PLUS PETITS QUE LES DONNÉES À ÉCRIRE. LE PROBLÈME EST QU’AUSSI LONGTEMPS QUE LES APPLICATIONS CONTINUERONT À EFFECTUER DES DEMANDES D’ÉCRITURE EN MODE 512 OCTETS"
-
-#define voip_sdu "Nos tests montrent que le nouveau Toshiba MK7559GSXP, un disque dur de 750 Go"
-#define very_small_sdu "NoS tEsTs MoNtReNt"
-
-void rlc_um_test_send_sdu (rlc_um_entity_t* rlcP, uint32_t frame, unsigned int sdu_typeP);
-# endif
diff --git a/openair2/LAYER2/RLC/mac_primitives.h b/openair2/LAYER2/RLC/mac_primitives.h
deleted file mode 100644
index 4690bba42e..0000000000
--- a/openair2/LAYER2/RLC/mac_primitives.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c
deleted file mode 100644
index b18b67198f..0000000000
--- a/openair2/LAYER2/RLC/rlc.c
+++ /dev/null
@@ -1,683 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*
- rlc.c
- -------------------
- AUTHOR : Lionel GAUTHIER
- COMPANY : EURECOM
- EMAIL : Lionel.Gauthier at eurecom dot fr
-*/
-#define RLC_C
-#include "rlc.h"
-#include "mem_block.h"
-#include "../MAC/mac_extern.h"
-#include "LAYER2/RLC/UM_v9.3.0/rlc_um.h"
-#include "common/utils/LOG/log.h"
-#include "UTIL/OCG/OCG_vars.h"
-#include "common/utils/LOG/vcd_signal_dumper.h"
-#include "common/openairinterface5g_limits.h"
-#include "assertions.h"
-#include
-
-#include "common/ran_context.h"
-extern RAN_CONTEXT_t RC;
-
-extern bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const MBMS_flag_t MBMS_flagP,
- const rb_id_t rb_idP,
- const sdu_size_t sdu_buffer_sizeP,
- mem_block_t *const sdu_buffer_pP);
-
-#define DEBUG_RLC_PDCP_INTERFACE 1
-//#define TRACE_RLC_PAYLOAD 1
-#define DEBUG_RLC_DATA_REQ 1
-void (*rlc_rrc_data_conf)(
- const protocol_ctxt_t *const ctxtP,
- const rb_id_t rb_idP,
- const mui_t muiP,
- const rlc_tx_status_t statusP) __attribute__ ((aligned(32)));
-
-void (*rlc_rrc_data_ind)(
- const protocol_ctxt_t *const ctxtP,
- const rb_id_t rb_idP,
- const sdu_size_t sdu_sizeP,
- const uint8_t *const sduP) __attribute__ ((aligned(32)));
-
-logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
-logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
-rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
-rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
-hash_table_t *rlc_coll_p __attribute__ ((aligned(32)));
-
-
-logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
-logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */
-//-----------------------------------------------------------------------------
-void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP)
-//-----------------------------------------------------------------------------
-{
- unsigned long octet_index = 0;
-
- if (dataP == NULL) {
- return;
- }
-
- LOG_T(componentP, "+-----+-------------------------------------------------+\n");
- LOG_T(componentP, "| | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- LOG_T(componentP, "+-----+-------------------------------------------------+\n");
-
- for (octet_index = 0; octet_index < sizeP; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- LOG_T(componentP, " |\n");
- }
-
- LOG_T(componentP, " %04lu |", octet_index);
- }
-
- /*
- * Print every single octet in hexadecimal form
- */
- LOG_T(componentP, " %02x", dataP[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
-
- /*
- * Append enough spaces and put final pipe
- */
- unsigned char index;
-
- for (index = octet_index; index < 16; ++index) {
- LOG_T(componentP, " ");
- }
-
- LOG_T(componentP, " |\n");
-}
-
-//-----------------------------------------------------------------------------
-rlc_op_status_t rlc_stat_req (
- const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const rb_id_t rb_idP,
- unsigned int *stat_rlc_mode,
- unsigned int *stat_tx_pdcp_sdu,
- unsigned int *stat_tx_pdcp_bytes,
- unsigned int *stat_tx_pdcp_sdu_discarded,
- unsigned int *stat_tx_pdcp_bytes_discarded,
- unsigned int *stat_tx_data_pdu,
- unsigned int *stat_tx_data_bytes,
- unsigned int *stat_tx_retransmit_pdu_by_status,
- unsigned int *stat_tx_retransmit_bytes_by_status,
- unsigned int *stat_tx_retransmit_pdu,
- unsigned int *stat_tx_retransmit_bytes,
- unsigned int *stat_tx_control_pdu,
- unsigned int *stat_tx_control_bytes,
- unsigned int *stat_rx_pdcp_sdu,
- unsigned int *stat_rx_pdcp_bytes,
- unsigned int *stat_rx_data_pdus_duplicate,
- unsigned int *stat_rx_data_bytes_duplicate,
- unsigned int *stat_rx_data_pdu,
- unsigned int *stat_rx_data_bytes,
- unsigned int *stat_rx_data_pdu_dropped,
- unsigned int *stat_rx_data_bytes_dropped,
- unsigned int *stat_rx_data_pdu_out_of_window,
- unsigned int *stat_rx_data_bytes_out_of_window,
- unsigned int *stat_rx_control_pdu,
- unsigned int *stat_rx_control_bytes,
- unsigned int *stat_timer_reordering_timed_out,
- unsigned int *stat_timer_poll_retransmit_timed_out,
- unsigned int *stat_timer_status_prohibit_timed_out) {
- //-----------------------------------------------------------------------------
- rlc_mode_t rlc_mode = RLC_MODE_NONE;
- rlc_union_t *rlc_union_p = NULL;
- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_rc;
-
- //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
- if(rb_idP >= NB_RB_MAX) {
- LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MAX);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
-
- key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- rlc_mode = rlc_union_p->mode;
- }
-
- *stat_rlc_mode = rlc_mode;
-
- switch (rlc_mode) {
- case RLC_MODE_NONE:
- *stat_tx_pdcp_sdu = 0;
- *stat_tx_pdcp_bytes = 0;
- *stat_tx_pdcp_sdu_discarded = 0;
- *stat_tx_pdcp_bytes_discarded = 0;
- *stat_tx_data_pdu = 0;
- *stat_tx_data_bytes = 0;
- *stat_tx_retransmit_pdu_by_status = 0;
- *stat_tx_retransmit_bytes_by_status = 0;
- *stat_tx_retransmit_pdu = 0;
- *stat_tx_retransmit_bytes = 0;
- *stat_tx_control_pdu = 0;
- *stat_tx_control_bytes = 0;
- *stat_rx_pdcp_sdu = 0;
- *stat_rx_pdcp_bytes = 0;
- *stat_rx_data_pdus_duplicate = 0;
- *stat_rx_data_bytes_duplicate = 0;
- *stat_rx_data_pdu = 0;
- *stat_rx_data_bytes = 0;
- *stat_rx_data_pdu_dropped = 0;
- *stat_rx_data_bytes_dropped = 0;
- *stat_rx_data_pdu_out_of_window = 0;
- *stat_rx_data_bytes_out_of_window = 0;
- *stat_rx_control_pdu = 0;
- *stat_rx_control_bytes = 0;
- *stat_timer_reordering_timed_out = 0;
- *stat_timer_poll_retransmit_timed_out = 0;
- *stat_timer_status_prohibit_timed_out = 0;
- return RLC_OP_STATUS_BAD_PARAMETER;
- break;
-
- case RLC_MODE_AM:
- rlc_am_stat_req(ctxt_pP,
- &rlc_union_p->rlc.am,
- stat_tx_pdcp_sdu,
- stat_tx_pdcp_bytes,
- stat_tx_pdcp_sdu_discarded,
- stat_tx_pdcp_bytes_discarded,
- stat_tx_data_pdu,
- stat_tx_data_bytes,
- stat_tx_retransmit_pdu_by_status,
- stat_tx_retransmit_bytes_by_status,
- stat_tx_retransmit_pdu,
- stat_tx_retransmit_bytes,
- stat_tx_control_pdu,
- stat_tx_control_bytes,
- stat_rx_pdcp_sdu,
- stat_rx_pdcp_bytes,
- stat_rx_data_pdus_duplicate,
- stat_rx_data_bytes_duplicate,
- stat_rx_data_pdu,
- stat_rx_data_bytes,
- stat_rx_data_pdu_dropped,
- stat_rx_data_bytes_dropped,
- stat_rx_data_pdu_out_of_window,
- stat_rx_data_bytes_out_of_window,
- stat_rx_control_pdu,
- stat_rx_control_bytes,
- stat_timer_reordering_timed_out,
- stat_timer_poll_retransmit_timed_out,
- stat_timer_status_prohibit_timed_out);
- return RLC_OP_STATUS_OK;
- break;
-
- case RLC_MODE_UM:
- *stat_tx_retransmit_pdu_by_status = 0;
- *stat_tx_retransmit_bytes_by_status = 0;
- *stat_tx_retransmit_pdu = 0;
- *stat_tx_retransmit_bytes = 0;
- *stat_tx_control_pdu = 0;
- *stat_tx_control_bytes = 0;
- *stat_rx_data_pdu_dropped = 0;
- *stat_rx_data_bytes_dropped = 0;
- *stat_rx_data_pdu_out_of_window = 0;
- *stat_rx_data_bytes_out_of_window = 0;
- *stat_timer_poll_retransmit_timed_out = 0;
- *stat_timer_status_prohibit_timed_out = 0;
- rlc_um_stat_req (&rlc_union_p->rlc.um,
- stat_tx_pdcp_sdu,
- stat_tx_pdcp_bytes,
- stat_tx_pdcp_sdu_discarded,
- stat_tx_pdcp_bytes_discarded,
- stat_tx_data_pdu,
- stat_tx_data_bytes,
- stat_rx_pdcp_sdu,
- stat_rx_pdcp_bytes,
- stat_rx_data_pdus_duplicate,
- stat_rx_data_bytes_duplicate,
- stat_rx_data_pdu,
- stat_rx_data_bytes,
- stat_rx_data_pdu_dropped,
- stat_rx_data_bytes_dropped,
- stat_rx_data_pdu_out_of_window,
- stat_rx_data_bytes_out_of_window,
- stat_timer_reordering_timed_out);
- return RLC_OP_STATUS_OK;
- break;
-
- case RLC_MODE_TM:
- *stat_tx_pdcp_sdu = 0;
- *stat_tx_pdcp_bytes = 0;
- *stat_tx_pdcp_sdu_discarded = 0;
- *stat_tx_pdcp_bytes_discarded = 0;
- *stat_tx_data_pdu = 0;
- *stat_tx_data_bytes = 0;
- *stat_tx_retransmit_pdu_by_status = 0;
- *stat_tx_retransmit_bytes_by_status = 0;
- *stat_tx_retransmit_pdu = 0;
- *stat_tx_retransmit_bytes = 0;
- *stat_tx_control_pdu = 0;
- *stat_tx_control_bytes = 0;
- *stat_rx_pdcp_sdu = 0;
- *stat_rx_pdcp_bytes = 0;
- *stat_rx_data_pdus_duplicate = 0;
- *stat_rx_data_bytes_duplicate = 0;
- *stat_rx_data_pdu = 0;
- *stat_rx_data_bytes = 0;
- *stat_rx_data_pdu_dropped = 0;
- *stat_rx_data_bytes_dropped = 0;
- *stat_rx_data_pdu_out_of_window = 0;
- *stat_rx_data_bytes_out_of_window = 0;
- *stat_rx_control_pdu = 0;
- *stat_rx_control_bytes = 0;
- *stat_timer_reordering_timed_out = 0;
- *stat_timer_poll_retransmit_timed_out = 0;
- *stat_timer_status_prohibit_timed_out = 0;
- return RLC_OP_STATUS_BAD_PARAMETER;
- break;
-
- default:
- *stat_tx_pdcp_sdu = 0;
- *stat_tx_pdcp_bytes = 0;
- *stat_tx_pdcp_sdu_discarded = 0;
- *stat_tx_pdcp_bytes_discarded = 0;
- *stat_tx_data_pdu = 0;
- *stat_tx_data_bytes = 0;
- *stat_tx_retransmit_pdu_by_status = 0;
- *stat_tx_retransmit_bytes_by_status = 0;
- *stat_tx_retransmit_pdu = 0;
- *stat_tx_retransmit_bytes = 0;
- *stat_tx_control_pdu = 0;
- *stat_tx_control_bytes = 0;
- *stat_rx_pdcp_sdu = 0;
- *stat_rx_pdcp_bytes = 0;
- *stat_rx_data_pdus_duplicate = 0;
- *stat_rx_data_bytes_duplicate = 0;
- *stat_rx_data_pdu = 0;
- *stat_rx_data_bytes = 0;
- *stat_rx_data_pdu_dropped = 0;
- *stat_rx_data_bytes_dropped = 0;
- *stat_rx_data_pdu_out_of_window = 0;
- *stat_rx_data_bytes_out_of_window = 0;
- *stat_rx_control_pdu = 0;
- *stat_rx_control_bytes = 0;
- *stat_timer_poll_retransmit_timed_out = 0;
- *stat_timer_status_prohibit_timed_out = 0;
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
-}
-
-//-----------------------------------------------------------------------------
-rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const MBMS_flag_t MBMS_flagP,
- const rb_id_t rb_idP,
- const mui_t muiP,
- confirm_t confirmP,
- sdu_size_t sdu_sizeP,
- mem_block_t *sdu_pP,
- const uint32_t *const sourceL2Id,
- const uint32_t *const destinationL2Id
- ) {
- //-----------------------------------------------------------------------------
- mem_block_t *new_sdu_p = NULL;
- rlc_mode_t rlc_mode = RLC_MODE_NONE;
- rlc_union_t *rlc_union_p = NULL;
- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_rc;
- rlc_mbms_id_t *mbms_id_p = NULL;
- logical_chan_id_t log_ch_id = 0;
-#ifdef DEBUG_RLC_DATA_REQ
- LOG_D(RLC,PROTOCOL_CTXT_FMT"rlc_data_req: rb_id %ld (MAX %d), muip %d, confirmP %d, sdu_sizeP %d, sdu_pP %p\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_idP,
- NB_RAB_MAX,
- muiP,
- confirmP,
- sdu_sizeP,
- sdu_pP);
-#endif
-#if T_TRACER
-
- if (ctxt_pP->enb_flag)
- T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP));
-
-#endif
-
- if (MBMS_flagP) {
- //AssertFatal (rb_idP < NB_RB_MBMS_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
- if(rb_idP >= NB_RB_MBMS_MAX) {
- LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
- } else {
- //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
- if(rb_idP >= NB_RB_MAX) {
- LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MAX);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
- }
-
- //DevAssert(sdu_pP != NULL);
- if(sdu_pP == NULL) {
- LOG_E(RLC, "sdu_pP == NULL\n");
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
-
- //DevCheck(sdu_sizeP > 0, sdu_sizeP, 0, 0);
- if(sdu_sizeP <= 0) {
- LOG_E(RLC, "sdu_sizeP %d, file %s, line %d\n", sdu_sizeP, __FILE__,__LINE__);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_IN);
-
- if (MBMS_flagP == true) {
- if (ctxt_pP->enb_flag) {
- log_ch_id = rlc_mbms_enb_get_lcid_by_rb_id(ctxt_pP->module_id,rb_idP);
- mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][log_ch_id];
- } else {
- log_ch_id = rlc_mbms_ue_get_lcid_by_rb_id(ctxt_pP->rnti,rb_idP);
- mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ctxt_pP->rnti][log_ch_id];
- }
-
- key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id);
- } else if (sourceL2Id && destinationL2Id) {
- LOG_D (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%ld, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP,
- srb_flagP);
- key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- //Thinh's line originally uncommented
- //key = RLC_COLL_KEY_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, *sourceL2Id, *destinationL2Id, srb_flagP);
- //key_lcid = RLC_COLL_KEY_LCID_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, chan_idP, *sourceL2Id, *destinationL2Id, srb_flagP);
- } else {
- LOG_D (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%ld, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP,
- srb_flagP);
- key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- }
-
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- rlc_mode = rlc_union_p->mode;
- } else {
- rlc_mode = RLC_MODE_NONE;
- //AssertFatal (0 , "RLC not configured key %ju\n", key);
- LOG_E(RLC, "not configured key %lu\n", key);
- return RLC_OP_STATUS_OUT_OF_RESSOURCES;
- }
-
- if (MBMS_flagP == 0) {
- LOG_D(RLC, PROTOCOL_CTXT_FMT"[RB %ld] Display of rlc_data_req:\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_idP);
-#if defined(TRACE_RLC_PAYLOAD)
- rlc_util_print_hex_octets(RLC, (unsigned char *)sdu_pP->data, sdu_sizeP);
-#endif
-#ifdef DEBUG_RLC_DATA_REQ
- LOG_D(RLC,"RLC_TYPE : %d\n", rlc_mode);
-#endif
-
- switch (rlc_mode) {
- case RLC_MODE_NONE:
- free_mem_block(sdu_pP, __func__);
- LOG_E(RLC, PROTOCOL_CTXT_FMT" Received RLC_MODE_NONE as rlc_type for rb_id %ld\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_idP);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_BAD_PARAMETER;
-
- case RLC_MODE_AM:
-#ifdef DEBUG_RLC_DATA_REQ
- LOG_D(RLC,"RLC_MODE_AM\n");
-#endif
- new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_am_data_req_alloc), __func__);
-
- if (new_sdu_p != NULL) {
- // PROCESS OF COMPRESSION HERE:
- memset (new_sdu_p->data, 0, sizeof (struct rlc_am_data_req_alloc));
- memcpy (&new_sdu_p->data[sizeof (struct rlc_am_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
- ((struct rlc_am_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
- ((struct rlc_am_data_req *) (new_sdu_p->data))->conf = confirmP;
- ((struct rlc_am_data_req *) (new_sdu_p->data))->mui = muiP;
- ((struct rlc_am_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_am_data_req_alloc);
- free_mem_block(sdu_pP, __func__);
- rlc_am_data_req(ctxt_pP, &rlc_union_p->rlc.am, new_sdu_p);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_OK;
- } else {
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- free_mem_block(sdu_pP, __func__);
- return RLC_OP_STATUS_INTERNAL_ERROR;
- }
-
- break;
-
- case RLC_MODE_UM:
-
- /* TODO: this is a hack, needs better solution. Let's not use too
- * much memory and store at maximum 5 millions bytes.
- */
- /* look for HACK_RLC_UM_LIMIT for others places related to the hack. Please do not remove this comment. */
- if (rlc_um_get_buffer_occupancy(&rlc_union_p->rlc.um) > 5000000) {
- free_mem_block(sdu_pP, __func__);
- return RLC_OP_STATUS_OUT_OF_RESSOURCES;
- }
-
- new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc), __func__);
-
- if (new_sdu_p != NULL) {
- // PROCESS OF COMPRESSION HERE:
- memset (new_sdu_p->data, 0, sizeof (struct rlc_um_data_req_alloc));
- memcpy (&new_sdu_p->data[sizeof (struct rlc_um_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
- ((struct rlc_um_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
- ((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
- free_mem_block(sdu_pP, __func__);
- rlc_um_data_req(ctxt_pP, &rlc_union_p->rlc.um, new_sdu_p);
- //free_mem_block(new_sdu, __func__);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_OK;
- } else {
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- free_mem_block(sdu_pP, __func__);
- return RLC_OP_STATUS_INTERNAL_ERROR;
- }
-
- break;
-
- case RLC_MODE_TM:
- new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_tm_data_req_alloc), __func__);
-
- if (new_sdu_p != NULL) {
- // PROCESS OF COMPRESSION HERE:
- memset (new_sdu_p->data, 0, sizeof (struct rlc_tm_data_req_alloc));
- memcpy (&new_sdu_p->data[sizeof (struct rlc_tm_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
- ((struct rlc_tm_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
- ((struct rlc_tm_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_tm_data_req_alloc);
- free_mem_block(sdu_pP, __func__);
- rlc_tm_data_req(ctxt_pP, &rlc_union_p->rlc.tm, new_sdu_p);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_OK;
- } else {
- //handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : out of memory\n", __FILE__, __LINE__);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- free_mem_block(sdu_pP, __func__);
- return RLC_OP_STATUS_INTERNAL_ERROR;
- }
-
- break;
-
- default:
- free_mem_block(sdu_pP, __func__);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_INTERNAL_ERROR;
- }
- } else { /* MBMS_flag != 0 */
- // LOG_I(RLC,"DUY rlc_data_req: mbms_rb_id in RLC instant is: %d\n", mbms_rb_id);
- if (sdu_pP != NULL) {
- if (sdu_sizeP > 0) {
- LOG_D(RLC,"received a packet with size %d for MBMS \n", sdu_sizeP);
- new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc), __func__);
-
- if (new_sdu_p != NULL) {
- // PROCESS OF COMPRESSION HERE:
- memset (new_sdu_p->data, 0, sizeof (struct rlc_um_data_req_alloc));
- memcpy (&new_sdu_p->data[sizeof (struct rlc_um_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
- ((struct rlc_um_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
- ((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
- free_mem_block(sdu_pP, __func__);
- rlc_um_data_req(ctxt_pP, &rlc_union_p->rlc.um, new_sdu_p);
- //free_mem_block(new_sdu, __func__);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_OK;
- } else {
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- free_mem_block(sdu_pP, __func__);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
- } else {
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
- } else {
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-void rlc_data_ind (
- const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const MBMS_flag_t MBMS_flagP,
- const rb_id_t rb_idP,
- const sdu_size_t sdu_sizeP,
- mem_block_t *sdu_pP) {
- //-----------------------------------------------------------------------------
- LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %ld] Display of rlc_data_ind: size %u\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- (srb_flagP) ? "SRB" : "DRB",
- rb_idP,
- sdu_sizeP);
- rlc_util_print_hex_octets(RLC, (unsigned char *)sdu_pP->data, sdu_sizeP);
-
- if (ctxt_pP->enb_flag) {
-#if T_TRACER
- T(T_ENB_RLC_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP));
-#endif
- const ngran_node_t type = RC.rrc[ctxt_pP->module_id]->node_type;
- AssertFatal(!NODE_IS_CU(type),
- "Can't be CU, bad node type %d\n", type);
-
- if (NODE_IS_DU(type) && srb_flagP == 1) {
- MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE);
- F1AP_UL_RRC_MESSAGE(msg).rnti = ctxt_pP->rnti;
- F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_idP;
- F1AP_UL_RRC_MESSAGE(msg).rrc_container = sdu_pP->data;
- F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = sdu_sizeP;
- itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg);
- return;
- }
- } // case monolithic eNodeB or UE
-
- get_pdcp_data_ind_func()(ctxt_pP, srb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP,NULL,NULL);
-}
-//-----------------------------------------------------------------------------
-void rlc_data_conf (const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const rb_id_t rb_idP,
- const mui_t muiP,
- const rlc_tx_status_t statusP) {
- //-----------------------------------------------------------------------------
- if (srb_flagP) {
- if (rlc_rrc_data_conf != NULL) {
- rlc_rrc_data_conf (ctxt_pP, rb_idP, muiP, statusP);
- }
- }
-}
-//-----------------------------------------------------------------------------
-int
-rlc_module_init (int enb_flag) { /* enb_flag is unused, but needed for binary
- * compatibility with rlc_v2 */
- //-----------------------------------------------------------------------------
- int k;
- module_id_t module_id1;
- /* for no gcc warnings */
- (void)k;
- LOG_D(RLC, "MODULE INIT\n");
- rlc_rrc_data_ind = NULL;
- rlc_rrc_data_conf = NULL;
- rlc_coll_p = hashtable_create ((LTE_maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, rb_free_rlc_union);
-
- //AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed");
- if(rlc_coll_p == NULL) {
- LOG_E(RLC, "UNRECOVERABLE error, RLC hashtable_create failed\n");
- return -1;
- }
-
- for (module_id1=0; module_id1 < MAX_MOBILES_PER_ENB; module_id1++) {
- for (k=0; k < RLC_MAX_MBMS_LC; k++) {
- rlc_mbms_lcid2service_session_id_ue[module_id1][k].service_id = 0;
- rlc_mbms_lcid2service_session_id_ue[module_id1][k].session_id = 0;
- }
-
- for (k=0; k < NB_RB_MBMS_MAX; k++) {
- rlc_mbms_rbid2lcid_ue[module_id1][k] = RLC_LC_UNALLOCATED;
- }
- }
-
- for (k=0; k < RLC_MAX_MBMS_LC; k++) {
- rlc_mbms_lcid2service_session_id_eNB[0][k].service_id = 0;
- rlc_mbms_lcid2service_session_id_eNB[0][k].session_id = 0;
- }
-
- for (k=0; k < NB_RB_MBMS_MAX; k++) {
- rlc_mbms_rbid2lcid_eNB[0][k] = RLC_LC_UNALLOCATED;
- }
-
- pool_buffer_init();
- return(0);
-}
-//-----------------------------------------------------------------------------
-void
-rlc_module_cleanup (void)
-//-----------------------------------------------------------------------------
-{
- hashtable_destroy(&rlc_coll_p);
-}
-//-----------------------------------------------------------------------------
-void
-rlc_layer_init (void) {
- //-----------------------------------------------------------------------------
-}
-//-----------------------------------------------------------------------------
-void
-rlc_layer_cleanup (void)
-//-----------------------------------------------------------------------------
-{
-}
-
diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h
index 561a664d85..32c3a70ea7 100644
--- a/openair2/LAYER2/RLC/rlc.h
+++ b/openair2/LAYER2/RLC/rlc.h
@@ -38,12 +38,6 @@
# include "platform_types.h"
#include "common/platform_constants.h"
# include "hashtable.h"
-# include "rlc_am.h"
-# include "rlc_um.h"
-# include "rlc_tm.h"
-# include "rlc_am_structs.h"
-# include "rlc_tm_structs.h"
-# include "rlc_um_structs.h"
# include "LTE_asn_constant.h"
# include "common/utils/LOG/log.h"
# include "mem_block.h"
@@ -54,11 +48,8 @@
# include "LTE_SRB-ToAddMod.h"
# include "LTE_SRB-ToAddModList.h"
# include "LTE_DRB-ToReleaseList.h"
+# include "LTE_PMCH-InfoList-r9.h"
-#include "LTE_PMCH-InfoList-r9.h"
-
-typedef uint64_t hash_key_t;
-#define HASHTABLE_NOT_A_KEY_VALUE ((uint64_t)-1)
//-----------------------------------------------------------------------------
#define RLC_OP_STATUS_OK 1
@@ -87,18 +78,6 @@ typedef enum rlc_mode_e {
RLC_MODE_TM = 4
} rlc_mode_t;
-/*! \struct rlc_info_t
-* \brief Structure containing RLC protocol configuration parameters.
-*/
-typedef volatile struct {
- rlc_mode_t rlc_mode;
- union {
- rlc_am_info_t rlc_am_info; /*!< \sa rlc_am.h. */
- rlc_tm_info_t rlc_tm_info; /*!< \sa rlc_tm.h. */
- rlc_um_info_t rlc_um_info; /*!< \sa rlc_um.h. */
- } rlc;
-} rlc_info_t;
-
/*! \struct mac_rlc_status_resp_t
* \brief Primitive exchanged between RLC and MAC informing about the buffer occupancy of the RLC protocol instance.
*/
@@ -111,20 +90,6 @@ typedef struct {
} mac_rlc_status_resp_t;
-/*! \struct mac_rlc_max_rx_header_size_t
-* \brief Usefull only for debug scenario where we connect 2 RLC protocol instances without the help of the MAC .
-*/
-typedef struct {
- union {
- struct rlc_am_rx_pdu_management dummy1;
- struct rlc_tm_rx_pdu_management dummy2;
- //struct rlc_um_rx_pdu_management dummy3;
- struct mac_tb_ind dummy4;
- struct mac_rx_tb_management dummy5;
- } dummy;
-} mac_rlc_max_rx_header_size_t;
-
-
//-----------------------------------------------------------------------------
// PRIVATE INTERNALS OF RLC
@@ -158,119 +123,6 @@ typedef void (rrc_data_conf_cb_t)(
const rlc_tx_status_t statusP);
-/*! \struct rlc_t
-* \brief Structure to be instanciated to allocate memory for RLC protocol instances.
-*/
-typedef struct rlc_union_s {
- rlc_mode_t mode;
- union {
- rlc_am_entity_t am;
- rlc_um_entity_t um;
- rlc_tm_entity_t tm;
- } rlc;
-} rlc_union_t;
-
-typedef struct rlc_mbms_s {
- rb_id_t rb_id;
- module_id_t instanciated_instance;
- rlc_um_entity_t um;
-} rlc_mbms_t;
-
-typedef struct rlc_mbms_id_s {
- mbms_service_id_t service_id;
- mbms_session_id_t session_id;
-} rlc_mbms_id_t;
-
-
-//rlc_mbms_t rlc_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
-//rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
-extern rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
-extern rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h
-
-#define rlc_mbms_enb_get_lcid_by_rb_id(Enb_mOD,rB_iD) rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD]
-;
-
-#define rlc_mbms_enb_set_lcid_by_rb_id(Enb_mOD,rB_iD,lOG_cH_iD) do { \
- rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD] = lOG_cH_iD; \
- } while (0);
-
-#define rlc_mbms_ue_get_lcid_by_rb_id(uE_mOD,rB_iD) rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD]
-
-#define rlc_mbms_ue_set_lcid_by_rb_id(uE_mOD,rB_iD,lOG_cH_iD) do { \
- AssertFatal(rB_iD0)
-# define RLC_SDU_DISCARD_TIMER_BASED_NO_EXPLICIT 0x02
-// UM, TM (must>0)
-# define RLC_SDU_DISCARD_MAX_DAT_RETRANSMISSION 0x04
-// AM (must>0)
-# define RLC_SDU_DISCARD_NOT_CONFIGURED 0x10
-// UM, TM (must>0)
-//----------------------------------------------------------
-// DATA, CONTROL PDU parameters
-//----------------------------------------------------------
-// D/C field (values shifted 7 bits left)
-# define RLC_DC_CONTROL_PDU 0
-# define RLC_DC_DATA_PDU 128
-# define RLC_DC_MASK 128
-// HE field
-# define RLC_HE_SUCC_BYTE_CONTAINS_DATA 0x00 // v9.2 ok
-# define RLC_HE_SUCC_BYTE_CONTAINS_LI_E 0x01 // v9.2 ok
-# define RLC_HE_SUCC_BYTE_CONTAINS_DATA_END_PDU_IS_END_SDU 0x02 // v9.2 ok
-# define RLC_HE_MASK 0x03
-// Extension bit
-/* Section 9.2.2.5:
-The interpretation of this bit depends on RLC mode and higher layer configuration:
-- In the UMD PDU, the "Extension bit" in the first octet has either the normal
- E-bit interpretation or the alternative E-bit interpretation depending on
- higher layer configuration. The "Extension bit" in all the other octects always
- has the normal E-bit interpretation.
-- In the AMD PDU, the "Extension bit" always has the normal E-bit interpretation.*/
-# define RLC_E_NEXT_FIELD_IS_COMPLETE_SDU 0x00 // alternative E-bit interpretation v9.2 ok
-# define RLC_E_NEXT_FIELD_IS_DATA 0x00 // v9.2 ok
-# define RLC_E_NEXT_FIELD_IS_LI_E 0x01 // v9.2 ok
-# define RLC_E_MASK 0x01
-// li field (values shifted 1 bit left)
-# define RLC_LI_LAST_PDU_ONE_BYTE_SHORT 0xFFF6 // TO BE REMOVED ONLY FOR COMPILATION
-
-# define RLC_LI_LAST_PDU_EXACTLY_FILLED 0x0000 // v9.2 ok
-# define RLC_LI_1ST_BYTE_PDU_IS_1ST_BYTE_SDU_LAST_BYTE_IGNORED 0xFFF4 // v9.2 ok UM only
-# define RLC_LI_LAST_PDU_ONE_BYTE_SHORT_FILLED_BY_SDU 0xFFF6 // v9.2 ok
-# define RLC_LI_1ST_BYTE_SDU_IS_1ST_BYTE_PDU 0xFFF8 // v9.2 ok UM only
-# define RLC_LI_1ST_BYTE_SDU_IS_1ST_BYTE_PDU_LAST_BYTE_SDU_IS_LAST_BYTE_PDU 0xFFFA // v9.2 ok UM only
-# define RLC_LI_PDU_PIGGY_BACKED_STATUS 0xFFFC // v9.2 ok AM
-# define RLC_LI_PDU_NOT_FIRST_NOT_LAST_BYTE_SDU 0xFFFC // v9.2 ok UM only
-# define RLC_LI_PDU_PADDING 0xFFFE // v9.2 ok
-# define RLC_LI_UNDEFINED 0xF0F0
-# define RLC_LI_MASK 0xFFFE
-// piggybacked status PDU (values shifted 4 bits left)
-# define RLC_PIGGY_PDU_TYPE_STATUS 0x00
-# define RLC_PDU_TYPE_STATUS 0x00 // v9.2 ok
-# define RLC_PIGGY_PDU_TYPE_RESET 0x10
-# define RLC_PDU_TYPE_RESET 0x10 // v9.2 ok
-# define RLC_PIGGY_PDU_TYPE_RESET_ACK 0x20
-# define RLC_PDU_TYPE_RESET_ACK 0x20 // v9.2 ok
-# define RLC_PIGGY_PDU_TYPE_MASK 0x70
-# define RLC_PDU_TYPE_MASK 0x70 // v9.2 ok
-
-# define GUARD_CRC_LIH_SIZE 0x03
-// in bytes
-
-#endif
diff --git a/openair2/LAYER2/RLC/rlc_def_lte.h b/openair2/LAYER2/RLC/rlc_def_lte.h
deleted file mode 100644
index aa4dac79ae..0000000000
--- a/openair2/LAYER2/RLC/rlc_def_lte.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_def_lte.h
-* \brief This file contains LTE constants for RLC internal use.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-* \note
-* \bug
-* \warning
-*/
-#ifndef __RLC_DEF_LTE_H__
-# define __RLC_DEF_LTE_H__
-//----------------------------------------------------------
-
-# define RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU 0x0
-# define RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU 0x1
-# define RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU 0x2
-# define RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU 0x3
-
-# define RLC_E_FIXED_PART_DATA_FIELD_FOLLOW 0x0
-# define RLC_E_FIXED_PART_E_AND_LI_FIELD_FOLLOW 0x1
-
-# define RLC_E_EXTENSION_PART_DATA_FIELD_FOLLOW 0x0
-# define RLC_E_EXTENSION_PART_E_AND_LI_FIELD_FOLLOW 0x1
-
-#endif
diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c
deleted file mode 100644
index 2e308fc0e1..0000000000
--- a/openair2/LAYER2/RLC/rlc_mac.c
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*
- rlc_mac.c
- -------------------
- AUTHOR : Lionel GAUTHIER
- COMPANY : EURECOM
- EMAIL : Lionel.Gauthier@eurecom.fr
-*/
-
-//-----------------------------------------------------------------------------
-#define RLC_MAC_C
-#include "rlc.h"
-#include "LAYER2/RLC/UM_v9.3.0/rlc_um.h"
-#include "LAYER2/MAC/mac_extern.h"
-#include "common/utils/LOG/log.h"
-#include "UTIL/OCG/OCG_vars.h"
-#include "hashtable.h"
-#include "assertions.h"
-#include "common/utils/LOG/vcd_signal_dumper.h"
-#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
-
-//#define DEBUG_MAC_INTERFACE 1
-
-//-----------------------------------------------------------------------------
-struct mac_data_ind mac_rlc_deserialize_tb (
- char *buffer_pP,
- const tb_size_t tb_sizeP,
- num_tb_t num_tbP,
- crc_t *crcs_pP) {
- //-----------------------------------------------------------------------------
- struct mac_data_ind data_ind;
- mem_block_t *tb_p;
- num_tb_t nb_tb_read;
- tbs_size_t tbs_size;
- nb_tb_read = 0;
- tbs_size = 0;
- list_init(&data_ind.data, NULL);
-
- while (num_tbP > 0) {
- tb_p = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_sizeP, __func__);
-
- if (tb_p != NULL) {
- ((struct mac_tb_ind *) (tb_p->data))->first_bit = 0;
- ((struct mac_tb_ind *) (tb_p->data))->data_ptr = (uint8_t *)&tb_p->data[sizeof (mac_rlc_max_rx_header_size_t)];
- ((struct mac_tb_ind *) (tb_p->data))->size = tb_sizeP;
-
- if (crcs_pP) {
- ((struct mac_tb_ind *) (tb_p->data))->error_indication = crcs_pP[nb_tb_read];
- } else {
- ((struct mac_tb_ind *) (tb_p->data))->error_indication = 0;
- }
-
- memcpy(((struct mac_tb_ind *) (tb_p->data))->data_ptr, &buffer_pP[tbs_size], tb_sizeP);
-#ifdef DEBUG_MAC_INTERFACE
- LOG_T(RLC, "[MAC-RLC] DUMP RX PDU(%d bytes):\n", tb_sizeP);
- rlc_util_print_hex_octets(RLC, ((struct mac_tb_ind *) (tb_p->data))->data_ptr, tb_sizeP);
-#endif
- nb_tb_read = nb_tb_read + 1;
- tbs_size = tbs_size + tb_sizeP;
- list_add_tail_eurecom(tb_p, &data_ind.data);
- }
-
- num_tbP = num_tbP - 1;
- }
-
- data_ind.no_tb = nb_tb_read;
- data_ind.tb_size = tb_sizeP << 3;
- return data_ind;
-}
-//-----------------------------------------------------------------------------
-tbs_size_t mac_rlc_serialize_tb (char *buffer_pP, list_t transport_blocksP) {
- //-----------------------------------------------------------------------------
- mem_block_t *tb_p;
- tbs_size_t tbs_size;
- tbs_size_t tb_size;
- tbs_size = 0;
-
- while (transport_blocksP.nb_elements > 0) {
- tb_p = list_remove_head (&transport_blocksP);
-
- if (tb_p != NULL) {
- tb_size = ((struct mac_tb_req *) (tb_p->data))->tb_size;
-#ifdef DEBUG_MAC_INTERFACE
- LOG_T(RLC, "[MAC-RLC] DUMP TX PDU(%d bytes):\n", tb_size);
- rlc_util_print_hex_octets(RLC, ((struct mac_tb_req *) (tb_p->data))->data_ptr, tb_size);
-#endif
- memcpy(&buffer_pP[tbs_size], &((struct mac_tb_req *) (tb_p->data))->data_ptr[0], tb_size);
- tbs_size = tbs_size + tb_size;
- free_mem_block(tb_p, __func__);
- }
- }
-
- return tbs_size;
-}
-//-----------------------------------------------------------------------------
-tbs_size_t mac_rlc_data_req(
- const module_id_t module_idP,
- const rnti_t rntiP,
- const eNB_index_t eNB_index,
- const frame_t frameP,
- const eNB_flag_t enb_flagP,
- const MBMS_flag_t MBMS_flagP,
- const logical_chan_id_t channel_idP,
- const tb_size_t tb_sizeP,
- char *buffer_pP,
- const uint32_t sourceL2Id,
- const uint32_t destinationL2Id
-) {
- //-----------------------------------------------------------------------------
- struct mac_data_req data_request;
- rlc_mode_t rlc_mode = RLC_MODE_NONE;
- rlc_mbms_id_t *mbms_id_p = NULL;
- rlc_union_t *rlc_union_p = NULL;
- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_rc;
- srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO;
- tbs_size_t ret_tb_size = 0;
- protocol_ctxt_t ctxt;
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, enb_flagP, rntiP, frameP, 0,eNB_index);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_REQ,VCD_FUNCTION_IN);
-#ifdef DEBUG_MAC_INTERFACE
- LOG_D(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_REQ channel %d (%d) MAX RB %d\n",
- PROTOCOL_CTXT_ARGS((&ctxt)),
- channel_idP,
- RLC_MAX_LC,
- NB_RB_MAX);
-#endif // DEBUG_MAC_INTERFACE
-
- if (MBMS_flagP) {
- //AssertFatal (channel_idP < RLC_MAX_MBMS_LC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC);
- if(channel_idP >= RLC_MAX_MBMS_LC) {
- LOG_E(RLC, "channel id is too high (%u/%d)!\n", channel_idP, RLC_MAX_MBMS_LC);
- return 0;
- }
- } else {
- //AssertFatal (channel_idP < NB_RB_MAX, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX);
- if(channel_idP >= NB_RB_MAX) {
- LOG_E(RLC, "channel id is too high (%u/%d)!\n", channel_idP, NB_RB_MAX);
- return 0;
- }
- }
-
- if (MBMS_flagP) {
- if (enb_flagP) {
- mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[module_idP][channel_idP];
- key = RLC_COLL_KEY_MBMS_VALUE(module_idP, rntiP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id);
- } else {
- return (tbs_size_t)0;
- }
- } else {
- key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag);
-
- if ((sourceL2Id > 0) && (destinationL2Id > 0))
- key = RLC_COLL_KEY_LCID_SOURCE_DEST_VALUE(module_idP, rntiP, enb_flagP, channel_idP, sourceL2Id, destinationL2Id, srb_flag);
- }
-
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- rlc_mode = rlc_union_p->mode;
- } else {
- rlc_mode = RLC_MODE_NONE;
- //AssertFatal (0 , "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP);
- LOG_E(RLC, "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP);
- }
-
- switch (rlc_mode) {
- case RLC_MODE_NONE:
- ret_tb_size =0;
- break;
-
- case RLC_MODE_AM:
- rlc_am_mui.rrc_mui_num = 0;
-
- ((rlc_am_entity_t *) &rlc_union_p->rlc.am)->nb_bytes_requested_by_mac = tb_sizeP;
- data_request = rlc_am_mac_data_request(&ctxt, &rlc_union_p->rlc.am,enb_flagP);
- ret_tb_size =mac_rlc_serialize_tb(buffer_pP, data_request.data);
- break;
-
- case RLC_MODE_UM:
- ((rlc_um_entity_t *) &rlc_union_p->rlc.um)->nb_bytes_requested_by_mac = tb_sizeP;
- data_request = rlc_um_mac_data_request(&ctxt, &rlc_union_p->rlc.um,enb_flagP);
- ret_tb_size = mac_rlc_serialize_tb(buffer_pP, data_request.data);
- break;
-
- case RLC_MODE_TM:
- ((rlc_tm_entity_t *) &rlc_union_p->rlc.tm)->rlc_pdu_size = tb_sizeP;
- data_request = rlc_tm_mac_data_request(&ctxt, &rlc_union_p->rlc.tm);
- ret_tb_size = mac_rlc_serialize_tb(buffer_pP, data_request.data);
- break;
-
- default:
- ;
- }
-
-#if T_TRACER
-
- if (enb_flagP)
- T(T_ENB_RLC_MAC_DL, T_INT(module_idP), T_INT(rntiP), T_INT(channel_idP), T_INT(ret_tb_size));
-
-#endif
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return ret_tb_size;
-}
-//-----------------------------------------------------------------------------
-void mac_rlc_data_ind (
- const module_id_t module_idP,
- const rnti_t rntiP,
- const eNB_index_t eNB_index,
- const frame_t frameP,
- const eNB_flag_t enb_flagP,
- const MBMS_flag_t MBMS_flagP,
- const logical_chan_id_t channel_idP,
- char *buffer_pP,
- const tb_size_t tb_sizeP,
- num_tb_t num_tbP,
- crc_t *crcs_pP) {
- //-----------------------------------------------------------------------------
- rlc_mode_t rlc_mode = RLC_MODE_NONE;
- rlc_mbms_id_t *mbms_id_p = NULL;
- rlc_union_t *rlc_union_p = NULL;
- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_rc;
- srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO;
- protocol_ctxt_t ctxt;
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, enb_flagP, rntiP, frameP, 0, eNB_index);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_IND,VCD_FUNCTION_IN);
-#ifdef DEBUG_MAC_INTERFACE
-
- if (num_tbP) {
- LOG_D(RLC, PROTOCOL_CTXT_FMT" MAC_RLC_DATA_IND on channel %d (%d), rb max %d, tb_sizeP %d\n",
- PROTOCOL_CTXT_ARGS(&ctxt),
- channel_idP,
- RLC_MAX_LC,
- NB_RB_MAX,
- tb_sizeP);
- }
-
-#endif // DEBUG_MAC_INTERFACE
-#if T_TRACER
-
- if (enb_flagP)
- T(T_ENB_RLC_MAC_UL, T_INT(module_idP), T_INT(rntiP), T_INT(channel_idP), T_INT(tb_sizeP));
-
-#endif
-
- if (MBMS_flagP) {
- if (BOOL_NOT(enb_flagP)) {
- mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[module_idP][channel_idP];
- key = RLC_COLL_KEY_MBMS_VALUE(module_idP, rntiP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id);
- } else {
- return;
- }
- } else {
- key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag);
- }
-
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- rlc_mode = rlc_union_p->mode;
- } else {
- rlc_mode = RLC_MODE_NONE;
- //AssertFatal (0 , "%s RLC not configured lcid %u ! (h_rc %d)\n", __FUNCTION__,channel_idP,h_rc);
- }
-
- struct mac_data_ind data_ind = mac_rlc_deserialize_tb(buffer_pP, tb_sizeP, num_tbP, crcs_pP);
-
- switch (rlc_mode) {
- case RLC_MODE_NONE:
- //handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
- list_free (&data_ind.data);
- break;
-
- case RLC_MODE_AM:
- rlc_am_mac_data_indication(&ctxt, &rlc_union_p->rlc.am, data_ind);
- break;
-
- case RLC_MODE_UM:
- rlc_um_mac_data_indication(&ctxt, &rlc_union_p->rlc.um, data_ind);
- break;
-
- case RLC_MODE_TM:
- rlc_tm_mac_data_indication(&ctxt, &rlc_union_p->rlc.tm, data_ind);
- break;
- }
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_IND,VCD_FUNCTION_OUT);
-}
-//-----------------------------------------------------------------------------
-mac_rlc_status_resp_t mac_rlc_status_ind(
- const module_id_t module_idP,
- const rnti_t rntiP,
- const eNB_index_t eNB_index,
- const frame_t frameP,
- const sub_frame_t subframeP,
- const eNB_flag_t enb_flagP,
- const MBMS_flag_t MBMS_flagP,
- const logical_chan_id_t channel_idP,
- const uint32_t sourceL2Id,
- const uint32_t destinationL2Id
-) {
- //-----------------------------------------------------------------------------
- mac_rlc_status_resp_t mac_rlc_status_resp;
- struct mac_status_ind tx_status;
- struct mac_status_resp status_resp;
- rlc_mode_t rlc_mode = RLC_MODE_NONE;
- rlc_mbms_id_t *mbms_id_p = NULL;
- rlc_union_t *rlc_union_p = NULL;
- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_rc;
- srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO;
- protocol_ctxt_t ctxt;
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, enb_flagP, rntiP, frameP, subframeP, eNB_index);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_STATUS_IND,VCD_FUNCTION_IN);
- memset (&mac_rlc_status_resp, 0, sizeof(mac_rlc_status_resp_t));
- memset (&tx_status, 0, sizeof(struct mac_status_ind));
-
- if (MBMS_flagP) {
- if (enb_flagP) {
- mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[module_idP][channel_idP];
- } else {
- mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[module_idP][channel_idP];
- }
-
- key = RLC_COLL_KEY_MBMS_VALUE(module_idP, rntiP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id);
- } else {
- if ((sourceL2Id > 0) && (destinationL2Id > 0)) {
- key = RLC_COLL_KEY_SOURCE_DEST_VALUE(module_idP, rntiP, enb_flagP, channel_idP, sourceL2Id, destinationL2Id, srb_flag);
- } else {
- key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag);
- }
- }
-
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- rlc_mode = rlc_union_p->mode;
- } else {
- rlc_mode = RLC_MODE_NONE;
- //LOG_W(RLC , "[%s] RLC not configured lcid %u module %u!\n", __FUNCTION__, channel_idP, module_idP);
- //LOG_D(RLC , "[%s] RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP);
- }
-
- switch (rlc_mode) {
- case RLC_MODE_NONE:
- //handle_event(WARNING,"FILE %s FONCTION mac_rlc_data_ind() LINE %s : no radio bearer configured :%d\n", __FILE__, __LINE__, channel_idP);
- mac_rlc_status_resp.bytes_in_buffer = 0;
- break;
-
- case RLC_MODE_AM:
- status_resp = rlc_am_mac_status_indication(&ctxt, &rlc_union_p->rlc.am, tx_status,enb_flagP);
- mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
- mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
- mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
- mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
- //return mac_rlc_status_resp;
- break;
-
- case RLC_MODE_UM:
- status_resp = rlc_um_mac_status_indication(&ctxt, &rlc_union_p->rlc.um, tx_status, enb_flagP);
- mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
- mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus;
- mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
- mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
- mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
- // return mac_rlc_status_resp;
- break;
-
- case RLC_MODE_TM:
- status_resp = rlc_tm_mac_status_indication(&ctxt, &rlc_union_p->rlc.tm, tx_status);
- mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes;
- mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus;
- // return mac_rlc_status_resp;
- break;
-
- default:
- mac_rlc_status_resp.bytes_in_buffer = 0 ;
- }
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_STATUS_IND,VCD_FUNCTION_OUT);
- return mac_rlc_status_resp;
-}
-
-//-----------------------------------------------------------------------------
-rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(
- const module_id_t module_idP,
- const rnti_t rntiP,
- const eNB_index_t eNB_index,
- const frame_t frameP,
- const sub_frame_t subframeP,
- const eNB_flag_t enb_flagP,
- const logical_chan_id_t channel_idP) {
- //-----------------------------------------------------------------------------
- rlc_buffer_occupancy_t mac_rlc_buffer_occupancy_resp = 0;
- rlc_mode_t rlc_mode = RLC_MODE_NONE;
- rlc_union_t *rlc_union_p = NULL;
- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_rc;
- srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO;
- protocol_ctxt_t ctxt;
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, enb_flagP, rntiP, frameP, 0, eNB_index);
-
- //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_GET_BUFFER_OCCUPANCY_IND,VCD_FUNCTION_IN);
-
- /* Assumptions : for UE only */
- /* At each TTI, Buffer Occupancy is first computed in mac_rlc_status_ind called by MAC ue_scheduler() function */
- /* Then this function is called during MAC multiplexing ue_get_sdu(), and it may be call several times for the same bearer if it is in AM mode and there are several PDU types to transmit */
- //AssertFatal(enb_flagP == false,"RLC Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%d\n", channel_idP);
- if(enb_flagP != false) {
- LOG_E(RLC, "Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%u\n", channel_idP);
- return 0;
- }
-
- key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag);
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- rlc_mode = rlc_union_p->mode;
- } else {
- rlc_mode = RLC_MODE_NONE;
- //LOG_W(RLC , "[%s] RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP);
- //LOG_D(RLC , "[%s] RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP);
- }
-
- switch (rlc_mode) {
- case RLC_MODE_AM:
- mac_rlc_buffer_occupancy_resp = rlc_am_get_buffer_occupancy_in_bytes(&ctxt, &rlc_union_p->rlc.am);
- break;
-
- case RLC_MODE_UM:
- mac_rlc_buffer_occupancy_resp = rlc_um_get_buffer_occupancy(&rlc_union_p->rlc.um);
- break;
-
- default:
- mac_rlc_buffer_occupancy_resp = 0 ;
- }
-
- //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_GET_BUFFER_OCCUPANCY_IND,VCD_FUNCTION_OUT);
- return mac_rlc_buffer_occupancy_resp;
-}
-
-
diff --git a/openair2/LAYER2/RLC/rlc_mpls.c b/openair2/LAYER2/RLC/rlc_mpls.c
deleted file mode 100644
index 754f1e76aa..0000000000
--- a/openair2/LAYER2/RLC/rlc_mpls.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*
- rlc_mpls.c
- -------------------
- AUTHOR : Lionel GAUTHIER
- COMPANY : EURECOM
- EMAIL : Lionel.Gauthier@eurecom.fr
-*/
-
-#define RLC_MPLS_C
-#include "rlc.h"
-
-
-//-----------------------------------------------------------------------------
-rlc_op_status_t mpls_rlc_data_req (
- const protocol_ctxt_t *const ctxtP,
- const rb_id_t rb_idP,
- const sdu_size_t sdu_sizeP,
- mem_block_t *const sduP) {
- //-----------------------------------------------------------------------------
- // third arg should be set to 1 or 0
- return rlc_data_req(ctxtP, SRB_FLAG_NO, MBMS_FLAG_NO, rb_idP, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, sdu_sizeP, sduP,NULL, NULL );
-}
-
diff --git a/openair2/LAYER2/RLC/rlc_primitives.h b/openair2/LAYER2/RLC/rlc_primitives.h
deleted file mode 100644
index 0e751855d5..0000000000
--- a/openair2/LAYER2/RLC/rlc_primitives.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file rlc_primitives.h
-* \brief This file contains constants definition for RLC primitives.
-* \author GAUTHIER Lionel
-* \date 2010-2011
-* \version
-* \note
-* \bug
-* \warning
-*/
-#ifndef __RLC_PRIMITIVES_H__
-# define __RLC_PRIMITIVES_H__
-
-# include
-# include
-# include "platform_types.h"
-#include "common/platform_constants.h"
-# include "mem_block.h"
-
-
-# define RLC_NO_SAP RLC_NONE
-# define RLC_AM_SAP RLC_MODE_AM
-# define RLC_UM_SAP RLC_MODE_UM
-# define RLC_TM_SAP RLC_MODE_TM
-//----------------------------------------------------------
-// primitives
-//----------------------------------------------------------
-# define RLC_AM_DATA_REQ 0x01
-# define RLC_UM_DATA_REQ 0x02
-# define RLC_TM_DATA_REQ 0x04
-
-# define RLC_AM_DATA_IND 0x08
-# define RLC_UM_DATA_IND 0x10
-# define RLC_TM_DATA_IND 0x20
-
-# define RLC_AM_DATA_CNF 0x40
-//----------------------------------------------------------
-// control primitives
-//----------------------------------------------------------
-# define CRLC_CONFIG_REQ 0x81
-# define CRLC_SUSPEND_REQ 0x82
-# define CRLC_SUSPEND_CONF 0x84
-# define CRLC_RESUME_REQ 0x88
-# define CRLC_STATUS_IND 0x90
-//----------------------------------------------------------
-// primitives definition
-//----------------------------------------------------------
-# define RLC_AM_SDU_MNGT_LAST_PDU_SN_EXTENDS_ABOVE_CONF_TX_WINDOW 0X4000
-# define RLC_AM_SDU_MNGT_LAST_PDU_SN_UNKNOWN 0X8000
-# define RLC_TX_CONFIRM_SUCCESSFULL 0xCF
-# define RLC_TX_CONFIRM_FAILURE 0xFA
-
-struct rlc_am_data_req {
- //struct rlc_am_sdu_management sdu_mngt;
- uint32_t mui;
- uint16_t data_size; // in bytes
- uint16_t data_offset; // beginning of payload data may not start just after the header (PDCP header compression, etc)
- uint8_t conf; // confirm of sdu delivery to the peer entity
-};
-
-struct rlc_tm_data_req {
- uint16_t data_size; // in bits
- uint16_t data_offset; // beginning of payload data may not start just after the header (PDCP header compression, etc)
-};
-
-
-struct rlc_um_data_req {
- uint16_t data_size; // in bytes
- uint16_t data_offset; // beginning of payload data may not start just after the header (PDCP header compression, etc)
- uint8_t use_special_li;
-};
-
-typedef struct rlc_am_data_req rlc_am_data_req_t;
-typedef struct rlc_tm_data_req rlc_tm_data_req_t;
-typedef struct rlc_um_data_req rlc_um_data_req_t;
-
-//----------------------------------------------------------
-// control primitives definition
-//----------------------------------------------------------
-# define RLC_E_R_RELEASE 0x00
-# define RLC_E_R_MODIFICATION 0x01
-# define RLC_E_R_ESTABLISHMENT 0x02
-# define RLC_E_R_RE_ESTABLISHMENT 0x04
-# define RLC_STOP 0x08
-# define RLC_CONTINUE 0x10
-
-# define RLC_TM_SEGMENTATION_NOT_ALLOWED 0x00
-# define RLC_TM_SEGMENTATION_ALLOWED 0x01
-
-# define RLC_TM_DELIVERY_OF_ERRONEOUS_SDU_NO 0x01
-# define RLC_TM_DELIVERY_OF_ERRONEOUS_SDU_YES 0x02
-# define RLC_TM_DELIVERY_OF_ERRONEOUS_SDU_NO_DETECT 0x04
-
-
-struct rlc_am_parameters {
- uint8_t rb_id;
- uint8_t e_r; // reestablishment, release or modification of the rlc
- uint8_t stop;
- uint8_t cont; // continue
- // timers
- uint32_t *frame_tick_milliseconds;
-
- uint16_t timer_poll;
- uint16_t timer_poll_prohibit;
- uint16_t timer_epc;
- uint16_t timer_discard;
- uint16_t timer_poll_periodic;
- uint16_t timer_status_prohibit;
- uint16_t timer_status_periodic;
- uint16_t timer_rst;
- uint8_t max_rst;
- uint16_t timer_mrw;
-
- // protocol_parameters
- uint16_t pdu_size; // in bits
- uint8_t missing_pdu_indicator;
- uint8_t in_sequence_delivery; // no action : this version always deliver sdus in sequence
- uint16_t max_dat;
- uint16_t poll_pdu;
- uint16_t poll_sdu;
- uint8_t poll_window; // in percent of the window
- uint16_t configured_tx_window_size;
- uint16_t configured_rx_window_size;
- uint16_t max_mrw;
-
- uint8_t last_transmission_pdu_poll_trigger;
- uint8_t last_retransmission_pdu_poll_trigger;
- uint8_t sdu_discard_mode;
- uint8_t send_mrw;
-};
-
-struct rlc_um_parameters {
- uint32_t *frame_tick_milliseconds;
- uint8_t rb_id;
- uint8_t e_r; // reestablishment, release or modification of the rlc
- uint8_t stop;
- uint8_t cont; // continue
- uint8_t sdu_discard_mode;
- uint16_t timer_discard;
- uint16_t size_input_sdus_buffer;
-};
-
-struct rlc_tm_parameters {
- uint32_t *frame_tick_milliseconds;
- uint8_t rb_id;
- uint8_t e_r; // reestablishment, release or modification of the rlc
- uint8_t sdu_discard_mode;
- uint8_t segmentation_indication;
- uint8_t delivery_of_erroneous_sdu;
- uint16_t timer_discard;
- uint16_t size_input_sdus_buffer;
-};
-
-
-struct crlc_config_req {
- union {
- struct rlc_am_parameters am_parameters;
- struct rlc_um_parameters um_parameters;
- struct rlc_tm_parameters tm_parameters;
- } parameters;
-};
-
-struct crlc_suspend_conf {
- uint16_t vt_s_or_vt_us;
-};
-
-struct crlc_resume_req {
- // no parameters
- uint8_t todo;
-};
-
-struct crlc_status_ind {
- uint16_t evc;
-};
-
-struct crlc_primitive {
- uint8_t type;
- union {
- struct crlc_config_req c_config_req;
- struct crlc_suspend_conf c_suspend_conf;
- struct crlc_resume_req c_resume_req;
- struct crlc_status_ind c_status_ind;
- } primitive;
-};
-
-#endif
diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c
deleted file mode 100644
index ed9af5efb2..0000000000
--- a/openair2/LAYER2/RLC/rlc_rrc.c
+++ /dev/null
@@ -1,788 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*
- rlc_rrc.c
- -------------------
- AUTHOR : Lionel GAUTHIER
- COMPANY : EURECOM
- EMAIL : Lionel.Gauthier at eurecom dot fr
-*/
-
-#define RLC_RRC_C
-#include "rlc.h"
-#include "rlc_am.h"
-#include "rlc_um.h"
-#include "rlc_tm.h"
-#include "common/utils/LOG/log.h"
-#include "LTE_RLC-Config.h"
-#include "LTE_DRB-ToAddMod.h"
-#include "LTE_DRB-ToAddModList.h"
-#include "LTE_SRB-ToAddMod.h"
-#include "LTE_SRB-ToAddModList.h"
-#include "LTE_DL-UM-RLC.h"
-#include "LTE_PMCH-InfoList-r9.h"
-
-#include "LAYER2/MAC/mac_extern.h"
-#include "assertions.h"
-//-----------------------------------------------------------------------------
-rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t *const ctxt_pP,
- const LTE_SRB_ToAddModList_t *const srb2add_listP,
- const LTE_DRB_ToAddModList_t *const drb2add_listP,
- const LTE_DRB_ToReleaseList_t *const drb2release_listP,
- const LTE_PMCH_InfoList_r9_t *const pmch_InfoList_r9_pP,
- const uint32_t sourceL2Id,
- const uint32_t destinationL2Id
-
- ) {
- //-----------------------------------------------------------------------------
- rb_id_t rb_id = 0;
- logical_chan_id_t lc_id = 0;
- LTE_DRB_Identity_t drb_id = 0;
- LTE_DRB_Identity_t *pdrb_id = NULL;
- long int cnt = 0;
- const LTE_SRB_ToAddMod_t *srb_toaddmod_p = NULL;
- const LTE_DRB_ToAddMod_t *drb_toaddmod_p = NULL;
- rlc_union_t *rlc_union_p = NULL;
- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_rc;
- int i, j;
- LTE_MBMS_SessionInfoList_r9_t *mbms_SessionInfoList_r9_p = NULL;
- LTE_MBMS_SessionInfo_r9_t *MBMS_SessionInfo_p = NULL;
- mbms_session_id_t mbms_session_id;
- mbms_service_id_t mbms_service_id;
- LTE_DL_UM_RLC_t dl_um_rlc;
- /* for no gcc warnings */
- (void)rlc_union_p;
- (void)key;
- (void)h_rc;
- LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ ASN1 \n",
- PROTOCOL_CTXT_ARGS(ctxt_pP));
-
- if (srb2add_listP != NULL) {
- for (cnt=0; cntlist.count; cnt++) {
- rb_id = srb2add_listP->list.array[cnt]->srb_Identity;
- lc_id = rb_id;
- LOG_D(RLC, "Adding SRB %ld, rb_id %ld\n",srb2add_listP->list.array[cnt]->srb_Identity,rb_id);
- srb_toaddmod_p = srb2add_listP->list.array[cnt];
-
- if (srb_toaddmod_p->rlc_Config) {
- switch (srb_toaddmod_p->rlc_Config->present) {
- case LTE_SRB_ToAddMod__rlc_Config_PR_NOTHING:
- break;
-
- case LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue:
- switch (srb_toaddmod_p->rlc_Config->choice.explicitValue.present) {
- case LTE_RLC_Config_PR_NOTHING:
- break;
-
- case LTE_RLC_Config_PR_am:
- if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_AM,0, 0 ) != NULL) {
- config_req_rlc_am_asn1 (
- ctxt_pP,
- SRB_FLAG_YES,
- &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am,
- rb_id, lc_id);
- } else {
- LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_id);
- }
-
- break;
-
- case LTE_RLC_Config_PR_um_Bi_Directional:
- if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM,0,0 ) != NULL) {
- config_req_rlc_um_asn1(
- ctxt_pP,
- SRB_FLAG_YES,
- MBMS_FLAG_NO,
- UNUSED_PARAM_MBMS_SESSION_ID,
- UNUSED_PARAM_MBMS_SERVICE_ID,
- &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.ul_UM_RLC,
- &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.dl_UM_RLC,
- rb_id, lc_id,0, 0
- );
- } else {
- LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_id);
- }
-
- break;
-
- case LTE_RLC_Config_PR_um_Uni_Directional_UL:
- if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM,0, 0 ) != NULL) {
- config_req_rlc_um_asn1(
- ctxt_pP,
- SRB_FLAG_YES,
- MBMS_FLAG_NO,
- UNUSED_PARAM_MBMS_SESSION_ID,
- UNUSED_PARAM_MBMS_SERVICE_ID,
- &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_UL.ul_UM_RLC,
- NULL,
- rb_id, lc_id,0, 0
- );
- } else {
- LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_id);
- }
-
- break;
-
- case LTE_RLC_Config_PR_um_Uni_Directional_DL:
- if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM,0, 0 ) != NULL) {
- config_req_rlc_um_asn1(
- ctxt_pP,
- SRB_FLAG_YES,
- MBMS_FLAG_NO,
- UNUSED_PARAM_MBMS_SESSION_ID,
- UNUSED_PARAM_MBMS_SERVICE_ID,
- NULL,
- &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_DL.dl_UM_RLC,
- rb_id, lc_id,0, 0
- );
- } else {
- LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_id);
- }
-
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_CTXT_FMT" UNKNOWN RLC CONFIG %d \n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- srb_toaddmod_p->rlc_Config->choice.explicitValue.present);
- break;
- }
-
- break;
-
- case LTE_SRB_ToAddMod__rlc_Config_PR_defaultValue:
- //#warning TO DO SRB_ToAddMod__rlc_Config_PR_defaultValue
- LOG_I(RRC, "RLC SRB1 is default value !!\n");
- struct LTE_RLC_Config__am *config_am_pP = &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am;
- config_am_pP->dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35;
- config_am_pP->dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms0;
- config_am_pP->ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms45;
- config_am_pP->ul_AM_RLC.pollPDU = LTE_PollPDU_pInfinity;
- config_am_pP->ul_AM_RLC.pollByte = LTE_PollByte_kBinfinity;
- config_am_pP->ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t4;
-
- if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_AM,0, 0 ) != NULL) {
- config_req_rlc_am_asn1 (
- ctxt_pP,
- SRB_FLAG_YES,
- &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am,
- rb_id,lc_id);
- } else {
- LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_id);
- }
-
- /*
- if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) {
- config_req_rlc_um_asn1(
- ctxt_pP,
- SRB_FLAG_YES,
- MBMS_FLAG_NO,
- UNUSED_PARAM_MBMS_SESSION_ID,
- UNUSED_PARAM_MBMS_SERVICE_ID,
- NULL, // TO DO DEFAULT CONFIG
- NULL, // TO DO DEFAULT CONFIG
- rb_id, lc_id);
- } else {
- LOG_D(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_id);
- }
- */
- break;
-
- default:
- ;
- }
- }
- }
- }
-
- if (drb2add_listP != NULL) {
- for (cnt=0; cntlist.count; cnt++) {
- drb_toaddmod_p = drb2add_listP->list.array[cnt];
- drb_id = drb_toaddmod_p->drb_Identity;
-
- if (drb_toaddmod_p->logicalChannelIdentity) {
- lc_id = *drb_toaddmod_p->logicalChannelIdentity;
- } else {
- LOG_E(RLC, PROTOCOL_CTXT_FMT" logicalChannelIdentity is missing from drb-ToAddMod information element!\n", PROTOCOL_CTXT_ARGS(ctxt_pP));
- continue;
- }
-
- if (lc_id == 1 || lc_id == 2) {
- LOG_E(RLC, PROTOCOL_CTXT_FMT" logicalChannelIdentity = %d is invalid in RRC message when adding DRB!\n", PROTOCOL_CTXT_ARGS(ctxt_pP), lc_id);
- continue;
- }
-
- LOG_D(RLC, "Adding DRB %ld, lc_id %d\n",drb_id,lc_id);
-
- if (drb_toaddmod_p->rlc_Config) {
- switch (drb_toaddmod_p->rlc_Config->present) {
- case LTE_RLC_Config_PR_NOTHING:
- break;
-
- case LTE_RLC_Config_PR_am:
- if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_AM,0, 0 ) != NULL) {
- config_req_rlc_am_asn1 (
- ctxt_pP,
- SRB_FLAG_NO,
- &drb_toaddmod_p->rlc_Config->choice.am,
- drb_id, lc_id);
- }
-
- break;
-
- case LTE_RLC_Config_PR_um_Bi_Directional:
- if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM,sourceL2Id,destinationL2Id) != NULL) {
- config_req_rlc_um_asn1(
- ctxt_pP,
- SRB_FLAG_NO,
- MBMS_FLAG_NO,
- UNUSED_PARAM_MBMS_SESSION_ID,
- UNUSED_PARAM_MBMS_SERVICE_ID,
- &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.ul_UM_RLC,
- &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.dl_UM_RLC,
- drb_id, lc_id,
- sourceL2Id,
- destinationL2Id
- );
- }
-
- break;
-
- case LTE_RLC_Config_PR_um_Uni_Directional_UL:
- if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM,0,0) != NULL) {
- config_req_rlc_um_asn1(
- ctxt_pP,
- SRB_FLAG_NO,
- MBMS_FLAG_NO,
- UNUSED_PARAM_MBMS_SESSION_ID,
- UNUSED_PARAM_MBMS_SERVICE_ID,
- &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_UL.ul_UM_RLC,
- NULL,
- drb_id, lc_id,0, 0
- );
- }
-
- break;
-
- case LTE_RLC_Config_PR_um_Uni_Directional_DL:
- if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM,0,0 ) != NULL) {
- config_req_rlc_um_asn1(
- ctxt_pP,
- SRB_FLAG_NO,
- MBMS_FLAG_NO,
- UNUSED_PARAM_MBMS_SESSION_ID,
- UNUSED_PARAM_MBMS_SERVICE_ID,
- NULL,
- &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_DL.dl_UM_RLC,
- drb_id, lc_id,0, 0
- );
- }
-
- break;
-
- default:
- LOG_W(RLC, PROTOCOL_CTXT_FMT"[RB %ld] unknown drb_toaddmod_p->rlc_Config->present \n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- drb_id);
- }
- }
- }
- }
-
- if (drb2release_listP != NULL) {
- for (cnt=0; cntlist.count; cnt++) {
- pdrb_id = drb2release_listP->list.array[cnt];
- rrc_rlc_remove_rlc(
- ctxt_pP,
- SRB_FLAG_NO,
- MBMS_FLAG_NO,
- *pdrb_id);
- }
- }
-
- if (pmch_InfoList_r9_pP != NULL) {
- for (i=0; ilist.count; i++) {
- mbms_SessionInfoList_r9_p = &(pmch_InfoList_r9_pP->list.array[i]->mbms_SessionInfoList_r9);
-
- for (j=0; jlist.count; j++) {
- MBMS_SessionInfo_p = mbms_SessionInfoList_r9_p->list.array[j];
-
- if (0/*MBMS_SessionInfo_p->sessionId_r9*/)
- mbms_session_id = MBMS_SessionInfo_p->sessionId_r9->buf[0];
- else
- mbms_session_id = MBMS_SessionInfo_p->logicalChannelIdentity_r9;
-
- lc_id = mbms_session_id;
- mbms_service_id = MBMS_SessionInfo_p->tmgi_r9.serviceId_r9.buf[2]; //serviceId is 3-octet string
- // mbms_service_id = j;
-
- // can set the mch_id = i
- if (ctxt_pP->enb_flag) {
- rb_id = (mbms_service_id * LTE_maxSessionPerPMCH ) + mbms_session_id;//+ (LTE_maxDRB + 3) * MAX_MOBILES_PER_ENB; // 1
- rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lc_id].service_id = mbms_service_id;
- rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lc_id].session_id = mbms_session_id;
- rlc_mbms_enb_set_lcid_by_rb_id(ctxt_pP->module_id,rb_id,lc_id);
- } else {
- rb_id = (mbms_service_id * LTE_maxSessionPerPMCH ) + mbms_session_id; // + (LTE_maxDRB + 3); // 15
- rlc_mbms_lcid2service_session_id_ue[ctxt_pP->module_id][lc_id].service_id = mbms_service_id;
- rlc_mbms_lcid2service_session_id_ue[ctxt_pP->module_id][lc_id].session_id = mbms_session_id;
- rlc_mbms_ue_set_lcid_by_rb_id(ctxt_pP->module_id,rb_id,lc_id);
- }
-
- key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->module_id, ctxt_pP->enb_flag, mbms_service_id, mbms_session_id);
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) {
- rlc_union_p = rrc_rlc_add_rlc (
- ctxt_pP,
- SRB_FLAG_NO,
- MBMS_FLAG_YES,
- rb_id,
- lc_id,
- RLC_MODE_UM, 0, 0);
-
- //AssertFatal(rlc_union_p != NULL, "ADD MBMS RLC UM FAILED");
- if(rlc_union_p == NULL) {
- LOG_E(RLC, "ADD MBMS RLC UM FAILED\n");
- }
- }
-
- LOG_I(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ MBMS ASN1 LC ID %u RB ID %ld SESSION ID %u SERVICE ID %u\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- lc_id,
- rb_id,
- mbms_session_id,
- mbms_service_id
- );
- dl_um_rlc.sn_FieldLength = LTE_SN_FieldLength_size5;
- dl_um_rlc.t_Reordering = LTE_T_Reordering_ms0;
- config_req_rlc_um_asn1 (
- ctxt_pP,
- SRB_FLAG_NO,
- MBMS_FLAG_YES,
- mbms_session_id,
- mbms_service_id,
- NULL,
- &dl_um_rlc,
- rb_id, lc_id,0, 0
- );
- }
- }
- }
-
- LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ ASN1 END \n",
- PROTOCOL_CTXT_ARGS(ctxt_pP));
- return RLC_OP_STATUS_OK;
-}
-//-----------------------------------------------------------------------------
-void
-rb_free_rlc_union (
- void *rlcu_pP) {
- //-----------------------------------------------------------------------------
- rlc_union_t *rlcu_p;
-
- if (rlcu_pP) {
- rlcu_p = (rlc_union_t *)(rlcu_pP);
- LOG_D(RLC,"%s %p \n",__FUNCTION__,rlcu_pP);
-
- switch (rlcu_p->mode) {
- case RLC_MODE_AM:
- rlc_am_cleanup(&rlcu_p->rlc.am);
- break;
-
- case RLC_MODE_UM:
- rlc_um_cleanup(&rlcu_p->rlc.um);
- break;
-
- case RLC_MODE_TM:
- rlc_tm_cleanup(&rlcu_p->rlc.tm);
- break;
-
- default:
- LOG_W(RLC,
- "%s %p unknown RLC type\n",
- __FUNCTION__,
- rlcu_pP);
- break;
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-rlc_op_status_t rrc_rlc_remove_ue (
- const protocol_ctxt_t *const ctxt_pP) {
- //-----------------------------------------------------------------------------
- rb_id_t rb_id;
-
- for (rb_id = 1; rb_id <= 2; rb_id++) {
- rrc_rlc_remove_rlc(ctxt_pP,
- SRB_FLAG_YES,
- MBMS_FLAG_NO,
- rb_id);
- }
-
- for (rb_id = 1; rb_id <= LTE_maxDRB; rb_id++) {
- rrc_rlc_remove_rlc(ctxt_pP,
- SRB_FLAG_NO,
- MBMS_FLAG_NO,
- rb_id);
- }
-
- return RLC_OP_STATUS_OK;
-}
-
-//-----------------------------------------------------------------------------
-rlc_op_status_t rrc_rlc_remove_rlc (
- const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const MBMS_flag_t MBMS_flagP,
- const rb_id_t rb_idP) {
- //-----------------------------------------------------------------------------
- logical_chan_id_t lcid = 0;
- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_rc;
- hash_key_t key_lcid = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_lcid_rc;
- rlc_union_t *rlc_union_p = NULL;
- rlc_mbms_id_t *mbms_id_p = NULL;
- /* for no gcc warnings */
- (void)lcid;
-
- if (MBMS_flagP == true) {
- if (ctxt_pP->enb_flag) {
- lcid = rlc_mbms_enb_get_lcid_by_rb_id(ctxt_pP->module_id,rb_idP);
- mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid];
- rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].service_id = 0;
- rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].session_id = 0;
- rlc_mbms_rbid2lcid_ue[ctxt_pP->module_id][rb_idP] = RLC_LC_UNALLOCATED;
- } else {
- lcid = rlc_mbms_ue_get_lcid_by_rb_id(ctxt_pP->module_id,rb_idP);
- mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ctxt_pP->module_id][lcid];
- rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].service_id = 0;
- rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].session_id = 0;
- rlc_mbms_rbid2lcid_ue[ctxt_pP->module_id][rb_idP] = RLC_LC_UNALLOCATED;
- }
-
- key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id);
- } else {
- key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- }
-
- //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
- if(rb_idP >= NB_RB_MAX) {
- LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MAX);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
-
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- // also remove the hash-key created by LC-id
- switch (rlc_union_p->mode) {
- case RLC_MODE_AM:
- lcid = rlc_union_p->rlc.am.channel_id;
- break;
-
- case RLC_MODE_UM:
- lcid = rlc_union_p->rlc.um.channel_id;
- break;
-
- case RLC_MODE_TM:
- lcid = rlc_union_p->rlc.tm.channel_id;
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %ld] RLC mode is unknown!\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- (srb_flagP) ? "SRB" : "DRB",
- rb_idP);
- }
-
- key_lcid = RLC_COLL_KEY_LCID_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, lcid, srb_flagP);
- h_lcid_rc = hashtable_get(rlc_coll_p, key_lcid, (void **)&rlc_union_p);
- } else {
- h_lcid_rc = HASH_TABLE_KEY_NOT_EXISTS;
- }
-
- if ((h_rc == HASH_TABLE_OK) && (h_lcid_rc == HASH_TABLE_OK)) {
- h_lcid_rc = hashtable_remove(rlc_coll_p, key_lcid);
- h_rc = hashtable_remove(rlc_coll_p, key);
- LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %ld LCID %d] RELEASED %s\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- (srb_flagP) ? "SRB" : "DRB",
- rb_idP, lcid,
- (srb_flagP) ? "SRB" : "DRB");
- } else if ((h_rc == HASH_TABLE_KEY_NOT_EXISTS) || (h_lcid_rc == HASH_TABLE_KEY_NOT_EXISTS)) {
- LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %ld LCID %d] RELEASE : RLC NOT FOUND %s, by RB-ID=%d, by LC-ID=%d\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- (srb_flagP) ? "SRB" : "DRB",
- rb_idP, lcid,
- (srb_flagP) ? "SRB" : "DRB",
- h_rc, h_lcid_rc);
- } else {
- LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %ld LCID %d] RELEASE : INTERNAL ERROR %s\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- (srb_flagP) ? "SRB" : "DRB",
- rb_idP, lcid,
- (srb_flagP) ? "SRB" : "DRB");
- }
-
- return RLC_OP_STATUS_OK;
-}
-//-----------------------------------------------------------------------------
-rlc_union_t *rrc_rlc_add_rlc (
- const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const MBMS_flag_t MBMS_flagP,
- const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP,
- const rlc_mode_t rlc_modeP,
- const uint32_t sourceL2Id,
- const uint32_t destinationL2Id
-) {
- //-----------------------------------------------------------------------------
- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_rc;
- hash_key_t key_lcid = HASHTABLE_NOT_A_KEY_VALUE;
- hashtable_rc_t h_lcid_rc;
- rlc_union_t *rlc_union_p = NULL;
- rlc_mbms_id_t *mbms_id_p = NULL;
- logical_chan_id_t lcid = 0;
-
- if (MBMS_flagP == false) {
- //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
- //AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
- if(rb_idP >= NB_RB_MAX) {
- LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MAX);
- return NULL;
- }
-
- if(chan_idP >= RLC_MAX_LC) {
- LOG_E(RLC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
- return NULL;
- }
- }
-
- if (MBMS_flagP == true) {
- if (ctxt_pP->enb_flag) {
- lcid = rlc_mbms_enb_get_lcid_by_rb_id(ctxt_pP->module_id,rb_idP);
- mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid];
- //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].service_id = 0;
- //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].session_id = 0;
- //LG 2014-04-15rlc_mbms_rbid2lcid_eNB[ctxt_pP->module_id][rb_idP] = RLC_LC_UNALLOCATED;
- } else {
- lcid = rlc_mbms_ue_get_lcid_by_rb_id(ctxt_pP->module_id,rb_idP);
- mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ctxt_pP->module_id][lcid];
- //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].service_id = 0;
- //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->module_id][lcid].session_id = 0;
- //LG 2014-04-15rlc_mbms_rbid2lcid_ue[ctxt_pP->module_id][rb_idP] = RLC_LC_UNALLOCATED;
- }
-
- key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id);
- } else {
- if ((sourceL2Id > 0) && (destinationL2Id > 0) ) {
- key = RLC_COLL_KEY_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, sourceL2Id, destinationL2Id, srb_flagP);
- key_lcid = RLC_COLL_KEY_LCID_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, chan_idP, sourceL2Id, destinationL2Id, srb_flagP);
- } else {
- key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- key_lcid = RLC_COLL_KEY_LCID_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, chan_idP, srb_flagP);
- }
- }
-
- h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
-
- if (h_rc == HASH_TABLE_OK) {
- LOG_W(RLC, PROTOCOL_CTXT_FMT"[%s %ld] rrc_rlc_add_rlc , already exist %s\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- (srb_flagP) ? "SRB" : "DRB",
- rb_idP,
- (srb_flagP) ? "SRB" : "DRB");
-
- //AssertFatal(rlc_union_p->mode == rlc_modeP, "Error rrc_rlc_add_rlc , already exist but RLC mode differ");
- if(rlc_union_p->mode != rlc_modeP) {
- LOG_E(RLC, "Error rrc_rlc_add_rlc , already exist but RLC mode differ\n");
- return NULL;
- }
-
- return rlc_union_p;
- } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) {
- rlc_union_p = calloc(1, sizeof(rlc_union_t));
- h_rc = hashtable_insert(rlc_coll_p, key, rlc_union_p);
- if(MBMS_flagP != true)
- h_lcid_rc = hashtable_insert(rlc_coll_p, key_lcid, rlc_union_p);
-
- if ((h_rc == HASH_TABLE_OK) && (h_lcid_rc == HASH_TABLE_OK)) {
- if (MBMS_flagP == true) {
- LOG_I(RLC, PROTOCOL_CTXT_FMT" RLC service id %u session id %u rrc_rlc_add_rlc\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- mbms_id_p->service_id,
- mbms_id_p->session_id);
- } else {
- LOG_I(RLC, PROTOCOL_CTXT_FMT" [%s %ld] rrc_rlc_add_rlc %s\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- (srb_flagP) ? "SRB" : "DRB",
- rb_idP,
- (srb_flagP) ? "SRB" : "DRB");
- }
-
- rlc_union_p->mode = rlc_modeP;
- return rlc_union_p;
- } else {
- LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %ld] rrc_rlc_add_rlc FAILED %s (add by RB_id=%d; add by LC_id=%d)\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- (srb_flagP) ? "SRB" : "DRB",
- rb_idP,
- (srb_flagP) ? "SRB" : "DRB",
- h_rc, h_lcid_rc);
- free(rlc_union_p);
- rlc_union_p = NULL;
- return NULL;
- }
- } else {
- LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %ld] rrc_rlc_add_rlc , INTERNAL ERROR %s\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- (srb_flagP) ? "SRB" : "DRB",
- rb_idP,
- (srb_flagP) ? "SRB" : "DRB");
- }
-
- return NULL;
-}
-//-----------------------------------------------------------------------------
-rlc_op_status_t rrc_rlc_config_req (
- const protocol_ctxt_t *const ctxt_pP,
- const srb_flag_t srb_flagP,
- const MBMS_flag_t mbms_flagP,
- const config_action_t actionP,
- const rb_id_t rb_idP,
- const rlc_info_t rlc_infoP) {
- //-----------------------------------------------------------------------------
- //rlc_op_status_t status;
- LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG_REQ for RAB %ld\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_idP);
-
- //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
- if(rb_idP >= NB_RB_MAX) {
- LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MAX);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
-
- switch (actionP) {
- case CONFIG_ACTION_ADD:
- if (rrc_rlc_add_rlc(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, rb_idP, rlc_infoP.rlc_mode,0, 0 ) != NULL) {
- return RLC_OP_STATUS_INTERNAL_ERROR;
- }
-
- // no break, fall to next case
- case CONFIG_ACTION_MODIFY:
- switch (rlc_infoP.rlc_mode) {
- case RLC_MODE_AM:
- LOG_I(RLC, PROTOCOL_CTXT_FMT"[RB %ld] MODIFY RB AM\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_idP);
- config_req_rlc_am(
- ctxt_pP,
- srb_flagP,
- &rlc_infoP.rlc.rlc_am_info,
- rb_idP, rb_idP);
- break;
-
- case RLC_MODE_UM:
- LOG_I(RLC, PROTOCOL_CTXT_FMT"[RB %ld] MODIFY RB UM\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_idP);
- config_req_rlc_um(
- ctxt_pP,
- srb_flagP,
- &rlc_infoP.rlc.rlc_um_info,
- rb_idP, rb_idP);
- break;
-
- case RLC_MODE_TM:
- LOG_I(RLC, PROTOCOL_CTXT_FMT"[RB %ld] MODIFY RB TM\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_idP);
- config_req_rlc_tm(
- ctxt_pP,
- srb_flagP,
- &rlc_infoP.rlc.rlc_tm_info,
- rb_idP, rb_idP);
- break;
-
- default:
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
-
- break;
-
- case CONFIG_ACTION_REMOVE:
- return rrc_rlc_remove_rlc(ctxt_pP, srb_flagP, mbms_flagP, rb_idP);
- break;
-
- default:
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
-
- return RLC_OP_STATUS_OK;
-}
-//-----------------------------------------------------------------------------
-rlc_op_status_t rrc_rlc_data_req (
- const protocol_ctxt_t *const ctxt_pP,
- const MBMS_flag_t MBMS_flagP,
- const rb_id_t rb_idP,
- const mui_t muiP,
- const confirm_t confirmP,
- const sdu_size_t sdu_sizeP,
- char *sduP) {
- //-----------------------------------------------------------------------------
- mem_block_t *sdu;
- sdu = get_free_mem_block(sdu_sizeP, __func__);
-
- if (sdu != NULL) {
- memcpy (sdu->data, sduP, sdu_sizeP);
- return rlc_data_req(ctxt_pP, SRB_FLAG_YES, MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, sdu,NULL, NULL );
- } else {
- return RLC_OP_STATUS_INTERNAL_ERROR;
- }
-}
-
-//-----------------------------------------------------------------------------
-void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t rrc_data_confP) {
- //-----------------------------------------------------------------------------
- rlc_rrc_data_ind = rrc_data_indP;
- rlc_rrc_data_conf = rrc_data_confP;
-}
-
diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c
index 182f4c385f..e632fb2024 100644
--- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c
+++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c
@@ -390,8 +390,11 @@ static void nr_pdcp_entity_get_stats(nr_pdcp_entity_t *entity,
nr_pdcp_entity_t *new_nr_pdcp_entity(
nr_pdcp_entity_type_t type,
- int is_gnb, int rb_id, int pdusession_id,int has_sdap,
- int has_sdapULheader, int has_sdapDLheader,
+ int is_gnb,
+ int rb_id,
+ int pdusession_id,
+ bool has_sdap_rx,
+ bool has_sdap_tx,
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
char *buf, int size),
void *deliver_sdu_data,
@@ -432,9 +435,8 @@ nr_pdcp_entity_t *new_nr_pdcp_entity(
ret->rb_id = rb_id;
ret->pdusession_id = pdusession_id;
- ret->has_sdap = has_sdap;
- ret->has_sdapULheader = has_sdapULheader;
- ret->has_sdapDLheader = has_sdapDLheader;
+ ret->has_sdap_rx = has_sdap_rx;
+ ret->has_sdap_tx = has_sdap_tx;
ret->sn_size = sn_size;
ret->t_reordering = t_reordering;
ret->discard_timer = discard_timer;
diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h
index ec76a598ac..4ad2508e4a 100644
--- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h
+++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h
@@ -102,9 +102,8 @@ typedef struct nr_pdcp_entity_t {
/* configuration variables */
int rb_id;
int pdusession_id;
- int has_sdap;
- int has_sdapULheader;
- int has_sdapDLheader;
+ bool has_sdap_rx;
+ bool has_sdap_tx;
int sn_size; /* SN size, in bits */
int t_reordering; /* unit: ms, -1 for infinity */
int discard_timer; /* unit: ms, -1 for infinity */
@@ -169,8 +168,11 @@ typedef struct nr_pdcp_entity_t {
nr_pdcp_entity_t *new_nr_pdcp_entity(
nr_pdcp_entity_type_t type,
- int is_gnb, int rb_id, int pdusession_id,int has_sdap,
- int has_sdapULheader,int has_sdapDLheader,
+ int is_gnb,
+ int rb_id,
+ int pdusession_id,
+ bool has_sdap_rx,
+ bool has_sdap_tx,
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
char *buf, int size),
void *deliver_sdu_data,
diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
index c0046a7713..fd1430420c 100644
--- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
+++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
@@ -617,7 +617,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
if (IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN) {
LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE ID/RNTI: %ld\n", size, ue->rntiMaybeUEid);
- sdap_data_ind(entity->rb_id, entity->is_gnb, entity->has_sdap, entity->has_sdapULheader, entity->pdusession_id, ue->rntiMaybeUEid, buf, size);
+ sdap_data_ind(entity->rb_id, entity->is_gnb, entity->has_sdap_rx, entity->pdusession_id, ue->rntiMaybeUEid, buf, size);
}
else{
for (i = 0; i < MAX_DRBS_PER_UE; i++) {
@@ -633,7 +633,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
rb_found:
{
LOG_D(PDCP, "%s() (drb %d) sending message to SDAP size %d\n", __func__, rb_id, size);
- sdap_data_ind(rb_id, ue->drb[rb_id - 1]->is_gnb, ue->drb[rb_id - 1]->has_sdap, ue->drb[rb_id - 1]->has_sdapULheader, ue->drb[rb_id - 1]->pdusession_id, ue->rntiMaybeUEid, buf, size);
+ sdap_data_ind(rb_id, ue->drb[rb_id - 1]->is_gnb, ue->drb[rb_id - 1]->has_sdap_rx, ue->drb[rb_id - 1]->pdusession_id, ue->rntiMaybeUEid, buf, size);
}
}
}
@@ -855,7 +855,7 @@ static void add_srb(int is_gnb, ue_id_t rntiMaybeUEid, struct NR_SRB_ToAddMod *s
LOG_D(PDCP, "%s:%d:%s: warning SRB %d already exist for UE ID/RNTI %ld, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rntiMaybeUEid);
} else {
pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id,
- 0, 0, 0, 0, // sdap parameters
+ 0, false, false, // sdap parameters
deliver_sdu_srb, ue, deliver_pdu_srb, ue,
12, t_Reordering, -1,
ciphering_algorithm,
@@ -906,9 +906,8 @@ void add_drb_am(int is_gnb, ue_id_t rntiMaybeUEid, struct NR_DRB_ToAddMod *s, in
}
int pdusession_id;
- int has_sdap = 0;
- int has_sdapULheader=0;
- int has_sdapDLheader=0;
+ bool has_sdap_rx = false;
+ bool has_sdap_tx = false;
bool is_sdap_DefaultDRB = false;
NR_QFI_t *mappedQFIs2Add = NULL;
uint8_t mappedQFIs2AddCount=0;
@@ -920,9 +919,13 @@ void add_drb_am(int is_gnb, ue_id_t rntiMaybeUEid, struct NR_DRB_ToAddMod *s, in
exit(-1);
}
pdusession_id = s->cnAssociation->choice.sdap_Config->pdu_Session;
- has_sdapULheader = s->cnAssociation->choice.sdap_Config->sdap_HeaderUL == NR_SDAP_Config__sdap_HeaderUL_present ? 1 : 0;
- has_sdapDLheader = s->cnAssociation->choice.sdap_Config->sdap_HeaderDL == NR_SDAP_Config__sdap_HeaderDL_present ? 1 : 0;
- has_sdap = has_sdapULheader | has_sdapDLheader;
+ if (is_gnb) {
+ has_sdap_rx = s->cnAssociation->choice.sdap_Config->sdap_HeaderUL == NR_SDAP_Config__sdap_HeaderUL_present;
+ has_sdap_tx = s->cnAssociation->choice.sdap_Config->sdap_HeaderDL == NR_SDAP_Config__sdap_HeaderDL_present;
+ } else {
+ has_sdap_tx = s->cnAssociation->choice.sdap_Config->sdap_HeaderUL == NR_SDAP_Config__sdap_HeaderUL_present;
+ has_sdap_rx = s->cnAssociation->choice.sdap_Config->sdap_HeaderDL == NR_SDAP_Config__sdap_HeaderDL_present;
+ }
is_sdap_DefaultDRB = s->cnAssociation->choice.sdap_Config->defaultDRB == true ? 1 : 0;
mappedQFIs2Add = (NR_QFI_t*)s->cnAssociation->choice.sdap_Config->mappedQoS_FlowsToAdd->list.array[0];
mappedQFIs2AddCount = s->cnAssociation->choice.sdap_Config->mappedQoS_FlowsToAdd->list.count;
@@ -941,8 +944,8 @@ void add_drb_am(int is_gnb, ue_id_t rntiMaybeUEid, struct NR_DRB_ToAddMod *s, in
if (ue->drb[drb_id-1] != NULL) {
LOG_W(PDCP, "%s:%d:%s: warning DRB %d already exist for UE ID/RNTI %ld, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rntiMaybeUEid);
} else {
- pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id,pdusession_id,has_sdap,
- has_sdapULheader,has_sdapDLheader,
+ pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id, pdusession_id,
+ has_sdap_rx, has_sdap_tx,
deliver_sdu_drb, ue, deliver_pdu_drb, ue,
sn_size_dl, t_reordering, discard_timer,
has_ciphering ? ciphering_algorithm : 0,
@@ -953,7 +956,7 @@ void add_drb_am(int is_gnb, ue_id_t rntiMaybeUEid, struct NR_DRB_ToAddMod *s, in
LOG_D(PDCP, "%s:%d:%s: added drb %d to UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rntiMaybeUEid);
- new_nr_sdap_entity(is_gnb, has_sdap, rntiMaybeUEid, pdusession_id, is_sdap_DefaultDRB, drb_id, mappedQFIs2Add, mappedQFIs2AddCount);
+ new_nr_sdap_entity(is_gnb, has_sdap_rx, has_sdap_tx, rntiMaybeUEid, pdusession_id, is_sdap_DefaultDRB, drb_id, mappedQFIs2Add, mappedQFIs2AddCount);
}
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
}
@@ -1109,7 +1112,6 @@ void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid)
(NR_SRB_ToAddModList_t *) NULL,
rbconfig->drb_ToAddModList,
rbconfig->drb_ToReleaseList,
- (LTE_PMCH_InfoList_r9_t *) NULL,
Rlc_Bearer_ToAdd_list);
LOG_D(PDCP, "%s:%d: done RRC PDCP/RLC ASN1 request for UE ID/RNTI %ld\n", __FUNCTION__, __LINE__, ctxt.rntiMaybeUEid);
diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
index d17e53cce4..29aab4ab5a 100644
--- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
+++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
@@ -957,7 +957,6 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt
const NR_SRB_ToAddModList_t * const srb2add_listP,
const NR_DRB_ToAddModList_t * const drb2add_listP,
const NR_DRB_ToReleaseList_t * const drb2release_listP,
- const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list)
{
int rnti = ctxt_pP->rntiMaybeUEid;
@@ -973,11 +972,6 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt
exit(1);
}
- if (pmch_InfoList_r9_pP != NULL) {
- LOG_E(RLC, "%s: pmch_InfoList_r9_pP not handled\n", __FUNCTION__);
- exit(1);
- }
-
if (drb2release_listP != NULL) {
LOG_E(RLC, "%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__);
//exit(1);
@@ -1084,8 +1078,7 @@ rlc_op_status_t rrc_rlc_config_req (
const srb_flag_t srb_flagP,
const MBMS_flag_t mbms_flagP,
const config_action_t actionP,
- const rb_id_t rb_idP,
- const rlc_info_t rlc_infoP)
+ const rb_id_t rb_idP)
{
nr_rlc_ue_t *ue;
int i;
diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c
index 7e9a33e087..87c9222468 100644
--- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c
+++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c
@@ -954,8 +954,7 @@ rlc_op_status_t rrc_rlc_config_req (
const srb_flag_t srb_flagP,
const MBMS_flag_t mbms_flagP,
const config_action_t actionP,
- const rb_id_t rb_idP,
- const rlc_info_t rlc_infoP)
+ const rb_id_t rb_idP)
{
rlc_ue_t *ue;
int i;
diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
index cd30c1bfb7..60db353949 100644
--- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
+++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
@@ -391,7 +391,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
int CC_id = UL_info->CC_id;
NR_Sched_Rsp_t *sched_info = &NR_Sched_INFO[module_id][CC_id];
NR_IF_Module_t *ifi = nr_if_inst[module_id];
- gNB_MAC_INST *mac = RC.nrmac[module_id];
+
LOG_D(NR_PHY,"SFN/SLOT:%d.%d module_id:%d CC_id:%d UL_info[rach_pdus:%zu rx_ind:%zu crcs:%zu]\n",
UL_info->frame, UL_info->slot,
module_id, CC_id,
@@ -443,8 +443,6 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
handle_nr_rach(UL_info);
handle_nr_uci(UL_info);
- // clear UL DCI prior to handling ULSCH
- mac->UL_dci_req[CC_id].numPdus = 0;
handle_nr_ulsch(UL_info);
handle_nr_srs(UL_info);
@@ -452,7 +450,9 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
free_unqueued_nfapi_indications(rach_ind, uci_ind, rx_ind, crc_ind);
}
if (NFAPI_MODE != NFAPI_MODE_PNF) {
-
+ gNB_MAC_INST *mac = RC.nrmac[module_id];
+ // clear UL DCI prior to handling ULSCH
+ mac->UL_dci_req[CC_id].numPdus = 0;
if (ifi->CC_mask==0) {
ifi->current_frame = UL_info->frame;
ifi->current_slot = UL_info->slot;
diff --git a/openair2/RRC/LTE/extern_NB_IoT.h b/openair2/RRC/LTE/extern_NB_IoT.h
index f240e8b215..24934f4bf1 100644
--- a/openair2/RRC/LTE/extern_NB_IoT.h
+++ b/openair2/RRC/LTE/extern_NB_IoT.h
@@ -46,7 +46,6 @@ extern UE_RRC_INST_NB_IoT *UE_rrc_inst_NB_IoT;
extern eNB_RRC_INST_NB_IoT *eNB_rrc_inst_NB_IoT;
extern PHY_Config_NB_IoT_t *config_INFO;
-extern rlc_info_t Rlc_info_am_NB_IoT,Rlc_info_am_config_NB_IoT;
extern uint8_t DRB2LCHAN_NB_IoT[2];
extern LTE_LogicalChannelConfig_NB_r13_t SRB1bis_logicalChannelConfig_defaultValue_NB_IoT;
extern LTE_LogicalChannelConfig_NB_r13_t SRB1_logicalChannelConfig_defaultValue_NB_IoT;
diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c
index 327099c1c9..ca051194db 100644
--- a/openair2/RRC/LTE/rrc_UE.c
+++ b/openair2/RRC/LTE/rrc_UE.c
@@ -522,8 +522,7 @@ rrc_t310_expiration(
SRB_FLAG_YES,
MBMS_FLAG_NO,
CONFIG_ACTION_REMOVE,
- UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
- Rlc_info_um);
+ UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id);
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active = 0;
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].StatusSrb = IDLE;
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Next_check_frame = 0;
@@ -710,7 +709,7 @@ rrc_ue_establish_srb1(
// memcpy(&UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Lchan_desc[1],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE);
LOG_I(RRC,"[UE %d], CONFIG_SRB1 %d corresponding to eNB_index %d\n", ue_mod_idP,DCCH,eNB_index);
//rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, lchan_id,UNDEF_SECURITY_MODE);
- // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,lchan_id,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
+ // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,lchan_id,SIGNALLING_RADIO_BEARER);
// UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size=DEFAULT_MEAS_IND_SIZE+1;
return(0);
}
@@ -734,7 +733,7 @@ rrc_ue_establish_srb2(
// memcpy(&UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Srb_info.Lchan_desc[1],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE);
LOG_I(RRC,"[UE %d], CONFIG_SRB2 %d corresponding to eNB_index %d\n",ue_mod_idP,DCCH1,eNB_index);
//rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, lchan_id, UNDEF_SECURITY_MODE);
- // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,lchan_id,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
+ // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,lchan_id,SIGNALLING_RADIO_BEARER);
// UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size=DEFAULT_MEAS_IND_SIZE+1;
return(0);
}
@@ -2124,11 +2123,11 @@ rrc_ue_process_mobilityControlInfo(
//Removing SRB1 and SRB2 and DRB0
LOG_I(RRC,"[UE %d] : Update needed for rrc_pdcp_config_req (deprecated) and rrc_rlc_config_req commands(deprecated)\n", ctxt_pP->module_id);
rrc_pdcp_config_req (ctxt_pP, SRB_FLAG_YES, CONFIG_ACTION_REMOVE, DCCH,UNDEF_SECURITY_MODE);
- rrc_rlc_config_req(ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, CONFIG_ACTION_REMOVE,ctxt_pP->module_id+DCCH,Rlc_info_am_config);
+ rrc_rlc_config_req(ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, CONFIG_ACTION_REMOVE,ctxt_pP->module_id+DCCH);
rrc_pdcp_config_req (ctxt_pP, SRB_FLAG_YES, CONFIG_ACTION_REMOVE, DCCH1,UNDEF_SECURITY_MODE);
- rrc_rlc_config_req(ctxt_pP, SRB_FLAG_YES,CONFIG_ACTION_REMOVE, MBMS_FLAG_NO,ctxt_pP->module_id+DCCH1,Rlc_info_am_config);
+ rrc_rlc_config_req(ctxt_pP, SRB_FLAG_YES,CONFIG_ACTION_REMOVE, MBMS_FLAG_NO,ctxt_pP->module_id+DCCH1);
rrc_pdcp_config_req (ctxt_pP, SRB_FLAG_NO, CONFIG_ACTION_REMOVE, DTCH,UNDEF_SECURITY_MODE);
- rrc_rlc_config_req(ctxt_pP, SRB_FLAG_NO,CONFIG_ACTION_REMOVE, MBMS_FLAG_NO,ctxt_pP->module_id+DTCH,Rlc_info_um);
+ rrc_rlc_config_req(ctxt_pP, SRB_FLAG_NO,CONFIG_ACTION_REMOVE, MBMS_FLAG_NO,ctxt_pP->module_id+DTCH);
//Synchronisation to DL of target cell
LOG_I(RRC,
"HO: Reset PDCP and RLC for configured RBs.. \n[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 eNB %d) --->][MAC_UE][MOD %02d][]\n",
@@ -2168,9 +2167,9 @@ rrc_ue_process_mobilityControlInfo(
// rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, ue_mod_idP+DCCH1);
// rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, ue_mod_idP+DTCH);
// Re-establish RLC for all RBs that are established
- // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
- // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
- // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DTCH,RADIO_ACCESS_BEARER,Rlc_info_um);
+ // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH,SIGNALLING_RADIO_BEARER);
+ // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH1,SIGNALLING_RADIO_BEARER);
+ // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DTCH,RADIO_ACCESS_BEARER);
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_SI_RECEIVED;
}
diff --git a/openair2/RRC/LTE/rrc_common.c b/openair2/RRC/LTE/rrc_common.c
index c40d0ff766..be7a4048f9 100644
--- a/openair2/RRC/LTE/rrc_common.c
+++ b/openair2/RRC/LTE/rrc_common.c
@@ -66,18 +66,6 @@ rrc_init_global_param(
DTCH_UL_LCHAN_DESC.transport_block_size = 52;
DTCH_UL_LCHAN_DESC.max_transport_blocks = 20;
DTCH_UL_LCHAN_DESC.Delay_class = 1;
- Rlc_info_um.rlc_mode = RLC_MODE_UM;
- Rlc_info_um.rlc.rlc_um_info.timer_reordering = 5;
- Rlc_info_um.rlc.rlc_um_info.sn_field_length = 10;
- Rlc_info_um.rlc.rlc_um_info.is_mXch = 0;
- //Rlc_info_um.rlc.rlc_um_info.sdu_discard_mode=16;
- Rlc_info_am_config.rlc_mode = RLC_MODE_AM;
- Rlc_info_am_config.rlc.rlc_am_info.max_retx_threshold = 50;
- Rlc_info_am_config.rlc.rlc_am_info.poll_pdu = 8;
- Rlc_info_am_config.rlc.rlc_am_info.poll_byte = 1000;
- Rlc_info_am_config.rlc.rlc_am_info.t_poll_retransmit = 15;
- Rlc_info_am_config.rlc.rlc_am_info.t_reordering = 50;
- Rlc_info_am_config.rlc.rlc_am_info.t_status_prohibit = 10;
return 0;
}
diff --git a/openair2/RRC/LTE/rrc_extern.h b/openair2/RRC/LTE/rrc_extern.h
index 14de4d8dcc..644512a686 100644
--- a/openair2/RRC/LTE/rrc_extern.h
+++ b/openair2/RRC/LTE/rrc_extern.h
@@ -48,8 +48,6 @@ extern int NB_UE_INST;
extern void* bigphys_malloc(int);
-//CONSTANTS
-extern rlc_info_t Rlc_info_um,Rlc_info_am_config;
//uint8_t RACH_TIME_ALLOC;
extern uint16_t RACH_FREQ_ALLOC;
//uint8_t NB_RACH;
diff --git a/openair2/RRC/LTE/rrc_vars.h b/openair2/RRC/LTE/rrc_vars.h
index f0495a7649..693459f2ff 100644
--- a/openair2/RRC/LTE/rrc_vars.h
+++ b/openair2/RRC/LTE/rrc_vars.h
@@ -78,7 +78,6 @@ LTE_LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue = {ul_Specific
};
//CONSTANTS
-rlc_info_t Rlc_info_um,Rlc_info_am_config;
uint16_t RACH_FREQ_ALLOC;
//uint8_t NB_RACH;
LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
diff --git a/openair2/RRC/NR/nr_rrc_common.c b/openair2/RRC/NR/nr_rrc_common.c
index daa9663ca8..828e392460 100644
--- a/openair2/RRC/NR/nr_rrc_common.c
+++ b/openair2/RRC/NR/nr_rrc_common.c
@@ -63,20 +63,6 @@ int rrc_init_nr_global_param(void){
DTCH_UL_LCHAN_DESC.max_transport_blocks = 20;
DTCH_UL_LCHAN_DESC.Delay_class = 1;
- Rlc_info_um.rlc_mode = RLC_MODE_UM;
- Rlc_info_um.rlc.rlc_um_info.timer_reordering = 5;
- Rlc_info_um.rlc.rlc_um_info.sn_field_length = 10;
- Rlc_info_um.rlc.rlc_um_info.is_mXch = 0;
- //Rlc_info_um.rlc.rlc_um_info.sdu_discard_mode=16;
-
- Rlc_info_am_config.rlc_mode = RLC_MODE_AM;
- Rlc_info_am_config.rlc.rlc_am_info.max_retx_threshold = 50;
- Rlc_info_am_config.rlc.rlc_am_info.poll_pdu = 8;
- Rlc_info_am_config.rlc.rlc_am_info.poll_byte = 1000;
- Rlc_info_am_config.rlc.rlc_am_info.t_poll_retransmit = 15;
- Rlc_info_am_config.rlc.rlc_am_info.t_reordering = 50;
- Rlc_info_am_config.rlc.rlc_am_info.t_status_prohibit = 10;
-
return 0;
}
diff --git a/openair2/RRC/NR/nr_rrc_extern.h b/openair2/RRC/NR/nr_rrc_extern.h
index 85faa60697..7283b25be0 100644
--- a/openair2/RRC/NR/nr_rrc_extern.h
+++ b/openair2/RRC/NR/nr_rrc_extern.h
@@ -51,8 +51,6 @@ extern int NB_UE_INST;
extern void* bigphys_malloc(int);
-//CONSTANTS
-extern rlc_info_t Rlc_info_um,Rlc_info_am_config;
//uint8_t RACH_TIME_ALLOC;
extern uint16_t RACH_FREQ_ALLOC;
//uint8_t NB_RACH;
diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h
index 57aee7a6b2..0d7e0e7f97 100644
--- a/openair2/RRC/NR/nr_rrc_proto.h
+++ b/openair2/RRC/NR/nr_rrc_proto.h
@@ -207,7 +207,6 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt
const NR_SRB_ToAddModList_t * const srb2add_listP,
const NR_DRB_ToAddModList_t * const drb2add_listP,
const NR_DRB_ToReleaseList_t * const drb2release_listP,
- const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
void nr_pdcp_add_srbs(eNB_flag_t enb_flag, ue_id_t rntiMaybeUEid, NR_SRB_ToAddModList_t *const srb2add_list, const uint8_t security_modeP, uint8_t *const kRRCenc, uint8_t *const kUPint);
diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c
index 5a0a138c66..b5a63cdf0d 100644
--- a/openair2/RRC/NR/rrc_gNB.c
+++ b/openair2/RRC/NR/rrc_gNB.c
@@ -307,7 +307,6 @@ void apply_macrlc_config(gNB_RRC_INST *rrc,
ue_context_pP->ue_context.SRB_configList,
ue_context_pP->ue_context.DRB_configList,
NULL,
- NULL,
get_softmodem_params()->sa ? cgc->rlc_BearerToAddModList : NULL);
}
@@ -1323,7 +1322,6 @@ rrc_gNB_process_RRCReconfigurationComplete(
SRB_configList, // NULL,
DRB_configList,
DRB_Release_configList2,
- NULL,
get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL);
}
@@ -1391,8 +1389,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
SRB_FLAG_NO,
MBMS_FLAG_NO,
CONFIG_ACTION_REMOVE,
- nr_DRB2LCHAN[i],
- Rlc_info_um);*/
+ nr_DRB2LCHAN[i]);*/
}
ue_context_pP->ue_context.DRB_active[drb_id] = 0;
diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c
index a6ce1b4a55..379e4d8bdc 100644
--- a/openair2/RRC/NR/rrc_gNB_nsa.c
+++ b/openair2/RRC/NR/rrc_gNB_nsa.c
@@ -396,7 +396,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
get_softmodem_params()->sa ? ue_context_p->ue_context.rb_config->srb_ToAddModList : NULL,
ue_context_p->ue_context.rb_config->drb_ToAddModList,
ue_context_p->ue_context.rb_config->drb_ToReleaseList,
- (LTE_PMCH_InfoList_r9_t *)NULL,
ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList);
LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %lx\n", __FUNCTION__, __LINE__, ctxt.rntiMaybeUEid);
diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c
index 93d459b3ed..b09b09efb3 100644
--- a/openair2/RRC/NR_UE/rrc_UE.c
+++ b/openair2/RRC/NR_UE/rrc_UE.c
@@ -1974,7 +1974,6 @@ nr_rrc_ue_establish_srb2(
radioBearerConfig->srb_ToAddModList,
NULL,
NULL,
- NULL,
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList
);
@@ -2069,7 +2068,7 @@ nr_rrc_ue_establish_srb2(
kUPint,
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList);
// Refresh DRBs
- nr_rrc_rlc_config_asn1_req(ctxt_pP, NULL, radioBearerConfig->drb_ToAddModList, NULL, NULL, NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList);
+ nr_rrc_rlc_config_asn1_req(ctxt_pP, NULL, radioBearerConfig->drb_ToAddModList, NULL, NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList);
} // drb_ToAddModList //
if (radioBearerConfig->drb_ToReleaseList != NULL) {
diff --git a/openair2/SDAP/nr_sdap/nr_sdap.c b/openair2/SDAP/nr_sdap/nr_sdap.c
index e2b6714488..783ca5a914 100644
--- a/openair2/SDAP/nr_sdap/nr_sdap.c
+++ b/openair2/SDAP/nr_sdap/nr_sdap.c
@@ -64,8 +64,7 @@ bool sdap_data_req(protocol_ctxt_t *ctxt_p,
void sdap_data_ind(rb_id_t pdcp_entity,
int is_gnb,
- int has_sdap,
- int has_sdapULheader,
+ bool has_sdap_rx,
int pdusession_id,
ue_id_t ue_id,
char *buf,
@@ -81,8 +80,7 @@ void sdap_data_ind(rb_id_t pdcp_entity,
sdap_entity->rx_entity(sdap_entity,
pdcp_entity,
is_gnb,
- has_sdap,
- has_sdapULheader,
+ has_sdap_rx,
pdusession_id,
ue_id,
buf,
diff --git a/openair2/SDAP/nr_sdap/nr_sdap.h b/openair2/SDAP/nr_sdap/nr_sdap.h
index 54447ebb68..5d4d907a8c 100644
--- a/openair2/SDAP/nr_sdap/nr_sdap.h
+++ b/openair2/SDAP/nr_sdap/nr_sdap.h
@@ -55,13 +55,11 @@ bool sdap_data_req(protocol_ctxt_t *ctxt_p,
*/
void sdap_data_ind(rb_id_t pdcp_entity,
int is_gnb,
- int has_sdap,
- int has_sdapULheader,
+ bool has_sdap_rx,
int pdusession_id,
ue_id_t ue_id,
char *buf,
- int size
- );
+ int size);
void set_qfi_pduid(uint8_t qfi, uint8_t pduid);
diff --git a/openair2/SDAP/nr_sdap/nr_sdap_entity.c b/openair2/SDAP/nr_sdap/nr_sdap_entity.c
index 5755d3430a..09e80feccf 100644
--- a/openair2/SDAP/nr_sdap/nr_sdap_entity.c
+++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.c
@@ -62,7 +62,7 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
const uint32_t *destinationL2Id,
const uint8_t qfi,
const bool rqi) {
- /* The offset of the SDAP header, it might be 0 if the has_sdap is not true in the pdcp entity. */
+ /* The offset of the SDAP header, it might be 0 if has_sdap_tx is not true in the pdcp entity. */
int offset=0;
bool ret = false;
/*Hardcode DRB ID given from upper layer (ue/enb_tun_read_thread rb_id), it will change if we have SDAP*/
@@ -79,7 +79,7 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
if(pdcp_entity){
sdap_drb_id = pdcp_entity;
- pdcp_ent_has_sdap = entity->qfi2drb_table[qfi].hasSdap;
+ pdcp_ent_has_sdap = entity->qfi2drb_table[qfi].has_sdap_tx;
LOG_D(SDAP, "TX - QFI: %u is mapped to DRB ID: %ld\n", qfi, entity->qfi2drb_table[qfi].drb_id);
}
@@ -173,17 +173,16 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
rb_id_t pdcp_entity,
int is_gnb,
- int has_sdap,
- int has_sdapHeader,
+ bool has_sdap_rx,
int pdusession_id,
ue_id_t ue_id,
char *buf,
int size) {
- /* The offset of the SDAP header, it might be 0 if the has_sdap is not true in the pdcp entity. */
+ /* The offset of the SDAP header, it might be 0 if has_sdap_rx is not true in the pdcp entity. */
int offset=0;
- if(is_gnb) { // gNB
- if(has_sdap && has_sdapHeader ) { // Handling the SDAP Header
+ if (is_gnb) { // gNB
+ if (has_sdap_rx) { // Handling the SDAP Header
offset = SDAP_HDR_LENGTH;
nr_sdap_ul_hdr_t *sdap_hdr = (nr_sdap_ul_hdr_t *)buf;
LOG_D(SDAP, "RX Entity Received QFI: %u\n", sdap_hdr->QFI);
@@ -224,7 +223,7 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
* 5.2.2 Downlink
* if the DRB from which this SDAP data PDU is received is configured by RRC with the presence of SDAP header.
*/
- if(has_sdap && has_sdapHeader) { // Handling the SDAP Header
+ if (has_sdap_rx) { // Handling the SDAP Header
offset = SDAP_HDR_LENGTH;
/*
* TS 37.324 5.2 Data transfer
@@ -263,8 +262,7 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
* the DRB according to the stored QoS flow to DRB mapping rule is configured by RRC
* with the presence of UL SDAP header
*/
- if( (pdcp_entity != entity->qfi2drb_table[sdap_hdr->QFI].drb_id) &&
- has_sdapHeader ){
+ if (pdcp_entity != entity->qfi2drb_table[sdap_hdr->QFI].drb_id) {
nr_sdap_ul_hdr_t sdap_ctrl_pdu = entity->sdap_construct_ctrl_pdu(sdap_hdr->QFI);
rb_id_t sdap_ctrl_pdu_drb = entity->sdap_map_ctrl_pdu(entity, pdcp_entity, SDAP_CTRL_PDU_MAP_RULE_DRB, sdap_hdr->QFI);
entity->sdap_submit_ctrl_pdu(ue_id, sdap_ctrl_pdu_drb, sdap_ctrl_pdu);
@@ -304,13 +302,15 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
}
}
-void nr_sdap_qfi2drb_map_update(nr_sdap_entity_t *entity, uint8_t qfi, rb_id_t drb, bool hasSdap){
+void nr_sdap_qfi2drb_map_update(nr_sdap_entity_t *entity, uint8_t qfi, rb_id_t drb, bool has_sdap_rx, bool has_sdap_tx)
+{
if(qfi < SDAP_MAX_QFI &&
qfi > SDAP_MAP_RULE_EMPTY &&
drb > 0 &&
drb <= AVLBL_DRB){
entity->qfi2drb_table[qfi].drb_id = drb;
- entity->qfi2drb_table[qfi].hasSdap = hasSdap;
+ entity->qfi2drb_table[qfi].has_sdap_rx = has_sdap_rx;
+ entity->qfi2drb_table[qfi].has_sdap_tx = has_sdap_tx;
LOG_D(SDAP, "Updated mapping: QFI %u -> DRB %ld \n", qfi, entity->qfi2drb_table[qfi].drb_id);
} else {
LOG_D(SDAP, "Map updated failed, QFI: %u, DRB: %ld\n", qfi, drb);
@@ -332,7 +332,7 @@ rb_id_t nr_sdap_qfi2drb_map(nr_sdap_entity_t *entity, uint8_t qfi, rb_id_t upper
return pdcp_entity;
} else if(entity->default_drb) {
LOG_D(SDAP, "Mapping QFI: %u to Default DRB: %ld\n", qfi, entity->default_drb);
- entity->qfi2drb_map_update(entity, qfi, entity->default_drb, entity->qfi2drb_table[qfi].hasSdap);
+ entity->qfi2drb_map_update(entity, qfi, entity->default_drb, entity->qfi2drb_table[qfi].has_sdap_rx, entity->qfi2drb_table[qfi].has_sdap_tx);
return entity->default_drb;
} else {
LOG_D(SDAP, "Mapping rule and default DRB do not exist for QFI:%u\n", qfi);
@@ -374,37 +374,36 @@ void nr_sdap_submit_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_u
}
}
-void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, rb_id_t pdcp_entity, ue_id_t ue_id, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount, uint8_t drb_identity)
+void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, rb_id_t pdcp_entity, ue_id_t ue_id, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount, uint8_t drb_identity, bool has_sdap_rx, bool has_sdap_tx)
{
LOG_D(SDAP, "RRC Configuring SDAP Entity\n");
uint8_t qfi = 0;
- bool hasSdap = true;
for(int i = 0; i < mappedQFIs2AddCount; i++){
qfi = mapped_qfi_2_add[i];
- if(existing_sdap_entity->default_drb && existing_sdap_entity->qfi2drb_table[qfi].drb_id == SDAP_NO_MAPPING_RULE){
+ if (existing_sdap_entity->default_drb && existing_sdap_entity->qfi2drb_table[qfi].drb_id == SDAP_NO_MAPPING_RULE) {
nr_sdap_ul_hdr_t sdap_ctrl_pdu = existing_sdap_entity->sdap_construct_ctrl_pdu(qfi);
rb_id_t sdap_ctrl_pdu_drb = existing_sdap_entity->sdap_map_ctrl_pdu(existing_sdap_entity, pdcp_entity, SDAP_CTRL_PDU_MAP_DEF_DRB, qfi);
existing_sdap_entity->sdap_submit_ctrl_pdu(ue_id, sdap_ctrl_pdu_drb, sdap_ctrl_pdu);
}
- if(existing_sdap_entity->qfi2drb_table[qfi].drb_id != drb_identity && existing_sdap_entity->qfi2drb_table[qfi].hasSdap){
+ if (existing_sdap_entity->qfi2drb_table[qfi].drb_id != drb_identity && existing_sdap_entity->qfi2drb_table[qfi].has_sdap_tx) {
nr_sdap_ul_hdr_t sdap_ctrl_pdu = existing_sdap_entity->sdap_construct_ctrl_pdu(qfi);
rb_id_t sdap_ctrl_pdu_drb = existing_sdap_entity->sdap_map_ctrl_pdu(existing_sdap_entity, pdcp_entity, SDAP_CTRL_PDU_MAP_RULE_DRB, qfi);
existing_sdap_entity->sdap_submit_ctrl_pdu(ue_id, sdap_ctrl_pdu_drb, sdap_ctrl_pdu);
}
LOG_D(SDAP, "Storing the configured QoS flow to DRB mapping rule\n");
- existing_sdap_entity->qfi2drb_map_update(existing_sdap_entity, qfi, drb_identity, hasSdap);
+ existing_sdap_entity->qfi2drb_map_update(existing_sdap_entity, qfi, drb_identity, has_sdap_rx, has_sdap_tx);
}
}
-nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, int has_sdap, ue_id_t ue_id, int pdusession_id, bool is_defaultDRB, uint8_t drb_identity, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount)
+nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, bool has_sdap_rx, bool has_sdap_tx, ue_id_t ue_id, int pdusession_id, bool is_defaultDRB, uint8_t drb_identity, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount)
{
if (nr_sdap_get_entity(ue_id, pdusession_id)) {
LOG_E(SDAP, "SDAP Entity for UE already exists with RNTI/UE ID: %lu and PDU SESSION ID: %d\n", ue_id, pdusession_id);
nr_sdap_entity_t *existing_sdap_entity = nr_sdap_get_entity(ue_id, pdusession_id);
rb_id_t pdcp_entity = existing_sdap_entity->default_drb;
if(!is_gnb)
- nr_sdap_ue_qfi2drb_config(existing_sdap_entity, pdcp_entity, ue_id, mapped_qfi_2_add, mappedQFIs2AddCount, drb_identity);
+ nr_sdap_ue_qfi2drb_config(existing_sdap_entity, pdcp_entity, ue_id, mapped_qfi_2_add, mappedQFIs2AddCount, drb_identity, has_sdap_rx, has_sdap_tx);
return existing_sdap_entity;
}
@@ -438,7 +437,7 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, int has_sdap, ue_id_t ue_id, in
LOG_D(SDAP, "RRC updating mapping rules\n");
for (int i = 0; i < mappedQFIs2AddCount; i++)
{
- sdap_entity->qfi2drb_map_update(sdap_entity, mapped_qfi_2_add[i], sdap_entity->default_drb, has_sdap);
+ sdap_entity->qfi2drb_map_update(sdap_entity, mapped_qfi_2_add[i], sdap_entity->default_drb, has_sdap_rx, has_sdap_tx);
}
}
}
diff --git a/openair2/SDAP/nr_sdap/nr_sdap_entity.h b/openair2/SDAP/nr_sdap/nr_sdap_entity.h
index 9b012d037c..e8ed236fd1 100644
--- a/openair2/SDAP/nr_sdap/nr_sdap_entity.h
+++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.h
@@ -65,7 +65,8 @@ typedef struct nr_sdap_ul_hdr_s {
typedef struct qfi2drb_s {
rb_id_t drb_id;
- bool hasSdap;
+ bool has_sdap_rx;
+ bool has_sdap_tx;
} qfi2drb_t;
void nr_pdcp_submit_sdap_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu);
@@ -76,7 +77,7 @@ typedef struct nr_sdap_entity_s {
int pdusession_id;
qfi2drb_t qfi2drb_table[SDAP_MAX_QFI];
- void (*qfi2drb_map_update)(struct nr_sdap_entity_s *entity, uint8_t qfi, rb_id_t drb, bool hasSdap);
+ void (*qfi2drb_map_update)(struct nr_sdap_entity_s *entity, uint8_t qfi, rb_id_t drb, bool has_sdap_rx, bool has_sdap_tx);
void (*qfi2drb_map_delete)(struct nr_sdap_entity_s *entity, uint8_t qfi);
rb_id_t (*qfi2drb_map)(struct nr_sdap_entity_s *entity, uint8_t qfi, rb_id_t upper_layer_rb_id);
@@ -101,8 +102,7 @@ typedef struct nr_sdap_entity_s {
void (*rx_entity)(struct nr_sdap_entity_s *entity,
rb_id_t pdcp_entity,
int is_gnb,
- int has_sdap,
- int has_sdapULheader,
+ bool has_sdap_rx,
int pdusession_id,
ue_id_t ue_id,
char *buf,
@@ -113,7 +113,7 @@ typedef struct nr_sdap_entity_s {
} nr_sdap_entity_t;
/* QFI to DRB Mapping Related Function */
-void nr_sdap_qfi2drb_map_update(nr_sdap_entity_t *entity, uint8_t qfi, rb_id_t drb, bool hasSdap);
+void nr_sdap_qfi2drb_map_update(nr_sdap_entity_t *entity, uint8_t qfi, rb_id_t drb, bool has_sdap_rx, bool has_sdap_tx);
/* QFI to DRB Mapping Related Function */
void nr_sdap_qfi2drb_map_del(nr_sdap_entity_t *entity, uint8_t qfi);
@@ -153,13 +153,13 @@ void nr_sdap_submit_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_u
* TS 37.324 5.3 QoS flow to DRB Mapping
* 5.3.1 Configuration Procedures
*/
-void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, rb_id_t pdcp_entity, ue_id_t ue_id, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount, uint8_t drb_identity);
+void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, rb_id_t pdcp_entity, ue_id_t ue_id, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount, uint8_t drb_identity, bool has_sdap_rx, bool has_sdap_tx);
/*
* TS 37.324 4.4 5.1.1 SDAP entity establishment
* Establish an SDAP entity.
*/
-nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, int has_sdap, ue_id_t ue_id, int pdusession_id, bool is_defaultDRB, uint8_t default_DRB, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount);
+nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, bool has_sdap_rx, bool has_sdap_tx, ue_id_t ue_id, int pdusession_id, bool is_defaultDRB, uint8_t default_DRB, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount);
/* Entity Handling Related Functions */
nr_sdap_entity_t *nr_sdap_get_entity(ue_id_t ue_id, int pdusession_id);
diff --git a/openair2/UTIL/LISTS/list.c b/openair2/UTIL/LISTS/list.c
deleted file mode 100644
index 578833edba..0000000000
--- a/openair2/UTIL/LISTS/list.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-/*! \file list.c
-* \brief list management primimtives. It includes three implementations: (1) with mem_blocks, (2) standard list implementation (mem usage 314MB) (3) Linux Queue-based implementation (mem usage 394 MB)
-* \author Navid Nikaein, Mohamed Said MOSLI BOUKSIAA, Lionel GAUTHIER
-* \date 2012 - 2014
-* \version 0.5
-* @ingroup util
-*/
-
-#define LIST_C
-#define NULL 0
-
-#include "list.h"
-#include
-
-//-----------------------------------------------------------------------------
-/*
- * initialize list
- */
-//-----------------------------------------------------------------------------
-void
-list_init (list_t * listP, char *nameP)
-{
- //-----------------------------------------------------------------------------
- if (nameP) {
- strncpy( listP->name, nameP, LIST_NAME_MAX_CHAR-1 );
- listP->name[LIST_NAME_MAX_CHAR-1] = 0; // terminate string
- }
-
- listP->tail = NULL;
- listP->head = NULL;
- listP->nb_elements = 0;
-}
-//-----------------------------------------------------------------------------
-void
-list_free (list_t * listP)
-{
- //-----------------------------------------------------------------------------
- mem_block_t *le;
-
- while ((le = list_remove_head (listP))) {
- free_mem_block (le, __func__);
- }
-}
-//-----------------------------------------------------------------------------
-mem_block_t *
-list_get_head (list_t * listP)
-{
- //-----------------------------------------------------------------------------
- return listP->head;
-}
-//-----------------------------------------------------------------------------
-/*
- * remove an element from head of a list
- * @param pointer on targeted list
- * @return pointer on removed mem_block_t
- */
-mem_block_t *
-list_remove_head (list_t * listP)
-{
- //-----------------------------------------------------------------------------
-
- // access optimisation
- mem_block_t *head;
- head = listP->head;
-
- // almost one element
- if (head != NULL) {
- listP->head = head->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- // if only one element, update tail
- if (listP->head == NULL) {
- listP->tail = NULL;
- } else {
- head->next = NULL;
- }
- } else {
- //msg("[MEM_MGT][WARNING] remove_head_from_list(%s) no elements\n",listP->name);
- }
-
- return head;
-}
-
-//-----------------------------------------------------------------------------
-mem_block_t *
-list_remove_element (mem_block_t * elementP, list_t * listP)
-{
- //-----------------------------------------------------------------------------
-
- // access optimisation;
- mem_block_t *head;
-
- if (elementP != NULL) {
- // test head
- head = listP->head;
-
- if (listP->head == elementP) {
- // almost one element
- if (head != NULL) {
- listP->head = head->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- // if only one element, update tail
- if (listP->head == NULL) {
- listP->tail = NULL;
- } else {
- head->next = NULL;
- }
- }
- } else {
- while (head) {
- if (head->next == elementP) {
- head->next = elementP->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- if (listP->tail == elementP) {
- listP->tail = head;
- }
-
- return elementP;
- } else {
- head = head->next;
- }
- }
- }
- }
-
- return elementP;
-}
-
-//-----------------------------------------------------------------------------
-/*
- * add an element to the beginning of a list
- * @param pointer on targeted list
- * @return pointer on removed mem_block_t
- */
-void
-list_add_head (mem_block_t * elementP, list_t * listP)
-{
- //-----------------------------------------------------------------------------
-
- // access optimisation;
- mem_block_t *head;
-
- if (elementP != NULL) {
- head = listP->head;
- listP->nb_elements = listP->nb_elements + 1;
-
- // almost one element
- if (head == NULL) {
- listP->head = elementP;
- listP->tail = elementP;
- } else {
- elementP->next = head;
- listP->head = elementP;
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-/*
- * add an element to the end of a list
- * @param pointer on targeted list
- * @return pointer on removed mem_block_t
- */
-void
-list_add_tail_eurecom (mem_block_t * elementP, list_t * listP)
-{
- mem_block_t *tail;
- //-----------------------------------------------------------------------------
-
- if (elementP != NULL) {
- // access optimisation
- listP->nb_elements = listP->nb_elements + 1;
- elementP->next = NULL;
- tail = listP->tail;
-
- // almost one element
- if (tail == NULL) {
- listP->head = elementP;
- } else {
- tail->next = elementP;
- }
-
- listP->tail = elementP;
- } else {
- //msg("[CNT_LIST][ERROR] add_cnt_tail() element NULL\n");
- }
-}
-
-//-----------------------------------------------------------------------------
-void
-list_add_list (list_t * sublistP, list_t * listP)
-{
- //-----------------------------------------------------------------------------
-
- if (sublistP) {
- if (sublistP->head) {
- // access optimisation
- mem_block_t *tail;
-
- tail = listP->tail;
-
- // almost one element
- if (tail == NULL) {
- listP->head = sublistP->head;
- } else {
- tail->next = sublistP->head;
- }
-
- listP->tail = sublistP->tail;
- // clear sublist
- sublistP->head = NULL;
- sublistP->tail = NULL;
- listP->nb_elements = listP->nb_elements + sublistP->nb_elements;
- sublistP->nb_elements = 0;
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-void
-list_display (list_t * listP)
-{
- //-----------------------------------------------------------------------------
-
- mem_block_t *cursor;
- // unsigned short nb_elements = 0;
-
- // test lists
- if (listP) {
- cursor = listP->head;
-
- if (cursor) {
- // almost one element
- //msg ("Display list %s %p", listP->name, listP);
- // while (cursor != NULL) {
- // msg ("%d:", cursor->pool_id);
- // msg ("\n");
- // cursor = cursor->next;
- // nb_elements++;
- //}
- // msg (" found nb_elements %d nb_elements %d\n", nb_elements, listP->nb_elements);
- }
- } else {
- //msg ("[SDU_MNGT][WARNING] display_cnt_list() : list is NULL\n");
- }
-}
-#ifndef LINUX_LIST
-/*! \fn void push_front(struct list* z, double val)
-* \brief this function pushes front new values in a predefined list.
-* \param z is the predefined list
-* val is the new value to be pushed inside the list
-* \return
-*/
-void
-push_front(struct list* z, double val)
-{
-
- struct node* p = (struct node*) malloc(sizeof(struct node));
-
- p->next = z->head;
- p->val = val;
- z->head = p;
-
- z->size++;
-
- return;
-
-}
-
-/*! \fn void initialize(struct list* z)
-* \brief initialize a list structure.
-* \param z is the list
-* \return
-*/
-void
-initialize(struct list* z)
-{
- z->head = NULL;
- z->size = 0;
-
- return;
-}
-
-/*! \fn void del(struct list* z)
-* \brief delete a list structure.
-* \param z is the list
-* \return
-*/
-void
-del(struct list* z)
-{
- struct node* cur;
- struct node* x = z->head;
-
- while((x != NULL) && (z->size > 0)) {
- cur = x;
- x = x->next;
- free(cur);
- z->size--;
- }
-
- z->head = NULL;
- z->size = 0;
-
- return;
-}
-/*! \fn void totable(double* table, struct list* v)
-* \brief convert a list structure to a table.
-* \param table is a pointer to double table
-* v is the list to be converted
-* \return
-*/
-void
-totable(double* table, struct list* v)
-{
- int i = 0;
-
- struct node* x = v->head;
-
- while(x) {
- table[i] = x->val;
- i++;
- x = x->next;
- }
-
- return;
-}
-/*! \fn int compare (const void * a, const void * b)
-* \brief compare the value of two parameters
-* \param a is a double, b is another double
-* \return 1 if a>b, -0 if a y );
-}
-#else
-// push an element to the head of the list
-void push_front(struct list* z, double val)
-{
- struct entry* p = (struct entry*) malloc(sizeof(struct entry));
- p->val = val;
-
- LIST_INSERT_HEAD(&z->head, p, entries);
- z->size++;
-
- return;
-
-}
-
-
-// initialization
-void initialize(struct list* z)
-{
- LIST_INIT(&z->head);
- z->size = 0;
-
- return;
-}
-
-// delete
-void del(struct list* z)
-{
- while (z->head.lh_first != NULL) {
- free(z->head.lh_first);
- LIST_REMOVE(z->head.lh_first, entries);
- }
-
- z->size = 0;
-
- return;
-}
-
-// convert the list to a table
-void totable(double* table, struct list* v)
-{
- int i = 0;
-
- struct entry* x;
-
- for (x = v->head.lh_first; x != NULL; x = x->entries.le_next) {
- table[i] = x->val;
- i++;
- }
-
- return;
-}
-
-int compare (const void * a, const void * b)
-{
- double x = *(double*)a;
- double y = *(double*)b;
-
- return ( x > y );
-}
-#endif
-
-/*! \fn int32_t calculate_median(struct list *loc_list)
-* \brief calculate the median of a list
-* \param loc_list is the list
-* \return the median value
-*/
-int32_t calculate_median(struct list *loc_list)
-{
- int32_t median = 0;
-
- if (loc_list->size > 0) {
- double* table = (double*) malloc(loc_list->size * sizeof(double));
- totable(table, loc_list);
- /// sort the table in ascending way
- qsort (table, loc_list->size, sizeof(double), &compare);
- /// median is the value at middle the sorted table
- /// Q1 is the value at 1/4 the sorted table
- /// Q3 is the value at 3/4 the sorted table
- median = table[loc_list->size/2];
- free(table);
- }
-
- return median;
-}
diff --git a/openair2/UTIL/LISTS/list.h b/openair2/UTIL/LISTS/list.h
deleted file mode 100644
index 079c723ebf..0000000000
--- a/openair2/UTIL/LISTS/list.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-
-/*! \file pad_list.c
-* \brief list management primimtives
-* \author Mohamed Said MOSLI BOUKSIAA, Lionel GAUTHIER, Navid Nikaein
-* \date 2012 - 2014
-* \version 0.5
-* @ingroup util
-*/
-
-/*
- list.h
- -------------------
- AUTHOR : Lionel GAUTHIER
- COMPANY : EURECOM
- EMAIL : Lionel.Gauthier@eurecom.fr
-
- ***************************************************************************/
-#ifndef __LIST_H__
-# define __LIST_H__
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-#include
-#include
-#include
-#include
-
-
-#include "UTIL/MEM/mem_block.h"
-#include
-
-
-//-----------------------------------------------------------------------------
-void list_init (list_t* , char *);
-void list_free (list_t* listP);
-mem_block_t* list_get_head (list_t*);
-mem_block_t* list_remove_head (list_t* );
-mem_block_t* list_remove_element (mem_block_t*, list_t*);
-void list_add_head (mem_block_t* , list_t* );
-void list_add_tail_eurecom (mem_block_t* , list_t* );
-void list_add_list (list_t* , list_t* );
-void list_display (list_t* );
-//-----------------------------------------------------------------------------
-void list2_init (list2_t*, char*);
-void list2_free (list2_t* );
-mem_block_t* list2_get_head (list2_t*);
-mem_block_t* list2_get_tail (list2_t*);
-mem_block_t* list2_remove_element (mem_block_t* , list2_t* );
-mem_block_t* list2_remove_head (list2_t* );
-mem_block_t* list2_remove_tail (list2_t* );
-void list2_add_head (mem_block_t* , list2_t* );
-void list2_add_tail (mem_block_t* , list2_t* );
-void list2_add_list (list2_t* , list2_t* );
-void list2_display (list2_t* );
-//-----------------------------------------------------------------------------
-/* The following lists are used for sorting numbers */
-#ifndef LINUX_LIST
-/*! \brief the node structure */
-struct node {
- struct node* next; /*!< \brief is a node pointer */
- double val; /*!< \brief is a the value of a node pointer*/
-};
-//-----------------------------------------------------------------------------
-/*! \brief the list structure */
-struct list {
- struct node* head; /*!< \brief is a node pointer */
- ssize_t size; /*!< \brief is the list size*/
-};
-#else
-//-----------------------------------------------------------------------------
-struct entry {
- double val;
- LIST_ENTRY(entry) entries;
-};
-//-----------------------------------------------------------------------------
-struct list {
- LIST_HEAD(listhead, entry) head;
- ssize_t size;
-};
-#endif
-//-----------------------------------------------------------------------------
-void push_front (struct list*, double);
-void initialize (struct list*);
-void del (struct list*);
-void totable (double*, struct list*);
-int compare (const void * a, const void * b);
-int32_t calculate_median(struct list *loc_list);
-
-
-typedef struct {
- size_t size;
- size_t mallocedSize;
- size_t atomSize;
- size_t increment;
-} varArray_t;
-
-static inline varArray_t * initVarArray(size_t increment, size_t atomSize) {
- varArray_t * tmp=(varArray_t *)malloc(sizeof(varArray_t)+increment*atomSize);
- tmp->size=0;
- tmp->atomSize=atomSize;
- tmp->mallocedSize=increment;
- tmp->increment=increment;
- return(tmp);
-}
-
-static inline void * dataArray(varArray_t * input) {
- return input+1;
-}
-
-static inline void appendVarArray(varArray_t ** inputPtr, void* data) {
- varArray_t *input=*inputPtr;
- if (input->size>=input->mallocedSize) {
- input->mallocedSize+=input->increment;
- *inputPtr=(varArray_t *)realloc(input,sizeof(varArray_t)+input->mallocedSize*input->atomSize);
- AssertFatal(*inputPtr, "no memory left");
- input=*inputPtr;
- }
- memcpy((uint8_t*)(input+1)+input->atomSize*input->size++, data, input->atomSize);
-}
-
-static inline void freeVarArray(varArray_t * input) {
- free(input);
-}
-
-#endif
diff --git a/openair2/UTIL/LISTS/list2.c b/openair2/UTIL/LISTS/list2.c
deleted file mode 100644
index d9aa1b6a90..0000000000
--- a/openair2/UTIL/LISTS/list2.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-
-/*! \file pad_list.c
-* \brief list management primimtives
-* \author Mohamed Said MOSLI BOUKSIAA, Lionel GAUTHIER, Navid Nikaein
-* \date 2012 - 2014
-* \version 0.5
-* @ingroup util
-*/
-
-/***************************************************************************
- list2.c - description
- -------------------
- -------------------
- AUTHOR : Lionel GAUTHIER
- COMPANY : EURECOM
- EMAIL : Lionel.Gauthier@eurecom.fr
- ***************************************************************************/
-#define LIST2_C
-#include "list.h"
-#include "assertions.h"
-
-#include
-
-
-//-----------------------------------------------------------------------------
-/*
- * initialize list
- */
-//-----------------------------------------------------------------------------
-void
-list2_init (list2_t * listP, char *nameP)
-{
- //-----------------------------------------------------------------------------
- if (nameP) {
- strncpy( listP->name, nameP, LIST_NAME_MAX_CHAR-1 );
- listP->name[LIST_NAME_MAX_CHAR-1] = 0; // terminate string
- }
-
- listP->tail = NULL;
- listP->head = NULL;
- listP->nb_elements = 0;
-}
-
-//-----------------------------------------------------------------------------
-void
-list2_free (list2_t * listP)
-{
- //-----------------------------------------------------------------------------
-
- mem_block_t *le;
-
- while ((le = list2_remove_head (listP))) {
- free_mem_block (le, __func__);
- }
-}
-
-//-----------------------------------------------------------------------------
-/*
- * remove an element from list
- * @param pointer on targeted list
- * @param mem_block_t to remove
- * @return pointer on removed mem_block_t
- */
-mem_block_t *
-list2_remove_element (mem_block_t * elementP, list2_t * listP)
-{
- //-----------------------------------------------------------------------------
-
- if (elementP != NULL) {
- // head of list
- if (elementP == listP->head) {
- listP->head = elementP->next;
-
- if (listP->head == NULL) {
- listP->tail = NULL;
- } else {
- elementP->next->previous = NULL;
- elementP->next = NULL;
- }
-
- // tail of the list
- // note : case of 1 remaining element in the list has been treated above
- } else if (elementP == listP->tail) {
- // so several elements in the list
- listP->tail = elementP->previous;
- listP->tail->next = NULL;
- elementP->previous = NULL;
- // in the middle of the list, after a head element and before the tail element
- } else {
- // link element n-1 with element n+1
- elementP->previous->next = elementP->next;
- elementP->next->previous = elementP->previous;
- elementP->next = NULL;
- elementP->previous = NULL;
- }
-
- listP->nb_elements = listP->nb_elements - 1;
- }
-
- return elementP;
-}
-//-----------------------------------------------------------------------------
-mem_block_t *
-list2_get_head (list2_t * listP)
-{
- //-----------------------------------------------------------------------------
- return listP->head;
-}
-
-//-----------------------------------------------------------------------------
-mem_block_t *
-list2_get_tail (list2_t * listP)
-{
- //-----------------------------------------------------------------------------
- return listP->tail;
-}
-
-//-----------------------------------------------------------------------------
-/*
- * remove an element from head of a list
- * @param pointer on targeted list
- * @return pointer on removed mem_block_t
- */
-mem_block_t *
-list2_remove_head (list2_t * listP)
-{
- //-----------------------------------------------------------------------------
-
- // access optimisation
- mem_block_t *head;
-
- head = listP->head;
-
- // almost one element
- if (head != NULL) {
- listP->head = head->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- // if only one element, update tail
- if (listP->head == NULL) {
- listP->tail = NULL;
- } else {
- listP->head->previous = NULL;
- head->next = NULL;
- }
- } else {
- //msg("[MEM_MGT][WARNING] remove_head_from_list(%s) no elements\n",listP->name);
- }
-
- return head;
-}
-
-//-----------------------------------------------------------------------------
-/*
- * remove an element from tail of a list
- * @param pointer on targeted list
- * @return pointer on removed mem_block_t
- */
-mem_block_t *
-list2_remove_tail (list2_t * listP)
-{
- //-----------------------------------------------------------------------------
-
- // access optimisation;
- mem_block_t *tail;
-
-
- tail = listP->tail;
-
- // almost one element;
- if (tail != NULL) {
- listP->nb_elements = listP->nb_elements - 1;
-
- // if only one element, update head, tail;
- if (listP->head == tail) {
- listP->head = NULL;
- listP->tail = NULL;
- } else {
- listP->tail = tail->previous;
- tail->previous->next = NULL;
- }
-
- tail->previous = NULL;
- } else {
- //msg("[MEM_MGT][WARNING] remove_head_from_list(%s) no elements\n",listP->name);
- }
-
- return tail;
-}
-
-//-----------------------------------------------------------------------------
-/*
- * add an element to the beginning of a list
- * @param pointer on targeted list
- * @return pointer on removed mem_block_t
- */
-void
-list2_add_head (mem_block_t * elementP, list2_t * listP)
-{
- //-----------------------------------------------------------------------------
-
- // access optimisation;
- mem_block_t *head;
-
- if (elementP != NULL) {
- head = listP->head;
- listP->nb_elements = listP->nb_elements + 1;
-
- // almost one element
- if (head == NULL) {
- elementP->previous = NULL;
- elementP->next = NULL;
- listP->head = elementP;
- listP->tail = elementP;
- } else {
- elementP->next = head;
- head->previous = elementP;
- elementP->previous = NULL;
- listP->head = elementP;
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-/*
- * add an element to the end of a list
- * @param pointer on targeted list
- * @return pointer on removed mem_block_t
- */
-void
-list2_add_tail (mem_block_t * elementP, list2_t * listP)
-{
- mem_block_t *tail;
- //-----------------------------------------------------------------------------
-
- if (elementP != NULL) {
- // access optimisation
- listP->nb_elements = listP->nb_elements + 1;
- elementP->next = NULL;
- tail = listP->tail;
-
- // almost one element
- if (tail == NULL) {
- elementP->previous = NULL;
- listP->head = elementP;
- } else {
- tail->next = elementP;
- elementP->previous = tail;
- }
-
- listP->tail = elementP;
- }
-}
-
-//-----------------------------------------------------------------------------
-void
-list2_add_list (list2_t * sublistP, list2_t * listP)
-{
- //-----------------------------------------------------------------------------
-
- if (sublistP) {
- if (sublistP->head) {
- // access optimisation
- mem_block_t *tail;
-
- tail = listP->tail;
-
- // almost one element
- if (tail == NULL) {
- listP->head = sublistP->head;
- } else {
- tail->next = sublistP->head;
- sublistP->head->previous = tail;
- }
-
- listP->tail = sublistP->tail;
- // clear sublist
- sublistP->head = NULL;
- sublistP->tail = NULL;
- }
-
- listP->nb_elements = listP->nb_elements + sublistP->nb_elements;
- }
-}
-
-//-----------------------------------------------------------------------------
-void
-list2_display (list2_t * listP)
-{
- //-----------------------------------------------------------------------------
- /*
- mem_block_t *cursor;
- unsigned short nb_elements = 0;
- //uint32_t nb_bytes;
- // uint32_t index;
-
- // test lists
- if (listP) {
- cursor = listP->head;
- if (cursor) {
- // almost one element
- msg ("Display list %s %p", listP->name, listP);
- while (cursor != NULL) {
- msg ("%d:", cursor->pool_id);
- //nb_bytes = (( sdu_management*)(cursor->misc))->size;
- // for (index=0; index < nb_bytes; index++) {
- // msg("%02X.",cursor->data[index]);
- // }
- msg ("\n");
- cursor = cursor->next;
- nb_elements++;
- }
- msg (" found nb_elements %d nb_elements %d\n", nb_elements, listP->nb_elements);
- AssertFatal(nb_elements == listP->nb_elements, "Bad count of elements %d != %d", nb_elements, listP->nb_elements);
- }
- }*/
-}
diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h
index 3733914ef4..9492e036b7 100644
--- a/radio/COMMON/common_lib.h
+++ b/radio/COMMON/common_lib.h
@@ -152,11 +152,19 @@ typedef enum {
/*! \brief Radio Tx burst flags */
typedef enum {
- Invalid = 0,
- MiddleOfBurst,
- StartOfBurst,
- EndOfBurst
-} radio_tx_flag_t;
+ TX_BURST_INVALID = 0,
+ TX_BURST_MIDDLE = 1,
+ TX_BURST_START = 2,
+ TX_BURST_END = 3,
+ TX_BURST_START_AND_END = 4,
+ TX_BURST_END_NO_TIME_SPEC = 10,
+} radio_tx_burst_flag_t;
+
+/*! \brief Radio TX GPIO flags: MSB to enable sending GPIO command, 12 LSB carry GPIO values */
+typedef enum {
+ /* first 12 bits reserved for beams */
+ TX_GPIO_CHANGE = 0x1000,
+} radio_tx_gpio_flag_t;
/*! \brief Structure used for initializing UDP read threads */
typedef struct {
@@ -315,7 +323,7 @@ typedef struct {
int cc;
signed char first_packet;
signed char last_packet;
- int flags_msb;
+ radio_tx_gpio_flag_t flags_gpio;
} openair0_write_package_t;
typedef struct {
diff --git a/radio/IRIS/USERSPACE/LIB/iris_lib.cpp b/radio/IRIS/USERSPACE/LIB/iris_lib.cpp
index 051efe7a53..32a2f51db0 100644
--- a/radio/IRIS/USERSPACE/LIB/iris_lib.cpp
+++ b/radio/IRIS/USERSPACE/LIB/iris_lib.cpp
@@ -164,9 +164,9 @@ trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buf
return nsamps;
}
- if (flags == 2 || flags == 1) { // start of burst
+ if (flags == TX_BURST_START || flags == TX_BURST_MIDDLE)
- } else if (flags == 3 || flags == 4) {
+ } else if (flags == TX_BURST_END || flags == TX_BURST_START_AND_END) {
flag |= SOAPY_SDR_END_BURST;
}
diff --git a/radio/USRP/USERSPACE/LIB/usrp_lib.cpp b/radio/USRP/USERSPACE/LIB/usrp_lib.cpp
index 1f6fbd34b1..d175295fce 100644
--- a/radio/USRP/USERSPACE/LIB/usrp_lib.cpp
+++ b/radio/USRP/USERSPACE/LIB/usrp_lib.cpp
@@ -59,7 +59,6 @@
/** @addtogroup _USRP_PHY_RF_INTERFACE_
* @{
*/
-int gpio789=0;
extern int usrp_tx_thread;
@@ -88,6 +87,9 @@ typedef struct {
//! TX forward samples. We use usrp_time_offset to get this value
int tx_forward_nsamps; //166 for 20Mhz
+ //! gpio bank to use
+ char *gpio_bank;
+
// --------------------------------
// Debug and output control
// --------------------------------
@@ -258,27 +260,41 @@ static int sync_to_gps(openair0_device *device) {
return EXIT_SUCCESS;
}
+#define ATR_MASK 0x7f //pins controlled by ATR
+#define ATR_RX 0x50 //data[4] and data[6]
+#define ATR_XX 0x20 //data[5]
+#define MAN_MASK ATR_MASK^0xFFF //manually controlled pins
+
/*! \brief Called to start the USRP transceiver. Return 0 if OK, < 0 if error
@param device pointer to the device structure specific to the RF hardware target
*/
static int trx_usrp_start(openair0_device *device) {
usrp_state_t *s = (usrp_state_t *)device->priv;
- if (device->type != USRP_X400_DEV) {
- // setup GPIO for TDD, GPIO(4) = ATR_RX
- //set data direction register (DDR) to output
- s->usrp->set_gpio_attr("FP0", "DDR", 0xfff, 0xfff);
- //set lower 7 bits to be controlled automatically by ATR (the rest 5 bits are controlled manually)
- s->usrp->set_gpio_attr("FP0", "CTRL", 0x7f,0xfff);
- //set pins 4 (RX_TX_Switch) and 6 (Shutdown PA) to 1 when the radio is only receiving (ATR_RX)
- s->usrp->set_gpio_attr("FP0", "ATR_RX", (1<<4)|(1<<6), 0x7f);
- // set pin 5 (Shutdown LNA) to 1 when the radio is transmitting and receiveing (ATR_XX)
- // (we use full duplex here, because our RX is on all the time - this might need to change later)
- s->usrp->set_gpio_attr("FP0", "ATR_XX", (1<<5), 0x7f);
- // set the output pins to 1
- s->usrp->set_gpio_attr("FP0", "OUT", 7<<7, 0xf80);
- }
+ s->gpio_bank = (char *) "FP0"; //good for B210, X310 and N310
+#if UHD_VERSION>4000000
+ if (device->type == USRP_X400_DEV) {
+ // Set every pin on GPIO0 to be controlled by DB0_RF0
+ std::vector sxx{12, "DB0_RF0"};
+ s->gpio_bank = (char *) "GPIO0";
+ s->usrp->set_gpio_src(s->gpio_bank, sxx);
+ }
+#endif
+
+ // setup GPIO for TDD, GPIO(4) = ATR_RX
+ //set data direction register (DDR) to output
+ s->usrp->set_gpio_attr(s->gpio_bank, "DDR", 0xfff, 0xfff);
+ //set bits to be controlled automatically by ATR
+ s->usrp->set_gpio_attr(s->gpio_bank, "CTRL", ATR_MASK, 0xfff);
+ //set bits to 1 when the radio is only receiving (ATR_RX)
+ s->usrp->set_gpio_attr(s->gpio_bank, "ATR_RX", ATR_RX, ATR_MASK);
+ // set bits to 1 when the radio is transmitting and receiveing (ATR_XX)
+ // (we use full duplex here, because our RX is on all the time - this might need to change later)
+ s->usrp->set_gpio_attr(s->gpio_bank, "ATR_XX", ATR_XX, ATR_MASK);
+ // set all other pins to manual
+ s->usrp->set_gpio_attr(s->gpio_bank, "OUT", MAN_MASK, 0xfff);
+
s->wait_for_first_pps = 1;
s->rx_count = 0;
s->tx_count = 0;
@@ -373,8 +389,8 @@ static int trx_usrp_write(openair0_device *device,
usrp_state_t *s = (usrp_state_t *)device->priv;
int nsamps2; // aligned to upper 32 or 16 byte boundary
- int flags_lsb = flags&0xff;
- int flags_msb = (flags>>8)&0xff;
+ radio_tx_burst_flag_t flags_burst = (radio_tx_burst_flag_t) (flags & 0xf);
+ radio_tx_gpio_flag_t flags_gpio = (radio_tx_gpio_flag_t) ((flags >> 4) & 0x1fff);
int end;
openair0_thread_t *write_thread = &device->write_thread;
@@ -384,28 +400,28 @@ static int trx_usrp_write(openair0_device *device,
bool first_packet_state=false,last_packet_state=false;
- if (flags_lsb == 2) { // start of burst
+ if (flags_burst == TX_BURST_START) {
// s->tx_md.start_of_burst = true;
// s->tx_md.end_of_burst = false;
first_packet_state = true;
last_packet_state = false;
- } else if (flags_lsb == 3) { // end of burst
+ } else if (flags_burst == TX_BURST_END) {
//s->tx_md.start_of_burst = false;
//s->tx_md.end_of_burst = true;
first_packet_state = false;
last_packet_state = true;
- } else if (flags_lsb == 4) { // start and end
+ } else if (flags_burst == TX_BURST_START_AND_END) {
// s->tx_md.start_of_burst = true;
// s->tx_md.end_of_burst = true;
first_packet_state = true;
last_packet_state = true;
- } else if (flags_lsb==1) { // middle of burst
+ } else if (flags_burst == TX_BURST_MIDDLE) {
// s->tx_md.start_of_burst = false;
// s->tx_md.end_of_burst = false;
first_packet_state = false;
last_packet_state = false;
}
- else if (flags_lsb==10) { // fail safe mode
+ else if (flags_burst==10) { // fail safe mode
// s->tx_md.has_time_spec = false;
// s->tx_md.start_of_burst = false;
// s->tx_md.end_of_burst = true;
@@ -449,12 +465,11 @@ static int trx_usrp_write(openair0_device *device,
s->tx_count++;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHING_GPIO,1);
- // bit 3 enables gpio (for backward compatibility)
- if (flags_msb&8) {
- // push GPIO bits 7-9 from flags_msb
- int gpio789=(flags_msb&7)<<7;
+ // bit 13 enables gpio
+ if ((flags_gpio & TX_GPIO_CHANGE) != 0) {
+ // push GPIO bits
s->usrp->set_command_time(s->tx_md.time_spec);
- s->usrp->set_gpio_attr("FP0", "OUT", gpio789, 0x380);
+ s->usrp->set_gpio_attr(s->gpio_bank, "OUT", flags_gpio, MAN_MASK);
s->usrp->clear_command_time();
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHING_GPIO,0);
@@ -489,7 +504,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHI
write_package[end].cc = cc;
write_package[end].first_packet = first_packet_state;
write_package[end].last_packet = last_packet_state;
- write_package[end].flags_msb = flags_msb;
+ write_package[end].flags_gpio = flags_gpio;
for (int i = 0; i < cc; i++)
write_package[end].buff[i] = buff[i];
write_thread->count_write++;
@@ -526,7 +541,7 @@ void *trx_usrp_write_thread(void * arg){
int cc;
signed char first_packet;
signed char last_packet;
- int flags_msb;
+ int flags_gpio;
while(1){
pthread_mutex_lock(&write_thread->mutex_write);
@@ -544,7 +559,7 @@ void *trx_usrp_write_thread(void * arg){
cc = write_package[start].cc;
first_packet = write_package[start].first_packet;
last_packet = write_package[start].last_packet;
- flags_msb = write_package[start].flags_msb;
+ flags_gpio = write_package[start].flags_gpio;
write_thread->start = (write_thread->start + 1)% MAX_WRITE_THREAD_PACKAGE;
write_thread->count_write--;
pthread_mutex_unlock(&write_thread->mutex_write);
@@ -589,11 +604,10 @@ void *trx_usrp_write_thread(void * arg){
s->tx_count++;
// bit 3 enables gpio (for backward compatibility)
- if (flags_msb&8) {
- // push GPIO bits 7-9 from flags_msb
- int gpio789=(flags_msb&7)<<7;
+ if (flags_gpio&0x1000) {
+ // push GPIO bits
s->usrp->set_command_time(s->tx_md.time_spec);
- s->usrp->set_gpio_attr("FP0", "OUT", gpio789, 0x380);
+ s->usrp->set_gpio_attr(s->gpio_bank, "OUT", flags_gpio, MAN_MASK);
s->usrp->clear_command_time();
}
@@ -740,11 +754,6 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
s->rx_timestamp = s->rx_md.time_spec.to_ticks(s->sample_rate);
*ptimestamp = s->rx_timestamp;
- // push GPIO bits 7-9 from flags_msb
- /*s->usrp->set_command_time(uhd::time_spec_t::from_ticks((s->rx_timestamp+(2*nsamps)),s->sample_rate));
- s->usrp->set_gpio_attr("FP0", "OUT", gpio789<<7, 0x380);
- s->usrp->clear_command_time();
- gpio789 = (gpio789+1)&7;*/
recplay_state_t *recPlay=device->recplay_state;
if ( recPlay != NULL) { // record mode
@@ -992,7 +1001,7 @@ extern "C" {
int choffset = 0;
if ( device->priv == NULL) {
- s=(usrp_state_t *)calloc(sizeof(usrp_state_t),1);
+ s=(usrp_state_t *)calloc(1, sizeof(usrp_state_t));
device->priv=s;
AssertFatal( s!=NULL,"USRP device: memory allocation failure\n");
} else {
diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/pnf.sa.band78.rfsim.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/pnf.sa.band78.rfsim.conf
new file mode 100644
index 0000000000..06bb23309e
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/pnf.sa.band78.rfsim.conf
@@ -0,0 +1,54 @@
+
+L1s = (
+{
+ num_cc = 1;
+ tr_n_preference = "nfapi";
+ local_n_if_name = "lo";
+ remote_n_address = "127.0.0.2"; // vnf addr
+ local_n_address = "127.0.0.1"; // pnf addr
+ local_n_portc = 50000; // pnf p5 port [!]
+ remote_n_portc = 50001; // vnf p5 port
+ local_n_portd = 50010; // pnf p7 port
+ remote_n_portd = 50011; // vnf p7 port
+ prach_dtx_threshold = 120;
+ pucch0_dtx_threshold = 150;
+ ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0
+}
+);
+
+RUs = (
+{
+ local_rf = "yes"
+ nb_tx = 1
+ nb_rx = 1
+ att_tx = 0
+ att_rx = 0;
+ bands = [78];
+ max_pdschReferenceSignalPower = -27;
+ max_rxgain = 114;
+}
+);
+
+
+rfsimulator :
+{
+ serveraddr = "server";
+ serverport = "4043";
+ options = (); #("saviq"); or/and "chanmod"
+ modelname = "AWGN";
+ IQfile = "/tmp/rfsimulator.iqs";
+};
+
+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";
+};
+
diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/vnf.sa.band78.106prb.rfsim.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/vnf.sa.band78.106prb.rfsim.conf
new file mode 100644
index 0000000000..d763268ca8
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/vnf.sa.band78.106prb.rfsim.conf
@@ -0,0 +1,251 @@
+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 = 1;
+ plmn_list = ({
+ mcc = 208;
+ mnc = 99;
+ mnc_length = 2;
+ snssaiList = (
+ {
+ sst = 1;
+ sd = 0x1; // 0 false, else true
+ },
+ {
+ sst = 1;
+ sd = 0x112233; // 0 false, else true
+ }
+ );
+
+ });
+
+ nr_cellid = 12345678L;
+
+ ////////// Physical parameters:
+
+ ssb_SubcarrierOffset = 0;
+ pdsch_AntennaPorts = 1;
+ pusch_AntennaPorts = 1;
+ min_rxtxtime = 6;
+ sib1_tda = 0;
+
+ pdcch_ConfigSIB1 = (
+ {
+ controlResourceSetZero = 12;
+ searchSpaceZero = 0;
+ }
+ );
+
+ servingCellConfigCommon = (
+ {
+ #spCellConfigCommon
+
+ physCellId = 0;
+
+# downlinkConfigCommon
+ #frequencyInfoDL
+ # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP)
+ absoluteFrequencySSB = 641280;
+ dl_frequencyBand = 78;
+ # this is 3600 MHz
+ dl_absoluteFrequencyPointA = 640008;
+ #scs-SpecificCarrierList
+ dl_offstToCarrier = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ dl_subcarrierSpacing = 1;
+ dl_carrierBandwidth = 106;
+ #initialDownlinkBWP
+ #genericParameters
+ # this is RBstart=27,L=48 (275*(L-1))+RBstart
+ initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952
+# 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 = 106;
+ pMax = 20;
+ #initialUplinkBWP
+ #genericParameters
+ initialULBWPlocationAndBandwidth = 28875;
+# 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 = 13;
+ preambleReceivedTargetPower = -96;
+#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 = 4;
+#oneHalf (0..15) 4,8,12,16,...60,64
+ ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14;
+#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 setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+ pucchGroupHopping = 0;
+ hoppingId = 40;
+ p0_nominal = -90;
+# 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;
+
+# dmrs_TypeA_position
+# 0 = pos2, 1 = pos3
+ dmrs_TypeA_Position = 0;
+
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ subcarrierSpacing = 1;
+
+
+ #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 = "192.168.70.132";
+ ipv6 = "192:168:30::17";
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+
+
+ NETWORK_INTERFACES :
+ {
+ GNB_INTERFACE_NAME_FOR_NG_AMF = "demo-oai";
+ GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.70.129/24";
+ GNB_INTERFACE_NAME_FOR_NGU = "demo-oai";
+ GNB_IPV4_ADDRESS_FOR_NGU = "192.168.70.129/24";
+ GNB_PORT_FOR_S1U = 2152; # Spec 2152
+ };
+
+ }
+);
+
+MACRLCs = (
+ {
+ num_cc = 1;
+ local_s_if_name = "lo:";
+ remote_s_address = "127.0.0.1"; // pnf addr [!]
+ local_s_address = "127.0.0.2"; // vnf addr
+ local_s_portc = 50001; // vnf p5 port
+ remote_s_portc = 50000; // pnf p5 port [!]
+ local_s_portd = 50011; // vnf p7 port [!]
+ remote_s_portd = 50010; // pnf p7 port [!]
+ tr_s_preference = "nfapi";
+ tr_n_preference = "local_RRC";
+ }
+)
+
+
+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";
+};
diff --git a/targets/TEST/RLC_AM_V9.3.0/Makefile b/targets/TEST/RLC_AM_V9.3.0/Makefile
deleted file mode 100644
index 8884d7b667..0000000000
--- a/targets/TEST/RLC_AM_V9.3.0/Makefile
+++ /dev/null
@@ -1,199 +0,0 @@
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-
-NUM_CORES=$(shell cat /proc/cpuinfo | grep processor | wc -l)
-
-TOP_DIR = $(OPENAIR1_DIR)
-OPENAIR1_TOP = $(OPENAIR1_DIR)
-OPENAIR2_TOP = $(OPENAIR2_DIR)
-OPENAIR3_TOP = $(OPENAIR3_DIR)
-OPENAIR3 = $(OPENAIR3_DIR)
-
-CFLAGS += -m32 -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11
-
-ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
-
-CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
-CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1
-#CFLAGS += -DLLR8
-
-ifndef OPENAIR2
-OPENAIR2=1
-endif
-
-ifdef TRAFFIC_TM5
-CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 #-DFULL_BUFFER=1
-endif
-
-# activate OCG and libxml only under linux
-ifeq ($(linux),1)
-CFLAGS += -I/usr/include/libxml2 -L/usr/local/lib -I/usr/include/atlas -L/usr/X11R6/lib
-OCG_FLAG = 1
-cygwin=0
-CFLAGS += -DLINUX
-else
-cygwin=1
-OCG_FLAG = 0
-endif
-
-
-ifdef XFORMS
-CFLAGS += -DXFORMS
-endif
-
-ifdef PRINT_STATS
-CFLAGS += -DPRINT_STATS
-endif
-
-ifndef rrc_cellular
-rrc_cellular = 0
-rrc_cellular_eNB = 0
-rrc_cellular_UE = 0
-else
- ifeq ($(eNB_flag),1)
- rrc_cellular_eNB=1
- endif
- ifeq ($(UE_flag),1)
- rrc_cellular_UE=1
- endif
-endif
-
-ifdef DEBUG_PHY
-CFLAGS += -DDEBUG_PHY
-endif
-
-# ln -sf EUTRA-RRC-Definitions-a20.asn EUTRA-RRC-Definitions.asn
-# make cleanasn1
-#make all Rel10=1
-export IS_REL10=$(shell if [ -f .lock-rel10 ] ; then echo "1" ; else echo "0" ; fi)
-export IS_REL8=$(shell if [ -f .lock-rel8 ] ; then echo "1" ; else echo "0" ; fi)
-
-ifdef Rel10
-CFLAGS += -DRel10
-ifeq ($(IS_REL10), 0)
- $(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ; rm EUTRA-RRC-Definitions.asn ; ln -s EUTRA-RRC-Definitions-a20.asn EUTRA-RRC-Definitions.asn ; cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; ln -s asn1-86_constants.h asn1_constants.h ; cd $(OPENAIR_TARGETS)/SIMU/USER/ ; rm -f $(ASN1_MSG_OBJS1) ; rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ; rm -f $(L2_OBJS) ; rm -f *.o ; rm -f oaisim ; touch .lock-rel10 ; rm .lock-rel8 ;)
-endif
-else # default is rel 8
-ifeq ($(IS_REL8), 0)
- $(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ; rm EUTRA-RRC-Definitions.asn ; ln -s EUTRA-RRC-Definitions-86.asn EUTRA-RRC-Definitions.asn ; cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; ln -s asn1-a20_constants.h asn1_constants.h ; cd $(OPENAIR_TARGETS)/SIMU/USER/ ; rm -f $(ASN1_MSG_OBJS1) ; rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ; rm -f $(L2_OBJS); rm -f *.o ; rm -f oaisim ; touch .lock-rel8 ; rm .lock-rel10 ; )
-endif
-endif
-
-ifeq ($(NAS), 1)
-CFLAGS += -DPDCP_USE_NETLINK -DLINUX
-NAS_FLAG=1
-endif
-
-ifdef TEST_OMG
-CFLAGS += -DTEST_OMG
-#CFLAGS += -DDEBUG_OMG
-endif
-# after the execution, a profiling output "gmon.out" will be created,
-#then we need to run "gprof ./oaisim > gmon.txt" in the same directory as "gmon.out"
-# you could also use the script "grpof2dot.py gmon.txt" for visual diagrams
-ifdef GPROF
-CFLAGS += -pg
-endif
-
-#require kernel patch for oai driver to enable address autoconfiguration (IPv6 only)
-ifdef ADDCONF
-CFLAGS+=-DADDRCONF
-endif
-
-ifdef OAI_NW_DRIVER_TYPE_ETHERNET
-CFLAGS+=-DOAI_NW_DRIVER_TYPE_ETHERNET
-endif
-
-CFLAGS += $(shell if [ `uname -o` = "Cygwin" ] ; then echo "-DCYGWIN" ;fi)
-
-CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
-
-ifneq ($(USE_MME), R8)
-UPDATE_RELEASE_9=1
-endif
-
-
-
-EXTRA_CFLAGS += -DOPENAIR2
-EXTRA_CFLAGS += -DASSERT
-EXTRA_CFLAGS += -DNO_RRM
-EXTRA_CFLAGS += -DTEST_RLC_AM
-
-COMMON_DIR = $(OPENAIR2_TOP)/COMMON
-L2_INTERFACE_DIR = $(OPENAIR2_TOP)/RRC/L2_INTERFACE
-RLC_UM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/UM_v9.3.0
-RLC_AM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/AM_v9.3.0
-RLC_TM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/TM_v9.3.0
-RLC_DIR = $(OPENAIR2_TOP)/LAYER2/RLC
-PDCP_DIR = $(OPENAIR2_TOP)/LAYER2/PDCP
-MEM_DIR = $(OPENAIR2_TOP)/UTIL/MEM
-LIST_DIR = $(OPENAIR2_TOP)/UTIL/LISTS
-MATH_DIR = $(OPENAIR2_TOP)/UTIL/MATH
-TIMER_DIR = $(OPENAIR2_TOP)/UTIL/TIMER
-PHY_INTERFACE_DIR = $(OPENAIR2_TOP)/PHY_INTERFACE
-RRC_DIR = $(OPENAIR2_TOP)/RRC/LITE
-L2_INTERFACE_DIR = $(OPENAIR2_TOP)/RRC/L2_INTERFACE
-MAC_DIR = $(OPENAIR2_TOP)/LAYER2/MAC
-LOG_DIR=$(OPENAIR2_TOP)/UTIL/LOG
-OCG_DIR=$(OPENAIR2_TOP)/UTIL/OCG
-OPT_DIR=$(OPENAIR2_TOP)/UTIL/OPT
-
-
-SOURCES_L2 = $(LIST_DIR)/list.c
-SOURCES_L2 += $(LIST_DIR)/list2.c
-
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_init.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_timer_poll_retransmit.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_timer_reordering.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_timer_status_prohibit.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_segment.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_segments_holes.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_in_sdu.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_receiver.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_retransmit.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_windows.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_rx_list.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_reassembly.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_status_report.c
-SOURCES_L2 += $(RLC_AM_DIR)/rlc_am_test.c
-
-SOURCES_L2 += $(MEM_DIR)/mem_block.c
-
-LOG_OBJS = $(LOG_DIR)/log.o
-LOG_OBJS += $(LOG_DIR)/vcd_signal_dumper.o
-OPT_OBJS = $(OPT_DIR)/probe.o
-
-L2_OBJS=$(addsuffix .o,$(basename $(SOURCES_L2))) $(PHY_INTERFACE_OBJS) $(MAC_OBJS) $(L2_INTERFACE_OBJS) $(RRC_OBJS) $(LOG_OBJS) $(OPT_OBJS)
-
-
-L2_incl = -I$(OPENAIR2_TOP) -I$(COMMON_DIR) -I$(RLC_DIR) -I$(RLC_AM_DIR) -I$(RLC_UM_DIR) -I$(RLC_TM_DIR) -I$(PDCP_DIR) -I$(MEM_DIR) -I$(LIST_DIR) -I$(LOG_DIR) -I$(MATH_DIR) -I$(TIMER_DIR) -I$(OPENAIR3)/MESH -I$(OPENAIR2_TOP)/RRC/LITE -I$(OPENAIR2_TOP)/RRC/LITE/MESSAGES -I$(OPENAIR3)/MESH/RRM -I$(OPT_DIR)
-
-
-
-
-
-ASN1_MSG_OBJS2 := $(foreach file, $(ASN1_MSG_OBJS), $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/$(file))
-
-OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(SCHED_OBJS) $(STATS_OBJS) $(ASN1_MSG_OBJS2)
-
-all: testam
-
-
-$(OBJ) : %.o : %.c
- $(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) -I$(ASN1_MSG_INC) -o $@ $<
-
-$(L2_OBJS) : %.o : %.c
- $(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) -I$(ASN1_MSG_INC) -o $@ $<
-
-testam : $(OBJ) $(L2_OBJS) oaisim.c
- echo CYGWIN variable is $(cygwin)
- $(CC) oaisim.c -I$(TOP_DIR) $(L2_incl) -I$(ASN1_MSG_INC) -o testam $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(L2_OBJS) -lm -lrt
-
-
-clean:
- rm -f testam
- rm -f $(OBJ)
- rm -f $(L2_OBJS)
- rm -f *.o
- rm -f *.exe*
-
diff --git a/targets/TEST/RLC_AM_V9.3.0/oaisim.c b/targets/TEST/RLC_AM_V9.3.0/oaisim.c
deleted file mode 100644
index fc2082f1df..0000000000
--- a/targets/TEST/RLC_AM_V9.3.0/oaisim.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#include
-#include
-#include
-#include "SIMULATION/TOOLS/defs.h"
-#include "SIMULATION/RF/defs.h"
-#include "PHY/types.h"
-#include "PHY/defs.h"
-#include "PHY/vars.h"
-#include "MAC_INTERFACE/vars.h"
-
-#include "rlc_am.h"
-#include "rlc_am_test.h"
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/vars.h"
-#include "UTIL/LOG/log_if.h"
-#include "UTIL/LOG/log_extern.h"
-#include "RRC/LTE/vars.h"
-#include "PHY_INTERFACE/vars.h"
-#include "UTIL/OCG/OCG.h"
-
-
-
-int main(int argc, char **argv)
-{
-
- //initialize the log generator
- logInit();
- mac_xface = malloc(sizeof(MAC_xface));
- rlc_am_v9_3_0_test();
- return(0);
-}
-
-
diff --git a/targets/TEST/RLC_UM_V9.3.0/Makefile b/targets/TEST/RLC_UM_V9.3.0/Makefile
deleted file mode 100644
index 919def5f1e..0000000000
--- a/targets/TEST/RLC_UM_V9.3.0/Makefile
+++ /dev/null
@@ -1,188 +0,0 @@
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-
-NUM_CORES=$(shell cat /proc/cpuinfo | grep processor | wc -l)
-
-TOP_DIR = $(OPENAIR1_DIR)
-OPENAIR1_TOP = $(OPENAIR1_DIR)
-OPENAIR2_TOP = $(OPENAIR2_DIR)
-OPENAIR3_TOP = $(OPENAIR3_DIR)
-OPENAIR3 = $(OPENAIR3_DIR)
-
-CFLAGS += -m32 -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11
-
-ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
-
-CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
-CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1
-#CFLAGS += -DLLR8
-
-ifndef OPENAIR2
-OPENAIR2=1
-endif
-
-ifdef TRAFFIC_TM5
-CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 #-DFULL_BUFFER=1
-endif
-
-# activate OCG and libxml only under linux
-ifeq ($(linux),1)
-CFLAGS += -I/usr/include/libxml2 -L/usr/local/lib -I/usr/include/atlas -L/usr/X11R6/lib
-OCG_FLAG = 1
-CFLAGS += -DLINUX
-else
-OCG_FLAG = 0
-endif
-
-ifdef XFORMS
-CFLAGS += -DXFORMS
-endif
-
-ifdef PRINT_STATS
-CFLAGS += -DPRINT_STATS
-endif
-
-ifndef rrc_cellular
-rrc_cellular = 0
-rrc_cellular_eNB = 0
-rrc_cellular_UE = 0
-else
- ifeq ($(eNB_flag),1)
- rrc_cellular_eNB=1
- endif
- ifeq ($(UE_flag),1)
- rrc_cellular_UE=1
- endif
-endif
-
-ifdef DEBUG_PHY
-CFLAGS += -DDEBUG_PHY
-endif
-
-# ln -sf EUTRA-RRC-Definitions-a20.asn EUTRA-RRC-Definitions.asn
-# make cleanasn1
-#make all Rel10=1
-export IS_REL10=$(shell if [ -f .lock-rel10 ] ; then echo "1" ; else echo "0" ; fi)
-export IS_REL8=$(shell if [ -f .lock-rel8 ] ; then echo "1" ; else echo "0" ; fi)
-
-ifdef Rel10
-CFLAGS += -DRel10
-ifeq ($(IS_REL10), 0)
- $(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ; rm EUTRA-RRC-Definitions.asn ; ln -s EUTRA-RRC-Definitions-a20.asn EUTRA-RRC-Definitions.asn ; cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; ln -s asn1-86_constants.h asn1_constants.h ; cd $(OPENAIR_TARGETS)/SIMU/USER/ ; rm -f $(ASN1_MSG_OBJS1) ; rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ; rm -f $(L2_OBJS) ; rm -f *.o ; rm -f oaisim ; touch .lock-rel10 ; rm .lock-rel8 ;)
-endif
-else # default is rel 8
-ifeq ($(IS_REL8), 0)
- $(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/ ; rm EUTRA-RRC-Definitions.asn ; ln -s EUTRA-RRC-Definitions-86.asn EUTRA-RRC-Definitions.asn ; cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; ln -s asn1-a20_constants.h asn1_constants.h ; cd $(OPENAIR_TARGETS)/SIMU/USER/ ; rm -f $(ASN1_MSG_OBJS1) ; rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated ; rm -f $(L2_OBJS); rm -f *.o ; rm -f oaisim ; touch .lock-rel8 ; rm .lock-rel10 ; )
-endif
-endif
-
-ifeq ($(NAS), 1)
-CFLAGS += -DPDCP_USE_NETLINK -DLINUX
-NAS_FLAG=1
-endif
-
-ifdef TEST_OMG
-CFLAGS += -DTEST_OMG
-#CFLAGS += -DDEBUG_OMG
-endif
-# after the execution, a profiling output "gmon.out" will be created,
-#then we need to run "gprof ./oaisim > gmon.txt" in the same directory as "gmon.out"
-# you could also use the script "grpof2dot.py gmon.txt" for visual diagrams
-ifdef GPROF
-CFLAGS += -pg
-endif
-
-#require kernel patch for oai driver to enable address autoconfiguration (IPv6 only)
-ifdef ADDCONF
-CFLAGS+=-DADDRCONF
-endif
-
-ifdef OAI_NW_DRIVER_TYPE_ETHERNET
-CFLAGS+=-DOAI_NW_DRIVER_TYPE_ETHERNET
-endif
-
-CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
-
-ifneq ($(USE_MME), R8)
-UPDATE_RELEASE_9=1
-endif
-
-
-
-EXTRA_CFLAGS += -DOPENAIR2
-EXTRA_CFLAGS += -DASSERT
-EXTRA_CFLAGS += -DNO_RRM
-EXTRA_CFLAGS += -DTEST_RLC_UM
-
-COMMON_DIR = $(OPENAIR2_TOP)/COMMON
-L2_INTERFACE_DIR = $(OPENAIR2_TOP)/RRC/L2_INTERFACE
-RLC_UM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/UM_v9.3.0
-RLC_AM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/AM_v9.3.0
-RLC_TM_DIR = $(OPENAIR2_TOP)/LAYER2/RLC/TM_v9.3.0
-RLC_DIR = $(OPENAIR2_TOP)/LAYER2/RLC
-PDCP_DIR = $(OPENAIR2_TOP)/LAYER2/PDCP
-MEM_DIR = $(OPENAIR2_TOP)/UTIL/MEM
-LIST_DIR = $(OPENAIR2_TOP)/UTIL/LISTS
-MATH_DIR = $(OPENAIR2_TOP)/UTIL/MATH
-TIMER_DIR = $(OPENAIR2_TOP)/UTIL/TIMER
-PHY_INTERFACE_DIR = $(OPENAIR2_TOP)/PHY_INTERFACE
-RRC_DIR = $(OPENAIR2_TOP)/RRC/LITE
-L2_INTERFACE_DIR = $(OPENAIR2_TOP)/RRC/L2_INTERFACE
-MAC_DIR = $(OPENAIR2_TOP)/LAYER2/MAC
-LOG_DIR=$(OPENAIR2_TOP)/UTIL/LOG
-OCG_DIR=$(OPENAIR2_TOP)/UTIL/OCG
-OPT_DIR=$(OPENAIR2_TOP)/UTIL/OPT
-
-
-SOURCES_L2 = $(LIST_DIR)/list.c
-SOURCES_L2 += $(LIST_DIR)/list2.c
-
-SOURCES_L2 += $(RLC_UM_DIR)/rlc_um.c
-SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_control_primitives.c
-SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_dar.c
-SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_fsm.c
-SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_reassembly.c
-SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_receiver.c
-SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_segment.c
-SOURCES_L2 += $(RLC_UM_DIR)/rlc_um_test.c
-
-
-SOURCES_L2 += $(MEM_DIR)/mem_block.c
-
-LOG_OBJS = $(LOG_DIR)/log.o
-LOG_OBJS += $(LOG_DIR)/vcd_signal_dumper.o
-OPT_OBJS = $(OPT_DIR)/probe.o
-
-L2_OBJS=$(addsuffix .o,$(basename $(SOURCES_L2))) $(PHY_INTERFACE_OBJS) $(MAC_OBJS) $(L2_INTERFACE_OBJS) $(RRC_OBJS) $(LOG_OBJS) $(OPT_OBJS)
-
-
-L2_incl = -I$(OPENAIR2_TOP) -I$(COMMON_DIR) -I$(RLC_DIR) -I$(RLC_AM_DIR) -I$(RLC_UM_DIR) -I$(RLC_TM_DIR) -I$(PDCP_DIR) -I$(MEM_DIR) -I$(LIST_DIR) -I$(LOG_DIR) -I$(MATH_DIR) -I$(TIMER_DIR) -I$(OPENAIR3)/MESH -I$(OPENAIR2_TOP)/RRC/LITE -I$(OPENAIR2_TOP)/RRC/LITE/MESSAGES -I$(OPENAIR3)/MESH/RRM -I$(OPT_DIR)
-
-
-
-
-
-
-ASN1_MSG_OBJS2 := $(foreach file, $(ASN1_MSG_OBJS), $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/$(file))
-
-OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(SCHED_OBJS) $(STATS_OBJS) $(ASN1_MSG_OBJS2)
-
-all: testum
-
-
-$(OBJ) : %.o : %.c
- $(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) -I$(ASN1_MSG_INC) -o $@ $<
-
-$(L2_OBJS) : %.o : %.c
- $(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DMAC_CONTEXT=1 -DTEST_RLC_UM=1 -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) -I$(ASN1_MSG_INC) -o $@ $<
-
-testum : $(OBJ) $(L2_OBJS) oaisim.c
- $(CC) oaisim.c -I$(TOP_DIR) $(L2_incl) -I$(ASN1_MSG_INC) -o testum $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(L2_OBJS) -lm -lrt
-
-
-clean:
- rm -f testum
- rm -f $(OBJ)
- rm -f $(L2_OBJS)
- rm -f *.o
- rm -f *.exe*
-
diff --git a/targets/TEST/RLC_UM_V9.3.0/oaisim.c b/targets/TEST/RLC_UM_V9.3.0/oaisim.c
deleted file mode 100644
index c520749de3..0000000000
--- a/targets/TEST/RLC_UM_V9.3.0/oaisim.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- * contact@openairinterface.org
- */
-
-#include
-#include
-#include
-#include "SIMULATION/TOOLS/defs.h"
-#include "SIMULATION/RF/defs.h"
-#include "PHY/types.h"
-#include "PHY/defs.h"
-#include "PHY/vars.h"
-#include "MAC_INTERFACE/vars.h"
-
-#include "rlc.h"
-#include "rlc_um.h"
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/vars.h"
-#include "UTIL/LOG/log_if.h"
-#include "UTIL/LOG/log_extern.h"
-#include "RRC/LTE/vars.h"
-#include "PHY_INTERFACE/vars.h"
-#include "UTIL/OCG/OCG.h"
-
-
-
-int main(int argc, char **argv)
-{
- logInit();
- mac_xface = malloc(sizeof(MAC_xface));
- rlc_um_v9_3_0_test();
- return(0);
-}
-
-
|