Reverted back to a single config structure between PDCP NR and PDCP LTE.

master
Pedro Alvarez 6 years ago committed by Andre Puschmann
parent 810cacdc02
commit 457f35699d

@ -67,45 +67,25 @@ public:
uint32_t lcid; uint32_t lcid;
}; };
class srslte_pdcp_config_lte_t
{
public:
srslte_pdcp_config_lte_t(uint8_t bearer_id_ = 0,
bool is_control_ = false,
bool is_data_ = false,
uint8_t direction_ = SECURITY_DIRECTION_UPLINK) :
bearer_id(bearer_id_),
direction(direction_),
is_control(is_control_),
is_data(is_data_),
sn_len(12)
{
}
uint32_t bearer_id;
uint8_t direction;
bool is_control;
bool is_data;
uint8_t sn_len;
// TODO: Support the following configurations
// bool do_rohc;
};
const uint8_t PDCP_SN_LEN_5 = 5; const uint8_t PDCP_SN_LEN_5 = 5;
const uint8_t PDCP_SN_LEN_12 = 12; const uint8_t PDCP_SN_LEN_12 = 12;
const uint8_t PDCP_SN_LEN_18 = 18; const uint8_t PDCP_SN_LEN_18 = 18;
class srslte_pdcp_config_nr_t class srslte_pdcp_config_t
{ {
public: public:
srslte_pdcp_config_nr_t(uint8_t bearer_id_, bool is_control_, bool is_data_, uint8_t direction_, uint8_t sn_len_) : srslte_pdcp_config_t(uint8_t bearer_id_,
bool is_control_,
bool is_data_ ,
uint8_t direction_ ,
uint8_t sn_len_) :
bearer_id(bearer_id_), bearer_id(bearer_id_),
direction(direction_), direction(direction_),
is_control(is_control_), is_control(is_control_),
is_data(is_data_), is_data(is_data_),
sn_len(sn_len_) sn_len(sn_len_)
{ {
hdr_len_bytes = ceil((float)sn_len / 8);
} }
uint32_t bearer_id; uint32_t bearer_id;
@ -113,6 +93,10 @@ public:
bool is_control; bool is_control;
bool is_data; bool is_data;
uint8_t sn_len; uint8_t sn_len;
uint8_t hdr_len_bytes;
// TODO: Support the following configurations
// bool do_rohc;
}; };
class mac_interface_timers class mac_interface_timers

@ -211,7 +211,7 @@ public:
virtual void add_user(uint16_t rnti) = 0; virtual void add_user(uint16_t rnti) = 0;
virtual void rem_user(uint16_t rnti) = 0; virtual void rem_user(uint16_t rnti) = 0;
virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0; virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0;
virtual void add_bearer(uint16_t rnti, uint32_t lcid, srslte::srslte_pdcp_config_lte_t cnfg) = 0; virtual void add_bearer(uint16_t rnti, uint32_t lcid, srslte::srslte_pdcp_config_t cnfg) = 0;
virtual void config_security(uint16_t rnti, virtual void config_security(uint16_t rnti,
uint32_t lcid, uint32_t lcid,
uint8_t* k_rrc_enc_, uint8_t* k_rrc_enc_,

@ -232,8 +232,7 @@ public:
virtual void reestablish(uint32_t lcid) = 0; virtual void reestablish(uint32_t lcid) = 0;
virtual void reset() = 0; virtual void reset() = 0;
virtual void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking = true) = 0; virtual void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking = true) = 0;
virtual void add_bearer(uint32_t lcid, virtual void add_bearer(uint32_t lcid, srslte::srslte_pdcp_config_t cnfg) = 0;
srslte::srslte_pdcp_config_lte_t cnfg = srslte::srslte_pdcp_config_lte_t()) = 0;
virtual void change_lcid(uint32_t old_lcid, uint32_t new_lcid) = 0; virtual void change_lcid(uint32_t old_lcid, uint32_t new_lcid) = 0;
virtual void config_security(uint32_t lcid, virtual void config_security(uint32_t lcid,
uint8_t* k_rrc_enc_, uint8_t* k_rrc_enc_,

@ -46,8 +46,8 @@ public:
void reset(); void reset();
void write_sdu(uint32_t lcid, unique_byte_buffer_t sdu, bool blocking = true); void write_sdu(uint32_t lcid, unique_byte_buffer_t sdu, bool blocking = true);
void write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu); void write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu);
void add_bearer(uint32_t lcid, srslte_pdcp_config_lte_t cnfg = srslte_pdcp_config_lte_t()); void add_bearer(uint32_t lcid, srslte_pdcp_config_t cnfg);
void add_bearer_mrb(uint32_t lcid, srslte_pdcp_config_lte_t cnfg = srslte_pdcp_config_lte_t()); void add_bearer_mrb(uint32_t lcid, srslte_pdcp_config_t cnfg);
void del_bearer(uint32_t lcid); void del_bearer(uint32_t lcid);
void change_lcid(uint32_t old_lcid, uint32_t new_lcid); void change_lcid(uint32_t old_lcid, uint32_t new_lcid);
void config_security(uint32_t lcid, void config_security(uint32_t lcid,

@ -54,7 +54,7 @@ public:
srsue::gw_interface_pdcp* gw_, srsue::gw_interface_pdcp* gw_,
srslte::log* log_, srslte::log* log_,
uint32_t lcid_, uint32_t lcid_,
srslte_pdcp_config_lte_t cfg_); srslte_pdcp_config_t cfg_);
void reset(); void reset();
void reestablish(); void reestablish();
@ -72,8 +72,7 @@ private:
srsue::rrc_interface_pdcp* rrc = nullptr; srsue::rrc_interface_pdcp* rrc = nullptr;
srsue::gw_interface_pdcp* gw = nullptr; srsue::gw_interface_pdcp* gw = nullptr;
srslte_pdcp_config_lte_t cfg = {}; srslte_pdcp_config_t cfg = {0, SECURITY_DIRECTION_UPLINK, false, false, 0};
uint8_t sn_len_bytes = 0;
uint32_t rx_count = 0; uint32_t rx_count = 0;
uint32_t tx_count = 0; uint32_t tx_count = 0;

@ -46,7 +46,7 @@ public:
srsue::gw_interface_pdcp* gw_, srsue::gw_interface_pdcp* gw_,
srslte::log* log_, srslte::log* log_,
uint32_t lcid_, uint32_t lcid_,
srslte_pdcp_config_nr_t cfg_); srslte_pdcp_config_t cfg_);
void reset(); void reset();
void reestablish(); void reestablish();
@ -64,7 +64,7 @@ private:
srsue::rrc_interface_pdcp* rrc = nullptr; srsue::rrc_interface_pdcp* rrc = nullptr;
srsue::gw_interface_pdcp* gw = nullptr; srsue::gw_interface_pdcp* gw = nullptr;
srslte_pdcp_config_nr_t cfg = {0, false, false, 0, PDCP_SN_LEN_12}; srslte_pdcp_config_t cfg = {0, false, false, 0, PDCP_SN_LEN_12};
uint16_t sn_len_bytes = 0; uint16_t sn_len_bytes = 0;

@ -120,7 +120,7 @@ void pdcp::write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu)
pthread_rwlock_unlock(&rwlock); pthread_rwlock_unlock(&rwlock);
} }
void pdcp::add_bearer(uint32_t lcid, srslte_pdcp_config_lte_t cfg) void pdcp::add_bearer(uint32_t lcid, srslte_pdcp_config_t cfg)
{ {
pthread_rwlock_wrlock(&rwlock); pthread_rwlock_wrlock(&rwlock);
if (not valid_lcid(lcid)) { if (not valid_lcid(lcid)) {
@ -141,7 +141,7 @@ unlock_and_exit:
pthread_rwlock_unlock(&rwlock); pthread_rwlock_unlock(&rwlock);
} }
void pdcp::add_bearer_mrb(uint32_t lcid, srslte_pdcp_config_lte_t cfg) void pdcp::add_bearer_mrb(uint32_t lcid, srslte_pdcp_config_t cfg)
{ {
pthread_rwlock_wrlock(&rwlock); pthread_rwlock_wrlock(&rwlock);
if (not valid_mch_lcid(lcid)) { if (not valid_mch_lcid(lcid)) {

@ -33,7 +33,7 @@ void pdcp_entity_lte::init(srsue::rlc_interface_pdcp* rlc_,
srsue::gw_interface_pdcp* gw_, srsue::gw_interface_pdcp* gw_,
srslte::log* log_, srslte::log* log_,
uint32_t lcid_, uint32_t lcid_,
srslte_pdcp_config_lte_t cfg_) srslte_pdcp_config_t cfg_)
{ {
rlc = rlc_; rlc = rlc_;
rrc = rrc_; rrc = rrc_;

@ -34,7 +34,7 @@ void pdcp_entity_nr::init(srsue::rlc_interface_pdcp* rlc_,
srsue::gw_interface_pdcp* gw_, srsue::gw_interface_pdcp* gw_,
srslte::log* log_, srslte::log* log_,
uint32_t lcid_, uint32_t lcid_,
srslte_pdcp_config_nr_t cfg_) srslte_pdcp_config_t cfg_)
{ {
rlc = rlc_; rlc = rlc_;
rrc = rrc_; rrc = rrc_;
@ -190,7 +190,7 @@ void pdcp_entity_nr::write_data_header(const srslte::unique_byte_buffer_t& sdu,
} }
break; break;
case PDCP_SN_LEN_18: case PDCP_SN_LEN_18:
sdu->msg[0] = 0x80; // Data PDU and SN 18, D flag present sdu->msg[0] = 0x80; // Data PDU and SN 18 implies DRB, D flag must be present
*sdu->msg = count & 0x3F; *sdu->msg = count & 0x3F;
break; break;
default: default:

@ -99,7 +99,7 @@ private:
bool test_tx_basic(srslte::byte_buffer_pool* pool, srslte::log* log) bool test_tx_basic(srslte::byte_buffer_pool* pool, srslte::log* log)
{ {
srslte::pdcp_entity_nr pdcp; srslte::pdcp_entity_nr pdcp;
srslte::srslte_pdcp_config_nr_t cfg = {1, false, true, SECURITY_DIRECTION_UPLINK, srslte::PDCP_SN_LEN_12}; srslte::srslte_pdcp_config_t cfg = {1, false, true, SECURITY_DIRECTION_UPLINK, srslte::PDCP_SN_LEN_12};
rlc_dummy rlc(log); rlc_dummy rlc(log);
rrc_dummy rrc(log); rrc_dummy rrc(log);

@ -48,7 +48,7 @@ public:
void add_user(uint16_t rnti); void add_user(uint16_t rnti);
void rem_user(uint16_t rnti); void rem_user(uint16_t rnti);
void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu); void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu);
void add_bearer(uint16_t rnti, uint32_t lcid, srslte::srslte_pdcp_config_lte_t cnfg); void add_bearer(uint16_t rnti, uint32_t lcid, srslte::srslte_pdcp_config_t cnfg);
void config_security(uint16_t rnti, void config_security(uint16_t rnti,
uint32_t lcid, uint32_t lcid,
uint8_t* k_rrc_enc_, uint8_t* k_rrc_enc_,

@ -193,11 +193,14 @@ void rrc::add_user(uint16_t rnti)
} }
if (rnti == SRSLTE_MRNTI) { if (rnti == SRSLTE_MRNTI) {
srslte::srslte_pdcp_config_lte_t cfg; srslte::srslte_pdcp_config_t cfg = {
cfg.is_control = false; .bearer_id = 1,
cfg.is_data = true; .is_control = false,
cfg.sn_len = 12; .is_data = true,
cfg.direction = SECURITY_DIRECTION_DOWNLINK; .sn_len = srslte::PDCP_SN_LEN_12,
.direction = SECURITY_DIRECTION_DOWNLINK,
};
uint32_t teid_in = 1; uint32_t teid_in = 1;
for (uint32_t i = 0; i < mcch.msg.c1().mbsfn_area_cfg_r9().pmch_info_list_r9[0].mbms_session_info_list_r9.size(); for (uint32_t i = 0; i < mcch.msg.c1().mbsfn_area_cfg_r9().pmch_info_list_r9[0].mbms_session_info_list_r9.size();
@ -1529,12 +1532,11 @@ 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::srslte_pdcp_config_lte_t pdcp_cnfg; srslte::srslte_pdcp_config_t pdcp_cnfg{.bearer_id = 1,
pdcp_cnfg.bearer_id = 1; .is_control = true,
pdcp_cnfg.is_control = true; .is_data = false,
pdcp_cnfg.is_data = false; .sn_len = srslte::PDCP_SN_LEN_5,
pdcp_cnfg.sn_len = 5; .direction = SECURITY_DIRECTION_DOWNLINK};
pdcp_cnfg.direction = SECURITY_DIRECTION_DOWNLINK;
parent->pdcp->add_bearer(rnti, 1, pdcp_cnfg); parent->pdcp->add_bearer(rnti, 1, pdcp_cnfg);
// Configure PHY layer // Configure PHY layer
@ -1739,12 +1741,11 @@ 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::srslte_pdcp_config_lte_t pdcp_cnfg; srslte::srslte_pdcp_config_t pdcp_cnfg = {.bearer_id = 2,
pdcp_cnfg.bearer_id = 2; .direction = SECURITY_DIRECTION_DOWNLINK,
pdcp_cnfg.direction = SECURITY_DIRECTION_DOWNLINK; .is_control = true,
pdcp_cnfg.is_control = true; .is_data = false,
pdcp_cnfg.is_data = false; .sn_len = srslte::PDCP_SN_LEN_5};
pdcp_cnfg.sn_len = 5;
parent->pdcp->add_bearer(rnti, 2, pdcp_cnfg); parent->pdcp->add_bearer(rnti, 2, pdcp_cnfg);
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);
@ -1821,12 +1822,12 @@ void rrc::ue::send_connection_reconf_new_bearer(LIBLTE_S1AP_E_RABTOBESETUPLISTBE
parent->rlc->add_bearer(rnti, lcid, srslte::make_rlc_config_t(drb_item.rlc_cfg)); parent->rlc->add_bearer(rnti, lcid, srslte::make_rlc_config_t(drb_item.rlc_cfg));
// Configure DRB in PDCP // Configure DRB in PDCP
srslte::srslte_pdcp_config_lte_t pdcp_config; srslte::srslte_pdcp_config_t pdcp_config = {
pdcp_config.bearer_id = drb_item.drb_id - 1; // TODO: Review all ID mapping LCID DRB ERAB EPSBID Mapping .bearer_id = (uint8_t)(drb_item.drb_id - 1), // TODO: Review all ID mapping LCID DRB ERAB EPSBID Mapping
pdcp_config.is_control = false; .is_control = false,
pdcp_config.is_data = true; .is_data = true,
pdcp_config.sn_len = 12; .sn_len = srslte::PDCP_SN_LEN_12,
pdcp_config.direction = SECURITY_DIRECTION_DOWNLINK; .direction = SECURITY_DIRECTION_DOWNLINK};
parent->pdcp->add_bearer(rnti, lcid, pdcp_config); parent->pdcp->add_bearer(rnti, lcid, pdcp_config);
// DRB has already been configured in GTPU through bearer setup // DRB has already been configured in GTPU through bearer setup

@ -82,7 +82,7 @@ void pdcp::rem_user(uint16_t rnti)
pthread_rwlock_unlock(&rwlock); pthread_rwlock_unlock(&rwlock);
} }
void pdcp::add_bearer(uint16_t rnti, uint32_t lcid, srslte::srslte_pdcp_config_lte_t cfg) void pdcp::add_bearer(uint16_t rnti, uint32_t lcid, srslte::srslte_pdcp_config_t cfg)
{ {
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) { if (users.count(rnti)) {

@ -3145,11 +3145,11 @@ 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
srslte_pdcp_config_lte_t pdcp_cfg; srslte_pdcp_config_t pdcp_cfg = {.bearer_id = srb_cnfg->srb_id,
pdcp_cfg.is_control = true; .is_control = true,
pdcp_cfg.is_data = false; .is_data = false,
pdcp_cfg.sn_len = 5; .direction = SECURITY_DIRECTION_DOWNLINK,
pdcp_cfg.bearer_id = srb_cnfg->srb_id; .sn_len = PDCP_SN_LEN_5};
pdcp->add_bearer(srb_cnfg->srb_id, pdcp_cfg); 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);
@ -3222,9 +3222,11 @@ void rrc::add_drb(drb_to_add_mod_s* drb_cnfg)
} }
// Setup PDCP // Setup PDCP
srslte_pdcp_config_lte_t pdcp_cfg = {}; srslte_pdcp_config_t pdcp_cfg = {.bearer_id = drb_cnfg->drb_id,
pdcp_cfg.is_data = true; .is_control = true,
pdcp_cfg.bearer_id = drb_cnfg->drb_id; .is_data = false,
.direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = PDCP_SN_LEN_12};
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) {
pdcp_cfg.sn_len = 7; pdcp_cfg.sn_len = 7;

Loading…
Cancel
Save