Lines Matching refs:dst

26 	struct dsa_switch_tree *dst;
29 list_for_each_entry(dst, &dsa_tree_list, list) {
30 if (dst->index != tree_index)
33 list_for_each_entry(dp, &dst->ports, list) {
47 struct dsa_switch_tree *dst;
49 list_for_each_entry(dst, &dsa_tree_list, list)
50 if (dst->index == index)
51 return dst;
58 struct dsa_switch_tree *dst;
60 dst = kzalloc(sizeof(*dst), GFP_KERNEL);
61 if (!dst)
64 dst->index = index;
66 INIT_LIST_HEAD(&dst->rtable);
68 INIT_LIST_HEAD(&dst->ports);
70 INIT_LIST_HEAD(&dst->list);
71 list_add_tail(&dst->list, &dsa_tree_list);
73 kref_init(&dst->refcount);
75 return dst;
78 static void dsa_tree_free(struct dsa_switch_tree *dst)
80 list_del(&dst->list);
81 kfree(dst);
84 static struct dsa_switch_tree *dsa_tree_get(struct dsa_switch_tree *dst)
86 if (dst)
87 kref_get(&dst->refcount);
89 return dst;
94 struct dsa_switch_tree *dst;
96 dst = dsa_tree_find(index);
97 if (dst)
98 return dsa_tree_get(dst);
105 struct dsa_switch_tree *dst;
107 dst = container_of(ref, struct dsa_switch_tree, refcount);
109 dsa_tree_free(dst);
112 static void dsa_tree_put(struct dsa_switch_tree *dst)
114 if (dst)
115 kref_put(&dst->refcount, dsa_tree_release);
133 static struct dsa_port *dsa_tree_find_port_by_node(struct dsa_switch_tree *dst,
138 list_for_each_entry(dp, &dst->ports, list)
149 struct dsa_switch_tree *dst;
152 dst = ds->dst;
154 list_for_each_entry(dl, &dst->rtable, list)
166 list_add_tail(&dl->list, &dst->rtable);
174 struct dsa_switch_tree *dst = ds->dst;
182 link_dp = dsa_tree_find_port_by_node(dst, it.node);
198 static bool dsa_tree_setup_routing_table(struct dsa_switch_tree *dst)
203 list_for_each_entry(dp, &dst->ports, list) {
214 static struct dsa_port *dsa_tree_find_first_cpu(struct dsa_switch_tree *dst)
218 list_for_each_entry(dp, &dst->ports, list)
225 static int dsa_tree_setup_default_cpu(struct dsa_switch_tree *dst)
229 cpu_dp = dsa_tree_find_first_cpu(dst);
231 pr_err("DSA: tree %d has no CPU port\n", dst->index);
236 list_for_each_entry(dp, &dst->ports, list)
243 static void dsa_tree_teardown_default_cpu(struct dsa_switch_tree *dst)
247 list_for_each_entry(dp, &dst->ports, list)
315 struct dsa_switch_tree *dst = dp->ds->dst;
322 id = (const unsigned char *)&dst->index;
323 len = sizeof(dst->index);
443 list_for_each_entry(dp, &ds->dst->ports, list) {
488 list_for_each_entry(dp, &ds->dst->ports, list)
518 list_for_each_entry(dp, &ds->dst->ports, list)
529 static int dsa_tree_setup_switches(struct dsa_switch_tree *dst)
534 list_for_each_entry(dp, &dst->ports, list) {
540 list_for_each_entry(dp, &dst->ports, list) {
555 list_for_each_entry(dp, &dst->ports, list)
558 list_for_each_entry(dp, &dst->ports, list)
564 static void dsa_tree_teardown_switches(struct dsa_switch_tree *dst)
568 list_for_each_entry(dp, &dst->ports, list)
571 list_for_each_entry(dp, &dst->ports, list)
575 static int dsa_tree_setup_master(struct dsa_switch_tree *dst)
580 list_for_each_entry(dp, &dst->ports, list) {
591 static void dsa_tree_teardown_master(struct dsa_switch_tree *dst)
595 list_for_each_entry(dp, &dst->ports, list)
600 static int dsa_tree_setup(struct dsa_switch_tree *dst)
605 if (dst->setup) {
607 dst->index);
611 complete = dsa_tree_setup_routing_table(dst);
615 err = dsa_tree_setup_default_cpu(dst);
619 err = dsa_tree_setup_switches(dst);
623 err = dsa_tree_setup_master(dst);
627 dst->setup = true;
629 pr_info("DSA: tree %d setup\n", dst->index);
634 dsa_tree_teardown_switches(dst);
636 dsa_tree_teardown_default_cpu(dst);
641 static void dsa_tree_teardown(struct dsa_switch_tree *dst)
645 if (!dst->setup)
648 dsa_tree_teardown_master(dst);
650 dsa_tree_teardown_switches(dst);
652 dsa_tree_teardown_default_cpu(dst);
654 list_for_each_entry_safe(dl, next, &dst->rtable, list) {
659 pr_info("DSA: tree %d torn down\n", dst->index);
661 dst->setup = false;
666 struct dsa_switch_tree *dst = ds->dst;
669 list_for_each_entry(dp, &dst->ports, list)
681 list_add_tail(&dp->list, &dst->ports);
733 struct dsa_switch_tree *dst = ds->dst;
752 dp->dst = dst;
835 ds->dst = dsa_tree_touch(m[0]);
836 if (!ds->dst)
933 ds->dst = dsa_tree_touch(0);
934 if (!ds->dst)
946 struct dsa_switch_tree *dst = ds->dst;
949 list_for_each_entry_safe(dp, next, &dst->ports, list) {
959 struct dsa_switch_tree *dst;
988 dst = ds->dst;
989 dsa_tree_get(dst);
990 err = dsa_tree_setup(dst);
993 dsa_tree_put(dst);
1005 dsa_tree_put(ds->dst);
1014 struct dsa_switch_tree *dst = ds->dst;
1016 dsa_tree_teardown(dst);
1018 dsa_tree_put(dst);