kernel: bump 5.15 to 5.15.115
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 703-03-v5.16-net-dsa-populate-supported_interfaces-member.patch
1 From c07c6e8eb4b38bae921f9e2f108d1e7f8e14226e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= <kabel@kernel.org>
3 Date: Thu, 28 Oct 2021 18:00:14 +0100
4 Subject: [PATCH] net: dsa: populate supported_interfaces member
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Add a new DSA switch operation, phylink_get_interfaces, which should
10 fill in which PHY_INTERFACE_MODE_* are supported by given port.
11
12 Use this before phylink_create() to fill phylinks supported_interfaces
13 member, allowing phylink to determine which PHY_INTERFACE_MODEs are
14 supported.
15
16 Signed-off-by: Marek BehĂșn <kabel@kernel.org>
17 [tweaked patch and description to add more complete support -- rmk]
18 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
19 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
20 Signed-off-by: David S. Miller <davem@davemloft.net>
21 ---
22 include/net/dsa.h | 2 ++
23 net/dsa/port.c | 4 ++++
24 net/dsa/slave.c | 4 ++++
25 3 files changed, 10 insertions(+)
26
27 --- a/include/net/dsa.h
28 +++ b/include/net/dsa.h
29 @@ -654,6 +654,8 @@ struct dsa_switch_ops {
30 /*
31 * PHYLINK integration
32 */
33 + void (*phylink_get_interfaces)(struct dsa_switch *ds, int port,
34 + unsigned long *supported_interfaces);
35 void (*phylink_validate)(struct dsa_switch *ds, int port,
36 unsigned long *supported,
37 struct phylink_link_state *state);
38 --- a/net/dsa/port.c
39 +++ b/net/dsa/port.c
40 @@ -1188,6 +1188,10 @@ static int dsa_port_phylink_register(str
41 dp->pl_config.type = PHYLINK_DEV;
42 dp->pl_config.pcs_poll = ds->pcs_poll;
43
44 + if (ds->ops->phylink_get_interfaces)
45 + ds->ops->phylink_get_interfaces(ds, dp->index,
46 + dp->pl_config.supported_interfaces);
47 +
48 dp->pl = phylink_create(&dp->pl_config, of_fwnode_handle(port_dn),
49 mode, &dsa_port_phylink_mac_ops);
50 if (IS_ERR(dp->pl)) {
51 --- a/net/dsa/slave.c
52 +++ b/net/dsa/slave.c
53 @@ -1837,6 +1837,10 @@ static int dsa_slave_phy_setup(struct ne
54 dp->pl_config.poll_fixed_state = true;
55 }
56
57 + if (ds->ops->phylink_get_interfaces)
58 + ds->ops->phylink_get_interfaces(ds, dp->index,
59 + dp->pl_config.supported_interfaces);
60 +
61 dp->pl = phylink_create(&dp->pl_config, of_fwnode_handle(port_dn), mode,
62 &dsa_port_phylink_mac_ops);
63 if (IS_ERR(dp->pl)) {