mlx5 update for 3.18
Subsystems (5)
cover mlx5 update for 3.18
Hi Dave,
This series integrates a new mechanism for populating and extracting field values used in the driver/firmware interaction around command mailboxes.
Eli.
Eli Cohen (4):
net/mlx5_core: Update device capabilities handling net/mlx5_core: Use hardware registers description header file net/mlx5_core: use set/get macros in device caps net/mlx5_core: Identify resources by their type
drivers/infiniband/hw/mlx5/cq.c | 8 +- drivers/infiniband/hw/mlx5/mad.c | 2 +- drivers/infiniband/hw/mlx5/main.c | 83 +- drivers/infiniband/hw/mlx5/qp.c | 72 +- drivers/infiniband/hw/mlx5/srq.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 77 +- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 14 +- drivers/net/ethernet/mellanox/mlx5/core/fw.c | 81 +- drivers/net/ethernet/mellanox/mlx5/core/main.c | 229 +- drivers/net/ethernet/mellanox/mlx5/core/qp.c | 60 +- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 4 +- include/linux/mlx5/device.h | 182 +- include/linux/mlx5/driver.h | 118 +- include/linux/mlx5/mlx5_ifc.h | 4464 ++++++++++++++++++++++++ include/linux/mlx5/qp.h | 3 +- 15 files changed, 4948 insertions(+), 455 deletions(-) create mode 100644 include/linux/mlx5/mlx5_ifc.h
Signature · 1 line
2.1.1
cover mlx5 update for 3.18
Hi Dave,
This series integrates a new mechanism for populating and extracting field values used in the driver/firmware interaction around command mailboxes.
Eli.
Eli Cohen (4):
net/mlx5_core: Update device capabilities handling net/mlx5_core: Use hardware registers description header file net/mlx5_core: use set/get macros in device caps net/mlx5_core: Identify resources by their type
drivers/infiniband/hw/mlx5/cq.c | 8 +- drivers/infiniband/hw/mlx5/mad.c | 2 +- drivers/infiniband/hw/mlx5/main.c | 83 +- drivers/infiniband/hw/mlx5/qp.c | 72 +- drivers/infiniband/hw/mlx5/srq.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 77 +- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 14 +- drivers/net/ethernet/mellanox/mlx5/core/fw.c | 81 +- drivers/net/ethernet/mellanox/mlx5/core/main.c | 229 +- drivers/net/ethernet/mellanox/mlx5/core/qp.c | 60 +- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 4 +- include/linux/mlx5/device.h | 182 +- include/linux/mlx5/driver.h | 118 +- include/linux/mlx5/mlx5_ifc.h | 4464 ++++++++++++++++++++++++ include/linux/mlx5/qp.h | 3 +- 15 files changed, 4948 insertions(+), 455 deletions(-) create mode 100644 include/linux/mlx5/mlx5_ifc.h
Signature · 1 line
2.1.1
PATCH 1/4 net/mlx5_core: Update device capabilities handling
In reply to Eli CohenRearrange struct mlx5_caps so it has a "gen" field to represent the current capabilities configured for the device. Max capabilities can also be queried from the device. Also update capabilities struct to contain more fields as per the latest revision if firmware specification.
--- drivers/infiniband/hw/mlx5/cq.c | 8 +- drivers/infiniband/hw/mlx5/mad.c | 2 +- drivers/infiniband/hw/mlx5/main.c | 83 ++++++---- drivers/infiniband/hw/mlx5/qp.c | 72 +++++--- drivers/infiniband/hw/mlx5/srq.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 24 ++- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/fw.c | 81 +-------- drivers/net/ethernet/mellanox/mlx5/core/main.c | 219 +++++++++++++++++++------ drivers/net/ethernet/mellanox/mlx5/core/uar.c | 4 +- include/linux/mlx5/device.h | 24 ++- include/linux/mlx5/driver.h | 28 +++- 12 files changed, 331 insertions(+), 222 deletions(-)
drivers/infiniband/hw/mlx5/cq.c +4 -4
@@ -752,7 +752,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, int entries,return ERR_PTR (-EINVAL ); entries =roundup_pow_of_two (entries +1 ); -if (entries > dev->mdev->caps.max_cqes) +if (entries > dev->mdev->caps.gen.max_cqes)return ERR_PTR (-EINVAL ); cq =kzalloc (sizeof (*cq),GFP_KERNEL );
@@ -919,7 +919,7 @@ int mlx5_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period)int err;u32 fsel; -if (!(dev->mdev->caps.flags &MLX5_DEV_CAP_FLAG_CQ_MODER )) +if (!(dev->mdev->caps.gen.flags &MLX5_DEV_CAP_FLAG_CQ_MODER ))return -ENOSYS ; in =kzalloc (sizeof (*in),GFP_KERNEL );
@@ -1074,7 +1074,7 @@ int mlx5_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)int uninitialized_var (cqe_size );unsigned long flags; -if (!(dev->mdev->caps.flags &MLX5_DEV_CAP_FLAG_RESIZE_CQ )) { +if (!(dev->mdev->caps.gen.flags &MLX5_DEV_CAP_FLAG_RESIZE_CQ )) {pr_info ("Firmware does not support resize CQ\n" );return -ENOSYS ; }
@@ -1083,7 +1083,7 @@ int mlx5_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)return -EINVAL ; entries =roundup_pow_of_two (entries +1 ); -if (entries > dev->mdev->caps.max_cqes +1 ) +if (entries > dev->mdev->caps.gen.max_cqes +1 )return -EINVAL ;if (entries == ibcq->cqe +1 )
drivers/infiniband/hw/mlx5/mad.c +1 -1
@@ -129,7 +129,7 @@ int mlx5_query_ext_port_caps(struct mlx5_ib_dev *dev, u8 port) packet_error =be16_to_cpu (out_mad->status); - dev->mdev->caps.ext_port_cap[port -1 ] = (!err && !packet_error) ? + dev->mdev->caps.gen.ext_port_cap[port -1 ] = (!err && !packet_error) ?MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO :0 ; out:
drivers/infiniband/hw/mlx5/main.c +47 -36
200 lines not on this page · raw message
drivers/infiniband/hw/mlx5/qp.c +47 -25
253 lines not on this page · raw message
drivers/infiniband/hw/mlx5/srq.c +4 -2
@@ -238,6 +238,7 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, struct ib_udata *udata) {struct mlx5_ib_dev *dev =to_mdev (pd->device); +struct mlx5_general_caps *gen;struct mlx5_ib_srq *srq;int desc_size;int buf_size;
@@ -247,11 +248,12 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd,int is_xrc;u32 flgs, xrcdn; + gen = &dev->mdev->caps.gen;/* Sanity check SRQ size before proceeding */ -if (init_attr->attr.max_wr >= dev->mdev->caps.max_srq_wqes) { +if (init_attr->attr.max_wr >= gen->max_srq_wqes) {mlx5_ib_dbg (dev,"max_wr %d, cap %d\n" , init_attr->attr.max_wr, - dev->mdev->caps.max_srq_wqes); + gen->max_srq_wqes);return ERR_PTR (-EINVAL ); }
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +15 -9
@@ -1538,16 +1538,9 @@ static const char *cmd_status_str(u8 status) } } -int mlx5_cmd_status_to_err (struct mlx5_outbox_hdr *hdr) +static int cmd_status_to_err (u8 status) { -if (!hdr->status) -return 0 ; - -pr_warn ("command failed, status %s(0x%x), syndrome 0x%x\n" , -cmd_status_str (hdr->status), hdr->status, -be32_to_cpu (hdr->syndrome)); - -switch (hdr->status) { +switch (status) {case MLX5_CMD_STAT_OK :return 0 ;case MLX5_CMD_STAT_INT_ERR :return -EIO ;case MLX5_CMD_STAT_BAD_OP_ERR :return -EINVAL ;
@@ -1567,3 +1560,16 @@ int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr)default :return -EIO ; } } + +/* this will be available till all the commands use set/get macros */ +int mlx5_cmd_status_to_err (struct mlx5_outbox_hdr *hdr) +{ +if (!hdr->status) +return 0 ; + +pr_warn ("command failed, status %s(0x%x), syndrome 0x%x\n" , +cmd_status_str (hdr->status), hdr->status, +be32_to_cpu (hdr->syndrome)); + +return cmd_status_to_err (hdr->status); +}
drivers/net/ethernet/mellanox/mlx5/core/eq.c +1 -1
@@ -468,7 +468,7 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) err =mlx5_create_map_eq (dev, &table->pages_eq,MLX5_EQ_VEC_PAGES , - dev->caps.max_vf +1 , + dev->caps.gen.max_vf +1 ,1 <<MLX5_EVENT_TYPE_PAGE_REQUEST ,"mlx5_pages_eq" , &dev->priv.uuari.uars[0 ]);if (err) {
drivers/net/ethernet/mellanox/mlx5/core/fw.c +2 -79
88 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/main.c +168 -51
268 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/uar.c +2 -2
@@ -174,11 +174,11 @@ int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari)for (i =0 ; i < tot_uuars; i++) { bf = &uuari->bfs[i]; - bf->buf_size = dev->caps.bf_reg_size /2 ; + bf->buf_size = dev->caps.gen.bf_reg_size /2 ; bf->uar = &uuari->uars[i /MLX5_BF_REGS_PER_PAGE ]; bf->regreg = uuari->uars[i /MLX5_BF_REGS_PER_PAGE ].map; bf->reg =NULL ;/* Add WC support */ - bf->offset = (i %MLX5_BF_REGS_PER_PAGE ) * dev->caps.bf_reg_size + + bf->offset = (i %MLX5_BF_REGS_PER_PAGE ) * dev->caps.gen.bf_reg_size +MLX5_BF_OFFSET ; bf->need_lock =need_uuar_lock (i);spin_lock_init (&bf->lock);
include/linux/mlx5/device.h +15 -9
@@ -71,6 +71,11 @@ enum { };enum { +MLX5_MIN_PKEY_TABLE_SIZE =128 , +MLX5_MAX_LOG_PKEY_TABLE =5 , +}; + +enum {MLX5_PERM_LOCAL_READ =1 <<2 ,MLX5_PERM_LOCAL_WRITE =1 <<3 ,MLX5_PERM_REMOTE_READ =1 <<4 ,
@@ -184,10 +189,10 @@ enum {MLX5_DEV_CAP_FLAG_CQ_MODER =1LL <<29 ,MLX5_DEV_CAP_FLAG_RESIZE_CQ =1LL <<30 ,MLX5_DEV_CAP_FLAG_RESIZE_SRQ =1LL <<32 , +MLX5_DEV_CAP_FLAG_DCT =1LL <<37 ,MLX5_DEV_CAP_FLAG_REMOTE_FENCE =1LL <<38 ,MLX5_DEV_CAP_FLAG_TLP_HINTS =1LL <<39 ,MLX5_DEV_CAP_FLAG_SIG_HAND_OVER =1LL <<40 , -MLX5_DEV_CAP_FLAG_DCT =1LL <<41 , MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46, };
@@ -243,10 +248,14 @@ enum { };enum { -MLX5_CAP_OFF_DCT =41 ,MLX5_CAP_OFF_CMDIF_CSUM =46 , }; +enum { +HCA_CAP_OPMOD_GET_MAX =0 , +HCA_CAP_OPMOD_GET_CUR =1 , +}; +struct mlx5_inbox_hdr {__be16 opcode;u8 rsvd[4 ];
@@ -303,9 +312,10 @@ struct mlx5_hca_cap {u8 log_max_ra_req_qp;u8 rsvd10;u8 log_max_ra_res_qp; -u8 rsvd11[4 ]; +u8 pad_cap; +u8 rsvd11[3 ];__be16 max_qp_count; -__be16 rsvd12; +__be16 pkey_table_size;u8 rsvd13;u8 local_ca_ack_delay;u8 rsvd14;
@@ -335,11 +345,7 @@ struct mlx5_hca_cap {u8 log_max_xrcd;u8 rsvd25[42 ];__be16 log_uar_page_sz; -u8 rsvd26[28 ]; -u8 log_max_atomic_size_qp; -u8 rsvd27[2 ]; -u8 log_max_atomic_size_dc; -u8 rsvd28[76 ]; +u8 rsvd26[108 ]; };
include/linux/mlx5/driver.h +25 -3
@@ -335,23 +335,30 @@ struct mlx5_port_caps {int pkey_table_len; }; -struct mlx5_caps { +struct mlx5_general_caps {u8 log_max_eq;u8 log_max_cq;u8 log_max_qp;u8 log_max_mkey;u8 log_max_pd;u8 log_max_srq; +u8 log_max_strq; +u8 log_max_mrw_sz; +u8 log_max_bsf_list_size; +u8 log_max_klm_list_size;u32 max_cqes;int max_wqes; +u32 max_eqes; +u32 max_indirection;int max_sq_desc_sz;int max_rq_desc_sz; +int max_dc_sq_desc_sz;u64 flags;u16 stat_rate_support;int log_max_msg;int num_ports; -int max_ra_res_qp; -int max_ra_req_qp; +u8 log_max_ra_res_qp; +u8 log_max_ra_req_qp;int max_srq_wqes;int bf_reg_size;int bf_regs_per_page;
@@ -363,6 +370,19 @@ struct mlx5_caps {u8 log_max_mcg;u32 max_qp_mcg;int min_page_sz; +int pd_cap; +u32 max_qp_counters; +u32 pkey_table_size; +u8 log_max_ra_req_dc; +u8 log_max_ra_res_dc; +u32 uar_sz; +u8 min_log_pg_sz; +u8 log_max_xrcd; +u16 log_uar_page_sz; +}; + +struct mlx5_caps { +struct mlx5_general_caps gen; };struct mlx5_cmd_mailbox {
@@ -695,6 +715,8 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);void mlx5_cmd_use_events (struct mlx5_core_dev *dev);void mlx5_cmd_use_polling (struct mlx5_core_dev *dev);int mlx5_cmd_status_to_err (struct mlx5_outbox_hdr *hdr); +int mlx5_core_get_caps (struct mlx5_core_dev *dev,struct mlx5_caps *caps, +u16 opmod);int mlx5_cmd_exec (struct mlx5_core_dev *dev,void *in,int in_size,void *out,int out_size); int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
Signature · 1 line
2.1.1
PATCH 2/4 net/mlx5_core: Use hardware registers description header file
In reply to Eli CohenAdd an auto generated header file that describes hardware registers along with set of macros that set/get values. The macros do static checks to avoid overflow, handle endianess, and overall provide a clean way to code commands.
A few commands were removed since they are not supported currently and will be added when support is available.
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 36 - drivers/net/ethernet/mellanox/mlx5/core/qp.c | 3 - include/linux/mlx5/device.h | 74 + include/linux/mlx5/driver.h | 76 +- include/linux/mlx5/mlx5_ifc.h | 4464 +++++++++++++++++++++++++ 5 files changed, 4539 insertions(+), 114 deletions(-) create mode 100644 include/linux/mlx5/mlx5_ifc.h
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +0 -36
@@ -357,60 +357,24 @@ const char *mlx5_command_str(int command)case MLX5_CMD_OP_2ERR_QP :return "2ERR_QP" ; -case MLX5_CMD_OP_RTS2SQD_QP : -return "RTS2SQD_QP" ; - -case MLX5_CMD_OP_SQD2RTS_QP : -return "SQD2RTS_QP" ; -case MLX5_CMD_OP_2RST_QP :return "2RST_QP" ;case MLX5_CMD_OP_QUERY_QP :return "QUERY_QP" ; -case MLX5_CMD_OP_CONF_SQP : -return "CONF_SQP" ; -case MLX5_CMD_OP_MAD_IFC :return "MAD_IFC" ;case MLX5_CMD_OP_INIT2INIT_QP :return "INIT2INIT_QP" ; -case MLX5_CMD_OP_SUSPEND_QP : -return "SUSPEND_QP" ; - -case MLX5_CMD_OP_UNSUSPEND_QP : -return "UNSUSPEND_QP" ; - -case MLX5_CMD_OP_SQD2SQD_QP : -return "SQD2SQD_QP" ; - -case MLX5_CMD_OP_ALLOC_QP_COUNTER_SET : -return "ALLOC_QP_COUNTER_SET" ; - -case MLX5_CMD_OP_DEALLOC_QP_COUNTER_SET : -return "DEALLOC_QP_COUNTER_SET" ; - -case MLX5_CMD_OP_QUERY_QP_COUNTER_SET : -return "QUERY_QP_COUNTER_SET" ; -case MLX5_CMD_OP_CREATE_PSV :return "CREATE_PSV" ;case MLX5_CMD_OP_DESTROY_PSV :return "DESTROY_PSV" ; -case MLX5_CMD_OP_QUERY_PSV : -return "QUERY_PSV" ; - -case MLX5_CMD_OP_QUERY_SIG_RULE_TABLE : -return "QUERY_SIG_RULE_TABLE" ; - -case MLX5_CMD_OP_QUERY_BLOCK_SIZE_TABLE : -return "QUERY_BLOCK_SIZE_TABLE" ; -case MLX5_CMD_OP_CREATE_SRQ :return "CREATE_SRQ" ;
drivers/net/ethernet/mellanox/mlx5/core/qp.c +0 -3
@@ -184,13 +184,10 @@ int mlx5_core_qp_modify(struct mlx5_core_dev *dev, enum mlx5_qp_state cur_state, [MLX5_QP_STATE_RST] = MLX5_CMD_OP_2RST_QP, [MLX5_QP_STATE_ERR] = MLX5_CMD_OP_2ERR_QP, [MLX5_QP_STATE_RTS ] =MLX5_CMD_OP_RTS2RTS_QP , - [MLX5_QP_STATE_SQD ] =MLX5_CMD_OP_RTS2SQD_QP , }, [MLX5_QP_STATE_SQD] = { [MLX5_QP_STATE_RST ] =MLX5_CMD_OP_2RST_QP , [MLX5_QP_STATE_ERR ] =MLX5_CMD_OP_2ERR_QP , - [MLX5_QP_STATE_RTS ] =MLX5_CMD_OP_SQD2RTS_QP , - [MLX5_QP_STATE_SQD ] =MLX5_CMD_OP_SQD2SQD_QP , }, [MLX5_QP_STATE_SQER ] = { [MLX5_QP_STATE_RST ] =MLX5_CMD_OP_2RST_QP ,
include/linux/mlx5/device.h +74 -0
80 lines not on this page · raw message
include/linux/mlx5/driver.h +1 -75
88 lines not on this page · raw message
include/linux/mlx5/mlx5_ifc.h new file +4464 -0
2,759 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.1
Part of the diff is not shown here. View the raw message.
Re: [PATCH net-next 2/4] net/mlx5_core: Use hardware registers description header file
Quoted 7 lines · Eli Cohen
Add an auto generated header file that describes hardware registers along with set of macros that set/get values. The macros do static checks to avoid overflow, handle endianess, and overall provide a clean way to code commands.
A few commands were removed since they are not supported currently and will be added when support is available.
Quoted 8 lines
Signed-off-by Eli Cohen <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 36 - drivers/net/ethernet/mellanox/mlx5/core/qp.c | 3 - include/linux/mlx5/device.h | 74 + include/linux/mlx5/driver.h | 76 +- include/linux/mlx5/mlx5_ifc.h | 4464 +++++++++++++++++++++++++ 5 files changed, 4539 insertions(+), 114 deletions(-)
I find hard time believing that all of 4k auto generated macros are actually used. Could you trim it down to only usable bits?
RE: [PATCH net-next 2/4] net/mlx5_core: Use hardware registers description header file
Quoted 1 line
I find hard time believing that all of 4k auto generated macros are actually used. Could you trim it down to only usable bits?
4K is the size of a header file that defines structs that describe the driver/firmware interface. It does not contribute a bit to code size. It's an autogenerated file based on data from the reference manual and I see no point in trimming it.
David Miller
maintainerRe: [PATCH net-next 2/4] net/mlx5_core: Use hardware registers description header file
From: Eli Cohen <[email protected]>
Date: Tue, 30 Sep 2014 19:34:40 +0000
Quoted 6 lines
Quoted 1 line
I find hard time believing that all of 4k auto generated macros are actually used. Could you trim it down to only usable bits?
4K is the size of a header file that defines structs that describe the driver/firmware interface. It does not contribute a bit to code size. It's an autogenerated file based on data from the reference manual and I see no point in trimming it.
People will try to review it only to discover that it's completely unused.
I've been through this before with other device driver teams telling us that it's part of some automated framework etc. and that doesn't make it acceptable.
Please trim these things down to exactly what the driver uses.
RE: [PATCH net-next 2/4] net/mlx5_core: Use hardware registers description header file
Quoted 5 lines
People will try to review it only to discover that it's completely unused.
I've been through this before with other device driver teams telling us that it's part of some automated framework etc. and that >doesn't make it acceptable.
Please trim these things down to exactly what the driver uses.
OK, I have sent a few minutes ago V1 series that fixes that.
PATCH 3/4 net/mlx5_core: use set/get macros in device caps
In reply to Eli CohenTransform device capabilities related commands to use set/get macros to manipulate command mailboxes.
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 17 +++ drivers/net/ethernet/mellanox/mlx5/core/main.c | 150 ++++++++++++------------- include/linux/mlx5/device.h | 92 --------------- include/linux/mlx5/driver.h | 1 + 4 files changed, 92 insertions(+), 168 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +17 -0
@@ -1537,3 +1537,20 @@ int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr)return cmd_status_to_err (hdr->status); } + +int mlx5_cmd_status_to_err_v2 (void *ptr) +{ +u32 syndrome; +u8 status; + + status =be32_to_cpu (*(__be32 *)ptr) >>24 ; +if (!status) +return 0 ; + + syndrome =be32_to_cpu (*(__be32 *)(ptr +4 )); + +pr_warn ("command failed, status %s(0x%x), syndrome 0x%x\n" , +cmd_status_str (status), status, syndrome); + +return cmd_status_to_err (status); +}
drivers/net/ethernet/mellanox/mlx5/core/main.c +74 -76
220 lines not on this page · raw message
include/linux/mlx5/device.h +0 -92
98 lines not on this page · raw message
include/linux/mlx5/driver.h +1 -0
@@ -641,6 +641,7 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);void mlx5_cmd_use_events (struct mlx5_core_dev *dev);void mlx5_cmd_use_polling (struct mlx5_core_dev *dev);int mlx5_cmd_status_to_err (struct mlx5_outbox_hdr *hdr); +int mlx5_cmd_status_to_err_v2 (void *ptr);int mlx5_core_get_caps (struct mlx5_core_dev *dev,struct mlx5_caps *caps,u16 opmod); int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
Signature · 1 line
2.1.1
PATCH 4/4 net/mlx5_core: Identify resources by their type
In reply to Eli CohenThis patch puts a common part as the first field of mlx5_core_qp. This field is used to identify which resource generated an event. This is required since upcoming new resource types such as DC targets are allocated for the same numerical space as regular QPs and may generate the same events. By searching the resource in the same table we can then look at the common field to identify the resource.
--- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 12 +++--- drivers/net/ethernet/mellanox/mlx5/core/qp.c | 57 ++++++++++++++++++++-------- include/linux/mlx5/driver.h | 13 ++++++- include/linux/mlx5/qp.h | 3 +- 4 files changed, 60 insertions(+), 25 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eq.c +6 -6
@@ -198,7 +198,7 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq)int eqes_found =0 ;int set_ci =0 ;u32 cqn; -u32 srqn; +u32 rsn;u8 port;while ((eqe =next_eqe_sw (eq))) {
@@ -224,18 +224,18 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq)case MLX5_EVENT_TYPE_PATH_MIG_FAILED :case MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR :case MLX5_EVENT_TYPE_WQ_ACCESS_ERROR : + rsn =be32_to_cpu (eqe->data.qp_srq.qp_srq_n) &0xffffff ;mlx5_core_dbg (dev,"event %s(%d) arrived\n" ,eqe_type_str (eqe->type), eqe->type); -mlx5_qp_event (dev,be32_to_cpu (eqe->data.qp_srq.qp_srq_n) &0xffffff , - eqe->type); +mlx5_rsc_event (dev, rsn, eqe->type);break ;case MLX5_EVENT_TYPE_SRQ_RQ_LIMIT :case MLX5_EVENT_TYPE_SRQ_CATAS_ERROR : - srqn =be32_to_cpu (eqe->data.qp_srq.qp_srq_n) &0xffffff ; + rsn =be32_to_cpu (eqe->data.qp_srq.qp_srq_n) &0xffffff ;mlx5_core_dbg (dev,"SRQ event %s(%d): srqn 0x%x\n" , -eqe_type_str (eqe->type), eqe->type, srqn); -mlx5_srq_event (dev, srqn, eqe->type); +eqe_type_str (eqe->type), eqe->type, rsn); +mlx5_srq_event (dev, rsn, eqe->type);break ;case MLX5_EVENT_TYPE_CMD :
drivers/net/ethernet/mellanox/mlx5/core/qp.c +41 -16
93 lines not on this page · raw message
include/linux/mlx5/driver.h +12 -1
@@ -375,6 +375,16 @@ struct mlx5_core_mr {u32 pd; }; +enum mlx5_res_type { +MLX5_RES_QP , +}; + +struct mlx5_core_rsc_common { +enum mlx5_res_type res; +atomic_t refcount; +struct completion free; +}; +struct mlx5_core_srq {u32 srqn;int max;
@@ -700,7 +710,7 @@ int mlx5_eq_init(struct mlx5_core_dev *dev);void mlx5_eq_cleanup (struct mlx5_core_dev *dev);void mlx5_fill_page_array (struct mlx5_buf *buf,__be64 *pas);void mlx5_cq_completion (struct mlx5_core_dev *dev,u32 cqn); -void mlx5_qp_event (struct mlx5_core_dev *dev,u32 qpn,int event_type); +void mlx5_rsc_event (struct mlx5_core_dev *dev,u32 rsn,int event_type);void mlx5_srq_event (struct mlx5_core_dev *dev,u32 srqn,int event_type);struct mlx5_core_srq *mlx5_core_get_srq (struct mlx5_core_dev *dev,u32 srqn);void mlx5_cmd_comp_handler (struct mlx5_core_dev *dev,unsigned long vector);
@@ -737,6 +747,7 @@ void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);int mlx5_core_create_psv (struct mlx5_core_dev *dev,u32 pdn,int npsvs,u32 *sig_index);int mlx5_core_destroy_psv (struct mlx5_core_dev *dev,int psv_num); +void mlx5_core_put_rsc (struct mlx5_core_rsc_common *common);static inline u32 mlx5_mkey_to_idx (u32 mkey) {
include/linux/mlx5/qp.h +1 -2
@@ -342,10 +342,9 @@ struct mlx5_stride_block_ctrl_seg { };struct mlx5_core_qp { +struct mlx5_core_rsc_common common;/* must be first */ void (*event) (struct mlx5_core_qp *,int );int qpn; -atomic_t refcount; -struct completion free;struct mlx5_rsc_debug *dbg;int pid; };
Signature · 1 line
2.1.1