+++ /dev/null
-From b6e5b828dc3ddb8c66890eb0f341b231cd3a3c9d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 10 Apr 2024 20:42:38 +0100
-Subject: net: dsa: introduce dsa_phylink_to_port()
-
-From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-
-[ Upstream commit dd0c9855b41310470086500c9963bbb64bb90dd0 ]
-
-We convert from a phylink_config struct to a dsa_port struct in many
-places, let's provide a helper for this.
-
-Reviewed-by: Andrew Lunn <andrew@lunn.ch>
-Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
-Link: https://lore.kernel.org/r/E1rudqA-006K9B-85@rmk-PC.armlinux.org.uk
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 0005b2dc43f9 ("dsa: lan9303: Fix mapping between DSA port number and PHY address")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/net/dsa.h | 6 ++++++
- net/dsa/port.c | 12 ++++++------
- 2 files changed, 12 insertions(+), 6 deletions(-)
-
-diff --git a/include/net/dsa.h b/include/net/dsa.h
-index 0b9c6aa270474..f643866300ed3 100644
---- a/include/net/dsa.h
-+++ b/include/net/dsa.h
-@@ -327,6 +327,12 @@ struct dsa_port {
- };
- };
-
-+static inline struct dsa_port *
-+dsa_phylink_to_port(struct phylink_config *config)
-+{
-+ return container_of(config, struct dsa_port, pl_config);
-+}
-+
- /* TODO: ideally DSA ports would have a single dp->link_dp member,
- * and no dst->rtable nor this struct dsa_link would be needed,
- * but this would require some more complex tree walking,
-diff --git a/net/dsa/port.c b/net/dsa/port.c
-index 37ab238e83042..c5e7b12aff5bf 100644
---- a/net/dsa/port.c
-+++ b/net/dsa/port.c
-@@ -1572,7 +1572,7 @@ static struct phylink_pcs *
- dsa_port_phylink_mac_select_pcs(struct phylink_config *config,
- phy_interface_t interface)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct phylink_pcs *pcs = ERR_PTR(-EOPNOTSUPP);
- struct dsa_switch *ds = dp->ds;
-
-@@ -1586,7 +1586,7 @@ static int dsa_port_phylink_mac_prepare(struct phylink_config *config,
- unsigned int mode,
- phy_interface_t interface)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct dsa_switch *ds = dp->ds;
- int err = 0;
-
-@@ -1601,7 +1601,7 @@ static void dsa_port_phylink_mac_config(struct phylink_config *config,
- unsigned int mode,
- const struct phylink_link_state *state)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct dsa_switch *ds = dp->ds;
-
- if (!ds->ops->phylink_mac_config)
-@@ -1614,7 +1614,7 @@ static int dsa_port_phylink_mac_finish(struct phylink_config *config,
- unsigned int mode,
- phy_interface_t interface)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct dsa_switch *ds = dp->ds;
- int err = 0;
-
-@@ -1629,7 +1629,7 @@ static void dsa_port_phylink_mac_link_down(struct phylink_config *config,
- unsigned int mode,
- phy_interface_t interface)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct phy_device *phydev = NULL;
- struct dsa_switch *ds = dp->ds;
-
-@@ -1652,7 +1652,7 @@ static void dsa_port_phylink_mac_link_up(struct phylink_config *config,
- int speed, int duplex,
- bool tx_pause, bool rx_pause)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct dsa_switch *ds = dp->ds;
-
- if (!ds->ops->phylink_mac_link_up) {
---
-2.43.0
-
cachefiles-wait-for-ondemand_object_worker-to-finish.patch
cachefiles-cyclic-allocation-of-msg_id-to-avoid-reus.patch
cachefiles-add-missing-lock-protection-when-polling.patch
-net-dsa-introduce-dsa_phylink_to_port.patch
dsa-lan9303-fix-mapping-between-dsa-port-number-and-.patch
filelock-fix-potential-use-after-free-in-posix_lock_.patch
fs-dcache-re-use-value-stored-to-dentry-d_flags-inst.patch
Link: https://patch.msgid.link/20240703145718.19951-1-ceggers@arri.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/net/dsa/lan9303-core.c | 23 ++++++++++-------------
+ drivers/net/dsa/lan9303-core.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
-diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
-index 666b4d766c005..1f7000f90bb78 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
-@@ -1048,31 +1048,31 @@ static int lan9303_get_sset_count(struct dsa_switch *ds, int port, int sset)
+@@ -1048,31 +1048,31 @@ static int lan9303_get_sset_count(struct
return ARRAY_SIZE(lan9303_mib);
}
}
static int lan9303_port_enable(struct dsa_switch *ds, int port,
-@@ -1100,7 +1100,7 @@ static void lan9303_port_disable(struct dsa_switch *ds, int port)
+@@ -1100,7 +1100,7 @@ static void lan9303_port_disable(struct
vlan_vid_del(dsa_port_to_conduit(dp), htons(ETH_P_8021Q), port);
lan9303_disable_processing_port(chip, port);
}
static int lan9303_port_bridge_join(struct dsa_switch *ds, int port,
-@@ -1375,8 +1375,6 @@ static const struct dsa_switch_ops lan9303_switch_ops = {
+@@ -1355,8 +1355,6 @@ static const struct dsa_switch_ops lan93
static int lan9303_register_switch(struct lan9303 *chip)
{
chip->ds = devm_kzalloc(chip->dev, sizeof(*chip->ds), GFP_KERNEL);
if (!chip->ds)
return -ENOMEM;
-@@ -1386,8 +1384,7 @@ static int lan9303_register_switch(struct lan9303 *chip)
+@@ -1365,8 +1363,7 @@ static int lan9303_register_switch(struc
+ chip->ds->num_ports = LAN9303_NUM_PORTS;
chip->ds->priv = chip;
chip->ds->ops = &lan9303_switch_ops;
- chip->ds->phylink_mac_ops = &lan9303_phylink_mac_ops;
- base = chip->phy_addr_base;
- chip->ds->phys_mii_mask = GENMASK(LAN9303_NUM_PORTS - 1 + base, base);
+ chip->ds->phys_mii_mask = GENMASK(LAN9303_NUM_PORTS - 1, 0);
return dsa_register_switch(chip->ds);
}
---
-2.43.0
-
+++ /dev/null
-From 2cf66bca77e312bf1604c5451dfc2fe43ce59ed8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 10 Apr 2024 20:42:43 +0100
-Subject: net: dsa: allow DSA switch drivers to provide their own phylink mac
- ops
-
-From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-
-[ Upstream commit cae425cb43feddd9fd62fc1b25567f9463da4915 ]
-
-Rather than having a shim for each and every phylink MAC operation,
-allow DSA switch drivers to provide their own ops structure. When a
-DSA driver provides the phylink MAC operations, the shimmed ops must
-not be provided, so fail an attempt to register a switch with both
-the phylink_mac_ops in struct dsa_switch and the phylink_mac_*
-operations populated in dsa_switch_ops populated.
-
-Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
-Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-Link: https://lore.kernel.org/r/E1rudqF-006K9H-Cc@rmk-PC.armlinux.org.uk
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 0005b2dc43f9 ("dsa: lan9303: Fix mapping between DSA port number and PHY address")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/net/dsa.h | 5 +++++
- net/dsa/dsa.c | 11 +++++++++++
- net/dsa/port.c | 26 ++++++++++++++++++++------
- 3 files changed, 36 insertions(+), 6 deletions(-)
-
-diff --git a/include/net/dsa.h b/include/net/dsa.h
-index f228b479a5fd2..7edfd8de8882f 100644
---- a/include/net/dsa.h
-+++ b/include/net/dsa.h
-@@ -457,6 +457,11 @@ struct dsa_switch {
- */
- const struct dsa_switch_ops *ops;
-
-+ /*
-+ * Allow a DSA switch driver to override the phylink MAC ops
-+ */
-+ const struct phylink_mac_ops *phylink_mac_ops;
-+
- /*
- * User mii_bus and devices for the individual ports.
- */
-diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
-index 09d2f5d4b3dd4..2f347cd373162 100644
---- a/net/dsa/dsa.c
-+++ b/net/dsa/dsa.c
-@@ -1505,6 +1505,17 @@ static int dsa_switch_probe(struct dsa_switch *ds)
- if (!ds->num_ports)
- return -EINVAL;
-
-+ if (ds->phylink_mac_ops) {
-+ if (ds->ops->phylink_mac_select_pcs ||
-+ ds->ops->phylink_mac_prepare ||
-+ ds->ops->phylink_mac_config ||
-+ ds->ops->phylink_mac_finish ||
-+ ds->ops->phylink_mac_link_down ||
-+ ds->ops->phylink_mac_link_up ||
-+ ds->ops->adjust_link)
-+ return -EINVAL;
-+ }
-+
- if (np) {
- err = dsa_switch_parse_of(ds, np);
- if (err)
-diff --git a/net/dsa/port.c b/net/dsa/port.c
-index 02bf1c306bdca..c6febc3d96d9b 100644
---- a/net/dsa/port.c
-+++ b/net/dsa/port.c
-@@ -1662,6 +1662,7 @@ static const struct phylink_mac_ops dsa_port_phylink_mac_ops = {
-
- int dsa_port_phylink_create(struct dsa_port *dp)
- {
-+ const struct phylink_mac_ops *mac_ops;
- struct dsa_switch *ds = dp->ds;
- phy_interface_t mode;
- struct phylink *pl;
-@@ -1685,8 +1686,12 @@ int dsa_port_phylink_create(struct dsa_port *dp)
- }
- }
-
-- pl = phylink_create(&dp->pl_config, of_fwnode_handle(dp->dn),
-- mode, &dsa_port_phylink_mac_ops);
-+ mac_ops = &dsa_port_phylink_mac_ops;
-+ if (ds->phylink_mac_ops)
-+ mac_ops = ds->phylink_mac_ops;
-+
-+ pl = phylink_create(&dp->pl_config, of_fwnode_handle(dp->dn), mode,
-+ mac_ops);
- if (IS_ERR(pl)) {
- pr_err("error creating PHYLINK: %ld\n", PTR_ERR(pl));
- return PTR_ERR(pl);
-@@ -1952,12 +1957,23 @@ static void dsa_shared_port_validate_of(struct dsa_port *dp,
- dn, dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index);
- }
-
-+static void dsa_shared_port_link_down(struct dsa_port *dp)
-+{
-+ struct dsa_switch *ds = dp->ds;
-+
-+ if (ds->phylink_mac_ops && ds->phylink_mac_ops->mac_link_down)
-+ ds->phylink_mac_ops->mac_link_down(&dp->pl_config, MLO_AN_FIXED,
-+ PHY_INTERFACE_MODE_NA);
-+ else if (ds->ops->phylink_mac_link_down)
-+ ds->ops->phylink_mac_link_down(ds, dp->index, MLO_AN_FIXED,
-+ PHY_INTERFACE_MODE_NA);
-+}
-+
- int dsa_shared_port_link_register_of(struct dsa_port *dp)
- {
- struct dsa_switch *ds = dp->ds;
- bool missing_link_description;
- bool missing_phy_mode;
-- int port = dp->index;
-
- dsa_shared_port_validate_of(dp, &missing_phy_mode,
- &missing_link_description);
-@@ -1973,9 +1989,7 @@ int dsa_shared_port_link_register_of(struct dsa_port *dp)
- "Skipping phylink registration for %s port %d\n",
- dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index);
- } else {
-- if (ds->ops->phylink_mac_link_down)
-- ds->ops->phylink_mac_link_down(ds, port,
-- MLO_AN_FIXED, PHY_INTERFACE_MODE_NA);
-+ dsa_shared_port_link_down(dp);
-
- return dsa_shared_port_phylink_register(dp);
- }
---
-2.43.0
-
+++ /dev/null
-From a578bfc5658fe19e87f8b0d4304bfba5e0bcf5c4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 10 Apr 2024 20:42:38 +0100
-Subject: net: dsa: introduce dsa_phylink_to_port()
-
-From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-
-[ Upstream commit dd0c9855b41310470086500c9963bbb64bb90dd0 ]
-
-We convert from a phylink_config struct to a dsa_port struct in many
-places, let's provide a helper for this.
-
-Reviewed-by: Andrew Lunn <andrew@lunn.ch>
-Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
-Link: https://lore.kernel.org/r/E1rudqA-006K9B-85@rmk-PC.armlinux.org.uk
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 0005b2dc43f9 ("dsa: lan9303: Fix mapping between DSA port number and PHY address")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/net/dsa.h | 6 ++++++
- net/dsa/port.c | 12 ++++++------
- 2 files changed, 12 insertions(+), 6 deletions(-)
-
-diff --git a/include/net/dsa.h b/include/net/dsa.h
-index 7c0da9effe4e9..f228b479a5fd2 100644
---- a/include/net/dsa.h
-+++ b/include/net/dsa.h
-@@ -327,6 +327,12 @@ struct dsa_port {
- };
- };
-
-+static inline struct dsa_port *
-+dsa_phylink_to_port(struct phylink_config *config)
-+{
-+ return container_of(config, struct dsa_port, pl_config);
-+}
-+
- /* TODO: ideally DSA ports would have a single dp->link_dp member,
- * and no dst->rtable nor this struct dsa_link would be needed,
- * but this would require some more complex tree walking,
-diff --git a/net/dsa/port.c b/net/dsa/port.c
-index c42dac87671b1..02bf1c306bdca 100644
---- a/net/dsa/port.c
-+++ b/net/dsa/port.c
-@@ -1558,7 +1558,7 @@ static struct phylink_pcs *
- dsa_port_phylink_mac_select_pcs(struct phylink_config *config,
- phy_interface_t interface)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct phylink_pcs *pcs = ERR_PTR(-EOPNOTSUPP);
- struct dsa_switch *ds = dp->ds;
-
-@@ -1572,7 +1572,7 @@ static int dsa_port_phylink_mac_prepare(struct phylink_config *config,
- unsigned int mode,
- phy_interface_t interface)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct dsa_switch *ds = dp->ds;
- int err = 0;
-
-@@ -1587,7 +1587,7 @@ static void dsa_port_phylink_mac_config(struct phylink_config *config,
- unsigned int mode,
- const struct phylink_link_state *state)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct dsa_switch *ds = dp->ds;
-
- if (!ds->ops->phylink_mac_config)
-@@ -1600,7 +1600,7 @@ static int dsa_port_phylink_mac_finish(struct phylink_config *config,
- unsigned int mode,
- phy_interface_t interface)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct dsa_switch *ds = dp->ds;
- int err = 0;
-
-@@ -1615,7 +1615,7 @@ static void dsa_port_phylink_mac_link_down(struct phylink_config *config,
- unsigned int mode,
- phy_interface_t interface)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct phy_device *phydev = NULL;
- struct dsa_switch *ds = dp->ds;
-
-@@ -1638,7 +1638,7 @@ static void dsa_port_phylink_mac_link_up(struct phylink_config *config,
- int speed, int duplex,
- bool tx_pause, bool rx_pause)
- {
-- struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
- struct dsa_switch *ds = dp->ds;
-
- if (!ds->ops->phylink_mac_link_up) {
---
-2.43.0
-
+++ /dev/null
-From a4a7537a9af06d98efcd54ac125675ffcaf4b2c2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 16 Apr 2024 11:19:14 +0100
-Subject: net: dsa: lan9303: provide own phylink MAC operations
-
-From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-
-[ Upstream commit 855b4ac06e46eaaf0f28484863e55d23fee89a0c ]
-
-Convert lan9303 to provide its own phylink MAC operations, thus
-avoiding the shim layer in DSA's port.c. We need to provide stubs for
-the mac_link_down() and mac_config() methods which are mandatory.
-
-Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-Link: https://lore.kernel.org/r/E1rwfuE-007537-1u@rmk-PC.armlinux.org.uk
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 0005b2dc43f9 ("dsa: lan9303: Fix mapping between DSA port number and PHY address")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/dsa/lan9303-core.c | 31 ++++++++++++++++++++++++++-----
- 1 file changed, 26 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
-index fcb20eac332a6..666b4d766c005 100644
---- a/drivers/net/dsa/lan9303-core.c
-+++ b/drivers/net/dsa/lan9303-core.c
-@@ -1293,14 +1293,29 @@ static void lan9303_phylink_get_caps(struct dsa_switch *ds, int port,
- }
- }
-
--static void lan9303_phylink_mac_link_up(struct dsa_switch *ds, int port,
-+static void lan9303_phylink_mac_config(struct phylink_config *config,
-+ unsigned int mode,
-+ const struct phylink_link_state *state)
-+{
-+}
-+
-+static void lan9303_phylink_mac_link_down(struct phylink_config *config,
-+ unsigned int mode,
-+ phy_interface_t interface)
-+{
-+}
-+
-+static void lan9303_phylink_mac_link_up(struct phylink_config *config,
-+ struct phy_device *phydev,
- unsigned int mode,
- phy_interface_t interface,
-- struct phy_device *phydev, int speed,
-- int duplex, bool tx_pause,
-+ int speed, int duplex, bool tx_pause,
- bool rx_pause)
- {
-- struct lan9303 *chip = ds->priv;
-+ struct dsa_port *dp = dsa_phylink_to_port(config);
-+ struct lan9303 *chip = dp->ds->priv;
-+ struct dsa_switch *ds = dp->ds;
-+ int port = dp->index;
- u32 ctl;
- u32 reg;
-
-@@ -1330,6 +1345,12 @@ static void lan9303_phylink_mac_link_up(struct dsa_switch *ds, int port,
- regmap_write(chip->regmap, flow_ctl_reg[port], reg);
- }
-
-+static const struct phylink_mac_ops lan9303_phylink_mac_ops = {
-+ .mac_config = lan9303_phylink_mac_config,
-+ .mac_link_down = lan9303_phylink_mac_link_down,
-+ .mac_link_up = lan9303_phylink_mac_link_up,
-+};
-+
- static const struct dsa_switch_ops lan9303_switch_ops = {
- .get_tag_protocol = lan9303_get_tag_protocol,
- .setup = lan9303_setup,
-@@ -1337,7 +1358,6 @@ static const struct dsa_switch_ops lan9303_switch_ops = {
- .phy_read = lan9303_phy_read,
- .phy_write = lan9303_phy_write,
- .phylink_get_caps = lan9303_phylink_get_caps,
-- .phylink_mac_link_up = lan9303_phylink_mac_link_up,
- .get_ethtool_stats = lan9303_get_ethtool_stats,
- .get_sset_count = lan9303_get_sset_count,
- .port_enable = lan9303_port_enable,
-@@ -1365,6 +1385,7 @@ static int lan9303_register_switch(struct lan9303 *chip)
- chip->ds->num_ports = LAN9303_NUM_PORTS;
- chip->ds->priv = chip;
- chip->ds->ops = &lan9303_switch_ops;
-+ chip->ds->phylink_mac_ops = &lan9303_phylink_mac_ops;
- base = chip->phy_addr_base;
- chip->ds->phys_mii_mask = GENMASK(LAN9303_NUM_PORTS - 1 + base, base);
-
---
-2.43.0
-
cachefiles-wait-for-ondemand_object_worker-to-finish.patch
cachefiles-cyclic-allocation-of-msg_id-to-avoid-reus.patch
cachefiles-add-missing-lock-protection-when-polling.patch
-net-dsa-introduce-dsa_phylink_to_port.patch
-net-dsa-allow-dsa-switch-drivers-to-provide-their-ow.patch
-net-dsa-lan9303-provide-own-phylink-mac-operations.patch
dsa-lan9303-fix-mapping-between-dsa-port-number-and-.patch
filelock-fix-potential-use-after-free-in-posix_lock_.patch
fs-dcache-re-use-value-stored-to-dentry-d_flags-inst.patch