Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: dsa: felix: provide own phylink MAC operations

Convert felix to provide its own phylink MAC operations, thus
avoiding the shim layer in DSA's port.c.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/E1sByYA-00EM0y-Jn@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Russell King (Oracle) and committed by
Jakub Kicinski
ef0e51dc bbb31b7a

+40 -18
+36 -18
drivers/net/dsa/ocelot/felix.c
··· 1050 1050 config->supported_interfaces); 1051 1051 } 1052 1052 1053 - static void felix_phylink_mac_config(struct dsa_switch *ds, int port, 1053 + static void felix_phylink_mac_config(struct phylink_config *config, 1054 1054 unsigned int mode, 1055 1055 const struct phylink_link_state *state) 1056 1056 { 1057 - struct ocelot *ocelot = ds->priv; 1058 - struct felix *felix = ocelot_to_felix(ocelot); 1057 + struct dsa_port *dp = dsa_phylink_to_port(config); 1058 + struct ocelot *ocelot = dp->ds->priv; 1059 + int port = dp->index; 1060 + struct felix *felix; 1061 + 1062 + felix = ocelot_to_felix(ocelot); 1059 1063 1060 1064 if (felix->info->phylink_mac_config) 1061 1065 felix->info->phylink_mac_config(ocelot, port, mode, state); 1062 1066 } 1063 1067 1064 - static struct phylink_pcs *felix_phylink_mac_select_pcs(struct dsa_switch *ds, 1065 - int port, 1066 - phy_interface_t iface) 1068 + static struct phylink_pcs * 1069 + felix_phylink_mac_select_pcs(struct phylink_config *config, 1070 + phy_interface_t iface) 1067 1071 { 1068 - struct ocelot *ocelot = ds->priv; 1069 - struct felix *felix = ocelot_to_felix(ocelot); 1072 + struct dsa_port *dp = dsa_phylink_to_port(config); 1073 + struct ocelot *ocelot = dp->ds->priv; 1070 1074 struct phylink_pcs *pcs = NULL; 1075 + int port = dp->index; 1076 + struct felix *felix; 1077 + 1078 + felix = ocelot_to_felix(ocelot); 1071 1079 1072 1080 if (felix->pcs && felix->pcs[port]) 1073 1081 pcs = felix->pcs[port]; ··· 1083 1075 return pcs; 1084 1076 } 1085 1077 1086 - static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port, 1078 + static void felix_phylink_mac_link_down(struct phylink_config *config, 1087 1079 unsigned int link_an_mode, 1088 1080 phy_interface_t interface) 1089 1081 { 1090 - struct ocelot *ocelot = ds->priv; 1082 + struct dsa_port *dp = dsa_phylink_to_port(config); 1083 + struct ocelot *ocelot = dp->ds->priv; 1084 + int port = dp->index; 1091 1085 struct felix *felix; 1092 1086 1093 1087 felix = ocelot_to_felix(ocelot); ··· 1098 1088 felix->info->quirks); 1099 1089 } 1100 1090 1101 - static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, 1091 + static void felix_phylink_mac_link_up(struct phylink_config *config, 1092 + struct phy_device *phydev, 1102 1093 unsigned int link_an_mode, 1103 1094 phy_interface_t interface, 1104 - struct phy_device *phydev, 1105 1095 int speed, int duplex, 1106 1096 bool tx_pause, bool rx_pause) 1107 1097 { 1108 - struct ocelot *ocelot = ds->priv; 1109 - struct felix *felix = ocelot_to_felix(ocelot); 1098 + struct dsa_port *dp = dsa_phylink_to_port(config); 1099 + struct ocelot *ocelot = dp->ds->priv; 1100 + int port = dp->index; 1101 + struct felix *felix; 1102 + 1103 + felix = ocelot_to_felix(ocelot); 1110 1104 1111 1105 ocelot_phylink_mac_link_up(ocelot, port, phydev, link_an_mode, 1112 1106 interface, speed, duplex, tx_pause, rx_pause, ··· 2097 2083 ocelot_port_get_mm_stats(ocelot, port, stats); 2098 2084 } 2099 2085 2086 + const struct phylink_mac_ops felix_phylink_mac_ops = { 2087 + .mac_select_pcs = felix_phylink_mac_select_pcs, 2088 + .mac_config = felix_phylink_mac_config, 2089 + .mac_link_down = felix_phylink_mac_link_down, 2090 + .mac_link_up = felix_phylink_mac_link_up, 2091 + }; 2092 + EXPORT_SYMBOL_GPL(felix_phylink_mac_ops); 2093 + 2100 2094 const struct dsa_switch_ops felix_switch_ops = { 2101 2095 .get_tag_protocol = felix_get_tag_protocol, 2102 2096 .change_tag_protocol = felix_change_tag_protocol, ··· 2126 2104 .get_sset_count = felix_get_sset_count, 2127 2105 .get_ts_info = felix_get_ts_info, 2128 2106 .phylink_get_caps = felix_phylink_get_caps, 2129 - .phylink_mac_config = felix_phylink_mac_config, 2130 - .phylink_mac_select_pcs = felix_phylink_mac_select_pcs, 2131 - .phylink_mac_link_down = felix_phylink_mac_link_down, 2132 - .phylink_mac_link_up = felix_phylink_mac_link_up, 2133 2107 .port_enable = felix_port_enable, 2134 2108 .port_fast_age = felix_port_fast_age, 2135 2109 .port_fdb_dump = felix_fdb_dump,
+1
drivers/net/dsa/ocelot/felix.h
··· 82 82 struct netlink_ext_ack *extack); 83 83 }; 84 84 85 + extern const struct phylink_mac_ops felix_phylink_mac_ops; 85 86 extern const struct dsa_switch_ops felix_switch_ops; 86 87 87 88 /* DSA glue / front-end for struct ocelot */
+1
drivers/net/dsa/ocelot/felix_vsc9959.c
··· 2717 2717 ds->num_ports = felix->info->num_ports; 2718 2718 ds->num_tx_queues = felix->info->num_tx_queues; 2719 2719 ds->ops = &felix_switch_ops; 2720 + ds->phylink_mac_ops = &felix_phylink_mac_ops; 2720 2721 ds->priv = ocelot; 2721 2722 felix->ds = ds; 2722 2723 felix->tag_proto = DSA_TAG_PROTO_OCELOT;
+1
drivers/net/dsa/ocelot/ocelot_ext.c
··· 96 96 ds->num_tx_queues = felix->info->num_tx_queues; 97 97 98 98 ds->ops = &felix_switch_ops; 99 + ds->phylink_mac_ops = &felix_phylink_mac_ops; 99 100 ds->priv = ocelot; 100 101 felix->ds = ds; 101 102 felix->tag_proto = DSA_TAG_PROTO_OCELOT;
+1
drivers/net/dsa/ocelot/seville_vsc9953.c
··· 1009 1009 ds->dev = &pdev->dev; 1010 1010 ds->num_ports = felix->info->num_ports; 1011 1011 ds->ops = &felix_switch_ops; 1012 + ds->phylink_mac_ops = &felix_phylink_mac_ops; 1012 1013 ds->priv = ocelot; 1013 1014 felix->ds = ds; 1014 1015 felix->tag_proto = DSA_TAG_PROTO_SEVILLE;