Lines Matching refs:port

72 	aggr_port_t *port = buf;  in aggr_port_destructor()  local
74 ASSERT3P(port->lp_mnh, ==, NULL); in aggr_port_destructor()
75 ASSERT(!port->lp_tx_grp_added); in aggr_port_destructor()
77 ASSERT3P(port->lp_hwghs[i], ==, NULL); in aggr_port_destructor()
110 aggr_port_init_callbacks(aggr_port_t *port) in aggr_port_init_callbacks() argument
113 port->lp_mnh = mac_notify_add(port->lp_mh, aggr_port_notify_cb, port); in aggr_port_init_callbacks()
128 aggr_grp_port_hold(port); in aggr_port_init_callbacks()
138 aggr_port_t *port; in aggr_port_create() local
215 port = kmem_cache_alloc(aggr_port_cache, KM_SLEEP); in aggr_port_create()
217 port->lp_refs = 1; in aggr_port_create()
218 port->lp_next = NULL; in aggr_port_create()
219 port->lp_mh = mh; in aggr_port_create()
220 port->lp_mch = mch; in aggr_port_create()
221 port->lp_mip = mip; in aggr_port_create()
222 port->lp_linkid = linkid; in aggr_port_create()
223 port->lp_closing = B_FALSE; in aggr_port_create()
224 port->lp_mah = mah; in aggr_port_create()
227 mac_unicast_primary_get(port->lp_mh, port->lp_addr); in aggr_port_create()
230 port->lp_state = AGGR_PORT_STATE_STANDBY; in aggr_port_create()
231 port->lp_link_state = LINK_STATE_UNKNOWN; in aggr_port_create()
232 port->lp_ifspeed = 0; in aggr_port_create()
233 port->lp_link_duplex = LINK_DUPLEX_UNKNOWN; in aggr_port_create()
234 port->lp_started = B_FALSE; in aggr_port_create()
235 port->lp_tx_enabled = B_FALSE; in aggr_port_create()
236 port->lp_promisc_on = B_FALSE; in aggr_port_create()
237 port->lp_no_link_update = no_link_update; in aggr_port_create()
238 port->lp_portid = portid; in aggr_port_create()
239 port->lp_margin = margin; in aggr_port_create()
240 port->lp_prom_addr = NULL; in aggr_port_create()
248 port->lp_stat[i] = in aggr_port_create()
249 aggr_port_stat(port, i + MAC_STAT_MIN); in aggr_port_create()
252 port->lp_ether_stat[i] = in aggr_port_create()
253 aggr_port_stat(port, i + MACTYPE_STAT_MIN); in aggr_port_create()
257 port->lp_collector_enabled = B_FALSE; in aggr_port_create()
259 *pp = port; in aggr_port_create()
271 aggr_port_delete(aggr_port_t *port) in aggr_port_delete() argument
273 aggr_lacp_port_t *pl = &port->lp_lacp; in aggr_port_delete()
275 ASSERT(!port->lp_promisc_on); in aggr_port_delete()
276 port->lp_closing = B_TRUE; in aggr_port_delete()
277 VERIFY0(mac_margin_remove(port->lp_mh, port->lp_margin)); in aggr_port_delete()
278 mac_client_clear_flow_cb(port->lp_mch); in aggr_port_delete()
286 if ((port->lp_mnh != NULL) && in aggr_port_delete()
287 (mac_notify_remove(port->lp_mnh, B_FALSE) == 0)) { in aggr_port_delete()
288 aggr_grp_port_rele(port); in aggr_port_delete()
290 port->lp_mnh = NULL; in aggr_port_delete()
309 (void) mac_unicast_primary_set(port->lp_mh, port->lp_addr); in aggr_port_delete()
311 if (port->lp_mah != NULL) in aggr_port_delete()
312 (void) mac_unicast_remove(port->lp_mch, port->lp_mah); in aggr_port_delete()
314 mac_client_close(port->lp_mch, MAC_CLOSE_FLAGS_EXCLUSIVE); in aggr_port_delete()
315 mac_close(port->lp_mh); in aggr_port_delete()
316 AGGR_PORT_REFRELE(port); in aggr_port_delete()
320 aggr_port_free(aggr_port_t *port) in aggr_port_free() argument
322 ASSERT(port->lp_refs == 0); in aggr_port_free()
323 if (port->lp_grp != NULL) in aggr_port_free()
324 AGGR_GRP_REFRELE(port->lp_grp); in aggr_port_free()
325 port->lp_grp = NULL; in aggr_port_free()
326 id_free(aggr_portids, port->lp_portid); in aggr_port_free()
327 port->lp_portid = 0; in aggr_port_free()
328 mutex_destroy(&port->lp_lacp.lacp_timer_lock); in aggr_port_free()
329 cv_destroy(&port->lp_lacp.lacp_timer_cv); in aggr_port_free()
330 kmem_cache_free(aggr_port_cache, port); in aggr_port_free()
338 aggr_port_notify_link(aggr_grp_t *grp, aggr_port_t *port) in aggr_port_notify_link() argument
349 mac_perim_enter_by_mh(port->lp_mh, &mph); in aggr_port_notify_link()
355 link_state = port->lp_no_link_update ? LINK_STATE_UP : in aggr_port_notify_link()
356 mac_link_get(port->lp_mh); in aggr_port_notify_link()
357 if (port->lp_link_state != link_state) { in aggr_port_notify_link()
359 do_attach = (port->lp_link_state != LINK_STATE_UP); in aggr_port_notify_link()
361 do_detach = (port->lp_link_state == LINK_STATE_UP); in aggr_port_notify_link()
363 port->lp_link_state = link_state; in aggr_port_notify_link()
366 link_duplex = aggr_port_stat(port, ETHER_STAT_LINK_DUPLEX); in aggr_port_notify_link()
367 if (port->lp_link_duplex != link_duplex) { in aggr_port_notify_link()
369 do_attach |= (port->lp_link_duplex != LINK_DUPLEX_FULL); in aggr_port_notify_link()
371 do_detach |= (port->lp_link_duplex == LINK_DUPLEX_FULL); in aggr_port_notify_link()
373 port->lp_link_duplex = link_duplex; in aggr_port_notify_link()
376 ifspeed = aggr_port_stat(port, MAC_STAT_IFSPEED); in aggr_port_notify_link()
377 if (port->lp_ifspeed != ifspeed) { in aggr_port_notify_link()
380 if (port->lp_state == AGGR_PORT_STATE_ATTACHED) in aggr_port_notify_link()
387 port->lp_ifspeed = ifspeed; in aggr_port_notify_link()
391 link_state_changed = aggr_grp_attach_port(grp, port); in aggr_port_notify_link()
394 link_state_changed = aggr_grp_detach_port(grp, port); in aggr_port_notify_link()
406 aggr_port_notify_unicst(aggr_grp_t *grp, aggr_port_t *port, in aggr_port_notify_unicst() argument
417 mac_perim_enter_by_mh(port->lp_mh, &mph); in aggr_port_notify_unicst()
423 mac_unicast_primary_get(port->lp_mh, mac_addr); in aggr_port_notify_unicst()
430 bcopy(mac_addr, port->lp_addr, ETHERADDRL); in aggr_port_notify_unicst()
432 aggr_grp_port_mac_changed(grp, port, &mac_addr_changed, in aggr_port_notify_unicst()
457 aggr_port_t *port = arg; in aggr_port_notify_cb() local
458 aggr_grp_t *grp = port->lp_grp; in aggr_port_notify_cb()
463 if (port->lp_closing) { in aggr_port_notify_cb()
470 aggr_grp_port_rele(port); in aggr_port_notify_cb()
479 if (aggr_port_notify_link(grp, port)) in aggr_port_notify_cb()
483 aggr_port_notify_unicst(grp, port, &mac_addr_changed, in aggr_port_notify_cb()
498 aggr_port_start(aggr_port_t *port) in aggr_port_start() argument
500 ASSERT(MAC_PERIM_HELD(port->lp_mh)); in aggr_port_start()
502 if (port->lp_started) in aggr_port_start()
505 port->lp_started = B_TRUE; in aggr_port_start()
506 aggr_grp_multicst_port(port, B_TRUE); in aggr_port_start()
511 aggr_port_stop(aggr_port_t *port) in aggr_port_stop() argument
513 ASSERT(MAC_PERIM_HELD(port->lp_mh)); in aggr_port_stop()
515 if (!port->lp_started) in aggr_port_stop()
518 aggr_grp_multicst_port(port, B_FALSE); in aggr_port_stop()
521 port->lp_started = B_FALSE; in aggr_port_stop()
529 aggr_port_promisc(aggr_port_t *port, boolean_t on) in aggr_port_promisc() argument
533 ASSERT(MAC_PERIM_HELD(port->lp_mh)); in aggr_port_promisc()
535 if (on == port->lp_promisc_on) in aggr_port_promisc()
538 rc = mac_set_promisc(port->lp_mh, on); in aggr_port_promisc()
541 port->lp_promisc_on = on; in aggr_port_promisc()
550 aggr_port_unicst(aggr_port_t *port) in aggr_port_unicst() argument
552 aggr_grp_t *grp = port->lp_grp; in aggr_port_unicst()
555 ASSERT(MAC_PERIM_HELD(port->lp_mh)); in aggr_port_unicst()
557 return (mac_unicast_primary_set(port->lp_mh, grp->lg_addr)); in aggr_port_unicst()
566 aggr_port_t *port = arg; in aggr_port_multicst() local
569 return (mac_multicast_add(port->lp_mch, addrp)); in aggr_port_multicst()
571 mac_multicast_remove(port->lp_mch, addrp); in aggr_port_multicst()
577 aggr_port_stat(aggr_port_t *port, uint_t stat) in aggr_port_stat() argument
579 return (mac_stat_get(port->lp_mh, stat)); in aggr_port_stat()
589 aggr_port_addmac(aggr_port_t *port, uint_t idx, const uint8_t *mac_addr) in aggr_port_addmac() argument
595 ASSERT(MAC_PERIM_HELD(port->lp_grp->lg_mh)); in aggr_port_addmac()
597 mac_perim_enter_by_mh(port->lp_mh, &pmph); in aggr_port_addmac()
605 if (port->lp_hwghs[idx] == NULL) in aggr_port_addmac()
612 if ((port->lp_hwghs[idx] != NULL) && in aggr_port_addmac()
613 ((mac_hwgroup_addmac(port->lp_hwghs[idx], mac_addr)) == 0)) { in aggr_port_addmac()
623 if (port->lp_started && in aggr_port_addmac()
624 ((err = aggr_port_promisc(port, B_TRUE)) != 0)) { in aggr_port_addmac()
633 pprev = &port->lp_prom_addr; in aggr_port_addmac()
653 aggr_port_remmac(aggr_port_t *port, uint_t idx, const uint8_t *mac_addr) in aggr_port_remmac() argument
655 aggr_grp_t *grp = port->lp_grp; in aggr_port_remmac()
661 mac_perim_enter_by_mh(port->lp_mh, &pmph); in aggr_port_remmac()
667 pprev = &port->lp_prom_addr; in aggr_port_remmac()
683 if (port->lp_prom_addr == NULL && !grp->lg_promisc) in aggr_port_remmac()
684 (void) aggr_port_promisc(port, B_FALSE); in aggr_port_remmac()
687 if (port->lp_hwghs[idx] == NULL) in aggr_port_remmac()
690 ASSERT3P(port->lp_hwghs[idx], !=, NULL); in aggr_port_remmac()
691 (void) mac_hwgroup_remmac(port->lp_hwghs[idx], mac_addr); in aggr_port_remmac()
698 aggr_port_addvlan(aggr_port_t *port, uint_t idx, uint16_t vid) in aggr_port_addvlan() argument
703 ASSERT(MAC_PERIM_HELD(port->lp_grp->lg_mh)); in aggr_port_addvlan()
705 mac_perim_enter_by_mh(port->lp_mh, &pmph); in aggr_port_addvlan()
708 if (port->lp_hwghs[idx] == NULL) in aggr_port_addvlan()
717 if (port->lp_hwghs[idx] == NULL) in aggr_port_addvlan()
720 err = mac_hwgroup_addvlan(port->lp_hwghs[idx], vid); in aggr_port_addvlan()
727 aggr_port_remvlan(aggr_port_t *port, uint_t idx, uint16_t vid) in aggr_port_remvlan() argument
732 ASSERT(MAC_PERIM_HELD(port->lp_grp->lg_mh)); in aggr_port_remvlan()
734 mac_perim_enter_by_mh(port->lp_mh, &pmph); in aggr_port_remvlan()
737 if (port->lp_hwghs[idx] == NULL) in aggr_port_remvlan()
740 if (port->lp_hwghs[idx] == NULL) in aggr_port_remvlan()
743 err = mac_hwgroup_remvlan(port->lp_hwghs[idx], vid); in aggr_port_remvlan()