[v6,net-next,3/5] net: dsa: tag_ksz: Extend ksz9477_xmit() for HSR frame duplication
Message ID | 20230922133108.2090612-4-lukma@denx.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5862960vqi; Fri, 22 Sep 2023 14:02:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwiWBbrcmDYDLdYrAA/l2WXkpCEkmN6xqso8Xup9gDbP6C46FqQl3K8l3mlNEtXOwKc8Ud X-Received: by 2002:a05:6a20:8f18:b0:15d:7e2a:cc77 with SMTP id b24-20020a056a208f1800b0015d7e2acc77mr779323pzk.48.1695416529172; Fri, 22 Sep 2023 14:02:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695416529; cv=none; d=google.com; s=arc-20160816; b=e+0IOFECMDU7mnkHdnvSzi0+mnCkAl6R/r6C+BSBW0pToPD7K30AQvpmS5WQOQ5RfJ FcSsEjdEsWJndH8WA5KST1z8FvJ7IsIfzPvc5Am2olzZZqAc0g3NdScBMagyz70qFjs6 aulEOVlDcLJtFnmRe+gGocUSsAuL2yC7HcfkeftNU0Rn0HGoQSZ4zhWjepzti57EqdYK iDFCEmVJTcSq0oYSjEGk+sPpyY+V1OnNDoQt6+rEh3E6o+wLF/qMubw6mfqYip1B3Q24 0csCRqXmYM8xyaXKe35s+Ml7Z93Qqz09XKS3do46ZW1Vq7Gojn7x+xkgSA1SZhAYxugb RdjA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gXmkSM/rvnMffX+oLeFRannNXAcxtFi0FsuPk+VjC1I=; fh=dzEs5lB/GHyqXf+vqWghQ+vANL9PTMEGvyuBa2mPf5c=; b=pPVkwdtQ8LBdbY5Vg4yR8Qbn/XotlEeYjPGa1CYvTftiHDFYtes2bg0M8kUtZ1G3kC cWK1bf+ZozVYCOTaaheVYbq876Jm8OTacK5dCcXh/5gYSMvyh7MkljpwWvkt3smJFAYG Os/ws13KxZdJt10lphTvIlRkWZsVMwr3lQTmTRXtY1aXYMM6+syD1W4xX0dyRZ1EZllM b+kv+3+/Q6IiHrZm5jIB2pGDd00vVxe6XF9OqZTwEhHtR9HoFWrX9VbyQFr08YsD1mU2 5kObyTaeJH/g2yB3BqjPEzD/bl5iopP8SGb+SMXOL9ojfyK4wpNJ29qJZ/wUHw0tcWJJ ydcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=YujyD3VP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=denx.de Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id q15-20020a17090311cf00b001c5cf1c30d8si4704009plh.367.2023.09.22.14.02.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 14:02:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=YujyD3VP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=denx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 1964881DDD36; Fri, 22 Sep 2023 06:31:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234130AbjIVNbq (ORCPT <rfc822;chrisfriedt@gmail.com> + 29 others); Fri, 22 Sep 2023 09:31:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234085AbjIVNbi (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 22 Sep 2023 09:31:38 -0400 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BD3C196; Fri, 22 Sep 2023 06:31:31 -0700 (PDT) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id B21728644E; Fri, 22 Sep 2023 15:31:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1695389490; bh=gXmkSM/rvnMffX+oLeFRannNXAcxtFi0FsuPk+VjC1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YujyD3VP92tkry6nKslIit6LDIpyAqgcQgFHszD3GqoDVy8MOT3Vznuj3kHGfMUwf GphYmtCaBAMqWCq+yBSPyIAirCe+zAEihb7g0A961h7fGAJ6AFWNjEV99uiPLwSo4o pcK2xyZmwMZyAqRCTbeLU2rbnTcq2y1SM3P6XZe0N3uLJLd5VuukO0fsMjQHzNEbnQ F+QIRdpJET6tPeDmvU4JxscqYqxlpJR3JO2Ul2MaJG/YX0+GCU0eIdiGRiEDacQ/c2 bv5D9ddjds59wWrKcGkPT8i6uaQXLdiktRnjo+1YVtJbrIfK0briOZkLx1/hgG+0sW 01bfpOirBQZ7Q== From: Lukasz Majewski <lukma@denx.de> To: Tristram.Ha@microchip.com, Eric Dumazet <edumazet@google.com>, Andrew Lunn <andrew@lunn.ch>, davem@davemloft.net, Woojung Huh <woojung.huh@microchip.com>, Vladimir Oltean <olteanv@gmail.com>, Oleksij Rempel <o.rempel@pengutronix.de> Cc: Florian Fainelli <f.fainelli@gmail.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, UNGLinuxDriver@microchip.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski <lukma@denx.de>, Florian Fainelli <florian.fainelli@broadcom.com> Subject: [PATCH v6 net-next 3/5] net: dsa: tag_ksz: Extend ksz9477_xmit() for HSR frame duplication Date: Fri, 22 Sep 2023 15:31:06 +0200 Message-Id: <20230922133108.2090612-4-lukma@denx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230922133108.2090612-1-lukma@denx.de> References: <20230922133108.2090612-1-lukma@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Fri, 22 Sep 2023 06:31:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777773082364451983 X-GMAIL-MSGID: 1777773082364451983 |
Series |
net: dsa: hsr: Enable HSR HW offloading for KSZ9477
|
|
Commit Message
Lukasz Majewski
Sept. 22, 2023, 1:31 p.m. UTC
The KSZ9477 has support for HSR (High-Availability Seamless Redundancy). One of its offloading (i.e. performed in the switch IC hardware) features is to duplicate received frame to both HSR aware switch ports. To achieve this goal - the tail TAG needs to be modified. To be more specific, both ports must be marked as destination (egress) ones. The NETIF_F_HW_HSR_DUP flag indicates that the device supports HSR and assures (in HSR core code) that frame is sent only once from HOST to switch with tail tag indicating both ports. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> --- Changes for v2: - Use ksz_hsr_get_ports() to obtain the bits values corresponding to HSR aware ports Changes for v3: - None Changes for v4: - Iterate over switch ports to find ones supporting HSR. Comparing to v3, where caching of egress tag bits were used, no noticeable performance regression has been observed. Changes for v5: - None Changes for v6: - None --- net/dsa/tag_ksz.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c index ea100bd25939..3632e47dea9e 100644 --- a/net/dsa/tag_ksz.c +++ b/net/dsa/tag_ksz.c @@ -293,6 +293,14 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb, if (is_link_local_ether_addr(hdr->h_dest)) val |= KSZ9477_TAIL_TAG_OVERRIDE; + if (dev->features & NETIF_F_HW_HSR_DUP) { + struct net_device *hsr_dev = dp->hsr_dev; + struct dsa_port *other_dp; + + dsa_hsr_foreach_port(other_dp, dp->ds, hsr_dev) + val |= BIT(other_dp->index); + } + *tag = cpu_to_be16(val); return ksz_defer_xmit(dp, skb);