fix PDCP initialization in eNB

master
Andre Puschmann 8 years ago
parent 80c0d0e694
commit 8030778809

@ -29,20 +29,22 @@
#include "srslte/common/timers.h" #include "srslte/common/timers.h"
#include "srslte/common/security.h" #include "srslte/common/security.h"
#include "srslte/asn1/liblte_rrc.h"
namespace srslte { namespace srslte {
class srslte_pdcp_config_t class srslte_pdcp_config_t
{ {
public: public:
srslte_pdcp_config_t(bool is_control_ = false) srslte_pdcp_config_t(bool is_control_ = false, bool is_data_ = false, uint8_t direction_ = SECURITY_DIRECTION_UPLINK)
:direction(SECURITY_DIRECTION_UPLINK) :direction(direction_)
,is_control(is_control_) ,is_control(is_control_)
,is_data(false) ,is_data(is_data_)
,do_security(false) ,do_security(false)
,sn_len(12) {} ,sn_len(12) {}
u_int8_t direction; uint8_t direction;
bool is_control; bool is_control;
bool is_data; bool is_data;
bool do_security; bool do_security;

@ -28,6 +28,7 @@
#include "srslte/common/common.h" #include "srslte/common/common.h"
#include "srslte/common/security.h" #include "srslte/common/security.h"
#include "srslte/common/interfaces_common.h"
#include "srslte/interfaces/sched_interface.h" #include "srslte/interfaces/sched_interface.h"
#include "srslte/upper/rlc_interface.h" #include "srslte/upper/rlc_interface.h"
#include "srslte/asn1/liblte_rrc.h" #include "srslte/asn1/liblte_rrc.h"
@ -175,7 +176,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::byte_buffer_t *sdu) = 0; virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
virtual void add_bearer(uint16_t rnti, uint32_t lcid, LIBLTE_RRC_PDCP_CONFIG_STRUCT *cnfg=NULL) = 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_,

@ -41,7 +41,13 @@ void pdcp::init(srsue::rlc_interface_pdcp *rlc_, srsue::rrc_interface_pdcp *rrc_
lcid = lcid_; lcid = lcid_;
direction = direction_; direction = direction_;
pdcp_array[0].init(rlc, rrc, gw, pdcp_log, lcid, direction); // Default config
srslte_pdcp_config_t cnfg;
cnfg.is_control = false;
cnfg.is_data = false;
cnfg.direction = direction_;
pdcp_array[0].init(rlc, rrc, gw, pdcp_log, lcid, cnfg);
} }
void pdcp::stop() void pdcp::stop()

@ -193,9 +193,8 @@ void rlc::write_pdu_pcch(uint8_t *payload, uint32_t nof_bytes)
*******************************************************************************/ *******************************************************************************/
void rlc::add_bearer(uint32_t lcid) void rlc::add_bearer(uint32_t lcid)
{ {
// No config provided - use defaults for lcid // No config provided - use defaults for SRB1 and SRB2
if(default_lcid == lcid || (default_lcid+1) == lcid) if(lcid < 3) {
{
if (!rlc_array[lcid].active()) { if (!rlc_array[lcid].active()) {
LIBLTE_RRC_RLC_CONFIG_STRUCT cnfg; LIBLTE_RRC_RLC_CONFIG_STRUCT cnfg;
cnfg.rlc_mode = LIBLTE_RRC_RLC_MODE_AM; cnfg.rlc_mode = LIBLTE_RRC_RLC_MODE_AM;
@ -210,7 +209,7 @@ void rlc::add_bearer(uint32_t lcid)
rlc_log->warning("Bearer %s already configured. Reconfiguration not supported\n", get_rb_name(lcid).c_str()); rlc_log->warning("Bearer %s already configured. Reconfiguration not supported\n", get_rb_name(lcid).c_str());
} }
}else{ }else{
rlc_log->error("Radio bearer %s does not support default RLC configuration.", rlc_log->error("Radio bearer %s does not support default RLC configuration.\n",
get_rb_name(lcid).c_str()); get_rb_name(lcid).c_str());
} }
} }

@ -113,7 +113,7 @@ int rlc_tm::read_pdu(uint8_t *payload, uint32_t nof_bytes)
return pdu_size; return pdu_size;
} }
void rlc_tm:: write_pdu(uint8_t *payload, uint32_t nof_bytes) void rlc_tm::write_pdu(uint8_t *payload, uint32_t nof_bytes)
{ {
byte_buffer_t *buf = pool_allocate; byte_buffer_t *buf = pool_allocate;
memcpy(buf->msg, payload, nof_bytes); memcpy(buf->msg, payload, nof_bytes);

@ -75,18 +75,18 @@ void rlc_um::configure(srslte_rlc_config_t cnfg_)
log->info("%s configured in %s mode: " log->info("%s configured in %s mode: "
"t_reordering=%d ms, rx_sn_field_length=%u bits, tx_sn_field_length=%u bits\n", "t_reordering=%d ms, rx_sn_field_length=%u bits, tx_sn_field_length=%u bits\n",
rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode], rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode],
cfg.t_reordering, cfg.rx_sn_field_length, cfg.tx_sn_field_length); cfg.t_reordering, rlc_umd_sn_size_num[cfg.rx_sn_field_length], rlc_umd_sn_size_num[cfg.rx_sn_field_length]);
break; break;
case LIBLTE_RRC_RLC_MODE_UM_UNI_UL: case LIBLTE_RRC_RLC_MODE_UM_UNI_UL:
log->info("%s configured in %s mode: tx_sn_field_length=%u bits\n", log->info("%s configured in %s mode: tx_sn_field_length=%u bits\n",
rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode], rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode],
cfg.tx_sn_field_length); rlc_umd_sn_size_num[cfg.rx_sn_field_length]);
break; break;
case LIBLTE_RRC_RLC_MODE_UM_UNI_DL: case LIBLTE_RRC_RLC_MODE_UM_UNI_DL:
log->info("%s configured in %s mode: " log->info("%s configured in %s mode: "
"t_reordering=%d ms, rx_sn_field_length=%u bits\n", "t_reordering=%d ms, rx_sn_field_length=%u bits\n",
rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode], rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode],
cfg.t_reordering, cfg.rx_sn_field_length); cfg.t_reordering, rlc_umd_sn_size_num[cfg.rx_sn_field_length]);
break; break;
default: default:
log->error("RLC configuration mode not recognized\n"); log->error("RLC configuration mode not recognized\n");

@ -51,7 +51,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::byte_buffer_t *sdu); void write_sdu(uint16_t rnti, uint32_t lcid, srslte::byte_buffer_t *sdu);
void add_bearer(uint16_t rnti, uint32_t lcid, LIBLTE_RRC_PDCP_CONFIG_STRUCT *cnfg=NULL); 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_,

@ -73,20 +73,13 @@ void pdcp::rem_user(uint16_t rnti)
} }
} }
void pdcp::add_bearer(uint16_t rnti, uint32_t lcid, LIBLTE_RRC_PDCP_CONFIG_STRUCT* cnfg_) void pdcp::add_bearer(uint16_t rnti, uint32_t lcid, srslte::srslte_pdcp_config_t cfg)
{ {
if (users.count(rnti)) { if (users.count(rnti)) {
srslte::srslte_pdcp_config_t cfg;
if(cnfg_->rlc_um_pdcp_sn_size_present) {
if(LIBLTE_RRC_PDCP_SN_SIZE_7_BITS == cnfg_->rlc_um_pdcp_sn_size) {
cfg.sn_len = 7;
}
}
users[rnti].pdcp->add_bearer(lcid, cfg); users[rnti].pdcp->add_bearer(lcid, cfg);
} }
} }
void pdcp::reset(uint16_t rnti) void pdcp::reset(uint16_t rnti)
{ {
if (users.count(rnti)) { if (users.count(rnti)) {

@ -1154,9 +1154,14 @@ void rrc::ue::send_connection_setup(bool is_setup)
// Configure MAC // Configure MAC
parent->mac->ue_cfg(rnti, &sched_cfg); parent->mac->ue_cfg(rnti, &sched_cfg);
// Configure SRB1 in RLC and PDCP // Configure SRB1 in RLC
parent->rlc->add_bearer(rnti, 1); parent->rlc->add_bearer(rnti, 1);
parent->pdcp->add_bearer(rnti, 1);
// Configure SRB1 in PDCP
srslte::srslte_pdcp_config_t pdcp_cnfg;
pdcp_cnfg.is_control = true;
pdcp_cnfg.direction = SECURITY_DIRECTION_DOWNLINK;
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);
@ -1168,7 +1173,6 @@ void rrc::ue::send_connection_setup(bool is_setup)
rr_cfg->sps_cnfg_present = false; rr_cfg->sps_cnfg_present = false;
send_dl_ccch(&dl_ccch_msg); send_dl_ccch(&dl_ccch_msg);
} }
@ -1312,12 +1316,27 @@ void rrc::ue::send_connection_reconf(srslte::byte_buffer_t *pdu)
// Configure SRB2 in RLC and PDCP // Configure SRB2 in RLC and PDCP
parent->rlc->add_bearer(rnti, 2); parent->rlc->add_bearer(rnti, 2);
parent->pdcp->add_bearer(rnti, 2);
// Configure SRB2 in PDCP
srslte::srslte_pdcp_config_t pdcp_cnfg;
pdcp_cnfg.direction = SECURITY_DIRECTION_DOWNLINK;
pdcp_cnfg.is_control = true;
pdcp_cnfg.is_data = false;
parent->pdcp->add_bearer(rnti, 2, pdcp_cnfg);
// Configure DRB1 in RLC // Configure DRB1 in RLC
parent->rlc->add_bearer(rnti, 3, &conn_reconf->rr_cnfg_ded.drb_to_add_mod_list[0].rlc_cnfg); parent->rlc->add_bearer(rnti, 3, &conn_reconf->rr_cnfg_ded.drb_to_add_mod_list[0].rlc_cnfg);
// Configure DRB1 in PDCP // Configure DRB1 in PDCP
parent->pdcp->add_bearer(rnti, 3, &conn_reconf->rr_cnfg_ded.drb_to_add_mod_list[0].pdcp_cnfg); pdcp_cnfg.is_control = false;
pdcp_cnfg.is_data = true;
if (conn_reconf->rr_cnfg_ded.drb_to_add_mod_list[0].pdcp_cnfg.rlc_um_pdcp_sn_size_present) {
if(LIBLTE_RRC_PDCP_SN_SIZE_7_BITS == conn_reconf->rr_cnfg_ded.drb_to_add_mod_list[0].pdcp_cnfg.rlc_um_pdcp_sn_size) {
pdcp_cnfg.sn_len = 7;
}
}
parent->pdcp->add_bearer(rnti, 3, pdcp_cnfg);
// DRB1 has already been configured in GTPU through bearer setup // DRB1 has already been configured in GTPU through bearer setup
// Add NAS Attach accept // Add NAS Attach accept

Loading…
Cancel
Save