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 802B22BD5 for ; Thu, 5 May 2016 05:46:15 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 04 May 2016 20:46:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,580,1455004800"; d="scan'208";a="969073777" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by orsmga002.jf.intel.com with ESMTP; 04 May 2016 20:46:13 -0700 Date: Wed, 4 May 2016 20:50:00 -0700 From: Yuanhan Liu To: "Xie, Huawei" Cc: "dev@dpdk.org" Message-ID: <20160505035000.GY5641@yliu-dev.sh.intel.com> References: <1462323027-91942-1-git-send-email-huawei.xie@intel.com> <20160505000327.GT5641@yliu-dev.sh.intel.com> <20160505030704.GU5641@yliu-dev.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] virtio: split virtio rx/tx queue 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: Thu, 05 May 2016 03:46:15 -0000 On Thu, May 05, 2016 at 03:29:44AM +0000, Xie, Huawei wrote: > On 5/5/2016 11:03 AM, Yuanhan Liu wrote: > > On Thu, May 05, 2016 at 01:54:25AM +0000, Xie, Huawei wrote: > >> On 5/5/2016 7:59 AM, Yuanhan Liu wrote: > >>> On Wed, May 04, 2016 at 08:50:27AM +0800, Huawei Xie wrote: > >>>> -int virtio_dev_queue_setup(struct rte_eth_dev *dev, > >>>> - int queue_type, > >>>> - uint16_t queue_idx, > >>>> +static int > >>>> +virtio_dev_cq_queue_setup(struct rte_eth_dev *dev, > >>> While it's good to split Rx/Tx specific stuff, but why are you trying to > >>> remove a common queue_setup function that does common setups, such as vring > >>> memory allocation. > >>> > >>> This results to much duplicated code: following diff summary also shows > >>> it clearly: > >> The motivation to do this is we need separate RX/TX queue setup. > > We actually have done that. If you look at current rx/tx/ctrl_queue_setup() > > code, we invoked the common function; we also did some queue specific > > settings. It has not been done in a very clean way though: there are quite > > many "if .. else .." as you stated. And that's what you are going to resolve, > > but IMO, you went far: you made __same__ code 3 copies, one for rx, tx and > > ctrl queue, respectively. > > > >> The switch/case in the common queue setup looks bad. > > Assuming you are talking about the "if .. else .." ... > > > > While I agree with you on that, introducing so many duplicated code is worse. > > > >> I am aware of the common operations, and i had planned to extract them, > >> maybe i could do this in this patchset. > > If you meant to do in another patch on top of this patch, then it looks > > like the wrong way to go: breaking something first and then fixing it > > later does not sound a good practice to me. > > To your later comment, we could split first, then do the queue setup rework. Well, if you insist, I'm Okay. But please don't do it in the way this patch does, that introduces quite many duplicated codes. --yliu