[libvirt] [PATCH 4/6] virNetDevMacVLanTapSetup: Rework to support multiple FDs

Michal Privoznik mprivozn at redhat.com
Mon Dec 7 10:58:07 UTC 2015


On 04.12.2015 18:43, Laine Stump wrote:
> On 12/04/2015 07:31 AM, Michal Privoznik wrote:
>> So, for the multiqueue on macvtaps we are going to need to open
>> the device multiple times. Currently, this is not supported.
>> Rework the function, so that upper layers can be reworked too.
> 
> Either merge 3 & 4 together, or change the log message (I'm okay with
> multiple functions at the same level being changed in the same patch).
> 
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>   src/util/virnetdevmacvlan.c | 66
>> ++++++++++++++++++++++++---------------------
>>   1 file changed, 35 insertions(+), 31 deletions(-)
>>
>> diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
>> index d20990b..f7a7d72 100644
>> --- a/src/util/virnetdevmacvlan.c
>> +++ b/src/util/virnetdevmacvlan.c
>> @@ -302,10 +302,9 @@ virNetDevMacVLanTapOpen(const char *ifname,
>>     /**
>>    * virNetDevMacVLanTapSetup:
>> - * @tapfd: file descriptor of the macvtap tap
>> - * @vnet_hdr: 1 to enable IFF_VNET_HDR, 0 to disable it
>> - *
>> - * Returns 0 on success, -1 in case of fatal error, error code
>> otherwise.
>> + * @tapfd: array of file descriptors of the macvtap tap
>> + * @tapfdSize: number of file descriptors in @tapfd
>> + * @vnet_hdr: whether to enable or disable IFF_VNET_HDR
>>    *
>>    * Turn the IFF_VNET_HDR flag, if requested and available, make sure
>>    * it's off in the other cases.
>> @@ -313,47 +312,52 @@ virNetDevMacVLanTapOpen(const char *ifname,
>>    * be turned off for some reason. This is reported with -1. Other fatal
>>    * error is not being able to read the interface flags. In that case
>> the
>>    * macvtap device should not be used.
>> + *
> 
> Comparing this to the VNET_HDR stuff for tap devices, I see that in that
> case lack of support for VNET_HDR isn't fatal - it simply isn't set. My
> guess is that VNET_HDR support was probably added prior to macvtap, so
> that it's always there if we're doing macvtap, but I don't know for
> sure. (I'm just wondering if maybe there's some way code could be shared
> between the two to reduce maintenance).
> 
> The other difference is that IFF_MULTI_QUEUE is set on each fd for a tap
> device. Is this also needed for macvtap?

Good point. Honestly, I don't know. I have it working locally even
without the flag. Let me ask the kvm guy that implemented the feature
there and get back.

Michal




More information about the libvir-list mailing list