Lines Matching defs:smp

75 _sfxge_mac_stat_update(sfxge_mac_t *smp, int tries, int delay_usec)
77 sfxge_t *sp = smp->sm_sp;
78 efsys_mem_t *esmp = &(smp->sm_mem);
81 ASSERT(mutex_owned(&(smp->sm_lock)));
82 ASSERT3U(smp->sm_state, !=, SFXGE_MAC_UNINITIALIZED);
85 if (smp->sm_mac_stats_timer_reqd && !smp->sm_mac_stats_pend)
90 if (efx_mac_stats_update(sp->s_enp, esmp, smp->sm_stat,
102 smp->sm_mac_stats_pend = B_FALSE;
103 smp->sm_lbolt = ddi_get_lbolt();
107 sfxge_mac_stat_update_quick(sfxge_mac_t *smp)
114 _sfxge_mac_stat_update(smp, 2, 50);
118 sfxge_mac_stat_update_wait(sfxge_mac_t *smp)
121 _sfxge_mac_stat_update(smp, 20, 500);
127 sfxge_mac_t *smp = ksp->ks_private;
138 ASSERT(mutex_owned(&(smp->sm_lock)));
140 if (smp->sm_state != SFXGE_MAC_STARTED)
143 sfxge_mac_stat_update_quick(smp);
145 knp = smp->sm_stat;
148 knp->value.ui64 = (smp->sm_link_up) ? 1 : 0;
151 knp->value.ui64 = smp->sm_link_speed;
154 knp->value.ui64 = smp->sm_link_duplex;
157 knp->value.ui64 = (smp->sm_fcntl & EFX_FCNTL_GENERATE) ? 1 : 0;
160 knp->value.ui64 = (smp->sm_fcntl & EFX_FCNTL_RESPOND) ? 1 : 0;
163 sfxge_ev_moderation_get(smp->sm_sp, &val);
167 sfxge_rx_coalesce_mode_get(smp->sm_sp, &rxmode);
171 if (sfxge_rx_scale_count_get(smp->sm_sp, &val) != 0)
188 sfxge_mac_t *smp = &(sp->s_mac);
206 smp->sm_ksp = ksp;
209 ksp->ks_private = smp;
210 ksp->ks_lock = &(smp->sm_lock);
213 smp->sm_stat = knp = ksp->ks_data;
242 sfxge_mac_t *smp = &(sp->s_mac);
245 kstat_delete(smp->sm_ksp);
246 smp->sm_ksp = NULL;
247 smp->sm_stat = NULL;
253 sfxge_mac_t *smp = &(sp->s_mac);
256 mutex_enter(&(smp->sm_lock));
258 if (smp->sm_state != SFXGE_MAC_STARTED)
261 sfxge_mac_stat_update_quick(smp);
263 *valp = smp->sm_stat[id].value.ui64;
266 mutex_exit(&(smp->sm_lock));
274 sfxge_mac_t *smp = &(sp->s_mac);
275 efsys_mem_t *esmp = &(smp->sm_mem);
279 mutex_enter(&(smp->sm_lock));
280 while (smp->sm_state == SFXGE_MAC_STARTED) {
282 /* clears smp->sm_mac_stats_pend if appropriate */
283 if (smp->sm_mac_stats_pend)
284 sfxge_mac_stat_update_wait(smp);
291 if ((smp->sm_link_poll_reqd == B_FALSE) &&
292 (smp->sm_mac_stats_timer_reqd == B_FALSE))
299 if (smp->sm_link_up &&
301 smp->sm_mac_stats_pend = B_TRUE;
306 while (smp->sm_state == SFXGE_MAC_STARTED) {
307 if (cv_timedwait(&(smp->sm_link_poll_kv),
308 &(smp->sm_lock), timeout) < 0) {
315 mutex_exit(&(smp->sm_lock));
322 sfxge_mac_t *smp = &(sp->s_mac);
324 ASSERT(mutex_owned(&(smp->sm_lock)));
325 ASSERT3U(smp->sm_state, ==, SFXGE_MAC_STARTED);
328 (void) ddi_taskq_dispatch(smp->sm_tqp, sfxge_mac_poll, sp, DDI_SLEEP);
334 sfxge_mac_t *smp = &(sp->s_mac);
336 ASSERT(mutex_owned(&(smp->sm_lock)));
337 ASSERT3U(smp->sm_state, ==, SFXGE_MAC_INITIALIZED);
339 cv_broadcast(&(smp->sm_link_poll_kv));
342 mutex_exit(&(smp->sm_lock));
343 ddi_taskq_wait(smp->sm_tqp);
344 mutex_enter(&(smp->sm_lock));
347 sfxge_mac_stat_update_wait(smp);
353 sfxge_mac_t *smp = &(sp->s_mac);
354 efsys_mem_t *esmp = &(smp->sm_mem);
362 SFXGE_OBJ_CHECK(smp, sfxge_mac_t);
364 ASSERT3U(smp->sm_state, ==, SFXGE_MAC_UNINITIALIZED);
366 smp->sm_sp = sp;
368 smp->sm_link_poll_reqd = (~encp->enc_features &
370 smp->sm_mac_stats_timer_reqd = (~encp->enc_features &
373 mutex_init(&(smp->sm_lock), NULL, MUTEX_DRIVER,
375 cv_init(&(smp->sm_link_poll_kv), NULL, CV_DRIVER, NULL);
378 smp->sm_tqp = ddi_taskq_create(dip, "mac_tq", 1, TASKQ_DEFAULTPRI, 0);
379 if (smp->sm_tqp == NULL) {
401 smp->sm_fcntl = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE;
416 bcopy(bytes, smp->sm_bia, ETHERADDRL);
428 bcopy(encp->enc_mac_addr, smp->sm_bia, ETHERADDRL);
438 smp->sm_state = SFXGE_MAC_INITIALIZED;
459 ddi_taskq_destroy(smp->sm_tqp);
460 smp->sm_tqp = NULL;
465 cv_destroy(&(smp->sm_link_poll_kv));
467 mutex_destroy(&(smp->sm_lock));
469 smp->sm_sp = NULL;
478 sfxge_mac_t *smp = &(sp->s_mac);
481 ASSERT(mutex_owned(&(smp->sm_lock)));
483 if (smp->sm_state == SFXGE_MAC_STARTED) {
489 all_unicst = (smp->sm_promisc == SFXGE_PROMISC_ALL_PHYS);
490 mulcst = (smp->sm_mcast_count > 0);
491 all_mulcst = (smp->sm_promisc >= SFXGE_PROMISC_ALL_MULTI);
499 smp->sm_mcast_addr, smp->sm_mcast_count)) != 0)
516 sfxge_mac_t *smp = &(sp->s_mac);
517 efsys_mem_t *esmp = &(smp->sm_mem);
522 mutex_enter(&(smp->sm_lock));
524 ASSERT3U(smp->sm_state, ==, SFXGE_MAC_INITIALIZED);
541 if ((rc = efx_mac_fcntl_set(enp, smp->sm_fcntl, B_TRUE)) != 0)
545 if ((rc = efx_mac_addr_set(enp, (smp->sm_laa_valid) ?
546 smp->sm_laa : smp->sm_bia)) != 0)
552 if (!smp->sm_mac_stats_timer_reqd) {
561 smp->sm_state = SFXGE_MAC_STARTED;
569 mutex_exit(&(smp->sm_lock));
591 mutex_exit(&(smp->sm_lock));
600 sfxge_mac_t *smp = &(sp->s_mac);
604 ASSERT(mutex_owned(&(smp->sm_lock)));
605 if (smp->sm_state != SFXGE_MAC_STARTED)
608 if (smp->sm_link_mode == mode)
611 smp->sm_link_mode = mode;
612 smp->sm_link_up = B_TRUE;
614 switch (smp->sm_link_mode) {
617 smp->sm_link_speed = 0;
618 smp->sm_link_duplex = SFXGE_LINK_DUPLEX_UNKNOWN;
619 smp->sm_link_up = B_FALSE;
624 smp->sm_link_speed = 10;
625 smp->sm_link_duplex = (smp->sm_link_mode == EFX_LINK_10HDX) ?
631 smp->sm_link_speed = 100;
632 smp->sm_link_duplex = (smp->sm_link_mode == EFX_LINK_100HDX) ?
638 smp->sm_link_speed = 1000;
639 smp->sm_link_duplex = (smp->sm_link_mode == EFX_LINK_1000HDX) ?
644 smp->sm_link_speed = 10000;
645 smp->sm_link_duplex = SFXGE_LINK_DUPLEX_FULL;
649 smp->sm_link_speed = 40000;
650 smp->sm_link_duplex = SFXGE_LINK_DUPLEX_FULL;
658 duplex = (smp->sm_link_duplex == SFXGE_LINK_DUPLEX_FULL) ?
660 change = (smp->sm_link_up) ? "UP" : "DOWN";
662 smp->sm_link_speed, duplex);
665 change, smp->sm_link_up ? info : "");
674 sfxge_mac_t *smp = &(sp->s_mac);
676 mutex_enter(&(smp->sm_lock));
678 mutex_exit(&(smp->sm_lock));
684 sfxge_mac_t *smp = &(sp->s_mac);
686 mutex_enter(&(smp->sm_lock));
687 *upp = smp->sm_link_up;
688 mutex_exit(&(smp->sm_lock));
694 sfxge_mac_t *smp = &(sp->s_mac);
696 mutex_enter(&(smp->sm_lock));
697 *speedp = smp->sm_link_speed;
698 mutex_exit(&(smp->sm_lock));
704 sfxge_mac_t *smp = &(sp->s_mac);
706 mutex_enter(&(smp->sm_lock));
707 *duplexp = smp->sm_link_duplex;
708 mutex_exit(&(smp->sm_lock));
714 sfxge_mac_t *smp = &(sp->s_mac);
716 mutex_enter(&(smp->sm_lock));
717 *fcntlp = smp->sm_fcntl;
718 mutex_exit(&(smp->sm_lock));
724 sfxge_mac_t *smp = &(sp->s_mac);
727 mutex_enter(&(smp->sm_lock));
729 if (smp->sm_fcntl == fcntl)
732 smp->sm_fcntl = fcntl;
734 if (smp->sm_state != SFXGE_MAC_STARTED)
737 if ((rc = efx_mac_fcntl_set(sp->s_enp, smp->sm_fcntl, B_TRUE)) != 0)
741 mutex_exit(&(smp->sm_lock));
748 mutex_exit(&(smp->sm_lock));
756 sfxge_mac_t *smp = &(sp->s_mac);
764 mutex_enter(&(smp->sm_lock));
766 if (smp->sm_state != SFXGE_MAC_INITIALIZED &&
767 smp->sm_state != SFXGE_MAC_STARTED) {
774 bcopy(smp->sm_bia, addr, ETHERADDRL);
778 if (!(smp->sm_laa_valid)) {
783 bcopy(smp->sm_laa, addr, ETHERADDRL);
791 mutex_exit(&(smp->sm_lock));
801 mutex_exit(&(smp->sm_lock));
812 sfxge_mac_t *smp = &(sp->s_mac);
818 mutex_enter(&(smp->sm_lock));
820 old_mac_valid = smp->sm_laa_valid;
822 bcopy(smp->sm_laa, old_mac, ETHERADDRL);
824 bcopy(addr, smp->sm_laa, ETHERADDRL);
825 smp->sm_laa_valid = B_TRUE;
827 if (smp->sm_state != SFXGE_MAC_STARTED)
831 if ((rc = efx_mac_addr_set(enp, smp->sm_laa)) != 0) {
838 mutex_exit(&smp->sm_lock);
843 mutex_enter(&(smp->sm_lock));
846 mutex_enter(&smp->sm_lock);
849 if ((rc = efx_mac_addr_set(enp, smp->sm_laa)) != 0)
853 mutex_exit(&(smp->sm_lock));
859 bcopy(old_mac, smp->sm_laa, ETHERADDRL);
861 smp->sm_laa_valid = B_FALSE;
865 mutex_exit(&(smp->sm_lock));
873 sfxge_mac_t *smp = &(sp->s_mac);
876 mutex_enter(&(smp->sm_lock));
878 if (smp->sm_promisc == promisc)
881 smp->sm_promisc = promisc;
887 mutex_exit(&(smp->sm_lock));
892 mutex_exit(&(smp->sm_lock));
900 sfxge_mac_t *smp = &(sp->s_mac);
904 mutex_enter(&(smp->sm_lock));
913 while (i < smp->sm_mcast_count) {
914 if (bcmp(smp->sm_mcast_addr + (i * ETHERADDRL),
921 if (smp->sm_mcast_count >= EFX_MAC_MULTICAST_LIST_MAX) {
927 bcopy(addr, smp->sm_mcast_addr + (smp->sm_mcast_count++ * ETHERADDRL),
934 mutex_exit(&(smp->sm_lock));
939 smp->sm_mcast_count--;
942 mutex_exit(&(smp->sm_lock));
950 sfxge_mac_t *smp = &(sp->s_mac);
954 mutex_enter(&(smp->sm_lock));
957 while (i < smp->sm_mcast_count) {
958 if (bcmp(smp->sm_mcast_addr + (i * ETHERADDRL),
960 (void) memmove(smp->sm_mcast_addr + (i * ETHERADDRL),
961 smp->sm_mcast_addr + ((i + 1) * ETHERADDRL),
962 (smp->sm_mcast_count - (i + 1)) * ETHERADDRL);
963 smp->sm_mcast_count--;
971 mutex_exit(&(smp->sm_lock));
976 mutex_exit(&(smp->sm_lock));
984 sfxge_mac_t *smp = &(sp->s_mac);
986 efsys_mem_t *esmp = &(smp->sm_mem);
988 mutex_enter(&(smp->sm_lock));
990 ASSERT3U(smp->sm_state, ==, SFXGE_MAC_STARTED);
991 ASSERT3P(smp->sm_sp, ==, sp);
992 smp->sm_state = SFXGE_MAC_INITIALIZED;
995 if (!smp->sm_mac_stats_timer_reqd)
1000 smp->sm_lbolt = 0;
1002 smp->sm_link_up = B_FALSE;
1003 smp->sm_link_speed = 0;
1004 smp->sm_link_duplex = SFXGE_LINK_DUPLEX_UNKNOWN;
1009 smp->sm_link_mode = EFX_LINK_UNKNOWN;
1013 mutex_exit(&(smp->sm_lock));
1019 sfxge_mac_t *smp = &(sp->s_mac);
1020 efsys_mem_t *esmp = &(smp->sm_mem);
1022 ASSERT3U(smp->sm_state, ==, SFXGE_MAC_INITIALIZED);
1023 ASSERT3P(smp->sm_sp, ==, sp);
1029 smp->sm_state = SFXGE_MAC_UNINITIALIZED;
1030 smp->sm_link_mode = EFX_LINK_UNKNOWN;
1031 smp->sm_promisc = SFXGE_PROMISC_OFF;
1033 bzero(smp->sm_mcast_addr, sizeof (smp->sm_mcast_addr));
1034 smp->sm_mcast_count = 0;
1036 bzero(smp->sm_laa, ETHERADDRL);
1037 smp->sm_laa_valid = B_FALSE;
1039 bzero(smp->sm_bia, ETHERADDRL);
1041 smp->sm_fcntl = 0;
1050 ddi_taskq_destroy(smp->sm_tqp);
1051 smp->sm_tqp = NULL;
1053 mutex_destroy(&(smp->sm_lock));
1055 smp->sm_sp = NULL;