netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-next 0/2] Allocate the per-port Q counter
@ 2018-12-09 10:52 Leon Romanovsky
  2018-12-09 10:52 ` [PATCH mlx5-next 1/2] net/mlx5: Add shared Q counter bits Leon Romanovsky
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Leon Romanovsky @ 2018-12-09 10:52 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, RDMA mailing list, Yishai Hadas, Saeed Mahameed,
	linux-netdev

From: Leon Romanovsky <leonro@mellanox.com>

Hi

See commit message for the patch description.

Thanks

Leon Romanovsky (1):
  net/mlx5: Add shared Q counter bits

Yishai Hadas (1):
  IB/mlx5: Allocate the per-port Q counter shared when DEVX is supported

 drivers/infiniband/hw/mlx5/cmd.c  | 17 +++++++++++++++++
 drivers/infiniband/hw/mlx5/cmd.h  |  2 ++
 drivers/infiniband/hw/mlx5/main.c | 10 ++++++++--
 include/linux/mlx5/mlx5_ifc.h     |  6 +++++-
 4 files changed, 32 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH mlx5-next 1/2] net/mlx5: Add shared Q counter bits
  2018-12-09 10:52 [PATCH rdma-next 0/2] Allocate the per-port Q counter Leon Romanovsky
@ 2018-12-09 10:52 ` Leon Romanovsky
  2018-12-09 10:52 ` [PATCH rdma-next 2/2] IB/mlx5: Allocate the per-port Q counter shared when DEVX is supported Leon Romanovsky
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2018-12-09 10:52 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, RDMA mailing list, Yishai Hadas, Saeed Mahameed,
	linux-netdev

From: Leon Romanovsky <leonro@mellanox.com>

Updated HW specification file with needed bits to allow
sharing of Q counters between DEVX contexts and kernel.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 include/linux/mlx5/mlx5_ifc.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 52393fbcf3b4..15093356a226 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -85,6 +85,10 @@ enum {
 	MLX5_OBJ_TYPE_UMEM = 0x0005,
 };
 
+enum {
+	MLX5_SHARED_RESOURCE_UID = 0xffff,
+};
+
 enum {
 	MLX5_CMD_OP_QUERY_HCA_CAP                 = 0x100,
 	MLX5_CMD_OP_QUERY_ADAPTER                 = 0x101,
@@ -7464,7 +7468,7 @@ struct mlx5_ifc_alloc_q_counter_out_bits {
 
 struct mlx5_ifc_alloc_q_counter_in_bits {
 	u8         opcode[0x10];
-	u8         reserved_at_10[0x10];
+	u8         uid[0x10];
 
 	u8         reserved_at_20[0x10];
 	u8         op_mod[0x10];
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH rdma-next 2/2] IB/mlx5: Allocate the per-port Q counter shared when DEVX is supported
  2018-12-09 10:52 [PATCH rdma-next 0/2] Allocate the per-port Q counter Leon Romanovsky
  2018-12-09 10:52 ` [PATCH mlx5-next 1/2] net/mlx5: Add shared Q counter bits Leon Romanovsky
@ 2018-12-09 10:52 ` Leon Romanovsky
  2018-12-19  5:11 ` [PATCH rdma-next 0/2] Allocate the per-port Q counter Jason Gunthorpe
  2018-12-21 19:12 ` Jason Gunthorpe
  3 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2018-12-09 10:52 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, RDMA mailing list, Yishai Hadas, Saeed Mahameed,
	linux-netdev

From: Yishai Hadas <yishaih@mellanox.com>

The per-port Q counter is some kernel resource and as such may be used
by few UID(s) upon DEVX usage.

To enable using it for QP/RQ when DEVX context is used need to allocate
it with a sharing mode indication to let firmware allows its usage.

The UID = 0xffff was chosen to mark it.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/hw/mlx5/cmd.c  | 17 +++++++++++++++++
 drivers/infiniband/hw/mlx5/cmd.h  |  2 ++
 drivers/infiniband/hw/mlx5/main.c | 10 ++++++++--
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/cmd.c b/drivers/infiniband/hw/mlx5/cmd.c
index ca060a2e2b36..752c60426a1c 100644
--- a/drivers/infiniband/hw/mlx5/cmd.c
+++ b/drivers/infiniband/hw/mlx5/cmd.c
@@ -326,3 +326,20 @@ int mlx5_cmd_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn, u16 uid)
 	MLX5_SET(dealloc_xrcd_in, in, uid, uid);
 	return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
 }
+
+int mlx5_cmd_alloc_q_counter(struct mlx5_core_dev *dev, u16 *counter_id,
+			     u16 uid)
+{
+	u32 in[MLX5_ST_SZ_DW(alloc_q_counter_in)]   = {0};
+	u32 out[MLX5_ST_SZ_DW(alloc_q_counter_out)] = {0};
+	int err;
+
+	MLX5_SET(alloc_q_counter_in, in, opcode, MLX5_CMD_OP_ALLOC_Q_COUNTER);
+	MLX5_SET(alloc_q_counter_in, in, uid, uid);
+
+	err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
+	if (!err)
+		*counter_id = MLX5_GET(alloc_q_counter_out, out,
+				       counter_set_id);
+	return err;
+}
diff --git a/drivers/infiniband/hw/mlx5/cmd.h b/drivers/infiniband/hw/mlx5/cmd.h
index c03c56455534..1e76dc67a369 100644
--- a/drivers/infiniband/hw/mlx5/cmd.h
+++ b/drivers/infiniband/hw/mlx5/cmd.h
@@ -61,4 +61,6 @@ int mlx5_cmd_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid,
 			u32 qpn, u16 uid);
 int mlx5_cmd_xrcd_alloc(struct mlx5_core_dev *dev, u32 *xrcdn, u16 uid);
 int mlx5_cmd_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn, u16 uid);
+int mlx5_cmd_alloc_q_counter(struct mlx5_core_dev *dev, u16 *counter_id,
+			     u16 uid);
 #endif /* MLX5_IB_CMD_H */
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 4660f5f1547a..3477fa1b2289 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -5114,6 +5114,10 @@ static int mlx5_ib_alloc_counters(struct mlx5_ib_dev *dev)
 {
 	int err = 0;
 	int i;
+	bool is_shared;
+
+	is_shared = MLX5_CAP_GEN_64(dev->mdev, general_obj_types) &
+				MLX5_GENERAL_OBJ_TYPES_CAP_UCTX;
 
 	for (i = 0; i < dev->num_ports; i++) {
 		err = __mlx5_ib_alloc_counters(dev, &dev->port[i].cnts);
@@ -5123,8 +5127,10 @@ static int mlx5_ib_alloc_counters(struct mlx5_ib_dev *dev)
 		mlx5_ib_fill_counters(dev, dev->port[i].cnts.names,
 				      dev->port[i].cnts.offsets);
 
-		err = mlx5_core_alloc_q_counter(dev->mdev,
-						&dev->port[i].cnts.set_id);
+		err = mlx5_cmd_alloc_q_counter(dev->mdev,
+					       &dev->port[i].cnts.set_id,
+					       is_shared ?
+					       MLX5_SHARED_RESOURCE_UID : 0);
 		if (err) {
 			mlx5_ib_warn(dev,
 				     "couldn't allocate queue counter for port %d, err %d\n",
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH rdma-next 0/2] Allocate the per-port Q counter
  2018-12-09 10:52 [PATCH rdma-next 0/2] Allocate the per-port Q counter Leon Romanovsky
  2018-12-09 10:52 ` [PATCH mlx5-next 1/2] net/mlx5: Add shared Q counter bits Leon Romanovsky
  2018-12-09 10:52 ` [PATCH rdma-next 2/2] IB/mlx5: Allocate the per-port Q counter shared when DEVX is supported Leon Romanovsky
@ 2018-12-19  5:11 ` Jason Gunthorpe
  2018-12-19  6:08   ` Leon Romanovsky
  2018-12-21 19:12 ` Jason Gunthorpe
  3 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2018-12-19  5:11 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, Leon Romanovsky, RDMA mailing list, Yishai Hadas,
	Saeed Mahameed, linux-netdev

On Sun, Dec 09, 2018 at 12:52:34PM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Hi
> 
> See commit message for the patch description.
> 
> Thanks
> 
> Leon Romanovsky (1):
>   net/mlx5: Add shared Q counter bits
> 
> Yishai Hadas (1):
>   IB/mlx5: Allocate the per-port Q counter shared when DEVX is supported

This seems fine, please update the shared branch

Thanks,
Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH rdma-next 0/2] Allocate the per-port Q counter
  2018-12-19  5:11 ` [PATCH rdma-next 0/2] Allocate the per-port Q counter Jason Gunthorpe
@ 2018-12-19  6:08   ` Leon Romanovsky
  0 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2018-12-19  6:08 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Doug Ledford, RDMA mailing list, Yishai Hadas, Saeed Mahameed,
	linux-netdev

[-- Attachment #1: Type: text/plain, Size: 572 bytes --]

On Tue, Dec 18, 2018 at 10:11:14PM -0700, Jason Gunthorpe wrote:
> On Sun, Dec 09, 2018 at 12:52:34PM +0200, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > Hi
> >
> > See commit message for the patch description.
> >
> > Thanks
> >
> > Leon Romanovsky (1):
> >   net/mlx5: Add shared Q counter bits
> >
> > Yishai Hadas (1):
> >   IB/mlx5: Allocate the per-port Q counter shared when DEVX is supported
>
> This seems fine, please update the shared branch

Done,
2acc7957dbc3 net/mlx5: Add shared Q counter bits

Thanks

>
> Thanks,
> Jason

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH rdma-next 0/2] Allocate the per-port Q counter
  2018-12-09 10:52 [PATCH rdma-next 0/2] Allocate the per-port Q counter Leon Romanovsky
                   ` (2 preceding siblings ...)
  2018-12-19  5:11 ` [PATCH rdma-next 0/2] Allocate the per-port Q counter Jason Gunthorpe
@ 2018-12-21 19:12 ` Jason Gunthorpe
  3 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2018-12-21 19:12 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, Leon Romanovsky, RDMA mailing list, Yishai Hadas,
	Saeed Mahameed, linux-netdev

On Sun, Dec 09, 2018 at 12:52:34PM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Hi
> 
> See commit message for the patch description.
> 
> Thanks
> 
> Leon Romanovsky (1):
>   net/mlx5: Add shared Q counter bits
> 
> Yishai Hadas (1):
>   IB/mlx5: Allocate the per-port Q counter shared when DEVX is supported

Applied to for-next

Thanks,
Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-21 19:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-09 10:52 [PATCH rdma-next 0/2] Allocate the per-port Q counter Leon Romanovsky
2018-12-09 10:52 ` [PATCH mlx5-next 1/2] net/mlx5: Add shared Q counter bits Leon Romanovsky
2018-12-09 10:52 ` [PATCH rdma-next 2/2] IB/mlx5: Allocate the per-port Q counter shared when DEVX is supported Leon Romanovsky
2018-12-19  5:11 ` [PATCH rdma-next 0/2] Allocate the per-port Q counter Jason Gunthorpe
2018-12-19  6:08   ` Leon Romanovsky
2018-12-21 19:12 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).