Lines Matching defs:sup

184 softmac_capab_perim(softmac_upper_t *sup, void *data, uint_t flags)
188 mutex_enter(&sup->su_mutex);
191 mutex_exit(&sup->su_mutex);
194 return (MUTEX_HELD(&sup->su_mutex));
200 softmac_client_tx_notify(softmac_upper_t *sup, mac_tx_notify_t func, void *arg)
202 ASSERT(MUTEX_HELD(&sup->su_mutex));
205 sup->su_tx_notify_func = func;
206 sup->su_tx_notify_arg = arg;
211 while (sup->su_tx_inprocess != 0)
212 cv_wait(&sup->su_cv, &sup->su_mutex);
214 sup->su_tx_notify_func = NULL;
215 sup->su_tx_notify_arg = NULL;
217 return ((mac_tx_notify_handle_t)sup);
221 softmac_tx_is_flow_blocked(softmac_upper_t *sup, mac_tx_cookie_t cookie)
223 ASSERT(cookie == (mac_tx_cookie_t)sup);
224 return (sup->su_tx_busy);
228 softmac_capab_direct(softmac_upper_t *sup, void *data, uint_t flags)
231 softmac_lower_t *slp = sup->su_slp;
233 ASSERT(MUTEX_HELD(&sup->su_mutex));
235 ASSERT(sup->su_mode == SOFTMAC_FASTPATH);
239 if (sup->su_direct)
242 sup->su_direct_rxinfo.slr_rx = (softmac_rx_t)direct->di_rx_cf;
243 sup->su_direct_rxinfo.slr_arg = direct->di_rx_ch;
244 slp->sl_rxinfo = &sup->su_direct_rxinfo;
246 direct->di_tx_dh = sup;
248 direct->di_tx_fctl_dh = sup;
250 direct->di_tx_cb_dh = sup;
251 sup->su_direct = B_TRUE;
255 if (!sup->su_direct)
258 slp->sl_rxinfo = &sup->su_rxinfo;
259 sup->su_direct = B_FALSE;
266 softmac_dld_capab(softmac_upper_t *sup, uint_t type, void *data, uint_t flags)
278 !check_ip_above(sup->su_rq)) {
284 err = softmac_capab_direct(sup, data, flags);
288 err = softmac_capab_perim(sup, data, flags);
299 softmac_capability_advertise(softmac_upper_t *sup, mblk_t *mp)
305 queue_t *q = sup->su_wq;
307 softmac_t *softmac = sup->su_softmac;
313 ASSERT(sup->su_mode == SOFTMAC_FASTPATH);
323 if (check_ip_above(sup->su_rq)) {
387 dld.dld_capab_handle = (uintptr_t)sup;
389 dlcapabsetqid(&(dld.dld_mid), sup->su_rq);
409 dlcapabsetqid(&(hcksum.hcksum_mid), sup->su_rq);
429 dlcapabsetqid(&(zcopy.zerocopy_mid), sup->su_rq);
453 dlcapabsetqid(&(mdt.mdt_mid), sup->su_rq);
463 softmac_capability_req(softmac_upper_t *sup, mblk_t *mp)
470 queue_t *q = sup->su_wq;
472 ASSERT(sup->su_mode == SOFTMAC_FASTPATH);
478 if (!sup->su_bound) {
489 softmac_capability_advertise(sup, mp);
529 dlcapabsetqid(&(hcksum.hcksum_mid), sup->su_rq);
547 softmac_bind_req(softmac_upper_t *sup, mblk_t *mp)
549 softmac_lower_t *slp = sup->su_slp;
550 softmac_t *softmac = sup->su_softmac;
563 dlerrorack(sup->su_wq, mp, DL_BIND_REQ, DL_SYSERR, ENOMEM);
597 sup->su_active = B_TRUE;
599 sup->su_bound = B_TRUE;
601 qreply(sup->su_wq, ackmp);
605 dlerrorack(sup->su_wq, ackmp, DL_BIND_REQ, DL_SYSERR, err);
611 softmac_unbind_req(softmac_upper_t *sup, mblk_t *mp)
613 softmac_lower_t *slp = sup->su_slp;
614 softmac_t *softmac = sup->su_softmac;
623 if (!sup->su_bound) {
624 dlerrorack(sup->su_wq, mp, DL_UNBIND_REQ, DL_OUTSTATE, 0);
632 dlerrorack(sup->su_wq, mp, DL_UNBIND_REQ, DL_SYSERR, ENOMEM);
647 dlerrorack(sup->su_wq, ackmp, DL_UNBIND_REQ, DL_SYSERR, err);
651 sup->su_bound = B_FALSE;
654 if (sup->su_active) {
657 sup->su_active = B_FALSE;
662 qreply(sup->su_wq, ackmp);
669 softmac_wput_single_nondata(softmac_upper_t *sup, mblk_t *mp)
671 softmac_t *softmac = sup->su_softmac;
672 softmac_lower_t *slp = sup->su_slp;
677 sup->su_is_arp = 0;
680 sup->su_is_arp = 1;
692 miocnak(sup->su_wq, mp, 0, EINVAL);
704 sup->su_mode = SOFTMAC_SLOWPATH;
705 list_insert_head(&softmac->smac_sup_list, sup);
717 (void) softmac_fastpath_setup(sup);
738 * sup is trying to switching its datapath mode
742 qreply(sup->su_wq, mp);
756 softmac_datapath_switch_done(sup);
766 if (sup->su_mode != SOFTMAC_FASTPATH) {
767 dld_wput(sup->su_wq, mp);
781 softmac_bind_req(sup, mp);
784 softmac_unbind_req(sup, mp);
787 softmac_capability_req(sup, mp);
808 softmac_upper_t *sup = arg;
811 mutex_enter(&sup->su_disp_mutex);
813 while (sup->su_pending_head != NULL) {
814 if (sup->su_closing)
817 SOFTMAC_DQ_PENDING(sup, &mp);
818 mutex_exit(&sup->su_disp_mutex);
819 softmac_wput_single_nondata(sup, mp);
820 mutex_enter(&sup->su_disp_mutex);
827 freemsgchain(sup->su_pending_head);
828 sup->su_pending_head = sup->su_pending_tail = NULL;
829 sup->su_dlpi_pending = B_FALSE;
830 cv_signal(&sup->su_disp_cv);
831 mutex_exit(&sup->su_disp_mutex);
842 softmac_upper_t *sup;
849 sup = list_head(&softmac_taskq_list);
850 while (sup != NULL) {
851 list_remove(&softmac_taskq_list, sup);
852 sup->su_taskq_scheduled = B_FALSE;
855 softmac_wput_nondata_task, sup, TQ_SLEEP) != NULL);
857 sup = list_head(&softmac_taskq_list);
872 softmac_wput_nondata(softmac_upper_t *sup, mblk_t *mp)
878 mutex_enter(&sup->su_disp_mutex);
880 if (sup->su_closing) {
881 mutex_exit(&sup->su_disp_mutex);
886 SOFTMAC_EQ_PENDING(sup, mp);
888 if (sup->su_dlpi_pending) {
889 mutex_exit(&sup->su_disp_mutex);
892 sup->su_dlpi_pending = B_TRUE;
893 mutex_exit(&sup->su_disp_mutex);
896 sup, TQ_NOSLEEP) != NULL) {
901 if (!sup->su_taskq_scheduled) {
902 list_insert_tail(&softmac_taskq_list, sup);
905 sup->su_taskq_scheduled = B_TRUE;
913 softmac_fastpath_setup(softmac_upper_t *sup)
915 softmac_t *softmac = sup->su_softmac;
919 err = softmac_lower_setup(softmac, sup, &slp);
921 mutex_enter(&sup->su_mutex);
926 while (sup->su_tx_inprocess != 0)
927 cv_wait(&sup->su_cv, &sup->su_mutex);
929 ASSERT(sup->su_mode != SOFTMAC_FASTPATH);
930 ASSERT(sup->su_slp == NULL);
932 sup->su_mode = SOFTMAC_SLOWPATH;
934 sup->su_slp = slp;
935 sup->su_mode = SOFTMAC_FASTPATH;
937 mutex_exit(&sup->su_mutex);
945 softmac_fastpath_tear(softmac_upper_t *sup)
947 mutex_enter(&sup->su_mutex);
952 while (sup->su_tx_inprocess != 0)
953 cv_wait(&sup->su_cv, &sup->su_mutex);
960 sup->su_tx_notify_func = NULL;
961 sup->su_tx_notify_arg = NULL;
962 if (sup->su_tx_busy) {
963 ASSERT(sup->su_tx_flow_mp == NULL);
964 VERIFY((sup->su_tx_flow_mp = getq(sup->su_wq)) != NULL);
965 sup->su_tx_busy = B_FALSE;
968 sup->su_mode = SOFTMAC_SLOWPATH;
974 (void) ldi_close(sup->su_slp->sl_lh, FREAD|FWRITE, kcred);
975 sup->su_slp = NULL;
976 mutex_exit(&sup->su_mutex);
980 softmac_wput_data(softmac_upper_t *sup, mblk_t *mp)
987 if (sup->su_mode != SOFTMAC_FASTPATH)
988 dld_wput(sup->su_wq, mp);
990 (void) softmac_fastpath_wput_data(sup, mp, NULL, 0);
995 softmac_fastpath_wput_data(softmac_upper_t *sup, mblk_t *mp, uintptr_t f_hint,
998 queue_t *wq = sup->su_slp->sl_wq;
1024 if (sup->su_tx_busy) {
1029 return ((mac_tx_cookie_t)sup);
1032 mutex_enter(&sup->su_mutex);
1033 if (!sup->su_tx_busy) {
1040 ASSERT(sup->su_tx_flow_mp != NULL);
1041 (void) putq(sup->su_wq, sup->su_tx_flow_mp);
1042 sup->su_tx_flow_mp = NULL;
1043 sup->su_tx_busy = B_TRUE;
1046 mutex_exit(&sup->su_mutex);
1052 return ((mac_tx_cookie_t)sup);
1088 softmac_upper_t *sup;
1129 for (sup = list_head(&softmac->smac_sup_list); sup != NULL;
1130 sup = list_next(&softmac->smac_sup_list, sup)) {
1138 if (sup->su_is_arp) {
1171 if (sup != NULL && expected_mode == SOFTMAC_SLOWPATH) {
1181 for (sup = list_head(&softmac->smac_sup_list); sup != NULL;
1182 sup = list_next(&softmac->smac_sup_list, sup)) {
1183 if (!sup->su_is_arp) {
1186 softmac_wput_nondata(sup, head);
1195 list_insert_tail(&sup->su_req_list, req);
1235 softmac_upperstream_close(softmac_upper_t *sup)
1237 softmac_t *softmac = sup->su_softmac;
1242 if (sup->su_mode == SOFTMAC_FASTPATH)
1243 softmac_fastpath_tear(sup);
1245 if (sup->su_mode != SOFTMAC_UNKNOWN) {
1246 list_remove(&softmac->smac_sup_list, sup);
1247 sup->su_mode = SOFTMAC_UNKNOWN;
1253 while ((req = list_head(&sup->su_req_list)) != NULL) {
1254 list_remove(&sup->su_req_list, req);
1265 softmac_datapath_switch_done(softmac_upper_t *sup)
1267 softmac_t *softmac = sup->su_softmac;
1272 req = list_head(&sup->su_req_list);
1273 list_remove(&sup->su_req_list, req);
1277 if (expected_mode == sup->su_mode) {
1282 ASSERT(!sup->su_bound);
1290 softmac_fastpath_tear(sup);
1292 (void) softmac_fastpath_setup(sup);