summaryrefslogtreecommitdiff
path: root/drivers/net/ena
diff options
context:
space:
mode:
authorRafal Kozik <rk@semihalf.com>2018-06-07 11:43:15 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2018-06-14 19:27:50 +0200
commit3d19e1abb7930e138ec861ce6905d7adbe8ecf27 (patch)
tree3967e995221e85e11cbffa7fcbe435bf8e5a355a /drivers/net/ena
parentf7d82d246dd91f4dd9dae33d761a9dfd80b0d9b4 (diff)
downloaddpdk-next-eventdev-3d19e1abb7930e138ec861ce6905d7adbe8ecf27.zip
dpdk-next-eventdev-3d19e1abb7930e138ec861ce6905d7adbe8ecf27.tar.gz
dpdk-next-eventdev-3d19e1abb7930e138ec861ce6905d7adbe8ecf27.tar.xz
net/ena: add (un)likely statements
Add likely and unlikely statements to increase performance. Signed-off-by: Rafal Kozik <rk@semihalf.com> Acked-by: Michal Krawczyk <mk@semihalf.com>
Diffstat (limited to 'drivers/net/ena')
-rw-r--r--drivers/net/ena/ena_ethdev.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 5fbf0e5..1425a04 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -936,7 +936,7 @@ ena_calc_queue_size(struct ena_com_dev *ena_dev,
if (!rte_is_power_of_2(queue_size))
queue_size = rte_align32pow2(queue_size >> 1);
- if (queue_size == 0) {
+ if (unlikely(queue_size == 0)) {
PMD_INIT_LOG(ERR, "Invalid queue size");
return -EFAULT;
}
@@ -1360,7 +1360,7 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count)
}
/* When we submitted free recources to device... */
- if (i > 0) {
+ if (likely(i > 0)) {
/* ...let HW know that it can fill buffers with data */
rte_wmb();
ena_com_write_sq_doorbell(rxq->ena_com_io_sq);
@@ -1466,7 +1466,7 @@ static void ena_interrupt_handler_rte(void *cb_arg)
struct ena_com_dev *ena_dev = &adapter->ena_dev;
ena_com_admin_q_comp_intr_handler(ena_dev);
- if (adapter->state != ENA_ADAPTER_STATE_CLOSED)
+ if (likely(adapter->state != ENA_ADAPTER_STATE_CLOSED))
ena_com_aenq_intr_handler(ena_dev, adapter);
}
@@ -1856,7 +1856,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
mbuf->data_off = RTE_PKTMBUF_HEADROOM;
mbuf->refcnt = 1;
mbuf->next = NULL;
- if (segments == 0) {
+ if (unlikely(segments == 0)) {
mbuf->nb_segs = ena_rx_ctx.descs;
mbuf->port = rx_ring->port_id;
mbuf->pkt_len = 0;