Lines Matching +full:xrx200 +full:- +full:reset

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright (c) 2017 Savoir-faire Linux Inc.
22 * dsa_port_notify - Notify the switching fabric of changes to a port
25 * @v: event-specific value.
29 * reconfigure themselves for cross-chip operations. Can also be used to
35 return dsa_tree_notify(dp->ds->dst, e, v); in dsa_port_notify()
57 struct dsa_switch *ds = dp->ds; in dsa_port_fast_age()
59 if (!ds->ops->port_fast_age) in dsa_port_fast_age()
62 ds->ops->port_fast_age(ds, dp->index); in dsa_port_fast_age()
70 struct dsa_switch *ds = dp->ds; in dsa_port_vlan_fast_age()
73 if (!ds->ops->port_vlan_fast_age) in dsa_port_vlan_fast_age()
74 return -EOPNOTSUPP; in dsa_port_vlan_fast_age()
76 err = ds->ops->port_vlan_fast_age(ds, dp->index, vid); in dsa_port_vlan_fast_age()
107 struct dsa_switch *ds = dp->ds; in dsa_port_can_configure_learning()
110 if (!ds->ops->port_bridge_flags || !ds->ops->port_pre_bridge_flags) in dsa_port_can_configure_learning()
113 err = ds->ops->port_pre_bridge_flags(ds, dp->index, flags, NULL); in dsa_port_can_configure_learning()
119 struct dsa_switch *ds = dp->ds; in dsa_port_supports_hwtstamp()
123 if (!ds->ops->port_hwtstamp_get || !ds->ops->port_hwtstamp_set) in dsa_port_supports_hwtstamp()
128 * fail in copy_to_user() with -EFAULT, which hopefully is enough to in dsa_port_supports_hwtstamp()
131 err = ds->ops->port_hwtstamp_get(ds, dp->index, &ifr); in dsa_port_supports_hwtstamp()
132 return err != -EOPNOTSUPP; in dsa_port_supports_hwtstamp()
137 struct dsa_switch *ds = dp->ds; in dsa_port_set_state()
138 int port = dp->index; in dsa_port_set_state()
140 if (!ds->ops->port_stp_state_set) in dsa_port_set_state()
141 return -EOPNOTSUPP; in dsa_port_set_state()
143 ds->ops->port_stp_state_set(ds, port, state); in dsa_port_set_state()
146 (do_fast_age && dp->learning)) { in dsa_port_set_state()
155 if ((dp->stp_state == BR_STATE_LEARNING || in dsa_port_set_state()
156 dp->stp_state == BR_STATE_FORWARDING) && in dsa_port_set_state()
163 dp->stp_state = state; in dsa_port_set_state()
171 struct dsa_switch *ds = dp->ds; in dsa_port_set_state_now()
175 if (err && err != -EOPNOTSUPP) { in dsa_port_set_state_now()
176 dev_err(ds->dev, "port %d failed to set STP state %u: %pe\n", in dsa_port_set_state_now()
177 dp->index, state, ERR_PTR(err)); in dsa_port_set_state_now()
185 struct dsa_switch *ds = dp->ds; in dsa_port_set_mst_state()
189 if (!ds->ops->port_mst_state_set) in dsa_port_set_mst_state()
190 return -EOPNOTSUPP; in dsa_port_set_mst_state()
192 err = br_mst_get_state(dsa_port_to_bridge_port(dp), state->msti, in dsa_port_set_mst_state()
197 err = ds->ops->port_mst_state_set(ds, dp->index, state); in dsa_port_set_mst_state()
201 if (!(dp->learning && in dsa_port_set_mst_state()
204 (state->state == BR_STATE_DISABLED || in dsa_port_set_mst_state()
205 state->state == BR_STATE_BLOCKING || in dsa_port_set_mst_state()
206 state->state == BR_STATE_LISTENING))) in dsa_port_set_mst_state()
209 err = dsa_port_msti_fast_age(dp, state->msti); in dsa_port_set_mst_state()
219 struct dsa_switch *ds = dp->ds; in dsa_port_enable_rt()
220 int port = dp->index; in dsa_port_enable_rt()
223 if (ds->ops->port_enable) { in dsa_port_enable_rt()
224 err = ds->ops->port_enable(ds, port, phy); in dsa_port_enable_rt()
229 if (!dp->bridge) in dsa_port_enable_rt()
232 if (dp->pl) in dsa_port_enable_rt()
233 phylink_start(dp->pl); in dsa_port_enable_rt()
251 struct dsa_switch *ds = dp->ds; in dsa_port_disable_rt()
252 int port = dp->index; in dsa_port_disable_rt()
254 if (dp->pl) in dsa_port_disable_rt()
255 phylink_stop(dp->pl); in dsa_port_disable_rt()
257 if (!dp->bridge) in dsa_port_disable_rt()
260 if (ds->ops->port_disable) in dsa_port_disable_rt()
261 ds->ops->port_disable(ds, port); in dsa_port_disable_rt()
276 struct dsa_switch *ds = dp->ds; in dsa_port_reset_vlan_filtering()
281 if (ds->needs_standalone_vlan_filtering && in dsa_port_reset_vlan_filtering()
285 } else if (!ds->needs_standalone_vlan_filtering && in dsa_port_reset_vlan_filtering()
297 * VLAN-aware bridge. in dsa_port_reset_vlan_filtering()
299 if (change_vlan_filtering && ds->vlan_filtering_is_global) { in dsa_port_reset_vlan_filtering()
315 dev_err(ds->dev, "port %d: %s\n", dp->index, in dsa_port_reset_vlan_filtering()
318 if (err && err != -EOPNOTSUPP) { in dsa_port_reset_vlan_filtering()
319 dev_err(ds->dev, in dsa_port_reset_vlan_filtering()
320 "port %d failed to reset VLAN filtering to %d: %pe\n", in dsa_port_reset_vlan_filtering()
321 dp->index, vlan_filtering, ERR_PTR(err)); in dsa_port_reset_vlan_filtering()
342 if (err && err != -EOPNOTSUPP) in dsa_port_inherit_brport_flags()
363 if (err && err != -EOPNOTSUPP) in dsa_port_clear_brport_flags()
364 dev_err(dp->ds->dev, in dsa_port_clear_brport_flags()
382 if (err && err != -EOPNOTSUPP) in dsa_port_switchdev_sync_attrs()
386 if (err && err != -EOPNOTSUPP) in dsa_port_switchdev_sync_attrs()
390 if (err && err != -EOPNOTSUPP) in dsa_port_switchdev_sync_attrs()
428 struct dsa_switch *ds = dp->ds; in dsa_port_bridge_create()
431 bridge = dsa_tree_bridge_find(ds->dst, br); in dsa_port_bridge_create()
433 refcount_inc(&bridge->refcount); in dsa_port_bridge_create()
434 dp->bridge = bridge; in dsa_port_bridge_create()
440 return -ENOMEM; in dsa_port_bridge_create()
442 refcount_set(&bridge->refcount, 1); in dsa_port_bridge_create()
444 bridge->dev = br; in dsa_port_bridge_create()
446 bridge->num = dsa_bridge_num_get(br, ds->max_num_bridges); in dsa_port_bridge_create()
447 if (ds->max_num_bridges && !bridge->num) { in dsa_port_bridge_create()
451 return -EOPNOTSUPP; in dsa_port_bridge_create()
454 dp->bridge = bridge; in dsa_port_bridge_create()
462 struct dsa_bridge *bridge = dp->bridge; in dsa_port_bridge_destroy()
464 dp->bridge = NULL; in dsa_port_bridge_destroy()
466 if (!refcount_dec_and_test(&bridge->refcount)) in dsa_port_bridge_destroy()
469 if (bridge->num) in dsa_port_bridge_destroy()
470 dsa_bridge_num_put(br, bridge->num); in dsa_port_bridge_destroy()
477 struct dsa_switch *ds = dp->ds; in dsa_port_supports_mst()
479 return ds->ops->vlan_msti_set && in dsa_port_supports_mst()
480 ds->ops->port_mst_state_set && in dsa_port_supports_mst()
481 ds->ops->port_vlan_fast_age && in dsa_port_supports_mst()
492 struct net_device *dev = dp->user; in dsa_port_bridge_join()
497 return -EOPNOTSUPP; in dsa_port_bridge_join()
508 info.bridge = *dp->bridge; in dsa_port_bridge_join()
514 dp->bridge->tx_fwd_offload = info.tx_fwd_offload; in dsa_port_bridge_join()
519 dp->bridge->tx_fwd_offload, extack); in dsa_port_bridge_join()
566 if (!dp->bridge) in dsa_port_bridge_leave()
569 info.bridge = *dp->bridge; in dsa_port_bridge_leave()
578 dev_err(dp->ds->dev, in dsa_port_bridge_leave()
580 dp->index, ERR_PTR(err)); in dsa_port_bridge_leave()
593 if (!dp->lag) in dsa_port_lag_change()
601 tx_enabled = linfo->link_up && linfo->tx_enabled; in dsa_port_lag_change()
603 if (tx_enabled == dp->lag_tx_enabled) in dsa_port_lag_change()
606 dp->lag_tx_enabled = tx_enabled; in dsa_port_lag_change()
614 struct dsa_switch *ds = dp->ds; in dsa_port_lag_create()
617 lag = dsa_tree_lag_find(ds->dst, lag_dev); in dsa_port_lag_create()
619 refcount_inc(&lag->refcount); in dsa_port_lag_create()
620 dp->lag = lag; in dsa_port_lag_create()
626 return -ENOMEM; in dsa_port_lag_create()
628 refcount_set(&lag->refcount, 1); in dsa_port_lag_create()
629 mutex_init(&lag->fdb_lock); in dsa_port_lag_create()
630 INIT_LIST_HEAD(&lag->fdbs); in dsa_port_lag_create()
631 lag->dev = lag_dev; in dsa_port_lag_create()
632 dsa_lag_map(ds->dst, lag); in dsa_port_lag_create()
633 dp->lag = lag; in dsa_port_lag_create()
640 struct dsa_lag *lag = dp->lag; in dsa_port_lag_destroy()
642 dp->lag = NULL; in dsa_port_lag_destroy()
643 dp->lag_tx_enabled = false; in dsa_port_lag_destroy()
645 if (!refcount_dec_and_test(&lag->refcount)) in dsa_port_lag_destroy()
648 WARN_ON(!list_empty(&lag->fdbs)); in dsa_port_lag_destroy()
649 dsa_lag_unmap(dp->ds->dst, lag); in dsa_port_lag_destroy()
669 info.lag = *dp->lag; in dsa_port_lag_join()
708 if (!dp->lag) in dsa_port_lag_leave()
717 info.lag = *dp->lag; in dsa_port_lag_leave()
723 dev_err(dp->ds->dev, in dsa_port_lag_leave()
725 dp->index, ERR_PTR(err)); in dsa_port_lag_leave()
733 struct dsa_switch *ds = dp->ds; in dsa_port_can_apply_vlan_filtering()
744 struct net_device *upper_dev, *user = dp->user; in dsa_port_can_apply_vlan_filtering()
756 /* br_vlan_get_info() returns -EINVAL or -ENOENT if the in dsa_port_can_apply_vlan_filtering()
769 if (!ds->vlan_filtering_is_global) in dsa_port_can_apply_vlan_filtering()
799 struct dsa_switch *ds = dp->ds; in dsa_port_vlan_filtering()
803 if (!ds->ops->port_vlan_filtering) in dsa_port_vlan_filtering()
804 return -EOPNOTSUPP; in dsa_port_vlan_filtering()
814 return -EINVAL; in dsa_port_vlan_filtering()
819 err = ds->ops->port_vlan_filtering(ds, dp->index, vlan_filtering, in dsa_port_vlan_filtering()
824 if (ds->vlan_filtering_is_global) { in dsa_port_vlan_filtering()
827 ds->vlan_filtering = vlan_filtering; in dsa_port_vlan_filtering()
830 struct net_device *user = other_dp->user; in dsa_port_vlan_filtering()
844 dp->vlan_filtering = vlan_filtering; in dsa_port_vlan_filtering()
846 err = dsa_user_manage_vlan_filtering(dp->user, in dsa_port_vlan_filtering()
855 ds->ops->port_vlan_filtering(ds, dp->index, old_vlan_filtering, NULL); in dsa_port_vlan_filtering()
857 if (ds->vlan_filtering_is_global) in dsa_port_vlan_filtering()
858 ds->vlan_filtering = old_vlan_filtering; in dsa_port_vlan_filtering()
860 dp->vlan_filtering = old_vlan_filtering; in dsa_port_vlan_filtering()
871 struct dsa_switch *ds = dp->ds; in dsa_port_skip_vlan_configuration()
876 return !ds->configure_vlan_while_not_filtering && !br_vlan_enabled(br); in dsa_port_skip_vlan_configuration()
892 dp->ageing_time = ageing_time; in dsa_port_ageing_time()
902 return -EINVAL; in dsa_port_mst_enable()
912 struct dsa_switch *ds = dp->ds; in dsa_port_pre_bridge_flags()
914 if (!ds->ops->port_pre_bridge_flags) in dsa_port_pre_bridge_flags()
915 return -EINVAL; in dsa_port_pre_bridge_flags()
917 return ds->ops->port_pre_bridge_flags(ds, dp->index, flags, extack); in dsa_port_pre_bridge_flags()
924 struct dsa_switch *ds = dp->ds; in dsa_port_bridge_flags()
927 if (!ds->ops->port_bridge_flags) in dsa_port_bridge_flags()
928 return -EOPNOTSUPP; in dsa_port_bridge_flags()
930 err = ds->ops->port_bridge_flags(ds, dp->index, flags, extack); in dsa_port_bridge_flags()
937 if (learning == dp->learning) in dsa_port_bridge_flags()
940 if ((dp->learning && !learning) && in dsa_port_bridge_flags()
941 (dp->stp_state == BR_STATE_LEARNING || in dsa_port_bridge_flags()
942 dp->stp_state == BR_STATE_FORWARDING)) in dsa_port_bridge_flags()
945 dp->learning = learning; in dsa_port_bridge_flags()
953 struct dsa_switch *ds = dp->ds; in dsa_port_set_host_flood()
955 if (ds->ops->port_set_host_flood) in dsa_port_set_host_flood()
956 ds->ops->port_set_host_flood(ds, dp->index, uc, mc); in dsa_port_set_host_flood()
962 struct dsa_switch *ds = dp->ds; in dsa_port_vlan_msti()
964 if (!ds->ops->vlan_msti_set) in dsa_port_vlan_msti()
965 return -EOPNOTSUPP; in dsa_port_vlan_msti()
967 return ds->ops->vlan_msti_set(ds, *dp->bridge, msti); in dsa_port_vlan_msti()
989 .bridge = *dp->bridge, in dsa_port_fdb_add()
997 if (!dp->ds->fdb_isolation) in dsa_port_fdb_add()
1012 .bridge = *dp->bridge, in dsa_port_fdb_del()
1016 if (!dp->ds->fdb_isolation) in dsa_port_fdb_del()
1053 .bridge = *dp->bridge, in dsa_port_bridge_host_fdb_add()
1057 if (!dp->ds->fdb_isolation) in dsa_port_bridge_host_fdb_add()
1064 if (conduit->priv_flags & IFF_UNICAST_FLT) { in dsa_port_bridge_host_fdb_add()
1104 .bridge = *dp->bridge, in dsa_port_bridge_host_fdb_del()
1108 if (!dp->ds->fdb_isolation) in dsa_port_bridge_host_fdb_del()
1111 if (conduit->priv_flags & IFF_UNICAST_FLT) { in dsa_port_bridge_host_fdb_del()
1124 .lag = dp->lag, in dsa_port_lag_fdb_add()
1129 .bridge = *dp->bridge, in dsa_port_lag_fdb_add()
1133 if (!dp->ds->fdb_isolation) in dsa_port_lag_fdb_add()
1143 .lag = dp->lag, in dsa_port_lag_fdb_del()
1148 .bridge = *dp->bridge, in dsa_port_lag_fdb_del()
1152 if (!dp->ds->fdb_isolation) in dsa_port_lag_fdb_del()
1160 struct dsa_switch *ds = dp->ds; in dsa_port_fdb_dump()
1161 int port = dp->index; in dsa_port_fdb_dump()
1163 if (!ds->ops->port_fdb_dump) in dsa_port_fdb_dump()
1164 return -EOPNOTSUPP; in dsa_port_fdb_dump()
1166 return ds->ops->port_fdb_dump(ds, port, cb, data); in dsa_port_fdb_dump()
1177 .bridge = *dp->bridge, in dsa_port_mdb_add()
1181 if (!dp->ds->fdb_isolation) in dsa_port_mdb_add()
1195 .bridge = *dp->bridge, in dsa_port_mdb_del()
1199 if (!dp->ds->fdb_isolation) in dsa_port_mdb_del()
1235 .bridge = *dp->bridge, in dsa_port_bridge_host_mdb_add()
1239 if (!dp->ds->fdb_isolation) in dsa_port_bridge_host_mdb_add()
1242 err = dev_mc_add(conduit, mdb->addr); in dsa_port_bridge_host_mdb_add()
1279 .bridge = *dp->bridge, in dsa_port_bridge_host_mdb_del()
1283 if (!dp->ds->fdb_isolation) in dsa_port_bridge_host_mdb_del()
1286 err = dev_mc_del(conduit, mdb->addr); in dsa_port_bridge_host_mdb_del()
1330 if (err && err != -EOPNOTSUPP) in dsa_port_host_vlan_add()
1333 vlan_vid_add(conduit, htons(ETH_P_8021Q), vlan->vid); in dsa_port_host_vlan_add()
1349 if (err && err != -EOPNOTSUPP) in dsa_port_host_vlan_del()
1352 vlan_vid_del(conduit, htons(ETH_P_8021Q), vlan->vid); in dsa_port_host_vlan_del()
1360 struct dsa_switch *ds = dp->ds; in dsa_port_mrp_add()
1362 if (!ds->ops->port_mrp_add) in dsa_port_mrp_add()
1363 return -EOPNOTSUPP; in dsa_port_mrp_add()
1365 return ds->ops->port_mrp_add(ds, dp->index, mrp); in dsa_port_mrp_add()
1371 struct dsa_switch *ds = dp->ds; in dsa_port_mrp_del()
1373 if (!ds->ops->port_mrp_del) in dsa_port_mrp_del()
1374 return -EOPNOTSUPP; in dsa_port_mrp_del()
1376 return ds->ops->port_mrp_del(ds, dp->index, mrp); in dsa_port_mrp_del()
1382 struct dsa_switch *ds = dp->ds; in dsa_port_mrp_add_ring_role()
1384 if (!ds->ops->port_mrp_add_ring_role) in dsa_port_mrp_add_ring_role()
1385 return -EOPNOTSUPP; in dsa_port_mrp_add_ring_role()
1387 return ds->ops->port_mrp_add_ring_role(ds, dp->index, mrp); in dsa_port_mrp_add_ring_role()
1393 struct dsa_switch *ds = dp->ds; in dsa_port_mrp_del_ring_role()
1395 if (!ds->ops->port_mrp_del_ring_role) in dsa_port_mrp_del_ring_role()
1396 return -EOPNOTSUPP; in dsa_port_mrp_del_ring_role()
1398 return ds->ops->port_mrp_del_ring_role(ds, dp->index, mrp); in dsa_port_mrp_del_ring_role()
1406 struct dsa_switch *ds = dp->ds; in dsa_port_assign_conduit()
1407 int port = dp->index, err; in dsa_port_assign_conduit()
1409 err = ds->ops->port_change_conduit(ds, port, conduit, extack); in dsa_port_assign_conduit()
1411 dev_err(ds->dev, "port %d failed to assign conduit %s: %pe\n", in dsa_port_assign_conduit()
1412 port, conduit->name, ERR_PTR(err)); in dsa_port_assign_conduit()
1417 dp->cpu_dp = conduit->dsa_ptr; in dsa_port_assign_conduit()
1418 dp->cpu_port_in_lag = netif_is_lag_master(conduit); in dsa_port_assign_conduit()
1423 /* Change the dp->cpu_dp affinity for a user port. Note that both cross-chip
1424 * notifiers and drivers have implicit assumptions about user-to-CPU-port
1436 struct net_device *dev = dp->user; in dsa_port_change_conduit()
1437 struct dsa_switch *ds = dp->ds; in dsa_port_change_conduit()
1451 * under a bridge, either due to ds->vlan_filtering_is_global or in dsa_port_change_conduit()
1452 * ds->needs_standalone_vlan_filtering. In turn this means VLANs in dsa_port_change_conduit()
1470 /* If live-changing, we also need to uninstall the user device address in dsa_port_change_conduit()
1473 if (dev->flags & IFF_UP) in dsa_port_change_conduit()
1483 if (is_zero_ether_addr(dp->mac)) in dsa_port_change_conduit()
1486 /* If live-changing, we need to install the user device address to the in dsa_port_change_conduit()
1489 if (dev->flags & IFF_UP) { in dsa_port_change_conduit()
1490 err = dsa_user_host_uc_install(dev, dev->dev_addr); in dsa_port_change_conduit()
1511 if (err && err == -EOPNOTSUPP) { in dsa_port_change_conduit()
1527 if (dev->flags & IFF_UP) in dsa_port_change_conduit()
1531 if (is_zero_ether_addr(dp->mac)) in dsa_port_change_conduit()
1538 if (dev->flags & IFF_UP) { in dsa_port_change_conduit()
1539 tmp = dsa_user_host_uc_install(dev, dev->dev_addr); in dsa_port_change_conduit()
1541 dev_err(ds->dev, in dsa_port_change_conduit()
1543 dp->index, ERR_PTR(tmp)); in dsa_port_change_conduit()
1552 dev_err(ds->dev, in dsa_port_change_conduit()
1554 dp->index, ERR_PTR(tmp)); in dsa_port_change_conduit()
1562 dev_err(ds->dev, in dsa_port_change_conduit()
1564 dp->index, bridge_dev->name, ERR_PTR(tmp)); in dsa_port_change_conduit()
1574 cpu_dp->rcv = tag_ops->rcv; in dsa_port_set_tag_protocol()
1575 cpu_dp->tag_ops = tag_ops; in dsa_port_set_tag_protocol()
1583 struct phylink_pcs *pcs = ERR_PTR(-EOPNOTSUPP); in dsa_port_phylink_mac_select_pcs()
1584 struct dsa_switch *ds = dp->ds; in dsa_port_phylink_mac_select_pcs()
1586 if (ds->ops->phylink_mac_select_pcs) in dsa_port_phylink_mac_select_pcs()
1587 pcs = ds->ops->phylink_mac_select_pcs(ds, dp->index, interface); in dsa_port_phylink_mac_select_pcs()
1597 struct dsa_switch *ds = dp->ds; in dsa_port_phylink_mac_config()
1599 if (!ds->ops->phylink_mac_config) in dsa_port_phylink_mac_config()
1602 ds->ops->phylink_mac_config(ds, dp->index, mode, state); in dsa_port_phylink_mac_config()
1610 struct dsa_switch *ds = dp->ds; in dsa_port_phylink_mac_link_down()
1612 if (!ds->ops->phylink_mac_link_down) in dsa_port_phylink_mac_link_down()
1615 ds->ops->phylink_mac_link_down(ds, dp->index, mode, interface); in dsa_port_phylink_mac_link_down()
1626 struct dsa_switch *ds = dp->ds; in dsa_port_phylink_mac_link_up()
1628 if (!ds->ops->phylink_mac_link_up) in dsa_port_phylink_mac_link_up()
1631 ds->ops->phylink_mac_link_up(ds, dp->index, mode, interface, phydev, in dsa_port_phylink_mac_link_up()
1645 struct dsa_switch *ds = dp->ds; in dsa_port_phylink_create()
1650 err = of_get_phy_mode(dp->dn, &mode); in dsa_port_phylink_create()
1654 if (ds->ops->phylink_get_caps) { in dsa_port_phylink_create()
1655 ds->ops->phylink_get_caps(ds, dp->index, &dp->pl_config); in dsa_port_phylink_create()
1659 __set_bit(mode, dp->pl_config.supported_interfaces); in dsa_port_phylink_create()
1662 dp->pl_config.supported_interfaces); in dsa_port_phylink_create()
1664 dp->pl_config.supported_interfaces); in dsa_port_phylink_create()
1669 if (ds->phylink_mac_ops) in dsa_port_phylink_create()
1670 mac_ops = ds->phylink_mac_ops; in dsa_port_phylink_create()
1672 pl = phylink_create(&dp->pl_config, of_fwnode_handle(dp->dn), mode, in dsa_port_phylink_create()
1679 dp->pl = pl; in dsa_port_phylink_create()
1686 phylink_destroy(dp->pl); in dsa_port_phylink_destroy()
1687 dp->pl = NULL; in dsa_port_phylink_destroy()
1692 struct dsa_switch *ds = dp->ds; in dsa_shared_port_phylink_register()
1693 struct device_node *port_dn = dp->dn; in dsa_shared_port_phylink_register()
1696 dp->pl_config.dev = ds->dev; in dsa_shared_port_phylink_register()
1697 dp->pl_config.type = PHYLINK_DEV; in dsa_shared_port_phylink_register()
1703 err = phylink_of_phy_connect(dp->pl, port_dn, 0); in dsa_shared_port_phylink_register()
1704 if (err && err != -ENODEV) { in dsa_shared_port_phylink_register()
1718 * link management perspective (phy-handle, fixed-link, etc). Additionally, the
1719 * phy-mode may be absent. The interpretation of these port OF nodes depends on
1722 * User ports with no phy-handle or fixed-link are expected to connect to an
1723 * internal PHY located on the ds->user_mii_bus at an MDIO address equal to
1726 * Shared (CPU and DSA) ports with no phy-handle or fixed-link are expected to
1727 * operate at the maximum speed that their phy-mode is capable of. If the
1728 * phy-mode is absent, they are expected to operate using the phy-mode
1731 * if the phy-mode is a SERDES link, whether in-band autoneg is expected to be
1741 * a fixed-link, a phy-handle, or a managed = "in-band-status" property.
1768 "brcm,bcm53010-srab",
1769 "brcm,bcm53011-srab",
1770 "brcm,bcm53012-srab",
1771 "brcm,bcm53018-srab",
1772 "brcm,bcm53019-srab",
1773 "brcm,bcm5301x-srab",
1774 "brcm,bcm11360-srab",
1775 "brcm,bcm58522-srab",
1776 "brcm,bcm58525-srab",
1777 "brcm,bcm58535-srab",
1778 "brcm,bcm58622-srab",
1779 "brcm,bcm58623-srab",
1780 "brcm,bcm58625-srab",
1781 "brcm,bcm88312-srab",
1782 "brcm,cygnus-srab",
1783 "brcm,nsp-srab",
1784 "brcm,omega-srab",
1785 "brcm,bcm3384-switch",
1786 "brcm,bcm6328-switch",
1787 "brcm,bcm6368-switch",
1788 "brcm,bcm63xx-switch",
1791 "brcm,bcm7445-switch-v4.0",
1792 "brcm,bcm7278-switch-v4.0",
1793 "brcm,bcm7278-switch-v4.8",
1796 "lantiq,xrx200-gswip",
1797 "lantiq,xrx300-gswip",
1798 "lantiq,xrx330-gswip",
1822 "smsc,lan9303-mdio",
1825 "smsc,lan9303-i2c",
1834 struct device_node *dn = dp->dn, *phy_np; in dsa_shared_port_validate_of()
1835 struct dsa_switch *ds = dp->ds; in dsa_shared_port_validate_of()
1843 dev_err(ds->dev, in dsa_shared_port_validate_of()
1844 "OF node %pOF of %s port %d lacks the required \"phy-mode\" property\n", in dsa_shared_port_validate_of()
1845 dn, dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index); in dsa_shared_port_validate_of()
1849 * managed = "in-band-status" in dsa_shared_port_validate_of()
1854 phy_np = of_parse_phandle(dn, "phy-handle", 0); in dsa_shared_port_validate_of()
1862 dev_err(ds->dev, in dsa_shared_port_validate_of()
1863 …"OF node %pOF of %s port %d lacks the required \"phy-handle\", \"fixed-link\" or \"managed\" prope… in dsa_shared_port_validate_of()
1864 dn, dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index); in dsa_shared_port_validate_of()
1869 struct dsa_switch *ds = dp->ds; in dsa_shared_port_link_down()
1871 if (ds->phylink_mac_ops && ds->phylink_mac_ops->mac_link_down) in dsa_shared_port_link_down()
1872 ds->phylink_mac_ops->mac_link_down(&dp->pl_config, MLO_AN_FIXED, in dsa_shared_port_link_down()
1874 else if (ds->ops->phylink_mac_link_down) in dsa_shared_port_link_down()
1875 ds->ops->phylink_mac_link_down(ds, dp->index, MLO_AN_FIXED, in dsa_shared_port_link_down()
1881 struct dsa_switch *ds = dp->ds; in dsa_shared_port_link_register_of()
1889 !of_device_compatible_match(ds->dev->of_node, in dsa_shared_port_link_register_of()
1891 return -EINVAL; in dsa_shared_port_link_register_of()
1894 dev_warn(ds->dev, in dsa_shared_port_link_register_of()
1896 dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index); in dsa_shared_port_link_register_of()
1908 if (dp->pl) { in dsa_shared_port_link_unregister_of()
1910 phylink_disconnect_phy(dp->pl); in dsa_shared_port_link_unregister_of()
1920 struct dsa_switch *ds = dp->ds; in dsa_port_hsr_join()
1923 if (!ds->ops->port_hsr_join) in dsa_port_hsr_join()
1924 return -EOPNOTSUPP; in dsa_port_hsr_join()
1926 dp->hsr_dev = hsr; in dsa_port_hsr_join()
1928 err = ds->ops->port_hsr_join(ds, dp->index, hsr, extack); in dsa_port_hsr_join()
1930 dp->hsr_dev = NULL; in dsa_port_hsr_join()
1937 struct dsa_switch *ds = dp->ds; in dsa_port_hsr_leave()
1940 dp->hsr_dev = NULL; in dsa_port_hsr_leave()
1942 if (ds->ops->port_hsr_leave) { in dsa_port_hsr_leave()
1943 err = ds->ops->port_hsr_leave(ds, dp->index, hsr); in dsa_port_hsr_leave()
1945 dev_err(dp->ds->dev, in dsa_port_hsr_leave()
1947 dp->index, hsr->name, ERR_PTR(err)); in dsa_port_hsr_leave()
1977 dev_err(dp->ds->dev, in dsa_port_tag_8021q_vlan_del()
1979 dp->index, vid, ERR_PTR(err)); in dsa_port_tag_8021q_vlan_del()