Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp811252rwb; Wed, 9 Nov 2022 08:54:53 -0800 (PST) X-Google-Smtp-Source: AMsMyM5a/GG0seqeCMWCLAMogAyEaJneN2C9mK26hB63eOnG4RZesuoNNTGnyJlr4eohR2H5L667 X-Received: by 2002:a17:906:5a4b:b0:7ad:ba84:faf0 with SMTP id my11-20020a1709065a4b00b007adba84faf0mr53884994ejc.753.1668012892921; Wed, 09 Nov 2022 08:54:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668012892; cv=none; d=google.com; s=arc-20160816; b=n8/WzacIusrwjxPg/FC924UJDpsFTPpvIDOrBKZ6S73CraINYpwgwfp27J5gcSIIuo 81YXgwEStkjqaVIp7rBWxlJcI4uT1wyUpV8393x+qYzceEIF6w+0vAXksX8tmFuHu+OF NJj/Rtzn1x8NtUJmEp2nILl71LygYbuh1BLY97to/UxF+0PIM1wRodglHECWoWka0ERc fwFXVncdg66NeuW6iOcNAxx5b3Z0m4VUsW/hvASCF5B44yE4Wj195mY8DxTFQK5d4sAU +CtEQZbqvZxjvhchBcl3IW6UrUssfIL+OLpEHScT4H5MiRBdmdNCZCuCmz1SerlUteO3 EsJg== 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=wlWx8xsTCdfxtgLYoUzFnVCZjXRJlA1hg0PQEq10fwE=; b=loIONnEMmXes2t4RR7Z8hvzMb5/K1X3i2FCDbZV4veStKcgNuuGDrwpej7A1lxzEGe npNEgm9a3NoI4IpDwpB03RT1RKwvUj6qVrrQz+wDUivFayV/tVGDpgugqd9IYbdfJGZc 3kiPvT3G2qVART0tUeFXesEvNwwHLiPwHVkkCAisnLr3PsxqGBpfK2dWU5ry/pEbkjXx 0gFP2PgYPuNdVQkfbUZGh/aYtHa+2IT75CpPOrzLtbkYkRp/Dk9NnMEkT5fVdjk4fkQQ 1zs3osp2yUqK1uJliHyMpAwif732FkIsDcnobAqVrlOW5BNlZYaOcrSuTGnEqf9YIgrA z/wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=OIAM7q5N; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a170906728300b0073dd7598686si14523579ejl.270.2022.11.09.08.54.30; Wed, 09 Nov 2022 08:54:52 -0800 (PST) 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=fail header.i=@nbd.name header.s=20160729 header.b=OIAM7q5N; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231865AbiKIQfM (ORCPT + 93 others); Wed, 9 Nov 2022 11:35:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231173AbiKIQex (ORCPT ); Wed, 9 Nov 2022 11:34:53 -0500 Received: from nbd.name (nbd.name [46.4.11.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80AAF1A064; Wed, 9 Nov 2022 08:34:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=wlWx8xsTCdfxtgLYoUzFnVCZjXRJlA1hg0PQEq10fwE=; b=OIAM7q5NYu41hcHMIPQK990l5Y vpQYZhPl7o5Ns6foy1wqgtGrtFwt9W2Iyi1WTmsGi+V/AD5VoLFVaeZHSvW0x7Cat3jNXsOkuKgR4 iE61HSTdnYDCj31f5D2+zoNBsXOZgl0ahtxiKGT9XWl4Dk7u2G9joUbEy24ox9mBWFkA=; Received: from p200300daa72ee100054f3c61b16ef6e7.dip0.t-ipconnect.de ([2003:da:a72e:e100:54f:3c61:b16e:f6e7] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from ) id 1oso28-000l4N-3V; Wed, 09 Nov 2022 17:34:36 +0100 From: Felix Fietkau To: netdev@vger.kernel.org, John Crispin , Sean Wang , Mark Lee , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger Cc: Vladimir Oltean , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 07/12] net: ethernet: mtk_eth_soc: compile out netsys v2 code on mt7621 Date: Wed, 9 Nov 2022 17:34:21 +0100 Message-Id: <20221109163426.76164-8-nbd@nbd.name> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221109163426.76164-1-nbd@nbd.name> References: <20221109163426.76164-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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 Avoid some branches in the hot path on low-end devices with limited CPU power, and reduce code size Signed-off-by: Felix Fietkau --- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index c6a39a249fb5..146437ca044b 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -905,7 +905,13 @@ enum mkt_eth_capabilities { #define MTK_MUX_GMAC12_TO_GEPHY_SGMII \ (MTK_ETH_MUX_GMAC12_TO_GEPHY_SGMII | MTK_MUX) -#define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x)) +#ifdef CONFIG_SOC_MT7621 +#define MTK_CAP_MASK MTK_NETSYS_V2 +#else +#define MTK_CAP_MASK 0 +#endif + +#define MTK_HAS_CAPS(caps, _x) (((caps) & (_x) & ~(MTK_CAP_MASK)) == (_x)) #define MT7621_CAPS (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | \ MTK_GMAC2_RGMII | MTK_SHARED_INT | \ -- 2.38.1