Lines Matching full:ds
86 static void xrs700x_get_strings(struct dsa_switch *ds, int port, in xrs700x_get_strings() argument
98 static int xrs700x_get_sset_count(struct dsa_switch *ds, int port, int sset) in xrs700x_get_sset_count() argument
153 for (i = 0; i < priv->ds->num_ports; i++) in xrs700x_mib_work()
159 static void xrs700x_get_ethtool_stats(struct dsa_switch *ds, int port, in xrs700x_get_ethtool_stats() argument
162 struct xrs700x *priv = ds->priv; in xrs700x_get_ethtool_stats()
172 static void xrs700x_get_stats64(struct dsa_switch *ds, int port, in xrs700x_get_stats64() argument
175 struct xrs700x *priv = ds->priv; in xrs700x_get_stats64()
190 priv->ds->num_ports, in xrs700x_setup_regmap_range()
196 priv->ds->num_ports, in xrs700x_setup_regmap_range()
202 priv->ds->num_ports, in xrs700x_setup_regmap_range()
208 priv->ds->num_ports, in xrs700x_setup_regmap_range()
226 static enum dsa_tag_protocol xrs700x_get_tag_protocol(struct dsa_switch *ds, in xrs700x_get_tag_protocol() argument
233 static int xrs700x_reset(struct dsa_switch *ds) in xrs700x_reset() argument
235 struct xrs700x *priv = ds->priv; in xrs700x_reset()
255 static void xrs700x_port_stp_state_set(struct dsa_switch *ds, int port, in xrs700x_port_stp_state_set() argument
258 struct xrs700x *priv = ds->priv; in xrs700x_port_stp_state_set()
277 dev_err(ds->dev, "invalid STP state: %d\n", state); in xrs700x_port_stp_state_set()
297 static int xrs700x_port_add_bpdu_ipf(struct dsa_switch *ds, int port) in xrs700x_port_add_bpdu_ipf() argument
299 struct xrs700x *priv = ds->priv; in xrs700x_port_add_bpdu_ipf()
319 for (i = 0; i < ds->num_ports; i++) { in xrs700x_port_add_bpdu_ipf()
320 if (dsa_is_cpu_port(ds, i)) in xrs700x_port_add_bpdu_ipf()
340 static int xrs700x_port_add_hsrsup_ipf(struct dsa_switch *ds, int port, in xrs700x_port_add_hsrsup_ipf() argument
343 struct xrs700x *priv = ds->priv; in xrs700x_port_add_hsrsup_ipf()
363 for (i = 0; i < ds->num_ports; i++) { in xrs700x_port_add_hsrsup_ipf()
364 if (dsa_is_cpu_port(ds, i)) in xrs700x_port_add_hsrsup_ipf()
383 static int xrs700x_port_setup(struct dsa_switch *ds, int port) in xrs700x_port_setup() argument
385 bool cpu_port = dsa_is_cpu_port(ds, port); in xrs700x_port_setup()
386 struct xrs700x *priv = ds->priv; in xrs700x_port_setup()
390 xrs700x_port_stp_state_set(ds, port, BR_STATE_DISABLED); in xrs700x_port_setup()
393 for (i = 0; i < ds->num_ports; i++) { in xrs700x_port_setup()
394 if (!dsa_is_cpu_port(ds, i)) in xrs700x_port_setup()
409 ret = xrs700x_port_add_bpdu_ipf(ds, port); in xrs700x_port_setup()
417 static int xrs700x_setup(struct dsa_switch *ds) in xrs700x_setup() argument
419 struct xrs700x *priv = ds->priv; in xrs700x_setup()
422 ret = xrs700x_reset(ds); in xrs700x_setup()
426 for (i = 0; i < ds->num_ports; i++) { in xrs700x_setup()
427 ret = xrs700x_port_setup(ds, i); in xrs700x_setup()
437 static void xrs700x_teardown(struct dsa_switch *ds) in xrs700x_teardown() argument
439 struct xrs700x *priv = ds->priv; in xrs700x_teardown()
444 static void xrs700x_phylink_get_caps(struct dsa_switch *ds, int port, in xrs700x_phylink_get_caps() argument
462 dev_err(ds->dev, "Unsupported port: %i\n", port); in xrs700x_phylink_get_caps()
484 struct xrs700x *priv = dp->ds->priv; in xrs700x_mac_link_up()
508 static int xrs700x_bridge_common(struct dsa_switch *ds, int port, in xrs700x_bridge_common() argument
512 struct xrs700x *priv = ds->priv; in xrs700x_bridge_common()
515 for (i = 0; i < ds->num_ports; i++) { in xrs700x_bridge_common()
516 if (dsa_is_cpu_port(ds, i)) in xrs700x_bridge_common()
521 if (dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) in xrs700x_bridge_common()
527 for (i = 0; i < ds->num_ports; i++) { in xrs700x_bridge_common()
528 if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) in xrs700x_bridge_common()
547 static int xrs700x_bridge_join(struct dsa_switch *ds, int port, in xrs700x_bridge_join() argument
551 return xrs700x_bridge_common(ds, port, bridge, true); in xrs700x_bridge_join()
554 static void xrs700x_bridge_leave(struct dsa_switch *ds, int port, in xrs700x_bridge_leave() argument
557 xrs700x_bridge_common(ds, port, bridge, false); in xrs700x_bridge_leave()
560 static int xrs700x_hsr_join(struct dsa_switch *ds, int port, in xrs700x_hsr_join() argument
566 struct xrs700x *priv = ds->priv; in xrs700x_hsr_join()
592 dsa_hsr_foreach_port(dp, ds, hsr) { in xrs700x_hsr_join()
617 val = GENMASK(ds->num_ports - 1, 0); in xrs700x_hsr_join()
623 val &= ~BIT(dsa_upstream_port(ds, port)); in xrs700x_hsr_join()
636 ret = xrs700x_port_add_hsrsup_ipf(ds, partner->index, fwd ? port : -1); in xrs700x_hsr_join()
640 ret = xrs700x_port_add_hsrsup_ipf(ds, port, fwd ? partner->index : -1); in xrs700x_hsr_join()
651 user = dsa_to_port(ds, hsr_pair[i])->user; in xrs700x_hsr_join()
658 static int xrs700x_hsr_leave(struct dsa_switch *ds, int port, in xrs700x_hsr_leave() argument
662 struct xrs700x *priv = ds->priv; in xrs700x_hsr_leave()
667 dsa_hsr_foreach_port(dp, ds, hsr) { in xrs700x_hsr_leave()
685 val = GENMASK(ds->num_ports - 1, 0); in xrs700x_hsr_leave()
686 val &= ~BIT(dsa_upstream_port(ds, port)); in xrs700x_hsr_leave()
705 user = dsa_to_port(ds, hsr_pair[i])->user; in xrs700x_hsr_leave()
752 priv->ds->num_ports = info->num_ports; in xrs700x_detect()
765 struct dsa_switch *ds; in xrs700x_switch_alloc() local
768 ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL); in xrs700x_switch_alloc()
769 if (!ds) in xrs700x_switch_alloc()
772 ds->dev = base; in xrs700x_switch_alloc()
780 ds->ops = &xrs700x_ops; in xrs700x_switch_alloc()
781 ds->phylink_mac_ops = &xrs700x_phylink_mac_ops; in xrs700x_switch_alloc()
782 ds->priv = priv; in xrs700x_switch_alloc()
785 priv->ds = ds; in xrs700x_switch_alloc()
820 priv->ports = devm_kcalloc(priv->dev, priv->ds->num_ports, in xrs700x_switch_register()
825 for (i = 0; i < priv->ds->num_ports; i++) { in xrs700x_switch_register()
831 return dsa_register_switch(priv->ds); in xrs700x_switch_register()
837 dsa_unregister_switch(priv->ds); in xrs700x_switch_remove()
843 dsa_switch_shutdown(priv->ds); in xrs700x_switch_shutdown()