From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by dpdk.org (Postfix) with ESMTP id C70611B412 for ; Thu, 7 Jun 2018 11:44:07 +0200 (CEST) Received: by mail-lf0-f67.google.com with SMTP id j13-v6so13639561lfb.13 for ; Thu, 07 Jun 2018 02:44:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kdkCH7ytM2PLnyKJUz10VN66VjYw0xAVX91cVlg73gY=; b=ovbKL/Gmkryss7fVDzqZdTKrJWEZs5+S/kQOddpUPvIkFDwTzbRyNE2mqUS/WY8Ucz F/+r+V2wQfE6Ea22BO/SFOBCItrUYSuj8zCXb8yMbEvKPqc1AF4xZy3x3Xzmjb13zXCt OltMtFB5rjEm8a8RaVAyXJVpyhZ3EGQfC6WNlXOsAbxUq9qSs3PgnSo95s+pelEDTlS/ x2nyspjfStT0oCsiKegF4q9FIOwVIWeW9bsL1Q4HQOx8OJF28GqtIQineg6E5Weqc39I BLplTAfeSjGZu0ryVOt7rKVrk6Z+V5yOrE+VDobUVU/Tg207znjZ6tKgtkOtLD3imXoN bbOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kdkCH7ytM2PLnyKJUz10VN66VjYw0xAVX91cVlg73gY=; b=bY8e4bszezO/Ws/bjAyfx7qJ5km+g1TKZCZbBMSc+dCZzyeawK9w3rkSTRtwSQRkYk 2SI99FS0QiVMg1ipr7SxqdSynQ2JYzZQiuEkeAmE7QdSciC71eBf2LG+92t/6ICXgxar njcVJzpk3hMdv+gvFkcM/xo2BqaFz17X45QwKMRQMs9fm/+phVHJRlY6zWbLYCJAOBir CnKfrw70RSAbeo+TAj/jJZ9S1eFucFM1dwPoXxv8CaSPjKuNSoNf2Np0TYkKjOr5drTU uE9di3XxVKiW66q6gOlXOKbG5a4OSziIUuNBpcAPo/n855ZbCYTN7e2LTRTho/CKCA9F 3/uw== X-Gm-Message-State: APt69E1K3A28woOBdVMszsa2HNo1KZMCtK8FLY40wqHwtuFWap5IGqul qO8wZvT4rwsp7mgD3OvUPiAnug== X-Google-Smtp-Source: ADUXVKK8l9rzB6tqdDg9fVCNAgma1ntonqunEb5jJb+x2vSEDSIkei6esOZEBys/3MGGMRkKE3dxng== X-Received: by 2002:a19:9390:: with SMTP id w16-v6mr870817lfk.70.1528364647448; Thu, 07 Jun 2018 02:44:07 -0700 (PDT) Received: from mkPC.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id p28-v6sm3612368lfh.24.2018.06.07.02.44.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 02:44:05 -0700 (PDT) From: Michal Krawczyk To: Marcin Wojtas , Michal Krawczyk , Guy Tzalik , Evgeny Schemeilin Cc: dev@dpdk.org, matua@amazon.com, Rafal Kozik Date: Thu, 7 Jun 2018 11:43:15 +0200 Message-Id: <20180607094322.14312-20-mk@semihalf.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180607094322.14312-1-mk@semihalf.com> References: <20180607094322.14312-1-mk@semihalf.com> Subject: [dpdk-dev] [PATCH v3 20/27] net/ena: add (un)likely statements X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2018 09:44:09 -0000 From: Rafal Kozik Add likely and unlikely statements to increase performance. Signed-off-by: Rafal Kozik Acked-by: Michal Krawczyk --- drivers/net/ena/ena_ethdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 5fbf0e5d5..1425a0496 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; -- 2.14.1