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

1 /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
23 * - In one of PGID[0-63]: for the destination masks. There are 2 paths by
25 * - The {DMAC, VID} is present in the MAC table. In that case, the
28 * - The {DMAC, VID} is not present in the MAC table (it is unknown). The
34 * ocelot->num_phys_ports - 1, or a multicast set: the PGIDs from
35 * ocelot->num_phys_ports to 63. By convention, a unicast PGID corresponds to
40 * - In one of PGID[64-79]: for the aggregation mask. The switch classifier
41 * dissects each frame and generates a 4-bit Link Aggregation Code which is
48 * - In one of PGID[80-90]: for the source mask. The third time, the PGID table
60 * PGID_MC: the flooding destinations for non-IP multicast traffic.
73 #define for_each_unicast_dest_pgid(ocelot, pgid) \
75 (pgid) < (ocelot)->num_phys_ports; \
78 #define for_each_nonreserved_multicast_dest_pgid(ocelot, pgid) \
79 for ((pgid) = (ocelot)->num_phys_ports + 1; \
83 #define for_each_aggr_pgid(ocelot, pgid) \
97 #define OCELOT_SPEED_1000 1
104 #define REG_MASK GENMASK(TARGET_OFFSET - 1, 0)
111 ANA = 1,
648 struct ocelot;
652 struct net_device *(*port_to_netdev)(struct ocelot *ocelot, int port);
654 int (*reset)(struct ocelot *ocelot);
658 void (*psfp_init)(struct ocelot *ocelot);
659 int (*psfp_filter_add)(struct ocelot *ocelot, int port,
661 int (*psfp_filter_del)(struct ocelot *ocelot, struct flow_cls_offload *f);
662 int (*psfp_stats_get)(struct ocelot *ocelot, struct flow_cls_offload *f,
664 void (*cut_through_fwd)(struct ocelot *ocelot);
665 void (*tas_clock_adjust)(struct ocelot *ocelot);
666 void (*tas_guard_bands_update)(struct ocelot *ocelot, int port);
667 void (*update_stats)(struct ocelot *ocelot);
691 /* all VLANs are egress-untagged */
693 /* all VLANs except the native VLAN and VID 0 are egress-tagged */
694 OCELOT_PORT_TAG_NATIVE = 1,
695 /* all VLANs except VID 0 are egress-tagged */
697 /* all VLANs are egress-tagged */
736 OCELOT_PROTO_PTP_L4 = BIT(1),
740 #define OCELOT_QUIRK_QSGMII_PORTS_MUST_BE_UP BIT(1)
773 struct ocelot *ocelot;
812 struct ocelot {
878 * configuration of the Time-Aware Shaper, MAC Merge layer and
879 * cut-through forwarding, on which it depends
885 u8 ptp:1;
886 u8 mm_supported:1;
890 /* Protects the 2-step TX timestamp ID logic */
906 #define ocelot_bulk_read(ocelot, reg, buf, count) \
907 __ocelot_bulk_read_ix(ocelot, reg, 0, buf, count)
909 #define ocelot_read_ix(ocelot, reg, gi, ri) \
910 __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
911 #define ocelot_read_gix(ocelot, reg, gi) \
912 __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi))
913 #define ocelot_read_rix(ocelot, reg, ri) \
914 __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri))
915 #define ocelot_read(ocelot, reg) \
916 __ocelot_read_ix(ocelot, reg, 0)
918 #define ocelot_write_ix(ocelot, val, reg, gi, ri) \
919 __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
920 #define ocelot_write_gix(ocelot, val, reg, gi) \
921 __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi))
922 #define ocelot_write_rix(ocelot, val, reg, ri) \
923 __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
924 #define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0)
926 #define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) \
927 __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
928 #define ocelot_rmw_gix(ocelot, val, m, reg, gi) \
929 __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi))
930 #define ocelot_rmw_rix(ocelot, val, m, reg, ri) \
931 __ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri))
932 #define ocelot_rmw(ocelot, val, m, reg) __ocelot_rmw_ix(ocelot, val, m, reg, 0)
934 #define ocelot_field_write(ocelot, reg, val) \
935 regmap_field_write((ocelot)->regfields[(reg)], (val))
936 #define ocelot_field_read(ocelot, reg, val) \
937 regmap_field_read((ocelot)->regfields[(reg)], (val))
938 #define ocelot_fields_write(ocelot, id, reg, val) \
939 regmap_fields_write((ocelot)->regfields[(reg)], (id), (val))
940 #define ocelot_fields_read(ocelot, id, reg, val) \
941 regmap_fields_read((ocelot)->regfields[(reg)], (id), (val))
943 #define ocelot_target_read_ix(ocelot, target, reg, gi, ri) \
944 __ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
945 #define ocelot_target_read_gix(ocelot, target, reg, gi) \
946 __ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi))
947 #define ocelot_target_read_rix(ocelot, target, reg, ri) \
948 __ocelot_target_read_ix(ocelot, target, reg, reg##_RSZ * (ri))
949 #define ocelot_target_read(ocelot, target, reg) \
950 __ocelot_target_read_ix(ocelot, target, reg, 0)
952 #define ocelot_target_write_ix(ocelot, target, val, reg, gi, ri) \
953 __ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
954 #define ocelot_target_write_gix(ocelot, target, val, reg, gi) \
955 __ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi))
956 #define ocelot_target_write_rix(ocelot, target, val, reg, ri) \
957 __ocelot_target_write_ix(ocelot, target, val, reg, reg##_RSZ * (ri))
958 #define ocelot_target_write(ocelot, target, val, reg) \
959 __ocelot_target_write_ix(ocelot, target, val, reg, 0)
966 int __ocelot_bulk_read_ix(struct ocelot *ocelot, enum ocelot_reg reg,
968 u32 __ocelot_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, u32 offset);
969 void __ocelot_write_ix(struct ocelot *ocelot, u32 val, enum ocelot_reg reg,
971 void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask,
973 u32 __ocelot_target_read_ix(struct ocelot *ocelot, enum ocelot_target target,
975 void __ocelot_target_write_ix(struct ocelot *ocelot, enum ocelot_target target,
979 void ocelot_lock_inj_grp(struct ocelot *ocelot, int grp);
980 void ocelot_unlock_inj_grp(struct ocelot *ocelot, int grp);
981 void ocelot_lock_xtr_grp(struct ocelot *ocelot, int grp);
982 void ocelot_unlock_xtr_grp(struct ocelot *ocelot, int grp);
983 void ocelot_lock_xtr_grp_bh(struct ocelot *ocelot, int grp);
984 void ocelot_unlock_xtr_grp_bh(struct ocelot *ocelot, int grp);
985 bool ocelot_can_inject(struct ocelot *ocelot, int grp);
986 void ocelot_port_inject_frame(struct ocelot *ocelot, int port, int grp,
988 void ocelot_ifh_set_basic(void *ifh, struct ocelot *ocelot, int port,
990 int ocelot_xtr_poll_frame(struct ocelot *ocelot, int grp, struct sk_buff **skb);
991 void ocelot_drain_cpu_queue(struct ocelot *ocelot, int grp);
992 void ocelot_ptp_rx_timestamp(struct ocelot *ocelot, struct sk_buff *skb,
996 int ocelot_regfields_init(struct ocelot *ocelot,
998 struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res);
999 int ocelot_reset(struct ocelot *ocelot);
1000 int ocelot_init(struct ocelot *ocelot);
1001 void ocelot_deinit(struct ocelot *ocelot);
1002 void ocelot_init_port(struct ocelot *ocelot, int port);
1003 void ocelot_deinit_port(struct ocelot *ocelot, int port);
1005 void ocelot_port_setup_dsa_8021q_cpu(struct ocelot *ocelot, int cpu);
1006 void ocelot_port_teardown_dsa_8021q_cpu(struct ocelot *ocelot, int cpu);
1007 void ocelot_port_assign_dsa_8021q_cpu(struct ocelot *ocelot, int port, int cpu);
1008 void ocelot_port_unassign_dsa_8021q_cpu(struct ocelot *ocelot, int port);
1009 u32 ocelot_port_assigned_dsa_8021q_cpu_mask(struct ocelot *ocelot, int port);
1017 void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data);
1018 void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data);
1019 int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset);
1020 void ocelot_port_get_stats64(struct ocelot *ocelot, int port,
1022 void ocelot_port_get_pause_stats(struct ocelot *ocelot, int port,
1024 void ocelot_port_get_mm_stats(struct ocelot *ocelot, int port,
1026 void ocelot_port_get_rmon_stats(struct ocelot *ocelot, int port,
1029 void ocelot_port_get_eth_ctrl_stats(struct ocelot *ocelot, int port,
1031 void ocelot_port_get_eth_mac_stats(struct ocelot *ocelot, int port,
1033 void ocelot_port_get_eth_phy_stats(struct ocelot *ocelot, int port,
1035 void ocelot_port_get_ts_stats(struct ocelot *ocelot, int port,
1037 int ocelot_get_ts_info(struct ocelot *ocelot, int port,
1039 void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs);
1040 int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled,
1042 void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
1043 u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port);
1044 int ocelot_port_pre_bridge_flags(struct ocelot *ocelot, int port,
1046 void ocelot_port_bridge_flags(struct ocelot *ocelot, int port,
1048 int ocelot_port_get_default_prio(struct ocelot *ocelot, int port);
1049 int ocelot_port_set_default_prio(struct ocelot *ocelot, int port, u8 prio);
1050 int ocelot_port_get_dscp_prio(struct ocelot *ocelot, int port, u8 dscp);
1051 int ocelot_port_add_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio);
1052 int ocelot_port_del_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio);
1053 int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
1056 void ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
1058 int ocelot_mact_flush(struct ocelot *ocelot, int port);
1059 int ocelot_fdb_dump(struct ocelot *ocelot, int port,
1061 int ocelot_fdb_add(struct ocelot *ocelot, int port, const unsigned char *addr,
1063 int ocelot_fdb_del(struct ocelot *ocelot, int port, const unsigned char *addr,
1065 int ocelot_lag_fdb_add(struct ocelot *ocelot, struct net_device *bond,
1068 int ocelot_lag_fdb_del(struct ocelot *ocelot, struct net_device *bond,
1071 int ocelot_vlan_prepare(struct ocelot *ocelot, int port, u16 vid, bool pvid,
1073 int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
1075 int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid);
1076 void ocelot_hwstamp_get(struct ocelot *ocelot, int port,
1078 int ocelot_hwstamp_set(struct ocelot *ocelot, int port,
1081 int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port,
1084 void ocelot_get_txtstamp(struct ocelot *ocelot);
1085 void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu);
1086 int ocelot_get_max_mtu(struct ocelot *ocelot, int port);
1087 int ocelot_port_policer_add(struct ocelot *ocelot, int port,
1089 int ocelot_port_policer_del(struct ocelot *ocelot, int port);
1090 int ocelot_port_mirror_add(struct ocelot *ocelot, int from, int to,
1092 void ocelot_port_mirror_del(struct ocelot *ocelot, int from, bool ingress);
1093 int ocelot_cls_flower_replace(struct ocelot *ocelot, int port,
1095 int ocelot_cls_flower_destroy(struct ocelot *ocelot, int port,
1097 int ocelot_cls_flower_stats(struct ocelot *ocelot, int port,
1099 int ocelot_port_mdb_add(struct ocelot *ocelot, int port,
1102 int ocelot_port_mdb_del(struct ocelot *ocelot, int port,
1105 int ocelot_port_lag_join(struct ocelot *ocelot, int port,
1109 void ocelot_port_lag_leave(struct ocelot *ocelot, int port,
1111 void ocelot_port_lag_change(struct ocelot *ocelot, int port, bool lag_tx_active);
1112 int ocelot_bond_get_id(struct ocelot *ocelot, struct net_device *bond);
1114 int ocelot_devlink_sb_register(struct ocelot *ocelot);
1115 void ocelot_devlink_sb_unregister(struct ocelot *ocelot);
1116 int ocelot_sb_pool_get(struct ocelot *ocelot, unsigned int sb_index,
1119 int ocelot_sb_pool_set(struct ocelot *ocelot, unsigned int sb_index,
1123 int ocelot_sb_port_pool_get(struct ocelot *ocelot, int port,
1126 int ocelot_sb_port_pool_set(struct ocelot *ocelot, int port,
1129 int ocelot_sb_tc_pool_bind_get(struct ocelot *ocelot, int port,
1133 int ocelot_sb_tc_pool_bind_set(struct ocelot *ocelot, int port,
1138 int ocelot_sb_occ_snapshot(struct ocelot *ocelot, unsigned int sb_index);
1139 int ocelot_sb_occ_max_clear(struct ocelot *ocelot, unsigned int sb_index);
1140 int ocelot_sb_occ_port_pool_get(struct ocelot *ocelot, int port,
1143 int ocelot_sb_occ_tc_port_bind_get(struct ocelot *ocelot, int port,
1148 int ocelot_port_configure_serdes(struct ocelot *ocelot, int port,
1151 void ocelot_phylink_mac_config(struct ocelot *ocelot, int port,
1154 void ocelot_phylink_mac_link_down(struct ocelot *ocelot, int port,
1158 void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port,
1166 int ocelot_mact_lookup(struct ocelot *ocelot, int *dst_idx,
1169 int ocelot_mact_learn_streamdata(struct ocelot *ocelot, int dst_idx,
1175 int ocelot_migrate_mdbs(struct ocelot *ocelot, unsigned long from_mask,
1178 int ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix,
1180 int ocelot_vcap_policer_del(struct ocelot *ocelot, u32 pol_ix);
1182 void ocelot_mm_irq(struct ocelot *ocelot);
1183 int ocelot_port_set_mm(struct ocelot *ocelot, int port,
1186 int ocelot_port_get_mm(struct ocelot *ocelot, int port,
1188 int ocelot_port_mqprio(struct ocelot *ocelot, int port,
1192 int ocelot_mrp_add(struct ocelot *ocelot, int port,
1194 int ocelot_mrp_del(struct ocelot *ocelot, int port,
1196 int ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port,
1198 int ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port,
1201 static inline int ocelot_mrp_add(struct ocelot *ocelot, int port,
1204 return -EOPNOTSUPP;
1207 static inline int ocelot_mrp_del(struct ocelot *ocelot, int port,
1210 return -EOPNOTSUPP;
1214 ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port,
1217 return -EOPNOTSUPP;
1221 ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port,
1224 return -EOPNOTSUPP;
1228 void ocelot_pll5_init(struct ocelot *ocelot);