[openib-general] mthca_reset question

Kanevsky, Arkady Arkady.Kanevsky at netapp.com
Thu Apr 27 06:50:06 PDT 2006


Here is an extract from the mthca_reset.c 
	/*
	 * Reset the chip.  This is somewhat ugly because we have to
	 * save off the PCI header before reset and then restore it
	 * after the chip reboots.  We skip config space offsets 22
	 * and 23 since those have a special meaning.
	 *
	 * To make matters worse, for Tavor (PCI-X HCA) we have to
	 * find the associated bridge device and save off its PCI
	 * header as well.
	 */

	if (!(mdev->mthca_flags & MTHCA_FLAG_PCIE)) {
		/* Look for the bridge -- its device ID will be 2 more
		   than HCA's device ID. */
		while ((bridge = pci_get_device(mdev->pdev->vendor,
						mdev->pdev->device + 2,
						bridge)) != NULL) {
			if (bridge->hdr_type    ==
PCI_HEADER_TYPE_BRIDGE &&
			    bridge->subordinate == mdev->pdev->bus) {
				mthca_dbg(mdev, "Found bridge: %s\n",
					  pci_name(bridge));
				break;
			}
		}

First,
Why do we check for not PCIE instead of PCIX?
Second, why while instead of if?

Most interesting, third,
Why is bridge device ID 2 more than HCA device ID?
What is this hack rely/depends on?
Can we find a device parent which should be a bridge instead?

Thanks,
Arkady


Arkady Kanevsky                     email: arkady at netapp.com
Network Appliance Inc.              phone: 781-768-5395
1601 Trapelo Rd. - Suite 16.        Fax: 781-895-1195
Waltham, MA 02451                   central phone: 781-768-5300



More information about the general mailing list