From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by dpdk.org (Postfix) with ESMTP id 84D9B5A87 for ; Mon, 19 Oct 2015 06:19:15 +0200 (CEST) Received: by pabrc13 with SMTP id rc13so178036887pab.0 for ; Sun, 18 Oct 2015 21:19:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=NvgiBOQmHOeswrfICsXmnTFH0GI4qvDtf+4zYJcG5zU=; b=Kr3iTGFP+lacgOWlwFP71fPZl4usjz0kXrtg10cU/pINeHwRlxG6sc/+xUouejazqZ 1nT7N+V0GD6x3WWuRI42y2jNxxzuQ/QL3CYrYynVBljGOPeRHQnI/rF+dcURxx4ajl20 /dTC99FtVuQf9OfQ3R72DsXahMjvyffV81oS4N19jlHPsrOTZ2Th5KZAArbprNfxhO/a xHlqSk1czpLNBzosYFToNGbtxAtPEn2eRVU7EcPeGqh7f0sLOpV8j7UhxJwkL4r9xwFO MbN0J0904KxAKfklXVzE9DdGhv76i+6Yvb3dBY2MPZK9mgE/mG35KK+SlBmRMnQ2gFdx lTmw== X-Gm-Message-State: ALoCoQnP1ikjdmQSw+88YGIbDqbtBurMKNA2D1ZV3f3esVexMr9n2Mmy1fikTmtebsM2c9f0H1fX X-Received: by 10.66.141.199 with SMTP id rq7mr32299329pab.140.1445228354972; Sun, 18 Oct 2015 21:19:14 -0700 (PDT) Received: from xeon-e3 (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id iy1sm33402712pbb.85.2015.10.18.21.19.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2015 21:19:14 -0700 (PDT) Date: Sun, 18 Oct 2015 21:19:25 -0700 From: Stephen Hemminger To: Huawei Xie Message-ID: <20151018211925.7c1b9fb2@xeon-e3> In-Reply-To: <1445149744-3217-7-git-send-email-huawei.xie@intel.com> References: <1443537953-23917-1-git-send-email-huawei.xie@intel.com> <1445149744-3217-1-git-send-email-huawei.xie@intel.com> <1445149744-3217-7-git-send-email-huawei.xie@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v2 6/7] virtio: simple tx routine 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 04:19:15 -0000 +static inline void __attribute__((always_inline)) +virtio_xmit_cleanup(struct virtqueue *vq) +{ Please don't use always inline, frustrating the compiler isn't going to help. + uint16_t i, desc_idx; + int nb_free = 0; + struct rte_mbuf *m, *free[VIRTIO_TX_MAX_FREE_BUF_SZ]; + + desc_idx = (uint16_t)(vq->vq_used_cons_idx & + ((vq->vq_nentries >> 1) - 1)); + free[0] = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie; + nb_free = 1; + + for (i = 1; i < VIRTIO_TX_FREE_NR; i++) { + m = (struct rte_mbuf *)vq->vq_descx[desc_idx++].cookie; + if (likely(m->pool == free[0]->pool)) + free[nb_free++] = m; + else { + rte_mempool_put_bulk(free[0]->pool, (void **)free, + nb_free); + free[0] = m; + nb_free = 1; + } + } + + rte_mempool_put_bulk(free[0]->pool, (void **)free, nb_free); + vq->vq_used_cons_idx += VIRTIO_TX_FREE_NR; + vq->vq_free_cnt += (VIRTIO_TX_FREE_NR << 1); + + return; +} Don't add return; at end of void functions. It only clutters things for no reason.