mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
dpif-netdev-dpcls: Make subtable reprobe thread-safe.
The subtable search function can be used at any time by a PMD thread.
Setting the subtable search function should be done atomically to
prevent garbage data from being read.
A dpcls_subtable_lookup_reprobe() call can happen at the same time that
DPCLS subtables are being sorted. This could lead to modifications done
by the reprobe() to be lost. Prevent this from happening by locking on
pmd->flow_mutex. After this change both the reprobe function and a
subtable sort will share the flow_mutex preventing modifications by
either one from being lost.
Also remove the pvector_publish() call. The pvector is not being changed
in dpcls_subtable_lookup_reprobe(), only the data pointed to by pointers
in the vector are being changed.
Fixes: 3d018c3ea7
("dpif-netdev: add subtable lookup prio set command.")
Reported-by: Ilya Maximets <i.maximets@ovn.org>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2022-January/390757.html
Signed-off-by: Cian Ferriter <cian.ferriter@intel.com>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
committed by
Ian Stokes
parent
5f4dfcccba
commit
f92e6946d0
@@ -83,8 +83,10 @@ struct dpcls_subtable {
|
||||
/* The lookup function to use for this subtable. If there is a known
|
||||
* property of the subtable (eg: only 3 bits of miniflow metadata is
|
||||
* used for the lookup) then this can point at an optimized version of
|
||||
* the lookup function for this particular subtable. */
|
||||
dpcls_subtable_lookup_func lookup_func;
|
||||
* the lookup function for this particular subtable. The lookup function
|
||||
* can be used at any time by a PMD thread, so it's declared as an atomic
|
||||
* here to prevent garbage from being read. */
|
||||
ATOMIC(dpcls_subtable_lookup_func) lookup_func;
|
||||
|
||||
/* Caches the masks to match a packet to, reducing runtime calculations. */
|
||||
uint64_t *mf_masks;
|
||||
|
Reference in New Issue
Block a user