MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ccp_lsb_alloc

Function ccp_lsb_alloc

dpdk/drivers/crypto/ccp/ccp_dev.c:279–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279static uint32_t
280ccp_lsb_alloc(struct ccp_queue *cmd_q, unsigned int count)
281{
282 struct ccp_device *ccp;
283 int start;
284
285 /* First look at the map for the queue */
286 if (cmd_q->lsb >= 0) {
287 start = (uint32_t)ccp_bitmap_find_next_zero_area(cmd_q->lsbmap,
288 LSB_SIZE, 0,
289 count);
290 if (start < LSB_SIZE) {
291 ccp_bitmap_set(cmd_q->lsbmap, start, count);
292 return start + cmd_q->lsb * LSB_SIZE;
293 }
294 }
295
296 /* try to get an entry from the shared blocks */
297 ccp = cmd_q->dev;
298
299 rte_spinlock_lock(&ccp->lsb_lock);
300
301 start = (uint32_t)ccp_bitmap_find_next_zero_area(ccp->lsbmap,
302 MAX_LSB_CNT * LSB_SIZE,
303 0, count);
304 if (start <= MAX_LSB_CNT * LSB_SIZE) {
305 ccp_bitmap_set(ccp->lsbmap, start, count);
306 rte_spinlock_unlock(&ccp->lsb_lock);
307 return start * LSB_ITEM_SIZE;
308 }
309 CCP_LOG_ERR("NO LSBs available");
310
311 rte_spinlock_unlock(&ccp->lsb_lock);
312
313 return 0;
314}
315
316static void __rte_unused
317ccp_lsb_free(struct ccp_queue *cmd_q,

Callers 1

ccp_add_deviceFunction · 0.85

Calls 4

ccp_bitmap_setFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected