Lines Matching refs: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()
469 static void xrs700x_mac_link_up(struct dsa_switch *ds, int port, in xrs700x_mac_link_up() argument
475 struct xrs700x *priv = ds->priv; in xrs700x_mac_link_up()
498 static int xrs700x_bridge_common(struct dsa_switch *ds, int port, in xrs700x_bridge_common() argument
502 struct xrs700x *priv = ds->priv; in xrs700x_bridge_common()
505 for (i = 0; i < ds->num_ports; i++) { in xrs700x_bridge_common()
506 if (dsa_is_cpu_port(ds, i)) in xrs700x_bridge_common()
511 if (dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) in xrs700x_bridge_common()
517 for (i = 0; i < ds->num_ports; i++) { in xrs700x_bridge_common()
518 if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) in xrs700x_bridge_common()
537 static int xrs700x_bridge_join(struct dsa_switch *ds, int port, in xrs700x_bridge_join() argument
541 return xrs700x_bridge_common(ds, port, bridge, true); in xrs700x_bridge_join()
544 static void xrs700x_bridge_leave(struct dsa_switch *ds, int port, in xrs700x_bridge_leave() argument
547 xrs700x_bridge_common(ds, port, bridge, false); in xrs700x_bridge_leave()
550 static int xrs700x_hsr_join(struct dsa_switch *ds, int port, in xrs700x_hsr_join() argument
555 struct xrs700x *priv = ds->priv; in xrs700x_hsr_join()
576 dsa_hsr_foreach_port(dp, ds, hsr) { in xrs700x_hsr_join()
601 val = GENMASK(ds->num_ports - 1, 0); in xrs700x_hsr_join()
607 val &= ~BIT(dsa_upstream_port(ds, port)); in xrs700x_hsr_join()
620 ret = xrs700x_port_add_hsrsup_ipf(ds, partner->index, fwd ? port : -1); in xrs700x_hsr_join()
624 ret = xrs700x_port_add_hsrsup_ipf(ds, port, fwd ? partner->index : -1); in xrs700x_hsr_join()
635 slave = dsa_to_port(ds, hsr_pair[i])->slave; in xrs700x_hsr_join()
642 static int xrs700x_hsr_leave(struct dsa_switch *ds, int port, in xrs700x_hsr_leave() argument
646 struct xrs700x *priv = ds->priv; in xrs700x_hsr_leave()
651 dsa_hsr_foreach_port(dp, ds, hsr) { in xrs700x_hsr_leave()
669 val = GENMASK(ds->num_ports - 1, 0); in xrs700x_hsr_leave()
670 val &= ~BIT(dsa_upstream_port(ds, port)); in xrs700x_hsr_leave()
689 slave = dsa_to_port(ds, hsr_pair[i])->slave; in xrs700x_hsr_leave()
731 priv->ds->num_ports = info->num_ports; in xrs700x_detect()
744 struct dsa_switch *ds; in xrs700x_switch_alloc() local
747 ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL); in xrs700x_switch_alloc()
748 if (!ds) in xrs700x_switch_alloc()
751 ds->dev = base; in xrs700x_switch_alloc()
759 ds->ops = &xrs700x_ops; in xrs700x_switch_alloc()
760 ds->priv = priv; in xrs700x_switch_alloc()
763 priv->ds = ds; in xrs700x_switch_alloc()
798 priv->ports = devm_kcalloc(priv->dev, priv->ds->num_ports, in xrs700x_switch_register()
803 for (i = 0; i < priv->ds->num_ports; i++) { in xrs700x_switch_register()
809 return dsa_register_switch(priv->ds); in xrs700x_switch_register()
815 dsa_unregister_switch(priv->ds); in xrs700x_switch_remove()
821 dsa_switch_shutdown(priv->ds); in xrs700x_switch_shutdown()