mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 14:23:38 +00:00
Merge branch 'master' of https://github.com/coolsnowwolf/lede
This commit is contained in:
commit
d86f684586
@ -0,0 +1,42 @@
|
||||
From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <arinc.unal@arinc9.com>
|
||||
Date: Sat, 28 Jan 2023 12:42:32 +0300
|
||||
Subject: [PATCH] net: ethernet: mtk_eth_soc: disable hardware DSA untagging
|
||||
for second MAC
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
According to my tests on MT7621AT and MT7623NI SoCs, hardware DSA untagging
|
||||
won't work on the second MAC. Therefore, disable this feature when the
|
||||
second MAC of the MT7621 and MT7623 SoCs is being used.
|
||||
|
||||
Fixes: 2d7605a72906 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging")
|
||||
Link: https://lore.kernel.org/netdev/6249fc14-b38a-c770-36b4-5af6d41c21d3@arinc9.com/
|
||||
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||||
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||||
Link: https://lore.kernel.org/r/20230128094232.2451947-1-arinc.unal@arinc9.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -3142,7 +3142,8 @@ static int mtk_open(struct net_device *d
|
||||
struct mtk_eth *eth = mac->hw;
|
||||
int i, err;
|
||||
|
||||
- if (mtk_uses_dsa(dev) && !eth->prog) {
|
||||
+ if ((mtk_uses_dsa(dev) && !eth->prog) &&
|
||||
+ !(mac->id == 1 && MTK_HAS_CAPS(eth->soc->caps, MTK_GMAC1_TRGMII))) {
|
||||
for (i = 0; i < ARRAY_SIZE(eth->dsa_meta); i++) {
|
||||
struct metadata_dst *md_dst = eth->dsa_meta[i];
|
||||
|
||||
@@ -3159,7 +3160,8 @@ static int mtk_open(struct net_device *d
|
||||
}
|
||||
} else {
|
||||
/* Hardware special tag parsing needs to be disabled if at least
|
||||
- * one MAC does not use DSA.
|
||||
+ * one MAC does not use DSA, or the second MAC of the MT7621 and
|
||||
+ * MT7623 SoCs is being used.
|
||||
*/
|
||||
u32 val = mtk_r32(eth, MTK_CDMP_IG_CTRL);
|
||||
val &= ~MTK_CDMP_STAG_EN;
|
@ -0,0 +1,54 @@
|
||||
From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <arinc.unal@arinc9.com>
|
||||
Date: Sun, 5 Feb 2023 20:53:31 +0300
|
||||
Subject: [PATCH] net: ethernet: mtk_eth_soc: enable special tag when any MAC
|
||||
uses DSA
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The special tag is only enabled when the first MAC uses DSA. However, it
|
||||
must be enabled when any MAC uses DSA. Change the check accordingly.
|
||||
|
||||
This fixes hardware DSA untagging not working on the second MAC of the
|
||||
MT7621 and MT7623 SoCs, and likely other SoCs too. Therefore, remove the
|
||||
check that disables hardware DSA untagging for the second MAC of the MT7621
|
||||
and MT7623 SoCs.
|
||||
|
||||
Fixes: a1f47752fd62 ("net: ethernet: mtk_eth_soc: disable hardware DSA untagging for second MAC")
|
||||
Co-developed-by: Richard van Schagen <richard@routerhints.com>
|
||||
Signed-off-by: Richard van Schagen <richard@routerhints.com>
|
||||
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -3077,7 +3077,7 @@ static void mtk_gdm_config(struct mtk_et
|
||||
|
||||
val |= config;
|
||||
|
||||
- if (!i && eth->netdev[0] && netdev_uses_dsa(eth->netdev[0]))
|
||||
+ if (eth->netdev[i] && netdev_uses_dsa(eth->netdev[i]))
|
||||
val |= MTK_GDMA_SPECIAL_TAG;
|
||||
|
||||
mtk_w32(eth, val, MTK_GDMA_FWD_CFG(i));
|
||||
@@ -3142,8 +3142,7 @@ static int mtk_open(struct net_device *d
|
||||
struct mtk_eth *eth = mac->hw;
|
||||
int i, err;
|
||||
|
||||
- if ((mtk_uses_dsa(dev) && !eth->prog) &&
|
||||
- !(mac->id == 1 && MTK_HAS_CAPS(eth->soc->caps, MTK_GMAC1_TRGMII))) {
|
||||
+ if (mtk_uses_dsa(dev) && !eth->prog) {
|
||||
for (i = 0; i < ARRAY_SIZE(eth->dsa_meta); i++) {
|
||||
struct metadata_dst *md_dst = eth->dsa_meta[i];
|
||||
|
||||
@@ -3160,8 +3159,7 @@ static int mtk_open(struct net_device *d
|
||||
}
|
||||
} else {
|
||||
/* Hardware special tag parsing needs to be disabled if at least
|
||||
- * one MAC does not use DSA, or the second MAC of the MT7621 and
|
||||
- * MT7623 SoCs is being used.
|
||||
+ * one MAC does not use DSA.
|
||||
*/
|
||||
u32 val = mtk_r32(eth, MTK_CDMP_IG_CTRL);
|
||||
val &= ~MTK_CDMP_STAG_EN;
|
@ -0,0 +1,129 @@
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Tue, 7 Feb 2023 12:30:27 +0200
|
||||
Subject: [PATCH] net: ethernet: mtk_eth_soc: fix DSA TX tag hwaccel for switch
|
||||
port 0
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Arınç reports that on his MT7621AT Unielec U7621-06 board and MT7623NI
|
||||
Bananapi BPI-R2, packets received by the CPU over mt7530 switch port 0
|
||||
(of which this driver acts as the DSA master) are not processed
|
||||
correctly by software. More precisely, they arrive without a DSA tag
|
||||
(in packet or in the hwaccel area - skb_metadata_dst()), so DSA cannot
|
||||
demux them towards the switch's interface for port 0. Traffic from other
|
||||
ports receives a skb_metadata_dst() with the correct port and is demuxed
|
||||
properly.
|
||||
|
||||
Looking at mtk_poll_rx(), it becomes apparent that this driver uses the
|
||||
skb vlan hwaccel area:
|
||||
|
||||
union {
|
||||
u32 vlan_all;
|
||||
struct {
|
||||
__be16 vlan_proto;
|
||||
__u16 vlan_tci;
|
||||
};
|
||||
};
|
||||
|
||||
as a temporary storage for the VLAN hwaccel tag, or the DSA hwaccel tag.
|
||||
If this is a DSA master it's a DSA hwaccel tag, and finally clears up
|
||||
the skb VLAN hwaccel header.
|
||||
|
||||
I'm guessing that the problem is the (mis)use of API.
|
||||
skb_vlan_tag_present() looks like this:
|
||||
|
||||
#define skb_vlan_tag_present(__skb) (!!(__skb)->vlan_all)
|
||||
|
||||
So if both vlan_proto and vlan_tci are zeroes, skb_vlan_tag_present()
|
||||
returns precisely false. I don't know for sure what is the format of the
|
||||
DSA hwaccel tag, but I surely know that lowermost 3 bits of vlan_proto
|
||||
are 0 when receiving from port 0:
|
||||
|
||||
unsigned int port = vlan_proto & GENMASK(2, 0);
|
||||
|
||||
If the RX descriptor has no other bits set to non-zero values in
|
||||
RX_DMA_VTAG, then the call to __vlan_hwaccel_put_tag() will not, in
|
||||
fact, make the subsequent skb_vlan_tag_present() return true, because
|
||||
it's implemented like this:
|
||||
|
||||
static inline void __vlan_hwaccel_put_tag(struct sk_buff *skb,
|
||||
__be16 vlan_proto, u16 vlan_tci)
|
||||
{
|
||||
skb->vlan_proto = vlan_proto;
|
||||
skb->vlan_tci = vlan_tci;
|
||||
}
|
||||
|
||||
What we need to do to fix this problem (assuming this is the problem) is
|
||||
to stop using skb->vlan_all as temporary storage for driver affairs, and
|
||||
just create some local variables that serve the same purpose, but
|
||||
hopefully better. Instead of calling skb_vlan_tag_present(), let's look
|
||||
at a boolean has_hwaccel_tag which we set to true when the RX DMA
|
||||
descriptors have something. Disambiguate based on netdev_uses_dsa()
|
||||
whether this is a VLAN or DSA hwaccel tag, and only call
|
||||
__vlan_hwaccel_put_tag() if we're certain it's a VLAN tag.
|
||||
|
||||
Arınç confirms that the treatment works, so this validates the
|
||||
assumption.
|
||||
|
||||
Link: https://lore.kernel.org/netdev/704f3a72-fc9e-714a-db54-272e17612637@arinc9.com/
|
||||
Fixes: 2d7605a72906 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging")
|
||||
Reported-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||||
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Felix Fietkau <nbd@nbd.name>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -1829,7 +1829,9 @@ static int mtk_poll_rx(struct napi_struc
|
||||
|
||||
while (done < budget) {
|
||||
unsigned int pktlen, *rxdcsum;
|
||||
+ bool has_hwaccel_tag = false;
|
||||
struct net_device *netdev;
|
||||
+ u16 vlan_proto, vlan_tci;
|
||||
dma_addr_t dma_addr;
|
||||
u32 hash, reason;
|
||||
int mac = 0;
|
||||
@@ -1969,27 +1971,29 @@ static int mtk_poll_rx(struct napi_struc
|
||||
|
||||
if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
|
||||
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
|
||||
- if (trxd.rxd3 & RX_DMA_VTAG_V2)
|
||||
- __vlan_hwaccel_put_tag(skb,
|
||||
- htons(RX_DMA_VPID(trxd.rxd4)),
|
||||
- RX_DMA_VID(trxd.rxd4));
|
||||
+ if (trxd.rxd3 & RX_DMA_VTAG_V2) {
|
||||
+ vlan_proto = RX_DMA_VPID(trxd.rxd4);
|
||||
+ vlan_tci = RX_DMA_VID(trxd.rxd4);
|
||||
+ has_hwaccel_tag = true;
|
||||
+ }
|
||||
} else if (trxd.rxd2 & RX_DMA_VTAG) {
|
||||
- __vlan_hwaccel_put_tag(skb, htons(RX_DMA_VPID(trxd.rxd3)),
|
||||
- RX_DMA_VID(trxd.rxd3));
|
||||
+ vlan_proto = RX_DMA_VPID(trxd.rxd3);
|
||||
+ vlan_tci = RX_DMA_VID(trxd.rxd3);
|
||||
+ has_hwaccel_tag = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* When using VLAN untagging in combination with DSA, the
|
||||
* hardware treats the MTK special tag as a VLAN and untags it.
|
||||
*/
|
||||
- if (skb_vlan_tag_present(skb) && netdev_uses_dsa(netdev)) {
|
||||
- unsigned int port = ntohs(skb->vlan_proto) & GENMASK(2, 0);
|
||||
+ if (has_hwaccel_tag && netdev_uses_dsa(netdev)) {
|
||||
+ unsigned int port = vlan_proto & GENMASK(2, 0);
|
||||
|
||||
if (port < ARRAY_SIZE(eth->dsa_meta) &&
|
||||
eth->dsa_meta[port])
|
||||
skb_dst_set_noref(skb, ð->dsa_meta[port]->dst);
|
||||
-
|
||||
- __vlan_hwaccel_clear_tag(skb);
|
||||
+ } else if (has_hwaccel_tag) {
|
||||
+ __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vlan_tci);
|
||||
}
|
||||
|
||||
skb_record_rx_queue(skb, 0);
|
@ -0,0 +1,26 @@
|
||||
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
|
||||
Date: Sun, 12 Feb 2023 07:51:51 +0100
|
||||
Subject: [PATCH] net: ethernet: mtk_wed: No need to clear memory after a
|
||||
dma_alloc_coherent() call
|
||||
|
||||
dma_alloc_coherent() already clears the allocated memory, there is no need
|
||||
to explicitly call memset().
|
||||
|
||||
Moreover, it is likely that the size in the memset() is incorrect and
|
||||
should be "size * sizeof(*ring->desc)".
|
||||
|
||||
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
|
||||
Link: https://lore.kernel.org/r/d5acce7dd108887832c9719f62c7201b4c83b3fb.1676184599.git.christophe.jaillet@wanadoo.fr
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||
@@ -786,7 +786,6 @@ mtk_wed_rro_ring_alloc(struct mtk_wed_de
|
||||
|
||||
ring->desc_size = sizeof(*ring->desc);
|
||||
ring->size = size;
|
||||
- memset(ring->desc, 0, size);
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Date: Wed, 7 Dec 2022 15:04:54 +0100
|
||||
Subject: [PATCH] net: ethernet: mtk_wed: fix some possible NULL pointer
|
||||
dereferences
|
||||
|
||||
Fix possible NULL pointer dereference in mtk_wed_detach routine checking
|
||||
wo pointer is properly allocated before running mtk_wed_wo_reset() and
|
||||
mtk_wed_wo_deinit().
|
||||
Even if it is just a theoretical issue at the moment check wo pointer is
|
||||
not NULL in mtk_wed_mcu_msg_update.
|
||||
Moreover, honor mtk_wed_mcu_send_msg return value in mtk_wed_wo_reset()
|
||||
|
||||
Fixes: 799684448e3e ("net: ethernet: mtk_wed: introduce wed wo support")
|
||||
Fixes: 4c5de09eb0d0 ("net: ethernet: mtk_wed: add configure wed wo support")
|
||||
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||
@@ -174,9 +174,10 @@ mtk_wed_wo_reset(struct mtk_wed_device *
|
||||
mtk_wdma_tx_reset(dev);
|
||||
mtk_wed_reset(dev, MTK_WED_RESET_WED);
|
||||
|
||||
- mtk_wed_mcu_send_msg(wo, MTK_WED_MODULE_ID_WO,
|
||||
- MTK_WED_WO_CMD_CHANGE_STATE, &state,
|
||||
- sizeof(state), false);
|
||||
+ if (mtk_wed_mcu_send_msg(wo, MTK_WED_MODULE_ID_WO,
|
||||
+ MTK_WED_WO_CMD_CHANGE_STATE, &state,
|
||||
+ sizeof(state), false))
|
||||
+ return;
|
||||
|
||||
if (readx_poll_timeout(mtk_wed_wo_read_status, dev, val,
|
||||
val == MTK_WED_WOIF_DISABLE_DONE,
|
||||
@@ -632,9 +633,11 @@ mtk_wed_detach(struct mtk_wed_device *de
|
||||
mtk_wed_free_tx_rings(dev);
|
||||
|
||||
if (mtk_wed_get_rx_capa(dev)) {
|
||||
- mtk_wed_wo_reset(dev);
|
||||
+ if (hw->wed_wo)
|
||||
+ mtk_wed_wo_reset(dev);
|
||||
mtk_wed_free_rx_rings(dev);
|
||||
- mtk_wed_wo_deinit(hw);
|
||||
+ if (hw->wed_wo)
|
||||
+ mtk_wed_wo_deinit(hw);
|
||||
}
|
||||
|
||||
if (dev->wlan.bus_type == MTK_WED_BUS_PCIE) {
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
|
||||
@@ -207,6 +207,9 @@ int mtk_wed_mcu_msg_update(struct mtk_we
|
||||
if (dev->hw->version == 1)
|
||||
return 0;
|
||||
|
||||
+ if (WARN_ON(!wo))
|
||||
+ return -ENODEV;
|
||||
+
|
||||
return mtk_wed_mcu_send_msg(wo, MTK_WED_MODULE_ID_WO, id, data, len,
|
||||
true);
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Date: Wed, 7 Dec 2022 15:04:55 +0100
|
||||
Subject: [PATCH] net: ethernet: mtk_wed: fix possible deadlock if
|
||||
mtk_wed_wo_init fails
|
||||
|
||||
Introduce __mtk_wed_detach() in order to avoid a deadlock in
|
||||
mtk_wed_attach routine if mtk_wed_wo_init fails since both
|
||||
mtk_wed_attach and mtk_wed_detach run holding hw_lock mutex.
|
||||
|
||||
Fixes: 4c5de09eb0d0 ("net: ethernet: mtk_wed: add configure wed wo support")
|
||||
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||
@@ -619,12 +619,10 @@ mtk_wed_deinit(struct mtk_wed_device *de
|
||||
}
|
||||
|
||||
static void
|
||||
-mtk_wed_detach(struct mtk_wed_device *dev)
|
||||
+__mtk_wed_detach(struct mtk_wed_device *dev)
|
||||
{
|
||||
struct mtk_wed_hw *hw = dev->hw;
|
||||
|
||||
- mutex_lock(&hw_lock);
|
||||
-
|
||||
mtk_wed_deinit(dev);
|
||||
|
||||
mtk_wdma_rx_reset(dev);
|
||||
@@ -657,6 +655,13 @@ mtk_wed_detach(struct mtk_wed_device *de
|
||||
module_put(THIS_MODULE);
|
||||
|
||||
hw->wed_dev = NULL;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+mtk_wed_detach(struct mtk_wed_device *dev)
|
||||
+{
|
||||
+ mutex_lock(&hw_lock);
|
||||
+ __mtk_wed_detach(dev);
|
||||
mutex_unlock(&hw_lock);
|
||||
}
|
||||
|
||||
@@ -1545,8 +1550,10 @@ mtk_wed_attach(struct mtk_wed_device *de
|
||||
ret = mtk_wed_wo_init(hw);
|
||||
}
|
||||
out:
|
||||
- if (ret)
|
||||
- mtk_wed_detach(dev);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev->hw->dev, "failed to attach wed device\n");
|
||||
+ __mtk_wed_detach(dev);
|
||||
+ }
|
||||
unlock:
|
||||
mutex_unlock(&hw_lock);
|
||||
|
@ -0,0 +1,28 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 6 May 2022 21:38:42 +0200
|
||||
Subject: [PATCH] net: dsa: tag_mtk: add padding for tx packets
|
||||
|
||||
Padding for transmitted packets needs to account for the special tag.
|
||||
With not enough padding, garbage bytes are inserted by the switch at the
|
||||
end of small packets.
|
||||
|
||||
Fixes: 5cd8985a1909 ("net-next: dsa: add Mediatek tag RX/TX handler")
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/net/dsa/tag_mtk.c
|
||||
+++ b/net/dsa/tag_mtk.c
|
||||
@@ -25,6 +25,13 @@ static struct sk_buff *mtk_tag_xmit(stru
|
||||
u8 xmit_tpid;
|
||||
u8 *mtk_tag;
|
||||
|
||||
+ /* The Ethernet switch we are interfaced with needs packets to be at
|
||||
+ * least 64 bytes (including FCS) otherwise their padding might be
|
||||
+ * corrupted. With tags enabled, we need to make sure that packets are
|
||||
+ * at least 68 bytes (including FCS and tag).
|
||||
+ */
|
||||
+ eth_skb_pad(skb);
|
||||
+
|
||||
/* Build the special tag after the MAC Source Address. If VLAN header
|
||||
* is present, it's required that VLAN header and special tag is
|
||||
* being combined. Only in this way we can allow the switch can parse
|
@ -0,0 +1,28 @@
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 6 May 2022 21:38:42 +0200
|
||||
Subject: [PATCH] net: dsa: tag_mtk: add padding for tx packets
|
||||
|
||||
Padding for transmitted packets needs to account for the special tag.
|
||||
With not enough padding, garbage bytes are inserted by the switch at the
|
||||
end of small packets.
|
||||
|
||||
Fixes: 5cd8985a1909 ("net-next: dsa: add Mediatek tag RX/TX handler")
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/net/dsa/tag_mtk.c
|
||||
+++ b/net/dsa/tag_mtk.c
|
||||
@@ -25,6 +25,13 @@ static struct sk_buff *mtk_tag_xmit(stru
|
||||
u8 xmit_tpid;
|
||||
u8 *mtk_tag;
|
||||
|
||||
+ /* The Ethernet switch we are interfaced with needs packets to be at
|
||||
+ * least 64 bytes (including FCS) otherwise their padding might be
|
||||
+ * corrupted. With tags enabled, we need to make sure that packets are
|
||||
+ * at least 68 bytes (including FCS and tag).
|
||||
+ */
|
||||
+ eth_skb_pad(skb);
|
||||
+
|
||||
/* Build the special tag after the MAC Source Address. If VLAN header
|
||||
* is present, it's required that VLAN header and special tag is
|
||||
* being combined. Only in this way we can allow the switch can parse
|
@ -17,27 +17,42 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -2002,29 +2002,16 @@ static int mtk_poll_rx(struct napi_struc
|
||||
if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
|
||||
mtk_ppe_check_skb(eth->ppe[0], skb, hash);
|
||||
@@ -1829,9 +1829,7 @@ static int mtk_poll_rx(struct napi_struc
|
||||
|
||||
while (done < budget) {
|
||||
unsigned int pktlen, *rxdcsum;
|
||||
- bool has_hwaccel_tag = false;
|
||||
struct net_device *netdev;
|
||||
- u16 vlan_proto, vlan_tci;
|
||||
dma_addr_t dma_addr;
|
||||
u32 hash, reason;
|
||||
int mac = 0;
|
||||
@@ -1966,36 +1964,21 @@ static int mtk_poll_rx(struct napi_struc
|
||||
skb_checksum_none_assert(skb);
|
||||
skb->protocol = eth_type_trans(skb, netdev);
|
||||
|
||||
- if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
|
||||
- mtk_ppe_check_skb(eth->ppe[0], skb, hash);
|
||||
-
|
||||
- if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
|
||||
- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
|
||||
- if (trxd.rxd3 & RX_DMA_VTAG_V2)
|
||||
- __vlan_hwaccel_put_tag(skb,
|
||||
- htons(RX_DMA_VPID(trxd.rxd4)),
|
||||
- RX_DMA_VID(trxd.rxd4));
|
||||
- if (trxd.rxd3 & RX_DMA_VTAG_V2) {
|
||||
- vlan_proto = RX_DMA_VPID(trxd.rxd4);
|
||||
- vlan_tci = RX_DMA_VID(trxd.rxd4);
|
||||
- has_hwaccel_tag = true;
|
||||
- }
|
||||
- } else if (trxd.rxd2 & RX_DMA_VTAG) {
|
||||
- __vlan_hwaccel_put_tag(skb, htons(RX_DMA_VPID(trxd.rxd3)),
|
||||
- RX_DMA_VID(trxd.rxd3));
|
||||
- vlan_proto = RX_DMA_VPID(trxd.rxd3);
|
||||
- vlan_tci = RX_DMA_VID(trxd.rxd3);
|
||||
- has_hwaccel_tag = true;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
/* When using VLAN untagging in combination with DSA, the
|
||||
* hardware treats the MTK special tag as a VLAN and untags it.
|
||||
*/
|
||||
- if (skb_vlan_tag_present(skb) && netdev_uses_dsa(netdev)) {
|
||||
- unsigned int port = ntohs(skb->vlan_proto) & GENMASK(2, 0);
|
||||
- if (has_hwaccel_tag && netdev_uses_dsa(netdev)) {
|
||||
- unsigned int port = vlan_proto & GENMASK(2, 0);
|
||||
+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) &&
|
||||
+ (trxd.rxd2 & RX_DMA_VTAG) && netdev_uses_dsa(netdev)) {
|
||||
+ unsigned int port = RX_DMA_VPID(trxd.rxd3) & GENMASK(2, 0);
|
||||
@ -45,12 +60,17 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
if (port < ARRAY_SIZE(eth->dsa_meta) &&
|
||||
eth->dsa_meta[port])
|
||||
skb_dst_set_noref(skb, ð->dsa_meta[port]->dst);
|
||||
-
|
||||
- __vlan_hwaccel_clear_tag(skb);
|
||||
- } else if (has_hwaccel_tag) {
|
||||
- __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vlan_tci);
|
||||
}
|
||||
|
||||
+ if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
|
||||
+ mtk_ppe_check_skb(eth->ppe[0], skb, hash);
|
||||
+
|
||||
skb_record_rx_queue(skb, 0);
|
||||
@@ -2841,29 +2828,11 @@ static netdev_features_t mtk_fix_feature
|
||||
napi_gro_receive(napi, skb);
|
||||
|
||||
@@ -2810,29 +2793,11 @@ static netdev_features_t mtk_fix_feature
|
||||
|
||||
static int mtk_set_features(struct net_device *dev, netdev_features_t features)
|
||||
{
|
||||
@ -80,7 +100,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3177,30 +3146,6 @@ static int mtk_open(struct net_device *d
|
||||
@@ -3146,30 +3111,6 @@ static int mtk_open(struct net_device *d
|
||||
struct mtk_eth *eth = mac->hw;
|
||||
int i, err;
|
||||
|
||||
@ -111,7 +131,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0);
|
||||
if (err) {
|
||||
netdev_err(dev, "%s: could not attach PHY: %d\n", __func__,
|
||||
@@ -3241,6 +3186,35 @@ static int mtk_open(struct net_device *d
|
||||
@@ -3210,6 +3151,35 @@ static int mtk_open(struct net_device *d
|
||||
phylink_start(mac->phylink);
|
||||
netif_tx_start_all_queues(dev);
|
||||
|
||||
@ -147,7 +167,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3725,10 +3699,9 @@ static int mtk_hw_init(struct mtk_eth *e
|
||||
@@ -3694,10 +3664,9 @@ static int mtk_hw_init(struct mtk_eth *e
|
||||
if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
|
||||
val = mtk_r32(eth, MTK_CDMP_IG_CTRL);
|
||||
mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL);
|
||||
@ -160,7 +180,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
/* set interrupt delays based on current Net DIM sample */
|
||||
mtk_dim_rx(ð->rx_dim.work);
|
||||
@@ -4366,7 +4339,7 @@ static int mtk_add_mac(struct mtk_eth *e
|
||||
@@ -4335,7 +4304,7 @@ static int mtk_add_mac(struct mtk_eth *e
|
||||
eth->netdev[id]->hw_features |= NETIF_F_LRO;
|
||||
|
||||
eth->netdev[id]->vlan_features = eth->soc->hw_features &
|
||||
@ -176,6 +196,6 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
NETIF_F_RXCSUM | \
|
||||
NETIF_F_HW_VLAN_CTAG_TX | \
|
||||
- NETIF_F_HW_VLAN_CTAG_RX | \
|
||||
NETIF_F_SG | NETIF_F_ALL_TSO | \
|
||||
NETIF_F_SG | NETIF_F_TSO | \
|
||||
NETIF_F_TSO6 | \
|
||||
NETIF_F_IPV6_CSUM |\
|
||||
NETIF_F_HW_TC)
|
@ -9,10 +9,10 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
@@ -49,8 +49,7 @@
|
||||
@@ -48,8 +48,7 @@
|
||||
#define MTK_HW_FEATURES (NETIF_F_IP_CSUM | \
|
||||
NETIF_F_RXCSUM | \
|
||||
NETIF_F_HW_VLAN_CTAG_TX | \
|
||||
NETIF_F_HW_VLAN_CTAG_RX | \
|
||||
- NETIF_F_SG | NETIF_F_TSO | \
|
||||
- NETIF_F_TSO6 | \
|
||||
+ NETIF_F_SG | NETIF_F_ALL_TSO | \
|
@ -10,28 +10,6 @@ Fixes: 2d7605a72906 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging"
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -1999,9 +1999,6 @@ static int mtk_poll_rx(struct napi_struc
|
||||
skb_checksum_none_assert(skb);
|
||||
skb->protocol = eth_type_trans(skb, netdev);
|
||||
|
||||
- if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
|
||||
- mtk_ppe_check_skb(eth->ppe[0], skb, hash);
|
||||
-
|
||||
/* When using VLAN untagging in combination with DSA, the
|
||||
* hardware treats the MTK special tag as a VLAN and untags it.
|
||||
*/
|
||||
@@ -2014,6 +2011,9 @@ static int mtk_poll_rx(struct napi_struc
|
||||
skb_dst_set_noref(skb, ð->dsa_meta[port]->dst);
|
||||
}
|
||||
|
||||
+ if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
|
||||
+ mtk_ppe_check_skb(eth->ppe[0], skb, hash);
|
||||
+
|
||||
skb_record_rx_queue(skb, 0);
|
||||
napi_gro_receive(napi, skb);
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
|
||||
@@ -8,6 +8,7 @@
|
||||
|
Loading…
Reference in New Issue
Block a user