* [PATCH -next 0/4] RDMA: Simplify multiple create*_workqueue() invocations
@ 2024-08-23 10:18 Jinjie Ruan
2024-08-23 10:18 ` [PATCH -next 1/4] RDMA/qib: Simplify an alloc_ordered_workqueue() invocation Jinjie Ruan
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Jinjie Ruan @ 2024-08-23 10:18 UTC (permalink / raw)
To: dennis.dalessandro, jgg, leon, linux-rdma, linux-kernel,
bvanassche
Cc: ruanjinjie
This patch series follows the SCSI patches of Bart, simplifies snprintf()
to format a workqueue name code by passing the format string and arguments
to alloc_workqueue().
Jinjie Ruan (4):
RDMA/qib: Simplify an alloc_ordered_workqueue() invocation
RDMA/mad: Simplify an alloc_ordered_workqueue() invocation
RDMA/mlx4: Simplify an alloc_ordered_workqueue() invocation
RDMA/mad: Simplify an alloc_ordered_workqueue() invocation
drivers/infiniband/core/mad.c | 5 ++---
drivers/infiniband/hw/mlx4/alias_GUID.c | 4 +---
drivers/infiniband/hw/mlx4/mad.c | 10 +++-------
drivers/infiniband/hw/qib/qib_init.c | 9 +++------
4 files changed, 9 insertions(+), 19 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH -next 1/4] RDMA/qib: Simplify an alloc_ordered_workqueue() invocation
2024-08-23 10:18 [PATCH -next 0/4] RDMA: Simplify multiple create*_workqueue() invocations Jinjie Ruan
@ 2024-08-23 10:18 ` Jinjie Ruan
2024-08-23 10:18 ` [PATCH -next 2/4] RDMA/mad: " Jinjie Ruan
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jinjie Ruan @ 2024-08-23 10:18 UTC (permalink / raw)
To: dennis.dalessandro, jgg, leon, linux-rdma, linux-kernel,
bvanassche
Cc: ruanjinjie
Let alloc_ordered_workqueue() format the workqueue name instead of
calling snprintf() explicitly.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/infiniband/hw/qib/qib_init.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c
index db3b25c8433a..4100656fe9a3 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -581,12 +581,9 @@ static int qib_create_workqueues(struct qib_devdata *dd)
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
ppd = dd->pport + pidx;
if (!ppd->qib_wq) {
- char wq_name[23];
-
- snprintf(wq_name, sizeof(wq_name), "qib%d_%d",
- dd->unit, pidx);
- ppd->qib_wq = alloc_ordered_workqueue(wq_name,
- WQ_MEM_RECLAIM);
+ ppd->qib_wq = alloc_ordered_workqueue("qib%d_%d",
+ WQ_MEM_RECLAIM,
+ dd->unit, pidx);
if (!ppd->qib_wq)
goto wq_error;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH -next 2/4] RDMA/mad: Simplify an alloc_ordered_workqueue() invocation
2024-08-23 10:18 [PATCH -next 0/4] RDMA: Simplify multiple create*_workqueue() invocations Jinjie Ruan
2024-08-23 10:18 ` [PATCH -next 1/4] RDMA/qib: Simplify an alloc_ordered_workqueue() invocation Jinjie Ruan
@ 2024-08-23 10:18 ` Jinjie Ruan
2024-08-23 10:18 ` [PATCH -next 3/4] RDMA/mlx4: " Jinjie Ruan
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jinjie Ruan @ 2024-08-23 10:18 UTC (permalink / raw)
To: dennis.dalessandro, jgg, leon, linux-rdma, linux-kernel,
bvanassche
Cc: ruanjinjie
Let alloc_ordered_workqueue() format the workqueue name instead of calling
snprintf() explicitly.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/infiniband/core/mad.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 70708fea1296..1fd54d5c4dd8 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -2939,7 +2939,6 @@ static int ib_mad_port_open(struct ib_device *device,
int ret, cq_size;
struct ib_mad_port_private *port_priv;
unsigned long flags;
- char name[sizeof "ib_mad123"];
int has_smi;
if (WARN_ON(rdma_max_mad_size(device, port_num) < IB_MGMT_MAD_SIZE))
@@ -2992,8 +2991,8 @@ static int ib_mad_port_open(struct ib_device *device,
goto error7;
}
- snprintf(name, sizeof(name), "ib_mad%u", port_num);
- port_priv->wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
+ port_priv->wq = alloc_ordered_workqueue("ib_mad%u", WQ_MEM_RECLAIM,
+ port_num);
if (!port_priv->wq) {
ret = -ENOMEM;
goto error8;
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH -next 3/4] RDMA/mlx4: Simplify an alloc_ordered_workqueue() invocation
2024-08-23 10:18 [PATCH -next 0/4] RDMA: Simplify multiple create*_workqueue() invocations Jinjie Ruan
2024-08-23 10:18 ` [PATCH -next 1/4] RDMA/qib: Simplify an alloc_ordered_workqueue() invocation Jinjie Ruan
2024-08-23 10:18 ` [PATCH -next 2/4] RDMA/mad: " Jinjie Ruan
@ 2024-08-23 10:18 ` Jinjie Ruan
2024-08-23 10:18 ` [PATCH -next 4/4] RDMA/mad: " Jinjie Ruan
2024-08-23 14:39 ` [PATCH -next 0/4] RDMA: Simplify multiple create*_workqueue() invocations Jason Gunthorpe
4 siblings, 0 replies; 6+ messages in thread
From: Jinjie Ruan @ 2024-08-23 10:18 UTC (permalink / raw)
To: dennis.dalessandro, jgg, leon, linux-rdma, linux-kernel,
bvanassche
Cc: ruanjinjie
Let alloc_ordered_workqueue() format the workqueue name instead of calling
snprintf() explicitly.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/infiniband/hw/mlx4/alias_GUID.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/alias_GUID.c b/drivers/infiniband/hw/mlx4/alias_GUID.c
index 9a439569ffcf..d7327735b8d0 100644
--- a/drivers/infiniband/hw/mlx4/alias_GUID.c
+++ b/drivers/infiniband/hw/mlx4/alias_GUID.c
@@ -829,7 +829,6 @@ void mlx4_ib_destroy_alias_guid_service(struct mlx4_ib_dev *dev)
int mlx4_ib_init_alias_guid_service(struct mlx4_ib_dev *dev)
{
- char alias_wq_name[22];
int ret = 0;
int i, j;
union ib_gid gid;
@@ -875,9 +874,8 @@ int mlx4_ib_init_alias_guid_service(struct mlx4_ib_dev *dev)
dev->sriov.alias_guid.ports_guid[i].parent = &dev->sriov.alias_guid;
dev->sriov.alias_guid.ports_guid[i].port = i;
- snprintf(alias_wq_name, sizeof alias_wq_name, "alias_guid%d", i);
dev->sriov.alias_guid.ports_guid[i].wq =
- alloc_ordered_workqueue(alias_wq_name, WQ_MEM_RECLAIM);
+ alloc_ordered_workqueue("alias_guid%d", WQ_MEM_RECLAIM, i);
if (!dev->sriov.alias_guid.ports_guid[i].wq) {
ret = -ENOMEM;
goto err_thread;
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH -next 4/4] RDMA/mad: Simplify an alloc_ordered_workqueue() invocation
2024-08-23 10:18 [PATCH -next 0/4] RDMA: Simplify multiple create*_workqueue() invocations Jinjie Ruan
` (2 preceding siblings ...)
2024-08-23 10:18 ` [PATCH -next 3/4] RDMA/mlx4: " Jinjie Ruan
@ 2024-08-23 10:18 ` Jinjie Ruan
2024-08-23 14:39 ` [PATCH -next 0/4] RDMA: Simplify multiple create*_workqueue() invocations Jason Gunthorpe
4 siblings, 0 replies; 6+ messages in thread
From: Jinjie Ruan @ 2024-08-23 10:18 UTC (permalink / raw)
To: dennis.dalessandro, jgg, leon, linux-rdma, linux-kernel,
bvanassche
Cc: ruanjinjie
Let alloc_ordered_workqueue() format the workqueue name instead of calling
snprintf() explicitly.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
drivers/infiniband/hw/mlx4/mad.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index dc9cf45d2d32..e6e132f10625 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -2158,7 +2158,6 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev,
struct mlx4_ib_demux_ctx *ctx,
int port)
{
- char name[21];
int ret = 0;
int i;
@@ -2194,24 +2193,21 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev,
goto err_mcg;
}
- snprintf(name, sizeof(name), "mlx4_ibt%d", port);
- ctx->wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
+ ctx->wq = alloc_ordered_workqueue("mlx4_ibt%d", WQ_MEM_RECLAIM, port);
if (!ctx->wq) {
pr_err("Failed to create tunnelling WQ for port %d\n", port);
ret = -ENOMEM;
goto err_wq;
}
- snprintf(name, sizeof(name), "mlx4_ibwi%d", port);
- ctx->wi_wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
+ ctx->wi_wq = alloc_ordered_workqueue("mlx4_ibwi%d", WQ_MEM_RECLAIM, port);
if (!ctx->wi_wq) {
pr_err("Failed to create wire WQ for port %d\n", port);
ret = -ENOMEM;
goto err_wiwq;
}
- snprintf(name, sizeof(name), "mlx4_ibud%d", port);
- ctx->ud_wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
+ ctx->ud_wq = alloc_ordered_workqueue("mlx4_ibud%d", WQ_MEM_RECLAIM, port);
if (!ctx->ud_wq) {
pr_err("Failed to create up/down WQ for port %d\n", port);
ret = -ENOMEM;
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH -next 0/4] RDMA: Simplify multiple create*_workqueue() invocations
2024-08-23 10:18 [PATCH -next 0/4] RDMA: Simplify multiple create*_workqueue() invocations Jinjie Ruan
` (3 preceding siblings ...)
2024-08-23 10:18 ` [PATCH -next 4/4] RDMA/mad: " Jinjie Ruan
@ 2024-08-23 14:39 ` Jason Gunthorpe
4 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2024-08-23 14:39 UTC (permalink / raw)
To: Jinjie Ruan
Cc: dennis.dalessandro, leon, linux-rdma, linux-kernel, bvanassche
On Fri, Aug 23, 2024 at 06:18:36PM +0800, Jinjie Ruan wrote:
> This patch series follows the SCSI patches of Bart, simplifies snprintf()
> to format a workqueue name code by passing the format string and arguments
> to alloc_workqueue().
>
> Jinjie Ruan (4):
> RDMA/qib: Simplify an alloc_ordered_workqueue() invocation
> RDMA/mad: Simplify an alloc_ordered_workqueue() invocation
> RDMA/mlx4: Simplify an alloc_ordered_workqueue() invocation
> RDMA/mad: Simplify an alloc_ordered_workqueue() invocation
>
> drivers/infiniband/core/mad.c | 5 ++---
> drivers/infiniband/hw/mlx4/alias_GUID.c | 4 +---
> drivers/infiniband/hw/mlx4/mad.c | 10 +++-------
> drivers/infiniband/hw/qib/qib_init.c | 9 +++------
> 4 files changed, 9 insertions(+), 19 deletions(-)
Applied to for-next
Thanks,
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-08-23 14:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-23 10:18 [PATCH -next 0/4] RDMA: Simplify multiple create*_workqueue() invocations Jinjie Ruan
2024-08-23 10:18 ` [PATCH -next 1/4] RDMA/qib: Simplify an alloc_ordered_workqueue() invocation Jinjie Ruan
2024-08-23 10:18 ` [PATCH -next 2/4] RDMA/mad: " Jinjie Ruan
2024-08-23 10:18 ` [PATCH -next 3/4] RDMA/mlx4: " Jinjie Ruan
2024-08-23 10:18 ` [PATCH -next 4/4] RDMA/mad: " Jinjie Ruan
2024-08-23 14:39 ` [PATCH -next 0/4] RDMA: Simplify multiple create*_workqueue() invocations Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox