From: Bart Van Assche <Bart.VanAssche-Sjgp3cTcYWE@public.gmane.org>
To: "jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org"
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
<leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH v2 rdma-core 4/8] mlx5: Avoid sparse complaints about !!
Date: Thu, 20 Jul 2017 17:23:32 +0000 [thread overview]
Message-ID: <1500571411.3181.4.camel@wdc.com> (raw)
In-Reply-To: <1500570064-11712-5-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
On Thu, 2017-07-20 at 11:01 -0600, Jason Gunthorpe wrote:
> Sparse says:
> warning: dubious: !x & y
>
> Unclear why sparse thinks this is bad, but casting to C99 bool is the
> same as !! and much easier to read.
>
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> ---
> providers/mlx5/cq.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/providers/mlx5/cq.c b/providers/mlx5/cq.c
> index 500116133c1f9e..9a8d958a9ced68 100644
> --- a/providers/mlx5/cq.c
> +++ b/providers/mlx5/cq.c
> @@ -206,11 +206,12 @@ static inline int handle_responder(struct ibv_wc *wc, struct mlx5_cqe64 *cqe,
> if (likely(cur_rsc->type == MLX5_RSC_TYPE_QP)) {
> wq = &qp->rq;
> if (qp->qp_cap_cache & MLX5_RX_CSUM_VALID)
> - wc->wc_flags |= (!!(cqe->hds_ip_ext & MLX5_CQE_L4_OK) &
> - !!(cqe->hds_ip_ext & MLX5_CQE_L3_OK) &
> - (get_cqe_l3_hdr_type(cqe) ==
> - MLX5_CQE_L3_HDR_TYPE_IPV4)) <<
> - IBV_WC_IP_CSUM_OK_SHIFT;
> + wc->wc_flags |=
> + ((bool)(cqe->hds_ip_ext & MLX5_CQE_L4_OK) &
> + (bool)(cqe->hds_ip_ext & MLX5_CQE_L3_OK) &
> + (get_cqe_l3_hdr_type(cqe) ==
> + MLX5_CQE_L3_HDR_TYPE_IPV4))
> + << IBV_WC_IP_CSUM_OK_SHIFT;
> } else {
> wq = &(rsc_to_mrwq(cur_rsc)->rq);
> }
> @@ -1105,11 +1106,11 @@ static inline int mlx5_cq_read_wc_flags(struct ibv_cq_ex *ibcq)
> int wc_flags = 0;
>
> if (cq->flags & MLX5_CQ_FLAGS_RX_CSUM_VALID)
> - wc_flags = (!!(cq->cqe64->hds_ip_ext & MLX5_CQE_L4_OK) &
> - !!(cq->cqe64->hds_ip_ext & MLX5_CQE_L3_OK) &
> - (get_cqe_l3_hdr_type(cq->cqe64) ==
> - MLX5_CQE_L3_HDR_TYPE_IPV4)) <<
> - IBV_WC_IP_CSUM_OK_SHIFT;
> + wc_flags = ((bool)(cq->cqe64->hds_ip_ext & MLX5_CQE_L4_OK) &
> + (bool)(cq->cqe64->hds_ip_ext & MLX5_CQE_L3_OK) &
> + (get_cqe_l3_hdr_type(cq->cqe64) ==
> + MLX5_CQE_L3_HDR_TYPE_IPV4))
> + << IBV_WC_IP_CSUM_OK_SHIFT;
>
> switch (mlx5dv_get_cqe_opcode(cq->cqe64)) {
> case MLX5_CQE_RESP_WR_IMM:
Hello Jason,
Since patches 4 and 5 touch the same code: shouldn't these two patches
be squashed into a single patch?
Thanks,
Bart.--
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
next prev parent reply other threads:[~2017-07-20 17:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 17:00 [PATCH v2 rdma-core 0/8] Sparse updates for Mellanox and vmw_pvrdma providers Jason Gunthorpe
[not found] ` <1500570064-11712-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-20 17:00 ` [PATCH v2 rdma-core 1/8] verbs: Annotate ibv_wc helpers with endian Jason Gunthorpe
2017-07-20 17:00 ` [PATCH v2 rdma-core 2/8] verbs: Annotate ibv_send_wr " Jason Gunthorpe
2017-07-20 17:00 ` [PATCH v2 rdma-core 3/8] mlx4: Add sparse annotations Jason Gunthorpe
2017-07-20 17:01 ` [PATCH v2 rdma-core 4/8] mlx5: Avoid sparse complaints about !! Jason Gunthorpe
[not found] ` <1500570064-11712-5-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-07-20 17:23 ` Bart Van Assche [this message]
[not found] ` <1500571411.3181.4.camel-Sjgp3cTcYWE@public.gmane.org>
2017-07-20 17:36 ` Jason Gunthorpe
2017-07-20 17:01 ` [PATCH v2 rdma-core 5/8] mlx5: Add sparse annotations Jason Gunthorpe
2017-07-20 17:01 ` [PATCH v2 rdma-core 6/8] mthca: " Jason Gunthorpe
2017-07-20 17:01 ` [PATCH v2 rdma-core 7/8] vmw_pvrdma: Update kernel header Jason Gunthorpe
2017-07-20 17:01 ` [PATCH v2 rdma-core 8/8] vmw_pvrdma: Add sparse annotations Jason Gunthorpe
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=1500571411.3181.4.camel@wdc.com \
--to=bart.vanassche-sjgp3ctcywe@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).