Mellanox mlx5 driver updates for 3.13
Subsystems (4)
cover Mellanox mlx5 driver updates for 3.13
Hi Roland,
The following set of patches contains fixes and enhancements to the mlx5 driver for the 3.13 merge window.
Eli
Eli Cohen (7):
IB/mlx5: Fix check of number of entries in create CQ IB/mlx5: Multithreaded create mr
IB/mlx5: Fix overflow check in IB_WR_FAST_REG_MR IB/mlx5: Simplify mlx5_ib_destroy_srq
mlx5: Fix cleanup flow when DMA mapping fails
mlx5: Support arbitrary page size to firmware
mlx5: Clear reserved area in set_hca_cap
Moshe Lazer (2):
IB/mlx5: Fix srq free in destroy qp
mlx5_core: Change optimal_reclaimed_pages for better performance
drivers/infiniband/hw/mlx5/cq.c | 23 +-- drivers/infiniband/hw/mlx5/main.c | 3 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 6 + drivers/infiniband/hw/mlx5/mr.c | 163 +++++++++++++---- drivers/infiniband/hw/mlx5/qp.c | 12 +- drivers/infiniband/hw/mlx5/srq.c | 8 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 106 ++++++++--- drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 8 +- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/main.c | 35 +++- drivers/net/ethernet/mellanox/mlx5/core/mr.c | 32 ++-- .../net/ethernet/mellanox/mlx5/core/pagealloc.c | 195 +++++++++++++++------ include/linux/mlx5/device.h | 9 +- include/linux/mlx5/driver.h | 18 +- 14 files changed, 451 insertions(+), 169 deletions(-)
Signature · 6 lines
1.8.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/9 IB/mlx5: Fix check of number of entries in create CQ
In reply to a message not in the archiveVerify that the value is non negative before rounding up to power of 2.
--- drivers/infiniband/hw/mlx5/cq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/cq.c +4 -1
@@ -653,8 +653,11 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, int entries,int eqn;int err; +if (entries <0 ) +return ERR_PTR (-EINVAL ); + entries =roundup_pow_of_two (entries +1 ); -if (entries <1 || entries > dev->mdev.caps.max_cqes) +if (entries > dev->mdev.caps.max_cqes)return ERR_PTR (-EINVAL ); cq =kzalloc (sizeof (*cq),GFP_KERNEL );
Signature · 6 lines
1.8.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/9 IB/mlx5: Multithreaded create mr
In reply to a message not in the archiveUse asynchronous commands to execute eight concurrent create MR commands. This is to fill memory caches faster so we keep consuming from there. Also, increase timeout for shrinking caches to five minutes.
--- drivers/infiniband/hw/mlx5/main.c | 3 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 6 + drivers/infiniband/hw/mlx5/mr.c | 163 +++++++++++++++++----- drivers/infiniband/hw/mlx5/qp.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 106 ++++++++++---- drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 8 +- drivers/net/ethernet/mellanox/mlx5/core/mr.c | 32 +++-- include/linux/mlx5/driver.h | 17 ++- 8 files changed, 255 insertions(+), 84 deletions(-)
drivers/infiniband/hw/mlx5/main.c +2 -1
@@ -745,7 +745,8 @@ static int alloc_pa_mkey(struct mlx5_ib_dev *dev, u32 *key, u32 pdn) seg->qpn_mkey7_0 =cpu_to_be32 (0xffffff <<8 ); seg->start_addr =0 ; - err =mlx5_core_create_mkey (&dev->mdev, &mr, in,sizeof (*in)); + err =mlx5_core_create_mkey (&dev->mdev, &mr, in,sizeof (*in), +NULL ,NULL ,NULL );if (err) {mlx5_ib_warn (dev,"failed to create mkey, %d\n" , err); goto err_in;
drivers/infiniband/hw/mlx5/mlx5_ib.h +6 -0
@@ -262,6 +262,9 @@ struct mlx5_ib_mr {int npages;struct completion done;enum ib_wc_status status; +struct mlx5_ib_dev *dev; +struct mlx5_create_mkey_mbox_out out; +unsigned long start; };struct mlx5_ib_fast_reg_page_list {
@@ -323,6 +326,7 @@ struct mlx5_cache_ent {struct mlx5_ib_dev *dev;struct work_struct work;struct delayed_work dwork; +int pending; };struct mlx5_mr_cache {
@@ -358,6 +362,8 @@ struct mlx5_ib_dev {spinlock_t mr_lock;struct mlx5_ib_resources devr;struct mlx5_mr_cache cache; +struct timer_list delay_timer; +int fill_delay; };static inline struct mlx5_ib_cq *to_mibcq (struct mlx5_core_cq *mcq)
drivers/infiniband/hw/mlx5/mr.c +125 -38
326 lines not on this page · raw message
drivers/infiniband/hw/mlx5/qp.c +3 -1
@@ -1744,6 +1744,7 @@ static void set_reg_umr_segment(struct mlx5_wqe_umr_ctrl_seg *umr,MLX5_MKEY_MASK_PD |MLX5_MKEY_MASK_LR |MLX5_MKEY_MASK_LW | +MLX5_MKEY_MASK_KEY |MLX5_MKEY_MASK_RR |MLX5_MKEY_MASK_RW | MLX5_MKEY_MASK_A |
@@ -1800,7 +1801,8 @@ static void set_reg_mkey_segment(struct mlx5_mkey_seg *seg, struct ib_send_wr *w seg->start_addr =cpu_to_be64 (wr->wr.fast_reg.iova_start); seg->len =cpu_to_be64 (wr->wr.fast_reg.length); seg->log2_page_size = wr->wr.fast_reg.page_shift; - seg->qpn_mkey7_0 =cpu_to_be32 (0xffffff <<8 ); + seg->qpn_mkey7_0 =cpu_to_be32 (0xffffff00 | +mlx5_mkey_variant (wr->wr.fast_reg.rkey)); } static void set_frwr_pages(struct mlx5_wqe_data_seg *dseg,
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +79 -27
233 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c +4 -4
@@ -154,10 +154,10 @@ static ssize_t average_read(struct file *filp, char __user *buf, size_t count,return 0 ; stats = filp->private_data; -spin_lock (&stats->lock); +spin_lock_irq (&stats->lock);if (stats->n) field =div64_u64 (stats->sum, stats->n); -spin_unlock (&stats->lock); +spin_unlock_irq (&stats->lock); ret =snprintf (tbuf,sizeof (tbuf),"%llu\n" , field);if (ret >0 ) {if (copy_to_user (buf, tbuf, ret))
@@ -175,10 +175,10 @@ static ssize_t average_write(struct file *filp, const char __user *buf,struct mlx5_cmd_stats *stats; stats = filp->private_data; -spin_lock (&stats->lock); +spin_lock_irq (&stats->lock); stats->sum =0 ; stats->n =0 ; -spin_unlock (&stats->lock); +spin_unlock_irq (&stats->lock); *pos += count;
drivers/net/ethernet/mellanox/mlx5/core/mr.c +21 -11
@@ -37,31 +37,41 @@#include "mlx5_core.h" int mlx5_core_create_mkey (struct mlx5_core_dev *dev,struct mlx5_core_mr *mr, -struct mlx5_create_mkey_mbox_in *in,int inlen) +struct mlx5_create_mkey_mbox_in *in,int inlen, +mlx5_cmd_cbk_t callback,void *context, +struct mlx5_create_mkey_mbox_out *out) { -struct mlx5_create_mkey_mbox_out out; +struct mlx5_create_mkey_mbox_out lout;int err;u8 key; -memset (&out,0 ,sizeof (out)); -spin_lock (&dev->priv.mkey_lock); +memset (&lout,0 ,sizeof (lout)); +spin_lock_irq (&dev->priv.mkey_lock); key = dev->priv.mkey_key++; -spin_unlock (&dev->priv.mkey_lock); +spin_unlock_irq (&dev->priv.mkey_lock); in->seg.qpn_mkey7_0 |=cpu_to_be32 (key); in->hdr.opcode =cpu_to_be16 (MLX5_CMD_OP_CREATE_MKEY ); - err =mlx5_cmd_exec (dev, in, inlen, &out,sizeof (out)); +if (callback) { + err =mlx5_cmd_exec_cb (dev, in, inlen, out,sizeof (*out), + callback, context); +return err; + }else { + err =mlx5_cmd_exec (dev, in, inlen, &lout,sizeof (lout)); + } +if (err) {mlx5_core_dbg (dev,"cmd exec faile %d\n" , err);return err; } -if (out.hdr.status) { -mlx5_core_dbg (dev,"status %d\n" , out.hdr.status); -return mlx5_cmd_status_to_err (&out.hdr); +if (lout.hdr.status) { +mlx5_core_dbg (dev,"status %d\n" , lout.hdr.status); +return mlx5_cmd_status_to_err (&lout.hdr); } - mr->key =mlx5_idx_to_mkey (be32_to_cpu (out.mkey) &0xffffff ) | key; -mlx5_core_dbg (dev,"out 0x%x, key 0x%x, mkey 0x%x\n" ,be32_to_cpu (out.mkey), key, mr->key); + mr->key =mlx5_idx_to_mkey (be32_to_cpu (lout.mkey) &0xffffff ) | key; +mlx5_core_dbg (dev,"out 0x%x, key 0x%x, mkey 0x%x\n" , +be32_to_cpu (lout.mkey), key, mr->key);return err; }
include/linux/mlx5/driver.h +15 -2
@@ -557,9 +557,11 @@ typedef void (*mlx5_cmd_cbk_t)(int status, void *context);struct mlx5_cmd_work_ent {struct mlx5_cmd_msg *in;struct mlx5_cmd_msg *out; +void *uout; +int uout_size;mlx5_cmd_cbk_t callback;void *context; -int idx; +int idx;struct completion done;struct mlx5_cmd *cmd;struct work_struct work;
@@ -570,6 +572,7 @@ struct mlx5_cmd_work_ent {u8 token;struct timespec ts1;struct timespec ts2; +u16 op; };struct mlx5_pas {
@@ -653,6 +656,9 @@ void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);int mlx5_cmd_status_to_err (struct mlx5_outbox_hdr *hdr);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, +void *out,int out_size,mlx5_cmd_cbk_t callback, +void *context);int mlx5_cmd_alloc_uar (struct mlx5_core_dev *dev,u32 *uarn);int mlx5_cmd_free_uar (struct mlx5_core_dev *dev,u32 uarn);int mlx5_alloc_uuars (struct mlx5_core_dev *dev,struct mlx5_uuar_info *uuari);
@@ -676,7 +682,9 @@ int mlx5_core_query_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,int mlx5_core_arm_srq (struct mlx5_core_dev *dev,struct mlx5_core_srq *srq,u16 lwm,int is_srq);int mlx5_core_create_mkey (struct mlx5_core_dev *dev,struct mlx5_core_mr *mr, -struct mlx5_create_mkey_mbox_in *in,int inlen); +struct mlx5_create_mkey_mbox_in *in,int inlen, +mlx5_cmd_cbk_t callback,void *context, +struct mlx5_create_mkey_mbox_out *out);int mlx5_core_destroy_mkey (struct mlx5_core_dev *dev,struct mlx5_core_mr *mr);int mlx5_core_query_mkey (struct mlx5_core_dev *dev,struct mlx5_core_mr *mr,struct mlx5_query_mkey_mbox_out *out,int outlen);
@@ -745,6 +753,11 @@ static inline u32 mlx5_idx_to_mkey(u32 mkey_idx)return mkey_idx <<8 ; } +static inline u8 mlx5_mkey_variant (u32 mkey) +{ +return mkey &0xff ; +} +enum {MLX5_PROF_MASK_QP_SIZE = (u64 )1 <<0 ,MLX5_PROF_MASK_MR_CACHE = (u64 )1 <<1 ,
Signature · 6 lines
1.8.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/9 IB/mlx5: Fix overflow check in IB_WR_FAST_REG_MR
In reply to a message not in the archiveMake sure not to overflow when reading the page list from struct ib_fast_reg_page_list.
--- drivers/infiniband/hw/mlx5/qp.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/infiniband/hw/mlx5/qp.c +4 -0
@@ -1915,6 +1915,10 @@ static int set_frwr_li_wr(void **seg, struct ib_send_wr *wr, int *size,if (unlikely ((*seg == qp->sq.qend))) *seg =mlx5_get_send_wqe (qp,0 );if (!li) { +if (unlikely (wr->wr.fast_reg.page_list_len > + wr->wr.fast_reg.page_list->max_page_list_len)) +return -ENOMEM ; +set_frwr_pages (*seg, wr, mdev, pd, writ); *seg +=sizeof (struct mlx5_wqe_data_seg ); *size += (sizeof (struct mlx5_wqe_data_seg ) /16 );
Signature · 6 lines
1.8.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/9 IB/mlx5: Simplify mlx5_ib_destroy_srq
In reply to a message not in the archiveMake use of destroy_srq_kernel() to clear SRQ resouces.
--- drivers/infiniband/hw/mlx5/srq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/hw/mlx5/srq.c +1 -3
@@ -390,9 +390,7 @@ int mlx5_ib_destroy_srq(struct ib_srq *srq)mlx5_ib_db_unmap_user (to_mucontext (srq->uobject->context), &msrq->db);ib_umem_release (msrq->umem); }else { -kfree (msrq->wrid); -mlx5_buf_free (&dev->mdev, &msrq->buf); -mlx5_db_free (&dev->mdev, &msrq->db); +destroy_srq_kernel (dev, msrq); }kfree (srq);
Signature · 6 lines
1.8.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/9 IB/mlx5: Fix srq free in destroy qp
In reply to a message not in the archiveFrom: Moshe Lazer <moshel-VPRAkNaXOzVWk0Htik3J/[email protected]>
On destroy QP the driver walks over the relevant CQ and removes CQEs reported for the destroyed QP. It also frees the related SRQ entry without checking that this is actually SRQ related CQE. In case of a CQ used for both send and receive QP, we could free srq entries for send CQEs. This patch resolves this issue by verifying that this is a SRQ related CQE by checking the SRQ number in the CQE is not zero.
--- drivers/infiniband/hw/mlx5/cq.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/infiniband/hw/mlx5/cq.c +4 -12
@@ -750,17 +750,9 @@ int mlx5_ib_destroy_cq(struct ib_cq *cq)return 0 ; } -static int is_equal_rsn (struct mlx5_cqe64 *cqe64,struct mlx5_ib_srq *srq, -u32 rsn) +static int is_equal_rsn (struct mlx5_cqe64 *cqe64,u32 rsn) { -u32 lrsn; - -if (srq) - lrsn =be32_to_cpu (cqe64->srqn) &0xffffff ; -else - lrsn =be32_to_cpu (cqe64->sop_drop_qpn) &0xffffff ; - -return rsn == lrsn; +return rsn == (ntohl (cqe64->sop_drop_qpn) &0xffffff ); }void __mlx5_ib_cq_clean (struct mlx5_ib_cq *cq,u32 rsn,struct mlx5_ib_srq *srq)
@@ -790,8 +782,8 @@ void __mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 rsn, struct mlx5_ib_srq *srq)while ((int ) --prod_index - (int ) cq->mcq.cons_index >=0 ) { cqe =get_cqe (cq, prod_index & cq->ibcq.cqe); cqe64 = (cq->mcq.cqe_sz ==64 ) ? cqe : cqe +64 ; -if (is_equal_rsn (cqe64, srq, rsn)) { -if (srq) +if (is_equal_rsn (cqe64, rsn)) { +if (srq && (ntohl (cqe64->srqn) &0xffffff ))mlx5_ib_free_srq_wqe (srq,be16_to_cpu (cqe64->wqe_counter)); ++nfreed; }else if (nfreed) {
Signature · 6 lines
1.8.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/9 mlx5: Fix cleanup flow when DMA mapping fails
In reply to a message not in the archiveIf DMA mapping fails, the driver cleared the object that holds the previously DMA mapped pages. Fix this by allocating a new object for the command that reports back to firmware that pages can't be supplied.
--- drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +13 -5
@@ -181,6 +181,7 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages, {struct mlx5_manage_pages_inbox *in;struct mlx5_manage_pages_outbox out; +struct mlx5_manage_pages_inbox *nin;struct page *page;int inlen;u64 addr;
@@ -247,13 +248,20 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages, out_alloc:if (notify_fail) { -memset (in,0 , inlen); + nin =kzalloc (sizeof (*nin),GFP_KERNEL ); +if (!nin) { +mlx5_core_warn (dev,"allocation failed\n" ); + goto unmap; + }memset (&out,0 ,sizeof (out)); - in->hdr.opcode =cpu_to_be16 (MLX5_CMD_OP_MANAGE_PAGES ); - in->hdr.opmod =cpu_to_be16 (MLX5_PAGES_CANT_GIVE ); -if (mlx5_cmd_exec (dev, in,sizeof (*in), &out,sizeof (out))) -mlx5_core_warn (dev,"\n" ); + nin->hdr.opcode =cpu_to_be16 (MLX5_CMD_OP_MANAGE_PAGES ); + nin->hdr.opmod =cpu_to_be16 (MLX5_PAGES_CANT_GIVE ); +if (mlx5_cmd_exec (dev, nin,sizeof (*nin), &out,sizeof (out))) +mlx5_core_warn (dev,"page notify failed\n" ); +kfree (nin); } + +unmap:for (i--; i >=0 ; i--) { addr =be64_to_cpu (in->pas[i]); page =remove_page (dev, addr);
Signature · 6 lines
1.8.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 7/9 mlx5: Support arbitrary page size to firmware
In reply to a message not in the archiveConnect-IB firmware requires 4K pages to be communicated with the driver. This patch breaks larger pages to 4K units to enable support for architectures utilizing larger page size, such as PowerPC.
This patch also fixes several places that referred to PAGE_SHIFT instead of explicit 12 which is the inherent page shift on Connect-IB.
--- drivers/infiniband/hw/mlx5/cq.c | 2 +- drivers/infiniband/hw/mlx5/qp.c | 4 +- drivers/infiniband/hw/mlx5/srq.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 2 +- .../net/ethernet/mellanox/mlx5/core/pagealloc.c | 174 ++++++++++++++------- include/linux/mlx5/driver.h | 1 + 6 files changed, 127 insertions(+), 60 deletions(-)
drivers/infiniband/hw/mlx5/cq.c +1 -1
@@ -620,7 +620,7 @@ static int create_cq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, }mlx5_fill_page_array (&cq->buf.buf, (*cqb)->pas); - (*cqb)->ctx.log_pg_sz = cq->buf.buf.page_shift -PAGE_SHIFT ; + (*cqb)->ctx.log_pg_sz = cq->buf.buf.page_shift -12 ; *index = dev->mdev.priv.uuari.uars[0 ].index;return 0 ;
drivers/infiniband/hw/mlx5/qp.c +2 -2
@@ -551,7 +551,7 @@ static int create_user_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd, }mlx5_ib_populate_pas (dev, qp->umem, page_shift, (*in)->pas,0 ); (*in)->ctx.log_pg_sz_remote_qpn = -cpu_to_be32 ((page_shift -PAGE_SHIFT ) <<24 ); +cpu_to_be32 ((page_shift -12 ) <<24 ); (*in)->ctx.params2 =cpu_to_be32 (offset <<6 ); (*in)->ctx.qp_counter_set_usr_page =cpu_to_be32 (uar_index);
@@ -648,7 +648,7 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, goto err_buf; } (*in)->ctx.qp_counter_set_usr_page =cpu_to_be32 (uar_index); - (*in)->ctx.log_pg_sz_remote_qpn =cpu_to_be32 ((qp->buf.page_shift -PAGE_SHIFT ) <<24 ); + (*in)->ctx.log_pg_sz_remote_qpn =cpu_to_be32 ((qp->buf.page_shift -12 ) <<24 );/* Set "fast registration enabled" for all kernel QPs */ (*in)->ctx.params1 |=cpu_to_be32 (1 <<11 ); (*in)->ctx.sq_crq_size |=cpu_to_be16 (1 <<4 );
drivers/infiniband/hw/mlx5/srq.c +2 -2
@@ -123,7 +123,7 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq, goto err_in; } - (*in)->ctx.log_pg_sz = page_shift -PAGE_SHIFT ; + (*in)->ctx.log_pg_sz = page_shift -12 ; (*in)->ctx.pgoff_cqn =cpu_to_be32 (offset <<26 );return 0 ;
@@ -192,7 +192,7 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq, } srq->wq_sig = !!srq_signature; - (*in)->ctx.log_pg_sz = page_shift -PAGE_SHIFT ; + (*in)->ctx.log_pg_sz = page_shift -12 ;return 0 ;
drivers/net/ethernet/mellanox/mlx5/core/eq.c +1 -1
@@ -354,7 +354,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, in->hdr.opcode =cpu_to_be16 (MLX5_CMD_OP_CREATE_EQ ); in->ctx.log_sz_usr_page =cpu_to_be32 (ilog2 (eq->nent) <<24 | uar->index); in->ctx.intr = vecidx; - in->ctx.log_page_size =PAGE_SHIFT -12 ; + in->ctx.log_page_size = eq->buf.page_shift -12 ; in->events_mask =cpu_to_be64 (mask); err =mlx5_cmd_exec (dev, in, inlen, &out,sizeof (out));
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +120 -54
275 lines not on this page · raw message
include/linux/mlx5/driver.h +1 -0
@@ -483,6 +483,7 @@ struct mlx5_priv {struct rb_root page_root;int fw_pages;int reg_pages; +struct list_head free_list;struct mlx5_core_health health;
Signature · 6 lines
1.8.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/9 mlx5: Clear reserved area in set_hca_cap
In reply to a message not in the archiveFirmware spec requires reserved fields to be cleared when calling set_hca_cap. Current code queries and copy to the set area, possibly resulting in reserved bits not cleared. This patch copies only writable fields to the set area.
Fix also typo - msx => max
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 35 +++++++++++++++++++++++--- include/linux/mlx5/device.h | 9 +++++-- 2 files changed, 39 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +32 -3
@@ -159,6 +159,36 @@ struct mlx5_reg_host_endianess {u8 rsvd[15 ]; }; + +#define CAP_MASK (pos, size) ((u64)((1 << (size)) - 1) << (pos)) + +enum { +MLX5_CAP_BITS_RW_MASK =CAP_MASK (MLX5_CAP_OFF_CMDIF_CSUM ,2 ) | +CAP_MASK (MLX5_CAP_OFF_DCT ,1 ), +}; + +/* selectively copy writable fields clearing any reserved area +*/ +static void copy_rw_fields (struct mlx5_hca_cap *to,struct mlx5_hca_cap *from) +{ +u64 v64; + + to->log_max_qp = from->log_max_qp &0x1f ; + to->log_max_ra_req_dc = from->log_max_ra_req_dc &0x3f ; + to->log_max_ra_res_dc = from->log_max_ra_res_dc &0x3f ; + to->log_max_ra_req_qp = from->log_max_ra_req_qp &0x3f ; + to->log_max_ra_res_qp = from->log_max_ra_res_qp &0x3f ; + to->log_max_atomic_size_qp = from->log_max_atomic_size_qp; + to->log_max_atomic_size_dc = from->log_max_atomic_size_dc; + v64 =be64_to_cpu (from->flags) &MLX5_CAP_BITS_RW_MASK ; + to->flags =cpu_to_be64 (v64); +} + +enum { +HCA_CAP_OPMOD_GET_MAX =0 , +HCA_CAP_OPMOD_GET_CUR =1 , +}; +static int handle_hca_cap (struct mlx5_core_dev *dev) {struct mlx5_cmd_query_hca_cap_mbox_out *query_out =NULL ;
@@ -180,7 +210,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) } query_ctx.hdr.opcode =cpu_to_be16 (MLX5_CMD_OP_QUERY_HCA_CAP ); - query_ctx.hdr.opmod =cpu_to_be16 (0x1 ); + query_ctx.hdr.opmod =cpu_to_be16 (HCA_CAP_OPMOD_GET_CUR ); err =mlx5_cmd_exec (dev, &query_ctx,sizeof (query_ctx), query_out,sizeof (*query_out));if (err)
@@ -192,8 +222,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) goto query_ex; } -memcpy (&set_ctx->hca_cap, &query_out->hca_cap, -sizeof (set_ctx->hca_cap)); +copy_rw_fields (&set_ctx->hca_cap, &query_out->hca_cap);if (dev->profile->mask &MLX5_PROF_MASK_QP_SIZE ) set_ctx->hca_cap.log_max_qp = dev->profile->log_max_qp;
include/linux/mlx5/device.h +7 -2
@@ -230,6 +230,11 @@ enum {MLX5_MAX_PAGE_SHIFT =31 }; +enum { +MLX5_CAP_OFF_DCT =41 , +MLX5_CAP_OFF_CMDIF_CSUM =46 , +}; +struct mlx5_inbox_hdr {__be16 opcode;u8 rsvd[4 ];
@@ -319,9 +324,9 @@ struct mlx5_hca_cap {u8 rsvd25[42 ];__be16 log_uar_page_sz;u8 rsvd26[28 ]; -u8 log_msx_atomic_size_qp; +u8 log_max_atomic_size_qp;u8 rsvd27[2 ]; -u8 log_msx_atomic_size_dc; +u8 log_max_atomic_size_dc;u8 rsvd28[76 ]; };
Signature · 6 lines
1.8.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/9 mlx5_core: Change optimal_reclaimed_pages for better performance
In reply to a message not in the archiveFrom: Moshe Lazer <moshel-VPRAkNaXOzVWk0Htik3J/[email protected]>
Change optimal_reclaimed_pages() to increase the output size of each reclaim pages command. This change reduces significantly the amount of reclaim pages commands issued to FW when the driver is unloaded which reduces the overall driver unload time.
--- drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +7 -2
@@ -454,14 +454,19 @@ int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot)return give_pages (dev, func_id, npages,0 ); } +enum { +MLX5_BLKS_FOR_RECLAIM_PAGES =12 +}; +static int optimal_reclaimed_pages (void ) {struct mlx5_cmd_prot_block *block;struct mlx5_cmd_layout *lay;int ret; - ret = (sizeof (lay->in) +sizeof (block->data) - -sizeof (struct mlx5_manage_pages_outbox )) /8 ; + ret = (sizeof (lay->out) +MLX5_BLKS_FOR_RECLAIM_PAGES *sizeof (block->data) - +sizeof (struct mlx5_manage_pages_outbox )) / + FIELD_SIZEOF(struct mlx5_manage_pages_outbox, pas[0]);return ret; }
Signature · 6 lines
1.8.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH for-next 7/9] mlx5: Support arbitrary page size to firmware
In reply to a message not in the archiveQuoted 2 lines · Eli Cohen
This patch also fixes several places that referred to
PAGE_SHIFTinstead of explicit 12 which is the inherent page shift on Connect-IB.
Patch looks fine but maybe we should have a follow-up that changes this magic constant of 12 to something like MLX5_ADAPTER_PAGE_SHIFT (defined to 12 in a header somewhere)?
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH for-next 7/9] mlx5: Support arbitrary page size to firmware
In reply to a message not in the archiveQuoted 8 lines · Roland Dreier
Quoted 2 lines · Eli Cohen
This patch also fixes several places that referred to
PAGE_SHIFTinstead of explicit 12 which is the inherent page shift on Connect-IB.Patch looks fine but maybe we should have a follow-up that changes this magic constant of 12 to something like
MLX5_ADAPTER_PAGE_SHIFT(defined to 12 in a header somewhere)?
Yes it makes sense.
I am going to send a few more patches and will include one that fixes the page shift thing.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html