develop&-nr up-to-date as of 30.7.19
This commit is contained in:
@@ -83,7 +83,7 @@ nfapi_tx_request_pdu_t *tx_request_pdu[1023][10][10]; // [frame][subframe][max_n
|
||||
|
||||
uint8_t tx_pdus[32][8][4096];
|
||||
|
||||
|
||||
nfapi_ue_release_request_body_t release_rntis;
|
||||
uint16_t phy_antenna_capability_values[] = { 1, 2, 4, 8, 16 };
|
||||
|
||||
nfapi_pnf_param_response_t g_pnf_param_resp;
|
||||
@@ -197,19 +197,19 @@ static pthread_t pnf_start_pthread;
|
||||
int nfapitooai_level(int nfapi_level) {
|
||||
switch(nfapi_level) {
|
||||
case NFAPI_TRACE_ERROR:
|
||||
return LOG_ERR;
|
||||
return OAILOG_ERR;
|
||||
|
||||
case NFAPI_TRACE_WARN:
|
||||
return LOG_WARNING;
|
||||
return OAILOG_WARNING;
|
||||
|
||||
case NFAPI_TRACE_NOTE:
|
||||
return LOG_INFO;
|
||||
return OAILOG_INFO;
|
||||
|
||||
case NFAPI_TRACE_INFO:
|
||||
return LOG_DEBUG;
|
||||
return OAILOG_DEBUG;
|
||||
}
|
||||
|
||||
return LOG_ERR;
|
||||
return OAILOG_ERR;
|
||||
}
|
||||
|
||||
void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char *message, ...) {
|
||||
@@ -540,7 +540,6 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
|
||||
}
|
||||
|
||||
if(req->nfapi_config.earfcn.tl.tag == NFAPI_NFAPI_EARFCN_TAG) {
|
||||
fp->eutra_band = 0;
|
||||
fp->dl_CarrierFreq = from_earfcn(fp->eutra_band, req->nfapi_config.earfcn.value);
|
||||
fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_uldl_offset(fp->eutra_band) * 1e5);
|
||||
num_tlv++;
|
||||
@@ -896,6 +895,15 @@ int pnf_phy_lbt_dl_config_req(nfapi_pnf_p7_config_t *config, nfapi_lbt_dl_config
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_phy_ue_release_req(nfapi_pnf_p7_config_t* config, nfapi_ue_release_request_t* req) {
|
||||
if (req->ue_release_request_body.number_of_TLVs==0)
|
||||
return -1;
|
||||
|
||||
release_rntis.number_of_TLVs = req->ue_release_request_body.number_of_TLVs;
|
||||
memcpy(&release_rntis.ue_release_request_TLVs_list, req->ue_release_request_body.ue_release_request_TLVs_list, sizeof(nfapi_ue_release_request_TLVs_t)*req->ue_release_request_body.number_of_TLVs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_phy_vendor_ext(nfapi_pnf_p7_config_t *config, nfapi_p7_message_header_t *msg) {
|
||||
if(msg->message_id == P7_VENDOR_EXT_REQ) {
|
||||
//vendor_ext_p7_req* req = (vendor_ext_p7_req*)msg;
|
||||
@@ -1024,7 +1032,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
|
||||
p7_config->hi_dci0_req = &pnf_phy_hi_dci0_req;
|
||||
p7_config->tx_req = &pnf_phy_tx_req;
|
||||
p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
|
||||
|
||||
p7_config->ue_release_req = &pnf_phy_ue_release_req;
|
||||
if (NFAPI_MODE==NFAPI_UE_STUB_PNF) {
|
||||
p7_config->dl_config_req = &memcpy_dl_config_req;
|
||||
p7_config->ul_config_req = &memcpy_ul_config_req;
|
||||
@@ -1367,7 +1375,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
|
||||
printf("%s() PNF\n\n\n\n\n\n", __FUNCTION__);
|
||||
|
||||
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
|
||||
nfapi_setmode(NFAPI_PNF); // PNF!
|
||||
nfapi_setmode(NFAPI_MODE_PNF); // PNF!
|
||||
}
|
||||
|
||||
nfapi_pnf_config_t *config = nfapi_pnf_config_create();
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "common/ran_context.h"
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern UL_RCC_IND_t UL_RCC_INFO;
|
||||
|
||||
typedef struct {
|
||||
uint8_t enabled;
|
||||
@@ -424,6 +425,40 @@ int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indicatio
|
||||
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
||||
printf("[VNF] RACH_IND eNB:%p sfn_sf:%d number_of_preambles:%d\n", eNB, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles);
|
||||
pthread_mutex_lock(&eNB->UL_INFO_mutex);
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF){
|
||||
int8_t index = -1;
|
||||
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
|
||||
if((UL_RCC_INFO.rach_ind[i].header.message_id == 0) && (index == -1)){
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(index == -1){
|
||||
LOG_E(MAC,"phy_rach_indication : num of rach reach max \n");
|
||||
return 0;
|
||||
}
|
||||
UL_RCC_INFO.rach_ind[index] = *ind;
|
||||
|
||||
if (ind->rach_indication_body.number_of_preambles > 0)
|
||||
UL_RCC_INFO.rach_ind[index].rach_indication_body.preamble_list = malloc(sizeof(nfapi_preamble_pdu_t)*ind->rach_indication_body.number_of_preambles );
|
||||
|
||||
for (int i=0; i<ind->rach_indication_body.number_of_preambles; i++) {
|
||||
if (ind->rach_indication_body.preamble_list[i].preamble_rel8.tl.tag == NFAPI_PREAMBLE_REL8_TAG) {
|
||||
|
||||
printf("preamble[%d]: rnti:%02x preamble:%d timing_advance:%d\n",
|
||||
i,
|
||||
ind->rach_indication_body.preamble_list[i].preamble_rel8.rnti,
|
||||
ind->rach_indication_body.preamble_list[i].preamble_rel8.preamble,
|
||||
ind->rach_indication_body.preamble_list[i].preamble_rel8.timing_advance
|
||||
);
|
||||
}
|
||||
if(ind->rach_indication_body.preamble_list[i].preamble_rel13.tl.tag == NFAPI_PREAMBLE_REL13_TAG) {
|
||||
printf("RACH PREAMBLE REL13 present\n");
|
||||
}
|
||||
|
||||
UL_RCC_INFO.rach_ind[index].rach_indication_body.preamble_list[i] = ind->rach_indication_body.preamble_list[i];
|
||||
}
|
||||
}else{
|
||||
eNB->UL_INFO.rach_ind = *ind;
|
||||
eNB->UL_INFO.rach_ind.rach_indication_body.preamble_list = eNB->preamble_list;
|
||||
|
||||
@@ -443,7 +478,7 @@ int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indicatio
|
||||
|
||||
eNB->preamble_list[i] = ind->rach_indication_body.preamble_list[i];
|
||||
}
|
||||
|
||||
}
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
||||
//mac_rach_ind(p7_vnf->mac, ind);
|
||||
@@ -454,13 +489,33 @@ int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indicatio
|
||||
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
||||
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_harqs:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->harq_indication_body.number_of_harqs);
|
||||
pthread_mutex_lock(&eNB->UL_INFO_mutex);
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF){
|
||||
int8_t index = -1;
|
||||
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
|
||||
if((UL_RCC_INFO.harq_ind[i].header.message_id == 0) && (index == -1)){
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(index == -1){
|
||||
LOG_E(MAC,"phy_harq_indication : num of harq reach max \n");
|
||||
return 0;
|
||||
}
|
||||
UL_RCC_INFO.harq_ind[index] = *ind;
|
||||
|
||||
if (ind->harq_indication_body.number_of_harqs > 0)
|
||||
UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list = malloc(sizeof(nfapi_harq_indication_pdu_t)*ind->harq_indication_body.number_of_harqs );
|
||||
for (int i=0; i<ind->harq_indication_body.number_of_harqs; i++) {
|
||||
memcpy(&UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list[i], &ind->harq_indication_body.harq_pdu_list[i], sizeof(nfapi_harq_indication_pdu_t));
|
||||
}
|
||||
}else{
|
||||
eNB->UL_INFO.harq_ind = *ind;
|
||||
eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = eNB->harq_pdu_list;
|
||||
|
||||
for (int i=0; i<ind->harq_indication_body.number_of_harqs; i++) {
|
||||
memcpy(&eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i], &ind->harq_indication_body.harq_pdu_list[i], sizeof(eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i]));
|
||||
}
|
||||
|
||||
}
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
||||
//mac_harq_ind(p7_vnf->mac, ind);
|
||||
@@ -470,6 +525,37 @@ int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indicatio
|
||||
int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_t *ind) {
|
||||
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
||||
pthread_mutex_lock(&eNB->UL_INFO_mutex);
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF){
|
||||
int8_t index = -1;
|
||||
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
|
||||
if((UL_RCC_INFO.crc_ind[i].header.message_id == 0) && (index == -1)){
|
||||
index = i;
|
||||
}
|
||||
if(UL_RCC_INFO.rx_ind[i].sfn_sf == ind->sfn_sf){
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(index == -1){
|
||||
LOG_E(MAC,"phy_crc_indication : num of crc reach max \n");
|
||||
return 0;
|
||||
}
|
||||
UL_RCC_INFO.crc_ind[index] = *ind;
|
||||
|
||||
if (ind->crc_indication_body.number_of_crcs > 0)
|
||||
UL_RCC_INFO.crc_ind[index].crc_indication_body.crc_pdu_list = malloc(sizeof(nfapi_crc_indication_pdu_t)*ind->crc_indication_body.number_of_crcs );
|
||||
|
||||
for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++) {
|
||||
memcpy(&UL_RCC_INFO.crc_ind[index].crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0]));
|
||||
|
||||
LOG_D(MAC, "%s() NFAPI SFN/SF:%d CRC_IND:number_of_crcs:%u UL_INFO:crcs:%d PDU[%d] rnti:%04x UL_INFO:rnti:%04x\n",
|
||||
__FUNCTION__,
|
||||
NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, UL_RCC_INFO.crc_ind[index].crc_indication_body.number_of_crcs,
|
||||
i,
|
||||
ind->crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti,
|
||||
UL_RCC_INFO.crc_ind[index].crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti);
|
||||
}
|
||||
}else{
|
||||
eNB->UL_INFO.crc_ind = *ind;
|
||||
nfapi_crc_indication_t *dest_ind = &eNB->UL_INFO.crc_ind;
|
||||
nfapi_crc_indication_pdu_t *dest_pdu_list = eNB->crc_pdu_list;
|
||||
@@ -489,7 +575,7 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_
|
||||
ind->crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti,
|
||||
eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti);
|
||||
}
|
||||
|
||||
}
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
||||
//mac_crc_ind(p7_vnf->mac, ind);
|
||||
@@ -504,6 +590,52 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&eNB->UL_INFO_mutex);
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF){
|
||||
int8_t index = -1;
|
||||
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
|
||||
if((UL_RCC_INFO.rx_ind[i].header.message_id == 0) && (index == -1)){
|
||||
index = i;
|
||||
}
|
||||
if(UL_RCC_INFO.crc_ind[i].sfn_sf == ind->sfn_sf){
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(index == -1){
|
||||
LOG_E(MAC,"phy_rx_indication : num of rx reach max \n");
|
||||
return 0;
|
||||
}
|
||||
UL_RCC_INFO.rx_ind[index] = *ind;
|
||||
|
||||
if (ind->rx_indication_body.number_of_pdus > 0)
|
||||
UL_RCC_INFO.rx_ind[index].rx_indication_body.rx_pdu_list = malloc(sizeof(nfapi_rx_indication_pdu_t)*ind->rx_indication_body.number_of_pdus );
|
||||
|
||||
for (int i=0; i<ind->rx_indication_body.number_of_pdus; i++) {
|
||||
nfapi_rx_indication_pdu_t *dest_pdu = &UL_RCC_INFO.rx_ind[index].rx_indication_body.rx_pdu_list[i];
|
||||
nfapi_rx_indication_pdu_t *src_pdu = &ind->rx_indication_body.rx_pdu_list[i];
|
||||
|
||||
memcpy(dest_pdu, src_pdu, sizeof(*src_pdu));
|
||||
// DJP - TODO FIXME - intentional memory leak
|
||||
if(dest_pdu->rx_indication_rel8.length > 0){
|
||||
dest_pdu->data = malloc(dest_pdu->rx_indication_rel8.length);
|
||||
memcpy(dest_pdu->data, src_pdu->data, dest_pdu->rx_indication_rel8.length);
|
||||
}else{
|
||||
dest_pdu->data = NULL;
|
||||
}
|
||||
|
||||
LOG_D(PHY, "%s() NFAPI SFN/SF:%d PDUs:%d [PDU:%d] handle:%d rnti:%04x length:%d offset:%d ul_cqi:%d ta:%d data:%p\n",
|
||||
__FUNCTION__,
|
||||
NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, i,
|
||||
dest_pdu->rx_ue_information.handle,
|
||||
dest_pdu->rx_ue_information.rnti,
|
||||
dest_pdu->rx_indication_rel8.length,
|
||||
dest_pdu->rx_indication_rel8.offset,
|
||||
dest_pdu->rx_indication_rel8.ul_cqi,
|
||||
dest_pdu->rx_indication_rel8.timing_advance,
|
||||
dest_pdu->data
|
||||
);
|
||||
}
|
||||
}else{
|
||||
nfapi_rx_indication_t *dest_ind = &eNB->UL_INFO.rx_ind;
|
||||
nfapi_rx_indication_pdu_t *dest_pdu_list = eNB->rx_pdu_list;
|
||||
*dest_ind = *ind;
|
||||
@@ -528,7 +660,7 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
|
||||
dest_pdu->data
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
||||
//mac_rx_ind(p7_vnf->mac, ind);
|
||||
@@ -544,6 +676,32 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t
|
||||
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
||||
LOG_D(MAC, "%s() NFAPI SFN/SF:%d srs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs);
|
||||
pthread_mutex_lock(&eNB->UL_INFO_mutex);
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF){
|
||||
int8_t index = -1;
|
||||
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
|
||||
if((UL_RCC_INFO.sr_ind[i].header.message_id == 0) && (index == -1)){
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(index == -1){
|
||||
LOG_E(MAC,"phy_sr_indication : num of sr reach max \n");
|
||||
return 0;
|
||||
}
|
||||
UL_RCC_INFO.sr_ind[index] = *ind;
|
||||
LOG_D(MAC,"%s() UL_INFO[%d].sr_ind.sr_indication_body.number_of_srs:%d\n", __FUNCTION__, index, eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs);
|
||||
if (ind->sr_indication_body.number_of_srs > 0)
|
||||
UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list = malloc(sizeof(nfapi_sr_indication_pdu_t)*ind->sr_indication_body.number_of_srs );
|
||||
|
||||
for (int i=0; i<ind->sr_indication_body.number_of_srs; i++) {
|
||||
nfapi_sr_indication_pdu_t *dest_pdu = &UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list[i];
|
||||
nfapi_sr_indication_pdu_t *src_pdu = &ind->sr_indication_body.sr_pdu_list[i];
|
||||
|
||||
LOG_D(MAC, "SR_IND[PDU:%d %d][rnti:%x cqi:%d channel:%d]\n", index, i, src_pdu->rx_ue_information.rnti, src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel);
|
||||
|
||||
memcpy(dest_pdu, src_pdu, sizeof(*src_pdu));
|
||||
}
|
||||
}else{
|
||||
nfapi_sr_indication_t *dest_ind = &eNB->UL_INFO.sr_ind;
|
||||
nfapi_sr_indication_pdu_t *dest_pdu_list = eNB->sr_pdu_list;
|
||||
*dest_ind = *ind;
|
||||
@@ -556,7 +714,7 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t
|
||||
LOG_D(MAC, "SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti, src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel);
|
||||
memcpy(dest_pdu, src_pdu, sizeof(*src_pdu));
|
||||
}
|
||||
|
||||
}
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
||||
//mac_sr_ind(p7_vnf->mac, ind);
|
||||
@@ -569,7 +727,48 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
|
||||
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
||||
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_cqis:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
|
||||
pthread_mutex_lock(&eNB->UL_INFO_mutex);
|
||||
eNB->UL_INFO.cqi_ind = ind->cqi_indication_body;
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF){
|
||||
int8_t index = -1;
|
||||
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
|
||||
if((UL_RCC_INFO.cqi_ind[i].header.message_id == 0) && (index == -1)){
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(index == -1){
|
||||
LOG_E(MAC,"phy_cqi_indication : num of cqi reach max \n");
|
||||
return 0;
|
||||
}
|
||||
UL_RCC_INFO.cqi_ind[index] = *ind;
|
||||
if (ind->cqi_indication_body.number_of_cqis > 0){
|
||||
UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_pdu_list = malloc(sizeof(nfapi_cqi_indication_pdu_t)*ind->cqi_indication_body.number_of_cqis );
|
||||
UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_raw_pdu_list = malloc(sizeof(nfapi_cqi_indication_raw_pdu_t)*ind->cqi_indication_body.number_of_cqis );
|
||||
}
|
||||
for (int i=0; i<ind->cqi_indication_body.number_of_cqis; i++) {
|
||||
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
|
||||
LOG_D(MAC, "SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
|
||||
src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel);
|
||||
memcpy(&UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_pdu_list[i],
|
||||
src_pdu, sizeof(nfapi_cqi_indication_pdu_t));
|
||||
|
||||
memcpy(&UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_raw_pdu_list[i],
|
||||
&ind->cqi_indication_body.cqi_raw_pdu_list[i], sizeof(nfapi_cqi_indication_raw_pdu_t));
|
||||
}
|
||||
}else{
|
||||
nfapi_cqi_indication_t *dest_ind = &eNB->UL_INFO.cqi_ind;
|
||||
*dest_ind = *ind;
|
||||
dest_ind->cqi_indication_body.cqi_pdu_list = ind->cqi_indication_body.cqi_pdu_list;
|
||||
dest_ind->cqi_indication_body.cqi_raw_pdu_list = ind->cqi_indication_body.cqi_raw_pdu_list;
|
||||
for(int i=0; i<ind->cqi_indication_body.number_of_cqis; i++) {
|
||||
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
|
||||
LOG_D(MAC, "SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
|
||||
src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel);
|
||||
memcpy(&dest_ind->cqi_indication_body.cqi_pdu_list[i],
|
||||
src_pdu, sizeof(nfapi_cqi_indication_pdu_t));
|
||||
memcpy(&dest_ind->cqi_indication_body.cqi_raw_pdu_list[i],
|
||||
&ind->cqi_indication_body.cqi_raw_pdu_list[i], sizeof(nfapi_cqi_indication_raw_pdu_t));
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
return 1;
|
||||
}
|
||||
@@ -947,6 +1146,7 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
|
||||
config->deallocate_p4_p5_vendor_ext = &vnf_deallocate_p4_p5_vendor_ext;
|
||||
config->codec_config.allocate = &vnf_allocate;
|
||||
config->codec_config.deallocate = &vnf_deallocate;
|
||||
memset(&UL_RCC_INFO,0,sizeof(UL_RCC_IND_t));
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
|
||||
pthread_create(&vnf_start_pthread, NULL, (void *)&vnf_start_thread, config);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
|
||||
@@ -1040,3 +1240,21 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int oai_nfapi_ue_release_req(nfapi_ue_release_request_t *release_req){
|
||||
if(release_req->ue_release_request_body.number_of_TLVs <= 0)
|
||||
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.message_id = NFAPI_UE_RELEASE_REQUEST;
|
||||
release_req->ue_release_request_body.tl.tag = NFAPI_UE_RELEASE_BODY_TAG;
|
||||
|
||||
int retval = nfapi_vnf_p7_ue_release_req(p7_config, release_req);
|
||||
if (retval!=0) {
|
||||
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||
} else {
|
||||
release_req->ue_release_request_body.number_of_TLVs = 0;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -150,6 +150,8 @@ typedef enum {
|
||||
NFAPI_LBT_DL_INDICATION,
|
||||
NFAPI_NB_HARQ_INDICATION,
|
||||
NFAPI_NRACH_INDICATION,
|
||||
NFAPI_UE_RELEASE_REQUEST,
|
||||
NFAPI_UE_RELEASE_RESPONSE,
|
||||
|
||||
NFAPI_PNF_PARAM_REQUEST = 0x0100,
|
||||
NFAPI_PNF_PARAM_RESPONSE,
|
||||
@@ -2424,6 +2426,19 @@ typedef struct {
|
||||
} nfapi_tx_request_body_t;
|
||||
#define NFAPI_TX_REQUEST_BODY_TAG 0x2022
|
||||
|
||||
#define NFAPI_RELEASE_MAX_RNTI 256
|
||||
typedef struct {
|
||||
uint32_t handle;
|
||||
uint16_t rnti;
|
||||
} nfapi_ue_release_request_TLVs_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint16_t number_of_TLVs;
|
||||
nfapi_ue_release_request_TLVs_t ue_release_request_TLVs_list[NFAPI_RELEASE_MAX_RNTI];
|
||||
} nfapi_ue_release_request_body_t;
|
||||
#define NFAPI_UE_RELEASE_BODY_TAG 0x2068
|
||||
|
||||
// P7 Message Structures
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
@@ -3450,6 +3465,19 @@ typedef struct {
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_error_indication_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint16_t sfn_sf;
|
||||
nfapi_ue_release_request_body_t ue_release_request_body;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_ue_release_request_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint32_t error_code;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_ue_release_response_t;
|
||||
|
||||
//
|
||||
// P4 Messages
|
||||
//
|
||||
|
||||
Regular → Executable
+142
-9
@@ -81,13 +81,19 @@ void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config)
|
||||
if(size == 0)
|
||||
return 0;
|
||||
|
||||
void* buffer_p = NULL;
|
||||
if(config && config->allocate)
|
||||
{
|
||||
return (config->allocate)(size);
|
||||
buffer_p = (config->allocate)(size);
|
||||
if(buffer_p != NULL){
|
||||
memset(buffer_p,0,size);
|
||||
}
|
||||
return buffer_p;
|
||||
}
|
||||
else
|
||||
{
|
||||
return calloc(1, size);
|
||||
buffer_p = calloc(1, size);
|
||||
return buffer_p;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1577,7 +1583,43 @@ static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
|
||||
|
||||
return x && y && z;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
{
|
||||
nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv;
|
||||
if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t j;
|
||||
uint16_t num = value->number_of_TLVs;
|
||||
for(j = 0; j < num; ++j){
|
||||
if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
|
||||
int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
|
||||
int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value);
|
||||
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
|
||||
return x && y && z;
|
||||
}
|
||||
|
||||
static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
|
||||
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
|
||||
|
||||
int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end);
|
||||
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
|
||||
return x && z;
|
||||
}
|
||||
|
||||
static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
{
|
||||
nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
|
||||
@@ -2665,7 +2707,15 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__);
|
||||
result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
break;
|
||||
|
||||
|
||||
case NFAPI_UE_RELEASE_REQUEST:
|
||||
result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
break;
|
||||
|
||||
case NFAPI_UE_RELEASE_RESPONSE:
|
||||
result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
break;
|
||||
|
||||
case NFAPI_HARQ_INDICATION:
|
||||
result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
break;
|
||||
@@ -4479,7 +4529,55 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
uint8_t proceed = 1;
|
||||
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
|
||||
|
||||
if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
|
||||
return 0;
|
||||
|
||||
while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
|
||||
{
|
||||
nfapi_tl_t generic_tl;
|
||||
if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
||||
return 0;
|
||||
|
||||
switch(generic_tl.tag)
|
||||
{
|
||||
case NFAPI_UE_RELEASE_BODY_TAG:
|
||||
{
|
||||
pNfapiMsg->ue_release_request_body.tl = generic_tl;
|
||||
if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
|
||||
return 0;
|
||||
|
||||
if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI);
|
||||
return 0;
|
||||
} else {
|
||||
uint8_t j;
|
||||
uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs;
|
||||
for(j = 0; j < num; ++j){
|
||||
if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag );
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
{
|
||||
nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv;
|
||||
@@ -5727,7 +5825,18 @@ static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPa
|
||||
pull8(ppReadPackedMsg, &value->nrach_ce_level, end));
|
||||
}
|
||||
|
||||
|
||||
static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
|
||||
if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){
|
||||
return 0;
|
||||
}
|
||||
else{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
|
||||
@@ -5940,7 +6049,17 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen
|
||||
if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
|
||||
retLen = sizeof(nfapi_timing_info_t);
|
||||
break;
|
||||
|
||||
|
||||
case NFAPI_UE_RELEASE_REQUEST:
|
||||
if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
|
||||
retLen = sizeof(nfapi_ue_release_request_t);
|
||||
break;
|
||||
|
||||
case NFAPI_UE_RELEASE_RESPONSE:
|
||||
if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
|
||||
retLen = sizeof(nfapi_ue_release_response_t);
|
||||
break;
|
||||
|
||||
default:
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
|
||||
break;
|
||||
@@ -6060,7 +6179,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
|
||||
|
||||
case NFAPI_UE_RELEASE_REQUEST:
|
||||
if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
|
||||
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case NFAPI_HARQ_INDICATION:
|
||||
if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
|
||||
result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
@@ -6158,7 +6284,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
|
||||
|
||||
case NFAPI_UE_RELEASE_RESPONSE:
|
||||
if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
|
||||
result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
|
||||
|
||||
@@ -546,7 +546,7 @@ typedef struct
|
||||
nfapi_hi_dci0_request_t* hi_dci0_req;
|
||||
nfapi_tx_request_t* tx_req;
|
||||
nfapi_lbt_dl_config_request_t* lbt_dl_config_req;
|
||||
|
||||
nfapi_ue_release_request_t* ue_release_req;
|
||||
} nfapi_pnf_p7_subframe_buffer_t;
|
||||
|
||||
typedef struct nfapi_pnf_p7_config nfapi_pnf_p7_config_t;
|
||||
@@ -652,6 +652,17 @@ typedef struct nfapi_pnf_p7_config
|
||||
* \return not currently used
|
||||
*/
|
||||
int (*lbt_dl_config_req)(nfapi_pnf_p7_config_t* config, nfapi_lbt_dl_config_request_t* req);
|
||||
|
||||
/*! A callback for the UE_RELEASE_REQ.request
|
||||
* \param config A poiner to the PNF P7 config
|
||||
* \param req A pointer to the release rnti request message structure
|
||||
* \return not currently used
|
||||
*
|
||||
* The release request contains pointers to the release rnti to be sent. In the case that the FAPI interface
|
||||
* will 'keep' the pointers until they are transmitted the callee should set the pointers in the req to 0
|
||||
* and then use the p7 codec config free function to release the rnti when appropriate.
|
||||
*/
|
||||
int (*ue_release_req)(nfapi_pnf_p7_config_t* config, nfapi_ue_release_request_t* req);
|
||||
|
||||
/*! A callback for vendor extension messages
|
||||
* \param config A poiner to the PNF P7 config
|
||||
@@ -796,6 +807,7 @@ int nfapi_pnf_p7_nrach_ind(nfapi_pnf_p7_config_t* config, nfapi_nrach_indication
|
||||
*/
|
||||
int nfapi_pnf_p7_vendor_extension(nfapi_pnf_p7_config_t* config, nfapi_p7_message_header_t* msg);
|
||||
|
||||
int nfapi_pnf_ue_release_resp(nfapi_pnf_p7_config_t* config, nfapi_ue_release_response_t* resp);
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -36,7 +36,7 @@ extern uint16_t sf_ahead;
|
||||
|
||||
void add_sf(uint16_t *frameP, uint16_t *subframeP, int offset)
|
||||
{
|
||||
*frameP = *frameP + ((*subframeP + offset) / 10);
|
||||
*frameP = (*frameP + ((*subframeP + offset) / 10))%1024;
|
||||
|
||||
*subframeP = ((*subframeP + offset) % 10);
|
||||
}
|
||||
@@ -241,6 +241,16 @@ void deallocate_nfapi_lbt_dl_config_request(nfapi_lbt_dl_config_request_t* req,
|
||||
pnf_p7_free(pnf_p7, req);
|
||||
}
|
||||
|
||||
nfapi_ue_release_request_t* allocate_nfapi_ue_release_request(pnf_p7_t* pnf_p7)
|
||||
{
|
||||
return pnf_p7_malloc(pnf_p7, sizeof(nfapi_ue_release_request_t));
|
||||
}
|
||||
|
||||
void deallocate_nfapi_ue_release_request(nfapi_ue_release_request_t* req, pnf_p7_t* pnf_p7)
|
||||
{
|
||||
pnf_p7_free(pnf_p7, req);
|
||||
}
|
||||
|
||||
pnf_p7_rx_message_t* pnf_p7_rx_reassembly_queue_add_segment(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint16_t sequence_number, uint16_t segment_number, uint8_t m, uint8_t* data, uint16_t data_len)
|
||||
{
|
||||
pnf_p7_rx_message_t* msg = 0;
|
||||
@@ -720,6 +730,21 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
|
||||
}
|
||||
}
|
||||
|
||||
if(tx_subframe_buffer->ue_release_req != 0)
|
||||
{
|
||||
if(pnf_p7->_public.ue_release_req)
|
||||
(pnf_p7->_public.ue_release_req)(&(pnf_p7->_public), tx_subframe_buffer->ue_release_req);
|
||||
}
|
||||
else
|
||||
{
|
||||
//send dummy
|
||||
if(pnf_p7->_public.ue_release_req && pnf_p7->_public.dummy_subframe.ue_release_req)
|
||||
{
|
||||
pnf_p7->_public.dummy_subframe.ue_release_req->sfn_sf = sfn_sf_tx;
|
||||
(pnf_p7->_public.ue_release_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_subframe.ue_release_req);
|
||||
}
|
||||
}
|
||||
|
||||
if(tx_subframe_buffer->dl_config_req != 0)
|
||||
{
|
||||
deallocate_nfapi_dl_config_request(tx_subframe_buffer->dl_config_req, pnf_p7);
|
||||
@@ -735,6 +760,10 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
|
||||
deallocate_nfapi_hi_dci0_request(tx_subframe_buffer->hi_dci0_req, pnf_p7);
|
||||
tx_subframe_buffer->hi_dci0_req = 0;
|
||||
}
|
||||
if(tx_subframe_buffer->ue_release_req != 0){
|
||||
deallocate_nfapi_ue_release_request(tx_subframe_buffer->ue_release_req, pnf_p7);
|
||||
tx_subframe_buffer->ue_release_req = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -799,7 +828,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
|
||||
}
|
||||
} // sfn_sf match
|
||||
|
||||
if (subframe_buffer->dl_config_req == 0 && subframe_buffer->tx_req == 0 && subframe_buffer->ul_config_req == 0 && subframe_buffer->lbt_dl_config_req == 0)
|
||||
if (subframe_buffer->dl_config_req == 0 && subframe_buffer->tx_req == 0 && subframe_buffer->ul_config_req == 0 && subframe_buffer->lbt_dl_config_req == 0 && subframe_buffer->ue_release_req == 0)
|
||||
{
|
||||
memset(&(pnf_p7->subframe_buffer[buffer_index]), 0, sizeof(nfapi_pnf_p7_subframe_buffer_t));
|
||||
pnf_p7->subframe_buffer[buffer_index].sfn_sf = -1;
|
||||
@@ -1310,6 +1339,80 @@ void pnf_handle_p7_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pn
|
||||
|
||||
}
|
||||
|
||||
void pnf_handle_ue_release_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
{
|
||||
nfapi_ue_release_request_t* req = allocate_nfapi_ue_release_request(pnf_p7);
|
||||
if(req == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to alloced nfapi_ue_release_request structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int unpack_result = nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_ue_release_request_t), &pnf_p7->_public.codec_config);
|
||||
if(unpack_result == 0)
|
||||
{
|
||||
if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "failed to lock mutex\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(is_p7_request_in_window(req->sfn_sf, "ue_release_request", pnf_p7))
|
||||
{
|
||||
uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf);
|
||||
uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size;
|
||||
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UE_RELEASE_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_sf_dec, buffer_index);
|
||||
|
||||
if (0 && NFAPI_SFNSF2DEC(req->sfn_sf)%100==0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() UE_RELEASE_REQ.req sfn_sf:%d rntis:%d - UE_RELEASE_REQ is within window\n",
|
||||
__FUNCTION__,
|
||||
NFAPI_SFNSF2DEC(req->sfn_sf),
|
||||
req->ue_release_request_body.number_of_TLVs);
|
||||
|
||||
if(pnf_p7->subframe_buffer[buffer_index].ue_release_req != 0)
|
||||
{
|
||||
deallocate_nfapi_ue_release_request(pnf_p7->subframe_buffer[buffer_index].ue_release_req, pnf_p7);
|
||||
}
|
||||
|
||||
pnf_p7->subframe_buffer[buffer_index].sfn_sf = req->sfn_sf;
|
||||
pnf_p7->subframe_buffer[buffer_index].ue_release_req = req;
|
||||
|
||||
pnf_p7->stats.tx_ontime++;
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() UE_RELEASE_REQUEST Request is outside of window REQ:SFN_SF:%d CURR:SFN_SF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), NFAPI_SFNSF2DEC(pnf_p7->sfn_sf));
|
||||
|
||||
deallocate_nfapi_ue_release_request(req, pnf_p7);
|
||||
if(pnf_p7->_public.timing_info_mode_aperiodic)
|
||||
{
|
||||
pnf_p7->timing_info_aperiodic_send = 1;
|
||||
}
|
||||
|
||||
pnf_p7->stats.tx_late++;
|
||||
}
|
||||
nfapi_ue_release_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_UE_RELEASE_RESPONSE;
|
||||
resp.header.phy_id = req->header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_OK;
|
||||
nfapi_pnf_ue_release_resp(&(pnf_p7->_public), &resp);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "do ue_release_response\n");
|
||||
|
||||
if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "failed to unlock mutex\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
deallocate_nfapi_ue_release_request(req, pnf_p7);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t calculate_t2(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_time_hr)
|
||||
{
|
||||
@@ -1445,7 +1548,11 @@ void pnf_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7,
|
||||
case NFAPI_LBT_DL_CONFIG_REQUEST:
|
||||
pnf_handle_lbt_dl_config_request(pRecvMsg, recvMsgLen, pnf_p7);
|
||||
break;
|
||||
|
||||
|
||||
case NFAPI_UE_RELEASE_REQUEST:
|
||||
pnf_handle_ue_release_request(pRecvMsg, recvMsgLen, pnf_p7);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
if(header.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
|
||||
@@ -1536,7 +1643,7 @@ void pnf_handle_p7_message(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7, ui
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "Failed to allocate PNF_P7 reassemby buffer len:%d\n", length);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(pnf_p7->reassemby_buffer, 0, length);
|
||||
pnf_p7->reassemby_buffer_size = length;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,3 +223,15 @@ int nfapi_pnf_p7_vendor_extension(nfapi_pnf_p7_config_t* config, nfapi_p7_messag
|
||||
return pnf_p7_pack_and_send_p7_message(_this, msg, 0);
|
||||
}
|
||||
|
||||
int nfapi_pnf_ue_release_resp(nfapi_pnf_p7_config_t* config, nfapi_ue_release_response_t* resp)
|
||||
{
|
||||
if (config == NULL || resp == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||
|
||||
return pnf_p7_pack_and_send_p7_message(_this, &(resp->header), sizeof(nfapi_ue_release_response_t));
|
||||
}
|
||||
|
||||
@@ -990,6 +990,15 @@ int nfapi_vnf_p7_lbt_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_lbt_dl_c
|
||||
*/
|
||||
int nfapi_vnf_p7_vendor_extension(nfapi_vnf_p7_config_t* config, nfapi_p7_message_header_t* msg);
|
||||
|
||||
/*! Send the RELEASE_RNTI.request
|
||||
* \param config A pointer to the vnf p7 configuration
|
||||
* \param req A data structure for the decoded RELEASE_RNTI.request.
|
||||
* \return A status value. 0 equal success, -1 indicates failure
|
||||
*
|
||||
* The caller is responsiable for memory management of any pointers set in the req, which
|
||||
* may be released after this function call has returned or at a later pointer
|
||||
*/
|
||||
int nfapi_vnf_p7_ue_release_req(nfapi_vnf_p7_config_t* config, nfapi_ue_release_request_t* req);
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -822,6 +822,28 @@ void vnf_handle_nrach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_handle_ue_release_resp(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
{
|
||||
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || vnf_p7 == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_ue_release_response_t resp;
|
||||
|
||||
if(nfapi_p7_message_unpack(pRecvMsg, recvMsgLen, &resp, sizeof(resp), &vnf_p7->_public.codec_config) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
vnf_p7_codec_free(vnf_p7, resp.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_handle_p7_vendor_extension(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7, uint16_t message_id)
|
||||
{
|
||||
if (pRecvMsg == NULL || vnf_p7 == NULL)
|
||||
@@ -1334,6 +1356,10 @@ void vnf_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
vnf_handle_nrach_indication(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
|
||||
case NFAPI_UE_RELEASE_RESPONSE:
|
||||
vnf_handle_ue_release_resp(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
if(header.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
|
||||
@@ -1430,7 +1456,7 @@ void vnf_handle_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "Failed to allocate VNF_P7 reassemby buffer len:%d\n", length);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(phy->reassembly_buffer, 0, length);
|
||||
phy->reassembly_buffer_size = length;
|
||||
}
|
||||
|
||||
|
||||
@@ -534,6 +534,14 @@ int nfapi_vnf_p7_vendor_extension(nfapi_vnf_p7_config_t* config, nfapi_p7_messag
|
||||
return vnf_p7_pack_and_send_p7_msg(vnf_p7, header);
|
||||
}
|
||||
|
||||
int nfapi_vnf_p7_ue_release_req(nfapi_vnf_p7_config_t* config, nfapi_ue_release_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
|
||||
int nfapi_vnf_p7_release_msg(nfapi_vnf_p7_config_t* config, nfapi_p7_message_header_t* header)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user