Lines Matching full:dp
20 struct dsa_port *dp; in dsa_switch_fastest_ageing_time() local
22 dsa_switch_for_each_port(dp, ds) in dsa_switch_fastest_ageing_time()
23 if (dp->ageing_time && dp->ageing_time < ageing_time) in dsa_switch_fastest_ageing_time()
24 ageing_time = dp->ageing_time; in dsa_switch_fastest_ageing_time()
49 static bool dsa_port_mtu_match(struct dsa_port *dp, in dsa_port_mtu_match() argument
52 return dp == info->dp || dsa_port_is_dsa(dp) || dsa_port_is_cpu(dp); in dsa_port_mtu_match()
58 struct dsa_port *dp; in dsa_switch_mtu() local
64 dsa_switch_for_each_port(dp, ds) { in dsa_switch_mtu()
65 if (dsa_port_mtu_match(dp, info)) { in dsa_switch_mtu()
66 ret = ds->ops->port_change_mtu(ds, dp->index, in dsa_switch_mtu()
81 if (info->dp->ds == ds) { in dsa_switch_bridge_join()
85 err = ds->ops->port_bridge_join(ds, info->dp->index, in dsa_switch_bridge_join()
93 if (info->dp->ds != ds && ds->ops->crosschip_bridge_join) { in dsa_switch_bridge_join()
95 info->dp->ds->dst->index, in dsa_switch_bridge_join()
96 info->dp->ds->index, in dsa_switch_bridge_join()
97 info->dp->index, in dsa_switch_bridge_join()
110 if (info->dp->ds == ds && ds->ops->port_bridge_leave) in dsa_switch_bridge_leave()
111 ds->ops->port_bridge_leave(ds, info->dp->index, info->bridge); in dsa_switch_bridge_leave()
113 if (info->dp->ds != ds && ds->ops->crosschip_bridge_leave) in dsa_switch_bridge_leave()
114 ds->ops->crosschip_bridge_leave(ds, info->dp->ds->dst->index, in dsa_switch_bridge_leave()
115 info->dp->ds->index, in dsa_switch_bridge_leave()
116 info->dp->index, in dsa_switch_bridge_leave()
126 static bool dsa_port_host_address_match(struct dsa_port *dp, in dsa_port_host_address_match() argument
131 if (dsa_switch_is_upstream_of(dp->ds, targeted_dp->ds)) in dsa_port_host_address_match()
132 return dp->index == dsa_towards_port(dp->ds, cpu_dp->ds->index, in dsa_port_host_address_match()
152 static int dsa_port_do_mdb_add(struct dsa_port *dp, in dsa_port_do_mdb_add() argument
156 struct dsa_switch *ds = dp->ds; in dsa_port_do_mdb_add()
158 int port = dp->index; in dsa_port_do_mdb_add()
162 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) in dsa_port_do_mdb_add()
165 mutex_lock(&dp->addr_lists_lock); in dsa_port_do_mdb_add()
167 a = dsa_mac_addr_find(&dp->mdbs, mdb->addr, mdb->vid, db); in dsa_port_do_mdb_add()
189 list_add_tail(&a->list, &dp->mdbs); in dsa_port_do_mdb_add()
192 mutex_unlock(&dp->addr_lists_lock); in dsa_port_do_mdb_add()
197 static int dsa_port_do_mdb_del(struct dsa_port *dp, in dsa_port_do_mdb_del() argument
201 struct dsa_switch *ds = dp->ds; in dsa_port_do_mdb_del()
203 int port = dp->index; in dsa_port_do_mdb_del()
207 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) in dsa_port_do_mdb_del()
210 mutex_lock(&dp->addr_lists_lock); in dsa_port_do_mdb_del()
212 a = dsa_mac_addr_find(&dp->mdbs, mdb->addr, mdb->vid, db); in dsa_port_do_mdb_del()
231 mutex_unlock(&dp->addr_lists_lock); in dsa_port_do_mdb_del()
236 static int dsa_port_do_fdb_add(struct dsa_port *dp, const unsigned char *addr, in dsa_port_do_fdb_add() argument
239 struct dsa_switch *ds = dp->ds; in dsa_port_do_fdb_add()
241 int port = dp->index; in dsa_port_do_fdb_add()
245 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) in dsa_port_do_fdb_add()
248 mutex_lock(&dp->addr_lists_lock); in dsa_port_do_fdb_add()
250 a = dsa_mac_addr_find(&dp->fdbs, addr, vid, db); in dsa_port_do_fdb_add()
272 list_add_tail(&a->list, &dp->fdbs); in dsa_port_do_fdb_add()
275 mutex_unlock(&dp->addr_lists_lock); in dsa_port_do_fdb_add()
280 static int dsa_port_do_fdb_del(struct dsa_port *dp, const unsigned char *addr, in dsa_port_do_fdb_del() argument
283 struct dsa_switch *ds = dp->ds; in dsa_port_do_fdb_del()
285 int port = dp->index; in dsa_port_do_fdb_del()
289 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) in dsa_port_do_fdb_del()
292 mutex_lock(&dp->addr_lists_lock); in dsa_port_do_fdb_del()
294 a = dsa_mac_addr_find(&dp->fdbs, addr, vid, db); in dsa_port_do_fdb_del()
313 mutex_unlock(&dp->addr_lists_lock); in dsa_port_do_fdb_del()
393 struct dsa_port *dp; in dsa_switch_host_fdb_add() local
399 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_fdb_add()
400 if (dsa_port_host_address_match(dp, info->dp)) { in dsa_switch_host_fdb_add()
401 if (dsa_port_is_cpu(dp) && info->dp->cpu_port_in_lag) { in dsa_switch_host_fdb_add()
402 err = dsa_switch_do_lag_fdb_add(ds, dp->lag, in dsa_switch_host_fdb_add()
407 err = dsa_port_do_fdb_add(dp, info->addr, in dsa_switch_host_fdb_add()
421 struct dsa_port *dp; in dsa_switch_host_fdb_del() local
427 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_fdb_del()
428 if (dsa_port_host_address_match(dp, info->dp)) { in dsa_switch_host_fdb_del()
429 if (dsa_port_is_cpu(dp) && info->dp->cpu_port_in_lag) { in dsa_switch_host_fdb_del()
430 err = dsa_switch_do_lag_fdb_del(ds, dp->lag, in dsa_switch_host_fdb_del()
435 err = dsa_port_do_fdb_del(dp, info->addr, in dsa_switch_host_fdb_del()
449 int port = dsa_towards_port(ds, info->dp->ds->index, info->dp->index); in dsa_switch_fdb_add()
450 struct dsa_port *dp = dsa_to_port(ds, port); in dsa_switch_fdb_add() local
455 return dsa_port_do_fdb_add(dp, info->addr, info->vid, info->db); in dsa_switch_fdb_add()
461 int port = dsa_towards_port(ds, info->dp->ds->index, info->dp->index); in dsa_switch_fdb_del()
462 struct dsa_port *dp = dsa_to_port(ds, port); in dsa_switch_fdb_del() local
467 return dsa_port_do_fdb_del(dp, info->addr, info->vid, info->db); in dsa_switch_fdb_del()
473 struct dsa_port *dp; in dsa_switch_lag_fdb_add() local
479 dsa_switch_for_each_port(dp, ds) in dsa_switch_lag_fdb_add()
480 if (dsa_port_offloads_lag(dp, info->lag)) in dsa_switch_lag_fdb_add()
491 struct dsa_port *dp; in dsa_switch_lag_fdb_del() local
497 dsa_switch_for_each_port(dp, ds) in dsa_switch_lag_fdb_del()
498 if (dsa_port_offloads_lag(dp, info->lag)) in dsa_switch_lag_fdb_del()
509 if (info->dp->ds == ds && ds->ops->port_lag_change) in dsa_switch_lag_change()
510 return ds->ops->port_lag_change(ds, info->dp->index); in dsa_switch_lag_change()
512 if (info->dp->ds != ds && ds->ops->crosschip_lag_change) in dsa_switch_lag_change()
513 return ds->ops->crosschip_lag_change(ds, info->dp->ds->index, in dsa_switch_lag_change()
514 info->dp->index); in dsa_switch_lag_change()
522 if (info->dp->ds == ds && ds->ops->port_lag_join) in dsa_switch_lag_join()
523 return ds->ops->port_lag_join(ds, info->dp->index, info->lag, in dsa_switch_lag_join()
526 if (info->dp->ds != ds && ds->ops->crosschip_lag_join) in dsa_switch_lag_join()
527 return ds->ops->crosschip_lag_join(ds, info->dp->ds->index, in dsa_switch_lag_join()
528 info->dp->index, info->lag, in dsa_switch_lag_join()
537 if (info->dp->ds == ds && ds->ops->port_lag_leave) in dsa_switch_lag_leave()
538 return ds->ops->port_lag_leave(ds, info->dp->index, info->lag); in dsa_switch_lag_leave()
540 if (info->dp->ds != ds && ds->ops->crosschip_lag_leave) in dsa_switch_lag_leave()
541 return ds->ops->crosschip_lag_leave(ds, info->dp->ds->index, in dsa_switch_lag_leave()
542 info->dp->index, info->lag); in dsa_switch_lag_leave()
550 int port = dsa_towards_port(ds, info->dp->ds->index, info->dp->index); in dsa_switch_mdb_add()
551 struct dsa_port *dp = dsa_to_port(ds, port); in dsa_switch_mdb_add() local
556 return dsa_port_do_mdb_add(dp, info->mdb, info->db); in dsa_switch_mdb_add()
562 int port = dsa_towards_port(ds, info->dp->ds->index, info->dp->index); in dsa_switch_mdb_del()
563 struct dsa_port *dp = dsa_to_port(ds, port); in dsa_switch_mdb_del() local
568 return dsa_port_do_mdb_del(dp, info->mdb, info->db); in dsa_switch_mdb_del()
574 struct dsa_port *dp; in dsa_switch_host_mdb_add() local
580 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_mdb_add()
581 if (dsa_port_host_address_match(dp, info->dp)) { in dsa_switch_host_mdb_add()
582 err = dsa_port_do_mdb_add(dp, info->mdb, info->db); in dsa_switch_host_mdb_add()
594 struct dsa_port *dp; in dsa_switch_host_mdb_del() local
600 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_mdb_del()
601 if (dsa_port_host_address_match(dp, info->dp)) { in dsa_switch_host_mdb_del()
602 err = dsa_port_do_mdb_del(dp, info->mdb, info->db); in dsa_switch_host_mdb_del()
612 static bool dsa_port_vlan_match(struct dsa_port *dp, in dsa_port_vlan_match() argument
615 return dsa_port_is_dsa(dp) || dp == info->dp; in dsa_port_vlan_match()
621 static bool dsa_port_host_vlan_match(struct dsa_port *dp, in dsa_port_host_vlan_match() argument
626 if (dsa_switch_is_upstream_of(dp->ds, targeted_dp->ds)) in dsa_port_host_vlan_match()
627 return dsa_port_is_dsa(dp) || dp == cpu_dp; in dsa_port_host_vlan_match()
644 static int dsa_port_do_vlan_add(struct dsa_port *dp, in dsa_port_do_vlan_add() argument
648 struct dsa_switch *ds = dp->ds; in dsa_port_do_vlan_add()
649 int port = dp->index; in dsa_port_do_vlan_add()
654 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) in dsa_port_do_vlan_add()
665 mutex_lock(&dp->vlans_lock); in dsa_port_do_vlan_add()
667 v = dsa_vlan_find(&dp->vlans, vlan); in dsa_port_do_vlan_add()
687 list_add_tail(&v->list, &dp->vlans); in dsa_port_do_vlan_add()
690 mutex_unlock(&dp->vlans_lock); in dsa_port_do_vlan_add()
695 static int dsa_port_do_vlan_del(struct dsa_port *dp, in dsa_port_do_vlan_del() argument
698 struct dsa_switch *ds = dp->ds; in dsa_port_do_vlan_del()
699 int port = dp->index; in dsa_port_do_vlan_del()
704 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) in dsa_port_do_vlan_del()
707 mutex_lock(&dp->vlans_lock); in dsa_port_do_vlan_del()
709 v = dsa_vlan_find(&dp->vlans, vlan); in dsa_port_do_vlan_del()
728 mutex_unlock(&dp->vlans_lock); in dsa_port_do_vlan_del()
736 struct dsa_port *dp; in dsa_switch_vlan_add() local
742 dsa_switch_for_each_port(dp, ds) { in dsa_switch_vlan_add()
743 if (dsa_port_vlan_match(dp, info)) { in dsa_switch_vlan_add()
744 err = dsa_port_do_vlan_add(dp, info->vlan, in dsa_switch_vlan_add()
757 struct dsa_port *dp; in dsa_switch_vlan_del() local
763 dsa_switch_for_each_port(dp, ds) { in dsa_switch_vlan_del()
764 if (dsa_port_vlan_match(dp, info)) { in dsa_switch_vlan_del()
765 err = dsa_port_do_vlan_del(dp, info->vlan); in dsa_switch_vlan_del()
777 struct dsa_port *dp; in dsa_switch_host_vlan_add() local
783 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_vlan_add()
784 if (dsa_port_host_vlan_match(dp, info->dp)) { in dsa_switch_host_vlan_add()
785 err = dsa_port_do_vlan_add(dp, info->vlan, in dsa_switch_host_vlan_add()
798 struct dsa_port *dp; in dsa_switch_host_vlan_del() local
804 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_vlan_del()
805 if (dsa_port_host_vlan_match(dp, info->dp)) { in dsa_switch_host_vlan_del()
806 err = dsa_port_do_vlan_del(dp, info->vlan); in dsa_switch_host_vlan_del()
819 struct dsa_port *dp, *cpu_dp; in dsa_switch_change_tag_proto() local
838 dsa_switch_for_each_user_port(dp, ds) { in dsa_switch_change_tag_proto()
839 struct net_device *slave = dp->slave; in dsa_switch_change_tag_proto()