Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3344658rdb; Wed, 13 Sep 2023 09:13:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEieaCIh97qL+EjP7WAhe53TLZoxSSZcgRShW90GbFiq4prDiQkYx2VDyls0xCMvZ72Bz/f X-Received: by 2002:a05:6a00:1586:b0:68f:ee51:7db1 with SMTP id u6-20020a056a00158600b0068fee517db1mr3715708pfk.11.1694621580022; Wed, 13 Sep 2023 09:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694621580; cv=none; d=google.com; s=arc-20160816; b=UKyF+lb/OHeb0/13nAeQJLgMDLf4o1cvdaFtxMoaRwrdgOBU7KqDjh0GEyEeUDwW8X 86ThPqnuVwd6qcX+VM9o+ADI+rpsv65kz+0nM/94jrVqygAAA0bTNbHgSFNoJLz3wuXj 2O3+y/+WTaJ5Dpt0c0KGgY48DqAzeiOGSQunkx+rovIXUbuhVyGLb4YqWiP4JE45cR91 Ev4lhRqHMq7RbmpM5dOZFKm94bQNHwdd9Pr0T6ZaUgprCmtY2iAVT0H0VKuseb2KIciZ OnycXF7QerFZ+eTV9c1quMximH00cg3R1e62Vgobu3RCEwulthM4ScYSuuAUeaGBgKOX LBCA== 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=Q4TLaPjJGYtbUUUt+F/f79z+dkxxZ0mIyqX82iiNHCQ=; fh=r2Rs7mCJq/Or1dHvKHVIJ+zyjhpMlj0e58rrWxsK7SA=; b=Vr4MwUfUwdenllJWKvhJnUBaYZ7o2UvLOVfS/qGKHY86jsY3khsNX8LDTIrxhZaiMv 5DIXj51BSugYPsSa+l7MRdLgEyBMZFlAhSVv8Vm6chNkR5s3frxORdcsEAgjbL8H+k5F x9jRyetL02YkvUPkJaP3znBJWS5389SS1lg8AZE2n3TEWniYaNjuskwPAbN6W+Nqxelo x9ZqFhjXcRmq8a14UABriRp2u85UkaQwEy0W91Lw707Viw53poLMVkG5pCj5Jxo4quWT k8M1l/b3qvxFo22NGKlSBSiTIzPHImph7m8scaKJCXnL86w7CNGbAh+vEJdmGAJxDoFk 2img== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="MdLwo/5V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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. [23.128.96.38]) by mx.google.com with ESMTPS id fd25-20020a056a002e9900b0068fad24a32csi7912803pfb.27.2023.09.13.09.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 09:13:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="MdLwo/5V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 E61168211F50; Wed, 13 Sep 2023 03:58:37 -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 S239784AbjIMK6S (ORCPT + 99 others); Wed, 13 Sep 2023 06:58:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239845AbjIMK6R (ORCPT ); Wed, 13 Sep 2023 06:58:17 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E833819B4; Wed, 13 Sep 2023 03:58:10 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2bc63e0d8cdso106900581fa.2; Wed, 13 Sep 2023 03:58:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694602689; x=1695207489; 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=Q4TLaPjJGYtbUUUt+F/f79z+dkxxZ0mIyqX82iiNHCQ=; b=MdLwo/5VdbXxKQ4WGN7kCw7GubUS/dCRh6cXWzO7BFioKy9ONzVNuScE7Rfxy/98kn YuMWJQhbswTTLYhYBK5Va9nxurRXByj+ywoe50yZtlnq3gvxoK2MMUJbTa1O3FKp+D3V NrMIukbMBnPNtm1sVesegegWFKBKde9g+QAjSiL2qoth0fzxynxehX+vScj/XWzRQ7XP rJoGZJtg0nU3wqmzhtvYqEgJV/CQzg26yV/aCqOBsbup5e23NS8rb6/KR3FSANhjtM06 tbe5IOVE8pLph7i27QAHqrlMUeYU53gaLBYSjlAvoW5djPvGXDdyOpTea94tl3+7PEcs LRzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694602689; x=1695207489; 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=Q4TLaPjJGYtbUUUt+F/f79z+dkxxZ0mIyqX82iiNHCQ=; b=cqFT2hgwZH0K5W939tyPxNUNns1ZOe8CtX+rbzrMUSIhlpKh98jFKp7e3RAJge8Ap7 8U3ARWnm9zEL44aIYuoiYDwBKwgMvJnk++yqw96DNuwjLKXEbwdmIuRUVIvYGYIei0r7 iaf18WYodqyeR6GVkEPVaXfwkUKG6w8qYtE96qLs+QP5m6E672Mnti8A4ej2Byfu7oFJ CuoJPQM2Q3jOjoG+5BNWNwu4ptn6/FsbOslaxY1gnbUfAtvtJz998f/P0ri2Im2EQc36 g3A/l86+757KNbU+opzjZOF/vnMRhl31YayKtXRogPxqUpLS8wrF4vKRxBmphc1hPEC0 NK9g== X-Gm-Message-State: AOJu0YzD6nXMbMfEyTji+ZbowMgQURDzQDUOBdEERZZJSfQRmEhC/zBV VsGmPqdUP1E91huQ/fbW554= X-Received: by 2002:a2e:8349:0:b0:2bc:be93:6d3c with SMTP id l9-20020a2e8349000000b002bcbe936d3cmr1961460ljh.32.1694602688771; Wed, 13 Sep 2023 03:58:08 -0700 (PDT) Received: from skbuf ([188.26.184.93]) by smtp.gmail.com with ESMTPSA id ga17-20020a170906b85100b009a1e0349c4csm8211559ejb.23.2023.09.13.03.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 03:58:08 -0700 (PDT) Date: Wed, 13 Sep 2023 13:58:06 +0300 From: Vladimir Oltean To: Lukasz Majewski Cc: Andrew Lunn , Tristram.Ha@microchip.com, Eric Dumazet , davem@davemloft.net, Woojung Huh , Oleksij Rempel , Florian Fainelli , Jakub Kicinski , Paolo Abeni , UNGLinuxDriver@microchip.com, Oleksij Rempel , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [[RFC PATCH v4 net-next] 0/2] net: dsa: hsr: Enable HSR HW offloading for KSZ9477 Message-ID: <20230913105806.g5p3wck675gbw5fo@skbuf> References: <20230911165848.0741c03c@wsk> <20230911160501.5vc4nttz6fnww56h@skbuf> <20230912101748.0ca4eec8@wsk> <20230912092909.4yj4b2b4xrhzdztu@skbuf> <20230912160326.188e1d13@wsk> <20230912160326.188e1d13@wsk> <20230912142644.u4sdkveei3e5hwaf@skbuf> <20230912170641.5bfc3cfe@wsk> <20230912215523.as4puqamj65dikip@skbuf> <20230913102219.773e38f8@wsk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230913102219.773e38f8@wsk> 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]); Wed, 13 Sep 2023 03:58:38 -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 fry.vger.email On Wed, Sep 13, 2023 at 10:22:19AM +0200, Lukasz Majewski wrote: > Why we cannot have even simpler solution - in the HSR/Wol code we read > content of REG_SW_MAC_ADDR_0 (the actually programmed MAC) and: > > - If not programmed - use DSA master one (like done in mine patches) You said here https://lore.kernel.org/netdev/20230912160326.188e1d13@wsk/ that using the DSA master address is a complication that can be avoided, no? So why is it now part of the solution that you propose? I thought we were in agreement to program the actual DSA user ports' MAC addresses to hardware. > - If already programmed: > - check if equal to DSA master - proceed with HSR. > - if not equal to DSA master (e.g. WoL altered) - exit HSR join > with information that offloading is not possible With KSZ switches, a single CPU port is supported, so all ports share the same DSA master. So if the contents of REG_SW_MAC_ADDR_0 is different from the DSA master (the same DSA master that was used for an earlier HSR offload), why do you infer that it was altered by WoL? It makes no sense. > Then, the content of REG_SW_MAC_ADDR_X would determine what to do with > it. > > > There are probably hundreds of implementations of this idea in the > > kernel, but the one that comes to my mind is ocelot_mirror_get() + > > ocelot_mirror_put(). Again, I need to mention that I know that port > > mirroring != HSR - I'm just talking about the technique. > > > > There is one more thing that your reply to my observation fails to > > address. Even with this refcount thing, you will still need to add > > code to dsa_slave_set_mac_address() which notifies the ksz driver, so > > that the driver can refuse MAC address changes, which would break the > > offloads. Ack? > > And the above problem is not related to the DSA slave address change > discussed earlier? "Discussed earlier" is a bit imprecise and I don't know what you're talking about. There are 3 netdev kinds at play here: (a) DSA master, (b) DSA user port, (c) HSR device. - Changing the MAC address of (a) triggers a pre-existing bug. That bug can be separated from the HSR offload discussion if the HSR offload decides to not program the DSA master's MAC address to hardware, but a different MAC address. The pre-existence of the DSA bug is not a strong enough argument per se to avoid programming the DSA master's address to hardware. But there may be others. Like the fact that DSA user ports may inherit the DSA master's MAC address, or they may have their own. Limiting HSR offload and WoL to just the "inherit" case may seem a bit arbitrary, considering that the self-address filtering from hsr_handle_frame() looks at the port_A and port_B MAC addresses. - Changing the MAC address of (c) does not seem directly possible, but: - Changing the MAC address of (b) also triggers (c) - see hsr_netdev_notify(). This is because the HSR driver makes sure that the addresses of port_A, port_B and the HSR device are equal at all times. The simple matter is: if you program the MAC address of a netdev (any netdev) to hardware, then for a correct and robust implementation, you need to make sure that the hardware will always be in sync with that address, keeping in mind that the user may change it. Either you deny changes, or you update the hardware when the address is updated. It's not quite clear to me that you're making a distinction between changing (a) and (b). > > In principle it sounds like a plan. It just needs to be implemented. > > To clarify: > > 0. It looks like described above prevention from REG_SW_MAC_ADDR_X > overwriting and DSA slave port MAC address change are needed. > > Then questions about time line: > > 1. The HSR code is accepted without fixes from 0. and then when other > user (WoL) patches are posted problems from 0. needs to be addressed. > > or > > 2. To accept the HSR code you (and other community members? Russell, > Andrew) require the fixes from 0. first. If the DSA user port MAC address changes, and REG_SW_MAC_ADDR_0 was previously programmed with it, and nothing is done in reaction to this, then this is a problem with the HSR offload. So no, it's not just a problem with upcoming WoL patches as you imply. You need to integrate a solution to that problem as part of your HSR patches.