Author: hselasky
Date: Mon Nov 16 10:06:10 2020
New Revision: 367717
URL: https://svnweb.freebsd.org/changeset/base/367717

Log:
  Enhance the mlx5_core_create_cq() function in mlx5core.
  
  Enhance mlx5_core_create_cq() to get the command out buffer from the
  callers to let them use the output.
  
  Linux commit:
  38164b771947be9baf06e78ffdfb650f8f3e908e
  
  MFC after:    1 week
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/mlx5/cq.h
  head/sys/dev/mlx5/mlx5_core/mlx5_cq.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c

Modified: head/sys/dev/mlx5/cq.h
==============================================================================
--- head/sys/dev/mlx5/cq.h      Mon Nov 16 10:03:18 2020        (r367716)
+++ head/sys/dev/mlx5/cq.h      Mon Nov 16 10:06:10 2020        (r367717)
@@ -155,7 +155,7 @@ static inline void mlx5_cq_arm(struct mlx5_core_cq *cq
 int mlx5_init_cq_table(struct mlx5_core_dev *dev);
 void mlx5_cleanup_cq_table(struct mlx5_core_dev *dev);
 int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
-                       u32 *in, int inlen);
+                       u32 *in, int inlen, u32 *out, int outlen);
 int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
 int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
                       u32 *out, int outlen);

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cq.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_cq.c       Mon Nov 16 10:03:18 2020        
(r367716)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_cq.c       Mon Nov 16 10:06:10 2020        
(r367717)
@@ -119,16 +119,16 @@ void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn,
 }
 
 int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
-                       u32 *in, int inlen)
+                       u32 *in, int inlen, u32 *out, int outlen)
 {
        struct mlx5_cq_table *table = &dev->priv.cq_table;
-       u32 out[MLX5_ST_SZ_DW(create_cq_out)] = {0};
        u32 din[MLX5_ST_SZ_DW(destroy_cq_in)] = {0};
        u32 dout[MLX5_ST_SZ_DW(destroy_cq_out)] = {0};
        int err;
 
+       memset(out, 0, outlen);
        MLX5_SET(create_cq_in, in, opcode, MLX5_CMD_OP_CREATE_CQ);
-       err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
+       err = mlx5_cmd_exec(dev, in, inlen, out, outlen);
        if (err)
                return err;
 

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c    Mon Nov 16 10:03:18 2020        
(r367716)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c    Mon Nov 16 10:06:10 2020        
(r367717)
@@ -1989,6 +1989,7 @@ static int
 mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param, int eq_ix)
 {
        struct mlx5_core_cq *mcq = &cq->mcq;
+       u32 out[MLX5_ST_SZ_DW(create_cq_out)];
        void *in;
        void *cqc;
        int inlen;
@@ -2017,7 +2018,7 @@ mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_p
            PAGE_SHIFT);
        MLX5_SET64(cqc, cqc, dbr_addr, cq->wq_ctrl.db.dma);
 
-       err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen);
+       err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen, out, 
sizeof(out));
 
        kvfree(in);
 

Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c      Mon Nov 16 10:03:18 2020        
(r367716)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c      Mon Nov 16 10:06:10 2020        
(r367717)
@@ -905,6 +905,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde
        int entries = attr->cqe;
        int vector = attr->comp_vector;
        struct mlx5_ib_dev *dev = to_mdev(ibdev);
+       u32 out[MLX5_ST_SZ_DW(create_cq_out)];
        struct mlx5_ib_cq *cq;
        int uninitialized_var(index);
        int uninitialized_var(inlen);
@@ -969,7 +970,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibde
        if (cq->create_flags & IB_CQ_FLAGS_IGNORE_OVERRUN)
                MLX5_SET(cqc, cqc, oi, 1);
 
-       err = mlx5_core_create_cq(dev->mdev, &cq->mcq, cqb, inlen);
+       err = mlx5_core_create_cq(dev->mdev, &cq->mcq, cqb, inlen, out, 
sizeof(out));
        if (err)
                goto err_cqb;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to