queue->max_inflights = ADF_MAX_INFLIGHTS(queue->queue_size,
ADF_BYTES_TO_MSG_SIZE(desc_size));
- queue->modulo = ADF_RING_SIZE_MODULO(queue->queue_size);
+ queue->modulo_mask = (1 << ADF_RING_SIZE_MODULO(queue->queue_size)) - 1;
if (queue->max_inflights < 2) {
PMD_DRV_LOG(ERR, "Invalid num inflights");
queue->hw_queue_number, queue_base);
PMD_DRV_LOG(DEBUG, "RING: Name:%s, size in CSR: %u, in bytes %u,"
- " nb msgs %u, msg_size %u, max_inflights %u modulo %u",
+ " nb msgs %u, msg_size %u, max_inflights %u modulo mask %u",
queue->memz_name,
queue->queue_size, queue_size_bytes,
qp_conf->nb_descriptors, desc_size,
- queue->max_inflights, queue->modulo);
+ queue->max_inflights, queue->modulo_mask);
return 0;
queue->hw_queue_number, queue_config);
}
-
-static inline uint32_t adf_modulo(uint32_t data, uint32_t shift)
+static inline uint32_t adf_modulo(uint32_t data, uint32_t modulo_mask)
{
- uint32_t div = data >> shift;
- uint32_t mult = div << shift;
-
- return data - mult;
+ return data & modulo_mask;
}
static inline void
goto kick_tail;
}
- tail = adf_modulo(tail + queue->msg_size, queue->modulo);
+ tail = adf_modulo(tail + queue->msg_size, queue->modulo_mask);
ops++;
nb_ops_sent++;
}
tmp_qp->op_cookies[head / rx_queue->msg_size],
tmp_qp->qat_dev_gen);
- head = adf_modulo(head + rx_queue->msg_size, rx_queue->modulo);
+ head = adf_modulo(head + rx_queue->msg_size,
+ rx_queue->modulo_mask);
resp_msg = (uint8_t *)rx_queue->base_addr + head;
ops++;