From: Bob Pearson <rpearsonhpe@gmail.com>
To: jgg@nvidia.com, yanjun.zhu@linux.dev, linux-rdma@vger.kernel.org
Cc: Bob Pearson <rpearsonhpe@gmail.com>
Subject: [PATCH for-next 1/6] RDMA/rxe: Cleanup rxe_ah/av_chk_attr
Date: Fri, 3 Nov 2023 15:43:20 -0500 [thread overview]
Message-ID: <20231103204324.9606-2-rpearsonhpe@gmail.com> (raw)
In-Reply-To: <20231103204324.9606-1-rpearsonhpe@gmail.com>
Replace rxe_ah_chk_attr() and rxe_av_chk_attr() by a single
routine rxe_chk_ah_attr().
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
drivers/infiniband/sw/rxe/rxe_av.c | 43 ++++-----------------------
drivers/infiniband/sw/rxe/rxe_loc.h | 3 +-
drivers/infiniband/sw/rxe/rxe_qp.c | 4 +--
drivers/infiniband/sw/rxe/rxe_verbs.c | 5 ++--
4 files changed, 12 insertions(+), 43 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_av.c b/drivers/infiniband/sw/rxe/rxe_av.c
index 889d7adbd455..4ac17b8def28 100644
--- a/drivers/infiniband/sw/rxe/rxe_av.c
+++ b/drivers/infiniband/sw/rxe/rxe_av.c
@@ -14,45 +14,24 @@ void rxe_init_av(struct rdma_ah_attr *attr, struct rxe_av *av)
memcpy(av->dmac, attr->roce.dmac, ETH_ALEN);
}
-static int chk_attr(void *obj, struct rdma_ah_attr *attr, bool obj_is_ah)
+int rxe_chk_ah_attr(struct rxe_dev *rxe, struct rdma_ah_attr *attr)
{
const struct ib_global_route *grh = rdma_ah_read_grh(attr);
- struct rxe_port *port;
- struct rxe_dev *rxe;
- struct rxe_qp *qp;
- struct rxe_ah *ah;
+ struct rxe_port *port = &rxe->port;
int type;
- if (obj_is_ah) {
- ah = obj;
- rxe = to_rdev(ah->ibah.device);
- } else {
- qp = obj;
- rxe = to_rdev(qp->ibqp.device);
- }
-
- port = &rxe->port;
-
if (rdma_ah_get_ah_flags(attr) & IB_AH_GRH) {
if (grh->sgid_index > port->attr.gid_tbl_len) {
- if (obj_is_ah)
- rxe_dbg_ah(ah, "invalid sgid index = %d\n",
- grh->sgid_index);
- else
- rxe_dbg_qp(qp, "invalid sgid index = %d\n",
- grh->sgid_index);
+ rxe_dbg_dev(rxe, "invalid sgid index = %d\n",
+ grh->sgid_index);
return -EINVAL;
}
type = rdma_gid_attr_network_type(grh->sgid_attr);
if (type < RDMA_NETWORK_IPV4 ||
type > RDMA_NETWORK_IPV6) {
- if (obj_is_ah)
- rxe_dbg_ah(ah, "invalid network type for rdma_rxe = %d\n",
- type);
- else
- rxe_dbg_qp(qp, "invalid network type for rdma_rxe = %d\n",
- type);
+ rxe_dbg_dev(rxe, "invalid network type for rdma_rxe = %d\n",
+ type);
return -EINVAL;
}
}
@@ -60,16 +39,6 @@ static int chk_attr(void *obj, struct rdma_ah_attr *attr, bool obj_is_ah)
return 0;
}
-int rxe_av_chk_attr(struct rxe_qp *qp, struct rdma_ah_attr *attr)
-{
- return chk_attr(qp, attr, false);
-}
-
-int rxe_ah_chk_attr(struct rxe_ah *ah, struct rdma_ah_attr *attr)
-{
- return chk_attr(ah, attr, true);
-}
-
void rxe_av_from_attr(u8 port_num, struct rxe_av *av,
struct rdma_ah_attr *attr)
{
diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
index 4d2a8ef52c85..3d2504a0ae56 100644
--- a/drivers/infiniband/sw/rxe/rxe_loc.h
+++ b/drivers/infiniband/sw/rxe/rxe_loc.h
@@ -9,8 +9,7 @@
/* rxe_av.c */
void rxe_init_av(struct rdma_ah_attr *attr, struct rxe_av *av);
-int rxe_av_chk_attr(struct rxe_qp *qp, struct rdma_ah_attr *attr);
-int rxe_ah_chk_attr(struct rxe_ah *ah, struct rdma_ah_attr *attr);
+int rxe_chk_ah_attr(struct rxe_dev *rxe, struct rdma_ah_attr *attr);
void rxe_av_from_attr(u8 port_num, struct rxe_av *av,
struct rdma_ah_attr *attr);
void rxe_av_to_attr(struct rxe_av *av, struct rdma_ah_attr *attr);
diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
index 28e379c108bc..c28005db032d 100644
--- a/drivers/infiniband/sw/rxe/rxe_qp.c
+++ b/drivers/infiniband/sw/rxe/rxe_qp.c
@@ -456,11 +456,11 @@ int rxe_qp_chk_attr(struct rxe_dev *rxe, struct rxe_qp *qp,
goto err1;
}
- if (mask & IB_QP_AV && rxe_av_chk_attr(qp, &attr->ah_attr))
+ if (mask & IB_QP_AV && rxe_chk_ah_attr(rxe, &attr->ah_attr))
goto err1;
if (mask & IB_QP_ALT_PATH) {
- if (rxe_av_chk_attr(qp, &attr->alt_ah_attr))
+ if (rxe_chk_ah_attr(rxe, &attr->alt_ah_attr))
goto err1;
if (!rdma_is_port_valid(&rxe->ib_dev, attr->alt_port_num)) {
rxe_dbg_qp(qp, "invalid alt port %d\n", attr->alt_port_num);
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 48f86839d36a..6706d540f1f6 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -286,7 +286,7 @@ static int rxe_create_ah(struct ib_ah *ibah,
/* create index > 0 */
ah->ah_num = ah->elem.index;
- err = rxe_ah_chk_attr(ah, init_attr->ah_attr);
+ err = rxe_chk_ah_attr(rxe, init_attr->ah_attr);
if (err) {
rxe_dbg_ah(ah, "bad attr");
goto err_cleanup;
@@ -322,10 +322,11 @@ static int rxe_create_ah(struct ib_ah *ibah,
static int rxe_modify_ah(struct ib_ah *ibah, struct rdma_ah_attr *attr)
{
+ struct rxe_dev *rxe = to_rdev(ibah->device);
struct rxe_ah *ah = to_rah(ibah);
int err;
- err = rxe_ah_chk_attr(ah, attr);
+ err = rxe_chk_ah_attr(rxe, attr);
if (err) {
rxe_dbg_ah(ah, "bad attr");
goto err_out;
--
2.40.1
next prev parent reply other threads:[~2023-11-03 20:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-03 20:43 [PATCH for-next 0/6] RDMA/rxe: Make multicast actually work Bob Pearson
2023-11-03 20:43 ` Bob Pearson [this message]
2023-11-03 20:43 ` [PATCH for-next 2/6] RDMA/rxe: Handle loopback of mcast packets Bob Pearson
2023-11-04 12:30 ` Zhu Yanjun
2023-11-03 20:43 ` [PATCH for-next 3/6] RDMA/rxe: Register IP mcast address Bob Pearson
2023-11-04 12:42 ` Zhu Yanjun
2023-11-05 20:19 ` Bob Pearson
2023-11-06 13:26 ` Zhu Yanjun
2023-11-06 17:31 ` Bob Pearson
2023-11-08 1:24 ` Zhu Yanjun
2023-11-03 20:43 ` [PATCH for-next 4/6] RDMA/rxe: Let rxe_lookup_mcg use rcu_read_lock Bob Pearson
2023-11-03 20:43 ` [PATCH for-next 5/6] RDMA/rxe: Split multicast lock Bob Pearson
2023-11-03 20:43 ` [PATCH for-next 6/6] RDMA/rxe: Cleanup mcg lifetime Bob Pearson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231103204324.9606-2-rpearsonhpe@gmail.com \
--to=rpearsonhpe@gmail.com \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=yanjun.zhu@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox