Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3837790ybz; Mon, 20 Apr 2020 10:20:12 -0700 (PDT) X-Google-Smtp-Source: APiQypLWg/DRD3DXMl/ta1g1OelcrtgWM9f4F7ZRFuhUUqGwHKi697zBl4TJDHMgHdQh+4tbpGSn X-Received: by 2002:a17:906:82d2:: with SMTP id a18mr16885830ejy.373.1587403212771; Mon, 20 Apr 2020 10:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587403212; cv=none; d=google.com; s=arc-20160816; b=gW5Fi0Wi4pL3a1ajrXs1sato/+nZsNxytBttDTzrwf7e7lBB73QAUi0W06ktzYTftV cNjTPt71O3sJwQaBud6x1nX6i5BFvQhhPdptzdijr3PWdS+/GJBUjbmVggNBu+UsL1IL I31Tuc94Fx9b0Ccc2RimdE9Dex4nXgzNj2CgxZvPHjGqnbvWHbGYwWqLWNNmTj9YzC33 w5xAcTruCMYIBQ+JyomCglkl7wEsvC+K3SXrbwnX566Onigox5wBIalDHZ+LkhjxArBW JEid/r23Hq4yGZ8Y1bBBm03Cld594TIAPi+qvZOx5zpOmdiO7rLLe0RUe6Tb8XeovNL1 oSNA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=Sd8E77foj1OUgsaWFd9h8ikuxOeJShnx246PjzjsMdU=; b=R3V15knVye+AVZo3QjsjAeXQrs2w3f1LMHe8hCoy57Wq8TThHtscdNux+U/M+boQGx jFc9Si0YwTj4Av9CQV2C6yvc4FtWV0E47nBBkhDKaisY15iLvuxhVeoNd6YDDFYoYcVY OqT9eU3xzsymGUU+MvRHnXdJZh9BLvWSy28BprloHqh9udKHai8SeLFdsMFfABTG/2HS ODSvIu3IVe1AKmJ371QDgly7k6pmEtDHnOSqd86gOYGsy3ZgXbASR8bIsmn0snAOzHD2 mJqfQXHwGUZl2lDdWMfLsIjFOmLIk1fow4+nE/MFjPkQiuYr4+Ieqs830qOA51R/S+NU wfPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cumulusnetworks.com header.s=google header.b="P83+///7"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=cumulusnetworks.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g25si957880ejo.389.2020.04.20.10.19.49; Mon, 20 Apr 2020 10:20:12 -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=pass header.i=@cumulusnetworks.com header.s=google header.b="P83+///7"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=cumulusnetworks.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726724AbgDTRSg (ORCPT + 99 others); Mon, 20 Apr 2020 13:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726751AbgDTRSf (ORCPT ); Mon, 20 Apr 2020 13:18:35 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03956C061A0C for ; Mon, 20 Apr 2020 10:18:35 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id w145so8644969lff.3 for ; Mon, 20 Apr 2020 10:18:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cumulusnetworks.com; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=Sd8E77foj1OUgsaWFd9h8ikuxOeJShnx246PjzjsMdU=; b=P83+///79KUkjs8GzdyrNR6bxDjqliRkmJtvTNgYl6VXFoxCRH1sOMGQhR9jq5i1FN 8XWAkZh/7UWBbTWMn5Jf+IIONxmCljSviNanlUDzeefOeE5OaIYtiVsBaNwo6b7uLja6 FFXjFuy2hvquUy58sW0rcV1kiTa0dhP8R/fdg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Sd8E77foj1OUgsaWFd9h8ikuxOeJShnx246PjzjsMdU=; b=Ts1Ye69f4lB6pXWYnv/QZG60sZwH4xINm4IqZsErwa6NcGkU1MyC/jvf8riy5cEsdP AE8JcgEtdd9n2i4khxd9h4oPKnY6qEYpKLZ53og1VelixmUy1mGfKw2jhUfo8yuyws5K ACN+L8Lfxjp+gRDi6lyKezsz6QAmabv/CC533oYtajXRGa3wFdcjog9D4jc3m7qDM6Cq 28T0YMAZBTaV2XBHjhsHtx9D4r+149qATEiqKcfn8G2vhtygQDnZmOs896FCWWvCobGx vFoKulmtfl94DCu1FSnnJfelCvkoOIDmagP68oZ4bcGp3bBbv4pmjHMVu6FeNAP5ZMuz CLgg== X-Gm-Message-State: AGi0PuYGiCEKev3ys4J+9GlSwRPQFa9ZMBxAp12B9JrGPSAtG7Zga82w fsevw/Dc6EbSzUncp7Xsuy4Zig== X-Received: by 2002:a19:700b:: with SMTP id h11mr11256321lfc.89.1587403113517; Mon, 20 Apr 2020 10:18:33 -0700 (PDT) Received: from [192.168.0.109] (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id v15sm57421ljd.33.2020.04.20.10.18.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Apr 2020 10:18:32 -0700 (PDT) Subject: Re: [PATCH net-next 10/13] bridge: mrp: Implement netlink interface to configure MRP To: Horatiu Vultur , davem@davemloft.net, jiri@resnulli.us, ivecera@redhat.com, kuba@kernel.org, roopa@cumulusnetworks.com, olteanv@gmail.com, andrew@lunn.ch, UNGLinuxDriver@microchip.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bridge@lists.linux-foundation.org References: <20200420150947.30974-1-horatiu.vultur@microchip.com> <20200420150947.30974-11-horatiu.vultur@microchip.com> From: Nikolay Aleksandrov Message-ID: <066720c4-ddc4-ce71-734f-932b6a342e01@cumulusnetworks.com> Date: Mon, 20 Apr 2020 20:18:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200420150947.30974-11-horatiu.vultur@microchip.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/04/2020 18:09, Horatiu Vultur wrote: > Implement netlink interface to configure MRP. The implementation > will do sanity checks over the attributes and then eventually call the MRP > interface. > > Signed-off-by: Horatiu Vultur > --- > net/bridge/br_mrp_netlink.c | 117 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 117 insertions(+) > create mode 100644 net/bridge/br_mrp_netlink.c > > diff --git a/net/bridge/br_mrp_netlink.c b/net/bridge/br_mrp_netlink.c > new file mode 100644 > index 000000000000..0ff42e7c7f57 > --- /dev/null > +++ b/net/bridge/br_mrp_netlink.c > @@ -0,0 +1,117 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > + > +#include > + > +#include > +#include "br_private.h" > +#include "br_private_mrp.h" > + > +static const struct nla_policy br_mrp_policy[IFLA_BRIDGE_MRP_MAX + 1] = { > + [IFLA_BRIDGE_MRP_UNSPEC] = { .type = NLA_REJECT }, > + [IFLA_BRIDGE_MRP_INSTANCE] = { .type = NLA_EXACT_LEN, > + .len = sizeof(struct br_mrp_instance)}, > + [IFLA_BRIDGE_MRP_PORT_STATE] = { .type = NLA_U32 }, > + [IFLA_BRIDGE_MRP_PORT_ROLE] = { .type = NLA_EXACT_LEN, > + .len = sizeof(struct br_mrp_port_role)}, > + [IFLA_BRIDGE_MRP_RING_STATE] = { .type = NLA_EXACT_LEN, > + .len = sizeof(struct br_mrp_ring_state)}, > + [IFLA_BRIDGE_MRP_RING_ROLE] = { .type = NLA_EXACT_LEN, > + .len = sizeof(struct br_mrp_ring_role)}, > + [IFLA_BRIDGE_MRP_START_TEST] = { .type = NLA_EXACT_LEN, > + .len = sizeof(struct br_mrp_start_test)}, > +}; > + > +int br_mrp_parse(struct net_bridge *br, struct net_bridge_port *p, > + struct nlattr *attr, int cmd, struct netlink_ext_ack *extack) > +{ > + struct nlattr *tb[IFLA_BRIDGE_MRP_MAX + 1]; > + int err; > + > + if (br->stp_enabled != BR_NO_STP) { > + NL_SET_ERR_MSG_MOD(extack, "MRP can't be enabled if STP is already enabled\n"); > + return -EINVAL; > + } > + > + err = nla_parse_nested(tb, IFLA_BRIDGE_MRP_MAX, attr, > + NULL, extack); > + if (err) > + return err; > + > + if (tb[IFLA_BRIDGE_MRP_INSTANCE]) { > + struct br_mrp_instance *instance = > + nla_data(tb[IFLA_BRIDGE_MRP_INSTANCE]); > + > + if (cmd == RTM_SETLINK) > + err = br_mrp_add(br, instance); > + else > + err = br_mrp_del(br, instance); > + if (err) > + return err; > + } > + > + if (tb[IFLA_BRIDGE_MRP_PORT_STATE]) { > + enum br_mrp_port_state_type state = > + nla_get_u32(tb[IFLA_BRIDGE_MRP_PORT_STATE]); > + > + err = br_mrp_set_port_state(p, state); > + if (err) > + return err; > + } > + > + if (tb[IFLA_BRIDGE_MRP_PORT_ROLE]) { > + struct br_mrp_port_role *role = > + nla_data(tb[IFLA_BRIDGE_MRP_PORT_ROLE]); > + > + err = br_mrp_set_port_role(p, role); > + if (err) > + return err; > + } > + > + if (tb[IFLA_BRIDGE_MRP_RING_STATE]) { > + struct br_mrp_ring_state *state = > + nla_data(tb[IFLA_BRIDGE_MRP_RING_STATE]); > + > + err = br_mrp_set_ring_state(br, state); > + if (err) > + return err; > + } > + > + if (tb[IFLA_BRIDGE_MRP_RING_ROLE]) { > + struct br_mrp_ring_role *role = > + nla_data(tb[IFLA_BRIDGE_MRP_RING_ROLE]); > + > + err = br_mrp_set_ring_role(br, role); > + if (err) > + return err; > + } > + > + if (tb[IFLA_BRIDGE_MRP_START_TEST]) { > + struct br_mrp_start_test *test = > + nla_data(tb[IFLA_BRIDGE_MRP_START_TEST]); > + > + err = br_mrp_start_test(br, test); > + if (err) > + return err; > + } > + > + return 0; > +} > + > +int br_mrp_port_open(struct net_device *dev, u8 loc) > +{ > + struct net_bridge_port *p; > + int err = 0; > + > + p = br_port_get_rcu(dev); > + if (!p) { > + err = -EINVAL; > + goto out; > + } > + > + p->loc = loc; > + br_ifinfo_notify(RTM_NEWLINK, NULL, p); > + > +out: > + return err; > +} > +EXPORT_SYMBOL(br_mrp_port_open); > I just noticed the EXPORT_SYMBOL() here, why do you need it?