Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp346826pxj; Thu, 13 May 2021 06:24:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhNOsh4iIM1Nm+Z90iX56fW+OwoGDeLOvMwuXsFK8aGMjx+E1Tf4KNB+c8DKNEkar01lzC X-Received: by 2002:a05:6402:16db:: with SMTP id r27mr48126552edx.375.1620912291312; Thu, 13 May 2021 06:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620912291; cv=none; d=google.com; s=arc-20160816; b=Itk9P6TOoy3yVcAP16ud29mGffl2Qi6wcI05cWNDCKkkZ1dEVts7gSyfR6SeHKK+fT PfBdmGSOrt4gbDq/UvKLkw4RNKBx5WDllpUbZ6pbscPFYP1XmS46NUMI9RJnB9jGBcpN UqgDg40lujW9Jg3IWUM6csErzuSRDOfXtURh/rzBlfDVZbI5/rzjRHsYyzqx/MIuJVVk 5K0xtr40frQQpj911a+ZX/SK/NaBSOUUOD4tqidr56RTonLYSrpOZQlQCDaEhv+D2LHt vsR9S0JBQB2wyB0qgaGA+pioTC7IartuD+RwcsGlrpDsxi6VirUpmHlf+TIvjuBo1kuv DdAg== 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=6KLRqt639GMTY2PpsxevpPAHP09gYSiSb+iDRzOfR44=; b=p89gSblu4pY8QXEvr7hIiwO94ABLiRAuNKUqcIQJHdUlgVC/roz2fyN5mKPhLqPTxl cjDMg8heVrHg3TahqLn4ESMNJRHJbcR0fNoh/e2hDljacYZLD7/Jvv4xaRf7z2Kb7O9X 5mME8ZuxGrFNDii+EhFBH3Bim3rnIxBXeQPhvb/jJbJTtfqhlCFiqTVQbOzQ1GOdVESp EQrad84AOcWbe0o7icIfkOMa9xlmftgU2ZUP9t1UDGW3yH6GPMHHiBwbOzDt9j3XQ9Vv t1v4AxCcfnlm8i3lTar/R7Xf0QVMnItK+bBl2XMhIfILOZYCLRkj2KIpHYlnSiueHRfx O0Aw== 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 hq10si2669756ejc.165.2021.05.13.06.24.25; Thu, 13 May 2021 06:24:51 -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 S233910AbhEMNXQ (ORCPT + 99 others); Thu, 13 May 2021 09:23:16 -0400 Received: from mail.aperture-lab.de ([116.203.183.178]:52864 "EHLO mail.aperture-lab.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233987AbhEMNW2 (ORCPT ); Thu, 13 May 2021 09:22:28 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 109754100B; Thu, 13 May 2021 15:21:04 +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, linux-kernel@vger.kernel.org, =?UTF-8?q?Linus=20L=C3=BCssing?= Subject: [net-next v4 06/11] net: bridge: mcast: prepare expiry functions for mcast router split Date: Thu, 13 May 2021 15:20:48 +0200 Message-Id: <20210513132053.23445-7-linus.luessing@c0d3.blue> In-Reply-To: <20210513132053.23445-1-linus.luessing@c0d3.blue> References: <20210513132053.23445-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..7815991 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 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