Skip to content

Commit db0f5be

Browse files
robertfalkenbergcodebot
authored andcommitted
f1u,cu_up: run dl_notif_timer only when needed
1 parent 12d3ed7 commit db0f5be

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

lib/f1u/cu_up/f1u_bearer_impl.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ f1u_bearer_impl::f1u_bearer_impl(uint32_t ue_index,
3232
{
3333
dl_notif_timer.set(std::chrono::milliseconds(f1u_dl_notif_time_ms),
3434
[this](timer_id_t tid) { on_expired_dl_notif_timer(); });
35-
dl_notif_timer.run();
3635
}
3736

3837
void f1u_bearer_impl::handle_pdu(nru_ul_message msg)
@@ -85,11 +84,18 @@ void f1u_bearer_impl::handle_sdu(pdcp_tx_pdu sdu)
8584
// attach discard blocks (if any)
8685
fill_discard_blocks(msg);
8786

87+
// stop backoff timer
88+
dl_notif_timer.stop();
89+
8890
tx_pdu_notifier.on_new_pdu(std::move(msg));
8991
}
9092

9193
void f1u_bearer_impl::discard_sdu(uint32_t pdcp_sn)
9294
{
95+
// start backoff timer
96+
if (!dl_notif_timer.is_running()) {
97+
dl_notif_timer.run();
98+
}
9399
if (discard_blocks.empty()) {
94100
discard_blocks.push_back(nru_pdcp_sn_discard_block{});
95101
nru_pdcp_sn_discard_block& block = discard_blocks.back();
@@ -124,8 +130,6 @@ void f1u_bearer_impl::fill_discard_blocks(nru_dl_message& msg)
124130
msg.dl_user_data.discard_blocks = std::move(discard_blocks);
125131
discard_blocks = {};
126132
}
127-
// restart UL notification timer
128-
dl_notif_timer.run();
129133
}
130134

131135
void f1u_bearer_impl::on_expired_dl_notif_timer()
@@ -137,7 +141,13 @@ void f1u_bearer_impl::on_expired_dl_notif_timer()
137141
void f1u_bearer_impl::flush_discard_blocks()
138142
{
139143
nru_dl_message msg = {};
144+
145+
// attach discard blocks (if any)
140146
fill_discard_blocks(msg);
147+
148+
// stop backoff timer
149+
dl_notif_timer.stop();
150+
141151
if (msg.dl_user_data.discard_blocks.has_value()) {
142152
logger.log_debug("Sending discard blocks");
143153
tx_pdu_notifier.on_new_pdu(std::move(msg));

tests/unittests/f1u/cu_up/f1u_cu_up_bearer_test.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ TEST_F(f1u_cu_up_test, tx_discard)
125125
constexpr uint32_t pdu_size = 10;
126126
constexpr uint32_t pdcp_sn = 123;
127127

128+
// advance time by one to ensure timer is stopped and ignores this tick
129+
tick();
130+
128131
f1u->discard_sdu(pdcp_sn);
129132
// advance time just before the timer-based DL notification is triggered
130133
for (uint32_t t = 0; t < f1u_dl_notif_time_ms - 1; t++) {
@@ -161,6 +164,9 @@ TEST_F(f1u_cu_up_test, tx_discard)
161164
tester->tx_msg_list.pop_front();
162165
ASSERT_TRUE(tester->tx_msg_list.empty());
163166

167+
// advance time by one to ensure timer is stopped and ignores this tick
168+
tick();
169+
164170
f1u->discard_sdu(pdcp_sn + 7);
165171
// advance time just before the timer-based DL notification is triggered
166172
for (uint32_t t = 0; t < f1u_dl_notif_time_ms - 1; t++) {

0 commit comments

Comments
 (0)