Commit c536277e authored by Bernard Metzler's avatar Bernard Metzler Committed by Doug Ledford

RDMA/siw: Fix 64/32bit pointer inconsistency

Fixes improper casting between addresses and unsigned types.
Changes siw_pbl_get_buffer() function to return appropriate
dma_addr_t, and not u64.

Also fixes debug prints. Now any potentially kernel private
pointers are printed formatted as '%pK', to allow keeping that
information secret.

Fixes: d941bfe500be ("RDMA/siw: Change CQ flags from 64->32 bits")
Fixes: b0fff731 ("rdma/siw: completion queue methods")
Fixes: 8b6a361b ("rdma/siw: receive path")
Fixes: b9be6f18 ("rdma/siw: transmit path")
Fixes: f29dd55b ("rdma/siw: queue pair methods")
Fixes: 2251334d ("rdma/siw: application buffer management")
Fixes: 303ae1cd ("rdma/siw: application interface")
Fixes: 6c52fdc2 ("rdma/siw: connection management")
Fixes: a5319752 ("rdma/siw: main include file")
Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Reported-by: default avatarJason Gunthorpe <jgg@ziepe.ca>
Reported-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarBernard Metzler <bmt@zurich.ibm.com>
Link: https://lore.kernel.org/r/20190822173738.26817-1-bmt@zurich.ibm.comSigned-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent fab4f97e
...@@ -138,9 +138,9 @@ struct siw_umem { ...@@ -138,9 +138,9 @@ struct siw_umem {
}; };
struct siw_pble { struct siw_pble {
u64 addr; /* Address of assigned user buffer */ dma_addr_t addr; /* Address of assigned buffer */
u64 size; /* Size of this entry */ unsigned int size; /* Size of this entry */
u64 pbl_off; /* Total offset from start of PBL */ unsigned long pbl_off; /* Total offset from start of PBL */
}; };
struct siw_pbl { struct siw_pbl {
...@@ -734,7 +734,7 @@ static inline void siw_crc_skb(struct siw_rx_stream *srx, unsigned int len) ...@@ -734,7 +734,7 @@ static inline void siw_crc_skb(struct siw_rx_stream *srx, unsigned int len)
"MEM[0x%08x] %s: " fmt, mem->stag, __func__, ##__VA_ARGS__) "MEM[0x%08x] %s: " fmt, mem->stag, __func__, ##__VA_ARGS__)
#define siw_dbg_cep(cep, fmt, ...) \ #define siw_dbg_cep(cep, fmt, ...) \
ibdev_dbg(&cep->sdev->base_dev, "CEP[0x%p] %s: " fmt, \ ibdev_dbg(&cep->sdev->base_dev, "CEP[0x%pK] %s: " fmt, \
cep, __func__, ##__VA_ARGS__) cep, __func__, ##__VA_ARGS__)
void siw_cq_flush(struct siw_cq *cq); void siw_cq_flush(struct siw_cq *cq);
......
...@@ -355,8 +355,8 @@ static int siw_cm_upcall(struct siw_cep *cep, enum iw_cm_event_type reason, ...@@ -355,8 +355,8 @@ static int siw_cm_upcall(struct siw_cep *cep, enum iw_cm_event_type reason,
getname_local(cep->sock, &event.local_addr); getname_local(cep->sock, &event.local_addr);
getname_peer(cep->sock, &event.remote_addr); getname_peer(cep->sock, &event.remote_addr);
} }
siw_dbg_cep(cep, "[QP %u]: id 0x%p, reason=%d, status=%d\n", siw_dbg_cep(cep, "[QP %u]: reason=%d, status=%d\n",
cep->qp ? qp_id(cep->qp) : -1, id, reason, status); cep->qp ? qp_id(cep->qp) : UINT_MAX, reason, status);
return id->event_handler(id, &event); return id->event_handler(id, &event);
} }
...@@ -947,8 +947,6 @@ static void siw_accept_newconn(struct siw_cep *cep) ...@@ -947,8 +947,6 @@ static void siw_accept_newconn(struct siw_cep *cep)
siw_cep_get(new_cep); siw_cep_get(new_cep);
new_s->sk->sk_user_data = new_cep; new_s->sk->sk_user_data = new_cep;
siw_dbg_cep(cep, "listen socket 0x%p, new 0x%p\n", s, new_s);
if (siw_tcp_nagle == false) { if (siw_tcp_nagle == false) {
int val = 1; int val = 1;
...@@ -1011,7 +1009,8 @@ static void siw_cm_work_handler(struct work_struct *w) ...@@ -1011,7 +1009,8 @@ static void siw_cm_work_handler(struct work_struct *w)
cep = work->cep; cep = work->cep;
siw_dbg_cep(cep, "[QP %u]: work type: %d, state %d\n", siw_dbg_cep(cep, "[QP %u]: work type: %d, state %d\n",
cep->qp ? qp_id(cep->qp) : -1, work->type, cep->state); cep->qp ? qp_id(cep->qp) : UINT_MAX,
work->type, cep->state);
siw_cep_set_inuse(cep); siw_cep_set_inuse(cep);
...@@ -1145,9 +1144,9 @@ static void siw_cm_work_handler(struct work_struct *w) ...@@ -1145,9 +1144,9 @@ static void siw_cm_work_handler(struct work_struct *w)
} }
if (release_cep) { if (release_cep) {
siw_dbg_cep(cep, siw_dbg_cep(cep,
"release: timer=%s, QP[%u], id 0x%p\n", "release: timer=%s, QP[%u]\n",
cep->mpa_timer ? "y" : "n", cep->mpa_timer ? "y" : "n",
cep->qp ? qp_id(cep->qp) : -1, cep->cm_id); cep->qp ? qp_id(cep->qp) : UINT_MAX);
siw_cancel_mpatimer(cep); siw_cancel_mpatimer(cep);
...@@ -1211,8 +1210,8 @@ int siw_cm_queue_work(struct siw_cep *cep, enum siw_work_type type) ...@@ -1211,8 +1210,8 @@ int siw_cm_queue_work(struct siw_cep *cep, enum siw_work_type type)
else else
delay = MPAREP_TIMEOUT; delay = MPAREP_TIMEOUT;
} }
siw_dbg_cep(cep, "[QP %u]: work type: %d, work 0x%p, timeout %lu\n", siw_dbg_cep(cep, "[QP %u]: work type: %d, timeout %lu\n",
cep->qp ? qp_id(cep->qp) : -1, type, work, delay); cep->qp ? qp_id(cep->qp) : -1, type, delay);
queue_delayed_work(siw_cm_wq, &work->work, delay); queue_delayed_work(siw_cm_wq, &work->work, delay);
...@@ -1376,16 +1375,16 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params) ...@@ -1376,16 +1375,16 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params)
} }
if (v4) if (v4)
siw_dbg_qp(qp, siw_dbg_qp(qp,
"id 0x%p, pd_len %d, laddr %pI4 %d, raddr %pI4 %d\n", "pd_len %d, laddr %pI4 %d, raddr %pI4 %d\n",
id, pd_len, pd_len,
&((struct sockaddr_in *)(laddr))->sin_addr, &((struct sockaddr_in *)(laddr))->sin_addr,
ntohs(((struct sockaddr_in *)(laddr))->sin_port), ntohs(((struct sockaddr_in *)(laddr))->sin_port),
&((struct sockaddr_in *)(raddr))->sin_addr, &((struct sockaddr_in *)(raddr))->sin_addr,
ntohs(((struct sockaddr_in *)(raddr))->sin_port)); ntohs(((struct sockaddr_in *)(raddr))->sin_port));
else else
siw_dbg_qp(qp, siw_dbg_qp(qp,
"id 0x%p, pd_len %d, laddr %pI6 %d, raddr %pI6 %d\n", "pd_len %d, laddr %pI6 %d, raddr %pI6 %d\n",
id, pd_len, pd_len,
&((struct sockaddr_in6 *)(laddr))->sin6_addr, &((struct sockaddr_in6 *)(laddr))->sin6_addr,
ntohs(((struct sockaddr_in6 *)(laddr))->sin6_port), ntohs(((struct sockaddr_in6 *)(laddr))->sin6_port),
&((struct sockaddr_in6 *)(raddr))->sin6_addr, &((struct sockaddr_in6 *)(raddr))->sin6_addr,
...@@ -1508,8 +1507,7 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params) ...@@ -1508,8 +1507,7 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params)
if (rv >= 0) { if (rv >= 0) {
rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT); rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT);
if (!rv) { if (!rv) {
siw_dbg_cep(cep, "id 0x%p, [QP %u]: exit\n", id, siw_dbg_cep(cep, "[QP %u]: exit\n", qp_id(qp));
qp_id(qp));
siw_cep_set_free(cep); siw_cep_set_free(cep);
return 0; return 0;
} }
...@@ -1581,7 +1579,7 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params) ...@@ -1581,7 +1579,7 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params)
siw_cancel_mpatimer(cep); siw_cancel_mpatimer(cep);
if (cep->state != SIW_EPSTATE_RECVD_MPAREQ) { if (cep->state != SIW_EPSTATE_RECVD_MPAREQ) {
siw_dbg_cep(cep, "id 0x%p: out of state\n", id); siw_dbg_cep(cep, "out of state\n");
siw_cep_set_free(cep); siw_cep_set_free(cep);
siw_cep_put(cep); siw_cep_put(cep);
...@@ -1602,7 +1600,7 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params) ...@@ -1602,7 +1600,7 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params)
up_write(&qp->state_lock); up_write(&qp->state_lock);
goto error; goto error;
} }
siw_dbg_cep(cep, "id 0x%p\n", id); siw_dbg_cep(cep, "[QP %d]\n", params->qpn);
if (try_gso && cep->mpa.hdr.params.bits & MPA_RR_FLAG_GSO_EXP) { if (try_gso && cep->mpa.hdr.params.bits & MPA_RR_FLAG_GSO_EXP) {
siw_dbg_cep(cep, "peer allows GSO on TX\n"); siw_dbg_cep(cep, "peer allows GSO on TX\n");
...@@ -1612,8 +1610,8 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params) ...@@ -1612,8 +1610,8 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params)
params->ird > sdev->attrs.max_ird) { params->ird > sdev->attrs.max_ird) {
siw_dbg_cep( siw_dbg_cep(
cep, cep,
"id 0x%p, [QP %u]: ord %d (max %d), ird %d (max %d)\n", "[QP %u]: ord %d (max %d), ird %d (max %d)\n",
id, qp_id(qp), params->ord, sdev->attrs.max_ord, qp_id(qp), params->ord, sdev->attrs.max_ord,
params->ird, sdev->attrs.max_ird); params->ird, sdev->attrs.max_ird);
rv = -EINVAL; rv = -EINVAL;
up_write(&qp->state_lock); up_write(&qp->state_lock);
...@@ -1625,8 +1623,8 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params) ...@@ -1625,8 +1623,8 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params)
if (params->private_data_len > max_priv_data) { if (params->private_data_len > max_priv_data) {
siw_dbg_cep( siw_dbg_cep(
cep, cep,
"id 0x%p, [QP %u]: private data length: %d (max %d)\n", "[QP %u]: private data length: %d (max %d)\n",
id, qp_id(qp), params->private_data_len, max_priv_data); qp_id(qp), params->private_data_len, max_priv_data);
rv = -EINVAL; rv = -EINVAL;
up_write(&qp->state_lock); up_write(&qp->state_lock);
goto error; goto error;
...@@ -1680,7 +1678,7 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params) ...@@ -1680,7 +1678,7 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params)
qp_attrs.flags = SIW_MPA_CRC; qp_attrs.flags = SIW_MPA_CRC;
qp_attrs.state = SIW_QP_STATE_RTS; qp_attrs.state = SIW_QP_STATE_RTS;
siw_dbg_cep(cep, "id 0x%p, [QP%u]: moving to rts\n", id, qp_id(qp)); siw_dbg_cep(cep, "[QP%u]: moving to rts\n", qp_id(qp));
/* Associate QP with CEP */ /* Associate QP with CEP */
siw_cep_get(cep); siw_cep_get(cep);
...@@ -1701,8 +1699,8 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params) ...@@ -1701,8 +1699,8 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params)
if (rv) if (rv)
goto error; goto error;
siw_dbg_cep(cep, "id 0x%p, [QP %u]: send mpa reply, %d byte pdata\n", siw_dbg_cep(cep, "[QP %u]: send mpa reply, %d byte pdata\n",
id, qp_id(qp), params->private_data_len); qp_id(qp), params->private_data_len);
rv = siw_send_mpareqrep(cep, params->private_data, rv = siw_send_mpareqrep(cep, params->private_data,
params->private_data_len); params->private_data_len);
...@@ -1760,14 +1758,14 @@ int siw_reject(struct iw_cm_id *id, const void *pdata, u8 pd_len) ...@@ -1760,14 +1758,14 @@ int siw_reject(struct iw_cm_id *id, const void *pdata, u8 pd_len)
siw_cancel_mpatimer(cep); siw_cancel_mpatimer(cep);
if (cep->state != SIW_EPSTATE_RECVD_MPAREQ) { if (cep->state != SIW_EPSTATE_RECVD_MPAREQ) {
siw_dbg_cep(cep, "id 0x%p: out of state\n", id); siw_dbg_cep(cep, "out of state\n");
siw_cep_set_free(cep); siw_cep_set_free(cep);
siw_cep_put(cep); /* put last reference */ siw_cep_put(cep); /* put last reference */
return -ECONNRESET; return -ECONNRESET;
} }
siw_dbg_cep(cep, "id 0x%p, cep->state %d, pd_len %d\n", id, cep->state, siw_dbg_cep(cep, "cep->state %d, pd_len %d\n", cep->state,
pd_len); pd_len);
if (__mpa_rr_revision(cep->mpa.hdr.params.bits) >= MPA_REVISION_1) { if (__mpa_rr_revision(cep->mpa.hdr.params.bits) >= MPA_REVISION_1) {
...@@ -1805,14 +1803,14 @@ static int siw_listen_address(struct iw_cm_id *id, int backlog, ...@@ -1805,14 +1803,14 @@ static int siw_listen_address(struct iw_cm_id *id, int backlog,
rv = kernel_setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&s_val, rv = kernel_setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&s_val,
sizeof(s_val)); sizeof(s_val));
if (rv) { if (rv) {
siw_dbg(id->device, "id 0x%p: setsockopt error: %d\n", id, rv); siw_dbg(id->device, "setsockopt error: %d\n", rv);
goto error; goto error;
} }
rv = s->ops->bind(s, laddr, addr_family == AF_INET ? rv = s->ops->bind(s, laddr, addr_family == AF_INET ?
sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in) :
sizeof(struct sockaddr_in6)); sizeof(struct sockaddr_in6));
if (rv) { if (rv) {
siw_dbg(id->device, "id 0x%p: socket bind error: %d\n", id, rv); siw_dbg(id->device, "socket bind error: %d\n", rv);
goto error; goto error;
} }
cep = siw_cep_alloc(sdev); cep = siw_cep_alloc(sdev);
...@@ -1825,13 +1823,13 @@ static int siw_listen_address(struct iw_cm_id *id, int backlog, ...@@ -1825,13 +1823,13 @@ static int siw_listen_address(struct iw_cm_id *id, int backlog,
rv = siw_cm_alloc_work(cep, backlog); rv = siw_cm_alloc_work(cep, backlog);
if (rv) { if (rv) {
siw_dbg(id->device, siw_dbg(id->device,
"id 0x%p: alloc_work error %d, backlog %d\n", id, "alloc_work error %d, backlog %d\n",
rv, backlog); rv, backlog);
goto error; goto error;
} }
rv = s->ops->listen(s, backlog); rv = s->ops->listen(s, backlog);
if (rv) { if (rv) {
siw_dbg(id->device, "id 0x%p: listen error %d\n", id, rv); siw_dbg(id->device, "listen error %d\n", rv);
goto error; goto error;
} }
cep->cm_id = id; cep->cm_id = id;
...@@ -1915,8 +1913,7 @@ static void siw_drop_listeners(struct iw_cm_id *id) ...@@ -1915,8 +1913,7 @@ static void siw_drop_listeners(struct iw_cm_id *id)
list_del(p); list_del(p);
siw_dbg_cep(cep, "id 0x%p: drop cep, state %d\n", id, siw_dbg_cep(cep, "drop cep, state %d\n", cep->state);
cep->state);
siw_cep_set_inuse(cep); siw_cep_set_inuse(cep);
...@@ -1953,7 +1950,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog) ...@@ -1953,7 +1950,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
struct net_device *dev = to_siw_dev(id->device)->netdev; struct net_device *dev = to_siw_dev(id->device)->netdev;
int rv = 0, listeners = 0; int rv = 0, listeners = 0;
siw_dbg(id->device, "id 0x%p: backlog %d\n", id, backlog); siw_dbg(id->device, "backlog %d\n", backlog);
/* /*
* For each attached address of the interface, create a * For each attached address of the interface, create a
...@@ -1969,8 +1966,8 @@ int siw_create_listen(struct iw_cm_id *id, int backlog) ...@@ -1969,8 +1966,8 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
s_raddr = (struct sockaddr_in *)&id->remote_addr; s_raddr = (struct sockaddr_in *)&id->remote_addr;
siw_dbg(id->device, siw_dbg(id->device,
"id 0x%p: laddr %pI4:%d, raddr %pI4:%d\n", "laddr %pI4:%d, raddr %pI4:%d\n",
id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port), &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
&s_raddr->sin_addr, ntohs(s_raddr->sin_port)); &s_raddr->sin_addr, ntohs(s_raddr->sin_port));
rtnl_lock(); rtnl_lock();
...@@ -1995,8 +1992,8 @@ int siw_create_listen(struct iw_cm_id *id, int backlog) ...@@ -1995,8 +1992,8 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
*s_raddr = &to_sockaddr_in6(id->remote_addr); *s_raddr = &to_sockaddr_in6(id->remote_addr);
siw_dbg(id->device, siw_dbg(id->device,
"id 0x%p: laddr %pI6:%d, raddr %pI6:%d\n", "laddr %pI6:%d, raddr %pI6:%d\n",
id, &s_laddr->sin6_addr, ntohs(s_laddr->sin6_port), &s_laddr->sin6_addr, ntohs(s_laddr->sin6_port),
&s_raddr->sin6_addr, ntohs(s_raddr->sin6_port)); &s_raddr->sin6_addr, ntohs(s_raddr->sin6_port));
read_lock_bh(&in6_dev->lock); read_lock_bh(&in6_dev->lock);
...@@ -2029,17 +2026,15 @@ int siw_create_listen(struct iw_cm_id *id, int backlog) ...@@ -2029,17 +2026,15 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
else if (!rv) else if (!rv)
rv = -EINVAL; rv = -EINVAL;
siw_dbg(id->device, "id 0x%p: %s\n", id, rv ? "FAIL" : "OK"); siw_dbg(id->device, "%s\n", rv ? "FAIL" : "OK");
return rv; return rv;
} }
int siw_destroy_listen(struct iw_cm_id *id) int siw_destroy_listen(struct iw_cm_id *id)
{ {
siw_dbg(id->device, "id 0x%p\n", id);
if (!id->provider_data) { if (!id->provider_data) {
siw_dbg(id->device, "id 0x%p: no cep(s)\n", id); siw_dbg(id->device, "no cep(s)\n");
return 0; return 0;
} }
siw_drop_listeners(id); siw_drop_listeners(id);
......
...@@ -71,9 +71,10 @@ int siw_reap_cqe(struct siw_cq *cq, struct ib_wc *wc) ...@@ -71,9 +71,10 @@ int siw_reap_cqe(struct siw_cq *cq, struct ib_wc *wc)
wc->wc_flags = IB_WC_WITH_INVALIDATE; wc->wc_flags = IB_WC_WITH_INVALIDATE;
} }
wc->qp = cqe->base_qp; wc->qp = cqe->base_qp;
siw_dbg_cq(cq, "idx %u, type %d, flags %2x, id 0x%p\n", siw_dbg_cq(cq,
"idx %u, type %d, flags %2x, id 0x%pK\n",
cq->cq_get % cq->num_cqe, cqe->opcode, cq->cq_get % cq->num_cqe, cqe->opcode,
cqe->flags, (void *)cqe->id); cqe->flags, (void *)(uintptr_t)cqe->id);
} }
WRITE_ONCE(cqe->flags, 0); WRITE_ONCE(cqe->flags, 0);
cq->cq_get++; cq->cq_get++;
......
...@@ -197,12 +197,12 @@ int siw_check_mem(struct ib_pd *pd, struct siw_mem *mem, u64 addr, ...@@ -197,12 +197,12 @@ int siw_check_mem(struct ib_pd *pd, struct siw_mem *mem, u64 addr,
*/ */
if (addr < mem->va || addr + len > mem->va + mem->len) { if (addr < mem->va || addr + len > mem->va + mem->len) {
siw_dbg_pd(pd, "MEM interval len %d\n", len); siw_dbg_pd(pd, "MEM interval len %d\n", len);
siw_dbg_pd(pd, "[0x%016llx, 0x%016llx] out of bounds\n", siw_dbg_pd(pd, "[0x%pK, 0x%pK] out of bounds\n",
(unsigned long long)addr, (void *)(uintptr_t)addr,
(unsigned long long)(addr + len)); (void *)(uintptr_t)(addr + len));
siw_dbg_pd(pd, "[0x%016llx, 0x%016llx] STag=0x%08x\n", siw_dbg_pd(pd, "[0x%pK, 0x%pK] STag=0x%08x\n",
(unsigned long long)mem->va, (void *)(uintptr_t)mem->va,
(unsigned long long)(mem->va + mem->len), (void *)(uintptr_t)(mem->va + mem->len),
mem->stag); mem->stag);
return -E_BASE_BOUNDS; return -E_BASE_BOUNDS;
...@@ -330,7 +330,7 @@ int siw_invalidate_stag(struct ib_pd *pd, u32 stag) ...@@ -330,7 +330,7 @@ int siw_invalidate_stag(struct ib_pd *pd, u32 stag)
* Optionally, provides remaining len within current element, and * Optionally, provides remaining len within current element, and
* current PBL index for later resume at same element. * current PBL index for later resume at same element.
*/ */
u64 siw_pbl_get_buffer(struct siw_pbl *pbl, u64 off, int *len, int *idx) dma_addr_t siw_pbl_get_buffer(struct siw_pbl *pbl, u64 off, int *len, int *idx)
{ {
int i = idx ? *idx : 0; int i = idx ? *idx : 0;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable); struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable);
void siw_umem_release(struct siw_umem *umem, bool dirty); void siw_umem_release(struct siw_umem *umem, bool dirty);
struct siw_pbl *siw_pbl_alloc(u32 num_buf); struct siw_pbl *siw_pbl_alloc(u32 num_buf);
u64 siw_pbl_get_buffer(struct siw_pbl *pbl, u64 off, int *len, int *idx); dma_addr_t siw_pbl_get_buffer(struct siw_pbl *pbl, u64 off, int *len, int *idx);
struct siw_mem *siw_mem_id2obj(struct siw_device *sdev, int stag_index); struct siw_mem *siw_mem_id2obj(struct siw_device *sdev, int stag_index);
int siw_mem_add(struct siw_device *sdev, struct siw_mem *m); int siw_mem_add(struct siw_device *sdev, struct siw_mem *m);
int siw_invalidate_stag(struct ib_pd *pd, u32 stag); int siw_invalidate_stag(struct ib_pd *pd, u32 stag);
......
...@@ -949,7 +949,7 @@ int siw_activate_tx(struct siw_qp *qp) ...@@ -949,7 +949,7 @@ int siw_activate_tx(struct siw_qp *qp)
rv = -EINVAL; rv = -EINVAL;
goto out; goto out;
} }
wqe->sqe.sge[0].laddr = (u64)&wqe->sqe.sge[1]; wqe->sqe.sge[0].laddr = (uintptr_t)&wqe->sqe.sge[1];
wqe->sqe.sge[0].lkey = 0; wqe->sqe.sge[0].lkey = 0;
wqe->sqe.num_sge = 1; wqe->sqe.num_sge = 1;
} }
......
...@@ -38,9 +38,10 @@ static int siw_rx_umem(struct siw_rx_stream *srx, struct siw_umem *umem, ...@@ -38,9 +38,10 @@ static int siw_rx_umem(struct siw_rx_stream *srx, struct siw_umem *umem,
p = siw_get_upage(umem, dest_addr); p = siw_get_upage(umem, dest_addr);
if (unlikely(!p)) { if (unlikely(!p)) {
pr_warn("siw: %s: [QP %u]: bogus addr: %p, %p\n", pr_warn("siw: %s: [QP %u]: bogus addr: %pK, %pK\n",
__func__, qp_id(rx_qp(srx)), __func__, qp_id(rx_qp(srx)),
(void *)dest_addr, (void *)umem->fp_addr); (void *)(uintptr_t)dest_addr,
(void *)(uintptr_t)umem->fp_addr);
/* siw internal error */ /* siw internal error */
srx->skb_copied += copied; srx->skb_copied += copied;
srx->skb_new -= copied; srx->skb_new -= copied;
...@@ -50,7 +51,7 @@ static int siw_rx_umem(struct siw_rx_stream *srx, struct siw_umem *umem, ...@@ -50,7 +51,7 @@ static int siw_rx_umem(struct siw_rx_stream *srx, struct siw_umem *umem,
pg_off = dest_addr & ~PAGE_MASK; pg_off = dest_addr & ~PAGE_MASK;
bytes = min(len, (int)PAGE_SIZE - pg_off); bytes = min(len, (int)PAGE_SIZE - pg_off);
siw_dbg_qp(rx_qp(srx), "page %p, bytes=%u\n", p, bytes); siw_dbg_qp(rx_qp(srx), "page %pK, bytes=%u\n", p, bytes);
dest = kmap_atomic(p); dest = kmap_atomic(p);
rv = skb_copy_bits(srx->skb, srx->skb_offset, dest + pg_off, rv = skb_copy_bits(srx->skb, srx->skb_offset, dest + pg_off,
...@@ -104,11 +105,11 @@ static int siw_rx_kva(struct siw_rx_stream *srx, void *kva, int len) ...@@ -104,11 +105,11 @@ static int siw_rx_kva(struct siw_rx_stream *srx, void *kva, int len)
{ {
int rv; int rv;
siw_dbg_qp(rx_qp(srx), "kva: 0x%p, len: %u\n", kva, len); siw_dbg_qp(rx_qp(srx), "kva: 0x%pK, len: %u\n", kva, len);
rv = skb_copy_bits(srx->skb, srx->skb_offset, kva, len); rv = skb_copy_bits(srx->skb, srx->skb_offset, kva, len);
if (unlikely(rv)) { if (unlikely(rv)) {
pr_warn("siw: [QP %u]: %s, len %d, kva 0x%p, rv %d\n", pr_warn("siw: [QP %u]: %s, len %d, kva 0x%pK, rv %d\n",
qp_id(rx_qp(srx)), __func__, len, kva, rv); qp_id(rx_qp(srx)), __func__, len, kva, rv);
return rv; return rv;
...@@ -132,7 +133,7 @@ static int siw_rx_pbl(struct siw_rx_stream *srx, int *pbl_idx, ...@@ -132,7 +133,7 @@ static int siw_rx_pbl(struct siw_rx_stream *srx, int *pbl_idx,
while (len) { while (len) {
int bytes; int bytes;
u64 buf_addr = dma_addr_t buf_addr =
siw_pbl_get_buffer(pbl, offset, &bytes, pbl_idx); siw_pbl_get_buffer(pbl, offset, &bytes, pbl_idx);
if (!buf_addr) if (!buf_addr)
break; break;
...@@ -485,7 +486,7 @@ int siw_proc_send(struct siw_qp *qp) ...@@ -485,7 +486,7 @@ int siw_proc_send(struct siw_qp *qp)
mem_p = *mem; mem_p = *mem;
if (mem_p->mem_obj == NULL) if (mem_p->mem_obj == NULL)
rv = siw_rx_kva(srx, rv = siw_rx_kva(srx,
(void *)(sge->laddr + frx->sge_off), (void *)(uintptr_t)(sge->laddr + frx->sge_off),
sge_bytes); sge_bytes);
else if (!mem_p->is_pbl) else if (!mem_p->is_pbl)
rv = siw_rx_umem(srx, mem_p->umem, rv = siw_rx_umem(srx, mem_p->umem,
...@@ -598,7 +599,7 @@ int siw_proc_write(struct siw_qp *qp) ...@@ -598,7 +599,7 @@ int siw_proc_write(struct siw_qp *qp)
if (mem->mem_obj == NULL) if (mem->mem_obj == NULL)
rv = siw_rx_kva(srx, rv = siw_rx_kva(srx,
(void *)(srx->ddp_to + srx->fpdu_part_rcvd), (void *)(uintptr_t)(srx->ddp_to + srx->fpdu_part_rcvd),
bytes); bytes);
else if (!mem->is_pbl) else if (!mem->is_pbl)
rv = siw_rx_umem(srx, mem->umem, rv = siw_rx_umem(srx, mem->umem,
...@@ -841,7 +842,8 @@ int siw_proc_rresp(struct siw_qp *qp) ...@@ -841,7 +842,8 @@ int siw_proc_rresp(struct siw_qp *qp)
bytes = min(srx->fpdu_part_rem, srx->skb_new); bytes = min(srx->fpdu_part_rem, srx->skb_new);
if (mem_p->mem_obj == NULL) if (mem_p->mem_obj == NULL)
rv = siw_rx_kva(srx, (void *)(sge->laddr + wqe->processed), rv = siw_rx_kva(srx,
(void *)(uintptr_t)(sge->laddr + wqe->processed),
bytes); bytes);
else if (!mem_p->is_pbl) else if (!mem_p->is_pbl)
rv = siw_rx_umem(srx, mem_p->umem, sge->laddr + wqe->processed, rv = siw_rx_umem(srx, mem_p->umem, sge->laddr + wqe->processed,
......
...@@ -26,7 +26,7 @@ static struct page *siw_get_pblpage(struct siw_mem *mem, u64 addr, int *idx) ...@@ -26,7 +26,7 @@ static struct page *siw_get_pblpage(struct siw_mem *mem, u64 addr, int *idx)
{ {
struct siw_pbl *pbl = mem->pbl; struct siw_pbl *pbl = mem->pbl;
u64 offset = addr - mem->va; u64 offset = addr - mem->va;
u64 paddr = siw_pbl_get_buffer(pbl, offset, NULL, idx); dma_addr_t paddr = siw_pbl_get_buffer(pbl, offset, NULL, idx);
if (paddr) if (paddr)
return virt_to_page(paddr); return virt_to_page(paddr);
...@@ -37,7 +37,7 @@ static struct page *siw_get_pblpage(struct siw_mem *mem, u64 addr, int *idx) ...@@ -37,7 +37,7 @@ static struct page *siw_get_pblpage(struct siw_mem *mem, u64 addr, int *idx)
/* /*
* Copy short payload at provided destination payload address * Copy short payload at provided destination payload address
*/ */
static int siw_try_1seg(struct siw_iwarp_tx *c_tx, u64 paddr) static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
{ {
struct siw_wqe *wqe = &c_tx->wqe_active; struct siw_wqe *wqe = &c_tx->wqe_active;
struct siw_sge *sge = &wqe->sqe.sge[0]; struct siw_sge *sge = &wqe->sqe.sge[0];
...@@ -50,16 +50,16 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, u64 paddr) ...@@ -50,16 +50,16 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, u64 paddr)
return 0; return 0;
if (tx_flags(wqe) & SIW_WQE_INLINE) { if (tx_flags(wqe) & SIW_WQE_INLINE) {
memcpy((void *)paddr, &wqe->sqe.sge[1], bytes); memcpy(paddr, &wqe->sqe.sge[1], bytes);
} else { } else {
struct siw_mem *mem = wqe->mem[0]; struct siw_mem *mem = wqe->mem[0];
if (!mem->mem_obj) { if (!mem->mem_obj) {
/* Kernel client using kva */ /* Kernel client using kva */
memcpy((void *)paddr, (void *)sge->laddr, bytes); memcpy(paddr,
(const void *)(uintptr_t)sge->laddr, bytes);
} else if (c_tx->in_syscall) { } else if (c_tx->in_syscall) {
if (copy_from_user((void *)paddr, if (copy_from_user(paddr, u64_to_user_ptr(sge->laddr),
(const void __user *)sge->laddr,
bytes)) bytes))
return -EFAULT; return -EFAULT;
} else { } else {
...@@ -79,12 +79,12 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, u64 paddr) ...@@ -79,12 +79,12 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, u64 paddr)
buffer = kmap_atomic(p); buffer = kmap_atomic(p);
if (likely(PAGE_SIZE - off >= bytes)) { if (likely(PAGE_SIZE - off >= bytes)) {
memcpy((void *)paddr, buffer + off, bytes); memcpy(paddr, buffer + off, bytes);
kunmap_atomic(buffer); kunmap_atomic(buffer);
} else { } else {
unsigned long part = bytes - (PAGE_SIZE - off); unsigned long part = bytes - (PAGE_SIZE - off);
memcpy((void *)paddr, buffer + off, part); memcpy(paddr, buffer + off, part);
kunmap_atomic(buffer); kunmap_atomic(buffer);
if (!mem->is_pbl) if (!mem->is_pbl)
...@@ -98,7 +98,7 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, u64 paddr) ...@@ -98,7 +98,7 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, u64 paddr)
return -EFAULT; return -EFAULT;
buffer = kmap_atomic(p); buffer = kmap_atomic(p);
memcpy((void *)(paddr + part), buffer, memcpy(paddr + part, buffer,
bytes - part); bytes - part);
kunmap_atomic(buffer); kunmap_atomic(buffer);
} }
...@@ -166,7 +166,7 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx) ...@@ -166,7 +166,7 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx)
c_tx->ctrl_len = sizeof(struct iwarp_send); c_tx->ctrl_len = sizeof(struct iwarp_send);
crc = (char *)&c_tx->pkt.send_pkt.crc; crc = (char *)&c_tx->pkt.send_pkt.crc;
data = siw_try_1seg(c_tx, (u64)crc); data = siw_try_1seg(c_tx, crc);
break; break;
case SIW_OP_SEND_REMOTE_INV: case SIW_OP_SEND_REMOTE_INV:
...@@ -189,7 +189,7 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx) ...@@ -189,7 +189,7 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx)
c_tx->ctrl_len = sizeof(struct iwarp_send_inv); c_tx->ctrl_len = sizeof(struct iwarp_send_inv);
crc = (char *)&c_tx->pkt.send_pkt.crc; crc = (char *)&c_tx->pkt.send_pkt.crc;
data = siw_try_1seg(c_tx, (u64)crc); data = siw_try_1seg(c_tx, crc);
break; break;
case SIW_OP_WRITE: case SIW_OP_WRITE:
...@@ -201,7 +201,7 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx) ...@@ -201,7 +201,7 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx)
c_tx->ctrl_len = sizeof(struct iwarp_rdma_write); c_tx->ctrl_len = sizeof(struct iwarp_rdma_write);
crc = (char *)&c_tx->pkt.write_pkt.crc; crc = (char *)&c_tx->pkt.write_pkt.crc;
data = siw_try_1seg(c_tx, (u64)crc); data = siw_try_1seg(c_tx, crc);
break; break;
case SIW_OP_READ_RESPONSE: case SIW_OP_READ_RESPONSE:
...@@ -216,7 +216,7 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx) ...@@ -216,7 +216,7 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx)
c_tx->ctrl_len = sizeof(struct iwarp_rdma_rresp); c_tx->ctrl_len = sizeof(struct iwarp_rdma_rresp);
crc = (char *)&c_tx->pkt.write_pkt.crc; crc = (char *)&c_tx->pkt.write_pkt.crc;
data = siw_try_1seg(c_tx, (u64)crc); data = siw_try_1seg(c_tx, crc);
break; break;
default: default:
...@@ -471,7 +471,8 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s) ...@@ -471,7 +471,8 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)
* tx from kernel virtual address: either inline data * tx from kernel virtual address: either inline data
* or memory region with assigned kernel buffer * or memory region with assigned kernel buffer
*/ */
iov[seg].iov_base = (void *)(sge->laddr + sge_off); iov[seg].iov_base =
(void *)(uintptr_t)(sge->laddr + sge_off);
iov[seg].iov_len = sge_len; iov[seg].iov_len = sge_len;
if (do_crc) if (do_crc)
...@@ -523,13 +524,13 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s) ...@@ -523,13 +524,13 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)
page_address(p) + fp_off, page_address(p) + fp_off,
plen); plen);
} else { } else {
u64 pa = ((sge->laddr + sge_off) & PAGE_MASK); u64 va = sge->laddr + sge_off;
page_array[seg] = virt_to_page(pa); page_array[seg] = virt_to_page(va & PAGE_MASK);
if (do_crc) if (do_crc)
crypto_shash_update( crypto_shash_update(
c_tx->mpa_crc_hd, c_tx->mpa_crc_hd,
(void *)(sge->laddr + sge_off), (void *)(uintptr_t)va,
plen); plen);
} }
...@@ -822,7 +823,8 @@ static int siw_qp_sq_proc_tx(struct siw_qp *qp, struct siw_wqe *wqe) ...@@ -822,7 +823,8 @@ static int siw_qp_sq_proc_tx(struct siw_qp *qp, struct siw_wqe *wqe)
rv = -EINVAL; rv = -EINVAL;
goto tx_error; goto tx_error;
} }
wqe->sqe.sge[0].laddr = (u64)&wqe->sqe.sge[1]; wqe->sqe.sge[0].laddr =
(u64)(uintptr_t)&wqe->sqe.sge[1];
} }
} }
wqe->wr_status = SIW_WR_INPROGRESS; wqe->wr_status = SIW_WR_INPROGRESS;
...@@ -917,7 +919,7 @@ static int siw_qp_sq_proc_tx(struct siw_qp *qp, struct siw_wqe *wqe) ...@@ -917,7 +919,7 @@ static int siw_qp_sq_proc_tx(struct siw_qp *qp, struct siw_wqe *wqe)
static int siw_fastreg_mr(struct ib_pd *pd, struct siw_sqe *sqe) static int siw_fastreg_mr(struct ib_pd *pd, struct siw_sqe *sqe)
{ {
struct ib_mr *base_mr = (struct ib_mr *)sqe->base_mr; struct ib_mr *base_mr = (struct ib_mr *)(uintptr_t)sqe->base_mr;
struct siw_device *sdev = to_siw_dev(pd->device); struct siw_device *sdev = to_siw_dev(pd->device);
struct siw_mem *mem = siw_mem_id2obj(sdev, sqe->rkey >> 8); struct siw_mem *mem = siw_mem_id2obj(sdev, sqe->rkey >> 8);
int rv = 0; int rv = 0;
...@@ -947,8 +949,7 @@ static int siw_fastreg_mr(struct ib_pd *pd, struct siw_sqe *sqe) ...@@ -947,8 +949,7 @@ static int siw_fastreg_mr(struct ib_pd *pd, struct siw_sqe *sqe)
mem->stag = sqe->rkey; mem->stag = sqe->rkey;
mem->perms = sqe->access; mem->perms = sqe->access;
siw_dbg_mem(mem, "STag now valid, MR va: 0x%016llx -> 0x%016llx\n", siw_dbg_mem(mem, "STag 0x%08x now valid\n", sqe->rkey);
mem->va, base_mr->iova);
mem->va = base_mr->iova; mem->va = base_mr->iova;
mem->stag_valid = 1; mem->stag_valid = 1;
out: out:
......
...@@ -424,8 +424,7 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd, ...@@ -424,8 +424,7 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
*/ */
qp->srq = to_siw_srq(attrs->srq); qp->srq = to_siw_srq(attrs->srq);
qp->attrs.rq_size = 0; qp->attrs.rq_size = 0;
siw_dbg(base_dev, "QP [%u]: [SRQ 0x%p] attached\n", siw_dbg(base_dev, "QP [%u]: SRQ attached\n", qp->qp_num);
qp->qp_num, qp->srq);
} else if (num_rqe) { } else if (num_rqe) {
if (qp->kernel_verbs) if (qp->kernel_verbs)
qp->recvq = vzalloc(num_rqe * sizeof(struct siw_rqe)); qp->recvq = vzalloc(num_rqe * sizeof(struct siw_rqe));
...@@ -610,7 +609,7 @@ int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata) ...@@ -610,7 +609,7 @@ int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata)
base_ucontext); base_ucontext);
struct siw_qp_attrs qp_attrs; struct siw_qp_attrs qp_attrs;
siw_dbg_qp(qp, "state %d, cep 0x%p\n", qp->attrs.state, qp->cep); siw_dbg_qp(qp, "state %d\n", qp->attrs.state);
/* /*
* Mark QP as in process of destruction to prevent from * Mark QP as in process of destruction to prevent from
...@@ -662,7 +661,7 @@ static int siw_copy_inline_sgl(const struct ib_send_wr *core_wr, ...@@ -662,7 +661,7 @@ static int siw_copy_inline_sgl(const struct ib_send_wr *core_wr,
void *kbuf = &sqe->sge[1]; void *kbuf = &sqe->sge[1];
int num_sge = core_wr->num_sge, bytes = 0; int num_sge = core_wr->num_sge, bytes = 0;
sqe->sge[0].laddr = (u64)kbuf; sqe->sge[0].laddr = (uintptr_t)kbuf;
sqe->sge[0].lkey = 0; sqe->sge[0].lkey = 0;
while (num_sge--) { while (num_sge--) {
...@@ -825,7 +824,7 @@ int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr, ...@@ -825,7 +824,7 @@ int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr,
break; break;
case IB_WR_REG_MR: case IB_WR_REG_MR:
sqe->base_mr = (uint64_t)reg_wr(wr)->mr; sqe->base_mr = (uintptr_t)reg_wr(wr)->mr;
sqe->rkey = reg_wr(wr)->key; sqe->rkey = reg_wr(wr)->key;
sqe->access = reg_wr(wr)->access & IWARP_ACCESS_MASK; sqe->access = reg_wr(wr)->access & IWARP_ACCESS_MASK;
sqe->opcode = SIW_OP_REG_MR; sqe->opcode = SIW_OP_REG_MR;
...@@ -842,8 +841,9 @@ int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr, ...@@ -842,8 +841,9 @@ int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr,
rv = -EINVAL; rv = -EINVAL;
break; break;
} }
siw_dbg_qp(qp, "opcode %d, flags 0x%x, wr_id 0x%p\n", siw_dbg_qp(qp, "opcode %d, flags 0x%x, wr_id 0x%pK\n",
sqe->opcode, sqe->flags, (void *)sqe->id); sqe->opcode, sqe->flags,
(void *)(uintptr_t)sqe->id);
if (unlikely(rv < 0)) if (unlikely(rv < 0))
break; break;
...@@ -1205,8 +1205,8 @@ struct ib_mr *siw_reg_user_mr(struct ib_pd *pd, u64 start, u64 len, ...@@ -1205,8 +1205,8 @@ struct ib_mr *siw_reg_user_mr(struct ib_pd *pd, u64 start, u64 len,
unsigned long mem_limit = rlimit(RLIMIT_MEMLOCK); unsigned long mem_limit = rlimit(RLIMIT_MEMLOCK);
int rv; int rv;
siw_dbg_pd(pd, "start: 0x%016llx, va: 0x%016llx, len: %llu\n", siw_dbg_pd(pd, "start: 0x%pK, va: 0x%pK, len: %llu\n",
(unsigned long long)start, (unsigned long long)rnic_va, (void *)(uintptr_t)start, (void *)(uintptr_t)rnic_va,
(unsigned long long)len); (unsigned long long)len);
if (atomic_inc_return(&sdev->num_mr) > SIW_MAX_MR) { if (atomic_inc_return(&sdev->num_mr) > SIW_MAX_MR) {
...@@ -1363,7 +1363,7 @@ int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle, ...@@ -1363,7 +1363,7 @@ int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle,
struct siw_mem *mem = mr->mem; struct siw_mem *mem = mr->mem;
struct siw_pbl *pbl = mem->pbl; struct siw_pbl *pbl = mem->pbl;
struct siw_pble *pble; struct siw_pble *pble;
u64 pbl_size; unsigned long pbl_size;
int i, rv; int i, rv;
if (!pbl) { if (!pbl) {
...@@ -1402,16 +1402,18 @@ int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle, ...@@ -1402,16 +1402,18 @@ int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle,
pbl_size += sg_dma_len(slp); pbl_size += sg_dma_len(slp);
} }
siw_dbg_mem(mem, siw_dbg_mem(mem,
"sge[%d], size %llu, addr 0x%016llx, total %llu\n", "sge[%d], size %u, addr 0x%p, total %lu\n",
i, pble->size, pble->addr, pbl_size); i, pble->size, (void *)(uintptr_t)pble->addr,
pbl_size);
} }
rv = ib_sg_to_pages(base_mr, sl, num_sle, sg_off, siw_set_pbl_page); rv = ib_sg_to_pages(base_mr, sl, num_sle, sg_off, siw_set_pbl_page);
if (rv > 0) { if (rv > 0) {
mem->len = base_mr->length; mem->len = base_mr->length;
mem->va = base_mr->iova; mem->va = base_mr->iova;
siw_dbg_mem(mem, siw_dbg_mem(mem,
"%llu bytes, start 0x%016llx, %u SLE to %u entries\n", "%llu bytes, start 0x%pK, %u SLE to %u entries\n",
mem->len, mem->va, num_sle, pbl->num_buf); mem->len, (void *)(uintptr_t)mem->va, num_sle,
pbl->num_buf);
} }
return rv; return rv;
} }
...@@ -1529,7 +1531,7 @@ int siw_create_srq(struct ib_srq *base_srq, ...@@ -1529,7 +1531,7 @@ int siw_create_srq(struct ib_srq *base_srq,
} }
spin_lock_init(&srq->lock); spin_lock_init(&srq->lock);
siw_dbg_pd(base_srq->pd, "[SRQ 0x%p]: success\n", srq); siw_dbg_pd(base_srq->pd, "[SRQ]: success\n");
return 0; return 0;
...@@ -1650,8 +1652,7 @@ int siw_post_srq_recv(struct ib_srq *base_srq, const struct ib_recv_wr *wr, ...@@ -1650,8 +1652,7 @@ int siw_post_srq_recv(struct ib_srq *base_srq, const struct ib_recv_wr *wr,
if (unlikely(!srq->kernel_verbs)) { if (unlikely(!srq->kernel_verbs)) {
siw_dbg_pd(base_srq->pd, siw_dbg_pd(base_srq->pd,
"[SRQ 0x%p]: no kernel post_recv for mapped srq\n", "[SRQ]: no kernel post_recv for mapped srq\n");
srq);
rv = -EINVAL; rv = -EINVAL;
goto out; goto out;
} }
...@@ -1673,8 +1674,7 @@ int siw_post_srq_recv(struct ib_srq *base_srq, const struct ib_recv_wr *wr, ...@@ -1673,8 +1674,7 @@ int siw_post_srq_recv(struct ib_srq *base_srq, const struct ib_recv_wr *wr,
} }
if (unlikely(wr->num_sge > srq->max_sge)) { if (unlikely(wr->num_sge > srq->max_sge)) {
siw_dbg_pd(base_srq->pd, siw_dbg_pd(base_srq->pd,
"[SRQ 0x%p]: too many sge's: %d\n", srq, "[SRQ]: too many sge's: %d\n", wr->num_sge);
wr->num_sge);
rv = -EINVAL; rv = -EINVAL;
break; break;
} }
...@@ -1693,7 +1693,7 @@ int siw_post_srq_recv(struct ib_srq *base_srq, const struct ib_recv_wr *wr, ...@@ -1693,7 +1693,7 @@ int siw_post_srq_recv(struct ib_srq *base_srq, const struct ib_recv_wr *wr,
spin_unlock_irqrestore(&srq->lock, flags); spin_unlock_irqrestore(&srq->lock, flags);
out: out:
if (unlikely(rv < 0)) { if (unlikely(rv < 0)) {
siw_dbg_pd(base_srq->pd, "[SRQ 0x%p]: error %d\n", srq, rv); siw_dbg_pd(base_srq->pd, "[SRQ]: error %d\n", rv);
*bad_wr = wr; *bad_wr = wr;
} }
return rv; return rv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment