Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 369287
b: refs/heads/master
c: b8e8200
h: refs/heads/master
i:
  369285: 96d333c
  369283: 71d0920
  369279: 1341c71
v: v3
  • Loading branch information
Jacob Keller authored and Jeff Kirsher committed Apr 18, 2013
1 parent 336801a commit 58d8f60
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ef1889d586a84ee17cf16fe48bfec03ace6eab2a
refs/heads/master: b8e820015ec703b971e6a3e2354502ecdd905aee
48 changes: 48 additions & 0 deletions trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,52 @@ MODULE_DESCRIPTION("Intel(R) 10 Gigabit PCI Express Network Driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);

static int ixgbe_read_pci_cfg_word_parent(struct ixgbe_adapter *adapter,
u32 reg, u16 *value)
{
int pos = 0;
struct pci_dev *parent_dev;
struct pci_bus *parent_bus;

parent_bus = adapter->pdev->bus->parent;
if (!parent_bus)
return -1;

parent_dev = parent_bus->self;
if (!parent_dev)
return -1;

pos = pci_find_capability(parent_dev, PCI_CAP_ID_EXP);
if (!pos)
return -1;

pci_read_config_word(parent_dev, pos + reg, value);
return 0;
}

static s32 ixgbe_get_parent_bus_info(struct ixgbe_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
u16 link_status = 0;
int err;

hw->bus.type = ixgbe_bus_type_pci_express;

/* Get the negotiated link width and speed from PCI config space of the
* parent, as this device is behind a switch
*/
err = ixgbe_read_pci_cfg_word_parent(adapter, 18, &link_status);

/* assume caller will handle error case */
if (err)
return err;

hw->bus.width = ixgbe_convert_bus_width(link_status);
hw->bus.speed = ixgbe_convert_bus_speed(link_status);

return 0;
}

static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter)
{
if (!test_bit(__IXGBE_DOWN, &adapter->state) &&
Expand Down Expand Up @@ -7487,6 +7533,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

/* pick up the PCI bus settings for reporting later */
hw->mac.ops.get_bus_info(hw);
if (hw->device_id == IXGBE_DEV_ID_82599_SFP_SF_QP)
ixgbe_get_parent_bus_info(adapter);

/* print bus type/speed/width info */
e_dev_info("(PCI Express:%s:%s) %pM\n",
Expand Down

0 comments on commit 58d8f60

Please sign in to comment.