+++ /dev/null
-From f6678d46a8816b39812f7c1b0faf8e6b94024dc9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 7 Nov 2022 14:59:18 +0530
-Subject: net: dsa: microchip: add ksz9563 in ksz_switch_ops and select based
- on compatible string
-
-From: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
-
-[ Upstream commit ef912fe443adfa15b88645b3bf58c92e5a364167 ]
-
-Add KSZ9563 inside ksz_switch_chips structure with
-port_nirq as 3. KSZ9563 use KSZ9893 switch parameters
-but port_nirq count is 3 for KSZ9563 whereas 2 for
-KSZ9893. Add KSZ9563 inside ksz_switch_chips as a separate
-member and from device tree map compatible string into
-KSZ9563 inside ksz_spi.c and ksz9477_i2c.c.
-Global Chip ID 1 and 2 registers read value 9893, select
-sku based on Global Chip ID 4 Register which read 0x1c
-for KSZ9563.
-
-Signed-off-by: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: ba54bce747fa ("net: dsa: microchip: linearize skb for tail-tagging switches")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/dsa/microchip/ksz9477.c | 3 ++-
- drivers/net/dsa/microchip/ksz9477_i2c.c | 2 +-
- drivers/net/dsa/microchip/ksz_common.c | 33 +++++++++++++++++++++++--
- drivers/net/dsa/microchip/ksz_common.h | 3 +++
- drivers/net/dsa/microchip/ksz_spi.c | 2 +-
- 5 files changed, 38 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
-index b854ee425fcdd..6858f96c6b85a 100644
---- a/drivers/net/dsa/microchip/ksz9477.c
-+++ b/drivers/net/dsa/microchip/ksz9477.c
-@@ -193,7 +193,8 @@ int ksz9477_reset_switch(struct ksz_device *dev)
-
- /* KSZ9893 compatible chips do not support refclk configuration */
- if (dev->chip_id == KSZ9893_CHIP_ID ||
-- dev->chip_id == KSZ8563_CHIP_ID)
-+ dev->chip_id == KSZ8563_CHIP_ID ||
-+ dev->chip_id == KSZ9563_CHIP_ID)
- return 0;
-
- data8 = SW_ENABLE_REFCLKO;
-diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c b/drivers/net/dsa/microchip/ksz9477_i2c.c
-index aae1dadef882d..7ea9803f7069a 100644
---- a/drivers/net/dsa/microchip/ksz9477_i2c.c
-+++ b/drivers/net/dsa/microchip/ksz9477_i2c.c
-@@ -101,7 +101,7 @@ static const struct of_device_id ksz9477_dt_ids[] = {
- },
- {
- .compatible = "microchip,ksz9563",
-- .data = &ksz_switch_chips[KSZ9893]
-+ .data = &ksz_switch_chips[KSZ9563]
- },
- {
- .compatible = "microchip,ksz8563",
-diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
-index 9dbe188f09c3c..effc66d1555da 100644
---- a/drivers/net/dsa/microchip/ksz_common.c
-+++ b/drivers/net/dsa/microchip/ksz_common.c
-@@ -1277,6 +1277,31 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .gbit_capable = {true, true, true},
- },
-
-+ [KSZ9563] = {
-+ .chip_id = KSZ9563_CHIP_ID,
-+ .dev_name = "KSZ9563",
-+ .num_vlans = 4096,
-+ .num_alus = 4096,
-+ .num_statics = 16,
-+ .cpu_ports = 0x07, /* can be configured as cpu port */
-+ .port_cnt = 3, /* total port count */
-+ .port_nirqs = 3,
-+ .ops = &ksz9477_dev_ops,
-+ .mib_names = ksz9477_mib_names,
-+ .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
-+ .reg_mib_cnt = MIB_COUNTER_NUM,
-+ .regs = ksz9477_regs,
-+ .masks = ksz9477_masks,
-+ .shifts = ksz9477_shifts,
-+ .xmii_ctrl0 = ksz9477_xmii_ctrl0,
-+ .xmii_ctrl1 = ksz8795_xmii_ctrl1, /* Same as ksz8795 */
-+ .supports_mii = {false, false, true},
-+ .supports_rmii = {false, false, true},
-+ .supports_rgmii = {false, false, true},
-+ .internal_phy = {true, true, false},
-+ .gbit_capable = {true, true, true},
-+ },
-+
- [KSZ9567] = {
- .chip_id = KSZ9567_CHIP_ID,
- .dev_name = "KSZ9567",
-@@ -2383,7 +2408,8 @@ static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds,
-
- if (dev->chip_id == KSZ8830_CHIP_ID ||
- dev->chip_id == KSZ8563_CHIP_ID ||
-- dev->chip_id == KSZ9893_CHIP_ID)
-+ dev->chip_id == KSZ9893_CHIP_ID ||
-+ dev->chip_id == KSZ9563_CHIP_ID)
- proto = DSA_TAG_PROTO_KSZ9893;
-
- if (dev->chip_id == KSZ9477_CHIP_ID ||
-@@ -2503,7 +2529,8 @@ static void ksz_set_xmii(struct ksz_device *dev, int port,
- data8 |= bitval[P_RGMII_SEL];
- /* On KSZ9893, disable RGMII in-band status support */
- if (dev->chip_id == KSZ9893_CHIP_ID ||
-- dev->chip_id == KSZ8563_CHIP_ID)
-+ dev->chip_id == KSZ8563_CHIP_ID ||
-+ dev->chip_id == KSZ9563_CHIP_ID)
- data8 &= ~P_MII_MAC_MODE;
- break;
- default:
-@@ -2776,6 +2803,8 @@ static int ksz_switch_detect(struct ksz_device *dev)
-
- if (id4 == SKU_ID_KSZ8563)
- dev->chip_id = KSZ8563_CHIP_ID;
-+ else if (id4 == SKU_ID_KSZ9563)
-+ dev->chip_id = KSZ9563_CHIP_ID;
- else
- dev->chip_id = KSZ9893_CHIP_ID;
-
-diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
-index a3a7a90dad967..6f263e36ee373 100644
---- a/drivers/net/dsa/microchip/ksz_common.h
-+++ b/drivers/net/dsa/microchip/ksz_common.h
-@@ -154,6 +154,7 @@ enum ksz_model {
- KSZ9896,
- KSZ9897,
- KSZ9893,
-+ KSZ9563,
- KSZ9567,
- LAN9370,
- LAN9371,
-@@ -172,6 +173,7 @@ enum ksz_chip_id {
- KSZ9896_CHIP_ID = 0x00989600,
- KSZ9897_CHIP_ID = 0x00989700,
- KSZ9893_CHIP_ID = 0x00989300,
-+ KSZ9563_CHIP_ID = 0x00956300,
- KSZ9567_CHIP_ID = 0x00956700,
- LAN9370_CHIP_ID = 0x00937000,
- LAN9371_CHIP_ID = 0x00937100,
-@@ -563,6 +565,7 @@ static inline int is_lan937x(struct ksz_device *dev)
- /* KSZ9893, KSZ9563, KSZ8563 specific register */
- #define REG_CHIP_ID4 0x0f
- #define SKU_ID_KSZ8563 0x3c
-+#define SKU_ID_KSZ9563 0x1c
-
- /* Driver set switch broadcast storm protection at 10% rate. */
- #define BROADCAST_STORM_PROT_RATE 10
-diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c
-index 1b6ab891b986e..4f2186779082a 100644
---- a/drivers/net/dsa/microchip/ksz_spi.c
-+++ b/drivers/net/dsa/microchip/ksz_spi.c
-@@ -163,7 +163,7 @@ static const struct of_device_id ksz_dt_ids[] = {
- },
- {
- .compatible = "microchip,ksz9563",
-- .data = &ksz_switch_chips[KSZ9893]
-+ .data = &ksz_switch_chips[KSZ9563]
- },
- {
- .compatible = "microchip,ksz8563",
---
-2.39.5
-
+++ /dev/null
-From 8c099a416f000e137e926b20ea091cc0b3513a56 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 20 Jan 2023 10:51:34 +0530
-Subject: net: dsa: microchip: enable port queues for tc mqprio
-
-From: Arun Ramadoss <arun.ramadoss@microchip.com>
-
-[ Upstream commit e30f33a5f5c74f278feaa57517d851874dfc640f ]
-
-LAN937x family of switches has 8 queues per port where the KSZ switches
-has 4 queues per port. By default, only one queue per port is enabled.
-The queues are configurable in 2, 4 or 8. This patch add 8 number of
-queues for LAN937x and 4 for other switches.
-In the tag_ksz.c file, prioirty of the packet is queried using the skb
-buffer and the corresponding value is updated in the tag.
-
-Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: ba54bce747fa ("net: dsa: microchip: linearize skb for tail-tagging switches")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/dsa/microchip/ksz9477.c | 18 ++++++++++++++++++
- drivers/net/dsa/microchip/ksz9477.h | 1 +
- drivers/net/dsa/microchip/ksz9477_reg.h | 6 +++++-
- drivers/net/dsa/microchip/ksz_common.c | 18 ++++++++++++++++++
- drivers/net/dsa/microchip/ksz_common.h | 1 +
- drivers/net/dsa/microchip/lan937x_main.c | 4 ++++
- net/dsa/tag_ksz.c | 15 +++++++++++++++
- 7 files changed, 62 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
-index 6858f96c6b85a..678d38b6f24e2 100644
---- a/drivers/net/dsa/microchip/ksz9477.c
-+++ b/drivers/net/dsa/microchip/ksz9477.c
-@@ -1012,6 +1012,22 @@ int ksz9477_set_ageing_time(struct ksz_device *dev, unsigned int msecs)
- return ksz_write8(dev, REG_SW_LUE_CTRL_3, value);
- }
-
-+void ksz9477_port_queue_split(struct ksz_device *dev, int port)
-+{
-+ u8 data;
-+
-+ if (dev->info->num_tx_queues == 8)
-+ data = PORT_EIGHT_QUEUE;
-+ else if (dev->info->num_tx_queues == 4)
-+ data = PORT_FOUR_QUEUE;
-+ else if (dev->info->num_tx_queues == 2)
-+ data = PORT_TWO_QUEUE;
-+ else
-+ data = PORT_SINGLE_QUEUE;
-+
-+ ksz_prmw8(dev, port, REG_PORT_CTRL_0, PORT_QUEUE_SPLIT_MASK, data);
-+}
-+
- void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
- {
- struct dsa_switch *ds = dev->ds;
-@@ -1023,6 +1039,8 @@ void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
- ksz_port_cfg(dev, port, REG_PORT_CTRL_0, PORT_TAIL_TAG_ENABLE,
- true);
-
-+ ksz9477_port_queue_split(dev, port);
-+
- ksz_port_cfg(dev, port, REG_PORT_CTRL_0, PORT_MAC_LOOPBACK, false);
-
- /* set back pressure */
-diff --git a/drivers/net/dsa/microchip/ksz9477.h b/drivers/net/dsa/microchip/ksz9477.h
-index 00862c4cfb7f1..beb9d73086526 100644
---- a/drivers/net/dsa/microchip/ksz9477.h
-+++ b/drivers/net/dsa/microchip/ksz9477.h
-@@ -57,5 +57,6 @@ int ksz9477_reset_switch(struct ksz_device *dev);
- int ksz9477_dsa_init(struct ksz_device *dev);
- int ksz9477_switch_init(struct ksz_device *dev);
- void ksz9477_switch_exit(struct ksz_device *dev);
-+void ksz9477_port_queue_split(struct ksz_device *dev, int port);
-
- #endif
-diff --git a/drivers/net/dsa/microchip/ksz9477_reg.h b/drivers/net/dsa/microchip/ksz9477_reg.h
-index ffb9484018ed5..bf407cd6b51da 100644
---- a/drivers/net/dsa/microchip/ksz9477_reg.h
-+++ b/drivers/net/dsa/microchip/ksz9477_reg.h
-@@ -849,7 +849,11 @@
- #define PORT_FORCE_TX_FLOW_CTRL BIT(4)
- #define PORT_FORCE_RX_FLOW_CTRL BIT(3)
- #define PORT_TAIL_TAG_ENABLE BIT(2)
--#define PORT_QUEUE_SPLIT_ENABLE 0x3
-+#define PORT_QUEUE_SPLIT_MASK GENMASK(1, 0)
-+#define PORT_EIGHT_QUEUE 0x3
-+#define PORT_FOUR_QUEUE 0x2
-+#define PORT_TWO_QUEUE 0x1
-+#define PORT_SINGLE_QUEUE 0x0
-
- #define REG_PORT_CTRL_1 0x0021
-
-diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
-index 966990a34a073..d2b646dfeb623 100644
---- a/drivers/net/dsa/microchip/ksz_common.c
-+++ b/drivers/net/dsa/microchip/ksz_common.c
-@@ -1035,6 +1035,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x07, /* can be configured as cpu port */
- .port_cnt = 3, /* total port count */
- .port_nirqs = 3,
-+ .num_tx_queues = 4,
- .ops = &ksz9477_dev_ops,
- .mib_names = ksz9477_mib_names,
- .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
-@@ -1061,6 +1062,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .num_statics = 8,
- .cpu_ports = 0x10, /* can be configured as cpu port */
- .port_cnt = 5, /* total cpu and user ports */
-+ .num_tx_queues = 4,
- .ops = &ksz8_dev_ops,
- .ksz87xx_eee_link_erratum = true,
- .mib_names = ksz9477_mib_names,
-@@ -1099,6 +1101,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .num_statics = 8,
- .cpu_ports = 0x10, /* can be configured as cpu port */
- .port_cnt = 5, /* total cpu and user ports */
-+ .num_tx_queues = 4,
- .ops = &ksz8_dev_ops,
- .ksz87xx_eee_link_erratum = true,
- .mib_names = ksz9477_mib_names,
-@@ -1123,6 +1126,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .num_statics = 8,
- .cpu_ports = 0x10, /* can be configured as cpu port */
- .port_cnt = 5, /* total cpu and user ports */
-+ .num_tx_queues = 4,
- .ops = &ksz8_dev_ops,
- .ksz87xx_eee_link_erratum = true,
- .mib_names = ksz9477_mib_names,
-@@ -1147,6 +1151,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .num_statics = 8,
- .cpu_ports = 0x4, /* can be configured as cpu port */
- .port_cnt = 3,
-+ .num_tx_queues = 4,
- .ops = &ksz8_dev_ops,
- .mib_names = ksz88xx_mib_names,
- .mib_cnt = ARRAY_SIZE(ksz88xx_mib_names),
-@@ -1168,6 +1173,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x7F, /* can be configured as cpu port */
- .port_cnt = 7, /* total physical port count */
- .port_nirqs = 4,
-+ .num_tx_queues = 4,
- .ops = &ksz9477_dev_ops,
- .phy_errata_9477 = true,
- .mib_names = ksz9477_mib_names,
-@@ -1200,6 +1206,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x3F, /* can be configured as cpu port */
- .port_cnt = 6, /* total physical port count */
- .port_nirqs = 2,
-+ .num_tx_queues = 4,
- .ops = &ksz9477_dev_ops,
- .phy_errata_9477 = true,
- .mib_names = ksz9477_mib_names,
-@@ -1232,6 +1239,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x7F, /* can be configured as cpu port */
- .port_cnt = 7, /* total physical port count */
- .port_nirqs = 2,
-+ .num_tx_queues = 4,
- .ops = &ksz9477_dev_ops,
- .phy_errata_9477 = true,
- .mib_names = ksz9477_mib_names,
-@@ -1262,6 +1270,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x07, /* can be configured as cpu port */
- .port_cnt = 3, /* total port count */
- .port_nirqs = 2,
-+ .num_tx_queues = 4,
- .ops = &ksz9477_dev_ops,
- .mib_names = ksz9477_mib_names,
- .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
-@@ -1287,6 +1296,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x07, /* can be configured as cpu port */
- .port_cnt = 3, /* total port count */
- .port_nirqs = 3,
-+ .num_tx_queues = 4,
- .ops = &ksz9477_dev_ops,
- .mib_names = ksz9477_mib_names,
- .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
-@@ -1312,6 +1322,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x7F, /* can be configured as cpu port */
- .port_cnt = 7, /* total physical port count */
- .port_nirqs = 3,
-+ .num_tx_queues = 4,
- .ops = &ksz9477_dev_ops,
- .phy_errata_9477 = true,
- .mib_names = ksz9477_mib_names,
-@@ -1342,6 +1353,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x10, /* can be configured as cpu port */
- .port_cnt = 5, /* total physical port count */
- .port_nirqs = 6,
-+ .num_tx_queues = 8,
- .ops = &lan937x_dev_ops,
- .mib_names = ksz9477_mib_names,
- .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
-@@ -1366,6 +1378,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x30, /* can be configured as cpu port */
- .port_cnt = 6, /* total physical port count */
- .port_nirqs = 6,
-+ .num_tx_queues = 8,
- .ops = &lan937x_dev_ops,
- .mib_names = ksz9477_mib_names,
- .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
-@@ -1390,6 +1403,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x30, /* can be configured as cpu port */
- .port_cnt = 8, /* total physical port count */
- .port_nirqs = 6,
-+ .num_tx_queues = 8,
- .ops = &lan937x_dev_ops,
- .mib_names = ksz9477_mib_names,
- .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
-@@ -1418,6 +1432,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x38, /* can be configured as cpu port */
- .port_cnt = 5, /* total physical port count */
- .port_nirqs = 6,
-+ .num_tx_queues = 8,
- .ops = &lan937x_dev_ops,
- .mib_names = ksz9477_mib_names,
- .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
-@@ -1446,6 +1461,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .cpu_ports = 0x30, /* can be configured as cpu port */
- .port_cnt = 8, /* total physical port count */
- .port_nirqs = 6,
-+ .num_tx_queues = 8,
- .ops = &lan937x_dev_ops,
- .mib_names = ksz9477_mib_names,
- .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
-@@ -1977,6 +1993,8 @@ static int ksz_setup(struct dsa_switch *ds)
-
- dev->dev_ops->enable_stp_addr(dev);
-
-+ ds->num_tx_queues = dev->info->num_tx_queues;
-+
- regmap_update_bits(dev->regmap[0], regs[S_MULTICAST_CTRL],
- MULTICAST_STORM_DISABLE, MULTICAST_STORM_DISABLE);
-
-diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
-index 6f263e36ee373..f887f264152b4 100644
---- a/drivers/net/dsa/microchip/ksz_common.h
-+++ b/drivers/net/dsa/microchip/ksz_common.h
-@@ -46,6 +46,7 @@ struct ksz_chip_data {
- int cpu_ports;
- int port_cnt;
- u8 port_nirqs;
-+ u8 num_tx_queues;
- const struct ksz_dev_ops *ops;
- bool phy_errata_9477;
- bool ksz87xx_eee_link_erratum;
-diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c
-index 338eff0818dfd..9c54bd0c620c6 100644
---- a/drivers/net/dsa/microchip/lan937x_main.c
-+++ b/drivers/net/dsa/microchip/lan937x_main.c
-@@ -15,6 +15,7 @@
-
- #include "lan937x_reg.h"
- #include "ksz_common.h"
-+#include "ksz9477.h"
- #include "lan937x.h"
-
- static int lan937x_cfg(struct ksz_device *dev, u32 addr, u8 bits, bool set)
-@@ -180,6 +181,9 @@ void lan937x_port_setup(struct ksz_device *dev, int port, bool cpu_port)
- lan937x_port_cfg(dev, port, REG_PORT_CTRL_0,
- PORT_TAIL_TAG_ENABLE, true);
-
-+ /* Enable the Port Queue split */
-+ ksz9477_port_queue_split(dev, port);
-+
- /* set back pressure for half duplex */
- lan937x_port_cfg(dev, port, REG_PORT_MAC_CTRL_1, PORT_BACK_PRESSURE,
- true);
-diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
-index 429250298ac4b..fa61b2bc79391 100644
---- a/net/dsa/tag_ksz.c
-+++ b/net/dsa/tag_ksz.c
-@@ -105,12 +105,15 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795);
- #define KSZ9477_PTP_TAG_LEN 4
- #define KSZ9477_PTP_TAG_INDICATION 0x80
-
-+#define KSZ9477_TAIL_TAG_PRIO GENMASK(8, 7)
- #define KSZ9477_TAIL_TAG_OVERRIDE BIT(9)
- #define KSZ9477_TAIL_TAG_LOOKUP BIT(10)
-
- static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
- struct net_device *dev)
- {
-+ u16 queue_mapping = skb_get_queue_mapping(skb);
-+ u8 prio = netdev_txq_to_tc(dev, queue_mapping);
- struct dsa_port *dp = dsa_slave_to_port(dev);
- __be16 *tag;
- u8 *addr;
-@@ -125,6 +128,8 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
-
- val = BIT(dp->index);
-
-+ val |= FIELD_PREP(KSZ9477_TAIL_TAG_PRIO, prio);
-+
- if (is_link_local_ether_addr(addr))
- val |= KSZ9477_TAIL_TAG_OVERRIDE;
-
-@@ -158,12 +163,15 @@ static const struct dsa_device_ops ksz9477_netdev_ops = {
- DSA_TAG_DRIVER(ksz9477_netdev_ops);
- MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9477);
-
-+#define KSZ9893_TAIL_TAG_PRIO GENMASK(4, 3)
- #define KSZ9893_TAIL_TAG_OVERRIDE BIT(5)
- #define KSZ9893_TAIL_TAG_LOOKUP BIT(6)
-
- static struct sk_buff *ksz9893_xmit(struct sk_buff *skb,
- struct net_device *dev)
- {
-+ u16 queue_mapping = skb_get_queue_mapping(skb);
-+ u8 prio = netdev_txq_to_tc(dev, queue_mapping);
- struct dsa_port *dp = dsa_slave_to_port(dev);
- u8 *addr;
- u8 *tag;
-@@ -177,6 +185,8 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb,
-
- *tag = BIT(dp->index);
-
-+ *tag |= FIELD_PREP(KSZ9893_TAIL_TAG_PRIO, prio);
-+
- if (is_link_local_ether_addr(addr))
- *tag |= KSZ9893_TAIL_TAG_OVERRIDE;
-
-@@ -213,11 +223,14 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9893);
- #define LAN937X_TAIL_TAG_BLOCKING_OVERRIDE BIT(11)
- #define LAN937X_TAIL_TAG_LOOKUP BIT(12)
- #define LAN937X_TAIL_TAG_VALID BIT(13)
-+#define LAN937X_TAIL_TAG_PRIO GENMASK(10, 8)
- #define LAN937X_TAIL_TAG_PORT_MASK 7
-
- static struct sk_buff *lan937x_xmit(struct sk_buff *skb,
- struct net_device *dev)
- {
-+ u16 queue_mapping = skb_get_queue_mapping(skb);
-+ u8 prio = netdev_txq_to_tc(dev, queue_mapping);
- struct dsa_port *dp = dsa_slave_to_port(dev);
- const struct ethhdr *hdr = eth_hdr(skb);
- __be16 *tag;
-@@ -230,6 +243,8 @@ static struct sk_buff *lan937x_xmit(struct sk_buff *skb,
-
- val = BIT(dp->index);
-
-+ val |= FIELD_PREP(LAN937X_TAIL_TAG_PRIO, prio);
-+
- if (is_link_local_ether_addr(hdr->h_dest))
- val |= LAN937X_TAIL_TAG_BLOCKING_OVERRIDE;
-
---
-2.39.5
-
+++ /dev/null
-From 918fe1d978150745c40d7ca88f33350021c6a2b9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 7 Nov 2022 14:59:21 +0530
-Subject: net: dsa: microchip: ksz8563: Add number of port irq
-
-From: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
-
-[ Upstream commit 4630d1420f841b2b112928359c4dc148d9a7d1f8 ]
-
-KSZ8563 have three port interrupts: PTP, PHY and ACL. Add
-port_nirq as 3 for KSZ8563 inside ksz_chip_data.
-
-Signed-off-by: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: ba54bce747fa ("net: dsa: microchip: linearize skb for tail-tagging switches")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/dsa/microchip/ksz_common.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
-index effc66d1555da..966990a34a073 100644
---- a/drivers/net/dsa/microchip/ksz_common.c
-+++ b/drivers/net/dsa/microchip/ksz_common.c
-@@ -1034,6 +1034,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
- .num_statics = 16,
- .cpu_ports = 0x07, /* can be configured as cpu port */
- .port_cnt = 3, /* total port count */
-+ .port_nirqs = 3,
- .ops = &ksz9477_dev_ops,
- .mib_names = ksz9477_mib_names,
- .mib_cnt = ARRAY_SIZE(ksz9477_mib_names),
---
-2.39.5
-
+++ /dev/null
-From 23b68ba2cf246f14b812d79a50f6ba4f5ee1bbc9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 15 May 2025 09:29:19 +0200
-Subject: net: dsa: microchip: linearize skb for tail-tagging switches
-
-From: Jakob Unterwurzacher <jakobunt@gmail.com>
-
-[ Upstream commit ba54bce747fa9e07896c1abd9b48545f7b4b31d2 ]
-
-The pointer arithmentic for accessing the tail tag only works
-for linear skbs.
-
-For nonlinear skbs, it reads uninitialized memory inside the
-skb headroom, essentially randomizing the tag. I have observed
-it gets set to 6 most of the time.
-
-Example where ksz9477_rcv thinks that the packet from port 1 comes from port 6
-(which does not exist for the ksz9896 that's in use), dropping the packet.
-Debug prints added by me (not included in this patch):
-
- [ 256.645337] ksz9477_rcv:323 tag0=6
- [ 256.645349] skb len=47 headroom=78 headlen=0 tailroom=0
- mac=(64,14) mac_len=14 net=(78,0) trans=78
- shinfo(txflags=0 nr_frags=1 gso(size=0 type=0 segs=0))
- csum(0x0 start=0 offset=0 ip_summed=0 complete_sw=0 valid=0 level=0)
- hash(0x0 sw=0 l4=0) proto=0x00f8 pkttype=1 iif=3
- priority=0x0 mark=0x0 alloc_cpu=0 vlan_all=0x0
- encapsulation=0 inner(proto=0x0000, mac=0, net=0, trans=0)
- [ 256.645377] dev name=end1 feat=0x0002e10200114bb3
- [ 256.645386] skb headroom: 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- [ 256.645395] skb headroom: 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- [ 256.645403] skb headroom: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- [ 256.645411] skb headroom: 00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- [ 256.645420] skb headroom: 00000040: ff ff ff ff ff ff 00 1c 19 f2 e2 db 08 06
- [ 256.645428] skb frag: 00000000: 00 01 08 00 06 04 00 01 00 1c 19 f2 e2 db 0a 02
- [ 256.645436] skb frag: 00000010: 00 83 00 00 00 00 00 00 0a 02 a0 2f 00 00 00 00
- [ 256.645444] skb frag: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01
- [ 256.645452] ksz_common_rcv:92 dsa_conduit_find_user returned NULL
-
-Call skb_linearize before trying to access the tag.
-
-This patch fixes ksz9477_rcv which is used by the ksz9896 I have at
-hand, and also applies the same fix to ksz8795_rcv which seems to have
-the same problem.
-
-Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
-CC: stable@vger.kernel.org
-Fixes: 016e43a26bab ("net: dsa: ksz: Add KSZ8795 tag code")
-Fixes: 8b8010fb7876 ("dsa: add support for Microchip KSZ tail tagging")
-Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
-Link: https://patch.msgid.link/20250515072920.2313014-1-jakob.unterwurzacher@cherry.de
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/dsa/tag_ksz.c | 19 +++++++++++++++----
- 1 file changed, 15 insertions(+), 4 deletions(-)
-
-diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
-index cc3a920eb7f4e..8fbcdc9a0f3bd 100644
---- a/net/dsa/tag_ksz.c
-+++ b/net/dsa/tag_ksz.c
-@@ -69,7 +69,12 @@ static struct sk_buff *ksz8795_xmit(struct sk_buff *skb, struct net_device *dev)
-
- static struct sk_buff *ksz8795_rcv(struct sk_buff *skb, struct net_device *dev)
- {
-- u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
-+ u8 *tag;
-+
-+ if (skb_linearize(skb))
-+ return NULL;
-+
-+ tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
-
- return ksz_common_rcv(skb, dev, tag[0] & 7, KSZ_EGRESS_TAG_LEN);
- }
-@@ -141,10 +146,16 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
-
- static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev)
- {
-- /* Tag decoding */
-- u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
-- unsigned int port = tag[0] & KSZ9477_TAIL_TAG_EG_PORT_M;
- unsigned int len = KSZ_EGRESS_TAG_LEN;
-+ unsigned int port;
-+ u8 *tag;
-+
-+ if (skb_linearize(skb))
-+ return NULL;
-+
-+ /* Tag decoding */
-+ tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
-+ port = tag[0] & KSZ9477_TAIL_TAG_EG_PORT_M;
-
- /* Extra 4-bytes PTP timestamp */
- if (tag[0] & KSZ9477_PTP_TAG_INDICATION)
---
-2.39.5
-
+++ /dev/null
-From 9722d1162cdb1e7f2fdb270bcb3ec41f2d64e10e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 9 Sep 2024 15:42:59 +0200
-Subject: net: dsa: microchip: update tag_ksz masks for KSZ9477 family
-
-From: Pieter Van Trappen <pieter.van.trappen@cern.ch>
-
-[ Upstream commit 3f464b193d40e49299dcd087b10cc3b77cbbea68 ]
-
-Remove magic number 7 by introducing a GENMASK macro instead.
-Remove magic number 0x80 by using the BIT macro instead.
-
-Signed-off-by: Pieter Van Trappen <pieter.van.trappen@cern.ch>
-Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-Link: https://patch.msgid.link/20240909134301.75448-1-vtpieter@gmail.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: ba54bce747fa ("net: dsa: microchip: linearize skb for tail-tagging switches")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/dsa/tag_ksz.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
-index fa61b2bc79391..cc3a920eb7f4e 100644
---- a/net/dsa/tag_ksz.c
-+++ b/net/dsa/tag_ksz.c
-@@ -103,8 +103,9 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795);
-
- #define KSZ9477_INGRESS_TAG_LEN 2
- #define KSZ9477_PTP_TAG_LEN 4
--#define KSZ9477_PTP_TAG_INDICATION 0x80
-+#define KSZ9477_PTP_TAG_INDICATION BIT(7)
-
-+#define KSZ9477_TAIL_TAG_EG_PORT_M GENMASK(2, 0)
- #define KSZ9477_TAIL_TAG_PRIO GENMASK(8, 7)
- #define KSZ9477_TAIL_TAG_OVERRIDE BIT(9)
- #define KSZ9477_TAIL_TAG_LOOKUP BIT(10)
-@@ -142,7 +143,7 @@ static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev)
- {
- /* Tag decoding */
- u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
-- unsigned int port = tag[0] & 7;
-+ unsigned int port = tag[0] & KSZ9477_TAIL_TAG_EG_PORT_M;
- unsigned int len = KSZ_EGRESS_TAG_LEN;
-
- /* Extra 4-bytes PTP timestamp */
---
-2.39.5
-
xfs-use-xfs_buf_daddr_null-for-daddrs-in-getfsmap-co.patch
xfs-take-m_growlock-when-running-growfsrt.patch
xfs-reset-rootdir-extent-size-hint-after-growfsrt.patch
-net-dsa-microchip-add-ksz9563-in-ksz_switch_ops-and-.patch
-net-dsa-microchip-ksz8563-add-number-of-port-irq.patch
-net-dsa-microchip-enable-port-queues-for-tc-mqprio.patch
-net-dsa-microchip-update-tag_ksz-masks-for-ksz9477-f.patch
-net-dsa-microchip-linearize-skb-for-tail-tagging-swi.patch
pmdomain-core-fix-error-checking-in-genpd_dev_pm_att.patch
arm64-dts-marvell-udpu-define-pinctrl-state-for-alar.patch
input-synaptics-rmi-fix-crash-with-unsupported-versi.patch
+++ /dev/null
-From 647381dbd54840732fa1f9d3f61c39a5196ffbf7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 15 May 2025 09:29:19 +0200
-Subject: net: dsa: microchip: linearize skb for tail-tagging switches
-
-From: Jakob Unterwurzacher <jakobunt@gmail.com>
-
-[ Upstream commit ba54bce747fa9e07896c1abd9b48545f7b4b31d2 ]
-
-The pointer arithmentic for accessing the tail tag only works
-for linear skbs.
-
-For nonlinear skbs, it reads uninitialized memory inside the
-skb headroom, essentially randomizing the tag. I have observed
-it gets set to 6 most of the time.
-
-Example where ksz9477_rcv thinks that the packet from port 1 comes from port 6
-(which does not exist for the ksz9896 that's in use), dropping the packet.
-Debug prints added by me (not included in this patch):
-
- [ 256.645337] ksz9477_rcv:323 tag0=6
- [ 256.645349] skb len=47 headroom=78 headlen=0 tailroom=0
- mac=(64,14) mac_len=14 net=(78,0) trans=78
- shinfo(txflags=0 nr_frags=1 gso(size=0 type=0 segs=0))
- csum(0x0 start=0 offset=0 ip_summed=0 complete_sw=0 valid=0 level=0)
- hash(0x0 sw=0 l4=0) proto=0x00f8 pkttype=1 iif=3
- priority=0x0 mark=0x0 alloc_cpu=0 vlan_all=0x0
- encapsulation=0 inner(proto=0x0000, mac=0, net=0, trans=0)
- [ 256.645377] dev name=end1 feat=0x0002e10200114bb3
- [ 256.645386] skb headroom: 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- [ 256.645395] skb headroom: 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- [ 256.645403] skb headroom: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- [ 256.645411] skb headroom: 00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- [ 256.645420] skb headroom: 00000040: ff ff ff ff ff ff 00 1c 19 f2 e2 db 08 06
- [ 256.645428] skb frag: 00000000: 00 01 08 00 06 04 00 01 00 1c 19 f2 e2 db 0a 02
- [ 256.645436] skb frag: 00000010: 00 83 00 00 00 00 00 00 0a 02 a0 2f 00 00 00 00
- [ 256.645444] skb frag: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01
- [ 256.645452] ksz_common_rcv:92 dsa_conduit_find_user returned NULL
-
-Call skb_linearize before trying to access the tag.
-
-This patch fixes ksz9477_rcv which is used by the ksz9896 I have at
-hand, and also applies the same fix to ksz8795_rcv which seems to have
-the same problem.
-
-Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
-CC: stable@vger.kernel.org
-Fixes: 016e43a26bab ("net: dsa: ksz: Add KSZ8795 tag code")
-Fixes: 8b8010fb7876 ("dsa: add support for Microchip KSZ tail tagging")
-Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
-Link: https://patch.msgid.link/20250515072920.2313014-1-jakob.unterwurzacher@cherry.de
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/dsa/tag_ksz.c | 19 +++++++++++++++----
- 1 file changed, 15 insertions(+), 4 deletions(-)
-
-diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
-index 7bf87fa471a0c..0a16c04c4bfc4 100644
---- a/net/dsa/tag_ksz.c
-+++ b/net/dsa/tag_ksz.c
-@@ -139,7 +139,12 @@ static struct sk_buff *ksz8795_xmit(struct sk_buff *skb, struct net_device *dev)
-
- static struct sk_buff *ksz8795_rcv(struct sk_buff *skb, struct net_device *dev)
- {
-- u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
-+ u8 *tag;
-+
-+ if (skb_linearize(skb))
-+ return NULL;
-+
-+ tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
-
- return ksz_common_rcv(skb, dev, tag[0] & 7, KSZ_EGRESS_TAG_LEN);
- }
-@@ -301,10 +306,16 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
-
- static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev)
- {
-- /* Tag decoding */
-- u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
-- unsigned int port = tag[0] & KSZ9477_TAIL_TAG_EG_PORT_M;
- unsigned int len = KSZ_EGRESS_TAG_LEN;
-+ unsigned int port;
-+ u8 *tag;
-+
-+ if (skb_linearize(skb))
-+ return NULL;
-+
-+ /* Tag decoding */
-+ tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
-+ port = tag[0] & KSZ9477_TAIL_TAG_EG_PORT_M;
-
- /* Extra 4-bytes PTP timestamp */
- if (tag[0] & KSZ9477_PTP_TAG_INDICATION) {
---
-2.39.5
-
+++ /dev/null
-From 2123154cd68a07242d7203174814afb18ca32ab2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 9 Sep 2024 15:42:59 +0200
-Subject: net: dsa: microchip: update tag_ksz masks for KSZ9477 family
-
-From: Pieter Van Trappen <pieter.van.trappen@cern.ch>
-
-[ Upstream commit 3f464b193d40e49299dcd087b10cc3b77cbbea68 ]
-
-Remove magic number 7 by introducing a GENMASK macro instead.
-Remove magic number 0x80 by using the BIT macro instead.
-
-Signed-off-by: Pieter Van Trappen <pieter.van.trappen@cern.ch>
-Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-Link: https://patch.msgid.link/20240909134301.75448-1-vtpieter@gmail.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: ba54bce747fa ("net: dsa: microchip: linearize skb for tail-tagging switches")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/dsa/tag_ksz.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
-index ea100bd25939b..7bf87fa471a0c 100644
---- a/net/dsa/tag_ksz.c
-+++ b/net/dsa/tag_ksz.c
-@@ -176,8 +176,9 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795, KSZ8795_NAME);
-
- #define KSZ9477_INGRESS_TAG_LEN 2
- #define KSZ9477_PTP_TAG_LEN 4
--#define KSZ9477_PTP_TAG_INDICATION 0x80
-+#define KSZ9477_PTP_TAG_INDICATION BIT(7)
-
-+#define KSZ9477_TAIL_TAG_EG_PORT_M GENMASK(2, 0)
- #define KSZ9477_TAIL_TAG_PRIO GENMASK(8, 7)
- #define KSZ9477_TAIL_TAG_OVERRIDE BIT(9)
- #define KSZ9477_TAIL_TAG_LOOKUP BIT(10)
-@@ -302,7 +303,7 @@ static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev)
- {
- /* Tag decoding */
- u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
-- unsigned int port = tag[0] & 7;
-+ unsigned int port = tag[0] & KSZ9477_TAIL_TAG_EG_PORT_M;
- unsigned int len = KSZ_EGRESS_TAG_LEN;
-
- /* Extra 4-bytes PTP timestamp */
---
-2.39.5
-
path_overmount-avoid-false-negatives.patch
fix-propagation-graph-breakage-by-move_mount_set_gro.patch
do_change_type-refuse-to-operate-on-unmounted-not-ou.patch
-net-dsa-microchip-update-tag_ksz-masks-for-ksz9477-f.patch
-net-dsa-microchip-linearize-skb-for-tail-tagging-swi.patch
pmdomain-core-fix-error-checking-in-genpd_dev_pm_att.patch
input-synaptics-rmi-fix-crash-with-unsupported-versi.patch
kasan-use-unchecked-__memset-internally.patch