On 7/20/2018 1:23 PM, Thomas Monjalon wrote:
> 20/07/2018 14:44, Ferruh Yigit:
>> --- a/drivers/net/tap/rte_eth_tap.c
>> +++ b/drivers/net/tap/rte_eth_tap.c
>>      if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
>>          strlen(params) == 0) {
>> -            eth_dev = rte_eth_dev_attach_secondary(name);
>> +            eth_dev = rte_eth_vdev_secondary_probe(dev, name, &ops);
>>              if (!eth_dev) {
>>                      TAP_LOG(ERR, "Failed to probe %s", name);
>>                      return -1;
>>              }
>> -            /* TODO: request info from primary to set up Rx and Tx */
>> -            eth_dev->dev_ops = &ops;
>> -            rte_eth_dev_probing_finish(eth_dev);
>>              return 0;
>>      }
>>  
>> --- a/lib/librte_ethdev/rte_ethdev_vdev.h
>> +++ b/lib/librte_ethdev/rte_ethdev_vdev.h
>> +static inline struct rte_eth_dev *
>> +rte_eth_vdev_secondary_probe(struct rte_vdev_device *vdev,
>> +            const char *name, const struct eth_dev_ops *ops)
>> +{
>> +    struct rte_eth_dev *eth_dev;
>> +
>> +    eth_dev = rte_eth_dev_attach_secondary(name);
>> +    if (!eth_dev)
>> +            return NULL;
>> +
>> +    /* TODO: request info from primary to set up Rx and Tx */
>> +    eth_dev->dev_ops = ops;
>> +    eth_dev->device = &vdev->device;
>> +    rte_eth_dev_probing_finish(eth_dev);
>> +    return eth_dev;
>> +}
> 
> As you can see in the following patch,
> 
>       net/tap: add queues when attaching from secondary process
>       https://patches.dpdk.org/patch/43229/
> 
> The synchronization with primary process can be specific to the PMD.
> It will use some private data and can need IPC call to translate some
> file descriptors.
> Moreover, we will need to think about a more complex sync in order
> to update queues when a process re-configure queues number,
> and also attach in primary a device created in secondary.
> We need also to handle hotplug as Qi already proposed.
> 
> My suggestion: just fix the PMDs without creating an helper.
> We could design a helper later when we will have thought to the global
> issue we want to solve.

This was to help PMDs as Stephen suggested, helper function can be introduced
later, I will send initial version with updated PMDs in v2.

Reply via email to