Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/cell-m6.md
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,36 @@ replay checks caught it in the signed-list run: UE2 reported cell 1 in only
- only a gap that ran consumes its suspend superframe; a failed one (late,
the beacon would not stop) is left to that log.

**A handover arrival placed on a position a schedule was giving another
UE.** One `m6_daps_dl` run showed the target's DL to the arriving UE
~111 µs late (2–3 µs elsewhere) and 13 uplinks lost; it was recorded as not
reproduced. It was a race, and a frequent one.
- **What happened:** the CU's coordination schedule moved the target's own
UE from position 1 to 2. Before that schedule was on air, the CU issued
the handover with target position 2, taken free from the target's report
(which predated the schedule).
- **Why the target accepted it:** its free-position check read a snapshot
of the map that was refreshed once per main-loop pass, not at the commit.
Both UEs then sat on position 2: the arrival's DL frame queued behind the
other's in one slot (~110 µs, one frame's airtime), and their uplinks
collided.
- **How often:** in the saved rig logs, 201 of 1550 handover commands (13 %)
were refused by the target as `invalid`. That was the same race, caught
when the target's view was fresh, and the CU retried. 41–53 % of the
same-channel A3 handover runs had one, and 14 DU logs show the race
missed (two UEs on one position). Cross-channel runs never had it: the
coordination moves only co-channel positions.
- **The fix:**
- The CU holds a handover while either DU has a schedule pushed and not
yet applied (the reverse of the schedule's own in-flight guard).
- It chooses the target's id and position against its own last schedule
for that DU as well as the report.
- The DU counts a staged schedule's positions as taken.
- The DU refreshes its handover check's view of the map at the commit.
- **Rig, after:** 25 runs (`m6_handover.sh` 6 normal + 3 fault,
`m6_daps_dl.sh` all 16), 29 commands: 0 refused, no position shared,
the arrival's DL 2–3 µs late (p50) in every run.

**First attempts at execution, in order:**
1. The source's stale reports re-triggered the A3 for the UE that had just
left, which issued a duplicate command. The CU now retires the old key.
Expand Down
10 changes: 10 additions & 0 deletions examples/cell/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2124,7 +2124,12 @@ int run_du(IRadio *dev, const Cfg &c) {
last_ho_seq = cmd.seq;
}
net_now = f1_view.net_sf;
/* Taken: the map on air and a schedule staged to replace it (an
* arrival placed on a position the next schedule gives another UE
* collides with it from that instant: shared DL and UL slots). */
live = f1_view.ues;
if (const auto &sg = stager.staged())
live.insert(live.end(), sg->ues.begin(), sg->ues.end());
again = (cmd.target == c.cell && ho_in.count(cmd.target_ue) &&
ho_in[cmd.target_ue].id == cmd.id) ||
(cmd.source == c.cell && ho_out.count(cmd.ue) && ho_out[cmd.ue].id == cmd.id);
Expand Down Expand Up @@ -3110,6 +3115,11 @@ int run_du(IRadio *dev, const Cfg &c) {
ta_report.clear();
for (const Grant &g : map.grants)
ta_report[g.ue] = g.ta_us;
/* The positions the F1 thread checks a handover against: the map
* just committed, at once (not at the next pass). */
f1_view.ues.clear();
for (const Grant &g : map.grants)
f1_view.ues.push_back({g.ue, position_of(g)});
}
if (f1_eff) {
std::lock_guard<std::mutex> lk(f1_mu);
Expand Down
3 changes: 3 additions & 0 deletions src/cell/F1.h
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,9 @@ class Stager {
}
uint32_t applied_version() const { return applied_ ? applied_->version : 0; }
uint32_t staged_version() const { return staged_ ? staged_->version : 0; }
/* The staged schedule (not yet on air): its positions are already taken
* for anything else this DU is asked to place (a handover arrival). */
const std::optional<Schedule> &staged() const { return staged_; }
const std::optional<Schedule> &applied() const { return applied_; }

private:
Expand Down
16 changes: 14 additions & 2 deletions tools/ran-controller/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,24 +1113,36 @@ int main() {
for (const auto &fl : flights)
busy = busy || fl.second.cmd.target == *act || fl.second.cmd.source == *act ||
fl.second.cmd.target == cell || fl.second.cmd.source == cell;
/* Nor while either DU has a schedule pushed and not yet applied:
* the positions in its report are about to change (the reverse
* of the schedule's own in-flight guard). */
for (const uint16_t x : {cell, *act})
if (auto xd = dus.find(x); xd != dus.end() && xd->second.sched && !xd->second.sched_refused &&
xd->second.rep.applied_version < xd->second.sched->version)
busy = true;
auto tit = dus.find(*act);
/* The target's report must be current: its capacity, channel and
* clock are what the command is built from. */
const bool tgt_fresh = tit != dus.end() && now - tit->second.at < std::chrono::seconds(3);
if (!busy && tgt_fresh && tit->second.rep.net_sf > 0 && dit->second.rep.net_sf > 0) {
const f1::Report &sr = dit->second.rep, &tr = tit->second.rep;
/* Taken at the target: what it reports, and what this CU last
* scheduled it (its report may predate that schedule). */
std::vector<CoordAssign> taken = tr.ues;
if (tit->second.sched)
taken.insert(taken.end(), tit->second.sched->ues.begin(), tit->second.sched->ues.end());
uint16_t tue = 0;
for (uint16_t u = 1; u <= tr.positions.size() && !tue; ++u) {
bool used = false;
for (const auto &a : tr.ues)
for (const auto &a : taken)
used = used || a.ue == u;
if (!used)
tue = u;
}
uint8_t tpos = 0;
for (uint8_t p = 1; p <= tr.positions.size() && !tpos; ++p) {
bool used = false;
for (const auto &a : tr.ues)
for (const auto &a : taken)
used = used || a.pos == p;
if (!used)
tpos = p;
Expand Down
Loading