[dpdk-dev] [PATCH 06/12] net/failsafe: add fail-safe PMD

Gaëtan Rivet gaetan.rivet at 6wind.com
Mon Mar 6 15:19:13 CET 2017


On Fri, Mar 03, 2017 at 09:38:11AM -0800, Stephen Hemminger wrote:
>On Fri,  3 Mar 2017 16:40:28 +0100
>Gaetan Rivet <gaetan.rivet at 6wind.com> wrote:
>
>> +
>> +static struct rte_eth_dev *
>> +pci_addr_to_eth_dev(struct rte_pci_addr *addr)
>> +{
>> +	uint8_t pid;
>> +
>> +	if (addr == NULL)
>> +		return NULL;
>> +	for (pid = 0; pid < RTE_MAX_ETHPORTS; pid++) {
>> +		struct rte_pci_addr *addr2;
>> +		struct rte_eth_dev *edev;
>> +
>> +		edev = &rte_eth_devices[pid];
>> +		if (edev->device == NULL ||
>> +		    edev->device->devargs == NULL)
>> +			continue;
>> +		addr2 = &edev->device->devargs->pci.addr;
>> +		if (rte_eal_compare_pci_addr(addr, addr2) == 0)
>> +			return edev;
>> +	}
>> +	return NULL;
>> +}
>> +
>> +static int
>> +pci_scan_one(struct sub_device *sdev)
>> +{
>> +	struct rte_devargs *da;
>> +	char dirname[PATH_MAX];
>> +
>> +	da = &sdev->devargs;
>> +	snprintf(dirname, sizeof(dirname),
>> +		"%s/" PCI_PRI_FMT,
>> +		pci_get_sysfs_path(),
>> +		da->pci.addr.domain,
>> +		da->pci.addr.bus,
>> +		da->pci.addr.devid,
>> +		da->pci.addr.function);
>> +	errno = 0;
>> +	if (rte_eal_pci_parse_sysfs_entry(&sdev->pci_device,
>> +		dirname, &da->pci.addr) < 0) {
>> +		if (errno == ENOENT) {
>> +			DEBUG("Could not scan requested device " PCI_PRI_FMT,
>> +				da->pci.addr.domain,
>> +				da->pci.addr.bus,
>> +				da->pci.addr.devid,
>> +				da->pci.addr.function);
>> +		} else {
>> +			ERROR("Error while scanning sysfs entry %s",
>> +					dirname);
>> +			return -1;
>> +		}
>> +	} else {
>> +		sdev->state = DEV_SCANNED;
>> +	}
>> +	return 0;
>> +}
>
>This needs to be generic and in EAL.
>A bigger problem is that it PCI specific and therefore won't work in environments
>where devices are attached to different busses (SOC and Hyper-V).
>
>Please rework to play well with bus model.

Yes I agree, I planned to do so in any case for a V2.

I saw a few commits from Jan Blunck about a vdev bus[0].
Do you have other series regarding busses in mind that I should rebase 
upon for a better support?

[0]: http://dpdk.org/ml/archives/dev/2017-March/059423.html

-- 
Gaëtan Rivet
6WIND


More information about the dev mailing list