aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChien Tung <chien.tin.tung@intel.com>2010-03-03 14:13:26 -0500
committerRoland Dreier <rolandd@cisco.com>2010-03-12 13:54:11 -0500
commita72042c08a8ba3b685dc9cba62c57c48188ef2c8 (patch)
tree6e8c25efd48b1a46a6f3fe4a68f51ae23bd90eef
parent9f29006ae8c85746e5a52d557f689359149a0793 (diff)
RDMA/nes: Fix CX4 link problem in back-to-back configuration
Commit 09124e19 ("RDMA/nes: Add support for KR device id 0x0110") took out too much code and broke CX4 link detection in back-to-back configuration. Put back the code that does the link check. Signed-off-by: Chien Tung <chien.tin.tung@intel.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--drivers/infiniband/hw/nes/nes_nic.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index a1d79b6856ac..91fdde382e82 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -1595,7 +1595,6 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1595 struct nes_vnic *nesvnic; 1595 struct nes_vnic *nesvnic;
1596 struct net_device *netdev; 1596 struct net_device *netdev;
1597 struct nic_qp_map *curr_qp_map; 1597 struct nic_qp_map *curr_qp_map;
1598 u32 u32temp;
1599 u8 phy_type = nesdev->nesadapter->phy_type[nesdev->mac_index]; 1598 u8 phy_type = nesdev->nesadapter->phy_type[nesdev->mac_index];
1600 1599
1601 netdev = alloc_etherdev(sizeof(struct nes_vnic)); 1600 netdev = alloc_etherdev(sizeof(struct nes_vnic));
@@ -1707,6 +1706,10 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1707 ((phy_type == NES_PHY_TYPE_PUMA_1G) && 1706 ((phy_type == NES_PHY_TYPE_PUMA_1G) &&
1708 (((PCI_FUNC(nesdev->pcidev->devfn) == 1) && (nesdev->mac_index == 2)) || 1707 (((PCI_FUNC(nesdev->pcidev->devfn) == 1) && (nesdev->mac_index == 2)) ||
1709 ((PCI_FUNC(nesdev->pcidev->devfn) == 2) && (nesdev->mac_index == 1)))))) { 1708 ((PCI_FUNC(nesdev->pcidev->devfn) == 2) && (nesdev->mac_index == 1)))))) {
1709 u32 u32temp;
1710 u32 link_mask;
1711 u32 link_val;
1712
1710 u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + 1713 u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 +
1711 (0x200 * (nesdev->mac_index & 1))); 1714 (0x200 * (nesdev->mac_index & 1)));
1712 if (phy_type != NES_PHY_TYPE_PUMA_1G) { 1715 if (phy_type != NES_PHY_TYPE_PUMA_1G) {
@@ -1715,13 +1718,36 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1715 (0x200 * (nesdev->mac_index & 1)), u32temp); 1718 (0x200 * (nesdev->mac_index & 1)), u32temp);
1716 } 1719 }
1717 1720
1721 /* Check and set linkup here. This is for back to back */
1722 /* configuration where second port won't get link interrupt */
1723 switch (phy_type) {
1724 case NES_PHY_TYPE_PUMA_1G:
1725 if (nesdev->mac_index < 2) {
1726 link_mask = 0x01010000;
1727 link_val = 0x01010000;
1728 } else {
1729 link_mask = 0x02020000;
1730 link_val = 0x02020000;
1731 }
1732 break;
1733 default:
1734 link_mask = 0x0f1f0000;
1735 link_val = 0x0f0f0000;
1736 break;
1737 }
1738
1739 u32temp = nes_read_indexed(nesdev,
1740 NES_IDX_PHY_PCS_CONTROL_STATUS0 +
1741 (0x200 * (nesdev->mac_index & 1)));
1742 if ((u32temp & link_mask) == link_val)
1743 nesvnic->linkup = 1;
1744
1718 /* clear the MAC interrupt status, assumes direct logical to physical mapping */ 1745 /* clear the MAC interrupt status, assumes direct logical to physical mapping */
1719 u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index)); 1746 u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index));
1720 nes_debug(NES_DBG_INIT, "Phy interrupt status = 0x%X.\n", u32temp); 1747 nes_debug(NES_DBG_INIT, "Phy interrupt status = 0x%X.\n", u32temp);
1721 nes_write_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index), u32temp); 1748 nes_write_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index), u32temp);
1722 1749
1723 nes_init_phy(nesdev); 1750 nes_init_phy(nesdev);
1724
1725 } 1751 }
1726 1752
1727 return netdev; 1753 return netdev;