Skip to contentSkip to conversation

ib/core: Add extended link speeds

PATCH In review Marcel Apfelbaum 5 participants 13 messages Oct 3, 2011 – Oct 11, 2011 8 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 ib/core: Add extended link speeds

The following extended speeds are introduced:
FDR-10 - is a proprietary link speed which is 10.3125 Gbps at 64/66
encoding rather than 8b10b encoding.
FDR - represents the IBA extended speed: 14.0625 Gbps.
EDR - represents the IBA extended speed: 25.78125 Gbps.

---
 drivers/infiniband/core/sysfs.c |   23 +++++++++++++---
 drivers/infiniband/core/verbs.c |   29 +++++++++++++++++++++
 include/rdma/ib_verbs.h         |   55 +++++++++++++++++++++++++++++++++++++++-
 3 files changed, 102 insertions(+), 5 deletions(-)
drivers/infiniband/core/sysfs.c +19 -4
@@ -179,6 +179,7 @@ static ssize_t rate_show(struct ib_port 
 	struct ib_port_attr attr;
 	char *speed = "";
 	int rate;
+	int rate_rounded;
 	ssize_t ret;
 
 	ret = ib_query_port(p->ibdev, p->port_num, &attr);
@@ -186,16 +187,30 @@ static ssize_t rate_show(struct ib_port 
 		return ret;
 
 	switch (attr.active_speed) {
-	case 2: speed = " DDR"; break;
-	case 4: speed = " QDR"; break;
+	case 2:
+		speed = " DDR";
+		break;
+	case 4:
+		speed = " QDR";
+		break;
+	case 8:
+		speed = " FDR10";
+		break;
+	case 16:
+		speed = " FDR";
+		break;
+	case 32:
+		speed = " EDR";
+		break;
 	}
 
-	rate = 25 * ib_width_enum_to_int(attr.active_width) * attr.active_speed;
+	rate = ib_width_enum_to_int(attr.active_width) *
+	       ib_active_speed_to_rate(attr.active_speed, &rate_rounded);
 	if (rate < 0)
 		return -EINVAL;
 
 	return sprintf(buf, "%d%s Gb/sec (%dX%s)\n",
-		       rate / 10, rate % 10 ? ".5" : "",
+		       rate, rate_rounded ? ".5" : "",
 		       ib_width_enum_to_int(attr.active_width), speed);
 }
 
drivers/infiniband/core/verbs.c +29 -0
@@ -77,6 +77,35 @@ enum ib_rate mult_to_ib_rate(int mult)
 }
 EXPORT_SYMBOL(mult_to_ib_rate);
 
+int ib_rate_to_int(enum ib_rate rate, int *rounded)
+{
+	*rounded = 0;
+
+	switch (rate) {
+	case IB_RATE_2_5_GBPS:
+		*rounded = 1;
+		return 2;
+	case IB_RATE_5_GBPS:   return 5;
+	case IB_RATE_10_GBPS:  return 10;
+	case IB_RATE_20_GBPS:  return 20;
+	case IB_RATE_30_GBPS:  return 30;
+	case IB_RATE_40_GBPS:  return 40;
+	case IB_RATE_60_GBPS:  return 60;
+	case IB_RATE_80_GBPS:  return 80;
+	case IB_RATE_120_GBPS: return 120;
+	case IB_RATE_14_GBPS:  return 14;
+	case IB_RATE_56_GBPS:  return 56;
+	case IB_RATE_112_GBPS: return 112;
+	case IB_RATE_168_GBPS: return 168;
+	case IB_RATE_25_GBPS:  return 25;
+	case IB_RATE_100_GBPS: return 100;
+	case IB_RATE_200_GBPS: return 200;
+	case IB_RATE_300_GBPS: return 300;
+	default:	       return -1;
+	}
+}
+EXPORT_SYMBOL(ib_rate_to_int);
+
 enum rdma_transport_type
 rdma_node_get_transport(enum rdma_node_type node_type)
 {
include/rdma/ib_verbs.h +54 -1

79 lines not on this page · raw message

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to a message not in the archive

drivers/infiniband/core/verbs.c enum ib_rate mult_to_ib_rate(int mult) · line 81

Quoted 8 lines
drivers/infiniband/core/verbs.c +2 -0
@@ -77,6 +77,35 @@ enum ib_rate mult_to_ib_rate(int mult)
 }
 EXPORT_SYMBOL(mult_to_ib_rate);
 
+int ib_rate_to_int(enum ib_rate rate, int *rounded)
+{

I like this approach better, but I wonder if it still couldn't be slightly cleaner. Rather than returning 'rounded' and having the caller assume that 1 means add .5 to the result, we could return the fractional part directly. I.e. rename 'rounded' to 'fraction' and return 5.

Or if ib_rate_to_int() is only used to convert the rate into a string, we could just return the string directly.

Quoted 41 lines
drivers/infiniband/core/verbs.c +27 -0
+	*rounded = 0;
+
+	switch (rate) {
+	case IB_RATE_2_5_GBPS:
+		*rounded = 1;
+		return 2;
+	case IB_RATE_5_GBPS:   return 5;
+	case IB_RATE_10_GBPS:  return 10;
+	case IB_RATE_20_GBPS:  return 20;
+	case IB_RATE_30_GBPS:  return 30;
+	case IB_RATE_40_GBPS:  return 40;
+	case IB_RATE_60_GBPS:  return 60;
+	case IB_RATE_80_GBPS:  return 80;
+	case IB_RATE_120_GBPS: return 120;
+	case IB_RATE_14_GBPS:  return 14;
+	case IB_RATE_56_GBPS:  return 56;
+	case IB_RATE_112_GBPS: return 112;
+	case IB_RATE_168_GBPS: return 168;
+	case IB_RATE_25_GBPS:  return 25;
+	case IB_RATE_100_GBPS: return 100;
+	case IB_RATE_200_GBPS: return 200;
+	case IB_RATE_300_GBPS: return 300;
+	default:	       return -1;
+	}
+}
+EXPORT_SYMBOL(ib_rate_to_int);
+
 enum rdma_transport_type
 rdma_node_get_transport(enum rdma_node_type node_type)
 {
include/rdma/ib_verbs.h +1 -0
@@ -207,6 +207,7 @@ enum ib_port_cap_flags {
 	IB_PORT_SM_DISABLED			= 1 << 10,
 	IB_PORT_SYS_IMAGE_GUID_SUP		= 1 << 11,
 	IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP	= 1 << 12,
+	IB_PORT_EXTENDED_SPEEDS_SUP             = 1 << 14,
 	IB_PORT_CM_SUP				= 1 << 16,
 	IB_PORT_SNMP_TUNNEL_SUP			= 1 << 17,
 	IB_PORT_REINIT_SUP			= 1 << 18,

include/rdma/ib_verbs.h enum ib_port_width { · line 230

Quoted 4 lines
include/rdma/ib_verbs.h +1 -0
@@ -226,6 +227,42 @@ enum ib_port_width {
 	IB_WIDTH_12X	= 8
 };
 
+static inline int ib_active_speed_to_rate(u8 active_speed, int *rounded)

I don't see where this is used.

The other patches in this series look good to me.

- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to a message not in the archive
Quoted 1 line · Sean

I like this approach better, but I wonder if it still couldn't be slightly cleaner.  Rather than returning 'rounded' and having the caller assume that 1 means add .5 to the result, we could return the fractional part directly.  I.e. rename 'rounded' to 'fraction' and return 5.

Why not just define this function to return the rate in units where it's a whole number?
ie just have the function return the value in Mbps instead of Gbps, so it returns
2500, 5000, etc. instead of 2+(*rounded=5), 5+(*rounded=0), etc.

By the way, you say:

Quoted 1 line

FDR - represents the IBA extended speed: 14.0625 Gbps.

but AFAIK FDR is 14.025 Gbps (and my suggestion above would let this be returned as 14025 Mbps).

Quoted 1 line

Or if ib_rate_to_int() is only used to convert the rate into a string, we could just return the string directly.

Maybe... I think it gets used in IPoIB too if I didn't misread things.

- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to a message not in the archive
Quoted 5 lines

Why not just define this function to return the rate in units where it's a whole number?
ie just have the function return the value in Mbps instead of Gbps, so it returns
2500, 5000, etc. instead of 2+(*rounded=5), 5+(*rounded=0), etc.

even simpler!

Quoted 4 lines
Quoted 1 line

Or if ib_rate_to_int() is only used to convert the rate into a string, we

could just return the string directly.

Maybe... I think it gets used in IPoIB too if I didn't misread things.

ipoib just converts it to a string, and I didn't see any other users of it.

+ rate = ib_rate_to_int(path.pathrec.rate, &rate_rounded);

seq_printf(file,
" DLID: 0x%04x\n"
@@ -220,8 +221,8 @@ static int ipoib_path_seq_show(struct se
" rate: %*d%s Gb/sec\n", be16_to_cpu(path.pathrec.dlid), path.pathrec.sl,

-			   10 - ((rate % 10) ? 2 : 0),
-			   rate / 10, rate % 10 ? ".5" : "");
+			   10 - (rate_rounded ? 2 : 0),
+			   rate, rate_rounded ? ".5" : "");

}
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
In reply to a message not in the archive

Changes from v1
- function ib_rate_to_int changed to ib_rate_to_mbps
- new implementation for ib_rate_to_mbps

The following extended speeds are introduced:
FDR-10 - is a proprietary link speed which is 10.3125 Gbps at 64/66
encoding rather than 8b10b encoding.
FDR - represents the IBA extended speed: 14.0625 Gbps.
EDR - represents the IBA extended speed: 25.78125 Gbps.

---
 drivers/infiniband/core/sysfs.c |   23 ++++++++++++++---
 drivers/infiniband/core/verbs.c |   25 ++++++++++++++++++
 include/rdma/ib_verbs.h         |   54 +++++++++++++++++++++++++++++++++++++++-
 3 files changed, 97 insertions(+), 5 deletions(-)
drivers/infiniband/core/sysfs.c +19 -4
@@ -179,6 +179,7 @@ static ssize_t rate_show(struct ib_port 
 	struct ib_port_attr attr;
 	char *speed = "";
 	int rate;
+	int rate_rounded;
 	ssize_t ret;
 
 	ret = ib_query_port(p->ibdev, p->port_num, &attr);
@@ -186,16 +187,30 @@ static ssize_t rate_show(struct ib_port 
 		return ret;
 
 	switch (attr.active_speed) {
-	case 2: speed = " DDR"; break;
-	case 4: speed = " QDR"; break;
+	case 2:
+		speed = " DDR";
+		break;
+	case 4:
+		speed = " QDR";
+		break;
+	case 8:
+		speed = " FDR10";
+		break;
+	case 16:
+		speed = " FDR";
+		break;
+	case 32:
+		speed = " EDR";
+		break;
 	}
 
-	rate = 25 * ib_width_enum_to_int(attr.active_width) * attr.active_speed;
+	rate = ib_width_enum_to_int(attr.active_width) *
+	       ib_active_speed_to_rate(attr.active_speed, &rate_rounded);
 	if (rate < 0)
 		return -EINVAL;
 
 	return sprintf(buf, "%d%s Gb/sec (%dX%s)\n",
-		       rate / 10, rate % 10 ? ".5" : "",
+		       rate, rate_rounded ? ".5" : "",
 		       ib_width_enum_to_int(attr.active_width), speed);
 }
 
drivers/infiniband/core/verbs.c +25 -0
@@ -77,6 +77,31 @@ enum ib_rate mult_to_ib_rate(int mult)
 }
 EXPORT_SYMBOL(mult_to_ib_rate);
 
+int ib_rate_to_mbps(enum ib_rate rate)
+{
+	switch (rate) {
+	case IB_RATE_2_5_GBPS: return 2500;
+	case IB_RATE_5_GBPS:   return 5000;
+	case IB_RATE_10_GBPS:  return 10000;
+	case IB_RATE_20_GBPS:  return 20000;
+	case IB_RATE_30_GBPS:  return 30000;
+	case IB_RATE_40_GBPS:  return 40000;
+	case IB_RATE_60_GBPS:  return 60000;
+	case IB_RATE_80_GBPS:  return 80000;
+	case IB_RATE_120_GBPS: return 120000;
+	case IB_RATE_14_GBPS:  return 14062;
+	case IB_RATE_56_GBPS:  return 56250;
+	case IB_RATE_112_GBPS: return 112500;
+	case IB_RATE_168_GBPS: return 168750;
+	case IB_RATE_25_GBPS:  return 25781;
+	case IB_RATE_100_GBPS: return 103125;
+	case IB_RATE_200_GBPS: return 206250;
+	case IB_RATE_300_GBPS: return 309375;
+	default:	       return -1;
+	}
+}
+EXPORT_SYMBOL(ib_rate_to_mbps);
+
 enum rdma_transport_type
 rdma_node_get_transport(enum rdma_node_type node_type)
 {
include/rdma/ib_verbs.h +53 -1

78 lines not on this page · raw message

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
In reply to a message not in the archive

Hi Sean,
The function ib_active_speed_to_rate is used in the same patch by rate_show function

Marcel

Quoted 57 lines · Sean

drivers/infiniband/core/verbs.c enum ib_rate mult_to_ib_rate(int mult) · line 81

Quoted 8 lines
drivers/infiniband/core/verbs.c +2 -0
@@ -77,6 +77,35 @@ enum ib_rate mult_to_ib_rate(int mult)
  }
  EXPORT_SYMBOL(mult_to_ib_rate);
 
+int ib_rate_to_int(enum ib_rate rate, int *rounded)
+{

I like this approach better, but I wonder if it still couldn't be slightly cleaner.  Rather than returning 'rounded' and having the caller assume that 1 means add .5 to the result, we could return the fractional part directly.  I.e. rename 'rounded' to 'fraction' and return 5.

Or if ib_rate_to_int() is only used to convert the rate into a string, we could just return the string directly.

Quoted 44 lines
drivers/infiniband/core/verbs.c +27 -0
+     *rounded = 0;
+
+     switch (rate) {
+     case IB_RATE_2_5_GBPS:
+             *rounded = 1;
+             return 2;
+     case IB_RATE_5_GBPS:   return 5;
+     case IB_RATE_10_GBPS:  return 10;
+     case IB_RATE_20_GBPS:  return 20;
+     case IB_RATE_30_GBPS:  return 30;
+     case IB_RATE_40_GBPS:  return 40;
+     case IB_RATE_60_GBPS:  return 60;
+     case IB_RATE_80_GBPS:  return 80;
+     case IB_RATE_120_GBPS: return 120;
+     case IB_RATE_14_GBPS:  return 14;
+     case IB_RATE_56_GBPS:  return 56;
+     case IB_RATE_112_GBPS: return 112;
+     case IB_RATE_168_GBPS: return 168;
+     case IB_RATE_25_GBPS:  return 25;
+     case IB_RATE_100_GBPS: return 100;
+     case IB_RATE_200_GBPS: return 200;
+     case IB_RATE_300_GBPS: return 300;
+     default:               return -1;
+     }
+}
+EXPORT_SYMBOL(ib_rate_to_int);
+

 enum rdma_transport_type rdma_node_get_transport(enum rdma_node_type node_type) {

include/rdma/ib_verbs.h +1 -0
@@ -207,6 +207,7 @@ enum ib_port_cap_flags {
       IB_PORT_SM_DISABLED                     = 1 << 10,
       IB_PORT_SYS_IMAGE_GUID_SUP              = 1 << 11,
       IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP       = 1 << 12,
+     IB_PORT_EXTENDED_SPEEDS_SUP             = 1 << 14,
       IB_PORT_CM_SUP                          = 1 << 16,
       IB_PORT_SNMP_TUNNEL_SUP                 = 1 << 17,
       IB_PORT_REINIT_SUP                      = 1 << 18,
@@ -226,6 +227,42 @@ enum ib_port_width {

      IB_WIDTH_12X    = 8
 };

Quoted 8 lines
Quoted 1 line

+static inline int ib_active_speed_to_rate(u8 active_speed, int *rounded)

I don't see where this is used.

The other patches in this series look good to me.

- Sean

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw
In reply to a message not in the archive
Quoted 12 lines
drivers/infiniband/core/sysfs.c +6 -2
@@ -186,16 +187,30 @@ static ssize_t rate_show(struct ib_port
 		return ret;
 
 	switch (attr.active_speed) {
-	case 2: speed = " DDR"; break;
-	case 4: speed = " QDR"; break;
+	case 2:
+		speed = " DDR";
+		break;
+	case 4:
+		speed = " QDR";
+		break;

drivers/infiniband/core/sysfs.c static ssize_t rate_show(struct ib_port · line 205

Quoted 10 lines
drivers/infiniband/core/sysfs.c +9 -0
+	case 8:
+		speed = " FDR10";
+		break;
+	case 16:
+		speed = " FDR";
+		break;
+	case 32:
+		speed = " EDR";
+		break;
 	}

We're already switching on attr.active speed above. We should just merge ib_active_speed_to_rate() into this function, so we can avoid dealing with its 'rate_rounded' parameter as well.

drivers/infiniband/core/sysfs.c static ssize_t rate_show(struct ib_port · line 215

Quoted 12 lines
drivers/infiniband/core/sysfs.c +3 -2
-	rate = 25 * ib_width_enum_to_int(attr.active_width) * attr.active_speed;
+	rate = ib_width_enum_to_int(attr.active_width) *
+	       ib_active_speed_to_rate(attr.active_speed, &rate_rounded);
 	if (rate < 0)
 		return -EINVAL;
 
 	return sprintf(buf, "%d%s Gb/sec (%dX%s)\n",
-		       rate / 10, rate % 10 ? ".5" : "",
+		       rate, rate_rounded ? ".5" : "",
 		       ib_width_enum_to_int(attr.active_width), speed);
 }

Thanks,
Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw
In reply to a message not in the archive

Hi Sean,
Sure, thanks for the review

Marcel

Quoted 42 lines

-----Original Message-----
From: Hefty, Sean [mailto:[email protected]]
Sent: Tuesday, October 04, 2011 5:14 PM
To: Marcel Apfelbaum; [email protected]
Cc: [email protected]; Marcel Apfelbaum; Or Gerlitz; Hal Rosenstock
Subject: RE: [PATCH for-3.2 v1 1/5] ib/core: Add extended link speeds

Quoted 12 lines
drivers/infiniband/core/sysfs.c +6 -2
@@ -186,16 +187,30 @@ static ssize_t rate_show(struct ib_port
 		return ret;
 
 	switch (attr.active_speed) {
-	case 2: speed = " DDR"; break;
-	case 4: speed = " QDR"; break;
+	case 2:
+		speed = " DDR";
+		break;
+	case 4:
+		speed = " QDR";
+		break;

drivers/infiniband/core/sysfs.c static ssize_t rate_show(struct ib_port · line 205

Quoted 10 lines
drivers/infiniband/core/sysfs.c +9 -0
+	case 8:
+		speed = " FDR10";
+		break;
+	case 16:
+		speed = " FDR";
+		break;
+	case 32:
+		speed = " EDR";
+		break;
 	}

We're already switching on attr.active speed above. We should just merge ib_active_speed_to_rate() into this function, so we can avoid dealing with its 'rate_rounded' parameter as well.

Review static ssize_t rate_show(struct ib_port · line 192

Quoted 2 lines
(quoted diff) +0 -1
-	rate = 25 * ib_width_enum_to_int(attr.active_width) *

attr.active_speed;

Quoted 5 lines
drivers/infiniband/core/sysfs.c +2 -0
+	rate = ib_width_enum_to_int(attr.active_width) *
+	       ib_active_speed_to_rate(attr.active_speed, &rate_rounded);
 	if (rate < 0)
 		return -EINVAL;
 
Quoted 7 lines

drivers/infiniband/core/sysfs.c static ssize_t rate_show(struct ib_port

Quoted 4 lines
drivers/infiniband/core/sysfs.c +1 -1
 	return sprintf(buf, "%d%s Gb/sec (%dX%s)\n",
-		       rate / 10, rate % 10 ? ".5" : "",
+		       rate, rate_rounded ? ".5" : "",
 		       ib_width_enum_to_int(attr.active_width), speed);  }

Thanks,
Sean

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw

PATCH v2 1/5 ib/core: Add extended link speeds

In reply to a message not in the archive

The following extended speeds are introduced:
FDR-10 - is a proprietary link speed which is 10.3125 Gbps at 64/66
encoding rather than 8b10b encoding.
FDR - represents the IBA extended speed: 14.0625 Gbps.
EDR - represents the IBA extended speed: 25.78125 Gbps.

---
Changes from v1
- Removed ib_active_speed_to_rate function
- Moved ib_active_speed_to_rate code into rate_show method

 drivers/infiniband/core/sysfs.c |   26 ++++++++++++++++++++++----
 drivers/infiniband/core/verbs.c |   25 +++++++++++++++++++++++++
 include/rdma/ib_verbs.h         |   18 +++++++++++++++++-
 3 files changed, 64 insertions(+), 5 deletions(-)
drivers/infiniband/core/sysfs.c +22 -4
@@ -185,17 +185,35 @@ static ssize_t rate_show(struct ib_port 
 	if (ret)
 		return ret;
 
+	rate = (25 * attr.active_speed) / 10;
+
 	switch (attr.active_speed) {
-	case 2: speed = " DDR"; break;
-	case 4: speed = " QDR"; break;
+	case 2:
+		speed = " DDR";
+		break;
+	case 4:
+		speed = " QDR";
+		break;
+	case 8:
+		speed = " FDR10";
+		rate = 10;
+		break;
+	case 16:
+		speed = " FDR";
+		rate = 14;
+		break;
+	case 32:
+		speed = " EDR";
+		rate = 25;
+		break;
 	}
 
-	rate = 25 * ib_width_enum_to_int(attr.active_width) * attr.active_speed;
+	rate *= ib_width_enum_to_int(attr.active_width);
 	if (rate < 0)
 		return -EINVAL;
 
 	return sprintf(buf, "%d%s Gb/sec (%dX%s)\n",
-		       rate / 10, rate % 10 ? ".5" : "",
+		       rate, (attr.active_speed == 1) ? ".5" : "",
 		       ib_width_enum_to_int(attr.active_width), speed);
 }
 
drivers/infiniband/core/verbs.c +25 -0
@@ -77,6 +77,31 @@ enum ib_rate mult_to_ib_rate(int mult)
 }
 EXPORT_SYMBOL(mult_to_ib_rate);
 
+int ib_rate_to_mbps(enum ib_rate rate)
+{
+	switch (rate) {
+	case IB_RATE_2_5_GBPS: return 2500;
+	case IB_RATE_5_GBPS:   return 5000;
+	case IB_RATE_10_GBPS:  return 10000;
+	case IB_RATE_20_GBPS:  return 20000;
+	case IB_RATE_30_GBPS:  return 30000;
+	case IB_RATE_40_GBPS:  return 40000;
+	case IB_RATE_60_GBPS:  return 60000;
+	case IB_RATE_80_GBPS:  return 80000;
+	case IB_RATE_120_GBPS: return 120000;
+	case IB_RATE_14_GBPS:  return 14062;
+	case IB_RATE_56_GBPS:  return 56250;
+	case IB_RATE_112_GBPS: return 112500;
+	case IB_RATE_168_GBPS: return 168750;
+	case IB_RATE_25_GBPS:  return 25781;
+	case IB_RATE_100_GBPS: return 103125;
+	case IB_RATE_200_GBPS: return 206250;
+	case IB_RATE_300_GBPS: return 309375;
+	default:	       return -1;
+	}
+}
+EXPORT_SYMBOL(ib_rate_to_mbps);
+
 enum rdma_transport_type
 rdma_node_get_transport(enum rdma_node_type node_type)
 {
include/rdma/ib_verbs.h +17 -1
@@ -207,6 +207,7 @@ enum ib_port_cap_flags {
 	IB_PORT_SM_DISABLED			= 1 << 10,
 	IB_PORT_SYS_IMAGE_GUID_SUP		= 1 << 11,
 	IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP	= 1 << 12,
+	IB_PORT_EXTENDED_SPEEDS_SUP             = 1 << 14,
 	IB_PORT_CM_SUP				= 1 << 16,
 	IB_PORT_SNMP_TUNNEL_SUP			= 1 << 17,
 	IB_PORT_REINIT_SUP			= 1 << 18,
@@ -415,7 +416,15 @@ enum ib_rate {
 	IB_RATE_40_GBPS  = 7,
 	IB_RATE_60_GBPS  = 8,
 	IB_RATE_80_GBPS  = 9,
-	IB_RATE_120_GBPS = 10
+	IB_RATE_120_GBPS = 10,
+	IB_RATE_14_GBPS  = 11,
+	IB_RATE_56_GBPS  = 12,
+	IB_RATE_112_GBPS = 13,
+	IB_RATE_168_GBPS = 14,
+	IB_RATE_25_GBPS  = 15,
+	IB_RATE_100_GBPS = 16,
+	IB_RATE_200_GBPS = 17,
+	IB_RATE_300_GBPS = 18
 };
 
 /**
@@ -427,6 +436,13 @@ enum ib_rate {
 int ib_rate_to_mult(enum ib_rate rate) __attribute_const__;
 
 /**
+ * ib_rate_to_mbps - Convert the IB rate enum to Mbps.
+ * For example, IB_RATE_2_5_GBPS will be converted to 2500.
+ * @rate: rate to convert.
+ */
+int ib_rate_to_mbps(enum ib_rate rate) __attribute_const__;
+
+/**
  * mult_to_ib_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate
  * enum.
  * @mult: multiple to convert.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by
#15 lore raw
In reply to a message not in the archive
Quoted 8 lines

The following extended speeds are introduced:
FDR-10 - is a proprietary link speed which is 10.3125 Gbps at 64/66
encoding rather than 8b10b encoding.
FDR - represents the IBA extended speed: 14.0625 Gbps.
EDR - represents the IBA extended speed: 25.78125 Gbps.

Quoted 1 line

---

FWIW - this series looks okay with me.

Quoted 116 lines

Changes from v1
- Removed ib_active_speed_to_rate function
- Moved ib_active_speed_to_rate code into rate_show method

 drivers/infiniband/core/sysfs.c |   26 ++++++++++++++++++++++----
 drivers/infiniband/core/verbs.c |   25 +++++++++++++++++++++++++
 include/rdma/ib_verbs.h         |   18 +++++++++++++++++-
 3 files changed, 64 insertions(+), 5 deletions(-)
drivers/infiniband/core/sysfs.c +22 -4
@@ -185,17 +185,35 @@ static ssize_t rate_show(struct ib_port
 	if (ret)
 		return ret;
 
+	rate = (25 * attr.active_speed) / 10;
+
 	switch (attr.active_speed) {
-	case 2: speed = " DDR"; break;
-	case 4: speed = " QDR"; break;
+	case 2:
+		speed = " DDR";
+		break;
+	case 4:
+		speed = " QDR";
+		break;
+	case 8:
+		speed = " FDR10";
+		rate = 10;
+		break;
+	case 16:
+		speed = " FDR";
+		rate = 14;
+		break;
+	case 32:
+		speed = " EDR";
+		rate = 25;
+		break;
 	}
 
-	rate = 25 * ib_width_enum_to_int(attr.active_width) * attr.active_speed;
+	rate *= ib_width_enum_to_int(attr.active_width);
 	if (rate < 0)
 		return -EINVAL;
 
 	return sprintf(buf, "%d%s Gb/sec (%dX%s)\n",
-		       rate / 10, rate % 10 ? ".5" : "",
+		       rate, (attr.active_speed == 1) ? ".5" : "",
 		       ib_width_enum_to_int(attr.active_width), speed);
 }
 
drivers/infiniband/core/verbs.c +25 -0
@@ -77,6 +77,31 @@ enum ib_rate mult_to_ib_rate(int mult)
 }
 EXPORT_SYMBOL(mult_to_ib_rate);
 
+int ib_rate_to_mbps(enum ib_rate rate)
+{
+	switch (rate) {
+	case IB_RATE_2_5_GBPS: return 2500;
+	case IB_RATE_5_GBPS:   return 5000;
+	case IB_RATE_10_GBPS:  return 10000;
+	case IB_RATE_20_GBPS:  return 20000;
+	case IB_RATE_30_GBPS:  return 30000;
+	case IB_RATE_40_GBPS:  return 40000;
+	case IB_RATE_60_GBPS:  return 60000;
+	case IB_RATE_80_GBPS:  return 80000;
+	case IB_RATE_120_GBPS: return 120000;
+	case IB_RATE_14_GBPS:  return 14062;
+	case IB_RATE_56_GBPS:  return 56250;
+	case IB_RATE_112_GBPS: return 112500;
+	case IB_RATE_168_GBPS: return 168750;
+	case IB_RATE_25_GBPS:  return 25781;
+	case IB_RATE_100_GBPS: return 103125;
+	case IB_RATE_200_GBPS: return 206250;
+	case IB_RATE_300_GBPS: return 309375;
+	default:	       return -1;
+	}
+}
+EXPORT_SYMBOL(ib_rate_to_mbps);
+
 enum rdma_transport_type
 rdma_node_get_transport(enum rdma_node_type node_type)
 {
include/rdma/ib_verbs.h +10 -1
@@ -207,6 +207,7 @@ enum ib_port_cap_flags {
 	IB_PORT_SM_DISABLED			= 1 << 10,
 	IB_PORT_SYS_IMAGE_GUID_SUP		= 1 << 11,
 	IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP	= 1 << 12,
+	IB_PORT_EXTENDED_SPEEDS_SUP             = 1 << 14,
 	IB_PORT_CM_SUP				= 1 << 16,
 	IB_PORT_SNMP_TUNNEL_SUP			= 1 << 17,
 	IB_PORT_REINIT_SUP			= 1 << 18,
@@ -415,7 +416,15 @@ enum ib_rate {
 	IB_RATE_40_GBPS  = 7,
 	IB_RATE_60_GBPS  = 8,
 	IB_RATE_80_GBPS  = 9,
-	IB_RATE_120_GBPS = 10
+	IB_RATE_120_GBPS = 10,
+	IB_RATE_14_GBPS  = 11,
+	IB_RATE_56_GBPS  = 12,
+	IB_RATE_112_GBPS = 13,
+	IB_RATE_168_GBPS = 14,
+	IB_RATE_25_GBPS  = 15,
+	IB_RATE_100_GBPS = 16,
+	IB_RATE_200_GBPS = 17,
+	IB_RATE_300_GBPS = 18
 };
 
 /**
@@ -427,6 +436,13 @@ enum ib_rate {
 int ib_rate_to_mult(enum ib_rate rate) __attribute_const__;
 
 /**

include/rdma/ib_verbs.h enum ib_rate { · line 448

Quoted 10 lines
include/rdma/ib_verbs.h +7 -0
+ * ib_rate_to_mbps - Convert the IB rate enum to Mbps.
+ * For example, IB_RATE_2_5_GBPS will be converted to 2500.
+ * @rate: rate to convert.
+ */
+int ib_rate_to_mbps(enum ib_rate rate) __attribute_const__;
+
+/**
  * mult_to_ib_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate
  * enum.
  * @mult: multiple to convert.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw
In reply to a message not in the archive
Quoted 7 lines · Sean
Quoted 4 lines

The following extended speeds are introduced:
FDR-10  - is a proprietary link speed which is 10.3125 Gbps at 64/66 encoding rather FDR     - represents the IBA extended speed: 14.0625 Gbps.
EDR     - represents the IBA extended speed: 25.78125 Gbps.

FWIW - this series looks okay with me.

Roland,

Just wanted to check if anything else if needed here beyond Sean's thorough review.

BTW what's your estimate on how long do we have before the 3.2 merge window opens?
I was under the misconception that the top (Linus) mainline kernel is under hold as of the kernel.org being down, upto two days ago when I noted that the first github hit for Linux is Linus tree which is @ -rc9, anyway,

Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#19 lore raw
In reply to a message not in the archive
Quoted 3 lines · Or Gerlitz

I was under the misconception that the top (Linus) mainline kernel is under hold as of the kernel.org being down, upto two days ago when I noted that the first github hit for Linux is Linus tree which is @ -rc9, anyway,

FWIW I just noted that kernel.org is up again,

Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html