From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 7768F58E6 for ; Thu, 9 Oct 2014 07:13:14 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 08 Oct 2014 22:14:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,682,1406617200"; d="scan'208";a="615594618" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 08 Oct 2014 22:20:33 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 8 Oct 2014 22:20:33 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 8 Oct 2014 22:20:32 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.230]) by shsmsx102.ccr.corp.intel.com ([169.254.2.192]) with mapi id 14.03.0195.001; Thu, 9 Oct 2014 13:20:31 +0800 From: "Wu, Jingjing" To: Neil Horman Thread-Topic: [dpdk-dev] [PATCH] llib/ibrte_net: workaround to avoid macro conflict Thread-Index: AQHP3FkgZuWg1TJnZE62rzm9sYZLW5wZINMAgA4nm3A= Date: Thu, 9 Oct 2014 05:20:31 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F8B04B34@SHSMSX104.ccr.corp.intel.com> References: <1412045348-18543-1-git-send-email-jingjing.wu@intel.com> <20140930130950.GF2193@hmsreliant.think-freely.org> In-Reply-To: <20140930130950.GF2193@hmsreliant.think-freely.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 05:13:14 -0000 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 so= me DPDK applications, such as classification. rte_ip.h provides a more simplify way for the IP protocol layer. -----Original Message----- From: Neil Horman [mailto:nhorman@tuxdriver.com]=20 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 c= onflict 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=20 > time, there will be conflict error. >=20 > This patch uses the way "#ifndef #endif" to avoid the conflict.=20 >=20 > Signed-off-by: Jingjing Wu > --- > lib/librte_net/rte_ip.h | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index=20 > e3f65c1..2bcb479 100644 > --- a/lib/librte_net/rte_ip.h > +++ b/lib/librte_net/rte_ip.h > @@ -116,6 +116,8 @@ struct ipv4_hdr { > =20 > #define IPV4_HDR_OFFSET_UNITS 8 > =20 > +#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 */ > =20 > +#endif /*_NETINET_IN_H_*/ > +#endif /*_NETINET_IN_H*/ > + > /* > * IPv4 address types > */ > -- > 1.8.1.4 >=20 >=20 Why define them at all? Why not just have rte_ip.h include netinet/in.h di= rectly? Its a standard include file in a standard location for both bsd an= d linux IIRC. Neil