Skip to content

Commit 54eb160

Browse files
committed
dpif-netdev: Reorder flow mark assignment.
During code-review, it seems like it could be possible to publish a flow into the cmap, and the hw offload thread assistance could miss the appropriate flow. This situation probably didn't occur much in practice, and the result might be just a dropped packet (although, I'm not sure that it couldn't also result in a weird duplicate flow getting installed due to the check in mark_to_flow_find that gets called during dfc_processing). This change reorders the assignment to before the cmap_insert. The cmap_insert should act as a barrier in this case to ensure that the write to flow->mark is ready before the read (after the CMAP_FOR_EACH_WITH_HASH). Fixes: 241bad1 ("dpif-netdev: associate flow with a mark id") Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Aaron Conole <aconole@redhat.com>
1 parent 704c8a0 commit 54eb160

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/dpif-netdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2599,10 +2599,10 @@ mark_to_flow_associate(const uint32_t mark, struct dp_netdev_flow *flow)
25992599
unsigned int tid = netdev_offload_thread_id();
26002600
dp_netdev_flow_ref(flow);
26012601

2602+
flow->mark = mark;
26022603
cmap_insert(&dp_offload_threads[tid].mark_to_flow,
26032604
CONST_CAST(struct cmap_node *, &flow->mark_node),
26042605
hash_int(mark, 0));
2605-
flow->mark = mark;
26062606

26072607
VLOG_DBG("Associated dp_netdev flow %p with mark %u mega_ufid "UUID_FMT,
26082608
flow, mark, UUID_ARGS((struct uuid *) &flow->mega_ufid));

0 commit comments

Comments
 (0)