[dpdk-dev] [PATCH v4 10/23] rte_mbuf.h: make sure RTE-MIN compares same types

Bruce Richardson bruce.richardson at intel.com
Thu May 17 12:49:58 CEST 2018


On Mon, May 14, 2018 at 01:10:17PM +0800, Andy Green wrote:
> /projects/lagopus/src/dpdk/build/include/rte_common.h:384:2:
> warning: conversion from 'int' to 'uint16_t'
> {aka 'short unsigned int'} may change value [-Wconversion]
>   __extension__ ({ \
>   ^~~~~~~~~~~~~
> /projects/lagopus/src/dpdk/build/include/rte_mbuf.h:1204:16:
> note: in expansion of macro 'RTE_MIN'
>   m->data_off = RTE_MIN(RTE_PKTMBUF_HEADROOM,
> (uint16_t)m->buf_len);
> 
> RTE_PKTMBUF_HEADROOM is typ 128, so it doesn't make trouble.
> 
> Signed-off-by: Andy Green <andy at warmcat.com>
> ---
>  lib/librte_mbuf/rte_mbuf.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index c214f1945..a27dbb878 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -1201,7 +1201,8 @@ rte_pktmbuf_priv_size(struct rte_mempool *mp)
>   */
>  static inline void rte_pktmbuf_reset_headroom(struct rte_mbuf *m)
>  {
> -	m->data_off = RTE_MIN(RTE_PKTMBUF_HEADROOM, (uint16_t)m->buf_len);
> +	m->data_off = (uint16_t)RTE_MIN((uint16_t)RTE_PKTMBUF_HEADROOM,
> +					(uint16_t)m->buf_len);
>  }
>  
Not sure the cast before RTE_MIN is necessary, but it's harmless.

Acked-by: Bruce Richardson <bruce.richardson at intel.com>



More information about the dev mailing list