Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp619109ybt; Wed, 1 Jul 2020 06:22:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ1r+FVhXS+Hct1FS+VesPFwJ6206IYl+HwHyy0NdeEF9Joe8/6yFCBGMmK9kOJljLVhaO X-Received: by 2002:a05:6402:1244:: with SMTP id l4mr29450013edw.71.1593609759219; Wed, 01 Jul 2020 06:22:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593609759; cv=none; d=google.com; s=arc-20160816; b=YCZ6usOZgok1Zl4a/qT0sGAoOuVqf0oiFKe6H3yIyrN+jS04OmFPnT3UQon34e+EqT 12oSJr5jF/XiqzrIMdvgICs1DXPE0/CS6NHtvea2lC7w7YFQaRNckuNQyX2WzXEsVEvJ ofMLSj+Pmlr4gcg/Wu3S3rlPE8ZX0qF4s3woR64epaa0kgDg2CeYfkHH50dNElhO+w7S h2kuCiAExbUE1oK8GMo4pjuZWJqxyJmMiqHqod+ImlfD7ZfoKgw9eIRHuOH5FnF3xQdP HARclfgofAaca+9suN4UZiZk6Hf3+Ydgm5MPHeLcwWwWmhKjbm4Xo0KU845xkdxZPh4y 4hqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:dkim-signature; bh=OM7gq0x55el2eASz29Oppu8FYntXI3XandAfw6XffFI=; b=MUZV0hVk6zzcD/jzCNNmjWX0ZK9xPM/uPgogxrRQJEf13qZRqy3NLjY2E8W2bht1Jj nYKg5dnQ0fnW4gsTyJh1dRafNZ4RPVrZa+TNc85K4xdAhDW0nzSxMWN6YngopXF2tOBy lYqg+7k29lj8E+w7piUxpRaG3coNU1dWbSJMCEVuN1zAogCcyT0dW7rUlg2Cm+7vD0pY qJil/LGFcBxAUlsdRssXDJJjChtX+HFmXK+C/+T5JBn726dhg3Hjp9jR4ylKygOBQ2yD x/iQf67EJ6Q4uIvGOajq9DT3cH3xNwltf8/AdPJRQHGR39AsddYR9P8qiTbJWaHdL6cj PADQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=UTJpague; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si3741693eja.251.2020.07.01.06.22.16; Wed, 01 Jul 2020 06:22:39 -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; dkim=fail header.i=@microchip.com header.s=mchp header.b=UTJpague; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730942AbgGANTm (ORCPT + 99 others); Wed, 1 Jul 2020 09:19:42 -0400 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:34679 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729332AbgGANTm (ORCPT ); Wed, 1 Jul 2020 09:19:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1593609581; x=1625145581; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=w1Bi0JXqdM2ufMXqYAxcGD/e6gns1M8IrcGV3a6OBmA=; b=UTJpaguemft+TtBPbBYAc34KOLHQwGSI2WdOfgfaToslUeomTzCRQHTC r8E/NvD26hO92MGj/rcTE+aPS/EzKflOzTAhlGcY59uCeMkV48P/2dc3y 7f6C3iKTt2Btn5xhaxrISnMhariuw/CCDKpJ693K/M0RBhEb3oLe3kaEG ePwZDPhBTcUrQ/l0tm8O6s2KbTucO7p1aXrNy9FrRN2UVSk3qkplqx+2H hlB1W2Hortw0VlKF9EhzM7nhnkhbShDWc+HRXIEhUtmNc0FR1nfeQ8mb4 CC70QiYDyiecZs4R30rWdOcNnCclsj7mXSA+Ob1ywgTRp7HGbaDjPryM0 g==; IronPort-SDR: CACbmcQpoOAtRtqiBQVYzHRCPFN/j/ocKbaAAGsdJRP2qm0odNZqH6YJ+0Vft2NDr01lpAhLWe oD6tSFyaUhEnMtYnyoaF5BlLx7CUlW8CWFnJbC8e2WSj1Z3tDrFvdrUIXg/Tp7yCQdMAykRwxf o4AJkzcCXD2dks6Cs5EWKsOplTiDqj4dm8xzmT5iLlyoCA7cJDVnkvj5igMkATmNDldPHEe62r ZHUBAjL4YAWMR3+AtBr3iIIru82e0383p4nNvr1+HP7p5YVJIKfREAbeomDlQr/usiqBxGZE41 SUs= X-IronPort-AV: E=Sophos;i="5.75,300,1589266800"; d="scan'208";a="85820750" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Jul 2020 06:19:41 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 1 Jul 2020 06:19:22 -0700 Received: from localhost (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 1 Jul 2020 06:19:40 -0700 Date: Wed, 1 Jul 2020 15:19:39 +0200 From: Horatiu Vultur To: Nikolay Aleksandrov CC: , , , , , , , Subject: Re: [PATCH net-next v2 3/3] bridge: Extend br_fill_ifinfo to return MPR status Message-ID: <20200701131939.bc6xwf7y2tlypio7@soft-dev3.localdomain> References: <20200701072239.520807-1-horatiu.vultur@microchip.com> <20200701072239.520807-4-horatiu.vultur@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 07/01/2020 12:51, Nikolay Aleksandrov wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On 01/07/2020 10:22, Horatiu Vultur wrote: > > This patch extends the function br_fill_ifinfo to return also the MRP > > status for each instance on a bridge. It also adds a new filter > > RTEXT_FILTER_MRP to return the MRP status only when this is set, not to > > interfer with the vlans. The MRP status is return only on the bridge > > interfaces. > > > > Signed-off-by: Horatiu Vultur > > --- > > include/uapi/linux/rtnetlink.h | 1 + > > net/bridge/br_netlink.c | 29 ++++++++++++++++++++++++++++- > > 2 files changed, 29 insertions(+), 1 deletion(-) > > > > diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h > > index 879e64950a0a2..9b814c92de123 100644 > > --- a/include/uapi/linux/rtnetlink.h > > +++ b/include/uapi/linux/rtnetlink.h > > @@ -778,6 +778,7 @@ enum { > > #define RTEXT_FILTER_BRVLAN (1 << 1) > > #define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2) > > #define RTEXT_FILTER_SKIP_STATS (1 << 3) > > +#define RTEXT_FILTER_MRP (1 << 4) > > > > /* End of information exported to user level */ > > > > diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c > > index 240e260e3461c..6ecb7c7453dcb 100644 > > --- a/net/bridge/br_netlink.c > > +++ b/net/bridge/br_netlink.c > > @@ -453,6 +453,32 @@ static int br_fill_ifinfo(struct sk_buff *skb, > > rcu_read_unlock(); > > if (err) > > goto nla_put_failure; > > + > > + nla_nest_end(skb, af); > > + } > > + > > + if (filter_mask & RTEXT_FILTER_MRP) { > > + struct nlattr *af; > > + int err; > > + > > + /* RCU needed because of the VLAN locking rules (rcu || rtnl) */ > > + rcu_read_lock(); Hi Nik, > > If you're using RCU, then in the previous patch (02) you should be using RCU primitives > to walk the list and deref the ports. > Alternatively if you rely on rtnl only then drop these RCU locks here as they're misleading. > > I'd prefer to just use RCU for it in case we drop rtnl one day when dumping. Thanks for the comments. I will create a new series where I will use the RCU. > > > + if (!br_mrp_enabled(br) || port) { > > + rcu_read_unlock(); > > + goto done; > > + } > > + af = nla_nest_start_noflag(skb, IFLA_AF_SPEC); > > + if (!af) { > > + rcu_read_unlock(); > > + goto nla_put_failure; > > + } > > + > > + err = br_mrp_fill_info(skb, br); > > + > > + rcu_read_unlock(); > > + if (err) > > + goto nla_put_failure; > > + > > nla_nest_end(skb, af); > > } > > > > @@ -516,7 +542,8 @@ int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, > > struct net_bridge_port *port = br_port_get_rtnl(dev); > > > > if (!port && !(filter_mask & RTEXT_FILTER_BRVLAN) && > > - !(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)) > > + !(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED) && > > + !(filter_mask & RTEXT_FILTER_MRP)) > > return 0; > > > > return br_fill_ifinfo(skb, port, pid, seq, RTM_NEWLINK, nlflags, > > > -- /Horatiu