On Wed, Oct 25, 2023 at 11:15 AM Ilya Maximets <i.maxim...@ovn.org> wrote:
>
> On 10/24/23 21:35, Han Zhou wrote:
> > Enhance MAC_Binding aging to allow CIDR-based threshold configurations.
> > This enables distinct threshold settings for different IP ranges,
> > applying the longest prefix matching for overlapping ranges.
> >
> > A common use case involves setting a default threshold for all IPs,
while
> > disabling aging for a specific range and potentially excluding a subset
> > within that range.
> >
> > Signed-off-by: Han Zhou <hz...@ovn.org>
> > ---
> >  northd/aging.c  | 297 +++++++++++++++++++++++++++++++++++++++++++++---
> >  northd/aging.h  |   3 +
> >  northd/northd.c |  11 +-
> >  ovn-nb.xml      |  63 +++++++++-
> >  tests/ovn.at    |  60 ++++++++++
> >  5 files changed, 413 insertions(+), 21 deletions(-)
> >
> > diff --git a/northd/aging.c b/northd/aging.c
> > index f626c72c8ca3..e5868211a63b 100644
> > --- a/northd/aging.c
> > +++ b/northd/aging.c
> > @@ -47,12 +47,253 @@ aging_waker_schedule_next_wake(struct aging_waker
*waker, int64_t next_wake_ms)
> >      }
> >  }
> >
> > +struct threshold_entry {
> > +    union {
> > +        ovs_be32 ipv4;
> > +        struct in6_addr ipv6;
> > +    } prefix;
> > +    bool is_v4;
>
> Hi, Han.  Thanks for the patch!
>
> Not a full review, but I wonder if it would be cleaner to replace
> all the structure members above with a single 'struct in6_addr prefix;'
> and store ipv4 addresses as ipv6-mapped ipv4.  This will allow to use
> a single array for storing the entries as well.  May save some lines
> of code.
>
> What do you think?

Thanks Ilya for the review. In fact using a common in6_addr in a single
array was my first attempt, but then I realized that if there are both IPv4
and IPv6 entries in the array, for each mac-binding checking, say if it is
IPv4, it may have to go through all the IPv6 entries unnecessarily. If
there are a huge amount of MAC-bindings to check, the time may be doubled.
Probably this doesn't have a big impact, but using two arrays didn't seem
too many lines of code, so I went with the current *safe* approach. Let me
know if you have a strong preference for the alternative, and I am happy to
change it.

>
> Also, this patch, probably, needs a NEWS entry.

I was wondering if this change is big enough to add one. Now I will add it
since you brought up :).

Thanks,
Han

>
> Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to