Message ID | 20230912122201.3752918-1-paweldembicki@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp602231vqx; Tue, 12 Sep 2023 11:31:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHivwyqRsMnU/QB44IhT1En0B7ESAZe4UnwywYqrgQNzKw2rXIozmFHvPzr9gPss3Lxd/P5 X-Received: by 2002:a17:902:ea01:b0:1bd:b8c8:98f8 with SMTP id s1-20020a170902ea0100b001bdb8c898f8mr586119plg.4.1694543486568; Tue, 12 Sep 2023 11:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694543486; cv=none; d=google.com; s=arc-20160816; b=vaRB1Ni3pduVaD6CKYeadQ6xpjVkNCMxuGTggCZme8ZoYe/7ioVujoZqSiYLhbEfr7 flJUgOX5SwJW41amF261ft/DbptSWvvGq0uqNdEB/bV2XuXj3q81Md3RhiUjcvTZLOXR 99wNewq8qK2l8Etf6PeGqGl3oI2SOok4j5a0IuxA/C2xR1edmGAQqlZVjv8yk4l+uJhL 1HSrdmNUNDnQhe8mDZ14r2DnJrsC1WM0RwbFfV1fNyE/51ppsYFY7S6w8d9iMqbsTBGT SdOVtYWi6GbNp9722N4Rvz6mbuYvh24mWAxmCgHjBVphTHULkZJHKtce/ipv+Ew32hK4 +N7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Dn4TgEzrAdz2bdBKKMJZsRroR4da2heG9+A1fboRUrw=; fh=7pT+hAKdFm8SgkIrQfctQAWhXj//sVAB1OFY1O6ncNU=; b=ORoyrFjip+iGGAG3ztchS7M6kXxXOIfhJoGERhKvS/Xd6sRyGbqaO/9svYr1UVhPpe AGUcs3JXmCQ4o/GmtdJ1mbLlz2tzjPRhTtMiur/zRXMsGb4jtYvEi16ceO6H8yZEuPLn 5Ia2A6M7FqMfRj9cJj4yx8ftqIJIAo4MXJzSx6Z/TyaSYkMYVBFAvgTstizirC3wZhX3 +TVDsKS1K/fXQEx5NpWtXLQ1WvHARhdUxBvMqVn2mUdZelWvJ8UbDgiOomrtCfbIN1R8 Lg0gWQ+KfPf4XdY5kxjb/jqDp4a7LKfmTphKnXdVZpaxBl4drpc6AR37EyTAz9pV6ZZF OKYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=rLjDZBYu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id l1-20020a170902f68100b001b9e9edea43si8421772plg.552.2023.09.12.11.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 11:31:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=rLjDZBYu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 385768174A45; Tue, 12 Sep 2023 05:26:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235116AbjILM0E (ORCPT <rfc822;pwkd43@gmail.com> + 37 others); Tue, 12 Sep 2023 08:26:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235227AbjILMZq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Sep 2023 08:25:46 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B19661704; Tue, 12 Sep 2023 05:25:42 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-502934c88b7so8912803e87.2; Tue, 12 Sep 2023 05:25:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694521540; x=1695126340; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Dn4TgEzrAdz2bdBKKMJZsRroR4da2heG9+A1fboRUrw=; b=rLjDZBYu0W1MbcafUORHEn7Y6UywGWGr6LzUnhkgncSWABK19cE4TCsaISwIpswARZ b8SRpWmHQaseRbzpN2Pediqa3iMdV56ZSrT0GAG2gMqjW3yFnPqmIE7WuGmZA1sZjfqu vSQl5xB3XyMnNTqfH2qmC7Qb3Gf40U8YU+Eed0SJPuvVC+WXH7a1dgLo0nAVnwjz9D5j ra8o8EDQAK53gX1aeZQJoxnnvC8J33HXlt0lp1Lt1c3uDegiaP0yt+Kde/o6jDCiVpP9 3puPqhX9vmxOZMXAmVF7cbr+a21XvEsp6xpP0DTVRduP7pP+dvDIwIXgHz2UJOA1CRsb YmTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694521540; x=1695126340; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Dn4TgEzrAdz2bdBKKMJZsRroR4da2heG9+A1fboRUrw=; b=i7Tsdf+Y+m777qe9WhrKwPmvELB9saYwlWov/JAbHThoCwG7eYovvR1gBIkcyVk9Mz BfRvENReOB3X9O0jtbpIqK14pj0rUIbbrfa0krviFjIn6LdHlkJpGkMF+s7lyYOTGq3+ 9CsqrFCBi7y9GOxK+f6fR909UiyevFpLLG4Q34ufbqbL+nEqwKxlYUyLzVTnqpA4FsRJ 5H1tsp+bcXVE0MevjHzLoq2hEjQvJbdnlz2EGt5LhFNbIp/um8ZEg6/5TLOAVWeJga4K Vpm4ExWfw788MlRsX7lnXrcraFwgSMrmJ+v9LC2mlti3MnPKXYI6RnlPxHQ+YbTp6BET LTKg== X-Gm-Message-State: AOJu0YyXLUu+P9sdDcI8+WjxPwboMBUeRHZnU1qoDm6mw5O0xD6VkP42 laYv4GDIGpMUHchLM6WLsaj2FV7p7Rh34w== X-Received: by 2002:a05:6512:1196:b0:502:d765:a7c9 with SMTP id g22-20020a056512119600b00502d765a7c9mr520lfr.28.1694521540288; Tue, 12 Sep 2023 05:25:40 -0700 (PDT) Received: from WBEC325.dom.local ([185.188.71.122]) by smtp.gmail.com with ESMTPSA id g21-20020ac25395000000b004fe333128c0sm1737327lfh.242.2023.09.12.05.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 05:25:39 -0700 (PDT) From: Pawel Dembicki <paweldembicki@gmail.com> To: netdev@vger.kernel.org Cc: Dan Carpenter <dan.carpenter@linaro.org>, Simon Horman <simon.horman@corigine.com>, Pawel Dembicki <paweldembicki@gmail.com>, Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, Vladimir Oltean <olteanv@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Russell King <linux@armlinux.org.uk>, linux-kernel@vger.kernel.org Subject: [PATCH net-next v3 0/8] net: dsa: vsc73xx: Make vsc73xx usable Date: Tue, 12 Sep 2023 14:21:53 +0200 Message-Id: <20230912122201.3752918-1-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 12 Sep 2023 05:26:26 -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 agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776857630915439682 X-GMAIL-MSGID: 1776857630915439682 |
Series |
net: dsa: vsc73xx: Make vsc73xx usable
|
|
Message
Pawel Dembicki
Sept. 12, 2023, 12:21 p.m. UTC
This patch series focuses on making vsc73xx usable. The first patch was added in v2; it switches from a poll loop to read_poll_timeout. The second patch is a simple conversion to phylink because adjust_link won't work anymore. The third patch introduces a definition with the maximum number of ports to avoid using magic numbers. The fourth patch implements port state configuration, which is required for bridge functionality. STP frames are not forwarded at this moment. BPDU frames are only forwarded from/to the PI/SI interface. For more information, see chapter 2.7.1 (CPU Forwarding) in the datasheet. Patches 5-8 provide a basic implementation of tag8021q functionality with QinQ support, without VLAN filtering in the bridge and simple VLAN awareness in VLAN filtering mode. Pawel Dembicki (8): net: dsa: vsc73xx: use read_poll_timeout instead delay loop net: dsa: vsc73xx: convert to PHYLINK net: dsa: vsc73xx: Add define for max num of ports net: dsa: vsc73xx: add port_stp_state_set function net: dsa: vsc73xx: Add vlan filtering net: dsa: vsc73xx: introduce tag 8021q for vsc73xx net: dsa: vsc73xx: Implement vsc73xx 8021q tagger net: dsa: vsc73xx: Add bridge support drivers/net/dsa/Kconfig | 2 +- drivers/net/dsa/vitesse-vsc73xx-core.c | 800 +++++++++++++++++++++---- drivers/net/dsa/vitesse-vsc73xx.h | 17 + include/net/dsa.h | 2 + net/dsa/Kconfig | 6 + net/dsa/Makefile | 1 + net/dsa/tag_vsc73xx_8021q.c | 91 +++ 7 files changed, 806 insertions(+), 113 deletions(-) create mode 100644 net/dsa/tag_vsc73xx_8021q.c
Comments
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 <linus.walleij@linaro.org> > Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> > --- > 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 >
wt., 12 wrz 2023 o 16:48 Vladimir Oltean <olteanv@gmail.com> napisał(a): > > Hi Pawel, > Hi Vladimir, Thank you for Your time. > 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 <linus.walleij@linaro.org> > > Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> > > --- > > 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. > In this patch bridges are unimplemented. Please look at 8/8 patch [0]. > > + 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. > Jakub in v1 series points kdoc warn in this case. I added a description to the field added by me. Should I prepare in the v4 series a separate commit for other descriptions in this struct? > > */ > > 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 > > [0] https://lore.kernel.org/netdev/20230912122201.3752918-9-paweldembicki@gmail.com/T/#u
On Tue, Sep 12, 2023 at 05:27:45PM +0200, Paweł Dembicki wrote: > > To forward a packet between port A and port B, both of them must be in > > BR_STATE_FORWARDING, not just A. > > > > In this patch bridges are unimplemented. Please look at 8/8 patch [0]. > > [0] https://lore.kernel.org/netdev/20230912122201.3752918-9-paweldembicki@gmail.com/T/#u Yes, but vsc73xx_port_stp_state_set() remains unchanged until the end. What am I missing? In your implementation, nothing prevents port i (which is in BR_STATE_FORWARDING) from forwarding packets towards a port j, present in vsc->forward_map[i] & BIT(j), which is *not* in BR_STATE_FORWARDING. If you don't have access to the STP protocol yet, you can put port j down and it will go to the DISABLED state and you can confirm that other ports in the bridge will still remain configured to forward to it. > > > 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. > > > > Jakub in v1 series points kdoc warn in this case. I added a > description to the field added by me. Should I prepare in the v4 > series a separate commit for other descriptions in this struct? Yes, but please hold off posting it until I'm done reviewing this version.
On Tue, Sep 12, 2023 at 02:21:56PM +0200, Pawel Dembicki wrote: > +static void vsc73xx_phylink_mac_link_up(struct dsa_switch *ds, int port, > + unsigned int mode, > + phy_interface_t interface, > + struct phy_device *phydev, > + int speed, int duplex, > + bool tx_pause, bool rx_pause) > +{ > + struct vsc73xx *vsc = ds->priv; > + u32 val; > + > + if (speed == SPEED_1000) > + val = VSC73XX_MAC_CFG_GIGA_MODE | VSC73XX_MAC_CFG_TX_IPG_1000M; > + else > + val = VSC73XX_MAC_CFG_TX_IPG_100_10M; > + > + if (interface == PHY_INTERFACE_MODE_RGMII) > + val |= VSC73XX_MAC_CFG_CLK_SEL_1000M; > + else > + val |= VSC73XX_MAC_CFG_CLK_SEL_EXT; I know the original code tested against PHY_INTERFACE_MODE_RGMII, but is this correct, or should it be: if (phy_interface_is_rgmii(interface)) since the various RGMII* modes are used to determine the delay on the PHY side. Even so, I don't think that is a matter for this patch, but a future (or maybe a preceeding patch) to address. Other than that, I think it looks okay. Thanks.
śr., 27 wrz 2023 o 01:03 Vladimir Oltean <olteanv@gmail.com> napisał(a): > > On Tue, Sep 12, 2023 at 05:49:36PM +0100, Russell King (Oracle) wrote: > > On Tue, Sep 12, 2023 at 02:21:56PM +0200, Pawel Dembicki wrote: > > > +static void vsc73xx_phylink_mac_link_up(struct dsa_switch *ds, int port, > > > + unsigned int mode, > > > + phy_interface_t interface, > > > + struct phy_device *phydev, > > > + int speed, int duplex, > > > + bool tx_pause, bool rx_pause) > > > +{ > > > + struct vsc73xx *vsc = ds->priv; > > > + u32 val; > > > + > > > + if (speed == SPEED_1000) > > > + val = VSC73XX_MAC_CFG_GIGA_MODE | VSC73XX_MAC_CFG_TX_IPG_1000M; > > > + else > > > + val = VSC73XX_MAC_CFG_TX_IPG_100_10M; > > > + > > > + if (interface == PHY_INTERFACE_MODE_RGMII) > > > + val |= VSC73XX_MAC_CFG_CLK_SEL_1000M; > > > + else > > > + val |= VSC73XX_MAC_CFG_CLK_SEL_EXT; > > > > I know the original code tested against PHY_INTERFACE_MODE_RGMII, but > > is this correct, or should it be: > > > > if (phy_interface_is_rgmii(interface)) > > > > since the various RGMII* modes are used to determine the delay on the > > PHY side. > > > > Even so, I don't think that is a matter for this patch, but a future > > (or maybe a preceeding patch) to address. > > > > Other than that, I think it looks okay. > > > > Thanks. > > > > -- > > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ > > FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! > > I also agree with adding one more patch to this which converts to > phy_interface_is_rgmii(). Paweł: there was a recent discussion about > the (ir)relevance of the specific rgmii phy-mode in fixed-link here. > https://lore.kernel.org/netdev/ZNpEaMJjmDqhK1dW@shell.armlinux.org.uk/ I plan to make rgmii delays configurable from the device tree. Should I? a. switch to phy_interface_is_rgmii in the current patch? b. add another patch in this series? c. wait with change to phy_interface_is_rgmii for patch with rgmii delays configuration?
> I plan to make rgmii delays configurable from the device tree. Should I? > a. switch to phy_interface_is_rgmii in the current patch? > b. add another patch in this series? > c. wait with change to phy_interface_is_rgmii for patch with rgmii > delays configuration? Do you actually need this feature? Does the PHY you are using already support fine tuning of the delays? Andrew