Lines Matching full:ds

68 static bool dsa_switch_supports_uc_filtering(struct dsa_switch *ds)  in dsa_switch_supports_uc_filtering()  argument
70 return ds->ops->port_fdb_add && ds->ops->port_fdb_del && in dsa_switch_supports_uc_filtering()
71 ds->fdb_isolation && !ds->vlan_filtering_is_global && in dsa_switch_supports_uc_filtering()
72 !ds->needs_standalone_vlan_filtering; in dsa_switch_supports_uc_filtering()
75 static bool dsa_switch_supports_mc_filtering(struct dsa_switch *ds) in dsa_switch_supports_mc_filtering() argument
77 return ds->ops->port_mdb_add && ds->ops->port_mdb_del && in dsa_switch_supports_mc_filtering()
78 ds->fdb_isolation && !ds->vlan_filtering_is_global && in dsa_switch_supports_mc_filtering()
79 !ds->needs_standalone_vlan_filtering; in dsa_switch_supports_mc_filtering()
90 struct dsa_switch *ds = dp->ds; in dsa_user_standalone_event_work() local
98 dev_err(ds->dev, in dsa_user_standalone_event_work()
108 dev_err(ds->dev, in dsa_user_standalone_event_work()
120 dev_err(ds->dev, in dsa_user_standalone_event_work()
132 dev_err(ds->dev, in dsa_user_standalone_event_work()
209 if (!dsa_switch_supports_uc_filtering(dp->ds)) in dsa_user_sync_uc()
229 if (!dsa_switch_supports_uc_filtering(dp->ds)) in dsa_user_unsync_uc()
249 if (!dsa_switch_supports_mc_filtering(dp->ds)) in dsa_user_sync_mc()
269 if (!dsa_switch_supports_mc_filtering(dp->ds)) in dsa_user_unsync_mc()
279 struct dsa_switch *ds = dp->ds; in dsa_user_sync_ha() local
292 if (dsa_switch_supports_uc_filtering(ds) || in dsa_user_sync_ha()
293 dsa_switch_supports_mc_filtering(ds)) in dsa_user_sync_ha()
300 struct dsa_switch *ds = dp->ds; in dsa_user_unsync_ha() local
313 if (dsa_switch_supports_uc_filtering(ds) || in dsa_user_unsync_ha()
314 dsa_switch_supports_mc_filtering(ds)) in dsa_user_unsync_ha()
321 struct dsa_switch *ds = bus->priv; in dsa_user_phy_read() local
323 if (ds->phys_mii_mask & (1 << addr)) in dsa_user_phy_read()
324 return ds->ops->phy_read(ds, addr, reg); in dsa_user_phy_read()
331 struct dsa_switch *ds = bus->priv; in dsa_user_phy_write() local
333 if (ds->phys_mii_mask & (1 << addr)) in dsa_user_phy_write()
334 return ds->ops->phy_write(ds, addr, reg, val); in dsa_user_phy_write()
339 void dsa_user_mii_bus_init(struct dsa_switch *ds) in dsa_user_mii_bus_init() argument
341 ds->user_mii_bus->priv = (void *)ds; in dsa_user_mii_bus_init()
342 ds->user_mii_bus->name = "dsa user smi"; in dsa_user_mii_bus_init()
343 ds->user_mii_bus->read = dsa_user_phy_read; in dsa_user_mii_bus_init()
344 ds->user_mii_bus->write = dsa_user_phy_write; in dsa_user_mii_bus_init()
345 snprintf(ds->user_mii_bus->id, MII_BUS_ID_SIZE, "dsa-%d.%d", in dsa_user_mii_bus_init()
346 ds->dst->index, ds->index); in dsa_user_mii_bus_init()
347 ds->user_mii_bus->parent = ds->dev; in dsa_user_mii_bus_init()
348 ds->user_mii_bus->phy_mask = ~ds->phys_mii_mask; in dsa_user_mii_bus_init()
362 struct dsa_switch *ds = dp->ds; in dsa_user_open() local
371 if (dsa_switch_supports_uc_filtering(ds)) { in dsa_user_open()
393 if (dsa_switch_supports_uc_filtering(ds)) in dsa_user_open()
403 struct dsa_switch *ds = dp->ds; in dsa_user_close() local
410 if (dsa_switch_supports_uc_filtering(ds)) in dsa_user_close()
429 struct dsa_switch *ds = dp->ds; in dsa_user_change_rx_flags() local
438 if (dsa_switch_supports_uc_filtering(ds) && in dsa_user_change_rx_flags()
439 dsa_switch_supports_mc_filtering(ds)) in dsa_user_change_rx_flags()
453 struct dsa_switch *ds = dp->ds; in dsa_user_set_mac_address() local
460 if (ds->ops->port_set_mac_address) { in dsa_user_set_mac_address()
461 err = ds->ops->port_set_mac_address(ds, dp->index, in dsa_user_set_mac_address()
473 if (dsa_switch_supports_uc_filtering(ds)) { in dsa_user_set_mac_address()
488 if (dsa_switch_supports_uc_filtering(ds)) in dsa_user_set_mac_address()
497 if (dsa_switch_supports_uc_filtering(ds)) in dsa_user_set_mac_address()
577 struct dsa_switch *ds = p->dp->ds; in dsa_user_ioctl() local
583 if (ds->ops->port_hwtstamp_get) in dsa_user_ioctl()
584 return ds->ops->port_hwtstamp_get(ds, port, ifr); in dsa_user_ioctl()
587 if (ds->ops->port_hwtstamp_set) in dsa_user_ioctl()
588 return ds->ops->port_hwtstamp_set(ds, port, ifr); in dsa_user_ioctl()
894 struct dsa_switch *ds = p->dp->ds; in dsa_skb_tx_timestamp() local
899 if (!ds->ops->port_txtstamp) in dsa_skb_tx_timestamp()
902 ds->ops->port_txtstamp(ds, p->dp->index, skb); in dsa_skb_tx_timestamp()
972 struct dsa_switch *ds = dp->ds; in dsa_user_get_regs_len() local
974 if (ds->ops->get_regs_len) in dsa_user_get_regs_len()
975 return ds->ops->get_regs_len(ds, dp->index); in dsa_user_get_regs_len()
984 struct dsa_switch *ds = dp->ds; in dsa_user_get_regs() local
986 if (ds->ops->get_regs) in dsa_user_get_regs()
987 ds->ops->get_regs(ds, dp->index, regs, _p); in dsa_user_get_regs()
1000 struct dsa_switch *ds = dp->ds; in dsa_user_get_eeprom_len() local
1002 if (ds->cd && ds->cd->eeprom_len) in dsa_user_get_eeprom_len()
1003 return ds->cd->eeprom_len; in dsa_user_get_eeprom_len()
1005 if (ds->ops->get_eeprom_len) in dsa_user_get_eeprom_len()
1006 return ds->ops->get_eeprom_len(ds); in dsa_user_get_eeprom_len()
1015 struct dsa_switch *ds = dp->ds; in dsa_user_get_eeprom() local
1017 if (ds->ops->get_eeprom) in dsa_user_get_eeprom()
1018 return ds->ops->get_eeprom(ds, eeprom, data); in dsa_user_get_eeprom()
1027 struct dsa_switch *ds = dp->ds; in dsa_user_set_eeprom() local
1029 if (ds->ops->set_eeprom) in dsa_user_set_eeprom()
1030 return ds->ops->set_eeprom(ds, eeprom, data); in dsa_user_set_eeprom()
1039 struct dsa_switch *ds = dp->ds; in dsa_user_get_strings() local
1048 if (ds->ops->get_strings) in dsa_user_get_strings()
1049 ds->ops->get_strings(ds, dp->index, stringset, in dsa_user_get_strings()
1062 struct dsa_switch *ds = dp->ds; in dsa_user_get_ethtool_stats() local
1083 if (ds->ops->get_ethtool_stats) in dsa_user_get_ethtool_stats()
1084 ds->ops->get_ethtool_stats(ds, dp->index, data + 4); in dsa_user_get_ethtool_stats()
1090 struct dsa_switch *ds = dp->ds; in dsa_user_get_sset_count() local
1095 if (ds->ops->get_sset_count) { in dsa_user_get_sset_count()
1096 count = ds->ops->get_sset_count(ds, dp->index, sset); in dsa_user_get_sset_count()
1113 struct dsa_switch *ds = dp->ds; in dsa_user_get_eth_phy_stats() local
1115 if (ds->ops->get_eth_phy_stats) in dsa_user_get_eth_phy_stats()
1116 ds->ops->get_eth_phy_stats(ds, dp->index, phy_stats); in dsa_user_get_eth_phy_stats()
1123 struct dsa_switch *ds = dp->ds; in dsa_user_get_eth_mac_stats() local
1125 if (ds->ops->get_eth_mac_stats) in dsa_user_get_eth_mac_stats()
1126 ds->ops->get_eth_mac_stats(ds, dp->index, mac_stats); in dsa_user_get_eth_mac_stats()
1134 struct dsa_switch *ds = dp->ds; in dsa_user_get_eth_ctrl_stats() local
1136 if (ds->ops->get_eth_ctrl_stats) in dsa_user_get_eth_ctrl_stats()
1137 ds->ops->get_eth_ctrl_stats(ds, dp->index, ctrl_stats); in dsa_user_get_eth_ctrl_stats()
1146 struct dsa_switch *ds = dp->ds; in dsa_user_get_rmon_stats() local
1148 if (ds->ops->get_rmon_stats) in dsa_user_get_rmon_stats()
1149 ds->ops->get_rmon_stats(ds, dp->index, rmon_stats, ranges); in dsa_user_get_rmon_stats()
1156 struct dsa_switch *ds = dp->ds; in dsa_user_net_selftest() local
1158 if (ds->ops->self_test) { in dsa_user_net_selftest()
1159 ds->ops->self_test(ds, dp->index, etest, buf); in dsa_user_net_selftest()
1170 struct dsa_switch *ds = dp->ds; in dsa_user_get_mm() local
1172 if (!ds->ops->get_mm) in dsa_user_get_mm()
1175 return ds->ops->get_mm(ds, dp->index, state); in dsa_user_get_mm()
1182 struct dsa_switch *ds = dp->ds; in dsa_user_set_mm() local
1184 if (!ds->ops->set_mm) in dsa_user_set_mm()
1187 return ds->ops->set_mm(ds, dp->index, cfg, extack); in dsa_user_set_mm()
1194 struct dsa_switch *ds = dp->ds; in dsa_user_get_mm_stats() local
1196 if (ds->ops->get_mm_stats) in dsa_user_get_mm_stats()
1197 ds->ops->get_mm_stats(ds, dp->index, stats); in dsa_user_get_mm_stats()
1203 struct dsa_switch *ds = dp->ds; in dsa_user_get_wol() local
1207 if (ds->ops->get_wol) in dsa_user_get_wol()
1208 ds->ops->get_wol(ds, dp->index, w); in dsa_user_get_wol()
1214 struct dsa_switch *ds = dp->ds; in dsa_user_set_wol() local
1219 if (ds->ops->set_wol) in dsa_user_set_wol()
1220 ret = ds->ops->set_wol(ds, dp->index, w); in dsa_user_set_wol()
1228 struct dsa_switch *ds = dp->ds; in dsa_user_set_eee() local
1235 if (!ds->ops->set_mac_eee) in dsa_user_set_eee()
1238 ret = ds->ops->set_mac_eee(ds, dp->index, e); in dsa_user_set_eee()
1248 struct dsa_switch *ds = dp->ds; in dsa_user_get_eee() local
1255 if (!ds->ops->get_mac_eee) in dsa_user_get_eee()
1258 ret = ds->ops->get_mac_eee(ds, dp->index, e); in dsa_user_get_eee()
1285 struct dsa_switch *ds = dp->ds; in dsa_user_get_pause_stats() local
1287 if (ds->ops->get_pause_stats) in dsa_user_get_pause_stats()
1288 ds->ops->get_pause_stats(ds, dp->index, pause_stats); in dsa_user_get_pause_stats()
1372 struct dsa_switch *ds = dp->ds; in dsa_user_add_cls_matchall_mirred() local
1377 if (!ds->ops->port_mirror_add) in dsa_user_add_cls_matchall_mirred()
1405 err = ds->ops->port_mirror_add(ds, dp->index, mirror, ingress, extack); in dsa_user_add_cls_matchall_mirred()
1426 struct dsa_switch *ds = dp->ds; in dsa_user_add_cls_matchall_police() local
1430 if (!ds->ops->port_policer_add) { in dsa_user_add_cls_matchall_police()
1466 err = ds->ops->port_policer_add(ds, dp->index, policer); in dsa_user_add_cls_matchall_police()
1499 struct dsa_switch *ds = dp->ds; in dsa_user_del_cls_matchall() local
1509 if (ds->ops->port_mirror_del) in dsa_user_del_cls_matchall()
1510 ds->ops->port_mirror_del(ds, dp->index, in dsa_user_del_cls_matchall()
1514 if (ds->ops->port_policer_del) in dsa_user_del_cls_matchall()
1515 ds->ops->port_policer_del(ds, dp->index); in dsa_user_del_cls_matchall()
1547 struct dsa_switch *ds = dp->ds; in dsa_user_add_cls_flower() local
1550 if (!ds->ops->cls_flower_add) in dsa_user_add_cls_flower()
1553 return ds->ops->cls_flower_add(ds, port, cls, ingress); in dsa_user_add_cls_flower()
1561 struct dsa_switch *ds = dp->ds; in dsa_user_del_cls_flower() local
1564 if (!ds->ops->cls_flower_del) in dsa_user_del_cls_flower()
1567 return ds->ops->cls_flower_del(ds, port, cls, ingress); in dsa_user_del_cls_flower()
1575 struct dsa_switch *ds = dp->ds; in dsa_user_stats_cls_flower() local
1578 if (!ds->ops->cls_flower_stats) in dsa_user_stats_cls_flower()
1581 return ds->ops->cls_flower_stats(ds, port, cls, ingress); in dsa_user_stats_cls_flower()
1672 static int dsa_user_setup_ft_block(struct dsa_switch *ds, int port, in dsa_user_setup_ft_block() argument
1675 struct net_device *conduit = dsa_port_to_conduit(dsa_to_port(ds, port)); in dsa_user_setup_ft_block()
1687 struct dsa_switch *ds = dp->ds; in dsa_user_setup_tc() local
1693 return dsa_user_setup_ft_block(ds, dp->index, type_data); in dsa_user_setup_tc()
1698 if (!ds->ops->port_setup_tc) in dsa_user_setup_tc()
1701 return ds->ops->port_setup_tc(ds, dp->index, type, type_data); in dsa_user_setup_tc()
1708 struct dsa_switch *ds = dp->ds; in dsa_user_get_rxnfc() local
1710 if (!ds->ops->get_rxnfc) in dsa_user_get_rxnfc()
1713 return ds->ops->get_rxnfc(ds, dp->index, nfc, rule_locs); in dsa_user_get_rxnfc()
1720 struct dsa_switch *ds = dp->ds; in dsa_user_set_rxnfc() local
1722 if (!ds->ops->set_rxnfc) in dsa_user_set_rxnfc()
1725 return ds->ops->set_rxnfc(ds, dp->index, nfc); in dsa_user_set_rxnfc()
1732 struct dsa_switch *ds = p->dp->ds; in dsa_user_get_ts_info() local
1734 if (!ds->ops->get_ts_info) in dsa_user_get_ts_info()
1737 return ds->ops->get_ts_info(ds, p->dp->index, ts); in dsa_user_get_ts_info()
1751 struct dsa_switch *ds = dp->ds; in dsa_user_vlan_rx_add_vid() local
1773 if (!dsa_switch_supports_uc_filtering(ds) && in dsa_user_vlan_rx_add_vid()
1774 !dsa_switch_supports_mc_filtering(ds)) in dsa_user_vlan_rx_add_vid()
1788 if (dsa_switch_supports_mc_filtering(ds)) { in dsa_user_vlan_rx_add_vid()
1795 if (dsa_switch_supports_uc_filtering(ds)) { in dsa_user_vlan_rx_add_vid()
1824 struct dsa_switch *ds = dp->ds; in dsa_user_vlan_rx_kill_vid() local
1837 if (!dsa_switch_supports_uc_filtering(ds) && in dsa_user_vlan_rx_kill_vid()
1838 !dsa_switch_supports_mc_filtering(ds)) in dsa_user_vlan_rx_kill_vid()
1852 if (dsa_switch_supports_mc_filtering(ds)) { in dsa_user_vlan_rx_kill_vid()
1859 if (dsa_switch_supports_uc_filtering(ds)) { in dsa_user_vlan_rx_kill_vid()
1892 * If ds->vlan_filtering_is_global = true, then standalone ports which share
1899 * - if ds->needs_standalone_vlan_filtering = true, OR if
1900 * (ds->vlan_filtering_is_global = true AND there are bridges spanning
1908 * - if ds->configure_vlan_while_not_filtering = true (default):
1994 if (!dp->ds->mtu_enforcement_ingress) in dsa_bridge_mtu_normalization()
2016 if (!other_dp->ds->mtu_enforcement_ingress) in dsa_bridge_mtu_normalization()
2058 struct dsa_switch *ds = dp->ds; in dsa_user_change_mtu() local
2068 if (!ds->ops->port_change_mtu) in dsa_user_change_mtu()
2071 dsa_tree_for_each_user_port(other_dp, ds->dst) { in dsa_user_change_mtu()
2119 err = ds->ops->port_change_mtu(ds, dp->index, new_mtu); in dsa_user_change_mtu()
2143 struct dsa_switch *ds = dp->ds; in dsa_user_dcbnl_set_default_prio() local
2147 if (!ds->ops->port_set_default_prio) in dsa_user_dcbnl_set_default_prio()
2157 err = ds->ops->port_set_default_prio(ds, port, new_prio); in dsa_user_dcbnl_set_default_prio()
2170 struct dsa_switch *ds = dp->ds; in dsa_user_dcbnl_add_dscp_prio() local
2175 if (!ds->ops->port_add_dscp_prio) in dsa_user_dcbnl_add_dscp_prio()
2191 err = ds->ops->port_add_dscp_prio(ds, port, dscp, new_prio); in dsa_user_dcbnl_add_dscp_prio()
2223 struct dsa_switch *ds = dp->ds; in dsa_user_dcbnl_del_default_prio() local
2227 if (!ds->ops->port_set_default_prio) in dsa_user_dcbnl_del_default_prio()
2237 err = ds->ops->port_set_default_prio(ds, port, new_prio); in dsa_user_dcbnl_del_default_prio()
2250 struct dsa_switch *ds = dp->ds; in dsa_user_dcbnl_del_dscp_prio() local
2254 if (!ds->ops->port_del_dscp_prio) in dsa_user_dcbnl_del_dscp_prio()
2261 err = ds->ops->port_del_dscp_prio(ds, port, dscp, app->priority); in dsa_user_dcbnl_del_dscp_prio()
2295 struct dsa_switch *ds = dp->ds; in dsa_user_dcbnl_init() local
2299 if (ds->ops->port_get_default_prio) { in dsa_user_dcbnl_init()
2300 int prio = ds->ops->port_get_default_prio(ds, port); in dsa_user_dcbnl_init()
2315 if (ds->ops->port_get_dscp_prio) { in dsa_user_dcbnl_init()
2325 prio = ds->ops->port_get_dscp_prio(ds, port, protocol); in dsa_user_dcbnl_init()
2385 struct dsa_switch *ds = dp->ds; in dsa_user_get_stats64() local
2387 if (ds->ops->get_stats64) in dsa_user_get_stats64()
2388 ds->ops->get_stats64(ds, dp->index, s); in dsa_user_get_stats64()
2436 void dsa_port_phylink_mac_change(struct dsa_switch *ds, int port, bool up) in dsa_port_phylink_mac_change() argument
2438 const struct dsa_port *dp = dsa_to_port(ds, port); in dsa_port_phylink_mac_change()
2449 struct dsa_switch *ds = dp->ds; in dsa_user_phylink_fixed_state() local
2454 ds->ops->phylink_fixed_state(ds, dp->index, state); in dsa_user_phylink_fixed_state()
2462 struct dsa_switch *ds = dp->ds; in dsa_user_phy_connect() local
2464 user_dev->phydev = mdiobus_get_phy(ds->user_mii_bus, addr); in dsa_user_phy_connect()
2479 struct dsa_switch *ds = dp->ds; in dsa_user_phy_setup() local
2490 if (ds->ops->phylink_fixed_state) { in dsa_user_phy_setup()
2499 if (ds->ops->get_phy_flags) in dsa_user_phy_setup()
2500 phy_flags = ds->ops->get_phy_flags(ds, dp->index); in dsa_user_phy_setup()
2503 if (ret == -ENODEV && ds->user_mii_bus) { in dsa_user_phy_setup()
2524 const struct dsa_switch *ds = dp->ds; in dsa_user_setup_tagger() local
2542 if (ds->needs_standalone_vlan_filtering) in dsa_user_setup_tagger()
2581 struct dsa_switch *ds = port->ds; in dsa_user_create() local
2588 if (!ds->num_tx_queues) in dsa_user_create()
2589 ds->num_tx_queues = 1; in dsa_user_create()
2601 ds->num_tx_queues, 1); in dsa_user_create()
2615 if (dsa_switch_supports_uc_filtering(ds)) in dsa_user_create()
2618 if (ds->ops->port_max_mtu) in dsa_user_create()
2619 user_dev->max_mtu = ds->ops->port_max_mtu(ds, port->index); in dsa_user_create()
2622 SET_NETDEV_DEV(user_dev, port->ds->dev); in dsa_user_create()
2649 ret, ds->dst->index, ds->index, port->index); in dsa_user_create()
2657 dev_warn(ds->dev, "nonfatal error %d setting MTU to %d on port %d\n", in dsa_user_create()
2728 struct dsa_switch *ds = dp->ds; in dsa_user_change_conduit() local
2736 if (!ds->ops->port_change_conduit) { in dsa_user_change_conduit()
3016 struct dsa_switch *ds; in dsa_user_prechangeupper_sanity_check() local
3024 ds = dp->ds; in dsa_user_prechangeupper_sanity_check()
3026 if (ds->ops->port_prechangeupper) { in dsa_user_prechangeupper_sanity_check()
3027 err = ds->ops->port_prechangeupper(ds, dp->index, info); in dsa_user_prechangeupper_sanity_check()
3392 struct dsa_switch_tree *dst = cpu_dp->ds->dst; in dsa_user_netdevice_event()
3423 dst = cpu_dp->ds->dst; in dsa_user_netdevice_event()
3467 struct dsa_switch *ds; in dsa_user_switchdev_event_work() local
3472 ds = dp->ds; in dsa_user_switchdev_event_work()
3483 dev_err(ds->dev, in dsa_user_switchdev_event_work()
3499 dev_err(ds->dev, in dsa_user_switchdev_event_work()
3514 struct dsa_switch_tree *dst = dp->ds->dst; in dsa_foreign_dev_check()
3534 struct dsa_switch *ds = dp->ds; in dsa_user_fdb_event() local
3550 if (!ds->assisted_learning_on_cpu_port) in dsa_user_fdb_event()
3565 if (!ds->ops->lag_fdb_add || !ds->ops->lag_fdb_del) in dsa_user_fdb_event()
3568 if (!ds->ops->port_fdb_add || !ds->ops->port_fdb_del) in dsa_user_fdb_event()