From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id E120B6A96 for ; Thu, 9 Oct 2014 13:22:16 +0200 (CEST) Received: from hmsreliant.think-freely.org ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1XcBuK-0005Vt-Pl; Thu, 09 Oct 2014 07:29:36 -0400 Date: Thu, 9 Oct 2014 07:29:19 -0400 From: Neil Horman To: "Wu, Jingjing" Message-ID: <20141009112918.GA20940@hmsreliant.think-freely.org> References: <1412045348-18543-1-git-send-email-jingjing.wu@intel.com> <20140930130950.GF2193@hmsreliant.think-freely.org> <9BB6961774997848B5B42BEC655768F8B04B34@SHSMSX104.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9BB6961774997848B5B42BEC655768F8B04B34@SHSMSX104.ccr.corp.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] llib/ibrte_net: workaround to avoid macro conflict X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 11:22:17 -0000 On Thu, Oct 09, 2014 at 05:20:31AM +0000, Wu, Jingjing wrote: > Hi, Neil > > To have rte_ip.h include netinet/in.h directly is also a choice. > > But netinet/in.h contains a lot of extra stuff, and these may be useless some DPDK applications, such as classification. > rte_ip.h provides a more simplify way for the IP protocol layer. > Not sure what the relevance there is. The definitions you want are standardized, theres no need for the dpdk to re-invent that wheel. Get them from the system include file. The fact that extra macros are available in netinet.h is neither relevant or true (as you can't really say for certain what an application will need). Neil > -----Original Message----- > From: Neil Horman [mailto:nhorman@tuxdriver.com] > Sent: Tuesday, September 30, 2014 9:10 PM > To: Wu, Jingjing > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] llib/ibrte_net: workaround to avoid macro conflict > > On Tue, Sep 30, 2014 at 10:49:08AM +0800, Jingjing Wu wrote: > > Macros such as IPPROTO_TCP, IPPROTO_UDP are already defined in . > > If user's application includes and rte_ip.h at the same > > time, there will be conflict error. > > > > This patch uses the way "#ifndef #endif" to avoid the conflict. > > > > Signed-off-by: Jingjing Wu > > --- > > lib/librte_net/rte_ip.h | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index > > e3f65c1..2bcb479 100644 > > --- a/lib/librte_net/rte_ip.h > > +++ b/lib/librte_net/rte_ip.h > > @@ -116,6 +116,8 @@ struct ipv4_hdr { > > > > #define IPV4_HDR_OFFSET_UNITS 8 > > > > +#ifndef _NETINET_IN_H > > +#ifndef _NETINET_IN_H_ > > /* IPv4 protocols */ > > #define IPPROTO_IP 0 /**< dummy for IP */ > > #define IPPROTO_HOPOPTS 0 /**< IP6 hop-by-hop options */ > > @@ -227,6 +229,9 @@ struct ipv4_hdr { > > #define IPPROTO_RAW 255 /**< raw IP packet */ > > #define IPPROTO_MAX 256 /**< maximum protocol number */ > > > > +#endif /*_NETINET_IN_H_*/ > > +#endif /*_NETINET_IN_H*/ > > + > > /* > > * IPv4 address types > > */ > > -- > > 1.8.1.4 > > > > > Why define them at all? Why not just have rte_ip.h include netinet/in.h directly? Its a standard include file in a standard location for both bsd and linux IIRC. > Neil > >