• Home
  • Raw
  • Download

Lines Matching refs:dst

37 int dsa_tree_notify(struct dsa_switch_tree *dst, unsigned long e, void *v)  in dsa_tree_notify()  argument
39 struct raw_notifier_head *nh = &dst->nh; in dsa_tree_notify()
61 struct dsa_switch_tree *dst; in dsa_broadcast() local
64 list_for_each_entry(dst, &dsa_tree_list, list) { in dsa_broadcast()
65 err = dsa_tree_notify(dst, e, v); in dsa_broadcast()
84 void dsa_lag_map(struct dsa_switch_tree *dst, struct net_device *lag) in dsa_lag_map() argument
88 if (dsa_lag_id(dst, lag) >= 0) in dsa_lag_map()
92 for (id = 0; id < dst->lags_len; id++) { in dsa_lag_map()
93 if (!dsa_lag_dev(dst, id)) { in dsa_lag_map()
94 dst->lags[id] = lag; in dsa_lag_map()
115 void dsa_lag_unmap(struct dsa_switch_tree *dst, struct net_device *lag) in dsa_lag_unmap() argument
120 dsa_lag_foreach_port(dp, dst, lag) in dsa_lag_unmap()
124 dsa_lags_foreach_id(id, dst) { in dsa_lag_unmap()
125 if (dsa_lag_dev(dst, id) == lag) { in dsa_lag_unmap()
126 dst->lags[id] = NULL; in dsa_lag_unmap()
134 struct dsa_switch_tree *dst; in dsa_bridge_num_find() local
142 list_for_each_entry(dst, &dsa_tree_list, list) in dsa_bridge_num_find()
143 list_for_each_entry(dp, &dst->ports, list) in dsa_bridge_num_find()
179 struct dsa_switch_tree *dst; in dsa_switch_find() local
182 list_for_each_entry(dst, &dsa_tree_list, list) { in dsa_switch_find()
183 if (dst->index != tree_index) in dsa_switch_find()
186 list_for_each_entry(dp, &dst->ports, list) { in dsa_switch_find()
200 struct dsa_switch_tree *dst; in dsa_tree_find() local
202 list_for_each_entry(dst, &dsa_tree_list, list) in dsa_tree_find()
203 if (dst->index == index) in dsa_tree_find()
204 return dst; in dsa_tree_find()
211 struct dsa_switch_tree *dst; in dsa_tree_alloc() local
213 dst = kzalloc(sizeof(*dst), GFP_KERNEL); in dsa_tree_alloc()
214 if (!dst) in dsa_tree_alloc()
217 dst->index = index; in dsa_tree_alloc()
219 INIT_LIST_HEAD(&dst->rtable); in dsa_tree_alloc()
221 INIT_LIST_HEAD(&dst->ports); in dsa_tree_alloc()
223 INIT_LIST_HEAD(&dst->list); in dsa_tree_alloc()
224 list_add_tail(&dst->list, &dsa_tree_list); in dsa_tree_alloc()
226 kref_init(&dst->refcount); in dsa_tree_alloc()
228 return dst; in dsa_tree_alloc()
231 static void dsa_tree_free(struct dsa_switch_tree *dst) in dsa_tree_free() argument
233 if (dst->tag_ops) in dsa_tree_free()
234 dsa_tag_driver_put(dst->tag_ops); in dsa_tree_free()
235 list_del(&dst->list); in dsa_tree_free()
236 kfree(dst); in dsa_tree_free()
239 static struct dsa_switch_tree *dsa_tree_get(struct dsa_switch_tree *dst) in dsa_tree_get() argument
241 if (dst) in dsa_tree_get()
242 kref_get(&dst->refcount); in dsa_tree_get()
244 return dst; in dsa_tree_get()
249 struct dsa_switch_tree *dst; in dsa_tree_touch() local
251 dst = dsa_tree_find(index); in dsa_tree_touch()
252 if (dst) in dsa_tree_touch()
253 return dsa_tree_get(dst); in dsa_tree_touch()
260 struct dsa_switch_tree *dst; in dsa_tree_release() local
262 dst = container_of(ref, struct dsa_switch_tree, refcount); in dsa_tree_release()
264 dsa_tree_free(dst); in dsa_tree_release()
267 static void dsa_tree_put(struct dsa_switch_tree *dst) in dsa_tree_put() argument
269 if (dst) in dsa_tree_put()
270 kref_put(&dst->refcount, dsa_tree_release); in dsa_tree_put()
273 static struct dsa_port *dsa_tree_find_port_by_node(struct dsa_switch_tree *dst, in dsa_tree_find_port_by_node() argument
278 list_for_each_entry(dp, &dst->ports, list) in dsa_tree_find_port_by_node()
289 struct dsa_switch_tree *dst; in dsa_link_touch() local
292 dst = ds->dst; in dsa_link_touch()
294 list_for_each_entry(dl, &dst->rtable, list) in dsa_link_touch()
306 list_add_tail(&dl->list, &dst->rtable); in dsa_link_touch()
314 struct dsa_switch_tree *dst = ds->dst; in dsa_port_setup_routing_table() local
322 link_dp = dsa_tree_find_port_by_node(dst, it.node); in dsa_port_setup_routing_table()
338 static bool dsa_tree_setup_routing_table(struct dsa_switch_tree *dst) in dsa_tree_setup_routing_table() argument
343 list_for_each_entry(dp, &dst->ports, list) { in dsa_tree_setup_routing_table()
354 static struct dsa_port *dsa_tree_find_first_cpu(struct dsa_switch_tree *dst) in dsa_tree_find_first_cpu() argument
358 list_for_each_entry(dp, &dst->ports, list) in dsa_tree_find_first_cpu()
368 static int dsa_tree_setup_default_cpu(struct dsa_switch_tree *dst) in dsa_tree_setup_default_cpu() argument
372 cpu_dp = dsa_tree_find_first_cpu(dst); in dsa_tree_setup_default_cpu()
374 pr_err("DSA: tree %d has no CPU port\n", dst->index); in dsa_tree_setup_default_cpu()
378 list_for_each_entry(dp, &dst->ports, list) { in dsa_tree_setup_default_cpu()
394 static int dsa_tree_setup_cpu_ports(struct dsa_switch_tree *dst) in dsa_tree_setup_cpu_ports() argument
398 list_for_each_entry(cpu_dp, &dst->ports, list) { in dsa_tree_setup_cpu_ports()
402 list_for_each_entry(dp, &dst->ports, list) { in dsa_tree_setup_cpu_ports()
416 return dsa_tree_setup_default_cpu(dst); in dsa_tree_setup_cpu_ports()
419 static void dsa_tree_teardown_cpu_ports(struct dsa_switch_tree *dst) in dsa_tree_teardown_cpu_ports() argument
423 list_for_each_entry(dp, &dst->ports, list) in dsa_tree_teardown_cpu_ports()
504 struct dsa_switch_tree *dst = dp->ds->dst; in dsa_port_devlink_setup() local
511 id = (const unsigned char *)&dst->index; in dsa_port_devlink_setup()
512 len = sizeof(dst->index); in dsa_port_devlink_setup()
803 const struct dsa_device_ops *tag_ops = ds->dst->tag_ops; in dsa_switch_setup_tag_protocol()
804 struct dsa_switch_tree *dst = ds->dst; in dsa_switch_setup_tag_protocol() local
807 if (tag_ops->proto == dst->default_proto) in dsa_switch_setup_tag_protocol()
860 list_for_each_entry(dp, &ds->dst->ports, list) { in dsa_switch_setup()
911 list_for_each_entry(dp, &ds->dst->ports, list) in dsa_switch_setup()
941 list_for_each_entry(dp, &ds->dst->ports, list) in dsa_switch_teardown()
956 static void dsa_tree_teardown_ports(struct dsa_switch_tree *dst) in dsa_tree_teardown_ports() argument
960 list_for_each_entry(dp, &dst->ports, list) in dsa_tree_teardown_ports()
966 list_for_each_entry(dp, &dst->ports, list) in dsa_tree_teardown_ports()
971 static void dsa_tree_teardown_switches(struct dsa_switch_tree *dst) in dsa_tree_teardown_switches() argument
975 list_for_each_entry(dp, &dst->ports, list) in dsa_tree_teardown_switches()
979 static int dsa_tree_setup_switches(struct dsa_switch_tree *dst) in dsa_tree_setup_switches() argument
984 list_for_each_entry(dp, &dst->ports, list) { in dsa_tree_setup_switches()
990 list_for_each_entry(dp, &dst->ports, list) { in dsa_tree_setup_switches()
1002 dsa_tree_teardown_ports(dst); in dsa_tree_setup_switches()
1004 dsa_tree_teardown_switches(dst); in dsa_tree_setup_switches()
1009 static int dsa_tree_setup_master(struct dsa_switch_tree *dst) in dsa_tree_setup_master() argument
1014 list_for_each_entry(dp, &dst->ports, list) { in dsa_tree_setup_master()
1025 static void dsa_tree_teardown_master(struct dsa_switch_tree *dst) in dsa_tree_teardown_master() argument
1029 list_for_each_entry(dp, &dst->ports, list) in dsa_tree_teardown_master()
1034 static int dsa_tree_setup_lags(struct dsa_switch_tree *dst) in dsa_tree_setup_lags() argument
1039 list_for_each_entry(dp, &dst->ports, list) { in dsa_tree_setup_lags()
1047 dst->lags = kcalloc(len, sizeof(*dst->lags), GFP_KERNEL); in dsa_tree_setup_lags()
1048 if (!dst->lags) in dsa_tree_setup_lags()
1051 dst->lags_len = len; in dsa_tree_setup_lags()
1055 static void dsa_tree_teardown_lags(struct dsa_switch_tree *dst) in dsa_tree_teardown_lags() argument
1057 kfree(dst->lags); in dsa_tree_teardown_lags()
1060 static int dsa_tree_setup(struct dsa_switch_tree *dst) in dsa_tree_setup() argument
1065 if (dst->setup) { in dsa_tree_setup()
1067 dst->index); in dsa_tree_setup()
1071 complete = dsa_tree_setup_routing_table(dst); in dsa_tree_setup()
1075 err = dsa_tree_setup_cpu_ports(dst); in dsa_tree_setup()
1079 err = dsa_tree_setup_switches(dst); in dsa_tree_setup()
1083 err = dsa_tree_setup_master(dst); in dsa_tree_setup()
1087 err = dsa_tree_setup_lags(dst); in dsa_tree_setup()
1091 dst->setup = true; in dsa_tree_setup()
1093 pr_info("DSA: tree %d setup\n", dst->index); in dsa_tree_setup()
1098 dsa_tree_teardown_master(dst); in dsa_tree_setup()
1100 dsa_tree_teardown_ports(dst); in dsa_tree_setup()
1101 dsa_tree_teardown_switches(dst); in dsa_tree_setup()
1103 dsa_tree_teardown_cpu_ports(dst); in dsa_tree_setup()
1108 static void dsa_tree_teardown(struct dsa_switch_tree *dst) in dsa_tree_teardown() argument
1112 if (!dst->setup) in dsa_tree_teardown()
1115 dsa_tree_teardown_lags(dst); in dsa_tree_teardown()
1117 dsa_tree_teardown_master(dst); in dsa_tree_teardown()
1119 dsa_tree_teardown_ports(dst); in dsa_tree_teardown()
1121 dsa_tree_teardown_switches(dst); in dsa_tree_teardown()
1123 dsa_tree_teardown_cpu_ports(dst); in dsa_tree_teardown()
1125 list_for_each_entry_safe(dl, next, &dst->rtable, list) { in dsa_tree_teardown()
1130 pr_info("DSA: tree %d torn down\n", dst->index); in dsa_tree_teardown()
1132 dst->setup = false; in dsa_tree_teardown()
1139 int dsa_tree_change_tag_proto(struct dsa_switch_tree *dst, in dsa_tree_change_tag_proto() argument
1159 list_for_each_entry(dp, &dst->ports, list) { in dsa_tree_change_tag_proto()
1168 err = dsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO, &info); in dsa_tree_change_tag_proto()
1172 dst->tag_ops = tag_ops; in dsa_tree_change_tag_proto()
1180 dsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO, &info); in dsa_tree_change_tag_proto()
1188 struct dsa_switch_tree *dst = ds->dst; in dsa_port_touch() local
1191 list_for_each_entry(dp, &dst->ports, list) in dsa_port_touch()
1204 list_add_tail(&dp->list, &dst->ports); in dsa_port_touch()
1258 struct dsa_switch_tree *dst = ds->dst; in dsa_port_parse_cpu() local
1263 if (dst->default_proto) { in dsa_port_parse_cpu()
1264 if (dst->default_proto != default_proto) { in dsa_port_parse_cpu()
1270 dst->default_proto = default_proto; in dsa_port_parse_cpu()
1300 if (dst->tag_ops) { in dsa_port_parse_cpu()
1301 if (dst->tag_ops != tag_ops) { in dsa_port_parse_cpu()
1314 dst->tag_ops = tag_ops; in dsa_port_parse_cpu()
1319 dsa_port_set_tag_protocol(dp, dst->tag_ops); in dsa_port_parse_cpu()
1320 dp->dst = dst; in dsa_port_parse_cpu()
1425 ds->dst = dsa_tree_touch(m[0]); in dsa_switch_parse_member_of()
1426 if (!ds->dst) in dsa_switch_parse_member_of()
1429 if (dsa_switch_find(ds->dst->index, ds->index)) { in dsa_switch_parse_member_of()
1432 ds->index, ds->dst->index); in dsa_switch_parse_member_of()
1436 if (ds->dst->last_switch < ds->index) in dsa_switch_parse_member_of()
1437 ds->dst->last_switch = ds->index; in dsa_switch_parse_member_of()
1533 ds->dst = dsa_tree_touch(0); in dsa_switch_parse()
1534 if (!ds->dst) in dsa_switch_parse()
1546 struct dsa_switch_tree *dst = ds->dst; in dsa_switch_release_ports() local
1549 list_for_each_entry_safe(dp, next, &dst->ports, list) { in dsa_switch_release_ports()
1559 struct dsa_switch_tree *dst; in dsa_switch_probe() local
1588 dst = ds->dst; in dsa_switch_probe()
1589 dsa_tree_get(dst); in dsa_switch_probe()
1590 err = dsa_tree_setup(dst); in dsa_switch_probe()
1593 dsa_tree_put(dst); in dsa_switch_probe()
1605 dsa_tree_put(ds->dst); in dsa_register_switch()
1614 struct dsa_switch_tree *dst = ds->dst; in dsa_switch_remove() local
1616 dsa_tree_teardown(dst); in dsa_switch_remove()
1618 dsa_tree_put(dst); in dsa_switch_remove()
1647 list_for_each_entry(dp, &ds->dst->ports, list) { in dsa_switch_shutdown()