Lines Matching refs:port_priv
28 static u16 dpaa2_switch_port_get_fdb_id(struct ethsw_port_priv *port_priv) in dpaa2_switch_port_get_fdb_id() argument
30 return port_priv->fdb->fdb_id; in dpaa2_switch_port_get_fdb_id()
54 static u16 dpaa2_switch_port_set_fdb(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_set_fdb() argument
66 fdb = dpaa2_switch_fdb_get_unused(port_priv->ethsw_data); in dpaa2_switch_port_set_fdb()
74 port_priv->fdb->bridge_dev = NULL; in dpaa2_switch_port_set_fdb()
78 port_priv->fdb = fdb; in dpaa2_switch_port_set_fdb()
79 port_priv->fdb->in_use = true; in dpaa2_switch_port_set_fdb()
80 port_priv->fdb->bridge_dev = NULL; in dpaa2_switch_port_set_fdb()
97 if (other_dev == port_priv->netdev) in dpaa2_switch_port_set_fdb()
111 port_priv->fdb->in_use = false; in dpaa2_switch_port_set_fdb()
112 port_priv->fdb->bridge_dev = NULL; in dpaa2_switch_port_set_fdb()
115 port_priv->fdb = other_port_priv->fdb; in dpaa2_switch_port_set_fdb()
119 port_priv->fdb->bridge_dev = bridge_dev; in dpaa2_switch_port_set_fdb()
191 static int dpaa2_switch_add_vlan(struct ethsw_port_priv *port_priv, u16 vid) in dpaa2_switch_add_vlan() argument
193 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_add_vlan()
197 vcfg.fdb_id = dpaa2_switch_port_get_fdb_id(port_priv); in dpaa2_switch_add_vlan()
209 static bool dpaa2_switch_port_is_up(struct ethsw_port_priv *port_priv) in dpaa2_switch_port_is_up() argument
211 struct net_device *netdev = port_priv->netdev; in dpaa2_switch_port_is_up()
215 err = dpsw_if_get_link_state(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_is_up()
216 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_is_up()
217 port_priv->idx, &state); in dpaa2_switch_port_is_up()
228 static int dpaa2_switch_port_set_pvid(struct ethsw_port_priv *port_priv, u16 pvid) in dpaa2_switch_port_set_pvid() argument
230 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_set_pvid()
231 struct net_device *netdev = port_priv->netdev; in dpaa2_switch_port_set_pvid()
237 port_priv->idx, &tci_cfg); in dpaa2_switch_port_set_pvid()
246 up = dpaa2_switch_port_is_up(port_priv); in dpaa2_switch_port_set_pvid()
250 port_priv->idx); in dpaa2_switch_port_set_pvid()
258 port_priv->idx, &tci_cfg); in dpaa2_switch_port_set_pvid()
265 port_priv->vlans[port_priv->pvid] &= ~ETHSW_VLAN_PVID; in dpaa2_switch_port_set_pvid()
266 port_priv->vlans[pvid] |= ETHSW_VLAN_PVID; in dpaa2_switch_port_set_pvid()
267 port_priv->pvid = pvid; in dpaa2_switch_port_set_pvid()
273 port_priv->idx); in dpaa2_switch_port_set_pvid()
283 static int dpaa2_switch_port_add_vlan(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_add_vlan() argument
286 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_add_vlan()
287 struct net_device *netdev = port_priv->netdev; in dpaa2_switch_port_add_vlan()
291 if (port_priv->vlans[vid]) { in dpaa2_switch_port_add_vlan()
300 vcfg.if_id[0] = port_priv->idx; in dpaa2_switch_port_add_vlan()
301 vcfg.fdb_id = dpaa2_switch_port_get_fdb_id(port_priv); in dpaa2_switch_port_add_vlan()
309 port_priv->vlans[vid] = ETHSW_VLAN_MEMBER; in dpaa2_switch_port_add_vlan()
320 port_priv->vlans[vid] |= ETHSW_VLAN_UNTAGGED; in dpaa2_switch_port_add_vlan()
324 err = dpaa2_switch_port_set_pvid(port_priv, vid); in dpaa2_switch_port_add_vlan()
350 static int dpaa2_switch_port_set_stp_state(struct ethsw_port_priv *port_priv, u8 state) in dpaa2_switch_port_set_stp_state() argument
356 if (!netif_running(port_priv->netdev) || state == port_priv->stp_state) in dpaa2_switch_port_set_stp_state()
361 if (port_priv->vlans[vid] & ETHSW_VLAN_MEMBER) { in dpaa2_switch_port_set_stp_state()
363 err = dpsw_if_set_stp(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_set_stp_state()
364 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_set_stp_state()
365 port_priv->idx, &stp_cfg); in dpaa2_switch_port_set_stp_state()
367 netdev_err(port_priv->netdev, in dpaa2_switch_port_set_stp_state()
374 port_priv->stp_state = state; in dpaa2_switch_port_set_stp_state()
403 static int dpaa2_switch_port_fdb_add_uc(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_fdb_add_uc() argument
410 entry.if_egress = port_priv->idx; in dpaa2_switch_port_fdb_add_uc()
414 fdb_id = dpaa2_switch_port_get_fdb_id(port_priv); in dpaa2_switch_port_fdb_add_uc()
415 err = dpsw_fdb_add_unicast(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_fdb_add_uc()
416 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_fdb_add_uc()
419 netdev_err(port_priv->netdev, in dpaa2_switch_port_fdb_add_uc()
424 static int dpaa2_switch_port_fdb_del_uc(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_fdb_del_uc() argument
431 entry.if_egress = port_priv->idx; in dpaa2_switch_port_fdb_del_uc()
435 fdb_id = dpaa2_switch_port_get_fdb_id(port_priv); in dpaa2_switch_port_fdb_del_uc()
436 err = dpsw_fdb_remove_unicast(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_fdb_del_uc()
437 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_fdb_del_uc()
441 netdev_err(port_priv->netdev, in dpaa2_switch_port_fdb_del_uc()
446 static int dpaa2_switch_port_fdb_add_mc(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_fdb_add_mc() argument
456 entry.if_id[0] = port_priv->idx; in dpaa2_switch_port_fdb_add_mc()
458 fdb_id = dpaa2_switch_port_get_fdb_id(port_priv); in dpaa2_switch_port_fdb_add_mc()
459 err = dpsw_fdb_add_multicast(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_fdb_add_mc()
460 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_fdb_add_mc()
464 netdev_err(port_priv->netdev, "dpsw_fdb_add_multicast err %d\n", in dpaa2_switch_port_fdb_add_mc()
469 static int dpaa2_switch_port_fdb_del_mc(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_fdb_del_mc() argument
479 entry.if_id[0] = port_priv->idx; in dpaa2_switch_port_fdb_del_mc()
481 fdb_id = dpaa2_switch_port_get_fdb_id(port_priv); in dpaa2_switch_port_fdb_del_mc()
482 err = dpsw_fdb_remove_multicast(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_fdb_del_mc()
483 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_fdb_del_mc()
487 netdev_err(port_priv->netdev, in dpaa2_switch_port_fdb_del_mc()
495 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_get_stats() local
499 err = dpsw_if_get_counter(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_get_stats()
500 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_get_stats()
501 port_priv->idx, in dpaa2_switch_port_get_stats()
506 err = dpsw_if_get_counter(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_get_stats()
507 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_get_stats()
508 port_priv->idx, in dpaa2_switch_port_get_stats()
513 err = dpsw_if_get_counter(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_get_stats()
514 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_get_stats()
515 port_priv->idx, in dpaa2_switch_port_get_stats()
520 err = dpsw_if_get_counter(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_get_stats()
521 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_get_stats()
522 port_priv->idx, in dpaa2_switch_port_get_stats()
527 err = dpsw_if_get_counter(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_get_stats()
528 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_get_stats()
529 port_priv->idx, in dpaa2_switch_port_get_stats()
535 err = dpsw_if_get_counter(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_get_stats()
536 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_get_stats()
537 port_priv->idx, in dpaa2_switch_port_get_stats()
544 err = dpsw_if_get_counter(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_get_stats()
545 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_get_stats()
546 port_priv->idx, in dpaa2_switch_port_get_stats()
579 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_change_mtu() local
582 err = dpsw_if_set_max_frame_length(port_priv->ethsw_data->mc_io, in dpaa2_switch_port_change_mtu()
584 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_change_mtu()
585 port_priv->idx, in dpaa2_switch_port_change_mtu()
599 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_link_state_update() local
609 if (dpaa2_mac_is_type_phy(port_priv->mac)) in dpaa2_switch_port_link_state_update()
618 err = dpsw_if_get_link_state(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_link_state_update()
619 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_link_state_update()
620 port_priv->idx, &state); in dpaa2_switch_port_link_state_update()
628 if (state.up != port_priv->link_state) { in dpaa2_switch_port_link_state_update()
636 port_priv->link_state = state.up; in dpaa2_switch_port_link_state_update()
685 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_open() local
686 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_open()
689 mutex_lock(&port_priv->mac_lock); in dpaa2_switch_port_open()
691 if (!dpaa2_switch_port_is_type_phy(port_priv)) { in dpaa2_switch_port_open()
700 err = dpsw_if_enable(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_open()
701 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_open()
702 port_priv->idx); in dpaa2_switch_port_open()
704 mutex_unlock(&port_priv->mac_lock); in dpaa2_switch_port_open()
711 if (dpaa2_switch_port_is_type_phy(port_priv)) in dpaa2_switch_port_open()
712 dpaa2_mac_start(port_priv->mac); in dpaa2_switch_port_open()
714 mutex_unlock(&port_priv->mac_lock); in dpaa2_switch_port_open()
721 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_stop() local
722 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_stop()
725 mutex_lock(&port_priv->mac_lock); in dpaa2_switch_port_stop()
727 if (dpaa2_switch_port_is_type_phy(port_priv)) { in dpaa2_switch_port_stop()
728 dpaa2_mac_stop(port_priv->mac); in dpaa2_switch_port_stop()
734 mutex_unlock(&port_priv->mac_lock); in dpaa2_switch_port_stop()
736 err = dpsw_if_disable(port_priv->ethsw_data->mc_io, 0, in dpaa2_switch_port_stop()
737 port_priv->ethsw_data->dpsw_handle, in dpaa2_switch_port_stop()
738 port_priv->idx); in dpaa2_switch_port_stop()
752 struct ethsw_port_priv *port_priv = netdev_priv(dev); in dpaa2_switch_port_parent_id() local
755 ppid->id[0] = port_priv->ethsw_data->dev_id; in dpaa2_switch_port_parent_id()
763 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_get_phys_name() local
766 err = snprintf(name, len, "p%d", port_priv->idx); in dpaa2_switch_port_get_phys_name()
821 struct ethsw_port_priv *port_priv) in dpaa2_switch_port_fdb_valid_entry() argument
823 int idx = port_priv->idx; in dpaa2_switch_port_fdb_valid_entry()
827 valid = entry->if_info == port_priv->idx; in dpaa2_switch_port_fdb_valid_entry()
834 static int dpaa2_switch_fdb_iterate(struct ethsw_port_priv *port_priv, in dpaa2_switch_fdb_iterate() argument
837 struct net_device *net_dev = port_priv->netdev; in dpaa2_switch_fdb_iterate()
838 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_fdb_iterate()
862 fdb_id = dpaa2_switch_port_get_fdb_id(port_priv); in dpaa2_switch_fdb_iterate()
876 err = cb(port_priv, &fdb_entry, data); in dpaa2_switch_fdb_iterate()
893 static int dpaa2_switch_fdb_entry_dump(struct ethsw_port_priv *port_priv, in dpaa2_switch_fdb_entry_dump() argument
897 if (!dpaa2_switch_port_fdb_valid_entry(fdb_entry, port_priv)) in dpaa2_switch_fdb_entry_dump()
907 struct ethsw_port_priv *port_priv = netdev_priv(net_dev); in dpaa2_switch_port_fdb_dump() local
916 err = dpaa2_switch_fdb_iterate(port_priv, dpaa2_switch_fdb_entry_dump, &dump); in dpaa2_switch_port_fdb_dump()
922 static int dpaa2_switch_fdb_entry_fast_age(struct ethsw_port_priv *port_priv, in dpaa2_switch_fdb_entry_fast_age() argument
926 if (!dpaa2_switch_port_fdb_valid_entry(fdb_entry, port_priv)) in dpaa2_switch_fdb_entry_fast_age()
933 dpaa2_switch_port_fdb_del_uc(port_priv, fdb_entry->mac_addr); in dpaa2_switch_fdb_entry_fast_age()
935 dpaa2_switch_port_fdb_del_mc(port_priv, fdb_entry->mac_addr); in dpaa2_switch_fdb_entry_fast_age()
940 static void dpaa2_switch_port_fast_age(struct ethsw_port_priv *port_priv) in dpaa2_switch_port_fast_age() argument
942 dpaa2_switch_fdb_iterate(port_priv, in dpaa2_switch_port_fast_age()
974 static int dpaa2_switch_port_set_mac_addr(struct ethsw_port_priv *port_priv) in dpaa2_switch_port_set_mac_addr() argument
976 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_set_mac_addr()
977 struct net_device *net_dev = port_priv->netdev; in dpaa2_switch_port_set_mac_addr()
987 port_priv->idx, mac_addr); in dpaa2_switch_port_set_mac_addr()
1084 struct ethsw_port_priv *port_priv = netdev_priv(net_dev); in dpaa2_switch_port_tx() local
1085 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_tx()
1127 port_priv->tx_qdid, in dpaa2_switch_port_tx()
1190 dpaa2_switch_port_acl_tbl_bind(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_acl_tbl_bind() argument
1193 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_acl_tbl_bind()
1194 struct net_device *netdev = port_priv->netdev; in dpaa2_switch_port_acl_tbl_bind()
1198 if (port_priv->filter_block) in dpaa2_switch_port_acl_tbl_bind()
1201 acl_if_cfg.if_id[0] = port_priv->idx; in dpaa2_switch_port_acl_tbl_bind()
1210 block->ports |= BIT(port_priv->idx); in dpaa2_switch_port_acl_tbl_bind()
1211 port_priv->filter_block = block; in dpaa2_switch_port_acl_tbl_bind()
1217 dpaa2_switch_port_acl_tbl_unbind(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_acl_tbl_unbind() argument
1220 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_acl_tbl_unbind()
1221 struct net_device *netdev = port_priv->netdev; in dpaa2_switch_port_acl_tbl_unbind()
1225 if (port_priv->filter_block != block) in dpaa2_switch_port_acl_tbl_unbind()
1228 acl_if_cfg.if_id[0] = port_priv->idx; in dpaa2_switch_port_acl_tbl_unbind()
1237 block->ports &= ~BIT(port_priv->idx); in dpaa2_switch_port_acl_tbl_unbind()
1238 port_priv->filter_block = NULL; in dpaa2_switch_port_acl_tbl_unbind()
1242 static int dpaa2_switch_port_block_bind(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_block_bind() argument
1245 struct dpaa2_switch_filter_block *old_block = port_priv->filter_block; in dpaa2_switch_port_block_bind()
1251 err = dpaa2_switch_block_offload_mirror(block, port_priv); in dpaa2_switch_port_block_bind()
1258 if (port_priv->filter_block == block) in dpaa2_switch_port_block_bind()
1261 err = dpaa2_switch_port_acl_tbl_unbind(port_priv, old_block); in dpaa2_switch_port_block_bind()
1271 return dpaa2_switch_port_acl_tbl_bind(port_priv, block); in dpaa2_switch_port_block_bind()
1275 dpaa2_switch_port_block_unbind(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_block_unbind() argument
1278 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_block_unbind()
1285 err = dpaa2_switch_block_unoffload_mirror(block, port_priv); in dpaa2_switch_port_block_unbind()
1292 if (block->ports == BIT(port_priv->idx)) in dpaa2_switch_port_block_unbind()
1295 err = dpaa2_switch_port_acl_tbl_unbind(port_priv, block); in dpaa2_switch_port_block_unbind()
1304 return dpaa2_switch_port_acl_tbl_bind(port_priv, new_block); in dpaa2_switch_port_block_unbind()
1310 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_setup_tc_block_bind() local
1311 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_setup_tc_block_bind()
1326 filter_block = port_priv->filter_block; in dpaa2_switch_setup_tc_block_bind()
1339 err = dpaa2_switch_port_block_bind(port_priv, filter_block); in dpaa2_switch_setup_tc_block_bind()
1360 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_setup_tc_block_unbind() local
1361 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_setup_tc_block_unbind()
1373 err = dpaa2_switch_port_block_unbind(port_priv, filter_block); in dpaa2_switch_setup_tc_block_unbind()
1438 static int dpaa2_switch_port_connect_mac(struct ethsw_port_priv *port_priv) in dpaa2_switch_port_connect_mac() argument
1444 dpsw_port_dev = to_fsl_mc_device(port_priv->netdev->dev.parent); in dpaa2_switch_port_connect_mac()
1445 dpmac_dev = fsl_mc_get_endpoint(dpsw_port_dev, port_priv->idx); in dpaa2_switch_port_connect_mac()
1458 mac->mc_io = port_priv->ethsw_data->mc_io; in dpaa2_switch_port_connect_mac()
1459 mac->net_dev = port_priv->netdev; in dpaa2_switch_port_connect_mac()
1468 netdev_err(port_priv->netdev, in dpaa2_switch_port_connect_mac()
1475 mutex_lock(&port_priv->mac_lock); in dpaa2_switch_port_connect_mac()
1476 port_priv->mac = mac; in dpaa2_switch_port_connect_mac()
1477 mutex_unlock(&port_priv->mac_lock); in dpaa2_switch_port_connect_mac()
1488 static void dpaa2_switch_port_disconnect_mac(struct ethsw_port_priv *port_priv) in dpaa2_switch_port_disconnect_mac() argument
1492 mutex_lock(&port_priv->mac_lock); in dpaa2_switch_port_disconnect_mac()
1493 mac = port_priv->mac; in dpaa2_switch_port_disconnect_mac()
1494 port_priv->mac = NULL; in dpaa2_switch_port_disconnect_mac()
1495 mutex_unlock(&port_priv->mac_lock); in dpaa2_switch_port_disconnect_mac()
1511 struct ethsw_port_priv *port_priv; in dpaa2_switch_irq0_handler_thread() local
1524 port_priv = ethsw->ports[if_id]; in dpaa2_switch_irq0_handler_thread()
1527 dpaa2_switch_port_link_state_update(port_priv->netdev); in dpaa2_switch_irq0_handler_thread()
1530 dpaa2_switch_port_set_mac_addr(port_priv); in dpaa2_switch_irq0_handler_thread()
1535 had_mac = !!port_priv->mac; in dpaa2_switch_irq0_handler_thread()
1537 dpaa2_switch_port_disconnect_mac(port_priv); in dpaa2_switch_irq0_handler_thread()
1539 dpaa2_switch_port_connect_mac(port_priv); in dpaa2_switch_irq0_handler_thread()
1625 static int dpaa2_switch_port_set_learning(struct ethsw_port_priv *port_priv, bool enable) in dpaa2_switch_port_set_learning() argument
1627 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_set_learning()
1637 port_priv->idx, learn_mode); in dpaa2_switch_port_set_learning()
1639 netdev_err(port_priv->netdev, "dpsw_if_set_learning_mode err %d\n", err); in dpaa2_switch_port_set_learning()
1642 dpaa2_switch_port_fast_age(port_priv); in dpaa2_switch_port_set_learning()
1650 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_attr_stp_state_set() local
1653 err = dpaa2_switch_port_set_stp_state(port_priv, state); in dpaa2_switch_port_attr_stp_state_set()
1661 err = dpaa2_switch_port_set_learning(port_priv, false); in dpaa2_switch_port_attr_stp_state_set()
1665 err = dpaa2_switch_port_set_learning(port_priv, in dpaa2_switch_port_attr_stp_state_set()
1666 port_priv->learn_ena); in dpaa2_switch_port_attr_stp_state_set()
1673 static int dpaa2_switch_port_flood(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_flood() argument
1676 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_flood()
1679 port_priv->bcast_flood = !!(flags.val & BR_BCAST_FLOOD); in dpaa2_switch_port_flood()
1682 port_priv->ucast_flood = !!(flags.val & BR_FLOOD); in dpaa2_switch_port_flood()
1684 return dpaa2_switch_fdb_set_egress_flood(ethsw, port_priv->fdb->fdb_id); in dpaa2_switch_port_flood()
1713 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_bridge_flags() local
1719 err = dpaa2_switch_port_set_learning(port_priv, learn_ena); in dpaa2_switch_port_bridge_flags()
1722 port_priv->learn_ena = learn_ena; in dpaa2_switch_port_bridge_flags()
1726 err = dpaa2_switch_port_flood(port_priv, flags); in dpaa2_switch_port_bridge_flags()
1769 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_vlans_add() local
1770 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_vlans_add()
1777 if (port_priv->vlans[vlan->vid] & ETHSW_VLAN_MEMBER) { in dpaa2_switch_port_vlans_add()
1802 if (!port_priv->ethsw_data->vlans[vlan->vid]) { in dpaa2_switch_port_vlans_add()
1804 err = dpaa2_switch_add_vlan(port_priv, vlan->vid); in dpaa2_switch_port_vlans_add()
1808 port_priv->ethsw_data->vlans[vlan->vid] |= ETHSW_VLAN_GLOBAL; in dpaa2_switch_port_vlans_add()
1811 return dpaa2_switch_port_add_vlan(port_priv, vlan->vid, vlan->flags); in dpaa2_switch_port_vlans_add()
1834 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_mdb_add() local
1841 err = dpaa2_switch_port_fdb_add_mc(port_priv, mdb->addr); in dpaa2_switch_port_mdb_add()
1848 dpaa2_switch_port_fdb_del_mc(port_priv, mdb->addr); in dpaa2_switch_port_mdb_add()
1876 static int dpaa2_switch_port_del_vlan(struct ethsw_port_priv *port_priv, u16 vid) in dpaa2_switch_port_del_vlan() argument
1878 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_del_vlan()
1879 struct net_device *netdev = port_priv->netdev; in dpaa2_switch_port_del_vlan()
1883 if (!port_priv->vlans[vid]) in dpaa2_switch_port_del_vlan()
1886 if (port_priv->vlans[vid] & ETHSW_VLAN_PVID) { in dpaa2_switch_port_del_vlan()
1891 err = dpaa2_switch_port_set_pvid(port_priv, 4095); in dpaa2_switch_port_del_vlan()
1897 vcfg.if_id[0] = port_priv->idx; in dpaa2_switch_port_del_vlan()
1898 if (port_priv->vlans[vid] & ETHSW_VLAN_UNTAGGED) { in dpaa2_switch_port_del_vlan()
1907 port_priv->vlans[vid] &= ~ETHSW_VLAN_UNTAGGED; in dpaa2_switch_port_del_vlan()
1910 if (port_priv->vlans[vid] & ETHSW_VLAN_MEMBER) { in dpaa2_switch_port_del_vlan()
1918 port_priv->vlans[vid] &= ~ETHSW_VLAN_MEMBER; in dpaa2_switch_port_del_vlan()
1942 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_vlans_del() local
1947 return dpaa2_switch_port_del_vlan(port_priv, vlan->vid); in dpaa2_switch_port_vlans_del()
1953 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_mdb_del() local
1959 err = dpaa2_switch_port_fdb_del_mc(port_priv, mdb->addr); in dpaa2_switch_port_mdb_del()
2006 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_bridge_join() local
2007 struct dpaa2_switch_fdb *old_fdb = port_priv->fdb; in dpaa2_switch_port_bridge_join()
2008 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_bridge_join()
2013 err = dpaa2_switch_port_del_vlan(port_priv, 1); in dpaa2_switch_port_bridge_join()
2017 dpaa2_switch_port_set_fdb(port_priv, upper_dev); in dpaa2_switch_port_bridge_join()
2021 err = dpaa2_switch_port_set_learning(port_priv, learn_ena); in dpaa2_switch_port_bridge_join()
2022 port_priv->learn_ena = learn_ena; in dpaa2_switch_port_bridge_join()
2025 err = dpaa2_switch_fdb_set_egress_flood(ethsw, port_priv->fdb->fdb_id); in dpaa2_switch_port_bridge_join()
2043 dpaa2_switch_port_set_fdb(port_priv, NULL); in dpaa2_switch_port_bridge_join()
2074 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_port_bridge_leave() local
2075 struct dpaa2_switch_fdb *old_fdb = port_priv->fdb; in dpaa2_switch_port_bridge_leave()
2076 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_bridge_leave()
2080 dpaa2_switch_port_fast_age(port_priv); in dpaa2_switch_port_bridge_leave()
2090 dpaa2_switch_port_set_fdb(port_priv, NULL); in dpaa2_switch_port_bridge_leave()
2101 port_priv->bcast_flood = true; in dpaa2_switch_port_bridge_leave()
2102 port_priv->ucast_flood = true; in dpaa2_switch_port_bridge_leave()
2108 err = dpaa2_switch_fdb_set_egress_flood(ethsw, port_priv->fdb->fdb_id); in dpaa2_switch_port_bridge_leave()
2118 err = dpaa2_switch_port_set_learning(port_priv, false); in dpaa2_switch_port_bridge_leave()
2121 port_priv->learn_ena = false; in dpaa2_switch_port_bridge_leave()
2126 return dpaa2_switch_port_add_vlan(port_priv, DEFAULT_VLAN_ID, in dpaa2_switch_port_bridge_leave()
2150 struct ethsw_port_priv *port_priv = netdev_priv(netdev); in dpaa2_switch_prechangeupper_sanity_checks() local
2173 if (other_port_priv->ethsw_data != port_priv->ethsw_data) { in dpaa2_switch_prechangeupper_sanity_checks()
2312 struct ethsw_port_priv *port_priv = netdev_priv(dev); in dpaa2_switch_port_event() local
2315 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_event()
2438 struct ethsw_port_priv *port_priv; in dpaa2_switch_rx() local
2452 port_priv = ethsw->ports[if_id]; in dpaa2_switch_rx()
2453 netdev = port_priv->netdev; in dpaa2_switch_rx()
2477 if (vid == port_priv->pvid) { in dpaa2_switch_rx()
2489 skb->offload_fwd_mark = !!(port_priv->fdb->bridge_dev); in dpaa2_switch_rx()
2985 struct ethsw_port_priv *port_priv = ethsw->ports[port_idx]; in dpaa2_switch_remove_port() local
2987 dpaa2_switch_port_disconnect_mac(port_priv); in dpaa2_switch_remove_port()
2988 free_netdev(port_priv->netdev); in dpaa2_switch_remove_port()
3129 static int dpaa2_switch_port_trap_mac_addr(struct ethsw_port_priv *port_priv, in dpaa2_switch_port_trap_mac_addr() argument
3142 return dpaa2_switch_acl_entry_add(port_priv->filter_block, &acl_entry); in dpaa2_switch_port_trap_mac_addr()
3145 static int dpaa2_switch_port_init(struct ethsw_port_priv *port_priv, u16 port) in dpaa2_switch_port_init() argument
3153 struct net_device *netdev = port_priv->netdev; in dpaa2_switch_port_init()
3154 struct ethsw_core *ethsw = port_priv->ethsw_data; in dpaa2_switch_port_init()
3165 port_priv->idx, &dpsw_if_attr); in dpaa2_switch_port_init()
3170 port_priv->tx_qdid = dpsw_if_attr.qdid; in dpaa2_switch_port_init()
3186 port_priv->fdb = fdb; in dpaa2_switch_port_init()
3197 err = dpaa2_switch_fdb_set_egress_flood(ethsw, port_priv->fdb->fdb_id); in dpaa2_switch_port_init()
3218 err = dpaa2_switch_port_acl_tbl_bind(port_priv, filter_block); in dpaa2_switch_port_init()
3222 err = dpaa2_switch_port_trap_mac_addr(port_priv, stpa); in dpaa2_switch_port_init()
3255 struct ethsw_port_priv *port_priv; in dpaa2_switch_remove() local
3268 port_priv = ethsw->ports[i]; in dpaa2_switch_remove()
3269 unregister_netdev(port_priv->netdev); in dpaa2_switch_remove()
3289 struct ethsw_port_priv *port_priv; in dpaa2_switch_probe_port() local
3300 port_priv = netdev_priv(port_netdev); in dpaa2_switch_probe_port()
3301 port_priv->netdev = port_netdev; in dpaa2_switch_probe_port()
3302 port_priv->ethsw_data = ethsw; in dpaa2_switch_probe_port()
3304 mutex_init(&port_priv->mac_lock); in dpaa2_switch_probe_port()
3306 port_priv->idx = port_idx; in dpaa2_switch_probe_port()
3307 port_priv->stp_state = BR_STATE_FORWARDING; in dpaa2_switch_probe_port()
3315 port_priv->bcast_flood = true; in dpaa2_switch_probe_port()
3316 port_priv->ucast_flood = true; in dpaa2_switch_probe_port()
3325 ethsw->ports[port_idx] = port_priv; in dpaa2_switch_probe_port()
3335 err = dpaa2_switch_port_init(port_priv, port_idx); in dpaa2_switch_probe_port()
3339 err = dpaa2_switch_port_set_mac_addr(port_priv); in dpaa2_switch_probe_port()
3343 err = dpaa2_switch_port_set_learning(port_priv, false); in dpaa2_switch_probe_port()
3346 port_priv->learn_ena = false; in dpaa2_switch_probe_port()
3348 err = dpaa2_switch_port_connect_mac(port_priv); in dpaa2_switch_probe_port()