diff mbox series

[rdma-core,1/3] verbs: Extend support of NDR rates

Message ID 20211229085502.167651-2-yishaih@nvidia.com (mailing list archive)
State Not Applicable
Headers show
Series Add NDR support | expand

Commit Message

Yishai Hadas Dec. 29, 2021, 8:55 a.m. UTC
From: Maher Sanalla <msanalla@nvidia.com>

NDR(106.25 Gbps) support exposed new data rates:
800 Gbps - NDR 8x.
1200 Gbps - NDR 12x.

Utility methods were updated to support the new rates mentioned above:
1) Rate to mult - Convert the IB rate enum to a multiple of 2.5 Gbps.
2) Rate to mbps - Convert IB rate enum to the mbps value.

The NDR support bit from PortInfo.CapabilityMask2 was added to
libibverbs, as well as the new link speeds mentioned above.

In addition, speed_str() of ibv_devinfo was updated to consider the new
NDR rate.

Reference: IB Spec Release 1.5

Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
---
 libibverbs/examples/devinfo.c | 1 +
 libibverbs/verbs.c            | 8 ++++++++
 libibverbs/verbs.h            | 3 +++
 3 files changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c
index 5db568b..cef6e2e 100644
--- a/libibverbs/examples/devinfo.c
+++ b/libibverbs/examples/devinfo.c
@@ -147,6 +147,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";
+	case 128: return "100.0 Gbps";
 	default: return "invalid speed";
 	}
 }
diff --git a/libibverbs/verbs.c b/libibverbs/verbs.c
index ee26b1d..69f82e5 100644
--- a/libibverbs/verbs.c
+++ b/libibverbs/verbs.c
@@ -72,6 +72,8 @@  int __attribute__((const)) ibv_rate_to_mult(enum ibv_rate rate)
 	case IBV_RATE_50_GBPS:  return 20;
 	case IBV_RATE_400_GBPS: return 160;
 	case IBV_RATE_600_GBPS: return 240;
+	case IBV_RATE_800_GBPS: return 320;
+	case IBV_RATE_1200_GBPS: return 480;
 	default:           return -1;
 	}
 }
@@ -92,6 +94,8 @@  enum ibv_rate __attribute__((const)) mult_to_ibv_rate(int mult)
 	case 20: return IBV_RATE_50_GBPS;
 	case 160: return IBV_RATE_400_GBPS;
 	case 240: return IBV_RATE_600_GBPS;
+	case 320: return IBV_RATE_800_GBPS;
+	case 480: return IBV_RATE_1200_GBPS;
 	default: return IBV_RATE_MAX;
 	}
 }
@@ -120,6 +124,8 @@  int  __attribute__((const)) ibv_rate_to_mbps(enum ibv_rate rate)
 	case IBV_RATE_50_GBPS:  return 53125;
 	case IBV_RATE_400_GBPS: return 425000;
 	case IBV_RATE_600_GBPS: return 637500;
+	case IBV_RATE_800_GBPS: return 850000;
+	case IBV_RATE_1200_GBPS: return 1275000;
 	default:               return -1;
 	}
 }
@@ -148,6 +154,8 @@  enum ibv_rate __attribute__((const)) mbps_to_ibv_rate(int mbps)
 	case 53125:  return IBV_RATE_50_GBPS;
 	case 425000: return IBV_RATE_400_GBPS;
 	case 637500: return IBV_RATE_600_GBPS;
+	case 850000: return IBV_RATE_800_GBPS;
+	case 1275000: return IBV_RATE_1200_GBPS;
 	default:     return IBV_RATE_MAX;
 	}
 }
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 36b4142..6f7910b 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -418,6 +418,7 @@  enum ibv_port_cap_flags2 {
 	IBV_PORT_SWITCH_PORT_STATE_TABLE_SUP	= 1 << 3,
 	IBV_PORT_LINK_WIDTH_2X_SUP		= 1 << 4,
 	IBV_PORT_LINK_SPEED_HDR_SUP		= 1 << 5,
+	IBV_PORT_LINK_SPEED_NDR_SUP		= 1 << 10,
 };
 
 struct ibv_port_attr {
@@ -721,6 +722,8 @@  enum ibv_rate {
 	IBV_RATE_50_GBPS  = 20,
 	IBV_RATE_400_GBPS = 21,
 	IBV_RATE_600_GBPS = 22,
+	IBV_RATE_800_GBPS = 23,
+	IBV_RATE_1200_GBPS = 24,
 };
 
 /**