Lines Matching refs:ds

68 static bool dsa_switch_supports_uc_filtering(struct dsa_switch *ds)
70 return ds->ops->port_fdb_add && ds->ops->port_fdb_del &&
71 ds->fdb_isolation && !ds->vlan_filtering_is_global &&
72 !ds->needs_standalone_vlan_filtering;
75 static bool dsa_switch_supports_mc_filtering(struct dsa_switch *ds)
77 return ds->ops->port_mdb_add && ds->ops->port_mdb_del &&
78 ds->fdb_isolation && !ds->vlan_filtering_is_global &&
79 !ds->needs_standalone_vlan_filtering;
90 struct dsa_switch *ds = dp->ds;
98 dev_err(ds->dev,
108 dev_err(ds->dev,
120 dev_err(ds->dev,
132 dev_err(ds->dev,
209 if (!dsa_switch_supports_uc_filtering(dp->ds))
229 if (!dsa_switch_supports_uc_filtering(dp->ds))
249 if (!dsa_switch_supports_mc_filtering(dp->ds))
269 if (!dsa_switch_supports_mc_filtering(dp->ds))
279 struct dsa_switch *ds = dp->ds;
292 if (dsa_switch_supports_uc_filtering(ds) ||
293 dsa_switch_supports_mc_filtering(ds))
300 struct dsa_switch *ds = dp->ds;
313 if (dsa_switch_supports_uc_filtering(ds) ||
314 dsa_switch_supports_mc_filtering(ds))
321 struct dsa_switch *ds = bus->priv;
323 if (ds->phys_mii_mask & (1 << addr))
324 return ds->ops->phy_read(ds, addr, reg);
331 struct dsa_switch *ds = bus->priv;
333 if (ds->phys_mii_mask & (1 << addr))
334 return ds->ops->phy_write(ds, addr, reg, val);
339 void dsa_user_mii_bus_init(struct dsa_switch *ds)
341 ds->user_mii_bus->priv = (void *)ds;
342 ds->user_mii_bus->name = "dsa user smi";
343 ds->user_mii_bus->read = dsa_user_phy_read;
344 ds->user_mii_bus->write = dsa_user_phy_write;
345 snprintf(ds->user_mii_bus->id, MII_BUS_ID_SIZE, "dsa-%d.%d",
346 ds->dst->index, ds->index);
347 ds->user_mii_bus->parent = ds->dev;
348 ds->user_mii_bus->phy_mask = ~ds->phys_mii_mask;
362 struct dsa_switch *ds = dp->ds;
365 if (dsa_switch_supports_uc_filtering(ds)) {
380 if (dsa_switch_supports_uc_filtering(ds))
390 struct dsa_switch *ds = dp->ds;
395 if (dsa_switch_supports_uc_filtering(ds))
451 struct dsa_switch *ds = dp->ds;
460 if (dsa_switch_supports_uc_filtering(ds) &&
461 dsa_switch_supports_mc_filtering(ds))
474 struct dsa_switch *ds = dp->ds;
481 if (ds->ops->port_set_mac_address) {
482 err = ds->ops->port_set_mac_address(ds, dp->index,
884 struct dsa_switch *ds = p->dp->ds;
889 if (!ds->ops->port_txtstamp)
892 ds->ops->port_txtstamp(ds, p->dp->index, skb);
962 struct dsa_switch *ds = dp->ds;
964 if (ds->ops->get_regs_len)
965 return ds->ops->get_regs_len(ds, dp->index);
974 struct dsa_switch *ds = dp->ds;
976 if (ds->ops->get_regs)
977 ds->ops->get_regs(ds, dp->index, regs, _p);
990 struct dsa_switch *ds = dp->ds;
992 if (ds->cd && ds->cd->eeprom_len)
993 return ds->cd->eeprom_len;
995 if (ds->ops->get_eeprom_len)
996 return ds->ops->get_eeprom_len(ds);
1005 struct dsa_switch *ds = dp->ds;
1007 if (ds->ops->get_eeprom)
1008 return ds->ops->get_eeprom(ds, eeprom, data);
1017 struct dsa_switch *ds = dp->ds;
1019 if (ds->ops->set_eeprom)
1020 return ds->ops->set_eeprom(ds, eeprom, data);
1029 struct dsa_switch *ds = dp->ds;
1036 if (ds->ops->get_strings)
1037 ds->ops->get_strings(ds, dp->index, stringset, data);
1049 struct dsa_switch *ds = dp->ds;
1070 if (ds->ops->get_ethtool_stats)
1071 ds->ops->get_ethtool_stats(ds, dp->index, data + 4);
1077 struct dsa_switch *ds = dp->ds;
1082 if (ds->ops->get_sset_count) {
1083 count = ds->ops->get_sset_count(ds, dp->index, sset);
1100 struct dsa_switch *ds = dp->ds;
1102 if (ds->ops->get_eth_phy_stats)
1103 ds->ops->get_eth_phy_stats(ds, dp->index, phy_stats);
1110 struct dsa_switch *ds = dp->ds;
1112 if (ds->ops->get_eth_mac_stats)
1113 ds->ops->get_eth_mac_stats(ds, dp->index, mac_stats);
1121 struct dsa_switch *ds = dp->ds;
1123 if (ds->ops->get_eth_ctrl_stats)
1124 ds->ops->get_eth_ctrl_stats(ds, dp->index, ctrl_stats);
1133 struct dsa_switch *ds = dp->ds;
1135 if (ds->ops->get_rmon_stats)
1136 ds->ops->get_rmon_stats(ds, dp->index, rmon_stats, ranges);
1143 struct dsa_switch *ds = dp->ds;
1145 if (ds->ops->get_ts_stats)
1146 ds->ops->get_ts_stats(ds, dp->index, ts_stats);
1153 struct dsa_switch *ds = dp->ds;
1155 if (ds->ops->self_test) {
1156 ds->ops->self_test(ds, dp->index, etest, buf);
1167 struct dsa_switch *ds = dp->ds;
1169 if (!ds->ops->get_mm)
1172 return ds->ops->get_mm(ds, dp->index, state);
1179 struct dsa_switch *ds = dp->ds;
1181 if (!ds->ops->set_mm)
1184 return ds->ops->set_mm(ds, dp->index, cfg, extack);
1191 struct dsa_switch *ds = dp->ds;
1193 if (ds->ops->get_mm_stats)
1194 ds->ops->get_mm_stats(ds, dp->index, stats);
1200 struct dsa_switch *ds = dp->ds;
1204 if (ds->ops->get_wol)
1205 ds->ops->get_wol(ds, dp->index, w);
1211 struct dsa_switch *ds = dp->ds;
1216 if (ds->ops->set_wol)
1217 ret = ds->ops->set_wol(ds, dp->index, w);
1225 struct dsa_switch *ds = dp->ds;
1229 if (!ds->ops->support_eee || !ds->ops->support_eee(ds, dp->index))
1235 if (!phylink_mac_implements_lpi(ds->phylink_mac_ops)) {
1240 if (!ds->ops->set_mac_eee)
1243 ret = ds->ops->set_mac_eee(ds, dp->index, e);
1246 } else if (ds->ops->set_mac_eee) {
1247 ret = ds->ops->set_mac_eee(ds, dp->index, e);
1258 struct dsa_switch *ds = dp->ds;
1261 if (!ds->ops->support_eee || !ds->ops->support_eee(ds, dp->index))
1291 struct dsa_switch *ds = dp->ds;
1293 if (ds->ops->get_pause_stats)
1294 ds->ops->get_pause_stats(ds, dp->index, pause_stats);
1377 struct dsa_switch *ds = dp->ds;
1388 if (!ds->ops->port_mirror_add) {
1427 if (dp->ds != to_dp->ds) {
1443 err = ds->ops->port_mirror_add(ds, dp->index, mirror, ingress, extack);
1464 struct dsa_switch *ds = dp->ds;
1468 if (!ds->ops->port_policer_add) {
1503 err = ds->ops->port_policer_add(ds, dp->index, policer);
1549 struct dsa_switch *ds = dp->ds;
1559 if (ds->ops->port_mirror_del)
1560 ds->ops->port_mirror_del(ds, dp->index,
1564 if (ds->ops->port_policer_del)
1565 ds->ops->port_policer_del(ds, dp->index);
1597 struct dsa_switch *ds = dp->ds;
1600 if (!ds->ops->cls_flower_add)
1603 return ds->ops->cls_flower_add(ds, port, cls, ingress);
1611 struct dsa_switch *ds = dp->ds;
1614 if (!ds->ops->cls_flower_del)
1617 return ds->ops->cls_flower_del(ds, port, cls, ingress);
1625 struct dsa_switch *ds = dp->ds;
1628 if (!ds->ops->cls_flower_stats)
1631 return ds->ops->cls_flower_stats(ds, port, cls, ingress);
1722 static int dsa_user_setup_ft_block(struct dsa_switch *ds, int port,
1725 struct net_device *conduit = dsa_port_to_conduit(dsa_to_port(ds, port));
1737 struct dsa_switch *ds = dp->ds;
1743 return dsa_user_setup_ft_block(ds, dp->index, type_data);
1748 if (!ds->ops->port_setup_tc)
1751 return ds->ops->port_setup_tc(ds, dp->index, type, type_data);
1758 struct dsa_switch *ds = dp->ds;
1760 if (!ds->ops->get_rxnfc)
1763 return ds->ops->get_rxnfc(ds, dp->index, nfc, rule_locs);
1770 struct dsa_switch *ds = dp->ds;
1772 if (!ds->ops->set_rxnfc)
1775 return ds->ops->set_rxnfc(ds, dp->index, nfc);
1782 struct dsa_switch *ds = p->dp->ds;
1784 if (!ds->ops->get_ts_info)
1787 return ds->ops->get_ts_info(ds, p->dp->index, ts);
1801 struct dsa_switch *ds = dp->ds;
1823 if (!dsa_switch_supports_uc_filtering(ds) &&
1824 !dsa_switch_supports_mc_filtering(ds))
1838 if (dsa_switch_supports_mc_filtering(ds)) {
1845 if (dsa_switch_supports_uc_filtering(ds)) {
1874 struct dsa_switch *ds = dp->ds;
1887 if (!dsa_switch_supports_uc_filtering(ds) &&
1888 !dsa_switch_supports_mc_filtering(ds))
1902 if (dsa_switch_supports_mc_filtering(ds)) {
1909 if (dsa_switch_supports_uc_filtering(ds)) {
1942 * If ds->vlan_filtering_is_global = true, then standalone ports which share
1949 * - if ds->needs_standalone_vlan_filtering = true, OR if
1950 * (ds->vlan_filtering_is_global = true AND there are bridges spanning
1958 * - if ds->configure_vlan_while_not_filtering = true (default):
2044 if (!dp->ds->mtu_enforcement_ingress)
2066 if (!other_dp->ds->mtu_enforcement_ingress)
2108 struct dsa_switch *ds = dp->ds;
2118 if (!ds->ops->port_change_mtu)
2121 dsa_tree_for_each_user_port(other_dp, ds->dst) {
2169 err = ds->ops->port_change_mtu(ds, dp->index, new_mtu);
2193 struct dsa_switch *ds = dp->ds;
2196 if (!ds->ops->port_set_apptrust)
2199 return ds->ops->port_set_apptrust(ds, port, sel, nsel);
2206 struct dsa_switch *ds = dp->ds;
2209 if (!ds->ops->port_get_apptrust)
2212 return ds->ops->port_get_apptrust(ds, port, sel, nsel);
2219 struct dsa_switch *ds = dp->ds;
2223 if (!ds->ops->port_set_default_prio)
2233 err = ds->ops->port_set_default_prio(ds, port, new_prio);
2250 struct dsa_switch *ds = dp->ds;
2259 dsa_switch_for_each_user_port(other_dp, ds) {
2280 dsa_switch_for_each_user_port_continue_reverse(other_dp, ds) {
2298 struct dsa_switch *ds = dp->ds;
2303 if (!ds->ops->port_add_dscp_prio)
2319 err = ds->ops->port_add_dscp_prio(ds, port, dscp, new_prio);
2325 if (!ds->dscp_prio_mapping_is_global)
2330 if (ds->ops->port_del_dscp_prio)
2331 ds->ops->port_del_dscp_prio(ds, port, dscp, new_prio);
2362 struct dsa_switch *ds = dp->ds;
2366 if (!ds->ops->port_set_default_prio)
2376 err = ds->ops->port_set_default_prio(ds, port, new_prio);
2389 struct dsa_switch *ds = dp->ds;
2393 if (!ds->ops->port_del_dscp_prio)
2400 err = ds->ops->port_del_dscp_prio(ds, port, dscp, app->priority);
2406 if (!ds->dscp_prio_mapping_is_global)
2411 if (ds->ops->port_add_dscp_prio)
2412 ds->ops->port_add_dscp_prio(ds, port, dscp,
2446 struct dsa_switch *ds = dp->ds;
2450 if (ds->ops->port_get_default_prio) {
2451 int prio = ds->ops->port_get_default_prio(ds, port);
2466 if (ds->ops->port_get_dscp_prio) {
2476 prio = ds->ops->port_get_dscp_prio(ds, port, protocol);
2539 struct dsa_switch *ds = dp->ds;
2541 if (ds->ops->get_stats64)
2542 ds->ops->get_stats64(ds, dp->index, s);
2567 struct dsa_switch *ds = dp->ds;
2569 if (!ds->ops->port_hwtstamp_get)
2572 return ds->ops->port_hwtstamp_get(ds, dp->index, cfg);
2580 struct dsa_switch *ds = dp->ds;
2582 if (!ds->ops->port_hwtstamp_set)
2585 return ds->ops->port_hwtstamp_set(ds, dp->index, cfg, extack);
2617 void dsa_port_phylink_mac_change(struct dsa_switch *ds, int port, bool up)
2619 const struct dsa_port *dp = dsa_to_port(ds, port);
2630 struct dsa_switch *ds = dp->ds;
2635 ds->ops->phylink_fixed_state(ds, dp->index, state);
2643 struct dsa_switch *ds = dp->ds;
2645 user_dev->phydev = mdiobus_get_phy(ds->user_mii_bus, addr);
2660 struct dsa_switch *ds = dp->ds;
2671 if (ds->ops->phylink_fixed_state) {
2680 if (ds->ops->get_phy_flags)
2681 phy_flags = ds->ops->get_phy_flags(ds, dp->index);
2684 if (ret == -ENODEV && ds->user_mii_bus) {
2705 const struct dsa_switch *ds = dp->ds;
2722 if (ds->needs_standalone_vlan_filtering)
2763 struct dsa_switch *ds = port->ds;
2770 if (!ds->num_tx_queues)
2771 ds->num_tx_queues = 1;
2783 ds->num_tx_queues, 1);
2797 if (dsa_switch_supports_uc_filtering(ds))
2800 if (ds->ops->port_max_mtu)
2801 user_dev->max_mtu = ds->ops->port_max_mtu(ds, port->index);
2804 SET_NETDEV_DEV(user_dev, port->ds->dev);
2827 ret, ds->dst->index, ds->index, port->index);
2835 dev_warn(ds->dev, "nonfatal error %d setting MTU to %d on port %d\n",
2904 struct dsa_switch *ds = dp->ds;
2912 if (!ds->ops->port_change_conduit) {
3186 struct dsa_switch *ds;
3194 ds = dp->ds;
3196 if (ds->ops->port_prechangeupper) {
3197 err = ds->ops->port_prechangeupper(ds, dp->index, info);
3562 struct dsa_switch_tree *dst = cpu_dp->ds->dst;
3593 dst = cpu_dp->ds->dst;
3637 struct dsa_switch *ds;
3642 ds = dp->ds;
3653 dev_err(ds->dev,
3669 dev_err(ds->dev,
3684 struct dsa_switch_tree *dst = dp->ds->dst;
3704 struct dsa_switch *ds = dp->ds;
3720 if (!ds->assisted_learning_on_cpu_port)
3735 if (!ds->ops->lag_fdb_add || !ds->ops->lag_fdb_del)
3738 if (!ds->ops->port_fdb_add || !ds->ops->port_fdb_del)