Lines Matching +full:ps +full:- +full:speed
1 // SPDX-License-Identifier: GPL-2.0-or-later
37 struct dsa_loop_priv *ps = priv; in dsa_loop_devlink_vtu_get() local
41 for (i = 0; i < ARRAY_SIZE(ps->vlans); i++) { in dsa_loop_devlink_vtu_get()
42 vl = &ps->vlans[i]; in dsa_loop_devlink_vtu_get()
43 if (vl->members) in dsa_loop_devlink_vtu_get()
53 struct dsa_loop_priv *ps = ds->priv; in dsa_loop_setup_devlink_resources() local
56 devlink_resource_size_params_init(&size_params, ARRAY_SIZE(ps->vlans), in dsa_loop_setup_devlink_resources()
57 ARRAY_SIZE(ps->vlans), in dsa_loop_setup_devlink_resources()
60 err = dsa_devlink_resource_register(ds, "VTU", ARRAY_SIZE(ps->vlans), in dsa_loop_setup_devlink_resources()
69 dsa_loop_devlink_vtu_get, ps); in dsa_loop_setup_devlink_resources()
82 dev_dbg(ds->dev, "%s: port: %d\n", __func__, port); in dsa_loop_get_protocol()
89 struct dsa_loop_priv *ps = ds->priv; in dsa_loop_setup() local
92 for (i = 0; i < ds->num_ports; i++) in dsa_loop_setup()
93 memcpy(ps->ports[i].mib, dsa_loop_mibs, in dsa_loop_setup()
96 dev_dbg(ds->dev, "%s\n", __func__); in dsa_loop_setup()
117 struct dsa_loop_priv *ps = ds->priv; in dsa_loop_get_strings() local
125 ps->ports[port].mib[i].name, ETH_GSTRING_LEN); in dsa_loop_get_strings()
131 struct dsa_loop_priv *ps = ds->priv; in dsa_loop_get_ethtool_stats() local
135 data[i] = ps->ports[port].mib[i].val; in dsa_loop_get_ethtool_stats()
140 struct dsa_loop_priv *ps = ds->priv; in dsa_loop_phy_read() local
141 struct mii_bus *bus = ps->bus; in dsa_loop_phy_read()
144 ret = mdiobus_read_nested(bus, ps->port_base + port, regnum); in dsa_loop_phy_read()
146 ps->ports[port].mib[DSA_LOOP_PHY_READ_ERR].val++; in dsa_loop_phy_read()
148 ps->ports[port].mib[DSA_LOOP_PHY_READ_OK].val++; in dsa_loop_phy_read()
156 struct dsa_loop_priv *ps = ds->priv; in dsa_loop_phy_write() local
157 struct mii_bus *bus = ps->bus; in dsa_loop_phy_write()
160 ret = mdiobus_write_nested(bus, ps->port_base + port, regnum, value); in dsa_loop_phy_write()
162 ps->ports[port].mib[DSA_LOOP_PHY_WRITE_ERR].val++; in dsa_loop_phy_write()
164 ps->ports[port].mib[DSA_LOOP_PHY_WRITE_OK].val++; in dsa_loop_phy_write()
174 dev_dbg(ds->dev, "%s: port: %d, bridge: %s\n", in dsa_loop_port_bridge_join()
175 __func__, port, bridge.dev->name); in dsa_loop_port_bridge_join()
183 dev_dbg(ds->dev, "%s: port: %d, bridge: %s\n", in dsa_loop_port_bridge_leave()
184 __func__, port, bridge.dev->name); in dsa_loop_port_bridge_leave()
190 dev_dbg(ds->dev, "%s: port: %d, state: %d\n", in dsa_loop_port_stp_state_set()
198 dev_dbg(ds->dev, "%s: port: %d, vlan_filtering: %d\n", in dsa_loop_port_vlan_filtering()
208 bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; in dsa_loop_port_vlan_add()
209 bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID; in dsa_loop_port_vlan_add()
210 struct dsa_loop_priv *ps = ds->priv; in dsa_loop_port_vlan_add() local
211 struct mii_bus *bus = ps->bus; in dsa_loop_port_vlan_add()
214 if (vlan->vid >= ARRAY_SIZE(ps->vlans)) in dsa_loop_port_vlan_add()
215 return -ERANGE; in dsa_loop_port_vlan_add()
218 mdiobus_read(bus, ps->port_base + port, MII_BMSR); in dsa_loop_port_vlan_add()
220 vl = &ps->vlans[vlan->vid]; in dsa_loop_port_vlan_add()
222 vl->members |= BIT(port); in dsa_loop_port_vlan_add()
224 vl->untagged |= BIT(port); in dsa_loop_port_vlan_add()
226 vl->untagged &= ~BIT(port); in dsa_loop_port_vlan_add()
228 dev_dbg(ds->dev, "%s: port: %d vlan: %d, %stagged, pvid: %d\n", in dsa_loop_port_vlan_add()
229 __func__, port, vlan->vid, untagged ? "un" : "", pvid); in dsa_loop_port_vlan_add()
232 ps->ports[port].pvid = vlan->vid; in dsa_loop_port_vlan_add()
240 bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; in dsa_loop_port_vlan_del()
241 struct dsa_loop_priv *ps = ds->priv; in dsa_loop_port_vlan_del() local
242 u16 pvid = ps->ports[port].pvid; in dsa_loop_port_vlan_del()
243 struct mii_bus *bus = ps->bus; in dsa_loop_port_vlan_del()
247 mdiobus_read(bus, ps->port_base + port, MII_BMSR); in dsa_loop_port_vlan_del()
249 vl = &ps->vlans[vlan->vid]; in dsa_loop_port_vlan_del()
251 vl->members &= ~BIT(port); in dsa_loop_port_vlan_del()
253 vl->untagged &= ~BIT(port); in dsa_loop_port_vlan_del()
255 if (pvid == vlan->vid) in dsa_loop_port_vlan_del()
258 dev_dbg(ds->dev, "%s: port: %d vlan: %d, %stagged, pvid: %d\n", in dsa_loop_port_vlan_del()
259 __func__, port, vlan->vid, untagged ? "un" : "", pvid); in dsa_loop_port_vlan_del()
260 ps->ports[port].pvid = pvid; in dsa_loop_port_vlan_del()
268 struct dsa_loop_priv *priv = ds->priv; in dsa_loop_port_change_mtu()
270 priv->ports[port].mtu = new_mtu; in dsa_loop_port_change_mtu()
283 bitmap_fill(config->supported_interfaces, PHY_INTERFACE_MODE_MAX); in dsa_loop_phylink_get_caps()
284 __clear_bit(PHY_INTERFACE_MODE_NA, config->supported_interfaces); in dsa_loop_phylink_get_caps()
285 config->mac_capabilities = ~0; in dsa_loop_phylink_get_caps()
311 struct dsa_loop_pdata *pdata = mdiodev->dev.platform_data; in dsa_loop_drv_probe()
312 struct dsa_loop_priv *ps; in dsa_loop_drv_probe() local
317 return -ENODEV; in dsa_loop_drv_probe()
319 ds = devm_kzalloc(&mdiodev->dev, sizeof(*ds), GFP_KERNEL); in dsa_loop_drv_probe()
321 return -ENOMEM; in dsa_loop_drv_probe()
323 ds->dev = &mdiodev->dev; in dsa_loop_drv_probe()
324 ds->num_ports = DSA_LOOP_NUM_PORTS; in dsa_loop_drv_probe()
326 ps = devm_kzalloc(&mdiodev->dev, sizeof(*ps), GFP_KERNEL); in dsa_loop_drv_probe()
327 if (!ps) in dsa_loop_drv_probe()
328 return -ENOMEM; in dsa_loop_drv_probe()
330 ps->netdev = dev_get_by_name(&init_net, pdata->netdev); in dsa_loop_drv_probe()
331 if (!ps->netdev) in dsa_loop_drv_probe()
332 return -EPROBE_DEFER; in dsa_loop_drv_probe()
334 pdata->cd.netdev[DSA_LOOP_CPU_PORT] = &ps->netdev->dev; in dsa_loop_drv_probe()
336 ds->dev = &mdiodev->dev; in dsa_loop_drv_probe()
337 ds->ops = &dsa_loop_driver; in dsa_loop_drv_probe()
338 ds->priv = ps; in dsa_loop_drv_probe()
339 ps->bus = mdiodev->bus; in dsa_loop_drv_probe()
341 dev_set_drvdata(&mdiodev->dev, ds); in dsa_loop_drv_probe()
345 dev_info(&mdiodev->dev, "%s: 0x%0x\n", in dsa_loop_drv_probe()
346 pdata->name, pdata->enabled_ports); in dsa_loop_drv_probe()
353 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); in dsa_loop_drv_remove()
354 struct dsa_loop_priv *ps; in dsa_loop_drv_remove() local
359 ps = ds->priv; in dsa_loop_drv_remove()
362 dev_put(ps->netdev); in dsa_loop_drv_remove()
367 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); in dsa_loop_drv_shutdown()
374 dev_set_drvdata(&mdiodev->dev, NULL); in dsa_loop_drv_shutdown()
379 .name = "dsa-loop",
386 #define NUM_FIXED_PHYS (DSA_LOOP_NUM_PORTS - 2)
403 .speed = SPEED_100, in dsa_loop_init()