Commit 73b5cad4 authored by Xu Bo's avatar Xu Bo Committed by Y_Tomita

Fixed some problems for L2 FAPI simulator.

parent 957bd567
......@@ -52,20 +52,20 @@ load_module ../../targets/bin/ue_ip.ko
if [ "$1" = "UE" ]; then
echo "bring up $LTEIF interface for UE"
ifconfig $LTEIF up
sudo ifconfig $LTEIF up
fi
ip route flush cache
sudo ip route flush cache
sleep 1
sysctl -w net.ipv4.conf.all.log_martians=1
sudo sysctl -w net.ipv4.conf.all.log_martians=1
echo "Disabling reverse path filtering"
sysctl -w net.ipv4.conf.all.rp_filter=0
ip route flush cache
sudo sysctl -w net.ipv4.conf.all.rp_filter=0
sudo ip route flush cache
# Check table 200 lte in /etc/iproute2/rt_tables
fgrep lte /etc/iproute2/rt_tables > /dev/null
if [ $? -ne 0 ]; then
echo "200 lte " >> /etc/iproute2/rt_tables
fi
ip rule add fwmark 1 table lte
ip route add default dev $LTEIF table lte
sudo ip rule add fwmark 1 table lte
sudo ip route add default dev $LTEIF table lte
......@@ -73,14 +73,14 @@
# define MAX_MOBILES_PER_ENB_NB_IoT 128
# define MAX_eNB 2
# else
# define MAX_MOBILES_PER_ENB 16
# define MAX_MOBILES_PER_ENB_NB_IoT 16
# define MAX_eNB 2
# define MAX_MOBILES_PER_ENB 64
# define MAX_MOBILES_PER_ENB_NB_IoT 64
# define MAX_eNB 1
# endif
#else
# define MAX_MOBILES_PER_ENB 256
# define MAX_MOBILES_PER_ENB_NB_IoT 256
# define MAX_eNB 2
# define MAX_eNB 1
#endif
......
......@@ -501,7 +501,7 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
#endif
{
if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) {
if (((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) || (nfapi_mode == 2)) {
LOG_D(MAC,
"[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %d\n",
module_idP, CC_idP, frameP, subframeP, ra->state);
......
......@@ -1286,6 +1286,7 @@ fill_nfapi_ulsch_harq_information(module_id_t module_
*/
#endif
harq_information->harq_information_rel10.delta_offset_harq = puschConfigDedicated->betaOffset_ACK_Index;
harq_information->harq_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG;
AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL,
"pucch_ConfigDedicated is null!\n");
if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL)
......@@ -3630,9 +3631,14 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
AssertFatal(num_ack_nak == 1,
"num_ack_nak %d > 1 for 1 CC and single-layer transmission frame:%d subframe:%d\n",
num_ack_nak,frameP,subframeP);
AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8,
"Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",
harq_pid, UE_id, rnti);
// AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8,
// "Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",
// harq_pid, UE_id, rnti);
if(sched_ctl->round[CC_idP][harq_pid] == 8){
return;
}
AssertFatal(pdu[0] == 1 || pdu[0] == 2
|| pdu[0] == 4,
"Received ACK/NAK %d which is not 1 or 2 for harq_pid %d from UE %d/%x\n",
......
......@@ -70,6 +70,8 @@ extern uint8_t usim_test;
extern UL_IND_t *UL_INFO;
extern uint8_t nfapi_mode;
extern int next_ra_frame;
extern module_id_t next_Mod_id;
/*
*
......
......@@ -49,7 +49,7 @@
#include "platform_constants.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "msc.h"
#include "targets/COMMON/openairinterface5g_limits.h"
#if defined(ENABLE_SECURITY)
# include "UTIL/OSA/osa_defs.h"
#endif
......@@ -79,6 +79,7 @@ extern RAN_CONTEXT_t RC;
static int mbms_socket = -1;
#endif
hash_table_t *pdcp_coll_p = NULL;
//-----------------------------------------------------------------------------
/*
* If PDCP_UNIT_TEST is set here then data flow between PDCP and RLC is broken
......@@ -368,8 +369,10 @@ boolean_t pdcp_data_req(
rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,sourceL2Id
,destinationL2Id
//,sourceL2Id
//,destinationL2Id
,NULL
,NULL
#endif
);
......@@ -800,7 +803,8 @@ pdcp_data_ind(
} else {
((pdcp_data_ind_header_t*) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * maxDRB);
}
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id;
//((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id;
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
static uint32_t pdcp_inst = 0;
......@@ -2014,7 +2018,7 @@ void pdcp_layer_init(void)
* Initialize SDU list
*/
list_init(&pdcp_sdu_list, NULL);
pdcp_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, pdcp_free);
pdcp_coll_p = hashtable_create ((maxDRB + 2)*NUMBER_OF_UE_MAX, NULL, pdcp_free);
AssertFatal(pdcp_coll_p != NULL, "UNRECOVERABLE error, PDCP hashtable_create failed");
for (instance = 0; instance < MAX_MOBILES_PER_ENB; instance++) {
......
......@@ -542,7 +542,7 @@ sdu_size_t pdcp_input_sdu_remaining_size_to_read;
(((hash_key_t)(sESSION_ID)) << 37) | \
(((hash_key_t)(0x0000000000000001)) << 63))
hash_table_t *pdcp_coll_p;
extern hash_table_t *pdcp_coll_p;
#endif
/*@}*/
......@@ -168,7 +168,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
((pdcp_data_ind_header_t*) sdu_p->data)->inst,
((pdcp_data_ind_header_t *) sdu_p->data)->data_size);
#else
((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
//((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
#endif
#if defined(LINK_ENB_PDCP_TO_GTPV1U)
......@@ -1083,8 +1083,8 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,&pdcp_read_header_g.sourceL2Id
,&pdcp_read_header_g.destinationL2Id
, NULL, NULL//,&pdcp_read_header_g.sourceL2Id
//,&pdcp_read_header_g.destinationL2Id
#endif
);
} else {
......@@ -1141,8 +1141,8 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,&pdcp_read_header_g.sourceL2Id
,&pdcp_read_header_g.destinationL2Id
, NULL, NULL//,&pdcp_read_header_g.sourceL2Id
//,&pdcp_read_header_g.destinationL2Id
#endif
);
}
......
......@@ -64,6 +64,8 @@
#include "rrc_nas_primitives.h"
#include "COMMON/platform_types.h"
#define MAKE_VERSION(a,b,c) ((a)*256+(b)*16+(c))
struct rb_entity {
nasRadioBearerId_t rab_id;
nasSapId_t sapi;
......@@ -160,6 +162,10 @@ typedef struct pdcp_data_req_header_s {
sdu_size_t data_size;
signed int inst;
ip_traffic_type_t traffic_type;
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
uint32_t sourceL2Id;
uint32_t destinationL2Id;
#endif
} pdcp_data_req_header_t;
typedef struct pdcp_data_ind_header_s {
......@@ -167,6 +173,10 @@ typedef struct pdcp_data_ind_header_s {
sdu_size_t data_size;
signed int inst;
ip_traffic_type_t dummy_traffic_type;
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
uint32_t sourceL2Id;
uint32_t destinationL2Id;
#endif
} pdcp_data_ind_header_t;
extern struct net_device *nasdev[NB_INSTANCES_MAX];
......
......@@ -158,7 +158,7 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL
LOG_D(MAC, "fill_rach_indication_UE_MAC 1 \n");
pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t));
// UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t));
UL_INFO->rach_ind.rach_indication_body.number_of_preambles = 1;
......@@ -195,7 +195,7 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL
// with that branch.
oai_nfapi_rach_ind(&UL_INFO->rach_ind);
free(UL_INFO->rach_ind.rach_indication_body.preamble_list);
free(UL_INFO);
// free(UL_INFO);
//}
pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex);
......@@ -311,6 +311,7 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
else if (SNRtimes10 > 635) pdu->ul_cqi_information.ul_cqi=255;
else pdu->ul_cqi_information.ul_cqi=(640+SNRtimes10)/5;
pdu->ul_cqi_information.channel = 0;
if(harq_information->harq_information_rel9_fdd.tl.tag == NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG){
if ((harq_information->harq_information_rel9_fdd.ack_nack_mode == 0) &&
(harq_information->harq_information_rel9_fdd.harq_size == 1)) {
......@@ -332,7 +333,24 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
pdu->harq_indication_fdd_rel13.harq_tb_n[1] = 1; // Assuming always an ACK (No NACK or DTX)
}
else AssertFatal(1==0,"only format 1a/b for now, received \n");
}else if(harq_information->harq_information_rel10_tdd.tl.tag == NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG ){
if ((harq_information->harq_information_rel10_tdd.ack_nack_mode == 0) &&
(harq_information->harq_information_rel10_tdd.harq_size == 1)) {
pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
pdu->harq_indication_tdd_rel13.mode = 0;
pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1;
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1;
} else if ((harq_information->harq_information_rel10_tdd.ack_nack_mode == 1) &&
(harq_information->harq_information_rel10_tdd.harq_size == 2)) {
pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
pdu->harq_indication_tdd_rel13.mode = 0;
pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1;
pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1;
pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = 1;
}
} else AssertFatal(1==0,"only format 1a/b for now, received \n");
UL_INFO->harq_ind.harq_indication_body.number_of_harqs++;
......@@ -622,7 +640,7 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //,
//if(tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data!= NULL && tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_length >0){
*/
if(dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index <= tx_req_num_elems -1){
if((dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index >= 0) &&(dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index <= tx_req_num_elems -1)){
//if(tx_request_pdu_list + dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index!= NULL){
LOG_E(MAC, "dl_config_req_UE_MAC 2 Received data: sfn/sf:%d PDU[%d] size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n", NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index, tx_req_num_elems);
......
......@@ -28,8 +28,8 @@ nfapi_hi_dci0_request_t* hi_dci0_req;
int tx_req_num_elems;
int next_ra_frame;
module_id_t next_Mod_id;
//int next_ra_frame;
//module_id_t next_Mod_id;
eth_params_t stub_eth_params;
......
......@@ -2092,7 +2092,7 @@ do_RRCConnectionSetup(
physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup;
if (carrier->sib1->tdd_Config == NULL) {
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 71 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid;
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 31 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid;
} else {
switch (carrier->sib1->tdd_Config->subframeAssignment) {
case 1:
......
This diff is collapsed.
......@@ -58,6 +58,7 @@ Description Defines functions used to handle EPS bearer contexts.
#include <netinet/in.h>
#include <arpa/inet.h>
extern uint8_t nfapi_mode;
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
......@@ -272,6 +273,18 @@ int esm_ebr_context_create(
strcpy(broadcast, ipv4_addr);
}
if(nfapi_mode ==3){
res = sprintf(command_line,
"ifconfig oip%d %s netmask %s broadcast %s up && "
"ip rule add from %s/24 table %d && "
"ip rule add to %s/24 table %d && "
"ip route add default dev oip%d table %d && "
"sysctl net.ipv4.conf.oip%d.rp_filter=0",
ueid+1, ipv4_addr, netmask, broadcast,
ipv4_addr, 201,
ipv4_addr, 201,
ueid+1, 201, ueid+1);
} else {
res = sprintf(command_line,
"ifconfig oip%d %s netmask %s broadcast %s up && "
"ip rule add from %s/32 table %d && "
......@@ -281,6 +294,7 @@ int esm_ebr_context_create(
ipv4_addr, ueid + 201,
ipv4_addr, ueid + 201,
ueid + 1, ueid + 201);
}
if ( res<0 ) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string");
}
......
......@@ -15,8 +15,8 @@
# define NUMBER_OF_eNB_MAX 7
# define NUMBER_OF_RU_MAX 32
# ifndef UE_EXPANSION
# define NUMBER_OF_UE_MAX 20
# define NUMBER_OF_CONNECTED_eNB_MAX 3
# define NUMBER_OF_UE_MAX 64
# define NUMBER_OF_CONNECTED_eNB_MAX 1
# else
# define NUMBER_OF_UE_MAX 256
# define NUMBER_OF_CONNECTED_eNB_MAX 1
......
......@@ -223,7 +223,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 1 );
if(!eNB->single_thread_flag && get_nprocs() >= 8){
if(!eNB->single_thread_flag && get_nprocs() >= 8 && nfapi_mode != 2){
if(wait_on_condition(&proc[1].mutex_rxtx,&proc[1].cond_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) {
LOG_E(PHY,"Frame %d, subframe %d: TX1 not ready\n",proc[1].frame_rx,proc[1].subframe_rx);
return(-1);
......
......@@ -102,9 +102,11 @@ void ue_stub_rx_handler(unsigned int, char *);
int32_t **rxdata;
int32_t **txdata;
int timer_subframe;
int timer_frame;
SF_ticking *phy_stub_ticking;
int timer_subframe = 0;
int timer_frame = 0;
SF_ticking *phy_stub_ticking = NULL;
int next_ra_frame = 0;
module_id_t next_Mod_id = 0;
#define KHz (1000UL)
#define MHz (1000*KHz)
......@@ -1021,7 +1023,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t));
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
UL_INFO->cqi_ind.cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_pdu_t));
UL_INFO->cqi_ind.cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_raw_pdu_t));
UL_INFO->cqi_ind.number_of_cqis = 0;
for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) {
......@@ -1097,8 +1101,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
// We make the start of RA between consecutive UEs differ by 20 frames
//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
if (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == next_Mod_id && proc->frame_rx >= next_ra_frame) {
if (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == next_Mod_id) {
next_ra_frame++;
if(next_ra_frame > 200){
// check if we have PRACH opportunity
if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[Mod_id].SI_Decoded == 1) {
......@@ -1109,16 +1114,18 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
if(prach_resources!=NULL ) {
UE_mac_inst[Mod_id].ra_frame = proc->frame_rx;
LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d \n", Mod_id );
LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", Mod_id ,proc->frame_tx, proc->subframe_tx);
fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx ,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0);
UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE;
next_Mod_id = Mod_id + 1;
next_ra_frame = (proc->frame_rx + 20)%1000;
//next_ra_frame = (proc->frame_rx + 20)%1000;
next_ra_frame = 0;
}
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
}
}
} // mode is PRACH
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
......@@ -1183,7 +1190,10 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list);
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL;
//}
free(UL_INFO->cqi_ind.cqi_pdu_list);
UL_INFO->cqi_ind.cqi_pdu_list = NULL;
free(UL_INFO->cqi_ind.cqi_raw_pdu_list);
UL_INFO->cqi_ind.cqi_raw_pdu_list = NULL;
free(UL_INFO);
UL_INFO = NULL;
......@@ -1764,6 +1774,13 @@ void init_UE_single_thread_stub(int nb_inst) {
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n");
AssertFatal(PHY_vars_UE_g[i]!=NULL,"PHY_vars_UE_g[inst] is NULL\n");
AssertFatal(PHY_vars_UE_g[i][0]!=NULL,"PHY_vars_UE_g[inst][0] is NULL\n");
if(nfapi_mode == 3){
#ifdef NAS_UE
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NAS_UE, INITIALIZE_MESSAGE);
itti_send_msg_to_task (TASK_NAS_UE, i + NB_eNB_INST, message_p);
#endif
}
}
UE = PHY_vars_UE_g[0][0];
......
......@@ -999,7 +999,7 @@ int main( int argc, char **argv )
#if defined(ENABLE_ITTI)
if (create_tasks_ue(1) < 0) {
if (create_tasks_ue(NB_UE_INST) < 0) {
printf("cannot create ITTI tasks\n");
exit(-1); // need a softer mode
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment