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) \ argument
75 (pgid) < (ocelot)->num_phys_ports; \
78 #define for_each_nonreserved_multicast_dest_pgid(ocelot, pgid) \ argument
79 for ((pgid) = (ocelot)->num_phys_ports + 1; \
83 #define for_each_aggr_pgid(ocelot, pgid) \ argument
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)
765 struct ocelot *ocelot; member
803 struct ocelot { struct
869 * configuration of the Time-Aware Shaper, MAC Merge layer and
870 * cut-through forwarding, on which it depends
876 u8 ptp:1;
877 u8 mm_supported:1;
881 /* Protects the 2-step TX timestamp ID logic */
897 #define ocelot_bulk_read(ocelot, reg, buf, count) \ argument
898 __ocelot_bulk_read_ix(ocelot, reg, 0, buf, count)
900 #define ocelot_read_ix(ocelot, reg, gi, ri) \ argument
901 __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
902 #define ocelot_read_gix(ocelot, reg, gi) \ argument
903 __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi))
904 #define ocelot_read_rix(ocelot, reg, ri) \ argument
905 __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri))
906 #define ocelot_read(ocelot, reg) \ argument
907 __ocelot_read_ix(ocelot, reg, 0)
909 #define ocelot_write_ix(ocelot, val, reg, gi, ri) \ argument
910 __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
911 #define ocelot_write_gix(ocelot, val, reg, gi) \ argument
912 __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi))
913 #define ocelot_write_rix(ocelot, val, reg, ri) \ argument
914 __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
915 #define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0) argument
917 #define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) \ argument
918 __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
919 #define ocelot_rmw_gix(ocelot, val, m, reg, gi) \ argument
920 __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi))
921 #define ocelot_rmw_rix(ocelot, val, m, reg, ri) \ argument
922 __ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri))
923 #define ocelot_rmw(ocelot, val, m, reg) __ocelot_rmw_ix(ocelot, val, m, reg, 0) argument
925 #define ocelot_field_write(ocelot, reg, val) \ argument
926 regmap_field_write((ocelot)->regfields[(reg)], (val))
927 #define ocelot_field_read(ocelot, reg, val) \ argument
928 regmap_field_read((ocelot)->regfields[(reg)], (val))
929 #define ocelot_fields_write(ocelot, id, reg, val) \ argument
930 regmap_fields_write((ocelot)->regfields[(reg)], (id), (val))
931 #define ocelot_fields_read(ocelot, id, reg, val) \ argument
932 regmap_fields_read((ocelot)->regfields[(reg)], (id), (val))
934 #define ocelot_target_read_ix(ocelot, target, reg, gi, ri) \ argument
935 __ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
936 #define ocelot_target_read_gix(ocelot, target, reg, gi) \ argument
937 __ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi))
938 #define ocelot_target_read_rix(ocelot, target, reg, ri) \ argument
939 __ocelot_target_read_ix(ocelot, target, reg, reg##_RSZ * (ri))
940 #define ocelot_target_read(ocelot, target, reg) \ argument
941 __ocelot_target_read_ix(ocelot, target, reg, 0)
943 #define ocelot_target_write_ix(ocelot, target, val, reg, gi, ri) \ argument
944 __ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
945 #define ocelot_target_write_gix(ocelot, target, val, reg, gi) \ argument
946 __ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi))
947 #define ocelot_target_write_rix(ocelot, target, val, reg, ri) \ argument
948 __ocelot_target_write_ix(ocelot, target, val, reg, reg##_RSZ * (ri))
949 #define ocelot_target_write(ocelot, target, val, reg) \ argument
950 __ocelot_target_write_ix(ocelot, target, val, reg, 0)
957 int __ocelot_bulk_read_ix(struct ocelot *ocelot, enum ocelot_reg reg,
959 u32 __ocelot_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, u32 offset);
960 void __ocelot_write_ix(struct ocelot *ocelot, u32 val, enum ocelot_reg reg,
962 void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask,
964 u32 __ocelot_target_read_ix(struct ocelot *ocelot, enum ocelot_target target,
966 void __ocelot_target_write_ix(struct ocelot *ocelot, enum ocelot_target target,
970 void ocelot_lock_inj_grp(struct ocelot *ocelot, int grp);
971 void ocelot_unlock_inj_grp(struct ocelot *ocelot, int grp);
972 void ocelot_lock_xtr_grp(struct ocelot *ocelot, int grp);
973 void ocelot_unlock_xtr_grp(struct ocelot *ocelot, int grp);
974 void ocelot_lock_xtr_grp_bh(struct ocelot *ocelot, int grp);
975 void ocelot_unlock_xtr_grp_bh(struct ocelot *ocelot, int grp);
976 bool ocelot_can_inject(struct ocelot *ocelot, int grp);
977 void ocelot_port_inject_frame(struct ocelot *ocelot, int port, int grp,
979 void ocelot_ifh_set_basic(void *ifh, struct ocelot *ocelot, int port,
981 int ocelot_xtr_poll_frame(struct ocelot *ocelot, int grp, struct sk_buff **skb);
982 void ocelot_drain_cpu_queue(struct ocelot *ocelot, int grp);
983 void ocelot_ptp_rx_timestamp(struct ocelot *ocelot, struct sk_buff *skb,
987 int ocelot_regfields_init(struct ocelot *ocelot,
989 struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res);
990 int ocelot_reset(struct ocelot *ocelot);
991 int ocelot_init(struct ocelot *ocelot);
992 void ocelot_deinit(struct ocelot *ocelot);
993 void ocelot_init_port(struct ocelot *ocelot, int port);
994 void ocelot_deinit_port(struct ocelot *ocelot, int port);
996 void ocelot_port_setup_dsa_8021q_cpu(struct ocelot *ocelot, int cpu);
997 void ocelot_port_teardown_dsa_8021q_cpu(struct ocelot *ocelot, int cpu);
998 void ocelot_port_assign_dsa_8021q_cpu(struct ocelot *ocelot, int port, int cpu);
999 void ocelot_port_unassign_dsa_8021q_cpu(struct ocelot *ocelot, int port);
1000 u32 ocelot_port_assigned_dsa_8021q_cpu_mask(struct ocelot *ocelot, int port);
1008 void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data);
1009 void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data);
1010 int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset);
1011 void ocelot_port_get_stats64(struct ocelot *ocelot, int port,
1013 void ocelot_port_get_pause_stats(struct ocelot *ocelot, int port,
1015 void ocelot_port_get_mm_stats(struct ocelot *ocelot, int port,
1017 void ocelot_port_get_rmon_stats(struct ocelot *ocelot, int port,
1020 void ocelot_port_get_eth_ctrl_stats(struct ocelot *ocelot, int port,
1022 void ocelot_port_get_eth_mac_stats(struct ocelot *ocelot, int port,
1024 void ocelot_port_get_eth_phy_stats(struct ocelot *ocelot, int port,
1026 int ocelot_get_ts_info(struct ocelot *ocelot, int port,
1028 void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs);
1029 int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled,
1031 void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
1032 u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port);
1033 int ocelot_port_pre_bridge_flags(struct ocelot *ocelot, int port,
1035 void ocelot_port_bridge_flags(struct ocelot *ocelot, int port,
1037 int ocelot_port_get_default_prio(struct ocelot *ocelot, int port);
1038 int ocelot_port_set_default_prio(struct ocelot *ocelot, int port, u8 prio);
1039 int ocelot_port_get_dscp_prio(struct ocelot *ocelot, int port, u8 dscp);
1040 int ocelot_port_add_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio);
1041 int ocelot_port_del_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio);
1042 int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
1045 void ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
1047 int ocelot_mact_flush(struct ocelot *ocelot, int port);
1048 int ocelot_fdb_dump(struct ocelot *ocelot, int port,
1050 int ocelot_fdb_add(struct ocelot *ocelot, int port, const unsigned char *addr,
1052 int ocelot_fdb_del(struct ocelot *ocelot, int port, const unsigned char *addr,
1054 int ocelot_lag_fdb_add(struct ocelot *ocelot, struct net_device *bond,
1057 int ocelot_lag_fdb_del(struct ocelot *ocelot, struct net_device *bond,
1060 int ocelot_vlan_prepare(struct ocelot *ocelot, int port, u16 vid, bool pvid,
1062 int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
1064 int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid);
1065 int ocelot_hwstamp_get(struct ocelot *ocelot, int port, struct ifreq *ifr);
1066 int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr);
1067 int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port,
1070 void ocelot_get_txtstamp(struct ocelot *ocelot);
1071 void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu);
1072 int ocelot_get_max_mtu(struct ocelot *ocelot, int port);
1073 int ocelot_port_policer_add(struct ocelot *ocelot, int port,
1075 int ocelot_port_policer_del(struct ocelot *ocelot, int port);
1076 int ocelot_port_mirror_add(struct ocelot *ocelot, int from, int to,
1078 void ocelot_port_mirror_del(struct ocelot *ocelot, int from, bool ingress);
1079 int ocelot_cls_flower_replace(struct ocelot *ocelot, int port,
1081 int ocelot_cls_flower_destroy(struct ocelot *ocelot, int port,
1083 int ocelot_cls_flower_stats(struct ocelot *ocelot, int port,
1085 int ocelot_port_mdb_add(struct ocelot *ocelot, int port,
1088 int ocelot_port_mdb_del(struct ocelot *ocelot, int port,
1091 int ocelot_port_lag_join(struct ocelot *ocelot, int port,
1095 void ocelot_port_lag_leave(struct ocelot *ocelot, int port,
1097 void ocelot_port_lag_change(struct ocelot *ocelot, int port, bool lag_tx_active);
1098 int ocelot_bond_get_id(struct ocelot *ocelot, struct net_device *bond);
1100 int ocelot_devlink_sb_register(struct ocelot *ocelot);
1101 void ocelot_devlink_sb_unregister(struct ocelot *ocelot);
1102 int ocelot_sb_pool_get(struct ocelot *ocelot, unsigned int sb_index,
1105 int ocelot_sb_pool_set(struct ocelot *ocelot, unsigned int sb_index,
1109 int ocelot_sb_port_pool_get(struct ocelot *ocelot, int port,
1112 int ocelot_sb_port_pool_set(struct ocelot *ocelot, int port,
1115 int ocelot_sb_tc_pool_bind_get(struct ocelot *ocelot, int port,
1119 int ocelot_sb_tc_pool_bind_set(struct ocelot *ocelot, int port,
1124 int ocelot_sb_occ_snapshot(struct ocelot *ocelot, unsigned int sb_index);
1125 int ocelot_sb_occ_max_clear(struct ocelot *ocelot, unsigned int sb_index);
1126 int ocelot_sb_occ_port_pool_get(struct ocelot *ocelot, int port,
1129 int ocelot_sb_occ_tc_port_bind_get(struct ocelot *ocelot, int port,
1134 int ocelot_port_configure_serdes(struct ocelot *ocelot, int port,
1137 void ocelot_phylink_mac_config(struct ocelot *ocelot, int port,
1140 void ocelot_phylink_mac_link_down(struct ocelot *ocelot, int port,
1144 void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port,
1152 int ocelot_mact_lookup(struct ocelot *ocelot, int *dst_idx,
1155 int ocelot_mact_learn_streamdata(struct ocelot *ocelot, int dst_idx,
1161 int ocelot_migrate_mdbs(struct ocelot *ocelot, unsigned long from_mask,
1164 int ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix,
1166 int ocelot_vcap_policer_del(struct ocelot *ocelot, u32 pol_ix);
1168 void ocelot_mm_irq(struct ocelot *ocelot);
1169 int ocelot_port_set_mm(struct ocelot *ocelot, int port,
1172 int ocelot_port_get_mm(struct ocelot *ocelot, int port,
1174 int ocelot_port_mqprio(struct ocelot *ocelot, int port,
1178 int ocelot_mrp_add(struct ocelot *ocelot, int port,
1180 int ocelot_mrp_del(struct ocelot *ocelot, int port,
1182 int ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port,
1184 int ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port,
1187 static inline int ocelot_mrp_add(struct ocelot *ocelot, int port, in ocelot_mrp_add() argument
1190 return -EOPNOTSUPP; in ocelot_mrp_add()
1193 static inline int ocelot_mrp_del(struct ocelot *ocelot, int port, in ocelot_mrp_del() argument
1196 return -EOPNOTSUPP; in ocelot_mrp_del()
1200 ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port, in ocelot_mrp_add_ring_role() argument
1203 return -EOPNOTSUPP; in ocelot_mrp_add_ring_role()
1207 ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port, in ocelot_mrp_del_ring_role() argument
1210 return -EOPNOTSUPP; in ocelot_mrp_del_ring_role()
1214 void ocelot_pll5_init(struct ocelot *ocelot);