From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 41D427ECF for ; Wed, 8 Oct 2014 20:49:16 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 08 Oct 2014 11:56:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,679,1406617200"; d="scan'208";a="615348222" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 08 Oct 2014 11:56:32 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id s98IuU1w021598; Thu, 9 Oct 2014 02:56:30 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s98IuSDN004434; Thu, 9 Oct 2014 02:56:30 +0800 Received: (from hxie5@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id s98IuSaj004430; Thu, 9 Oct 2014 02:56:28 +0800 From: Huawei Xie To: dev@dpdk.org Date: Thu, 9 Oct 2014 02:54:43 +0800 Message-Id: <1412794499-4332-10-git-send-email-huawei.xie@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1412794499-4332-1-git-send-email-huawei.xie@intel.com> References: <1412794499-4332-1-git-send-email-huawei.xie@intel.com> Subject: [dpdk-dev] [PATCH v6 09/25] lib/librte_vhost: add queue_id parameter to vhost rx/tx functions. 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: Wed, 08 Oct 2014 18:49:16 -0000 queue_id parameter is added to vhost rx/tx functions for multiple queue support in future. Signed-off-by: Huawei Xie --- lib/librte_vhost/vhost_rxtx.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index b0b3f95..ab76512 100644 --- a/lib/librte_vhost/vhost_rxtx.c +++ b/lib/librte_vhost/vhost_rxtx.c @@ -61,7 +61,7 @@ * added to the RX queue. This function works when mergeable is disabled. */ static inline uint32_t __attribute__((always_inline)) -virtio_dev_rx(struct virtio_net *dev, struct rte_mbuf **pkts, uint32_t count) +virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id, struct rte_mbuf **pkts, uint32_t count) { struct vhost_virtqueue *vq; struct vring_desc *desc; @@ -78,6 +78,11 @@ virtio_dev_rx(struct virtio_net *dev, struct rte_mbuf **pkts, uint32_t count) uint8_t success = 0; LOG_DEBUG(VHOST_DATA, "(%"PRIu64") virtio_dev_rx()\n", dev->device_fh); + if (unlikely(queue_id != VIRTIO_RXQ)) { + LOG_DEBUG(VHOST_DATA, "mq isn't supported in this version.\n"); + return 0; + } + vq = dev->virtqueue[VIRTIO_RXQ]; count = (count > MAX_PKT_BURST) ? MAX_PKT_BURST : count; @@ -395,7 +400,7 @@ copy_from_mbuf_to_vring(struct virtio_net *dev, * added to the RX queue. This function works for mergeable RX. */ static inline uint32_t __attribute__((always_inline)) -virtio_dev_merge_rx(struct virtio_net *dev, struct rte_mbuf **pkts, +virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id, struct rte_mbuf **pkts, uint32_t count) { struct vhost_virtqueue *vq; @@ -406,6 +411,10 @@ virtio_dev_merge_rx(struct virtio_net *dev, struct rte_mbuf **pkts, LOG_DEBUG(VHOST_DATA, "(%"PRIu64") virtio_dev_merge_rx()\n", dev->device_fh); + if (unlikely(queue_id != VIRTIO_RXQ)) { + LOG_DEBUG(VHOST_DATA, "mq isn't supported in this version.\n"); + } + vq = dev->virtqueue[VIRTIO_RXQ]; count = RTE_MIN((uint32_t)MAX_PKT_BURST, count); @@ -513,7 +522,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, struct rte_mbuf **pkts, /* This function works for TX packets with mergeable feature enabled. */ static uint16_t void __attribute__((always_inline)) -virtio_dev_merge_tx(struct virtio_net *dev, struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t count) +virtio_dev_merge_tx(struct virtio_net *dev, uint16_t queue_id, struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t count) { struct rte_mbuf *m, *prev; struct vhost_virtqueue *vq; @@ -525,6 +534,11 @@ virtio_dev_merge_tx(struct virtio_net *dev, struct rte_mempool *mbuf_pool, struc uint16_t free_entries, entry_success = 0; uint16_t avail_idx; + if (unlikely(queue_id != VIRTIO_TXQ)) { + LOG_DEBUG(VHOST_DATA, "mq isn't supported in this version.\n"); + return 0; + } + vq = dev->virtqueue[VIRTIO_TXQ]; avail_idx = *((volatile uint16_t *)&vq->avail->idx); -- 1.8.1.4