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, ...@@ -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); 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_entity_t *pdcp_srb;
nr_pdcp_ue_t *ue; nr_pdcp_ue_t *ue;
int t_Reordering=3000;
int srb_id = s->srb_Identity; int srb_id = s->srb_Identity;
if (s->pdcp_Config == NULL || int t_Reordering = -1; // infinity as per default SRB configuration in 9.2.1 of 38.331
s->pdcp_Config->t_Reordering == NULL) t_Reordering = 3000; if (s->pdcp_Config != NULL &&
else t_Reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering); s->pdcp_Config->t_Reordering != NULL)
t_Reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering);
nr_pdcp_manager_lock(nr_pdcp_ue_manager); nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid); ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid);
if (ue->srb[srb_id-1] != NULL) { 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 { } else {
pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id, pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id,
0, false, false, // sdap parameters 0, false, false, // sdap parameters
...@@ -1061,6 +1067,18 @@ bool nr_pdcp_data_req_srb(ue_id_t ue_id, ...@@ -1061,6 +1067,18 @@ bool nr_pdcp_data_req_srb(ue_id_t ue_id,
return 1; 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) 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 // 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); ...@@ -59,6 +59,18 @@ void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid);
bool nr_pdcp_remove_UE(ue_id_t ue_id); bool nr_pdcp_remove_UE(ue_id_t ue_id);
void nr_pdcp_reestablishment(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, void nr_pdcp_config_set_security(ue_id_t ue_id,
const rb_id_t rb_id, const rb_id_t rb_id,
const uint8_t security_modeP, const uint8_t security_modeP,
......
...@@ -28,11 +28,12 @@ ...@@ -28,11 +28,12 @@
#define NR_RRC_HEADER_SIZE_MAX 64 #define NR_RRC_HEADER_SIZE_MAX 64
#define NR_RRC_BUFFER_SIZE_MAX 1024 #define NR_RRC_BUFFER_SIZE_MAX 1024
#define NR_NUM_SRB 4
typedef struct { typedef struct {
char Payload[NR_RRC_BUFFER_SIZE_MAX]; char Payload[NR_RRC_BUFFER_SIZE_MAX];
char Header[NR_RRC_HEADER_SIZE_MAX]; char Header[NR_RRC_HEADER_SIZE_MAX];
uint16_t payload_size; uint16_t payload_size;
} NR_RRC_BUFFER; } NR_RRC_BUFFER;
typedef enum UE_STATE_NR_e { typedef enum UE_STATE_NR_e {
...@@ -45,17 +46,17 @@ typedef enum UE_STATE_NR_e { ...@@ -45,17 +46,17 @@ typedef enum UE_STATE_NR_e {
} NR_UE_STATE_t; } NR_UE_STATE_t;
typedef struct { typedef struct {
unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */ 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 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 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*/ 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 Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/
uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/ 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)*/ uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/
} __attribute__ ((__packed__)) NR_LCHAN_DESC; } __attribute__ ((__packed__)) NR_LCHAN_DESC;
typedef struct RB_INFO_NR_s { typedef struct RB_INFO_NR_s {
uint16_t Rb_id; //=Lchan_id uint16_t Rb_id; //=Lchan_id
NR_LCHAN_DESC Lchan_desc[2]; NR_LCHAN_DESC Lchan_desc[2];
//MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT //MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT
} NR_RB_INFO; } NR_RB_INFO;
...@@ -66,8 +67,8 @@ typedef struct NR_SRB_INFO_s { ...@@ -66,8 +67,8 @@ typedef struct NR_SRB_INFO_s {
} NR_SRB_INFO; } NR_SRB_INFO;
typedef struct SRB_INFO_TABLE_ENTRY_NR_s { typedef struct SRB_INFO_TABLE_ENTRY_NR_s {
NR_SRB_INFO Srb_info; NR_SRB_INFO Srb_info;
uint8_t Active; uint8_t Active;
uint8_t status; uint8_t status;
} NR_SRB_INFO_TABLE_ENTRY; } NR_SRB_INFO_TABLE_ENTRY;
......
...@@ -133,14 +133,15 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP, ...@@ -133,14 +133,15 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
switch(Srb_id) { switch(Srb_id) {
case CCCH: case CCCH:
LOG_D(NR_RRC, "nr_mac_rrc_data_req_ue: Payload size = %i\n",
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); NR_UE_rrc_inst[Mod_idP].Srb[gNB_id][0].srb_buffers.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); NR_UE_RRC_SRB_INFO_t *Srb0 = &NR_UE_rrc_inst[Mod_idP].Srb[gNB_id][0];
for(int i = 0; i<NR_UE_rrc_inst[Mod_idP].Srb0[gNB_id].Tx_buffer.payload_size; i++) { 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]); 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: case DCCH:
AssertFatal(1==0, "SRB1 not implemented yet!\n"); AssertFatal(1==0, "SRB1 not implemented yet!\n");
......
This diff is collapsed.
...@@ -59,8 +59,6 @@ ...@@ -59,8 +59,6 @@
#define NB_NR_UE_INST 1 #define NB_NR_UE_INST 1
#define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE #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_OBJ 7
#define MAX_MEAS_CONFIG 7 #define MAX_MEAS_CONFIG 7
#define MAX_MEAS_ID 7 #define MAX_MEAS_ID 7
...@@ -178,6 +176,17 @@ typedef enum { ...@@ -178,6 +176,17 @@ typedef enum {
IN_SYNC = 1 IN_SYNC = 1
} nr_sync_msg_t; } 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 { typedef struct NR_UE_RRC_INST_s {
NR_MeasConfig_t *meas_config; NR_MeasConfig_t *meas_config;
NR_CellGroupConfig_t *cell_group_config; NR_CellGroupConfig_t *cell_group_config;
...@@ -191,17 +200,14 @@ typedef struct NR_UE_RRC_INST_s { ...@@ -191,17 +200,14 @@ typedef struct NR_UE_RRC_INST_s {
NR_MeasIdToAddMod_t *MeasId[NB_CNX_UE][MAX_MEAS_ID]; NR_MeasIdToAddMod_t *MeasId[NB_CNX_UE][MAX_MEAS_ID];
NR_MeasGapConfig_t *measGapConfig[NB_CNX_UE]; NR_MeasGapConfig_t *measGapConfig[NB_CNX_UE];
NR_RSRP_Range_t s_measure; 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]; NR_DRB_ToAddMod_t *DRB_config[NB_CNX_UE][8];
rb_id_t *defaultDRB; // remember the ID of the default DRB rb_id_t *defaultDRB; // remember the ID of the default DRB
char *uecap_file; char *uecap_file;
rnti_t rnti; rnti_t rnti;
NR_SRB_INFO Srb0[NB_SIG_CNX_UE]; NR_UE_RRC_SRB_INFO_t Srb[NB_CNX_UE][NR_NUM_SRB];
NR_SRB_INFO_TABLE_ENTRY Srb1[NB_CNX_UE];
NR_SRB_INFO_TABLE_ENTRY Srb2[NB_CNX_UE];
OAI_NR_UECapability_t *UECap; OAI_NR_UECapability_t *UECap;
uint8_t *UECapability; uint8_t *UECapability;
...@@ -213,7 +219,7 @@ typedef struct NR_UE_RRC_INST_s { ...@@ -213,7 +219,7 @@ typedef struct NR_UE_RRC_INST_s {
plmn_t plmnID; 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; NR_MIB_t *mib;
...@@ -227,6 +233,7 @@ typedef struct NR_UE_RRC_INST_s { ...@@ -227,6 +233,7 @@ typedef struct NR_UE_RRC_INST_s {
//RRC_LIST_TYPE(NR_SecurityAlgorithmConfig_t, NR_SecurityAlgorithmConfig) SecurityAlgorithmConfig_list; //RRC_LIST_TYPE(NR_SecurityAlgorithmConfig_t, NR_SecurityAlgorithmConfig) SecurityAlgorithmConfig_list;
NR_CipheringAlgorithm_t cipheringAlgorithm; NR_CipheringAlgorithm_t cipheringAlgorithm;
e_NR_IntegrityProtAlgorithm integrityProtAlgorithm; e_NR_IntegrityProtAlgorithm integrityProtAlgorithm;
long keyToUse;
bool as_security_activated; bool as_security_activated;
long selected_plmn_identity; 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