From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by dpdk.org (Postfix) with ESMTP id 10BD98E86 for ; Mon, 19 Oct 2015 07:16:10 +0200 (CEST) Received: by padhk11 with SMTP id hk11so18235420pad.1 for ; Sun, 18 Oct 2015 22:16:09 -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=uUxF+H0SoaSUPWiVCEWmnSCRKadZrVNHsoGAnUuMSnA=; b=I5/49sEGbbAthTYzGCC5ahTpcdyvwJ4aZwGmpa8aMCBj9nv88FiD/S92ti8zUoNIYw HgZ/1GTP93h4Q+Z+ASiSd0DYE9UVPApEg1gd9EYqT09SFVgiguO5pFFBriw6Efq65rQ0 U1H+9ONDqr8kxwsDQxmnzFW0fZxGwFMsBRYraVsWSPiwnnGhnijZsdQ1F8oV0xej8sbV JArAorpgsu2a4Itp8eqJLAIKagskPi66JM7y1m/88MUQSnK7PvB9aM/7gy86c5bc8vFC pxTLB5NHKWH9dXSoiW2/ZtV2faGFUHbQgzzi2S3ZGlr7dr8Zd3t9mJHGSg0svQ06sM2O xlgA== X-Gm-Message-State: ALoCoQkWwiUuDB9aioihRpODoPny7sAdEZPT6Vu6BrJSUalF/tN0Js/F0q5no9fUqqqtAy6nu7a0 X-Received: by 10.66.157.3 with SMTP id wi3mr32314642pab.17.1445231769486; Sun, 18 Oct 2015 22:16:09 -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.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Oct 2015 22:16:08 -0700 (PDT) From: Stephen Hemminger To: huawei.xie@intel.com, changchun.ouyang@intel.com Date: Sun, 18 Oct 2015 22:16:12 -0700 Message-Id: <1445231772-17467-6-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 5/5] 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: Mon, 19 Oct 2015 05:16:10 -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 dbedcc3..8fa0dd7 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -198,7 +198,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) { @@ -209,14 +209,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; @@ -267,8 +260,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 * @@ -828,17 +819,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; ++txvq->packets; } -- 2.1.4