add factory function for creating PDCP config

master
Andre Puschmann 5 years ago
parent 5b4c42ac77
commit c7ee887170

@ -22,6 +22,7 @@
#ifndef SRSLTE_RRC_ASN1_UTILS_H #ifndef SRSLTE_RRC_ASN1_UTILS_H
#define SRSLTE_RRC_ASN1_UTILS_H #define SRSLTE_RRC_ASN1_UTILS_H
#include "srslte/common/interfaces_common.h"
#include "srslte/interfaces/rrc_interface_types.h" #include "srslte/interfaces/rrc_interface_types.h"
/************************ /************************
@ -80,6 +81,12 @@ rlc_config_t make_rlc_config_t(const asn1::rrc::rlc_cfg_c& asn1_type);
rlc_config_t make_rlc_config_t(const asn1::rrc::srb_to_add_mod_s& asn1_type); rlc_config_t make_rlc_config_t(const asn1::rrc::srb_to_add_mod_s& asn1_type);
void to_asn1(asn1::rrc::rlc_cfg_c* asn1_type, const rlc_config_t& cfg); void to_asn1(asn1::rrc::rlc_cfg_c* asn1_type, const rlc_config_t& cfg);
/***************************
* PDCP Config
**************************/
srslte::pdcp_config_t make_srb_pdcp_config_t(const uint8_t bearer_id, bool is_ue);
srslte::pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue);
/*************************** /***************************
* MAC Config * MAC Config
**************************/ **************************/

@ -23,6 +23,7 @@
#include "srslte/asn1/rrc_asn1.h" #include "srslte/asn1/rrc_asn1.h"
#include "srslte/config.h" #include "srslte/config.h"
#include <algorithm> #include <algorithm>
#include <srslte/common/interfaces_common.h>
namespace srslte { namespace srslte {
@ -184,6 +185,34 @@ void to_asn1(asn1::rrc::rlc_cfg_c* asn1_type, const srslte::rlc_config_t& cfg)
} }
} }
/**
* PDCP Config
*/
srslte::pdcp_config_t make_srb_pdcp_config_t(const uint8_t bearer_id, bool is_ue)
{
pdcp_config_t cfg(bearer_id,
PDCP_RB_IS_SRB,
is_ue ? SECURITY_DIRECTION_UPLINK : SECURITY_DIRECTION_DOWNLINK,
is_ue ? SECURITY_DIRECTION_DOWNLINK : SECURITY_DIRECTION_UPLINK,
PDCP_SN_LEN_5,
pdcp_t_reordering_t::ms500,
pdcp_discard_timer_t::infinity);
return cfg;
}
srslte::pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue)
{
pdcp_config_t cfg(bearer_id,
PDCP_RB_IS_DRB,
is_ue ? SECURITY_DIRECTION_UPLINK : SECURITY_DIRECTION_DOWNLINK,
is_ue ? SECURITY_DIRECTION_DOWNLINK : SECURITY_DIRECTION_UPLINK,
PDCP_SN_LEN_12,
pdcp_t_reordering_t::ms500,
pdcp_discard_timer_t::infinity);
return cfg;
}
/*************************** /***************************
* MAC Config * MAC Config
**************************/ **************************/

@ -211,20 +211,11 @@ void rrc::add_user(uint16_t rnti)
} }
if (rnti == SRSLTE_MRNTI) { if (rnti == SRSLTE_MRNTI) {
srslte::pdcp_config_t pdcp_cfg{1,
srslte::PDCP_RB_IS_DRB,
srslte::SECURITY_DIRECTION_DOWNLINK,
srslte::SECURITY_DIRECTION_UPLINK,
srslte::PDCP_SN_LEN_12,
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
uint32_t teid_in = 1; uint32_t teid_in = 1;
for (auto& mbms_item : mcch.msg.c1().mbsfn_area_cfg_r9().pmch_info_list_r9[0].mbms_session_info_list_r9) { for (auto& mbms_item : mcch.msg.c1().mbsfn_area_cfg_r9().pmch_info_list_r9[0].mbms_session_info_list_r9) {
uint32_t lcid = mbms_item.lc_ch_id_r9; uint32_t lcid = mbms_item.lc_ch_id_r9;
rlc->add_bearer_mrb(SRSLTE_MRNTI, lcid); rlc->add_bearer_mrb(SRSLTE_MRNTI, lcid);
pdcp->add_bearer(SRSLTE_MRNTI, lcid, pdcp_cfg); pdcp->add_bearer(SRSLTE_MRNTI, lcid, srslte::make_drb_pdcp_config_t(1, false));
gtpu->add_bearer(SRSLTE_MRNTI, lcid, 1, 1, &teid_in); gtpu->add_bearer(SRSLTE_MRNTI, lcid, 1, 1, &teid_in);
} }
} }
@ -1638,15 +1629,7 @@ void rrc::ue::send_connection_setup(bool is_setup)
parent->rlc->add_bearer(rnti, 1, srslte::rlc_config_t::srb_config(1)); parent->rlc->add_bearer(rnti, 1, srslte::rlc_config_t::srb_config(1));
// Configure SRB1 in PDCP // Configure SRB1 in PDCP
srslte::pdcp_config_t pdcp_cnfg{1, parent->pdcp->add_bearer(rnti, 1, srslte::make_srb_pdcp_config_t(1, false));
srslte::PDCP_RB_IS_SRB,
srslte::SECURITY_DIRECTION_DOWNLINK,
srslte::SECURITY_DIRECTION_UPLINK,
srslte::PDCP_SN_LEN_5,
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
parent->pdcp->add_bearer(rnti, 1, pdcp_cnfg);
// Configure PHY layer // Configure PHY layer
parent->phy->set_config_dedicated(rnti, phy_cfg); parent->phy->set_config_dedicated(rnti, phy_cfg);
@ -1856,15 +1839,7 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
parent->rlc->add_bearer(rnti, 2, srslte::rlc_config_t::srb_config(2)); parent->rlc->add_bearer(rnti, 2, srslte::rlc_config_t::srb_config(2));
// Configure SRB2 in PDCP // Configure SRB2 in PDCP
srslte::pdcp_config_t pdcp_cnfg_srb = {2, parent->pdcp->add_bearer(rnti, 2, srslte::make_srb_pdcp_config_t(2, false));
srslte::PDCP_RB_IS_SRB,
srslte::SECURITY_DIRECTION_DOWNLINK,
srslte::SECURITY_DIRECTION_UPLINK,
srslte::PDCP_SN_LEN_5,
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
parent->pdcp->add_bearer(rnti, 2, pdcp_cnfg_srb);
parent->pdcp->config_security(rnti, 2, k_rrc_enc, k_rrc_int, k_up_enc, cipher_algo, integ_algo); parent->pdcp->config_security(rnti, 2, k_rrc_enc, k_rrc_int, k_up_enc, cipher_algo, integ_algo);
parent->pdcp->enable_integrity(rnti, 2); parent->pdcp->enable_integrity(rnti, 2);
parent->pdcp->enable_encryption(rnti, 2); parent->pdcp->enable_encryption(rnti, 2);
@ -1873,14 +1848,7 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
parent->rlc->add_bearer(rnti, 3, srslte::make_rlc_config_t(conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].rlc_cfg)); parent->rlc->add_bearer(rnti, 3, srslte::make_rlc_config_t(conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].rlc_cfg));
// Configure DRB1 in PDCP // Configure DRB1 in PDCP
srslte::pdcp_config_t pdcp_cnfg_drb = {1, srslte::pdcp_config_t pdcp_cnfg_drb = srslte::make_drb_pdcp_config_t(1, false);
srslte::PDCP_RB_IS_DRB,
srslte::SECURITY_DIRECTION_DOWNLINK,
srslte::SECURITY_DIRECTION_UPLINK,
srslte::PDCP_SN_LEN_12,
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
if (conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].pdcp_cfg.rlc_um_present) { if (conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].pdcp_cfg.rlc_um_present) {
if (conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].pdcp_cfg.rlc_um.pdcp_sn_size.value == if (conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].pdcp_cfg.rlc_um.pdcp_sn_size.value ==
pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_::len7bits) { pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_::len7bits) {

@ -2547,15 +2547,7 @@ void rrc::handle_con_reest(rrc_conn_reest_s* setup)
void rrc::add_srb(srb_to_add_mod_s* srb_cnfg) void rrc::add_srb(srb_to_add_mod_s* srb_cnfg)
{ {
// Setup PDCP // Setup PDCP
pdcp_config_t pdcp_cfg = {.bearer_id = srb_cnfg->srb_id, pdcp->add_bearer(srb_cnfg->srb_id, make_srb_pdcp_config_t(srb_cnfg->srb_id, true));
.rb_type = PDCP_RB_IS_SRB,
.tx_direction = SECURITY_DIRECTION_UPLINK,
.rx_direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = PDCP_SN_LEN_5,
.t_reordering = pdcp_t_reordering_t::ms500,
.discard_timer = pdcp_discard_timer_t::infinity};
pdcp->add_bearer(srb_cnfg->srb_id, pdcp_cfg);
if (RB_ID_SRB2 == srb_cnfg->srb_id) { if (RB_ID_SRB2 == srb_cnfg->srb_id) {
pdcp->config_security(srb_cnfg->srb_id, k_rrc_enc, k_rrc_int, k_up_enc, cipher_algo, integ_algo); pdcp->config_security(srb_cnfg->srb_id, k_rrc_enc, k_rrc_int, k_up_enc, cipher_algo, integ_algo);
pdcp->enable_integrity(srb_cnfg->srb_id); pdcp->enable_integrity(srb_cnfg->srb_id);
@ -2627,13 +2619,7 @@ void rrc::add_drb(drb_to_add_mod_s* drb_cnfg)
} }
// Setup PDCP // Setup PDCP
pdcp_config_t pdcp_cfg = {.bearer_id = drb_cnfg->drb_id, pdcp_config_t pdcp_cfg = make_drb_pdcp_config_t(drb_cnfg->drb_id, true);
.rb_type = PDCP_RB_IS_DRB,
.tx_direction = SECURITY_DIRECTION_UPLINK,
.rx_direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = PDCP_SN_LEN_12,
.t_reordering = pdcp_t_reordering_t::ms500,
.discard_timer = pdcp_discard_timer_t::infinity};
if (drb_cnfg->pdcp_cfg.rlc_um_present) { if (drb_cnfg->pdcp_cfg.rlc_um_present) {
if (drb_cnfg->pdcp_cfg.rlc_um.pdcp_sn_size == pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_::len7bits) { if (drb_cnfg->pdcp_cfg.rlc_um.pdcp_sn_size == pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_::len7bits) {

Loading…
Cancel
Save