diff --git a/dataplane/controlplane.cpp b/dataplane/controlplane.cpp index a2386bfc..ee3b821b 100644 --- a/dataplane/controlplane.cpp +++ b/dataplane/controlplane.cpp @@ -1358,16 +1358,16 @@ void cControlPlane::switchGlobalBase() { YADECAP_MEMORY_BARRIER_COMPILE; - dataPlane->switch_worker_base(); - - YADECAP_MEMORY_BARRIER_COMPILE; - { std::lock_guard guard(dataPlane->currentGlobalBaseId_mutex); dataPlane->currentGlobalBaseId ^= 1; } YADECAP_MEMORY_BARRIER_COMPILE; + + dataPlane->switch_worker_base(); + + YADECAP_MEMORY_BARRIER_COMPILE; } void cControlPlane::waitAllWorkers() diff --git a/dataplane/dataplane.cpp b/dataplane/dataplane.cpp index 1182a6d0..6a3d0f37 100644 --- a/dataplane/dataplane.cpp +++ b/dataplane/dataplane.cpp @@ -1591,7 +1591,7 @@ void cDataPlane::switch_worker_base() std::lock_guard guard(currentGlobalBaseId_mutex); for (const auto& [socket_id, base_next] : base_nexts) { - base_next->globalBase = globalBases[socket_id][currentGlobalBaseId ^ 1]; + base_next->globalBase = globalBases[socket_id][currentGlobalBaseId]; } } neighbor.update_worker_base(base_nexts);