Skip to content

Commit 25fd735

Browse files
Bob Pearsonjgunthorpe
authored andcommitted
RDMA/rxe: Replace pr_xxx by rxe_dbg_xxx in rxe_av.c
Replace calls to pr_xxx() in rxe_av.c with rxe_dbg_xxx(). Link: https://lore.kernel.org/r/20221103171013.20659-13-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 14e501f commit 25fd735

File tree

4 files changed

+47
-21
lines changed

4 files changed

+47
-21
lines changed

drivers/infiniband/sw/rxe/rxe_av.c

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,62 @@ void rxe_init_av(struct rdma_ah_attr *attr, struct rxe_av *av)
1414
memcpy(av->dmac, attr->roce.dmac, ETH_ALEN);
1515
}
1616

17-
int rxe_av_chk_attr(struct rxe_dev *rxe, struct rdma_ah_attr *attr)
17+
static int chk_attr(void *obj, struct rdma_ah_attr *attr, bool obj_is_ah)
1818
{
1919
const struct ib_global_route *grh = rdma_ah_read_grh(attr);
2020
struct rxe_port *port;
21+
struct rxe_dev *rxe;
22+
struct rxe_qp *qp;
23+
struct rxe_ah *ah;
2124
int type;
2225

26+
if (obj_is_ah) {
27+
ah = obj;
28+
rxe = to_rdev(ah->ibah.device);
29+
} else {
30+
qp = obj;
31+
rxe = to_rdev(qp->ibqp.device);
32+
}
33+
2334
port = &rxe->port;
2435

2536
if (rdma_ah_get_ah_flags(attr) & IB_AH_GRH) {
2637
if (grh->sgid_index > port->attr.gid_tbl_len) {
27-
pr_warn("invalid sgid index = %d\n",
28-
grh->sgid_index);
38+
if (obj_is_ah)
39+
rxe_dbg_ah(ah, "invalid sgid index = %d\n",
40+
grh->sgid_index);
41+
else
42+
rxe_dbg_qp(qp, "invalid sgid index = %d\n",
43+
grh->sgid_index);
2944
return -EINVAL;
3045
}
3146

3247
type = rdma_gid_attr_network_type(grh->sgid_attr);
3348
if (type < RDMA_NETWORK_IPV4 ||
3449
type > RDMA_NETWORK_IPV6) {
35-
pr_warn("invalid network type for rdma_rxe = %d\n",
36-
type);
50+
if (obj_is_ah)
51+
rxe_dbg_ah(ah, "invalid network type for rdma_rxe = %d\n",
52+
type);
53+
else
54+
rxe_dbg_qp(qp, "invalid network type for rdma_rxe = %d\n",
55+
type);
3756
return -EINVAL;
3857
}
3958
}
4059

4160
return 0;
4261
}
4362

63+
int rxe_av_chk_attr(struct rxe_qp *qp, struct rdma_ah_attr *attr)
64+
{
65+
return chk_attr(qp, attr, false);
66+
}
67+
68+
int rxe_ah_chk_attr(struct rxe_ah *ah, struct rdma_ah_attr *attr)
69+
{
70+
return chk_attr(ah, attr, true);
71+
}
72+
4473
void rxe_av_from_attr(u8 port_num, struct rxe_av *av,
4574
struct rdma_ah_attr *attr)
4675
{
@@ -121,12 +150,12 @@ struct rxe_av *rxe_get_av(struct rxe_pkt_info *pkt, struct rxe_ah **ahp)
121150
/* only new user provider or kernel client */
122151
ah = rxe_pool_get_index(&pkt->rxe->ah_pool, ah_num);
123152
if (!ah) {
124-
pr_warn("Unable to find AH matching ah_num\n");
153+
rxe_dbg_qp(pkt->qp, "Unable to find AH matching ah_num\n");
125154
return NULL;
126155
}
127156

128157
if (rxe_ah_pd(ah) != pkt->qp->pd) {
129-
pr_warn("PDs don't match for AH and QP\n");
158+
rxe_dbg_qp(pkt->qp, "PDs don't match for AH and QP\n");
130159
rxe_put(ah);
131160
return NULL;
132161
}

drivers/infiniband/sw/rxe/rxe_loc.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@
99

1010
/* rxe_av.c */
1111
void rxe_init_av(struct rdma_ah_attr *attr, struct rxe_av *av);
12-
13-
int rxe_av_chk_attr(struct rxe_dev *rxe, struct rdma_ah_attr *attr);
14-
12+
int rxe_av_chk_attr(struct rxe_qp *qp, struct rdma_ah_attr *attr);
13+
int rxe_ah_chk_attr(struct rxe_ah *ah, struct rdma_ah_attr *attr);
1514
void rxe_av_from_attr(u8 port_num, struct rxe_av *av,
1615
struct rdma_ah_attr *attr);
17-
1816
void rxe_av_to_attr(struct rxe_av *av, struct rdma_ah_attr *attr);
19-
2017
void rxe_av_fill_ip_info(struct rxe_av *av, struct rdma_ah_attr *attr);
21-
2218
struct rxe_av *rxe_get_av(struct rxe_pkt_info *pkt, struct rxe_ah **ahp);
2319

2420
/* rxe_cq.c */

drivers/infiniband/sw/rxe/rxe_qp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,11 @@ int rxe_qp_chk_attr(struct rxe_dev *rxe, struct rxe_qp *qp,
414414
if (mask & IB_QP_CAP && rxe_qp_chk_cap(rxe, &attr->cap, !!qp->srq))
415415
goto err1;
416416

417-
if (mask & IB_QP_AV && rxe_av_chk_attr(rxe, &attr->ah_attr))
417+
if (mask & IB_QP_AV && rxe_av_chk_attr(qp, &attr->ah_attr))
418418
goto err1;
419419

420420
if (mask & IB_QP_ALT_PATH) {
421-
if (rxe_av_chk_attr(rxe, &attr->alt_ah_attr))
421+
if (rxe_av_chk_attr(qp, &attr->alt_ah_attr))
422422
goto err1;
423423
if (!rdma_is_port_valid(&rxe->ib_dev, attr->alt_port_num)) {
424424
rxe_dbg_qp(qp, "invalid alt port %d\n", attr->alt_port_num);

drivers/infiniband/sw/rxe/rxe_verbs.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,6 @@ static int rxe_create_ah(struct ib_ah *ibah,
172172
ah->is_user = false;
173173
}
174174

175-
err = rxe_av_chk_attr(rxe, init_attr->ah_attr);
176-
if (err)
177-
return err;
178-
179175
err = rxe_add_to_pool_ah(&rxe->ah_pool, ah,
180176
init_attr->flags & RDMA_CREATE_AH_SLEEPABLE);
181177
if (err)
@@ -184,6 +180,12 @@ static int rxe_create_ah(struct ib_ah *ibah,
184180
/* create index > 0 */
185181
ah->ah_num = ah->elem.index;
186182

183+
err = rxe_ah_chk_attr(ah, init_attr->ah_attr);
184+
if (err) {
185+
rxe_cleanup(ah);
186+
return err;
187+
}
188+
187189
if (uresp) {
188190
/* only if new user provider */
189191
err = copy_to_user(&uresp->ah_num, &ah->ah_num,
@@ -206,10 +208,9 @@ static int rxe_create_ah(struct ib_ah *ibah,
206208
static int rxe_modify_ah(struct ib_ah *ibah, struct rdma_ah_attr *attr)
207209
{
208210
int err;
209-
struct rxe_dev *rxe = to_rdev(ibah->device);
210211
struct rxe_ah *ah = to_rah(ibah);
211212

212-
err = rxe_av_chk_attr(rxe, attr);
213+
err = rxe_ah_chk_attr(ah, attr);
213214
if (err)
214215
return err;
215216

0 commit comments

Comments
 (0)