qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/2] net: Drop the NetLegacy structure, always use Netdev


From: Thomas Huth
Subject: Re: [PATCH v2 2/2] net: Drop the NetLegacy structure, always use Netdev instead
Date: Wed, 13 May 2020 10:40:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 12/05/2020 17.51, Eric Blake wrote:
> On 5/12/20 10:13 AM, Thomas Huth wrote:
> 
>>>> +++ b/qapi/net.json
>>>> @@ -453,7 +453,7 @@
>>>>    #        'l2tpv3' - since 2.1
>>>>    ##
>>>>    { 'union': 'Netdev',
>>>> -  'base': { 'id': 'str', 'type': 'NetClientDriver' },
>>>> +  'base': { '*id': 'str', 'type': 'NetClientDriver' },
>>>
>>> I don't think we need to make 'id' optional.
>>
>> It's required for "-net" now.
> 
> But does -net generate it's own id if one is not provided?  Can it still
> be mandatory in the QAPI type, and just figure out how to guarantee that
> the CLI parsing of -net provides a name early enough in the cycle to use
> the QAPI type without making the member optional there?

I guess it could be done - but we'd need to change the internal naming
scheme for this. Currently, the internal id / name is created with
assign_name() during qemu_net_client_setup() - which is the function
that is called from the individual network backends via
qemu_new_net_client() with a "model" string, e.g. net/slirp.c calls it
with model="user", net/tap.c calls it with model="bridge" etc.
The model string is then used in assign_name() to create the internal id
(aka. name in the NetClientState).

If we want to keep the "id" mandatory in the QAPI type, we have to
create the internal id before calling visit_type_Netdev() in
net_client_init(). But the "model" string information is not available
here yet, since this takes place before the init function of the backend
is called. Thus we'd need to come up with a different internal id string
here, e.g. something like "__org.qemu.net-xyz" like it is done in
net_param_nic() already. Do you think it is ok to change the internal
name / id here? I think it should be ok - if the users care about the id
of the netdevs, they should specify the ids on the command line and not
rely on some internal naming schemes... do you agree?

 Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]