Lines Matching refs:dsp
41 dls_open(dls_link_t *dlp, dls_dl_handle_t ddh, dld_str_t *dsp) in dls_open() argument
73 dsp->ds_dlp = dlp; in dls_open()
74 dsp->ds_mh = dlp->dl_mh; in dls_open()
75 dsp->ds_mch = dlp->dl_mch; in dls_open()
76 dsp->ds_mip = dlp->dl_mip; in dls_open()
77 dsp->ds_ddh = ddh; in dls_open()
78 dsp->ds_local = local; in dls_open()
80 ASSERT(MAC_PERIM_HELD(dsp->ds_mh)); in dls_open()
85 dls_close(dld_str_t *dsp) in dls_close() argument
87 dls_link_t *dlp = dsp->ds_dlp; in dls_close()
91 ASSERT(dsp->ds_datathr_cnt == 0); in dls_close()
92 ASSERT(MAC_PERIM_HELD(dsp->ds_mh)); in dls_close()
94 if (dsp->ds_local) in dls_close()
96 dsp->ds_local = B_FALSE; in dls_close()
105 for (p = dsp->ds_dmap; p != NULL; p = nextp) { in dls_close()
106 (void) mac_multicast_remove(dsp->ds_mch, p->dma_addr); in dls_close()
110 dsp->ds_dmap = NULL; in dls_close()
112 dls_active_clear(dsp, B_TRUE); in dls_close()
117 if (dsp->ds_dlstate == DL_IDLE) { in dls_close()
118 dls_unbind(dsp); in dls_close()
119 dsp->ds_dlstate = DL_UNBOUND; in dls_close()
126 (void) dls_promisc(dsp, 0); in dls_close()
135 dsp->ds_rx = NULL; in dls_close()
136 dsp->ds_rx_arg = NULL; in dls_close()
138 dsp->ds_dlp = NULL; in dls_close()
140 if (!mac_capab_get(dsp->ds_mh, MAC_CAPAB_LEGACY, NULL)) in dls_close()
141 mac_stop(dsp->ds_mh); in dls_close()
151 dls_bind(dld_str_t *dsp, uint32_t sap) in dls_bind() argument
155 ASSERT(MAC_PERIM_HELD(dsp->ds_mh)); in dls_bind()
160 if (!mac_sap_verify(dsp->ds_mh, sap, &dls_sap)) in dls_bind()
163 if (dsp->ds_promisc & DLS_PROMISC_SAP) in dls_bind()
169 dsp->ds_sap = sap; in dls_bind()
185 if (sap == ETHERTYPE_VLAN && dsp->ds_promisc == 0) { in dls_bind()
188 if (dsp->ds_vlan_mph != NULL) in dls_bind()
190 err = mac_promisc_add(dsp->ds_mch, in dls_bind()
191 MAC_CLIENT_PROMISC_ALL, dls_rx_vlan_promisc, dsp, in dls_bind()
192 &dsp->ds_vlan_mph, MAC_PROMISC_FLAGS_NO_PHYS); in dls_bind()
194 if (err == 0 && dsp->ds_nonip && in dls_bind()
195 dsp->ds_dlp->dl_nonip_cnt++ == 0) in dls_bind()
196 mac_rx_bypass_disable(dsp->ds_mch); in dls_bind()
205 dls_link_add(dsp->ds_dlp, dls_sap, dsp); in dls_bind()
206 if (dsp->ds_nonip && dsp->ds_dlp->dl_nonip_cnt++ == 0) in dls_bind()
207 mac_rx_bypass_disable(dsp->ds_mch); in dls_bind()
213 dls_unbind(dld_str_t *dsp) in dls_unbind() argument
215 ASSERT(MAC_PERIM_HELD(dsp->ds_mh)); in dls_unbind()
217 if (dsp->ds_nonip && --dsp->ds_dlp->dl_nonip_cnt == 0) in dls_unbind()
218 mac_rx_bypass_enable(dsp->ds_mch); in dls_unbind()
225 if (dsp->ds_vlan_mph != NULL) { in dls_unbind()
226 mac_promisc_remove(dsp->ds_vlan_mph); in dls_unbind()
227 dsp->ds_vlan_mph = NULL; in dls_unbind()
235 dls_link_remove(dsp->ds_dlp, dsp); in dls_unbind()
236 dsp->ds_sap = 0; in dls_unbind()
247 dls_promisc(dld_str_t *dsp, uint32_t new_flags) in dls_promisc() argument
250 uint32_t old_flags = dsp->ds_promisc; in dls_promisc()
253 ASSERT(MAC_PERIM_HELD(dsp->ds_mh)); in dls_promisc()
264 if (dsp->ds_promisc == 0 && new_flags != 0) { in dls_promisc()
269 dsp->ds_promisc = new_flags; in dls_promisc()
270 err = mac_promisc_add(dsp->ds_mch, mptype, in dls_promisc()
271 dls_rx_promisc, dsp, &dsp->ds_mph, in dls_promisc()
275 dsp->ds_promisc = old_flags; in dls_promisc()
280 if (dsp->ds_vlan_mph != NULL) { in dls_promisc()
281 mac_promisc_remove(dsp->ds_vlan_mph); in dls_promisc()
282 dsp->ds_vlan_mph = NULL; in dls_promisc()
284 } else if (dsp->ds_promisc != 0 && new_flags == 0) { in dls_promisc()
285 ASSERT(dsp->ds_mph != NULL); in dls_promisc()
287 mac_promisc_remove(dsp->ds_mph); in dls_promisc()
288 dsp->ds_promisc = new_flags; in dls_promisc()
289 dsp->ds_mph = NULL; in dls_promisc()
291 if (dsp->ds_sap == ETHERTYPE_VLAN && in dls_promisc()
292 dsp->ds_dlstate != DL_UNBOUND) { in dls_promisc()
293 if (dsp->ds_vlan_mph != NULL) in dls_promisc()
295 err = mac_promisc_add(dsp->ds_mch, in dls_promisc()
296 MAC_CLIENT_PROMISC_ALL, dls_rx_vlan_promisc, dsp, in dls_promisc()
297 &dsp->ds_vlan_mph, MAC_PROMISC_FLAGS_NO_PHYS); in dls_promisc()
299 } else if (dsp->ds_promisc == DLS_PROMISC_SAP && new_flags != 0 && in dls_promisc()
300 new_flags != dsp->ds_promisc) { in dls_promisc()
306 ASSERT(dsp->ds_mph != NULL); in dls_promisc()
307 mac_promisc_remove(dsp->ds_mph); in dls_promisc()
309 dsp->ds_promisc = new_flags; in dls_promisc()
310 err = mac_promisc_add(dsp->ds_mch, mptype, in dls_promisc()
311 dls_rx_promisc, dsp, &dsp->ds_mph, 0); in dls_promisc()
313 dsp->ds_promisc = old_flags; in dls_promisc()
316 dsp->ds_promisc = new_flags; in dls_promisc()
323 dls_multicst_add(dld_str_t *dsp, const uint8_t *addr) in dls_multicst_add() argument
330 ASSERT(MAC_PERIM_HELD(dsp->ds_mh)); in dls_multicst_add()
336 addr_length = dsp->ds_mip->mi_addr_length; in dls_multicst_add()
344 rw_enter(&dsp->ds_rw_lock, RW_WRITER); in dls_multicst_add()
345 for (pp = &(dsp->ds_dmap); (p = *pp) != NULL; pp = &(p->dma_nextp)) { in dls_multicst_add()
361 rw_exit(&dsp->ds_rw_lock); in dls_multicst_add()
366 err = mac_multicast_add(dsp->ds_mch, addr); in dls_multicst_add()
371 rw_enter(&dsp->ds_rw_lock, RW_WRITER); in dls_multicst_add()
376 rw_exit(&dsp->ds_rw_lock); in dls_multicst_add()
381 dls_multicst_remove(dld_str_t *dsp, const uint8_t *addr) in dls_multicst_remove() argument
387 ASSERT(MAC_PERIM_HELD(dsp->ds_mh)); in dls_multicst_remove()
393 addr_length = dsp->ds_mip->mi_addr_length; in dls_multicst_remove()
401 rw_enter(&dsp->ds_rw_lock, RW_WRITER); in dls_multicst_remove()
402 for (pp = &(dsp->ds_dmap); (p = *pp) != NULL; pp = &(p->dma_nextp)) { in dls_multicst_remove()
412 rw_exit(&dsp->ds_rw_lock); in dls_multicst_remove()
420 rw_exit(&dsp->ds_rw_lock); in dls_multicst_remove()
425 mac_multicast_remove(dsp->ds_mch, addr); in dls_multicst_remove()
431 dls_header(dld_str_t *dsp, const uint8_t *addr, uint16_t sap, uint_t pri, in dls_header() argument
438 boolean_t is_ethernet = (dsp->ds_mip->mi_media == DL_ETHER); in dls_header()
441 vid = mac_client_vid(dsp->ds_mch); in dls_header()
457 (pri != 0 && dsp->ds_dlp->dl_tagmode != LINK_TAGMODE_VLANONLY))) { in dls_header()
466 mp = mac_header(dsp->ds_mh, addr, mac_sap, payload, extra_len); in dls_header()
471 dsp->ds_dlp->dl_tagmode == LINK_TAGMODE_VLANONLY)) || !is_ethernet) in dls_header()
521 dls_rx_set(dld_str_t *dsp, dls_rx_t rx, void *arg) in dls_rx_set() argument
523 mutex_enter(&dsp->ds_lock); in dls_rx_set()
524 dsp->ds_rx = rx; in dls_rx_set()
525 dsp->ds_rx_arg = arg; in dls_rx_set()
526 mutex_exit(&dsp->ds_lock); in dls_rx_set()
530 dls_accept_common(dld_str_t *dsp, mac_header_info_t *mhip, dls_rx_t *ds_rx, in dls_accept_common() argument
534 size_t addr_length = dsp->ds_mip->mi_addr_length; in dls_accept_common()
540 if (dsp->ds_dlstate != DL_IDLE) in dls_accept_common()
543 if (dsp->ds_promisc != 0) { in dls_accept_common()
554 if (!promisc && !(dsp->ds_promisc == DLS_PROMISC_MULTI && in dls_accept_common()
561 if (dsp->ds_promisc & DLS_PROMISC_PHYS) in dls_accept_common()
588 if (dsp->ds_promisc & DLS_PROMISC_MULTI) in dls_accept_common()
591 rw_enter(&dsp->ds_rw_lock, RW_READER); in dls_accept_common()
592 for (dmap = dsp->ds_dmap; dmap != NULL; in dls_accept_common()
596 rw_exit(&dsp->ds_rw_lock); in dls_accept_common()
600 rw_exit(&dsp->ds_rw_lock); in dls_accept_common()
611 mutex_enter(&dsp->ds_lock); in dls_accept_common()
612 *ds_rx = dsp->ds_rx; in dls_accept_common()
613 *ds_rx_arg = dsp->ds_rx_arg; in dls_accept_common()
614 mutex_exit(&dsp->ds_lock); in dls_accept_common()
621 dls_accept(dld_str_t *dsp, mac_header_info_t *mhip, dls_rx_t *ds_rx, in dls_accept() argument
624 return (dls_accept_common(dsp, mhip, ds_rx, ds_rx_arg, B_FALSE, in dls_accept()
629 dls_accept_promisc(dld_str_t *dsp, mac_header_info_t *mhip, dls_rx_t *ds_rx, in dls_accept_promisc() argument
632 return (dls_accept_common(dsp, mhip, ds_rx, ds_rx_arg, B_TRUE, in dls_accept_promisc()
679 dls_active_set(dld_str_t *dsp) in dls_active_set() argument
683 ASSERT(MAC_PERIM_HELD(dsp->ds_mh)); in dls_active_set()
685 if (dsp->ds_passivestate == DLD_PASSIVE) in dls_active_set()
689 if ((dsp->ds_nactive == 0) && in dls_active_set()
690 ((err = dls_mac_active_set(dsp->ds_dlp)) != 0)) { in dls_active_set()
697 dsp->ds_passivestate = DLD_ACTIVE; in dls_active_set()
698 dsp->ds_nactive++; in dls_active_set()
712 dls_active_clear(dld_str_t *dsp, boolean_t all) in dls_active_clear() argument
714 ASSERT(MAC_PERIM_HELD(dsp->ds_mh)); in dls_active_clear()
716 if (dsp->ds_passivestate == DLD_PASSIVE) in dls_active_clear()
719 if (all && dsp->ds_nactive == 0) in dls_active_clear()
722 ASSERT(dsp->ds_nactive > 0); in dls_active_clear()
724 dsp->ds_nactive -= (all ? dsp->ds_nactive : 1); in dls_active_clear()
725 if (dsp->ds_nactive != 0) in dls_active_clear()
728 ASSERT(dsp->ds_passivestate == DLD_ACTIVE); in dls_active_clear()
729 dls_mac_active_clear(dsp->ds_dlp); in dls_active_clear()
730 dsp->ds_passivestate = DLD_UNINITIALIZED; in dls_active_clear()