Skip to content

Commit fdd3be5

Browse files
AlaiaLcodebot
authored andcommitted
ofh: added the static and dynamic Control-Plane packet builders
1 parent edb14aa commit fdd3be5

13 files changed

+323
-24
lines changed

include/srsran/ofh/ofh_factories.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ class iq_decompressor;
3838
class iq_compressor;
3939
class ota_symbol_boundary_notifier;
4040

41-
/// Creates an Open Fronthaul Control-Plane packet builder.
42-
std::unique_ptr<cplane_message_builder> create_ofh_control_plane_packet_builder();
41+
/// Creates an Open Fronthaul Control-Plane static compression message builder.
42+
std::unique_ptr<cplane_message_builder> create_ofh_control_plane_static_compression_message_builder();
43+
44+
/// Creates an Open Fronthaul Control-Plane dynamic compression message builder.
45+
std::unique_ptr<cplane_message_builder> create_ofh_control_plane_dynamic_compression_message_builder();
4346

4447
/// Creates an Open Fronthaul User-Plane packet builder with static compression header.
4548
std::unique_ptr<uplane_message_builder>

lib/ofh/ofh_factories.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#include "srsran/ofh/ofh_factories.h"
1212
#include "ofh_sector_impl.h"
1313
#include "receiver/ofh_receiver_impl.h"
14-
#include "serdes/ofh_cplane_message_builder_impl.h"
14+
#include "serdes/ofh_cplane_message_builder_dynamic_compression_impl.h"
15+
#include "serdes/ofh_cplane_message_builder_static_compression_impl.h"
1516
#include "serdes/ofh_uplane_message_builder_dynamic_compression_impl.h"
1617
#include "serdes/ofh_uplane_message_builder_static_compression_impl.h"
1718
#include "serdes/ofh_uplane_message_decoder_dynamic_compression_impl.h"
@@ -50,7 +51,9 @@ create_data_flow_cplane_sched(const transmitter_config&
5051
config.frame_pool = std::move(frame_pool);
5152
config.eth_builder = ether::create_vlan_frame_builder();
5253
config.ecpri_builder = ecpri::create_ecpri_packet_builder();
53-
config.cp_builder = ofh::create_ofh_control_plane_packet_builder();
54+
config.cp_builder = (tx_config.is_downlink_static_comp_hdr_enabled)
55+
? ofh::create_ofh_control_plane_static_compression_message_builder()
56+
: ofh::create_ofh_control_plane_dynamic_compression_message_builder();
5457

5558
config.nof_symbols = get_nsymb_per_slot(tx_config.cp);
5659
config.ru_nof_prbs =
@@ -107,9 +110,14 @@ create_data_flow_uplane_data(const transmitter_config& tx_config,
107110
return std::make_unique<data_flow_uplane_downlink_data_impl>(std::move(config));
108111
}
109112

110-
std::unique_ptr<cplane_message_builder> srsran::ofh::create_ofh_control_plane_packet_builder()
113+
std::unique_ptr<cplane_message_builder> srsran::ofh::create_ofh_control_plane_static_compression_message_builder()
111114
{
112-
return std::make_unique<cplane_message_builder_impl>();
115+
return std::make_unique<cplane_message_builder_static_compression_impl>();
116+
}
117+
118+
std::unique_ptr<cplane_message_builder> srsran::ofh::create_ofh_control_plane_dynamic_compression_message_builder()
119+
{
120+
return std::make_unique<cplane_message_builder_dynamic_compression_impl>();
113121
}
114122

115123
std::unique_ptr<uplane_message_builder>

lib/ofh/serdes/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#
88

99
set(SOURCES
10+
ofh_cplane_message_builder_dynamic_compression_impl.cpp
1011
ofh_cplane_message_builder_impl.cpp
12+
ofh_cplane_message_builder_static_compression_impl.cpp
1113
ofh_uplane_message_builder_impl.cpp
1214
ofh_uplane_message_builder_dynamic_compression_impl.cpp
1315
ofh_uplane_message_builder_static_compression_impl.cpp
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
*
3+
* Copyright 2021-2023 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#include "ofh_cplane_message_builder_dynamic_compression_impl.h"
12+
#include "../support/network_order_binary_serializer.h"
13+
14+
using namespace srsran;
15+
using namespace ofh;
16+
17+
void cplane_message_builder_dynamic_compression_impl::serialize_compression_header(
18+
network_order_binary_serializer& serializer,
19+
const ru_compression_params& compr,
20+
data_direction direction) const
21+
{
22+
// Downlink always encodes a 0.
23+
if (direction == data_direction::downlink) {
24+
static constexpr uint8_t reserved = 0;
25+
serializer.write(reserved);
26+
27+
return;
28+
}
29+
30+
uint8_t value = 0;
31+
value |= uint8_t(compr.data_width) << 4;
32+
value |= uint8_t(to_value(compr.type));
33+
34+
serializer.write(value);
35+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
*
3+
* Copyright 2021-2023 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#pragma once
12+
13+
#include "ofh_cplane_message_builder_impl.h"
14+
15+
namespace srsran {
16+
namespace ofh {
17+
18+
/// Open Fronthaul Control-Plane message builder for dynamic compression.
19+
class cplane_message_builder_dynamic_compression_impl : public cplane_message_builder_impl
20+
{
21+
private:
22+
// See interface for documentation
23+
void serialize_compression_header(network_order_binary_serializer& serializer,
24+
const ru_compression_params& compr,
25+
data_direction direction) const override;
26+
};
27+
28+
} // namespace ofh
29+
} // namespace srsran

lib/ofh/serdes/ofh_cplane_message_builder_impl.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@
1515
using namespace srsran;
1616
using namespace ofh;
1717

18-
/// Serializes the compression header using the given serializer and compression parameters.
19-
static void serialize_compression_header(ofh::network_order_binary_serializer& serializer,
20-
const ru_compression_params& compr)
21-
{
22-
uint8_t value = 0;
23-
value |= uint8_t(compr.data_width) << 4;
24-
value |= uint8_t(to_value(compr.type));
25-
26-
serializer.write(value);
27-
}
28-
2918
/// Encodes and returns the frame structure field. It is comprised by 4 LSB bits storing subcarrier spacing and 4 MSB
3019
/// bits storing the FFT/iFFT size.
3120
static uint8_t encode_frame_structure(cplane_scs scs, cplane_fft_size fft_size)
@@ -160,7 +149,7 @@ cplane_message_builder_impl::build_dl_ul_radio_channel_message(span<uint8_t>
160149
serializer.write(section_type);
161150

162151
// Compression header (1 Byte).
163-
serialize_compression_header(serializer, msg_params.comp_params);
152+
serialize_compression_header(serializer, msg_params.comp_params, msg_params.radio_hdr.direction);
164153

165154
// Reserved (1 Byte).
166155
static constexpr uint8_t reserved = 0U;
@@ -314,7 +303,7 @@ cplane_message_builder_impl::build_prach_mixed_numerology_message(span<uint8_t>
314303
serializer.write(uint16_t(msg_params.cpLength));
315304

316305
// Compression header (1 Byte).
317-
serialize_compression_header(serializer, msg_params.comp_params);
306+
serialize_compression_header(serializer, msg_params.comp_params, msg_params.radio_hdr.direction);
318307

319308
// Write the section fields. Only one section supported.
320309
serialize_section_3(serializer, msg_params.section_fields);

lib/ofh/serdes/ofh_cplane_message_builder_impl.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
namespace srsran {
1616
namespace ofh {
1717

18+
class network_order_binary_serializer;
19+
1820
/// Open Fronthaul Control-Plane message builder implementation.
1921
class cplane_message_builder_impl : public cplane_message_builder
2022
{
@@ -30,6 +32,12 @@ class cplane_message_builder_impl : public cplane_message_builder
3032
// See interface for documentation.
3133
unsigned build_prach_mixed_numerology_message(span<uint8_t> buffer,
3234
const cplane_section_type3_parameters& msg_params) override;
35+
36+
private:
37+
/// Serializes the compression header using the given serializer, compression parameters and direction.
38+
virtual void serialize_compression_header(network_order_binary_serializer& serializer,
39+
const ru_compression_params& compr,
40+
data_direction direction) const = 0;
3341
};
3442

3543
} // namespace ofh
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
*
3+
* Copyright 2021-2023 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#include "ofh_cplane_message_builder_static_compression_impl.h"
12+
#include "../support/network_order_binary_serializer.h"
13+
14+
using namespace srsran;
15+
using namespace ofh;
16+
17+
void cplane_message_builder_static_compression_impl::serialize_compression_header(
18+
network_order_binary_serializer& serializer,
19+
const ru_compression_params& compr,
20+
data_direction direction) const
21+
{
22+
// Static compression always encodes a 0.
23+
static constexpr uint8_t reserved = 0;
24+
serializer.write(reserved);
25+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
*
3+
* Copyright 2021-2023 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#pragma once
12+
13+
#include "ofh_cplane_message_builder_impl.h"
14+
15+
namespace srsran {
16+
namespace ofh {
17+
18+
/// Open Fronthaul Control-Plane message builder for static compression.
19+
class cplane_message_builder_static_compression_impl : public cplane_message_builder_impl
20+
{
21+
private:
22+
// See interface for documentation
23+
void serialize_compression_header(network_order_binary_serializer& serializer,
24+
const ru_compression_params& compr,
25+
data_direction direction) const override;
26+
};
27+
28+
} // namespace ofh
29+
} // namespace srsran

tests/unittests/ofh/serdes/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@
88

99
set_directory_properties(PROPERTIES LABELS "serdes")
1010

11+
add_executable(ofh_cplane_packet_builder_dynamic_compression_impl_test ofh_cplane_packet_builder_dynamic_compression_impl_test.cpp)
12+
target_link_libraries(ofh_cplane_packet_builder_dynamic_compression_impl_test srsran_ofh_message_serdes srsran_support gtest gtest_main)
13+
gtest_discover_tests(ofh_cplane_packet_builder_dynamic_compression_impl_test)
14+
1115
add_executable(ofh_cplane_packet_builder_impl_test ofh_cplane_packet_builder_impl_test.cpp)
1216
target_link_libraries(ofh_cplane_packet_builder_impl_test srsran_ofh_message_serdes srsran_support gtest gtest_main)
1317
gtest_discover_tests(ofh_cplane_packet_builder_impl_test)
1418

19+
add_executable(ofh_cplane_packet_builder_static_compression_impl_test ofh_cplane_packet_builder_static_compression_impl_test.cpp)
20+
target_link_libraries(ofh_cplane_packet_builder_static_compression_impl_test srsran_ofh_message_serdes srsran_support gtest gtest_main)
21+
gtest_discover_tests(ofh_cplane_packet_builder_static_compression_impl_test)
22+
1523
add_executable(ofh_uplane_packet_builder_dynamic_impl_test ofh_uplane_packet_builder_dynamic_impl_test.cpp)
1624
target_link_libraries(ofh_uplane_packet_builder_dynamic_impl_test srsran_ru_ofh srsran_support srsran_phy_support srsran_channel_precoder srslog gtest gtest_main)
1725
gtest_discover_tests(ofh_uplane_packet_builder_dynamic_impl_test)

0 commit comments

Comments
 (0)