aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorOr Gerlitz <ogerlitz@mellanox.com>2012-02-28 11:49:50 -0500
committerRoland Dreier <roland@purestorage.com>2012-03-05 12:25:16 -0500
commit2e96691c31ecf749f48aa94ea837b95dd656f5c2 (patch)
tree5e2bfaf522d66bc23c1ec0490fb3364c09aad4f2 /drivers/infiniband
parente9319b0cb00d4d68792fdae37e81e316cb632cb9 (diff)
IB: Use central enum for speed instead of hard-coded values
The kernel IB stack uses one enumeration for IB speed, which wasn't explicitly specified in the verbs header file. Add that enum, and use it all over the code. The IB speed/width notation is also used by iWARP and IBoE HW drivers, which use the convention of rate = speed * width to advertise their port link rate. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/sysfs.c13
-rw-r--r--drivers/infiniband/hw/amso1100/c2_provider.c2
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c2
-rw-r--r--drivers/infiniband/hw/cxgb4/provider.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_hca.c2
-rw-r--r--drivers/infiniband/hw/mlx4/main.c10
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.c2
7 files changed, 16 insertions, 17 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index a860b6ddbb61..83b720ef6c34 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -187,27 +187,26 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused,
187 return ret; 187 return ret;
188 188
189 switch (attr.active_speed) { 189 switch (attr.active_speed) {
190 case 1: 190 case IB_SPEED_SDR:
191 /* SDR */
192 rate = 25; 191 rate = 25;
193 break; 192 break;
194 case 2: 193 case IB_SPEED_DDR:
195 speed = " DDR"; 194 speed = " DDR";
196 rate = 50; 195 rate = 50;
197 break; 196 break;
198 case 4: 197 case IB_SPEED_QDR:
199 speed = " QDR"; 198 speed = " QDR";
200 rate = 100; 199 rate = 100;
201 break; 200 break;
202 case 8: 201 case IB_SPEED_FDR10:
203 speed = " FDR10"; 202 speed = " FDR10";
204 rate = 100; 203 rate = 100;
205 break; 204 break;
206 case 16: 205 case IB_SPEED_FDR:
207 speed = " FDR"; 206 speed = " FDR";
208 rate = 140; 207 rate = 140;
209 break; 208 break;
210 case 32: 209 case IB_SPEED_EDR:
211 speed = " EDR"; 210 speed = " EDR";
212 rate = 250; 211 rate = 250;
213 break; 212 break;
diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c b/drivers/infiniband/hw/amso1100/c2_provider.c
index 12f923d64e42..07eb3a8067d8 100644
--- a/drivers/infiniband/hw/amso1100/c2_provider.c
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c
@@ -94,7 +94,7 @@ static int c2_query_port(struct ib_device *ibdev,
94 props->pkey_tbl_len = 1; 94 props->pkey_tbl_len = 1;
95 props->qkey_viol_cntr = 0; 95 props->qkey_viol_cntr = 0;
96 props->active_width = 1; 96 props->active_width = 1;
97 props->active_speed = 1; 97 props->active_speed = IB_SPEED_SDR;
98 98
99 return 0; 99 return 0;
100} 100}
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 37c224fc3ad9..0bdf09aa6f42 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -1227,7 +1227,7 @@ static int iwch_query_port(struct ib_device *ibdev,
1227 props->gid_tbl_len = 1; 1227 props->gid_tbl_len = 1;
1228 props->pkey_tbl_len = 1; 1228 props->pkey_tbl_len = 1;
1229 props->active_width = 2; 1229 props->active_width = 2;
1230 props->active_speed = 2; 1230 props->active_speed = IB_SPEED_DDR;
1231 props->max_msg_sz = -1; 1231 props->max_msg_sz = -1;
1232 1232
1233 return 0; 1233 return 0;
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index 247fe706e7fa..be1c18f44400 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -329,7 +329,7 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port,
329 props->gid_tbl_len = 1; 329 props->gid_tbl_len = 1;
330 props->pkey_tbl_len = 1; 330 props->pkey_tbl_len = 1;
331 props->active_width = 2; 331 props->active_width = 2;
332 props->active_speed = 2; 332 props->active_speed = IB_SPEED_DDR;
333 props->max_msg_sz = -1; 333 props->max_msg_sz = -1;
334 334
335 return 0; 335 return 0;
diff --git a/drivers/infiniband/hw/ehca/ehca_hca.c b/drivers/infiniband/hw/ehca/ehca_hca.c
index 73edc3668663..9ed4d2588304 100644
--- a/drivers/infiniband/hw/ehca/ehca_hca.c
+++ b/drivers/infiniband/hw/ehca/ehca_hca.c
@@ -233,7 +233,7 @@ int ehca_query_port(struct ib_device *ibdev,
233 props->phys_state = 5; 233 props->phys_state = 5;
234 props->state = rblock->state; 234 props->state = rblock->state;
235 props->active_width = IB_WIDTH_12X; 235 props->active_width = IB_WIDTH_12X;
236 props->active_speed = 0x1; 236 props->active_speed = IB_SPEED_SDR;
237 } 237 }
238 238
239query_port1: 239query_port1:
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 7b445df6a667..6ff6bdf28a3a 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -215,16 +215,16 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
215 215
216 switch (ext_active_speed) { 216 switch (ext_active_speed) {
217 case 1: 217 case 1:
218 props->active_speed = 16; /* FDR */ 218 props->active_speed = IB_SPEED_FDR;
219 break; 219 break;
220 case 2: 220 case 2:
221 props->active_speed = 32; /* EDR */ 221 props->active_speed = IB_SPEED_EDR;
222 break; 222 break;
223 } 223 }
224 } 224 }
225 225
226 /* If reported active speed is QDR, check if is FDR-10 */ 226 /* If reported active speed is QDR, check if is FDR-10 */
227 if (props->active_speed == 4) { 227 if (props->active_speed == IB_SPEED_QDR) {
228 if (to_mdev(ibdev)->dev->caps.ext_port_cap[port] & 228 if (to_mdev(ibdev)->dev->caps.ext_port_cap[port] &
229 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO) { 229 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO) {
230 init_query_mad(in_mad); 230 init_query_mad(in_mad);
@@ -238,7 +238,7 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
238 238
239 /* Checking LinkSpeedActive for FDR-10 */ 239 /* Checking LinkSpeedActive for FDR-10 */
240 if (out_mad->data[15] & 0x1) 240 if (out_mad->data[15] & 0x1)
241 props->active_speed = 8; 241 props->active_speed = IB_SPEED_FDR10;
242 } 242 }
243 } 243 }
244 244
@@ -259,7 +259,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port,
259 enum ib_mtu tmp; 259 enum ib_mtu tmp;
260 260
261 props->active_width = IB_WIDTH_1X; 261 props->active_width = IB_WIDTH_1X;
262 props->active_speed = 4; 262 props->active_speed = IB_SPEED_QDR;
263 props->port_cap_flags = IB_PORT_CM_SUP; 263 props->port_cap_flags = IB_PORT_CM_SUP;
264 props->gid_tbl_len = to_mdev(ibdev)->dev->caps.gid_table_len[port]; 264 props->gid_tbl_len = to_mdev(ibdev)->dev->caps.gid_table_len[port];
265 props->max_msg_sz = to_mdev(ibdev)->dev->caps.max_msg_sz; 265 props->max_msg_sz = to_mdev(ibdev)->dev->caps.max_msg_sz;
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 0927b5cc65d3..8b8812de4b5c 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -597,7 +597,7 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr
597 props->pkey_tbl_len = 1; 597 props->pkey_tbl_len = 1;
598 props->qkey_viol_cntr = 0; 598 props->qkey_viol_cntr = 0;
599 props->active_width = IB_WIDTH_4X; 599 props->active_width = IB_WIDTH_4X;
600 props->active_speed = 1; 600 props->active_speed = IB_SPEED_SDR;
601 props->max_msg_sz = 0x80000000; 601 props->max_msg_sz = 0x80000000;
602 602
603 return 0; 603 return 0;