From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by dpdk.org (Postfix) with ESMTP id 9093E376D for ; Fri, 4 Sep 2015 22:58:27 +0200 (CEST) Received: by pacfv12 with SMTP id fv12so35110692pac.2 for ; Fri, 04 Sep 2015 13:58:26 -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=ZYIdGk9k94xIouDcc0Vidss0vao89vYaxgSGuE23pXmf+BRo45dB68YR+bslw0wke3 t3SUsCRCgGa7/9QoC7+mXfJv1arYu0xRuSdgmckxyAuL+A3RJSRm89zHVM4U2DFluUJz 6c7Tg9p7QkfcwnqbGtf2qIMnm3QbBctNC4mjSLr+yr6GRfs6KK+ubTmgJ2u2YQcy1/CI cXl/kRrQ7EuTQSO8GH3pp11fdhcuOuIF2VSJFY+JivvfDk2wl013wKqHqX+MLTK9pWtg /S9/nGCC6mljF9oeDWx3WevByX6bofzm7CRmQ8JBpB5+QKVKUOu6bdaXFitKLBAUE6BJ T4Vw== X-Gm-Message-State: ALoCoQnSmozLT+JJO8TwB9YZnMX+4KaC5u22+8ku5LJxeu8VXMhhurAQzIgKdGhYRt9sFbYOvrp0 X-Received: by 10.68.109.2 with SMTP id ho2mr11211557pbb.158.1441400306887; Fri, 04 Sep 2015 13:58:26 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id u5sm3524262pdr.63.2015.09.04.13.58.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Sep 2015 13:58:26 -0700 (PDT) From: Stephen Hemminger To: huawei.xie@intel.com, changchun.ouyang@intel.com Date: Fri, 4 Sep 2015 13:58:26 -0700 Message-Id: <1441400308-5725-3-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441400308-5725-1-git-send-email-stephen@networkplumber.org> References: <1441400308-5725-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH 2/4] 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: Fri, 04 Sep 2015 20:58:28 -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