Lines Matching full:ds
105 int (*connect)(struct dsa_switch *ds);
106 void (*disconnect)(struct dsa_switch *ds);
185 if ((_dp)->ds == (_ds) && (_dp)->hsr_dev == (_hsr))
257 struct dsa_switch *ds;
513 static inline struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p)
515 struct dsa_switch_tree *dst = ds->dst;
519 if (dp->ds == ds && dp->index == p)
551 static inline bool dsa_is_unused_port(struct dsa_switch *ds, int p)
553 return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_UNUSED;
556 static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
558 return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_CPU;
561 static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p)
563 return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_DSA;
566 static inline bool dsa_is_user_port(struct dsa_switch *ds, int p)
568 return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_USER;
585 if ((_dp)->ds == (_ds))
589 if ((_dp)->ds == (_ds))
593 if ((_dp)->ds == (_ds))
615 static inline u32 dsa_user_ports(struct dsa_switch *ds)
620 dsa_switch_for_each_user_port(dp, ds)
626 static inline u32 dsa_cpu_ports(struct dsa_switch *ds)
631 dsa_switch_for_each_cpu_port(cpu_dp, ds)
638 static inline unsigned int dsa_routing_port(struct dsa_switch *ds, int device)
640 struct dsa_switch_tree *dst = ds->dst;
644 if (dl->dp->ds == ds && dl->link_dp->ds->index == device)
647 return ds->num_ports;
651 static inline unsigned int dsa_towards_port(struct dsa_switch *ds, int device,
654 if (device == ds->index)
657 return dsa_routing_port(ds, device);
661 static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port)
663 const struct dsa_port *dp = dsa_to_port(ds, port);
669 return dsa_towards_port(ds, cpu_dp->ds->index, cpu_dp->index);
673 static inline bool dsa_is_upstream_port(struct dsa_switch *ds, int port)
675 if (dsa_is_unused_port(ds, port))
678 return port == dsa_upstream_port(ds, port);
682 static inline bool dsa_is_downstream_port(struct dsa_switch *ds, int port)
684 return dsa_is_dsa_port(ds, port) && !dsa_is_upstream_port(ds, port);
688 static inline unsigned int dsa_switch_upstream_port(struct dsa_switch *ds)
692 dsa_switch_for_each_available_port(dp, ds) {
693 return dsa_upstream_port(ds, dp->index);
696 return ds->num_ports;
718 const struct dsa_switch *ds = dp->ds;
720 if (ds->vlan_filtering_is_global)
721 return ds->vlan_filtering;
839 dsa_bridge_ports(struct dsa_switch *ds, const struct net_device *bdev)
844 dsa_switch_for_each_bridge_member(dp, ds, bdev)
853 return a->ds->dst == b->ds->dst;
866 enum dsa_tag_protocol (*get_tag_protocol)(struct dsa_switch *ds,
869 int (*change_tag_protocol)(struct dsa_switch *ds,
876 int (*connect_tag_protocol)(struct dsa_switch *ds,
879 int (*port_change_conduit)(struct dsa_switch *ds, int port,
884 int (*setup)(struct dsa_switch *ds);
885 void (*teardown)(struct dsa_switch *ds);
890 int (*port_setup)(struct dsa_switch *ds, int port);
891 void (*port_teardown)(struct dsa_switch *ds, int port);
893 u32 (*get_phy_flags)(struct dsa_switch *ds, int port);
898 int (*phy_read)(struct dsa_switch *ds, int port, int regnum);
899 int (*phy_write)(struct dsa_switch *ds, int port,
905 void (*phylink_get_caps)(struct dsa_switch *ds, int port,
907 void (*phylink_fixed_state)(struct dsa_switch *ds, int port,
912 void (*get_strings)(struct dsa_switch *ds, int port,
914 void (*get_ethtool_stats)(struct dsa_switch *ds,
916 int (*get_sset_count)(struct dsa_switch *ds, int port, int sset);
917 void (*get_ethtool_phy_stats)(struct dsa_switch *ds,
919 void (*get_eth_phy_stats)(struct dsa_switch *ds, int port,
921 void (*get_eth_mac_stats)(struct dsa_switch *ds, int port,
923 void (*get_eth_ctrl_stats)(struct dsa_switch *ds, int port,
925 void (*get_rmon_stats)(struct dsa_switch *ds, int port,
928 void (*get_ts_stats)(struct dsa_switch *ds, int port,
930 void (*get_stats64)(struct dsa_switch *ds, int port,
932 void (*get_pause_stats)(struct dsa_switch *ds, int port,
934 void (*self_test)(struct dsa_switch *ds, int port,
940 void (*get_wol)(struct dsa_switch *ds, int port,
942 int (*set_wol)(struct dsa_switch *ds, int port,
948 int (*get_ts_info)(struct dsa_switch *ds, int port,
954 int (*get_mm)(struct dsa_switch *ds, int port,
956 int (*set_mm)(struct dsa_switch *ds, int port,
959 void (*get_mm_stats)(struct dsa_switch *ds, int port,
965 int (*port_get_default_prio)(struct dsa_switch *ds, int port);
966 int (*port_set_default_prio)(struct dsa_switch *ds, int port,
968 int (*port_get_dscp_prio)(struct dsa_switch *ds, int port, u8 dscp);
969 int (*port_add_dscp_prio)(struct dsa_switch *ds, int port, u8 dscp,
971 int (*port_del_dscp_prio)(struct dsa_switch *ds, int port, u8 dscp,
973 int (*port_set_apptrust)(struct dsa_switch *ds, int port,
975 int (*port_get_apptrust)(struct dsa_switch *ds, int port, u8 *sel,
981 int (*suspend)(struct dsa_switch *ds);
982 int (*resume)(struct dsa_switch *ds);
987 int (*port_enable)(struct dsa_switch *ds, int port,
989 void (*port_disable)(struct dsa_switch *ds, int port);
998 int (*port_set_mac_address)(struct dsa_switch *ds, int port,
1007 struct dsa_port *(*preferred_default_local_cpu_port)(struct dsa_switch *ds);
1012 bool (*support_eee)(struct dsa_switch *ds, int port);
1013 int (*set_mac_eee)(struct dsa_switch *ds, int port,
1017 int (*get_eeprom_len)(struct dsa_switch *ds);
1018 int (*get_eeprom)(struct dsa_switch *ds,
1020 int (*set_eeprom)(struct dsa_switch *ds,
1026 int (*get_regs_len)(struct dsa_switch *ds, int port);
1027 void (*get_regs)(struct dsa_switch *ds, int port,
1033 int (*port_prechangeupper)(struct dsa_switch *ds, int port,
1039 int (*set_ageing_time)(struct dsa_switch *ds, unsigned int msecs);
1040 int (*port_bridge_join)(struct dsa_switch *ds, int port,
1044 void (*port_bridge_leave)(struct dsa_switch *ds, int port,
1046 void (*port_stp_state_set)(struct dsa_switch *ds, int port,
1048 int (*port_mst_state_set)(struct dsa_switch *ds, int port,
1050 void (*port_fast_age)(struct dsa_switch *ds, int port);
1051 int (*port_vlan_fast_age)(struct dsa_switch *ds, int port, u16 vid);
1052 int (*port_pre_bridge_flags)(struct dsa_switch *ds, int port,
1055 int (*port_bridge_flags)(struct dsa_switch *ds, int port,
1058 void (*port_set_host_flood)(struct dsa_switch *ds, int port,
1064 int (*port_vlan_filtering)(struct dsa_switch *ds, int port,
1067 int (*port_vlan_add)(struct dsa_switch *ds, int port,
1070 int (*port_vlan_del)(struct dsa_switch *ds, int port,
1072 int (*vlan_msti_set)(struct dsa_switch *ds, struct dsa_bridge bridge,
1078 int (*port_fdb_add)(struct dsa_switch *ds, int port,
1081 int (*port_fdb_del)(struct dsa_switch *ds, int port,
1084 int (*port_fdb_dump)(struct dsa_switch *ds, int port,
1086 int (*lag_fdb_add)(struct dsa_switch *ds, struct dsa_lag lag,
1089 int (*lag_fdb_del)(struct dsa_switch *ds, struct dsa_lag lag,
1096 int (*port_mdb_add)(struct dsa_switch *ds, int port,
1099 int (*port_mdb_del)(struct dsa_switch *ds, int port,
1105 int (*get_rxnfc)(struct dsa_switch *ds, int port,
1107 int (*set_rxnfc)(struct dsa_switch *ds, int port,
1113 int (*cls_flower_add)(struct dsa_switch *ds, int port,
1115 int (*cls_flower_del)(struct dsa_switch *ds, int port,
1117 int (*cls_flower_stats)(struct dsa_switch *ds, int port,
1119 int (*port_mirror_add)(struct dsa_switch *ds, int port,
1122 void (*port_mirror_del)(struct dsa_switch *ds, int port,
1124 int (*port_policer_add)(struct dsa_switch *ds, int port,
1126 void (*port_policer_del)(struct dsa_switch *ds, int port);
1127 int (*port_setup_tc)(struct dsa_switch *ds, int port,
1133 int (*crosschip_bridge_join)(struct dsa_switch *ds, int tree_index,
1137 void (*crosschip_bridge_leave)(struct dsa_switch *ds, int tree_index,
1140 int (*crosschip_lag_change)(struct dsa_switch *ds, int sw_index,
1142 int (*crosschip_lag_join)(struct dsa_switch *ds, int sw_index,
1146 int (*crosschip_lag_leave)(struct dsa_switch *ds, int sw_index,
1152 int (*port_hwtstamp_get)(struct dsa_switch *ds, int port,
1154 int (*port_hwtstamp_set)(struct dsa_switch *ds, int port,
1157 void (*port_txtstamp)(struct dsa_switch *ds, int port,
1159 bool (*port_rxtstamp)(struct dsa_switch *ds, int port,
1163 int (*devlink_param_get)(struct dsa_switch *ds, u32 id,
1165 int (*devlink_param_set)(struct dsa_switch *ds, u32 id,
1167 int (*devlink_info_get)(struct dsa_switch *ds,
1170 int (*devlink_sb_pool_get)(struct dsa_switch *ds,
1173 int (*devlink_sb_pool_set)(struct dsa_switch *ds, unsigned int sb_index,
1177 int (*devlink_sb_port_pool_get)(struct dsa_switch *ds, int port,
1180 int (*devlink_sb_port_pool_set)(struct dsa_switch *ds, int port,
1184 int (*devlink_sb_tc_pool_bind_get)(struct dsa_switch *ds, int port,
1188 int (*devlink_sb_tc_pool_bind_set)(struct dsa_switch *ds, int port,
1193 int (*devlink_sb_occ_snapshot)(struct dsa_switch *ds,
1195 int (*devlink_sb_occ_max_clear)(struct dsa_switch *ds,
1197 int (*devlink_sb_occ_port_pool_get)(struct dsa_switch *ds, int port,
1200 int (*devlink_sb_occ_tc_port_bind_get)(struct dsa_switch *ds, int port,
1211 int (*port_change_mtu)(struct dsa_switch *ds, int port,
1213 int (*port_max_mtu)(struct dsa_switch *ds, int port);
1218 int (*port_lag_change)(struct dsa_switch *ds, int port);
1219 int (*port_lag_join)(struct dsa_switch *ds, int port,
1223 int (*port_lag_leave)(struct dsa_switch *ds, int port,
1229 int (*port_hsr_join)(struct dsa_switch *ds, int port,
1232 int (*port_hsr_leave)(struct dsa_switch *ds, int port,
1238 int (*port_mrp_add)(struct dsa_switch *ds, int port,
1240 int (*port_mrp_del)(struct dsa_switch *ds, int port,
1242 int (*port_mrp_add_ring_role)(struct dsa_switch *ds, int port,
1244 int (*port_mrp_del_ring_role)(struct dsa_switch *ds, int port,
1250 int (*tag_8021q_vlan_add)(struct dsa_switch *ds, int port, u16 vid,
1252 int (*tag_8021q_vlan_del)(struct dsa_switch *ds, int port, u16 vid);
1257 void (*conduit_state_change)(struct dsa_switch *ds,
1272 int dsa_devlink_params_register(struct dsa_switch *ds,
1275 void dsa_devlink_params_unregister(struct dsa_switch *ds,
1278 int dsa_devlink_resource_register(struct dsa_switch *ds,
1285 void dsa_devlink_resources_unregister(struct dsa_switch *ds);
1287 void dsa_devlink_resource_occ_get_register(struct dsa_switch *ds,
1291 void dsa_devlink_resource_occ_get_unregister(struct dsa_switch *ds,
1294 dsa_devlink_region_create(struct dsa_switch *ds,
1298 dsa_devlink_port_region_create(struct dsa_switch *ds,
1307 struct dsa_switch *ds;
1314 return dl_priv->ds;
1323 return dl_priv->ds;
1331 bool dsa_fdb_present_in_other_db(struct dsa_switch *ds, int port,
1334 bool dsa_mdb_present_in_other_db(struct dsa_switch *ds, int port,
1338 int dsa_port_simple_hsr_validate(struct dsa_switch *ds, int port,
1341 int dsa_port_simple_hsr_join(struct dsa_switch *ds, int port,
1344 int dsa_port_simple_hsr_leave(struct dsa_switch *ds, int port,
1382 void dsa_unregister_switch(struct dsa_switch *ds);
1383 int dsa_register_switch(struct dsa_switch *ds);
1384 void dsa_switch_shutdown(struct dsa_switch *ds);
1388 int dsa_switch_suspend(struct dsa_switch *ds);
1389 int dsa_switch_resume(struct dsa_switch *ds);
1391 static inline int dsa_switch_suspend(struct dsa_switch *ds)
1395 static inline int dsa_switch_resume(struct dsa_switch *ds)
1411 void dsa_port_phylink_mac_change(struct dsa_switch *ds, int port, bool up);
1412 bool dsa_supports_eee(struct dsa_switch *ds, int port);