Lines Matching refs:rstruct

1407 	xpvtap_rs_t *rstruct;  in xpvtap_rs_init()  local
1416 rstruct = kmem_alloc(sizeof (xpvtap_rs_t), KM_SLEEP); in xpvtap_rs_init()
1424 rstruct->rs_free_size = (max_val >> 6) * 8; in xpvtap_rs_init()
1426 rstruct->rs_free_size = ((max_val >> 6) + 1) * 8; in xpvtap_rs_init()
1428 rstruct->rs_free = kmem_alloc(rstruct->rs_free_size, KM_SLEEP); in xpvtap_rs_init()
1431 rstruct->rs_min = min_val; in xpvtap_rs_init()
1432 rstruct->rs_last = min_val; in xpvtap_rs_init()
1433 rstruct->rs_max = max_val; in xpvtap_rs_init()
1434 mutex_init(&rstruct->rs_mutex, NULL, MUTEX_DRIVER, NULL); in xpvtap_rs_init()
1435 rstruct->rs_flushing = B_FALSE; in xpvtap_rs_init()
1438 array_size = rstruct->rs_free_size >> 3; in xpvtap_rs_init()
1440 rstruct->rs_free[index] = (uint64_t)0xFFFFFFFFFFFFFFFF; in xpvtap_rs_init()
1444 *handle = rstruct; in xpvtap_rs_init()
1457 xpvtap_rs_t *rstruct; in xpvtap_rs_fini() local
1462 rstruct = (xpvtap_rs_t *)*handle; in xpvtap_rs_fini()
1464 mutex_destroy(&rstruct->rs_mutex); in xpvtap_rs_fini()
1465 kmem_free(rstruct->rs_free, rstruct->rs_free_size); in xpvtap_rs_fini()
1466 kmem_free(rstruct, sizeof (xpvtap_rs_t)); in xpvtap_rs_fini()
1480 xpvtap_rs_t *rstruct; in xpvtap_rs_alloc() local
1492 rstruct = (xpvtap_rs_t *)handle; in xpvtap_rs_alloc()
1494 mutex_enter(&rstruct->rs_mutex); in xpvtap_rs_alloc()
1495 min = rstruct->rs_min; in xpvtap_rs_alloc()
1496 max = rstruct->rs_max; in xpvtap_rs_alloc()
1505 array_idx = rstruct->rs_last >> 6; in xpvtap_rs_alloc()
1506 free = rstruct->rs_free[array_idx]; in xpvtap_rs_alloc()
1507 last = rstruct->rs_last & 0x3F; in xpvtap_rs_alloc()
1512 *resource = rstruct->rs_last; in xpvtap_rs_alloc()
1515 rstruct->rs_free[array_idx] &= ~((uint64_t)1 << last); in xpvtap_rs_alloc()
1522 rstruct->rs_last++; in xpvtap_rs_alloc()
1523 if (rstruct->rs_last > max) { in xpvtap_rs_alloc()
1524 rstruct->rs_last = rstruct->rs_min; in xpvtap_rs_alloc()
1528 mutex_exit(&rstruct->rs_mutex); in xpvtap_rs_alloc()
1537 rstruct->rs_last++; in xpvtap_rs_alloc()
1538 if (rstruct->rs_last > max) { in xpvtap_rs_alloc()
1539 rstruct->rs_last = rstruct->rs_min; in xpvtap_rs_alloc()
1543 mutex_exit(&rstruct->rs_mutex); in xpvtap_rs_alloc()
1557 xpvtap_rs_t *rstruct; in xpvtap_rs_free() local
1564 rstruct = (xpvtap_rs_t *)handle; in xpvtap_rs_free()
1565 ASSERT(resource >= rstruct->rs_min); in xpvtap_rs_free()
1566 ASSERT(resource <= rstruct->rs_max); in xpvtap_rs_free()
1568 if (!rstruct->rs_flushing) { in xpvtap_rs_free()
1569 mutex_enter(&rstruct->rs_mutex); in xpvtap_rs_free()
1575 rstruct->rs_free[array_idx] |= ((uint64_t)1 << offset); in xpvtap_rs_free()
1577 if (!rstruct->rs_flushing) { in xpvtap_rs_free()
1578 mutex_exit(&rstruct->rs_mutex); in xpvtap_rs_free()
1590 xpvtap_rs_t *rstruct; in xpvtap_rs_flush() local
1601 rstruct = (xpvtap_rs_t *)handle; in xpvtap_rs_flush()
1603 mutex_enter(&rstruct->rs_mutex); in xpvtap_rs_flush()
1604 min = rstruct->rs_min; in xpvtap_rs_flush()
1605 max = rstruct->rs_max; in xpvtap_rs_flush()
1607 rstruct->rs_flushing = B_TRUE; in xpvtap_rs_flush()
1615 array_idx = rstruct->rs_last >> 6; in xpvtap_rs_flush()
1616 free = rstruct->rs_free[array_idx]; in xpvtap_rs_flush()
1617 last = rstruct->rs_last & 0x3F; in xpvtap_rs_flush()
1622 (*callback)(arg, rstruct->rs_last); in xpvtap_rs_flush()
1625 rstruct->rs_free[array_idx] |= ((uint64_t)1 << last); in xpvtap_rs_flush()
1629 rstruct->rs_last++; in xpvtap_rs_flush()
1630 if (rstruct->rs_last > max) { in xpvtap_rs_flush()
1631 rstruct->rs_last = rstruct->rs_min; in xpvtap_rs_flush()
1635 mutex_exit(&rstruct->rs_mutex); in xpvtap_rs_flush()