Re: [PATCH rdma-core 06/11] libbnxtre: convert cpu to le all over the place

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

 



On Sat, Jan 28, 2017 at 05:13:37PM -0500, Devesh Sharma wrote:

> +/* Memory byte order conversion functions. */
> +#if __BYTE_ORDER == __BIG_ENDIAN

No reason for this ifdef

> +static inline int bnxt_re_host_to_le64(uint64_t *src, int bytes)
> +{
> +	int qwords, indx;
> +
> +	if (!bytes || bytes < 8)
> +		return -EINVAL;
> +
> +	qwords = bytes / sizeof(uint64_t);
> +	for (indx = 0; indx < qwords; indx++) {
> +		if (*(src + indx))
> +			*(src + indx) = htole64(*(src + indx));
> +	}
> +
> +	return qwords;
> +}
> +
> +static inline int bnxt_re_le64_to_host(uint64_t *src, int bytes)
> +{
> +	int qwords, indx;
> +
> +	if (!bytes || bytes < 8)
> +		return -EINVAL;
> +
> +	qwords = bytes / sizeof(uint64_t);
> +	for (indx = 0; indx < qwords; indx++) {
> +		if (*(src + indx))
> +			*(src + indx) = le64toh(*(src + indx));
> +	}
> +
> +	return qwords;
> +}
> +#else
> +static inline int bnxt_re_host_to_le64(uint64_t *src, int bytes)
> +{
> +	return 0;
> +}
> +
> +static inline int bnxt_re_le64_to_host(uint64_t *src, int bytes)
> +{
> +	return 0;
> +}

And your alts look broken anyhow. Just use the first version, gcc will
optimize it properly..

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