Fix out of order

This commit is contained in:
Quentin 2019-08-30 10:48:23 +02:00
parent 3f40d205c9
commit f61148345e

View file

@ -180,8 +180,11 @@ release:
int is_in_order(struct thunder_ctx* thunderc, uint8_t link_id) { int is_in_order(struct thunder_ctx* thunderc, uint8_t link_id) {
uint64_t ref = thunderc->received_pkts_on_link[link_id]; uint64_t ref = thunderc->received_pkts_on_link[link_id];
for (int i = 0; i < thunderc->total_links; i++) { for (int i = 0; i < thunderc->total_links; i++) {
uint64_t expected = link_id > i ? ref - 1 : ref; uint64_t expected = link_id >= i ? ref : ref - 1;
if (thunderc->received_pkts_on_link[i] > expected) return 0; if (thunderc->received_pkts_on_link[i] > expected) {
printf("link_id=%d, i=%d, pkt_i=%ld, pkt_i_expected=%ld, pkt_link_id=%ld\n", link_id, i, thunderc->received_pkts_on_link[i], expected, ref);
return 0;
}
} }
return 1; return 1;
@ -253,7 +256,7 @@ void classify(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct b
if (timeout <= 0) { if (timeout <= 0) {
on_block(ctx, bi); on_block(ctx, bi);
printf(" Missing Packet - Blocked link %d (expected: %ld, seen: %ld, )\n", i, expected, thunderc->received_pkts_on_link[i]); printf(" Missing Packet - Blocked link %d (expected: %ld, seen: %ld)\n", i, expected, thunderc->received_pkts_on_link[i]);
continue; continue;
} }