Lines Matching refs:dp

71 static int vsw_setup_rx_dring(vsw_ldc_t *ldcp, dring_info_t *dp);
111 dring_info_t *dp;
121 if ((dp = vsw_create_rx_dring(ldcp)) == NULL)
124 mp = kmem_zalloc(VNET_DRING_REG_EXT_MSG_SIZE(dp->data_ncookies),
133 mp->num_descriptors = dp->num_descriptors;
134 mp->descriptor_size = dp->descriptor_size;
135 mp->options = dp->options;
136 mp->ncookies = dp->dring_ncookies;
137 bcopy(&dp->dring_cookie[0], &mp->cookie[0],
151 emsg->data_ncookies = dp->data_ncookies;
154 emsg->data_area_size = dp->data_sz;
157 bcopy(dp->data_cookie, (ldc_mem_cookie_t *)emsg->data_cookie,
158 sizeof (ldc_mem_cookie_t) * dp->data_ncookies);
174 dring_info_t *dp;
176 dp = (dring_info_t *)kmem_zalloc(sizeof (dring_info_t), KM_SLEEP);
177 mutex_init(&dp->dlock, NULL, MUTEX_DRIVER, NULL);
178 ldcp->lane_out.dringp = dp;
182 sizeof (vnet_rx_dringdata_desc_t), &dp->dring_handle)) != 0) {
188 ASSERT(dp->dring_handle != NULL);
191 if ((ldc_mem_dring_info(dp->dring_handle, &minfo)) != 0) {
197 dp->pub_addr = minfo.vaddr;
200 dp->num_descriptors = vsw_num_descriptors;
201 dp->descriptor_size = sizeof (vnet_rx_dringdata_desc_t);
202 dp->options = VIO_RX_DRING_DATA;
203 dp->dring_ncookies = 1; /* guaranteed by ldc */
204 dp->num_bufs = VSW_RXDRING_NRBUFS;
211 dp->rxdp_to_vmp = kmem_zalloc(dp->num_descriptors * sizeof (uintptr_t),
215 if (vsw_setup_rx_dring(ldcp, dp)) {
224 if ((ldc_mem_dring_bind(ldcp->ldc_handle, dp->dring_handle,
226 &dp->dring_cookie[0], &dp->dring_ncookies)) != 0) {
233 dp->end_idx = 0;
234 dp->last_ack_recv = -1;
235 dp->next_rxi = 0;
236 return (dp);
248 vsw_setup_rx_dring(vsw_ldc_t *ldcp, dring_info_t *dp)
282 dp->desc_data_sz = data_sz;
283 dp->data_sz = (dp->num_bufs * data_sz);
284 data_addr = kmem_zalloc(dp->data_sz, KM_SLEEP);
285 dp->data_addr = data_addr;
288 dp->data_sz, dp->data_addr);
291 rv = ldc_mem_alloc_handle(ldcp->ldc_handle, &dp->data_handle);
298 dp->data_cookie = kmem_zalloc(VNET_DATA_AREA_COOKIES *
304 rv = ldc_mem_bind_handle(dp->data_handle, (caddr_t)data_addr,
305 dp->data_sz, LDC_DIRECT_MAP, LDC_MEM_W,
306 dp->data_cookie, &ncookies);
315 dp->data_ncookies = ncookies;
318 rv = ldc_mem_nextcookie(dp->data_handle,
319 &(dp->data_cookie[j]));
336 rv = vio_create_mblks(dp->num_bufs, data_sz, (uint8_t *)data_addr,
337 &dp->rx_vmp);
342 pub_addr = dp->pub_addr;
343 rxdp_to_vmp = dp->rxdp_to_vmp;
344 for (i = 0; i < dp->num_descriptors; i++) {
347 vmp = vio_allocb(dp->rx_vmp);
369 dring_info_t *dp;
371 dp = lp->dringp;
372 if (dp == NULL) {
376 mutex_enter(&dp->dlock);
378 if (dp->rx_vmp != NULL) {
379 vio_clobber_pool(dp->rx_vmp);
387 if (vio_destroy_mblks(dp->rx_vmp) != 0) {
389 vsw_destroy_rxpools, dp->rx_vmp, DDI_SLEEP);
394 if (dp->data_cookie != NULL) {
395 kmem_free(dp->data_cookie, VNET_DATA_AREA_COOKIES *
397 dp->data_cookie = NULL;
401 if (dp->data_ncookies != 0) {
402 (void) ldc_mem_unbind_handle(dp->data_handle);
403 dp->data_ncookies = 0;
407 if (dp->data_handle) {
408 (void) ldc_mem_free_handle(dp->data_handle);
409 dp->data_handle = 0;
413 if (dp->data_addr != NULL) {
414 kmem_free(dp->data_addr, dp->data_sz);
418 if (dp->dring_handle != NULL) {
419 (void) ldc_mem_dring_unbind(dp->dring_handle);
420 (void) ldc_mem_dring_destroy(dp->dring_handle);
423 if (dp->rxdp_to_vmp != NULL) {
424 kmem_free(dp->rxdp_to_vmp,
425 dp->num_descriptors * sizeof (uintptr_t));
426 dp->rxdp_to_vmp = NULL;
429 mutex_exit(&dp->dlock);
430 mutex_destroy(&dp->dlock);
431 mutex_destroy(&dp->restart_lock);
432 kmem_free(dp, sizeof (dring_info_t));
445 dring_info_t *dp;
450 dp = vsw_map_dring_cmn(ldcp, dring_pkt);
451 if (dp == NULL) {
456 mutex_init(&dp->txlock, NULL, MUTEX_DRIVER, NULL);
457 mutex_init(&dp->restart_lock, NULL, MUTEX_DRIVER, NULL);
458 dp->next_txi = dp->restart_peer_txi = 0;
459 dp->restart_reqd = B_TRUE;
461 ldcp->lane_in.dringp = dp;
484 txdp = (vnet_rx_dringdata_desc_t *)dp->pub_addr;
485 for (i = 0; i < dp->num_descriptors; i++) {
491 return (dp);
494 if (dp->dring_handle != NULL) {
495 (void) ldc_mem_dring_unmap(dp->dring_handle);
497 kmem_free(dp, sizeof (*dp));
508 dring_info_t *dp;
510 if ((dp = lp->dringp) == NULL) {
515 if (dp->data_handle != NULL) {
516 (void) ldc_mem_unmap(dp->data_handle);
517 (void) ldc_mem_free_handle(dp->data_handle);
518 dp->data_handle = NULL;
522 if (dp->data_cookie != NULL) {
523 kmem_free(dp->data_cookie, dp->data_ncookies *
525 dp->data_cookie = NULL;
526 dp->data_ncookies = 0;
530 if (dp->dring_handle != NULL) {
531 (void) ldc_mem_dring_unmap(dp->dring_handle);
532 dp->dring_handle = NULL;
535 mutex_destroy(&dp->txlock);
536 kmem_free(dp, sizeof (dring_info_t));
615 dring_info_t *dp = lp->dringp;
675 } while (total_count < dp->num_bufs);
686 DECR_RXI(dp, end_ix);
727 dring_info_t *dp = ldcp->lane_out.dringp;
728 vnet_rx_dringdata_desc_t *pub_addr = dp->pub_addr;
730 rxi = dp->next_rxi;
732 vmp = dp->rxdp_to_vmp[rxi];
764 new_vmp = vio_allocb(dp->rx_vmp);
793 dp->rxdp_to_vmp[rxi] = new_vmp;
818 INCR_RXI(dp, rxi);
821 dp->next_rxi = rxi;
876 dring_info_t *dp = lane_in->dringp;
888 if (dp == NULL) {
894 pub_addr = dp->pub_addr;
937 if (mutex_owned(&dp->txlock)) {
938 mutex_exit(&dp->txlock);
940 if (mutex_owned(&dp->restart_lock)) {
941 mutex_exit(&dp->restart_lock);
949 mutex_enter(&dp->txlock);
950 txi = next_txi = dp->next_txi;
951 INCR_TXI(dp, next_txi);
955 mutex_exit(&dp->txlock);
963 dp->next_txi = next_txi;
964 mutex_exit(&dp->txlock);
973 dst = (caddr_t)dp->data_addr + buf_offset;
991 mutex_enter(&dp->restart_lock);
999 if (dp->restart_reqd == B_TRUE && dp->restart_peer_txi == txi) {
1000 dp->restart_reqd = B_FALSE;
1012 mutex_exit(&dp->restart_lock);
1037 mutex_enter(&dp->restart_lock);
1039 dp->restart_reqd = B_TRUE;
1040 mutex_exit(&dp->restart_lock);
1089 dring_info_t *dp = ldcp->lane_in.dringp;
1093 if (dp->ident != msg->dring_ident) {
1119 dring_info_t *dp;
1131 dp = ldcp->lane_in.dringp;
1134 pub_addr = dp->pub_addr;
1141 if (((start != VNET_START_IDX_UNSPEC) && !(CHECK_TXI(dp, start))) ||
1142 !(CHECK_TXI(dp, end))) {
1178 if (mutex_owned(&dp->restart_lock)) {
1179 mutex_exit(&dp->restart_lock);
1189 mutex_enter(&dp->restart_lock);
1193 INCR_TXI(dp, txi);
1209 dp->restart_reqd = B_TRUE;
1210 dp->restart_peer_txi = txi;
1211 mutex_exit(&dp->restart_lock);
1219 dp->restart_reqd = B_FALSE;
1220 mutex_exit(&dp->restart_lock);
1233 mutex_enter(&dp->restart_lock);
1234 dp->restart_reqd = B_TRUE;
1235 mutex_exit(&dp->restart_lock);