diff mbox series

[ovs-dev,branch-3.3,v1] ofproto-dpif-mirror: Always revalidate on mirror update.

Message ID 20240917193516.594830-1-mkp@redhat.com
State Accepted
Commit 2d14266cb9426436449e5b222d078661c0f87749
Delegated to: Kevin Traynor
Headers show
Series [ovs-dev,branch-3.3,v1] ofproto-dpif-mirror: Always revalidate on mirror update. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Mike Pattrick Sept. 17, 2024, 7:35 p.m. UTC
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 <ktraynor@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Mike Pattrick <mkp@redhat.com>
---
 ofproto/ofproto-dpif-mirror.c |  2 +-
 ofproto/ofproto-dpif.c        | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Eelco Chaudron Sept. 20, 2024, 6:58 a.m. UTC | #1
On 17 Sep 2024, at 21:35, Mike Pattrick wrote:

> 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 <ktraynor@redhat.com>
> Acked-by: Kevin Traynor <ktraynor@redhat.com>
> Signed-off-by: Mike Pattrick <mkp@redhat.com>

Change looks good to me. Should we backport this all the way down to 2.17?

Cheers,

Eelco

> ---
>  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 343b75f0e..45024580a 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 fe034f971..7e300c3f9 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -3669,6 +3669,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;
> -- 
> 2.43.5
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Eelco Chaudron Sept. 20, 2024, 11:40 a.m. UTC | #2
On 20 Sep 2024, at 8:58, Eelco Chaudron wrote:

> On 17 Sep 2024, at 21:35, Mike Pattrick wrote:
>
>> 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 <ktraynor@redhat.com>
>> Acked-by: Kevin Traynor <ktraynor@redhat.com>
>> Signed-off-by: Mike Pattrick <mkp@redhat.com>
>
> Change looks good to me. Should we backport this all the way down to 2.17?
>
> Cheers,
>
> Eelco

Forgot to add my ACK :(

Acked-by: Eelco Chaudron <echaudro@redhat.com>

>
>> ---
>>  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 343b75f0e..45024580a 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 fe034f971..7e300c3f9 100644
>> --- a/ofproto/ofproto-dpif.c
>> +++ b/ofproto/ofproto-dpif.c
>> @@ -3669,6 +3669,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;
>> -- 
>> 2.43.5
>>
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Kevin Traynor Sept. 20, 2024, 11:55 a.m. UTC | #3
On 20/09/2024 12:40, Eelco Chaudron wrote:
> 
> On 20 Sep 2024, at 8:58, Eelco Chaudron wrote:
> 
>> On 17 Sep 2024, at 21:35, Mike Pattrick wrote:
>>
>>> 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 <ktraynor@redhat.com>
>>> Acked-by: Kevin Traynor <ktraynor@redhat.com>
>>> Signed-off-by: Mike Pattrick <mkp@redhat.com>
>> Change looks good to me. Should we backport this all the way down to 2.17?
>>
>> Cheers,
>>
>> Eelco
> Forgot to add my ACK :(
> 
> Acked-by: Eelco Chaudron <echaudro@redhat.com>

Thanks Mike and Eelco. Pushed to branch-3.3 and down as far as branch-2.17.
diff mbox series

Patch

diff --git a/ofproto/ofproto-dpif-mirror.c b/ofproto/ofproto-dpif-mirror.c
index 343b75f0e..45024580a 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 fe034f971..7e300c3f9 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -3669,6 +3669,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;