Lines Matching full:ocelot
5 * register-compatible with Ocelot and that perform I/O to their host CPU
15 #include <soc/mscc/ocelot.h>
17 #include <linux/dsa/ocelot.h>
28 /* Translate the DSA database API into the ocelot switch library API,
48 struct ocelot *ocelot = ds->priv; in felix_cpu_port_for_conduit() local
53 mutex_lock(&ocelot->fwd_domain_lock); in felix_cpu_port_for_conduit()
54 lag = ocelot_bond_get_id(ocelot, conduit); in felix_cpu_port_for_conduit()
55 mutex_unlock(&ocelot->fwd_domain_lock); in felix_cpu_port_for_conduit()
106 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_vlan_add_rx() local
110 key_length = ocelot->vcap[VCAP_ES0].keys[VCAP_ES0_IGR_PORT].length; in felix_tag_8021q_vlan_add_rx()
117 cookie = OCELOT_VCAP_ES0_TAG_8021Q_RXVLAN(ocelot, port, upstream); in felix_tag_8021q_vlan_add_rx()
143 err = ocelot_vcap_filter_add(ocelot, outer_tagging_rule, NULL); in felix_tag_8021q_vlan_add_rx()
155 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_vlan_del_rx() local
158 block_vcap_es0 = &ocelot->block[VCAP_ES0]; in felix_tag_8021q_vlan_del_rx()
159 cookie = OCELOT_VCAP_ES0_TAG_8021Q_RXVLAN(ocelot, port, upstream); in felix_tag_8021q_vlan_del_rx()
166 return ocelot_vcap_filter_del(ocelot, outer_tagging_rule); in felix_tag_8021q_vlan_del_rx()
177 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_vlan_add_tx() local
191 cookie = OCELOT_VCAP_IS1_TAG_8021Q_TXVLAN(ocelot, port); in felix_tag_8021q_vlan_add_tx()
208 err = ocelot_vcap_filter_add(ocelot, untagging_rule, NULL); in felix_tag_8021q_vlan_add_tx()
215 cookie = OCELOT_VCAP_IS2_TAG_8021Q_TXVLAN(ocelot, port); in felix_tag_8021q_vlan_add_tx()
229 err = ocelot_vcap_filter_add(ocelot, redirect_rule, NULL); in felix_tag_8021q_vlan_add_tx()
231 ocelot_vcap_filter_del(ocelot, untagging_rule); in felix_tag_8021q_vlan_add_tx()
244 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_vlan_del_tx() local
248 block_vcap_is1 = &ocelot->block[VCAP_IS1]; in felix_tag_8021q_vlan_del_tx()
249 block_vcap_is2 = &ocelot->block[VCAP_IS2]; in felix_tag_8021q_vlan_del_tx()
251 cookie = OCELOT_VCAP_IS1_TAG_8021Q_TXVLAN(ocelot, port); in felix_tag_8021q_vlan_del_tx()
257 err = ocelot_vcap_filter_del(ocelot, untagging_rule); in felix_tag_8021q_vlan_del_tx()
261 cookie = OCELOT_VCAP_IS2_TAG_8021Q_TXVLAN(ocelot, port); in felix_tag_8021q_vlan_del_tx()
267 return ocelot_vcap_filter_del(ocelot, redirect_rule); in felix_tag_8021q_vlan_del_tx()
338 struct ocelot *ocelot = ds->priv; in felix_update_tag_8021q_rx_rules() local
343 block_vcap_es0 = &ocelot->block[VCAP_ES0]; in felix_update_tag_8021q_rx_rules()
346 cookie = OCELOT_VCAP_ES0_TAG_8021Q_RXVLAN(ocelot, port, in felix_update_tag_8021q_rx_rules()
354 err = ocelot_vcap_filter_replace(ocelot, outer_tagging_rule); in felix_update_tag_8021q_rx_rules()
379 * their arrival when using the ocelot-8021q tagging protocol.
384 struct ocelot *ocelot = ds->priv; in felix_update_trapping_destinations() local
385 struct felix *felix = ocelot_to_felix(ocelot); in felix_update_trapping_destinations()
399 block_vcap_is2 = &ocelot->block[VCAP_IS2]; in felix_update_trapping_destinations()
433 err = ocelot_vcap_filter_replace(ocelot, trap); in felix_update_trapping_destinations()
447 static void felix_npi_port_init(struct ocelot *ocelot, int port) in felix_npi_port_init() argument
449 ocelot->npi = port; in felix_npi_port_init()
451 ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK_M | in felix_npi_port_init()
456 ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_XTR_HDR, in felix_npi_port_init()
457 ocelot->npi_xtr_prefix); in felix_npi_port_init()
458 ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_INJ_HDR, in felix_npi_port_init()
459 ocelot->npi_inj_prefix); in felix_npi_port_init()
462 ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, 0); in felix_npi_port_init()
465 static void felix_npi_port_deinit(struct ocelot *ocelot, int port) in felix_npi_port_deinit() argument
468 int unused_port = ocelot->num_phys_ports + 2; in felix_npi_port_deinit()
470 ocelot->npi = -1; in felix_npi_port_deinit()
472 ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPU_PORT(unused_port), in felix_npi_port_deinit()
475 ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_XTR_HDR, in felix_npi_port_deinit()
477 ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_INJ_HDR, in felix_npi_port_deinit()
481 ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, 1); in felix_npi_port_deinit()
487 struct ocelot *ocelot = ds->priv; in felix_tag_npi_setup() local
501 felix_npi_port_init(ocelot, first_cpu_dp->index); in felix_tag_npi_setup()
508 struct ocelot *ocelot = ds->priv; in felix_tag_npi_teardown() local
510 felix_npi_port_deinit(ocelot, ocelot->npi); in felix_tag_npi_teardown()
515 struct ocelot *ocelot = ds->priv; in felix_tag_npi_get_host_fwd_mask() local
517 return BIT(ocelot->num_phys_ports); in felix_tag_npi_get_host_fwd_mask()
525 struct ocelot *ocelot = ds->priv; in felix_tag_npi_change_conduit() local
529 "LAG DSA conduit only supported using ocelot-8021q"); in felix_tag_npi_change_conduit()
548 felix_npi_port_deinit(ocelot, ocelot->npi); in felix_tag_npi_change_conduit()
549 felix_npi_port_init(ocelot, felix_cpu_port_for_conduit(ds, conduit)); in felix_tag_npi_change_conduit()
570 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_setup() local
579 ocelot_port_setup_dsa_8021q_cpu(ocelot, dp->index); in felix_tag_8021q_setup()
582 ocelot_port_assign_dsa_8021q_cpu(ocelot, dp->index, in felix_tag_8021q_setup()
596 ocelot_write_gix(ocelot, in felix_tag_8021q_setup()
607 ocelot_lock_xtr_grp_bh(ocelot, 0); in felix_tag_8021q_setup()
608 ocelot_drain_cpu_queue(ocelot, 0); in felix_tag_8021q_setup()
609 ocelot_unlock_xtr_grp_bh(ocelot, 0); in felix_tag_8021q_setup()
626 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_teardown() local
633 ocelot_write_gix(ocelot, in felix_tag_8021q_teardown()
639 ocelot_port_unassign_dsa_8021q_cpu(ocelot, dp->index); in felix_tag_8021q_teardown()
642 ocelot_port_teardown_dsa_8021q_cpu(ocelot, dp->index); in felix_tag_8021q_teardown()
659 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_change_conduit() local
661 ocelot_port_unassign_dsa_8021q_cpu(ocelot, port); in felix_tag_8021q_change_conduit()
662 ocelot_port_assign_dsa_8021q_cpu(ocelot, port, cpu); in felix_tag_8021q_change_conduit()
677 struct ocelot *ocelot = ds->priv; in felix_set_host_flood() local
681 ocelot_rmw_rix(ocelot, val, mask, ANA_PGID_PGID, PGID_UC); in felix_set_host_flood()
684 ocelot_rmw_rix(ocelot, val, mask, ANA_PGID_PGID, PGID_MC); in felix_set_host_flood()
685 ocelot_rmw_rix(ocelot, val, mask, ANA_PGID_PGID, PGID_MCIPV4); in felix_set_host_flood()
686 ocelot_rmw_rix(ocelot, val, mask, ANA_PGID_PGID, PGID_MCIPV6); in felix_set_host_flood()
689 ocelot_rmw_rix(ocelot, val, mask, ANA_PGID_PGID, PGID_BC); in felix_set_host_flood()
697 struct ocelot *ocelot = ds->priv; in felix_migrate_host_flood() local
698 struct felix *felix = ocelot_to_felix(ocelot); in felix_migrate_host_flood()
715 struct ocelot *ocelot = ds->priv; in felix_migrate_mdbs() local
724 return ocelot_migrate_mdbs(ocelot, from, to); in felix_migrate_mdbs()
759 struct ocelot *ocelot = ds->priv; in felix_change_tag_protocol() local
760 struct felix *felix = ocelot_to_felix(ocelot); in felix_change_tag_protocol()
806 struct ocelot *ocelot = ds->priv; in felix_get_tag_protocol() local
807 struct felix *felix = ocelot_to_felix(ocelot); in felix_get_tag_protocol()
815 struct ocelot *ocelot = ds->priv; in felix_port_set_host_flood() local
816 struct felix *felix = ocelot_to_felix(ocelot); in felix_port_set_host_flood()
838 struct ocelot *ocelot = ds->priv; in felix_port_change_conduit() local
839 struct felix *felix = ocelot_to_felix(ocelot); in felix_port_change_conduit()
847 struct ocelot *ocelot = ds->priv; in felix_set_ageing_time() local
849 ocelot_set_ageing_time(ocelot, ageing_time); in felix_set_ageing_time()
856 struct ocelot *ocelot = ds->priv; in felix_port_fast_age() local
859 err = ocelot_mact_flush(ocelot, port); in felix_port_fast_age()
868 struct ocelot *ocelot = ds->priv; in felix_fdb_dump() local
870 return ocelot_fdb_dump(ocelot, port, cb, data); in felix_fdb_dump()
879 struct ocelot *ocelot = ds->priv; in felix_fdb_add() local
891 return ocelot_fdb_add(ocelot, port, addr, vid, bridge_dev); in felix_fdb_add()
900 struct ocelot *ocelot = ds->priv; in felix_fdb_del() local
912 return ocelot_fdb_del(ocelot, port, addr, vid, bridge_dev); in felix_fdb_del()
920 struct ocelot *ocelot = ds->priv; in felix_lag_fdb_add() local
925 return ocelot_lag_fdb_add(ocelot, lag.dev, addr, vid, bridge_dev); in felix_lag_fdb_add()
933 struct ocelot *ocelot = ds->priv; in felix_lag_fdb_del() local
938 return ocelot_lag_fdb_del(ocelot, lag.dev, addr, vid, bridge_dev); in felix_lag_fdb_del()
946 struct ocelot *ocelot = ds->priv; in felix_mdb_add() local
955 if (port == ocelot->npi) in felix_mdb_add()
956 port = ocelot->num_phys_ports; in felix_mdb_add()
958 return ocelot_port_mdb_add(ocelot, port, mdb, bridge_dev); in felix_mdb_add()
966 struct ocelot *ocelot = ds->priv; in felix_mdb_del() local
975 if (port == ocelot->npi) in felix_mdb_del()
976 port = ocelot->num_phys_ports; in felix_mdb_del()
978 return ocelot_port_mdb_del(ocelot, port, mdb, bridge_dev); in felix_mdb_del()
984 struct ocelot *ocelot = ds->priv; in felix_bridge_stp_state_set() local
986 return ocelot_bridge_stp_state_set(ocelot, port, state); in felix_bridge_stp_state_set()
993 struct ocelot *ocelot = ds->priv; in felix_pre_bridge_flags() local
995 return ocelot_port_pre_bridge_flags(ocelot, port, val); in felix_pre_bridge_flags()
1002 struct ocelot *ocelot = ds->priv; in felix_bridge_flags() local
1004 if (port == ocelot->npi) in felix_bridge_flags()
1005 port = ocelot->num_phys_ports; in felix_bridge_flags()
1007 ocelot_port_bridge_flags(ocelot, port, val); in felix_bridge_flags()
1016 struct ocelot *ocelot = ds->priv; in felix_bridge_join() local
1018 return ocelot_port_bridge_join(ocelot, port, bridge.dev, bridge.num, in felix_bridge_join()
1025 struct ocelot *ocelot = ds->priv; in felix_bridge_leave() local
1027 ocelot_port_bridge_leave(ocelot, port, bridge.dev); in felix_bridge_leave()
1035 struct ocelot *ocelot = ds->priv; in felix_lag_join() local
1038 err = ocelot_port_lag_join(ocelot, port, lag.dev, info, extack); in felix_lag_join()
1052 struct ocelot *ocelot = ds->priv; in felix_lag_leave() local
1054 ocelot_port_lag_leave(ocelot, port, lag.dev); in felix_lag_leave()
1066 struct ocelot *ocelot = ds->priv; in felix_lag_change() local
1068 ocelot_port_lag_change(ocelot, port, dp->lag_tx_enabled); in felix_lag_change()
1077 struct ocelot *ocelot = ds->priv; in felix_vlan_prepare() local
1080 /* Ocelot switches copy frames as-is to the CPU, so the flags: in felix_vlan_prepare()
1084 * Just accept any configuration, and don't let ocelot deny installing in felix_vlan_prepare()
1088 if (port == ocelot->npi) in felix_vlan_prepare()
1091 return ocelot_vlan_prepare(ocelot, port, vlan->vid, in felix_vlan_prepare()
1100 struct ocelot *ocelot = ds->priv; in felix_vlan_filtering() local
1105 err = ocelot_port_vlan_filtering(ocelot, port, enabled, extack); in felix_vlan_filtering()
1109 felix = ocelot_to_felix(ocelot); in felix_vlan_filtering()
1124 struct ocelot *ocelot = ds->priv; in felix_vlan_add() local
1132 return ocelot_vlan_add(ocelot, port, vlan->vid, in felix_vlan_add()
1140 struct ocelot *ocelot = ds->priv; in felix_vlan_del() local
1142 return ocelot_vlan_del(ocelot, port, vlan->vid); in felix_vlan_del()
1148 struct ocelot *ocelot = ds->priv; in felix_phylink_get_caps() local
1154 __set_bit(ocelot->ports[port]->phy_mode, in felix_phylink_get_caps()
1163 struct ocelot *ocelot = dp->ds->priv; in felix_phylink_mac_config() local
1167 felix = ocelot_to_felix(ocelot); in felix_phylink_mac_config()
1170 felix->info->phylink_mac_config(ocelot, port, mode, state); in felix_phylink_mac_config()
1178 struct ocelot *ocelot = dp->ds->priv; in felix_phylink_mac_select_pcs() local
1183 felix = ocelot_to_felix(ocelot); in felix_phylink_mac_select_pcs()
1196 struct ocelot *ocelot = dp->ds->priv; in felix_phylink_mac_link_down() local
1200 felix = ocelot_to_felix(ocelot); in felix_phylink_mac_link_down()
1202 ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, interface, in felix_phylink_mac_link_down()
1214 struct ocelot *ocelot = dp->ds->priv; in felix_phylink_mac_link_up() local
1218 felix = ocelot_to_felix(ocelot); in felix_phylink_mac_link_up()
1220 ocelot_phylink_mac_link_up(ocelot, port, phydev, link_an_mode, in felix_phylink_mac_link_up()
1225 felix->info->port_sched_speed_set(ocelot, port, speed); in felix_phylink_mac_link_up()
1232 struct ocelot *ocelot = ds->priv; in felix_port_enable() local
1237 if (ocelot->npi >= 0) { in felix_port_enable()
1240 if (felix_cpu_port_for_conduit(ds, conduit) != ocelot->npi) { in felix_port_enable()
1249 static void felix_port_qos_map_init(struct ocelot *ocelot, int port) in felix_port_qos_map_init() argument
1253 ocelot_rmw_gix(ocelot, in felix_port_qos_map_init()
1260 ocelot_rmw_ix(ocelot, in felix_port_qos_map_init()
1273 struct ocelot *ocelot = ds->priv; in felix_get_stats64() local
1275 ocelot_port_get_stats64(ocelot, port, stats); in felix_get_stats64()
1281 struct ocelot *ocelot = ds->priv; in felix_get_pause_stats() local
1283 ocelot_port_get_pause_stats(ocelot, port, pause_stats); in felix_get_pause_stats()
1290 struct ocelot *ocelot = ds->priv; in felix_get_rmon_stats() local
1292 ocelot_port_get_rmon_stats(ocelot, port, rmon_stats, ranges); in felix_get_rmon_stats()
1298 struct ocelot *ocelot = ds->priv; in felix_get_eth_ctrl_stats() local
1300 ocelot_port_get_eth_ctrl_stats(ocelot, port, ctrl_stats); in felix_get_eth_ctrl_stats()
1306 struct ocelot *ocelot = ds->priv; in felix_get_eth_mac_stats() local
1308 ocelot_port_get_eth_mac_stats(ocelot, port, mac_stats); in felix_get_eth_mac_stats()
1314 struct ocelot *ocelot = ds->priv; in felix_get_eth_phy_stats() local
1316 ocelot_port_get_eth_phy_stats(ocelot, port, phy_stats); in felix_get_eth_phy_stats()
1322 struct ocelot *ocelot = ds->priv; in felix_get_strings() local
1324 return ocelot_get_strings(ocelot, port, stringset, data); in felix_get_strings()
1329 struct ocelot *ocelot = ds->priv; in felix_get_ethtool_stats() local
1331 ocelot_get_ethtool_stats(ocelot, port, data); in felix_get_ethtool_stats()
1336 struct ocelot *ocelot = ds->priv; in felix_get_sset_count() local
1338 return ocelot_get_sset_count(ocelot, port, sset); in felix_get_sset_count()
1344 struct ocelot *ocelot = ds->priv; in felix_get_ts_info() local
1346 return ocelot_get_ts_info(ocelot, port, info); in felix_get_ts_info()
1372 struct device *dev = felix->ocelot.dev; in felix_parse_ports_node()
1415 struct device *dev = felix->ocelot.dev; in felix_parse_dt()
1439 struct ocelot *ocelot = &felix->ocelot; in felix_request_regmap_by_name() local
1448 return dev_get_regmap(ocelot->dev->parent, resource_name); in felix_request_regmap_by_name()
1458 return ocelot_regmap_init(ocelot, &res); in felix_request_regmap_by_name()
1489 struct ocelot *ocelot = &felix->ocelot; in felix_init_structs() local
1494 ocelot->num_phys_ports = num_phys_ports; in felix_init_structs()
1495 ocelot->ports = devm_kcalloc(ocelot->dev, num_phys_ports, in felix_init_structs()
1497 if (!ocelot->ports) in felix_init_structs()
1500 ocelot->map = felix->info->map; in felix_init_structs()
1501 ocelot->num_mact_rows = felix->info->num_mact_rows; in felix_init_structs()
1502 ocelot->vcap = felix->info->vcap; in felix_init_structs()
1503 ocelot->vcap_pol.base = felix->info->vcap_pol_base; in felix_init_structs()
1504 ocelot->vcap_pol.max = felix->info->vcap_pol_max; in felix_init_structs()
1505 ocelot->vcap_pol.base2 = felix->info->vcap_pol_base2; in felix_init_structs()
1506 ocelot->vcap_pol.max2 = felix->info->vcap_pol_max2; in felix_init_structs()
1507 ocelot->ops = felix->info->ops; in felix_init_structs()
1508 ocelot->npi_inj_prefix = OCELOT_TAG_PREFIX_SHORT; in felix_init_structs()
1509 ocelot->npi_xtr_prefix = OCELOT_TAG_PREFIX_SHORT; in felix_init_structs()
1510 ocelot->devlink = felix->ds->devlink; in felix_init_structs()
1526 dev_err(ocelot->dev, in felix_init_structs()
1533 ocelot->targets[i] = target; in felix_init_structs()
1536 err = ocelot_regfields_init(ocelot, felix->info->regfields); in felix_init_structs()
1538 dev_err(ocelot->dev, "failed to init reg fields map\n"); in felix_init_structs()
1546 ocelot_port = devm_kzalloc(ocelot->dev, in felix_init_structs()
1550 dev_err(ocelot->dev, in felix_init_structs()
1558 dev_err(ocelot->dev, in felix_init_structs()
1566 ocelot_port->ocelot = ocelot; in felix_init_structs()
1569 ocelot->ports[port] = ocelot_port; in felix_init_structs()
1575 err = felix->info->mdio_bus_alloc(ocelot); in felix_init_structs()
1583 static void ocelot_port_purge_txtstamp_skb(struct ocelot *ocelot, int port, in ocelot_port_purge_txtstamp_skb() argument
1586 struct ocelot_port *ocelot_port = ocelot->ports[port]; in ocelot_port_purge_txtstamp_skb()
1619 struct ocelot *ocelot = ds->priv; in felix_port_deferred_xmit() local
1623 ocelot_lock_inj_grp(ocelot, 0); in felix_port_deferred_xmit()
1626 if (ocelot_can_inject(ocelot, 0)) in felix_port_deferred_xmit()
1633 ocelot_unlock_inj_grp(ocelot, 0); in felix_port_deferred_xmit()
1634 dev_err(ocelot->dev, "port %d failed to inject skb\n", in felix_port_deferred_xmit()
1636 ocelot_port_purge_txtstamp_skb(ocelot, port, skb); in felix_port_deferred_xmit()
1641 ocelot_port_inject_frame(ocelot, port, 0, rew_op, skb); in felix_port_deferred_xmit()
1643 ocelot_unlock_inj_grp(ocelot, 0); in felix_port_deferred_xmit()
1669 struct ocelot *ocelot = ds->priv; in felix_setup() local
1670 struct felix *felix = ocelot_to_felix(ocelot); in felix_setup()
1678 if (ocelot->targets[HSIO]) in felix_setup()
1679 ocelot_pll5_init(ocelot); in felix_setup()
1681 err = ocelot_init(ocelot); in felix_setup()
1685 if (ocelot->ptp) { in felix_setup()
1686 err = ocelot_init_timestamp(ocelot, felix->info->ptp_caps); in felix_setup()
1688 dev_err(ocelot->dev, in felix_setup()
1690 ocelot->ptp = 0; in felix_setup()
1695 ocelot_init_port(ocelot, dp->index); in felix_setup()
1698 felix->info->configure_serdes(ocelot, dp->index, in felix_setup()
1704 felix_port_qos_map_init(ocelot, dp->index); in felix_setup()
1708 err = felix->info->request_irq(ocelot); in felix_setup()
1710 dev_err(ocelot->dev, "Failed to request IRQ: %pe\n", in felix_setup()
1716 err = ocelot_devlink_sb_register(ocelot); in felix_setup()
1734 ocelot_deinit_port(ocelot, dp->index); in felix_setup()
1736 ocelot_deinit_timestamp(ocelot); in felix_setup()
1737 ocelot_deinit(ocelot); in felix_setup()
1741 felix->info->mdio_bus_free(ocelot); in felix_setup()
1748 struct ocelot *ocelot = ds->priv; in felix_teardown() local
1749 struct felix *felix = ocelot_to_felix(ocelot); in felix_teardown()
1758 ocelot_deinit_port(ocelot, dp->index); in felix_teardown()
1760 ocelot_devlink_sb_unregister(ocelot); in felix_teardown()
1761 ocelot_deinit_timestamp(ocelot); in felix_teardown()
1762 ocelot_deinit(ocelot); in felix_teardown()
1765 felix->info->mdio_bus_free(ocelot); in felix_teardown()
1771 struct ocelot *ocelot = ds->priv; in felix_hwtstamp_get() local
1773 return ocelot_hwstamp_get(ocelot, port, ifr); in felix_hwtstamp_get()
1779 struct ocelot *ocelot = ds->priv; in felix_hwtstamp_set() local
1780 struct felix *felix = ocelot_to_felix(ocelot); in felix_hwtstamp_set()
1784 err = ocelot_hwstamp_set(ocelot, port, ifr); in felix_hwtstamp_set()
1793 static bool felix_check_xtr_pkt(struct ocelot *ocelot) in felix_check_xtr_pkt() argument
1795 struct felix *felix = ocelot_to_felix(ocelot); in felix_check_xtr_pkt()
1804 ocelot_lock_xtr_grp(ocelot, grp); in felix_check_xtr_pkt()
1806 while (ocelot_read(ocelot, QS_XTR_DATA_PRESENT) & BIT(grp)) { in felix_check_xtr_pkt()
1810 err = ocelot_xtr_poll_frame(ocelot, grp, &skb); in felix_check_xtr_pkt()
1836 dev_err_ratelimited(ocelot->dev, in felix_check_xtr_pkt()
1839 ocelot_drain_cpu_queue(ocelot, 0); in felix_check_xtr_pkt()
1842 ocelot_unlock_xtr_grp(ocelot, grp); in felix_check_xtr_pkt()
1852 struct ocelot *ocelot = ds->priv; in felix_rxtstamp() local
1859 if (!(ocelot->ports[port]->trap_proto & OCELOT_PROTO_PTP_L2)) in felix_rxtstamp()
1864 if (!(ocelot->ports[port]->trap_proto & OCELOT_PROTO_PTP_L4)) in felix_rxtstamp()
1874 if (felix_check_xtr_pkt(ocelot)) { in felix_rxtstamp()
1879 ocelot_ptp_gettime64(&ocelot->ptp_info, &ts); in felix_rxtstamp()
1897 struct ocelot *ocelot = ds->priv; in felix_txtstamp() local
1900 if (!ocelot->ptp) in felix_txtstamp()
1903 if (ocelot_port_txtstamp_request(ocelot, port, skb, &clone)) { in felix_txtstamp()
1916 struct ocelot *ocelot = ds->priv; in felix_change_mtu() local
1917 struct ocelot_port *ocelot_port = ocelot->ports[port]; in felix_change_mtu()
1919 ocelot_port_set_maxlen(ocelot, port, new_mtu); in felix_change_mtu()
1921 mutex_lock(&ocelot->fwd_domain_lock); in felix_change_mtu()
1923 if (ocelot_port->taprio && ocelot->ops->tas_guard_bands_update) in felix_change_mtu()
1924 ocelot->ops->tas_guard_bands_update(ocelot, port); in felix_change_mtu()
1926 mutex_unlock(&ocelot->fwd_domain_lock); in felix_change_mtu()
1933 struct ocelot *ocelot = ds->priv; in felix_get_max_mtu() local
1935 return ocelot_get_max_mtu(ocelot, port); in felix_get_max_mtu()
1941 struct ocelot *ocelot = ds->priv; in felix_cls_flower_add() local
1942 struct felix *felix = ocelot_to_felix(ocelot); in felix_cls_flower_add()
1946 err = ocelot_cls_flower_replace(ocelot, port, cls, ingress); in felix_cls_flower_add()
1958 struct ocelot *ocelot = ds->priv; in felix_cls_flower_del() local
1960 return ocelot_cls_flower_destroy(ocelot, port, cls, ingress); in felix_cls_flower_del()
1966 struct ocelot *ocelot = ds->priv; in felix_cls_flower_stats() local
1968 return ocelot_cls_flower_stats(ocelot, port, cls, ingress); in felix_cls_flower_stats()
1974 struct ocelot *ocelot = ds->priv; in felix_port_policer_add() local
1980 return ocelot_port_policer_add(ocelot, port, &pol); in felix_port_policer_add()
1985 struct ocelot *ocelot = ds->priv; in felix_port_policer_del() local
1987 ocelot_port_policer_del(ocelot, port); in felix_port_policer_del()
1994 struct ocelot *ocelot = ds->priv; in felix_port_mirror_add() local
1996 return ocelot_port_mirror_add(ocelot, port, mirror->to_local_port, in felix_port_mirror_add()
2003 struct ocelot *ocelot = ds->priv; in felix_port_mirror_del() local
2005 ocelot_port_mirror_del(ocelot, port, mirror->ingress); in felix_port_mirror_del()
2012 struct ocelot *ocelot = ds->priv; in felix_port_setup_tc() local
2013 struct felix *felix = ocelot_to_felix(ocelot); in felix_port_setup_tc()
2025 struct ocelot *ocelot = ds->priv; in felix_sb_pool_get() local
2027 return ocelot_sb_pool_get(ocelot, sb_index, pool_index, pool_info); in felix_sb_pool_get()
2035 struct ocelot *ocelot = ds->priv; in felix_sb_pool_set() local
2037 return ocelot_sb_pool_set(ocelot, sb_index, pool_index, size, in felix_sb_pool_set()
2045 struct ocelot *ocelot = ds->priv; in felix_sb_port_pool_get() local
2047 return ocelot_sb_port_pool_get(ocelot, port, sb_index, pool_index, in felix_sb_port_pool_get()
2055 struct ocelot *ocelot = ds->priv; in felix_sb_port_pool_set() local
2057 return ocelot_sb_port_pool_set(ocelot, port, sb_index, pool_index, in felix_sb_port_pool_set()
2066 struct ocelot *ocelot = ds->priv; in felix_sb_tc_pool_bind_get() local
2068 return ocelot_sb_tc_pool_bind_get(ocelot, port, sb_index, tc_index, in felix_sb_tc_pool_bind_get()
2079 struct ocelot *ocelot = ds->priv; in felix_sb_tc_pool_bind_set() local
2081 return ocelot_sb_tc_pool_bind_set(ocelot, port, sb_index, tc_index, in felix_sb_tc_pool_bind_set()
2089 struct ocelot *ocelot = ds->priv; in felix_sb_occ_snapshot() local
2091 return ocelot_sb_occ_snapshot(ocelot, sb_index); in felix_sb_occ_snapshot()
2097 struct ocelot *ocelot = ds->priv; in felix_sb_occ_max_clear() local
2099 return ocelot_sb_occ_max_clear(ocelot, sb_index); in felix_sb_occ_max_clear()
2106 struct ocelot *ocelot = ds->priv; in felix_sb_occ_port_pool_get() local
2108 return ocelot_sb_occ_port_pool_get(ocelot, port, sb_index, pool_index, in felix_sb_occ_port_pool_get()
2117 struct ocelot *ocelot = ds->priv; in felix_sb_occ_tc_port_bind_get() local
2119 return ocelot_sb_occ_tc_port_bind_get(ocelot, port, sb_index, tc_index, in felix_sb_occ_tc_port_bind_get()
2126 struct ocelot *ocelot = ds->priv; in felix_mrp_add() local
2128 return ocelot_mrp_add(ocelot, port, mrp); in felix_mrp_add()
2134 struct ocelot *ocelot = ds->priv; in felix_mrp_del() local
2136 return ocelot_mrp_add(ocelot, port, mrp); in felix_mrp_del()
2143 struct ocelot *ocelot = ds->priv; in felix_mrp_add_ring_role() local
2145 return ocelot_mrp_add_ring_role(ocelot, port, mrp); in felix_mrp_add_ring_role()
2152 struct ocelot *ocelot = ds->priv; in felix_mrp_del_ring_role() local
2154 return ocelot_mrp_del_ring_role(ocelot, port, mrp); in felix_mrp_del_ring_role()
2159 struct ocelot *ocelot = ds->priv; in felix_port_get_default_prio() local
2161 return ocelot_port_get_default_prio(ocelot, port); in felix_port_get_default_prio()
2167 struct ocelot *ocelot = ds->priv; in felix_port_set_default_prio() local
2169 return ocelot_port_set_default_prio(ocelot, port, prio); in felix_port_set_default_prio()
2174 struct ocelot *ocelot = ds->priv; in felix_port_get_dscp_prio() local
2176 return ocelot_port_get_dscp_prio(ocelot, port, dscp); in felix_port_get_dscp_prio()
2182 struct ocelot *ocelot = ds->priv; in felix_port_add_dscp_prio() local
2184 return ocelot_port_add_dscp_prio(ocelot, port, dscp, prio); in felix_port_add_dscp_prio()
2190 struct ocelot *ocelot = ds->priv; in felix_port_del_dscp_prio() local
2192 return ocelot_port_del_dscp_prio(ocelot, port, dscp, prio); in felix_port_del_dscp_prio()
2198 struct ocelot *ocelot = ds->priv; in felix_get_mm() local
2200 return ocelot_port_get_mm(ocelot, port, state); in felix_get_mm()
2207 struct ocelot *ocelot = ds->priv; in felix_set_mm() local
2209 return ocelot_port_set_mm(ocelot, port, cfg, extack); in felix_set_mm()
2215 struct ocelot *ocelot = ds->priv; in felix_get_mm_stats() local
2217 ocelot_port_get_mm_stats(ocelot, port, stats); in felix_get_mm_stats()
2314 struct ocelot *ocelot; in felix_register_switch() local
2328 ocelot = &felix->ocelot; in felix_register_switch()
2329 ocelot->dev = dev; in felix_register_switch()
2330 ocelot->num_flooding_pgids = num_flooding_pgids; in felix_register_switch()
2331 ocelot->ptp = ptp; in felix_register_switch()
2332 ocelot->mm_supported = mm_supported; in felix_register_switch()
2344 ds->priv = ocelot; in felix_register_switch()
2354 struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port) in felix_port_to_netdev() argument
2356 struct felix *felix = ocelot_to_felix(ocelot); in felix_port_to_netdev()