IB/core: Add support for XDR link speed
authorOr Har-Toov <ohartoov@nvidia.com>
Wed, 20 Sep 2023 10:07:40 +0000 (13:07 +0300)
committerLeon Romanovsky <leon@kernel.org>
Tue, 26 Sep 2023 09:38:39 +0000 (12:38 +0300)
Add new IBTA speed XDR, the new rate that was added to Infiniband spec
as part of XDR and supporting signaling rate of 200Gb.

In order to report that value to rdma-core, add new u32 field to
query_port response.

Signed-off-by: Or Har-Toov <ohartoov@nvidia.com>
Reviewed-by: Mark Zhang <markzhang@nvidia.com>
Link: https://lore.kernel.org/r/9d235fc600a999e8274010f0e18b40fa60540e6c.1695204156.git.leon@kernel.org
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/core/sysfs.c
drivers/infiniband/core/uverbs_std_types_device.c
drivers/infiniband/core/verbs.c
include/rdma/ib_verbs.h
include/uapi/rdma/ib_user_ioctl_verbs.h

index ec5efdc1666013b675403d820da3215079b679b2..9f97bef0214975adb88b541496c3c10071c081c3 100644 (file)
@@ -342,6 +342,10 @@ static ssize_t rate_show(struct ib_device *ibdev, u32 port_num,
                speed = " NDR";
                rate = 1000;
                break;
+       case IB_SPEED_XDR:
+               speed = " XDR";
+               rate = 2000;
+               break;
        case IB_SPEED_SDR:
        default:                /* default to SDR for invalid rates */
                speed = " SDR";
index 049684880ae03df75a47c4bc9d49f8ca78ed6dd8..fb0555647336f46364763b0c7369ef81987c7166 100644 (file)
@@ -203,6 +203,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_PORT)(
 
        copy_port_attr_to_resp(&attr, &resp.legacy_resp, ib_dev, port_num);
        resp.port_cap_flags2 = attr.port_cap_flags2;
+       resp.active_speed_ex = attr.active_speed;
 
        return uverbs_copy_to_struct_or_zero(attrs, UVERBS_ATTR_QUERY_PORT_RESP,
                                             &resp, sizeof(resp));
@@ -461,7 +462,7 @@ DECLARE_UVERBS_NAMED_METHOD(
        UVERBS_ATTR_PTR_OUT(
                UVERBS_ATTR_QUERY_PORT_RESP,
                UVERBS_ATTR_STRUCT(struct ib_uverbs_query_port_resp_ex,
-                                  reserved),
+                                  active_speed_ex),
                UA_MANDATORY));
 
 DECLARE_UVERBS_NAMED_METHOD(
index cc2c37096bbafd21c9ef8ea3ac73cac74fe6e85d..8a6da87f464b0d70e0c0e1adf45ed9e1a7c85a78 100644 (file)
@@ -147,6 +147,7 @@ __attribute_const__ int ib_rate_to_mult(enum ib_rate rate)
        case IB_RATE_50_GBPS:  return  20;
        case IB_RATE_400_GBPS: return 160;
        case IB_RATE_600_GBPS: return 240;
+       case IB_RATE_800_GBPS: return 320;
        default:               return  -1;
        }
 }
@@ -176,6 +177,7 @@ __attribute_const__ enum ib_rate mult_to_ib_rate(int mult)
        case 20:  return IB_RATE_50_GBPS;
        case 160: return IB_RATE_400_GBPS;
        case 240: return IB_RATE_600_GBPS;
+       case 320: return IB_RATE_800_GBPS;
        default:  return IB_RATE_PORT_CURRENT;
        }
 }
@@ -205,6 +207,7 @@ __attribute_const__ int ib_rate_to_mbps(enum ib_rate rate)
        case IB_RATE_50_GBPS:  return 53125;
        case IB_RATE_400_GBPS: return 425000;
        case IB_RATE_600_GBPS: return 637500;
+       case IB_RATE_800_GBPS: return 850000;
        default:               return -1;
        }
 }
index e36c0d9aad276bcb5e527a5825ea531c844807ed..fd61c3a56fa7e62ee83619dd9ea2456afb29d569 100644 (file)
@@ -561,6 +561,7 @@ enum ib_port_speed {
        IB_SPEED_EDR    = 32,
        IB_SPEED_HDR    = 64,
        IB_SPEED_NDR    = 128,
+       IB_SPEED_XDR    = 256,
 };
 
 enum ib_stat_flag {
@@ -840,6 +841,7 @@ enum ib_rate {
        IB_RATE_50_GBPS  = 20,
        IB_RATE_400_GBPS = 21,
        IB_RATE_600_GBPS = 22,
+       IB_RATE_800_GBPS = 23,
 };
 
 /**
index d7c5aaa3274453f2dac87d8ad4c32ba9a0f5b346..fe15bc7e9f707bbf255eb35523e08b747a050f5c 100644 (file)
@@ -220,7 +220,8 @@ enum ib_uverbs_advise_mr_flag {
 struct ib_uverbs_query_port_resp_ex {
        struct ib_uverbs_query_port_resp legacy_resp;
        __u16 port_cap_flags2;
-       __u8  reserved[6];
+       __u8  reserved[2];
+       __u32 active_speed_ex;
 };
 
 struct ib_uverbs_qp_cap {