Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2598581rwd; Wed, 14 Jun 2023 05:13:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VvmDYhN55l74Xak+7Cb48MdpoBfc6HOt8XQVjYMx/WYGOYW64tafRcoScOyO6Bh+aflVN X-Received: by 2002:a05:6a00:2d9d:b0:656:5182:5e61 with SMTP id fb29-20020a056a002d9d00b0065651825e61mr2291978pfb.2.1686744825032; Wed, 14 Jun 2023 05:13:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686744825; cv=none; d=google.com; s=arc-20160816; b=kNiAy0HNrgcqMkaHyY8vENp2IAHtef5b/miAMZYicHyURIwTZntvB0kgq0an9YuVBc rZwAUdAscCAF7o4Dv1RxFdvrszi0nMTFuk7BfNdlMRvI0JI4aYdcQ8MxaFhyzYI9Dwj/ iIuqbfoElREc9omTCtkJBc9y1Yc9lzOnpLXgWYyZn/Gj/j7ODHhxJZHTllqC2k4/f/4E /ExJd+L8rm+1JnC7Wp0s0yACLIjRxs16KWwpr87pPSx//JKLZLHNmSsCZ1mL48xH60nN qtpT0UmdgLcZ4rL4Qm+Z/h8AbmL8mOHvE6mcdETEX9vATnJRaPJhW7Nsbk6NC5zTkafQ hNDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=sA/wHQWGukp8xdptR9h0VboCMWUkFR4POYrWrCGHCeE=; b=yPIWRh/vdKaHyFUDaJBtiKmi69/TpRSXIgtYZbp1eqTPYTYpccrWOQ/Ex1RSSvSC7Y 25ETYPUj2JjXJbKguh7Ago7+xAtbO6OhmY8nm0zJxZsGQ0z9DI+EgPKuRNSyzqVRK8xd 8l+s4NIjY1gpcxhCx2Efho4lrIkfs1RVgvWBc53TSc15DKJTEZwtJcsM4qxe6gH+S/XW 1XS6z2w9o+WwdM1ZKe2IBnNeaEV/i8VjsCbF4XMj3eDQf3zBQg8v+htAbC/qAw90SHqH /E/mNWBQw51mWTpk8kXUfoycGOXFbhADUpTy4j5cpWrW8UA8M1ppIxsOEfRcWOXCADK9 Qyfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=aiOCextL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r14-20020aa7988e000000b0064490c20e80si10772635pfl.59.2023.06.14.05.13.33; Wed, 14 Jun 2023 05:13:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=aiOCextL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239824AbjFNLre (ORCPT + 99 others); Wed, 14 Jun 2023 07:47:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241042AbjFNLrd (ORCPT ); Wed, 14 Jun 2023 07:47:33 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A769510D8; Wed, 14 Jun 2023 04:47:26 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 35EBlE1E109706; Wed, 14 Jun 2023 06:47:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1686743234; bh=sA/wHQWGukp8xdptR9h0VboCMWUkFR4POYrWrCGHCeE=; h=From:To:CC:Subject:Date; b=aiOCextLJUKAYz8Ee3M6kzNTrmzmiNHam9Dn6cIopUZoWQot4zqGloswc3fGqZaX+ LbQSLiJO1EC0FYN3KX3uUrOzl+a5CzeOYhoP+Ym/hKPFgD178Ax/L/vqlLue456MUI +i1ZFjEHWbVimurcW1nUH0U5adayfHdxWUZ0nRIo= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 35EBlEvP110320 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 14 Jun 2023 06:47:14 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 14 Jun 2023 06:47:14 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Wed, 14 Jun 2023 06:47:14 -0500 Received: from uda0500640.dal.design.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 35EBlA24044618; Wed, 14 Jun 2023 06:47:11 -0500 From: Ravi Gunasekaran To: , , , , , CC: , , , Subject: [PATCH v2 net-next] net: hsr: Disable promiscuous mode in offload mode Date: Wed, 14 Jun 2023 17:17:10 +0530 Message-ID: <20230614114710.31400-1-r-gunasekaran@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When port-to-port forwarding for interfaces in HSR node is enabled, disable promiscuous mode since L2 frame forward happens at the offloaded hardware. Signed-off-by: Ravi Gunasekaran Reviewed-by: Simon Horman --- Changes from v1: =============== * Changed the data type of "fwd_offloaded" from "unsigned int" to "bool" and moved it below "net_id" struct member as per Paolo's comment. * Collected Reviewed-by tag from v1 patch. v1: https://lore.kernel.org/all/20230612093933.13267-1-r-gunasekaran@ti.com/ net/hsr/hsr_device.c | 5 +++++ net/hsr/hsr_main.h | 1 + net/hsr/hsr_slave.c | 15 +++++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index 5a236aae2366..306f942c3b28 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -531,6 +531,11 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2], if (res) goto err_add_master; + /* HSR forwarding offload supported in lower device? */ + if ((slave[0]->features & NETIF_F_HW_HSR_FWD) && + (slave[1]->features & NETIF_F_HW_HSR_FWD)) + hsr->fwd_offloaded = true; + res = register_netdevice(hsr_dev); if (res) goto err_unregister; diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h index 5584c80a5c79..6851e33df7d1 100644 --- a/net/hsr/hsr_main.h +++ b/net/hsr/hsr_main.h @@ -208,6 +208,7 @@ struct hsr_priv { u8 net_id; /* for PRP, it occupies most significant 3 bits * of lan_id */ + bool fwd_offloaded; /* Forwarding offloaded to HW */ unsigned char sup_multicast_addr[ETH_ALEN] __aligned(sizeof(u16)); /* Align to u16 boundary to avoid unaligned access * in ether_addr_equal diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c index b70e6bbf6021..e5742f2a2d52 100644 --- a/net/hsr/hsr_slave.c +++ b/net/hsr/hsr_slave.c @@ -131,9 +131,14 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev, struct hsr_port *master; int res; - res = dev_set_promiscuity(dev, 1); - if (res) - return res; + /* Don't use promiscuous mode for offload since L2 frame forward + * happens at the offloaded hardware. + */ + if (!port->hsr->fwd_offloaded) { + res = dev_set_promiscuity(dev, 1); + if (res) + return res; + } master = hsr_port_get_hsr(hsr, HSR_PT_MASTER); hsr_dev = master->dev; @@ -152,7 +157,9 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev, fail_rx_handler: netdev_upper_dev_unlink(dev, hsr_dev); fail_upper_dev_link: - dev_set_promiscuity(dev, -1); + if (!port->hsr->fwd_offloaded) + dev_set_promiscuity(dev, -1); + return res; } -- 2.17.1