[SLOF] [PATCH] virtio-net: use common receive buffer for devices

Nikunj A Dadhania nikunj at linux.vnet.ibm.com
Thu Aug 3 15:11:38 AEST 2017


Alexey Kardashevskiy <aik at ozlabs.ru> writes:

> On 02/08/17 04:14, Thomas Huth wrote:
>> On 01.08.2017 08:39, Nikunj A Dadhania wrote:
>>> 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.
>>>
>>> Use common receive buffer for all the virtio-net devices. This will reduce the
>>> memory requirement per virtio-net device in slof.
>> 
>> Not sure whether this is a really good idea... I think theoretically an
>> OF client could open multiple network devices and use them in parallel -
>> and then the devices would destroy their shared receive buffers mutually.
>> Maybe you could change the code so that the buffers are only allocated
>> when the device is opened, and released again when the device is closed
>> again?
>
> Agree, something like this would make sense imho:

Yes, similar thing, and we need virt-queues to be part of the private
structure, so created a separate structure and embed net_driver within
it.


>
>
> diff --git a/include/netdriver.h b/include/netdriver.h
> index d81134e..5fd1d6e 100644
> --- a/include/netdriver.h
> +++ b/include/netdriver.h
> @@ -19,6 +19,7 @@ typedef struct net_driver {
>         uint8_t mac_addr[6];
>         uint32_t reg;
>         int running;
> +    void *dev;
>  } net_driver_t;
>

Regards
Nikunj



More information about the SLOF mailing list