From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f179.google.com (mail-pf0-f179.google.com [209.85.192.179]) by dpdk.org (Postfix) with ESMTP id B67DA2BC9 for ; Fri, 4 Mar 2016 19:19:11 +0100 (CET) Received: by mail-pf0-f179.google.com with SMTP id 63so39171013pfe.3 for ; Fri, 04 Mar 2016 10:19:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CPWLDCUF/JFNu4UAwm0KqrtOxnGzb94UbAMYTggWmxY=; b=daG4Zm/6DJ7csWgn2KoRNF/5GPwwLrvzE4h8jvQ0GWSli9APoaqVgNMgaOkGyQ9Sq7 /v4gV6nwOlz/rZwoL5/AS6bj+WvOqPfj4l39QtiMSU7e+9Oo2UNl/antZRXvHgbXh7FK 5CqpycoJQknnQ4E4gCObZwG2e1cGwDE8itarJcZDIGi2p/Z6haGNbFzCclELuUKwgffQ PRvpZ567BFftoijzgQxBca+o6wE8f9Y495qXGaDnzxMRtGi0pzNH6BoDZ1v1JlOI6ump rXb8gPPCn0himt5BSdXGmKqwuUR9KE2GOwkM+c1ol1wQjckbsMmS1Q8bkEUF46T7HxuD +s4A== 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=CPWLDCUF/JFNu4UAwm0KqrtOxnGzb94UbAMYTggWmxY=; b=ZScgz8TeBDGm2EJg9NwI1khZ5qPVgdL3RICfxZa/Ih2XyLV+AoHJxmlQqAXEvbiE0S NTvyo+GO/WkivLhMXrnp+AXd/dyqIiPJtSXJ+ipjLsNjjPwanT4OuhGBIq6gd/f1P1Gn Rpeo3rKLAVE3qSU7bK7fkPCrCH2XjLX+z/ktpL6opjBuiGDL8ow4g0HNogQQsKvxV7M8 EHmrI+sPVuAvGERvQJyoRi91YMNcId7JvWADEZegEGGasnw/ECp87LdNUXqaZxIal5rZ mF/qGyDV8IL7K5jOxiJEYmVTEBPHagQoiGkyrDfvKbZQxqra/Rq+JPyGomnDFckniCOT e25A== X-Gm-Message-State: AD7BkJJJAJZAcCTbU9QXfHtnk7Goa53edQgGLqM892+6PMnjL5a9fdfyNedguaQOr7jrLg== X-Received: by 10.98.68.91 with SMTP id r88mr14221803pfa.12.1457115551187; Fri, 04 Mar 2016 10:19:11 -0800 (PST) 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 qy7sm7040857pab.34.2016.03.04.10.19.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Mar 2016 10:19:10 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Fri, 4 Mar 2016 10:19:21 -0800 Message-Id: <1457115561-31186-4-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1457115561-31186-1-git-send-email-stephen@networkplumber.org> References: <1457115561-31186-1-git-send-email-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 3/3] virtio: optimize transmit enqueue 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 Mar 2016 18:19:12 -0000 All the error checks in virtqueue_enqueue_xmit are already done by the caller. Therefore they can be removed to improve performance. Signed-off-by: Stephen Hemminger --- drivers/net/virtio/virtio_rxtx.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 0f12e64..1c0b6eb 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -208,7 +208,7 @@ virtqueue_enqueue_recv_refill(struct virtqueue *vq, struct rte_mbuf *cookie) return 0; } -static int +static inline void virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie, uint16_t needed, int use_indirect, int can_push) { @@ -219,14 +219,7 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie, uint16_t head_size = txvq->hw->vtnet_hdr_size; unsigned long offs; - if (unlikely(txvq->vq_free_cnt == 0)) - return -ENOSPC; - if (unlikely(txvq->vq_free_cnt < needed)) - return -EMSGSIZE; head_idx = txvq->vq_desc_head_idx; - if (unlikely(head_idx >= txvq->vq_nentries)) - return -EFAULT; - idx = head_idx; dxp = &txvq->vq_descx[idx]; dxp->cookie = (void *)cookie; @@ -288,8 +281,6 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie, txvq->vq_desc_tail_idx = idx; txvq->vq_free_cnt = (uint16_t)(txvq->vq_free_cnt - needed); vq_update_avail_ring(txvq, head_idx); - - return 0; } static inline struct rte_mbuf * @@ -931,17 +922,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) } /* Enqueue Packet buffers */ - error = virtqueue_enqueue_xmit(txvq, txm, slots, - use_indirect, can_push); - if (unlikely(error)) { - if (error == ENOSPC) - PMD_TX_LOG(ERR, "virtqueue_enqueue Free count = 0"); - else if (error == EMSGSIZE) - PMD_TX_LOG(ERR, "virtqueue_enqueue Free count < 1"); - else - PMD_TX_LOG(ERR, "virtqueue_enqueue error: %d", error); - break; - } + virtqueue_enqueue_xmit(txvq, txm, slots, use_indirect, can_push); txvq->bytes += txm->pkt_len; virtio_update_packet_stats(txvq, txm); -- 2.1.4