RDMA/efa: Implement the query port speed verb
Subsystems (2)
PATCH 1/1 RDMA/efa: Implement the query port speed verb
Implement the query port speed callback to report the port effective bandwidth directly in 100 Mb/s granularity.
Reviewed-by Michael Margolin <[email protected]>
Reviewed-by Yonatan Nachum <[email protected]>
Signed-off-by Tom Sela <[email protected]>
--- 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(-)
drivers/infiniband/hw/efa/efa.h +1 -0
@@ -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);
drivers/infiniband/hw/efa/efa_com_cmd.c +4 -0
@@ -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(
drivers/infiniband/hw/efa/efa_main.c +1 -0
@@ -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,
drivers/infiniband/hw/efa/efa_verbs.c +10 -3
@@ -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)
Signature · 1 line
2.47.3
Quoted 6 lines · Tom Sela
Implement the query port speed callback to report the port effective bandwidth directly in 100 Mb/s granularity.
Reviewed-by Michael Margolin <[email protected]>Reviewed-by Yonatan Nachum <[email protected]>Signed-off-by Tom Sela <[email protected]>
Quoted 6 lines
--- 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