Commit d8cb2491 authored by francescomani's avatar francescomani

improve handling of SRBs at RRC UE

parent afc75c5d
......@@ -757,21 +757,27 @@ void deliver_pdu_srb_rlc(void *deliver_pdu_data, ue_id_t ue_id, int srb_id,
enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock);
}
static void add_srb(int is_gnb, ue_id_t rntiMaybeUEid, struct NR_SRB_ToAddMod *s, int ciphering_algorithm, int integrity_algorithm, unsigned char *ciphering_key, unsigned char *integrity_key)
void add_srb(int is_gnb,
ue_id_t rntiMaybeUEid,
struct NR_SRB_ToAddMod *s,
int ciphering_algorithm,
int integrity_algorithm,
unsigned char *ciphering_key,
unsigned char *integrity_key)
{
nr_pdcp_entity_t *pdcp_srb;
nr_pdcp_ue_t *ue;
int t_Reordering=3000;
int srb_id = s->srb_Identity;
if (s->pdcp_Config == NULL ||
s->pdcp_Config->t_Reordering == NULL) t_Reordering = 3000;
else t_Reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering);
int t_Reordering = -1; // infinity as per default SRB configuration in 9.2.1 of 38.331
if (s->pdcp_Config != NULL &&
s->pdcp_Config->t_Reordering != NULL)
t_Reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering);
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid);
if (ue->srb[srb_id-1] != NULL) {
LOG_D(PDCP, "%s:%d:%s: warning SRB %d already exist for UE ID/RNTI %ld, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rntiMaybeUEid);
LOG_E(PDCP, "%s:%d:%s: warning SRB %d already exist for UE ID/RNTI %ld, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rntiMaybeUEid);
} else {
pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id,
0, false, false, // sdap parameters
......@@ -1061,6 +1067,18 @@ bool nr_pdcp_data_req_srb(ue_id_t ue_id,
return 1;
}
void nr_pdcp_reconfigure_srb(ue_id_t ue_id,
int srb_id,
long t_Reordering)
{
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
nr_pdcp_ue_t *ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id);
nr_pdcp_entity_t *srb = ue->srb[srb_id - 1];
int decoded_t_reordering = decode_t_reordering(t_Reordering);
srb->t_reordering = decoded_t_reordering;
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
}
void nr_pdcp_reestablishment(ue_id_t ue_id)
{
// TODO implement this on a per RB basis following TS 38.323 Sec 5.1.2
......
......@@ -59,6 +59,18 @@ void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid);
bool nr_pdcp_remove_UE(ue_id_t ue_id);
void nr_pdcp_reestablishment(ue_id_t ue_id);
void nr_pdcp_reconfigure_srb(ue_id_t ue_id,
int srb_id,
long t_Reordering);
void add_srb(int is_gnb,
ue_id_t rntiMaybeUEid,
struct NR_SRB_ToAddMod *s,
int ciphering_algorithm,
int integrity_algorithm,
unsigned char *ciphering_key,
unsigned char *integrity_key);
void nr_pdcp_config_set_security(ue_id_t ue_id,
const rb_id_t rb_id,
const uint8_t security_modeP,
......
......@@ -28,11 +28,12 @@
#define NR_RRC_HEADER_SIZE_MAX 64
#define NR_RRC_BUFFER_SIZE_MAX 1024
#define NR_NUM_SRB 4
typedef struct {
char Payload[NR_RRC_BUFFER_SIZE_MAX];
char Header[NR_RRC_HEADER_SIZE_MAX];
uint16_t payload_size;
char Payload[NR_RRC_BUFFER_SIZE_MAX];
char Header[NR_RRC_HEADER_SIZE_MAX];
uint16_t payload_size;
} NR_RRC_BUFFER;
typedef enum UE_STATE_NR_e {
......@@ -45,17 +46,17 @@ typedef enum UE_STATE_NR_e {
} NR_UE_STATE_t;
typedef struct {
unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */
unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */
unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/
unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/
uint8_t Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/
uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/
uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/
unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */
unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */
unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/
unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/
uint8_t Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/
uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/
uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/
} __attribute__ ((__packed__)) NR_LCHAN_DESC;
typedef struct RB_INFO_NR_s {
uint16_t Rb_id; //=Lchan_id
uint16_t Rb_id; //=Lchan_id
NR_LCHAN_DESC Lchan_desc[2];
//MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT
} NR_RB_INFO;
......@@ -66,8 +67,8 @@ typedef struct NR_SRB_INFO_s {
} NR_SRB_INFO;
typedef struct SRB_INFO_TABLE_ENTRY_NR_s {
NR_SRB_INFO Srb_info;
uint8_t Active;
NR_SRB_INFO Srb_info;
uint8_t Active;
uint8_t status;
} NR_SRB_INFO_TABLE_ENTRY;
......
......@@ -133,14 +133,15 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
switch(Srb_id) {
case CCCH:
LOG_D(NR_RRC, "nr_mac_rrc_data_req_ue: Payload size = %i\n", NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size);
memcpy(buffer_pP, (uint8_t*)NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.Payload, NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size);
for(int i = 0; i<NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size; i++) {
LOG_D(NR_RRC, "nr_mac_rrc_data_req_ue: Payload size = %i\n",
NR_UE_rrc_inst[Mod_idP].Srb[gNB_id][0].srb_buffers.Tx_buffer.payload_size);
NR_UE_RRC_SRB_INFO_t *Srb0 = &NR_UE_rrc_inst[Mod_idP].Srb[gNB_id][0];
memcpy(buffer_pP, (uint8_t*)Srb0->srb_buffers.Tx_buffer.Payload, Srb0->srb_buffers.Tx_buffer.payload_size);
for(int i = 0; i < Srb0->srb_buffers.Tx_buffer.payload_size; i++) {
LOG_D(NR_RRC,"(%i): %i\n", i, buffer_pP[i]);
}
return NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size;
return Srb0->srb_buffers.Tx_buffer.payload_size;
case DCCH:
AssertFatal(1==0, "SRB1 not implemented yet!\n");
......
This diff is collapsed.
......@@ -59,8 +59,6 @@
#define NB_NR_UE_INST 1
#define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE
#define NB_SIG_CNX_UE 2 //MAX_MANAGED_RG_PER_MOBILE
#define MAX_MEAS_OBJ 7
#define MAX_MEAS_CONFIG 7
#define MAX_MEAS_ID 7
......@@ -178,6 +176,17 @@ typedef enum {
IN_SYNC = 1
} nr_sync_msg_t;
typedef enum {
RB_NOT_PRESENT = 0,
RB_ESTABLISHED,
RB_SUSPENDED
} NR_RB_status_t;
typedef struct NR_UE_RRC_SRB_INFO_s {
NR_RB_status_t status;
NR_SRB_INFO srb_buffers;
} NR_UE_RRC_SRB_INFO_t;
typedef struct NR_UE_RRC_INST_s {
NR_MeasConfig_t *meas_config;
NR_CellGroupConfig_t *cell_group_config;
......@@ -191,17 +200,14 @@ typedef struct NR_UE_RRC_INST_s {
NR_MeasIdToAddMod_t *MeasId[NB_CNX_UE][MAX_MEAS_ID];
NR_MeasGapConfig_t *measGapConfig[NB_CNX_UE];
NR_RSRP_Range_t s_measure;
NR_SRB_ToAddMod_t *SRB1_config[NB_CNX_UE];
NR_SRB_ToAddMod_t *SRB2_config[NB_CNX_UE];
NR_DRB_ToAddMod_t *DRB_config[NB_CNX_UE][8];
rb_id_t *defaultDRB; // remember the ID of the default DRB
char *uecap_file;
rnti_t rnti;
NR_SRB_INFO Srb0[NB_SIG_CNX_UE];
NR_SRB_INFO_TABLE_ENTRY Srb1[NB_CNX_UE];
NR_SRB_INFO_TABLE_ENTRY Srb2[NB_CNX_UE];
NR_UE_RRC_SRB_INFO_t Srb[NB_CNX_UE][NR_NUM_SRB];
OAI_NR_UECapability_t *UECap;
uint8_t *UECapability;
......@@ -213,7 +219,7 @@ typedef struct NR_UE_RRC_INST_s {
plmn_t plmnID;
NR_UE_RRC_SI_INFO SInfo[NB_SIG_CNX_UE];
NR_UE_RRC_SI_INFO SInfo[NB_CNX_UE];
NR_MIB_t *mib;
......@@ -227,6 +233,7 @@ typedef struct NR_UE_RRC_INST_s {
//RRC_LIST_TYPE(NR_SecurityAlgorithmConfig_t, NR_SecurityAlgorithmConfig) SecurityAlgorithmConfig_list;
NR_CipheringAlgorithm_t cipheringAlgorithm;
e_NR_IntegrityProtAlgorithm integrityProtAlgorithm;
long keyToUse;
bool as_security_activated;
long selected_plmn_identity;
......
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