* [PATCH rdma-core 1/6] rxe: Use libc's IN6_IS_ADDR_V4MAPPED
[not found] ` <1491518545-14746-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-04-06 22:42 ` Jason Gunthorpe
2017-04-06 22:42 ` [PATCH rdma-core 2/6] ipath/hfi: Enable sparse from travis Jason Gunthorpe
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jason Gunthorpe @ 2017-04-06 22:42 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Moni Shoua
Instead of the open coded version, makes sparse work.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 4 ++--
providers/rxe/rxe.c | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a05c3602bca2d..e5074f6e100637 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -392,8 +392,8 @@ endif()
add_subdirectory(providers/hfi1verbs) # NO SPARSE
add_subdirectory(providers/ipathverbs) # NO SPARSE
-add_subdirectory(providers/rxe) # NO SPARSE
-add_subdirectory(providers/rxe/man) # NO SPARSE
+add_subdirectory(providers/rxe)
+add_subdirectory(providers/rxe/man)
# Binaries
add_subdirectory(ibacm) # NO SPARSE
diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c
index 438f7c30505dd1..775caf0e185148 100644
--- a/providers/rxe/rxe.c
+++ b/providers/rxe/rxe.c
@@ -753,8 +753,7 @@ static int rxe_post_recv(struct ibv_qp *ibqp,
static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
{
- return ((unsigned long)(a->s6_addr32[0] | a->s6_addr32[1]) |
- (unsigned long)(a->s6_addr32[2] ^ htobe32(0x0000ffff))) == 0UL;
+ return IN6_IS_ADDR_V4MAPPED(a);
}
static inline int rdma_gid2ip(struct sockaddr *out, union ibv_gid *gid)
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH rdma-core 2/6] ipath/hfi: Enable sparse from travis
[not found] ` <1491518545-14746-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-06 22:42 ` [PATCH rdma-core 1/6] rxe: Use libc's IN6_IS_ADDR_V4MAPPED Jason Gunthorpe
@ 2017-04-06 22:42 ` Jason Gunthorpe
2017-04-06 22:42 ` [PATCH rdma-core 3/6] ocrdma: Fix missing endian swap in debug print Jason Gunthorpe
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jason Gunthorpe @ 2017-04-06 22:42 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
These are clean now.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e5074f6e100637..77f46eed0f4422 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -390,8 +390,8 @@ add_subdirectory(providers/qedr) # NO SPARSE
add_subdirectory(providers/vmw_pvrdma) # NO SPARSE
endif()
-add_subdirectory(providers/hfi1verbs) # NO SPARSE
-add_subdirectory(providers/ipathverbs) # NO SPARSE
+add_subdirectory(providers/hfi1verbs)
+add_subdirectory(providers/ipathverbs)
add_subdirectory(providers/rxe)
add_subdirectory(providers/rxe/man)
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH rdma-core 3/6] ocrdma: Fix missing endian swap in debug print
[not found] ` <1491518545-14746-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-06 22:42 ` [PATCH rdma-core 1/6] rxe: Use libc's IN6_IS_ADDR_V4MAPPED Jason Gunthorpe
2017-04-06 22:42 ` [PATCH rdma-core 2/6] ipath/hfi: Enable sparse from travis Jason Gunthorpe
@ 2017-04-06 22:42 ` Jason Gunthorpe
2017-04-06 22:42 ` [PATCH rdma-core 4/6] ocrdma: Add sparse annotations Jason Gunthorpe
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jason Gunthorpe @ 2017-04-06 22:42 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Devesh Sharma
'cw' is little endian in this context. Found by sparse.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
providers/ocrdma/ocrdma_verbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/providers/ocrdma/ocrdma_verbs.c b/providers/ocrdma/ocrdma_verbs.c
index f9de29d68099a6..7aa5499626249a 100644
--- a/providers/ocrdma/ocrdma_verbs.c
+++ b/providers/ocrdma/ocrdma_verbs.c
@@ -1610,7 +1610,7 @@ static void ocrdma_update_wc(struct ocrdma_qp *qp, struct ibv_wc *ibwc,
default:
ibwc->status = IBV_WC_GENERAL_ERR;
ocrdma_err("%s() invalid opcode received = 0x%x\n",
- __func__, hdr->cw & OCRDMA_WQE_OPCODE_MASK);
+ __func__, le32toh(hdr->cw) & OCRDMA_WQE_OPCODE_MASK);
break;
};
}
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH rdma-core 4/6] ocrdma: Add sparse annotations
[not found] ` <1491518545-14746-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (2 preceding siblings ...)
2017-04-06 22:42 ` [PATCH rdma-core 3/6] ocrdma: Fix missing endian swap in debug print Jason Gunthorpe
@ 2017-04-06 22:42 ` Jason Gunthorpe
2017-04-06 22:42 ` [PATCH rdma-core 5/6] mlx4: Fix incorrect masking of g_mlpath_rqpn Jason Gunthorpe
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jason Gunthorpe @ 2017-04-06 22:42 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Devesh Sharma
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 2 +-
providers/ocrdma/ocrdma_abi.h | 39 ++++++++++++++++++++++++++-------------
providers/ocrdma/ocrdma_verbs.c | 20 ++++++++++----------
3 files changed, 37 insertions(+), 24 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77f46eed0f4422..1ff3189c9d295e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -385,7 +385,7 @@ add_subdirectory(providers/mlx5) # NO SPARSE
add_subdirectory(providers/mlx5/man) # NO SPARSE
add_subdirectory(providers/mthca) # NO SPARSE
add_subdirectory(providers/nes) # NO SPARSE
-add_subdirectory(providers/ocrdma) # NO SPARSE
+add_subdirectory(providers/ocrdma)
add_subdirectory(providers/qedr) # NO SPARSE
add_subdirectory(providers/vmw_pvrdma) # NO SPARSE
endif()
diff --git a/providers/ocrdma/ocrdma_abi.h b/providers/ocrdma/ocrdma_abi.h
index 8156458131238a..e43e30aa7817d0 100644
--- a/providers/ocrdma/ocrdma_abi.h
+++ b/providers/ocrdma/ocrdma_abi.h
@@ -242,27 +242,27 @@ struct ocrdma_cqe {
union {
/* w0 to w2 */
struct {
- uint32_t wqeidx;
- uint32_t bytes_xfered;
- uint32_t qpn;
+ __le32 wqeidx;
+ __le32 bytes_xfered;
+ __le32 qpn;
} wq;
struct {
- uint32_t lkey_immdt;
- uint32_t rxlen;
- uint32_t buftag_qpn;
+ __le32 lkey_immdt;
+ __le32 rxlen;
+ __le32 buftag_qpn;
} rq;
struct {
- uint32_t lkey_immdt;
- uint32_t rxlen_pkey;
- uint32_t buftag_qpn;
+ __le32 lkey_immdt;
+ __le32 rxlen_pkey;
+ __le32 buftag_qpn;
} ud;
struct {
- uint32_t word_0;
- uint32_t word_1;
- uint32_t qpn;
+ __le32 word_0;
+ __le32 word_1;
+ __le32 qpn;
} cmn;
};
- uint32_t flags_status_srcqpn; /* w3 */
+ __le32 flags_status_srcqpn; /* w3 */
} __attribute__ ((packed));
struct ocrdma_sge {
@@ -335,6 +335,19 @@ struct ocrdma_hdr_wqe {
uint32_t total_len;
} __attribute__ ((packed));
+struct ocrdma_hdr_wqe_le {
+ __le32 cw;
+ union {
+ __le32 rsvd_tag;
+ __le32 rsvd_stag_flags;
+ };
+ union {
+ __le32 immdt;
+ __le32 lkey;
+ };
+ __le32 total_len;
+} __attribute__ ((packed));
+
struct ocrdma_ewqe_atomic {
uint32_t ra_hi;
uint32_t ra_lo;
diff --git a/providers/ocrdma/ocrdma_verbs.c b/providers/ocrdma/ocrdma_verbs.c
index 7aa5499626249a..6f140c33dbe509 100644
--- a/providers/ocrdma/ocrdma_verbs.c
+++ b/providers/ocrdma/ocrdma_verbs.c
@@ -59,7 +59,7 @@ static void ocrdma_ring_cq_db(struct ocrdma_cq *cq, uint32_t armed,
static inline void ocrdma_swap_cpu_to_le(void *dst, uint32_t len)
{
int i = 0;
- uint32_t *src_ptr = dst;
+ __le32 *src_ptr = dst;
uint32_t *dst_ptr = dst;
for (; i < (len / 4); i++)
*dst_ptr++ = le32toh(*src_ptr++);
@@ -1099,26 +1099,26 @@ int ocrdma_destroy_qp(struct ibv_qp *ibqp)
static void ocrdma_ring_sq_db(struct ocrdma_qp *qp)
{
- uint32_t db_val = htole32((qp->sq.dbid | (1 << 16)));
+ __le32 db_val = htole32((qp->sq.dbid | (1 << 16)));
udma_to_device_barrier();
- *(uint32_t *) (((uint8_t *) qp->db_sq_va)) = db_val;
+ *(__le32 *) (((uint8_t *) qp->db_sq_va)) = db_val;
}
static void ocrdma_ring_rq_db(struct ocrdma_qp *qp)
{
- uint32_t db_val = htole32((qp->rq.dbid | (1 << qp->db_shift)));
+ __le32 db_val = htole32((qp->rq.dbid | (1 << qp->db_shift)));
udma_to_device_barrier();
- *(uint32_t *) ((uint8_t *) qp->db_rq_va) = db_val;
+ *(__le32 *) ((uint8_t *) qp->db_rq_va) = db_val;
}
static void ocrdma_ring_srq_db(struct ocrdma_srq *srq)
{
- uint32_t db_val = htole32(srq->rq.dbid | (1 << srq->db_shift));
+ __le32 db_val = htole32(srq->rq.dbid | (1 << srq->db_shift));
udma_to_device_barrier();
- *(uint32_t *) (srq->db_va) = db_val;
+ *(__le32 *) (srq->db_va) = db_val;
}
static void ocrdma_ring_cq_db(struct ocrdma_cq *cq, uint32_t armed,
@@ -1137,7 +1137,7 @@ static void ocrdma_ring_cq_db(struct ocrdma_cq *cq, uint32_t armed,
val |= (num_cqe << OCRDMA_DB_CQ_NUM_POPPED_SHIFT);
udma_to_device_barrier();
- *(uint32_t *) ((uint8_t *) (cq->db_va) + OCRDMA_DB_CQ_OFFSET) =
+ *(__le32 *) ((uint8_t *) (cq->db_va) + OCRDMA_DB_CQ_OFFSET) =
htole32(val);
}
@@ -1323,7 +1323,7 @@ static void ocrdma_build_dpp_wqe(void *va, struct ocrdma_hdr_wqe *wqe,
/* convert WQE header to LE format */
for (; i < hdr_len; i++)
- *((uint32_t *) va + i) =
+ *((__le32 *) va + i) =
htole32(*((uint32_t *) wqe + i));
/* Convertion of data is done in HW */
for (; i < pyld_len; i++)
@@ -1585,7 +1585,7 @@ static enum ibv_wc_status ocrdma_to_ibwc_err(uint16_t status)
static void ocrdma_update_wc(struct ocrdma_qp *qp, struct ibv_wc *ibwc,
uint32_t wqe_idx)
{
- struct ocrdma_hdr_wqe *hdr;
+ struct ocrdma_hdr_wqe_le *hdr;
struct ocrdma_sge *rw;
int opcode;
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH rdma-core 5/6] mlx4: Fix incorrect masking of g_mlpath_rqpn
[not found] ` <1491518545-14746-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (3 preceding siblings ...)
2017-04-06 22:42 ` [PATCH rdma-core 4/6] ocrdma: Add sparse annotations Jason Gunthorpe
@ 2017-04-06 22:42 ` Jason Gunthorpe
2017-04-06 22:42 ` [PATCH rdma-core 6/6] mlx4: Fix typo in byte swap direction Jason Gunthorpe
2017-04-07 16:40 ` [PATCH rdma-core 0/6] More sparse cleanup Doug Ledford
6 siblings, 0 replies; 8+ messages in thread
From: Jason Gunthorpe @ 2017-04-06 22:42 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Yishai Hadas
Two other places do this math and consensus is that MLX4_CQE_QPN_MASK
is in host endian, so this math is wrong. Found by sparse.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
providers/mlx4/cq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/providers/mlx4/cq.c b/providers/mlx4/cq.c
index 01d103d983eb4d..844e4da1305c63 100644
--- a/providers/mlx4/cq.c
+++ b/providers/mlx4/cq.c
@@ -739,7 +739,7 @@ void __mlx4_cq_clean(struct mlx4_cq *cq, uint32_t qpn, struct mlx4_srq *srq)
cqe = get_cqe(cq, prod_index & cq->ibv_cq.cqe);
cqe += cqe_inc;
if (srq && srq->ext_srq &&
- be32toh(cqe->g_mlpath_rqpn & MLX4_CQE_QPN_MASK) == srq->verbs_srq.srq_num &&
+ (be32toh(cqe->g_mlpath_rqpn) & MLX4_CQE_QPN_MASK) == srq->verbs_srq.srq_num &&
!(cqe->owner_sr_opcode & MLX4_CQE_IS_SEND_MASK)) {
mlx4_free_srq_wqe(srq, be16toh(cqe->wqe_index));
++nfreed;
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH rdma-core 6/6] mlx4: Fix typo in byte swap direction
[not found] ` <1491518545-14746-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (4 preceding siblings ...)
2017-04-06 22:42 ` [PATCH rdma-core 5/6] mlx4: Fix incorrect masking of g_mlpath_rqpn Jason Gunthorpe
@ 2017-04-06 22:42 ` Jason Gunthorpe
2017-04-07 16:40 ` [PATCH rdma-core 0/6] More sparse cleanup Doug Ledford
6 siblings, 0 replies; 8+ messages in thread
From: Jason Gunthorpe @ 2017-04-06 22:42 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Yishai Hadas
The two macros are identical, but sparse notices.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
providers/mlx4/cq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/providers/mlx4/cq.c b/providers/mlx4/cq.c
index 844e4da1305c63..f0a47ae374a689 100644
--- a/providers/mlx4/cq.c
+++ b/providers/mlx4/cq.c
@@ -294,7 +294,7 @@ static inline int mlx4_parse_cqe(struct mlx4_cq *cq,
*pwr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)];
++wq->tail;
} else if (srq) {
- wqe_index = htobe16(cqe->wqe_index);
+ wqe_index = be16toh(cqe->wqe_index);
*pwr_id = srq->wrid[wqe_index];
mlx4_free_srq_wqe(srq, wqe_index);
} else {
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH rdma-core 0/6] More sparse cleanup
[not found] ` <1491518545-14746-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (5 preceding siblings ...)
2017-04-06 22:42 ` [PATCH rdma-core 6/6] mlx4: Fix typo in byte swap direction Jason Gunthorpe
@ 2017-04-07 16:40 ` Doug Ledford
6 siblings, 0 replies; 8+ messages in thread
From: Doug Ledford @ 2017-04-07 16:40 UTC (permalink / raw)
To: Jason Gunthorpe, linux-rdma-u79uwXL29TY76Z2rM5mHXA
On Thu, 2017-04-06 at 16:42 -0600, Jason Gunthorpe wrote:
> Have rxe, ipath, hfi1 and ocrdma enable sparse in travis.
>
> The bug sparse noticed in mlx4 sure looks legit and odd it has
> remained
> undetected for so long.
>
> Jason Gunthorpe (6):
> rxe: Use libc's IN6_IS_ADDR_V4MAPPED
> ipath/hfi: Enable sparse from travis
> ocrdma: Fix missing endian swap in debug print
> ocrdma: Add sparse annotations
> mlx4: Fix incorrect masking of g_mlpath_rqpn
> mlx4: Fix typo in byte swap direction
>
> CMakeLists.txt | 10 +++++-----
> providers/mlx4/cq.c | 4 ++--
> providers/ocrdma/ocrdma_abi.h | 39 ++++++++++++++++++++++++++-----
> --------
> providers/ocrdma/ocrdma_verbs.c | 22 +++++++++++-----------
> providers/rxe/rxe.c | 3 +--
> 5 files changed, 45 insertions(+), 33 deletions(-)
Thanks, applied.
--
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
GPG KeyID: B826A3330E572FDD
Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread