From patchwork Mon Nov 7 18:54:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 16641 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2234228wru; Mon, 7 Nov 2022 11:02:33 -0800 (PST) X-Google-Smtp-Source: AMsMyM49gh9oSVz9/wMRyllwTVa5YFJTnOVFO6gq4Is6vrHV7IDCrw2d0Z6eiJe6pSABnFrfq5DV X-Received: by 2002:a05:6a02:207:b0:46f:53ca:cab8 with SMTP id bh7-20020a056a02020700b0046f53cacab8mr43166157pgb.242.1667847753221; Mon, 07 Nov 2022 11:02:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667847753; cv=none; d=google.com; s=arc-20160816; b=hrDn4xepZHhMQp3Sr3w8AH6pi4XZou6ZvO3VvPUO7XjUD08aZIcAN4DvO3Mxx5n/rl IbuY3ChcfxiqbKyKKD1eVA1na6uGme5HEv+DZfkp1nAhwcUoFnfecPl1UxBnpvYwgyxH Xpl8IwS+OgWg/oc52oKWNtpwwpBsQN+sFQMYMFLiECTULU/wI/WBxpjqX0LjDiDGJvij zGpCCNAuWKBjgo7GFGsRGLOSGdDU1NHe9yTpneNM2DtCe1+teT2oezRzGMfEJeLvRU6c jzagmKz0SD/FiBWAQZmcFcS5+cgBcPCrFR1kDVwyPBsiOSOCLLyC/F9iXzOkCCTgPfIr qJLw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a170902c40e00b0017d9b373175si13961724plk.415.2022.11.07.11.02.08; Mon, 07 Nov 2022 11:02:33 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748865125440681040?= X-GMAIL-MSGID: =?utf-8?q?1748865125440681040?= 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 | \