Re: [PATCH for-next 3/6] IB/hfi1: Optimize packet type comparison using 9B and bypass code paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 01, 2018 at 10:46:23AM -0800, Dennis Dalessandro wrote:
>  
> +static inline bool opa_bth_is_migration(struct ib_other_headers *ohdr)
> +{
> +	return !!(ohdr->bth[1] & cpu_to_be32(OPA_BTH_MIG_REQ));
> +}
> +
>  extern const enum ib_wc_opcode ib_hfi1_wc_opcode[];
>  
>  extern const u8 hdr_len_by_opcode[];
> diff --git a/include/rdma/ib_hdrs.h b/include/rdma/ib_hdrs.h
> index 6a86d14..2aa19ec 100644
> +++ b/include/rdma/ib_hdrs.h
> @@ -335,4 +335,9 @@ static inline bool ib_bth_is_solicited(struct ib_other_headers *ohdr)
>  {
>  	return !!(ohdr->bth[0] & cpu_to_be32(IB_BTH_SOLICITED));
>  }
> +
> +static inline bool ib_bth_is_migration(struct ib_other_headers *ohdr)
> +{
> +	return !!(ohdr->bth[0] & cpu_to_be32(IB_BTH_MIG_REQ));
> +}
>  #endif                          /* IB_HDRS_H */

No on the !! - the cast to 'bool' causes the compiler to do this
automatically and is clearer. This is why we have 'bool'

I fixed the patch for you, please send another patch to get rid of the
other !! in boolean contexts I saw in this code.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux