]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: bridge: multicast: optimize TO_INCLUDE EHT timeouts
authorNikolay Aleksandrov <nikolay@nvidia.com>
Wed, 20 Jan 2021 14:52:00 +0000 (16:52 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 23 Jan 2021 03:39:57 +0000 (19:39 -0800)
This is an optimization specifically for TO_INCLUDE which sends queries
for the older entries and thus lowers the S,G timers to LMQT. If we have
the following situation for a group in either include or exclude mode:
 - host A was interested in srcs X and Y, but is timing out
 - host B sends TO_INCLUDE src Z, the bridge lowers X and Y's timeouts
   to LMQT
 - host B sends BLOCK src Z after LMQT time has passed
 => since host B is the last host we can delete the group, but if we
    still have host A's EHT entries for X and Y (i.e. if they weren't
    lowered to LMQT previously) then we'll have to wait another LMQT
    time before deleting the group, with this optimization we can
    directly remove it regardless of the group mode as there are no more
    interested hosts

Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/bridge/br_multicast_eht.c

index 861ae63f4a1c1d166eb67702c78378e8bff9e172..fee3060d04959922f0d4d0f4f71593761a9a6ed8 100644 (file)
@@ -656,6 +656,8 @@ static bool __eht_inc_exc(struct net_bridge_port_group *pg,
        }
        /* we can be missing sets only if we've deleted some entries */
        if (flush_entries) {
+               struct net_bridge *br = pg->key.port->br;
+               struct net_bridge_group_eht_set *eht_set;
                struct net_bridge_group_src *src_ent;
                struct hlist_node *tmp;
 
@@ -667,6 +669,25 @@ static bool __eht_inc_exc(struct net_bridge_port_group *pg,
                                changed = true;
                                continue;
                        }
+                       /* this is an optimization for TO_INCLUDE where we lower
+                        * the set's timeout to LMQT to catch timeout hosts:
+                        * - host A (timing out): set entries X, Y
+                        * - host B: set entry Z (new from current TO_INCLUDE)
+                        *           sends BLOCK Z after LMQT but host A's EHT
+                        *           entries still exist (unless lowered to LMQT
+                        *           so they can timeout with the S,Gs)
+                        * => we wait another LMQT, when we can just delete the
+                        *    group immediately
+                        */
+                       if (!(src_ent->flags & BR_SGRP_F_SEND) ||
+                           filter_mode != MCAST_INCLUDE ||
+                           !to_report)
+                               continue;
+                       eht_set = br_multicast_eht_set_lookup(pg,
+                                                             &eht_src_addr);
+                       if (!eht_set)
+                               continue;
+                       mod_timer(&eht_set->timer, jiffies + br_multicast_lmqt(br));
                }
        }