From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id C4E33C37C for ; Wed, 15 Jun 2016 11:07:38 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 15 Jun 2016 02:07:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,475,1459839600"; d="scan'208";a="719348175" Received: from dpdk06.sh.intel.com ([10.239.128.225]) by FMSMGA003.fm.intel.com with ESMTP; 15 Jun 2016 02:07:32 -0700 From: Jianfeng Tan To: dev@dpdk.org Cc: Jianfeng Tan , rich.lane@bigswitch.com, yuanhan.liu@linux.intel.com, mst@redhat.com, nakajima.yoshihiro@lab.ntt.co.jp, p.fedin@samsung.com, ann.zhuangyanying@huawei.com, mukawa@igel.co.jp, nhorman@tuxdriver.com Date: Wed, 15 Jun 2016 09:07:17 +0000 Message-Id: <1465981637-38015-4-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1465981637-38015-1-git-send-email-jianfeng.tan@intel.com> References: <1462438781-139674-1-git-send-email-jianfeng.tan@intel.com> <1465981637-38015-1-git-send-email-jianfeng.tan@intel.com> Subject: [dpdk-dev] [PATCH v3 0/3] virtio-user: handle ctrl-q in driver 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, 15 Jun 2016 09:07:39 -0000 In virtio-user driver, when notify ctrl-queue, invoke API of virtio-user device emulation to handle ctrl-q command. Besides, multi-queue requires ctrl-queue and ctrl-queue will be enabled automatically when multi-queue is specified. Signed-off-by: Jianfeng Tan --- drivers/net/virtio/virtio_user_ethdev.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 8f401a3..4c9279e 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -42,6 +42,7 @@ #include "virtio_logs.h" #include "virtio_pci.h" #include "virtqueue.h" +#include "virtio_rxtx.h" #include "virtio_user/virtio_user_dev.h" #define virtio_user_get_dev(hw) \ @@ -200,6 +201,11 @@ virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq) uint64_t buf = 1; struct virtio_user_dev *dev = virtio_user_get_dev(hw); + if (hw->cvq && (hw->cvq->vq == vq)) { + virtio_user_handle_cq(dev, vq->vq_queue_index); + return; + } + if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0) PMD_DRV_LOG(ERR, "failed to kick backend: %s\n", strerror(errno)); @@ -360,6 +366,13 @@ virtio_user_pmd_devinit(const char *name, const char *params) if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_CQ_NUM) == 1) rte_kvargs_process(kvlist, VIRTIO_USER_ARG_CQ_NUM, &get_integer_arg, &cq); + else if (queues > 1) + cq = 1; + + if (queues > 1 && cq == 0) { + PMD_INIT_LOG(ERR, "multi-q requires ctrl-q"); + goto end; + } eth_dev = virtio_user_eth_dev_alloc(name); if (!eth_dev) { -- 2.1.4