Lines Matching refs:bc

255 bcache_slab_size(struct bcache *bc)  in bcache_slab_size()  argument
257 struct bpool *bp = bc->bp; in bcache_slab_size()
265 struct bcache *bc; in bcache_init() local
267 bc = calloc(1, sizeof(struct bcache)); in bcache_init()
268 if (!bc) in bcache_init()
271 bc->bp = bp; in bcache_init()
272 bc->n_buffers_cons = 0; in bcache_init()
273 bc->n_buffers_prod = 0; in bcache_init()
278 free(bc); in bcache_init()
282 bc->slab_cons = bp->slabs_reserved[bp->n_slabs_reserved_available - 1]; in bcache_init()
283 bc->slab_prod = bp->slabs_reserved[bp->n_slabs_reserved_available - 2]; in bcache_init()
287 return bc; in bcache_init()
291 bcache_free(struct bcache *bc) in bcache_free() argument
295 if (!bc) in bcache_free()
302 bp = bc->bp; in bcache_free()
304 bp->slabs_reserved[bp->n_slabs_reserved_available] = bc->slab_prod; in bcache_free()
305 bp->slabs_reserved[bp->n_slabs_reserved_available + 1] = bc->slab_cons; in bcache_free()
309 free(bc); in bcache_free()
318 bcache_cons_check(struct bcache *bc, u32 n_buffers) in bcache_cons_check() argument
320 struct bpool *bp = bc->bp; in bcache_cons_check()
322 u64 n_buffers_cons = bc->n_buffers_cons; in bcache_cons_check()
349 bp->slabs[n_slabs_available] = bc->slab_cons; in bcache_cons_check()
353 bc->slab_cons = slab_full; in bcache_cons_check()
354 bc->n_buffers_cons = n_buffers_per_slab; in bcache_cons_check()
359 bcache_cons(struct bcache *bc) in bcache_cons() argument
361 u64 n_buffers_cons = bc->n_buffers_cons - 1; in bcache_cons()
364 buffer = bc->slab_cons[n_buffers_cons]; in bcache_cons()
365 bc->n_buffers_cons = n_buffers_cons; in bcache_cons()
370 bcache_prod(struct bcache *bc, u64 buffer) in bcache_prod() argument
372 struct bpool *bp = bc->bp; in bcache_prod()
374 u64 n_buffers_prod = bc->n_buffers_prod; in bcache_prod()
382 bc->slab_prod[n_buffers_prod] = buffer; in bcache_prod()
383 bc->n_buffers_prod = n_buffers_prod + 1; in bcache_prod()
397 bp->slabs[n_slabs_available] = bc->slab_prod; in bcache_prod()
402 bc->slab_prod = slab_empty; in bcache_prod()
403 bc->n_buffers_prod = 1; in bcache_prod()
442 struct bcache *bc; member
469 bcache_free(p->bc); in port_free()
490 p->bc = bcache_init(params->bp); in port_init()
491 if (!p->bc || in port_init()
492 (bcache_slab_size(p->bc) < umem_fq_size) || in port_init()
493 (bcache_cons_check(p->bc, umem_fq_size) < umem_fq_size)) { in port_init()
518 bcache_cons(p->bc); in port_init()
534 n_pkts = bcache_cons_check(p->bc, n_pkts); in port_rx_burst()
580 bcache_cons(p->bc); in port_rx_burst()
601 bcache_prod(p->bc, addr); in port_tx_burst()