Lines Matching defs:ds

1617 static void ksz_phylink_get_caps(struct dsa_switch *ds, int port,
1620 struct ksz_device *dev = ds->priv;
1744 static void ksz_get_stats64(struct dsa_switch *ds, int port,
1747 struct ksz_device *dev = ds->priv;
1757 static void ksz_get_pause_stats(struct dsa_switch *ds, int port,
1760 struct ksz_device *dev = ds->priv;
1770 static void ksz_get_strings(struct dsa_switch *ds, int port,
1773 struct ksz_device *dev = ds->priv;
1788 struct dsa_switch *ds = dev->ds;
1793 if (!dsa_is_user_port(ds, port))
1796 dp = dsa_to_port(ds, port);
1797 cpu_port = BIT(dsa_upstream_port(ds, port));
1799 for (i = 0; i < ds->num_ports; i++) {
1800 const struct dsa_port *other_dp = dsa_to_port(ds, i);
1804 if (!dsa_is_user_port(ds, i))
1819 for (j = 0; j < ds->num_ports; j++) {
1827 if (!dsa_is_user_port(ds, j))
1832 third_dp = dsa_to_port(ds, j);
1866 struct dsa_switch *ds = dev->ds;
1872 if (BIT(phy) & ds->phys_mii_mask) {
1879 ds->slave_mii_bus->irq[phy] = irq;
1885 if (BIT(phy) & ds->phys_mii_mask)
1886 irq_dispose_mapping(ds->slave_mii_bus->irq[phy]);
1893 struct dsa_switch *ds = dev->ds;
1897 if (BIT(phy) & ds->phys_mii_mask)
1898 irq_dispose_mapping(ds->slave_mii_bus->irq[phy]);
1903 struct dsa_switch *ds = dev->ds;
1912 bus = devm_mdiobus_alloc(ds->dev);
1922 snprintf(bus->id, MII_BUS_ID_SIZE, "SMI-%d", ds->index);
1923 bus->parent = ds->dev;
1924 bus->phy_mask = ~ds->phys_mii_mask;
1926 ds->slave_mii_bus = bus;
1936 ret = devm_of_mdiobus_register(ds->dev, bus, mdio_np);
1938 dev_err(ds->dev, "unable to register MDIO bus %s\n",
2106 static int ksz_setup(struct dsa_switch *ds)
2108 struct ksz_device *dev = ds->priv;
2123 dev_err(ds->dev, "failed to reset switch\n");
2133 dev->dev_ops->config_cpu_port(ds);
2137 ds->num_tx_queues = dev->info->num_tx_queues;
2144 ds->configure_vlan_while_not_filtering = false;
2147 ret = dev->dev_ops->setup(ds);
2165 dsa_switch_for_each_user_port(dp, dev->ds) {
2170 ret = ksz_ptp_irq_setup(ds, dp->index);
2176 ret = ksz_ptp_clock_register(ds);
2195 ksz_ptp_clock_unregister(ds);
2198 dsa_switch_for_each_user_port(dp, dev->ds)
2199 ksz_ptp_irq_free(ds, dp->index);
2202 dsa_switch_for_each_user_port(dp, dev->ds)
2211 static void ksz_teardown(struct dsa_switch *ds)
2213 struct ksz_device *dev = ds->priv;
2216 ksz_ptp_clock_unregister(ds);
2219 dsa_switch_for_each_user_port(dp, dev->ds) {
2220 ksz_ptp_irq_free(ds, dp->index);
2229 dev->dev_ops->teardown(ds);
2265 if (dsa_is_unused_port(dev->ds, i))
2276 const struct dsa_port *dp = dsa_to_port(dev->ds, i);
2309 static int ksz_phy_read16(struct dsa_switch *ds, int addr, int reg)
2311 struct ksz_device *dev = ds->priv;
2322 static int ksz_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val)
2324 struct ksz_device *dev = ds->priv;
2334 static u32 ksz_get_phy_flags(struct dsa_switch *ds, int port)
2336 struct ksz_device *dev = ds->priv;
2364 static void ksz_mac_link_down(struct dsa_switch *ds, int port,
2367 struct ksz_device *dev = ds->priv;
2377 static int ksz_sset_count(struct dsa_switch *ds, int port, int sset)
2379 struct ksz_device *dev = ds->priv;
2387 static void ksz_get_ethtool_stats(struct dsa_switch *ds, int port,
2390 const struct dsa_port *dp = dsa_to_port(ds, port);
2391 struct ksz_device *dev = ds->priv;
2405 static int ksz_port_bridge_join(struct dsa_switch *ds, int port,
2417 static void ksz_port_bridge_leave(struct dsa_switch *ds, int port,
2425 static void ksz_port_fast_age(struct dsa_switch *ds, int port)
2427 struct ksz_device *dev = ds->priv;
2432 static int ksz_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
2434 struct ksz_device *dev = ds->priv;
2442 static int ksz_port_fdb_add(struct dsa_switch *ds, int port,
2446 struct ksz_device *dev = ds->priv;
2454 static int ksz_port_fdb_del(struct dsa_switch *ds, int port,
2458 struct ksz_device *dev = ds->priv;
2466 static int ksz_port_fdb_dump(struct dsa_switch *ds, int port,
2469 struct ksz_device *dev = ds->priv;
2477 static int ksz_port_mdb_add(struct dsa_switch *ds, int port,
2481 struct ksz_device *dev = ds->priv;
2489 static int ksz_port_mdb_del(struct dsa_switch *ds, int port,
2493 struct ksz_device *dev = ds->priv;
2501 static int ksz_enable_port(struct dsa_switch *ds, int port,
2504 struct ksz_device *dev = ds->priv;
2506 if (!dsa_is_user_port(ds, port))
2519 void ksz_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
2521 struct ksz_device *dev = ds->priv;
2554 dev_err(ds->dev, "invalid STP state: %d\n", state);
2565 static int ksz_port_pre_bridge_flags(struct dsa_switch *ds, int port,
2575 static int ksz_port_bridge_flags(struct dsa_switch *ds, int port,
2579 struct ksz_device *dev = ds->priv;
2586 ksz_port_stp_state_set(ds, port, p->stp_state);
2592 static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds,
2596 struct ksz_device *dev = ds->priv;
2622 static int ksz_connect_tag_protocol(struct dsa_switch *ds,
2633 tagger_data = ksz_tagger_data(ds);
2641 static int ksz_port_vlan_filtering(struct dsa_switch *ds, int port,
2644 struct ksz_device *dev = ds->priv;
2652 static int ksz_port_vlan_add(struct dsa_switch *ds, int port,
2656 struct ksz_device *dev = ds->priv;
2664 static int ksz_port_vlan_del(struct dsa_switch *ds, int port,
2667 struct ksz_device *dev = ds->priv;
2675 static int ksz_port_mirror_add(struct dsa_switch *ds, int port,
2679 struct ksz_device *dev = ds->priv;
2687 static void ksz_port_mirror_del(struct dsa_switch *ds, int port,
2690 struct ksz_device *dev = ds->priv;
2696 static int ksz_change_mtu(struct dsa_switch *ds, int port, int mtu)
2698 struct ksz_device *dev = ds->priv;
2706 static int ksz_max_mtu(struct dsa_switch *ds, int port)
2708 struct ksz_device *dev = ds->priv;
2735 static int ksz_validate_eee(struct dsa_switch *ds, int port)
2737 struct ksz_device *dev = ds->priv;
2756 static int ksz_get_mac_eee(struct dsa_switch *ds, int port,
2761 ret = ksz_validate_eee(ds, port);
2776 static int ksz_set_mac_eee(struct dsa_switch *ds, int port,
2779 struct ksz_device *dev = ds->priv;
2782 ret = ksz_validate_eee(ds, port);
2882 static void ksz_phylink_mac_config(struct dsa_switch *ds, int port,
2886 struct ksz_device *dev = ds->priv;
3024 static void ksz_phylink_mac_link_up(struct dsa_switch *ds, int port,
3030 struct ksz_device *dev = ds->priv;
3161 static int ksz_setup_tc_cbs(struct dsa_switch *ds, int port,
3164 struct ksz_device *dev = ds->priv;
3386 static int ksz_tc_setup_qdisc_ets(struct dsa_switch *ds, int port,
3389 struct ksz_device *dev = ds->priv;
3417 static int ksz_setup_tc(struct dsa_switch *ds, int port,
3422 return ksz_setup_tc_cbs(ds, port, type_data);
3424 return ksz_tc_setup_qdisc_ets(ds, port, type_data);
3479 struct dsa_switch *ds;
3482 ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL);
3483 if (!ds)
3486 ds->dev = base;
3487 ds->num_ports = DSA_MAX_PORTS;
3488 ds->ops = &ksz_switch_ops;
3494 ds->priv = swdev;
3497 swdev->ds = ds;
3615 dev->ds->num_ports = dev->info->port_cnt;
3656 ret = dsa_register_switch(dev->ds);
3681 dsa_unregister_switch(dev->ds);