2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-05 08:45:23 +00:00

dpif-netdev: Simplify atomic function pointer stores.

The same pattern for atomic stores and initialization was used for the
DPIF and MFEX function pointers declared in struct dp_netdev_pmd_thread.
Simplify this pattern for all stores to 'miniflow_extract_opt' and
'netdev_input_func'.

Also replace the first store to 'miniflow_extract_opt' which was a
atomic_store_relaxed() with atomic_init().

Signed-off-by: Cian Ferriter <cian.ferriter@intel.com>
Acked-by: Kumar Amber <kumar.amber@intel.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Cian Ferriter
2022-02-21 16:01:26 +00:00
committed by Ilya Maximets
parent f77dbc1eb2
commit c356f6c0b9
3 changed files with 11 additions and 25 deletions

View File

@@ -241,9 +241,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
struct netdev_flow_key test_keys[NETDEV_MAX_BURST];
if (keys_size < cnt) {
miniflow_extract_func default_func = NULL;
atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
atomic_store_relaxed(&pmd->miniflow_extract_opt, NULL);
VLOG_ERR("Invalid key size supplied, Key_size: %d less than"
"batch_size: %" PRIuSIZE"\n", keys_size, cnt);
VLOG_ERR("Autovalidatior is disabled.\n");
@@ -350,9 +348,7 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
/* Having dumped the debug info for the batch, disable autovalidator. */
if (batch_failed) {
miniflow_extract_func default_func = NULL;
atomic_uintptr_t *pmd_func = (void *)&pmd->miniflow_extract_opt;
atomic_store_relaxed(pmd_func, (uintptr_t) default_func);
atomic_store_relaxed(&pmd->miniflow_extract_opt, NULL);
}
/* Preserve packet correctness by storing back the good offsets in