Skip to content

Commit 5275f33

Browse files
srs-codebotYour Name
authored and
Your Name
committed
Merge branch 'next' into agpl_next
2 parents aa9b8ac + dfc2ea0 commit 5275f33

File tree

15 files changed

+79
-54
lines changed

15 files changed

+79
-54
lines changed

.github/workflows/ccpp.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
run: |
1414
sudo apt update
1515
sudo apt install -y build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev colordiff ninja-build valgrind
16-
mkdir build && cd build && cmake -DRF_FOUND=True -GNinja .. && ninja && ctest -T memcheck
16+
mkdir build && cd build && cmake -DRF_FOUND=True -GNinja .. && ninja && ctest
1717
x86_ubuntu16_build:
1818
name: Build and test on x86 Ubuntu 16.04
1919
strategy:
@@ -26,7 +26,7 @@ jobs:
2626
run: |
2727
sudo apt update
2828
sudo apt install -y build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev colordiff ninja-build valgrind
29-
mkdir build && cd build && cmake -DRF_FOUND=True -GNinja .. && ninja && ctest -T memcheck
29+
mkdir build && cd build && cmake -DRF_FOUND=True -GNinja .. && ninja && ctest
3030
3131
aarch64_ubuntu18_build:
3232
runs-on: ubuntu-18.04

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
srsRAN
22
======
33

4-
[![Build Status](https://travis-ci.com/srsran/srsRAN.svg?branch=master)](https://travis-ci.com/srsran/srsRAN)
4+
[![Build Status](https://app.travis-ci.com/srsran/srsRAN.svg?branch=master)](https://app.travis-ci.com/github/srsran/srsRAN)
55
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/srsran/srsRAN.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/srsran/srsRAN/context:cpp)
6-
[![Coverity](https://scan.coverity.com/projects/23048/badge.svg)](https://scan.coverity.com/projects/srsran_agpl)
6+
[![Coverity](https://scan.coverity.com/projects/23045/badge.svg)](https://scan.coverity.com/projects/srsran)
77

88
srsRAN is a 4G/5G software radio suite developed by [SRS](http://www.srs.io).
99

1010
See the [srsRAN project pages](https://www.srsran.com) for information, guides and project news.
1111

1212
The srsRAN suite includes:
1313
* srsUE - a full-stack SDR 4G/5G-NSA UE application (5G-SA coming soon)
14-
* srsENB - a full-stack SDR 4G eNodeB application (5G-NSA and 5G-SA coming soon)
14+
* srsENB - a full-stack SDR 4G/5G-NSA eNodeB application (5G-SA coming soon)
1515
* srsEPC - a light-weight 4G core network implementation with MME, HSS and S/P-GW
1616

1717
For application features, build instructions and user guides see the [srsRAN documentation](https://docs.srsran.com).

lib/include/srsran/interfaces/pdcp_interface_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ class pdcp_config_t
174174
status_report_required == other.status_report_required;
175175
}
176176
bool operator!=(const pdcp_config_t& other) const { return not(*this == other); }
177+
178+
std::string get_rb_name() const { return (rb_type == PDCP_RB_IS_DRB ? "DRB" : "SRB") + std::to_string(bearer_id); }
177179
};
178180

179181
// Specifies in which direction security (integrity and ciphering) are enabled for PDCP

lib/include/srsran/phy/phch/pbch_msg_nr.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@
3232
*/
3333
#define SRSRAN_PBCH_MSG_NR_SZ 24
3434

35+
/**
36+
* @brief Define the payload buffer for SRSRAN_PBCH_MSG_NR_SZ to be 32 for alignment purposes
37+
*/
38+
#define SRSRAN_PBCH_MSG_NR_MAX_SZ 32
39+
3540
/**
3641
* @brief Describes the NR PBCH message
3742
*/
3843
typedef struct SRSRAN_API {
39-
uint8_t payload[SRSRAN_PBCH_MSG_NR_SZ]; ///< Actual PBCH payload provided by higher layers
44+
uint8_t payload[SRSRAN_PBCH_MSG_NR_MAX_SZ]; ///< Actual PBCH payload provided by higher layers
4045
uint8_t sfn_4lsb; ///< SFN 4 LSB
4146
uint8_t ssb_idx; ///< SS/PBCH blocks index described in TS 38.213 4.1
4247
uint8_t k_ssb_msb; ///< Subcarrier offset MSB described in TS 38.211 7.4.3.1

lib/include/srsran/upper/pdcp_entity_base.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ class pdcp_entity_base
142142
virtual pdcp_bearer_metrics_t get_metrics() = 0;
143143
virtual void reset_metrics() = 0;
144144

145+
const char* get_rb_name() const { return rb_name.c_str(); }
146+
145147
protected:
146148
srslog::basic_logger& logger;
147149
srsran::task_sched_handle task_sched;
@@ -163,6 +165,7 @@ class pdcp_entity_base
163165
pdcp_discard_timer_t::infinity,
164166
false,
165167
srsran_rat_t::lte};
168+
std::string rb_name;
166169

167170
srsran::as_security_config_t sec_cfg = {};
168171

lib/src/pdcp/pdcp.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ int pdcp::add_bearer(uint32_t lcid, const pdcp_config_t& cfg)
138138
valid_lcids_cached.insert(lcid);
139139
}
140140

141-
logger.info("Add %s (lcid=%d, bearer_id=%d, sn_len=%dbits)", rrc->get_rb_name(lcid), lcid, cfg.bearer_id, cfg.sn_len);
141+
logger.info("Add %s%d (lcid=%d, sn_len=%dbits)",
142+
cfg.rb_type == PDCP_RB_IS_DRB ? "DRB" : "SRB",
143+
cfg.bearer_id,
144+
lcid,
145+
cfg.sn_len);
142146

143147
return SRSRAN_SUCCESS;
144148
}
@@ -171,10 +175,10 @@ void pdcp::del_bearer(uint32_t lcid)
171175
valid_lcids_cached.erase(lcid);
172176
}
173177
if (valid_lcid(lcid)) {
178+
logger.info("Deleted PDCP bearer %s", pdcp_array[lcid]->get_rb_name());
174179
pdcp_array.erase(lcid);
175-
logger.info("Deleted PDCP bearer %s", rrc->get_rb_name(lcid));
176180
} else {
177-
logger.warning("Can't delete bearer %s. Bearer doesn't exist.", rrc->get_rb_name(lcid));
181+
logger.warning("Can't delete bearer with LCID=%s. Cause: bearer doesn't exist.", lcid);
178182
}
179183
}
180184

lib/src/pdcp/pdcp_entity_lte.cc

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ bool pdcp_entity_lte::configure(const pdcp_config_t& cnfg_)
6363
if (active) {
6464
// Already configured
6565
if (cnfg_ != cfg) {
66-
logger.error("Bearer reconfiguration not supported. LCID=%s.", rrc->get_rb_name(lcid));
66+
logger.error("Bearer reconfiguration not supported. LCID=%s.", rb_name.c_str());
6767
return false;
6868
}
6969
return true;
7070
}
7171

72-
cfg = cnfg_;
72+
cfg = cnfg_;
73+
rb_name = cfg.get_rb_name();
74+
7375
maximum_pdcp_sn = (1u << cfg.sn_len) - 1u;
7476
st.last_submitted_pdcp_rx_sn = maximum_pdcp_sn;
7577
if (is_srb()) {
@@ -88,7 +90,7 @@ bool pdcp_entity_lte::configure(const pdcp_config_t& cnfg_)
8890
// Queue Helpers
8991
maximum_allocated_sns_window = (1u << cfg.sn_len) / 2u;
9092

91-
logger.info("Init %s with bearer ID: %d", rrc->get_rb_name(lcid), cfg.bearer_id);
93+
logger.info("Init %s with bearer ID: %d", rb_name.c_str(), cfg.bearer_id);
9294
logger.info("SN len bits: %d, SN len bytes: %d, reordering window: %d, Maximum SN: %d, discard timer: %d ms",
9395
cfg.sn_len,
9496
cfg.hdr_len_bytes,
@@ -113,7 +115,7 @@ bool pdcp_entity_lte::configure(const pdcp_config_t& cnfg_)
113115
// Reestablishment procedure: 36.323 5.2
114116
void pdcp_entity_lte::reestablish()
115117
{
116-
logger.info("Re-establish %s with bearer ID: %d", rrc->get_rb_name(lcid), cfg.bearer_id);
118+
logger.info("Re-establish %s with bearer ID: %d", rb_name.c_str(), cfg.bearer_id);
117119
// For SRBs
118120
if (is_srb()) {
119121
st.next_pdcp_tx_sn = 0;
@@ -135,7 +137,7 @@ void pdcp_entity_lte::reestablish()
135137
void pdcp_entity_lte::reset()
136138
{
137139
if (active) {
138-
logger.debug("Reset %s", rrc->get_rb_name(lcid));
140+
logger.debug("Reset %s", rb_name.c_str());
139141
}
140142
active = false;
141143
}
@@ -144,7 +146,7 @@ void pdcp_entity_lte::reset()
144146
void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn)
145147
{
146148
if (!active) {
147-
logger.warning("Dropping %s SDU due to inactive bearer", rrc->get_rb_name(lcid));
149+
logger.warning("Dropping %s SDU due to inactive bearer", rb_name.c_str());
148150
return;
149151
}
150152

@@ -154,7 +156,7 @@ void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn)
154156
}
155157

156158
if (rlc->sdu_queue_is_full(lcid)) {
157-
logger.info(sdu->msg, sdu->N_bytes, "Dropping %s SDU due to full queue", rrc->get_rb_name(lcid));
159+
logger.info(sdu->msg, sdu->N_bytes, "Dropping %s SDU due to full queue", rb_name.c_str());
158160
return;
159161
}
160162

@@ -208,7 +210,7 @@ void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn)
208210
logger.info(sdu->msg,
209211
sdu->N_bytes,
210212
"TX %s PDU, SN=%d, integrity=%s, encryption=%s",
211-
rrc->get_rb_name(lcid),
213+
rb_name.c_str(),
212214
used_sn,
213215
srsran_direction_text[integrity_direction],
214216
srsran_direction_text[encryption_direction]);
@@ -235,7 +237,7 @@ void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn)
235237
void pdcp_entity_lte::write_pdu(unique_byte_buffer_t pdu)
236238
{
237239
if (!active) {
238-
logger.warning("Dropping %s PDU due to inactive bearer", rrc->get_rb_name(lcid));
240+
logger.warning("Dropping %s PDU due to inactive bearer", rb_name.c_str());
239241
return;
240242
}
241243

@@ -265,7 +267,7 @@ void pdcp_entity_lte::write_pdu(unique_byte_buffer_t pdu)
265267
logger.info(pdu->msg,
266268
pdu->N_bytes,
267269
"%s Rx PDU SN=%d (%d B, integrity=%s, encryption=%s)",
268-
rrc->get_rb_name(lcid),
270+
rb_name.c_str(),
269271
sn,
270272
pdu->N_bytes,
271273
srsran_direction_text[integrity_direction],
@@ -325,7 +327,7 @@ void pdcp_entity_lte::handle_srb_pdu(srsran::unique_byte_buffer_t pdu)
325327
cipher_decrypt(&pdu->msg[cfg.hdr_len_bytes], pdu->N_bytes - cfg.hdr_len_bytes, count, &pdu->msg[cfg.hdr_len_bytes]);
326328
}
327329

328-
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx SDU SN=%d", rrc->get_rb_name(lcid), sn);
330+
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx SDU SN=%d", rb_name.c_str(), sn);
329331

330332
// Extract MAC
331333
uint8_t mac[4];
@@ -334,7 +336,7 @@ void pdcp_entity_lte::handle_srb_pdu(srsran::unique_byte_buffer_t pdu)
334336
// Perfrom integrity checks
335337
if (integrity_direction == DIRECTION_RX || integrity_direction == DIRECTION_TXRX) {
336338
if (not integrity_verify(pdu->msg, pdu->N_bytes, count, mac)) {
337-
logger.error(pdu->msg, pdu->N_bytes, "%s Dropping PDU", rrc->get_rb_name(lcid));
339+
logger.error(pdu->msg, pdu->N_bytes, "%s Dropping PDU", rb_name.c_str());
338340
rrc->notify_pdcp_integrity_error(lcid);
339341
return; // Discard
340342
}
@@ -373,7 +375,7 @@ void pdcp_entity_lte::handle_um_drb_pdu(srsran::unique_byte_buffer_t pdu)
373375
cipher_decrypt(pdu->msg, pdu->N_bytes, count, pdu->msg);
374376
}
375377

376-
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx PDU SN=%d", rrc->get_rb_name(lcid), sn);
378+
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx PDU SN=%d", rb_name.c_str(), sn);
377379

378380
st.next_pdcp_rx_sn = sn + 1;
379381
if (st.next_pdcp_rx_sn > maximum_pdcp_sn) {
@@ -437,7 +439,7 @@ void pdcp_entity_lte::handle_am_drb_pdu(srsran::unique_byte_buffer_t pdu)
437439

438440
// Decrypt
439441
cipher_decrypt(pdu->msg, pdu->N_bytes, count, pdu->msg);
440-
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx SDU SN=%d", rrc->get_rb_name(lcid), sn);
442+
logger.debug(pdu->msg, pdu->N_bytes, "%s Rx SDU SN=%d", rb_name.c_str(), sn);
441443

442444
// Update info on last PDU submitted to upper layers
443445
st.last_submitted_pdcp_rx_sn = sn;

lib/src/pdcp/pdcp_entity_nr.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pdcp_entity_nr::~pdcp_entity_nr() {}
4646
// Reestablishment procedure: 38.323 5.2
4747
void pdcp_entity_nr::reestablish()
4848
{
49-
logger.info("Re-establish %s with bearer ID: %d", rrc->get_rb_name(lcid), cfg.bearer_id);
49+
logger.info("Re-establish %s with bearer ID: %d", rb_name.c_str(), cfg.bearer_id);
5050
// TODO
5151
}
5252

@@ -55,13 +55,14 @@ bool pdcp_entity_nr::configure(const pdcp_config_t& cnfg_)
5555
if (active) {
5656
// Already configured
5757
if (cnfg_ != cfg) {
58-
logger.error("Bearer reconfiguration not supported. LCID=%s.", rrc->get_rb_name(lcid));
58+
logger.error("Bearer reconfiguration not supported. LCID=%s.", rb_name.c_str());
5959
return false;
6060
}
6161
return true;
6262
}
6363

6464
cfg = cnfg_;
65+
rb_name = cfg.get_rb_name();
6566
window_size = 1 << (cfg.sn_len - 1);
6667

6768
// Timers
@@ -79,7 +80,7 @@ bool pdcp_entity_nr::configure(const pdcp_config_t& cnfg_)
7980
void pdcp_entity_nr::reset()
8081
{
8182
active = false;
82-
logger.debug("Reset %s", rrc->get_rb_name(lcid));
83+
logger.debug("Reset %s", rb_name.c_str());
8384
}
8485

8586
// SDAP/RRC interface
@@ -89,7 +90,7 @@ void pdcp_entity_nr::write_sdu(unique_byte_buffer_t sdu, int sn)
8990
logger.info(sdu->msg,
9091
sdu->N_bytes,
9192
"TX %s SDU, integrity=%s, encryption=%s",
92-
rrc->get_rb_name(lcid),
93+
rb_name.c_str(),
9394
srsran_direction_text[integrity_direction],
9495
srsran_direction_text[encryption_direction]);
9596

@@ -145,7 +146,7 @@ void pdcp_entity_nr::write_pdu(unique_byte_buffer_t pdu)
145146
logger.info(pdu->msg,
146147
pdu->N_bytes,
147148
"RX %s PDU (%d B), integrity=%s, encryption=%s",
148-
rrc->get_rb_name(lcid),
149+
rb_name.c_str(),
149150
pdu->N_bytes,
150151
srsran_direction_text[integrity_direction],
151152
srsran_direction_text[encryption_direction]);

lib/src/phy/sync/test/ssb_decode_test.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@
2929
#include <srsran/phy/utils/random.h>
3030
#include <stdlib.h>
3131

32-
/**
33-
* @brief NR PBCH payload buffer size for the SSB decode test.
34-
*
35-
* @note This needs to be a multiple of 32, since the PBCH message payload is
36-
* generated with srs_random_bit_vector.
37-
*/
38-
#define SRSRAN_PBCH_TEST_MSG_NR_SZ 32
39-
4032
// NR parameters
4133
static uint32_t carrier_nof_prb = 52;
4234
static srsran_subcarrier_spacing_t carrier_scs = srsran_subcarrier_spacing_15kHz;
@@ -130,7 +122,7 @@ static void gen_pbch_msg(srsran_pbch_msg_nr_t* pbch_msg, uint32_t ssb_idx)
130122
SRSRAN_MEM_ZERO(pbch_msg, srsran_pbch_msg_nr_t, 1);
131123

132124
// Generate payload
133-
srsran_random_bit_vector(random_gen, pbch_msg->payload, SRSRAN_PBCH_TEST_MSG_NR_SZ);
125+
srsran_random_bit_vector(random_gen, pbch_msg->payload, SRSRAN_PBCH_MSG_NR_SZ);
134126

135127
pbch_msg->ssb_idx = ssb_idx;
136128
pbch_msg->crc = true;

lib/src/radio/test/test_radio_rt_gain.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ int main(int argc, char** argv)
271271
continue;
272272
}
273273
break;
274-
case END:
275-
continue;
274+
default:
275+
break;
276276
}
277277

278278
// Prepare reception buffers

lib/src/rlc/rlc_um_nr.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,9 @@ void rlc_um_nr::rlc_um_nr_rx::handle_rx_buffer_update(const uint32_t sn)
430430

431431
// find next SN in rx buffer
432432
if (sn == RX_Next_Reassembly) {
433-
for (auto it = rx_window.begin(); it != rx_window.end(); ++it) {
434-
logger.debug("SN=%d has %zd segments", it->first, it->second.segments.size());
435-
if (RX_MOD_NR_BASE(it->first) > RX_MOD_NR_BASE(RX_Next_Reassembly)) {
436-
RX_Next_Reassembly = it->first;
437-
break;
438-
}
433+
RX_Next_Reassembly = ((RX_Next_Reassembly + 1) % mod);
434+
while (RX_MOD_NR_BASE(RX_Next_Reassembly) < RX_MOD_NR_BASE(RX_Next_Highest)) {
435+
RX_Next_Reassembly = (RX_Next_Reassembly + 1) % mod;
439436
}
440437
logger.debug("Updating RX_Next_Reassembly=%d", RX_Next_Reassembly);
441438
}

lib/test/rlc/rlc_um_nr_test.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,10 +676,13 @@ int main(int argc, char** argv)
676676
return SRSRAN_ERROR;
677677
}
678678

679+
// temporarily disabling
680+
#if 0
679681
if (rlc_um_nr_test9()) {
680682
fprintf(stderr, "rlc_um_nr_test9() failed.\n");
681683
return SRSRAN_ERROR;
682684
}
685+
#endif
683686

684687
#if PCAP
685688
pcap_handle->close();

srsenb/src/stack/mac/nr/mac_nr.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,10 @@ int mac_nr::slot_indication(const srsran_slot_cfg_t& slot_cfg)
307307

308308
int mac_nr::get_dl_sched(const srsran_slot_cfg_t& slot_cfg, dl_sched_t& dl_sched)
309309
{
310-
logger.set_context(slot_cfg.idx - TX_ENB_DELAY);
311-
312310
slot_point pdsch_slot = srsran::slot_point{NUMEROLOGY_IDX, slot_cfg.idx};
313311

312+
logger.set_context((pdsch_slot - TX_ENB_DELAY).to_uint());
313+
314314
// Run Scheduler
315315
sched_nr_interface::sched_rar_list_t rar_list;
316316
sched_nr_interface::dl_res_t dl_res(rar_list, dl_sched);

srsue/hdr/stack/upper/gw.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class gw : public gw_interface_stack, public srsran::thread
5353
{
5454
public:
5555
gw(srslog::basic_logger& logger_);
56+
~gw();
5657
int init(const gw_args_t& args_, stack_interface_gw* stack);
5758
void stop();
5859

@@ -85,7 +86,7 @@ class gw : public gw_interface_stack, public srsran::thread
8586
int32_t tun_fd = 0;
8687
struct ifreq ifr = {};
8788
int32_t sock = 0;
88-
bool if_up = false;
89+
std::atomic<bool> if_up = {false};
8990

9091
static const int NOT_ASSIGNED = -1;
9192
int32_t default_eps_bearer_id = NOT_ASSIGNED;

0 commit comments

Comments
 (0)