* [PATCH for-next] RDMA/efa: Implement the query port speed verb
@ 2026-06-08 8:39 Tom Sela
2026-06-09 19:04 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Tom Sela @ 2026-06-08 8:39 UTC (permalink / raw)
To: jgg, leon, linux-rdma, mrgolin, tomsela
Cc: sleybo, matua, gal.pressman, Yonatan Nachum
Implement the query port speed callback to report the port effective
bandwidth directly in 100 Mb/s granularity.
Reviewed-by: Michael Margolin <mrgolin@amazon.com>
Reviewed-by: Yonatan Nachum <ynachum@amazon.com>
Signed-off-by: Tom Sela <tomsela@amazon.com>
---
drivers/infiniband/hw/efa/efa.h | 1 +
drivers/infiniband/hw/efa/efa_com_cmd.c | 4 ++++
drivers/infiniband/hw/efa/efa_main.c | 1 +
drivers/infiniband/hw/efa/efa_verbs.c | 13 ++++++++++---
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/efa/efa.h b/drivers/infiniband/hw/efa/efa.h
index 00b19f2ba3da..f4586bb170c1 100644
--- a/drivers/infiniband/hw/efa/efa.h
+++ b/drivers/infiniband/hw/efa/efa.h
@@ -148,6 +148,7 @@ int efa_query_device(struct ib_device *ibdev,
struct ib_udata *udata);
int efa_query_port(struct ib_device *ibdev, u32 port,
struct ib_port_attr *props);
+int efa_query_port_speed(struct ib_device *ibdev, u32 port_num, u64 *speed);
int efa_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
int qp_attr_mask,
struct ib_qp_init_attr *qp_init_attr);
diff --git a/drivers/infiniband/hw/efa/efa_com_cmd.c b/drivers/infiniband/hw/efa/efa_com_cmd.c
index 63c7f07806a8..5db4f5805b59 100644
--- a/drivers/infiniband/hw/efa/efa_com_cmd.c
+++ b/drivers/infiniband/hw/efa/efa_com_cmd.c
@@ -6,6 +6,8 @@
#include "efa_com.h"
#include "efa_com_cmd.h"
+#define EFA_DEFAULT_LINK_SPEED_GBPS 100
+
int efa_com_create_qp(struct efa_com_dev *edev,
struct efa_com_create_qp_params *params,
struct efa_com_create_qp_result *res)
@@ -468,6 +470,8 @@ int efa_com_get_device_attr(struct efa_com_dev *edev,
result->device_caps = resp.u.device_attr.device_caps;
result->guid = resp.u.device_attr.guid;
result->max_link_speed_gbps = resp.u.device_attr.max_link_speed_gbps;
+ if (!result->max_link_speed_gbps)
+ result->max_link_speed_gbps = EFA_DEFAULT_LINK_SPEED_GBPS;
if (result->admin_api_version < 1) {
ibdev_err_ratelimited(
diff --git a/drivers/infiniband/hw/efa/efa_main.c b/drivers/infiniband/hw/efa/efa_main.c
index 03c237c8c81e..97da8e828e34 100644
--- a/drivers/infiniband/hw/efa/efa_main.c
+++ b/drivers/infiniband/hw/efa/efa_main.c
@@ -390,6 +390,7 @@ static const struct ib_device_ops efa_dev_ops = {
.query_gid = efa_query_gid,
.query_pkey = efa_query_pkey,
.query_port = efa_query_port,
+ .query_port_speed = efa_query_port_speed,
.query_qp = efa_query_qp,
.reg_user_mr = efa_reg_mr,
.reg_user_mr_dmabuf = efa_reg_user_mr_dmabuf,
diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
index 5cd34746e6a6..5bb00cb85775 100644
--- a/drivers/infiniband/hw/efa/efa_verbs.c
+++ b/drivers/infiniband/hw/efa/efa_verbs.c
@@ -90,8 +90,6 @@ static const struct rdma_stat_desc efa_port_stats_descs[] = {
EFA_DEFINE_PORT_STATS(EFA_STATS_STR)
};
-#define EFA_DEFAULT_LINK_SPEED_GBPS 100
-
#define EFA_CHUNK_PAYLOAD_SHIFT 12
#define EFA_CHUNK_PAYLOAD_SIZE BIT(EFA_CHUNK_PAYLOAD_SHIFT)
#define EFA_CHUNK_PAYLOAD_PTR_SIZE 8
@@ -332,7 +330,7 @@ int efa_query_port(struct ib_device *ibdev, u32 port,
props->phys_state = IB_PORT_PHYS_STATE_LINK_UP;
props->gid_tbl_len = 1;
props->pkey_tbl_len = 1;
- link_gbps = dev->dev_attr.max_link_speed_gbps ?: EFA_DEFAULT_LINK_SPEED_GBPS;
+ link_gbps = dev->dev_attr.max_link_speed_gbps;
efa_link_gbps_to_speed_and_width(link_gbps, &link_speed, &link_width);
props->active_speed = link_speed;
props->active_width = link_width;
@@ -344,6 +342,15 @@ int efa_query_port(struct ib_device *ibdev, u32 port,
return 0;
}
+int efa_query_port_speed(struct ib_device *ibdev, u32 port_num, u64 *speed)
+{
+ struct efa_dev *dev = to_edev(ibdev);
+
+ *speed = dev->dev_attr.max_link_speed_gbps * 10;
+
+ return 0;
+}
+
int efa_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
int qp_attr_mask,
struct ib_qp_init_attr *qp_init_attr)
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for-next] RDMA/efa: Implement the query port speed verb
2026-06-08 8:39 [PATCH for-next] RDMA/efa: Implement the query port speed verb Tom Sela
@ 2026-06-09 19:04 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2026-06-09 19:04 UTC (permalink / raw)
To: Tom Sela
Cc: leon, linux-rdma, mrgolin, sleybo, matua, gal.pressman,
Yonatan Nachum
On Mon, Jun 08, 2026 at 08:39:27AM +0000, Tom Sela wrote:
> Implement the query port speed callback to report the port effective
> bandwidth directly in 100 Mb/s granularity.
>
> Reviewed-by: Michael Margolin <mrgolin@amazon.com>
> Reviewed-by: Yonatan Nachum <ynachum@amazon.com>
> Signed-off-by: Tom Sela <tomsela@amazon.com>
> ---
> drivers/infiniband/hw/efa/efa.h | 1 +
> drivers/infiniband/hw/efa/efa_com_cmd.c | 4 ++++
> drivers/infiniband/hw/efa/efa_main.c | 1 +
> drivers/infiniband/hw/efa/efa_verbs.c | 13 ++++++++++---
> 4 files changed, 16 insertions(+), 3
Applied to for-next thanks
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-09 19:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-08 8:39 [PATCH for-next] RDMA/efa: Implement the query port speed verb Tom Sela
2026-06-09 19:04 ` Jason Gunthorpe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.