Lines Matching full:ds

86 static void xrs700x_get_strings(struct dsa_switch *ds, int port,  in xrs700x_get_strings()  argument
100 static int xrs700x_get_sset_count(struct dsa_switch *ds, int port, int sset) in xrs700x_get_sset_count() argument
155 for (i = 0; i < priv->ds->num_ports; i++) in xrs700x_mib_work()
161 static void xrs700x_get_ethtool_stats(struct dsa_switch *ds, int port, in xrs700x_get_ethtool_stats() argument
164 struct xrs700x *priv = ds->priv; in xrs700x_get_ethtool_stats()
174 static void xrs700x_get_stats64(struct dsa_switch *ds, int port, in xrs700x_get_stats64() argument
177 struct xrs700x *priv = ds->priv; in xrs700x_get_stats64()
192 priv->ds->num_ports, in xrs700x_setup_regmap_range()
198 priv->ds->num_ports, in xrs700x_setup_regmap_range()
204 priv->ds->num_ports, in xrs700x_setup_regmap_range()
210 priv->ds->num_ports, in xrs700x_setup_regmap_range()
228 static enum dsa_tag_protocol xrs700x_get_tag_protocol(struct dsa_switch *ds, in xrs700x_get_tag_protocol() argument
235 static int xrs700x_reset(struct dsa_switch *ds) in xrs700x_reset() argument
237 struct xrs700x *priv = ds->priv; in xrs700x_reset()
257 static void xrs700x_port_stp_state_set(struct dsa_switch *ds, int port, in xrs700x_port_stp_state_set() argument
260 struct xrs700x *priv = ds->priv; in xrs700x_port_stp_state_set()
279 dev_err(ds->dev, "invalid STP state: %d\n", state); in xrs700x_port_stp_state_set()
299 static int xrs700x_port_add_bpdu_ipf(struct dsa_switch *ds, int port) in xrs700x_port_add_bpdu_ipf() argument
301 struct xrs700x *priv = ds->priv; in xrs700x_port_add_bpdu_ipf()
321 for (i = 0; i < ds->num_ports; i++) { in xrs700x_port_add_bpdu_ipf()
322 if (dsa_is_cpu_port(ds, i)) in xrs700x_port_add_bpdu_ipf()
342 static int xrs700x_port_add_hsrsup_ipf(struct dsa_switch *ds, int port, in xrs700x_port_add_hsrsup_ipf() argument
345 struct xrs700x *priv = ds->priv; in xrs700x_port_add_hsrsup_ipf()
365 for (i = 0; i < ds->num_ports; i++) { in xrs700x_port_add_hsrsup_ipf()
366 if (dsa_is_cpu_port(ds, i)) in xrs700x_port_add_hsrsup_ipf()
385 static int xrs700x_port_setup(struct dsa_switch *ds, int port) in xrs700x_port_setup() argument
387 bool cpu_port = dsa_is_cpu_port(ds, port); in xrs700x_port_setup()
388 struct xrs700x *priv = ds->priv; in xrs700x_port_setup()
392 xrs700x_port_stp_state_set(ds, port, BR_STATE_DISABLED); in xrs700x_port_setup()
395 for (i = 0; i < ds->num_ports; i++) { in xrs700x_port_setup()
396 if (!dsa_is_cpu_port(ds, i)) in xrs700x_port_setup()
411 ret = xrs700x_port_add_bpdu_ipf(ds, port); in xrs700x_port_setup()
419 static int xrs700x_setup(struct dsa_switch *ds) in xrs700x_setup() argument
421 struct xrs700x *priv = ds->priv; in xrs700x_setup()
424 ret = xrs700x_reset(ds); in xrs700x_setup()
428 for (i = 0; i < ds->num_ports; i++) { in xrs700x_setup()
429 ret = xrs700x_port_setup(ds, i); in xrs700x_setup()
439 static void xrs700x_teardown(struct dsa_switch *ds) in xrs700x_teardown() argument
441 struct xrs700x *priv = ds->priv; in xrs700x_teardown()
446 static void xrs700x_phylink_get_caps(struct dsa_switch *ds, int port, in xrs700x_phylink_get_caps() argument
464 dev_err(ds->dev, "Unsupported port: %i\n", port); in xrs700x_phylink_get_caps()
486 struct xrs700x *priv = dp->ds->priv; in xrs700x_mac_link_up()
510 static int xrs700x_bridge_common(struct dsa_switch *ds, int port, in xrs700x_bridge_common() argument
514 struct xrs700x *priv = ds->priv; in xrs700x_bridge_common()
517 for (i = 0; i < ds->num_ports; i++) { in xrs700x_bridge_common()
518 if (dsa_is_cpu_port(ds, i)) in xrs700x_bridge_common()
523 if (dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) in xrs700x_bridge_common()
529 for (i = 0; i < ds->num_ports; i++) { in xrs700x_bridge_common()
530 if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) in xrs700x_bridge_common()
549 static int xrs700x_bridge_join(struct dsa_switch *ds, int port, in xrs700x_bridge_join() argument
553 return xrs700x_bridge_common(ds, port, bridge, true); in xrs700x_bridge_join()
556 static void xrs700x_bridge_leave(struct dsa_switch *ds, int port, in xrs700x_bridge_leave() argument
559 xrs700x_bridge_common(ds, port, bridge, false); in xrs700x_bridge_leave()
562 static int xrs700x_hsr_join(struct dsa_switch *ds, int port, in xrs700x_hsr_join() argument
568 struct xrs700x *priv = ds->priv; in xrs700x_hsr_join()
594 dsa_hsr_foreach_port(dp, ds, hsr) { in xrs700x_hsr_join()
619 val = GENMASK(ds->num_ports - 1, 0); in xrs700x_hsr_join()
625 val &= ~BIT(dsa_upstream_port(ds, port)); in xrs700x_hsr_join()
638 ret = xrs700x_port_add_hsrsup_ipf(ds, partner->index, fwd ? port : -1); in xrs700x_hsr_join()
642 ret = xrs700x_port_add_hsrsup_ipf(ds, port, fwd ? partner->index : -1); in xrs700x_hsr_join()
653 user = dsa_to_port(ds, hsr_pair[i])->user; in xrs700x_hsr_join()
660 static int xrs700x_hsr_leave(struct dsa_switch *ds, int port, in xrs700x_hsr_leave() argument
664 struct xrs700x *priv = ds->priv; in xrs700x_hsr_leave()
669 dsa_hsr_foreach_port(dp, ds, hsr) { in xrs700x_hsr_leave()
687 val = GENMASK(ds->num_ports - 1, 0); in xrs700x_hsr_leave()
688 val &= ~BIT(dsa_upstream_port(ds, port)); in xrs700x_hsr_leave()
707 user = dsa_to_port(ds, hsr_pair[i])->user; in xrs700x_hsr_leave()
754 priv->ds->num_ports = info->num_ports; in xrs700x_detect()
767 struct dsa_switch *ds; in xrs700x_switch_alloc() local
770 ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL); in xrs700x_switch_alloc()
771 if (!ds) in xrs700x_switch_alloc()
774 ds->dev = base; in xrs700x_switch_alloc()
782 ds->ops = &xrs700x_ops; in xrs700x_switch_alloc()
783 ds->phylink_mac_ops = &xrs700x_phylink_mac_ops; in xrs700x_switch_alloc()
784 ds->priv = priv; in xrs700x_switch_alloc()
787 priv->ds = ds; in xrs700x_switch_alloc()
822 priv->ports = devm_kcalloc(priv->dev, priv->ds->num_ports, in xrs700x_switch_register()
827 for (i = 0; i < priv->ds->num_ports; i++) { in xrs700x_switch_register()
833 return dsa_register_switch(priv->ds); in xrs700x_switch_register()
839 dsa_unregister_switch(priv->ds); in xrs700x_switch_remove()
845 dsa_switch_shutdown(priv->ds); in xrs700x_switch_shutdown()