Lines Matching defs:vswp

79 static	int vsw_unattach(vsw_t *vswp);
85 static int vsw_mdeg_register(vsw_t *vswp);
86 static void vsw_mdeg_unregister(vsw_t *vswp);
89 static int vsw_get_initial_md_properties(vsw_t *vswp, md_t *, mde_cookie_t);
90 static int vsw_read_mdprops(vsw_t *vswp);
96 static int vsw_port_read_props(vsw_port_t *portp, vsw_t *vswp,
98 static void vsw_read_pri_eth_types(vsw_t *vswp, md_t *mdp,
100 static void vsw_mtu_read(vsw_t *vswp, md_t *mdp, mde_cookie_t node,
102 static int vsw_mtu_update(vsw_t *vswp, uint32_t mtu);
103 static void vsw_linkprop_read(vsw_t *vswp, md_t *mdp, mde_cookie_t node,
105 static void vsw_bandwidth_read(vsw_t *vswp, md_t *mdp, mde_cookie_t node,
108 static void vsw_save_lmacaddr(vsw_t *vswp, uint64_t macaddr);
122 void vsw_mac_link_update(vsw_t *vswp, link_state_t link_state);
123 void vsw_mac_rx(vsw_t *vswp, mac_resource_handle_t mrh,
125 void vsw_physlink_state_update(vsw_t *vswp);
131 extern int vsw_setup_switching_start(vsw_t *vswp);
132 extern void vsw_setup_switching_stop(vsw_t *vswp);
134 extern void vsw_switch_frame_nop(vsw_t *vswp, mblk_t *mp, int caller,
140 extern void vsw_detach_ports(vsw_t *vswp);
141 extern int vsw_port_add(vsw_t *vswp, md_t *mdp, mde_cookie_t *node);
142 extern int vsw_port_detach(vsw_t *vswp, int p_instance);
143 static int vsw_port_update(vsw_t *vswp, md_t *curr_mdp, mde_cookie_t curr_mdex,
146 extern vsw_port_t *vsw_lookup_port(vsw_t *vswp, int p_instance);
147 extern int vsw_mac_open(vsw_t *vswp);
148 extern void vsw_mac_close(vsw_t *vswp);
149 extern void vsw_mac_cleanup_ports(vsw_t *vswp);
150 extern void vsw_unset_addrs(vsw_t *vswp);
151 extern void vsw_setup_switching_post_process(vsw_t *vswp);
160 extern void vsw_hio_cleanup(vsw_t *vswp);
161 extern void vsw_hio_start_ports(vsw_t *vswp);
167 extern int vsw_mac_client_init(vsw_t *vswp, vsw_port_t *port, int type);
168 extern void vsw_mac_client_cleanup(vsw_t *vswp, vsw_port_t *port, int type);
169 extern void vsw_if_mac_reconfig(vsw_t *vswp, boolean_t update_vlans,
171 extern void vsw_reset_ports(vsw_t *vswp);
173 extern void vsw_physlink_update_ports(vsw_t *vswp);
174 extern void vsw_update_bandwidth(vsw_t *vswp, vsw_port_t *port, int type,
513 vswdebug(vsw_t *vswp, const char *fmt, ...)
522 if (vswp == NULL)
525 cmn_err(CE_CONT, "vsw%d: %s\n", vswp->instance, buf);
581 vsw_t *vswp;
604 vswp = ddi_get_soft_state(vsw_state, instance);
606 if (vswp == NULL) {
611 vswp->dip = dip;
612 vswp->instance = instance;
613 vswp->phys_link_state = LINK_STATE_UNKNOWN;
614 ddi_set_driver_private(dip, (caddr_t)vswp);
616 mutex_init(&vswp->mac_lock, NULL, MUTEX_DRIVER, NULL);
617 mutex_init(&vswp->mca_lock, NULL, MUTEX_DRIVER, NULL);
618 mutex_init(&vswp->sw_thr_lock, NULL, MUTEX_DRIVER, NULL);
619 cv_init(&vswp->sw_thr_cv, NULL, CV_DRIVER, NULL);
620 rw_init(&vswp->maccl_rwlock, NULL, RW_DRIVER, NULL);
621 rw_init(&vswp->if_lockrw, NULL, RW_DRIVER, NULL);
622 rw_init(&vswp->mfdbrw, NULL, RW_DRIVER, NULL);
623 rw_init(&vswp->plist.lockrw, NULL, RW_DRIVER, NULL);
627 rv = vsw_read_mdprops(vswp);
635 vswp->instance);
636 D2(vswp, "creating unicast hash table (%s)...", hashname);
637 vswp->fdb_nchains = vsw_fdb_nchains;
638 vswp->fdb_hashp = mod_hash_create_ptrhash(hashname, vswp->fdb_nchains,
640 vsw_create_vlans((void *)vswp, VSW_LOCALDEV);
645 vswp->instance);
646 D2(vswp, "creating multicast hash table %s)...", hashname);
647 vswp->mfdb = mod_hash_create_ptrhash(hashname, vsw_fdb_nchains,
656 (void) snprintf(qname, TASKQ_NAMELEN, "taskq%d", vswp->instance);
657 if ((vswp->taskq_p = ddi_taskq_create(vswp->dip, qname, 1,
660 vswp->instance);
667 vswp->instance);
668 if ((vswp->rxp_taskq = ddi_taskq_create(vswp->dip, qname, 1,
671 vswp->instance);
678 if (ddi_prop_update_int(DDI_DEV_T_NONE, vswp->dip,
688 vswp->vsw_switch_frame = vsw_switch_frame_nop;
695 rv = vsw_setup_switching_start(vswp);
703 rv = vsw_mac_register(vswp);
721 rv = vsw_mdeg_register(vswp);
727 vswp->attach_progress = progress;
730 vswp->next = vsw_head;
731 vsw_head = vswp;
734 ddi_report_dev(vswp->dip);
740 vswp->attach_progress = progress;
741 (void) vsw_unattach(vswp);
749 vsw_t **vswpp, *vswp;
753 vswp = ddi_get_soft_state(vsw_state, instance);
755 if (vswp == NULL) {
768 D2(vswp, "detaching instance %d", instance);
770 if (vsw_unattach(vswp) != 0) {
778 if (*vswpp == vswp) {
779 *vswpp = vswp->next;
797 vsw_unattach(vsw_t *vswp)
801 progress = vswp->attach_progress;
809 if (vsw_mac_unregister(vswp) != 0) {
811 "MAC layer", vswp->instance);
827 vsw_mdeg_unregister(vswp);
828 vsw_detach_ports(vswp);
845 vsw_setup_switching_stop(vswp);
847 if (vswp->hio_capable == B_TRUE) {
848 vsw_hio_cleanup(vswp);
849 vswp->hio_capable = B_FALSE;
852 mutex_enter(&vswp->mac_lock);
853 vsw_mac_close(vswp);
854 mutex_exit(&vswp->mac_lock);
866 ddi_taskq_destroy(vswp->rxp_taskq);
876 ddi_taskq_destroy(vswp->taskq_p);
882 mod_hash_destroy_hash(vswp->mfdb);
888 vsw_destroy_vlans(vswp, VSW_LOCALDEV);
889 mod_hash_destroy_hash(vswp->fdb_hashp);
894 if (VSW_PRI_ETH_DEFINED(vswp)) {
895 kmem_free(vswp->pri_types,
896 sizeof (uint16_t) * vswp->pri_num_types);
897 (void) vio_destroy_mblks(vswp->pri_tx_vmp);
903 rw_destroy(&vswp->plist.lockrw);
904 rw_destroy(&vswp->mfdbrw);
905 rw_destroy(&vswp->if_lockrw);
906 rw_destroy(&vswp->maccl_rwlock);
907 cv_destroy(&vswp->sw_thr_cv);
908 mutex_destroy(&vswp->sw_thr_lock);
909 mutex_destroy(&vswp->mca_lock);
910 mutex_destroy(&vswp->mac_lock);
914 vswp->attach_progress = progress;
947 vsw_get_md_physname(vsw_t *vswp, md_t *mdp, mde_cookie_t node, char *name)
956 dev_name = ddi_driver_name(vswp->dip);
957 instance = ddi_get_instance(vswp->dip);
963 "device(s) from MD", vswp->instance);
967 vswp->instance, physname);
975 vswp->instance, physname);
979 D2(vswp, "%s: using first device specified (%s)",
993 if (ddi_prop_lookup_string(DDI_DEV_T_ANY, vswp->dip, 0,
997 vswp->instance, dev);
1002 "config file", vswp->instance, dev);
1020 vsw_get_md_smodes(vsw_t *vswp, md_t *mdp, mde_cookie_t node, uint8_t *mode)
1026 D1(vswp, "%s: enter", __func__);
1041 " from the MD", vswp->instance);
1056 D2(vswp, "%s: curr_mode = [%s]", __func__, curr_mode);
1066 vswp->instance, curr_mode);
1072 D2(vswp, "%s: %d mode", __func__, *mode);
1074 D1(vswp, "%s: exit", __func__);
1084 vsw_mac_register(vsw_t *vswp)
1089 D1(vswp, "%s: enter", __func__);
1094 macp->m_driver = vswp;
1095 macp->m_dip = vswp->dip;
1096 macp->m_src_addr = (uint8_t *)&vswp->if_addr;
1099 macp->m_max_sdu = vswp->mtu;
1101 rv = mac_register(macp, &vswp->if_mh);
1109 "a provider with MAC layer", vswp->instance);
1113 vswp->if_state |= VSW_IF_REG;
1115 D1(vswp, "%s: exit", __func__);
1121 vsw_mac_unregister(vsw_t *vswp)
1125 D1(vswp, "%s: enter", __func__);
1127 WRITE_ENTER(&vswp->if_lockrw);
1129 if (vswp->if_state & VSW_IF_REG) {
1130 rv = mac_unregister(vswp->if_mh);
1132 DWARN(vswp, "%s: unable to unregister from MAC "
1135 RW_EXIT(&vswp->if_lockrw);
1136 D1(vswp, "%s: fail exit", __func__);
1141 vswp->if_state &= ~(VSW_IF_UP | VSW_IF_REG);
1143 RW_EXIT(&vswp->if_lockrw);
1145 D1(vswp, "%s: exit", __func__);
1153 vsw_t *vswp = (vsw_t *)arg;
1155 D1(vswp, "%s: enter", __func__);
1157 mutex_enter(&vswp->mac_lock);
1158 if (vswp->mh == NULL) {
1159 mutex_exit(&vswp->mac_lock);
1164 *val = mac_stat_get(vswp->mh, stat);
1166 mutex_exit(&vswp->mac_lock);
1174 vsw_t *vswp = (vsw_t *)arg;
1176 D1(vswp, "%s: enter", __func__);
1178 WRITE_ENTER(&vswp->if_lockrw);
1179 vswp->if_state &= ~VSW_IF_UP;
1180 RW_EXIT(&vswp->if_lockrw);
1183 vsw_mac_client_cleanup(vswp, NULL, VSW_LOCALDEV);
1185 D1(vswp, "%s: exit (state = %d)", __func__, vswp->if_state);
1192 vsw_t *vswp = (vsw_t *)arg;
1194 D1(vswp, "%s: enter", __func__);
1196 WRITE_ENTER(&vswp->if_lockrw);
1198 vswp->if_state |= VSW_IF_UP;
1200 if (vswp->switching_setup_done == B_FALSE) {
1207 RW_EXIT(&vswp->if_lockrw);
1212 if (vswp->mh != NULL) {
1214 rv = vsw_mac_client_init(vswp, NULL, VSW_LOCALDEV);
1218 "unicast address\n", vswp->instance);
1222 RW_EXIT(&vswp->if_lockrw);
1224 D1(vswp, "%s: exit (state = %d)", __func__, vswp->if_state);
1246 vsw_t *vswp = (vsw_t *)arg;
1251 D1(vswp, "%s: enter", __func__);
1261 D2(vswp, "%s: addr = 0x%llx", __func__, addr);
1264 D2(vswp, "%s: adding multicast", __func__);
1265 if (vsw_add_mcst(vswp, VSW_LOCALDEV, addr, NULL) == 0) {
1273 DERR(vswp, "%s unable to alloc mem", __func__);
1274 (void) vsw_del_mcst(vswp,
1285 ret = vsw_mac_multicast_add(vswp, NULL, mcst_p,
1288 (void) vsw_del_mcst(vswp,
1294 mutex_enter(&vswp->mca_lock);
1295 mcst_p->nextp = vswp->mcap;
1296 vswp->mcap = mcst_p;
1297 mutex_exit(&vswp->mca_lock);
1300 "address", vswp->instance);
1305 D2(vswp, "%s: removing multicast", __func__);
1309 if (vsw_del_mcst(vswp, VSW_LOCALDEV, addr, NULL) == 0) {
1315 mcst_p = vsw_del_addr(VSW_LOCALDEV, vswp, addr);
1318 vsw_mac_multicast_remove(vswp, NULL, mcst_p, VSW_LOCALDEV);
1322 D1(vswp, "%s: exit", __func__);
1330 vsw_t *vswp = (vsw_t *)arg;
1332 D1(vswp, "%s: enter", __func__);
1334 WRITE_ENTER(&vswp->if_lockrw);
1336 vswp->if_state |= VSW_IF_PROMISC;
1338 vswp->if_state &= ~VSW_IF_PROMISC;
1339 RW_EXIT(&vswp->if_lockrw);
1341 D1(vswp, "%s: exit", __func__);
1349 vsw_t *vswp = (vsw_t *)arg;
1351 D1(vswp, "%s: enter", __func__);
1353 mp = vsw_vlan_frame_pretag(vswp, VSW_LOCALDEV, mp);
1359 vswp->vsw_switch_frame(vswp, mp, VSW_LOCALDEV, NULL, NULL);
1361 D1(vswp, "%s: exit", __func__);
1372 vsw_mdeg_register(vsw_t *vswp)
1380 D1(vswp, "%s: enter", __func__);
1392 VSW_SET_MDEG_PROP_INST(pspecp, vswp->regprop);
1399 D2(vswp, "%s: instance %d registering with mdeg", __func__,
1400 vswp->regprop);
1406 (void *)vswp, &mdeg_hdl);
1408 DERR(vswp, "%s: mdeg_register failed (%d) for vsw node",
1417 (void *)vswp, &mdeg_port_hdl);
1419 DERR(vswp, "%s: mdeg_register failed (%d)\n", __func__, rv);
1425 vswp->inst_spec = inst_specp;
1426 vswp->mdeg_hdl = mdeg_hdl;
1427 vswp->mdeg_port_hdl = mdeg_port_hdl;
1429 D1(vswp, "%s: exit", __func__);
1434 vswp->instance);
1438 vswp->mdeg_hdl = NULL;
1439 vswp->mdeg_port_hdl = NULL;
1445 vsw_mdeg_unregister(vsw_t *vswp)
1447 D1(vswp, "vsw_mdeg_unregister: enter");
1449 if (vswp->mdeg_hdl != NULL)
1450 (void) mdeg_unregister(vswp->mdeg_hdl);
1452 if (vswp->mdeg_port_hdl != NULL)
1453 (void) mdeg_unregister(vswp->mdeg_port_hdl);
1455 if (vswp->inst_spec != NULL) {
1456 if (vswp->inst_spec->specp != NULL) {
1457 (void) kmem_free(vswp->inst_spec->specp,
1459 vswp->inst_spec->specp = NULL;
1462 (void) kmem_free(vswp->inst_spec, sizeof (mdeg_node_spec_t));
1463 vswp->inst_spec = NULL;
1466 D1(vswp, "vsw_mdeg_unregister: exit");
1475 vsw_t *vswp;
1484 vswp = (vsw_t *)cb_argp;
1486 D1(vswp, "%s: added %d : removed %d : curr matched %d"
1512 "invalid: %d\n", vswp->instance, resp->added.nelem);
1523 "invalid: %d\n", vswp->instance,
1537 DERR(vswp, "%s: unable to get node name\n", __func__);
1543 DERR(vswp, "%s: Invalid node name: %s\n",
1549 DERR(vswp, "%s: prop(cfg-handle) not found\n",
1555 if (inst != vswp->regprop) {
1556 DERR(vswp, "%s: Invalid cfg-handle: %lx\n",
1561 vsw_update_md_prop(vswp, mdp, node);
1573 vsw_t *vswp;
1583 vswp = (vsw_t *)cb_argp;
1585 D2(vswp, "%s: added %d : removed %d : curr matched %d"
1595 D2(vswp, "%s: adding node(%d) 0x%lx", __func__, idx, node);
1597 if ((rv = vsw_port_add(vswp, mdp, &node)) != 0) {
1599 "(0x%lx), err=%d", vswp->instance, node, rv);
1609 DERR(vswp, "%s: prop(%s) not found in port(%d)",
1614 D2(vswp, "%s: removing node(%d) 0x%lx", __func__, idx, node);
1616 if (vsw_port_detach(vswp, inst) != 0) {
1618 vswp->instance, inst);
1623 (void) vsw_port_update(vswp, resp->match_curr.mdp,
1629 D1(vswp, "%s: exit", __func__);
1640 vsw_read_mdprops(vsw_t *vswp)
1667 inst = ddi_prop_get_int(DDI_DEV_T_ANY, vswp->dip,
1671 "OBP device tree", vswp->instance, reg_propname);
1675 vswp->regprop = inst;
1678 DWARN(vswp, "%s: cannot init MD\n", __func__);
1695 DWARN(vswp, "%s: invalid num_devs:%d\n", __func__, num_devs);
1709 DWARN(vswp, "%s: name property not found\n",
1719 DWARN(vswp, "%s: cfg-handle property not found\n",
1729 rv = vsw_get_initial_md_properties(vswp, mdp, listp[i]);
1744 vsw_get_initial_md_properties(vsw_t *vswp, md_t *mdp, mde_cookie_t node)
1748 D1(vswp, "%s: enter", __func__);
1750 if (vsw_get_md_physname(vswp, mdp, node, vswp->physname) != 0) {
1757 vswp->instance);
1761 vsw_save_lmacaddr(vswp, macaddr);
1763 if (vsw_get_md_smodes(vswp, mdp, node, &vswp->smode)) {
1764 DWARN(vswp, "%s: Unable to read %s property from MD, "
1768 vswp->smode = VSW_LAYER2;
1775 vsw_linkprop_read(vswp, mdp, node, &vswp->pls_update);
1778 vsw_mtu_read(vswp, mdp, node, &vswp->mtu);
1779 if (vswp->mtu < ETHERMTU || vswp->mtu > VNET_MAX_MTU) {
1780 vswp->mtu = ETHERMTU;
1782 vswp->max_frame_size = vswp->mtu + sizeof (struct ether_header) +
1786 vsw_vlan_read_ids(vswp, VSW_LOCALDEV, mdp, node, &vswp->pvid,
1787 &vswp->vids, &vswp->nvids, &vswp->default_vlan_id);
1790 vsw_read_pri_eth_types(vswp, mdp, node);
1793 vsw_bandwidth_read(vswp, mdp, node, &vswp->bandwidth);
1795 D1(vswp, "%s: exit", __func__);
1818 vsw_t *vswp;
1833 vswp = (vsw_t *)arg;
1836 inst = vswp->instance;
1841 vswp = portp->p_vswp;
1853 DWARN(vswp, "%s: prop(%s) not found", __func__,
1859 D2(vswp, "%s: %s(%d): (%d)\n", __func__,
1866 DWARN(vswp, "%s: prop(%s) not found", __func__, pvid_propname);
1871 D2(vswp, "%s: %s(%d): (%d)\n", __func__,
1878 D2(vswp, "%s: prop(%s) not found", __func__, vid_propname);
1886 D2(vswp, "%s: %s(%d): ", __func__, vid_propname, inst);
1892 D2(vswp, " %d ", (*vidspp)[i].vl_vid);
1894 D2(vswp, "\n");
1906 vsw_t *vswp;
1908 vswp = portp->p_vswp;
1914 D3(vswp, "%s: prop(%s) not found\n", __func__,
1918 D3(vswp, "%s: %s nodes found", __func__, port_maxbw_propname);
1937 vsw_read_pri_eth_types(vsw_t *vswp, md_t *mdp, mde_cookie_t node)
1957 D3(vswp, "%s: prop(%s) not found", __func__,
1964 vswp->pri_num_types = 0;
1975 vswp->pri_num_types = size;
1976 vswp->pri_types = kmem_zalloc(size * sizeof (uint16_t), KM_SLEEP);
1977 for (i = 0, types = vswp->pri_types; i < size; i++) {
1982 &vswp->pri_tx_vmp);
1986 vsw_mtu_read(vsw_t *vswp, md_t *mdp, mde_cookie_t node, uint32_t *mtu)
1994 inst = vswp->instance;
1998 D3(vswp, "%s: prop(%s) not found", __func__, mtu_propname);
2003 D2(vswp, "%s: %s(%d): (%d)\n", __func__,
2015 vsw_mtu_update(vsw_t *vswp, uint32_t mtu)
2019 WRITE_ENTER(&vswp->if_lockrw);
2021 if (vswp->if_state & VSW_IF_UP) {
2023 RW_EXIT(&vswp->if_lockrw);
2026 " as the device is plumbed\n", vswp->instance);
2031 D2(vswp, "%s: curr_mtu(%d) new_mtu(%d)\n",
2032 __func__, vswp->mtu, mtu);
2034 vswp->mtu = mtu;
2035 vswp->max_frame_size = vswp->mtu +
2038 rv = mac_maxsdu_update(vswp->if_mh, mtu);
2042 " layer\n", vswp->instance);
2045 RW_EXIT(&vswp->if_lockrw);
2048 vsw_reset_ports(vswp);
2056 vsw_linkprop_read(vsw_t *vswp, md_t *mdp, mde_cookie_t node,
2067 D3(vswp, "%s: prop(%s) not found", __func__, linkpropname);
2072 D2(vswp, "%s: %s(%d): (%d)\n", __func__, linkpropname,
2073 vswp->instance, *pls);
2078 vsw_mac_link_update(vsw_t *vswp, link_state_t link_state)
2080 READ_ENTER(&vswp->if_lockrw);
2082 if (vswp->if_state & VSW_IF_REG) {
2083 mac_link_update(vswp->if_mh, link_state);
2086 RW_EXIT(&vswp->if_lockrw);
2090 vsw_physlink_state_update(vsw_t *vswp)
2092 if (vswp->pls_update == B_TRUE) {
2093 vsw_mac_link_update(vswp, vswp->phys_link_state);
2095 vsw_physlink_update_ports(vswp);
2099 vsw_bandwidth_read(vsw_t *vswp, md_t *mdp, mde_cookie_t node, uint64_t *bw)
2108 D3(vswp, "%s: prop(%s) not found", __func__,
2112 D3(vswp, "%s: %s(%d): (%ld)\n", __func__,
2113 vsw_maxbw_propname, vswp->instance, *bw);
2130 vsw_update_md_prop(vsw_t *vswp, md_t *mdp, mde_cookie_t node)
2156 D1(vswp, "%s: enter", __func__);
2161 if (vsw_get_md_physname(vswp, mdp, node, (char *)&physname) == 0) {
2173 vswp->instance, physname);
2177 if (strcmp(physname, vswp->physname)) {
2178 D2(vswp, "%s: device name changed from %s to %s",
2179 __func__, vswp->physname, physname);
2183 D2(vswp, "%s: device name unchanged at %s",
2184 __func__, vswp->physname);
2188 "device from updated MD.", vswp->instance);
2197 vswp->instance);
2201 READ_ENTER(&vswp->if_lockrw);
2203 if (vswp->if_addr.ether_addr_octet[i]
2205 D2(vswp, "%s: octet[%d] 0x%x != 0x%x",
2207 vswp->if_addr.ether_addr_octet[i],
2215 RW_EXIT(&vswp->if_lockrw);
2217 vsw_save_lmacaddr(vswp, macaddr);
2224 if (vsw_get_md_smodes(vswp, mdp, node, &new_smode)) {
2226 vswp->instance, smode_propname);
2229 if (new_smode != vswp->smode) {
2230 D2(vswp, "%s: switching mode changed from %d to %d",
2231 __func__, vswp->smode, new_smode);
2238 vsw_vlan_read_ids(vswp, VSW_LOCALDEV, mdp, node, &pvid, &vids,
2242 if ((pvid != vswp->pvid) || /* pvid changed? */
2243 (nvids != vswp->nvids) || /* # of vids changed? */
2244 ((nvids != 0) && (vswp->nvids != 0) && /* vids changed? */
2245 !vsw_cmp_vids(vids, vswp->vids, nvids))) {
2250 vsw_mtu_read(vswp, mdp, node, &mtu);
2251 if (mtu != vswp->mtu) {
2257 vswp->instance, mtu);
2264 vsw_linkprop_read(vswp, mdp, node, &pls_update);
2265 if (pls_update != vswp->pls_update) {
2270 vsw_bandwidth_read(vswp, mdp, node, &maxbw);
2271 if (maxbw != vswp->bandwidth) {
2277 vswp->instance, maxbw);
2287 vswp->pls_update = pls_update;
2295 if (vswp->phys_link_state == LINK_STATE_DOWN) {
2296 vsw_mac_link_update(vswp, LINK_STATE_UP);
2303 if (vswp->smode & VSW_LAYER2) {
2304 vsw_mac_link_update(vswp,
2305 vswp->phys_link_state);
2316 vsw_setup_switching_stop(vswp);
2319 vsw_hio_cleanup(vswp);
2326 vsw_unset_addrs(vswp);
2331 mutex_enter(&vswp->mac_lock);
2332 vsw_mac_close(vswp);
2333 mutex_exit(&vswp->mac_lock);
2340 vswp->instance, vswp->physname, physname);
2341 (void) strncpy(vswp->physname,
2349 vswp->smode = new_smode;
2354 rv = vsw_mtu_update(vswp, mtu);
2363 rv = vsw_setup_switching(vswp);
2372 if (vsw_setup_switching_start(vswp) != 0) {
2381 vsw_setup_switching_post_process(vswp);
2390 vswp->instance, macaddr);
2392 READ_ENTER(&vswp->if_lockrw);
2393 if (vswp->if_state & VSW_IF_UP) {
2395 vsw_if_mac_reconfig(vswp, B_FALSE, 0, NULL, 0);
2400 mac_unicst_update(vswp->if_mh,
2401 (uint8_t *)&vswp->if_addr);
2404 RW_EXIT(&vswp->if_lockrw);
2410 vsw_vlan_remove_ids(vswp, VSW_LOCALDEV);
2412 if (vswp->if_state & VSW_IF_UP) {
2413 vsw_if_mac_reconfig(vswp, B_TRUE, pvid, vids, nvids);
2415 if (vswp->nvids != 0) {
2416 kmem_free(vswp->vids,
2417 sizeof (vsw_vlanid_t) * vswp->nvids);
2419 vswp->vids = vids;
2420 vswp->nvids = nvids;
2421 vswp->pvid = pvid;
2425 vsw_vlan_add_ids(vswp, VSW_LOCALDEV);
2433 vsw_update_bandwidth(vswp, NULL, VSW_LOCALDEV, maxbw);
2439 cmn_err(CE_WARN, "!vsw%d: configuration unchanged", vswp->instance);
2444 vswp->instance);
2451 vsw_port_read_props(vsw_port_t *portp, vsw_t *vswp,
2466 DWARN(vswp, "%s: prop(%s) not found", __func__,
2476 DERR(vswp, "%s: invalid number of nodes found (%d)",
2481 D2(vswp, "%s: %d nodes found", __func__, num_nodes);
2491 DWARN(vswp, "%s: no %s nodes found", __func__, chan_propname);
2496 D2(vswp, "%s: %d %s nodes found", __func__, nchan, chan_propname);
2500 DWARN(vswp, "%s: prop(%s) not found\n", __func__,
2509 D2(vswp, "%s: ldc_id 0x%llx", __func__, ldc_id);
2514 DWARN(vswp, "%s: prop(%s) not found",
2520 DWARN(vswp, "%s: invalid address size", __func__);
2525 D2(vswp, "%s: remote mac address 0x%llx", __func__, macaddr);
2533 portp->p_vswp = vswp;
2538 D2(vswp, "%s: using first of %d ldc ids",
2553 D1(vswp, "%s: prop(%s) found\n", __func__, hybrid_propname);
2576 vsw_port_add(vsw_t *vswp, md_t *mdp, mde_cookie_t *node)
2583 rv = vsw_port_read_props(portp, vswp, mdp, node);
2591 DERR(vswp, "%s: failed to attach port", __func__);
2599 vsw_port_update(vsw_t *vswp, md_t *curr_mdp, mde_cookie_t curr_mdex,
2633 plistp = &(vswp->plist);
2637 portp = vsw_lookup_port(vswp, cport_num);
2657 D1(vswp, "%s: prop(%s) found\n", __func__, hybrid_propname);
2674 vswp->instance, portp->p_instance, maxbw);
2715 vsw_mac_rx(vsw_t *vswp, mac_resource_handle_t mrh,
2720 D1(vswp, "%s:enter\n", __func__);
2721 READ_ENTER(&vswp->if_lockrw);
2723 if (!(vswp->if_state & VSW_IF_UP)) {
2724 RW_EXIT(&vswp->if_lockrw);
2729 D1(vswp, "%s:exit\n", __func__);
2738 if (!(vswp->if_state & VSW_IF_PROMISC)) {
2739 RW_EXIT(&vswp->if_lockrw);
2744 D1(vswp, "%s:exit\n", __func__);
2748 RW_EXIT(&vswp->if_lockrw);
2756 D1(vswp, "%s:exit\n", __func__);
2761 D2(vswp, "%s: sending up stack", __func__);
2764 (void) vsw_vlan_frame_untag(vswp, VSW_LOCALDEV, &mp, &mpt);
2766 mac_rx(vswp->if_mh, mrh, mp);
2768 D1(vswp, "%s:exit\n", __func__);
2773 vsw_save_lmacaddr(vsw_t *vswp, uint64_t macaddr)
2777 WRITE_ENTER(&vswp->if_lockrw);
2779 vswp->if_addr.ether_addr_octet[i] = macaddr & 0xFF;
2782 RW_EXIT(&vswp->if_lockrw);