Message ID | 1409105634-29980-6-git-send-email-jingjing.wu@intel.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-Path: <wujingji@shecgisg004.sh.intel.com> Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 77F22B375 for <dev@dpdk.org>; Wed, 27 Aug 2014 04:10:49 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 26 Aug 2014 19:14:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,408,1406617200"; d="scan'208";a="582158453" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 26 Aug 2014 19:14:37 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s7R2Eaxd006234; Wed, 27 Aug 2014 10:14:36 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s7R2EXQr030125; Wed, 27 Aug 2014 10:14:35 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s7R2EXol030121; Wed, 27 Aug 2014 10:14:33 +0800 From: Jingjing Wu <jingjing.wu@intel.com> To: dev@dpdk.org Date: Wed, 27 Aug 2014 10:13:52 +0800 Message-Id: <1409105634-29980-6-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1409105634-29980-1-git-send-email-jingjing.wu@intel.com> References: <1409105634-29980-1-git-send-email-jingjing.wu@intel.com> Subject: [dpdk-dev] [PATCH v2 5/7] fix the Marco conflict X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://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: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> X-List-Received-Date: Wed, 27 Aug 2014 02:10:50 -0000 |
Commit Message
Jingjing Wu
Aug. 27, 2014, 2:13 a.m. UTC
fix the Marco conflict between rte_ip.h and netinet/in.h Signed-off-by: jingjing.wu <jingjing.wu@intel.com> Reviewed-by: Helin Zhang <helin.zhang@intel.com> Reviewed-by: Jing Chen <jing.d.chen@intel.com> Reviewed-by: Jijiang Liu <jijiang.liu@intel.com> --- lib/librte_net/rte_ip.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Comments
2014-08-27 10:13, Jingjing Wu: > fix the Marco conflict between rte_ip.h and netinet/in.h Who is Marco? > +#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 */ > @@ -226,7 +228,8 @@ struct ipv4_hdr { > #define IPPROTO_DIVERT 254 /**< divert pseudo-protocol */ > #define IPPROTO_RAW 255 /**< raw IP packet */ > #define IPPROTO_MAX 256 /**< maximum protocol number */ > - > +#endif /* _NETINET_IN_H_ */ > +#endif /* _NETINET_IN_H */ Please explain your "fix" (which seems to be a workaround).
Hi, Thomas Because these macros such as IPPROTO_TCP, IPPROTO_UDP are already defined in <netinet/in.h>. If user's application include <netinet/in.h> and rte_ip.h at the same time, there will be conflict error, for example cmdline.c in testpmd. I remember there was someone also raised this issue few month ago. So just use the way "#ifndef #endif" to avoid the conflict. And it is exactly workaround as you said. Oh, it should be macro, but not marco, my spelling mistake. Sorry for that. I will rename this. > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Wednesday, August 27, 2014 10:28 PM > To: Wu, Jingjing > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 5/7] fix the Marco conflict > > 2014-08-27 10:13, Jingjing Wu: > > fix the Marco conflict between rte_ip.h and netinet/in.h > > Who is Marco? > > > +#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 */ > > @@ -226,7 +228,8 @@ struct ipv4_hdr { > > #define IPPROTO_DIVERT 254 /**< divert pseudo-protocol */ > > #define IPPROTO_RAW 255 /**< raw IP packet */ > > #define IPPROTO_MAX 256 /**< maximum protocol number */ > > - > > +#endif /* _NETINET_IN_H_ */ > > +#endif /* _NETINET_IN_H */ > > Please explain your "fix" (which seems to be a workaround). > > -- > Thomas
2014-08-28 03:39, Wu, Jingjing: > Because these macros such as IPPROTO_TCP, IPPROTO_UDP are already > defined in <netinet/in.h>. If user's application include <netinet/in.h> > and rte_ip.h at the same time, there will be conflict error, for > example cmdline.c in testpmd. Yes > I remember there was someone also raised this issue few month ago. Yes, and the question was: "should we totally remove these definitions"? I think yes. > So just use the way "#ifndef #endif" to avoid the conflict. But you didn't explain difference between _NETINET_IN_H and _NETINET_IN_H_. > And it is exactly workaround as you said. Yes, it's a workaround. If rte_ip.h is included before netinet/in.h, I think there is still a problem.
> -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Thursday, August 28, 2014 4:56 PM > To: Wu, Jingjing > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 5/7] fix the Marco conflict > > 2014-08-28 03:39, Wu, Jingjing: > > Because these macros such as IPPROTO_TCP, IPPROTO_UDP are already > > defined in <netinet/in.h>. If user's application include <netinet/in.h> > > and rte_ip.h at the same time, there will be conflict error, for > > example cmdline.c in testpmd. > > Yes > > > I remember there was someone also raised this issue few month ago. > > Yes, and the question was: "should we totally remove these definitions"? > I think yes. > Yes, it will be clear. But it also provides a way to user who doesn't use netinet/in.h. > > So just use the way "#ifndef #endif" to avoid the conflict. > > But you didn't explain difference between _NETINET_IN_H and _NETINET_IN_H_. It is due to the different versions of in.h, some use _NETINET_IN_H_ to define the head file, while some use _NETINET_IN_H > > > And it is exactly workaround as you said. > > Yes, it's a workaround. > If rte_ip.h is included before netinet/in.h, I think there is still a problem. Yes, it's just workaround. As my understanding, in DPDK's source code System head files includes first should be as following. So I think it's OK then. > > -- > Thomas Can I send a separate patch for this? Because it has no strict relationship with flow director. Thanks Jingjing
2014-08-28 14:37, Wu, Jingjing: > Can I send a separate patch for this? > Because it has no strict relationship with flow director. Yes, please. But I think you should look at the removal option (no redefinition of at all). Thanks
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index e3f65c1..67b6c2d 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 */ @@ -226,7 +228,8 @@ struct ipv4_hdr { #define IPPROTO_DIVERT 254 /**< divert pseudo-protocol */ #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 */