From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140059.outbound.protection.outlook.com [40.107.14.59]) by dpdk.org (Postfix) with ESMTP id 9717F1B959 for ; Fri, 11 Jan 2019 04:01:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AiSHfstfB239IuLX99qrRoYgQ5f7scxQVG0x7XLXooo=; b=lBdtEmv1rvRBc6KgLPnfD0Th/2qm7jlRJetzIERwslsWd3Ptlnh2IjxVldz9XY65DFpXeIhMjA2z8HAVFbbexekW4MOdPuXBjYko7TR1XgYBiQ1ZE0CQD572J/mjIgwPj+glOSabfq6MqG4da8UCeCd3tozEM78c5f1/JUZ946M= Received: from VI1PR08MB3167.eurprd08.prod.outlook.com (52.133.15.142) by VI1PR08MB2831.eurprd08.prod.outlook.com (10.170.236.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.7; Fri, 11 Jan 2019 03:01:44 +0000 Received: from VI1PR08MB3167.eurprd08.prod.outlook.com ([fe80::8960:6756:4cdc:3954]) by VI1PR08MB3167.eurprd08.prod.outlook.com ([fe80::8960:6756:4cdc:3954%4]) with mapi id 15.20.1516.016; Fri, 11 Jan 2019 03:01:44 +0000 From: "Gavin Hu (Arm Technology China)" To: "Dumitrescu, Cristian" , "Van Haaren, Harry" , "dev@dpdk.org" CC: "Pattan, Reshma" , "thomas@monjalon.net" , "olivier.matz@6wind.com" , Honnappa Nagarahalli Thread-Topic: [dpdk-dev] [PATCH v2] mbuf: fix compile by removing struct from function Thread-Index: AQHUqQ88OGYSD7W6bEWzUKTgrxkIQKWo1bEAgACLLHA= Date: Fri, 11 Jan 2019 03:01:43 +0000 Message-ID: References: <20190110165051.4859-1-harry.van.haaren@intel.com> <20190110180658.23302-1-harry.van.haaren@intel.com> <3EB4FA525960D640B5BDFFD6A3D891268E828A86@IRSMSX108.ger.corp.intel.com> In-Reply-To: <3EB4FA525960D640B5BDFFD6A3D891268E828A86@IRSMSX108.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Gavin.Hu@arm.com; x-originating-ip: [113.29.88.7] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR08MB2831; 6:KQPDMcjShvd6rZUjQlpNPqShbBzUN++GSQQj4pkPIRtm0M2KlCJo9QxlIbeKaI1k0HV2eoDaEyaizRrxWfY6NtPlKpwKDkBo5dRCVWSrsb6ThjwvK0JT04MC1LKtlGw0XJ5lTpYX3HmueC00OxOy/dxWqA4tI9VAdPvN0/a0kD6HyIIUVpMdMtILJ63G+pVtjwZ4yu470EFHz5QxUkZU30zoyVZHx8mVmkPTRTAnhy0alpcZj9yr4IlqkaEJMnC+WVRlna9IdMZVDl4eS4LEWY/3uWTHeJLhGWpnI2yXAUX0zL2nGyZbXUJBd3U2hstAGhyPWYJr8b3M3jUFPnhaxEGC6fl6ZDCk00GEzU+GM/tsPqB6e0nF5w3i9nMrd5+deY1SdlXg/bARmBusuO0lJdA7eyS+EbH9JTdFXYs8PAkL4M6hQfa8w7+Oob+s7EFq0lp6CgmoF46LfJ/HOd+zig==; 5:+uijIxVIuFhHMRuKJAYDJecsSXWq2QwPtYH/kLQUotjkI+9xDYd6OL/c0C+aXi6YhMg4fw9+a2vpWTbFTbag24ksRH7QiwSiDZi/zcQ0nnN3j7jT8EocHwdH9r6zyc4CLkvEh8bAgn3Qe9l4fyfNLAM+/Lkq0HyQirOtVWLzVPR2fuujFVQvd/12HZrpmEt5hNx/7nedti0OhQzLxN2Iag==; 7:3ITL+SuHQPqtQum28QeEFTBf2A0VeXLhz7advfXfcFdL240w+VcpqE+/jbIaSgs+hfCpovG+fPt34KGrSPvcNXle4N9U0Rk8MI/l1rwAtSO/C9W42NdvLY0hnkabFt9oW51HOS0bZ2/bxC20/GGNHw== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: cdf5c8a1-625b-44bb-54fb-08d677711e2c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR08MB2831; x-ms-traffictypediagnostic: VI1PR08MB2831: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(908002)(5005026)(6040522)(8220060)(2401047)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231475)(944501520)(52105112)(6055026)(6041310)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:VI1PR08MB2831; BCL:0; PCL:0; RULEID:; SRVR:VI1PR08MB2831; x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(346002)(376002)(136003)(366004)(13464003)(40434004)(189003)(199004)(2906002)(316002)(74316002)(99286004)(54906003)(486006)(97736004)(66066001)(478600001)(5660300001)(14444005)(5024004)(14454004)(25786009)(55016002)(7696005)(76176011)(966005)(86362001)(6246003)(4326008)(256004)(110136005)(186003)(476003)(53936002)(71190400001)(71200400001)(55236004)(11346002)(446003)(2501003)(53546011)(6506007)(102836004)(8936002)(81156014)(26005)(72206003)(33656002)(3846002)(7736002)(81166006)(229853002)(6436002)(6306002)(6116002)(106356001)(105586002)(305945005)(68736007)(9686003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB2831; H:VI1PR08MB3167.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: FA44HzdNgzNCZKH0belSm/180lI5uq1NnR2cPTMZunJwOuh4qoUsEe7nzreAhsnFOkD0wbmEc9RQy2HGTNzCLnsr9+WSVWK7eYIF0gmYePjvqQ3cBWn4g1o6HOqtQYXqU65S4DYSlRhkjD3yZeHJe95Wv00u5NxqV5FslqDZdfpqRvtr3xHQ6u67QF/Ax1BouB9To+8yo7hnmHrC0fl3E1iWc3L0ias5kImVcntzLZzlKJVP4bHXdbP90YO5F+oy37ZxdQEjlAmkV4EYtfqXsnCYoKAu0WB1heGDXsDDNkvVoG8LC//FJHZy0VdtiATksaAXnoUsQ443gKQ0/2mDl2rH4bcBmidEgw9IVbt/4zw8lc4XNzBkzJglCyUlSJgLb1NEVnKq5on7nIqNqnaII3v+0AVGkQS1a35Im361598= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: cdf5c8a1-625b-44bb-54fb-08d677711e2c X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 03:01:43.9914 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2831 Subject: Re: [dpdk-dev] [PATCH v2] mbuf: fix compile by removing struct from function 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: Fri, 11 Jan 2019 03:01:45 -0000 > -----Original Message----- > From: dev On Behalf Of Dumitrescu, Cristian > Sent: Friday, January 11, 2019 2:40 AM > To: Van Haaren, Harry ; dev@dpdk.org > Cc: Pattan, Reshma ; thomas@monjalon.net; > olivier.matz@6wind.com > Subject: Re: [dpdk-dev] [PATCH v2] mbuf: fix compile by removing struct > from function > > > > > -----Original Message----- > > From: Van Haaren, Harry > > Sent: Thursday, January 10, 2019 6:07 PM > > To: dev@dpdk.org > > Cc: Van Haaren, Harry ; Pattan, Reshma > > ; Dumitrescu, Cristian > > ; thomas@monjalon.net; > > olivier.matz@6wind.com > > Subject: [PATCH v2] mbuf: fix compile by removing struct from function > > > > Although C compilation works with the struct rte_mbuf_sched > > declared inside the struct rte_mbuf namespace, C++ fails to > > compile. > > > > This fix removes the temporary struct rte_mbuf_sched, instead > > reading from the mbuf directly for each struct member. As the > > struct is now not used directly, the C++ compiler doesn't need > > to know about the struct, resolving the issue. > > > > 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 > > Cc: olivier.matz@6wind.com > > > > See mailing list for v1 discussion, perhaps this solution is more > > readable due to leaving sched struct in-line in the mbuf struct. > > --- > > lib/librte_mbuf/rte_mbuf.h | 16 ++++++---------- > > 1 file changed, 6 insertions(+), 10 deletions(-) > > > > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > > index bc562dc8a..1b260efd5 100644 > > --- a/lib/librte_mbuf/rte_mbuf.h > > +++ b/lib/librte_mbuf/rte_mbuf.h > > @@ -2344,11 +2344,9 @@ rte_mbuf_sched_get(const struct rte_mbuf > *m, > > uint32_t *queue_id, > > uint8_t *traffic_class, > > uint8_t *color) > > { > > -struct rte_mbuf_sched sched =3D m->hash.sched; Did C++ complain *sched? *sched is better with less stack mem footprint. If the pointer works, the code looks better. > > - > > -*queue_id =3D sched.queue_id; > > -*traffic_class =3D sched.traffic_class; > > -*color =3D sched.color; > > +*queue_id =3D m->hash.sched.queue_id; > > +*traffic_class =3D m->hash.sched.traffic_class; > > +*color =3D m->hash.sched.color; > > } > > > > /** > > @@ -2395,11 +2393,9 @@ rte_mbuf_sched_set(struct rte_mbuf *m, > > uint32_t queue_id, > > uint8_t traffic_class, > > uint8_t color) > > { > > -m->hash.sched =3D (struct rte_mbuf_sched){ > > -.queue_id =3D queue_id, > > -.traffic_class =3D traffic_class, > > -.color =3D color, > > -}; > > +m->hash.sched.queue_id =3D queue_id; > > +m->hash.sched.traffic_class =3D traffic_class; > > +m->hash.sched.color =3D color; > > } > > > > #ifdef __cplusplus > > -- > > 2.17.1 > > NAK. > > I am fine with V1, but against this V2 due to the reasons previously disc= ussed > and agreed by Olivier [1] regarding performance. We should not sacrifice > performance for the sake of cosmetics criteria that can met some other wa= y. > > In order to meet readability requirements from Olivier, I suggest we go b= ack > to V1 and we explicitly mention the size of the mbuf->sched field inslide= the > mbuf as 8 bytes: > > struct rte_mbuf { > ... > struct rte_mbuf_sched sched; /**< Hierarchical scheduler: 8 bytes > */ > ... > } > > Olivier, is this a good compromise? > > Regards, > Cristian > > [1] https://mails.dpdk.org/archives/dev/2018-December/121806.html IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.