The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e5d8b775bbf6f378a591211e373859ec44f74149

commit e5d8b775bbf6f378a591211e373859ec44f74149
Author:     Slava Shwartsman <[email protected]>
AuthorDate: 2026-05-13 14:54:51 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-06-17 18:23:14 +0000

    RDMA: Fix link active_speed size
    
    According to the IB spec active_speed size should be u16 and not u8 as
    before. Changing it to allow further extensions in offered speeds.
    
    Linux commit:
    376ceb31ff87 RDMA: Fix link active_speed size
    
    Reviewed by:    kib
    Tested by:      Wafa Hamzah <[email protected]>
    MFC after:      1 week
    Sponsored by:   NVIDIA Networking
    Differential revision: https://reviews.freebsd.org/D57084
---
 sys/dev/bnxt/bnxt_re/ib_verbs.c                               | 5 +++--
 sys/dev/irdma/irdma_kcompat.c                                 | 2 +-
 sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c                           | 6 +++---
 sys/dev/qlnx/qlnxr/qlnxr_verbs.c                              | 2 +-
 sys/ofed/drivers/infiniband/core/ib_uverbs_std_types_device.c | 3 ++-
 sys/ofed/include/rdma/ib_verbs.h                              | 2 +-
 6 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/sys/dev/bnxt/bnxt_re/ib_verbs.c b/sys/dev/bnxt/bnxt_re/ib_verbs.c
index 32899abab9ff..9e6887a7c6e1 100644
--- a/sys/dev/bnxt/bnxt_re/ib_verbs.c
+++ b/sys/dev/bnxt/bnxt_re/ib_verbs.c
@@ -241,7 +241,7 @@ int bnxt_re_modify_device(struct ib_device *ibdev,
        return 0;
 }
 
-static void __to_ib_speed_width(u32 espeed, u8 lanes, u8 *speed, u8 *width)
+static void __to_ib_speed_width(u32 espeed, u8 lanes, u16 *speed, u8 *width)
 {
        if (!lanes) {
                switch (espeed) {
@@ -342,7 +342,8 @@ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num,
 {
        struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev);
        struct bnxt_qplib_dev_attr *dev_attr = rdev->dev_attr;
-       u8 active_speed = 0, active_width = 0;
+       u16 active_speed = 0;
+       u8 active_width = 0;
 
        dev_dbg(rdev_to_dev(rdev), "QUERY PORT with port_num 0x%x\n", port_num);
        memset(port_attr, 0, sizeof(*port_attr));
diff --git a/sys/dev/irdma/irdma_kcompat.c b/sys/dev/irdma/irdma_kcompat.c
index 51f44133252c..4d02bd08ca65 100644
--- a/sys/dev/irdma/irdma_kcompat.c
+++ b/sys/dev/irdma/irdma_kcompat.c
@@ -1634,7 +1634,7 @@ irdma_query_port(struct ib_device *ibdev, u8 port,
                props->state = IB_PORT_DOWN;
                props->phys_state = IB_PORT_PHYS_STATE_DISABLED;
        }
-       ib_get_eth_speed(ibdev, port, (u16 *)& props->active_speed, 
&props->active_width);
+       ib_get_eth_speed(ibdev, port, &props->active_speed, 
&props->active_width);
 
        if (rdma_protocol_roce(ibdev, 1)) {
                props->gid_tbl_len = 32;
diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c 
b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
index 5825cee87d9b..6ff4e55630d7 100644
--- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
+++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
@@ -155,7 +155,7 @@ static if_t mlx5_ib_get_netdev(struct ib_device *device,
        return ndev;
 }
 
-static int translate_eth_proto_oper(u32 eth_proto_oper, u8 *active_speed,
+static int translate_eth_proto_oper(u32 eth_proto_oper, u16 *active_speed,
                                    u8 *active_width)
 {
        switch (eth_proto_oper) {
@@ -216,7 +216,7 @@ static int translate_eth_proto_oper(u32 eth_proto_oper, u8 
*active_speed,
        return 0;
 }
 
-static int translate_eth_ext_proto_oper(u32 eth_proto_oper, u8 *active_speed,
+static int translate_eth_ext_proto_oper(u32 eth_proto_oper, u16 *active_speed,
                                        u8 *active_width)
 {
        switch (eth_proto_oper) {
@@ -969,7 +969,7 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u8 
port,
        if (err)
                goto out;
 
-       props->active_speed     = (u8)ptys->ib_proto_oper;
+       props->active_speed     = (u16)ptys->ib_proto_oper;
 
        pmtu->local_port = port;
        err = mlx5_core_access_pmtu(mdev, pmtu, 0);
diff --git a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c
index d74f51831da7..f3a054c707c3 100644
--- a/sys/dev/qlnx/qlnxr/qlnxr_verbs.c
+++ b/sys/dev/qlnx/qlnxr/qlnxr_verbs.c
@@ -546,7 +546,7 @@ qlnxr_query_device(struct ib_device *ibdev, struct 
ib_device_attr *attr,
 }
 
 static inline void
-get_link_speed_and_width(int speed, uint8_t *ib_speed, uint8_t *ib_width)
+get_link_speed_and_width(int speed, uint16_t *ib_speed, uint8_t *ib_width)
 {
        switch (speed) {
        case 1000:
diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_std_types_device.c 
b/sys/ofed/drivers/infiniband/core/ib_uverbs_std_types_device.c
index 5d45a22eb9fe..a245cbdd440e 100644
--- a/sys/ofed/drivers/infiniband/core/ib_uverbs_std_types_device.c
+++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_std_types_device.c
@@ -153,7 +153,8 @@ void copy_port_attr_to_resp(struct ib_port_attr *attr,
        resp->subnet_timeout = attr->subnet_timeout;
        resp->init_type_reply = attr->init_type_reply;
        resp->active_width = attr->active_width;
-       resp->active_speed = attr->active_speed;
+       /* This ABI needs to be extended to provide any speed more than 
IB_SPEED_NDR */
+       resp->active_speed = min_t(u16, attr->active_speed, IB_SPEED_NDR);
        resp->phys_state = attr->phys_state;
        resp->link_layer = rdma_port_get_link_layer(ib_dev, port_num);
 }
diff --git a/sys/ofed/include/rdma/ib_verbs.h b/sys/ofed/include/rdma/ib_verbs.h
index 0c40a6f18f7c..0908c106f513 100644
--- a/sys/ofed/include/rdma/ib_verbs.h
+++ b/sys/ofed/include/rdma/ib_verbs.h
@@ -609,7 +609,7 @@ struct ib_port_attr {
        u8                      subnet_timeout;
        u8                      init_type_reply;
        u8                      active_width;
-       u8                      active_speed;
+       u16                     active_speed;
        u8                      phys_state;
        bool                    grh_required;
 };

Reply via email to