Lines Matching refs:portp
89 static int vgen_force_link_state(vgen_port_t *portp, int link_state);
102 static void vgen_port_detach(vgen_port_t *portp);
103 static void vgen_port_list_insert(vgen_port_t *portp);
104 static void vgen_port_list_remove(vgen_port_t *portp);
112 static int vgen_port_read_props(vgen_port_t *portp, vgen_t *vgenp, md_t *mdp,
115 static int vgen_port_attach(vgen_port_t *portp);
116 static void vgen_port_detach_mdeg(vgen_port_t *portp);
119 static uint64_t vgen_port_stat(vgen_port_t *portp, uint_t stat);
120 static void vgen_port_reset(vgen_port_t *portp);
124 static int vgen_ldc_attach(vgen_port_t *portp, uint64_t ldc_id);
126 static void vgen_port_init(vgen_port_t *portp);
127 static void vgen_port_uninit(vgen_port_t *portp);
133 static int vgen_portsend(vgen_port_t *portp, mblk_t *mp);
190 static void vgen_vlan_create_hash(vgen_port_t *portp);
191 static void vgen_vlan_destroy_hash(vgen_port_t *portp);
192 static void vgen_vlan_add_ids(vgen_port_t *portp);
193 static void vgen_vlan_remove_ids(vgen_port_t *portp);
197 static mblk_t *vgen_vlan_frame_fixtag(vgen_port_t *portp, mblk_t *mp,
199 static void vgen_vlan_unaware_port_reset(vgen_port_t *portp);
631 vgen_port_t *portp = (vgen_port_t *)arg; in vgen_start() local
632 vgen_t *vgenp = portp->vgenp; in vgen_start()
635 mutex_enter(&portp->lock); in vgen_start()
636 vgen_port_init(portp); in vgen_start()
637 portp->flags |= VGEN_STARTED; in vgen_start()
638 mutex_exit(&portp->lock); in vgen_start()
648 vgen_port_t *portp = (vgen_port_t *)arg; in vgen_stop() local
649 vgen_t *vgenp = portp->vgenp; in vgen_stop()
653 mutex_enter(&portp->lock); in vgen_stop()
654 if (portp->flags & VGEN_STARTED) { in vgen_stop()
655 vgen_port_uninit(portp); in vgen_stop()
656 portp->flags &= ~(VGEN_STARTED); in vgen_stop()
658 mutex_exit(&portp->lock); in vgen_stop()
667 vgen_port_t *portp; in vgen_tx() local
670 portp = (vgen_port_t *)arg; in vgen_tx()
671 status = vgen_portsend(portp, mp); in vgen_tx()
699 vgen_vlan_frame_fixtag(vgen_port_t *portp, mblk_t *mp, boolean_t is_tagged, in vgen_vlan_frame_fixtag() argument
706 vgenp = portp->vgenp; in vgen_vlan_frame_fixtag()
732 if (portp != vgenp->vsw_portp) { in vgen_vlan_frame_fixtag()
738 rv = vgen_vlan_lookup(portp->vlan_hashp, vid); in vgen_vlan_frame_fixtag()
746 (vid == portp->pvid) ? (dst_tagged = B_FALSE) : in vgen_vlan_frame_fixtag()
779 vgen_portsend(vgen_port_t *portp, mblk_t *mp) in vgen_portsend() argument
791 if (portp == NULL) { in vgen_portsend()
795 vgenp = portp->vgenp; in vgen_portsend()
798 if (portp->use_vsw_port) { in vgen_portsend()
800 portp = portp->vgenp->vsw_portp; in vgen_portsend()
801 ASSERT(portp != NULL); in vgen_portsend()
822 if (portp != vgenp->vsw_portp && in vgen_portsend()
823 portp->pvid != vnetp->default_vlan_id) { in vgen_portsend()
830 mp = vgen_vlan_frame_fixtag(portp, mp, is_tagged, vlan_id); in vgen_portsend()
837 ldcp = portp->ldcp; in vgen_portsend()
999 vgen_port_t *portp; in vgen_multicst() local
1005 portp = (vgen_port_t *)arg; in vgen_multicst()
1006 vgenp = portp->vgenp; in vgen_multicst()
1008 if (portp->is_vsw_port != B_TRUE) { in vgen_multicst()
1016 ldcp = portp->ldcp; in vgen_multicst()
1121 vgen_port_t *portp = (vgen_port_t *)arg; in vgen_stat() local
1123 *val = vgen_port_stat(portp, stat); in vgen_stat()
1132 vgen_port_t *portp; in vgen_detach_ports() local
1137 while ((portp = plistp->headp) != NULL) { in vgen_detach_ports()
1138 vgen_port_detach(portp); in vgen_detach_ports()
1147 vgen_port_detach(vgen_port_t *portp) in vgen_port_detach() argument
1152 vgenp = portp->vgenp; in vgen_port_detach()
1153 port_num = portp->port_num; in vgen_port_detach()
1167 if (vgenp->vsw_portp == portp) { in vgen_port_detach()
1175 if (portp->vhp != NULL) { in vgen_port_detach()
1176 vio_net_resource_unreg(portp->vhp); in vgen_port_detach()
1177 portp->vhp = NULL; in vgen_port_detach()
1180 vgen_vlan_destroy_hash(portp); in vgen_port_detach()
1183 vgen_port_list_remove(portp); in vgen_port_detach()
1186 vgen_ldc_detach(portp->ldcp); in vgen_port_detach()
1188 if (portp->num_ldcs != 0) { in vgen_port_detach()
1189 kmem_free(portp->ldc_ids, portp->num_ldcs * sizeof (uint64_t)); in vgen_port_detach()
1190 portp->num_ldcs = 0; in vgen_port_detach()
1193 mutex_destroy(&portp->lock); in vgen_port_detach()
1194 KMEM_FREE(portp); in vgen_port_detach()
1201 vgen_port_list_insert(vgen_port_t *portp) in vgen_port_list_insert() argument
1206 vgenp = portp->vgenp; in vgen_port_list_insert()
1210 plistp->headp = portp; in vgen_port_list_insert()
1212 plistp->tailp->nextp = portp; in vgen_port_list_insert()
1214 plistp->tailp = portp; in vgen_port_list_insert()
1215 portp->nextp = NULL; in vgen_port_list_insert()
1220 vgen_port_list_remove(vgen_port_t *portp) in vgen_port_list_remove() argument
1227 vgenp = portp->vgenp; in vgen_port_list_remove()
1234 if (portp == plistp->headp) { in vgen_port_list_remove()
1235 plistp->headp = portp->nextp; in vgen_port_list_remove()
1236 if (portp == plistp->tailp) in vgen_port_list_remove()
1240 ((nextp = prevp->nextp) != NULL) && (nextp != portp); in vgen_port_list_remove()
1243 if (nextp == portp) { in vgen_port_list_remove()
1244 prevp->nextp = portp->nextp; in vgen_port_list_remove()
1246 if (portp == plistp->tailp) in vgen_port_list_remove()
1255 vgen_port_t *portp = NULL; in vgen_port_lookup() local
1257 for (portp = plistp->headp; portp != NULL; portp = portp->nextp) { in vgen_port_lookup()
1258 if (portp->port_num == port_num) { in vgen_port_lookup()
1263 return (portp); in vgen_port_lookup()
1267 vgen_port_init(vgen_port_t *portp) in vgen_port_init() argument
1270 vgen_vlan_add_ids(portp); in vgen_port_init()
1273 (void) vgen_ldc_init(portp->ldcp); in vgen_port_init()
1277 vgen_port_uninit(vgen_port_t *portp) in vgen_port_uninit() argument
1279 vgen_ldc_uninit(portp->ldcp); in vgen_port_uninit()
1282 vgen_vlan_remove_ids(portp); in vgen_port_uninit()
1407 vgen_port_t *portp; in vgen_vlan_read_ids() local
1429 portp = (vgen_port_t *)arg; in vgen_vlan_read_ids()
1430 vgenp = portp->vgenp; in vgen_vlan_read_ids()
1434 inst = portp->port_num; in vgen_vlan_read_ids()
1493 vgen_vlan_create_hash(vgen_port_t *portp) in vgen_vlan_create_hash() argument
1498 portp->port_num); in vgen_vlan_create_hash()
1500 portp->vlan_nchains = vgen_vlan_nchains; in vgen_vlan_create_hash()
1501 portp->vlan_hashp = mod_hash_create_idhash(hashname, in vgen_vlan_create_hash()
1502 portp->vlan_nchains, mod_hash_null_valdtor); in vgen_vlan_create_hash()
1509 vgen_vlan_destroy_hash(vgen_port_t *portp) in vgen_vlan_destroy_hash() argument
1511 if (portp->vlan_hashp != NULL) { in vgen_vlan_destroy_hash()
1512 mod_hash_destroy_hash(portp->vlan_hashp); in vgen_vlan_destroy_hash()
1513 portp->vlan_hashp = NULL; in vgen_vlan_destroy_hash()
1514 portp->vlan_nchains = 0; in vgen_vlan_destroy_hash()
1522 vgen_vlan_add_ids(vgen_port_t *portp) in vgen_vlan_add_ids() argument
1527 rv = mod_hash_insert(portp->vlan_hashp, in vgen_vlan_add_ids()
1528 (mod_hash_key_t)VLAN_ID_KEY(portp->pvid), in vgen_vlan_add_ids()
1532 for (i = 0; i < portp->nvids; i++) { in vgen_vlan_add_ids()
1533 rv = mod_hash_insert(portp->vlan_hashp, in vgen_vlan_add_ids()
1534 (mod_hash_key_t)VLAN_ID_KEY(portp->vids[i]), in vgen_vlan_add_ids()
1544 vgen_vlan_remove_ids(vgen_port_t *portp) in vgen_vlan_remove_ids() argument
1550 rv = mod_hash_remove(portp->vlan_hashp, in vgen_vlan_remove_ids()
1551 (mod_hash_key_t)VLAN_ID_KEY(portp->pvid), in vgen_vlan_remove_ids()
1555 for (i = 0; i < portp->nvids; i++) { in vgen_vlan_remove_ids()
1556 rv = mod_hash_remove(portp->vlan_hashp, in vgen_vlan_remove_ids()
1557 (mod_hash_key_t)VLAN_ID_KEY(portp->vids[i]), in vgen_vlan_remove_ids()
2092 vgen_port_t *portp; in vgen_add_port() local
2095 portp = kmem_zalloc(sizeof (vgen_port_t), KM_SLEEP); in vgen_add_port()
2097 rv = vgen_port_read_props(portp, vgenp, mdp, mdex); in vgen_add_port()
2099 KMEM_FREE(portp); in vgen_add_port()
2103 rv = vgen_port_attach(portp); in vgen_add_port()
2113 vgen_port_read_props(vgen_port_t *portp, vgen_t *vgenp, md_t *mdp, in vgen_port_read_props() argument
2210 portp->is_vsw_port = B_TRUE; in vgen_port_read_props()
2212 portp->is_vsw_port = B_FALSE; in vgen_port_read_props()
2217 portp->vgenp = vgenp; in vgen_port_read_props()
2218 portp->port_num = port_num; in vgen_port_read_props()
2219 ether_copy(&ea, &portp->macaddr); in vgen_port_read_props()
2220 portp->ldc_ids = kmem_zalloc(sizeof (uint64_t) * num_ldcs, KM_SLEEP); in vgen_port_read_props()
2221 bcopy(ldc_ids, portp->ldc_ids, sizeof (uint64_t) * num_ldcs); in vgen_port_read_props()
2222 portp->num_ldcs = num_ldcs; in vgen_port_read_props()
2225 vgen_vlan_read_ids(portp, VGEN_PEER, mdp, mdex, &portp->pvid, in vgen_port_read_props()
2226 &portp->vids, &portp->nvids, NULL); in vgen_port_read_props()
2238 vgen_port_t *portp; in vgen_remove_port() local
2250 portp = vgen_port_lookup(plistp, (int)port_num); in vgen_remove_port()
2251 if (portp == NULL) { in vgen_remove_port()
2257 vgen_port_detach_mdeg(portp); in vgen_remove_port()
2265 vgen_port_attach(vgen_port_t *portp) in vgen_port_attach() argument
2274 ASSERT(portp != NULL); in vgen_port_attach()
2275 vgenp = portp->vgenp; in vgen_port_attach()
2276 ldcids = portp->ldc_ids; in vgen_port_attach()
2279 portp->port_num, ldcids[0]); in vgen_port_attach()
2281 mutex_init(&portp->lock, NULL, MUTEX_DRIVER, NULL); in vgen_port_attach()
2287 if (vgen_ldc_attach(portp, ldcids[0]) == DDI_FAILURE) { in vgen_port_attach()
2288 vgen_port_detach(portp); in vgen_port_attach()
2293 vgen_vlan_create_hash(portp); in vgen_port_attach()
2295 if (portp->is_vsw_port == B_TRUE) { in vgen_port_attach()
2297 (void) atomic_swap_32(&portp->use_vsw_port, B_FALSE); in vgen_port_attach()
2300 (void) atomic_swap_32(&portp->use_vsw_port, B_TRUE); in vgen_port_attach()
2305 vgen_port_detach(portp); in vgen_port_attach()
2309 macp->m_driver = portp; in vgen_port_attach()
2316 mutex_enter(&portp->lock); in vgen_port_attach()
2318 portp->macaddr, &portp->vhp, &portp->vcb); in vgen_port_attach()
2319 mutex_exit(&portp->lock); in vgen_port_attach()
2326 vgen_port_list_insert(portp); in vgen_port_attach()
2329 if (portp->is_vsw_port == B_TRUE) { in vgen_port_attach()
2331 vgenp->vsw_portp = portp; in vgen_port_attach()
2336 portp); in vgen_port_attach()
2337 vgen_port_detach(portp); in vgen_port_attach()
2340 DBG1(vgenp, NULL, "exit: port_num(%d)\n", portp->port_num); in vgen_port_attach()
2346 vgen_port_detach_mdeg(vgen_port_t *portp) in vgen_port_detach_mdeg() argument
2348 vgen_t *vgenp = portp->vgenp; in vgen_port_detach_mdeg()
2350 DBG1(vgenp, NULL, "enter: port_num(%d)\n", portp->port_num); in vgen_port_detach_mdeg()
2352 mutex_enter(&portp->lock); in vgen_port_detach_mdeg()
2355 if (portp->flags & VGEN_STARTED) { in vgen_port_detach_mdeg()
2356 vgen_port_uninit(portp); in vgen_port_detach_mdeg()
2357 portp->flags &= ~(VGEN_STARTED); in vgen_port_detach_mdeg()
2360 mutex_exit(&portp->lock); in vgen_port_detach_mdeg()
2361 vgen_port_detach(portp); in vgen_port_detach_mdeg()
2363 DBG1(vgenp, NULL, "exit: port_num(%d)\n", portp->port_num); in vgen_port_detach_mdeg()
2373 vgen_port_t *portp; in vgen_update_port() local
2399 portp = vgen_port_lookup(plistp, (int)cport_num); in vgen_update_port()
2400 if (portp == NULL) { in vgen_update_port()
2407 vgen_vlan_read_ids(portp, VGEN_PEER, curr_mdp, curr_mdex, &pvid, &vids, in vgen_update_port()
2411 if ((pvid != portp->pvid) || /* pvid changed? */ in vgen_update_port()
2412 (nvids != portp->nvids) || /* # of vids changed? */ in vgen_update_port()
2413 ((nvids != 0) && (portp->nvids != 0) && /* vids changed? */ in vgen_update_port()
2414 bcmp(vids, portp->vids, sizeof (uint16_t) * nvids))) { in vgen_update_port()
2424 vgen_vlan_remove_ids(portp); in vgen_update_port()
2427 portp->pvid = pvid; in vgen_update_port()
2428 if (portp->nvids != 0) { in vgen_update_port()
2429 kmem_free(portp->vids, sizeof (uint16_t) * portp->nvids); in vgen_update_port()
2430 portp->nvids = 0; in vgen_update_port()
2433 portp->vids = kmem_zalloc(sizeof (uint16_t) * nvids, KM_SLEEP); in vgen_update_port()
2434 bcopy(vids, portp->vids, sizeof (uint16_t) * nvids); in vgen_update_port()
2435 portp->nvids = nvids; in vgen_update_port()
2440 vgen_vlan_add_ids(portp); in vgen_update_port()
2443 vgen_vlan_unaware_port_reset(portp); in vgen_update_port()
2451 vgen_port_stat(vgen_port_t *portp, uint_t stat) in vgen_port_stat() argument
2453 return (vgen_ldc_stat(portp->ldcp, stat)); in vgen_port_stat()
2458 vgen_ldc_attach(vgen_port_t *portp, uint64_t ldc_id) in vgen_ldc_attach() argument
2472 vgenp = portp->vgenp; in vgen_ldc_attach()
2479 ldcp->portp = portp; in vgen_ldc_attach()
2536 portp->ldcp = ldcp; in vgen_ldc_attach()
2572 vgen_port_t *portp; in vgen_ldc_detach() local
2577 portp = ldcp->portp; in vgen_ldc_detach()
2578 vgenp = portp->vgenp; in vgen_ldc_detach()
2662 if (ldcp->portp != vgenp->vsw_portp) { in vgen_ldc_init()
2667 &ldcp->portp->use_vsw_port, B_FALSE); in vgen_ldc_init()
2950 if (ldcp->portp != vgenp->vsw_portp) { in vgen_handle_evt_up()
2954 (void) atomic_swap_32(&ldcp->portp->use_vsw_port, B_FALSE); in vgen_handle_evt_up()
3674 vgen_port_t *portp = ldcp->portp; in vgen_set_vnet_proto_ops() local
3682 if (portp == vgenp->vsw_portp && vnetp->pls_update == B_TRUE) { in vgen_set_vnet_proto_ops()
3702 vgen_port_t *portp = ldcp->portp; in vgen_set_vnet_proto_ops() local
3713 if (portp->nvids == 0 && portp->pvid == vnetp->pvid) { in vgen_set_vnet_proto_ops()
3769 vgen_vlan_unaware_port_reset(vgen_port_t *portp) in vgen_vlan_unaware_port_reset() argument
3771 vgen_ldc_t *ldcp = portp->ldcp; in vgen_vlan_unaware_port_reset()
3772 vgen_t *vgenp = portp->vgenp; in vgen_vlan_unaware_port_reset()
3783 (portp->nvids != 0 || portp->pvid != vnetp->pvid)) { in vgen_vlan_unaware_port_reset()
3794 vgen_port_reset(vgen_port_t *portp) in vgen_port_reset() argument
3796 (void) vgen_ldc_reset(portp->ldcp, VGEN_OTHER); in vgen_port_reset()
3802 vgen_port_t *portp; in vgen_reset_vlan_unaware_ports() local
3808 for (portp = plistp->headp; portp != NULL; portp = portp->nextp) { in vgen_reset_vlan_unaware_ports()
3810 vgen_vlan_unaware_port_reset(portp); in vgen_reset_vlan_unaware_ports()
3820 vgen_port_t *portp; in vgen_reset_vsw_port() local
3822 if ((portp = vgenp->vsw_portp) != NULL) { in vgen_reset_vsw_port()
3823 vgen_port_reset(portp); in vgen_reset_vsw_port()
3889 vgen_port_t *portp = ldcp->portp; in vgen_process_reset() local
3899 if (portp == vgenp->vsw_portp) { /* vswitch port ? */ in vgen_process_reset()
3909 vio_net_report_err_t rep_err = portp->vcb.vio_net_report_err; in vgen_process_reset()
3910 rep_err(portp->vhp, VIO_NET_RES_DOWN); in vgen_process_reset()
3982 (void) atomic_swap_32(&portp->use_vsw_port, B_TRUE); in vgen_process_reset()
4034 (void) atomic_swap_32(&portp->use_vsw_port, in vgen_process_reset()
4158 if (ldcp->portp == vgenp->vsw_portp) { in vgen_handshake()
4204 ldcp->portp->vcb.vio_net_tx_update; in vgen_handshake()
4207 vtx_update(ldcp->portp->vhp); in vgen_handshake()
4753 ldcp->portp == vgenp->vsw_portp) { in vgen_handle_attr_ack()
5189 if (ldcp->portp != vgenp->vsw_portp) { in vgen_handle_physlink_info()
5389 vrx_cb = ldcp->portp->vcb.vio_net_rx_cb; in vgen_handle_pkt_data()
5399 vrx_cb(ldcp->portp->vhp, mp); in vgen_handle_pkt_data()
5524 vgen_port_t *portp = (vgen_port_t *)arg; in vgen_enable_intr() local
5525 vgen_ldc_t *ldcp = portp->ldcp; in vgen_enable_intr()
5556 vgen_port_t *portp = (vgen_port_t *)arg; in vgen_disable_intr() local
5557 vgen_ldc_t *ldcp = portp->ldcp; in vgen_disable_intr()
5576 vgen_port_t *portp = (vgen_port_t *)arg; in vgen_rx_poll() local
5577 vgen_ldc_t *ldcp = portp->ldcp; in vgen_rx_poll()
5653 ldcp->portp->vcb.vio_net_tx_update; in vgen_tx_watchdog()
5656 vtx_update(ldcp->portp->vhp); in vgen_tx_watchdog()
5823 vgen_port_t *portp; in vgen_ioctl() local
5832 portp = (vgen_port_t *)arg; in vgen_ioctl()
5834 if (portp == NULL) { in vgen_ioctl()
5839 mutex_enter(&portp->lock); in vgen_ioctl()
5845 rv = vgen_force_link_state(portp, iocp->ioc_cmd); in vgen_ioctl()
5855 mutex_exit(&portp->lock); in vgen_ioctl()
5873 vgen_force_link_state(vgen_port_t *portp, int cmd) in vgen_force_link_state() argument
5877 vgen_ldc_t *ldcp = portp->ldcp; in vgen_force_link_state()
5878 vgen_t *vgenp = portp->vgenp; in vgen_force_link_state()
5917 vgen_port_t *portp; in vgen_ioctl() local
5919 portp = (vgen_port_t *)arg; in vgen_ioctl()
5921 if (portp == NULL) { in vgen_ioctl()