aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRoland Dreier <roland@eddore.topspincom.com>2005-08-17 10:39:10 -0400
committerRoland Dreier <rolandd@cisco.com>2005-08-26 23:37:36 -0400
commitda6561c285a6e28a075b97fd5a1560a2b0ce843e (patch)
treef39c9f1529e3c8aede42490d67a75321a8d8a25e /drivers
parent2aeba9a03b0d249fc710b9939fc089ce53d8cd30 (diff)
[PATCH] IB/mthca: Use correct port width capability value
When we call the INIT_IB firmware command to bring up a port, use the actual port width capability returned by the QUERY_DEV_LIM command instead of always trying to enable both 1X and 4X. This fixes breakage seen when the firmware is build to allow 4X only. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cmd.c7
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cmd.h3
-rw-r--r--drivers/infiniband/hw/mthca/mthca_dev.h1
-rw-r--r--drivers/infiniband/hw/mthca/mthca_main.c1
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c11
5 files changed, 10 insertions, 13 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c
index e15c1e2deab4..c258c1b7022e 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -1282,10 +1282,8 @@ int mthca_INIT_IB(struct mthca_dev *dev,
1282#define INIT_IB_FLAG_SIG (1 << 18) 1282#define INIT_IB_FLAG_SIG (1 << 18)
1283#define INIT_IB_FLAG_NG (1 << 17) 1283#define INIT_IB_FLAG_NG (1 << 17)
1284#define INIT_IB_FLAG_G0 (1 << 16) 1284#define INIT_IB_FLAG_G0 (1 << 16)
1285#define INIT_IB_FLAG_1X (1 << 8)
1286#define INIT_IB_FLAG_4X (1 << 9)
1287#define INIT_IB_FLAG_12X (1 << 11)
1288#define INIT_IB_VL_SHIFT 4 1285#define INIT_IB_VL_SHIFT 4
1286#define INIT_IB_PORT_WIDTH_SHIFT 8
1289#define INIT_IB_MTU_SHIFT 12 1287#define INIT_IB_MTU_SHIFT 12
1290#define INIT_IB_MAX_GID_OFFSET 0x06 1288#define INIT_IB_MAX_GID_OFFSET 0x06
1291#define INIT_IB_MAX_PKEY_OFFSET 0x0a 1289#define INIT_IB_MAX_PKEY_OFFSET 0x0a
@@ -1301,12 +1299,11 @@ int mthca_INIT_IB(struct mthca_dev *dev,
1301 memset(inbox, 0, INIT_IB_IN_SIZE); 1299 memset(inbox, 0, INIT_IB_IN_SIZE);
1302 1300
1303 flags = 0; 1301 flags = 0;
1304 flags |= param->enable_1x ? INIT_IB_FLAG_1X : 0;
1305 flags |= param->enable_4x ? INIT_IB_FLAG_4X : 0;
1306 flags |= param->set_guid0 ? INIT_IB_FLAG_G0 : 0; 1302 flags |= param->set_guid0 ? INIT_IB_FLAG_G0 : 0;
1307 flags |= param->set_node_guid ? INIT_IB_FLAG_NG : 0; 1303 flags |= param->set_node_guid ? INIT_IB_FLAG_NG : 0;
1308 flags |= param->set_si_guid ? INIT_IB_FLAG_SIG : 0; 1304 flags |= param->set_si_guid ? INIT_IB_FLAG_SIG : 0;
1309 flags |= param->vl_cap << INIT_IB_VL_SHIFT; 1305 flags |= param->vl_cap << INIT_IB_VL_SHIFT;
1306 flags |= param->port_width << INIT_IB_PORT_WIDTH_SHIFT;
1310 flags |= param->mtu_cap << INIT_IB_MTU_SHIFT; 1307 flags |= param->mtu_cap << INIT_IB_MTU_SHIFT;
1311 MTHCA_PUT(inbox, flags, INIT_IB_FLAGS_OFFSET); 1308 MTHCA_PUT(inbox, flags, INIT_IB_FLAGS_OFFSET);
1312 1309
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.h b/drivers/infiniband/hw/mthca/mthca_cmd.h
index 4e0062778ff9..11f02a61432a 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.h
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.h
@@ -220,8 +220,7 @@ struct mthca_init_hca_param {
220}; 220};
221 221
222struct mthca_init_ib_param { 222struct mthca_init_ib_param {
223 int enable_1x; 223 int port_width;
224 int enable_4x;
225 int vl_cap; 224 int vl_cap;
226 int mtu_cap; 225 int mtu_cap;
227 u16 gid_cap; 226 u16 gid_cap;
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
index c8f67c034183..0f90a173ecee 100644
--- a/drivers/infiniband/hw/mthca/mthca_dev.h
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h
@@ -148,6 +148,7 @@ struct mthca_limits {
148 int reserved_mcgs; 148 int reserved_mcgs;
149 int num_pds; 149 int num_pds;
150 int reserved_pds; 150 int reserved_pds;
151 u8 port_width_cap;
151}; 152};
152 153
153struct mthca_alloc { 154struct mthca_alloc {
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c
index 279f158aa12b..16c5d4a805f0 100644
--- a/drivers/infiniband/hw/mthca/mthca_main.c
+++ b/drivers/infiniband/hw/mthca/mthca_main.c
@@ -171,6 +171,7 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim
171 mdev->limits.reserved_mrws = dev_lim->reserved_mrws; 171 mdev->limits.reserved_mrws = dev_lim->reserved_mrws;
172 mdev->limits.reserved_uars = dev_lim->reserved_uars; 172 mdev->limits.reserved_uars = dev_lim->reserved_uars;
173 mdev->limits.reserved_pds = dev_lim->reserved_pds; 173 mdev->limits.reserved_pds = dev_lim->reserved_pds;
174 mdev->limits.port_width_cap = dev_lim->max_port_width;
174 175
175 /* IB_DEVICE_RESIZE_MAX_WR not supported by driver. 176 /* IB_DEVICE_RESIZE_MAX_WR not supported by driver.
176 May be doable since hardware supports it for SRQ. 177 May be doable since hardware supports it for SRQ.
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 8fbb4f1f5398..b7e3d2342799 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -575,12 +575,11 @@ static void init_port(struct mthca_dev *dev, int port)
575 575
576 memset(&param, 0, sizeof param); 576 memset(&param, 0, sizeof param);
577 577
578 param.enable_1x = 1; 578 param.port_width = dev->limits.port_width_cap;
579 param.enable_4x = 1; 579 param.vl_cap = dev->limits.vl_cap;
580 param.vl_cap = dev->limits.vl_cap; 580 param.mtu_cap = dev->limits.mtu_cap;
581 param.mtu_cap = dev->limits.mtu_cap; 581 param.gid_cap = dev->limits.gid_table_len;
582 param.gid_cap = dev->limits.gid_table_len; 582 param.pkey_cap = dev->limits.pkey_table_len;
583 param.pkey_cap = dev->limits.pkey_table_len;
584 583
585 err = mthca_INIT_IB(dev, &param, port, &status); 584 err = mthca_INIT_IB(dev, &param, port, &status);
586 if (err) 585 if (err)