Lines Matching full:port

59 	struct sfxge_port *port = &sc->port;  in sfxge_mac_stat_update()  local
60 efsys_mem_t *esmp = &(port->mac_stats.dma_buf); in sfxge_mac_stat_update()
66 SFXGE_PORT_LOCK_ASSERT_OWNED(port); in sfxge_mac_stat_update()
68 if (__predict_false(port->init_state != SFXGE_PORT_STARTED)) { in sfxge_mac_stat_update()
73 min_ticks = (unsigned int)hz * port->stats_update_period_ms / 1000; in sfxge_mac_stat_update()
76 if ((unsigned int)(now - port->mac_stats.update_time) < min_ticks) { in sfxge_mac_stat_update()
81 port->mac_stats.update_time = now; in sfxge_mac_stat_update()
90 port->mac_stats.decode_buf, NULL)) != EAGAIN) in sfxge_mac_stat_update()
108 SFXGE_PORT_LOCK(&sc->port); in sfxge_get_counter()
113 mac_stats = (uint64_t *)sc->port.mac_stats.decode_buf; in sfxge_get_counter()
145 SFXGE_PORT_UNLOCK(&sc->port); in sfxge_get_counter()
154 SFXGE_PORT_UNLOCK(&sc->port); in sfxge_get_counter()
158 SFXGE_PORT_UNLOCK(&sc->port); in sfxge_get_counter()
171 SFXGE_PORT_LOCK(&sc->port); in sfxge_mac_stat_handler()
173 val = ((uint64_t *)sc->port.mac_stats.decode_buf)[id]; in sfxge_mac_stat_handler()
174 SFXGE_PORT_UNLOCK(&sc->port); in sfxge_mac_stat_handler()
228 return (sc->port.wanted_fc); in sfxge_port_wanted_fc()
241 struct sfxge_port *port; in sfxge_port_wanted_fc_handler() local
246 port = &sc->port; in sfxge_port_wanted_fc_handler()
252 SFXGE_PORT_LOCK(port); in sfxge_port_wanted_fc_handler()
254 if (port->wanted_fc != fcntl) { in sfxge_port_wanted_fc_handler()
255 if (port->init_state == SFXGE_PORT_STARTED) in sfxge_port_wanted_fc_handler()
257 port->wanted_fc, in sfxge_port_wanted_fc_handler()
260 port->wanted_fc = fcntl; in sfxge_port_wanted_fc_handler()
263 SFXGE_PORT_UNLOCK(port); in sfxge_port_wanted_fc_handler()
265 SFXGE_PORT_LOCK(port); in sfxge_port_wanted_fc_handler()
266 fcntl = port->wanted_fc; in sfxge_port_wanted_fc_handler()
267 SFXGE_PORT_UNLOCK(port); in sfxge_port_wanted_fc_handler()
279 struct sfxge_port *port; in sfxge_port_link_fc_handler() local
283 port = &sc->port; in sfxge_port_link_fc_handler()
285 SFXGE_PORT_LOCK(port); in sfxge_port_link_fc_handler()
286 if (__predict_true(port->init_state == SFXGE_PORT_STARTED) && in sfxge_port_link_fc_handler()
291 SFXGE_PORT_UNLOCK(port); in sfxge_port_link_fc_handler()
315 struct sfxge_port *port; in sfxge_mac_link_update() local
318 port = &sc->port; in sfxge_mac_link_update()
320 if (port->link_mode == mode) in sfxge_mac_link_update()
323 port->link_mode = mode; in sfxge_mac_link_update()
327 if_setbaudrate(sc->ifnet, sfxge_link_baudrate[port->link_mode]); in sfxge_mac_link_update()
336 struct sfxge_port *port; in sfxge_mac_poll_work() local
341 port = &sc->port; in sfxge_mac_poll_work()
343 SFXGE_PORT_LOCK(port); in sfxge_mac_poll_work()
345 if (__predict_false(port->init_state != SFXGE_PORT_STARTED)) in sfxge_mac_poll_work()
353 SFXGE_PORT_UNLOCK(port); in sfxge_mac_poll_work()
374 struct sfxge_port *port = &sc->port; in sfxge_mac_multicast_list_set() local
377 mtx_assert(&port->lock, MA_OWNED); in sfxge_mac_multicast_list_set()
379 port->mcast_count = if_foreach_llmaddr(ifp, sfxge_copy_maddr, in sfxge_mac_multicast_list_set()
380 port->mcast_addrs); in sfxge_mac_multicast_list_set()
381 if (port->mcast_count == EFX_MAC_MULTICAST_LIST_MAX) { in sfxge_mac_multicast_list_set()
387 rc = efx_mac_multicast_list_set(sc->enp, port->mcast_addrs, in sfxge_mac_multicast_list_set()
388 port->mcast_count); in sfxge_mac_multicast_list_set()
401 struct sfxge_port *port = &sc->port; in sfxge_mac_filter_set_locked() local
405 mtx_assert(&port->lock, MA_OWNED); in sfxge_mac_filter_set_locked()
415 (port->mcast_count > 0), all_mulcst, B_TRUE); in sfxge_mac_filter_set_locked()
423 struct sfxge_port *port = &sc->port; in sfxge_mac_filter_set() local
426 SFXGE_PORT_LOCK(port); in sfxge_mac_filter_set()
430 * checks IFF_DRV_RUNNING flag which implies port started, but in sfxge_mac_filter_set()
437 if (__predict_true(port->init_state == SFXGE_PORT_STARTED)) in sfxge_mac_filter_set()
441 SFXGE_PORT_UNLOCK(port); in sfxge_mac_filter_set()
448 struct sfxge_port *port; in sfxge_port_stop() local
451 port = &sc->port; in sfxge_port_stop()
454 SFXGE_PORT_LOCK(port); in sfxge_port_stop()
456 KASSERT(port->init_state == SFXGE_PORT_STARTED, in sfxge_port_stop()
457 ("port not started")); in sfxge_port_stop()
459 port->init_state = SFXGE_PORT_INITIALIZED; in sfxge_port_stop()
461 port->mac_stats.update_time = 0; in sfxge_port_stop()
466 (void)efx_mac_stats_periodic(enp, &port->mac_stats.dma_buf, 0, B_FALSE); in sfxge_port_stop()
468 port->link_mode = EFX_LINK_UNKNOWN; in sfxge_port_stop()
470 /* Destroy the common code port object. */ in sfxge_port_stop()
475 SFXGE_PORT_UNLOCK(port); in sfxge_port_stop()
484 struct sfxge_port *port; in sfxge_port_start() local
490 port = &sc->port; in sfxge_port_start()
493 SFXGE_PORT_LOCK(port); in sfxge_port_start()
495 KASSERT(port->init_state == SFXGE_PORT_INITIALIZED, in sfxge_port_start()
496 ("port not initialized")); in sfxge_port_start()
502 /* Initialize the port object in the common code. */ in sfxge_port_start()
525 if ((rc = efx_mac_stats_periodic(enp, &port->mac_stats.dma_buf, in sfxge_port_start()
526 port->stats_update_period_ms, in sfxge_port_start()
540 port->init_state = SFXGE_PORT_STARTED; in sfxge_port_start()
543 SFXGE_PORT_UNLOCK(port); in sfxge_port_start()
552 (void)efx_mac_stats_periodic(enp, &port->mac_stats.dma_buf, 0, B_FALSE); in sfxge_port_start()
562 SFXGE_PORT_UNLOCK(port); in sfxge_port_start()
570 struct sfxge_port *port = &sc->port; in sfxge_phy_stat_update() local
571 efsys_mem_t *esmp = &port->phy_stats.dma_buf; in sfxge_phy_stat_update()
576 SFXGE_PORT_LOCK_ASSERT_OWNED(port); in sfxge_phy_stat_update()
578 if (__predict_false(port->init_state != SFXGE_PORT_STARTED)) { in sfxge_phy_stat_update()
584 if ((unsigned int)(now - port->phy_stats.update_time) < (unsigned int)hz) { in sfxge_phy_stat_update()
589 port->phy_stats.update_time = now; in sfxge_phy_stat_update()
602 port->phy_stats.decode_buf)) != EAGAIN) in sfxge_phy_stat_update()
621 SFXGE_PORT_LOCK(&sc->port); in sfxge_phy_stat_handler()
623 val = ((uint32_t *)sc->port.phy_stats.decode_buf)[id]; in sfxge_phy_stat_handler()
624 SFXGE_PORT_UNLOCK(&sc->port); in sfxge_phy_stat_handler()
657 struct sfxge_port *port; in sfxge_port_fini() local
660 port = &sc->port; in sfxge_port_fini()
661 esmp = &port->mac_stats.dma_buf; in sfxge_port_fini()
663 KASSERT(port->init_state == SFXGE_PORT_INITIALIZED, in sfxge_port_fini()
664 ("Port not initialized")); in sfxge_port_fini()
666 port->init_state = SFXGE_PORT_UNINITIALIZED; in sfxge_port_fini()
668 port->link_mode = EFX_LINK_UNKNOWN; in sfxge_port_fini()
671 sfxge_dma_free(&port->phy_stats.dma_buf); in sfxge_port_fini()
672 free(port->phy_stats.decode_buf, M_SFXGE); in sfxge_port_fini()
675 free(port->mac_stats.decode_buf, M_SFXGE); in sfxge_port_fini()
677 SFXGE_PORT_LOCK_DESTROY(port); in sfxge_port_fini()
679 port->sc = NULL; in sfxge_port_fini()
706 struct sfxge_port *port; in sfxge_port_stats_update_period_ms_handler() local
711 port = &sc->port; in sfxge_port_stats_update_period_ms_handler()
721 SFXGE_PORT_LOCK(port); in sfxge_port_stats_update_period_ms_handler()
723 if (port->stats_update_period_ms != period_ms) { in sfxge_port_stats_update_period_ms_handler()
724 if (port->init_state == SFXGE_PORT_STARTED) in sfxge_port_stats_update_period_ms_handler()
726 &port->mac_stats.dma_buf, in sfxge_port_stats_update_period_ms_handler()
729 port->stats_update_period_ms = period_ms; in sfxge_port_stats_update_period_ms_handler()
732 SFXGE_PORT_UNLOCK(port); in sfxge_port_stats_update_period_ms_handler()
734 SFXGE_PORT_LOCK(port); in sfxge_port_stats_update_period_ms_handler()
735 period_ms = port->stats_update_period_ms; in sfxge_port_stats_update_period_ms_handler()
736 SFXGE_PORT_UNLOCK(port); in sfxge_port_stats_update_period_ms_handler()
747 struct sfxge_port *port; in sfxge_port_init() local
755 port = &sc->port; in sfxge_port_init()
756 mac_stats_buf = &port->mac_stats.dma_buf; in sfxge_port_init()
757 phy_stats_buf = &port->phy_stats.dma_buf; in sfxge_port_init()
759 KASSERT(port->init_state == SFXGE_PORT_UNINITIALIZED, in sfxge_port_init()
760 ("Port already initialized")); in sfxge_port_init()
762 port->sc = sc; in sfxge_port_init()
764 SFXGE_PORT_LOCK_INIT(port, device_get_nameunit(sc->dev)); in sfxge_port_init()
767 port->phy_stats.decode_buf = malloc(EFX_PHY_NSTATS * sizeof(uint32_t), in sfxge_port_init()
780 port->wanted_fc = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE; in sfxge_port_init()
790 port->mac_stats.decode_buf = malloc(EFX_MAC_NSTATS * sizeof(uint64_t), in sfxge_port_init()
797 port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc); in sfxge_port_init()
806 port->init_state = SFXGE_PORT_INITIALIZED; in sfxge_port_init()
812 free(port->mac_stats.decode_buf, M_SFXGE); in sfxge_port_init()
815 free(port->phy_stats.decode_buf, M_SFXGE); in sfxge_port_init()
816 SFXGE_PORT_LOCK_DESTROY(port); in sfxge_port_init()
817 port->sc = NULL; in sfxge_port_init()
875 mode = sc->port.link_mode; in sfxge_media_status()
1016 * We need port state to initialise the ifmedia list. in sfxge_port_ifmedia_init()
1088 /* Now discard port state until interface is started. */ in sfxge_port_ifmedia_init()