All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: netdev@vger.kernel.org, John Crispin <john@phrozen.org>,
	Sean Wang <sean.wang@mediatek.com>,
	Mark Lee <Mark-MC.Lee@mediatek.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>
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	[thread overview]
Message-ID: <20221107185452.90711-7-nbd@nbd.name> (raw)
In-Reply-To: <20221107185452.90711-1-nbd@nbd.name>

Avoid some branches in the hot path on low-end devices with limited CPU power,
and reduce code size

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: Felix Fietkau <nbd@nbd.name>
To: netdev@vger.kernel.org, John Crispin <john@phrozen.org>,
	Sean Wang <sean.wang@mediatek.com>,
	Mark Lee <Mark-MC.Lee@mediatek.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>
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	[thread overview]
Message-ID: <20221107185452.90711-7-nbd@nbd.name> (raw)
In-Reply-To: <20221107185452.90711-1-nbd@nbd.name>

Avoid some branches in the hot path on low-end devices with limited CPU power,
and reduce code size

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-11-07 18:56 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 18:54 [PATCH 01/14] net: ethernet: mtk_eth_soc: account for vlan in rx header length Felix Fietkau
2022-11-07 18:54 ` Felix Fietkau
2022-11-07 18:54 ` [PATCH 02/14] net: ethernet: mtk_eth_soc: increase tx ring side for QDMA devices Felix Fietkau
2022-11-07 18:54   ` Felix Fietkau
2022-11-07 18:54 ` [PATCH 03/14] net: ethernet: mtk_eth_soc: avoid port_mg assignment on MT7622 and newer Felix Fietkau
2022-11-07 18:54   ` Felix Fietkau
2022-11-07 18:54 ` [PATCH 04/14] net: ethernet: mtk_eth_soc: implement multi-queue support for per-port queues Felix Fietkau
2022-11-07 18:54   ` Felix Fietkau
2022-11-07 18:54 ` [PATCH 05/14] net: dsa: tag_mtk: assign " Felix Fietkau
2022-11-07 18:54   ` Felix Fietkau
2022-11-07 20:40   ` Vladimir Oltean
2022-11-07 20:40     ` Vladimir Oltean
2022-11-08  6:18     ` Felix Fietkau
2022-11-08  6:18       ` Felix Fietkau
2022-11-07 21:22   ` Vladimir Oltean
2022-11-07 21:22     ` Vladimir Oltean
2022-11-08  6:01     ` Felix Fietkau
2022-11-08  6:01       ` Felix Fietkau
2022-11-08  7:58       ` Vladimir Oltean
2022-11-08  7:58         ` Vladimir Oltean
2022-11-08  9:20         ` Felix Fietkau
2022-11-08  9:20           ` Felix Fietkau
2022-11-07 18:54 ` [PATCH 06/14] net: ethernet: mediatek: ppe: assign per-port queues for offloaded traffic Felix Fietkau
2022-11-07 18:54   ` Felix Fietkau
2022-11-07 18:54 ` Felix Fietkau [this message]
2022-11-07 18:54   ` [PATCH 07/14] net: ethernet: mtk_eth_soc: compile out netsys v2 code on mt7621 Felix Fietkau
2022-11-07 18:54 ` [PATCH 08/14] net: vlan: remove invalid VLAN protocol warning Felix Fietkau
2022-11-07 21:57   ` Vladimir Oltean
2022-11-08  6:08     ` Felix Fietkau
2022-11-08  9:00       ` Vladimir Oltean
2022-11-08  9:20         ` Felix Fietkau
2022-11-08  9:40           ` Vladimir Oltean
2022-11-08  9:46             ` Felix Fietkau
2022-11-08 10:08               ` Vladimir Oltean
2022-11-08 10:24                 ` Felix Fietkau
2022-11-08 10:33                   ` Vladimir Oltean
2022-11-08 10:42                     ` Felix Fietkau
2022-11-08 10:52                       ` Vladimir Oltean
2022-11-08 10:56                         ` Felix Fietkau
2022-11-08 11:23                           ` Vladimir Oltean
2022-11-07 18:54 ` [PATCH 09/14] flow_dissector: detect DSA using skb->protocol even when VLAN tag is present Felix Fietkau
2022-11-07 18:54 ` [PATCH 10/14] net: dsa: tag_mtk: parse hwaccel VLAN tags Felix Fietkau
2022-11-07 18:54   ` Felix Fietkau
2022-11-07 18:54 ` [PATCH 11/14] net: ethernet: mtk_eth_soc: fix VLAN rx hardware acceleration Felix Fietkau
2022-11-07 18:54   ` Felix Fietkau
2022-11-07 23:32   ` Vladimir Oltean
2022-11-07 23:32     ` Vladimir Oltean
2022-11-08  6:17     ` Felix Fietkau
2022-11-08  6:17       ` Felix Fietkau
2022-11-07 18:54 ` [PATCH 12/14] net: ethernet: mtk_eth_soc: work around issue with sending small fragments Felix Fietkau
2022-11-07 18:54   ` Felix Fietkau
2022-11-07 18:54 ` [PATCH 13/14] net: ethernet: mtk_eth_soc: set NETIF_F_ALL_TSO Felix Fietkau
2022-11-07 18:54   ` Felix Fietkau
2022-11-07 18:54 ` [PATCH 14/14] net: ethernet: mtk_eth_soc: drop packets to WDMA if the ring is full Felix Fietkau
2022-11-07 18:54   ` Felix Fietkau
2022-11-07 20:55 ` [PATCH 01/14] net: ethernet: mtk_eth_soc: account for vlan in rx header length Vladimir Oltean
2022-11-07 20:55   ` Vladimir Oltean
2022-11-08  6:18   ` Felix Fietkau
2022-11-08  6:18     ` Felix Fietkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221107185452.90711-7-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.