• Home
  • Raw
  • Download

Lines Matching refs:dst

28 	struct dsa_switch_tree *dst;  in dsa_get_dst()  local
30 list_for_each_entry(dst, &dsa_switch_trees, list) in dsa_get_dst()
31 if (dst->tree == tree) { in dsa_get_dst()
32 kref_get(&dst->refcount); in dsa_get_dst()
33 return dst; in dsa_get_dst()
40 struct dsa_switch_tree *dst = container_of(ref, struct dsa_switch_tree, in dsa_free_dst() local
43 list_del(&dst->list); in dsa_free_dst()
44 kfree(dst); in dsa_free_dst()
47 static void dsa_put_dst(struct dsa_switch_tree *dst) in dsa_put_dst() argument
49 kref_put(&dst->refcount, dsa_free_dst); in dsa_put_dst()
54 struct dsa_switch_tree *dst; in dsa_add_dst() local
56 dst = kzalloc(sizeof(*dst), GFP_KERNEL); in dsa_add_dst()
57 if (!dst) in dsa_add_dst()
59 dst->tree = tree; in dsa_add_dst()
60 dst->cpu_switch = -1; in dsa_add_dst()
61 INIT_LIST_HEAD(&dst->list); in dsa_add_dst()
62 list_add_tail(&dsa_switch_trees, &dst->list); in dsa_add_dst()
63 kref_init(&dst->refcount); in dsa_add_dst()
65 return dst; in dsa_add_dst()
68 static void dsa_dst_add_ds(struct dsa_switch_tree *dst, in dsa_dst_add_ds() argument
71 kref_get(&dst->refcount); in dsa_dst_add_ds()
72 dst->ds[index] = ds; in dsa_dst_add_ds()
75 static void dsa_dst_del_ds(struct dsa_switch_tree *dst, in dsa_dst_del_ds() argument
78 dst->ds[index] = NULL; in dsa_dst_del_ds()
79 kref_put(&dst->refcount, dsa_free_dst); in dsa_dst_del_ds()
121 static struct dsa_switch *dsa_dst_find_port(struct dsa_switch_tree *dst, in dsa_dst_find_port() argument
128 ds = dst->ds[index]; in dsa_dst_find_port()
139 static int dsa_port_complete(struct dsa_switch_tree *dst, in dsa_port_complete() argument
153 dst_ds = dsa_dst_find_port(dst, link); in dsa_port_complete()
170 static int dsa_ds_complete(struct dsa_switch_tree *dst, struct dsa_switch *ds) in dsa_ds_complete() argument
184 err = dsa_port_complete(dst, ds, port, index); in dsa_ds_complete()
199 static int dsa_dst_complete(struct dsa_switch_tree *dst) in dsa_dst_complete() argument
206 ds = dst->ds[index]; in dsa_dst_complete()
210 err = dsa_ds_complete(dst, ds); in dsa_dst_complete()
293 static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds) in dsa_ds_apply() argument
311 err = ds->ops->set_addr(ds, dst->master_netdev->dev_addr); in dsa_ds_apply()
355 static void dsa_ds_unapply(struct dsa_switch_tree *dst, struct dsa_switch *ds) in dsa_ds_unapply() argument
382 static int dsa_dst_apply(struct dsa_switch_tree *dst) in dsa_dst_apply() argument
389 ds = dst->ds[index]; in dsa_dst_apply()
393 err = dsa_ds_apply(dst, ds); in dsa_dst_apply()
398 if (dst->ds[0]) { in dsa_dst_apply()
399 err = dsa_cpu_port_ethtool_setup(dst->ds[0]); in dsa_dst_apply()
409 dst->master_netdev->dsa_ptr = (void *)dst; in dsa_dst_apply()
410 dst->applied = true; in dsa_dst_apply()
415 static void dsa_dst_unapply(struct dsa_switch_tree *dst) in dsa_dst_unapply() argument
420 if (!dst->applied) in dsa_dst_unapply()
423 dst->master_netdev->dsa_ptr = NULL; in dsa_dst_unapply()
432 ds = dst->ds[index]; in dsa_dst_unapply()
436 dsa_ds_unapply(dst, ds); in dsa_dst_unapply()
439 if (dst->ds[0]) in dsa_dst_unapply()
440 dsa_cpu_port_ethtool_restore(dst->ds[0]); in dsa_dst_unapply()
442 pr_info("DSA: tree %d unapplied\n", dst->tree); in dsa_dst_unapply()
443 dst->applied = false; in dsa_dst_unapply()
447 struct dsa_switch_tree *dst, in dsa_cpu_parse() argument
465 if (!dst->master_netdev) in dsa_cpu_parse()
466 dst->master_netdev = ethernet_dev; in dsa_cpu_parse()
468 if (dst->cpu_switch == -1) { in dsa_cpu_parse()
469 dst->cpu_switch = ds->index; in dsa_cpu_parse()
470 dst->cpu_port = index; in dsa_cpu_parse()
474 dst->tag_ops = dsa_resolve_tag_protocol(tag_protocol); in dsa_cpu_parse()
475 if (IS_ERR(dst->tag_ops)) { in dsa_cpu_parse()
477 return PTR_ERR(dst->tag_ops); in dsa_cpu_parse()
480 dst->rcv = dst->tag_ops->rcv; in dsa_cpu_parse()
485 static int dsa_ds_parse(struct dsa_switch_tree *dst, struct dsa_switch *ds) in dsa_ds_parse() argument
497 err = dsa_cpu_parse(port, index, dst, ds); in dsa_ds_parse()
503 pr_info("DSA: switch %d %d parsed\n", dst->tree, ds->index); in dsa_ds_parse()
508 static int dsa_dst_parse(struct dsa_switch_tree *dst) in dsa_dst_parse() argument
515 ds = dst->ds[index]; in dsa_dst_parse()
519 err = dsa_ds_parse(dst, ds); in dsa_dst_parse()
524 if (!dst->master_netdev) { in dsa_dst_parse()
529 pr_info("DSA: tree %d parsed\n", dst->tree); in dsa_dst_parse()
602 struct dsa_switch_tree *dst; in _dsa_register_switch() local
617 dst = dsa_get_dst(tree); in _dsa_register_switch()
618 if (!dst) { in _dsa_register_switch()
619 dst = dsa_add_dst(tree); in _dsa_register_switch()
620 if (!dst) in _dsa_register_switch()
624 if (dst->ds[index]) { in _dsa_register_switch()
629 ds->dst = dst; in _dsa_register_switch()
636 dsa_dst_add_ds(dst, ds, index); in _dsa_register_switch()
638 err = dsa_dst_complete(dst); in _dsa_register_switch()
648 if (dst->applied) { in _dsa_register_switch()
653 err = dsa_dst_parse(dst); in _dsa_register_switch()
657 err = dsa_dst_apply(dst); in _dsa_register_switch()
659 dsa_dst_unapply(dst); in _dsa_register_switch()
663 dsa_put_dst(dst); in _dsa_register_switch()
667 dsa_dst_del_ds(dst, ds, ds->index); in _dsa_register_switch()
669 dsa_put_dst(dst); in _dsa_register_switch()
688 struct dsa_switch_tree *dst = ds->dst; in _dsa_unregister_switch() local
690 dsa_dst_unapply(dst); in _dsa_unregister_switch()
692 dsa_dst_del_ds(dst, ds, ds->index); in _dsa_unregister_switch()