From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 31FE95A9D for ; Tue, 27 Jan 2015 03:37:12 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 26 Jan 2015 18:37:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,471,1418112000"; d="scan'208";a="656921758" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 26 Jan 2015 18:37:05 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t0R2b2Mo016309; Tue, 27 Jan 2015 10:37:02 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t0R2axxn013891; Tue, 27 Jan 2015 10:37:02 +0800 Received: (from couyang@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t0R2ax5l013887; Tue, 27 Jan 2015 10:36:59 +0800 From: Ouyang Changchun To: dev@dpdk.org Date: Tue, 27 Jan 2015 10:36:03 +0800 Message-Id: <1422326164-13697-24-git-send-email-changchun.ouyang@intel.com> X-Mailer: git-send-email 1.7.12.2 In-Reply-To: <1422326164-13697-1-git-send-email-changchun.ouyang@intel.com> References: <1421298930-15210-1-git-send-email-changchun.ouyang@intel.com> <1422326164-13697-1-git-send-email-changchun.ouyang@intel.com> Subject: [dpdk-dev] [PATCH v2 23/24] virtio: Fix zero copy break issue 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: Tue, 27 Jan 2015 02:37:49 -0000 vHOST zero copy need get vring descriptor and its buffer address to set the DMA address of HW ring, it is done in new_device when ioctl set_backend is called. This requies virtio_dev_rxtx_start is called before vtpci_reinit_complete, which makes sure the vring descriptro and its buffer is ready before its using. this patch also fixes one set status issue, according to virtio spec, VIRTIO_CONFIG_STATUS_ACK should be set after virtio hw reset. Signed-off-by: Changchun Ouyang --- lib/librte_pmd_virtio/virtio_ethdev.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c index b905532..648c761 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.c +++ b/lib/librte_pmd_virtio/virtio_ethdev.c @@ -414,6 +414,7 @@ virtio_dev_close(struct rte_eth_dev *dev) /* reset the NIC */ vtpci_irq_config(hw, VIRTIO_MSI_NO_VECTOR); vtpci_reset(hw); + hw->started = 0; virtio_dev_free_mbufs(dev); } @@ -1107,9 +1108,6 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv, return -ENOMEM; } - /* Tell the host we've noticed this device. */ - vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_ACK); - pci_dev = eth_dev->pci_dev; if (virtio_resource_init(pci_dev) < 0) #ifdef RTE_EAL_PORT_IO @@ -1123,6 +1121,9 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv, /* Reset the device although not necessary at startup */ vtpci_reset(hw); + /* Tell the host we've noticed this device. */ + vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_ACK); + /* Tell the host we've known how to drive the device. */ vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER); virtio_negotiate_features(hw); @@ -1324,10 +1325,10 @@ virtio_dev_start(struct rte_eth_dev *dev) if (hw->started) return 0; - vtpci_reinit_complete(hw); - /* Do final configuration before rx/tx engine starts */ virtio_dev_rxtx_start(dev); + vtpci_reinit_complete(hw); + hw->started = 1; /*Notify the backend -- 1.8.4.2