> > On 20.10.2016 19:33, Loftus, Ciara wrote: > >>>> @@ -894,6 +1006,66 @@ dpdk_dev_parse_name(const char > >> dev_name[], const char prefix[], > >>>> } > >>>> } > >>>> > >>>> +/* When attaching a vhost device to DPDK, a unique name of the > format > >>>> + * 'net_vhostX' is expected, where X is a unique identifier. > >>>> + * get_vhost_drv_id returns a valid X value to provide to DPDK. > >>>> + */ > >>>> +static int > >>>> +get_vhost_drv_id(void) > >>>> +{ > >>>> + int i = 0; > >>>> + > >>>> + for (i = 0; i < RTE_MAX_ETHPORTS; i++) { > >>>> + if (vhost_drv_ids[i] == 0) { > >>>> + return i; > >>>> + } > >>>> + } > >>>> + > >>>> + return -1; > >>>> +} > >>>> + > >>>> +static void > >>>> +set_vhost_drv_id(int id, int val) > >>>> +{ > >>>> + vhost_drv_ids[id] = val; > >>>> +} > >>> > >>> I think we can just increment global atomic counter instead of above > >> solution. > >>> Numbers just need to be uniqe. Driver never use them for anything. > > > > But that way we would be limiting the number of vHost ports to the max > value of the int we use as the counter. > > In that case I recommend to use existing 'id-pool' implementation instead.
I wasn't aware of the id-pool implementation. It's ideal for this case. I've added it in the v4. Thanks! > > Best regards, Ilya Maximets. > > P.S.: Could you, please, add me in CC list for the future versions of > this patch set? I just can't find it in patchwork. Apologies - I missed you on the next version. You can find it here: http://openvswitch.org/pipermail/dev/2016-October/080893.html I'll add your CC from now onwards. Not sure why they are not showing up in patchwork. Thanks, Ciara _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev