From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ouyang Changchun Subject: [PATCH v4 23/26] virtio: Fix zero copy break issue Date: Mon, 9 Feb 2015 09:14:12 +0800 Message-ID: <1423444455-11330-24-git-send-email-changchun.ouyang@intel.com> References: <1422516249-14596-1-git-send-email-changchun.ouyang@intel.com> <1423444455-11330-1-git-send-email-changchun.ouyang@intel.com> To: dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <1423444455-11330-1-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 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 1163d42..9eb0217 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.c +++ b/lib/librte_pmd_virtio/virtio_ethdev.c @@ -417,6 +417,7 @@ virtio_dev_close(struct rte_eth_dev *dev) if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) vtpci_irq_config(hw, VIRTIO_MSI_NO_VECTOR); vtpci_reset(hw); + hw->started = 0; virtio_dev_free_mbufs(dev); } @@ -1132,9 +1133,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) return -1; @@ -1145,6 +1143,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); @@ -1337,10 +1338,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