Skip to content

Commit 3e1b228

Browse files
author
Barath Raghavan
committed
Update field order.
1 parent b01d865 commit 3e1b228

11 files changed

Lines changed: 19 additions & 19 deletions

File tree

core/module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ using bess::gate_idx_t;
2121
#define UNCONSTRAINED_SOCKET ((0x1ull << MAX_NUMA_NODE) - 1)
2222

2323
struct task_result {
24+
bool block;
2425
uint32_t packets;
2526
uint64_t bits;
26-
bool block;
2727
};
2828

2929
typedef uint16_t task_id_t;

core/module_bench.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DummySourceModule : public Module {
3333

3434
RunNextModule(&batch);
3535

36-
return { .packets = batch_size, .bits = 0, .block = false };
36+
return { .block = false, .packets = batch_size, .bits = 0 };
3737
}
3838

3939
class DummyRelayModule : public Module {

core/modules/drr.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ struct task_result DRR::RunTask(void*) {
131131
// the number of bits inserted into the packet batch
132132
uint32_t cnt = batch.cnt();
133133
uint64_t bits_retrieved = (total_bytes + cnt * kPacketOverhead) * 8;
134-
return { .packets = cnt, .bits = bits_retrieved, .block = (cnt == 0) };
134+
return { .block = (cnt == 0), .packets = cnt, .bits = bits_retrieved };
135135
}
136136

137137
uint32_t DRR::GetNextBatch(bess::PacketBatch* batch, int* err) {

core/modules/flowgen.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,9 @@ struct task_result FlowGen::RunTask(void *) {
487487

488488
uint32_t cnt = batch.cnt();
489489
return {
490+
.block = (cnt == 0),
490491
.packets = cnt,
491-
.bits = ((template_size_ + pkt_overhead) * cnt) * 8,
492-
.block = (cnt == 0)
492+
.bits = ((template_size_ + pkt_overhead) * cnt) * 8
493493
};
494494
}
495495

core/modules/noop.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CommandResponse NoOP::Init(const bess::pb::EmptyArg &) {
1111
}
1212

1313
struct task_result NoOP::RunTask(void *) {
14-
return { .packets = 0, .bits = 0, .block = false };
14+
return { .block = false, .packets = 0, .bits = 0 };
1515
}
1616

1717
ADD_MODULE(NoOP, "noop", "creates a task that does nothing")

core/modules/port_inc.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct task_result PortInc::RunTask(void *arg) {
8383
batch.set_cnt(p->RecvPackets(qid, batch.pkts(), burst));
8484
uint32_t cnt = batch.cnt();
8585
if (cnt == 0) {
86-
return { .packets = 0, .bits = 0, .block = true };
86+
return { .block = true, .packets = 0, .bits = 0 };
8787
}
8888

8989
// NOTE: we cannot skip this step since it might be used by scheduler.
@@ -106,9 +106,9 @@ struct task_result PortInc::RunTask(void *arg) {
106106
RunNextModule(&batch);
107107

108108
return {
109+
.block = false,
109110
.packets = cnt,
110-
.bits = (received_bytes + cnt * pkt_overhead) * 8,
111-
.block = false
111+
.bits = (received_bytes + cnt * pkt_overhead) * 8
112112
};
113113
}
114114

core/modules/queue.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ struct task_result Queue::RunTask(void *) {
119119
uint32_t cnt = llring_sc_dequeue_burst(queue_, (void **)batch.pkts(), burst);
120120

121121
if (cnt == 0) {
122-
return { .packets = 0, .bits = 0, .block = true };
122+
return { .block = true, .packets = 0, .bits = 0 };
123123
}
124124

125125
batch.set_cnt(cnt);
@@ -137,9 +137,9 @@ struct task_result Queue::RunTask(void *) {
137137
}
138138

139139
return {
140+
.block = false,
140141
.packets = cnt,
141-
.bits = (total_bytes + cnt * pkt_overhead) * 8,
142-
.block = false
142+
.bits = (total_bytes + cnt * pkt_overhead) * 8
143143
};
144144
}
145145

core/modules/queue_inc.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct task_result QueueInc::RunTask(void *arg) {
7070
uint32_t cnt = batch.cnt();
7171

7272
if (cnt == 0) {
73-
return { .packets = 0, .bits = 0, .block = true };
73+
return { .block = true, .packets = 0, .bits = 0 };
7474
}
7575

7676
// NOTE: we cannot skip this step since it might be used by scheduler.
@@ -93,9 +93,9 @@ struct task_result QueueInc::RunTask(void *arg) {
9393
RunNextModule(&batch);
9494

9595
return {
96+
.block = false,
9697
.packets = cnt,
97-
.bits = (received_bytes + cnt * pkt_overhead) * 8,
98-
.block = false
98+
.bits = (received_bytes + cnt * pkt_overhead) * 8
9999
};
100100
}
101101

core/modules/source.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ struct task_result Source::RunTask(void *) {
6363
RunNextModule(&batch); // it's fine to call this function with cnt==0
6464

6565
return {
66+
.block = (cnt == 0),
6667
.packets = cnt,
67-
.bits = (pkt_size + pkt_overhead) * cnt * 8,
68-
.block = (cnt == 0)
68+
.bits = (pkt_size + pkt_overhead) * cnt * 8
6969
};
7070
}
7171

core/traffic_class_bench.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DummyModule : public Module {
2525

2626
[[gnu::noinline]] struct task_result DummyModule::RunTask(
2727
[[maybe_unused]] void *arg) {
28-
return { .packets = 0, .bits = 0, .block = false };
28+
return { .block = false, .packets = 0, .bits = 0 };
2929
}
3030

3131
// Performs TC Scheduler init/deinit before/after each test.

0 commit comments

Comments
 (0)