From 32b74d2f3827d66fe576df4ccb3ca8ca6e5e6bdd Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Thu, 25 Feb 2021 01:00:34 +0100 Subject: [PATCH] nr-softmodem compilation after merge with develop --- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c | 9 ++-- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h | 8 ++-- .../LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c | 9 +--- .../LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.h | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.h | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 11 +++-- openair2/RRC/NR/rrc_gNB.c | 33 +++++-------- openair2/RRC/NR/rrc_gNB_NGAP.c | 48 +++++++------------ 9 files changed, 49 insertions(+), 75 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index 514f10a94b..3d591dd842 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -20,7 +20,7 @@ */ #include "nr_pdcp_entity.h" - +#include "nr_pdcp_entity_srb.h" #include "nr_pdcp_entity_drb_am.h" #include "nr_pdcp_security_nea2.h" @@ -28,7 +28,7 @@ nr_pdcp_entity_t *new_nr_pdcp_entity_srb( int is_gnb, int rb_id, - void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, + void (*deliver_sdu)(const protocol_ctxt_t const *ctxt_pP,void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, char *buf, int size), void *deliver_sdu_data, void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity, @@ -38,7 +38,7 @@ nr_pdcp_entity_t *new_nr_pdcp_entity_srb( nr_pdcp_entity_srb_t *ret; - ret = calloc(1, sizeof(nr_pdcp_entity_srb_t)); + ret = calloc(1, sizeof(nr_pdcp_entity_t)); if (ret == NULL) { LOG_E(PDCP, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__); exit(1); @@ -60,12 +60,13 @@ nr_pdcp_entity_t *new_nr_pdcp_entity_srb( ret->common.maximum_nr_pdcp_sn = 4095; + ret->common.is_gnb = is_gnb; return (nr_pdcp_entity_t *)ret; } nr_pdcp_entity_t *new_nr_pdcp_entity_drb_am( int is_gnb, int rb_id, - void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, + void (*deliver_sdu)(const protocol_ctxt_t const *ctxt_pP,void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, char *buf, int size), void *deliver_sdu_data, void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity, diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h index 6e5f231c0a..0537f316ab 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h @@ -27,14 +27,14 @@ typedef struct nr_pdcp_entity_t { /* functions provided by the PDCP module */ - void (*recv_pdu)(protocol_ctxt_t *ctxt_pP,struct nr_pdcp_entity_t *entity, char *buffer, int size); + void (*recv_pdu)(const protocol_ctxt_t const *ctxt_pP,struct nr_pdcp_entity_t *entity, char *buffer, int size); void (*recv_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size, int sdu_id); void (*delete)(struct nr_pdcp_entity_t *entity); void (*set_integrity_key)(struct nr_pdcp_entity_t *entity, char *key); /* callbacks provided to the PDCP module */ - void (*deliver_sdu)(protocol_ctxt_t *ctxt_pP,void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, + void (*deliver_sdu)(const protocol_ctxt_t const *ctxt_pP,void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, char *buf, int size); void *deliver_sdu_data; void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity, @@ -65,7 +65,7 @@ typedef struct nr_pdcp_entity_t { nr_pdcp_entity_t *new_nr_pdcp_entity_srb( int is_gnb, int rb_id, - void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, + void (*deliver_sdu)(const protocol_ctxt_t const *ctxt_pP,void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, char *buf, int size), void *deliver_sdu_data, void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity, @@ -74,7 +74,7 @@ nr_pdcp_entity_t *new_nr_pdcp_entity_srb( nr_pdcp_entity_t *new_nr_pdcp_entity_drb_am( int is_gnb, int rb_id, - void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, + void (*deliver_sdu)(const protocol_ctxt_t const *ctxt_pP,void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, char *buf, int size), void *deliver_sdu_data, void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity, diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c index 3472b36396..dee31b474b 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c @@ -26,16 +26,12 @@ #include #include "common/utils/LOG/log.h" -void nr_pdcp_entity_drb_am_recv_pdu( protocol_ctxt_t *ctxt_pP , nr_pdcp_entity_t *_entity, char *buffer, int size) +void nr_pdcp_entity_drb_am_recv_pdu(const protocol_ctxt_t const *ctxt_pP , nr_pdcp_entity_t *_entity, char *buffer, int size) { nr_pdcp_entity_drb_am_t *entity = (nr_pdcp_entity_drb_am_t *)_entity; int sn; if (size < 3) abort(); -<<<<<<< HEAD - if (!(buffer[0] & 0x80)) { printf("%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } - entity->common.deliver_sdu(ctxt_pP, entity->common.deliver_sdu_data, -======= if (!(buffer[0] & 0x80)) LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); @@ -48,8 +44,7 @@ void nr_pdcp_entity_drb_am_recv_pdu( protocol_ctxt_t *ctxt_pP , nr_pdcp_entity_t entity->common.cipher(entity->common.security_context, (unsigned char *)buffer+3, size-3, entity->rb_id, sn, entity->common.is_gnb ? 0 : 1); - entity->common.deliver_sdu(entity->common.deliver_sdu_data, ->>>>>>> origin/develop + entity->common.deliver_sdu(ctxt_pP,entity->common.deliver_sdu_data, (nr_pdcp_entity_t *)entity, buffer+3, size-3); } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.h index 05828146c7..f29c2082a7 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.h @@ -33,7 +33,7 @@ typedef struct { int discard_timer; /* unit: ms, -1 means infinity */ } nr_pdcp_entity_drb_am_t; -void nr_pdcp_entity_drb_am_recv_pdu(protocol_ctxt_t *ctxt_pP,nr_pdcp_entity_t *entity, char *buffer, int size); +void nr_pdcp_entity_drb_am_recv_pdu(const protocol_ctxt_t const *ctxt_pP,nr_pdcp_entity_t *entity, char *buffer, int size); void nr_pdcp_entity_drb_am_recv_sdu(nr_pdcp_entity_t *entity, char *buffer, int size, int sdu_id); void nr_pdcp_entity_drb_am_set_integrity_key(nr_pdcp_entity_t *entity, char *key); diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c index c55323906c..c1311c2ee6 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.c @@ -25,7 +25,7 @@ #include #include -void nr_pdcp_entity_srb_recv_pdu(protocol_ctxt_t *ctxt_pP, nr_pdcp_entity_t *_entity, char *buffer, int size) +void nr_pdcp_entity_srb_recv_pdu(const protocol_ctxt_t const *ctxt_pP, nr_pdcp_entity_t *_entity, char *buffer, int size) { nr_pdcp_entity_srb_t *entity = (nr_pdcp_entity_srb_t *)_entity; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.h index a334b700e5..3b422512c2 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_srb.h @@ -29,7 +29,7 @@ typedef struct { int srb_id; } nr_pdcp_entity_srb_t; -void nr_pdcp_entity_srb_recv_pdu(protocol_ctxt_t *ctxt_pP, nr_pdcp_entity_t *_entity, char *buffer, int size); +void nr_pdcp_entity_srb_recv_pdu(const protocol_ctxt_t const *ctxt_pP, nr_pdcp_entity_t *_entity, char *buffer, int size); void nr_pdcp_entity_srb_recv_sdu(nr_pdcp_entity_t *_entity, char *buffer, int size, int sdu_id); void nr_pdcp_entity_srb_set_integrity_key(nr_pdcp_entity_t *_entity, char *key); void nr_pdcp_entity_srb_delete(nr_pdcp_entity_t *_entity); diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index b2b75729de..75342985b9 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -507,7 +507,7 @@ uint64_t pdcp_module_init(uint64_t _pdcp_optmask) return pdcp_optmask ; } -static void deliver_sdu_drb(protocol_ctxt_t *ctxt_pP,void *_ue, nr_pdcp_entity_t *entity, +static void deliver_sdu_drb(const protocol_ctxt_t const *ctxt_pP,void *_ue, nr_pdcp_entity_t *entity, char *buf, int size) { extern int nas_sock_fd[]; @@ -605,7 +605,7 @@ rb_found: } static int ccch_or_dcch = 0; -static void deliver_sdu_srb(protocol_ctxt_t *ctxt_pP, void *_ue, nr_pdcp_entity_t *entity, +static void deliver_sdu_srb(const protocol_ctxt_t const *ctxt_pP, void *_ue, nr_pdcp_entity_t *entity, char *buf, int size) { /* Implementation to be added */ @@ -789,6 +789,7 @@ boolean_t pdcp_data_ind( } if (rb != NULL) { + rb->recv_pdu(ctxt_pP,rb, (char *)sdu_buffer->data, sdu_buffer_size); } else { LOG_E(PDCP, "%s:%d:%s: fatal: no RB found (rb_id %ld, srb_flag %d)\n", @@ -846,7 +847,7 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) } } -static void add_srb(int rnti, struct NR_SRB_ToAddMod *s) +static void add_srb(int is_gnb,int rnti, struct NR_SRB_ToAddMod *s) { nr_pdcp_entity_t *pdcp_srb; nr_pdcp_ue_t *ue; @@ -867,7 +868,7 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s) LOG_W(PDCP, "%s:%d:%s: warning SRB %d already exist for ue %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); } else { - pdcp_srb = new_nr_pdcp_entity_srb(srb_id, deliver_sdu_srb, ue, deliver_pdu_srb, ue); + pdcp_srb = new_nr_pdcp_entity_srb(is_gnb,srb_id, deliver_sdu_srb, ue, deliver_pdu_srb, ue); nr_pdcp_ue_add_srb_pdcp_entity(ue, srb_id, pdcp_srb); LOG_I(PDCP, "%s:%d:%s: added srb %d to ue %d\n", @@ -987,7 +988,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req( if (srb2add_list != NULL) { for (i = 0; i < srb2add_list->list.count; i++) { - add_srb(rnti, srb2add_list->list.array[i]); + add_srb(ctxt_pP->enb_flag,rnti, srb2add_list->list.array[i]); } } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 17812636f1..25f33dd8de 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -812,31 +812,20 @@ rrc_gNB_generate_defaultRRCReconfiguration( ue_context_pP->ue_context.rnti, rrc_gNB_mui, size); -#ifdef ITTI_SIM - MessageDef *message_p; - uint8_t *message_buffer; - message_buffer = itti_malloc (TASK_RRC_GNB, TASK_RRC_UE_SIM, size); - memcpy (message_buffer, buffer, size); - message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, GNB_RRC_DCCH_DATA_IND); - GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; - GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; - GNB_RRC_DCCH_DATA_IND (message_p).size = size; - itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); -#else - nr_rrc_data_req(ctxt_pP, - DCCH, - rrc_gNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + nr_rrc_data_req(ctxt_pP, + DCCH, + rrc_gNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); #endif // rrc_rlc_config_asn1_req } - break; - - default : - LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt_pP->module_id]->node_type); + break; + + default : + LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt_pP->module_id]->node_type); } } diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 0c10dfbad1..435db4d924 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -425,38 +425,26 @@ rrc_gNB_send_NGAP_NAS_FIRST_REQ( NGAP_NAS_FIRST_REQ(message_p).selected_plmn_identity = selected_plmn_identity; if (rrcSetupComplete->registeredAMF != NULL) { - NR_RegisteredAMF_t *r_amf = rrcSetupComplete->registeredAMF; - NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask |= NGAP_UE_IDENTITIES_guami; - - if (r_amf->plmn_Identity != NULL) { - if ((r_amf->plmn_Identity->mcc != NULL) && (r_amf->plmn_Identity->mcc->list.count > 0)) { - /* Use first indicated PLMN MCC if it is defined */ - NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc = *r_amf->plmn_Identity->mcc->list.array[selected_plmn_identity]; - LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n", - ctxt_pP->module_id, - NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mcc, - ue_context_pP->ue_context.rnti); - } - - if (r_amf->plmn_Identity->mnc.list.count > 0) { - /* Use first indicated PLMN MNC if it is defined */ - NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc = *r_amf->plmn_Identity->mnc.list.array[selected_plmn_identity]; - LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x\n", - ctxt_pP->module_id, - NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mnc, - ue_context_pP->ue_context.rnti); - } - } else { - /* TODO */ + NR_RegisteredAMF_t *r_amf = rrcSetupComplete->registeredAMF; + NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask |= NGAP_UE_IDENTITIES_guami; + + if (r_amf->plmn_Identity != NULL) { + if ((r_amf->plmn_Identity->mcc != NULL) && (r_amf->plmn_Identity->mcc->list.count > 0)) { + /* Use first indicated PLMN MCC if it is defined */ + NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc = *r_amf->plmn_Identity->mcc->list.array[selected_plmn_identity]; + LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n", + ctxt_pP->module_id, + NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mcc, + ue_context_pP->ue_context.rnti); } - + if (r_amf->plmn_Identity->mnc.list.count > 0) { - /* Use first indicated PLMN MNC if it is defined */ - NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc = *r_amf->plmn_Identity->mnc.list.array[selected_plmn_identity]; - LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x\n", - ctxt_pP->module_id, - NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mnc, - ue_context_pP->ue_context.rnti); + /* Use first indicated PLMN MNC if it is defined */ + NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc = *r_amf->plmn_Identity->mnc.list.array[selected_plmn_identity]; + LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x\n", + ctxt_pP->module_id, + NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mnc, + ue_context_pP->ue_context.rnti); } } else { /* TODO */