From 685af54d8a47a42d9d06c51be45870f6f210a0dc Mon Sep 17 00:00:00 2001 From: Nikunj A Dadhania Date: Thu, 3 Aug 2017 15:44:59 +0530 Subject: virtio-net: rework the driver to support multiple open Found that virtio-net is using a around 200K receive buffer per device, if we connect more than 40 virtio-net devices the heap(8MB) gets over. Because of which allocation starts failing and the VM does not boot. Moreover, the driver did not support opening multiple device, which is possible using the OF client interface. As it was using globals to store the state information of the driver. Now the driver allocates a virtio_net structure during device open stage and fills in the state information. This details are used during various device functions and finally for cleaning up on close operation. Now as the buffer memory is allocated during open and freed during the close operations the heap usage is contained. Reported-by: Satheesh Rajendran Signed-off-by: Nikunj A Dadhania Reviewed-by: Thomas Huth Signed-off-by: Alexey Kardashevskiy --- lib/libvirtio/virtio.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/libvirtio/virtio.h') diff --git a/lib/libvirtio/virtio.h b/lib/libvirtio/virtio.h index 0fee4ba..389355c 100644 --- a/lib/libvirtio/virtio.h +++ b/lib/libvirtio/virtio.h @@ -110,6 +110,7 @@ extern void virtio_fill_desc(struct vring_desc *desc, bool is_modern, uint64_t addr, uint32_t len, uint16_t flags, uint16_t next); extern int virtio_queue_init_vq(struct virtio_device *dev, struct vqs *vq, unsigned int id); +extern void virtio_queue_term_vq(struct virtio_device *dev, struct vqs *vq, unsigned int id); extern struct virtio_device *virtio_setup_vd(void); extern void virtio_reset_device(struct virtio_device *dev); -- cgit v1.1