From patchwork Tue Jun 23 20:47:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 217280 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BBA4C433E0 for ; Tue, 23 Jun 2020 20:52:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 799BA20702 for ; Tue, 23 Jun 2020 20:52:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cumulusnetworks.com header.i=@cumulusnetworks.com header.b="TMhFhm6n" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392664AbgFWUwG (ORCPT ); Tue, 23 Jun 2020 16:52:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392909AbgFWUrj (ORCPT ); Tue, 23 Jun 2020 16:47:39 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19759C061755 for ; Tue, 23 Jun 2020 13:47:40 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id g75so115422wme.5 for ; Tue, 23 Jun 2020 13:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cumulusnetworks.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iTn4YwU+nfTQfkZuPTzGncuZ8rRbBocyqzX19b4wUbA=; b=TMhFhm6nfkpXmHPW+lhJe1n7cOAbgmdnyRnYRF08ge1eyJ2DV9spltmSVwZ4VSK4Wc Jt+Vztp07cBJUvd//XpdL7CXGrBp15sBWw5RyPDAs6+VDyhZ7be6kNhjp3hxaN0BI85b IjevMCed9DomHmDIsfcEaVrrUegwc59D4qWVo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iTn4YwU+nfTQfkZuPTzGncuZ8rRbBocyqzX19b4wUbA=; b=YqeVl/VY6f5jI1Fu9KXLP7gcmI2Dl3U+ZWxqSWZHWaHpPnhH6vNKUDCsmvGY84eJH7 CLXYqS9+uOfRAuSesdm+YYWLHlTcM167XiAL6PbXBQSWgC8PKabCcy9qwdhKcoQbF7bN AnrsYUdzD7XEnrO/EjVD9svi4xWeLD4nJXrCazn0rWOneeQSc1kY2vrFex6yJq12DiGL JL+6ahb6Pyb2mOFZmuLKNu7h89pE+Y7GEvHZcrUoxX2jhaL3DoT8kNGMdkaPI1CJ6+IJ 7wqRln3zQCrRwXtZiaKszkx4AxrZao+myN/CLFpNc+bL5T5B3GTRn2e0viFc79xevFuM 2BKg== X-Gm-Message-State: AOAM533hIEqiG7Wa2fhKGEz81YDWsD+Aq7Le9BLxSjdBNFdixNQEpeXP 9+1LRN2pyO3QIpAhf4T+6bBs2mSqzAHxAQ== X-Google-Smtp-Source: ABdhPJwAZRWitfLDhWCfV+SJTBcZEhIS7z6ASJYKGDcNe5UxFBpwzSqkCG/Tlq/3z81d9mmT8PZ/Tw== X-Received: by 2002:a1c:32ca:: with SMTP id y193mr4392078wmy.83.1592945258495; Tue, 23 Jun 2020 13:47:38 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id j6sm5686924wmb.3.2020.06.23.13.47.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 13:47:37 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@cumulusnetworks.com, anuradhak@cumulusnetworks.com, davem@davemloft.net, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 1/4] net: bridge: fdb_add_entry takes ndm as argument Date: Tue, 23 Jun 2020 23:47:15 +0300 Message-Id: <20200623204718.1057508-2-nikolay@cumulusnetworks.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200623204718.1057508-1-nikolay@cumulusnetworks.com> References: <20200623204718.1057508-1-nikolay@cumulusnetworks.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We can just pass ndm as an argument instead of its fields separately. Signed-off-by: Nikolay Aleksandrov --- net/bridge/br_fdb.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 4877a0db16c6..ed80d9ab0fb9 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -793,11 +793,11 @@ int br_fdb_get(struct sk_buff *skb, /* Update (create or replace) forwarding database entry */ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, - const u8 *addr, u16 state, u16 flags, u16 vid, - u8 ndm_flags) + const u8 *addr, struct ndmsg *ndm, u16 flags, u16 vid) { - bool is_sticky = !!(ndm_flags & NTF_STICKY); + bool is_sticky = !!(ndm->ndm_flags & NTF_STICKY); struct net_bridge_fdb_entry *fdb; + u16 state = ndm->ndm_state; bool modified = false; /* If the port cannot learn allow only local and static entries */ @@ -893,8 +893,7 @@ static int __br_fdb_add(struct ndmsg *ndm, struct net_bridge *br, err = br_fdb_external_learn_add(br, p, addr, vid, true); } else { spin_lock_bh(&br->hash_lock); - err = fdb_add_entry(br, p, addr, ndm->ndm_state, - nlh_flags, vid, ndm->ndm_flags); + err = fdb_add_entry(br, p, addr, ndm, nlh_flags, vid); spin_unlock_bh(&br->hash_lock); } From patchwork Tue Jun 23 20:47:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 217281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8821AC433DF for ; Tue, 23 Jun 2020 20:51:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5ADA920702 for ; Tue, 23 Jun 2020 20:51:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cumulusnetworks.com header.i=@cumulusnetworks.com header.b="Djy+o3H7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393060AbgFWUvx (ORCPT ); Tue, 23 Jun 2020 16:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404066AbgFWUrn (ORCPT ); Tue, 23 Jun 2020 16:47:43 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6ED9C061755 for ; Tue, 23 Jun 2020 13:47:43 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id g18so6943wrm.2 for ; Tue, 23 Jun 2020 13:47:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cumulusnetworks.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PsVnZiU164smHUvfeaLehL8S/X1w62QMfoibHkfcTw8=; b=Djy+o3H71e3jVrH1oxVs/TKg65SF8T1ef5c1OnJdOmNtq1nGUFiJfPUyk6RBFwagNy q6mO8rf8A2KSQu5/Nd0Cdu0/nslWy9hcaIFGfRO8u9dJz1rTVZIgXjbvVYumTIyv2b/Y H6bdubYoXoYX97JdYF2kdf9/2eDkUgHJ5zOJc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PsVnZiU164smHUvfeaLehL8S/X1w62QMfoibHkfcTw8=; b=I6m8pSwWbgTqOjYMORSlUjVjRQf22P3YkCMNOk/2B5pnlWUrvNRaPqpzwwUVBnyoiI voyb+DRhJW0WEBNQzdTIdz66kBe5exyCv9AzX5SMGXU3z4O3dk2DMGjypXtNachX1CTE DCz34Aazg3NUClCULZsXrw/fjFKlWOErx3DbYkpnWjtaI3DE5e8RcWhDGg4CerdAJNjg YcbDbRsoKdGQcbPWid2EjR2jLWpIwrFuiz6roChWUWXluL804tgAXV/hjmhRBlAoQ9Nd vuWQLgvraTsq0UEEPHnO+hwaz9mn21AR5HSTvyzYTfNI8c8FxKTI2cEAulUpRp09/YlZ Svig== X-Gm-Message-State: AOAM530hBsIcN9FfQ057MdRzvM7a6oyVSR/In+zw19XoMHVLzdHVaxHy /vcjwGeD/ml/FlwRgpWbFVdqZOrY8X7lWA== X-Google-Smtp-Source: ABdhPJw6gRorTuL7N34Xr6y8T1Wtr2ZATURck/BUB/8ILF8R5bw8TtxeRWJshC+xHcpRsERcSFzdfQ== X-Received: by 2002:a5d:6651:: with SMTP id f17mr13908746wrw.29.1592945262228; Tue, 23 Jun 2020 13:47:42 -0700 (PDT) Received: from debil.vdiclient.nvidia.com (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id j6sm5686924wmb.3.2020.06.23.13.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 13:47:41 -0700 (PDT) From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: roopa@cumulusnetworks.com, anuradhak@cumulusnetworks.com, davem@davemloft.net, bridge@lists.linux-foundation.org, Nikolay Aleksandrov Subject: [PATCH net-next 4/4] net: bridge: add a flag to avoid refreshing fdb when changing/adding Date: Tue, 23 Jun 2020 23:47:18 +0300 Message-Id: <20200623204718.1057508-5-nikolay@cumulusnetworks.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200623204718.1057508-1-nikolay@cumulusnetworks.com> References: <20200623204718.1057508-1-nikolay@cumulusnetworks.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When we modify or create a new fdb entry sometimes we want to avoid refreshing its activity in order to track it properly. One example is when a mac is received from EVPN multi-homing peer by FRR, which doesn't want to change local activity accounting. It makes it static and sets a flag to track its activity. Signed-off-by: Nikolay Aleksandrov --- include/uapi/linux/neighbour.h | 1 + net/bridge/br_fdb.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h index 21e569297355..dc8b72201f6c 100644 --- a/include/uapi/linux/neighbour.h +++ b/include/uapi/linux/neighbour.h @@ -191,6 +191,7 @@ enum { enum { NFEA_UNSPEC, NFEA_ACTIVITY_NOTIFY, + NFEA_DONT_REFRESH, __NFEA_MAX }; #define NFEA_MAX (__NFEA_MAX - 1) diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 642deb57c064..9db504baa094 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -860,6 +860,7 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, struct nlattr *nfea_tb[]) { bool is_sticky = !!(ndm->ndm_flags & NTF_STICKY); + bool refresh = !nfea_tb[NFEA_DONT_REFRESH]; struct net_bridge_fdb_entry *fdb; u16 state = ndm->ndm_state; bool modified = false; @@ -937,7 +938,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, fdb->used = jiffies; if (modified) { - fdb->updated = jiffies; + if (refresh) + fdb->updated = jiffies; fdb_notify(br, fdb, RTM_NEWNEIGH, true); } @@ -977,6 +979,7 @@ static int __br_fdb_add(struct ndmsg *ndm, struct net_bridge *br, static const struct nla_policy br_nda_fdb_pol[NFEA_MAX + 1] = { [NFEA_ACTIVITY_NOTIFY] = { .type = NLA_U8 }, + [NFEA_DONT_REFRESH] = { .type = NLA_FLAG }, }; /* Add new permanent fdb entry with RTM_NEWNEIGH */