Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3277082rdb; Wed, 13 Sep 2023 07:29:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESE1Jqucz/VTQPxyh8MvZRSl//X4yUEBClyr6zDOJyJXVHIP60QtX6P8cEUz/c4/iHSHlY X-Received: by 2002:a05:6a20:2444:b0:134:30a8:9df5 with SMTP id t4-20020a056a20244400b0013430a89df5mr3033345pzc.43.1694615386620; Wed, 13 Sep 2023 07:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694615386; cv=none; d=google.com; s=arc-20160816; b=iow5l0eBpw3Z6c8D1E5DCFL/Z44NSbRuc+XHWTtdbJWEKwoB+CO2Vr4zrdFi/VAUMw WPHPL6/KNlPWLH0+mdLKapk48EMAJw+DvUYNBl6KuEFFfM2pq7Qy4eJpibdOvVQmDDbL 6wY9mMAQgK8/mrU9FRuGQRsQ0s8C/SH3GfvU4Ebm4A24uZUCZ0bF9XlG66L2//0PDMhU //3fwny8SPfkzm0tgfwbpnQY2uTg0XVp4eFJeRVr2s0z4pcGsYXAt6x55izf9d6VtgZt qAf0+1dWBrcOHgwIiPeBlXkN3UWuBtgO41P5msjQW/Okhk/SEQVrM/WLcvQ3zuPInUPm UpIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9Mh3N+atY6fKlEdWof649s8ajhIo+Yy5qpEAzk5J3lE=; fh=ZYzCmJ77RpH48bNLLWqYCRIZ1WCGkSD8VpekouK/jA0=; b=BfxaFxjstozeX+llaQTMk5N0aaFVxMUuzoWKHwM0JwKrPrlRTpnwqSeOJtlbkL8/5b ksRfecA9Dkey5IzixEEPVrF8N4ZpMaXJw04Vx4EyXVbZvdnJn4qJfbio8MpPMOOpBvaR egqsrdaAr9Wd6TTImk+2lG8RD7QL1pAs0CMqtndpwXDlzDHPPpZ0ZkmuUgKxOLKOwfmS QGzgNAHI6Vskx9W09sEIyV5akhAO9Efi5luuZqu+/XHRa0iCXAxD7DYMZ+PIbG40WCXb gyXEwtGCxgML8M+PKcmKz/p8Ct97EfL2uyRo5vX803r21iLKzLgzBFMYqp1YG59ExqaL 6FCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=AFJgk5nH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id by13-20020a056a00400d00b0068a140568b4si10082940pfb.348.2023.09.13.07.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 07:29:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=AFJgk5nH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8EC36808AB97; Tue, 12 Sep 2023 07:48:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235976AbjILOsM (ORCPT + 99 others); Tue, 12 Sep 2023 10:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230347AbjILOsL (ORCPT ); Tue, 12 Sep 2023 10:48:11 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 007AB115; Tue, 12 Sep 2023 07:48:06 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-9ad749473baso203154566b.1; Tue, 12 Sep 2023 07:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694530085; x=1695134885; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=9Mh3N+atY6fKlEdWof649s8ajhIo+Yy5qpEAzk5J3lE=; b=AFJgk5nH4gzHb22ZSyZeM5iZyqngU3wRN8WgdaCAJPGH0tpXbZFeozlr3xYCxjo2se t+hV3qdMCWx8cYTojx2tvB8PSC/Mc5m2RT31QCBqtTBvjVWd4lDKSc6y8Jlvo3rJMS4H kyTHD/6niDbOjLndjV5Uqi1gXUhTd/+jbuhwdvZhYOWICEyNxnaD+A++UwCOSIsi8zwT V3jsOX2jFEhuH+xVMLTt4KJimcusDebe0+cLzoQEyNkgbGehLr/JPnXfXgaX+Jfk7J5w k+HT6Ko6NJMvG8TGHfHwpKxlbCFsZU5PgD/p3oPTgsTJkmTuxnuFMW7QgRPh51p0n9Jj hQpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694530085; x=1695134885; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9Mh3N+atY6fKlEdWof649s8ajhIo+Yy5qpEAzk5J3lE=; b=vQz+vCdRtPUKRT6GanFtp9EbaPtVmsSOM6X9MzO607DCzqN8mhJjAiz11K9goAF4aH nAFS8D3dgPdEkRm8nmmlmydZDkv5WH+JSHn4cIbPdxrvonF5R8rm8P80IUu42r1Ek9of GD6ISF4UbfxJasjP3eNIEm+hodDGNTrFOShKsDAukPJkn410qeMs1ekqpoJGOJXYMGZv OWlhysH0F/giD4cClZ7djdq4HqRAVZC3fxXgz1sDiN4HKAcp+UeZYPwG7mWOENlrE6Gp T1aXZIbyZIFXjPZXDbd5Js6apzGJsXWnN2Zp2fhOt29Md4pBuq0jSSBklHzJGhr81aqe npbA== X-Gm-Message-State: AOJu0YxZY8JMsHwyDc47g1Mx4Is/xo6r8yni38Rggem9uPxCCvXA1w0m E2eEXFdpYCNP0dIcBXUnLnQ= X-Received: by 2002:a17:906:295:b0:9a5:da6c:6539 with SMTP id 21-20020a170906029500b009a5da6c6539mr10782887ejf.75.1694530085232; Tue, 12 Sep 2023 07:48:05 -0700 (PDT) Received: from skbuf ([188.25.254.186]) by smtp.gmail.com with ESMTPSA id q7-20020a170906360700b0098ce63e36e9sm7064813ejb.16.2023.09.12.07.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 07:48:04 -0700 (PDT) Date: Tue, 12 Sep 2023 17:48:02 +0300 From: Vladimir Oltean To: Pawel Dembicki Cc: netdev@vger.kernel.org, Dan Carpenter , Simon Horman , Linus Walleij , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v3 4/8] net: dsa: vsc73xx: add port_stp_state_set function Message-ID: <20230912144802.czdpb6hpn2yiewvf@skbuf> References: <20230912122201.3752918-1-paweldembicki@gmail.com> <20230912122201.3752918-5-paweldembicki@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230912122201.3752918-5-paweldembicki@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 12 Sep 2023 07:48:14 -0700 (PDT) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Hi Pawel, On Tue, Sep 12, 2023 at 02:21:58PM +0200, Pawel Dembicki wrote: > This isn't a fully functional implementation of 802.1D, but > port_stp_state_set is required for a future tag8021q operations. > > This implementation handles properly all states, but vsc73xx doesn't > forward STP packets. > > Reviewed-by: Linus Walleij > Signed-off-by: Pawel Dembicki > --- > diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c > index 8f2285a03e82..541fbc195df1 100644 > --- a/drivers/net/dsa/vitesse-vsc73xx-core.c > +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c > @@ -1033,9 +1031,59 @@ static int vsc73xx_get_max_mtu(struct dsa_switch *ds, int port) > return 9600 - ETH_HLEN - ETH_FCS_LEN; > } > > +static int vsc73xx_port_setup(struct dsa_switch *ds, int port) > +{ For bisectability, the series must build patch by patch. Here, you are missing: struct vsc73xx *vsc = ds->priv; ../drivers/net/dsa/vitesse-vsc73xx-core.c:1038:3: error: use of undeclared identifier 'vsc' vsc->forward_map[CPU_PORT] = VSC73XX_SRCMASKS_PORTS_MASK & ^ ../drivers/net/dsa/vitesse-vsc73xx-core.c:1041:3: error: use of undeclared identifier 'vsc' vsc->forward_map[port] = VSC73XX_SRCMASKS_PORTS_MASK & ^ 2 errors generated. > + /* Configure forward map to CPU <-> port only */ > + if (port == CPU_PORT) > + vsc->forward_map[CPU_PORT] = VSC73XX_SRCMASKS_PORTS_MASK & > + ~BIT(CPU_PORT); vsc->forward_map[CPU_PORT] = dsa_user_ports(ds); > + else > + vsc->forward_map[port] = VSC73XX_SRCMASKS_PORTS_MASK & > + BIT(CPU_PORT); vsc->forward_map[port] = BIT(CPU_PORT); > + > + return 0; > +} > + > +/* FIXME: STP frames aren't forwarded at this moment. BPDU frames are > + * forwarded only from and to PI/SI interface. For more info see chapter > + * 2.7.1 (CPU Forwarding) in datasheet. > + * This function is required for tag8021q operations. > + */ > + > +static void vsc73xx_port_stp_state_set(struct dsa_switch *ds, int port, > + u8 state) > +{ > + struct vsc73xx *vsc = ds->priv; > + > + if (state == BR_STATE_BLOCKING || state == BR_STATE_DISABLED) > + vsc73xx_update_bits(vsc, VSC73XX_BLOCK_ANALYZER, 0, > + VSC73XX_RECVMASK, BIT(port), 0); > + else > + vsc73xx_update_bits(vsc, VSC73XX_BLOCK_ANALYZER, 0, > + VSC73XX_RECVMASK, BIT(port), BIT(port)); > + > + if (state == BR_STATE_LEARNING || state == BR_STATE_FORWARDING) > + vsc73xx_update_bits(vsc, VSC73XX_BLOCK_ANALYZER, 0, > + VSC73XX_LEARNMASK, BIT(port), BIT(port)); > + else > + vsc73xx_update_bits(vsc, VSC73XX_BLOCK_ANALYZER, 0, > + VSC73XX_LEARNMASK, BIT(port), 0); > + > + if (state == BR_STATE_FORWARDING) > + vsc73xx_update_bits(vsc, VSC73XX_BLOCK_ANALYZER, 0, > + VSC73XX_SRCMASKS + port, > + VSC73XX_SRCMASKS_PORTS_MASK, > + vsc->forward_map[port]); To forward a packet between port A and port B, both of them must be in BR_STATE_FORWARDING, not just A. > + else > + vsc73xx_update_bits(vsc, VSC73XX_BLOCK_ANALYZER, 0, > + VSC73XX_SRCMASKS + port, > + VSC73XX_SRCMASKS_PORTS_MASK, 0); > +} > + > static const struct dsa_switch_ops vsc73xx_ds_ops = { > .get_tag_protocol = vsc73xx_get_tag_protocol, > .setup = vsc73xx_setup, > + .port_setup = vsc73xx_port_setup, > .phy_read = vsc73xx_phy_read, > .phy_write = vsc73xx_phy_write, > .phylink_get_caps = vsc73xx_phylink_get_caps, > @@ -1049,6 +1097,7 @@ static const struct dsa_switch_ops vsc73xx_ds_ops = { > .port_disable = vsc73xx_port_disable, > .port_change_mtu = vsc73xx_change_mtu, > .port_max_mtu = vsc73xx_get_max_mtu, > + .port_stp_state_set = vsc73xx_port_stp_state_set, > }; > > static int vsc73xx_gpio_get(struct gpio_chip *chip, unsigned int offset) > diff --git a/drivers/net/dsa/vitesse-vsc73xx.h b/drivers/net/dsa/vitesse-vsc73xx.h > index f79d81ef24fb..224e284a5573 100644 > --- a/drivers/net/dsa/vitesse-vsc73xx.h > +++ b/drivers/net/dsa/vitesse-vsc73xx.h > @@ -18,6 +18,7 @@ > > /** > * struct vsc73xx - VSC73xx state container > + * @forward_map: Forward table cache If you start describing the member fields, shouldn't all be described? I think there will be kdoc warnings otherwise. > */ > struct vsc73xx { > struct device *dev; > @@ -28,6 +29,7 @@ struct vsc73xx { > u8 addr[ETH_ALEN]; > const struct vsc73xx_ops *ops; > void *priv; > + u8 forward_map[VSC73XX_MAX_NUM_PORTS]; > }; > > struct vsc73xx_ops { > -- > 2.34.1 >