From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bruce.richardson@intel.com>
Received: from mga12.intel.com (mga12.intel.com [192.55.52.136])
 by dpdk.org (Postfix) with ESMTP id 192985B1C
 for <dev@dpdk.org>; Thu, 17 May 2018 12:50:01 +0200 (CEST)
X-Amp-Result: UNKNOWN
X-Amp-Original-Verdict: FILE UNKNOWN
X-Amp-File-Uploaded: False
Received: from fmsmga006.fm.intel.com ([10.253.24.20])
 by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 17 May 2018 03:50:01 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.49,410,1520924400"; d="scan'208";a="229382677"
Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.55])
 by fmsmga006.fm.intel.com with SMTP; 17 May 2018 03:49:59 -0700
Received: by  (sSMTP sendmail emulation); Thu, 17 May 2018 11:49:58 +0100
Date: Thu, 17 May 2018 11:49:58 +0100
From: Bruce Richardson <bruce.richardson@intel.com>
To: Andy Green <andy@warmcat.com>
Cc: dev@dpdk.org
Message-ID: <20180517104957.GB22048@bricha3-MOBL.ger.corp.intel.com>
References: <152627436523.53156.4398253089110011263.stgit@localhost.localdomain>
 <152627461784.53156.12994381045130497126.stgit@localhost.localdomain>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <152627461784.53156.12994381045130497126.stgit@localhost.localdomain>
Organization: Intel Research and Development Ireland Ltd.
User-Agent: Mutt/1.9.4 (2018-02-28)
Subject: Re: [dpdk-dev] [PATCH v4 10/23] rte_mbuf.h: make sure RTE-MIN
 compares same types
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 17 May 2018 10:50:02 -0000

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@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@intel.com>