aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2008-08-04 14:08:37 -0400
committerRoland Dreier <rolandd@cisco.com>2008-08-04 14:08:37 -0400
commitbe43324d8b316fe83a7b4027334f2825f1121c2c (patch)
tree30d238ba31519d2c75c642f371754af2fa9ad236 /drivers/infiniband
parent1c355a6e80fd08e623416138631e240f431385f2 (diff)
RDMA/cxgb3: Fix deadlock initializing iw_cxgb3 device
Running 'ifconfig up' on the cxgb3 interface with iw_cxgb3 loaded causes a deadlock. The rtnl lock is already held in this path. The function fw_supports_fastreg() was introduced in 2.6.27 to conditionally set the IB_DEVICE_MEM_MGT_EXTENSIONS bit iff the firmware was at 7.0 or greater, and this function also acquires the rtnl lock and which thus causes a deadlock. Further, if iw_cxgb3 is loaded _after_ the nic interface is brought up, then the deadlock does not occur and therefore fw_supports_fastreg() does need to grab the rtnl lock in that path. It turns out this code is all useless anyway. The low level driver will NOT allow the open if the firmware isn't 7.0, so iw_cxgb3 can always set the MEM_MGT_EXTENSIONS bit. Simplify... Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index b89640aa6e10..eb778bfd6f66 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -1187,28 +1187,6 @@ static ssize_t show_rev(struct device *dev, struct device_attribute *attr,
1187 return sprintf(buf, "%d\n", iwch_dev->rdev.t3cdev_p->type); 1187 return sprintf(buf, "%d\n", iwch_dev->rdev.t3cdev_p->type);
1188} 1188}
1189 1189
1190static int fw_supports_fastreg(struct iwch_dev *iwch_dev)
1191{
1192 struct ethtool_drvinfo info;
1193 struct net_device *lldev = iwch_dev->rdev.t3cdev_p->lldev;
1194 char *cp, *next;
1195 unsigned fw_maj, fw_min;
1196
1197 rtnl_lock();
1198 lldev->ethtool_ops->get_drvinfo(lldev, &info);
1199 rtnl_unlock();
1200
1201 next = info.fw_version+1;
1202 cp = strsep(&next, ".");
1203 sscanf(cp, "%i", &fw_maj);
1204 cp = strsep(&next, ".");
1205 sscanf(cp, "%i", &fw_min);
1206
1207 PDBG("%s maj %u min %u\n", __func__, fw_maj, fw_min);
1208
1209 return fw_maj > 6 || (fw_maj == 6 && fw_min > 0);
1210}
1211
1212static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr, char *buf) 1190static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr, char *buf)
1213{ 1191{
1214 struct iwch_dev *iwch_dev = container_of(dev, struct iwch_dev, 1192 struct iwch_dev *iwch_dev = container_of(dev, struct iwch_dev,
@@ -1325,12 +1303,12 @@ int iwch_register_device(struct iwch_dev *dev)
1325 memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid)); 1303 memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid));
1326 memcpy(&dev->ibdev.node_guid, dev->rdev.t3cdev_p->lldev->dev_addr, 6); 1304 memcpy(&dev->ibdev.node_guid, dev->rdev.t3cdev_p->lldev->dev_addr, 6);
1327 dev->ibdev.owner = THIS_MODULE; 1305 dev->ibdev.owner = THIS_MODULE;
1328 dev->device_cap_flags = IB_DEVICE_LOCAL_DMA_LKEY | IB_DEVICE_MEM_WINDOW; 1306 dev->device_cap_flags = IB_DEVICE_LOCAL_DMA_LKEY |
1307 IB_DEVICE_MEM_WINDOW |
1308 IB_DEVICE_MEM_MGT_EXTENSIONS;
1329 1309
1330 /* cxgb3 supports STag 0. */ 1310 /* cxgb3 supports STag 0. */
1331 dev->ibdev.local_dma_lkey = 0; 1311 dev->ibdev.local_dma_lkey = 0;
1332 if (fw_supports_fastreg(dev))
1333 dev->device_cap_flags |= IB_DEVICE_MEM_MGT_EXTENSIONS;
1334 1312
1335 dev->ibdev.uverbs_cmd_mask = 1313 dev->ibdev.uverbs_cmd_mask =
1336 (1ull << IB_USER_VERBS_CMD_GET_CONTEXT) | 1314 (1ull << IB_USER_VERBS_CMD_GET_CONTEXT) |