Skip to content

Commit a09b000

Browse files
author
codebot
committed
Update main
2 parents 32dae89 + 1b58d9f commit a09b000

File tree

7 files changed

+160
-20
lines changed

7 files changed

+160
-20
lines changed

include/srsran/ngap/ngap_configuration_helpers.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ inline srs_cu_cp::ngap_configuration make_default_ngap_config()
3939
cfg.plmn = "00101";
4040
cfg.tac = 7;
4141
s_nssai_t slice_cfg;
42-
slice_cfg.sst = 1;
42+
slice_cfg.sst = 1;
43+
cfg.ue_context_setup_timeout_s = std::chrono::seconds{2};
4344
cfg.slice_configurations.push_back(slice_cfg);
4445

4546
return cfg;

include/srsran/ofh/ethernet/ethernet_frame_pool.h

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ class frame_buffer_array
121121

122122
public:
123123
// Constructor receives number of buffers stored/read at a time, reserves storage for all eAxCs.
124-
frame_buffer_array(unsigned nof_buffers, unsigned buffer_size) :
125-
increment_quant(nof_buffers),
126-
storage_nof_buffers(ofh::MAX_NOF_SUPPORTED_EAXC * nof_buffers * NUM_OF_ENTRIES),
124+
frame_buffer_array(unsigned nof_buffers_to_return, unsigned buffer_size, unsigned nof_antennas) :
125+
increment_quant(nof_buffers_to_return),
126+
storage_nof_buffers(nof_buffers_to_return * nof_antennas * NUM_OF_ENTRIES),
127127
buffers_array(storage_nof_buffers, frame_buffer{buffer_size}),
128128
write_position(storage_nof_buffers)
129129
{
@@ -174,6 +174,16 @@ class frame_buffer_array
174174
}
175175
}
176176

177+
// Changed state of all 'used' buffers to 'free'.
178+
void reset_buffers()
179+
{
180+
for (auto& buffer : buffers_array) {
181+
if (buffer.status != frame_buffer::frame_buffer_status::marked_to_send) {
182+
buffer.status = frame_buffer::frame_buffer_status::free;
183+
}
184+
}
185+
}
186+
177187
// Returns a vector of pointers to the buffers ready for sending.
178188
span<const frame_buffer*> find_buffers_ready_for_sending()
179189
{
@@ -221,11 +231,11 @@ class eth_frame_pool
221231
pool_entry(units::bytes mtu, unsigned num_of_frames)
222232
{
223233
// DL C-Plane storage.
224-
buffers.emplace_back(NUM_CP_MESSAGES_TO_RETURN, mtu.value());
234+
buffers.emplace_back(NUM_CP_MESSAGES_TO_RETURN, mtu.value(), ofh::MAX_NOF_SUPPORTED_EAXC);
225235
// UL C-Plane storage.
226-
buffers.emplace_back(NUM_CP_MESSAGES_TO_RETURN, mtu.value());
236+
buffers.emplace_back(NUM_CP_MESSAGES_TO_RETURN, mtu.value(), ofh::MAX_NOF_SUPPORTED_EAXC * 2);
227237
// U-Plane storage.
228-
buffers.emplace_back(num_of_frames, mtu.value());
238+
buffers.emplace_back(num_of_frames, mtu.value(), ofh::MAX_NOF_SUPPORTED_EAXC);
229239
}
230240

231241
/// Returns frame buffers for the given OFH type and given direction.
@@ -273,6 +283,12 @@ class eth_frame_pool
273283
entry_buf.clear_buffers();
274284
}
275285

286+
void reset_buffers(const ofh_pool_message_type& context)
287+
{
288+
frame_buffer_array& entry_buf = get_ofh_type_buffers(context.type, context.direction);
289+
entry_buf.reset_buffers();
290+
}
291+
276292
/// Returns a view over a next stored frame buffer for a given OFH type.
277293
span<const frame_buffer*> read_buffers(const ofh_pool_message_type& context)
278294
{
@@ -390,17 +406,17 @@ class eth_frame_pool
390406
pool_entry& cp_entry = get_pool_entry(slot_point, 0);
391407
// Clear buffers with DL Control-Plane messages.
392408
ofh_pool_message_type msg_type{ofh::message_type::control_plane, ofh::data_direction::downlink};
393-
cp_entry.clear_buffers(msg_type);
409+
cp_entry.reset_buffers(msg_type);
394410
// Clear buffers with UL Control-Plane messages.
395411
msg_type.direction = ofh::data_direction::uplink;
396-
cp_entry.clear_buffers(msg_type);
412+
cp_entry.reset_buffers(msg_type);
397413

398414
// Clear buffers with User-Plane messages.
399415
msg_type.type = ofh::message_type::user_plane;
400416
msg_type.direction = ofh::data_direction::downlink;
401417
for (unsigned symbol = 0; symbol != 14; ++symbol) {
402418
pool_entry& up_entry = get_pool_entry(slot_point, symbol);
403-
up_entry.clear_buffers(msg_type);
419+
up_entry.reset_buffers(msg_type);
404420
}
405421
}
406422

lib/ofh/transmitter/ofh_downlink_handler_broadcast_impl.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,21 @@ downlink_handler_broadcast_impl::downlink_handler_broadcast_impl(
4141
*dependencies.logger,
4242
calculate_nof_symbols_before_ota(config.cp, config.scs, config.dl_processing_time, config.tx_timing_params),
4343
get_nsymb_per_slot(config.cp),
44-
to_numerology_value(config.scs))
44+
to_numerology_value(config.scs)),
45+
frame_pool_ptr(dependencies.frame_pool_ptr),
46+
frame_pool(*frame_pool_ptr)
4547
{
4648
srsran_assert(data_flow_cplane, "Invalid Control-Plane data flow");
4749
srsran_assert(data_flow_uplane, "Invalid User-Plane data flow");
50+
srsran_assert(frame_pool_ptr, "Invalid frame pool");
4851
}
4952

5053
void downlink_handler_broadcast_impl::handle_dl_data(const resource_grid_context& context,
5154
const resource_grid_reader& grid)
5255
{
56+
// Clear any stale buffers associated with the context slot.
57+
frame_pool.clear_slot(context.slot);
58+
5359
if (window_checker.is_late(context.slot)) {
5460
logger.warning(
5561
"Dropped late downlink resource grid in slot '{}' and sector#{}. No OFH data will be transmitted for this slot",

lib/ofh/transmitter/ofh_downlink_handler_broadcast_impl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "ofh_tx_window_checker.h"
2828
#include "srsran/adt/span.h"
2929
#include "srsran/adt/static_vector.h"
30+
#include "srsran/ofh/ethernet/ethernet_frame_pool.h"
3031
#include "srsran/ofh/ofh_constants.h"
3132
#include "srsran/ofh/transmitter/ofh_downlink_handler.h"
3233
#include "srsran/ofh/transmitter/ofh_transmitter_configuration.h"
@@ -59,6 +60,8 @@ struct downlink_handler_broadcast_impl_dependencies {
5960
std::unique_ptr<data_flow_cplane_scheduling_commands> data_flow_cplane;
6061
/// Data flow for User-Plane.
6162
std::unique_ptr<data_flow_uplane_downlink_data> data_flow_uplane;
63+
/// Ethernet frame pool.
64+
std::shared_ptr<ether::eth_frame_pool> frame_pool_ptr;
6265
};
6366

6467
/// \brief Open Fronthaul downlink broadcast handler implementation.
@@ -84,6 +87,8 @@ class downlink_handler_broadcast_impl : public downlink_handler
8487
std::unique_ptr<data_flow_cplane_scheduling_commands> data_flow_cplane;
8588
std::unique_ptr<data_flow_uplane_downlink_data> data_flow_uplane;
8689
tx_window_checker window_checker;
90+
std::shared_ptr<ether::eth_frame_pool> frame_pool_ptr;
91+
ether::eth_frame_pool& frame_pool;
8792
};
8893

8994
} // namespace ofh

lib/ofh/transmitter/ofh_transmitter_factories.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ create_downlink_manager(const transmitter_config& tx_con
133133
dl_dependencies.logger = &logger;
134134
dl_dependencies.data_flow_cplane = std::move(data_flow_cplane);
135135
dl_dependencies.data_flow_uplane = std::move(data_flow_uplane);
136+
dl_dependencies.frame_pool_ptr = frame_pool;
136137

137138
return std::make_unique<downlink_manager_broadcast_impl>(dl_config, std::move(dl_dependencies));
138139
}

tests/integrationtests/ofh/ofh_integration_test.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,11 +1116,9 @@ static ru_ofh_dependencies generate_ru_dependencies(srslog::basic_logger&
11161116
sector_deps.eth_gateway = std::move(gateway);
11171117

11181118
// Configure Ethernet receiver.
1119-
if (!test_params.use_loopback_receiver) {
1120-
auto dummy_receiver = std::make_unique<dummy_eth_receiver>(logger, *workers.ru_rx_exec);
1121-
eth_receiver = dummy_receiver.get();
1122-
sector_deps.eth_receiver = std::move(dummy_receiver);
1123-
}
1119+
auto dummy_receiver = std::make_unique<dummy_eth_receiver>(logger, *workers.ru_rx_exec);
1120+
eth_receiver = dummy_receiver.get();
1121+
sector_deps.eth_receiver = std::move(dummy_receiver);
11241122

11251123
return dependencies;
11261124
}
@@ -1150,20 +1148,26 @@ int main(int argc, char** argv)
11501148
test_gateway* tx_gateway;
11511149
test_ether_receiver* eth_receiver;
11521150

1151+
ru_ofh_configuration ru_cfg = generate_ru_config();
1152+
ru_ofh_dependencies ru_deps =
1153+
generate_ru_dependencies(logger, workers, &timing_notifier, &rx_symbol_notifier, tx_gateway, eth_receiver);
1154+
11531155
if (test_params.use_loopback_receiver) {
1156+
ru_deps.sector_dependencies[0].eth_receiver.reset();
11541157
eth_receiver_ptr = std::make_unique<lo_eth_receiver>(logger);
11551158
eth_receiver = eth_receiver_ptr.get();
11561159
}
1157-
1158-
ru_ofh_configuration ru_cfg = generate_ru_config();
1159-
ru_ofh_dependencies ru_deps =
1160-
generate_ru_dependencies(logger, workers, &timing_notifier, &rx_symbol_notifier, tx_gateway, eth_receiver);
11611160
std::unique_ptr<radio_unit> ru_object = create_ofh_ru(ru_cfg, std::move(ru_deps));
11621161

11631162
// Get RU downlink plane handler.
11641163
auto& ru_dl_handler = ru_object->get_downlink_plane_handler();
11651164
auto& ru_ul_handler = ru_object->get_uplink_plane_handler();
11661165

1166+
if (test_params.use_loopback_receiver) {
1167+
eth_receiver_ptr = std::make_unique<lo_eth_receiver>(logger);
1168+
eth_receiver = eth_receiver_ptr.get();
1169+
}
1170+
11671171
// Create RU emulator instance.
11681172
ru_compression_params ul_compression_params{to_compression_type(test_params.data_compr_method),
11691173
test_params.data_bitwidth};

tests/unittests/ofh/ethernet/ethernet_frame_pool_test.cpp

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,113 @@ TEST_P(EthFramePoolFixture, read_interval_should_return_correct_data)
424424
pool.clear_sent_frame_buffers(interval);
425425
}
426426

427+
// Pool should have enough space to store C-Plane and U-Plane packets for all antennas.
428+
TEST_P(EthFramePoolFixture, pool_should_have_enough_space)
429+
{
430+
slot_point slot(to_numerology_value(scs), 0);
431+
for (unsigned slot_count = 0; slot_count < TEST_NUM_SLOTS; ++slot_count) {
432+
for (unsigned symbol = 0; symbol < nof_symbols; ++symbol) {
433+
ofh::slot_symbol_point symbol_point(slot, symbol, nof_symbols);
434+
ether::frame_pool_context ctx{{ofh_type, ofh::data_direction::downlink}, symbol_point};
435+
unsigned nof_requested_buffers = ofh::MAX_NOF_SUPPORTED_EAXC;
436+
// DL C-Plane and U-Plane
437+
for (unsigned i = 0; i != nof_requested_buffers; ++i) {
438+
span<frame_buffer> frame_buffers = pool.get_frame_buffers(ctx);
439+
ASSERT_TRUE(!frame_buffers.empty()) << "Non-empty span of buffers expected";
440+
for (auto& buffer : frame_buffers) {
441+
buffer.set_size(64);
442+
}
443+
pool.push_frame_buffers(ctx, frame_buffers);
444+
}
445+
pool.read_frame_buffers(ctx);
446+
pool.clear_sent_frame_buffers(ctx);
447+
448+
if (ofh_type == ofh::message_type::user_plane) {
449+
continue;
450+
}
451+
// UL C-Plane
452+
// We may need to write Type 1 and Type 3 C-Plane messages in the same slot and symbol.
453+
nof_requested_buffers *= 2;
454+
ctx = {{ofh_type, ofh::data_direction::uplink}, symbol_point};
455+
for (unsigned i = 0; i != nof_requested_buffers; ++i) {
456+
span<frame_buffer> frame_buffers = pool.get_frame_buffers(ctx);
457+
ASSERT_TRUE(!frame_buffers.empty()) << "Non-empty span of buffers expected";
458+
for (auto& buffer : frame_buffers) {
459+
buffer.set_size(64);
460+
}
461+
pool.push_frame_buffers(ctx, frame_buffers);
462+
}
463+
pool.read_frame_buffers(ctx);
464+
pool.clear_sent_frame_buffers(ctx);
465+
}
466+
++slot;
467+
}
468+
}
469+
470+
TEST_P(EthFramePoolFixture, clearing_full_pool_should_allow_adding_more_data)
471+
{
472+
slot_point slot(to_numerology_value(scs), 0);
473+
for (unsigned slot_count = 0; slot_count < TEST_NUM_SLOTS; ++slot_count) {
474+
for (unsigned symbol = 0; symbol < nof_symbols; ++symbol) {
475+
ofh::slot_symbol_point symbol_point(slot, symbol, nof_symbols);
476+
477+
if (ofh_type == ofh::message_type::control_plane && symbol != 0) {
478+
continue;
479+
}
480+
481+
// DL C-Plane and U-Plane
482+
bool pool_has_space = true;
483+
ether::frame_pool_context ctx{{ofh_type, ofh::data_direction::downlink}, symbol_point};
484+
unsigned nof_requested_buffers = ofh::MAX_NOF_SUPPORTED_EAXC;
485+
while (pool_has_space) {
486+
span<frame_buffer> frame_buffers = pool.get_frame_buffers(ctx);
487+
pool_has_space = !frame_buffers.empty();
488+
for (auto& buffer : frame_buffers) {
489+
buffer.set_size(64);
490+
}
491+
pool.push_frame_buffers(ctx, frame_buffers);
492+
}
493+
// Clear full slot in the pool and try to get buffers again.
494+
pool.clear_slot(slot);
495+
for (unsigned i = 0; i != nof_requested_buffers; ++i) {
496+
span<frame_buffer> frame_buffers = pool.get_frame_buffers(ctx);
497+
ASSERT_TRUE(!frame_buffers.empty()) << "Non-empty span of buffers expected";
498+
pool.push_frame_buffers(ctx, frame_buffers);
499+
}
500+
pool.read_frame_buffers(ctx);
501+
pool.clear_sent_frame_buffers(ctx);
502+
503+
if (ofh_type == ofh::message_type::user_plane) {
504+
continue;
505+
}
506+
507+
// UL C-Plane
508+
// We may need to write Type 1 and Type 3 C-Plane messages in the same slot and symbol.
509+
nof_requested_buffers *= 2;
510+
ctx = {{ofh_type, ofh::data_direction::uplink}, symbol_point};
511+
pool_has_space = true;
512+
while (pool_has_space) {
513+
span<frame_buffer> frame_buffers = pool.get_frame_buffers(ctx);
514+
pool_has_space = !frame_buffers.empty();
515+
for (auto& buffer : frame_buffers) {
516+
buffer.set_size(64);
517+
}
518+
pool.push_frame_buffers(ctx, frame_buffers);
519+
}
520+
// Clear full slot in the pool and try to get buffers again.
521+
pool.clear_slot(slot);
522+
for (unsigned i = 0; i != nof_requested_buffers; ++i) {
523+
span<frame_buffer> frame_buffers = pool.get_frame_buffers(ctx);
524+
ASSERT_TRUE(!frame_buffers.empty()) << "Non-empty span of buffers expected";
525+
pool.push_frame_buffers(ctx, frame_buffers);
526+
}
527+
pool.read_frame_buffers(ctx);
528+
pool.clear_sent_frame_buffers(ctx);
529+
}
530+
++slot;
531+
}
532+
}
533+
427534
INSTANTIATE_TEST_SUITE_P(EthFramePoolTestSuite,
428535
EthFramePoolFixture,
429536
::testing::Combine(::testing::Values(mtu::MTU_9000, mtu::MTU_5000, mtu::MTU_1500),

0 commit comments

Comments
 (0)