Lines Matching refs:ds
29 struct dsa_switch *ds = bus->priv; in dsa_slave_phy_read() local
31 if (ds->phys_mii_mask & (1 << addr)) in dsa_slave_phy_read()
32 return ds->ops->phy_read(ds, addr, reg); in dsa_slave_phy_read()
39 struct dsa_switch *ds = bus->priv; in dsa_slave_phy_write() local
41 if (ds->phys_mii_mask & (1 << addr)) in dsa_slave_phy_write()
42 return ds->ops->phy_write(ds, addr, reg, val); in dsa_slave_phy_write()
47 void dsa_slave_mii_bus_init(struct dsa_switch *ds) in dsa_slave_mii_bus_init() argument
49 ds->slave_mii_bus->priv = (void *)ds; in dsa_slave_mii_bus_init()
50 ds->slave_mii_bus->name = "dsa slave smi"; in dsa_slave_mii_bus_init()
51 ds->slave_mii_bus->read = dsa_slave_phy_read; in dsa_slave_mii_bus_init()
52 ds->slave_mii_bus->write = dsa_slave_phy_write; in dsa_slave_mii_bus_init()
53 snprintf(ds->slave_mii_bus->id, MII_BUS_ID_SIZE, "dsa-%d.%d", in dsa_slave_mii_bus_init()
54 ds->dst->index, ds->index); in dsa_slave_mii_bus_init()
55 ds->slave_mii_bus->parent = ds->dev; in dsa_slave_mii_bus_init()
56 ds->slave_mii_bus->phy_mask = ~ds->phys_mii_mask; in dsa_slave_mii_bus_init()
256 struct dsa_switch *ds = p->dp->ds; in dsa_slave_ioctl() local
262 if (ds->ops->port_hwtstamp_get) in dsa_slave_ioctl()
263 return ds->ops->port_hwtstamp_get(ds, port, ifr); in dsa_slave_ioctl()
266 if (ds->ops->port_hwtstamp_set) in dsa_slave_ioctl()
267 return ds->ops->port_hwtstamp_set(ds, port, ifr); in dsa_slave_ioctl()
522 struct dsa_switch *ds = dp->ds; in dsa_slave_get_port_parent_id() local
523 struct dsa_switch_tree *dst = ds->dst; in dsa_slave_get_port_parent_id()
529 if (dp->ds->devlink) in dsa_slave_get_port_parent_id()
554 struct dsa_switch *ds = p->dp->ds; in dsa_skb_tx_timestamp() local
559 if (!ds->ops->port_txtstamp) in dsa_skb_tx_timestamp()
562 ds->ops->port_txtstamp(ds, p->dp->index, skb); in dsa_skb_tx_timestamp()
655 struct dsa_switch *ds = dp->ds; in dsa_slave_get_regs_len() local
657 if (ds->ops->get_regs_len) in dsa_slave_get_regs_len()
658 return ds->ops->get_regs_len(ds, dp->index); in dsa_slave_get_regs_len()
667 struct dsa_switch *ds = dp->ds; in dsa_slave_get_regs() local
669 if (ds->ops->get_regs) in dsa_slave_get_regs()
670 ds->ops->get_regs(ds, dp->index, regs, _p); in dsa_slave_get_regs()
683 struct dsa_switch *ds = dp->ds; in dsa_slave_get_eeprom_len() local
685 if (ds->cd && ds->cd->eeprom_len) in dsa_slave_get_eeprom_len()
686 return ds->cd->eeprom_len; in dsa_slave_get_eeprom_len()
688 if (ds->ops->get_eeprom_len) in dsa_slave_get_eeprom_len()
689 return ds->ops->get_eeprom_len(ds); in dsa_slave_get_eeprom_len()
698 struct dsa_switch *ds = dp->ds; in dsa_slave_get_eeprom() local
700 if (ds->ops->get_eeprom) in dsa_slave_get_eeprom()
701 return ds->ops->get_eeprom(ds, eeprom, data); in dsa_slave_get_eeprom()
710 struct dsa_switch *ds = dp->ds; in dsa_slave_set_eeprom() local
712 if (ds->ops->set_eeprom) in dsa_slave_set_eeprom()
713 return ds->ops->set_eeprom(ds, eeprom, data); in dsa_slave_set_eeprom()
722 struct dsa_switch *ds = dp->ds; in dsa_slave_get_strings() local
731 if (ds->ops->get_strings) in dsa_slave_get_strings()
732 ds->ops->get_strings(ds, dp->index, stringset, in dsa_slave_get_strings()
745 struct dsa_switch *ds = dp->ds; in dsa_slave_get_ethtool_stats() local
766 if (ds->ops->get_ethtool_stats) in dsa_slave_get_ethtool_stats()
767 ds->ops->get_ethtool_stats(ds, dp->index, data + 4); in dsa_slave_get_ethtool_stats()
773 struct dsa_switch *ds = dp->ds; in dsa_slave_get_sset_count() local
778 if (ds->ops->get_sset_count) { in dsa_slave_get_sset_count()
779 count = ds->ops->get_sset_count(ds, dp->index, sset); in dsa_slave_get_sset_count()
796 struct dsa_switch *ds = dp->ds; in dsa_slave_net_selftest() local
798 if (ds->ops->self_test) { in dsa_slave_net_selftest()
799 ds->ops->self_test(ds, dp->index, etest, buf); in dsa_slave_net_selftest()
809 struct dsa_switch *ds = dp->ds; in dsa_slave_get_wol() local
813 if (ds->ops->get_wol) in dsa_slave_get_wol()
814 ds->ops->get_wol(ds, dp->index, w); in dsa_slave_get_wol()
820 struct dsa_switch *ds = dp->ds; in dsa_slave_set_wol() local
825 if (ds->ops->set_wol) in dsa_slave_set_wol()
826 ret = ds->ops->set_wol(ds, dp->index, w); in dsa_slave_set_wol()
834 struct dsa_switch *ds = dp->ds; in dsa_slave_set_eee() local
841 if (!ds->ops->set_mac_eee) in dsa_slave_set_eee()
844 ret = ds->ops->set_mac_eee(ds, dp->index, e); in dsa_slave_set_eee()
854 struct dsa_switch *ds = dp->ds; in dsa_slave_get_eee() local
861 if (!ds->ops->get_mac_eee) in dsa_slave_get_eee()
864 ret = ds->ops->get_mac_eee(ds, dp->index, e); in dsa_slave_get_eee()
954 if (dp->ds->devlink) in dsa_slave_get_phys_port_name()
985 struct dsa_switch *ds = dp->ds; in dsa_slave_add_cls_matchall_mirred() local
990 if (!ds->ops->port_mirror_add) in dsa_slave_add_cls_matchall_mirred()
1018 err = ds->ops->port_mirror_add(ds, dp->index, mirror, ingress); in dsa_slave_add_cls_matchall_mirred()
1039 struct dsa_switch *ds = dp->ds; in dsa_slave_add_cls_matchall_police() local
1043 if (!ds->ops->port_policer_add) { in dsa_slave_add_cls_matchall_police()
1079 err = ds->ops->port_policer_add(ds, dp->index, policer); in dsa_slave_add_cls_matchall_police()
1112 struct dsa_switch *ds = dp->ds; in dsa_slave_del_cls_matchall() local
1122 if (ds->ops->port_mirror_del) in dsa_slave_del_cls_matchall()
1123 ds->ops->port_mirror_del(ds, dp->index, in dsa_slave_del_cls_matchall()
1127 if (ds->ops->port_policer_del) in dsa_slave_del_cls_matchall()
1128 ds->ops->port_policer_del(ds, dp->index); in dsa_slave_del_cls_matchall()
1160 struct dsa_switch *ds = dp->ds; in dsa_slave_add_cls_flower() local
1163 if (!ds->ops->cls_flower_add) in dsa_slave_add_cls_flower()
1166 return ds->ops->cls_flower_add(ds, port, cls, ingress); in dsa_slave_add_cls_flower()
1174 struct dsa_switch *ds = dp->ds; in dsa_slave_del_cls_flower() local
1177 if (!ds->ops->cls_flower_del) in dsa_slave_del_cls_flower()
1180 return ds->ops->cls_flower_del(ds, port, cls, ingress); in dsa_slave_del_cls_flower()
1188 struct dsa_switch *ds = dp->ds; in dsa_slave_stats_cls_flower() local
1191 if (!ds->ops->cls_flower_stats) in dsa_slave_stats_cls_flower()
1194 return ds->ops->cls_flower_stats(ds, port, cls, ingress); in dsa_slave_stats_cls_flower()
1285 static int dsa_slave_setup_ft_block(struct dsa_switch *ds, int port, in dsa_slave_setup_ft_block() argument
1288 struct dsa_port *cpu_dp = dsa_to_port(ds, port)->cpu_dp; in dsa_slave_setup_ft_block()
1301 struct dsa_switch *ds = dp->ds; in dsa_slave_setup_tc() local
1307 return dsa_slave_setup_ft_block(ds, dp->index, type_data); in dsa_slave_setup_tc()
1312 if (!ds->ops->port_setup_tc) in dsa_slave_setup_tc()
1315 return ds->ops->port_setup_tc(ds, dp->index, type, type_data); in dsa_slave_setup_tc()
1322 struct dsa_switch *ds = dp->ds; in dsa_slave_get_rxnfc() local
1324 if (!ds->ops->get_rxnfc) in dsa_slave_get_rxnfc()
1327 return ds->ops->get_rxnfc(ds, dp->index, nfc, rule_locs); in dsa_slave_get_rxnfc()
1334 struct dsa_switch *ds = dp->ds; in dsa_slave_set_rxnfc() local
1336 if (!ds->ops->set_rxnfc) in dsa_slave_set_rxnfc()
1339 return ds->ops->set_rxnfc(ds, dp->index, nfc); in dsa_slave_set_rxnfc()
1346 struct dsa_switch *ds = p->dp->ds; in dsa_slave_get_ts_info() local
1348 if (!ds->ops->get_ts_info) in dsa_slave_get_ts_info()
1351 return ds->ops->get_ts_info(ds, p->dp->index, ts); in dsa_slave_get_ts_info()
1533 if (!dp->ds->mtu_enforcement_ingress) in dsa_bridge_mtu_normalization()
1555 if (!other_dp->ds->mtu_enforcement_ingress) in dsa_bridge_mtu_normalization()
1597 struct dsa_switch *ds = p->dp->ds; in dsa_slave_change_mtu() local
1608 if (!ds->ops->port_change_mtu) in dsa_slave_change_mtu()
1611 list_for_each_entry(dp_iter, &ds->dst->ports, list) { in dsa_slave_change_mtu()
1636 cpu_dp = dsa_to_port(ds, port)->cpu_dp; in dsa_slave_change_mtu()
1716 return dp->ds->devlink ? &dp->devlink_port : NULL; in dsa_slave_get_devlink_port()
1723 struct dsa_switch *ds = dp->ds; in dsa_slave_get_stats64() local
1725 if (ds->ops->get_stats64) in dsa_slave_get_stats64()
1726 ds->ops->get_stats64(ds, dp->index, s); in dsa_slave_get_stats64()
1776 void dsa_port_phylink_mac_change(struct dsa_switch *ds, int port, bool up) in dsa_port_phylink_mac_change() argument
1778 const struct dsa_port *dp = dsa_to_port(ds, port); in dsa_port_phylink_mac_change()
1789 struct dsa_switch *ds = dp->ds; in dsa_slave_phylink_fixed_state() local
1794 ds->ops->phylink_fixed_state(ds, dp->index, state); in dsa_slave_phylink_fixed_state()
1802 struct dsa_switch *ds = dp->ds; in dsa_slave_phy_connect() local
1804 slave_dev->phydev = mdiobus_get_phy(ds->slave_mii_bus, addr); in dsa_slave_phy_connect()
1819 struct dsa_switch *ds = dp->ds; in dsa_slave_phy_setup() local
1835 if (ds->ops->phylink_fixed_state) { in dsa_slave_phy_setup()
1848 if (ds->ops->get_phy_flags) in dsa_slave_phy_setup()
1849 phy_flags = ds->ops->get_phy_flags(ds, dp->index); in dsa_slave_phy_setup()
1852 if (ret == -ENODEV && ds->slave_mii_bus) { in dsa_slave_phy_setup()
1873 const struct dsa_switch *ds = dp->ds; in dsa_slave_setup_tagger() local
1891 if (ds->needs_standalone_vlan_filtering) in dsa_slave_setup_tagger()
1940 struct dsa_switch *ds = port->ds; in dsa_slave_create() local
1946 if (!ds->num_tx_queues) in dsa_slave_create()
1947 ds->num_tx_queues = 1; in dsa_slave_create()
1951 ds->num_tx_queues, 1); in dsa_slave_create()
1962 if (ds->ops->port_max_mtu) in dsa_slave_create()
1963 slave_dev->max_mtu = ds->ops->port_max_mtu(ds, port->index); in dsa_slave_create()
1969 SET_NETDEV_DEV(slave_dev, port->ds->dev); in dsa_slave_create()
1993 dev_warn(ds->dev, "nonfatal error %d setting MTU to %d on port %d\n", in dsa_slave_create()
2002 ret, ds->dst->index, ds->index, port->index); in dsa_slave_create()
2260 struct dsa_switch *ds; in dsa_slave_prechangeupper_sanity_check() local
2268 ds = dp->ds; in dsa_slave_prechangeupper_sanity_check()
2270 if (ds->ops->port_prechangeupper) { in dsa_slave_prechangeupper_sanity_check()
2271 err = ds->ops->port_prechangeupper(ds, dp->index, info); in dsa_slave_prechangeupper_sanity_check()
2334 dst = cpu_dp->ds->dst; in dsa_slave_netdevice_event()
2337 if (!dsa_is_user_port(dp->ds, dp->index)) in dsa_slave_netdevice_event()
2358 struct dsa_switch *ds = switchdev_work->ds; in dsa_fdb_offload_notify() local
2361 if (!dsa_is_user_port(ds, switchdev_work->port)) in dsa_fdb_offload_notify()
2367 dp = dsa_to_port(ds, switchdev_work->port); in dsa_fdb_offload_notify()
2376 struct dsa_switch *ds = switchdev_work->ds; in dsa_slave_switchdev_event_work() local
2380 dp = dsa_to_port(ds, switchdev_work->port); in dsa_slave_switchdev_event_work()
2392 dev_err(ds->dev, in dsa_slave_switchdev_event_work()
2409 dev_err(ds->dev, in dsa_slave_switchdev_event_work()
2427 struct dsa_switch_tree *dst = dp->ds->dst; in dsa_foreign_dev_check()
2448 struct dsa_switch *ds = dp->ds; in dsa_slave_fdb_event() local
2453 if (!ds->ops->port_fdb_add || !ds->ops->port_fdb_del) in dsa_slave_fdb_event()
2464 !ds->assisted_learning_on_cpu_port) in dsa_slave_fdb_event()
2483 switchdev_work->ds = ds; in dsa_slave_fdb_event()