Added enum to PDCP config to replace two bools.

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent 457f35699d
commit 73e30743d1

@ -68,32 +68,29 @@ public:
};
const uint8_t PDCP_SN_LEN_5 = 5;
const uint8_t PDCP_SN_LEN_7 = 7;
const uint8_t PDCP_SN_LEN_12 = 12;
const uint8_t PDCP_SN_LEN_18 = 18;
typedef enum { PDCP_RB_IS_SRB, PDCP_RB_IS_DRB } pdcp_rb_type_t;
class srslte_pdcp_config_t
{
public:
srslte_pdcp_config_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_, pdcp_rb_type_t rb_type_, uint8_t direction_, uint8_t sn_len_) :
bearer_id(bearer_id_),
rb_type(rb_type_),
direction(direction_),
is_control(is_control_),
is_data(is_data_),
sn_len(sn_len_)
{
hdr_len_bytes = ceil((float)sn_len / 8);
}
uint32_t bearer_id;
uint8_t direction;
bool is_control;
bool is_data;
uint8_t sn_len;
uint8_t hdr_len_bytes;
uint8_t bearer_id;
pdcp_rb_type_t rb_type;
uint8_t direction;
uint8_t sn_len;
uint8_t hdr_len_bytes;
// TODO: Support the following configurations
// bool do_rohc;

@ -60,8 +60,8 @@ public:
virtual void reestablish() = 0;
bool is_active() { return active; }
bool is_control() { return rb_is_control; }
bool is_data() { return !rb_is_control; }
bool is_srb() { return cfg.rb_type == PDCP_RB_IS_SRB; }
bool is_drb() { return cfg.rb_type == PDCP_RB_IS_DRB; }
// RRC interface
void enable_integrity() { do_integrity = true; }
@ -86,19 +86,14 @@ public:
uint32_t COUNT(uint32_t hfn, uint32_t sn);
protected:
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
srslte::log* log = nullptr;
bool active = false;
uint32_t lcid = 0;
bool rb_is_control = false;
bool do_integrity = false;
bool do_encryption = false;
uint32_t bearer_id = 0;
uint32_t direction = 0;
uint8_t sn_len = 0;
uint8_t sn_len_bytes = 0;
srslte_pdcp_config_t cfg = {1, PDCP_RB_IS_DRB, SECURITY_DIRECTION_UPLINK, PDCP_SN_LEN_12};
std::mutex mutex;
@ -118,17 +113,17 @@ protected:
inline uint32_t pdcp_entity_base::HFN(uint32_t count)
{
return (count >> sn_len);
return (count >> cfg.sn_len);
}
inline uint32_t pdcp_entity_base::SN(uint32_t count)
{
return count & (0xFFFFFFFF >> sn_len);
return count & (0xFFFFFFFF >> cfg.sn_len);
}
inline uint32_t pdcp_entity_base::COUNT(uint32_t hfn, uint32_t sn)
{
return (hfn << sn_len) | sn;
return (hfn << cfg.sn_len) | sn;
}
} // namespace srslte
#endif // SRSLTE_PDCP_ENTITY_BASE_H

@ -72,8 +72,6 @@ private:
srsue::rrc_interface_pdcp* rrc = nullptr;
srsue::gw_interface_pdcp* gw = nullptr;
srslte_pdcp_config_t cfg = {0, SECURITY_DIRECTION_UPLINK, false, false, 0};
uint32_t rx_count = 0;
uint32_t tx_count = 0;

@ -64,8 +64,6 @@ private:
srsue::rrc_interface_pdcp* rrc = nullptr;
srsue::gw_interface_pdcp* gw = nullptr;
srslte_pdcp_config_t cfg = {0, false, false, 0, PDCP_SN_LEN_12};
uint16_t sn_len_bytes = 0;
// State variables: 3GPP TS 38.323 v15.2.0, section 7.1

@ -56,7 +56,7 @@ void pdcp_entity_base::integrity_generate(uint8_t* msg, uint32_t msg_len, uint32
uint8_t *k_int;
// If control plane use RRC integrity key. If data use user plane key
if (is_control()) {
if (is_srb()) {
k_int = k_rrc_int;
} else {
k_int = k_up_int;
@ -69,8 +69,8 @@ void pdcp_entity_base::integrity_generate(uint8_t* msg, uint32_t msg_len, uint32
case INTEGRITY_ALGORITHM_ID_128_EIA1:
security_128_eia1(&k_int[16],
count,
bearer_id - 1,
direction,
cfg.bearer_id - 1,
cfg.direction,
msg,
msg_len,
mac);
@ -78,8 +78,8 @@ void pdcp_entity_base::integrity_generate(uint8_t* msg, uint32_t msg_len, uint32
case INTEGRITY_ALGORITHM_ID_128_EIA2:
security_128_eia2(&k_int[16],
count,
bearer_id - 1,
direction,
cfg.bearer_id - 1,
cfg.direction,
msg,
msg_len,
mac);
@ -90,8 +90,8 @@ void pdcp_entity_base::integrity_generate(uint8_t* msg, uint32_t msg_len, uint32
log->debug("Integrity gen input: COUNT %d, Bearer ID %d, Direction %s\n",
count,
bearer_id,
(direction == SECURITY_DIRECTION_DOWNLINK ? "Downlink" : "Uplink"));
cfg.bearer_id,
(cfg.direction == SECURITY_DIRECTION_DOWNLINK ? "Downlink" : "Uplink"));
log->debug_hex(mac, 4, "MAC (generated)");
log->debug_hex(msg, msg_len, " Message");
}
@ -103,7 +103,7 @@ bool pdcp_entity_base::integrity_verify(uint8_t* msg, uint32_t msg_len, uint32_t
uint8_t *k_int;
// If control plane use RRC integrity key. If data use user plane key
if (is_control()) {
if (is_srb()) {
k_int = k_rrc_int;
} else {
k_int = k_up_int;
@ -115,9 +115,9 @@ bool pdcp_entity_base::integrity_verify(uint8_t* msg, uint32_t msg_len, uint32_t
case INTEGRITY_ALGORITHM_ID_128_EIA1:
security_128_eia1(&k_int[16],
count,
bearer_id - 1,
(direction == SECURITY_DIRECTION_DOWNLINK) ? (SECURITY_DIRECTION_UPLINK)
: (SECURITY_DIRECTION_DOWNLINK),
cfg.bearer_id - 1,
(cfg.direction == SECURITY_DIRECTION_DOWNLINK) ? (SECURITY_DIRECTION_UPLINK)
: (SECURITY_DIRECTION_DOWNLINK),
msg,
msg_len,
mac_exp);
@ -125,9 +125,9 @@ bool pdcp_entity_base::integrity_verify(uint8_t* msg, uint32_t msg_len, uint32_t
case INTEGRITY_ALGORITHM_ID_128_EIA2:
security_128_eia2(&k_int[16],
count,
bearer_id - 1,
(direction == SECURITY_DIRECTION_DOWNLINK) ? (SECURITY_DIRECTION_UPLINK)
: (SECURITY_DIRECTION_DOWNLINK),
cfg.bearer_id - 1,
(cfg.direction == SECURITY_DIRECTION_DOWNLINK) ? (SECURITY_DIRECTION_UPLINK)
: (SECURITY_DIRECTION_DOWNLINK),
msg,
msg_len,
mac_exp);
@ -138,8 +138,8 @@ bool pdcp_entity_base::integrity_verify(uint8_t* msg, uint32_t msg_len, uint32_t
log->debug("Integrity check input: COUNT %d, Bearer ID %d, Direction %s\n",
count,
bearer_id,
(direction == SECURITY_DIRECTION_DOWNLINK ? "Downlink" : "Uplink"));
cfg.bearer_id,
(cfg.direction == SECURITY_DIRECTION_DOWNLINK ? "Downlink" : "Uplink"));
log->debug_hex(msg, msg_len, " Message");
if (integ_algo != INTEGRITY_ALGORITHM_ID_EIA0) {
@ -165,7 +165,7 @@ void pdcp_entity_base::cipher_encrypt(uint8_t* msg, uint32_t msg_len, uint32_t c
uint8_t *k_enc;
// If control plane use RRC encrytion key. If data use user plane key
if (is_control()) {
if (is_srb()) {
k_enc = k_rrc_enc;
} else {
k_enc = k_up_enc;
@ -173,18 +173,18 @@ void pdcp_entity_base::cipher_encrypt(uint8_t* msg, uint32_t msg_len, uint32_t c
log->debug("Cipher encrypt input: COUNT: %d, Bearer ID: %d, Direction %s\n",
count,
bearer_id,
(direction == SECURITY_DIRECTION_DOWNLINK) ? "Downlink" : "Uplink");
cfg.bearer_id,
(cfg.direction == SECURITY_DIRECTION_DOWNLINK) ? "Downlink" : "Uplink");
switch (cipher_algo) {
case CIPHERING_ALGORITHM_ID_EEA0:
break;
case CIPHERING_ALGORITHM_ID_128_EEA1:
security_128_eea1(&(k_enc[16]), count, bearer_id - 1, direction, msg, msg_len, ct_tmp.msg);
security_128_eea1(&(k_enc[16]), count, cfg.bearer_id - 1, cfg.direction, msg, msg_len, ct_tmp.msg);
memcpy(ct, ct_tmp.msg, msg_len);
break;
case CIPHERING_ALGORITHM_ID_128_EEA2:
security_128_eea2(&(k_enc[16]), count, bearer_id - 1, direction, msg, msg_len, ct_tmp.msg);
security_128_eea2(&(k_enc[16]), count, cfg.bearer_id - 1, cfg.direction, msg, msg_len, ct_tmp.msg);
memcpy(ct, ct_tmp.msg, msg_len);
break;
default:
@ -197,7 +197,7 @@ void pdcp_entity_base::cipher_decrypt(uint8_t* ct, uint32_t ct_len, uint32_t cou
byte_buffer_t msg_tmp;
uint8_t *k_enc;
// If control plane use RRC encrytion key. If data use user plane key
if (is_control()) {
if (is_srb()) {
k_enc = k_rrc_enc;
} else {
k_enc = k_up_enc;
@ -205,8 +205,8 @@ void pdcp_entity_base::cipher_decrypt(uint8_t* ct, uint32_t ct_len, uint32_t cou
log->debug("Cipher decript input: COUNT: %d, Bearer ID: %d, Direction %s\n",
count,
bearer_id,
(direction == SECURITY_DIRECTION_DOWNLINK) ? "Downlink" : "Uplink");
cfg.bearer_id,
(cfg.direction == SECURITY_DIRECTION_DOWNLINK) ? "Downlink" : "Uplink");
switch(cipher_algo)
{
@ -215,8 +215,9 @@ void pdcp_entity_base::cipher_decrypt(uint8_t* ct, uint32_t ct_len, uint32_t cou
case CIPHERING_ALGORITHM_ID_128_EEA1:
security_128_eea1(&(k_enc[16]),
count,
bearer_id - 1,
(direction == SECURITY_DIRECTION_DOWNLINK) ? (SECURITY_DIRECTION_UPLINK) : (SECURITY_DIRECTION_DOWNLINK),
cfg.bearer_id - 1,
(cfg.direction == SECURITY_DIRECTION_DOWNLINK) ? (SECURITY_DIRECTION_UPLINK)
: (SECURITY_DIRECTION_DOWNLINK),
ct,
ct_len,
msg_tmp.msg);
@ -225,8 +226,9 @@ void pdcp_entity_base::cipher_decrypt(uint8_t* ct, uint32_t ct_len, uint32_t cou
case CIPHERING_ALGORITHM_ID_128_EEA2:
security_128_eea2(&(k_enc[16]),
count,
bearer_id - 1,
(direction == SECURITY_DIRECTION_DOWNLINK) ? (SECURITY_DIRECTION_UPLINK) : (SECURITY_DIRECTION_DOWNLINK),
cfg.bearer_id - 1,
(cfg.direction == SECURITY_DIRECTION_DOWNLINK) ? (SECURITY_DIRECTION_UPLINK)
: (SECURITY_DIRECTION_DOWNLINK),
ct,
ct_len,
msg_tmp.msg);

@ -47,16 +47,9 @@ void pdcp_entity_lte::init(srsue::rlc_interface_pdcp* rlc_,
do_integrity = false;
do_encryption = false;
cfg = cfg_;
// set length of SN field in bytes
sn_len_bytes = (cfg.sn_len == 5) ? 1 : 2;
rb_is_control = cfg.is_control;
if (cfg.is_control) {
if (is_srb()) {
reordering_window = 0;
} else if (cfg.is_data) {
} else if (is_drb()) {
reordering_window = 2048;
}
@ -67,7 +60,7 @@ void pdcp_entity_lte::init(srsue::rlc_interface_pdcp* rlc_,
log->info("Init %s with bearer ID: %d\n", rrc->get_rb_name(lcid).c_str(), cfg.bearer_id);
log->info("SN len bits: %d, SN len bytes: %d, reordering window: %d, Maximum SN %d\n",
cfg.sn_len,
sn_len_bytes,
cfg.hdr_len_bytes,
reordering_window,
maximum_pdcp_sn);
}
@ -77,7 +70,7 @@ void pdcp_entity_lte::reestablish()
{
log->info("Re-establish %s with bearer ID: %d\n", rrc->get_rb_name(lcid).c_str(), cfg.bearer_id);
// For SRBs
if (cfg.is_control) {
if (is_srb()) {
tx_count = 0;
rx_count = 0;
rx_hfn = 0;
@ -118,7 +111,7 @@ void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, bool blocking)
mutex.lock();
if (cfg.is_control) {
if (is_srb()) {
pdcp_pack_control_pdu(tx_count, sdu.get());
if (do_integrity) {
integrity_generate(
@ -126,7 +119,7 @@ void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, bool blocking)
}
}
if (cfg.is_data) {
if (is_drb()) {
if (12 == cfg.sn_len) {
pdcp_pack_data_pdu_long_sn(tx_count, sdu.get());
} else {
@ -135,7 +128,8 @@ void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, bool blocking)
}
if (do_encryption) {
cipher_encrypt(&sdu->msg[sn_len_bytes], sdu->N_bytes - sn_len_bytes, tx_count, &sdu->msg[sn_len_bytes]);
cipher_encrypt(
&sdu->msg[cfg.hdr_len_bytes], sdu->N_bytes - cfg.hdr_len_bytes, tx_count, &sdu->msg[cfg.hdr_len_bytes]);
log->info_hex(sdu->msg, sdu->N_bytes, "TX %s SDU (encrypted)", rrc->get_rb_name(lcid).c_str());
}
tx_count++;
@ -157,13 +151,13 @@ void pdcp_entity_lte::write_pdu(unique_byte_buffer_t pdu)
(do_encryption) ? "true" : "false");
// Sanity check
if (pdu->N_bytes <= sn_len_bytes) {
if (pdu->N_bytes <= cfg.hdr_len_bytes) {
return;
}
mutex.lock();
if (cfg.is_data) {
if (is_drb()) {
// Handle DRB messages
if (rlc->rb_is_um(lcid)) {
handle_um_drb_pdu(pdu);
@ -173,10 +167,11 @@ void pdcp_entity_lte::write_pdu(unique_byte_buffer_t pdu)
gw->write_pdu(lcid, std::move(pdu));
} else {
// Handle SRB messages
if (cfg.is_control) {
if (is_srb()) {
uint32_t sn = *pdu->msg & 0x1F;
if (do_encryption) {
cipher_decrypt(&pdu->msg[sn_len_bytes], pdu->N_bytes - sn_len_bytes, sn, &(pdu->msg[sn_len_bytes]));
cipher_decrypt(
&pdu->msg[cfg.hdr_len_bytes], pdu->N_bytes - cfg.hdr_len_bytes, sn, &(pdu->msg[cfg.hdr_len_bytes]));
log->info_hex(pdu->msg, pdu->N_bytes, "RX %s PDU (decrypted)", rrc->get_rb_name(lcid).c_str());
}

@ -45,16 +45,13 @@ void pdcp_entity_nr::init(srsue::rlc_interface_pdcp* rlc_,
active = true;
do_integrity = false;
do_encryption = false;
// SN length in bytes
sn_len_bytes = ceil((float)cfg.sn_len / 8);
}
// Reestablishment procedure: 36.323 5.2
// Reestablishment procedure: 38.323 5.2
void pdcp_entity_nr::reestablish()
{
log->info("Re-establish %s with bearer ID: %d\n", rrc->get_rb_name(lcid).c_str(), cfg.bearer_id);
// For TODO
// TODO
}
// Used to stop/pause the entity (called on RRC conn release)
@ -146,7 +143,7 @@ void pdcp_entity_nr::write_pdu(unique_byte_buffer_t pdu)
}
// Deliver to upper layers (TODO support in order delivery)
if (is_control()) {
if (is_srb()) {
rrc->write_pdu(lcid, std::move(pdu));
} else {
gw->write_pdu(lcid, std::move(pdu));
@ -160,13 +157,15 @@ void pdcp_entity_nr::write_pdu(unique_byte_buffer_t pdu)
uint32_t pdcp_entity_nr::get_rcvd_sn(const unique_byte_buffer_t& pdu)
{
uint32_t rcvd_sn = 0;
switch (sn_len) {
switch (cfg.sn_len) {
case PDCP_SN_LEN_12:
pdu->msg;
break;
case PDCP_SN_LEN_18:
pdu->msg;
break;
default:
log->error("Cannot extract RCVD_SN, invalid SN length configured: %d\n", (int)sn_len);
log->error("Cannot extract RCVD_SN, invalid SN length configured: %d\n", cfg.sn_len);
}
return rcvd_sn;
}
@ -181,11 +180,11 @@ void pdcp_entity_nr::write_data_header(const srslte::unique_byte_buffer_t& sdu,
sdu->msg -= sn_len_bytes;
sdu->N_bytes += sn_len_bytes;
switch (sn_len) {
switch (cfg.sn_len) {
case PDCP_SN_LEN_12:
log->console("wazapp\n");
srslte::uint16_to_uint8(0x3F & count, sdu->msg);
if (is_data()) {
if (is_drb()) {
sdu->msg[0] |= 0x80; // On DRB Data PDUs we must set the D flag.
}
break;
@ -194,7 +193,7 @@ void pdcp_entity_nr::write_data_header(const srslte::unique_byte_buffer_t& sdu,
*sdu->msg = count & 0x3F;
break;
default:
log->error("Invalid SN length configuration: %d bits\n", sn_len);
log->error("Invalid SN length configuration: %d bits\n", cfg.sn_len);
}
}

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

@ -194,11 +194,10 @@ void rrc::add_user(uint16_t rnti)
if (rnti == SRSLTE_MRNTI) {
srslte::srslte_pdcp_config_t cfg = {
.bearer_id = 1,
.is_control = false,
.is_data = true,
.sn_len = srslte::PDCP_SN_LEN_12,
.direction = SECURITY_DIRECTION_DOWNLINK,
.bearer_id = 1,
.rb_type = srslte::PDCP_RB_IS_DRB,
.sn_len = srslte::PDCP_SN_LEN_12,
.direction = SECURITY_DIRECTION_DOWNLINK,
};
uint32_t teid_in = 1;
@ -1533,10 +1532,9 @@ void rrc::ue::send_connection_setup(bool is_setup)
// Configure SRB1 in PDCP
srslte::srslte_pdcp_config_t pdcp_cnfg{.bearer_id = 1,
.is_control = true,
.is_data = false,
.sn_len = srslte::PDCP_SN_LEN_5,
.direction = SECURITY_DIRECTION_DOWNLINK};
.rb_type = srslte::PDCP_RB_IS_DRB,
.sn_len = srslte::PDCP_SN_LEN_5,
.direction = SECURITY_DIRECTION_DOWNLINK};
parent->pdcp->add_bearer(rnti, 1, pdcp_cnfg);
// Configure PHY layer
@ -1741,12 +1739,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));
// Configure SRB2 in PDCP
srslte::srslte_pdcp_config_t pdcp_cnfg = {.bearer_id = 2,
.direction = SECURITY_DIRECTION_DOWNLINK,
.is_control = true,
.is_data = false,
.sn_len = srslte::PDCP_SN_LEN_5};
parent->pdcp->add_bearer(rnti, 2, pdcp_cnfg);
srslte::srslte_pdcp_config_t pdcp_cnfg_srb = {.bearer_id = 2,
.rb_type = srslte::PDCP_RB_IS_SRB,
.direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = srslte::PDCP_SN_LEN_5};
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->enable_integrity(rnti, 2);
parent->pdcp->enable_encryption(rnti, 2);
@ -1755,17 +1752,17 @@ 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));
// Configure DRB1 in PDCP
pdcp_cnfg.is_control = false;
pdcp_cnfg.is_data = true;
pdcp_cnfg.sn_len = 12;
pdcp_cnfg.bearer_id = 1; // TODO: Review all ID mapping LCID DRB ERAB EPSBID Mapping
srslte::srslte_pdcp_config_t pdcp_cnfg_drb = {.bearer_id = 1,
.rb_type = srslte::PDCP_RB_IS_DRB,
.direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = srslte::PDCP_SN_LEN_12};
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 ==
pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_::len7bits) {
pdcp_cnfg.sn_len = 7;
pdcp_cnfg_drb.sn_len = srslte::PDCP_SN_LEN_7;
}
}
parent->pdcp->add_bearer(rnti, 3, pdcp_cnfg);
parent->pdcp->add_bearer(rnti, 3, pdcp_cnfg_drb);
parent->pdcp->config_security(rnti, 3, k_rrc_enc, k_rrc_int, k_up_enc, cipher_algo, integ_algo);
parent->pdcp->enable_integrity(rnti, 3);
parent->pdcp->enable_encryption(rnti, 3);
@ -1823,11 +1820,10 @@ void rrc::ue::send_connection_reconf_new_bearer(LIBLTE_S1AP_E_RABTOBESETUPLISTBE
// Configure DRB in PDCP
srslte::srslte_pdcp_config_t pdcp_config = {
.bearer_id = (uint8_t)(drb_item.drb_id - 1), // TODO: Review all ID mapping LCID DRB ERAB EPSBID Mapping
.is_control = false,
.is_data = true,
.sn_len = srslte::PDCP_SN_LEN_12,
.direction = SECURITY_DIRECTION_DOWNLINK};
.bearer_id = (uint8_t)(drb_item.drb_id - 1), // TODO: Review all ID mapping LCID DRB ERAB EPSBID Mapping
.rb_type = srslte::PDCP_RB_IS_DRB,
.sn_len = srslte::PDCP_SN_LEN_12,
.direction = SECURITY_DIRECTION_DOWNLINK};
parent->pdcp->add_bearer(rnti, lcid, pdcp_config);
// DRB has already been configured in GTPU through bearer setup

@ -3145,11 +3145,10 @@ void rrc::handle_con_reest(rrc_conn_reest_s* setup)
void rrc::add_srb(srb_to_add_mod_s* srb_cnfg)
{
// Setup PDCP
srslte_pdcp_config_t pdcp_cfg = {.bearer_id = srb_cnfg->srb_id,
.is_control = true,
.is_data = false,
.direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = PDCP_SN_LEN_5};
srslte_pdcp_config_t pdcp_cfg = {.bearer_id = srb_cnfg->srb_id,
.rb_type = PDCP_RB_IS_SRB,
.direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = PDCP_SN_LEN_5};
pdcp->add_bearer(srb_cnfg->srb_id, pdcp_cfg);
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);
@ -3222,11 +3221,10 @@ void rrc::add_drb(drb_to_add_mod_s* drb_cnfg)
}
// Setup PDCP
srslte_pdcp_config_t pdcp_cfg = {.bearer_id = drb_cnfg->drb_id,
.is_control = true,
.is_data = false,
.direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = PDCP_SN_LEN_12};
srslte_pdcp_config_t pdcp_cfg = {.bearer_id = drb_cnfg->drb_id,
.rb_type = PDCP_RB_IS_DRB,
.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.pdcp_sn_size == pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_::len7bits) {
pdcp_cfg.sn_len = 7;

Loading…
Cancel
Save