Lines Matching refs:dp

26 	struct dsa_port *dp;  in dsa_switch_fastest_ageing_time()  local
28 dsa_switch_for_each_port(dp, ds) in dsa_switch_fastest_ageing_time()
29 if (dp->ageing_time && dp->ageing_time < ageing_time) in dsa_switch_fastest_ageing_time()
30 ageing_time = dp->ageing_time; in dsa_switch_fastest_ageing_time()
55 static bool dsa_port_mtu_match(struct dsa_port *dp, in dsa_port_mtu_match() argument
58 return dp == info->dp || dsa_port_is_dsa(dp) || dsa_port_is_cpu(dp); in dsa_port_mtu_match()
64 struct dsa_port *dp; in dsa_switch_mtu() local
70 dsa_switch_for_each_port(dp, ds) { in dsa_switch_mtu()
71 if (dsa_port_mtu_match(dp, info)) { in dsa_switch_mtu()
72 ret = ds->ops->port_change_mtu(ds, dp->index, in dsa_switch_mtu()
87 if (info->dp->ds == ds) { in dsa_switch_bridge_join()
91 err = ds->ops->port_bridge_join(ds, info->dp->index, in dsa_switch_bridge_join()
99 if (info->dp->ds != ds && ds->ops->crosschip_bridge_join) { in dsa_switch_bridge_join()
101 info->dp->ds->dst->index, in dsa_switch_bridge_join()
102 info->dp->ds->index, in dsa_switch_bridge_join()
103 info->dp->index, in dsa_switch_bridge_join()
116 if (info->dp->ds == ds && ds->ops->port_bridge_leave) in dsa_switch_bridge_leave()
117 ds->ops->port_bridge_leave(ds, info->dp->index, info->bridge); in dsa_switch_bridge_leave()
119 if (info->dp->ds != ds && ds->ops->crosschip_bridge_leave) in dsa_switch_bridge_leave()
120 ds->ops->crosschip_bridge_leave(ds, info->dp->ds->dst->index, in dsa_switch_bridge_leave()
121 info->dp->ds->index, in dsa_switch_bridge_leave()
122 info->dp->index, in dsa_switch_bridge_leave()
132 static bool dsa_port_host_address_match(struct dsa_port *dp, in dsa_port_host_address_match() argument
137 if (dsa_switch_is_upstream_of(dp->ds, targeted_dp->ds)) in dsa_port_host_address_match()
138 return dp->index == dsa_towards_port(dp->ds, cpu_dp->ds->index, in dsa_port_host_address_match()
158 static int dsa_port_do_mdb_add(struct dsa_port *dp, in dsa_port_do_mdb_add() argument
162 struct dsa_switch *ds = dp->ds; in dsa_port_do_mdb_add()
164 int port = dp->index; in dsa_port_do_mdb_add()
168 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) { in dsa_port_do_mdb_add()
170 trace_dsa_mdb_add_hw(dp, mdb->addr, mdb->vid, &db, err); in dsa_port_do_mdb_add()
175 mutex_lock(&dp->addr_lists_lock); in dsa_port_do_mdb_add()
177 a = dsa_mac_addr_find(&dp->mdbs, mdb->addr, mdb->vid, db); in dsa_port_do_mdb_add()
180 trace_dsa_mdb_add_bump(dp, mdb->addr, mdb->vid, &db, in dsa_port_do_mdb_add()
192 trace_dsa_mdb_add_hw(dp, mdb->addr, mdb->vid, &db, err); in dsa_port_do_mdb_add()
202 list_add_tail(&a->list, &dp->mdbs); in dsa_port_do_mdb_add()
205 mutex_unlock(&dp->addr_lists_lock); in dsa_port_do_mdb_add()
210 static int dsa_port_do_mdb_del(struct dsa_port *dp, in dsa_port_do_mdb_del() argument
214 struct dsa_switch *ds = dp->ds; in dsa_port_do_mdb_del()
216 int port = dp->index; in dsa_port_do_mdb_del()
220 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) { in dsa_port_do_mdb_del()
222 trace_dsa_mdb_del_hw(dp, mdb->addr, mdb->vid, &db, err); in dsa_port_do_mdb_del()
227 mutex_lock(&dp->addr_lists_lock); in dsa_port_do_mdb_del()
229 a = dsa_mac_addr_find(&dp->mdbs, mdb->addr, mdb->vid, db); in dsa_port_do_mdb_del()
231 trace_dsa_mdb_del_not_found(dp, mdb->addr, mdb->vid, &db); in dsa_port_do_mdb_del()
237 trace_dsa_mdb_del_drop(dp, mdb->addr, mdb->vid, &db, in dsa_port_do_mdb_del()
243 trace_dsa_mdb_del_hw(dp, mdb->addr, mdb->vid, &db, err); in dsa_port_do_mdb_del()
253 mutex_unlock(&dp->addr_lists_lock); in dsa_port_do_mdb_del()
258 static int dsa_port_do_fdb_add(struct dsa_port *dp, const unsigned char *addr, in dsa_port_do_fdb_add() argument
261 struct dsa_switch *ds = dp->ds; in dsa_port_do_fdb_add()
263 int port = dp->index; in dsa_port_do_fdb_add()
267 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) { in dsa_port_do_fdb_add()
269 trace_dsa_fdb_add_hw(dp, addr, vid, &db, err); in dsa_port_do_fdb_add()
274 mutex_lock(&dp->addr_lists_lock); in dsa_port_do_fdb_add()
276 a = dsa_mac_addr_find(&dp->fdbs, addr, vid, db); in dsa_port_do_fdb_add()
279 trace_dsa_fdb_add_bump(dp, addr, vid, &db, &a->refcount); in dsa_port_do_fdb_add()
290 trace_dsa_fdb_add_hw(dp, addr, vid, &db, err); in dsa_port_do_fdb_add()
300 list_add_tail(&a->list, &dp->fdbs); in dsa_port_do_fdb_add()
303 mutex_unlock(&dp->addr_lists_lock); in dsa_port_do_fdb_add()
308 static int dsa_port_do_fdb_del(struct dsa_port *dp, const unsigned char *addr, in dsa_port_do_fdb_del() argument
311 struct dsa_switch *ds = dp->ds; in dsa_port_do_fdb_del()
313 int port = dp->index; in dsa_port_do_fdb_del()
317 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) { in dsa_port_do_fdb_del()
319 trace_dsa_fdb_del_hw(dp, addr, vid, &db, err); in dsa_port_do_fdb_del()
324 mutex_lock(&dp->addr_lists_lock); in dsa_port_do_fdb_del()
326 a = dsa_mac_addr_find(&dp->fdbs, addr, vid, db); in dsa_port_do_fdb_del()
328 trace_dsa_fdb_del_not_found(dp, addr, vid, &db); in dsa_port_do_fdb_del()
334 trace_dsa_fdb_del_drop(dp, addr, vid, &db, &a->refcount); in dsa_port_do_fdb_del()
339 trace_dsa_fdb_del_hw(dp, addr, vid, &db, err); in dsa_port_do_fdb_del()
349 mutex_unlock(&dp->addr_lists_lock); in dsa_port_do_fdb_del()
437 struct dsa_port *dp; in dsa_switch_host_fdb_add() local
443 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_fdb_add()
444 if (dsa_port_host_address_match(dp, info->dp)) { in dsa_switch_host_fdb_add()
445 if (dsa_port_is_cpu(dp) && info->dp->cpu_port_in_lag) { in dsa_switch_host_fdb_add()
446 err = dsa_switch_do_lag_fdb_add(ds, dp->lag, in dsa_switch_host_fdb_add()
451 err = dsa_port_do_fdb_add(dp, info->addr, in dsa_switch_host_fdb_add()
465 struct dsa_port *dp; in dsa_switch_host_fdb_del() local
471 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_fdb_del()
472 if (dsa_port_host_address_match(dp, info->dp)) { in dsa_switch_host_fdb_del()
473 if (dsa_port_is_cpu(dp) && info->dp->cpu_port_in_lag) { in dsa_switch_host_fdb_del()
474 err = dsa_switch_do_lag_fdb_del(ds, dp->lag, in dsa_switch_host_fdb_del()
479 err = dsa_port_do_fdb_del(dp, info->addr, in dsa_switch_host_fdb_del()
493 int port = dsa_towards_port(ds, info->dp->ds->index, info->dp->index); in dsa_switch_fdb_add()
494 struct dsa_port *dp = dsa_to_port(ds, port); in dsa_switch_fdb_add() local
499 return dsa_port_do_fdb_add(dp, info->addr, info->vid, info->db); in dsa_switch_fdb_add()
505 int port = dsa_towards_port(ds, info->dp->ds->index, info->dp->index); in dsa_switch_fdb_del()
506 struct dsa_port *dp = dsa_to_port(ds, port); in dsa_switch_fdb_del() local
511 return dsa_port_do_fdb_del(dp, info->addr, info->vid, info->db); in dsa_switch_fdb_del()
517 struct dsa_port *dp; in dsa_switch_lag_fdb_add() local
523 dsa_switch_for_each_port(dp, ds) in dsa_switch_lag_fdb_add()
524 if (dsa_port_offloads_lag(dp, info->lag)) in dsa_switch_lag_fdb_add()
535 struct dsa_port *dp; in dsa_switch_lag_fdb_del() local
541 dsa_switch_for_each_port(dp, ds) in dsa_switch_lag_fdb_del()
542 if (dsa_port_offloads_lag(dp, info->lag)) in dsa_switch_lag_fdb_del()
553 if (info->dp->ds == ds && ds->ops->port_lag_change) in dsa_switch_lag_change()
554 return ds->ops->port_lag_change(ds, info->dp->index); in dsa_switch_lag_change()
556 if (info->dp->ds != ds && ds->ops->crosschip_lag_change) in dsa_switch_lag_change()
557 return ds->ops->crosschip_lag_change(ds, info->dp->ds->index, in dsa_switch_lag_change()
558 info->dp->index); in dsa_switch_lag_change()
566 if (info->dp->ds == ds && ds->ops->port_lag_join) in dsa_switch_lag_join()
567 return ds->ops->port_lag_join(ds, info->dp->index, info->lag, in dsa_switch_lag_join()
570 if (info->dp->ds != ds && ds->ops->crosschip_lag_join) in dsa_switch_lag_join()
571 return ds->ops->crosschip_lag_join(ds, info->dp->ds->index, in dsa_switch_lag_join()
572 info->dp->index, info->lag, in dsa_switch_lag_join()
581 if (info->dp->ds == ds && ds->ops->port_lag_leave) in dsa_switch_lag_leave()
582 return ds->ops->port_lag_leave(ds, info->dp->index, info->lag); in dsa_switch_lag_leave()
584 if (info->dp->ds != ds && ds->ops->crosschip_lag_leave) in dsa_switch_lag_leave()
585 return ds->ops->crosschip_lag_leave(ds, info->dp->ds->index, in dsa_switch_lag_leave()
586 info->dp->index, info->lag); in dsa_switch_lag_leave()
594 int port = dsa_towards_port(ds, info->dp->ds->index, info->dp->index); in dsa_switch_mdb_add()
595 struct dsa_port *dp = dsa_to_port(ds, port); in dsa_switch_mdb_add() local
600 return dsa_port_do_mdb_add(dp, info->mdb, info->db); in dsa_switch_mdb_add()
606 int port = dsa_towards_port(ds, info->dp->ds->index, info->dp->index); in dsa_switch_mdb_del()
607 struct dsa_port *dp = dsa_to_port(ds, port); in dsa_switch_mdb_del() local
612 return dsa_port_do_mdb_del(dp, info->mdb, info->db); in dsa_switch_mdb_del()
618 struct dsa_port *dp; in dsa_switch_host_mdb_add() local
624 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_mdb_add()
625 if (dsa_port_host_address_match(dp, info->dp)) { in dsa_switch_host_mdb_add()
626 err = dsa_port_do_mdb_add(dp, info->mdb, info->db); in dsa_switch_host_mdb_add()
638 struct dsa_port *dp; in dsa_switch_host_mdb_del() local
644 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_mdb_del()
645 if (dsa_port_host_address_match(dp, info->dp)) { in dsa_switch_host_mdb_del()
646 err = dsa_port_do_mdb_del(dp, info->mdb, info->db); in dsa_switch_host_mdb_del()
656 static bool dsa_port_vlan_match(struct dsa_port *dp, in dsa_port_vlan_match() argument
659 return dsa_port_is_dsa(dp) || dp == info->dp; in dsa_port_vlan_match()
665 static bool dsa_port_host_vlan_match(struct dsa_port *dp, in dsa_port_host_vlan_match() argument
670 if (dsa_switch_is_upstream_of(dp->ds, targeted_dp->ds)) in dsa_port_host_vlan_match()
671 return dsa_port_is_dsa(dp) || dp == cpu_dp; in dsa_port_host_vlan_match()
688 static int dsa_port_do_vlan_add(struct dsa_port *dp, in dsa_port_do_vlan_add() argument
692 struct dsa_switch *ds = dp->ds; in dsa_port_do_vlan_add()
693 int port = dp->index; in dsa_port_do_vlan_add()
698 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) { in dsa_port_do_vlan_add()
700 trace_dsa_vlan_add_hw(dp, vlan, err); in dsa_port_do_vlan_add()
713 mutex_lock(&dp->vlans_lock); in dsa_port_do_vlan_add()
715 v = dsa_vlan_find(&dp->vlans, vlan); in dsa_port_do_vlan_add()
718 trace_dsa_vlan_add_bump(dp, vlan, &v->refcount); in dsa_port_do_vlan_add()
729 trace_dsa_vlan_add_hw(dp, vlan, err); in dsa_port_do_vlan_add()
737 list_add_tail(&v->list, &dp->vlans); in dsa_port_do_vlan_add()
740 mutex_unlock(&dp->vlans_lock); in dsa_port_do_vlan_add()
745 static int dsa_port_do_vlan_del(struct dsa_port *dp, in dsa_port_do_vlan_del() argument
748 struct dsa_switch *ds = dp->ds; in dsa_port_do_vlan_del()
749 int port = dp->index; in dsa_port_do_vlan_del()
754 if (!(dsa_port_is_cpu(dp) || dsa_port_is_dsa(dp))) { in dsa_port_do_vlan_del()
756 trace_dsa_vlan_del_hw(dp, vlan, err); in dsa_port_do_vlan_del()
761 mutex_lock(&dp->vlans_lock); in dsa_port_do_vlan_del()
763 v = dsa_vlan_find(&dp->vlans, vlan); in dsa_port_do_vlan_del()
765 trace_dsa_vlan_del_not_found(dp, vlan); in dsa_port_do_vlan_del()
771 trace_dsa_vlan_del_drop(dp, vlan, &v->refcount); in dsa_port_do_vlan_del()
776 trace_dsa_vlan_del_hw(dp, vlan, err); in dsa_port_do_vlan_del()
786 mutex_unlock(&dp->vlans_lock); in dsa_port_do_vlan_del()
794 struct dsa_port *dp; in dsa_switch_vlan_add() local
800 dsa_switch_for_each_port(dp, ds) { in dsa_switch_vlan_add()
801 if (dsa_port_vlan_match(dp, info)) { in dsa_switch_vlan_add()
802 err = dsa_port_do_vlan_add(dp, info->vlan, in dsa_switch_vlan_add()
815 struct dsa_port *dp; in dsa_switch_vlan_del() local
821 dsa_switch_for_each_port(dp, ds) { in dsa_switch_vlan_del()
822 if (dsa_port_vlan_match(dp, info)) { in dsa_switch_vlan_del()
823 err = dsa_port_do_vlan_del(dp, info->vlan); in dsa_switch_vlan_del()
835 struct dsa_port *dp; in dsa_switch_host_vlan_add() local
841 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_vlan_add()
842 if (dsa_port_host_vlan_match(dp, info->dp)) { in dsa_switch_host_vlan_add()
843 err = dsa_port_do_vlan_add(dp, info->vlan, in dsa_switch_host_vlan_add()
856 struct dsa_port *dp; in dsa_switch_host_vlan_del() local
862 dsa_switch_for_each_port(dp, ds) { in dsa_switch_host_vlan_del()
863 if (dsa_port_host_vlan_match(dp, info->dp)) { in dsa_switch_host_vlan_del()
864 err = dsa_port_do_vlan_del(dp, info->vlan); in dsa_switch_host_vlan_del()
877 struct dsa_port *dp, *cpu_dp; in dsa_switch_change_tag_proto() local
896 dsa_switch_for_each_user_port(dp, ds) { in dsa_switch_change_tag_proto()
897 struct net_device *slave = dp->slave; in dsa_switch_change_tag_proto()