Lines Matching refs:port_no

32 void vsc9953_port_info_set_mdio(int port_no, struct mii_dev *bus)  in vsc9953_port_info_set_mdio()  argument
34 if (!VSC9953_PORT_CHECK(port_no)) in vsc9953_port_info_set_mdio()
37 vsc9953_l2sw.port[port_no].bus = bus; in vsc9953_port_info_set_mdio()
40 void vsc9953_port_info_set_phy_address(int port_no, int address) in vsc9953_port_info_set_phy_address() argument
42 if (!VSC9953_PORT_CHECK(port_no)) in vsc9953_port_info_set_phy_address()
45 vsc9953_l2sw.port[port_no].phyaddr = address; in vsc9953_port_info_set_phy_address()
48 void vsc9953_port_info_set_phy_int(int port_no, phy_interface_t phy_int) in vsc9953_port_info_set_phy_int() argument
50 if (!VSC9953_PORT_CHECK(port_no)) in vsc9953_port_info_set_phy_int()
53 vsc9953_l2sw.port[port_no].enet_if = phy_int; in vsc9953_port_info_set_phy_int()
56 void vsc9953_port_enable(int port_no) in vsc9953_port_enable() argument
58 if (!VSC9953_PORT_CHECK(port_no)) in vsc9953_port_enable()
61 vsc9953_l2sw.port[port_no].enabled = 1; in vsc9953_port_enable()
64 void vsc9953_port_disable(int port_no) in vsc9953_port_disable() argument
66 if (!VSC9953_PORT_CHECK(port_no)) in vsc9953_port_disable()
69 vsc9953_l2sw.port[port_no].enabled = 0; in vsc9953_port_disable()
155 static int vsc9953_port_init(int port_no) in vsc9953_port_init() argument
160 if (VSC9953_INTERNAL_PORT_CHECK(port_no)) in vsc9953_port_init()
168 sprintf(dev->name, "SW@PORT%d", port_no); in vsc9953_port_init()
169 dev->priv = &vsc9953_l2sw.port[port_no]; in vsc9953_port_init()
201 static void vsc9953_vlan_table_membership_set(int vid, u32 port_no, u8 add) in vsc9953_vlan_table_membership_set() argument
235 (1 << port_no))); in vsc9953_vlan_table_membership_set()
241 (1 << port_no)); in vsc9953_vlan_table_membership_set()
253 static void vsc9953_vlan_membership_show(int port_no) in vsc9953_vlan_membership_show() argument
262 printf("Port %d VLAN membership: ", port_no); in vsc9953_vlan_membership_show()
286 (1 << port_no)) in vsc9953_vlan_membership_show()
355 static void vsc9953_port_vlan_pvid_set(int port_no, int pvid) in vsc9953_port_vlan_pvid_set() argument
362 if (!vsc9953_l2sw.port[port_no].enabled) { in vsc9953_port_vlan_pvid_set()
363 printf("Port %d is administrative down\n", port_no); in vsc9953_port_vlan_pvid_set()
373 val = in_le32(&l2ana_reg->port[port_no].vlan_cfg); in vsc9953_port_vlan_pvid_set()
375 out_le32(&l2ana_reg->port[port_no].vlan_cfg, val); in vsc9953_port_vlan_pvid_set()
378 val = in_le32(&l2rew_reg->port[port_no].port_vlan_cfg); in vsc9953_port_vlan_pvid_set()
381 out_le32(&l2rew_reg->port[port_no].port_vlan_cfg, val); in vsc9953_port_vlan_pvid_set()
393 static void vsc9953_port_vlan_aware_set(int port_no, int enabled) in vsc9953_port_vlan_aware_set() argument
398 if (!vsc9953_l2sw.port[port_no].enabled) { in vsc9953_port_vlan_aware_set()
399 printf("Port %d is administrative down\n", port_no); in vsc9953_port_vlan_aware_set()
407 setbits_le32(&l2ana_reg->port[port_no].vlan_cfg, in vsc9953_port_vlan_aware_set()
410 clrbits_le32(&l2ana_reg->port[port_no].vlan_cfg, in vsc9953_port_vlan_aware_set()
424 static void vsc9953_port_vlan_popcnt_set(int port_no, int popcnt) in vsc9953_port_vlan_popcnt_set() argument
430 if (!vsc9953_l2sw.port[port_no].enabled) { in vsc9953_port_vlan_popcnt_set()
431 printf("Port %d is administrative down\n", port_no); in vsc9953_port_vlan_popcnt_set()
436 printf("Invalid pop count value: %d\n", port_no); in vsc9953_port_vlan_popcnt_set()
443 val = in_le32(&l2ana_reg->port[port_no].vlan_cfg); in vsc9953_port_vlan_popcnt_set()
446 out_le32(&l2ana_reg->port[port_no].vlan_cfg, val); in vsc9953_port_vlan_popcnt_set()
523 static int vsc9953_port_vlan_egr_untag_get(int port_no, in vsc9953_port_vlan_egr_untag_get() argument
530 if (!vsc9953_l2sw.port[port_no].enabled) { in vsc9953_port_vlan_egr_untag_get()
531 printf("Port %d is administrative down\n", port_no); in vsc9953_port_vlan_egr_untag_get()
538 val = in_le32(&l2rew_reg->port[port_no].port_tag_cfg); in vsc9953_port_vlan_egr_untag_get()
555 port_no); in vsc9953_port_vlan_egr_untag_get()
561 static void vsc9953_port_vlan_egr_untag_show(int port_no) in vsc9953_port_vlan_egr_untag_show() argument
565 if (vsc9953_port_vlan_egr_untag_get(port_no, &mode)) { in vsc9953_port_vlan_egr_untag_show()
566 printf("%7d\t%17s\n", port_no, "-"); in vsc9953_port_vlan_egr_untag_show()
570 printf("%7d\t", port_no); in vsc9953_port_vlan_egr_untag_show()
590 static void vsc9953_port_vlan_egr_untag_set(int port_no, in vsc9953_port_vlan_egr_untag_set() argument
596 if (!vsc9953_l2sw.port[port_no].enabled) { in vsc9953_port_vlan_egr_untag_set()
597 printf("Port %d is administrative down\n", port_no); in vsc9953_port_vlan_egr_untag_set()
606 clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egr_untag_set()
610 clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egr_untag_set()
615 clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egr_untag_set()
620 clrsetbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egr_untag_set()
624 printf("Unknown untag mode for port %d\n", port_no); in vsc9953_port_vlan_egr_untag_set()
659 static void vsc9953_port_status_set(int port_no, u8 enabled) in vsc9953_port_status_set() argument
664 if (!vsc9953_l2sw.port[port_no].enabled) in vsc9953_port_status_set()
671 setbits_le32(&l2qsys_reg->sys.switch_port_mode[port_no], in vsc9953_port_status_set()
674 clrbits_le32(&l2qsys_reg->sys.switch_port_mode[port_no], in vsc9953_port_status_set()
679 static void vsc9953_phy_autoneg(int port_no) in vsc9953_phy_autoneg() argument
681 if (!vsc9953_l2sw.port[port_no].phydev) in vsc9953_phy_autoneg()
684 if (vsc9953_l2sw.port[port_no].phydev->drv->startup( in vsc9953_phy_autoneg()
685 vsc9953_l2sw.port[port_no].phydev)) in vsc9953_phy_autoneg()
686 printf("Failed to start PHY for port %d\n", port_no); in vsc9953_phy_autoneg()
690 static void vsc9953_port_config_show(int port_no) in vsc9953_port_config_show() argument
702 val = in_le32(&l2qsys_reg->sys.switch_port_mode[port_no]); in vsc9953_port_config_show()
703 enabled = vsc9953_l2sw.port[port_no].enabled && in vsc9953_port_config_show()
707 if (VSC9953_INTERNAL_PORT_CHECK(port_no)) { in vsc9953_port_config_show()
712 if (vsc9953_l2sw.port[port_no].phydev) { in vsc9953_port_config_show()
713 link = vsc9953_l2sw.port[port_no].phydev->link; in vsc9953_port_config_show()
714 speed = vsc9953_l2sw.port[port_no].phydev->speed; in vsc9953_port_config_show()
715 duplex = vsc9953_l2sw.port[port_no].phydev->duplex; in vsc9953_port_config_show()
723 printf("%8d ", port_no); in vsc9953_port_config_show()
751 static void vsc9953_port_statistics_show(int port_no) in vsc9953_port_statistics_show() argument
758 if (!vsc9953_l2sw.port[port_no].enabled) { in vsc9953_port_statistics_show()
759 printf("Port %d is administrative down\n", port_no); in vsc9953_port_statistics_show()
766 printf("Statistics for L2 Switch port %d:\n", port_no); in vsc9953_port_statistics_show()
769 out_le32(&l2sys_reg->sys.stat_cfg, port_no); in vsc9953_port_statistics_show()
948 static void vsc9953_port_statistics_clear(int port_no) in vsc9953_port_statistics_clear() argument
953 if (!vsc9953_l2sw.port[port_no].enabled) { in vsc9953_port_statistics_clear()
954 printf("Port %d is administrative down\n", port_no); in vsc9953_port_statistics_clear()
962 out_le32(&l2sys_reg->sys.stat_cfg, port_no | in vsc9953_port_statistics_clear()
973 static void vsc9953_port_learn_mode_set(int port_no, enum port_learn_mode mode) in vsc9953_port_learn_mode_set() argument
978 if (!vsc9953_l2sw.port[port_no].enabled) { in vsc9953_port_learn_mode_set()
979 printf("Port %d is administrative down\n", port_no); in vsc9953_port_learn_mode_set()
988 clrbits_le32(&l2ana_reg->port[port_no].port_cfg, in vsc9953_port_learn_mode_set()
995 clrsetbits_le32(&l2ana_reg->port[port_no].port_cfg, in vsc9953_port_learn_mode_set()
1002 printf("Unknown learn mode for port %d\n", port_no); in vsc9953_port_learn_mode_set()
1007 static int vsc9953_port_learn_mode_get(int port_no, enum port_learn_mode *mode) in vsc9953_port_learn_mode_get() argument
1013 if (!vsc9953_l2sw.port[port_no].enabled) { in vsc9953_port_learn_mode_get()
1014 printf("Port %d is administrative down\n", port_no); in vsc9953_port_learn_mode_get()
1022 val = in_le32(&l2ana_reg->port[port_no].port_cfg); in vsc9953_port_learn_mode_get()
1127 static void vsc9953_mac_table_show(int port_no, int vid) in vsc9953_mac_table_show() argument
1143 if (port_no == ETHSW_CMD_PORT_ALL) { in vsc9953_mac_table_show()
1150 rc[port_no] = vsc9953_port_learn_mode_get(port_no, in vsc9953_mac_table_show()
1151 &mode[port_no]); in vsc9953_mac_table_show()
1152 if (!rc[port_no] && mode[port_no] != PORT_LEARN_NONE) in vsc9953_mac_table_show()
1153 vsc9953_port_learn_mode_set(port_no, PORT_LEARN_NONE); in vsc9953_mac_table_show()
1158 if (port_no != ETHSW_CMD_PORT_ALL) { in vsc9953_mac_table_show()
1160 port_no) | VSC9953_AGE_PORT_EN; in vsc9953_mac_table_show()
1220 if (port_no == ETHSW_CMD_PORT_ALL) { in vsc9953_mac_table_show()
1227 if (!rc[port_no] && mode[port_no] != PORT_LEARN_NONE) in vsc9953_mac_table_show()
1228 vsc9953_port_learn_mode_set(port_no, mode[port_no]); in vsc9953_mac_table_show()
1238 static int vsc9953_mac_table_add(u8 port_no, uchar mac[6], int vid) in vsc9953_mac_table_add() argument
1257 val = bitfield_replace_by_mask(val, VSC9953_MAC_DESTIDX_MASK, port_no); in vsc9953_mac_table_add()
1278 if ((port_no != bitfield_extract_by_mask(val, in vsc9953_mac_table_add()
1353 static void vsc9953_mac_table_age(int port_no, int vid) in vsc9953_mac_table_age() argument
1366 if (port_no != ETHSW_CMD_PORT_ALL) { in vsc9953_mac_table_age()
1368 rc[port_no] = vsc9953_port_learn_mode_get(port_no, in vsc9953_mac_table_age()
1369 &mode[port_no]); in vsc9953_mac_table_age()
1370 if (!rc[port_no] && mode[port_no] != PORT_LEARN_NONE) in vsc9953_mac_table_age()
1371 vsc9953_port_learn_mode_set(port_no, PORT_LEARN_NONE); in vsc9953_mac_table_age()
1374 port_no) | VSC9953_AGE_PORT_EN; in vsc9953_mac_table_age()
1398 if (port_no != ETHSW_CMD_PORT_ALL) { in vsc9953_mac_table_age()
1399 if (!rc[port_no] && mode[port_no] != PORT_LEARN_NONE) in vsc9953_mac_table_age()
1400 vsc9953_port_learn_mode_set(port_no, mode[port_no]); in vsc9953_mac_table_age()
1422 static void vsc9953_port_vlan_egress_tag_set(int port_no, in vsc9953_port_vlan_egress_tag_set() argument
1432 clrbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egress_tag_set()
1436 setbits_le32(&l2rew_reg->port[port_no].port_tag_cfg, in vsc9953_port_vlan_egress_tag_set()
1440 printf("Unknown egress VLAN tag mode for port %d\n", port_no); in vsc9953_port_vlan_egress_tag_set()
1445 static void vsc9953_port_vlan_egress_tag_get(int port_no, in vsc9953_port_vlan_egress_tag_get() argument
1454 val = in_le32(&l2rew_reg->port[port_no].port_tag_cfg); in vsc9953_port_vlan_egress_tag_get()
1511 static void vsc9953_port_ingress_filtering_set(int port_no, int enabled) in vsc9953_port_ingress_filtering_set() argument
1519 setbits_le32(&l2ana_reg->ana.vlan_mask, 1 << port_no); in vsc9953_port_ingress_filtering_set()
1521 clrbits_le32(&l2ana_reg->ana.vlan_mask, 1 << port_no); in vsc9953_port_ingress_filtering_set()
1525 static int vsc9953_port_ingress_filtering_get(int port_no) in vsc9953_port_ingress_filtering_get() argument
1534 return !!(val & (1 << port_no)); in vsc9953_port_ingress_filtering_get()
1538 static int vsc9953_port_aggr_grp_get(int port_no, int *aggr_grp) in vsc9953_port_aggr_grp_get() argument
1543 if (!VSC9953_PORT_CHECK(port_no)) in vsc9953_port_aggr_grp_get()
1549 val = in_le32(&l2ana_reg->port[port_no].port_cfg); in vsc9953_port_aggr_grp_get()
1559 int port_no; in vsc9953_aggr_grp_members_get() local
1562 for (port_no = 0; port_no < VSC9953_MAX_PORTS; port_no++) { in vsc9953_aggr_grp_members_get()
1563 aggr_membr[port_no] = 0; in vsc9953_aggr_grp_members_get()
1565 if (vsc9953_port_aggr_grp_get(port_no, &aggr_membr_grp)) in vsc9953_aggr_grp_members_get()
1569 aggr_membr[port_no] = 1; in vsc9953_aggr_grp_members_get()
1573 static void vsc9953_update_dest_members_masks(int port_no, u32 membr_bitfld_old, in vsc9953_update_dest_members_masks() argument
1588 if (i == port_no) { in vsc9953_update_dest_members_masks()
1597 pgid &= ~((u32)(1 << port_no)); in vsc9953_update_dest_members_masks()
1599 pgid |= ((u32)(1 << port_no)); in vsc9953_update_dest_members_masks()
1605 static void vsc9953_update_source_members_masks(int port_no, in vsc9953_update_source_members_masks() argument
1620 if (i == port_no) { in vsc9953_update_source_members_masks()
1629 pgid |= (u32)(1 << port_no); in vsc9953_update_source_members_masks()
1632 pgid &= ~(u32)(1 << port_no); in vsc9953_update_source_members_masks()
1656 static void vsc9953_update_aggr_members_masks(int port_no, u32 membr_bitfld_old, in vsc9953_update_aggr_members_masks() argument
1698 static void vsc9953_update_members_masks(int port_no, in vsc9953_update_members_masks() argument
1705 vsc9953_update_dest_members_masks(port_no, membr_bitfld_old, in vsc9953_update_members_masks()
1707 vsc9953_update_source_members_masks(port_no, membr_bitfld_old, in vsc9953_update_members_masks()
1709 vsc9953_update_aggr_members_masks(port_no, membr_bitfld_old, in vsc9953_update_members_masks()
1714 static int vsc9953_port_aggr_grp_set(int port_no, int aggr_grp) in vsc9953_port_aggr_grp_set() argument
1723 if (!VSC9953_PORT_CHECK(port_no) || !VSC9953_PORT_CHECK(aggr_grp)) in vsc9953_port_aggr_grp_set()
1729 rc = vsc9953_port_aggr_grp_get(port_no, &aggr_grp_old); in vsc9953_port_aggr_grp_set()
1740 aggr_membr_old[port_no] = 0; in vsc9953_port_aggr_grp_set()
1741 aggr_membr_new[port_no] = 1; in vsc9953_port_aggr_grp_set()
1744 vsc9953_update_members_masks(port_no, aggr_membr_old, aggr_membr_new); in vsc9953_port_aggr_grp_set()
1747 val = in_le32(&l2ana_reg->port[port_no].port_cfg); in vsc9953_port_aggr_grp_set()
1750 out_le32(&l2ana_reg->port[port_no].port_cfg, val); in vsc9953_port_aggr_grp_set()