Lines Matching +full:ocelot +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright 2019-2021 NXP
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,
41 return ERR_PTR(-EOPNOTSUPP); in felix_classify_db()
48 struct ocelot *ocelot = ds->priv; in felix_cpu_port_for_master() local
53 mutex_lock(&ocelot->fwd_domain_lock); in felix_cpu_port_for_master()
54 lag = ocelot_bond_get_id(ocelot, master); in felix_cpu_port_for_master()
55 mutex_unlock(&ocelot->fwd_domain_lock); in felix_cpu_port_for_master()
60 cpu_dp = master->dsa_ptr; in felix_cpu_port_for_master()
61 return cpu_dp->index; in felix_cpu_port_for_master()
71 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_vlan_add_rx() local
75 key_length = ocelot->vcap[VCAP_ES0].keys[VCAP_ES0_IGR_PORT].length; in felix_tag_8021q_vlan_add_rx()
80 return -ENOMEM; in felix_tag_8021q_vlan_add_rx()
82 cookie = OCELOT_VCAP_ES0_TAG_8021Q_RXVLAN(ocelot, port, upstream); in felix_tag_8021q_vlan_add_rx()
84 outer_tagging_rule->key_type = OCELOT_VCAP_KEY_ANY; in felix_tag_8021q_vlan_add_rx()
85 outer_tagging_rule->prio = 1; in felix_tag_8021q_vlan_add_rx()
86 outer_tagging_rule->id.cookie = cookie; in felix_tag_8021q_vlan_add_rx()
87 outer_tagging_rule->id.tc_offload = false; in felix_tag_8021q_vlan_add_rx()
88 outer_tagging_rule->block_id = VCAP_ES0; in felix_tag_8021q_vlan_add_rx()
89 outer_tagging_rule->type = OCELOT_VCAP_FILTER_OFFLOAD; in felix_tag_8021q_vlan_add_rx()
90 outer_tagging_rule->lookup = 0; in felix_tag_8021q_vlan_add_rx()
91 outer_tagging_rule->ingress_port.value = port; in felix_tag_8021q_vlan_add_rx()
92 outer_tagging_rule->ingress_port.mask = GENMASK(key_length - 1, 0); in felix_tag_8021q_vlan_add_rx()
93 outer_tagging_rule->egress_port.value = upstream; in felix_tag_8021q_vlan_add_rx()
94 outer_tagging_rule->egress_port.mask = GENMASK(key_length - 1, 0); in felix_tag_8021q_vlan_add_rx()
95 outer_tagging_rule->action.push_outer_tag = OCELOT_ES0_TAG; in felix_tag_8021q_vlan_add_rx()
96 outer_tagging_rule->action.tag_a_tpid_sel = OCELOT_TAG_TPID_SEL_8021AD; in felix_tag_8021q_vlan_add_rx()
97 outer_tagging_rule->action.tag_a_vid_sel = 1; in felix_tag_8021q_vlan_add_rx()
98 outer_tagging_rule->action.vid_a_val = vid; in felix_tag_8021q_vlan_add_rx()
100 err = ocelot_vcap_filter_add(ocelot, outer_tagging_rule, NULL); in felix_tag_8021q_vlan_add_rx()
112 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_vlan_del_rx() local
115 block_vcap_es0 = &ocelot->block[VCAP_ES0]; in felix_tag_8021q_vlan_del_rx()
116 cookie = OCELOT_VCAP_ES0_TAG_8021Q_RXVLAN(ocelot, port, upstream); in felix_tag_8021q_vlan_del_rx()
121 return -ENOENT; in felix_tag_8021q_vlan_del_rx()
123 return ocelot_vcap_filter_del(ocelot, outer_tagging_rule); in felix_tag_8021q_vlan_del_rx()
134 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_vlan_add_tx() local
140 return -ENOMEM; in felix_tag_8021q_vlan_add_tx()
145 return -ENOMEM; in felix_tag_8021q_vlan_add_tx()
148 cookie = OCELOT_VCAP_IS1_TAG_8021Q_TXVLAN(ocelot, port); in felix_tag_8021q_vlan_add_tx()
150 untagging_rule->key_type = OCELOT_VCAP_KEY_ANY; in felix_tag_8021q_vlan_add_tx()
151 untagging_rule->ingress_port_mask = cpu_ports; in felix_tag_8021q_vlan_add_tx()
152 untagging_rule->vlan.vid.value = vid; in felix_tag_8021q_vlan_add_tx()
153 untagging_rule->vlan.vid.mask = VLAN_VID_MASK; in felix_tag_8021q_vlan_add_tx()
154 untagging_rule->prio = 1; in felix_tag_8021q_vlan_add_tx()
155 untagging_rule->id.cookie = cookie; in felix_tag_8021q_vlan_add_tx()
156 untagging_rule->id.tc_offload = false; in felix_tag_8021q_vlan_add_tx()
157 untagging_rule->block_id = VCAP_IS1; in felix_tag_8021q_vlan_add_tx()
158 untagging_rule->type = OCELOT_VCAP_FILTER_OFFLOAD; in felix_tag_8021q_vlan_add_tx()
159 untagging_rule->lookup = 0; in felix_tag_8021q_vlan_add_tx()
160 untagging_rule->action.vlan_pop_cnt_ena = true; in felix_tag_8021q_vlan_add_tx()
161 untagging_rule->action.vlan_pop_cnt = 1; in felix_tag_8021q_vlan_add_tx()
162 untagging_rule->action.pag_override_mask = 0xff; in felix_tag_8021q_vlan_add_tx()
163 untagging_rule->action.pag_val = port; in felix_tag_8021q_vlan_add_tx()
165 err = ocelot_vcap_filter_add(ocelot, untagging_rule, NULL); in felix_tag_8021q_vlan_add_tx()
172 cookie = OCELOT_VCAP_IS2_TAG_8021Q_TXVLAN(ocelot, port); in felix_tag_8021q_vlan_add_tx()
174 redirect_rule->key_type = OCELOT_VCAP_KEY_ANY; in felix_tag_8021q_vlan_add_tx()
175 redirect_rule->ingress_port_mask = cpu_ports; in felix_tag_8021q_vlan_add_tx()
176 redirect_rule->pag = port; in felix_tag_8021q_vlan_add_tx()
177 redirect_rule->prio = 1; in felix_tag_8021q_vlan_add_tx()
178 redirect_rule->id.cookie = cookie; in felix_tag_8021q_vlan_add_tx()
179 redirect_rule->id.tc_offload = false; in felix_tag_8021q_vlan_add_tx()
180 redirect_rule->block_id = VCAP_IS2; in felix_tag_8021q_vlan_add_tx()
181 redirect_rule->type = OCELOT_VCAP_FILTER_OFFLOAD; in felix_tag_8021q_vlan_add_tx()
182 redirect_rule->lookup = 0; in felix_tag_8021q_vlan_add_tx()
183 redirect_rule->action.mask_mode = OCELOT_MASK_MODE_REDIRECT; in felix_tag_8021q_vlan_add_tx()
184 redirect_rule->action.port_mask = BIT(port); in felix_tag_8021q_vlan_add_tx()
186 err = ocelot_vcap_filter_add(ocelot, redirect_rule, NULL); in felix_tag_8021q_vlan_add_tx()
188 ocelot_vcap_filter_del(ocelot, untagging_rule); in felix_tag_8021q_vlan_add_tx()
201 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_vlan_del_tx() local
205 block_vcap_is1 = &ocelot->block[VCAP_IS1]; in felix_tag_8021q_vlan_del_tx()
206 block_vcap_is2 = &ocelot->block[VCAP_IS2]; in felix_tag_8021q_vlan_del_tx()
208 cookie = OCELOT_VCAP_IS1_TAG_8021Q_TXVLAN(ocelot, port); in felix_tag_8021q_vlan_del_tx()
212 return -ENOENT; in felix_tag_8021q_vlan_del_tx()
214 err = ocelot_vcap_filter_del(ocelot, untagging_rule); in felix_tag_8021q_vlan_del_tx()
218 cookie = OCELOT_VCAP_IS2_TAG_8021Q_TXVLAN(ocelot, port); in felix_tag_8021q_vlan_del_tx()
222 return -ENOENT; in felix_tag_8021q_vlan_del_tx()
224 return ocelot_vcap_filter_del(ocelot, redirect_rule); in felix_tag_8021q_vlan_del_tx()
241 err = felix_tag_8021q_vlan_add_rx(ds, port, cpu_dp->index, vid); in felix_tag_8021q_vlan_add()
254 felix_tag_8021q_vlan_del_rx(ds, port, cpu_dp->index, vid); in felix_tag_8021q_vlan_add()
268 err = felix_tag_8021q_vlan_del_rx(ds, port, cpu_dp->index, vid); in felix_tag_8021q_vlan_del()
281 felix_tag_8021q_vlan_add_rx(ds, port, cpu_dp->index, vid); in felix_tag_8021q_vlan_del()
292 if (WARN_ON(!trap->ingress_port_mask)) in felix_trap_get_cpu_port()
293 return -1; in felix_trap_get_cpu_port()
295 first_port = __ffs(trap->ingress_port_mask); in felix_trap_get_cpu_port()
298 return dp->cpu_dp->index; in felix_trap_get_cpu_port()
303 * their arrival when using the ocelot-8021q tagging protocol.
308 struct ocelot *ocelot = ds->priv; in felix_update_trapping_destinations() local
309 struct felix *felix = ocelot_to_felix(ocelot); in felix_update_trapping_destinations()
317 if (!felix->info->quirk_no_xtr_irq) in felix_update_trapping_destinations()
323 block_vcap_is2 = &ocelot->block[VCAP_IS2]; in felix_update_trapping_destinations()
326 list_for_each_entry(trap, &block_vcap_is2->rules, list) { in felix_update_trapping_destinations()
327 if (!trap->is_trap) in felix_update_trapping_destinations()
338 cpu_copy_ena = !!trap->take_ts; in felix_update_trapping_destinations()
348 if (trap->action.mask_mode == mask_mode && in felix_update_trapping_destinations()
349 trap->action.port_mask == port_mask && in felix_update_trapping_destinations()
350 trap->action.cpu_copy_ena == cpu_copy_ena) in felix_update_trapping_destinations()
353 trap->action.mask_mode = mask_mode; in felix_update_trapping_destinations()
354 trap->action.port_mask = port_mask; in felix_update_trapping_destinations()
355 trap->action.cpu_copy_ena = cpu_copy_ena; in felix_update_trapping_destinations()
357 err = ocelot_vcap_filter_replace(ocelot, trap); in felix_update_trapping_destinations()
371 static void felix_npi_port_init(struct ocelot *ocelot, int port) in felix_npi_port_init() argument
373 ocelot->npi = port; in felix_npi_port_init()
375 ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK_M | in felix_npi_port_init()
380 ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_XTR_HDR, in felix_npi_port_init()
381 ocelot->npi_xtr_prefix); in felix_npi_port_init()
382 ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_INJ_HDR, in felix_npi_port_init()
383 ocelot->npi_inj_prefix); in felix_npi_port_init()
386 ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, 0); in felix_npi_port_init()
389 static void felix_npi_port_deinit(struct ocelot *ocelot, int port) in felix_npi_port_deinit() argument
392 int unused_port = ocelot->num_phys_ports + 2; in felix_npi_port_deinit()
394 ocelot->npi = -1; in felix_npi_port_deinit()
396 ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPU_PORT(unused_port), in felix_npi_port_deinit()
399 ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_XTR_HDR, in felix_npi_port_deinit()
401 ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_INJ_HDR, in felix_npi_port_deinit()
405 ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, 1); in felix_npi_port_deinit()
411 struct ocelot *ocelot = ds->priv; in felix_tag_npi_setup() local
414 if (first_cpu_dp && dp->cpu_dp != first_cpu_dp) { in felix_tag_npi_setup()
415 dev_err(ds->dev, "Multiple NPI ports not supported\n"); in felix_tag_npi_setup()
416 return -EINVAL; in felix_tag_npi_setup()
419 first_cpu_dp = dp->cpu_dp; in felix_tag_npi_setup()
423 return -EINVAL; in felix_tag_npi_setup()
425 felix_npi_port_init(ocelot, first_cpu_dp->index); in felix_tag_npi_setup()
432 struct ocelot *ocelot = ds->priv; in felix_tag_npi_teardown() local
434 felix_npi_port_deinit(ocelot, ocelot->npi); in felix_tag_npi_teardown()
439 struct ocelot *ocelot = ds->priv; in felix_tag_npi_get_host_fwd_mask() local
441 return BIT(ocelot->num_phys_ports); in felix_tag_npi_get_host_fwd_mask()
449 struct ocelot *ocelot = ds->priv; in felix_tag_npi_change_master() local
453 "LAG DSA master only supported using ocelot-8021q"); in felix_tag_npi_change_master()
454 return -EOPNOTSUPP; in felix_tag_npi_change_master()
462 struct net_device *slave = other_dp->slave; in felix_tag_npi_change_master()
464 if (other_dp != dp && (slave->flags & IFF_UP) && in felix_tag_npi_change_master()
468 return -EOPNOTSUPP; in felix_tag_npi_change_master()
472 felix_npi_port_deinit(ocelot, ocelot->npi); in felix_tag_npi_change_master()
473 felix_npi_port_init(ocelot, felix_cpu_port_for_master(ds, master)); in felix_tag_npi_change_master()
480 * use the software-defined tag_8021q frame format. As far as the hardware is
481 * concerned, it thinks it is a "dumb switch" - the queues of the CPU port
483 * register-based MMIO.
494 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_setup() local
503 ocelot_port_setup_dsa_8021q_cpu(ocelot, dp->index); in felix_tag_8021q_setup()
506 ocelot_port_assign_dsa_8021q_cpu(ocelot, dp->index, in felix_tag_8021q_setup()
507 dp->cpu_dp->index); in felix_tag_8021q_setup()
513 * - When these packets are injected from the tag_8021q in felix_tag_8021q_setup()
516 * - STP traffic ingressing on a user port should go to in felix_tag_8021q_setup()
520 ocelot_write_gix(ocelot, in felix_tag_8021q_setup()
522 ANA_PORT_CPU_FWD_BPDU_CFG, dp->index); in felix_tag_8021q_setup()
525 * transferred to the tag_8021q tagger from the NPI-based tagger. in felix_tag_8021q_setup()
527 * other hand, the MMIO-based matching of PTP frames is very brittle, in felix_tag_8021q_setup()
531 ocelot_lock_xtr_grp_bh(ocelot, 0); in felix_tag_8021q_setup()
532 ocelot_drain_cpu_queue(ocelot, 0); in felix_tag_8021q_setup()
533 ocelot_unlock_xtr_grp_bh(ocelot, 0); in felix_tag_8021q_setup()
540 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_teardown() local
547 ocelot_write_gix(ocelot, in felix_tag_8021q_teardown()
550 dp->index); in felix_tag_8021q_teardown()
553 ocelot_port_unassign_dsa_8021q_cpu(ocelot, dp->index); in felix_tag_8021q_teardown()
556 ocelot_port_teardown_dsa_8021q_cpu(ocelot, dp->index); in felix_tag_8021q_teardown()
571 struct ocelot *ocelot = ds->priv; in felix_tag_8021q_change_master() local
573 ocelot_port_unassign_dsa_8021q_cpu(ocelot, port); in felix_tag_8021q_change_master()
574 ocelot_port_assign_dsa_8021q_cpu(ocelot, port, cpu); in felix_tag_8021q_change_master()
589 struct ocelot *ocelot = ds->priv; in felix_set_host_flood() local
593 ocelot_rmw_rix(ocelot, val, mask, ANA_PGID_PGID, PGID_UC); in felix_set_host_flood()
596 ocelot_rmw_rix(ocelot, val, mask, ANA_PGID_PGID, PGID_MC); in felix_set_host_flood()
597 ocelot_rmw_rix(ocelot, val, mask, ANA_PGID_PGID, PGID_MCIPV4); in felix_set_host_flood()
598 ocelot_rmw_rix(ocelot, val, mask, ANA_PGID_PGID, PGID_MCIPV6); in felix_set_host_flood()
601 ocelot_rmw_rix(ocelot, val, mask, ANA_PGID_PGID, PGID_BC); in felix_set_host_flood()
609 struct ocelot *ocelot = ds->priv; in felix_migrate_host_flood() local
610 struct felix *felix = ocelot_to_felix(ocelot); in felix_migrate_host_flood()
614 mask = old_proto_ops->get_host_fwd_mask(ds); in felix_migrate_host_flood()
618 mask = proto_ops->get_host_fwd_mask(ds); in felix_migrate_host_flood()
619 felix_set_host_flood(ds, mask, !!felix->host_flood_uc_mask, in felix_migrate_host_flood()
620 !!felix->host_flood_mc_mask, true); in felix_migrate_host_flood()
627 struct ocelot *ocelot = ds->priv; in felix_migrate_mdbs() local
633 from = old_proto_ops->get_host_fwd_mask(ds); in felix_migrate_mdbs()
634 to = proto_ops->get_host_fwd_mask(ds); in felix_migrate_mdbs()
636 return ocelot_migrate_mdbs(ocelot, from, to); in felix_migrate_mdbs()
671 struct ocelot *ocelot = ds->priv; in felix_change_tag_protocol() local
672 struct felix *felix = ocelot_to_felix(ocelot); in felix_change_tag_protocol()
684 return -EPROTONOSUPPORT; in felix_change_tag_protocol()
687 old_proto_ops = felix->tag_proto_ops; in felix_change_tag_protocol()
692 err = proto_ops->setup(ds); in felix_change_tag_protocol()
701 old_proto_ops->teardown(ds); in felix_change_tag_protocol()
703 felix->tag_proto_ops = proto_ops; in felix_change_tag_protocol()
704 felix->tag_proto = proto; in felix_change_tag_protocol()
709 proto_ops->teardown(ds); in felix_change_tag_protocol()
718 struct ocelot *ocelot = ds->priv; in felix_get_tag_protocol() local
719 struct felix *felix = ocelot_to_felix(ocelot); in felix_get_tag_protocol()
721 return felix->tag_proto; in felix_get_tag_protocol()
727 struct ocelot *ocelot = ds->priv; in felix_port_set_host_flood() local
728 struct felix *felix = ocelot_to_felix(ocelot); in felix_port_set_host_flood()
732 felix->host_flood_uc_mask |= BIT(port); in felix_port_set_host_flood()
734 felix->host_flood_uc_mask &= ~BIT(port); in felix_port_set_host_flood()
737 felix->host_flood_mc_mask |= BIT(port); in felix_port_set_host_flood()
739 felix->host_flood_mc_mask &= ~BIT(port); in felix_port_set_host_flood()
741 mask = felix->tag_proto_ops->get_host_fwd_mask(ds); in felix_port_set_host_flood()
742 felix_set_host_flood(ds, mask, !!felix->host_flood_uc_mask, in felix_port_set_host_flood()
743 !!felix->host_flood_mc_mask, true); in felix_port_set_host_flood()
750 struct ocelot *ocelot = ds->priv; in felix_port_change_master() local
751 struct felix *felix = ocelot_to_felix(ocelot); in felix_port_change_master()
753 return felix->tag_proto_ops->change_master(ds, port, master, extack); in felix_port_change_master()
759 struct ocelot *ocelot = ds->priv; in felix_set_ageing_time() local
761 ocelot_set_ageing_time(ocelot, ageing_time); in felix_set_ageing_time()
768 struct ocelot *ocelot = ds->priv; in felix_port_fast_age() local
771 err = ocelot_mact_flush(ocelot, port); in felix_port_fast_age()
773 dev_err(ds->dev, "Flushing MAC table on port %d returned %pe\n", in felix_port_fast_age()
780 struct ocelot *ocelot = ds->priv; in felix_fdb_dump() local
782 return ocelot_fdb_dump(ocelot, port, cb, data); in felix_fdb_dump()
791 struct ocelot *ocelot = ds->priv; in felix_fdb_add() local
803 return ocelot_fdb_add(ocelot, port, addr, vid, bridge_dev); in felix_fdb_add()
812 struct ocelot *ocelot = ds->priv; in felix_fdb_del() local
824 return ocelot_fdb_del(ocelot, port, addr, vid, bridge_dev); in felix_fdb_del()
832 struct ocelot *ocelot = ds->priv; in felix_lag_fdb_add() local
837 return ocelot_lag_fdb_add(ocelot, lag.dev, addr, vid, bridge_dev); in felix_lag_fdb_add()
845 struct ocelot *ocelot = ds->priv; in felix_lag_fdb_del() local
850 return ocelot_lag_fdb_del(ocelot, lag.dev, addr, vid, bridge_dev); in felix_lag_fdb_del()
858 struct ocelot *ocelot = ds->priv; in felix_mdb_add() local
867 if (port == ocelot->npi) in felix_mdb_add()
868 port = ocelot->num_phys_ports; in felix_mdb_add()
870 return ocelot_port_mdb_add(ocelot, port, mdb, bridge_dev); in felix_mdb_add()
878 struct ocelot *ocelot = ds->priv; in felix_mdb_del() local
887 if (port == ocelot->npi) in felix_mdb_del()
888 port = ocelot->num_phys_ports; in felix_mdb_del()
890 return ocelot_port_mdb_del(ocelot, port, mdb, bridge_dev); in felix_mdb_del()
896 struct ocelot *ocelot = ds->priv; in felix_bridge_stp_state_set() local
898 return ocelot_bridge_stp_state_set(ocelot, port, state); in felix_bridge_stp_state_set()
905 struct ocelot *ocelot = ds->priv; in felix_pre_bridge_flags() local
907 return ocelot_port_pre_bridge_flags(ocelot, port, val); in felix_pre_bridge_flags()
914 struct ocelot *ocelot = ds->priv; in felix_bridge_flags() local
916 if (port == ocelot->npi) in felix_bridge_flags()
917 port = ocelot->num_phys_ports; in felix_bridge_flags()
919 ocelot_port_bridge_flags(ocelot, port, val); in felix_bridge_flags()
928 struct ocelot *ocelot = ds->priv; in felix_bridge_join() local
930 return ocelot_port_bridge_join(ocelot, port, bridge.dev, bridge.num, in felix_bridge_join()
937 struct ocelot *ocelot = ds->priv; in felix_bridge_leave() local
939 ocelot_port_bridge_leave(ocelot, port, bridge.dev); in felix_bridge_leave()
947 struct ocelot *ocelot = ds->priv; in felix_lag_join() local
950 err = ocelot_port_lag_join(ocelot, port, lag.dev, info, extack); in felix_lag_join()
964 struct ocelot *ocelot = ds->priv; in felix_lag_leave() local
966 ocelot_port_lag_leave(ocelot, port, lag.dev); in felix_lag_leave()
978 struct ocelot *ocelot = ds->priv; in felix_lag_change() local
980 ocelot_port_lag_change(ocelot, port, dp->lag_tx_enabled); in felix_lag_change()
989 struct ocelot *ocelot = ds->priv; in felix_vlan_prepare() local
990 u16 flags = vlan->flags; in felix_vlan_prepare()
992 /* Ocelot switches copy frames as-is to the CPU, so the flags: in felix_vlan_prepare()
993 * egress-untagged or not, pvid or not, make no difference. This in felix_vlan_prepare()
996 * Just accept any configuration, and don't let ocelot deny installing in felix_vlan_prepare()
1000 if (port == ocelot->npi) in felix_vlan_prepare()
1003 return ocelot_vlan_prepare(ocelot, port, vlan->vid, in felix_vlan_prepare()
1012 struct ocelot *ocelot = ds->priv; in felix_vlan_filtering() local
1014 return ocelot_port_vlan_filtering(ocelot, port, enabled, extack); in felix_vlan_filtering()
1021 struct ocelot *ocelot = ds->priv; in felix_vlan_add() local
1022 u16 flags = vlan->flags; in felix_vlan_add()
1029 return ocelot_vlan_add(ocelot, port, vlan->vid, in felix_vlan_add()
1037 struct ocelot *ocelot = ds->priv; in felix_vlan_del() local
1039 return ocelot_vlan_del(ocelot, port, vlan->vid); in felix_vlan_del()
1045 struct ocelot *ocelot = ds->priv; in felix_phylink_get_caps() local
1047 config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | in felix_phylink_get_caps()
1051 __set_bit(ocelot->ports[port]->phy_mode, in felix_phylink_get_caps()
1052 config->supported_interfaces); in felix_phylink_get_caps()
1059 struct ocelot *ocelot = ds->priv; in felix_phylink_mac_config() local
1060 struct felix *felix = ocelot_to_felix(ocelot); in felix_phylink_mac_config()
1062 if (felix->info->phylink_mac_config) in felix_phylink_mac_config()
1063 felix->info->phylink_mac_config(ocelot, port, mode, state); in felix_phylink_mac_config()
1070 struct ocelot *ocelot = ds->priv; in felix_phylink_mac_select_pcs() local
1071 struct felix *felix = ocelot_to_felix(ocelot); in felix_phylink_mac_select_pcs()
1074 if (felix->pcs && felix->pcs[port]) in felix_phylink_mac_select_pcs()
1075 pcs = felix->pcs[port]; in felix_phylink_mac_select_pcs()
1084 struct ocelot *ocelot = ds->priv; in felix_phylink_mac_link_down() local
1087 felix = ocelot_to_felix(ocelot); in felix_phylink_mac_link_down()
1089 ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, interface, in felix_phylink_mac_link_down()
1090 felix->info->quirks); in felix_phylink_mac_link_down()
1100 struct ocelot *ocelot = ds->priv; in felix_phylink_mac_link_up() local
1101 struct felix *felix = ocelot_to_felix(ocelot); in felix_phylink_mac_link_up()
1103 ocelot_phylink_mac_link_up(ocelot, port, phydev, link_an_mode, in felix_phylink_mac_link_up()
1105 felix->info->quirks); in felix_phylink_mac_link_up()
1107 if (felix->info->port_sched_speed_set) in felix_phylink_mac_link_up()
1108 felix->info->port_sched_speed_set(ocelot, port, speed); in felix_phylink_mac_link_up()
1115 struct ocelot *ocelot = ds->priv; in felix_port_enable() local
1120 if (ocelot->npi >= 0) { in felix_port_enable()
1123 if (felix_cpu_port_for_master(ds, master) != ocelot->npi) { in felix_port_enable()
1124 dev_err(ds->dev, "Multiple masters are not allowed\n"); in felix_port_enable()
1125 return -EINVAL; in felix_port_enable()
1132 static void felix_port_qos_map_init(struct ocelot *ocelot, int port) in felix_port_qos_map_init() argument
1136 ocelot_rmw_gix(ocelot, in felix_port_qos_map_init()
1143 ocelot_rmw_ix(ocelot, in felix_port_qos_map_init()
1156 struct ocelot *ocelot = ds->priv; in felix_get_stats64() local
1158 ocelot_port_get_stats64(ocelot, port, stats); in felix_get_stats64()
1164 struct ocelot *ocelot = ds->priv; in felix_get_pause_stats() local
1166 ocelot_port_get_pause_stats(ocelot, port, pause_stats); in felix_get_pause_stats()
1173 struct ocelot *ocelot = ds->priv; in felix_get_rmon_stats() local
1175 ocelot_port_get_rmon_stats(ocelot, port, rmon_stats, ranges); in felix_get_rmon_stats()
1181 struct ocelot *ocelot = ds->priv; in felix_get_eth_ctrl_stats() local
1183 ocelot_port_get_eth_ctrl_stats(ocelot, port, ctrl_stats); in felix_get_eth_ctrl_stats()
1189 struct ocelot *ocelot = ds->priv; in felix_get_eth_mac_stats() local
1191 ocelot_port_get_eth_mac_stats(ocelot, port, mac_stats); in felix_get_eth_mac_stats()
1197 struct ocelot *ocelot = ds->priv; in felix_get_eth_phy_stats() local
1199 ocelot_port_get_eth_phy_stats(ocelot, port, phy_stats); in felix_get_eth_phy_stats()
1205 struct ocelot *ocelot = ds->priv; in felix_get_strings() local
1207 return ocelot_get_strings(ocelot, port, stringset, data); in felix_get_strings()
1212 struct ocelot *ocelot = ds->priv; in felix_get_ethtool_stats() local
1214 ocelot_get_ethtool_stats(ocelot, port, data); in felix_get_ethtool_stats()
1219 struct ocelot *ocelot = ds->priv; in felix_get_sset_count() local
1221 return ocelot_get_sset_count(ocelot, port, sset); in felix_get_sset_count()
1227 struct ocelot *ocelot = ds->priv; in felix_get_ts_info() local
1229 return ocelot_get_ts_info(ocelot, port, info); in felix_get_ts_info()
1244 u32 modes = felix->info->port_modes[port]; in felix_validate_phy_mode()
1248 return -EOPNOTSUPP; in felix_validate_phy_mode()
1255 struct device *dev = felix->ocelot.dev; in felix_parse_ports_node()
1268 return -ENODEV; in felix_parse_ports_node()
1274 dev_err(dev, "Failed to read phy-mode or " in felix_parse_ports_node()
1275 "phy-interface-type property for port %d\n", in felix_parse_ports_node()
1278 return -ENODEV; in felix_parse_ports_node()
1288 * best-effort to bring up as many ports as possible. in felix_parse_ports_node()
1301 struct device *dev = felix->ocelot.dev; in felix_parse_dt()
1306 switch_node = dev->of_node; in felix_parse_dt()
1310 ports_node = of_get_child_by_name(switch_node, "ethernet-ports"); in felix_parse_dt()
1312 dev_err(dev, "Incorrect bindings: absent \"ports\" or \"ethernet-ports\" node\n"); in felix_parse_dt()
1313 return -ENODEV; in felix_parse_dt()
1325 struct ocelot *ocelot = &felix->ocelot; in felix_request_regmap_by_name() local
1333 if (!felix->info->resources) in felix_request_regmap_by_name()
1334 return dev_get_regmap(ocelot->dev->parent, resource_name); in felix_request_regmap_by_name()
1336 for (i = 0; i < felix->info->num_resources; i++) { in felix_request_regmap_by_name()
1337 if (strcmp(resource_name, felix->info->resources[i].name)) in felix_request_regmap_by_name()
1340 memcpy(&res, &felix->info->resources[i], sizeof(res)); in felix_request_regmap_by_name()
1341 res.start += felix->switch_base; in felix_request_regmap_by_name()
1342 res.end += felix->switch_base; in felix_request_regmap_by_name()
1344 return ocelot_regmap_init(ocelot, &res); in felix_request_regmap_by_name()
1347 return ERR_PTR(-ENOENT); in felix_request_regmap_by_name()
1353 const char *resource_name = felix->info->resource_names[target]; in felix_request_regmap()
1375 struct ocelot *ocelot = &felix->ocelot; in felix_init_structs() local
1380 ocelot->num_phys_ports = num_phys_ports; in felix_init_structs()
1381 ocelot->ports = devm_kcalloc(ocelot->dev, num_phys_ports, in felix_init_structs()
1383 if (!ocelot->ports) in felix_init_structs()
1384 return -ENOMEM; in felix_init_structs()
1386 ocelot->map = felix->info->map; in felix_init_structs()
1387 ocelot->num_mact_rows = felix->info->num_mact_rows; in felix_init_structs()
1388 ocelot->vcap = felix->info->vcap; in felix_init_structs()
1389 ocelot->vcap_pol.base = felix->info->vcap_pol_base; in felix_init_structs()
1390 ocelot->vcap_pol.max = felix->info->vcap_pol_max; in felix_init_structs()
1391 ocelot->vcap_pol.base2 = felix->info->vcap_pol_base2; in felix_init_structs()
1392 ocelot->vcap_pol.max2 = felix->info->vcap_pol_max2; in felix_init_structs()
1393 ocelot->ops = felix->info->ops; in felix_init_structs()
1394 ocelot->npi_inj_prefix = OCELOT_TAG_PREFIX_SHORT; in felix_init_structs()
1395 ocelot->npi_xtr_prefix = OCELOT_TAG_PREFIX_SHORT; in felix_init_structs()
1396 ocelot->devlink = felix->ds->devlink; in felix_init_structs()
1401 return -ENOMEM; in felix_init_structs()
1412 dev_err(ocelot->dev, in felix_init_structs()
1419 ocelot->targets[i] = target; in felix_init_structs()
1422 err = ocelot_regfields_init(ocelot, felix->info->regfields); in felix_init_structs()
1424 dev_err(ocelot->dev, "failed to init reg fields map\n"); in felix_init_structs()
1432 ocelot_port = devm_kzalloc(ocelot->dev, in felix_init_structs()
1436 dev_err(ocelot->dev, in felix_init_structs()
1439 return -ENOMEM; in felix_init_structs()
1444 dev_err(ocelot->dev, in felix_init_structs()
1451 ocelot_port->phy_mode = port_phy_modes[port]; in felix_init_structs()
1452 ocelot_port->ocelot = ocelot; in felix_init_structs()
1453 ocelot_port->target = target; in felix_init_structs()
1454 ocelot_port->index = port; in felix_init_structs()
1455 ocelot->ports[port] = ocelot_port; in felix_init_structs()
1460 if (felix->info->mdio_bus_alloc) { in felix_init_structs()
1461 err = felix->info->mdio_bus_alloc(ocelot); in felix_init_structs()
1469 static void ocelot_port_purge_txtstamp_skb(struct ocelot *ocelot, int port, in ocelot_port_purge_txtstamp_skb() argument
1472 struct ocelot_port *ocelot_port = ocelot->ports[port]; in ocelot_port_purge_txtstamp_skb()
1473 struct sk_buff *clone = OCELOT_SKB_CB(skb)->clone; in ocelot_port_purge_txtstamp_skb()
1480 spin_lock_irqsave(&ocelot_port->tx_skbs.lock, flags); in ocelot_port_purge_txtstamp_skb()
1482 skb_queue_walk_safe(&ocelot_port->tx_skbs, skb, skb_tmp) { in ocelot_port_purge_txtstamp_skb()
1485 __skb_unlink(skb, &ocelot_port->tx_skbs); in ocelot_port_purge_txtstamp_skb()
1490 spin_unlock_irqrestore(&ocelot_port->tx_skbs.lock, flags); in ocelot_port_purge_txtstamp_skb()
1502 struct dsa_switch *ds = xmit_work->dp->ds; in felix_port_deferred_xmit()
1503 struct sk_buff *skb = xmit_work->skb; in felix_port_deferred_xmit()
1505 struct ocelot *ocelot = ds->priv; in felix_port_deferred_xmit() local
1506 int port = xmit_work->dp->index; in felix_port_deferred_xmit()
1509 ocelot_lock_inj_grp(ocelot, 0); in felix_port_deferred_xmit()
1512 if (ocelot_can_inject(ocelot, 0)) in felix_port_deferred_xmit()
1516 } while (--retries); in felix_port_deferred_xmit()
1519 ocelot_unlock_inj_grp(ocelot, 0); in felix_port_deferred_xmit()
1520 dev_err(ocelot->dev, "port %d failed to inject skb\n", in felix_port_deferred_xmit()
1522 ocelot_port_purge_txtstamp_skb(ocelot, port, skb); in felix_port_deferred_xmit()
1527 ocelot_port_inject_frame(ocelot, port, 0, rew_op, skb); in felix_port_deferred_xmit()
1529 ocelot_unlock_inj_grp(ocelot, 0); in felix_port_deferred_xmit()
1543 tagger_data->xmit_work_fn = felix_port_deferred_xmit; in felix_connect_tag_protocol()
1549 return -EPROTONOSUPPORT; in felix_connect_tag_protocol()
1555 struct ocelot *ocelot = ds->priv; in felix_setup() local
1556 struct felix *felix = ocelot_to_felix(ocelot); in felix_setup()
1560 err = felix_init_structs(felix, ds->num_ports); in felix_setup()
1564 if (ocelot->targets[HSIO]) in felix_setup()
1565 ocelot_pll5_init(ocelot); in felix_setup()
1567 err = ocelot_init(ocelot); in felix_setup()
1571 if (ocelot->ptp) { in felix_setup()
1572 err = ocelot_init_timestamp(ocelot, felix->info->ptp_caps); in felix_setup()
1574 dev_err(ocelot->dev, in felix_setup()
1576 ocelot->ptp = 0; in felix_setup()
1581 ocelot_init_port(ocelot, dp->index); in felix_setup()
1583 if (felix->info->configure_serdes) in felix_setup()
1584 felix->info->configure_serdes(ocelot, dp->index, in felix_setup()
1585 dp->dn); in felix_setup()
1590 felix_port_qos_map_init(ocelot, dp->index); in felix_setup()
1593 err = ocelot_devlink_sb_register(ocelot); in felix_setup()
1600 felix_change_tag_protocol(ds, felix->tag_proto); in felix_setup()
1602 ds->mtu_enforcement_ingress = true; in felix_setup()
1603 ds->assisted_learning_on_cpu_port = true; in felix_setup()
1604 ds->fdb_isolation = true; in felix_setup()
1605 ds->max_num_bridges = ds->num_ports; in felix_setup()
1611 ocelot_deinit_port(ocelot, dp->index); in felix_setup()
1613 ocelot_deinit_timestamp(ocelot); in felix_setup()
1614 ocelot_deinit(ocelot); in felix_setup()
1617 if (felix->info->mdio_bus_free) in felix_setup()
1618 felix->info->mdio_bus_free(ocelot); in felix_setup()
1625 struct ocelot *ocelot = ds->priv; in felix_teardown() local
1626 struct felix *felix = ocelot_to_felix(ocelot); in felix_teardown()
1630 if (felix->tag_proto_ops) in felix_teardown()
1631 felix->tag_proto_ops->teardown(ds); in felix_teardown()
1635 ocelot_deinit_port(ocelot, dp->index); in felix_teardown()
1637 ocelot_devlink_sb_unregister(ocelot); in felix_teardown()
1638 ocelot_deinit_timestamp(ocelot); in felix_teardown()
1639 ocelot_deinit(ocelot); in felix_teardown()
1641 if (felix->info->mdio_bus_free) in felix_teardown()
1642 felix->info->mdio_bus_free(ocelot); in felix_teardown()
1648 struct ocelot *ocelot = ds->priv; in felix_hwtstamp_get() local
1650 return ocelot_hwstamp_get(ocelot, port, ifr); in felix_hwtstamp_get()
1656 struct ocelot *ocelot = ds->priv; in felix_hwtstamp_set() local
1657 struct felix *felix = ocelot_to_felix(ocelot); in felix_hwtstamp_set()
1661 err = ocelot_hwstamp_set(ocelot, port, ifr); in felix_hwtstamp_set()
1665 using_tag_8021q = felix->tag_proto == DSA_TAG_PROTO_OCELOT_8021Q; in felix_hwtstamp_set()
1670 static bool felix_check_xtr_pkt(struct ocelot *ocelot) in felix_check_xtr_pkt() argument
1672 struct felix *felix = ocelot_to_felix(ocelot); in felix_check_xtr_pkt()
1675 if (felix->tag_proto != DSA_TAG_PROTO_OCELOT_8021Q) in felix_check_xtr_pkt()
1678 if (!felix->info->quirk_no_xtr_irq) in felix_check_xtr_pkt()
1681 ocelot_lock_xtr_grp(ocelot, grp); in felix_check_xtr_pkt()
1683 while (ocelot_read(ocelot, QS_XTR_DATA_PRESENT) & BIT(grp)) { in felix_check_xtr_pkt()
1687 err = ocelot_xtr_poll_frame(ocelot, grp, &skb); in felix_check_xtr_pkt()
1713 dev_err_ratelimited(ocelot->dev, in felix_check_xtr_pkt()
1716 ocelot_drain_cpu_queue(ocelot, 0); in felix_check_xtr_pkt()
1719 ocelot_unlock_xtr_grp(ocelot, grp); in felix_check_xtr_pkt()
1727 u32 tstamp_lo = OCELOT_SKB_CB(skb)->tstamp_lo; in felix_rxtstamp()
1729 struct ocelot *ocelot = ds->priv; in felix_rxtstamp() local
1736 if (!(ocelot->ports[port]->trap_proto & OCELOT_PROTO_PTP_L2)) in felix_rxtstamp()
1741 if (!(ocelot->ports[port]->trap_proto & OCELOT_PROTO_PTP_L4)) in felix_rxtstamp()
1751 if (felix_check_xtr_pkt(ocelot)) { in felix_rxtstamp()
1756 ocelot_ptp_gettime64(&ocelot->ptp_info, &ts); in felix_rxtstamp()
1761 tstamp_hi--; in felix_rxtstamp()
1767 shhwtstamps->hwtstamp = tstamp; in felix_rxtstamp()
1774 struct ocelot *ocelot = ds->priv; in felix_txtstamp() local
1777 if (!ocelot->ptp) in felix_txtstamp()
1780 if (ocelot_port_txtstamp_request(ocelot, port, skb, &clone)) { in felix_txtstamp()
1781 dev_err_ratelimited(ds->dev, in felix_txtstamp()
1788 OCELOT_SKB_CB(skb)->clone = clone; in felix_txtstamp()
1793 struct ocelot *ocelot = ds->priv; in felix_change_mtu() local
1794 struct ocelot_port *ocelot_port = ocelot->ports[port]; in felix_change_mtu()
1796 ocelot_port_set_maxlen(ocelot, port, new_mtu); in felix_change_mtu()
1798 mutex_lock(&ocelot->fwd_domain_lock); in felix_change_mtu()
1800 if (ocelot_port->taprio && ocelot->ops->tas_guard_bands_update) in felix_change_mtu()
1801 ocelot->ops->tas_guard_bands_update(ocelot, port); in felix_change_mtu()
1803 mutex_unlock(&ocelot->fwd_domain_lock); in felix_change_mtu()
1810 struct ocelot *ocelot = ds->priv; in felix_get_max_mtu() local
1812 return ocelot_get_max_mtu(ocelot, port); in felix_get_max_mtu()
1818 struct ocelot *ocelot = ds->priv; in felix_cls_flower_add() local
1819 struct felix *felix = ocelot_to_felix(ocelot); in felix_cls_flower_add()
1823 err = ocelot_cls_flower_replace(ocelot, port, cls, ingress); in felix_cls_flower_add()
1827 using_tag_8021q = felix->tag_proto == DSA_TAG_PROTO_OCELOT_8021Q; in felix_cls_flower_add()
1835 struct ocelot *ocelot = ds->priv; in felix_cls_flower_del() local
1837 return ocelot_cls_flower_destroy(ocelot, port, cls, ingress); in felix_cls_flower_del()
1843 struct ocelot *ocelot = ds->priv; in felix_cls_flower_stats() local
1845 return ocelot_cls_flower_stats(ocelot, port, cls, ingress); in felix_cls_flower_stats()
1851 struct ocelot *ocelot = ds->priv; in felix_port_policer_add() local
1853 .rate = div_u64(policer->rate_bytes_per_sec, 1000) * 8, in felix_port_policer_add()
1854 .burst = policer->burst, in felix_port_policer_add()
1857 return ocelot_port_policer_add(ocelot, port, &pol); in felix_port_policer_add()
1862 struct ocelot *ocelot = ds->priv; in felix_port_policer_del() local
1864 ocelot_port_policer_del(ocelot, port); in felix_port_policer_del()
1871 struct ocelot *ocelot = ds->priv; in felix_port_mirror_add() local
1873 return ocelot_port_mirror_add(ocelot, port, mirror->to_local_port, in felix_port_mirror_add()
1880 struct ocelot *ocelot = ds->priv; in felix_port_mirror_del() local
1882 ocelot_port_mirror_del(ocelot, port, mirror->ingress); in felix_port_mirror_del()
1889 struct ocelot *ocelot = ds->priv; in felix_port_setup_tc() local
1890 struct felix *felix = ocelot_to_felix(ocelot); in felix_port_setup_tc()
1892 if (felix->info->port_setup_tc) in felix_port_setup_tc()
1893 return felix->info->port_setup_tc(ds, port, type, type_data); in felix_port_setup_tc()
1895 return -EOPNOTSUPP; in felix_port_setup_tc()
1902 struct ocelot *ocelot = ds->priv; in felix_sb_pool_get() local
1904 return ocelot_sb_pool_get(ocelot, sb_index, pool_index, pool_info); in felix_sb_pool_get()
1912 struct ocelot *ocelot = ds->priv; in felix_sb_pool_set() local
1914 return ocelot_sb_pool_set(ocelot, sb_index, pool_index, size, in felix_sb_pool_set()
1922 struct ocelot *ocelot = ds->priv; in felix_sb_port_pool_get() local
1924 return ocelot_sb_port_pool_get(ocelot, port, sb_index, pool_index, in felix_sb_port_pool_get()
1932 struct ocelot *ocelot = ds->priv; in felix_sb_port_pool_set() local
1934 return ocelot_sb_port_pool_set(ocelot, port, sb_index, pool_index, in felix_sb_port_pool_set()
1943 struct ocelot *ocelot = ds->priv; in felix_sb_tc_pool_bind_get() local
1945 return ocelot_sb_tc_pool_bind_get(ocelot, port, sb_index, tc_index, in felix_sb_tc_pool_bind_get()
1956 struct ocelot *ocelot = ds->priv; in felix_sb_tc_pool_bind_set() local
1958 return ocelot_sb_tc_pool_bind_set(ocelot, port, sb_index, tc_index, in felix_sb_tc_pool_bind_set()
1966 struct ocelot *ocelot = ds->priv; in felix_sb_occ_snapshot() local
1968 return ocelot_sb_occ_snapshot(ocelot, sb_index); in felix_sb_occ_snapshot()
1974 struct ocelot *ocelot = ds->priv; in felix_sb_occ_max_clear() local
1976 return ocelot_sb_occ_max_clear(ocelot, sb_index); in felix_sb_occ_max_clear()
1983 struct ocelot *ocelot = ds->priv; in felix_sb_occ_port_pool_get() local
1985 return ocelot_sb_occ_port_pool_get(ocelot, port, sb_index, pool_index, in felix_sb_occ_port_pool_get()
1994 struct ocelot *ocelot = ds->priv; in felix_sb_occ_tc_port_bind_get() local
1996 return ocelot_sb_occ_tc_port_bind_get(ocelot, port, sb_index, tc_index, in felix_sb_occ_tc_port_bind_get()
2003 struct ocelot *ocelot = ds->priv; in felix_mrp_add() local
2005 return ocelot_mrp_add(ocelot, port, mrp); in felix_mrp_add()
2011 struct ocelot *ocelot = ds->priv; in felix_mrp_del() local
2013 return ocelot_mrp_add(ocelot, port, mrp); in felix_mrp_del()
2020 struct ocelot *ocelot = ds->priv; in felix_mrp_add_ring_role() local
2022 return ocelot_mrp_add_ring_role(ocelot, port, mrp); in felix_mrp_add_ring_role()
2029 struct ocelot *ocelot = ds->priv; in felix_mrp_del_ring_role() local
2031 return ocelot_mrp_del_ring_role(ocelot, port, mrp); in felix_mrp_del_ring_role()
2036 struct ocelot *ocelot = ds->priv; in felix_port_get_default_prio() local
2038 return ocelot_port_get_default_prio(ocelot, port); in felix_port_get_default_prio()
2044 struct ocelot *ocelot = ds->priv; in felix_port_set_default_prio() local
2046 return ocelot_port_set_default_prio(ocelot, port, prio); in felix_port_set_default_prio()
2051 struct ocelot *ocelot = ds->priv; in felix_port_get_dscp_prio() local
2053 return ocelot_port_get_dscp_prio(ocelot, port, dscp); in felix_port_get_dscp_prio()
2059 struct ocelot *ocelot = ds->priv; in felix_port_add_dscp_prio() local
2061 return ocelot_port_add_dscp_prio(ocelot, port, dscp, prio); in felix_port_add_dscp_prio()
2067 struct ocelot *ocelot = ds->priv; in felix_port_del_dscp_prio() local
2069 return ocelot_port_del_dscp_prio(ocelot, port, dscp, prio); in felix_port_del_dscp_prio()
2075 struct ocelot *ocelot = ds->priv; in felix_get_mm() local
2077 return ocelot_port_get_mm(ocelot, port, state); in felix_get_mm()
2084 struct ocelot *ocelot = ds->priv; in felix_set_mm() local
2086 return ocelot_port_set_mm(ocelot, port, cfg, extack); in felix_set_mm()
2092 struct ocelot *ocelot = ds->priv; in felix_get_mm_stats() local
2094 ocelot_port_get_mm_stats(ocelot, port, stats); in felix_get_mm_stats()
2182 struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port) in felix_port_to_netdev() argument
2184 struct felix *felix = ocelot_to_felix(ocelot); in felix_port_to_netdev()
2185 struct dsa_switch *ds = felix->ds; in felix_port_to_netdev()
2190 return dsa_to_port(ds, port)->slave; in felix_port_to_netdev()
2200 return -EINVAL; in felix_netdev_to_port()
2202 return dp->index; in felix_netdev_to_port()