From patchwork Wed Nov 23 09:57:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 24841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2699027wrr; Wed, 23 Nov 2022 02:09:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf5qkf/fSIi7f0G1AKbXj9IJlEhzjuqUsBSjTd/YTOzFY1+6OX5jddd43l++4R5RxWdbnMoh X-Received: by 2002:a17:90a:71c5:b0:213:b0e:ede8 with SMTP id m5-20020a17090a71c500b002130b0eede8mr19458234pjs.89.1669198194462; Wed, 23 Nov 2022 02:09:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669198194; cv=none; d=google.com; s=arc-20160816; b=qefrati2ABwv87kuryZBA9TPefT4xLW5n7QMP+DU73V2huDstsUciumpVZ08GAHlrt iBUo+qslO91RiK0o9++vXKUTQ5lN/W20qpQNnlueUrslgz1MWwgGCMQ2rdOtAmaNuEfP tzuLvHsnANzfiZGwR84m0TT6nBVvXndyeJ2dTShFFVMjNK6yJlpKWC+XXS5/9j0/nGM2 szxWPCAs2Im/KsJDvB5G7dX+LpRmSnf+8jZt+thL2u38m2haJpUbrPhtQLyLlMInnENL +uG59DPBIcR190W+I0KgstiECuTJb7CE4xoHWgqsdiW7Z98BIrzAU21CeG04ZQN5jQx1 xokQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15-20020a17090311cf00b0017c2a42fc8csi18067839plh.270.2022.11.23.02.09.41; Wed, 23 Nov 2022 02:09:54 -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 + 99 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 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?1750281165922925374?= X-GMAIL-MSGID: =?utf-8?q?1750281165922925374?= 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 | \