Skip to content

Commit f042425

Browse files
khooi8913Copilot
andauthored
v0.2.0 release
* Implement TX_TOTAL counter for uplink U-plane packets * Address code review feedback: add null check and clean up spacing * Fix uninitiated UL U-plane packet issue * Resolve merge conflicts tx_total and uplink cplane handling * docs: update known issues --------- Co-authored-by: khooi8913 <17496254+khooi8913@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 263f2dd commit f042425

File tree

5 files changed

+78
-17
lines changed

5 files changed

+78
-17
lines changed

apps/examples/ofh/ru_emulator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ class ru_emulator : public frame_notifier
545545

546546
low_cfg.logger->set_level(cfg.phy_log_level);
547547

548-
ofh_transmitter = std::make_shared<ofh_transmitter_impl>(logger, cfg.timing_params, transceiver.get_transmitter(), ul_frame_pool);
548+
ofh_transmitter = std::make_shared<ofh_transmitter_impl>(logger, cfg.timing_params, transceiver.get_transmitter(), ul_frame_pool, ul_context_repo, prach_cp_repo, &tx_total_counter);
549549

550550
low_cfg.error_notifier = &error_adapter;
551551
low_cfg.metric_notifier = &metrics_adapter;

apps/examples/ofh/ru_ofh_transmitter.cpp

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "srsran/adt/static_vector.h"
33
#include "srsran/adt/gps_clock.h"
44
#include "srsran/instrumentation/traces/ofh_traces.h"
5+
#include "./support/uplink_context_repository.h"
56

67
using namespace srsran;
78
using namespace ofh;
@@ -17,14 +18,24 @@ static slot_symbol_point calculate_ofh_slot_symbol_point(slot_symbol_point symbo
1718
return {ofh_slot, symbol_point.get_symbol_index(), symbol_point.get_nof_symbols()};
1819
}
1920

20-
ofh_transmitter_impl::ofh_transmitter_impl(srslog::basic_logger& logger_,
21-
const ru_window_timing_parameters& timing_params_,
22-
std::shared_ptr<ether::gateway> gw,
23-
std::shared_ptr<ether::eth_frame_pool> frame_pool) :
24-
logger(logger_), pool(std::move(frame_pool)), gateway(gw), timing_params(timing_params_)
21+
ofh_transmitter_impl::ofh_transmitter_impl(srslog::basic_logger& logger_,
22+
const ru_window_timing_parameters& timing_params_,
23+
std::shared_ptr<ether::gateway> gw,
24+
std::shared_ptr<ether::eth_frame_pool> frame_pool,
25+
std::shared_ptr<uplink_cplane_context_repository> ul_context_repo_,
26+
std::shared_ptr<uplink_cplane_context_repository> prach_context_repo_,
27+
ru_emu_stats::kpi_counter* tx_counter_) :
28+
logger(logger_),
29+
pool(std::move(frame_pool)),
30+
gateway(gw),
31+
timing_params(timing_params_),
32+
ul_context_repo(std::move(ul_context_repo_)),
33+
prach_context_repo(std::move(prach_context_repo_)),
34+
tx_counter(tx_counter_)
2535
{
2636
srsran_assert(gateway, "Invalid Ethernet gateway");
2737
srsran_assert(pool, "Invalid frame pool");
38+
srsran_assert(tx_counter, "Invalid TX counter");
2839
}
2940

3041
void ofh_transmitter_impl::transmit_frame_burst(span<span<const uint8_t>> frame_burst)
@@ -34,6 +45,8 @@ void ofh_transmitter_impl::transmit_frame_burst(span<span<const uint8_t>> frame_
3445
}
3546

3647
gateway->send(frame_burst);
48+
// Increment TX_TOTAL counter for uplink U-plane packets.
49+
tx_counter->increment(frame_burst.size());
3750
logger.debug("Sending an Ethernet frame burst of size '{}'", frame_burst.size());
3851
}
3952

@@ -95,5 +108,28 @@ void ofh_transmitter_impl::on_new_symbol(slot_symbol_point symbol_point)
95108
pool->clear_sent_frame_buffers(interval_up);
96109
pool->clear_sent_frame_buffers(interval_up_prach);
97110

111+
// Clear uplink C-Plane contexts for the transmitted slots to prevent stale contexts
112+
// from generating new frames after DU stops.
113+
if (ul_context_repo) {
114+
slot_point start_slot = interval_up.start.get_slot();
115+
slot_point end_slot = interval_up.end.get_slot();
116+
117+
// Clear contexts for all slots in the interval
118+
for (slot_point slot = start_slot; slot <= end_slot; ++slot) {
119+
ul_context_repo->clear_slot(slot);
120+
}
121+
}
122+
123+
// Clear PRACH C-Plane contexts for the transmitted slots.
124+
if (prach_context_repo) {
125+
slot_point start_slot = interval_up_prach.start.get_slot();
126+
slot_point end_slot = interval_up_prach.end.get_slot();
127+
128+
// Clear contexts for all slots in the interval
129+
for (slot_point slot = start_slot; slot <= end_slot; ++slot) {
130+
prach_context_repo->clear_slot(slot);
131+
}
132+
}
133+
98134
ofh_tracer << trace_event("ofh_ofh_transmitter", tp);
99135
}

apps/examples/ofh/ru_ofh_transmitter.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#pragma once
22

33
#include "./helpers/timing_window_params.h"
4+
#include "./support/uplink_context_repository.h"
5+
#include "./helpers.h"
46
#include "srsran/ofh/ethernet/ethernet_frame_pool.h"
57
#include "srsran/ofh/ethernet/ethernet_gateway.h"
68
#include "srsran/ofh/timing/ofh_ota_symbol_boundary_notifier.h"
@@ -24,12 +26,21 @@ class ofh_transmitter_impl : public ota_symbol_boundary_notifier
2426
std::shared_ptr<ether::gateway> gateway;
2527
/// Internal representation of timing parameters.
2628
const ru_window_timing_parameters timing_params;
29+
/// Uplink context repository (for clearing contexts after transmission).
30+
std::shared_ptr<uplink_cplane_context_repository> ul_context_repo;
31+
/// PRACH context repository (for clearing contexts after transmission).
32+
std::shared_ptr<uplink_cplane_context_repository> prach_context_repo;
33+
/// TX total counter for uplink U-plane packets.
34+
ru_emu_stats::kpi_counter* tx_counter;
2735

2836
public:
29-
ofh_transmitter_impl(srslog::basic_logger& logger_,
30-
const ru_window_timing_parameters& timing_params_,
31-
std::shared_ptr<ether::gateway> gw,
32-
std::shared_ptr<ether::eth_frame_pool> frame_pool);
37+
ofh_transmitter_impl(srslog::basic_logger& logger_,
38+
const ru_window_timing_parameters& timing_params_,
39+
std::shared_ptr<ether::gateway> gw,
40+
std::shared_ptr<ether::eth_frame_pool> frame_pool,
41+
std::shared_ptr<uplink_cplane_context_repository> ul_context_repo_,
42+
std::shared_ptr<uplink_cplane_context_repository> prach_context_repo_,
43+
ru_emu_stats::kpi_counter* tx_counter_);
3344

3445
// See interface for documentation.
3546
void on_new_symbol(slot_symbol_point symbol_point) override;

apps/examples/ofh/support/uplink_context_repository.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "srsran/ofh/ofh_constants.h"
2828
#include "srsran/ofh/serdes/ofh_cplane_message_properties.h"
2929
#include "srsran/ran/slot_pdu_capacity_constants.h"
30+
#include "srsran/srslog/srslog.h"
3031
#include <array>
3132
#include <mutex>
3233
#include <vector>
@@ -118,6 +119,26 @@ class uplink_cplane_context_repository
118119

119120
return make_unexpected(default_error_t{});
120121
}
122+
123+
/// Clears the context for the given slot and eAxC by resetting the number of symbols to 0.
124+
void clear(slot_point slot, unsigned eaxc)
125+
{
126+
std::lock_guard<std::mutex> lock(mutex);
127+
ul_cplane_context& ctx = entry(slot, eaxc);
128+
// Clear by setting nof_symbols to 0, which will cause future get() calls to fail
129+
ctx.nof_symbols = 0;
130+
}
131+
132+
/// Clears all contexts for the given slot across all eAxCs.
133+
void clear_slot(slot_point slot)
134+
{
135+
std::lock_guard<std::mutex> lock(mutex);
136+
unsigned index = calculate_repository_index(slot, repo.size());
137+
// Reset all eAxC entries for this slot
138+
for (auto& ctx : repo[index]) {
139+
ctx.nof_symbols = 0;
140+
}
141+
}
121142
};
122143

123144
} // namespace ofh

proto-ru/KNOWN_ISSUES.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33
This document lists known issues and limitations in ProtO-RU.
44

5-
1. Realtime KPI monitoring
6-
- TX_TOTAL counter is currently not (yet) implemented.
7-
8-
1. Uninitiated uplink U-plane packets
9-
- In some cases, ProtO-RU may be sending uplink U-plane packets even if there are no incoming C-plane packets from the DU/gNB after ProtO-RU is running for a while.
10-
- Note that this does not affect the normal operation of ProtO-RU, and this issue is currently under investigation.
11-
125
1. T2a/Ta3 value validation
136
- Currently, ProtO-RU does not validate the T2a/Ta3 values configured in the RU configuration file.
147
- Users must ensure that the T2a/Ta3 values are sufficiently large to provide enough time for the RU to process and transmit the data within the required deadlines.

0 commit comments

Comments
 (0)