Commit d9186098 authored by Sameeh Jubran's avatar Sameeh Jubran Committed by David S. Miller

net: ena: optimise calculations for CQ doorbell

This patch initially checks if CQ doorbell
is needed before proceeding with the calculations.
Signed-off-by: default avatarIgor Chauskin <igorch@amazon.com>
Signed-off-by: default avatarSameeh Jubran <sameehj@amazon.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cdf449ec
...@@ -195,15 +195,17 @@ static inline int ena_com_update_dev_comp_head(struct ena_com_io_cq *io_cq) ...@@ -195,15 +195,17 @@ static inline int ena_com_update_dev_comp_head(struct ena_com_io_cq *io_cq)
u16 unreported_comp, head; u16 unreported_comp, head;
bool need_update; bool need_update;
head = io_cq->head; if (unlikely(io_cq->cq_head_db_reg)) {
unreported_comp = head - io_cq->last_head_update; head = io_cq->head;
need_update = unreported_comp > (io_cq->q_depth / ENA_COMP_HEAD_THRESH); unreported_comp = head - io_cq->last_head_update;
need_update = unreported_comp > (io_cq->q_depth / ENA_COMP_HEAD_THRESH);
if (io_cq->cq_head_db_reg && need_update) {
pr_debug("Write completion queue doorbell for queue %d: head: %d\n", if (unlikely(need_update)) {
io_cq->qid, head); pr_debug("Write completion queue doorbell for queue %d: head: %d\n",
writel(head, io_cq->cq_head_db_reg); io_cq->qid, head);
io_cq->last_head_update = head; writel(head, io_cq->cq_head_db_reg);
io_cq->last_head_update = head;
}
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment