From: Shai Brandes <shaib...@amazon.com> Provide a method to check the number of used entries in the send queue
Signed-off-by: Shai Brandes <shaib...@amazon.com> --- drivers/net/ena/base/ena_eth_com.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ena/base/ena_eth_com.h b/drivers/net/ena/base/ena_eth_com.h index 4e3d0fb6fd..877668612c 100644 --- a/drivers/net/ena/base/ena_eth_com.h +++ b/drivers/net/ena/base/ena_eth_com.h @@ -82,15 +82,14 @@ static inline void ena_com_unmask_intr(struct ena_com_io_cq *io_cq, ENA_REG_WRITE32(io_cq->bus, intr_reg->intr_control, io_cq->unmask_reg); } -static inline int ena_com_free_q_entries(struct ena_com_io_sq *io_sq) +static inline u16 ena_com_used_q_entries(struct ena_com_io_sq *io_sq) { - u16 tail, next_to_comp, cnt; - - next_to_comp = io_sq->next_to_comp; - tail = io_sq->tail; - cnt = tail - next_to_comp; + return io_sq->tail - io_sq->next_to_comp; +} - return io_sq->q_depth - 1 - cnt; +static inline int ena_com_free_q_entries(struct ena_com_io_sq *io_sq) +{ + return io_sq->q_depth - 1 - ena_com_used_q_entries(io_sq); } /* Check if the submission queue has enough space to hold required_buffers */ -- 2.17.1