Commit 4a78389a authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

sims/net/switch: Retry on full queue in sync mode

parent 07530e39
...@@ -144,11 +144,8 @@ class NetPort : public Port { ...@@ -144,11 +144,8 @@ class NetPort : public Port {
} }
virtual void Sync(uint64_t cur_ts) override { virtual void Sync(uint64_t cur_ts) override {
if (SimbricksNetIfN2DSync(&netif_, cur_ts, eth_latency, sync_period, while (SimbricksNetIfN2DSync(&netif_, cur_ts, eth_latency, sync_period,
sync_mode) != 0) { sync_mode));
fprintf(stderr, "SimbricksNetIfN2DSync failed\n");
abort();
}
} }
virtual void AdvanceEpoch(uint64_t cur_ts) override { virtual void AdvanceEpoch(uint64_t cur_ts) override {
...@@ -191,9 +188,12 @@ class NetPort : public Port { ...@@ -191,9 +188,12 @@ class NetPort : public Port {
const void *data, size_t len, uint64_t cur_ts) override { const void *data, size_t len, uint64_t cur_ts) override {
volatile union SimbricksProtoNetN2D *msg_to = volatile union SimbricksProtoNetN2D *msg_to =
SimbricksNetIfN2DAlloc(&netif_, cur_ts, eth_latency); SimbricksNetIfN2DAlloc(&netif_, cur_ts, eth_latency);
if (!msg_to) if (!msg_to && !sync_) {
return false; return false;
} else if (!msg_to && sync_) {
while (!msg_to)
msg_to = SimbricksNetIfN2DAlloc(&netif_, cur_ts, eth_latency);
}
volatile struct SimbricksProtoNetN2DRecv *rx; volatile struct SimbricksProtoNetN2DRecv *rx;
rx = &msg_to->recv; rx = &msg_to->recv;
rx->len = len; rx->len = len;
...@@ -251,10 +251,7 @@ class NetHostPort : public Port { ...@@ -251,10 +251,7 @@ class NetHostPort : public Port {
} }
virtual void Sync(uint64_t cur_ts) override { virtual void Sync(uint64_t cur_ts) override {
if (SimbricksNicIfSync(&nicif_, cur_ts) != 0) { while (SimbricksNicIfSync(&nicif_, cur_ts));
fprintf(stderr, "SimbricksNicIfSync failed\n");
abort();
}
} }
virtual void AdvanceEpoch(uint64_t cur_ts) override { virtual void AdvanceEpoch(uint64_t cur_ts) override {
...@@ -298,8 +295,12 @@ class NetHostPort : public Port { ...@@ -298,8 +295,12 @@ class NetHostPort : public Port {
const void *data, size_t len, uint64_t cur_ts) override { const void *data, size_t len, uint64_t cur_ts) override {
volatile union SimbricksProtoNetD2N *msg_to = volatile union SimbricksProtoNetD2N *msg_to =
SimbricksNicIfD2NAlloc(&nicif_, cur_ts); SimbricksNicIfD2NAlloc(&nicif_, cur_ts);
if (!msg_to) if (!msg_to && !sync_) {
return false; return false;
} else if (!msg_to && sync_) {
while (!msg_to)
msg_to = SimbricksNicIfD2NAlloc(&nicif_, cur_ts);
}
volatile struct SimbricksProtoNetD2NSend *rx; volatile struct SimbricksProtoNetD2NSend *rx;
rx = &msg_to->send; rx = &msg_to->send;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment