[PATCH rdma-core 5/6] verbs: Added new rates derived from 2x and HDR support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michael Guralnik <michaelgur@xxxxxxxxxxxx>

Due to 2x and HDR addition new rates exposed:
28 Gbps - FDR 2x.
50 Gbps - EDR 2x or HDR 1x.
400 Gbps - HDR 8x.
600 Gbps - HDR 12x.

Utility methods were updated to support the new rates.
Rate to mult - Convert the IB rate enum to a multiple of the base rate
of 2.5 Gbit/sec.  For example, IBV_RATE_5_GBPS will be converted to 2,
since 5 Gbit/sec is 2 * 2.5 Gbit/sec.

Rate to mbps - Convert IB rate enum to the mbps value. conversion done
by multiplication of IB rate in mbps from IB spec and width needed to reach
the rate. For example, 400 GBPS is reached by HDR 8x so the mbps rate is
53.125 Gbit/sec * 8 = 425,000 mbps.

In addition, speed_str() and width_str() as part of ibv_devinfo were
updated to consider the new HDR and 2x options.

Signed-off-by: Michael Guralnik <michaelgur@xxxxxxxxxxxx>
Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
---
 libibverbs/examples/devinfo.c |  2 ++
 libibverbs/verbs.c            | 16 ++++++++++++++++
 libibverbs/verbs.h            |  6 +++++-
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c
index 5bbe936..735adb1 100644
--- a/libibverbs/examples/devinfo.c
+++ b/libibverbs/examples/devinfo.c
@@ -128,6 +128,7 @@ static const char *width_str(uint8_t width)
 	case 2:  return "4";
 	case 4:  return "8";
 	case 8:  return "12";
+	case 16: return "2";
 	default: return "invalid width";
 	}
 }
@@ -143,6 +144,7 @@ static const char *speed_str(uint8_t speed)
 
 	case 16: return "14.0 Gbps";
 	case 32: return "25.0 Gbps";
+	case 64: return "50.0 Gbps";
 	default: return "invalid speed";
 	}
 }
diff --git a/libibverbs/verbs.c b/libibverbs/verbs.c
index 3540ef2..9cdc361 100644
--- a/libibverbs/verbs.c
+++ b/libibverbs/verbs.c
@@ -69,6 +69,10 @@ int __attribute__((const)) ibv_rate_to_mult(enum ibv_rate rate)
 	case IBV_RATE_60_GBPS:  return 24;
 	case IBV_RATE_80_GBPS:  return 32;
 	case IBV_RATE_120_GBPS: return 48;
+	case IBV_RATE_28_GBPS:  return 11;
+	case IBV_RATE_50_GBPS:  return 20;
+	case IBV_RATE_400_GBPS: return 160;
+	case IBV_RATE_600_GBPS: return 240;
 	default:           return -1;
 	}
 }
@@ -85,6 +89,10 @@ enum ibv_rate __attribute__((const)) mult_to_ibv_rate(int mult)
 	case 24: return IBV_RATE_60_GBPS;
 	case 32: return IBV_RATE_80_GBPS;
 	case 48: return IBV_RATE_120_GBPS;
+	case 11: return IBV_RATE_28_GBPS;
+	case 20: return IBV_RATE_50_GBPS;
+	case 160: return IBV_RATE_400_GBPS;
+	case 240: return IBV_RATE_600_GBPS;
 	default: return IBV_RATE_MAX;
 	}
 }
@@ -109,6 +117,10 @@ int  __attribute__((const)) ibv_rate_to_mbps(enum ibv_rate rate)
 	case IBV_RATE_100_GBPS: return 103125;
 	case IBV_RATE_200_GBPS: return 206250;
 	case IBV_RATE_300_GBPS: return 309375;
+	case IBV_RATE_28_GBPS:  return 28125;
+	case IBV_RATE_50_GBPS:  return 53125;
+	case IBV_RATE_400_GBPS: return 425000;
+	case IBV_RATE_600_GBPS: return 637500;
 	default:               return -1;
 	}
 }
@@ -133,6 +145,10 @@ enum ibv_rate __attribute__((const)) mbps_to_ibv_rate(int mbps)
 	case 103125: return IBV_RATE_100_GBPS;
 	case 206250: return IBV_RATE_200_GBPS;
 	case 309375: return IBV_RATE_300_GBPS;
+	case 28125:  return IBV_RATE_28_GBPS;
+	case 53125:  return IBV_RATE_50_GBPS;
+	case 425000: return IBV_RATE_400_GBPS;
+	case 637500: return IBV_RATE_600_GBPS;
 	default:     return IBV_RATE_MAX;
 	}
 }
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 40a7280..c9491a7 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -661,7 +661,11 @@ enum ibv_rate {
 	IBV_RATE_25_GBPS  = 15,
 	IBV_RATE_100_GBPS = 16,
 	IBV_RATE_200_GBPS = 17,
-	IBV_RATE_300_GBPS = 18
+	IBV_RATE_300_GBPS = 18,
+	IBV_RATE_28_GBPS  = 19,
+	IBV_RATE_50_GBPS  = 20,
+	IBV_RATE_400_GBPS = 21,
+	IBV_RATE_600_GBPS = 22,
 };
 
 /**
-- 
1.8.3.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux