Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2318065rdb; Thu, 21 Sep 2023 15:18:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcuaf3lLpc4jmB01xiM+sF4SZfsjRAWH0Jm2++6Ku9db9lbcl7KNA9Af2AlWjF1/T48eZk X-Received: by 2002:a17:902:e888:b0:1c5:ba50:2b28 with SMTP id w8-20020a170902e88800b001c5ba502b28mr7972407plg.25.1695334682808; Thu, 21 Sep 2023 15:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695334682; cv=none; d=google.com; s=arc-20160816; b=sCS5rRM6as41RwRH/zOqmUheG6u5Ap8pOzd3RzesWa7WXE0Y02wuuHBZ3no7/KvsFb B/+gUS6gIOTzWd28m3Eoc96BZoxtAZTobBX3wrkGPl75embNWRxQfOCoc9DFYEuLCEgE 2zXG3Efk4y3Yyxsf0wKCVP2PBionJgYgU3M0tdTV/3lBMyrbx8XwEq63E7JQ4ApMPiJr vVbBZvVwFq47phw6mRlkhiGrejyUxHqmK+a5vvp0/iFadTOdqS6+Zf/z+i+Gv9LroG/s 6oRXGcxQI5HQQX0eZzASpXJ5fhDIXQMcaE5EYWg0ztLpgk8ISaEOt7leWtLqfhKxlB45 1yKQ== 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=yMH7PzSWp067dWiOIVcukRVxS+yuwr0XHpd8PRZA1eY=; fh=pOCHu4CC7jGMNyy4gjE5E0b3NpuuIEA2OVDg8ciKUV0=; b=l/spQV6xbQ4mT1IBDbC/Hyx1kuM/iznSlrG6TlbUhwy3TKc2vaDhiOGIvOgLKTMALB r0BjAyE4zTdY204Pon3M53UWHzPbclPhsDp2YaZgKl5W5f+aePoW3+/FfBGX2NYZNSJV HWFM0ldZGSNjMGJappIlL4VoBm+D3XKsrKc8sSOPr7i0aFNXWFRXTqW+vkurDZ94LCpV JfxAZkKc9PjiP9yYQhMQYhIqLOxEzWXyFN5LI+OF0Vu44Iu08bJDjtUvRHpG3Lqlso0f F7/mzS8ekYqiPzeHGoN9mwHMVwBq5SxWDtRetZMhr2RNCRDnYKBa7EVfwJw+liN9nV0Y /SEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DrGcmFYB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id n12-20020a170903110c00b001c38666f77dsi2772292plh.596.2023.09.21.15.18.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 15:18:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DrGcmFYB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id BD05781FD9FD; Thu, 21 Sep 2023 12:50:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231341AbjIUTuL (ORCPT + 99 others); Thu, 21 Sep 2023 15:50:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231551AbjIUTtw (ORCPT ); Thu, 21 Sep 2023 15:49:52 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4431EA5EF; Thu, 21 Sep 2023 12:32:29 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-532c3b4b55eso1589240a12.0; Thu, 21 Sep 2023 12:32:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695324748; x=1695929548; 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=yMH7PzSWp067dWiOIVcukRVxS+yuwr0XHpd8PRZA1eY=; b=DrGcmFYBh4mqwecXAUrqpBEW0qxvQ/9w+D/UPM0vX7y8Zlvq6N8DZrlAmB56kFffJk u5Cxa4vXKQOGj1yVYusoEwRb3QZ/z0SqiEpmFfqwepTSsQaMhz2QsmDpA+TD+8yQZcWq a3ZS82xWFfxXOYlXs5hR4gN9ck4Pm/iqzRBU/1mREom1NPw6q8H7rYiBAtd4TbtXOWt5 CZNxhsRnobU0pp8B249GJ1Hz7kDBgp48GiDb7dhd943q2n2Jc3K7E4ijJ+RtrlGBnU47 TFFpwziOrmAOx/YAjFxvOaX6ToeMEfqH43kYNnMW17iNTHFI2lg6ys4OqknUaBxIkXp4 LBiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324748; x=1695929548; 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=yMH7PzSWp067dWiOIVcukRVxS+yuwr0XHpd8PRZA1eY=; b=XUj+o134A78aObRzhKC0KzxU3ksBHkOVHvkCRmXHGAwms0TzzVDepL1ouGZMj45eEZ eVoILpVhwtR6268TCYtVx+F2AsabusQcxrZUrwzddJydrAbQKFs0LO7ehYXCiD7YmNme 3qxq9iIES9Y+OYBwH3CQ5kZ5UBY0hTScsmxe0QbHQZKqtxNRoEzDvk9vjYkaKMFG5Nla B1+IG5MUUThPTlzigPk2tlaHnYvf0CjC+IDtBZWUTRL/ZNI7DfcZtv3GMs3/OkTlLcOA ylAruOQCoQzYdGl3AITx3MFUQMOMZHFQgghITFXc6nDzGnkDXUjC3m8JVgEtweLJGDY+ dHXg== X-Gm-Message-State: AOJu0YwH+cywups3KWMMXbSozYTIbrZBxeqC09chMR/e6OVRjMzOoj3n pYkkS5K4UOmlIjcWZyX4Gs8= X-Received: by 2002:aa7:d792:0:b0:532:b974:671e with SMTP id s18-20020aa7d792000000b00532b974671emr5718460edq.41.1695324747878; Thu, 21 Sep 2023 12:32:27 -0700 (PDT) Received: from skbuf ([188.25.255.147]) by smtp.gmail.com with ESMTPSA id f15-20020a50ee8f000000b0052a19a75372sm1213490edr.90.2023.09.21.12.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:32:27 -0700 (PDT) Date: Thu, 21 Sep 2023 22:32:24 +0300 From: Vladimir Oltean To: Lukasz Majewski Cc: Tristram.Ha@microchip.com, Eric Dumazet , Andrew Lunn , davem@davemloft.net, Woojung Huh , Oleksij Rempel , Florian Fainelli , Jakub Kicinski , Paolo Abeni , UNGLinuxDriver@microchip.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Oltean Subject: Re: [PATCH v5 net-next 5/5] net: dsa: microchip: Enable HSR offloading for KSZ9477 Message-ID: <20230921193224.l3ojpdcsb4bpfl7d@skbuf> References: <20230920114343.1979843-1-lukma@denx.de> <20230920114343.1979843-1-lukma@denx.de> <20230920114343.1979843-6-lukma@denx.de> <20230920114343.1979843-6-lukma@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230920114343.1979843-6-lukma@denx.de> <20230920114343.1979843-6-lukma@denx.de> 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 fry.vger.email 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 (fry.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:50:21 -0700 (PDT) On Wed, Sep 20, 2023 at 01:43:43PM +0200, Lukasz Majewski wrote: > +void ksz9477_hsr_join(struct dsa_switch *ds, int port, struct net_device *hsr) > +{ > + struct ksz_device *dev = ds->priv; > + struct net_device *slave; > + u8 data; > + > + /* Program which port(s) shall support HSR */ > + ksz_rmw32(dev, REG_HSR_PORT_MAP__4, BIT(port), BIT(port)); > + > + /* Forward frames between HSR ports (i.e. bridge together HSR ports) */ > + ksz9477_cfg_port_member(dev, port, > + BIT(dsa_upstream_port(ds, port)) | BIT(port)); Isn't this supposed to be ksz9477_cfg_port_member(dev, port, BIT(dsa_upstream_port(ds, port)) | BIT(pair)); where "pair" is not even passed as an argument to ksz9477_hsr_join(), but represents the *other* port in the HSR ring, not this one? > + > + if (!dev->hsr_ports) { > + /* Enable discarding of received HSR frames */ > + ksz_read8(dev, REG_HSR_ALU_CTRL_0__1, &data); > + data |= HSR_DUPLICATE_DISCARD; > + data &= ~HSR_NODE_UNICAST; > + ksz_write8(dev, REG_HSR_ALU_CTRL_0__1, data); > + } > + > + /* Enable per port self-address filtering. > + * The global self-address filtering has already been enabled in the > + * ksz9477_reset_switch() function. > + */ > + ksz_port_cfg(dev, port, REG_PORT_LUE_CTRL, PORT_SRC_ADDR_FILTER, true); > + > + /* Setup HW supported features for lan HSR ports */ > + slave = dsa_to_port(ds, port)->slave; > + slave->features |= KSZ9477_SUPPORTED_HSR_FEATURES; > +} > diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h > index 1f3fb6c23f36..1f447a34f555 100644 > --- a/drivers/net/dsa/microchip/ksz_common.h > +++ b/drivers/net/dsa/microchip/ksz_common.h > @@ -101,6 +101,11 @@ struct ksz_ptp_irq { > int num; > }; > > +struct ksz_switch_macaddr { > + unsigned char addr[ETH_ALEN]; > + refcount_t refcount; > +}; > + > struct ksz_port { > bool remove_tag; /* Remove Tag flag set, for ksz8795 only */ > bool learning; > @@ -169,6 +174,10 @@ struct ksz_device { > struct mutex lock_irq; /* IRQ Access */ > struct ksz_irq girq; > struct ksz_ptp_data ptp_data; > + > + struct ksz_switch_macaddr *switch_macaddr; > + struct net_device *hsr_dev; /* HSR */ Please be consistent with the lines above, and use tabs to align the "/* HSR */" comment. > + u8 hsr_ports; > }; > > /* List of supported models */ > -- > 2.20.1 >