From 72da322f89fc00053766bf9f785649ab77611700 Mon Sep 17 00:00:00 2001 From: Mike Pattrick Date: Tue, 17 Sep 2024 15:35:16 -0400 Subject: [PATCH] ofproto-dpif-mirror: Always revalidate on mirror update. Previously updating mirror settings would not trigger a revalidation, this could result in impactful changes to mirrors taking a long time to take effect. This change sets need_revalidate whenever a setting is successfully set on a mirror. Fixes: ec7ceaed4f3e ("ofproto-dpif: Modularize mirror code.") Reported-at: https://issues.redhat.com/browse/FDP-788 Tested-by: Kevin Traynor Acked-by: Kevin Traynor Signed-off-by: Mike Pattrick Acked-by: Eelco Chaudron Signed-off-by: Kevin Traynor --- ofproto/ofproto-dpif-mirror.c | 2 +- ofproto/ofproto-dpif.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ofproto/ofproto-dpif-mirror.c b/ofproto/ofproto-dpif-mirror.c index 343b75f0ed0..45024580aa6 100644 --- a/ofproto/ofproto-dpif-mirror.c +++ b/ofproto/ofproto-dpif-mirror.c @@ -265,7 +265,7 @@ mirror_set(struct mbridge *mbridge, void *aux, const char *name, { hmapx_destroy(&srcs_map); hmapx_destroy(&dsts_map); - return 0; + return ECANCELED; } /* XXX: Not sure if these need to be thread safe. */ diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index f20ed9a3f1a..cf4679480db 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3667,6 +3667,16 @@ mirror_set__(struct ofproto *ofproto_, void *aux, s->n_dsts, s->src_vlans, bundle_lookup(ofproto, s->out_bundle), s->snaplen, s->out_vlan); + + if (!error) { + ofproto->backer->need_revalidate = REV_RECONFIGURE; + } else if (error == ECANCELED) { + /* The user requested a change that is identical to the current state, + * the reconfiguration is canceled, but don't log an error message + * about that. */ + error = 0; + } + free(srcs); free(dsts); return error;