All of lore.kernel.org
 help / color / mirror / Atom feed
* libxl: Is the nic param to libxl_network_device_add an (in)_out parameter?
@ 2014-11-18 15:28 Euan Harris
  2014-11-18 15:35 ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Euan Harris @ 2014-11-18 15:28 UTC (permalink / raw)
  To: xen-devel

Hi,

If I call libxl_device_nic_add and pass in a mostly-default
libxl_device_nic structure, the function fills in the unspecified default
config fields with data for the NIC which it has just created:

	libxl_device_nic nic;
   	libxl_device_nic_init(&nic);
	/* 
	   nic.devid == -1 
	   nic.mac == 00:00:00:00:00:00 
           nic.model == null
	   etc.
	 */

	libxl_device_nic_add(ctx, domid, &nic, NULL);
	/* 
	   nic.devid == 3 
	   nic.mac == 00:16:3e:1b:7b:12
           nic.model == rtl8139
	   etc.
	 */

Is this behaviour an intentional part of the API which I can rely on,
or just an artefact of the current implementation?  In other words, is
nic meant to be an (in)_out parameter?  If it's not, what is the correct
way to find out the device ID which was allocated for the new device,
for example?

Thanks,
Euan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libxl: Is the nic param to libxl_network_device_add an (in)_out parameter?
  2014-11-18 15:28 libxl: Is the nic param to libxl_network_device_add an (in)_out parameter? Euan Harris
@ 2014-11-18 15:35 ` Ian Campbell
  2014-11-18 15:41   ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2014-11-18 15:35 UTC (permalink / raw)
  To: Euan Harris, Ian Jackson; +Cc: xen-devel

On Tue, 2014-11-18 at 15:28 +0000, Euan Harris wrote:
> Hi,
> 
> If I call libxl_device_nic_add and pass in a mostly-default
> libxl_device_nic structure, the function fills in the unspecified default
> config fields with data for the NIC which it has just created:
> 
> 	libxl_device_nic nic;
>    	libxl_device_nic_init(&nic);
> 	/* 
> 	   nic.devid == -1 
> 	   nic.mac == 00:00:00:00:00:00 
>            nic.model == null
> 	   etc.
> 	 */
> 
> 	libxl_device_nic_add(ctx, domid, &nic, NULL);
> 	/* 
> 	   nic.devid == 3 
> 	   nic.mac == 00:16:3e:1b:7b:12
>            nic.model == rtl8139
> 	   etc.
> 	 */
> 
> Is this behaviour an intentional part of the API which I can rely on,
> or just an artefact of the current implementation?  In other words, is
> nic meant to be an (in)_out parameter?

I believe so, yes. The comment under "Devices" in libxl.h probably ought
to be adjusted to say so explicitly.

Ian (J) -- do you agree?

>   If it's not, what is the correct
> way to find out the device ID which was allocated for the new device,
> for example?

You would have to libxl_device_<type>_list and look for it, which is
clearly suboptimal.

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libxl: Is the nic param to libxl_network_device_add an (in)_out parameter?
  2014-11-18 15:35 ` Ian Campbell
@ 2014-11-18 15:41   ` Ian Jackson
  2014-11-18 15:44     ` Ian Campbell
  2014-11-18 17:08     ` Euan Harris
  0 siblings, 2 replies; 5+ messages in thread
From: Ian Jackson @ 2014-11-18 15:41 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Euan Harris, xen-devel

Ian Campbell writes ("Re: [Xen-devel] libxl: Is the nic param to libxl_network_device_add an (in)_out parameter?"):
> On Tue, 2014-11-18 at 15:28 +0000, Euan Harris wrote:
> > If I call libxl_device_nic_add and pass in a mostly-default
> > libxl_device_nic structure, the function fills in the unspecified default
> > config fields with data for the NIC which it has just created:
...
> > Is this behaviour an intentional part of the API which I can rely on,
> > or just an artefact of the current implementation?  In other words, is
> > nic meant to be an (in)_out parameter?

Yes.

> I believe so, yes. The comment under "Devices" in libxl.h probably ought
> to be adjusted to say so explicitly.
> 
> Ian (J) -- do you agree?

I do.  I think this applies to other kinds of device too, which might
have unspecified parameters which get filled in.

Euan, would you like to send us a doc patch for libxl.h ?

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libxl: Is the nic param to libxl_network_device_add an (in)_out parameter?
  2014-11-18 15:41   ` Ian Jackson
@ 2014-11-18 15:44     ` Ian Campbell
  2014-11-18 17:08     ` Euan Harris
  1 sibling, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2014-11-18 15:44 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Euan Harris, xen-devel

On Tue, 2014-11-18 at 15:41 +0000, Ian Jackson wrote:
> Ian Campbell writes ("Re: [Xen-devel] libxl: Is the nic param to libxl_network_device_add an (in)_out parameter?"):
> > On Tue, 2014-11-18 at 15:28 +0000, Euan Harris wrote:
> > > If I call libxl_device_nic_add and pass in a mostly-default
> > > libxl_device_nic structure, the function fills in the unspecified default
> > > config fields with data for the NIC which it has just created:
> ...
> > > Is this behaviour an intentional part of the API which I can rely on,
> > > or just an artefact of the current implementation?  In other words, is
> > > nic meant to be an (in)_out parameter?
> 
> Yes.
> 
> > I believe so, yes. The comment under "Devices" in libxl.h probably ought
> > to be adjusted to say so explicitly.
> > 
> > Ian (J) -- do you agree?
> 
> I do.  I think this applies to other kinds of device too, which might
> have unspecified parameters which get filled in.

Agreed. The docs section I was referring to is generic to all devices,
not just nics (i.e. it talks about libxl_device_<type>_add etc), so a
comment change would (and should) apply to everything.

> 
> Euan, would you like to send us a doc patch for libxl.h ?
> 
> Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libxl: Is the nic param to libxl_network_device_add an (in)_out parameter?
  2014-11-18 15:41   ` Ian Jackson
  2014-11-18 15:44     ` Ian Campbell
@ 2014-11-18 17:08     ` Euan Harris
  1 sibling, 0 replies; 5+ messages in thread
From: Euan Harris @ 2014-11-18 17:08 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Ian Campbell, xen-devel

> > I believe so, yes. The comment under "Devices" in libxl.h probably ought
> > to be adjusted to say so explicitly.
> > 
> > Ian (J) -- do you agree?
> 
> I do.  I think this applies to other kinds of device too, which might
> have unspecified parameters which get filled in.
> 
> Euan, would you like to send us a doc patch for libxl.h ?

I have sent a patch for the Devices comment.   If I come across more
functions which behave similarly I'll send more patches.

Thanks,
Euan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-18 17:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-18 15:28 libxl: Is the nic param to libxl_network_device_add an (in)_out parameter? Euan Harris
2014-11-18 15:35 ` Ian Campbell
2014-11-18 15:41   ` Ian Jackson
2014-11-18 15:44     ` Ian Campbell
2014-11-18 17:08     ` Euan Harris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.