Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1282057ybt; Thu, 2 Jul 2020 01:16:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBuIyW3zSaHJYOvGRyhEsCMfSjboZE+VSNSwPyKSSdD3LPCd192ww1LTzqDXqcq//9y5hD X-Received: by 2002:a17:906:2988:: with SMTP id x8mr18369499eje.141.1593677762563; Thu, 02 Jul 2020 01:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593677762; cv=none; d=google.com; s=arc-20160816; b=cUftY7FmJeC6j2KpDZJqg9wj7pDCI10sEyD7YtKRdsMyGBzPLaKPWIhCdxcXUReq0c 3Bg8E0lNAXoxndDrJ/CV7Sf0pGRKTvKBJ4whfGayHs1CabSsCE/U5/H6b62UHZ6diLfI 5WJYrIt2CcXGVst6SYFh5a/dP9yxTtqmuIQLIzXLlMyBnR/f24wszCVxz3XMcNvRJBaT nTTbQRTIuNXdaqBRgg9jfLvmq7CdwyMLK1Bdy0jK+7TvdDQYJyvC0ScDQaqO3P3Kwady KG3N8XTsds5qIzUlXtZu110sRdKncUAdGwkGacCX/2rKoKnZ5okODfXUa+M88hmKi3vt wm6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:dkim-signature; bh=zr65Em9fh0gJcYZgXGbSeoo3E/CAY8Dg3+2D7+T+ik8=; b=Yj3OnP9LzYVlTF3bfScCrYmdNBYItzYKKQJFAocJlFvDlsf6JoiUAbimP8ZJ3ET1AX wR9zI4mJw6trgBrAmopU1/Ute4CY+MQ0m3/LEgAvyvTo7mIpT7lwmIrezJx3ghqlHXea pE7tDRz8n3mis8iJnfw/QDZ5J7KnDKnCHfLQVDlbnGn89MVMhOXDcC7UNpCHhpfyNvpv p5FBXH/pull0j8MIAd6/m1T5xy8Z2C6uJTmDswP86Izi9iCAl5xaWLwzov2NFbH+wRIa 8QuaHrsqfG+HKZQOxkfOSb8HOJ/q270CjB0dIP+zf4CeGouAU8sCzAhiVu086HYSZnrr UrSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=nsBR7n1G; 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 bz23si5165492ejc.195.2020.07.02.01.15.39; Thu, 02 Jul 2020 01:16:02 -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=nsBR7n1G; 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 S1726826AbgGBINZ (ORCPT + 99 others); Thu, 2 Jul 2020 04:13:25 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:43101 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725379AbgGBINY (ORCPT ); Thu, 2 Jul 2020 04:13:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1593677605; x=1625213605; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PdW1XZ3MHRJsroDmSJ1DwasAvadWD6be00JFedG1d2Y=; b=nsBR7n1GUBTAOxNGU+77aWuJUuHTDrXU5Q1sTl21BeeCqTmv6Pb150jE BzI1BP3aDuf2gXe07QBoa86IyMijVMoVxvvX1vZP/sVev2K6SOrtseug2 KLBcaTVkXjCxWKXyYaANV1GTqC7bJ3rzgHmLX6JosxBTHIS+JunrTaB5h G8ebdaI6Iz4Wid5422w0gD9dz3JG8Fr9hWtGDQJB/MmJ43kTO1hiryhJb iEu6tpKBcXgAkT4lB7FaAeiV8ecAJPFSwj1IVaPC+/ZzYEQDY/mJf47hU 2DcmQkv/rPCWWK6U5hDmPUFOCiQ+RYDruKt1TBWMycHxJYhqDljddXaPH g==; IronPort-SDR: P6KVoisUuR8tbsqlDtzu9JPJ2xJa+dGQP/OXGUdIwjGfcU2ziEsaqzD9k7UvXO+9c6W4tp9Gn7 6nSezd4no5hFvoC3gjiwdvREntrn1EjRB70vHFZAA5OrhR2NRjJyhD4mllUgy5LPDwJkbsc9JX WvQ1AdKNLX2jH/Y04stFyk8l9qW3KVkj52w+PHM7G8982sWyAwgj3GKK+iJgdQ22b1Qfto9LW+ p/1I8uZzzfEJQ8dMd3vswAO382GQUpaK78tJYnS74niAXQoyVXBBXCBX+p1oaAMtkKNMoNjMM0 twQ= X-IronPort-AV: E=Sophos;i="5.75,303,1589266800"; d="scan'208";a="81635220" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Jul 2020 01:13:24 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 2 Jul 2020 01:13:23 -0700 Received: from soft-dev3.localdomain (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Thu, 2 Jul 2020 01:13:00 -0700 From: Horatiu Vultur To: , , , , , , , , CC: Horatiu Vultur Subject: [PATCH net-next v3 3/3] bridge: Extend br_fill_ifinfo to return MPR status Date: Thu, 2 Jul 2020 10:13:07 +0200 Message-ID: <20200702081307.933471-4-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200702081307.933471-1-horatiu.vultur@microchip.com> References: <20200702081307.933471-1-horatiu.vultur@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 25 ++++++++++++++++++++++++- 2 files changed, 25 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..c532fa65c9834 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c @@ -453,6 +453,28 @@ 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; + + if (!br_mrp_enabled(br) || port) + goto done; + + af = nla_nest_start_noflag(skb, IFLA_AF_SPEC); + if (!af) + goto nla_put_failure; + + rcu_read_lock(); + err = br_mrp_fill_info(skb, br); + rcu_read_unlock(); + + if (err) + goto nla_put_failure; + nla_nest_end(skb, af); } @@ -516,7 +538,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, -- 2.27.0