<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/net/ethernet/mediatek, branch v6.2</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.2</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.2'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-02-08T09:11:31+00:00</updated>
<entry>
<title>net: ethernet: mtk_eth_soc: fix DSA TX tag hwaccel for switch port 0</title>
<updated>2023-02-08T09:11:31+00:00</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2023-02-07T10:30:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1a3245fe0cf84e630598da4ab110a5f8a2d6730d'/>
<id>urn:sha1:1a3245fe0cf84e630598da4ab110a5f8a2d6730d</id>
<content type='text'>
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)-&gt;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 &amp; 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-&gt;vlan_proto = vlan_proto;
	skb-&gt;vlan_tci = vlan_tci;
}

What we need to do to fix this problem (assuming this is the problem) is
to stop using skb-&gt;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 &lt;arinc.unal@arinc9.com&gt;
Tested-by: Arınç ÜNAL &lt;arinc.unal@arinc9.com&gt;
Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Felix Fietkau &lt;nbd@nbd.name&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: ethernet: mtk_eth_soc: fix wrong parameters order in __xdp_rxq_info_reg()</title>
<updated>2023-02-08T09:04:33+00:00</updated>
<author>
<name>Tariq Toukan</name>
<email>tariqt@nvidia.com</email>
</author>
<published>2023-02-06T20:47:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c966153d120222cd4e85e1e1601584d7d4d91dcb'/>
<id>urn:sha1:c966153d120222cd4e85e1e1601584d7d4d91dcb</id>
<content type='text'>
Parameters 'queue_index' and 'napi_id' are passed in a swapped order.
Fix it here.

Fixes: 23233e577ef9 ("net: ethernet: mtk_eth_soc: rely on page_pool for single page buffers")
Signed-off-by: Tariq Toukan &lt;tariqt@nvidia.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: ethernet: mtk_eth_soc: enable special tag when any MAC uses DSA</title>
<updated>2023-02-08T09:00:29+00:00</updated>
<author>
<name>Arınç ÜNAL</name>
<email>arinc.unal@arinc9.com</email>
</author>
<published>2023-02-05T17:53:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=21386e692613702502f7c982d81e0dfa86d25cfd'/>
<id>urn:sha1:21386e692613702502f7c982d81e0dfa86d25cfd</id>
<content type='text'>
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 &lt;richard@routerhints.com&gt;
Signed-off-by: Richard van Schagen &lt;richard@routerhints.com&gt;
Signed-off-by: Arınç ÜNAL &lt;arinc.unal@arinc9.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>mtk_sgmii: enable PCS polling to allow SFP work</title>
<updated>2023-02-02T19:55:53+00:00</updated>
<author>
<name>Alexander Couzens</name>
<email>lynxis@fe80.eu</email>
</author>
<published>2023-02-01T18:23:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3337a6e04ddf2923a1bdcf3d31b3b52412bf82dd'/>
<id>urn:sha1:3337a6e04ddf2923a1bdcf3d31b3b52412bf82dd</id>
<content type='text'>
Currently there is no IRQ handling (even the SGMII supports it).
Enable polling to support SFP ports.

Fixes: 14a44ab0330d ("net: mtk_eth_soc: partially convert to phylink_pcs")
Reviewed-by: Russell King (Oracle) &lt;rmk+kernel@armlinux.org.uk&gt;
Signed-off-by: Alexander Couzens &lt;lynxis@fe80.eu&gt;
[ bmork: changed "1" =&gt; "true" ]
Signed-off-by: Bjørn Mork &lt;bjorn@mork.no&gt;
Acked-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
Tested-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: mediatek: sgmii: fix duplex configuration</title>
<updated>2023-02-02T19:55:53+00:00</updated>
<author>
<name>Bjørn Mork</name>
<email>bjorn@mork.no</email>
</author>
<published>2023-02-01T18:23:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9d32637122de88f1ef614c29703f0e050cad342e'/>
<id>urn:sha1:9d32637122de88f1ef614c29703f0e050cad342e</id>
<content type='text'>
The logic of the duplex bit is inverted.  Setting it means half
duplex, not full duplex.

Fix and rename macro to avoid confusion.

Fixes: 7e538372694b ("net: ethernet: mediatek: Re-add support SGMII")
Reviewed-by: Russell King (Oracle) &lt;rmk+kernel@armlinux.org.uk&gt;
Signed-off-by: Bjørn Mork &lt;bjorn@mork.no&gt;
Acked-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
Tested-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: mediatek: sgmii: ensure the SGMII PHY is powered down on configuration</title>
<updated>2023-02-02T19:55:53+00:00</updated>
<author>
<name>Alexander Couzens</name>
<email>lynxis@fe80.eu</email>
</author>
<published>2023-02-01T18:23:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7ff82416de8295c61423ef6fd75f052d3837d2f7'/>
<id>urn:sha1:7ff82416de8295c61423ef6fd75f052d3837d2f7</id>
<content type='text'>
The code expect the PHY to be in power down which is only true after reset.
Allow changes of the SGMII parameters more than once.

Only power down when reconfiguring to avoid bouncing the link when there's
no reason to - based on code from Russell King.

There are cases when the SGMII_PHYA_PWD register contains 0x9 which
prevents SGMII from working. The SGMII still shows link but no traffic
can flow. Writing 0x0 to the PHYA_PWD register fix the issue. 0x0 was
taken from a good working state of the SGMII interface.

Fixes: 42c03844e93d ("net-next: mediatek: add support for MediaTek MT7622 SoC")
Suggested-by: Russell King (Oracle) &lt;linux@armlinux.org.uk&gt;
Signed-off-by: Alexander Couzens &lt;lynxis@fe80.eu&gt;
[ bmork: rebased and squashed into one patch ]
Reviewed-by: Russell King (Oracle) &lt;rmk+kernel@armlinux.org.uk&gt;
Signed-off-by: Bjørn Mork &lt;bjorn@mork.no&gt;
Acked-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
Tested-by: Daniel Golle &lt;daniel@makrotopia.org&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: ethernet: mtk_eth_soc: disable hardware DSA untagging for second MAC</title>
<updated>2023-02-02T19:30:41+00:00</updated>
<author>
<name>Arınç ÜNAL</name>
<email>arinc.unal@arinc9.com</email>
</author>
<published>2023-01-28T09:42:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a1f47752fd6275b2502fb075945022d6cf264855'/>
<id>urn:sha1:a1f47752fd6275b2502fb075945022d6cf264855</id>
<content type='text'>
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 &lt;arinc.unal@arinc9.com&gt;
Signed-off-by: Arınç ÜNAL &lt;arinc.unal@arinc9.com&gt;
Link: https://lore.kernel.org/r/20230128094232.2451947-1-arinc.unal@arinc9.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: ethernet: mtk_eth_soc: Avoid truncating allocation</title>
<updated>2023-01-31T09:36:48+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2023-01-27T22:38:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f3eceaed9edd7c0e0d9fb057613131f92973626f'/>
<id>urn:sha1:f3eceaed9edd7c0e0d9fb057613131f92973626f</id>
<content type='text'>
There doesn't appear to be a reason to truncate the allocation used for
flow_info, so do a full allocation and remove the unused empty struct.
GCC does not like having a reference to an object that has been
partially allocated, as bounds checking may become impossible when
such an object is passed to other code. Seen with GCC 13:

../drivers/net/ethernet/mediatek/mtk_ppe.c: In function 'mtk_foe_entry_commit_subflow':
../drivers/net/ethernet/mediatek/mtk_ppe.c:623:18: warning: array subscript 'struct mtk_flow_entry[0]' is partly outside array bounds of 'unsigned char[48]' [-Warray-bounds=]
  623 |         flow_info-&gt;l2_data.base_flow = entry;
      |                  ^~

Cc: Felix Fietkau &lt;nbd@nbd.name&gt;
Cc: John Crispin &lt;john@phrozen.org&gt;
Cc: Sean Wang &lt;sean.wang@mediatek.com&gt;
Cc: Mark Lee &lt;Mark-MC.Lee@mediatek.com&gt;
Cc: Lorenzo Bianconi &lt;lorenzo@kernel.org&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Jakub Kicinski &lt;kuba@kernel.org&gt;
Cc: Paolo Abeni &lt;pabeni@redhat.com&gt;
Cc: Matthias Brugger &lt;matthias.bgg@gmail.com&gt;
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Simon Horman &lt;simon.horman@corigine.com&gt;
Link: https://lore.kernel.org/r/20230127223853.never.014-kees@kernel.org
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
</entry>
<entry>
<title>net: ethernet: mtk_wed: fix possible deadlock if mtk_wed_wo_init fails</title>
<updated>2022-12-09T03:47:43+00:00</updated>
<author>
<name>Lorenzo Bianconi</name>
<email>lorenzo@kernel.org</email>
</author>
<published>2022-12-07T14:04:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=587585e1bbebc250d46ebb0eeaf986d9c3c01c69'/>
<id>urn:sha1:587585e1bbebc250d46ebb0eeaf986d9c3c01c69</id>
<content type='text'>
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 &lt;lorenzo@kernel.org&gt;
Reviewed-by: Leon Romanovsky &lt;leonro@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: ethernet: mtk_wed: fix some possible NULL pointer dereferences</title>
<updated>2022-12-09T03:47:43+00:00</updated>
<author>
<name>Lorenzo Bianconi</name>
<email>lorenzo@kernel.org</email>
</author>
<published>2022-12-07T14:04:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c79e0af5ae5e4de98595983fc7e883e2ca54db11'/>
<id>urn:sha1:c79e0af5ae5e4de98595983fc7e883e2ca54db11</id>
<content type='text'>
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 &lt;lorenzo@kernel.org&gt;
Reviewed-by: Leon Romanovsky &lt;leonro@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
</feed>
