Skip to content

Commit 71eeba1

Browse files
Marcel Apfelbaumrolandd
authored andcommitted
IB: Add new InfiniBand link speeds
Introduce support for the following extended speeds: FDR-10: a Mellanox proprietary link speed which is 10.3125 Gbps with 64b/66b encoding rather than 8b/10b encoding. FDR: IBA extended speed 14.0625 Gbps. EDR: IBA extended speed 25.78125 Gbps. Signed-off-by: Marcel Apfelbaum <marcela@dev.mellanox.co.il> Reviewed-by: Hal Rosenstock <hal@mellanox.com> Reviewed-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
1 parent 976d167 commit 71eeba1

3 files changed

Lines changed: 64 additions & 5 deletions

File tree

‎drivers/infiniband/core/sysfs.c‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,35 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused,
185185
if (ret)
186186
return ret;
187187

188+
rate = (25 * attr.active_speed) / 10;
189+
188190
switch (attr.active_speed) {
189-
case 2: speed = " DDR"; break;
190-
case 4: speed = " QDR"; break;
191+
case 2:
192+
speed = " DDR";
193+
break;
194+
case 4:
195+
speed = " QDR";
196+
break;
197+
case 8:
198+
speed = " FDR10";
199+
rate = 10;
200+
break;
201+
case 16:
202+
speed = " FDR";
203+
rate = 14;
204+
break;
205+
case 32:
206+
speed = " EDR";
207+
rate = 25;
208+
break;
191209
}
192210

193-
rate = 25 * ib_width_enum_to_int(attr.active_width) * attr.active_speed;
211+
rate *= ib_width_enum_to_int(attr.active_width);
194212
if (rate < 0)
195213
return -EINVAL;
196214

197215
return sprintf(buf, "%d%s Gb/sec (%dX%s)\n",
198-
rate / 10, rate % 10 ? ".5" : "",
216+
rate, (attr.active_speed == 1) ? ".5" : "",
199217
ib_width_enum_to_int(attr.active_width), speed);
200218
}
201219

‎drivers/infiniband/core/verbs.c‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,31 @@ enum ib_rate mult_to_ib_rate(int mult)
7777
}
7878
EXPORT_SYMBOL(mult_to_ib_rate);
7979

80+
int ib_rate_to_mbps(enum ib_rate rate)
81+
{
82+
switch (rate) {
83+
case IB_RATE_2_5_GBPS: return 2500;
84+
case IB_RATE_5_GBPS: return 5000;
85+
case IB_RATE_10_GBPS: return 10000;
86+
case IB_RATE_20_GBPS: return 20000;
87+
case IB_RATE_30_GBPS: return 30000;
88+
case IB_RATE_40_GBPS: return 40000;
89+
case IB_RATE_60_GBPS: return 60000;
90+
case IB_RATE_80_GBPS: return 80000;
91+
case IB_RATE_120_GBPS: return 120000;
92+
case IB_RATE_14_GBPS: return 14062;
93+
case IB_RATE_56_GBPS: return 56250;
94+
case IB_RATE_112_GBPS: return 112500;
95+
case IB_RATE_168_GBPS: return 168750;
96+
case IB_RATE_25_GBPS: return 25781;
97+
case IB_RATE_100_GBPS: return 103125;
98+
case IB_RATE_200_GBPS: return 206250;
99+
case IB_RATE_300_GBPS: return 309375;
100+
default: return -1;
101+
}
102+
}
103+
EXPORT_SYMBOL(ib_rate_to_mbps);
104+
80105
enum rdma_transport_type
81106
rdma_node_get_transport(enum rdma_node_type node_type)
82107
{

‎include/rdma/ib_verbs.h‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ enum ib_port_cap_flags {
207207
IB_PORT_SM_DISABLED = 1 << 10,
208208
IB_PORT_SYS_IMAGE_GUID_SUP = 1 << 11,
209209
IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12,
210+
IB_PORT_EXTENDED_SPEEDS_SUP = 1 << 14,
210211
IB_PORT_CM_SUP = 1 << 16,
211212
IB_PORT_SNMP_TUNNEL_SUP = 1 << 17,
212213
IB_PORT_REINIT_SUP = 1 << 18,
@@ -415,7 +416,15 @@ enum ib_rate {
415416
IB_RATE_40_GBPS = 7,
416417
IB_RATE_60_GBPS = 8,
417418
IB_RATE_80_GBPS = 9,
418-
IB_RATE_120_GBPS = 10
419+
IB_RATE_120_GBPS = 10,
420+
IB_RATE_14_GBPS = 11,
421+
IB_RATE_56_GBPS = 12,
422+
IB_RATE_112_GBPS = 13,
423+
IB_RATE_168_GBPS = 14,
424+
IB_RATE_25_GBPS = 15,
425+
IB_RATE_100_GBPS = 16,
426+
IB_RATE_200_GBPS = 17,
427+
IB_RATE_300_GBPS = 18
419428
};
420429

421430
/**
@@ -426,6 +435,13 @@ enum ib_rate {
426435
*/
427436
int ib_rate_to_mult(enum ib_rate rate) __attribute_const__;
428437

438+
/**
439+
* ib_rate_to_mbps - Convert the IB rate enum to Mbps.
440+
* For example, IB_RATE_2_5_GBPS will be converted to 2500.
441+
* @rate: rate to convert.
442+
*/
443+
int ib_rate_to_mbps(enum ib_rate rate) __attribute_const__;
444+
429445
/**
430446
* mult_to_ib_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate
431447
* enum.

0 commit comments

Comments
 (0)