Commit ff64d6ac authored by Mahesh's avatar Mahesh

Resolved UE building error and updated packing of P7 messages

parent 0531e27c
......@@ -44,7 +44,7 @@
#include "../utils/LOG/log.h"
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
extern uint8_t nfapi_mode;
extern uint8_t nfapi_mode=0;
int load_config_sharedlib(configmodule_interface_t *cfgptr) {
void *lib_handle;
......
......@@ -81,7 +81,7 @@ sudo <oai_codebase>/cmake_targets/ran_build/build/nr-softmodem -O <oai_codebase>
* Change the `vnf_handle_timing_info()` function that calls p7 message unpack fn and initializes the sfn and slot in `vnf_p7.c` file [x]
* Change pack and unpack functions `pack_timing_info()` and `unpack_timing_info()` [x]
* Change `nfapi_timing_info_t` structure to support P7 in NR [x]
* Change packing functions to support NR P7 procedures. [x]
* Change packing functions for timing info to support NR P7 procedures. [x]
### Testing
......
......@@ -60,6 +60,7 @@ extern RAN_CONTEXT_t RC;
#include "openair1/PHY/NR_TRANSPORT/nr_dlsch.h"
#include "openair1/PHY/defs_gNB.h"
#define NUM_P5_PHY 2
#define _GNU_SOURCE
......@@ -299,7 +300,7 @@ int pnf_param_request(nfapi_pnf_config_t *config, nfapi_pnf_param_request_t *req
resp.pnf_phy.phy[i].excluded_rf_config[j].rf_config_index = pnf->phys[i].excluded_rfs[j];
}
}
/*
resp.pnf_rf.tl.tag = NFAPI_PNF_RF_TAG;
resp.pnf_rf.number_of_rfs = 2;
......@@ -400,7 +401,7 @@ int pnf_param_request(nfapi_pnf_config_t *config, nfapi_pnf_param_request_t *req
resp.pnf_phy_rel13_nb_iot.phy[i].nmm_modes_supported = pnf->phys[i].nmm_modes_supported;
}
}
*/
nfapi_pnf_pnf_param_resp(config, &resp);
return 0;
}
......@@ -642,7 +643,7 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
nfapi_resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NR_NFAPI_P7_PNF_PORT_TAG;
nfapi_resp.num_tlv++;
/*
nfapi_resp.nfapi_config.dl_ue_per_sf.tl.tag = NFAPI_NR_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG;
nfapi_resp.num_tlv++;
......@@ -651,7 +652,9 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
nfapi_resp.nfapi_config.rf_bands.tl.tag = NFAPI_NR_NFAPI_RF_BANDS_TAG;
nfapi_resp.num_tlv++;
nfapi_resp.nfapi_config.max_transmit_power.tl.tag = NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG;
nfapi_resp.num_tlv++;
*/
nfapi_resp.nfapi_config.timing_window.tl.tag = NFAPI_NR_NFAPI_TIMING_WINDOW_TAG;
nfapi_resp.num_tlv++;
......@@ -660,9 +663,6 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
nfapi_resp.nfapi_config.timing_info_period.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG;
nfapi_resp.num_tlv++;
nfapi_resp.nfapi_config.max_transmit_power.tl.tag = NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG;
nfapi_resp.num_tlv++;
}
nfapi_resp.nfapi_config.p7_pnf_port.value = pnf->phys[0].local_port; // 32123; // DJP - hard code alert!!!! FIXME TODO
......@@ -713,7 +713,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
phy_info->timing_info_mode = 0;
printf("NO timing info mode provided\n");
}
//TODO: Read the P7 message offset values
if(req->nfapi_config.timing_info_period.tl.tag == NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG) {
printf("timing info period provided value:%d\n", req->nfapi_config.timing_info_period.value);
phy_info->timing_info_period = req->nfapi_config.timing_info_period.value;
......@@ -737,7 +737,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
num_tlv++;
}
/*
if(req->nfapi_config.rf_bands.tl.tag == NFAPI_NR_NFAPI_RF_BANDS_TAG) {
pnf->rfs[0].band = req->nfapi_config.rf_bands.rf_band[0];
fp->nr_band = req->nfapi_config.rf_bands.rf_band[0];
......@@ -754,6 +754,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() nrarfcn:%u dl_carrierFreq:%u ul_CarrierFreq:%u band:%u N_RB_DL:%u\n",
__FUNCTION__, req->nfapi_config.nrarfcn.value, fp->dl_CarrierFreq, fp->ul_CarrierFreq, pnf->rfs[0].band, fp->N_RB_DL);
}
*/
#if SUBFRAME // TODO: add subframe struct to nr config request struct
if (req->subframe_config.duplex_mode.tl.tag == NFAPI_NR_SUBFRAME_CONFIG_DUPLEX_MODE_TAG) {
fp->frame_type = req->subframe_config.duplex_mode.value==0 ? TDD : FDD;
......@@ -994,7 +995,7 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
if (proc==NULL)
proc = &gNB->proc.L1_proc;
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu_list = req->dl_tti_request_body.dl_tti_pdu_list;
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu_list = req->dl_tti_pdu_list;
// TODO: NR_gNB_PDCCH not defined yet (check later)
#if 0
......@@ -1003,25 +1004,23 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
pdcch_vars->num_dci = 0;
#endif
if (req->dl_tti_request_body.nPDUs)
if (req->nPDUs)
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d; sfn:%d, slot:%d, nGroup:%u, nPDUs: %u, nUE: %u, PduIdx: %u,\n",
__FUNCTION__, proc->frame_tx, proc->slot_tx, proc->frame_rx, proc->slot_rx, // TODO: change subframes to slot
req->SFN,
req->Slot,
req->dl_tti_request_body.nGroup,
req->dl_tti_request_body.nPDUs,
req->dl_tti_request_body.nUe,
req->dl_tti_request_body.PduIdx);
req->nGroup,
req->nPDUs,
req->nUe,
req->PduIdx);
for (int i=0; i<req->dl_tti_request_body.nPDUs; i++) {
for (int i=0; i<req->nPDUs; i++) {
// TODO: enable after adding gNB PDCCH:
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d pdcch_vars->num_dci:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size,pdcch_vars->num_dci);
if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE) {
//handle_nfapi_dci_dl_pdu(eNB,NFAPI_SFNSF2SFN(req->sfn_sf),NFAPI_SFNSF2SF(req->sfn_sf),proc,&dl_config_pdu_list[i]);
handle_nfapi_nr_pdcch_pdu(gNB, sfn, slot, &dl_tti_pdu_list[i].pdcch_pdu);
dl_tti_pdu_list[i].pdcch_pdu.pdcch_pdu_rel15.numDlDci++; // ?
// pdcch_vars->num_dci++; // Is actually number of DCI PDUs
//dl_tti_pdu_list[i].pdcch_pdu.pdcch_pdu_rel15.numDlDci++; // ?
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() pdcch_vars->num_dci:%d\n", __FUNCTION__, pdcch_vars->num_dci);
} else if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_SSB_PDU_TYPE) {
// nfapi_dl_config_bch_pdu *bch_pdu = &dl_config_pdu_list[i].bch_pdu;
......@@ -1029,14 +1028,13 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
// uint16_t pdu_index = bch_pdu->bch_pdu_rel8.pdu_index;
uint16_t pdu_index = ssb_pdu->ssb_pdu_rel15.SsbBlockIndex;
if (tx_data_request[sfn][slot][pdu_index] != NULL) {
// if (tx_data_request[sfn][slot][pdu_index] != NULL) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PDU:%d BCH: pdu_index:%u pdu_length:%d sdu_length:%d BCH_SDU:%x,%x,%x\n", __FUNCTION__, i, pdu_index, bch_pdu->bch_pdu_rel8.length, tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_length, sdu[0], sdu[1], sdu[2]);
// handle_nfapi_bch_pdu(eNB, proc, &dl_config_pdu_list[i], tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_data);
handle_nr_nfapi_ssb_pdu(gNB, sfn, slot, &dl_tti_pdu_list[i]);
gNB->pbch_configured=1;\
} else {
//} else {
// NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() BCH NULL TX PDU SFN/SF:%d PDU_INDEX:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pdu_index);
}
//}
} else if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE) {
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu = &dl_tti_pdu_list[i].pdsch_pdu;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15_pdu = &pdsch_pdu->pdsch_pdu_rel15;
......@@ -1046,9 +1044,7 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
int UE_id = find_nr_dlsch(rel15_pdu->rnti,gNB,SEARCH_EXIST_OR_FREE);
AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n");
AssertFatal(UE_id<NUMBER_OF_UE_MAX,"returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX);
//LTE_eNB_DLSCH_t *dlsch0 = eNB->dlsch[UE_id][0];
NR_gNB_DLSCH_t *dlsch0 = gNB->dlsch[UE_id][0];
//LTE_eNB_DLSCH_t *dlsch1 = eNB->dlsch[UE_id][1];
int harq_pid = dlsch0->harq_ids[sfn%2][slot];
if(harq_pid >= dlsch0->Mdlharq) {
......
......@@ -312,7 +312,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_re
pnf->phys[0] = phy;
}
/*
for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
rf_info rf;
memset(&rf,0,sizeof(rf));
......@@ -320,7 +320,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_re
printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
pnf->rfs[0] = rf;
}
*/
nfapi_pnf_config_request_t req;
memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
......@@ -364,6 +364,8 @@ int pnf_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_config_
}
int wake_gNB_rxtx(PHY_VARS_gNB *gNB, uint16_t sfn, uint16_t slot) {
//printf("\n wake_gNB_rxtx before assignment sfn:%d slot:%d",sfn,slot);
gNB_L1_proc_t *proc=&gNB->proc;
gNB_L1_rxtx_proc_t *L1_proc= (slot&1)? &proc->L1_proc : &proc->L1_proc_tx;
......@@ -371,9 +373,10 @@ int wake_gNB_rxtx(PHY_VARS_gNB *gNB, uint16_t sfn, uint16_t slot) {
//printf("%s(eNB:%p, sfn:%d, sf:%d)\n", __FUNCTION__, eNB, sfn, sf);
//int i;
struct timespec wait;
wait.tv_sec=0;
wait.tv_nsec=5000000L;
clock_gettime(CLOCK_REALTIME, &wait);
wait.tv_sec = 0;
wait.tv_nsec +=5000000L;
//wait.tv_nsec = 0;
// wake up TX for subframe n+sf_ahead
// lock the TX mutex and make sure the thread is ready
if (pthread_mutex_timedlock(&L1_proc->mutex,&wait) != 0) {
......@@ -390,7 +393,7 @@ int wake_gNB_rxtx(PHY_VARS_gNB *gNB, uint16_t sfn, uint16_t slot) {
// Try to be 1 frame back
old_slot = slot;
old_sfn = sfn;
//printf("\n wake_gNB_rxtx after assignment sfn:%d slot:%d",proc->frame_rx,proc->slot_rx);
if (old_slot == 0 && old_sfn % 100 == 0) LOG_W( PHY,"[gNB] sfn/slot:%d%d old_sfn/slot:%d%d proc[rx:%d%d]\n", sfn, slot, old_sfn, old_slot, proc->frame_rx, proc->slot_rx);
}
......@@ -405,15 +408,15 @@ int wake_gNB_rxtx(PHY_VARS_gNB *gNB, uint16_t sfn, uint16_t slot) {
L1_proc->timestamp_tx = proc->timestamp_rx + (slot_ahead *fp->samples_per_tti);
L1_proc->frame_rx = proc->frame_rx;
L1_proc->slot_rx = proc->slot_rx;
L1_proc->frame_tx = (L1_proc->slot_rx > (9-slot_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
L1_proc->frame_tx = (L1_proc->slot_rx > (19-slot_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
L1_proc->slot_tx = (L1_proc->slot_rx + slot_ahead)%20;
//LOG_D(PHY, "sfn/sf:%d%d proc[rx:%d%d] L1_proc[instance_cnt_rxtx:%d rx:%d%d] About to wake rxtx thread\n\n", sfn, sf, proc->frame_rx, proc->subframe_rx, L1_proc->instance_cnt_rxtx, L1_proc->frame_rx, L1_proc->subframe_rx);
//printf("\nEntering wake_gNB_rxtx sfn %d slot %d\n",L1_proc->frame_rx,L1_proc->slot_rx);
// the thread can now be woken up
if (pthread_cond_signal(&L1_proc->cond) != 0) {
LOG_E( PHY, "[gNB] ERROR pthread_cond_signal for gNB RXn-TXnp4 thread\n");
exit_fun( "ERROR pthread_cond_signal" );
exit_fun( "ERROR pthread_clond_signal" );
return(-1);
}
......@@ -512,7 +515,7 @@ int phy_slot_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uin
if (RC.gNB && RC.gNB[0]->configured) {
// uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf);
// uint16_t sf = NFAPI_SFNSF2SF(sfn_sf);
//LOG_D(PHY,"[VNF] subframe indication sfn_sf:%d sfn:%d sf:%d\n", sfn_sf, sfn, sf);
LOG_D(PHY,"[VNF] slot indication sfn:%d sf:%d\n", sfn, slot);
wake_gNB_rxtx(RC.gNB[0], sfn, slot); // DONE: find NR equivalent
} else {
printf("[VNF] %s() RC.gNB:%p\n", __FUNCTION__, RC.gNB);
......@@ -1119,7 +1122,7 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_respons
req->header.message_id = NFAPI_CONFIG_REQUEST;
req->header.phy_id = phy->id;
printf("[VNF] Send NFAPI_CONFIG_REQUEST\n");
printf("\n NR bandP =%d\n",req->nfapi_config.rf_bands.rf_band[0]);
//printf("\n NR bandP =%d\n",req->nfapi_config.rf_bands.rf_band[0]);
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;
......@@ -1147,7 +1150,12 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_respons
req->num_tlv++;
}
}
//TODO: Assign tag and value for P7 message offsets
req->nfapi_config.dl_tti_timing_offset.tl.tag = NFAPI_NR_NFAPI_DL_TTI_TIMING_OFFSET;
req->nfapi_config.ul_tti_timing_offset.tl.tag = NFAPI_NR_NFAPI_UL_TTI_TIMING_OFFSET;
req->nfapi_config.ul_dci_timing_offset.tl.tag = NFAPI_NR_NFAPI_UL_DCI_TIMING_OFFSET;
req->nfapi_config.tx_data_timing_offset.tl.tag = NFAPI_NR_NFAPI_TX_DATA_TIMING_OFFSET;
vendor_ext_tlv_2 ve2;
memset(&ve2, 0, sizeof(ve2));
ve2.tl.tag = VENDOR_EXT_TLV_2_TAG;
......@@ -1249,7 +1257,8 @@ 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 = vnf.p7_vnfs[0].local_port; // 50001; // TODO: remove hardcode
vnf.p7_vnfs[0].local_port = 32123;
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
config->malloc = malloc;
......@@ -1304,14 +1313,15 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_tti_request_t *dl_config_req)
{
//printf("\nEntering 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!!!!
int retval = nfapi_vnf_p7_nr_dl_config_req(p7_config, dl_config_req);
dl_config_req->dl_tti_request_body.nPDUs = 0;
dl_config_req->dl_tti_request_body.nGroup = 0;
dl_config_req->nPDUs = 0;
dl_config_req->nGroup = 0;
if (retval!=0) {
......
......@@ -126,6 +126,8 @@ typedef struct {
#define NFAPI_SFNSLOT2SFN(_sfnslot) ((_sfnslot) >> 6)
#define NFAPI_SFNSLOT2SLOT(_sfnslot) ((_sfnslot) & 0x3F)
#define NFAPI_SFNSLOTDEC2SFN(_sfnslot_dec) ((_sfnslot_dec) / 20)
#define NFAPI_SFNSLOTDEC2SLOT(_sfnslot_dec) ((_sfnslot_dec) % 20)
#define NFAPI_MAX_SFNSLOTDEC 1024*20 // 20 is for numerology 1
......@@ -1123,6 +1125,7 @@ typedef struct {
uint32_t error_code;
nfapi_pnf_param_general_t pnf_param_general;
nfapi_pnf_phy_t pnf_phy;
/*
nfapi_pnf_rf_t pnf_rf;
nfapi_pnf_phy_rel10_t pnf_phy_rel10;
nfapi_pnf_phy_rel11_t pnf_phy_rel11;
......@@ -1130,11 +1133,13 @@ typedef struct {
nfapi_pnf_phy_rel13_t pnf_phy_rel13;
nfapi_pnf_phy_rel13_nb_iot_t pnf_phy_rel13_nb_iot;
nfapi_pnf_phy_rel15_t pnf_phy_rel15;
*/
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_pnf_param_response_t;
typedef struct {
nfapi_p4_p5_message_header_t header;
uint8_t num_tlvs;
nfapi_pnf_phy_rf_config_t pnf_phy_rf_config;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_pnf_config_request_t;
......@@ -2495,7 +2500,8 @@ typedef struct {
typedef struct {
nfapi_p7_message_header_t header;
uint32_t t1;
int32_t delta_sfn_sf;
//int32_t delta_sfn_sf;
int32_t delta_sfn_slot;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_dl_node_sync_t;
......@@ -3708,22 +3714,30 @@ typedef struct
nfapi_ipv4_address_t p7_pnf_address_ipv4;
nfapi_ipv6_address_t p7_pnf_address_ipv6;
nfapi_uint16_tlv_t p7_pnf_port;
nfapi_uint8_tlv_t timing_window; //Value: 0 → 30,000 microseconds
nfapi_uint8_tlv_t timing_info_mode;
nfapi_uint8_tlv_t timing_info_period;
nfapi_uint32_tlv_t dl_tti_timing_offset;
nfapi_uint32_tlv_t ul_tti_timing_offset;
nfapi_uint32_tlv_t ul_dci_timing_offset;
nfapi_uint32_tlv_t tx_data_timing_offset;
// // These TLVs are used to setup the transport connection between VNF and PNF
// These TLVs are used to setup the transport connection between VNF and PNF
/*
nfapi_uint8_tlv_t dl_ue_per_sf;
nfapi_uint8_tlv_t ul_ue_per_sf;
// These TLVs are used by PNF to report its RF capabilities to the VNF software
nfapi_rf_bands_t rf_bands;
*/
// These TLVs are used by the VNF to configure the synchronization with the PNF.
nfapi_uint8_tlv_t timing_window;
nfapi_uint8_tlv_t timing_info_mode;
nfapi_uint8_tlv_t timing_info_period;
// These TLVs are used by the VNF to configure the RF in the PNF
nfapi_uint16_tlv_t max_transmit_power;
nfapi_uint32_tlv_t nrarfcn;
//nfapi_uint16_tlv_t max_transmit_power;
//nfapi_uint32_tlv_t nrarfcn;
// nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands;
// nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands;
......
......@@ -23,28 +23,31 @@
//These TLVs are used exclusively by nFAPI
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG 0x0100
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG 0x0101
#define NFAPI_NR_NFAPI_P7_VNF_PORT_TAG 0x0102
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG 0x0103
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG 0x0104
#define NFAPI_NR_NFAPI_P7_PNF_PORT_TAG 0x0105
#define NFAPI_NR_NFAPI_DL_TTI_TIMING_OFFSET 0x0106
#define NFAPI_NR_NFAPI_UL_TTI_TIMING_OFFSET 0x0107
#define NFAPI_NR_NFAPI_UL_DCI_TIMING_OFFSET 0x0108
#define NFAPI_NR_NFAPI_TX_DATA_TIMING_OFFSET 0x0109
#define NFAPI_NR_NFAPI_TIMING_WINDOW_TAG 0x011E
#define NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG 0x011F
#define NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG 0x0120
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG 0x5100
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG 0x5101
#define NFAPI_NR_NFAPI_P7_VNF_PORT_TAG 0x5102
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG 0x5103
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG 0x5104
#define NFAPI_NR_NFAPI_P7_PNF_PORT_TAG 0x5105
/*
#define NFAPI_NR_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG 0x510A
#define NFAPI_NR_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG 0x510B
#define NFAPI_NR_NFAPI_RF_BANDS_TAG 0x5114
#define NFAPI_NR_NFAPI_TIMING_WINDOW_TAG 0x511E
#define NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG 0x511F
#define NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG 0x5120
#define NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG 0x5128
#define NFAPI_NR_NFAPI_NRARFCN_TAG 0x5129
#define NFAPI_NR_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG 0x5130
#define NFAPI_NR_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG 0x5131
#define NFAPI_NR_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG 0x5132
#define NFAPI_NR_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG 0x5133
*/
// P5 Message Structures
typedef struct {
......@@ -290,7 +293,7 @@ typedef enum {
typedef enum {
NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED=0,
NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED
NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED=1
} nfapi_nr_cce_reg_mapping_type_e;
typedef enum {
......
......@@ -24,13 +24,6 @@
#define NFAPI_MAX_NUM_GROUPS 8
#define NFAPI_MAX_NUM_CB 8
#define NFAPI_NR_DL_TTI_CSI_RS_REL_IISC 0x5551
#define NFAPI_NR_DL_TTI_PDCCH_REL_IISC 0x5552
#define NFAPI_NR_DL_TTI_PDSCH_REL_IISC 0x5553
#define NFAPI_NR_DL_TTI_SSB_REL_IISC 0x5554
#define NFAPI_NR_UL_TTI_PDU_LIST_REL_IISC 0x5555
#define NFAPI_NR_UL_TTI_GROUP_LIST_REL_IISC 0x5555
// Extension to the generic structures for single tlv values
......@@ -730,7 +723,7 @@ typedef struct {
///Granularity of precoding [TS38.211 sec 7.3.2.2] Field Type Description 0: sameAsRegBundle 1: allContiguousRBs
uint8_t precoderGranularity;
///Number of DCIs in this CORESET.Value: 0->MaxDciPerSlot
uint16_t numDlDci;
volatile uint16_t numDlDci;
///The RNTI used for identifying the UE when receiving the PDU Value: 1 -> 65535.
uint16_t RNTI[MAX_DCI_CORESET];
///For a UE-specific search space it equals the higher-layer parameter PDCCH-DMRSScrambling-ID if configured, otherwise it should be set to the phy cell ID. [TS38.211, sec 7.3.2.3] Value: 0->65535
......@@ -993,6 +986,7 @@ typedef struct {
} nfapi_nr_dl_tti_request_pdu_t;
#define NFAPI_NR_MAX_DL_TTI_PDUS 32
/*
typedef struct {
/// Number of PDUs that are included in this message. All PDUs in the message are numbered in order. Value 0 -> 255
uint8_t nPDUs;
......@@ -1005,14 +999,25 @@ typedef struct {
/// This value is an index for number of PDU identified by nPDU in this message Value: 0 -> 255
uint8_t PduIdx[256][12];
} nfapi_nr_dl_tti_request_body_t;
*/
typedef struct {
nfapi_p7_message_header_t header;
/// System Frame Number (0-1023)
uint16_t SFN;
/// Slot number (0-319)
/// Slot number (0-19)
uint16_t Slot;
nfapi_nr_dl_tti_request_body_t dl_tti_request_body;
/// Number of PDUs that are included in this message. All PDUs in the message are numbered in order. Value 0 -> 255
uint8_t nPDUs;
/// Number of UEs in the Group included in this message. Value 0 -> 255
uint8_t nGroup;
/// List containing PDUs
nfapi_nr_dl_tti_request_pdu_t dl_tti_pdu_list[NFAPI_NR_MAX_DL_TTI_PDUS];
//nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu_list;
/// Number of UE in this group. For SU-MIMO, one group includes one UE only. For MU-MIMO, one group includes up to 12 UEs. Value 1 -> 12
uint8_t nUe[256];
/// This value is an index for number of PDU identified by nPDU in this message Value: 0 -> 255
uint8_t PduIdx[256][12];
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_dl_tti_request_t;
......
This diff is collapsed.
This diff is collapsed.
......@@ -116,7 +116,7 @@ typedef struct {
uint16_t sfn_sf;
uint32_t sf_start_time_hr;
int32_t sfn_sf_shift;
uint16_t sfn;
uint16_t slot;
uint16_t sfn_slot;
......
......@@ -568,8 +568,8 @@ typedef struct
nfapi_nr_tx_data_request_t* tx_data_req;//nfapi_tx_request_t* tx_req;
//TODO: check these two later
nfapi_lbt_dl_config_request_t* lbt_dl_config_req;
nfapi_ue_release_request_t* ue_release_req;
//nfapi_lbt_dl_config_request_t* lbt_dl_config_req;
//nfapi_ue_release_request_t* ue_release_req;
} nfapi_pnf_p7_slot_buffer_t;
typedef struct nfapi_pnf_p7_config nfapi_pnf_p7_config_t;
......
This diff is collapsed.
......@@ -31,7 +31,7 @@ nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create()
_this->_public.segment_size = 1400;
_this->max_num_segments = 8;
_this->_public.subframe_buffer_size = 8;
_this->_public.subframe_buffer_size = 8;// TODO: Initialize the slot_buffer size
_this->_public.timing_info_mode_periodic = 1;
_this->_public.timing_info_period = 32;
_this->_public.timing_info_mode_aperiodic = 1;
......
......@@ -74,9 +74,12 @@ typedef struct nfapi_vnf_p7_connection_info {
uint16_t min_sync_cycle_count;
uint32_t latency[8];
uint32_t average_latency;
int32_t sf_offset_filtered;
int32_t sf_offset_trend;
int32_t sf_offset;
//int32_t sf_offset_filtered;
//int32_t sf_offset_trend;
//int32_t sf_offset;
int32_t slot_offset;
int32_t slot_offset_trend;
int32_t slot_offset_filtered;
uint16_t zero_count;
int32_t adjustment;
int32_t insync_minor_adjustment;
......@@ -84,8 +87,8 @@ typedef struct nfapi_vnf_p7_connection_info {
uint32_t previous_t1;
uint32_t previous_t2;
int32_t previous_sf_offset_filtered;
//int32_t previous_sf_offset_filtered;
int32_t previous_slot_offset_filtered;
int sfn_sf;
int sfn;
int slot;
......@@ -112,7 +115,8 @@ typedef struct {
uint8_t terminate;
nfapi_vnf_p7_connection_info_t* p7_connections;
int socket;
uint32_t sf_start_time_hr;
// uint32_t sf_start_time_hr;
uint32_t slot_start_time_hr;
uint8_t* rx_message_buffer; // would this be better put in the p7 conenction info?
uint16_t rx_message_buffer_size;
......
......@@ -802,7 +802,7 @@ void vnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, nfapi_vnf_confi
if(msg)
{
if(nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, msg, msg_size, &config->codec_config) >= 0)
{
{
if(config->vendor_ext)
config->vendor_ext(config, p5_idx, msg);
}
......
......@@ -664,7 +664,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy
info->p5_idx = p5_idx;
info->phy_id = vnf->next_phy_id++;
info->timing_window = 30; // This seems to override what gets set by the user - why???
info->timing_window = 30; // This seems to override what gets set by the user - why??? //TODO: Change in NR in terms of microsecends,what should be the value?
info->timing_info_mode = 0x03;
info->timing_info_period = 128;
......
This diff is collapsed.
......@@ -145,8 +145,8 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
//struct timespec original_pselect_timeout;
struct timespec pselect_timeout;
pselect_timeout.tv_sec = 0;
pselect_timeout.tv_nsec = 1000000; // ns in a 1 us
pselect_timeout.tv_nsec = 500000; // ns in a 1 ms (Change?)
//pselect_timeout.tv_nsec = 500000;
struct timespec pselect_start;
struct timespec pselect_stop;
......@@ -156,15 +156,25 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
long last_millisecond = -1;
struct timespec sf_duration;
sf_duration.tv_sec = 0;
sf_duration.tv_nsec = 0.5e6; // We want 1ms pause //We want 0.5 ms pause for NR
// struct timespec sf_duration; //Change to slot_duration?
// sf_duration.tv_sec = 0;
// sf_duration.tv_nsec = 0.5e6; // We want 1ms pause //We want 0.5 ms pause for NR
struct timespec slot_duration;
slot_duration.tv_sec = 0;
slot_duration.tv_nsec = 0.5e6;
struct timespec sf_start;
clock_gettime(CLOCK_MONOTONIC, &sf_start);
long millisecond = sf_start.tv_nsec / 1e6; //Check if we have to change
sf_start = timespec_add(sf_start, sf_duration);
NFAPI_TRACE(NFAPI_TRACE_INFO, "next slot will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
// struct timespec sf_start; //Change to slot_start?
struct timespec slot_start;
// clock_gettime(CLOCK_MONOTONIC, &sf_start);
clock_gettime(CLOCK_MONOTONIC, &slot_start);
// long millisecond = sf_start.tv_nsec / 1e6; //Check if we have to change
long millisecond = slot_start.tv_nsec / 1e6;
// sf_start = timespec_add(sf_start, sf_duration);
slot_start = timespec_add(slot_start, slot_duration);
NFAPI_TRACE(NFAPI_TRACE_INFO, "next slot will start at %d.%d\n", slot_start.tv_sec, slot_start.tv_nsec);
while(vnf_p7->terminate == 0)
{
......@@ -185,8 +195,9 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
if((pselect_start.tv_sec > sf_start.tv_sec) ||
((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec)))
//if((pselect_start.tv_sec > sf_start.tv_sec) ||
// ((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec)))
if((pselect_start.tv_sec > slot_start.tv_sec) || ((pselect_start.tv_sec == slot_start.tv_sec) && (pselect_start.tv_nsec > slot_start.tv_nsec)))
{
// overran the end of the subframe we do not want to wait
pselect_timeout.tv_sec = 0;
......@@ -198,8 +209,8 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
else
{
// still time before the end of the subframe wait
pselect_timeout = timespec_sub(sf_start, pselect_start);
//pselect_timeout = timespec_sub(sf_start, pselect_start);
pselect_timeout = timespec_sub(slot_start, pselect_start);
}
//original_pselect_timeout = pselect_timeout;
......@@ -234,7 +245,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
{
// todo check we don't go below 0
pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
}
//phy->insync_minor_adjustment = 0;
phy->insync_minor_adjustment_duration--;
......@@ -247,6 +258,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
// selectRetval = pselect(120, &rfds, NULL, NULL, &pselect_timeout, NULL);
clock_gettime(CLOCK_MONOTONIC, &pselect_stop);
......@@ -254,25 +266,33 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
if (selectRetval==-1 && errno == 22)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
// NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
// pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
// phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
// sf_duration.tv_sec, sf_duration.tv_nsec);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
sf_duration.tv_sec, sf_duration.tv_nsec);
slot_duration.tv_sec, slot_duration.tv_nsec);
}
if(selectRetval == 0)
{
// calculate the start of the next subframe
sf_start = timespec_add(sf_start, sf_duration);
// calculate the start of the next slot
//sf_start = timespec_add(sf_start, sf_duration);
slot_start = timespec_add(slot_start, slot_duration);
//NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0)
{
long insync_minor_adjustment_ns = (phy->insync_minor_adjustment * 1000);
sf_start.tv_nsec -= insync_minor_adjustment_ns;
//sf_start.tv_nsec -= insync_minor_adjustment_ns;
slot_start.tv_nsec -= insync_minor_adjustment_ns;
#if 1
if (sf_start.tv_nsec > 1e9)
/* if (sf_start.tv_nsec > 1e9) //Change to 0.5e6?
{
sf_start.tv_sec++;
sf_start.tv_nsec-=1e9;
......@@ -281,6 +301,16 @@ if (selectRetval==-1 && errno == 22)
{
sf_start.tv_sec--;
sf_start.tv_nsec+=1e9;
}*/
if (slot_start.tv_nsec > 1e9)
{
slot_start.tv_sec++;
slot_start.tv_nsec-=1e9;
}
else if (slot_start.tv_nsec < 0)
{
slot_start.tv_sec--;
slot_start.tv_nsec+=1e9;
}
#else
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] BEFORE adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d\n", phy->insync_minor_adjustment, sf_start.tv_nsec);
......@@ -314,8 +344,10 @@ if (selectRetval==-1 && errno == 22)
//phy->insync_minor_adjustment = 0;
phy->insync_minor_adjustment_duration--;
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n",
phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n",
// phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Slot minor adjustment %dus slot_start.tv_nsec:%d duration:%u\n",
phy->insync_minor_adjustment, slot_start.tv_nsec, phy->insync_minor_adjustment_duration);
if (phy->insync_minor_adjustment_duration==0)
{
......@@ -339,12 +371,15 @@ if (selectRetval==-1 && errno == 22)
last_millisecond = millisecond;
*/
millisecond ++;
//millisecond ++;
millisecond = millisecond + 1;
}
}
else
{
// we have overrun the subframe advance to go and collect $200
// we have overrun the subframe advance to go and collect $200
// CHANGE - gokul
if((millisecond - last_millisecond) > 3)
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe overrun %ld %ld (%ld)\n", millisecond, last_millisecond, millisecond - last_millisecond + 1);
......@@ -354,7 +389,8 @@ if (selectRetval==-1 && errno == 22)
if(selectRetval == 0)
{
vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
//vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
vnf_p7->slot_start_time_hr = vnf_get_current_time_hr();
// pselect timed out
nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
......@@ -365,6 +401,7 @@ if (selectRetval==-1 && errno == 22)
if (curr->slot == 19)
{
curr->sfn++;
curr->slot = 0; //Correct? - gokul
}
else if(curr->slot > 19)
{
......@@ -377,10 +414,11 @@ if (selectRetval==-1 && errno == 22)
//curr->sfn_sf = increment_sfn_sf(curr->sfn_sf);
vnf_sync(vnf_p7, curr);
//printf("sfn:%d, slot:%d",curr->sfn,curr->slot); //remove later - gokul
curr = curr->next;
}
//send_mac_subframe_indications(vnf_p7);
send_mac_slot_indications(vnf_p7);
......@@ -390,7 +428,7 @@ if (selectRetval==-1 && errno == 22)
// have a p7 message
if(FD_ISSET(vnf_p7->socket, &rfds))
{
vnf_p7_read_dispatch_message(vnf_p7);
vnf_p7_read_dispatch_message(vnf_p7);
}
}
else
......@@ -448,12 +486,13 @@ int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr,
memset(node, 0, sizeof(nfapi_vnf_p7_connection_info_t));
node->phy_id = phy_id;
node->in_sync = 0;
node->dl_out_sync_offset = 30;
node->dl_out_sync_offset = 30;//TODO: Values need to be changed for NR,How to set the values
node->dl_out_sync_period = 10;
node->dl_in_sync_offset = 30;
node->dl_in_sync_period = 512;
node->sfn_sf = 0;
//node->sfn_sf = 0;
node->sfn = 0;
node->slot = 0;
node->min_sync_cycle_count = 8;
// save the remote endpoint information
......
This diff is collapsed.
......@@ -36,6 +36,9 @@
#include "nfapi/oai_integration/vendor_ext.h"
int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_tti_request_t *dl_config_req);
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req);
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req);
extern uint8_t nfapi_mode;
......@@ -130,7 +133,7 @@ void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
}
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
PHY_VARS_gNB *gNB;
// copy data from L2 interface into L1 structures
module_id_t Mod_id = Sched_INFO->module_id;
......@@ -141,12 +144,23 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
frame_t frame = Sched_INFO->frame;
sub_frame_t slot = Sched_INFO->slot;
//Gokul
if(slot%2!=0)
{
printf("\n Odd Slot %d \n,slot");
}
else
{
printf("\n Even Slot \n");
}
AssertFatal(RC.gNB!=NULL,"RC.gNB is null\n");
AssertFatal(RC.gNB[Mod_id]!=NULL,"RC.gNB[%d] is null\n",Mod_id);
gNB = RC.gNB[Mod_id];
uint8_t number_dl_pdu = DL_req->dl_tti_request_body.nPDUs;
uint8_t number_dl_pdu = DL_req->nPDUs;
// uint8_t number_ul_pdu = 0;
uint8_t number_ul_dci_pdu = (UL_dci_req==NULL) ? 0 : UL_dci_req->numPdus;
......@@ -163,12 +177,12 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
gNB->pbch_configured=0;
for (int i=0;i<number_dl_pdu;i++) {
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu = &DL_req->dl_tti_request_body.dl_tti_pdu_list[i];
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu = &DL_req->dl_tti_pdu_list[i];
LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_tti_pdu->PDUType);
switch (dl_tti_pdu->PDUType) {
case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
gNB->pbch_configured=1;
// if (NFAPI_MODE!=NFAPI_MODE_VNF) ?
if(nfapi_mode != 2)
handle_nr_nfapi_ssb_pdu(gNB,frame,slot,
dl_tti_pdu);
......@@ -176,7 +190,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!=NFAPI_MODE_VNF) ?
if(nfapi_mode != 2)
handle_nfapi_nr_pdcch_pdu(gNB,
frame, slot,
&dl_tti_pdu->pdcch_pdu);
......@@ -192,7 +206,7 @@ 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!=NFAPI_MODE_VNF) ?
if(nfapi_mode != 2)
handle_nr_nfapi_pdsch_pdu(gNB,frame,slot,&dl_tti_pdu->pdsch_pdu, sdu);
}
}
......@@ -201,15 +215,32 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
if (UL_tti_req!=NULL)
memcpy(&gNB->UL_tti_req,UL_tti_req,sizeof(nfapi_nr_ul_tti_request_t));
// if (NFAPI_MODE!=NFAPI_MODE_VNF) //should we enclose the for in this?
if(nfapi_mode != 2)
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!=NFAPI_MONOLITHIC) {
oai_nfapi_nr_dl_config_req(Sched_INFO->DL_req);
if (nfapi_mode != 0 )
{
if (Sched_INFO->TX_req->Number_of_PDUs > 0)
{
Sched_INFO->TX_req->SFN = frame;
Sched_INFO->TX_req->Slot = slot;
oai_nfapi_tx_data_req(Sched_INFO->TX_req);
}
//if(Sched_INFO->DL_req->nPDUs > 0)
{
Sched_INFO->DL_req->SFN = frame;
Sched_INFO->DL_req->Slot = slot;
oai_nfapi_nr_dl_config_req(Sched_INFO->DL_req);
}
}
if (nfapi_mode != 0 && Sched_INFO->UL_dci_req->numPdus!=0)
{
Sched_INFO->UL_dci_req->SFN=frame;
Sched_INFO->UL_dci_req->Slot=slot;
oai_nfapi_ul_dci_req(Sched_INFO->UL_dci_req);
}
}
......@@ -160,7 +160,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_COMMON_TX,0);
if (gNB->pdcch_pdu || gNB->ul_dci_pdu) {
if (gNB->pdcch_pdu || gNB->ul_dci_pdu) {
LOG_D(PHY, "[gNB %d] Frame %d slot %d Calling nr_generate_dci_top (number of UL/DL DCI %d/%d)\n",
gNB->Mod_id, frame, slot,
gNB->ul_dci_pdu==NULL?0:gNB->ul_dci_pdu->pdcch_pdu.pdcch_pdu_rel15.numDlDci,
......
......@@ -337,41 +337,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
cfg->ssb_table.ssb_beam_id_list[0].beam_id->tl.tag = NFAPI_NR_CONFIG_BEAM_ID_TAG;
cfg->num_tlv++;
}
// TODO: assign values to nfapi_config struct
cfg->nfapi_config.dl_ue_per_sf.tl.tag = NFAPI_NR_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG;
cfg->num_tlv++;
cfg->nfapi_config.max_transmit_power.tl.tag = NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG;
cfg->num_tlv++;
cfg->nfapi_config.nrarfcn.tl.tag = NFAPI_NR_NFAPI_NRARFCN_TAG;
cfg->nfapi_config.nrarfcn.value = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA;
cfg->num_tlv++;
cfg->nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG;
cfg->num_tlv++;
cfg->nfapi_config.p7_pnf_address_ipv6.tl.tag = NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG;
cfg->num_tlv++;
cfg->nfapi_config.p7_pnf_port.tl.tag = NFAPI_NR_NFAPI_P7_PNF_PORT_TAG;
cfg->num_tlv++;
cfg->nfapi_config.p7_vnf_address_ipv6.tl.tag = NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG;
cfg->num_tlv++;
cfg->nfapi_config.rf_bands.tl.tag = NFAPI_NR_NFAPI_RF_BANDS_TAG;
cfg->num_tlv++;
cfg->nfapi_config.rf_bands.rf_band[0] = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
cfg->nfapi_config.ul_ue_per_sf.tl.tag = NFAPI_NR_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG;
cfg->num_tlv++;
}
......
......@@ -79,8 +79,8 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
DL_req[CC_idP].SFN = frameP;
DL_req[CC_idP].Slot = slotP;
DL_req[CC_idP].dl_tti_request_body.nPDUs = 0;
DL_req[CC_idP].dl_tti_request_body.nGroup = 0;
DL_req[CC_idP].nPDUs = 0;
DL_req[CC_idP].nGroup = 0;
//DL_req[CC_idP].dl_tti_request_body.transmission_power_pcfich = 6000;
UL_dci_req[CC_idP].SFN = frameP;
......@@ -439,7 +439,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
#endif
// Phytest scheduling
if (get_softmodem_params()->phy_test && slot_txP==1){
if (get_softmodem_params()->phy_test && slot_txP==3 ){
nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP, pucch_sched, NULL);
// resetting ta flag
gNB->ta_len = 0;
......@@ -452,12 +452,13 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
*/
} //is_nr_DL_slot
/*
if (is_nr_UL_slot(cc->ServingCellConfigCommon,slot_rxP)) {
if (get_softmodem_params()->phy_test && slot_rxP==8){
nr_schedule_uss_ulsch_phytest(module_idP, frame_rxP, slot_rxP);
}
}
*/ //Testing only DL for now
stop_meas(&RC.nrmac[module_idP]->eNB_scheduler);
......
......@@ -61,7 +61,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
NR_COMMON_channels_t *cc;
nfapi_nr_dl_tti_request_t *dl_tti_request;
nfapi_nr_dl_tti_request_body_t *dl_req;
nfapi_nr_dl_tti_request_pdu_t *dl_config_pdu;
int mib_sdu_length;
......@@ -73,7 +73,6 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
dl_tti_request = &gNB->DL_req[CC_id];
dl_req = &dl_tti_request->dl_tti_request_body;
cc = &gNB->common_channels[CC_id];
mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0]); // not used in this case
......@@ -82,16 +81,16 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
if (mib_sdu_length > 0) {
LOG_I(MAC, "Frame %d, slot %d: Adding BCH PDU in position %d (length %d)\n", frameP, slotP, dl_req->nPDUs, mib_sdu_length);
LOG_I(MAC, "Frame %d, slot %d: Adding BCH PDU in position %d (length %d)\n", frameP, slotP, dl_tti_request->nPDUs, mib_sdu_length);
if ((frameP & 1023) < 80){
LOG_I(MAC,"[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n",module_idP, frameP, CC_id, mib_sdu_length);
}
dl_config_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
dl_config_pdu = &dl_tti_request->dl_tti_pdu_list[dl_tti_request->nPDUs];
memset((void *) dl_config_pdu, 0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
dl_config_pdu->PDUType = NFAPI_NR_DL_TTI_SSB_PDU_TYPE;
dl_config_pdu->PDUSize =2 + sizeof(nfapi_nr_dl_tti_ssb_pdu_rel15_t);
dl_config_pdu->PDUSize = 2 + sizeof(nfapi_nr_dl_tti_ssb_pdu_rel15_t);
AssertFatal(cc->ServingCellConfigCommon->physCellId!=NULL,"cc->ServingCellConfigCommon->physCellId is null\n");
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.PhysCellId = *cc->ServingCellConfigCommon->physCellId;
......@@ -136,7 +135,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA = ssb_offset0/(ratio*12) - 10; // absoluteFrequencySSB is the center of SSB
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag = 1;
dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload = (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1);
dl_req->nPDUs++;
dl_tti_request->nPDUs++;
}
}
}
......
......@@ -66,7 +66,6 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
uint8_t CC_id;
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &nr_mac->common_channels[0];
nfapi_nr_dl_tti_request_body_t *dl_req;
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu;
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu;
nfapi_nr_pdu_t *TX_req;
......@@ -92,15 +91,13 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
LOG_D(MAC, "Scheduling common search space DCI type 1 dlBWP BW.firstRB %d.%d\n",
dlBWP_carrier_bandwidth,
NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,275));
dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body;
dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
dl_tti_pdcch_pdu = &nr_mac->DL_req[CC_id].dl_tti_pdu_list[nr_mac->DL_req[CC_id].nPDUs];
memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE;
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1];
dl_tti_pdsch_pdu = &nr_mac->DL_req[CC_id].dl_tti_pdu_list[nr_mac->DL_req[CC_id].nPDUs+1];
memset((void *)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE;
dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu));
......@@ -235,7 +232,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
pdsch_pdu_rel15->mcsIndex[0]);
*/
dl_req->nPDUs+=2;
nr_mac->DL_req[CC_id].nPDUs+=2;
TX_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
TX_req->PDU_length = 6;
......@@ -255,7 +252,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
int configure_fapi_dl_pdu(int Mod_idP,
int *CCEIndex,
nfapi_nr_dl_tti_request_body_t *dl_req,
nfapi_nr_dl_tti_request_t *dl_tti_req,
NR_sched_pucch *pucch_sched,
uint8_t *mcsIndex,
uint16_t *rbSize,
......@@ -278,12 +275,12 @@ int configure_fapi_dl_pdu(int Mod_idP,
NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
dl_tti_pdcch_pdu = &dl_tti_req->dl_tti_pdu_list[dl_tti_req->nPDUs];
memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE;
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1];
dl_tti_pdsch_pdu = &dl_tti_req->dl_tti_pdu_list[dl_tti_req->nPDUs+1];
memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE;
dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu));
......@@ -456,14 +453,14 @@ void config_uldci(NR_BWP_Uplink_t *ubwp,nfapi_nr_pusch_pdu_t *pusch_pdu,nfapi_nr
void configure_fapi_dl_Tx(module_id_t Mod_idP,
frame_t frameP,
sub_frame_t slotP,
nfapi_nr_dl_tti_request_body_t *dl_req,
nfapi_nr_dl_tti_request_t *dl_tti_req,
nfapi_nr_pdu_t *tx_req,
int tbs_bytes,
int16_t pdu_index){
int CC_id = 0;
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1];
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_tti_req->dl_tti_pdu_list[dl_tti_req->nPDUs+1];
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15;
gNB_MAC_INST *nr_mac = RC.nrmac[Mod_idP];
......@@ -477,7 +474,7 @@ void configure_fapi_dl_Tx(module_id_t Mod_idP,
pdsch_pdu_rel15->mcsIndex[0],
tbs_bytes);
dl_req->nPDUs+=2;
dl_tti_req->nPDUs+=2;
tx_req->PDU_length = pdsch_pdu_rel15->TBSize[0];
tx_req->PDU_index = nr_mac->pdu_index[0]++;
......@@ -506,7 +503,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP];
//NR_COMMON_channels_t *cc = nr_mac->common_channels;
//NR_ServingCellConfigCommon_t *scc=cc->ServingCellConfigCommon;
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
nfapi_nr_dl_tti_request_t *dl_tti_req = &gNB_mac->DL_req[CC_id];
nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[gNB_mac->TX_req[CC_id].Number_of_PDUs];
mac_rlc_status_resp_t rlc_status;
......@@ -541,7 +538,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
TBS_bytes = configure_fapi_dl_pdu(module_idP,
CCEIndices,
dl_req,
dl_tti_req,
pucch_sched,
dlsch_config!=NULL ? dlsch_config->mcsIndex : NULL,
dlsch_config!=NULL ? &dlsch_config->rbSize : NULL,
......@@ -666,7 +663,7 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
gNB_mac->UE_list.DLSCH_pdu[0][0].payload[0][offset + j] = 0; // mac_pdu[offset + j] = 0;
}
configure_fapi_dl_Tx(module_idP, frameP, slotP, dl_req, tx_req, TBS_bytes, gNB_mac->pdu_index[CC_id]);
configure_fapi_dl_Tx(module_idP, frameP, slotP, dl_tti_req, tx_req, TBS_bytes, gNB_mac->pdu_index[CC_id]);
if(IS_SOFTMODEM_NOS1){
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
......
......@@ -84,7 +84,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
int configure_fapi_dl_pdu(int Mod_id,
int *CCEIndeces,
nfapi_nr_dl_tti_request_body_t *dl_req,
nfapi_nr_dl_tti_request_t *dl_tti_req,
NR_sched_pucch *pucch_sched,
uint8_t *mcsIndex,
uint16_t *rbSize,
......@@ -95,7 +95,7 @@ void config_uldci(NR_BWP_Uplink_t *ubwp,nfapi_nr_pusch_pdu_t *pusch_pdu,nfapi_nr
void configure_fapi_dl_Tx(module_id_t Mod_idP,
frame_t frameP,
sub_frame_t slotP,
nfapi_nr_dl_tti_request_body_t *dl_req,
nfapi_nr_dl_tti_request_t *dl_tti_req,
nfapi_nr_pdu_t *tx_req,
int tbs_bytes,
int16_t pdu_index);
......
......@@ -298,7 +298,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
LOG_D(PHY,"NR_Schedule_response: SFN_SF:%d%d dl_pdus:%d\n",
sched_info->frame,
sched_info->slot,
sched_info->DL_req->dl_tti_request_body.nPDUs);
sched_info->DL_req->nPDUs);
}
}
}
......
......@@ -30,6 +30,10 @@
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
#include "common/config/config_load_configmodule.h"
#include "common/config/config_userapi.h"
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
#include "openair1/PHY/defs_gNB.h"
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h"
#include "openair1/PHY/LTE_TRANSPORT/transport_common.h"
extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
void configure_nfapi_pnf(char *vnf_ip_addr,
......@@ -1120,3 +1124,23 @@ int l1_north_init_eNB(void) {
void init_eNB_afterRU(void) {
}
void nr_phy_config_request(NR_PHY_Config_t *gNB){}
void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
int frame, int slot,
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu){}
void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
int frame, int slot,
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu){}
void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu){}
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){}
void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
uint8_t *sdu){
}
int l1_north_init_gNB(void){}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment