Commit 79e79244 authored by Mahesh's avatar Mahesh

L2 nfapi test(noS1) working

parent 7eb01667
......@@ -43,6 +43,7 @@
#include "config_userapi.h"
#include "../utils/LOG/log.h"
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
#include "nfapi/oai_integration/vendor_ext.h"
uint8_t nfapi_mode=0;
......@@ -216,12 +217,12 @@ configmodule_interface_t *load_configmodule(int argc,
if( strcmp(argv[i], "--vnf") == 0 ){
printf("\nVNF ENABLED\n");
nfapi_mode = 2;
nfapi_mode = NFAPI_MODE_VNF;
}
if( strcmp(argv[i], "--pnf") == 0 ){
printf("\nPNF ENABLED\n");
nfapi_mode = 1;
nfapi_mode = NFAPI_MODE_PNF;
}
}
......
......@@ -83,7 +83,7 @@
#include "T.h"
#include "nfapi/oai_integration/vendor_ext.h"
//#define DEBUG_THREADS 1
//#define USRP_DEBUG 1
......@@ -155,7 +155,7 @@ clock_gettime(CLOCK_MONOTONIC, &current);
// *******************************************************************
// NFAPI not yet supported for NR - this code has to be revised
if (nfapi_mode == 1) {
if (nfapi_mode == NFAPI_MODE_PNF) {
// I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
//add_subframe(&frame, &subframe, 4);
//oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
......
......@@ -85,6 +85,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "x2ap_eNB.h"
#include "ngap_gNB.h"
#include "gnb_paramdef.h"
#include "nfapi/oai_integration/vendor_ext.h"
pthread_cond_t nfapi_sync_cond;
pthread_mutex_t nfapi_sync_mutex;
......@@ -942,7 +943,7 @@ if(!IS_SOFTMODEM_NOS1)
printf("NFAPI MODE:%s\n", nfapi_mode_str);
if (nfapi_mode==2) // VNF
if (nfapi_mode==NFAPI_MODE_VNF) // VNF
wait_nfapi_init("main?");
printf("START MAIN THREADS\n");
......@@ -971,7 +972,7 @@ if(!IS_SOFTMODEM_NOS1)
config_sync_var=0;
if (nfapi_mode==1) { // PNF
if (nfapi_mode==NFAPI_MODE_PNF) { // PNF
wait_nfapi_init("main?");
}
......@@ -991,7 +992,7 @@ if(!IS_SOFTMODEM_NOS1)
load_softscope("nr",&p);
}
if (nfapi_mode != 1 && nfapi_mode != 2) {
if (nfapi_mode != NFAPI_MODE_PNF && nfapi_mode != NFAPI_MODE_VNF) {
printf("Not NFAPI mode - call init_eNB_afterRU()\n");
init_eNB_afterRU();
} else {
......
......@@ -955,7 +955,7 @@ int main( int argc, char **argv ) {
AssertFatal(nfapi_mode < 3,"");
printf("NFAPI MODE:%s\n", nfapi_mode_str[nfapi_mode]);
if (nfapi_mode==NFAPI_MODE_VNF) // VNF
if (nfapi_mode==2) // VNF
wait_nfapi_init("main?");
for (int i=0; i<RC.nb_nr_L1_inst; i++)
......@@ -964,7 +964,7 @@ int main( int argc, char **argv ) {
printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
config_sync_var=0;
if (nfapi_mode==NFAPI_MODE_PNF) { // PNF
if (nfapi_mode==1) { // PNF
wait_nfapi_init("main?");
}
......
......@@ -818,7 +818,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 = pnf->phys[0].local_port; // 32123; // DJP - hard code alert!!!! FIXME TODO
nfapi_resp.nfapi_config.p7_pnf_port.value = 32123; //pnf->phys[0].local_port; DJP - hard code alert!!!! FIXME TODO
nfapi_resp.num_tlv++;
pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr);
......@@ -1791,7 +1791,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 = 50010; // DJP - good grief cannot seem to get the right answer phy_info->local_port;
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_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);
......@@ -2314,7 +2314,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 = pnf_p7_port;
pnf.phys[0].udp.rx_port = 32123;//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);
......@@ -2365,7 +2365,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 = pnf_p7_port;
pnf.phys[0].udp.rx_port = 32123;//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);
......
......@@ -1262,7 +1262,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 = 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);
// for now just 1
......@@ -1324,7 +1324,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 = 50010;//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);
// for now just 1
......@@ -1334,7 +1334,7 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t
req->header.phy_id = phy->id;
printf("[VNF] Send NFAPI_CONFIG_REQUEST\n");
req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NFAPI_P7_VNF_PORT_TAG;
req->nfapi_config.p7_vnf_port.value = 50011;//p7_vnf->local_port;
req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port;
req->num_tlv++;
printf("[VNF] DJP local_port:%d\n", p7_vnf->local_port);
req->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
......@@ -1413,9 +1413,7 @@ int nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_start_resp
phy_info *phy = pnf->phys;
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
nfapi_vnf_p7_add_pnf((p7_vnf->config), phy->remote_addr, 32123, phy->id);
// nfapi_vnf_p7_add_pnf((p7_vnf->config), phy->remote_addr, phy->remote_port, phy->id);
nfapi_vnf_p7_add_pnf((p7_vnf->config), phy->remote_addr, phy->remote_port, phy->id);
return 0;
}
......@@ -1491,7 +1489,7 @@ void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
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 = 32123;
vnf.p7_vnfs[0].local_port = 50011;
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
config->malloc = malloc;
......@@ -1542,7 +1540,7 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
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 = 32123;
vnf.p7_vnfs[0].local_port = 50011;
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
config->malloc = malloc;
......
......@@ -551,9 +551,8 @@ int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t len)
struct sockaddr_in remote_addr;
memset((char*)&remote_addr, 0, sizeof(struct sockaddr_in));
remote_addr.sin_family = AF_INET;
remote_addr.sin_port = htons(32123);//htons(pnf_p7->_public.remote_p7_port); //hardcoding for now
//remote_addr.sin_addr.s_addr = inet_addr(pnf_p7->_public.remote_p7_addr);
//remote_addr.sin_port = 0; // hardcoded by Gokul
remote_addr.sin_port = htons(pnf_p7->_public.remote_p7_port);
if(inet_aton(pnf_p7->_public.remote_p7_addr, &remote_addr.sin_addr) == -1)
{
......@@ -2959,7 +2958,6 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
int recvfrom_result = 0;
struct sockaddr_in remote_addr;
socklen_t remote_addr_size = sizeof(remote_addr);
remote_addr.sin_family = 2; // Gokul - hardcoded
do
{
......
......@@ -177,7 +177,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
switch (dl_tti_pdu->PDUType) {
case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
gNB->pbch_configured=1;
if(nfapi_mode != 2)
if(nfapi_mode != NFAPI_MODE_VNF)
handle_nr_nfapi_ssb_pdu(gNB,frame,slot,
dl_tti_pdu);
......@@ -185,7 +185,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
AssertFatal(pdcch_received == 0, "pdcch_received is not 0, we can only handle one PDCCH PDU per slot\n");
if(nfapi_mode != 2)
if(nfapi_mode != NFAPI_MODE_VNF)
handle_nfapi_nr_pdcch_pdu(gNB,
frame, slot,
&dl_tti_pdu->pdcch_pdu);
......@@ -202,19 +202,19 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n",
pduIndex,TX_req->pdu_list[pduIndex].num_TLV);
uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct;
if(nfapi_mode != 2)
if(nfapi_mode != NFAPI_MODE_VNF)
handle_nr_nfapi_pdsch_pdu(gNB,frame,slot,&dl_tti_pdu->pdsch_pdu, sdu);
}
}
}
// if (UL_tti_req!=NULL) memcpy(&gNB->UL_tti_req,UL_tti_req,sizeof(nfapi_nr_ul_tti_request_t));
if(nfapi_mode != 2)
if(nfapi_mode != NFAPI_MODE_VNF)
for (int i=0;i<number_ul_dci_pdu;i++) {
handle_nfapi_nr_ul_dci_pdu(gNB, frame, slot, &UL_dci_req->ul_dci_pdu_list[i]);
}
if(nfapi_mode != 2)
if(nfapi_mode != NFAPI_MODE_VNF)
for (int i = 0; i < number_ul_tti_pdu; i++) {
switch (UL_tti_req->pdus_list[i].pdu_type) {
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
......@@ -234,17 +234,17 @@ if(nfapi_mode != 2)
}
}
// if(nfapi_mode != 0 && number_ul_tti_pdu>0)
// if(nfapi_mode != NFAPI_MONOLITHIC && number_ul_tti_pdu>0)
// {
// oai_nfapi_ul_tti_req(UL_tti_req);
// }
// if (nfapi_mode != 0 && Sched_INFO->UL_dci_req->numPdus!=0)
// if (nfapi_mode != NFAPI_MONOLITHIC && Sched_INFO->UL_dci_req->numPdus!=0)
// {
// oai_nfapi_ul_dci_req(Sched_INFO->UL_dci_req);
// }//Only DL
if (nfapi_mode != 0)
if (nfapi_mode != NFAPI_MONOLITHIC)
{ if(Sched_INFO->DL_req->dl_tti_request_body.nPDUs>0)
{
Sched_INFO->DL_req->SFN = frame;
......
......@@ -164,7 +164,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1);
if (nfapi_mode == 0 || nfapi_mode == 1) {
if (nfapi_mode == NFAPI_MONOLITHIC || nfapi_mode == NFAPI_MODE_PNF) {
if ((!(frame%ssb_frame_periodicity))) // generate SSB only for given frames according to SSB periodicity
nr_common_signal_procedures(gNB,frame, slot);
}
......
......@@ -45,7 +45,7 @@
#include "NR_MIB.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "../../../../nfapi/oai_integration/vendor_ext.h"
/* Softmodem params */
#include "executables/softmodem-common.h"
......@@ -332,7 +332,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
LOG_E(MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req);
// if in nFAPI mode
if ( (nfapi_mode == 1 || nfapi_mode == 2) && (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) ){
if ( (NFAPI_MODE == NFAPI_MODE_PNF || NFAPI_MODE == NFAPI_MODE_VNF) && (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) ){
while(RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) {
// DJP AssertFatal(RC.nrmac[Mod_idP]->if_inst->PHY_config_req != NULL,"if_inst->phy_config_request is null\n");
usleep(100 * 1000);
......
......@@ -100,7 +100,7 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
gNB->pdu_index[CC_idP] = 0;
if (nfapi_mode==0 || nfapi_mode == 1) { // monolithic or PNF
if (nfapi_mode == NFAPI_MONOLITHIC || nfapi_mode == NFAPI_MODE_PNF) { // monolithic or PNF
DL_req[CC_idP].SFN = frameP;
DL_req[CC_idP].Slot = slotP;
......
......@@ -39,7 +39,7 @@
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "common/ran_context.h"
#include "executables/softmodem-common.h"
#include "../../..//nfapi/oai_integration/vendor_ext.h"
#define MAX_IF_MODULES 100
//#define UL_HARQ_PRINT
......@@ -119,7 +119,7 @@ void handle_nr_uci(NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_
void handle_nr_ulsch(NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats) {
if(nfapi_mode == 1) {
if(nfapi_mode == NFAPI_MODE_PNF) {
if (UL_info->crc_ind.number_crcs>0) {
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
// oai_nfapi_crc_indication(&UL_info->crc_ind);
......@@ -204,7 +204,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
module_id,CC_id, UL_info->rach_ind.number_of_pdus,
UL_info->rx_ind.number_of_pdus, UL_info->crc_ind.number_crcs);
if (nfapi_mode != 1) {
if (nfapi_mode != NFAPI_MODE_PNF) {
if (ifi->CC_mask==0) {
ifi->current_frame = UL_info->frame;
ifi->current_slot = UL_info->slot;
......@@ -225,7 +225,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
mac->UL_dci_req[CC_id].numPdus = 0;
handle_nr_ulsch(UL_info, &mac->UE_info.UE_sched_ctrl[0],&mac->UE_info.mac_stats[0]);
if (nfapi_mode != 1) {
if (nfapi_mode != NFAPI_MODE_PNF) {
if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) {
/*
eNB_dlsch_ulsch_scheduler(module_id,
......
......@@ -22,12 +22,12 @@ L1s = (
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "lo";
remote_n_address = "127.0.0.1"; // vnf addr
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 = 50002; // pnf p7 port
remote_n_portd = 50003; // vnf p7 port
local_n_portd = 50010; // pnf p7 port
remote_n_portd = 50011; // vnf p7 port
}
);
......
......@@ -250,11 +250,11 @@ MACRLCs = (
num_cc = 1;
local_s_if_name = "lo:";
remote_s_address = "127.0.0.1"; // pnf addr [!]
local_s_address = "127.0.0.1"; // vnf 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 = 50003; // vnf p7 port [!]
remote_s_portd = 50002; // pnf p7 port [!]
local_s_portd = 50011; // vnf p7 port [!]
remote_s_portd = 50010; // pnf p7 port [!]
tr_s_preference = "nfapi";
tr_n_preference = "local_RRC";
}
......
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