* [PATCH 1/2] RDMA/rxe: Add common rxe_prepare_res()
@ 2022-07-05 11:46 Xiao Yang
2022-07-05 11:46 ` [PATCH 2/2] RDMA/rxe: Rename rxe_atomic_reply to atomic_reply Xiao Yang
2022-07-05 13:58 ` [PATCH 1/2] RDMA/rxe: Add common rxe_prepare_res() Jason Gunthorpe
0 siblings, 2 replies; 6+ messages in thread
From: Xiao Yang @ 2022-07-05 11:46 UTC (permalink / raw)
To: linux-rdma; +Cc: leon, jgg, rpearsonhpe, zyjzyj2000, Xiao Yang
Replace rxe_prepare_atomic_res() and rxe_prepare_read_res()
with rxe_prepare_res().
Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
drivers/infiniband/sw/rxe/rxe_resp.c | 71 +++++++++++++---------------
1 file changed, 32 insertions(+), 39 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index ccdfc1a6b659..5536582b8fe4 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -553,27 +553,48 @@ static enum resp_states write_data_in(struct rxe_qp *qp,
return rc;
}
-/* Guarantee atomicity of atomic operations at the machine level. */
-static DEFINE_SPINLOCK(atomic_ops_lock);
-
-static struct resp_res *rxe_prepare_atomic_res(struct rxe_qp *qp,
- struct rxe_pkt_info *pkt)
+static struct resp_res *rxe_prepare_res(struct rxe_qp *qp,
+ struct rxe_pkt_info *pkt,
+ int type)
{
struct resp_res *res;
+ u32 pkts;
res = &qp->resp.resources[qp->resp.res_head];
rxe_advance_resp_resource(qp);
free_rd_atomic_resource(qp, res);
- res->type = RXE_ATOMIC_MASK;
- res->first_psn = pkt->psn;
- res->last_psn = pkt->psn;
- res->cur_psn = pkt->psn;
+ res->type = type;
res->replay = 0;
+ switch (type) {
+ case RXE_READ_MASK:
+ res->read.va = qp->resp.va + qp->resp.offset;
+ res->read.va_org = qp->resp.va + qp->resp.offset;
+ res->read.resid = qp->resp.resid;
+ res->read.length = qp->resp.resid;
+ res->read.rkey = qp->resp.rkey;
+
+ pkts = max_t(u32, (reth_len(pkt) + qp->mtu - 1)/qp->mtu, 1);
+ res->first_psn = pkt->psn;
+ res->cur_psn = pkt->psn;
+ res->last_psn = (pkt->psn + pkts - 1) & BTH_PSN_MASK;
+
+ res->state = rdatm_res_state_new;
+ break;
+ case RXE_ATOMIC_MASK:
+ res->first_psn = pkt->psn;
+ res->last_psn = pkt->psn;
+ res->cur_psn = pkt->psn;
+ break;
+ }
+
return res;
}
+/* Guarantee atomicity of atomic operations at the machine level. */
+static DEFINE_SPINLOCK(atomic_ops_lock);
+
static enum resp_states rxe_atomic_reply(struct rxe_qp *qp,
struct rxe_pkt_info *pkt)
{
@@ -584,7 +605,7 @@ static enum resp_states rxe_atomic_reply(struct rxe_qp *qp,
u64 value;
if (!res) {
- res = rxe_prepare_atomic_res(qp, pkt);
+ res = rxe_prepare_res(qp, pkt, RXE_ATOMIC_MASK);
qp->resp.res = res;
}
@@ -680,34 +701,6 @@ static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,
return skb;
}
-static struct resp_res *rxe_prepare_read_res(struct rxe_qp *qp,
- struct rxe_pkt_info *pkt)
-{
- struct resp_res *res;
- u32 pkts;
-
- res = &qp->resp.resources[qp->resp.res_head];
- rxe_advance_resp_resource(qp);
- free_rd_atomic_resource(qp, res);
-
- res->type = RXE_READ_MASK;
- res->replay = 0;
- res->read.va = qp->resp.va + qp->resp.offset;
- res->read.va_org = qp->resp.va + qp->resp.offset;
- res->read.resid = qp->resp.resid;
- res->read.length = qp->resp.resid;
- res->read.rkey = qp->resp.rkey;
-
- pkts = max_t(u32, (reth_len(pkt) + qp->mtu - 1)/qp->mtu, 1);
- res->first_psn = pkt->psn;
- res->cur_psn = pkt->psn;
- res->last_psn = (pkt->psn + pkts - 1) & BTH_PSN_MASK;
-
- res->state = rdatm_res_state_new;
-
- return res;
-}
-
/**
* rxe_recheck_mr - revalidate MR from rkey and get a reference
* @qp: the qp
@@ -778,7 +771,7 @@ static enum resp_states read_reply(struct rxe_qp *qp,
struct rxe_mr *mr;
if (!res) {
- res = rxe_prepare_read_res(qp, req_pkt);
+ res = rxe_prepare_res(qp, req_pkt, RXE_READ_MASK);
qp->resp.res = res;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/2] RDMA/rxe: Rename rxe_atomic_reply to atomic_reply
2022-07-05 11:46 [PATCH 1/2] RDMA/rxe: Add common rxe_prepare_res() Xiao Yang
@ 2022-07-05 11:46 ` Xiao Yang
2022-07-06 7:38 ` Pearson, Robert B
2022-07-05 13:58 ` [PATCH 1/2] RDMA/rxe: Add common rxe_prepare_res() Jason Gunthorpe
1 sibling, 1 reply; 6+ messages in thread
From: Xiao Yang @ 2022-07-05 11:46 UTC (permalink / raw)
To: linux-rdma; +Cc: leon, jgg, rpearsonhpe, zyjzyj2000, Xiao Yang
It's better to use the unified naming format.
Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
drivers/infiniband/sw/rxe/rxe_resp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index 5536582b8fe4..265e46fe050f 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -595,7 +595,7 @@ static struct resp_res *rxe_prepare_res(struct rxe_qp *qp,
/* Guarantee atomicity of atomic operations at the machine level. */
static DEFINE_SPINLOCK(atomic_ops_lock);
-static enum resp_states rxe_atomic_reply(struct rxe_qp *qp,
+static enum resp_states atomic_reply(struct rxe_qp *qp,
struct rxe_pkt_info *pkt)
{
u64 *vaddr;
@@ -1333,7 +1333,7 @@ int rxe_responder(void *arg)
state = read_reply(qp, pkt);
break;
case RESPST_ATOMIC_REPLY:
- state = rxe_atomic_reply(qp, pkt);
+ state = atomic_reply(qp, pkt);
break;
case RESPST_ACKNOWLEDGE:
state = acknowledge(qp, pkt);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* RE: [PATCH 2/2] RDMA/rxe: Rename rxe_atomic_reply to atomic_reply
2022-07-05 11:46 ` [PATCH 2/2] RDMA/rxe: Rename rxe_atomic_reply to atomic_reply Xiao Yang
@ 2022-07-06 7:38 ` Pearson, Robert B
2022-07-06 12:14 ` yangx.jy
0 siblings, 1 reply; 6+ messages in thread
From: Pearson, Robert B @ 2022-07-06 7:38 UTC (permalink / raw)
To: Xiao Yang, linux-rdma@vger.kernel.org
Cc: leon@kernel.org, jgg@ziepe.ca, rpearsonhpe@gmail.com,
zyjzyj2000@gmail.com
Generally over time I have been adding a rxe_ prefix to all searchable names static or non static.
This avoids collisions with similar names in other drivers with e.g. ctags. I agree a unified naming
Scheme is good but would like to see one with a common prefix for subroutine names.
Bob
-----Original Message-----
From: Xiao Yang <yangx.jy@fujitsu.com>
Sent: Tuesday, July 5, 2022 6:46 AM
To: linux-rdma@vger.kernel.org
Cc: leon@kernel.org; jgg@ziepe.ca; rpearsonhpe@gmail.com; zyjzyj2000@gmail.com; Xiao Yang <yangx.jy@fujitsu.com>
Subject: [PATCH 2/2] RDMA/rxe: Rename rxe_atomic_reply to atomic_reply
It's better to use the unified naming format.
Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
drivers/infiniband/sw/rxe/rxe_resp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index 5536582b8fe4..265e46fe050f 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -595,7 +595,7 @@ static struct resp_res *rxe_prepare_res(struct rxe_qp *qp,
/* Guarantee atomicity of atomic operations at the machine level. */ static DEFINE_SPINLOCK(atomic_ops_lock);
-static enum resp_states rxe_atomic_reply(struct rxe_qp *qp,
+static enum resp_states atomic_reply(struct rxe_qp *qp,
struct rxe_pkt_info *pkt)
{
u64 *vaddr;
@@ -1333,7 +1333,7 @@ int rxe_responder(void *arg)
state = read_reply(qp, pkt);
break;
case RESPST_ATOMIC_REPLY:
- state = rxe_atomic_reply(qp, pkt);
+ state = atomic_reply(qp, pkt);
break;
case RESPST_ACKNOWLEDGE:
state = acknowledge(qp, pkt);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] RDMA/rxe: Rename rxe_atomic_reply to atomic_reply
2022-07-06 7:38 ` Pearson, Robert B
@ 2022-07-06 12:14 ` yangx.jy
2022-07-14 17:05 ` Bob Pearson
0 siblings, 1 reply; 6+ messages in thread
From: yangx.jy @ 2022-07-06 12:14 UTC (permalink / raw)
To: Pearson, Robert B, linux-rdma@vger.kernel.org
Cc: leon@kernel.org, jgg@ziepe.ca, rpearsonhpe@gmail.com,
zyjzyj2000@gmail.com
On 2022/7/6 15:38, Pearson, Robert B wrote:
> Generally over time I have been adding a rxe_ prefix to all searchable names static or non static.
> This avoids collisions with similar names in other drivers with e.g. ctags. I agree a unified naming
> Scheme is good but would like to see one with a common prefix for subroutine names.
Hi Bob,
I think it's hard to use unique name in all drivers. I saw that all
functions called by different qp states don't use the rxe_ prefix in
rxe_responders so just remove the rxe_ prefix. We can drop the patch if
you don't agree with this change.
Best Regards,
Xiao Yang
>
> Bob
>
> -----Original Message-----
> From: Xiao Yang <yangx.jy@fujitsu.com>
> Sent: Tuesday, July 5, 2022 6:46 AM
> To: linux-rdma@vger.kernel.org
> Cc: leon@kernel.org; jgg@ziepe.ca; rpearsonhpe@gmail.com; zyjzyj2000@gmail.com; Xiao Yang <yangx.jy@fujitsu.com>
> Subject: [PATCH 2/2] RDMA/rxe: Rename rxe_atomic_reply to atomic_reply
>
> It's better to use the unified naming format.
>
> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> ---
> drivers/infiniband/sw/rxe/rxe_resp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
> index 5536582b8fe4..265e46fe050f 100644
> --- a/drivers/infiniband/sw/rxe/rxe_resp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
> @@ -595,7 +595,7 @@ static struct resp_res *rxe_prepare_res(struct rxe_qp *qp,
> /* Guarantee atomicity of atomic operations at the machine level. */ static DEFINE_SPINLOCK(atomic_ops_lock);
>
> -static enum resp_states rxe_atomic_reply(struct rxe_qp *qp,
> +static enum resp_states atomic_reply(struct rxe_qp *qp,
> struct rxe_pkt_info *pkt)
> {
> u64 *vaddr;
> @@ -1333,7 +1333,7 @@ int rxe_responder(void *arg)
> state = read_reply(qp, pkt);
> break;
> case RESPST_ATOMIC_REPLY:
> - state = rxe_atomic_reply(qp, pkt);
> + state = atomic_reply(qp, pkt);
> break;
> case RESPST_ACKNOWLEDGE:
> state = acknowledge(qp, pkt);
> --
> 2.34.1
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] RDMA/rxe: Rename rxe_atomic_reply to atomic_reply
2022-07-06 12:14 ` yangx.jy
@ 2022-07-14 17:05 ` Bob Pearson
0 siblings, 0 replies; 6+ messages in thread
From: Bob Pearson @ 2022-07-14 17:05 UTC (permalink / raw)
To: yangx.jy@fujitsu.com, Pearson, Robert B,
linux-rdma@vger.kernel.org
Cc: leon@kernel.org, jgg@ziepe.ca, zyjzyj2000@gmail.com
On 7/6/22 07:14, yangx.jy@fujitsu.com wrote:
> On 2022/7/6 15:38, Pearson, Robert B wrote:
>> Generally over time I have been adding a rxe_ prefix to all searchable names static or non static.
>> This avoids collisions with similar names in other drivers with e.g. ctags. I agree a unified naming
>> Scheme is good but would like to see one with a common prefix for subroutine names.
> Hi Bob,
>
> I think it's hard to use unique name in all drivers. I saw that all
> functions called by different qp states don't use the rxe_ prefix in
> rxe_responders so just remove the rxe_ prefix. We can drop the patch if
> you don't agree with this change.
>
> Best Regards,
> Xiao Yang
I fought on your side of this argument with Zhu a while back but now I am completely on his side.
Linux has a lot of lines and generic subroutine names will very often collide all over the place.
The better answer is to add rxe_ not remove it. It's not super critical so I have been doing it as
a background task whenever I touch a piece of code. If you get the urge to make things more consistent
feel free to do that but by adding a prefix and not deleting it.
Bob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] RDMA/rxe: Add common rxe_prepare_res()
2022-07-05 11:46 [PATCH 1/2] RDMA/rxe: Add common rxe_prepare_res() Xiao Yang
2022-07-05 11:46 ` [PATCH 2/2] RDMA/rxe: Rename rxe_atomic_reply to atomic_reply Xiao Yang
@ 2022-07-05 13:58 ` Jason Gunthorpe
1 sibling, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2022-07-05 13:58 UTC (permalink / raw)
To: Xiao Yang; +Cc: linux-rdma, leon, rpearsonhpe, zyjzyj2000
On Tue, Jul 05, 2022 at 07:46:02PM +0800, Xiao Yang wrote:
> Replace rxe_prepare_atomic_res() and rxe_prepare_read_res()
> with rxe_prepare_res().
Explain why we should do a change like this in the commit message
please
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-14 17:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-05 11:46 [PATCH 1/2] RDMA/rxe: Add common rxe_prepare_res() Xiao Yang
2022-07-05 11:46 ` [PATCH 2/2] RDMA/rxe: Rename rxe_atomic_reply to atomic_reply Xiao Yang
2022-07-06 7:38 ` Pearson, Robert B
2022-07-06 12:14 ` yangx.jy
2022-07-14 17:05 ` Bob Pearson
2022-07-05 13:58 ` [PATCH 1/2] RDMA/rxe: Add common rxe_prepare_res() Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox