From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 5CC3D2AA0 for ; Thu, 10 Jan 2019 18:57:31 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2019 09:57:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,462,1539673200"; d="scan'208";a="126647444" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by orsmga001.jf.intel.com with ESMTP; 10 Jan 2019 09:57:28 -0800 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.65]) by IRSMSX106.ger.corp.intel.com ([169.254.8.161]) with mapi id 14.03.0415.000; Thu, 10 Jan 2019 17:57:27 +0000 From: "Van Haaren, Harry" To: Thomas Monjalon CC: "dev@dpdk.org" , "Pattan, Reshma" , "Dumitrescu, Cristian" , "olivier.matz@6wind.com" Thread-Topic: [PATCH] mbuf: fix compile by making sched struct visible Thread-Index: AQHUqQSdtM1t8uHY90+RpINOgfRKbaWow5MAgAADgAA= Date: Thu, 10 Jan 2019 17:57:27 +0000 Message-ID: References: <20190110165051.4859-1-harry.van.haaren@intel.com> <1558979.Xtpf54c0cE@xps> In-Reply-To: <1558979.Xtpf54c0cE@xps> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmE5YmQ5MjYtYzYxZS00NjllLThjMDAtYTcwMDhiZmIxZDk0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWE91S3ZPejhVTGlXTWpKZFJXRHFiZGdcL2RoMTJcL1VxaHlqeVFFanRLczdLdUFzMDFueUVza0x2MlJHTnNHNjVEIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] mbuf: fix compile by making sched struct visible X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2019 17:57:31 -0000 > -----Original Message----- > From: Thomas Monjalon [mailto:thomas@monjalon.net] > Sent: Thursday, January 10, 2019 5:35 PM > To: Van Haaren, Harry > Cc: dev@dpdk.org; Pattan, Reshma ; Dumitrescu, > Cristian ; olivier.matz@6wind.com > Subject: Re: [PATCH] mbuf: fix compile by making sched struct visible >=20 > 10/01/2019 17:50, Harry van Haaren: > > Although C compilation works with the struct rte_mbuf_sched > > declared inside the struct rte_mbuf namespace, C++ fails to > > compile. This fix moves the rte_mbuf_sched struct up to the > > global namespace, instead of declaring it inside the struct > > mbuf namespace. > > > > The struct rte_mbuf_sched is being used on the stack in > > rte_mbuf_sched_get() and as a cast in _set(). For this > > reason, it must be exposed as an available type. > > > > Fixes: 5d3f72100904 ("mbuf: implement generic format for sched field") > > > > Signed-off-by: Harry van Haaren > > > > --- > > > > Cc: reshma.pattan@intel.com > > Cc: cristian.dumitrescu@intel.com > > Cc: thomas@monjalon.net > > > > Hey folks, > > > > Currently the mbuf header will fail to compile with a C++ compiler, > > this patch is one possible solution. I'm not particularly happy with > > this as a fix as it reduces mbuf struct readability, however it does > > resolve the issue. >=20 > What are the other possible solutions? I guess we could avoid using the struct in inline functions, by reading or writing from the mbuf struct directly (without pulling out a temporary rte_mbuf_sched field): get() *queue_id =3D m->hash.sched.queue_id; ... set() m->hash.sched.queue_id =3D queue_id; ... I believe this was discussed when the patch was being reviewed; http://patches.dpdk.org/patch/49126/ I have a mild preference to keep all mbuf structs visible inside the unions= , it makes it easier to understand the layout of mbuf, hence I prefer the above pseudo code suggestion over the v1 patch sent before. If others have a strong opinion for another solution, I'm ok with it.