From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id CCE5ED59A for ; Wed, 4 Jan 2017 08:21:10 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 03 Jan 2017 23:21:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,458,1477983600"; d="scan'208";a="1107710575" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by fmsmga002.fm.intel.com with ESMTP; 03 Jan 2017 23:21:08 -0800 Date: Wed, 4 Jan 2017 15:22:56 +0800 From: Yuanhan Liu To: "Tan, Jianfeng" Cc: dev@dpdk.org, stephen@networkplumber.org Message-ID: <20170104072256.GK21228@yliu-dev.sh.intel.com> References: <1482996643-113253-1-git-send-email-jianfeng.tan@intel.com> <1482996643-113253-6-git-send-email-jianfeng.tan@intel.com> <20161230062747.GI21789@yliu-dev.sh.intel.com> <88093c9a-5bd8-5acb-aa87-4aa92c03a2df@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <88093c9a-5bd8-5acb-aa87-4aa92c03a2df@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v2 5/9] net/virtio: setup rxq interrupts 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: Wed, 04 Jan 2017 07:21:11 -0000 On Wed, Jan 04, 2017 at 02:56:50PM +0800, Tan, Jianfeng wrote: > > > On 12/30/2016 2:27 PM, Yuanhan Liu wrote: > >On Thu, Dec 29, 2016 at 07:30:39AM +0000, Jianfeng Tan wrote: > >>This patch mainly allocates structure to store queue/irq mapping, > >>and configure queue/irq mapping down through PCI ops. It also creates > >>eventfds for each Rx queue and tell the kernel about the eventfd/intr > >>binding. > >> > >>Mostly importantly, different from previous NICs (usually implements > >>these logic in dev_start()), virtio's interrupt settings should be > >>configured down to QEMU before sending DRIVER_OK notification. > >Isn't it obvious we have to have all driver stuff (including interrupt > >settings) configured properly before setting DRIVER_OK? :) That said, > >it's meanless to state the fact that virtio acts differently than other > >nics here on dev_start/stop. > > > >>Note: We only support 1:1 queue/irq mapping so far, which means, each > >>rx queue has one exclusive interrupt (corresponding to irqfd in the > >>qemu/kvm) to get notified when packets are available on that queue. > >That means you have to setup the "vectors=N" option has to set correctly > >in QEMU, otherwise it won't work? > > Yes, actually, the correct value should be "vectors>=N+1", with N standing Yeah, and it's a typo. > for the number of queue pairs. It's due to the hard coded mapping logic: > 0 -> config irq > 1 -> rxq0 > 2 -> rxq1 > ... > > > If so, you also have to doc it somewhere. > > Agreed. > > [...] > >>+ > >>+ if (virtio_queues_bind_intr(dev) < 0) { > >>+ PMD_INIT_LOG(ERR, "Failed to bind queue/interrupt"); > >>+ return -1; > >You have to free intr_handle->intr_vec, otherwise, memory leak occurs. > > It's freed at dev_close(). Do you mean freeing and reallocating here? As The typical way is free the resources have been allocated when errors happens. > nr_rx_queues is not a changeable value, I don't see the necessity here. I > miss something? No. nb_rx_queues does change, when people reconfigure the queue number. However, the MAX queues the virito supports does not change. You could use that number for allocation. --yliu