diff mbox

RDMA/mlx4: Move flag constants to uapi header

Message ID 20180313222646.GA10914@ziepe.ca (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show

Commit Message

Jason Gunthorpe March 13, 2018, 10:26 p.m. UTC
MLX4_USER_DEV_CAP_LARGE_CQE (via mlx4_ib_alloc_ucontext_resp.dev_caps)
and MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET (via
mlx4_uverbs_ex_query_device_resp.comp_mask) are copied directly to
userspace and form part of the uAPI.

Move them to the uapi header where they belong.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 drivers/infiniband/hw/mlx4/main.c         | 2 +-
 drivers/infiniband/hw/mlx4/mlx4_ib.h      | 4 ----
 drivers/net/ethernet/mellanox/mlx4/fw.c   | 1 +
 drivers/net/ethernet/mellanox/mlx4/main.c | 1 +
 include/linux/mlx4/device.h               | 4 ----
 include/uapi/rdma/mlx4-abi.h              | 8 ++++++++
 6 files changed, 11 insertions(+), 9 deletions(-)

Comments

Leon Romanovsky March 14, 2018, 9:45 a.m. UTC | #1
On Tue, Mar 13, 2018 at 04:26:46PM -0600, Jason Gunthorpe wrote:
> MLX4_USER_DEV_CAP_LARGE_CQE (via mlx4_ib_alloc_ucontext_resp.dev_caps)
> and MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET (via
> mlx4_uverbs_ex_query_device_resp.comp_mask) are copied directly to
> userspace and form part of the uAPI.
>
> Move them to the uapi header where they belong.
>
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx4/main.c         | 2 +-
>  drivers/infiniband/hw/mlx4/mlx4_ib.h      | 4 ----
>  drivers/net/ethernet/mellanox/mlx4/fw.c   | 1 +
>  drivers/net/ethernet/mellanox/mlx4/main.c | 1 +

The fact that you mixed our "ethernet" part with "uapi/rdma/mlx4-abi.h"
doesn't look good and we would like to avoid it.

Thanks
Jason Gunthorpe March 14, 2018, 4:53 p.m. UTC | #2
On Wed, Mar 14, 2018 at 11:45:07AM +0200, Leon Romanovsky wrote:
> On Tue, Mar 13, 2018 at 04:26:46PM -0600, Jason Gunthorpe wrote:
> > MLX4_USER_DEV_CAP_LARGE_CQE (via mlx4_ib_alloc_ucontext_resp.dev_caps)
> > and MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET (via
> > mlx4_uverbs_ex_query_device_resp.comp_mask) are copied directly to
> > userspace and form part of the uAPI.
> >
> > Move them to the uapi header where they belong.
> >
> > Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> >  drivers/infiniband/hw/mlx4/main.c         | 2 +-
> >  drivers/infiniband/hw/mlx4/mlx4_ib.h      | 4 ----
> >  drivers/net/ethernet/mellanox/mlx4/fw.c   | 1 +
> >  drivers/net/ethernet/mellanox/mlx4/main.c | 1 +
> 
> The fact that you mixed our "ethernet" part with "uapi/rdma/mlx4-abi.h"
> doesn't look good and we would like to avoid it.

Well putting RDMA core ABI stuff into the ethernet driver in the first
place was a strange idea. This is just fixing that to be done
properly.

You keep saying you don't want to to change mlx4 in any major way, so
lets just leave this patch as is, unless someone has a simple idea to
get rid of userspace_caps..

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe March 15, 2018, 10:23 p.m. UTC | #3
On Tue, Mar 13, 2018 at 04:26:46PM -0600, Jason Gunthorpe wrote:
> MLX4_USER_DEV_CAP_LARGE_CQE (via mlx4_ib_alloc_ucontext_resp.dev_caps)
> and MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET (via
> mlx4_uverbs_ex_query_device_resp.comp_mask) are copied directly to
> userspace and form part of the uAPI.
> 
> Move them to the uapi header where they belong.
> 
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
>  drivers/infiniband/hw/mlx4/main.c         | 2 +-
>  drivers/infiniband/hw/mlx4/mlx4_ib.h      | 4 ----
>  drivers/net/ethernet/mellanox/mlx4/fw.c   | 1 +
>  drivers/net/ethernet/mellanox/mlx4/main.c | 1 +
>  include/linux/mlx4/device.h               | 4 ----
>  include/uapi/rdma/mlx4-abi.h              | 8 ++++++++
>  6 files changed, 11 insertions(+), 9 deletions(-)

Applied to for-next, we can rework the weird caps.userspace_caps thing
some other day

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 2e3789fffcab7d..bf175b88d10a63 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -572,7 +572,7 @@  static int mlx4_ib_query_device(struct ib_device *ibdev,
 	if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) {
 		resp.response_length += sizeof(resp.hca_core_clock_offset);
 		if (!err && !mlx4_is_slave(dev->dev)) {
-			resp.comp_mask |= QUERY_DEVICE_RESP_MASK_TIMESTAMP;
+			resp.comp_mask |= MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET;
 			resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE;
 		}
 	}
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h
index d0640bd79679df..87c47b1dd87097 100644
--- a/drivers/infiniband/hw/mlx4/mlx4_ib.h
+++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h
@@ -641,10 +641,6 @@  struct mlx4_uverbs_ex_query_device {
 	__u32 reserved;
 };
 
-enum query_device_resp_mask {
-	QUERY_DEVICE_RESP_MASK_TIMESTAMP = 1UL << 0,
-};
-
 static inline struct mlx4_ib_dev *to_mdev(struct ib_device *ibdev)
 {
 	return container_of(ibdev, struct mlx4_ib_dev, ib_dev);
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index 634f603f941c4d..de6b3d41614887 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -37,6 +37,7 @@ 
 #include <linux/module.h>
 #include <linux/cache.h>
 #include <linux/kernel.h>
+#include <uapi/rdma/mlx4-abi.h>
 
 #include "fw.h"
 #include "icm.h"
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 4d84cab77105f3..958619ff24ae61 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -46,6 +46,7 @@ 
 #include <linux/etherdevice.h>
 #include <net/devlink.h>
 
+#include <uapi/rdma/mlx4-abi.h>
 #include <linux/mlx4/device.h>
 #include <linux/mlx4/doorbell.h>
 
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index a9b5fed8f7c607..81d0799b609168 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -256,10 +256,6 @@  enum {
 	MLX4_DEV_CAP_EQE_STRIDE_ENABLED	= 1LL << 3
 };
 
-enum {
-	MLX4_USER_DEV_CAP_LARGE_CQE	= 1L << 0
-};
-
 enum {
 	MLX4_FUNC_CAP_64B_EQE_CQE	= 1L << 0,
 	MLX4_FUNC_CAP_EQE_CQE_STRIDE	= 1L << 1,
diff --git a/include/uapi/rdma/mlx4-abi.h b/include/uapi/rdma/mlx4-abi.h
index d84616adff3264..be58594cec87dc 100644
--- a/include/uapi/rdma/mlx4-abi.h
+++ b/include/uapi/rdma/mlx4-abi.h
@@ -59,6 +59,10 @@  struct mlx4_ib_alloc_ucontext_resp_v3 {
 	__u16	bf_regs_per_page;
 };
 
+enum {
+	MLX4_USER_DEV_CAP_LARGE_CQE	= 1L << 0,
+};
+
 struct mlx4_ib_alloc_ucontext_resp {
 	__u32	dev_caps;
 	__u32	qp_tab_size;
@@ -162,6 +166,10 @@  struct mlx4_ib_rss_caps {
 	__u8 reserved[7];
 };
 
+enum query_device_resp_mask {
+	MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0,
+};
+
 struct mlx4_uverbs_ex_query_device_resp {
 	__u32			comp_mask;
 	__u32			response_length;