Skip to content

Commit e79e0af

Browse files
committed
mac: fix failing mac metrics unit test
1 parent 100ae6a commit e79e0af

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/mac/mac_ctrl/mac_metrics_aggregator.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,13 @@ class mac_metrics_aggregator::cell_metric_handler final : public mac_cell_metric
127127

128128
void on_cell_deactivation(const mac_dl_cell_metric_report& report) override
129129
{
130+
auto start_slot = next_report_end_slot_tx - period_slots;
130131
next_report_end_slot_tx = {};
131132
last_sl_tx = {};
132133
// Save MAC report and commit it.
133134
if (mac_builder != nullptr) {
134-
mac_builder->mac = report;
135+
mac_builder->mac = report;
136+
mac_builder->start_slot = start_slot;
135137
mac_builder.reset();
136138
}
137139
defer_until_success(parent.ctrl_exec, parent.timers, [this]() { parent.handle_cell_deactivation(cell_index); });
@@ -155,7 +157,8 @@ class mac_metrics_aggregator::cell_metric_handler final : public mac_cell_metric
155157

156158
// If the token is acquired, it means that it is this thread's job to dispatch a job to handle pending reports.
157159
unsigned ring_index = start_slot.count() / period_slots;
158-
bool token_acquired = not parent.report_ring[ring_index].end_slot_flag.exchange(true, std::memory_order_acq_rel);
160+
auto& ring_slot = parent.report_ring[ring_index];
161+
bool token_acquired = not ring_slot.end_slot_flag.exchange(true, std::memory_order_acq_rel);
159162
if (not token_acquired) {
160163
// Another cell is already handling the reports.
161164
return;

0 commit comments

Comments
 (0)