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 0446A5A0A for ; Tue, 23 Jun 2015 17:22:15 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 23 Jun 2015 08:21:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,666,1427785200"; d="scan'208";a="512988552" Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28]) by FMSMGA003.fm.intel.com with ESMTP; 23 Jun 2015 08:21:48 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.201]) by irsmsx105.ger.corp.intel.com ([169.254.7.245]) with mapi id 14.03.0224.002; Tue, 23 Jun 2015 16:21:46 +0100 From: "Dumitrescu, Cristian" To: Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH v5 01/13] port: added structures for port stats and config option Thread-Index: AQHQrcStUVSHEnzCSU6D1fuhE/vfUp26L6kg Date: Tue, 23 Jun 2015 15:21:45 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891263238FAFD@IRSMSX108.ger.corp.intel.com> References: <1434706885-4519-1-git-send-email-maciejx.t.gajdzica@intel.com> <2173119.kJ61eenqfH@xps13> <3EB4FA525960D640B5BDFFD6A3D891263238FA63@IRSMSX108.ger.corp.intel.com> <2132356.WZTODM8iGX@xps13> In-Reply-To: <2132356.WZTODM8iGX@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] 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 v5 01/13] port: added structures for port stats and config option 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: Tue, 23 Jun 2015 15:22:17 -0000 > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Tuesday, June 23, 2015 3:55 PM > To: Dumitrescu, Cristian > Cc: Gajdzica, MaciejX T; dev@dpdk.org; nhorman@tuxdriver.com > Subject: Re: [dpdk-dev] [PATCH v5 01/13] port: added structures for port > stats and config option >=20 > 2015-06-23 14:30, Dumitrescu, Cristian: > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon > > > 2015-06-19 11:41, Maciej Gajdzica: > > > > /** Input port interface defining the input port operation */ > > > > struct rte_port_in_ops { > > > > rte_port_in_op_create f_create; /**< Create */ > > > > rte_port_in_op_free f_free; /**< Free */ > > > > rte_port_in_op_rx f_rx; /**< Packet RX (packet burst) */ > > > > + rte_port_in_op_stats_read f_stats; /**< Stats */ > > > > }; > > > > > > Isn't it breaking an ABI? > > > > This is simply adding a field at the end of the API structure. This str= ucture is > instantiated per each port type and its role is very similar to a driver= ops > structure, for example: > > > > in file "rte_port_ethdev.h": extern struct rte_port_out_ops > rte_port_ethdev_writer_ops; > > in file "rte_port_ring.h": extern struct rte_port_out_ops > rte_port_ring_writer_nodrop_ops; > > > > Typically, instances of these structures are only referenced through > pointers by application code (and other libraries, like librte_pipeline),= so code > that is not aware of this last field in the structure will still continue= to work. > > > > The only case I see possible when code will break is if somebody would > create an array of such structures, but I think this is not a realistic s= cenario. > Instances of this structure are infrequent: once per port type in librte_= port, > and new instances are only created when the user wants to create new port > type. Basically, instances of this structure are created in isolation and= not in > bulk (arrays). >=20 > Why wouldn't it be a problem even for single instance? > If the application allocates one with old sizeof and the lib is trying to= write > in the new field, there can be a problem, no? >=20 The only case when the application is required to create a new instance of = this structure is when the application is defining a new port type (unlikel= y). In this case, the application using the old structure layout is not awa= re about the statistics functionality, so it will not invoke it, so the lib= rary will not attempt to read the f_stats structure field. Since this field= is immediately after the old structure layout, the other fields in the str= ucture are not disturbed, so the application works just fine. The only case when the application using the old structure layout is impact= ed is when the position of the old structure fields changes, and this can o= nly happen when an array of such structures is created. To my earlier point= , this is not realistic, as instances of this structure are created in isol= ation (single instance, not array of instances) and are accessed through po= inters. > Maybe Neil has an opinion? >=20 > > Due to this, I do not see this as breaking the API. I think this is the= most it > could be done to minimize the effect on the ABI will still adding new > functionality. Please let me know what you think. > > > > > > > > > struct rte_port_out_ops { > > > > - rte_port_out_op_create f_create; /**< Create */ > > > > - rte_port_out_op_free f_free; /**< Free */ > > > > - rte_port_out_op_tx f_tx; /**< Packet TX (single packet)= */ > > > > - rte_port_out_op_tx_bulk f_tx_bulk; /**< Packet TX (packet burst) > > > */ > > > > - rte_port_out_op_flush f_flush; /**< Flush */ > > > > + rte_port_out_op_create f_create; /**< Create */ > > > > + rte_port_out_op_free f_free; /**< Free */ > > > > + rte_port_out_op_tx f_tx; /**< Packet > > > TX (single packet) */ > > > > + rte_port_out_op_tx_bulk f_tx_bulk; /**< Packet TX > > > (packet burst) */ > > > > + rte_port_out_op_flush f_flush; /**< Flush */ > > > > > > What is the goal of this change? Breaking the alignment? > > > > Shall we submit a new patch revision to fix the alignment of the > comments? >=20 > Yes using spaces for alignment would be better.