Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2270308rwb; Mon, 7 Nov 2022 11:11:25 -0800 (PST) X-Google-Smtp-Source: AMsMyM5RRIbm9r/vjat0Twm7+RAm6fsdPUaGf4BnYv11007JJ5nCpIoJfAH5Yvow2SU5JUF3REQd X-Received: by 2002:a17:90a:d30c:b0:213:1035:f914 with SMTP id p12-20020a17090ad30c00b002131035f914mr70063159pju.196.1667848285559; Mon, 07 Nov 2022 11:11:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667848285; cv=none; d=google.com; s=arc-20160816; b=J8rBig7O0rdKei2S795w+1+f2d5AXxdWCyHnjVaQMRnDO0fPHyK02/h2h7/azAaOWk ao1X4WyF+4PtQO/42lc8iRtOvp3XaMbSwfDC2frIF1LjAgN9v7fltJAK/kGX4BA0Gs4G sTnW9XMfB+WM+/50kQR3VSYiZE6yZAtzIYV01Lqh84ODaCihJ8RCFvaiEE3bnbIgHxWr CTlcv998A3PomiRWGzya4sI/IrF5apZMsot+QhEZaXyqVooPp1gBu2XDza5jnxAaPTCW lEIjLiiRQdVJUIhNrJjJBafF+S2koND7GR/Z4z3nOoRV2F301sAF/yuyvjgcbjB5xjsW MLMA== 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=MIPw6Fj4eUcqK2lXqmxVDqLdzLAH3cHlKhsCRY7ov/c=; b=nRh5yUiEaUckIWeEx8vKQfyKyNoLC+Lx1fqPC3OKAXE32rx4kfI2ZM4qadkvySb0mQ D+lOI3lIuY9Q5Uefx5JdkMJ81CwTG7bteRfC4fGethZcr25C5kLjxj3edAy2I4SCX5eQ Lr8Uo35KC+RG76cbz+O7RdgoE2Yu5hrMw+pmWdmjOmBslwmfhHoY0NN6/r8Bas5g+dPd 6aiajAo9/8sAa9nj1RLibg4pXU5n8oBF5bl70KwIMqFzYtf/cRXPrcmCECSzABLllg86 zCdkZAac5vuT5U5T4zLjCl3obyxhChjdZ4Jf/mrBwGipJhzZFY95h9kvPEyYHc2d/8Kl Dhiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=IxaTc7l7; 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 9-20020a630209000000b0045ec918ad31si10198970pgc.544.2022.11.07.11.11.13; Mon, 07 Nov 2022 11:11:25 -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=IxaTc7l7; 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 S233176AbiKGSz7 (ORCPT + 93 others); Mon, 7 Nov 2022 13:55:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233038AbiKGSzg (ORCPT ); Mon, 7 Nov 2022 13:55:36 -0500 Received: from nbd.name (nbd.name [46.4.11.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E23192717A; Mon, 7 Nov 2022 10:55:35 -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=MIPw6Fj4eUcqK2lXqmxVDqLdzLAH3cHlKhsCRY7ov/c=; b=IxaTc7l7M1626+mMfOlWwYXuxi LnHo0KamGTSoQ1smd59tNgKlLBEBJwpdhCMCudyffzOcVE/IKehIjoFmppTg28GSXX5Z5h2fksoMe UpsTQh0KlLbwv3qIsltPHgqGQGbYJGBg7fgNKYj0C7OOVAmL+E5EJpMyBHQ71PFqNdfY=; Received: from p200300daa72ee1007849d74f78949f6c.dip0.t-ipconnect.de ([2003:da:a72e:e100:7849:d74f:7894:9f6c] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from ) id 1os7HD-000LCc-G5; Mon, 07 Nov 2022 19:55:19 +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: linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/14] net: ethernet: mtk_eth_soc: compile out netsys v2 code on mt7621 Date: Mon, 7 Nov 2022 19:54:45 +0100 Message-Id: <20221107185452.90711-7-nbd@nbd.name> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221107185452.90711-1-nbd@nbd.name> References: <20221107185452.90711-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 8123a646ba0a..e09b2483c70c 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