Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2030018pxj; Sun, 9 May 2021 12:48:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgyAZQaZAY00iNTzzXJxk7ZMdg8yrFJ2QTJnse6QGDqrbekpnlR0MNDmH7SgPXmv8P0XEh X-Received: by 2002:aa7:c655:: with SMTP id z21mr24956304edr.283.1620589688338; Sun, 09 May 2021 12:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620589688; cv=none; d=google.com; s=arc-20160816; b=wIe1fkx+XOVxK0qornBZx4Rxzp3vVFlbdEjMr45c3NfcNXe48dTnuEepzUlSTtpDKN bei7Vnods/RRsSfrqOsvE7DhQgTJX8AFzXdN9q23jjUZYiere29bUFkh47SZsf9QwBYk McW52BsrZYr40O+27jyEcKiRKfiOh0ZjRq2NoRZDZigH/J9sYzJU09jSwFN2qrBMvtJd NgIVdKSoLsNnfyMY5FDdgRVzA9wPBYzskPUN/4RFMA0UfleHi0sZ2UBqKsZfYdKNGK0x ZO2OgeM4mbhHjVYB7A32sdjXXeFrrQ26n35P1n+RzlsFQjn6wMTDhIY3mQoCv5Pb8PA6 bfBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=uHH27GNY449jAS163rZEGWDmcj973Lo8Egf3xtKcPQ4=; b=wVduZ+68mF8d7MOSx9U3LicangYt7YtBhY843aCyR4uw1onFyyNs2dAuJZ/+Om+bbk AltQLjE+lmr+tUkvvla4LQWhh4HCF294olWWh9zw8kXAtpHedt83K7KLBokzEp4mwpVM 3lPQlltuwnIW1C3dgPEOOLedlJ9lXUks8neT1Vhm3WLDzSx6yec3P2KtxEtBKo122jfW eeRbwsGQ7NTd/D7O+NY3tgE9Sb5IT4tx+IoPRDiipSEk/ojPtdj0eWBUpr79D3YD4/Ho hjWn/LxJqp+m4zamnnlQCDF5MWt6sS2Q2GIKtYZqiaxaSi2Glh3CkwACRg6vwrMpq9mb TBmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si7760401edb.70.2021.05.09.12.47.45; Sun, 09 May 2021 12:48:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230170AbhEITqw (ORCPT + 99 others); Sun, 9 May 2021 15:46:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbhEITqc (ORCPT ); Sun, 9 May 2021 15:46:32 -0400 Received: from mail.aperture-lab.de (mail.aperture-lab.de [IPv6:2a01:4f8:c2c:665b::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB23CC061573; Sun, 9 May 2021 12:45:28 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2EF053EDE1; Sun, 9 May 2021 21:45:27 +0200 (CEST) From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: netdev@vger.kernel.org Cc: Roopa Prabhu , Nikolay Aleksandrov , Jakub Kicinski , "David S . Miller" , bridge@lists.linux-foundation.org, b.a.t.m.a.n@lists.open-mesh.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Linus=20L=C3=BCssing?= Subject: [net-next v2 06/11] net: bridge: mcast: prepare expiry functions for mcast router split Date: Sun, 9 May 2021 21:45:04 +0200 Message-Id: <20210509194509.10849-7-linus.luessing@c0d3.blue> In-Reply-To: <20210509194509.10849-1-linus.luessing@c0d3.blue> References: <20210509194509.10849-1-linus.luessing@c0d3.blue> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation for the upcoming split of multicast router state into their IPv4 and IPv6 variants move the protocol specific timer access to an ip4 wrapper function. Signed-off-by: Linus Lüssing --- net/bridge/br_multicast.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 048b5b9..6c844b2 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -1354,16 +1354,16 @@ static int br_ip6_multicast_add_group(struct net_bridge *br, } #endif -static void br_multicast_router_expired(struct timer_list *t) +static void br_multicast_router_expired(struct net_bridge_port *port, + struct timer_list *t, + struct hlist_node *rlist) { - struct net_bridge_port *port = - from_timer(port, t, ip4_mc_router_timer); struct net_bridge *br = port->br; spin_lock(&br->multicast_lock); if (port->multicast_router == MDB_RTR_TYPE_DISABLED || port->multicast_router == MDB_RTR_TYPE_PERM || - timer_pending(&port->ip4_mc_router_timer)) + timer_pending(t)) goto out; __del_port_router(port); @@ -1371,6 +1371,13 @@ out: spin_unlock(&br->multicast_lock); } +static void br_ip4_multicast_router_expired(struct timer_list *t) +{ + struct net_bridge_port *port = from_timer(port, t, ip4_mc_router_timer); + + br_multicast_router_expired(port, t, &port->ip4_rlist); +} + static void br_mc_router_state_change(struct net_bridge *p, bool is_mc_router) { @@ -1384,10 +1391,9 @@ static void br_mc_router_state_change(struct net_bridge *p, switchdev_port_attr_set(p->dev, &attr, NULL); } -static void br_multicast_local_router_expired(struct timer_list *t) +static void br_multicast_local_router_expired(struct net_bridge *br, + struct timer_list *timer) { - struct net_bridge *br = from_timer(br, t, ip4_mc_router_timer); - spin_lock(&br->multicast_lock); if (br->multicast_router == MDB_RTR_TYPE_DISABLED || br->multicast_router == MDB_RTR_TYPE_PERM || @@ -1400,6 +1406,13 @@ out: spin_unlock(&br->multicast_lock); } +static inline void br_ip4_multicast_local_router_expired(struct timer_list *t) +{ + struct net_bridge *br = from_timer(br, t, ip4_mc_router_timer); + + br_multicast_local_router_expired(br, t); +} + static void br_multicast_querier_expired(struct net_bridge *br, struct bridge_mcast_own_query *query) { @@ -1615,7 +1628,7 @@ int br_multicast_add_port(struct net_bridge_port *port) port->multicast_eht_hosts_limit = BR_MCAST_DEFAULT_EHT_HOSTS_LIMIT; timer_setup(&port->ip4_mc_router_timer, - br_multicast_router_expired, 0); + br_ip4_multicast_router_expired, 0); timer_setup(&port->ip4_own_query.timer, br_ip4_multicast_port_query_expired, 0); #if IS_ENABLED(CONFIG_IPV6) @@ -3319,7 +3332,7 @@ void br_multicast_init(struct net_bridge *br) spin_lock_init(&br->multicast_lock); timer_setup(&br->ip4_mc_router_timer, - br_multicast_local_router_expired, 0); + br_ip4_multicast_local_router_expired, 0); timer_setup(&br->ip4_other_query.timer, br_ip4_multicast_querier_expired, 0); timer_setup(&br->ip4_own_query.timer, -- 2.31.0