From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by dpdk.org (Postfix) with ESMTP id 375648E80 for ; Mon, 19 Oct 2015 07:16:07 +0200 (CEST) Received: by pabrc13 with SMTP id rc13so179467234pab.0 for ; Sun, 18 Oct 2015 22:16:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9c0/EuTi9mwqsGDu/+HEUvAQGDLxij1VN6ykfdQTLXI=; b=TFcDm7VyPRYb2SsAqDLojg7O206BES51KJw8nuK/hN37fLN3I4PVZptSJR5z36xjzb IsXSpvXFy3eCkGwSQkJOa5mkdtlp7OkpdlHHtr8saFP76YD09mD6OVWpQSDba5QnrNO+ avnprhbVAMMevW1JFkWAGjX63xynd1DK1Z3ED0eQpgs7as3h5eXA85+bnKsfLtqrfjqp 7bIlCU3ei6vgnxLlw4cQXz47tjhsMIL1Z5ZAK4D5nD4W3zMldAWRrX6PsvNN4nmZTz7h ju5/O6WuIUTIq2kO0GMThFUv0UbmzVpHu4PG9I3Eo+O9VePLEV0NucjeUFhQ8+aDBNZB gi+A== X-Gm-Message-State: ALoCoQlCAIMfC4iDTg/JsXTVUaRJzmKGB0dUKGVHkH6YPkTvtrp3euboKmPGFLsRs9pvL2tqrs/7 X-Received: by 10.66.163.228 with SMTP id yl4mr32361290pab.112.1445231766602; Sun, 18 Oct 2015 22:16:06 -0700 (PDT) Received: from xeon-e3.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id k10sm33681035pbq.78.2015.10.18.22.16.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Oct 2015 22:16:05 -0700 (PDT) From: Stephen Hemminger To: huawei.xie@intel.com, changchun.ouyang@intel.com Date: Sun, 18 Oct 2015 22:16:09 -0700 Message-Id: <1445231772-17467-3-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1445231772-17467-1-git-send-email-stephen@networkplumber.org> References: <1445231772-17467-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH 2/5] virtio: don't use unlikely for normal tx stuff X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2015 05:16:07 -0000 Don't use unlikely() for VLAN or ring getting full. GCC will not optimize code in unlikely paths and since these can happen with normal code that can hurt performance. Signed-off-by: Stephen Hemminger --- drivers/net/virtio/virtio_rxtx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 5b50ed0..dbe6665 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -763,7 +763,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) int need = txm->nb_segs - txvq->vq_free_cnt + 1; /* Positive value indicates it need free vring descriptors */ - if (unlikely(need > 0)) { + if (need > 0) { nb_used = VIRTQUEUE_NUSED(txvq); virtio_rmb(); need = RTE_MIN(need, (int)nb_used); @@ -778,7 +778,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) } /* Do VLAN tag insertion */ - if (unlikely(txm->ol_flags & PKT_TX_VLAN_PKT)) { + if (txm->ol_flags & PKT_TX_VLAN_PKT) { error = rte_vlan_insert(&txm); if (unlikely(error)) { rte_pktmbuf_free(txm); @@ -798,10 +798,9 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) break; } txvq->bytes += txm->pkt_len; + ++txvq->packets; } - txvq->packets += nb_tx; - if (likely(nb_tx)) { vq_update_avail_idx(txvq); -- 2.1.4