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
805 struct ocelot { struct
868 * configuration of the Time-Aware Shaper, MAC Merge layer and
869 * cut-through forwarding, on which it depends
875 u8 ptp:1;
876 u8 mm_supported:1;
880 /* Protects the 2-step TX timestamp ID logic */
896 #define ocelot_bulk_read(ocelot, reg, buf, count) \ argument
897 __ocelot_bulk_read_ix(ocelot, reg, 0, buf, count)
899 #define ocelot_read_ix(ocelot, reg, gi, ri) \ argument
900 __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
901 #define ocelot_read_gix(ocelot, reg, gi) \ argument
902 __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi))
903 #define ocelot_read_rix(ocelot, reg, ri) \ argument
904 __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri))
905 #define ocelot_read(ocelot, reg) \ argument
906 __ocelot_read_ix(ocelot, reg, 0)
908 #define ocelot_write_ix(ocelot, val, reg, gi, ri) \ argument
909 __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
910 #define ocelot_write_gix(ocelot, val, reg, gi) \ argument
911 __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi))
912 #define ocelot_write_rix(ocelot, val, reg, ri) \ argument
913 __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
914 #define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0) argument
916 #define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) \ argument
917 __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
918 #define ocelot_rmw_gix(ocelot, val, m, reg, gi) \ argument
919 __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi))
920 #define ocelot_rmw_rix(ocelot, val, m, reg, ri) \ argument
921 __ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri))
922 #define ocelot_rmw(ocelot, val, m, reg) __ocelot_rmw_ix(ocelot, val, m, reg, 0) argument
924 #define ocelot_field_write(ocelot, reg, val) \ argument
925 regmap_field_write((ocelot)->regfields[(reg)], (val))
926 #define ocelot_field_read(ocelot, reg, val) \ argument
927 regmap_field_read((ocelot)->regfields[(reg)], (val))
928 #define ocelot_fields_write(ocelot, id, reg, val) \ argument
929 regmap_fields_write((ocelot)->regfields[(reg)], (id), (val))
930 #define ocelot_fields_read(ocelot, id, reg, val) \ argument
931 regmap_fields_read((ocelot)->regfields[(reg)], (id), (val))
933 #define ocelot_target_read_ix(ocelot, target, reg, gi, ri) \ argument
934 __ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
935 #define ocelot_target_read_gix(ocelot, target, reg, gi) \ argument
936 __ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi))
937 #define ocelot_target_read_rix(ocelot, target, reg, ri) \ argument
938 __ocelot_target_read_ix(ocelot, target, reg, reg##_RSZ * (ri))
939 #define ocelot_target_read(ocelot, target, reg) \ argument
940 __ocelot_target_read_ix(ocelot, target, reg, 0)
942 #define ocelot_target_write_ix(ocelot, target, val, reg, gi, ri) \ argument
943 __ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
944 #define ocelot_target_write_gix(ocelot, target, val, reg, gi) \ argument
945 __ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi))
946 #define ocelot_target_write_rix(ocelot, target, val, reg, ri) \ argument
947 __ocelot_target_write_ix(ocelot, target, val, reg, reg##_RSZ * (ri))
948 #define ocelot_target_write(ocelot, target, val, reg) \ argument
949 __ocelot_target_write_ix(ocelot, target, val, reg, 0)
956 int __ocelot_bulk_read_ix(struct ocelot *ocelot, enum ocelot_reg reg,
958 u32 __ocelot_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, u32 offset);
959 void __ocelot_write_ix(struct ocelot *ocelot, u32 val, enum ocelot_reg reg,
961 void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask,
963 u32 __ocelot_target_read_ix(struct ocelot *ocelot, enum ocelot_target target,
965 void __ocelot_target_write_ix(struct ocelot *ocelot, enum ocelot_target target,
969 bool ocelot_can_inject(struct ocelot *ocelot, int grp);
970 void ocelot_port_inject_frame(struct ocelot *ocelot, int port, int grp,
973 int ocelot_xtr_poll_frame(struct ocelot *ocelot, int grp, struct sk_buff **skb);
974 void ocelot_drain_cpu_queue(struct ocelot *ocelot, int grp);
975 void ocelot_ptp_rx_timestamp(struct ocelot *ocelot, struct sk_buff *skb,
979 int ocelot_regfields_init(struct ocelot *ocelot,
981 struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res);
982 int ocelot_reset(struct ocelot *ocelot);
983 int ocelot_init(struct ocelot *ocelot);
984 void ocelot_deinit(struct ocelot *ocelot);
985 void ocelot_init_port(struct ocelot *ocelot, int port);
986 void ocelot_deinit_port(struct ocelot *ocelot, int port);
988 void ocelot_port_setup_dsa_8021q_cpu(struct ocelot *ocelot, int cpu);
989 void ocelot_port_teardown_dsa_8021q_cpu(struct ocelot *ocelot, int cpu);
990 void ocelot_port_assign_dsa_8021q_cpu(struct ocelot *ocelot, int port, int cpu);
991 void ocelot_port_unassign_dsa_8021q_cpu(struct ocelot *ocelot, int port);
992 u32 ocelot_port_assigned_dsa_8021q_cpu_mask(struct ocelot *ocelot, int port);
1000 void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data);
1001 void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data);
1002 int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset);
1003 void ocelot_port_get_stats64(struct ocelot *ocelot, int port,
1005 void ocelot_port_get_pause_stats(struct ocelot *ocelot, int port,
1007 void ocelot_port_get_mm_stats(struct ocelot *ocelot, int port,
1009 void ocelot_port_get_rmon_stats(struct ocelot *ocelot, int port,
1012 void ocelot_port_get_eth_ctrl_stats(struct ocelot *ocelot, int port,
1014 void ocelot_port_get_eth_mac_stats(struct ocelot *ocelot, int port,
1016 void ocelot_port_get_eth_phy_stats(struct ocelot *ocelot, int port,
1018 int ocelot_get_ts_info(struct ocelot *ocelot, int port,
1020 void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs);
1021 int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled,
1023 void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
1024 u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port);
1025 int ocelot_port_pre_bridge_flags(struct ocelot *ocelot, int port,
1027 void ocelot_port_bridge_flags(struct ocelot *ocelot, int port,
1029 int ocelot_port_get_default_prio(struct ocelot *ocelot, int port);
1030 int ocelot_port_set_default_prio(struct ocelot *ocelot, int port, u8 prio);
1031 int ocelot_port_get_dscp_prio(struct ocelot *ocelot, int port, u8 dscp);
1032 int ocelot_port_add_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio);
1033 int ocelot_port_del_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio);
1034 int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
1037 void ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
1039 int ocelot_mact_flush(struct ocelot *ocelot, int port);
1040 int ocelot_fdb_dump(struct ocelot *ocelot, int port,
1042 int ocelot_fdb_add(struct ocelot *ocelot, int port, const unsigned char *addr,
1044 int ocelot_fdb_del(struct ocelot *ocelot, int port, const unsigned char *addr,
1046 int ocelot_lag_fdb_add(struct ocelot *ocelot, struct net_device *bond,
1049 int ocelot_lag_fdb_del(struct ocelot *ocelot, struct net_device *bond,
1052 int ocelot_vlan_prepare(struct ocelot *ocelot, int port, u16 vid, bool pvid,
1054 int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
1056 int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid);
1057 int ocelot_hwstamp_get(struct ocelot *ocelot, int port, struct ifreq *ifr);
1058 int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr);
1059 int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port,
1062 void ocelot_get_txtstamp(struct ocelot *ocelot);
1063 void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu);
1064 int ocelot_get_max_mtu(struct ocelot *ocelot, int port);
1065 int ocelot_port_policer_add(struct ocelot *ocelot, int port,
1067 int ocelot_port_policer_del(struct ocelot *ocelot, int port);
1068 int ocelot_port_mirror_add(struct ocelot *ocelot, int from, int to,
1070 void ocelot_port_mirror_del(struct ocelot *ocelot, int from, bool ingress);
1071 int ocelot_cls_flower_replace(struct ocelot *ocelot, int port,
1073 int ocelot_cls_flower_destroy(struct ocelot *ocelot, int port,
1075 int ocelot_cls_flower_stats(struct ocelot *ocelot, int port,
1077 int ocelot_port_mdb_add(struct ocelot *ocelot, int port,
1080 int ocelot_port_mdb_del(struct ocelot *ocelot, int port,
1083 int ocelot_port_lag_join(struct ocelot *ocelot, int port,
1087 void ocelot_port_lag_leave(struct ocelot *ocelot, int port,
1089 void ocelot_port_lag_change(struct ocelot *ocelot, int port, bool lag_tx_active);
1090 int ocelot_bond_get_id(struct ocelot *ocelot, struct net_device *bond);
1092 int ocelot_devlink_sb_register(struct ocelot *ocelot);
1093 void ocelot_devlink_sb_unregister(struct ocelot *ocelot);
1094 int ocelot_sb_pool_get(struct ocelot *ocelot, unsigned int sb_index,
1097 int ocelot_sb_pool_set(struct ocelot *ocelot, unsigned int sb_index,
1101 int ocelot_sb_port_pool_get(struct ocelot *ocelot, int port,
1104 int ocelot_sb_port_pool_set(struct ocelot *ocelot, int port,
1107 int ocelot_sb_tc_pool_bind_get(struct ocelot *ocelot, int port,
1111 int ocelot_sb_tc_pool_bind_set(struct ocelot *ocelot, int port,
1116 int ocelot_sb_occ_snapshot(struct ocelot *ocelot, unsigned int sb_index);
1117 int ocelot_sb_occ_max_clear(struct ocelot *ocelot, unsigned int sb_index);
1118 int ocelot_sb_occ_port_pool_get(struct ocelot *ocelot, int port,
1121 int ocelot_sb_occ_tc_port_bind_get(struct ocelot *ocelot, int port,
1126 int ocelot_port_configure_serdes(struct ocelot *ocelot, int port,
1129 void ocelot_phylink_mac_config(struct ocelot *ocelot, int port,
1132 void ocelot_phylink_mac_link_down(struct ocelot *ocelot, int port,
1136 void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port,
1144 int ocelot_mact_lookup(struct ocelot *ocelot, int *dst_idx,
1147 int ocelot_mact_learn_streamdata(struct ocelot *ocelot, int dst_idx,
1153 int ocelot_migrate_mdbs(struct ocelot *ocelot, unsigned long from_mask,
1156 int ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix,
1158 int ocelot_vcap_policer_del(struct ocelot *ocelot, u32 pol_ix);
1160 void ocelot_mm_irq(struct ocelot *ocelot);
1161 int ocelot_port_set_mm(struct ocelot *ocelot, int port,
1164 int ocelot_port_get_mm(struct ocelot *ocelot, int port,
1166 int ocelot_port_mqprio(struct ocelot *ocelot, int port,
1170 int ocelot_mrp_add(struct ocelot *ocelot, int port,
1172 int ocelot_mrp_del(struct ocelot *ocelot, int port,
1174 int ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port,
1176 int ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port,
1179 static inline int ocelot_mrp_add(struct ocelot *ocelot, int port, in ocelot_mrp_add() argument
1182 return -EOPNOTSUPP; in ocelot_mrp_add()
1185 static inline int ocelot_mrp_del(struct ocelot *ocelot, int port, in ocelot_mrp_del() argument
1188 return -EOPNOTSUPP; in ocelot_mrp_del()
1192 ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port, in ocelot_mrp_add_ring_role() argument
1195 return -EOPNOTSUPP; in ocelot_mrp_add_ring_role()
1199 ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port, in ocelot_mrp_del_ring_role() argument
1202 return -EOPNOTSUPP; in ocelot_mrp_del_ring_role()
1206 void ocelot_pll5_init(struct ocelot *ocelot);