Commit ec3bde2c authored by Sakthivel Velumani's avatar Sakthivel Velumani

Fix bug in pdcp config and GTP instance

UL iperf still not works. Can see packets in wireshark.
parent be8df443
......@@ -80,6 +80,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "gnb_paramdef.h"
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "nfapi/oai_integration/vendor_ext.h"
#include "gnb_config.h"
pthread_cond_t nfapi_sync_cond;
pthread_mutex_t nfapi_sync_mutex;
......@@ -405,6 +406,12 @@ int create_gNB_tasks(void) {
return -1;
}
// If CU
if ((RC.nrrrc[gnb_id_start]->node_type == ngran_gNB_CU) ||
(RC.nrrrc[gnb_id_start]->node_type == ngran_gNB)) {
RC.nrrrc[gnb_id_start]->gtpInstN3 = RCconfig_nr_gtpu();
}
//Use check on x2ap to consider the NSA scenario
if((is_x2ap_enabled() || get_softmodem_params()->sa) && (RC.nrrrc[0]->node_type != ngran_gNB_CUCP) ) {
if (itti_create_task (TASK_GTPV1_U, &gtpv1uTask, NULL) < 0) {
......
......@@ -23,6 +23,8 @@
#include "e1ap.h"
#include "e1ap_common.h"
#include "gnb_config.h"
#include "openair2/SDAP/nr_sdap/nr_sdap_entity.h"
#define E1AP_NUM_MSG_HANDLERS 14
typedef int (*e1ap_message_processing_t)(
......@@ -1429,6 +1431,13 @@ int e1apCUCP_handle_send_DATA_USAGE_REPORT(instance_t instance,
return -1;
}
static instance_t cuup_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) {
openAddr_t tmp= {0};
strncpy(tmp.originHost, IPaddrs->my_addr, sizeof(tmp.originHost)-1);
sprintf(tmp.originService, "%d", IPaddrs->my_portd);
return gtpv1Init(tmp);
}
void cuup_task_send_sctp_association_req(instance_t instance, e1ap_setup_req_t *e1ap_setup_req) {
DevAssert(e1ap_setup_req != NULL);
MessageDef *message_p = NULL;
......@@ -1468,6 +1477,18 @@ void cuup_task_handle_sctp_association_resp(instance_t instance, sctp_new_associ
e1ap_cuup_setup_req->sctp_out_streams = sctp_new_association_resp->out_streams;
e1ap_cuup_setup_req->default_sctp_stream_id = 0;
eth_params_t IPaddr;
IPaddr.my_addr = e1ap_cuup_setup_req->CUUP_e1_ip_address.ipv4_address;
IPaddr.my_portd = e1ap_cuup_setup_req->port_cuup;
getCxtE1(UPtype, instance)->gtpInstF1U = cuup_task_create_gtpu_instance_to_du(&IPaddr);
AssertFatal(getCxtE1(UPtype, instance)->gtpInstF1U>0,"Failed to create CUUP F1-U UDP listener");
extern instance_t CUuniqInstance;
CUuniqInstance = getCxtE1(UPtype, instance)->gtpInstF1U;
getCxtE1(UPtype, instance)->gtpInstN3 = RCconfig_nr_gtpu();
AssertFatal(getCxtE1(UPtype, instance)->gtpInstN3>0,"Failed to create CUUP N3 UDP listener");
N3GTPUInst = &getCxtE1(UPtype, instance)->gtpInstN3;
e1apCUUP_send_SETUP_REQUEST(instance);
}
......
......@@ -35,7 +35,6 @@
#include <split_headers.h>
#include "gnb_app.h"
#include "gnb_config.h"
#include "assertions.h"
#include "common/ran_context.h"
......@@ -53,6 +52,7 @@
#include <openair2/LAYER2/nr_pdcp/nr_pdcp.h>
#include "openair2/LAYER2/PDCP_v10.1.0/pdcp.h"
#include "openair2/E1AP/e1ap.h"
#include "gnb_config.h"
extern unsigned char NB_gNB_INST;
extern RAN_CONTEXT_t RC;
......@@ -103,7 +103,6 @@ uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const E
itti_send_msg_to_task (TASK_NGAP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
}
if (gnb_id == 0) RCconfig_nr_gtpu();
}
LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id));
......
......@@ -1250,7 +1250,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
config_security(rrc);
}//End RCconfig_NRRRC function
int RCconfig_nr_gtpu(void ) {
instance_t RCconfig_nr_gtpu(void) {
int num_gnbs = 0;
char* gnb_ipv4_address_for_NGU = NULL;
......@@ -1273,6 +1273,7 @@ int RCconfig_nr_gtpu(void ) {
config_get(NETParams,sizeof(NETParams)/sizeof(paramdef_t),gtpupath);
char *cidr=NULL, *address = NULL;
int port;
instance_t ret_inst;
if (NETParams[1].strptr != NULL) {
LOG_I(GTPU, "SA mode \n");
address = strtok_r(gnb_ipv4_address_for_NGU, "/", &cidr);
......@@ -1284,19 +1285,19 @@ int RCconfig_nr_gtpu(void ) {
}
if (address) {
MessageDef *message;
message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_REQ);
AssertFatal(message!=NULL,"");
IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_REQ(message).localAddr, "BAD IP ADDRESS FORMAT FOR gNB NG_U !\n" );
LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_REQ(message).localAddr);
GTPV1U_REQ(message).localPort = port;
strcpy(GTPV1U_REQ(message).localAddrStr,address);
sprintf(GTPV1U_REQ(message).localPortStr,"%d", port);
itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id)
eth_params_t IPaddr;
IPaddr.my_addr = address;
IPaddr.my_portd = port;
openAddr_t tmp= {0};
strncpy(tmp.originHost, IPaddr.my_addr, sizeof(tmp.originHost)-1);
sprintf(tmp.originService, "%d", IPaddr.my_portd);
strcpy(tmp.destinationService, tmp.originService);
LOG_I(GTPU,"Configuring GTPu address : %s, port : %s\n", tmp.originHost, tmp.originService);
ret_inst = gtpv1Init(tmp);
} else
LOG_E(GTPU,"invalid address for NGU or S1U\n");
return 0;
return ret_inst;
}
int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
......
......@@ -95,7 +95,7 @@ extern void NRRCconfig_RU(void);
extern void RCconfig_nr_flexran(void);
extern void RCconfig_NR_L1(void);
extern void RCconfig_nr_macrlc(void);
extern int RCconfig_nr_gtpu(void );
extern instance_t RCconfig_nr_gtpu(void);
extern void NRRCConfig(void);
//void enb_config_display(void);
......
......@@ -500,6 +500,9 @@ typedef struct gNB_RRC_INST_s {
// RRC configuration
gNB_RrcConfigurationReq configuration;
// gNB N3 GTPU instance
instance_t gtpInstN3;
// other PLMN parameters
/// Mobile country code
int mcc;
......
......@@ -103,6 +103,7 @@
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_e1_api.h"
#include "openair2/F1AP/f1ap_common.h"
#include "openair2/E1AP/e1ap_common.h"
#include "openair2/SDAP/nr_sdap/nr_sdap_entity.h"
#include "BIT_STRING.h"
#include "assertions.h"
......@@ -253,6 +254,8 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
rrc->ngap_id2_ngap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL);
rrc->configuration = *configuration;
rrc->carrier.servingcellconfigcommon = configuration->scc;
extern instance_t *N3GTPUInst;
N3GTPUInst = &rrc->gtpInstN3;
rrc->carrier.servingcellconfig = configuration->scd;
nr_rrc_config_ul_tda(configuration->scc,configuration->minRXTXTIME);
/// System Information INIT
......@@ -3618,7 +3621,7 @@ static void update_UL_UP_tunnel_info(e1ap_bearer_setup_req_t *req, instance_t in
sizeof(in_addr_t));
GtpuUpdateTunnelOutgoingPair(instance,
ue_id,
(ue_id & 0xFFFF),
(ebi_t)drb_p->id,
drb_p->DlUpParamList[0].teId,
newRemoteAddr);
......@@ -4117,15 +4120,15 @@ int drb_config_N3gtpu_create_e1(e1ap_bearer_setup_req_t *req,
uint8_t *kUPenc = NULL;
uint8_t *kUPint = NULL;
nr_derive_key_rrc_enc(req->cipheringAlgorithm,
(uint8_t *)req->encryptionKey,
&kUPenc);
nr_derive_key_up_enc(req->cipheringAlgorithm,
(uint8_t *)req->encryptionKey,
&kUPenc);
nr_derive_key_rrc_int(req->integrityProtectionAlgorithm,
(uint8_t *)req->integrityProtectionKey,
&kUPint);
nr_derive_key_up_int(req->integrityProtectionAlgorithm,
(uint8_t *)req->integrityProtectionKey,
&kUPint);
nr_pdcp_e1_add_drbs(false,
nr_pdcp_e1_add_drbs(true, // set this to notify PDCP that his not UE
create_tunnel_req.ue_id,
&DRB_configList,
(req->integrityProtectionAlgorithm << 4) | req->cipheringAlgorithm,
......@@ -4153,7 +4156,7 @@ void gNB_CU_create_up_ul_tunnel(e1ap_bearer_setup_resp_t *resp,
drbSetup->numUpParam = 1;
drbSetup->UpParamList[0].tlAddress = my_addr;
drbSetup->UpParamList[0].teId = newGtpuCreateTunnel(gtpInst,
ue_id,
(ue_id & 0xFFFF),
drb2Setup->id,
drb2Setup->id,
0xFFFF, // We will set the right value from DU answer
......@@ -4266,13 +4269,14 @@ void bearer_context_setup_direct(e1ap_bearer_setup_req_t *req, instance_t instan
fill_DRB_configList(&ctxt, ue_context_p);
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
// GTP tunnel for UL
int ret = drb_config_gtpu_create(&ctxt,
ue_context_p,
req,
ue_context_p->ue_context.DRB_configList,
ue_context_p->ue_context.SRB_configList,
instance);
rrc->gtpInstN3);
if (ret < 0) AssertFatal(false, "Unable to configure DRB or to create GTP Tunnel\n");
if(!NODE_IS_CU(RC.nrrrc[ctxt.module_id]->node_type)) {
......
......@@ -35,6 +35,8 @@ typedef struct {
static nr_sdap_entity_info sdap_info;
instance_t *N3GTPUInst = NULL;
nr_pdcp_ue_manager_t *nr_pdcp_sdap_get_ue_manager(void);
void nr_pdcp_submit_sdap_ctrl_pdu(int rnti, rb_id_t sdap_ctrl_pdu_drb, nr_sdap_ul_hdr_t ctrl_pdu){
......@@ -212,7 +214,7 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
req->ue_id = ue_id;
req->bearer_id = pdusession_id;
LOG_D(SDAP, "%s() sending message to gtp size %d\n", __func__, size-offset);
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
itti_send_msg_to_task(TASK_GTPV1_U, *N3GTPUInst, message_p);
} else { //nrUE
/*
* TS 37.324 5.2 Data transfer
......
......@@ -50,6 +50,9 @@
* the GTP-U Extension Header. Inside the DL PDU SESSION INFORMATION frame.
* TS 38.415 Fig. 5.5.2.1-1
*/
extern instance_t *N3GTPUInst;
typedef struct nr_sdap_dl_hdr_s {
uint8_t QFI:6;
uint8_t RQI:1;
......
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