removed rlc_interfaces. The rlc_cnfg types are now part of the rrc_interface_types. Removed implicit RB initialization in the RLC.

master
Francisco Paisana 6 years ago committed by Andre Puschmann
parent c5509caece
commit 58e2e51044

@ -22,64 +22,36 @@
#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 <string> #include "srslte/interfaces/rrc_interface_types.h"
// fwd decls /************************
* Forward declarations
***********************/
namespace asn1 { namespace asn1 {
namespace rrc { namespace rrc {
struct plmn_id_s; struct plmn_id_s;
struct s_tmsi_s; struct s_tmsi_s;
struct rlc_cfg_c; struct rlc_cfg_c;
struct srb_to_add_mod_s;
} // namespace rrc } // namespace rrc
} // namespace asn1 } // namespace asn1
/************************
* Conversion Helpers
***********************/
namespace srslte { namespace srslte {
bool plmn_is_valid(const asn1::rrc::plmn_id_s& asn1_type); plmn_id_t make_plmn_id_t(const asn1::rrc::plmn_id_s& asn1_type);
void to_asn1(asn1::rrc::plmn_id_s* asn1_type, const plmn_id_t& cfg);
struct plmn_id_t { s_tmsi_t make_s_tmsi_t(const asn1::rrc::s_tmsi_s& asn1_type);
uint8_t mcc[3]; void to_asn1(asn1::rrc::s_tmsi_s* asn1_type, const s_tmsi_t& cfg);
uint8_t mnc[3];
uint8_t nof_mnc_digits;
plmn_id_t() : mcc(), mnc(), nof_mnc_digits(2) {} rlc_config_t make_rlc_config_t(const asn1::rrc::rlc_cfg_c& asn1_type);
explicit plmn_id_t(const asn1::rrc::plmn_id_s& asn1_type); rlc_config_t make_rlc_config_t(const asn1::rrc::srb_to_add_mod_s& asn1_type);
void reset(); void to_asn1(asn1::rrc::rlc_cfg_c* asn1_type, const rlc_config_t& cfg);
int from_asn1(const asn1::rrc::plmn_id_s& asn1_type);
int to_asn1(asn1::rrc::plmn_id_s* asn1_type) const;
int from_number(uint16_t mcc_num, uint16_t mnc_num);
int from_string(const std::string& plmn_str);
std::string to_string() const;
bool operator==(const plmn_id_t& other);
};
struct s_tmsi_t {
uint8_t mmec = 0;
uint32_t m_tmsi = 0;
s_tmsi_t() = default;
explicit s_tmsi_t(const asn1::rrc::s_tmsi_s& asn1_type);
void from_asn1(const asn1::rrc::s_tmsi_s& asn1_type);
void to_asn1(asn1::rrc::s_tmsi_s* asn1_type) const;
};
enum class establishment_cause_t {
emergency,
high_prio_access,
mt_access,
mo_sig,
mo_data,
delay_tolerant_access_v1020,
mo_voice_call_v1280,
spare1,
nulltype
};
std::string to_string(const establishment_cause_t& cause);
class srslte_rlc_config_t;
void convert_from_asn1(srslte_rlc_config_t* out, const asn1::rrc::rlc_cfg_c& asn1_type);
} }
#endif // SRSLTE_RRC_ASN1_UTILS_H #endif // SRSLTE_RRC_ASN1_UTILS_H

@ -26,8 +26,8 @@
#include "srslte/common/common.h" #include "srslte/common/common.h"
#include "srslte/common/interfaces_common.h" #include "srslte/common/interfaces_common.h"
#include "srslte/common/security.h" #include "srslte/common/security.h"
#include "srslte/interfaces/rrc_interface_types.h"
#include "srslte/interfaces/sched_interface.h" #include "srslte/interfaces/sched_interface.h"
#include "srslte/upper/rlc_interface.h"
#include <vector> #include <vector>
@ -190,8 +190,7 @@ public:
virtual void clear_buffer(uint16_t rnti) = 0; virtual void clear_buffer(uint16_t rnti) = 0;
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 add_bearer(uint16_t rnti, uint32_t lcid) = 0; virtual void add_bearer(uint16_t rnti, uint32_t lcid, srslte::rlc_config_t cnfg) = 0;
virtual void add_bearer(uint16_t rnti, uint32_t lcid, srslte::srslte_rlc_config_t cnfg) = 0;
virtual void add_bearer_mrb(uint16_t rnti, uint32_t lcid) = 0; virtual void add_bearer_mrb(uint16_t rnti, uint32_t lcid) = 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;
}; };

@ -0,0 +1,262 @@
/*
* Copyright 2013-2019 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_RRC_INTERFACE_TYPES_H
#define SRSLTE_RRC_INTERFACE_TYPES_H
#include "srslte/common/bcd_helpers.h"
#include "srslte/config.h"
#include <string>
/************************
* Forward declarations
***********************/
namespace asn1 {
namespace rrc {
struct plmn_id_s;
struct s_tmsi_s;
struct rlc_cfg_c;
struct srb_to_add_mod_s;
} // namespace rrc
} // namespace asn1
/************************
* Interface types
***********************/
namespace srslte {
// helper functions
inline const char* enum_to_text(const char* const array[], uint32_t nof_types, uint32_t enum_val)
{
return enum_val >= nof_types ? "" : array[enum_val];
}
template <class ItemType>
ItemType enum_to_number(ItemType* array, uint32_t nof_types, uint32_t enum_val)
{
return enum_val >= nof_types ? -1 : array[enum_val];
}
/***************************
* PLMN ID
**************************/
struct plmn_id_t {
uint8_t mcc[3];
uint8_t mnc[3];
uint8_t nof_mnc_digits;
plmn_id_t() : mcc(), mnc(), nof_mnc_digits(0) {}
void reset()
{
nof_mnc_digits = 0;
std::fill(&mnc[0], &mnc[3], 0);
std::fill(&mcc[0], &mcc[3], 0);
}
int from_number(uint16_t mcc_num, uint16_t mnc_num)
{
srslte::mcc_to_bytes(mcc_num, &mcc[0]);
if (not srslte::mnc_to_bytes(mnc_num, &mnc[0], &nof_mnc_digits)) {
reset();
return SRSLTE_ERROR;
}
return SRSLTE_SUCCESS;
}
int from_string(const std::string& plmn_str)
{
if (plmn_str.size() < 5 or plmn_str.size() > 6) {
reset();
return SRSLTE_ERROR;
}
uint16_t mnc_num, mcc_num;
if (not string_to_mcc(std::string(plmn_str.begin(), plmn_str.begin() + 3), &mcc_num)) {
reset();
return SRSLTE_ERROR;
}
if (not string_to_mnc(std::string(plmn_str.begin() + 3, plmn_str.end()), &mnc_num)) {
reset();
return SRSLTE_ERROR;
}
return from_number(mcc_num, mnc_num);
}
std::string to_string() const
{
std::string mcc_str, mnc_str;
uint16_t mnc_num, mcc_num;
bytes_to_mnc(&mnc[0], &mnc_num, nof_mnc_digits);
bytes_to_mcc(&mcc[0], &mcc_num);
mnc_to_string(mnc_num, &mnc_str);
mcc_to_string(mcc_num, &mcc_str);
return mcc_str + mnc_str;
}
bool operator==(const plmn_id_t& other) const
{
return std::equal(&mcc[0], &mcc[3], &other.mcc[0]) and nof_mnc_digits == other.nof_mnc_digits and
std::equal(&mnc[0], &mnc[nof_mnc_digits], &other.mnc[0]);
}
bool is_valid() const { return nof_mnc_digits == 2 or nof_mnc_digits == 3; }
};
/***************************
* s-TMSI
**************************/
struct s_tmsi_t {
uint8_t mmec = 0;
uint32_t m_tmsi = 0;
};
/***************************
* Establishment Cause
**************************/
enum class establishment_cause_t {
emergency,
high_prio_access,
mt_access,
mo_sig,
mo_data,
delay_tolerant_access_v1020,
mo_voice_call_v1280,
spare1,
nulltype
};
inline std::string to_string(const establishment_cause_t& cause)
{
constexpr static const char* options[] = {"emergency",
"highPriorityAccess",
"mt-Access",
"mo-Signalling",
"mo-Data",
"delayTolerantAccess-v1020",
"mo-VoiceCall-v1280",
"spare1"};
return enum_to_text(options, (uint32_t)establishment_cause_t::nulltype, (uint32_t)cause);
}
/***************************
* RLC Config
**************************/
enum class rlc_mode_t { tm, um, am, nulltype };
inline std::string to_string(const rlc_mode_t& mode, bool long_txt = true)
{
constexpr static const char* long_options[] = {"Transparent Mode", "Unacknowledged Mode", "Acknowledged Mode"};
constexpr static const char* short_options[] = {"TM", "UM", "AM"};
if (long_txt) {
return enum_to_text(long_options, (uint32_t)rlc_mode_t::nulltype, (uint32_t)mode);
}
return enum_to_text(short_options, (uint32_t)rlc_mode_t::nulltype, (uint32_t)mode);
}
enum class rlc_umd_sn_size_t { size5bits, size10bits, nulltype };
inline std::string to_string(const rlc_umd_sn_size_t& sn_size)
{
constexpr static const char* options[] = {"5 bits", "10 bits"};
return enum_to_text(options, (uint32_t)rlc_mode_t::nulltype, (uint32_t)sn_size);
}
inline uint16_t to_number(const rlc_umd_sn_size_t& sn_size)
{
constexpr static uint16_t options[] = {5, 10};
return enum_to_number(options, (uint32_t)rlc_mode_t::nulltype, (uint32_t)sn_size);
}
struct rlc_am_config_t {
/****************************************************************************
* Configurable parameters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
// TX configs
int32_t t_poll_retx; // Poll retx timeout (ms)
int32_t poll_pdu; // Insert poll bit after this many PDUs
int32_t poll_byte; // Insert poll bit after this much data (KB)
uint32_t max_retx_thresh; // Max number of retx
// RX configs
int32_t t_reordering; // Timer used by rx to detect PDU loss (ms)
int32_t t_status_prohibit; // Timer used by rx to prohibit tx of status PDU (ms)
};
struct rlc_um_config_t {
/****************************************************************************
* Configurable parameters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
int32_t t_reordering; // Timer used by rx to detect PDU loss (ms)
rlc_umd_sn_size_t tx_sn_field_length; // Number of bits used for tx (UL) sequence number
rlc_umd_sn_size_t rx_sn_field_length; // Number of bits used for rx (DL) sequence number
uint32_t rx_window_size;
uint32_t rx_mod; // Rx counter modulus
uint32_t tx_mod; // Tx counter modulus
bool is_mrb; // Whether this is a multicast bearer
};
#define RLC_TX_QUEUE_LEN (128)
class rlc_config_t
{
public:
rlc_mode_t rlc_mode;
rlc_am_config_t am;
rlc_um_config_t um;
uint32_t tx_queue_length;
rlc_config_t() : rlc_mode(rlc_mode_t::tm), am(), um(), tx_queue_length(RLC_TX_QUEUE_LEN){};
// Factory for MCH
static rlc_config_t mch_config()
{
rlc_config_t cfg;
cfg.rlc_mode = rlc_mode_t::um;
cfg.um.t_reordering = 45;
cfg.um.rx_sn_field_length = rlc_umd_sn_size_t::size5bits;
cfg.um.rx_window_size = 16;
cfg.um.rx_mod = 32;
cfg.um.tx_sn_field_length = rlc_umd_sn_size_t::size5bits;
cfg.um.tx_mod = 32;
cfg.um.is_mrb = true;
cfg.tx_queue_length = 1024;
return cfg;
}
static rlc_config_t srb_config(uint32_t idx)
{
if (idx == 0 or idx > 2) {
return {};
}
// SRB1 and SRB2 are AM
rlc_config_t rlc_cfg;
rlc_cfg.rlc_mode = rlc_mode_t::am;
rlc_cfg.am.t_poll_retx = 45;
rlc_cfg.am.poll_pdu = -1;
rlc_cfg.am.poll_byte = -1;
rlc_cfg.am.max_retx_thresh = 4;
rlc_cfg.am.t_reordering = 35;
rlc_cfg.am.t_status_prohibit = 0;
return rlc_cfg;
}
};
} // namespace srslte
#endif // SRSLTE_RRC_INTERFACE_TYPES_H

@ -30,15 +30,14 @@
#include <string> #include <string>
#include "rrc_interface_types.h"
#include "srslte/asn1/liblte_mme.h" #include "srslte/asn1/liblte_mme.h"
#include "srslte/asn1/rrc_asn1.h" #include "srslte/asn1/rrc_asn1.h"
#include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/common/common.h" #include "srslte/common/common.h"
#include "srslte/common/interfaces_common.h" #include "srslte/common/interfaces_common.h"
#include "srslte/common/security.h" #include "srslte/common/security.h"
#include "srslte/phy/channel/channel.h" #include "srslte/phy/channel/channel.h"
#include "srslte/phy/rf/rf.h" #include "srslte/phy/rf/rf.h"
#include "srslte/upper/rlc_interface.h"
namespace srsue { namespace srsue {
@ -279,8 +278,7 @@ public:
virtual void reset() = 0; virtual void reset() = 0;
virtual void reestablish() = 0; virtual void reestablish() = 0;
virtual void reestablish(uint32_t lcid) = 0; virtual void reestablish(uint32_t lcid) = 0;
virtual void add_bearer(uint32_t lcid) = 0; virtual void add_bearer(uint32_t lcid, srslte::rlc_config_t cnfg) = 0;
virtual void add_bearer(uint32_t lcid, srslte::srslte_rlc_config_t cnfg) = 0;
virtual void add_bearer_mrb(uint32_t lcid) = 0; virtual void add_bearer_mrb(uint32_t lcid) = 0;
virtual void del_bearer(uint32_t lcid) = 0; virtual void del_bearer(uint32_t lcid) = 0;
virtual void resume_bearer(uint32_t lcid) = 0; virtual void resume_bearer(uint32_t lcid) = 0;

@ -76,8 +76,7 @@ public:
void reestablish(uint32_t lcid); void reestablish(uint32_t lcid);
void reset(); void reset();
void empty_queue(); void empty_queue();
void add_bearer(uint32_t lcid); void add_bearer(uint32_t lcid, rlc_config_t cnfg);
void add_bearer(uint32_t lcid, srslte_rlc_config_t cnfg);
void add_bearer_mrb(uint32_t lcid); void add_bearer_mrb(uint32_t lcid);
void del_bearer(uint32_t lcid); void del_bearer(uint32_t lcid);
void del_bearer_mrb(uint32_t lcid); void del_bearer_mrb(uint32_t lcid);

@ -71,7 +71,7 @@ public:
srslte::mac_interface_timers* mac_timers_); srslte::mac_interface_timers* mac_timers_);
~rlc_am(); ~rlc_am();
bool resume(); bool resume();
bool configure(srslte_rlc_config_t cfg_); bool configure(rlc_config_t cfg_);
void reestablish(); void reestablish();
void stop(); void stop();
@ -102,7 +102,7 @@ private:
rlc_am_tx(rlc_am* parent_); rlc_am_tx(rlc_am* parent_);
~rlc_am_tx(); ~rlc_am_tx();
bool configure(srslte_rlc_config_t cfg_); bool configure(rlc_config_t cfg_);
void empty_queue(); void empty_queue();
void reestablish(); void reestablish();
@ -148,7 +148,7 @@ private:
* Ref: 3GPP TS 36.322 v10.0.0 Section 7 * Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/ ***************************************************************************/
srslte_rlc_am_config_t cfg = {}; rlc_am_config_t cfg = {};
// TX SDU buffers // TX SDU buffers
rlc_tx_queue tx_sdu_queue; rlc_tx_queue tx_sdu_queue;
@ -202,7 +202,7 @@ private:
rlc_am_rx(rlc_am* parent_); rlc_am_rx(rlc_am* parent_);
~rlc_am_rx(); ~rlc_am_rx();
bool configure(srslte_rlc_am_config_t cfg_); bool configure(rlc_am_config_t cfg_);
void reestablish(); void reestablish();
void stop(); void stop();
@ -237,7 +237,7 @@ private:
* Configurable parameters * Configurable parameters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7 * Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/ ***************************************************************************/
srslte_rlc_am_config_t cfg = {}; rlc_am_config_t cfg = {};
// RX SDU buffers // RX SDU buffers
unique_byte_buffer_t rx_sdu; unique_byte_buffer_t rx_sdu;
@ -282,7 +282,7 @@ private:
srsue::pdcp_interface_rlc* pdcp = nullptr; srsue::pdcp_interface_rlc* pdcp = nullptr;
mac_interface_timers* mac_timers = nullptr; mac_interface_timers* mac_timers = nullptr;
uint32_t lcid = 0; uint32_t lcid = 0;
srslte_rlc_config_t cfg = {}; rlc_config_t cfg = {};
bool has_configuration = false; bool has_configuration = false;
std::string rb_name; std::string rb_name;

@ -22,8 +22,6 @@
#ifndef SRSLTE_RLC_COMMON_H #ifndef SRSLTE_RLC_COMMON_H
#define SRSLTE_RLC_COMMON_H #define SRSLTE_RLC_COMMON_H
#include "srslte/upper/rlc_interface.h"
namespace srslte { namespace srslte {
/**************************************************************************** /****************************************************************************
@ -143,7 +141,7 @@ public:
const static int RLC_BUFFER_NOF_PDU = 128; const static int RLC_BUFFER_NOF_PDU = 128;
virtual ~rlc_common() {} virtual ~rlc_common() {}
virtual bool configure(srslte_rlc_config_t cnfg) = 0; virtual bool configure(rlc_config_t cnfg) = 0;
virtual bool resume() = 0; virtual bool resume() = 0;
virtual void stop() = 0; virtual void stop() = 0;
virtual void reestablish() = 0; virtual void reestablish() = 0;

@ -1,110 +0,0 @@
/*
* Copyright 2013-2019 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_RLC_INTERFACE_H
#define SRSLTE_RLC_INTERFACE_H
#define RLC_TX_QUEUE_LEN (128)
namespace srslte {
typedef enum{
RLC_MODE_TM = 0,
RLC_MODE_UM,
RLC_MODE_AM,
RLC_MODE_N_ITEMS,
}rlc_mode_t;
static const char rlc_mode_text[RLC_MODE_N_ITEMS][20] = {"Transparent Mode",
"Unacknowledged Mode",
"Acknowledged Mode"};
typedef enum {
RLC_UMD_SN_SIZE_5_BITS = 0,
RLC_UMD_SN_SIZE_10_BITS,
RLC_UMD_SN_SIZE_N_ITEMS,
} rlc_umd_sn_size_t;
static const char rlc_umd_sn_size_text[RLC_UMD_SN_SIZE_N_ITEMS][20] = {"5 bits", "10 bits"};
static const uint16_t rlc_umd_sn_size_num[RLC_UMD_SN_SIZE_N_ITEMS] = {5, 10};
typedef struct {
/****************************************************************************
* Configurable parameters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
// TX configs
int32_t t_poll_retx; // Poll retx timeout (ms)
int32_t poll_pdu; // Insert poll bit after this many PDUs
int32_t poll_byte; // Insert poll bit after this much data (KB)
uint32_t max_retx_thresh; // Max number of retx
// RX configs
int32_t t_reordering; // Timer used by rx to detect PDU loss (ms)
int32_t t_status_prohibit; // Timer used by rx to prohibit tx of status PDU (ms)
} srslte_rlc_am_config_t;
typedef struct {
/****************************************************************************
* Configurable parameters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
int32_t t_reordering; // Timer used by rx to detect PDU loss (ms)
rlc_umd_sn_size_t tx_sn_field_length; // Number of bits used for tx (UL) sequence number
rlc_umd_sn_size_t rx_sn_field_length; // Number of bits used for rx (DL) sequence number
uint32_t rx_window_size;
uint32_t rx_mod; // Rx counter modulus
uint32_t tx_mod; // Tx counter modulus
bool is_mrb; // Whether this is a multicast bearer
} srslte_rlc_um_config_t;
class srslte_rlc_config_t
{
public:
rlc_mode_t rlc_mode;
srslte_rlc_am_config_t am;
srslte_rlc_um_config_t um;
uint32_t tx_queue_length;
// Default ctor
srslte_rlc_config_t() : rlc_mode(RLC_MODE_TM), am(), um(), tx_queue_length(RLC_TX_QUEUE_LEN){};
// Factory for MCH
static srslte_rlc_config_t mch_config()
{
srslte_rlc_config_t cfg;
cfg.rlc_mode = RLC_MODE_UM;
cfg.um.t_reordering = 45;
cfg.um.rx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS;
cfg.um.rx_window_size = 16;
cfg.um.rx_mod = 32;
cfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS;
cfg.um.tx_mod = 32;
cfg.um.is_mrb = true;
cfg.tx_queue_length = 1024;
return cfg;
}
};
} // namespace srslte
#endif // SRSLTE_RLC_INTERFACE_H

@ -41,7 +41,7 @@ public:
srslte::mac_interface_timers* mac_timers_, srslte::mac_interface_timers* mac_timers_,
uint32_t queue_len = 16); uint32_t queue_len = 16);
~rlc_tm(); ~rlc_tm();
bool configure(srslte_rlc_config_t cnfg); bool configure(rlc_config_t cnfg);
bool resume(); bool resume();
void stop(); void stop();
void reestablish(); void reestablish();

@ -49,7 +49,7 @@ public:
srsue::rrc_interface_rlc* rrc_, srsue::rrc_interface_rlc* rrc_,
mac_interface_timers* mac_timers_); mac_interface_timers* mac_timers_);
~rlc_um(); ~rlc_um();
bool configure(srslte_rlc_config_t cnfg); bool configure(rlc_config_t cnfg);
bool resume(); bool resume();
void reestablish(); void reestablish();
void stop(); void stop();
@ -81,7 +81,7 @@ private:
public: public:
rlc_um_tx(srslte::log* log_); rlc_um_tx(srslte::log* log_);
~rlc_um_tx(); ~rlc_um_tx();
bool configure(srslte_rlc_config_t cfg, std::string rb_name); bool configure(rlc_config_t cfg, std::string rb_name);
int build_data_pdu(uint8_t *payload, uint32_t nof_bytes); int build_data_pdu(uint8_t *payload, uint32_t nof_bytes);
void stop(); void stop();
void reestablish(); void reestablish();
@ -102,7 +102,7 @@ private:
* Configurable parameters * Configurable parameters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7 * Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/ ***************************************************************************/
srslte_rlc_um_config_t cfg = {}; rlc_um_config_t cfg = {};
// TX SDU buffers // TX SDU buffers
rlc_tx_queue tx_sdu_queue; rlc_tx_queue tx_sdu_queue;
@ -137,7 +137,7 @@ private:
~rlc_um_rx(); ~rlc_um_rx();
void stop(); void stop();
void reestablish(); void reestablish();
bool configure(srslte_rlc_config_t cfg, std::string rb_name); bool configure(rlc_config_t cfg, std::string rb_name);
void handle_data_pdu(uint8_t *payload, uint32_t nof_bytes); void handle_data_pdu(uint8_t *payload, uint32_t nof_bytes);
void reassemble_rx_sdus(); void reassemble_rx_sdus();
bool pdu_belongs_to_rx_sdu(); bool pdu_belongs_to_rx_sdu();
@ -160,7 +160,7 @@ private:
* Configurable parameters * Configurable parameters
* Ref: 3GPP TS 36.322 v10.0.0 Section 7 * Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/ ***************************************************************************/
srslte_rlc_um_config_t cfg = {}; rlc_um_config_t cfg = {};
// Rx window // Rx window
std::map<uint32_t, rlc_umd_pdu_t> rx_window; std::map<uint32_t, rlc_umd_pdu_t> rx_window;
@ -203,7 +203,7 @@ private:
srsue::rrc_interface_rlc* rrc = nullptr; srsue::rrc_interface_rlc* rrc = nullptr;
srslte::log* log = nullptr; srslte::log* log = nullptr;
uint32_t lcid = 0; uint32_t lcid = 0;
srslte_rlc_config_t cfg = {}; rlc_config_t cfg = {};
bool has_configuration = false; bool has_configuration = false;
std::string rb_name; std::string rb_name;
byte_buffer_pool* pool = nullptr; byte_buffer_pool* pool = nullptr;

@ -21,167 +21,138 @@
#include "srslte/asn1/rrc_asn1_utils.h" #include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/asn1/rrc_asn1.h" #include "srslte/asn1/rrc_asn1.h"
#include "srslte/common/bcd_helpers.h"
#include "srslte/config.h" #include "srslte/config.h"
#include "srslte/upper/rlc_interface.h"
#include <algorithm> #include <algorithm>
namespace srslte { namespace srslte {
/***************************
* PLMN ID
**************************/
bool plmn_is_valid(const asn1::rrc::plmn_id_s& asn1_type) bool plmn_is_valid(const asn1::rrc::plmn_id_s& asn1_type)
{ {
return asn1_type.mcc_present and (asn1_type.mnc.size() == 3 or asn1_type.mnc.size() == 2); return asn1_type.mcc_present and (asn1_type.mnc.size() == 3 or asn1_type.mnc.size() == 2);
} }
plmn_id_t::plmn_id_t(const asn1::rrc::plmn_id_s& asn1_type) plmn_id_t make_plmn_id_t(const asn1::rrc::plmn_id_s& asn1_type)
{
from_asn1(asn1_type);
}
void plmn_id_t::reset()
{
nof_mnc_digits = 2;
std::fill(&mnc[0], &mnc[3], 3);
std::fill(&mcc[0], &mcc[3], 3);
}
int plmn_id_t::from_asn1(const asn1::rrc::plmn_id_s& asn1_type)
{ {
if (not plmn_is_valid(asn1_type)) { if (not plmn_is_valid(asn1_type)) {
reset(); return {};
return SRSLTE_ERROR;
} }
std::copy(&asn1_type.mcc[0], &asn1_type.mcc[3], &mcc[0]); plmn_id_t plmn;
nof_mnc_digits = asn1_type.mnc.size(); std::copy(&asn1_type.mcc[0], &asn1_type.mcc[3], &plmn.mcc[0]);
std::copy(&asn1_type.mnc[0], &asn1_type.mnc[nof_mnc_digits], &mnc[0]); plmn.nof_mnc_digits = asn1_type.mnc.size();
std::copy(&asn1_type.mnc[0], &asn1_type.mnc[plmn.nof_mnc_digits], &plmn.mnc[0]);
return SRSLTE_SUCCESS; return plmn;
} }
int plmn_id_t::to_asn1(asn1::rrc::plmn_id_s* asn1_type) const void to_asn1(asn1::rrc::plmn_id_s* asn1_type, const plmn_id_t& cfg)
{ {
asn1_type->mcc_present = true; asn1_type->mcc_present = true;
std::copy(&mcc[0], &mcc[3], &asn1_type->mcc[0]); std::copy(&cfg.mcc[0], &cfg.mcc[3], &asn1_type->mcc[0]);
asn1_type->mnc.resize(nof_mnc_digits); asn1_type->mnc.resize(cfg.nof_mnc_digits);
std::copy(&mnc[0], &mnc[nof_mnc_digits], &asn1_type->mnc[0]); std::copy(&cfg.mnc[0], &cfg.mnc[cfg.nof_mnc_digits], &asn1_type->mnc[0]);
return SRSLTE_SUCCESS;
} }
int plmn_id_t::from_number(uint16_t mcc_num, uint16_t mnc_num) /***************************
{ * s-TMSI
srslte::mcc_to_bytes(mcc_num, &mcc[0]); **************************/
if (not srslte::mnc_to_bytes(mnc_num, &mnc[0], &nof_mnc_digits)) {
reset();
return SRSLTE_ERROR;
}
return SRSLTE_SUCCESS;
}
int plmn_id_t::from_string(const std::string& plmn_str) s_tmsi_t make_s_tmsi_t(const asn1::rrc::s_tmsi_s& asn1_type)
{ {
if (plmn_str.size() < 5 or plmn_str.size() > 6) { s_tmsi_t tmsi;
reset(); tmsi.mmec = asn1_type.mmec.to_number();
return SRSLTE_ERROR; tmsi.m_tmsi = asn1_type.m_tmsi.to_number();
} return tmsi;
uint16_t mnc_num, mcc_num;
if (not string_to_mcc(std::string(plmn_str.begin(), plmn_str.begin() + 3), &mcc_num)) {
reset();
return SRSLTE_ERROR;
}
if (not string_to_mnc(std::string(plmn_str.begin() + 3, plmn_str.end()), &mnc_num)) {
reset();
return SRSLTE_ERROR;
}
if (not mcc_to_bytes(mcc_num, &mcc[0])) {
reset();
return SRSLTE_ERROR;
}
return mnc_to_bytes(mnc_num, &mnc[0], &nof_mnc_digits) ? SRSLTE_SUCCESS : SRSLTE_ERROR;
} }
std::string plmn_id_t::to_string() const void to_asn1(asn1::rrc::s_tmsi_s* asn1_type, const s_tmsi_t& cfg)
{ {
std::string mcc_str, mnc_str; asn1_type->mmec.from_number(cfg.mmec);
uint16_t mnc_num, mcc_num; asn1_type->m_tmsi.from_number(cfg.m_tmsi);
bytes_to_mnc(&mnc[0], &mnc_num, nof_mnc_digits);
bytes_to_mcc(&mcc[0], &mcc_num);
mnc_to_string(mnc_num, &mnc_str);
mcc_to_string(mcc_num, &mcc_str);
return mcc_str + mnc_str;
} }
bool plmn_id_t::operator==(const plmn_id_t& other) /***************************
{ * Establishment Cause
return std::equal(&mcc[0], &mcc[3], &other.mcc[0]) and nof_mnc_digits == other.nof_mnc_digits and **************************/
std::equal(&mnc[0], &mnc[nof_mnc_digits], &other.mnc[0]);
}
s_tmsi_t::s_tmsi_t(const asn1::rrc::s_tmsi_s& asn1_type) static_assert((int)establishment_cause_t::nulltype == (int)asn1::rrc::establishment_cause_opts::nulltype,
{ "Failed conversion of ASN1 type");
from_asn1(asn1_type);
}
void s_tmsi_t::from_asn1(const asn1::rrc::s_tmsi_s& asn1_type) /***************************
{ * RLC Config
mmec = asn1_type.mmec.to_number(); **************************/
m_tmsi = asn1_type.m_tmsi.to_number();
}
void s_tmsi_t::to_asn1(asn1::rrc::s_tmsi_s* asn1_type) const srslte::rlc_config_t make_rlc_config_t(const asn1::rrc::rlc_cfg_c& asn1_type)
{ {
asn1_type->mmec.from_number(mmec); srslte::rlc_config_t rlc_cfg;
asn1_type->m_tmsi.from_number(m_tmsi); switch (asn1_type.type().value) {
case asn1::rrc::rlc_cfg_c::types_opts::am:
rlc_cfg.rlc_mode = rlc_mode_t::am;
rlc_cfg.am.t_poll_retx = asn1_type.am().ul_am_rlc.t_poll_retx.to_number();
rlc_cfg.am.poll_pdu = asn1_type.am().ul_am_rlc.poll_pdu.to_number();
rlc_cfg.am.poll_byte = asn1_type.am().ul_am_rlc.poll_byte.to_number() * 1000; // KB
rlc_cfg.am.max_retx_thresh = asn1_type.am().ul_am_rlc.max_retx_thres.to_number();
rlc_cfg.am.t_reordering = asn1_type.am().dl_am_rlc.t_reordering.to_number();
rlc_cfg.am.t_status_prohibit = asn1_type.am().dl_am_rlc.t_status_prohibit.to_number();
break;
case asn1::rrc::rlc_cfg_c::types_opts::um_bi_dir:
case asn1::rrc::rlc_cfg_c::types_opts::um_uni_dir_dl:
case asn1::rrc::rlc_cfg_c::types_opts::um_uni_dir_ul:
rlc_cfg.rlc_mode = rlc_mode_t::um;
rlc_cfg.um.t_reordering = asn1_type.um_bi_dir().dl_um_rlc.t_reordering.to_number();
rlc_cfg.um.rx_sn_field_length = (rlc_umd_sn_size_t)asn1_type.um_bi_dir().dl_um_rlc.sn_field_len.value;
rlc_cfg.um.rx_window_size = (rlc_cfg.um.rx_sn_field_length == rlc_umd_sn_size_t::size5bits) ? 16 : 512;
rlc_cfg.um.rx_mod = (rlc_cfg.um.rx_sn_field_length == rlc_umd_sn_size_t::size5bits) ? 32 : 1024;
rlc_cfg.um.tx_sn_field_length = (rlc_umd_sn_size_t)asn1_type.um_bi_dir().ul_um_rlc.sn_field_len.value;
rlc_cfg.um.tx_mod = (rlc_cfg.um.tx_sn_field_length == rlc_umd_sn_size_t::size5bits) ? 32 : 1024;
break;
default:
break;
}
return rlc_cfg;
} }
static_assert((int)establishment_cause_t::nulltype == (int)asn1::rrc::establishment_cause_opts::nulltype, srslte::rlc_config_t make_rlc_config_t(const asn1::rrc::srb_to_add_mod_s& asn1_type)
"Failed conversion of ASN1 type");
std::string to_string(const establishment_cause_t& cause)
{ {
asn1::rrc::establishment_cause_e asn1_cause((asn1::rrc::establishment_cause_opts::options)cause); if (asn1_type.rlc_cfg.type().value == asn1::rrc::srb_to_add_mod_s::rlc_cfg_c_::types_opts::explicit_value) {
return asn1_cause.to_string(); return make_rlc_config_t(asn1_type.rlc_cfg.explicit_value());
}
if (asn1_type.srb_id <= 2) {
return rlc_config_t::srb_config(asn1_type.srb_id);
} else {
asn1::rrc::rrc_log_print(
asn1::LOG_LEVEL_ERROR, "SRB %d does not support default initialization type\n", asn1_type.srb_id);
}
} }
void convert_from_asn1(srslte_rlc_config_t* out, const asn1::rrc::rlc_cfg_c& asn1_type) void to_asn1(asn1::rrc::rlc_cfg_c* asn1_type, const srslte::rlc_config_t& cfg)
{ {
out->am = srslte_rlc_am_config_t(); *asn1_type = asn1::rrc::rlc_cfg_c();
out->um = srslte_rlc_um_config_t(); switch (cfg.rlc_mode) {
case rlc_mode_t::um:
// update RLC mode to internal mode struct asn1_type->set_um_bi_dir();
out->rlc_mode = (asn1_type.type() == asn1::rrc::rlc_cfg_c::types::am) ? RLC_MODE_AM : RLC_MODE_UM; asn1::number_to_enum(asn1_type->um_bi_dir().dl_um_rlc.t_reordering, cfg.um.t_reordering);
asn1_type->um_bi_dir().dl_um_rlc.sn_field_len.value =
switch (out->rlc_mode) { (asn1::rrc::sn_field_len_opts::options)cfg.um.rx_sn_field_length;
case RLC_MODE_AM: asn1_type->um_bi_dir().ul_um_rlc.sn_field_len.value =
out->am.t_poll_retx = asn1_type.am().ul_am_rlc.t_poll_retx.to_number(); (asn1::rrc::sn_field_len_opts::options)cfg.um.tx_sn_field_length;
out->am.poll_pdu = asn1_type.am().ul_am_rlc.poll_pdu.to_number(); case rlc_mode_t::am:
out->am.poll_byte = asn1_type.am().ul_am_rlc.poll_byte.to_number() * 1000; // KB asn1_type->set_am();
out->am.max_retx_thresh = asn1_type.am().ul_am_rlc.max_retx_thres.to_number(); asn1::number_to_enum(asn1_type->am().ul_am_rlc.t_poll_retx, cfg.am.t_poll_retx);
out->am.t_reordering = asn1_type.am().dl_am_rlc.t_reordering.to_number(); asn1::number_to_enum(asn1_type->am().ul_am_rlc.poll_pdu, cfg.am.poll_pdu);
out->am.t_status_prohibit = asn1_type.am().dl_am_rlc.t_status_prohibit.to_number(); asn1::number_to_enum(asn1_type->am().ul_am_rlc.poll_byte, cfg.am.poll_byte / 1000);
break; asn1::number_to_enum(asn1_type->am().ul_am_rlc.max_retx_thres, cfg.am.max_retx_thresh);
case RLC_MODE_UM: asn1::number_to_enum(asn1_type->am().dl_am_rlc.t_reordering, cfg.am.t_reordering);
out->um.t_reordering = asn1_type.um_bi_dir().dl_um_rlc.t_reordering.to_number(); asn1::number_to_enum(asn1_type->am().dl_am_rlc.t_status_prohibit, cfg.am.t_status_prohibit);
out->um.rx_sn_field_length = (rlc_umd_sn_size_t)asn1_type.um_bi_dir().dl_um_rlc.sn_field_len.value;
out->um.rx_window_size = (RLC_UMD_SN_SIZE_5_BITS == out->um.rx_sn_field_length) ? 16 : 512;
out->um.rx_mod = (RLC_UMD_SN_SIZE_5_BITS == out->um.rx_sn_field_length) ? 32 : 1024;
out->um.tx_sn_field_length = (rlc_umd_sn_size_t)asn1_type.um_bi_dir().ul_um_rlc.sn_field_len.value;
out->um.tx_mod = (RLC_UMD_SN_SIZE_5_BITS == out->um.tx_sn_field_length) ? 32 : 1024;
break; break;
// case asn1::rrc::rlc_cfg_c::types::um_uni_dir_ul:
// um.tx_sn_field_length = (rlc_umd_sn_size_t)cnfg->um_uni_dir_ul().ul_um_rlc.sn_field_len.value;
// um.tx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.tx_sn_field_length) ? 32 : 1024;
// break;
// case asn1::rrc::rlc_cfg_c::types::um_uni_dir_dl:
// um.t_reordering = cnfg->um_uni_dir_dl().dl_um_rlc.t_reordering.to_number();
// um.rx_sn_field_length = (rlc_umd_sn_size_t)cnfg->um_uni_dir_dl().dl_um_rlc.sn_field_len.value;
// um.rx_window_size = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 16 : 512;
// um.rx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 32 : 1024;
// break;
default: default:
// Handle default case // stays TM
break; break;
} }
out->tx_queue_length = RLC_TX_QUEUE_LEN;
} }
} // namespace } // namespace srslte

@ -65,7 +65,7 @@ void rlc::init(srsue::pdcp_interface_rlc* pdcp_,
reset_metrics(); reset_metrics();
// create default RLC_TM bearer for SRB0 // create default RLC_TM bearer for SRB0
add_bearer(default_lcid, srslte_rlc_config_t()); add_bearer(default_lcid, rlc_config_t());
} }
void rlc::reset_metrics() void rlc::reset_metrics()
@ -171,7 +171,7 @@ void rlc::reset()
pthread_rwlock_unlock(&rwlock); pthread_rwlock_unlock(&rwlock);
// Add SRB0 again // Add SRB0 again
add_bearer(default_lcid, srslte_rlc_config_t()); add_bearer(default_lcid, rlc_config_t());
} }
void rlc::empty_queue() void rlc::empty_queue()
@ -223,7 +223,7 @@ bool rlc::rb_is_um(uint32_t lcid)
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
if (valid_lcid(lcid)) { if (valid_lcid(lcid)) {
ret = rlc_array.at(lcid)->get_mode() == RLC_MODE_UM; ret = rlc_array.at(lcid)->get_mode() == rlc_mode_t::um;
} else { } else {
rlc_log->warning("LCID %d doesn't exist.\n", lcid); rlc_log->warning("LCID %d doesn't exist.\n", lcid);
} }
@ -374,34 +374,7 @@ void rlc::write_pdu_mch(uint32_t lcid, uint8_t *payload, uint32_t nof_bytes)
RRC interface RRC interface
*******************************************************************************/ *******************************************************************************/
// FIXME: Remove function to forbid implicit configuration void rlc::add_bearer(uint32_t lcid, rlc_config_t cnfg)
void rlc::add_bearer(uint32_t lcid)
{
if (lcid > 2) {
rlc_log->error("Radio bearer %s does not support default RLC configuration.\n", rrc->get_rb_name(lcid).c_str());
return;
}
// No config provided - use defaults for SRB0, SRB1, and SRB2
if (lcid == 0) {
// SRB0 is TM
add_bearer(lcid, srslte_rlc_config_t());
} else {
// SRB1 and SRB2 are AM
srslte_rlc_config_t rlc_cfg;
rlc_cfg.rlc_mode = RLC_MODE_AM;
rlc_cfg.am.t_poll_retx = 45;
rlc_cfg.am.poll_pdu = -1;
rlc_cfg.am.poll_byte = -1;
rlc_cfg.am.max_retx_thresh = 4;
rlc_cfg.am.t_reordering = 35;
rlc_cfg.am.t_status_prohibit = 0;
add_bearer(lcid, rlc_cfg);
}
}
void rlc::add_bearer(uint32_t lcid, srslte_rlc_config_t cnfg)
{ {
pthread_rwlock_wrlock(&rwlock); pthread_rwlock_wrlock(&rwlock);
@ -410,13 +383,13 @@ void rlc::add_bearer(uint32_t lcid, srslte_rlc_config_t cnfg)
if (not valid_lcid(lcid)) { if (not valid_lcid(lcid)) {
switch(cnfg.rlc_mode) switch(cnfg.rlc_mode)
{ {
case RLC_MODE_TM: case rlc_mode_t::tm:
rlc_entity = new rlc_tm(rlc_log, lcid, pdcp, rrc, mac_timers); rlc_entity = new rlc_tm(rlc_log, lcid, pdcp, rrc, mac_timers);
break; break;
case RLC_MODE_AM: case rlc_mode_t::am:
rlc_entity = new rlc_am(rlc_log, lcid, pdcp, rrc, mac_timers); rlc_entity = new rlc_am(rlc_log, lcid, pdcp, rrc, mac_timers);
break; break;
case RLC_MODE_UM: case rlc_mode_t::um:
rlc_entity = new rlc_um(rlc_log, lcid, pdcp, rrc, mac_timers); rlc_entity = new rlc_um(rlc_log, lcid, pdcp, rrc, mac_timers);
break; break;
default: default:
@ -425,8 +398,8 @@ void rlc::add_bearer(uint32_t lcid, srslte_rlc_config_t cnfg)
} }
// configure and add to array // configure and add to array
if (cnfg.rlc_mode != RLC_MODE_TM) { if (cnfg.rlc_mode != rlc_mode_t::tm) {
if (rlc_entity->configure(cnfg) == false) { if (not rlc_entity->configure(cnfg)) {
rlc_log->error("Error configuring RLC entity\n."); rlc_log->error("Error configuring RLC entity\n.");
goto delete_and_exit; goto delete_and_exit;
} }
@ -436,7 +409,7 @@ void rlc::add_bearer(uint32_t lcid, srslte_rlc_config_t cnfg)
rlc_log->error("Error inserting RLC entity in to array\n."); rlc_log->error("Error inserting RLC entity in to array\n.");
goto delete_and_exit; goto delete_and_exit;
} }
rlc_log->info("Added radio bearer %s in %s\n", rrc->get_rb_name(lcid).c_str(), rlc_mode_text[cnfg.rlc_mode]); rlc_log->info("Added radio bearer %s in %s\n", rrc->get_rb_name(lcid).c_str(), to_string(cnfg.rlc_mode).c_str());
goto unlock_and_exit; goto unlock_and_exit;
} else { } else {
rlc_log->warning("Bearer %s already created.\n", rrc->get_rb_name(lcid).c_str()); rlc_log->warning("Bearer %s already created.\n", rrc->get_rb_name(lcid).c_str());
@ -460,7 +433,7 @@ void rlc::add_bearer_mrb(uint32_t lcid)
if (not valid_lcid_mrb(lcid)) { if (not valid_lcid_mrb(lcid)) {
rlc_entity = new rlc_um(rlc_log, lcid, pdcp, rrc, mac_timers); rlc_entity = new rlc_um(rlc_log, lcid, pdcp, rrc, mac_timers);
// configure and add to array // configure and add to array
if (not rlc_entity->configure(srslte_rlc_config_t::mch_config())) { if (not rlc_entity->configure(rlc_config_t::mch_config())) {
rlc_log->error("Error configuring RLC entity\n."); rlc_log->error("Error configuring RLC entity\n.");
goto delete_and_exit; goto delete_and_exit;
} }

@ -71,7 +71,7 @@ bool rlc_am::resume()
return true; return true;
} }
bool rlc_am::configure(srslte_rlc_config_t cfg_) bool rlc_am::configure(rlc_config_t cfg_)
{ {
// determine bearer name and configure Rx/Tx objects // determine bearer name and configure Rx/Tx objects
rb_name = rrc->get_rb_name(lcid); rb_name = rrc->get_rb_name(lcid);
@ -118,7 +118,7 @@ void rlc_am::stop()
rlc_mode_t rlc_am::get_mode() rlc_mode_t rlc_am::get_mode()
{ {
return RLC_MODE_AM; return rlc_mode_t::am;
} }
uint32_t rlc_am::get_bearer() uint32_t rlc_am::get_bearer()
@ -204,7 +204,7 @@ rlc_am::rlc_am_tx::~rlc_am_tx()
pthread_mutex_destroy(&mutex); pthread_mutex_destroy(&mutex);
} }
bool rlc_am::rlc_am_tx::configure(srslte_rlc_config_t cfg_) bool rlc_am::rlc_am_tx::configure(rlc_config_t cfg_)
{ {
// TODO: add config checks // TODO: add config checks
cfg = cfg_.am; cfg = cfg_.am;
@ -1152,7 +1152,7 @@ rlc_am::rlc_am_rx::~rlc_am_rx()
pthread_mutex_destroy(&mutex); pthread_mutex_destroy(&mutex);
} }
bool rlc_am::rlc_am_rx::configure(srslte_rlc_am_config_t cfg_) bool rlc_am::rlc_am_rx::configure(rlc_am_config_t cfg_)
{ {
// TODO: add config checks // TODO: add config checks
cfg = cfg_; cfg = cfg_;

@ -43,7 +43,7 @@ rlc_tm::~rlc_tm() {
pool = NULL; pool = NULL;
} }
bool rlc_tm::configure(srslte_rlc_config_t cnfg) bool rlc_tm::configure(rlc_config_t cnfg)
{ {
log->error("Attempted to configure TM RLC entity\n"); log->error("Attempted to configure TM RLC entity\n");
return true; return true;
@ -76,7 +76,7 @@ void rlc_tm::stop()
rlc_mode_t rlc_tm::get_mode() rlc_mode_t rlc_tm::get_mode()
{ {
return RLC_MODE_TM; return rlc_mode_t::tm;
} }
uint32_t rlc_tm::get_bearer() uint32_t rlc_tm::get_bearer()
@ -160,8 +160,13 @@ int rlc_tm::read_pdu(uint8_t *payload, uint32_t nof_bytes)
memcpy(payload, buf->msg, buf->N_bytes); memcpy(payload, buf->msg, buf->N_bytes);
log->debug("%s Complete SDU scheduled for tx. Stack latency: %ld us\n", log->debug("%s Complete SDU scheduled for tx. Stack latency: %ld us\n",
rrc->get_rb_name(lcid).c_str(), buf->get_latency_us()); rrc->get_rb_name(lcid).c_str(), buf->get_latency_us());
log->info_hex(payload, pdu_size, "TX %s, %s PDU, queue size=%d, bytes=%d", log->info_hex(payload,
rrc->get_rb_name(lcid).c_str(), rlc_mode_text[RLC_MODE_TM], ul_queue.size(), ul_queue.size_bytes()); pdu_size,
"TX %s, %s PDU, queue size=%d, bytes=%d",
rrc->get_rb_name(lcid).c_str(),
srslte::to_string(rlc_mode_t::tm).c_str(),
ul_queue.size(),
ul_queue.size_bytes());
num_tx_bytes += pdu_size; num_tx_bytes += pdu_size;
return pdu_size; return pdu_size;

@ -21,7 +21,6 @@
#include "srslte/upper/rlc_um.h" #include "srslte/upper/rlc_um.h"
#include <sstream> #include <sstream>
#include <srslte/upper/rlc_interface.h>
#define RX_MOD_BASE(x) (((x)-vr_uh-cfg.rx_window_size)%cfg.rx_mod) #define RX_MOD_BASE(x) (((x)-vr_uh-cfg.rx_window_size)%cfg.rx_mod)
@ -67,7 +66,7 @@ bool rlc_um::resume()
return true; return true;
} }
bool rlc_um::configure(srslte_rlc_config_t cnfg_) bool rlc_um::configure(rlc_config_t cnfg_)
{ {
// determine bearer name and configure Rx/Tx objects // determine bearer name and configure Rx/Tx objects
rb_name = get_rb_name(rrc, lcid, cnfg_.um.is_mrb); rb_name = get_rb_name(rrc, lcid, cnfg_.um.is_mrb);
@ -79,18 +78,17 @@ bool rlc_um::configure(srslte_rlc_config_t cnfg_)
if (resume()) { if (resume()) {
log->info("%s configured in %s: t_reordering=%d ms, rx_sn_field_length=%u bits, tx_sn_field_length=%u bits\n", log->info("%s configured in %s: t_reordering=%d ms, rx_sn_field_length=%u bits, tx_sn_field_length=%u bits\n",
rb_name.c_str(), rb_name.c_str(),
rlc_mode_text[cnfg_.rlc_mode], srslte::to_string(cnfg_.rlc_mode).c_str(),
cfg.um.t_reordering, cfg.um.t_reordering,
rlc_umd_sn_size_num[cfg.um.rx_sn_field_length], srslte::to_number(cfg.um.rx_sn_field_length),
rlc_umd_sn_size_num[cfg.um.rx_sn_field_length]); srslte::to_number(cfg.um.tx_sn_field_length));
return true; return true;
} else { } else {
return false; return false;
} }
} }
bool rlc_um::rlc_um_rx::configure(rlc_config_t cnfg_, std::string rb_name_)
bool rlc_um::rlc_um_rx::configure(srslte_rlc_config_t cnfg_, std::string rb_name_)
{ {
cfg = cnfg_.um; cfg = cnfg_.um;
@ -140,7 +138,7 @@ void rlc_um::stop()
rlc_mode_t rlc_um::get_mode() rlc_mode_t rlc_um::get_mode()
{ {
return RLC_MODE_UM; return rlc_mode_t::um;
} }
uint32_t rlc_um::get_bearer() uint32_t rlc_um::get_bearer()
@ -232,8 +230,7 @@ rlc_um::rlc_um_tx::~rlc_um_tx()
pthread_mutex_destroy(&mutex); pthread_mutex_destroy(&mutex);
} }
bool rlc_um::rlc_um_tx::configure(rlc_config_t cnfg_, std::string rb_name_)
bool rlc_um::rlc_um_tx::configure(srslte_rlc_config_t cnfg_, std::string rb_name_)
{ {
cfg = cnfg_.um; cfg = cnfg_.um;
@ -981,8 +978,7 @@ void rlc_um_read_data_pdu_header(uint8_t *payload, uint32_t nof_bytes, rlc_umd_s
uint8_t ext; uint8_t ext;
uint8_t *ptr = payload; uint8_t *ptr = payload;
// Fixed part // Fixed part
if(RLC_UMD_SN_SIZE_5_BITS == sn_size) if (sn_size == rlc_umd_sn_size_t::size5bits) {
{
header->fi = (rlc_fi_field_t)((*ptr >> 6) & 0x03); // 2 bits FI header->fi = (rlc_fi_field_t)((*ptr >> 6) & 0x03); // 2 bits FI
ext = ((*ptr >> 5) & 0x01); // 1 bit EXT ext = ((*ptr >> 5) & 0x01); // 1 bit EXT
header->sn = *ptr & 0x1F; // 5 bits SN header->sn = *ptr & 0x1F; // 5 bits SN
@ -1032,8 +1028,7 @@ void rlc_um_write_data_pdu_header(rlc_umd_pdu_header_t* header, byte_buffer_t* p
uint8_t *ptr = pdu->msg; uint8_t *ptr = pdu->msg;
// Fixed part // Fixed part
if(RLC_UMD_SN_SIZE_5_BITS == header->sn_size) if (header->sn_size == rlc_umd_sn_size_t::size5bits) {
{
*ptr = (header->fi & 0x03) << 6; // 2 bits FI *ptr = (header->fi & 0x03) << 6; // 2 bits FI
*ptr |= (ext & 0x01) << 5; // 1 bit EXT *ptr |= (ext & 0x01) << 5; // 1 bit EXT
*ptr |= header->sn & 0x1F; // 5 bits SN *ptr |= header->sn & 0x1F; // 5 bits SN
@ -1078,8 +1073,7 @@ void rlc_um_write_data_pdu_header(rlc_umd_pdu_header_t* header, byte_buffer_t* p
uint32_t rlc_um_packed_length(rlc_umd_pdu_header_t *header) uint32_t rlc_um_packed_length(rlc_umd_pdu_header_t *header)
{ {
uint32_t len = 0; uint32_t len = 0;
if(RLC_UMD_SN_SIZE_5_BITS == header->sn_size) if (header->sn_size == rlc_umd_sn_size_t::size5bits) {
{
len += 1; // Fixed part is 1 byte len += 1; // Fixed part is 1 byte
}else{ }else{
len += 2; // Fixed part is 2 bytes len += 2; // Fixed part is 2 bytes

@ -23,6 +23,7 @@
#include "srslte/asn1/rrc_asn1_utils.h" #include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/log_filter.h" #include "srslte/common/log_filter.h"
#include "srslte/interfaces/rrc_interface_types.h"
#include <iostream> #include <iostream>
using namespace asn1::rrc; using namespace asn1::rrc;
@ -85,7 +86,7 @@ int basic_test()
.mbms_session_info_list_r9[0] .mbms_session_info_list_r9[0]
.tmgi_r9.plmn_id_r9.explicit_value_r9() .tmgi_r9.plmn_id_r9.explicit_value_r9()
.mcc_present); .mcc_present);
srslte::plmn_id_t plmn( srslte::plmn_id_t plmn = srslte::make_plmn_id_t(
area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9()); area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9());
TESTASSERT(plmn.to_string() == "987654"); TESTASSERT(plmn.to_string() == "987654");
TESTASSERT(area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.service_id_r9.to_string() == TESTASSERT(area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.service_id_r9.to_string() ==
@ -108,7 +109,8 @@ int basic_test()
.mbms_session_info_list_r9[0] .mbms_session_info_list_r9[0]
.tmgi_r9.plmn_id_r9.explicit_value_r9() .tmgi_r9.plmn_id_r9.explicit_value_r9()
.mcc_present); .mcc_present);
plmn.from_asn1(area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9()); plmn = srslte::make_plmn_id_t(
area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9());
TESTASSERT(plmn.to_string() == "987654"); TESTASSERT(plmn.to_string() == "987654");
TESTASSERT(area_cfg_r9->pmch_info_list_r9[1].mbms_session_info_list_r9[0].tmgi_r9.service_id_r9.to_string() == TESTASSERT(area_cfg_r9->pmch_info_list_r9[1].mbms_session_info_list_r9[0].tmgi_r9.service_id_r9.to_string() ==
"000002"); "000002");

@ -23,6 +23,7 @@
#include "srslte/asn1/rrc_asn1_utils.h" #include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/log_filter.h" #include "srslte/common/log_filter.h"
#include "srslte/interfaces/rrc_interface_types.h"
#include <iostream> #include <iostream>
#include <srslte/srslte.h> #include <srslte/srslte.h>
@ -76,7 +77,7 @@ int basic_test()
TESTASSERT(meas_list[0].cgi_info_present); TESTASSERT(meas_list[0].cgi_info_present);
TESTASSERT(meas_list[0].cgi_info.plmn_id_list_present); TESTASSERT(meas_list[0].cgi_info.plmn_id_list_present);
TESTASSERT(meas_list[0].cgi_info.cell_global_id.plmn_id.mcc_present); TESTASSERT(meas_list[0].cgi_info.cell_global_id.plmn_id.mcc_present);
srslte::plmn_id_t plmn(meas_list[0].cgi_info.cell_global_id.plmn_id); srslte::plmn_id_t plmn = srslte::make_plmn_id_t(meas_list[0].cgi_info.cell_global_id.plmn_id);
TESTASSERT(plmn.to_string() == "89878"); TESTASSERT(plmn.to_string() == "89878");
TESTASSERT(meas_list[0].cgi_info.cell_global_id.cell_id.to_number() == 0x1084104); TESTASSERT(meas_list[0].cgi_info.cell_global_id.cell_id.to_number() == 0x1084104);
TESTASSERT(meas_list[0].cgi_info.tac.to_number() == 0x1042); TESTASSERT(meas_list[0].cgi_info.tac.to_number() == 0x1042);

@ -129,10 +129,10 @@ private:
bool running; bool running;
}; };
srslte_rlc_config_t default_rlc_cnfg() rlc_config_t default_rlc_cnfg()
{ {
srslte_rlc_config_t rlc_cnfg; rlc_config_t rlc_cnfg;
rlc_cnfg.rlc_mode = RLC_MODE_AM; rlc_cnfg.rlc_mode = rlc_mode_t::am;
rlc_cnfg.am.t_reordering = 5; rlc_cnfg.am.t_reordering = 5;
rlc_cnfg.am.t_status_prohibit = 5; rlc_cnfg.am.t_status_prohibit = 5;
rlc_cnfg.am.max_retx_thresh = 4; rlc_cnfg.am.max_retx_thresh = 4;

@ -32,7 +32,6 @@
#include <iostream> #include <iostream>
#include <pthread.h> #include <pthread.h>
#include <random> #include <random>
#include <srslte/upper/rlc_interface.h>
#define LOG_HEX_LIMIT (-1) #define LOG_HEX_LIMIT (-1)
@ -328,10 +327,10 @@ void stress_test(stress_test_args_t args)
pcap.open("rlc_stress_test.pcap", 0); pcap.open("rlc_stress_test.pcap", 0);
} }
srslte_rlc_config_t cnfg_; rlc_config_t cnfg_;
if (args.mode == "AM") { if (args.mode == "AM") {
// config RLC AM bearer // config RLC AM bearer
cnfg_.rlc_mode = RLC_MODE_AM; cnfg_.rlc_mode = rlc_mode_t::am;
cnfg_.am.max_retx_thresh = 4; cnfg_.am.max_retx_thresh = 4;
cnfg_.am.poll_byte = 25*1000; cnfg_.am.poll_byte = 25*1000;
cnfg_.am.poll_pdu = 4; cnfg_.am.poll_pdu = 4;
@ -340,12 +339,12 @@ void stress_test(stress_test_args_t args)
cnfg_.am.t_status_prohibit = 5; cnfg_.am.t_status_prohibit = 5;
} else if (args.mode == "UM") { } else if (args.mode == "UM") {
// config UM bearer // config UM bearer
cnfg_.rlc_mode = RLC_MODE_UM; cnfg_.rlc_mode = rlc_mode_t::um;
cnfg_.um.t_reordering = 5; cnfg_.um.t_reordering = 5;
cnfg_.um.rx_mod = 32; cnfg_.um.rx_mod = 32;
cnfg_.um.rx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS; cnfg_.um.rx_sn_field_length = rlc_umd_sn_size_t::size5bits;
cnfg_.um.rx_window_size = 16; cnfg_.um.rx_window_size = 16;
cnfg_.um.tx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS; cnfg_.um.tx_sn_field_length = rlc_umd_sn_size_t::size5bits;
cnfg_.um.tx_mod = 32; cnfg_.um.tx_mod = 32;
} else if (args.mode == "TM") { } else if (args.mode == "TM") {
// use default LCID in TM // use default LCID in TM

@ -39,7 +39,7 @@ int main(int argc, char **argv) {
memcpy(b1.msg, &pdu1[0], PDU1_LEN); memcpy(b1.msg, &pdu1[0], PDU1_LEN);
b1.N_bytes = PDU1_LEN; b1.N_bytes = PDU1_LEN;
rlc_um_read_data_pdu_header(&b1, srslte::RLC_UMD_SN_SIZE_10_BITS, &h); rlc_um_read_data_pdu_header(&b1, srslte::rlc_umd_sn_size_t::size10bits, &h);
assert(0x03 == h.fi); assert(0x03 == h.fi);
assert(0 == h.N_li); assert(0 == h.N_li);
assert(226 == h.sn); assert(226 == h.sn);
@ -54,7 +54,7 @@ int main(int argc, char **argv) {
memcpy(b1.msg, &pdu2[0], PDU2_LEN); memcpy(b1.msg, &pdu2[0], PDU2_LEN);
b1.N_bytes = PDU2_LEN; b1.N_bytes = PDU2_LEN;
rlc_um_read_data_pdu_header(&b1, srslte::RLC_UMD_SN_SIZE_10_BITS, &h); rlc_um_read_data_pdu_header(&b1, srslte::rlc_umd_sn_size_t::size10bits, &h);
assert(0x03 == h.fi); assert(0x03 == h.fi);
assert(225 == h.sn); assert(225 == h.sn);
assert(1 == h.N_li); assert(1 == h.N_li);

@ -109,13 +109,13 @@ int basic_test()
rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc1(&log1, 3, &tester, &tester, &timers);
rlc_um rlc2(&log2, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers);
srslte_rlc_config_t cnfg; rlc_config_t cnfg;
cnfg.rlc_mode = RLC_MODE_UM; cnfg.rlc_mode = rlc_mode_t::um;
cnfg.um.t_reordering = 5; cnfg.um.t_reordering = 5;
cnfg.um.rx_sn_field_length = RLC_UMD_SN_SIZE_10_BITS; cnfg.um.rx_sn_field_length = rlc_umd_sn_size_t::size10bits;
cnfg.um.rx_window_size = 512; cnfg.um.rx_window_size = 512;
cnfg.um.rx_mod = 1024; cnfg.um.rx_mod = 1024;
cnfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_10_BITS; cnfg.um.tx_sn_field_length = rlc_umd_sn_size_t::size10bits;
cnfg.um.tx_mod = 1024; cnfg.um.tx_mod = 1024;
TESTASSERT(rlc1.configure(cnfg) == true); TESTASSERT(rlc1.configure(cnfg) == true);
@ -179,13 +179,13 @@ int loss_test()
rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc1(&log1, 3, &tester, &tester, &timers);
rlc_um rlc2(&log2, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers);
srslte_rlc_config_t cnfg; rlc_config_t cnfg;
cnfg.rlc_mode = RLC_MODE_UM; cnfg.rlc_mode = rlc_mode_t::um;
cnfg.um.t_reordering = 5; cnfg.um.t_reordering = 5;
cnfg.um.rx_sn_field_length = RLC_UMD_SN_SIZE_10_BITS; cnfg.um.rx_sn_field_length = rlc_umd_sn_size_t::size10bits;
cnfg.um.rx_window_size = 512; cnfg.um.rx_window_size = 512;
cnfg.um.rx_mod = 1024; cnfg.um.rx_mod = 1024;
cnfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_10_BITS; cnfg.um.tx_sn_field_length = rlc_umd_sn_size_t::size10bits;
cnfg.um.tx_mod = 1024; cnfg.um.tx_mod = 1024;
rlc1.configure(cnfg); rlc1.configure(cnfg);
@ -247,8 +247,8 @@ int basic_mbsfn_test()
rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc1(&log1, 3, &tester, &tester, &timers);
rlc_um rlc2(&log2, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers);
rlc1.configure(srslte_rlc_config_t::mch_config()); rlc1.configure(rlc_config_t::mch_config());
rlc2.configure(srslte_rlc_config_t::mch_config()); rlc2.configure(rlc_config_t::mch_config());
tester.set_expected_sdu_len(1); tester.set_expected_sdu_len(1);
@ -319,13 +319,13 @@ int reassmble_test()
rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc1(&log1, 3, &tester, &tester, &timers);
rlc_um rlc2(&log2, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers);
srslte_rlc_config_t cnfg; rlc_config_t cnfg;
cnfg.rlc_mode = RLC_MODE_UM; cnfg.rlc_mode = rlc_mode_t::um;
cnfg.um.t_reordering = 5; cnfg.um.t_reordering = 5;
cnfg.um.rx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS; cnfg.um.rx_sn_field_length = rlc_umd_sn_size_t::size5bits;
cnfg.um.rx_window_size = 16; cnfg.um.rx_window_size = 16;
cnfg.um.rx_mod = 32; cnfg.um.rx_mod = 32;
cnfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS; cnfg.um.tx_sn_field_length = rlc_umd_sn_size_t::size5bits;
cnfg.um.tx_mod = 32; cnfg.um.tx_mod = 32;
rlc1.configure(cnfg); rlc1.configure(cnfg);
@ -435,13 +435,13 @@ int reassmble_test2()
rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc1(&log1, 3, &tester, &tester, &timers);
rlc_um rlc2(&log2, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers);
srslte_rlc_config_t cnfg; rlc_config_t cnfg;
cnfg.rlc_mode = RLC_MODE_UM; cnfg.rlc_mode = rlc_mode_t::um;
cnfg.um.t_reordering = 5; cnfg.um.t_reordering = 5;
cnfg.um.rx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS; cnfg.um.rx_sn_field_length = rlc_umd_sn_size_t::size5bits;
cnfg.um.rx_window_size = 16; cnfg.um.rx_window_size = 16;
cnfg.um.rx_mod = 32; cnfg.um.rx_mod = 32;
cnfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS; cnfg.um.tx_sn_field_length = rlc_umd_sn_size_t::size5bits;
cnfg.um.tx_mod = 32; cnfg.um.tx_mod = 32;
rlc1.configure(cnfg); rlc1.configure(cnfg);

@ -50,8 +50,7 @@ public:
void clear_buffer(uint16_t rnti); void clear_buffer(uint16_t rnti);
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 add_bearer(uint16_t rnti, uint32_t lcid); void add_bearer(uint16_t rnti, uint32_t lcid, srslte::rlc_config_t cnfg);
void add_bearer(uint16_t rnti, uint32_t lcid, srslte::srslte_rlc_config_t cnfg);
void add_bearer_mrb(uint16_t rnti, uint32_t lcid); void add_bearer_mrb(uint16_t rnti, uint32_t lcid);
// rlc_interface_pdcp // rlc_interface_pdcp

@ -23,6 +23,7 @@
#include "srslte/srslte.h" #include "srslte/srslte.h"
#include "enb_cfg_parser.h" #include "enb_cfg_parser.h"
#include "srslte/asn1/rrc_asn1_utils.h"
using namespace asn1::rrc; using namespace asn1::rrc;
@ -640,7 +641,7 @@ int enb::parse_sibs(all_args_t* args, rrc_cfg_t* rrc_cfg, phy_cfg_t* phy_config_
ERROR("Could not convert %s to a plmn_id\n", (mcc_str + mnc_str).c_str()); ERROR("Could not convert %s to a plmn_id\n", (mcc_str + mnc_str).c_str());
return -1; return -1;
} }
plmn.to_asn1(&cell_access->plmn_id_list[0].plmn_id); srslte::to_asn1(&cell_access->plmn_id_list[0].plmn_id, plmn);
cell_access->plmn_id_list[0].cell_reserved_for_oper = plmn_id_info_s::cell_reserved_for_oper_e_::not_reserved; cell_access->plmn_id_list[0].cell_reserved_for_oper = plmn_id_info_s::cell_reserved_for_oper_e_::not_reserved;
sib1->cell_sel_info.q_rx_lev_min_offset = 0; sib1->cell_sel_info.q_rx_lev_min_offset = 0;

@ -764,7 +764,7 @@ void rrc::configure_mbsfn_sibs(sib_type2_s* sib2, sib_type13_r9_s* sib13)
pmch_item->mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.set_explicit_value_r9(); pmch_item->mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.set_explicit_value_r9();
srslte::plmn_id_t plmn_obj; srslte::plmn_id_t plmn_obj;
plmn_obj.from_string("00003"); plmn_obj.from_string("00003");
plmn_obj.to_asn1(&pmch_item->mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9()); srslte::to_asn1(&pmch_item->mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9(), plmn_obj);
uint8_t byte[] = {0x0, 0x0, 0x0}; uint8_t byte[] = {0x0, 0x0, 0x0};
memcpy(&pmch_item->mbms_session_info_list_r9[0].tmgi_r9.service_id_r9[0], &byte[0], 3); memcpy(&pmch_item->mbms_session_info_list_r9[0].tmgi_r9.service_id_r9[0], &byte[0], 3);
@ -1526,7 +1526,7 @@ void rrc::ue::send_connection_setup(bool is_setup)
parent->mac->ue_cfg(rnti, &sched_cfg); parent->mac->ue_cfg(rnti, &sched_cfg);
// Configure SRB1 in RLC // Configure SRB1 in RLC
parent->rlc->add_bearer(rnti, 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_t pdcp_cnfg; srslte::srslte_pdcp_config_t pdcp_cnfg;
@ -1736,7 +1736,7 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
parent->mac->bearer_ue_cfg(rnti, 3, &bearer_cfg); parent->mac->bearer_ue_cfg(rnti, 3, &bearer_cfg);
// Configure SRB2 in RLC and PDCP // Configure SRB2 in RLC and PDCP
parent->rlc->add_bearer(rnti, 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_t pdcp_cnfg; srslte::srslte_pdcp_config_t pdcp_cnfg;
@ -1751,9 +1751,7 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
parent->pdcp->enable_encryption(rnti, 2); parent->pdcp->enable_encryption(rnti, 2);
// Configure DRB1 in RLC // Configure DRB1 in RLC
srslte::srslte_rlc_config_t 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));
srslte::convert_from_asn1(&rlc_cfg, conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].rlc_cfg);
parent->rlc->add_bearer(rnti, 3, rlc_cfg);
// Configure DRB1 in PDCP // Configure DRB1 in PDCP
pdcp_cnfg.is_control = false; pdcp_cnfg.is_control = false;
@ -1820,9 +1818,7 @@ void rrc::ue::send_connection_reconf_new_bearer(LIBLTE_S1AP_E_RABTOBESETUPLISTBE
parent->mac->bearer_ue_cfg(rnti, lcid, &bearer_cfg); parent->mac->bearer_ue_cfg(rnti, lcid, &bearer_cfg);
// Configure DRB in RLC // Configure DRB in RLC
srslte::srslte_rlc_config_t rlc_cfg; parent->rlc->add_bearer(rnti, lcid, srslte::make_rlc_config_t(drb_item.rlc_cfg));
srslte::convert_from_asn1(&rlc_cfg, drb_item.rlc_cfg);
parent->rlc->add_bearer(rnti, lcid, rlc_cfg);
// Configure DRB in PDCP // Configure DRB in PDCP
srslte::srslte_pdcp_config_t pdcp_config; srslte::srslte_pdcp_config_t pdcp_config;

@ -89,16 +89,7 @@ void rlc::clear_buffer(uint16_t rnti)
pthread_rwlock_unlock(&rwlock); pthread_rwlock_unlock(&rwlock);
} }
void rlc::add_bearer(uint16_t rnti, uint32_t lcid) void rlc::add_bearer(uint16_t rnti, uint32_t lcid, srslte::rlc_config_t cnfg)
{
pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) {
users[rnti].rlc->add_bearer(lcid);
}
pthread_rwlock_unlock(&rwlock);
}
void rlc::add_bearer(uint16_t rnti, uint32_t lcid, srslte::srslte_rlc_config_t cnfg)
{ {
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti)) { if (users.count(rnti)) {

@ -23,6 +23,7 @@
#include "srslte/asn1/rrc_asn1.h" #include "srslte/asn1/rrc_asn1.h"
#include "srslte/asn1/rrc_asn1_utils.h" #include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/interfaces/rrc_interface_types.h"
#include <iostream> #include <iostream>
using namespace asn1::rrc; using namespace asn1::rrc;
@ -63,7 +64,7 @@ int rrc_plmn_test()
TESTASSERT(plmn_in.mnc == plmn_out.mnc); TESTASSERT(plmn_in.mnc == plmn_out.mnc);
// Test plmn --> string // Test plmn --> string
srslte::plmn_id_t srsplmn_out(plmn_out); srslte::plmn_id_t srsplmn_out = srslte::make_plmn_id_t(plmn_out);
TESTASSERT(srsplmn_out.to_string() == "12345"); TESTASSERT(srsplmn_out.to_string() == "12345");
asn1::bit_ref bref_in(&byte_buf[0], sizeof(byte_buf)); asn1::bit_ref bref_in(&byte_buf[0], sizeof(byte_buf));

@ -25,6 +25,7 @@
#include "pthread.h" #include "pthread.h"
#include "rrc_common.h" #include "rrc_common.h"
#include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/block_queue.h" #include "srslte/common/block_queue.h"
#include "srslte/common/buffer_pool.h" #include "srslte/common/buffer_pool.h"
@ -104,8 +105,7 @@ class cell_t
srslte::plmn_id_t get_plmn(uint32_t idx) srslte::plmn_id_t get_plmn(uint32_t idx)
{ {
if (idx < sib1.cell_access_related_info.plmn_id_list.size() && has_valid_sib1) { if (idx < sib1.cell_access_related_info.plmn_id_list.size() && has_valid_sib1) {
srslte::plmn_id_t ret(sib1.cell_access_related_info.plmn_id_list[idx].plmn_id); return srslte::make_plmn_id_t(sib1.cell_access_related_info.plmn_id_list[idx].plmn_id);
return ret;
} else { } else {
return {}; return {};
} }

@ -25,7 +25,6 @@ add_subdirectory(upper)
set(SOURCES ue_stack_lte.cc) set(SOURCES ue_stack_lte.cc)
add_library(srsue_stack STATIC ${SOURCES}) add_library(srsue_stack STATIC ${SOURCES})
target_link_libraries(srsue_stack)
install(TARGETS srsue_stack DESTINATION ${LIBRARY_DIR}) install(TARGETS srsue_stack DESTINATION ${LIBRARY_DIR})

@ -23,3 +23,4 @@ set(SOURCES rrc.cc)
add_library(srsue_rrc STATIC ${SOURCES}) add_library(srsue_rrc STATIC ${SOURCES})
install(TARGETS srsue_rrc DESTINATION ${LIBRARY_DIR}) install(TARGETS srsue_rrc DESTINATION ${LIBRARY_DIR})

@ -1288,7 +1288,7 @@ void rrc::send_con_request(asn1::rrc::establishment_cause_e cause)
if (ue_identity_configured) { if (ue_identity_configured) {
rrc_conn_req->ue_id.set_s_tmsi(); rrc_conn_req->ue_id.set_s_tmsi();
ue_identity.to_asn1(&rrc_conn_req->ue_id.s_tmsi()); srslte::to_asn1(&rrc_conn_req->ue_id.s_tmsi(), ue_identity);
} else { } else {
rrc_conn_req->ue_id.set_random_value(); rrc_conn_req->ue_id.set_random_value();
// TODO use proper RNG // TODO use proper RNG
@ -2087,7 +2087,7 @@ void rrc::process_pcch(unique_byte_buffer_t pdu)
} }
for (uint32_t i = 0; i < paging->paging_record_list.size(); i++) { for (uint32_t i = 0; i < paging->paging_record_list.size(); i++) {
s_tmsi_t s_tmsi_paged(paging->paging_record_list[i].ue_id.s_tmsi()); s_tmsi_t s_tmsi_paged = make_s_tmsi_t(paging->paging_record_list[i].ue_id.s_tmsi());
rrc_log->info("Received paging (%d/%d) for UE %" PRIu64 ":%" PRIu64 "\n", rrc_log->info("Received paging (%d/%d) for UE %" PRIu64 ":%" PRIu64 "\n",
i + 1, i + 1,
paging->paging_record_list.size(), paging->paging_record_list.size(),
@ -3094,13 +3094,7 @@ void rrc::add_srb(srb_to_add_mod_s* srb_cnfg)
// Setup RLC // Setup RLC
if (srb_cnfg->rlc_cfg_present) { if (srb_cnfg->rlc_cfg_present) {
if (srb_cnfg->rlc_cfg.type() == srb_to_add_mod_s::rlc_cfg_c_::types::default_value) { rlc->add_bearer(srb_cnfg->srb_id, make_rlc_config_t(*srb_cnfg));
rlc->add_bearer(srb_cnfg->srb_id);
}else{
srslte_rlc_config_t rlc_cfg;
srslte::convert_from_asn1(&rlc_cfg, srb_cnfg->rlc_cfg.explicit_value());
rlc->add_bearer(srb_cnfg->srb_id, rlc_cfg);
}
} }
// Setup MAC // Setup MAC
@ -3176,9 +3170,7 @@ void rrc::add_drb(drb_to_add_mod_s* drb_cnfg)
pdcp->enable_encryption(lcid); pdcp->enable_encryption(lcid);
// Setup RLC // Setup RLC
srslte_rlc_config_t rlc_cfg; rlc->add_bearer(lcid, make_rlc_config_t(drb_cnfg->rlc_cfg));
srslte::convert_from_asn1(&rlc_cfg, drb_cnfg->rlc_cfg);
rlc->add_bearer(lcid, rlc_cfg);
// Setup MAC // Setup MAC
uint8_t log_chan_group = 0; uint8_t log_chan_group = 0;

Loading…
Cancel
Save