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. 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. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev