Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7149985rwb; Wed, 23 Nov 2022 02:56:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf7sk91wfX+j6vaIvINVeAm0uIUk21Vw7wh770lCD/b+Ij0FN1rRN9jVskccklNRaXGZSYT2 X-Received: by 2002:a17:906:cd07:b0:781:f37a:f50e with SMTP id oz7-20020a170906cd0700b00781f37af50emr22842209ejb.468.1669200999822; Wed, 23 Nov 2022 02:56:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669200999; cv=none; d=google.com; s=arc-20160816; b=N7tiabDbfcTlQPDIg3nlAqwY3Iv7EjAq+aUXsX5oc8QS1ecDAg8BGapWWzkvzjO0f1 NtKIT3C/9L2awBO3OazUJ3a9PB2scLAJyCdZvCRqrpAEFoypI1skf70w5aiN1v4V1VT8 cbT8KfjQdnx5Q+HGt4ztSY2eeLwUTgvY8sFP7JcvWtQqSmjIH7ZME24fVdyxk91Yc2Et 3CGKVU2W8a53OVio8H6gPK+eDAvB5I3O2AfjhY+J3V4Ed24AatABxy/olhXS2Sj+2a5Q IjWZ17yFHahMqOro/U3bH7e09PmYwJ5+44fBaXKI2rD9bQF+sNHdI7/uooA64xTthKGy +4Gw== 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=eABFuziAFv9CG/pcpOvBVb6ZPtsG1pSS3xVSecQ/ysM=; b=IvwzVc7dZN/qamq2x+9gvvBJH//859XI83jXuL9qIjklTZgZUYlzsw1W2OvBsBwkvh vOxgtil7ScTxlVexa1r+EoNYL3kUn93I/v5k6pVD2gfCyhsx+3I03XM2IZSQLY4D5Aqu exY+x56WnuVTc89wZySkjBMQDgDoLO5mF8aWVgV1ng9u5Ta7rhDtxpvLbQ7KWT8eXhGN h7Ut0l5FfNDd21XtlhjKhaaOpgqi6y05pjx/r0f7StbP31fbEU2oIcxioD7vmp6TFWzn TE2mz++HRyzD4CNpWYlOKzpbYcOeKnGa9+aa4P8ZQ9PVZPe0SgJUnT5z/NEG5DWqPcSh xkOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=G13HwW9x; 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 i14-20020a05640242ce00b0045cc02ce2aasi12593276edc.319.2022.11.23.02.56.18; Wed, 23 Nov 2022 02:56:39 -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=G13HwW9x; 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 S237051AbiKWKJM (ORCPT + 88 others); Wed, 23 Nov 2022 05:09:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236842AbiKWKIm (ORCPT ); Wed, 23 Nov 2022 05:08:42 -0500 Received: from nbd.name (nbd.name [46.4.11.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CEFE57B65; Wed, 23 Nov 2022 01:58:15 -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=eABFuziAFv9CG/pcpOvBVb6ZPtsG1pSS3xVSecQ/ysM=; b=G13HwW9x5H9EKBDevun+fC6NPW dOFjv8fDbIWC+GV474I88KzDR/890Pu7pC3h5Cq7aLDtvq4jYtukPmEFn/EvXJCmNnnaWG7FSdNhv zywT5Egt4BCBSdb6nEvKM1pxb9JVNhILhv5CMJpi+QELMUMccBJ43XnooHnjS50KRe3s=; Received: from p200300daa7225c0894d890dd9e4669b3.dip0.t-ipconnect.de ([2003:da:a722:5c08:94d8:90dd:9e46:69b3] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from ) id 1oxmVw-003vzk-9a; Wed, 23 Nov 2022 10:57:56 +0100 From: Felix Fietkau To: netdev@vger.kernel.org, John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , "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 2/5] net: ethernet: mtk_eth_soc: compile out netsys v2 code on mt7621 Date: Wed, 23 Nov 2022 10:57:51 +0100 Message-Id: <20221123095754.36821-2-nbd@nbd.name> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123095754.36821-1-nbd@nbd.name> References: <20221123095754.36821-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 a553265c10de..628ed72911bd 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -907,7 +907,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