Skip to content

Commit

Permalink
event/sw: fix ordering corruption with op release
Browse files Browse the repository at this point in the history
[ upstream commit 5078a8f37d82f3b54cf373389b6754e2bafd584f ]

This commit changes the logic in the scheduler to always
reset reorder-buffer (and QID/FID) entries when writing
them. This avoids stale ROB/QID/FID data re-use, which
previously caused ordering issues.

Before this commit, release events left the history-list
in an inconsistent state, and future events with op type of
forward could be incorrectly reordered.

There was a partial fix previously committed which is now
being resolved for all cases in a more general way, hence
the two fixlines here.

Fixes: 2e516d1 ("event/sw: fix events mis-identified as needing reorder")
Fixes: 617995d ("event/sw: add scheduling logic")

Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  • Loading branch information
harry-van-haaren authored and bluca committed Oct 18, 2023
1 parent 290d8dd commit 8e05122
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/event/sw/sw_evdev_scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ sw_schedule_atomic_to_cq(struct sw_evdev *sw, struct sw_qid * const qid,
sw->cq_ring_space[cq]--;

int head = (p->hist_head++ & (SW_PORT_HIST_LIST-1));
p->hist_list[head].fid = flow_id;
p->hist_list[head].qid = qid_id;
p->hist_list[head] = (struct sw_hist_list_entry) {
.qid = qid_id,
.fid = flow_id,
};

p->stats.tx_pkts++;
qid->stats.tx_pkts++;
Expand Down Expand Up @@ -162,8 +164,10 @@ sw_schedule_parallel_to_cq(struct sw_evdev *sw, struct sw_qid * const qid,
qid->stats.tx_pkts++;

const int head = (p->hist_head & (SW_PORT_HIST_LIST-1));
p->hist_list[head].fid = SW_HASH_FLOWID(qe->flow_id);
p->hist_list[head].qid = qid_id;
p->hist_list[head] = (struct sw_hist_list_entry) {
.qid = qid_id,
.fid = SW_HASH_FLOWID(qe->flow_id),
};

if (keep_order)
rob_ring_dequeue(qid->reorder_buffer_freelist,
Expand Down Expand Up @@ -413,7 +417,6 @@ __pull_port_lb(struct sw_evdev *sw, uint32_t port_id, int allow_reorder)
struct reorder_buffer_entry *rob_entry =
hist_entry->rob_entry;

hist_entry->rob_entry = NULL;
/* Although fragmentation not currently
* supported by eventdev API, we support it
* here. Open: How do we alert the user that
Expand Down

0 comments on commit 8e05122

Please sign in to comment.