Message ID | 1412045348-18543-1-git-send-email-jingjing.wu@intel.com (mailing list archive) |
---|---|
State | Rejected, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id F095668FD; Tue, 30 Sep 2014 04:42:40 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 373DC5902 for <dev@dpdk.org>; Tue, 30 Sep 2014 04:42:38 +0200 (CEST) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by orsmga103.jf.intel.com with ESMTP; 29 Sep 2014 19:47:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,624,1406617200"; d="scan'208";a="480884494" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by azsmga001.ch.intel.com with ESMTP; 29 Sep 2014 19:49:14 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s8U2nBK2001228; Tue, 30 Sep 2014 10:49:12 +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 s8U2n97r018578; Tue, 30 Sep 2014 10:49:11 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s8U2n9UK018574; Tue, 30 Sep 2014 10:49:09 +0800 From: Jingjing Wu <jingjing.wu@intel.com> To: dev@dpdk.org Date: Tue, 30 Sep 2014 10:49:08 +0800 Message-Id: <1412045348-18543-1-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [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 <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> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Jingjing Wu
Sept. 30, 2014, 2:49 a.m. UTC
Macros such as IPPROTO_TCP, IPPROTO_UDP are already defined in <netinet/in.h>.
If user's application includes <netinet/in.h> 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 <jingjing.wu@intel.com>
---
lib/librte_net/rte_ip.h | 5 +++++
1 file changed, 5 insertions(+)
Comments
Hi Jingjing, 2014-09-30 10:49, Jingjing Wu: > Macros such as IPPROTO_TCP, IPPROTO_UDP are already defined in <netinet/in.h>. > If user's application includes <netinet/in.h> and rte_ip.h at the same time, > there will be conflict error. > > This patch uses the way "#ifndef #endif" to avoid the conflict. I still think it is not the good approach. see http://dpdk.org/ml/archives/dev/2014-August/005006.html and http://dpdk.org/ml/archives/dev/2014-August/005026.html Why not simply remove these definitions?
On Tue, Sep 30, 2014 at 10:49:08AM +0800, Jingjing Wu wrote: > Macros such as IPPROTO_TCP, IPPROTO_UDP are already defined in <netinet/in.h>. > If user's application includes <netinet/in.h> 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 <jingjing.wu@intel.com> > --- > 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
Hi, Thomas The reason why I didn't remover all the macros in rte_ip.h is: netinet/in.h contains a lot of extra references to the sockets definitions, some external functions declarations, etc. These are useless some DPDK applications, such as classification. rte_ip.h provides a more simplify way for the IP protocol layer. > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Tuesday, September 30, 2014 1:08 PM > To: Wu, Jingjing > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] llib/ibrte_net: workaround to avoid macro conflict > > Hi Jingjing, > > 2014-09-30 10:49, Jingjing Wu: > > Macros such as IPPROTO_TCP, IPPROTO_UDP are already defined in <netinet/in.h>. > > If user's application includes <netinet/in.h> and rte_ip.h at the same time, > > there will be conflict error. > > > > This patch uses the way "#ifndef #endif" to avoid the conflict. > > I still think it is not the good approach. > see http://dpdk.org/ml/archives/dev/2014-August/005006.html > and http://dpdk.org/ml/archives/dev/2014-August/005026.html > Why not simply remove these definitions? > > -- > Thomas
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. -----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 <netinet/in.h>. > If user's application includes <netinet/in.h> 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 <jingjing.wu@intel.com> > --- > 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
If the DPDK wants to conflict with all those system headers it means they also have to provide working replacement for inet_pton, inet_ntop, and every other important socket function which depends upon in.h or depends upon code depending upon in.h. Clearly this doesn't represent a sustainable path for software development... I had to reimplement a number of these in my app to get around the header conflict and I'm sure I'm not the only one who ran into this issue either. Matthew.
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 <netinet/in.h>. > > If user's application includes <netinet/in.h> 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 <jingjing.wu@intel.com> > > --- > > 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 > >
2014-10-09 07:29, Neil Horman: > 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, Matthew, I totally agree with your point of view. Please, could you propose a patch to fix this issue? Thanks
On Mon, Nov 03, 2014 at 08:41:53AM +0100, Thomas Monjalon wrote: > 2014-10-09 07:29, Neil Horman: > > 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, Matthew, > > I totally agree with your point of view. > Please, could you propose a patch to fix this issue? > Matthew, can you handle this please, I've got too much going on right now. Neil > Thanks > -- > Thomas >
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 */