From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id A0B5337AF for ; Fri, 3 Jul 2015 11:57:49 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 03 Jul 2015 02:57:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,399,1432623600"; d="scan'208";a="722312871" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.208.62]) by orsmga001.jf.intel.com with SMTP; 03 Jul 2015 02:57:43 -0700 Received: by (sSMTP sendmail emulation); Fri, 03 Jul 2015 10:57:41 +0025 Date: Fri, 3 Jul 2015 10:57:41 +0100 From: Bruce Richardson To: "Sanford, Robert" Message-ID: <20150703095741.GC7548@bricha3-MOBL3> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] Ethernet API - multiple post-RX-burst callbacks' run-order is opposite to their add-order 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: Fri, 03 Jul 2015 09:57:52 -0000 On Thu, Jul 02, 2015 at 09:04:48PM +0000, Sanford, Robert wrote: > When one adds multiple post-RX-burst callbacks to a queue, their execution order is the opposite of the order in which they are added. For example, we add callback A( ), and then we add callback B( ). When we call rte_eth_rx_burst, after invoking the device's rx_pkt_burst function, it will invoke B( ), and then A( ). The same goes for pre-TX-burst callbacks, too. > > This is counter-intuitive. Shouldn't we either execute the callbacks in the same order that we add them (by changing the internals of the add-APIs), or change the add-APIs to allow one to specify whether a callback is added to the head or tail of the callback list? At the least, we could document the expected behavior. > Any thoughts on this? > Makes sense. I would agree that having the callbacks called in order of addition makes more sense. Having the order configurable might be useful, but would require an API change, so I'd only look to change that if it really proves necessary. If the callback order is consistent and behaves logically (i.e. order of call == order of add), can the app not ensure the callbacks are added in the correct order? /Bruce