mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
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. Link: https://patch.msgid.link/r/20260608083927.4116-1-tomsela@amazon.com Reviewed-by: Michael Margolin <mrgolin@amazon.com> Reviewed-by: Yonatan Nachum <ynachum@amazon.com> Signed-off-by: Tom Sela <tomsela@amazon.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
7d4f515b66
commit
20ff935086
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user