Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5309383rwd; Mon, 12 Jun 2023 03:14:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ63xMjpkNNL1IggTd+gEvzoiFntDt2FkYvCB6FpKDxX/XaUgHlkmumBL0YV1Ro2ogQ80p9C X-Received: by 2002:aa7:88d5:0:b0:662:def9:dc3f with SMTP id k21-20020aa788d5000000b00662def9dc3fmr10723349pff.4.1686564841467; Mon, 12 Jun 2023 03:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686564841; cv=none; d=google.com; s=arc-20160816; b=uoKsq3ALUrd8x+r98NC9Ohftonh3m8+5BeW+CZKBKU5AYtvifwDMnLtM9s8EPzsYnI lI1zKYN0b9J+KqbP4B0u4P5jwS3ULdHZdP8b34FYgoC11xYt/xvU646b91kkvjsOU8dQ lx6l9QKZZzGkS1YX3K4EMkz9yfi/dNdSHaABlmgsp9+nRXgsGy3TFe9AToM32oj2eNQX xuKdHjppVUKiKMinrD9HvHdMOorbKQpoYM7d8wef7Sr5+hZlE2rir0KSsEIP8iuPbNW/ BPPg2aeGIsPGBbKZc01+mnvzI+ln11etM+gje86WKjrJps06xweaWYsc2KQFDdvH7Ou2 f0eQ== 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=AGy91cg2bUq6lI9pwR/1/BuzfRyl0z5flNLxgO6J+zw=; b=HL2ePsiwHSnJ0mK8BcJF2QXPb1oaZabwfKuQKVkAkKZRhZFzjRTagziTFf6ycXEhw7 8uYDrAUEJFQ96AUT3nxSAIIp1x3jfcRNC8xqFgRlJGRozI9VkH+ceg+ETGTSuMmeF+NZ NXXqg0UYTxlfvAZyWZ8QNt2xj2qB0STDiEg/DMErFIIv+tF37ZqCuq4EZEQBpPt1kajM ANzh3x02Y/v3jysBqypTHpNkzbJciaJs8vazzMjCbqKWTEp3k+Y89ykbGKhA7KpbBGoS 9/Mh4J1QdZcesYRXDRdzQ6vrWLYpTRKPrNhi2nEI6nmAONHr9EOWJIim8A+640eeTij6 zviw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=IYZbNIUh; 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 q19-20020aa79833000000b006251fb701a6si6608699pfl.285.2023.06.12.03.13.49; Mon, 12 Jun 2023 03:14:01 -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=IYZbNIUh; 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 S236194AbjFLKCZ (ORCPT + 99 others); Mon, 12 Jun 2023 06:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235027AbjFLJzG (ORCPT ); Mon, 12 Jun 2023 05:55:06 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF8991701; Mon, 12 Jun 2023 02:40:04 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 35C9dboI046777; Mon, 12 Jun 2023 04:39:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1686562777; bh=AGy91cg2bUq6lI9pwR/1/BuzfRyl0z5flNLxgO6J+zw=; h=From:To:CC:Subject:Date; b=IYZbNIUhxGX3LPKfl9SuBYExmgHOzQ7bQub5g0W+DMs4V1olvPjICgYT5eS04mx1F Qv+Xofq3meea7Bkr+rEd6Ib2p5cX84bFp7yJPcNNS1Hc+Q67cy01gjqiKleqNmtITJ GkVIi5FkMZyklViEd77ij3M4/5w1G0m0bGVgkpJ4= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 35C9dbHu012876 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Jun 2023 04:39:37 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 12 Jun 2023 04:39:37 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE110.ent.ti.com (157.170.170.21) 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; Mon, 12 Jun 2023 04:39:37 -0500 Received: from uda0500640.dal.design.ti.com (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 35C9dXBJ021977; Mon, 12 Jun 2023 04:39:34 -0500 From: Ravi Gunasekaran To: , , , , CC: , , , Subject: [PATCH] net: hsr: Disable promiscuous mode in offload mode Date: Mon, 12 Jun 2023 15:09:33 +0530 Message-ID: <20230612093933.13267-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 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 --- 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..0225fabbe6d1 100644 --- a/net/hsr/hsr_main.h +++ b/net/hsr/hsr_main.h @@ -195,6 +195,7 @@ struct hsr_priv { struct hsr_self_node __rcu *self_node; /* MACs of slaves */ struct timer_list announce_timer; /* Supervision frame dispatch */ struct timer_list prune_timer; + unsigned int fwd_offloaded : 1; /* Forwarding offloaded to HW */ int announce_count; u16 sequence_nr; u16 sup_sequence_nr; /* For HSRv1 separate seq_nr for supervision */ 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