/* The ATS spec uses 0 in the Invalidate Queue Depth field to indicate that the function can accept 32 Invalidate Request. But here we use the  */
int pci_ats_queue_depth(struct pci_dev *dev)
/* The ATS spec uses 0 in the Invalidate Queue Depth field to indicate that the function can accept 32 Invalidate Request. But here we use the  */
int pci_ats_queue_depth(struct pci_dev *dev)
{
	int pos;
	u16 cap;
	if (dev->is_virtfn)
		return 0;
	if (dev->ats)
		return dev->ats->qdep;
	pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS);
	if (!pos)
		return -ENODEV;
	pci_read_config_word(dev, pos + PCI_ATS_CAP, &cap);
	return PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) :
				       PCI_ATS_MAX_QDEP;
}