From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FE93C3DA61 for ; Wed, 24 Jul 2024 16:30:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id C24F040DDD; Wed, 24 Jul 2024 16:30:27 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id nhpEJqPSD_eR; Wed, 24 Jul 2024 16:30:26 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org AC6E5402F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1721838626; bh=4kh6x9Iey6kF6Po/248f5rIjlPd1yMJFiOC97vENo7g=; h=Date:From:To:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=U6pTkbCGVmIZsN3rjiLjeoJvqrZk4ODtIAVPIFMU+4zCYMuE1SgUgSWa1P/N8NReK nE8VjM2ADumbhpf4zm+Tju2JSj17SDuzRghdjvKXRCDSGR9m6pBXZtkizy5vF9W7PV ioKQGlSXOfhow1AVe/J0qve+Sp0Ru0Uegb9se6P4QYLHZLcd8KcZwzYgiqHfdKgcPw UOt9PxmS3ODxE5+exfylhzyrXCH9pm/Ali/u2saquNeLQbrYARD1rZph7zK2zsHOch PAG0YXCCKF5wtsHw/bAGzWRVl9gVWuuFnaatUQ/v1tNRecQDI9BpgjmfLtxzrt1p5C OBQT6SSGp9Zbg== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id AC6E5402F2; Wed, 24 Jul 2024 16:30:26 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id B32C41BF29C for ; Wed, 24 Jul 2024 16:30:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id AC886607CB for ; Wed, 24 Jul 2024 16:30:25 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 1-WfhOnuyymQ for ; Wed, 24 Jul 2024 16:30:25 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2604:1380:40e1:4800::1; helo=sin.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org D12B660622 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D12B660622 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by smtp3.osuosl.org (Postfix) with ESMTPS id D12B660622 for ; Wed, 24 Jul 2024 16:30:24 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 0A2AACE11AA; Wed, 24 Jul 2024 16:30:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 042E8C32781; Wed, 24 Jul 2024 16:30:18 +0000 (UTC) Date: Wed, 24 Jul 2024 17:30:16 +0100 From: Simon Horman To: Ahmed Zaki Message-ID: <20240724163016.GB97837@kernel.org> References: <20240710204015.124233-1-ahmed.zaki@intel.com> <20240710204015.124233-13-ahmed.zaki@intel.com> <20240722150431.GK715661@kernel.org> <4691e62b-0597-4184-8e85-0e74d8cdab85@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4691e62b-0597-4184-8e85-0e74d8cdab85@intel.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721838620; bh=pdloUzkhjOyyHbG95eWHh1DIEfSYhXIR31SEwN6htKM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hY5k8GqENKG0OR27HYyUIxDVN8GPu3pDYZS1R/j9pCzxr7qolas9c3+CdVjq/cxwV RGYc3u2SSjb/ahXnIJa4x46hRtuOwhwgZl8dc4VUud2+nSnwPqZI+zaAtsqzhRXQhb Onl4uEPRwBS7btndxhck60b61WDVAIesjxdYGUTflLCqiCQNcG51Ja1enAm2SxyeX7 1/ZRkyI+SSzn1ep71a5J/r6W6DUIi59Fbk5QPQUWsgWlfdhakms6NGCJRTDfnIGCBR AUUk/9R4BtNP5WOxRxZEWEbbCrcBZlGGBTVJ1dhF+eh2TbfaNpsJm1h46xSW+97fSs gB7uHDacJ3x/g== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=hY5k8GqE Subject: Re: [Intel-wired-lan] [PATCH iwl-next v3 12/13] iavf: refactor add/del FDIR filters X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com, Marcin Szycik , intel-wired-lan@lists.osuosl.org, Sridhar Samudrala Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Wed, Jul 24, 2024 at 10:14:19AM -0600, Ahmed Zaki wrote: ... > > > +/** > > > + * iavf_fdir_del_fltr - delete a flow director filter from the list > > > + * @adapter: pointer to the VF adapter structure > > > + * @loc: location to delete. > > > + * > > > + * Return: 0 on success or negative errno on failure. > > > + */ > > > +int iavf_fdir_del_fltr(struct iavf_adapter *adapter, u32 loc) > > > +{ > > > + struct iavf_fdir_fltr *fltr = NULL; > > > + int err = 0; > > > + > > > + spin_lock_bh(&adapter->fdir_fltr_lock); > > > + fltr = iavf_find_fdir_fltr(adapter, loc); > > > + > > > + if (fltr) { > > > + if (fltr->state == IAVF_FDIR_FLTR_ACTIVE) { > > > + fltr->state = IAVF_FDIR_FLTR_DEL_REQUEST; > > > + } else if (fltr->state == IAVF_FDIR_FLTR_INACTIVE) { > > > + list_del(&fltr->list); > > > + kfree(fltr); > > > + adapter->fdir_active_fltr--; > > > + fltr = NULL; > > > + } else { > > > + err = -EBUSY; > > > + } > > > + } else if (adapter->fdir_active_fltr) { > > > + err = -EINVAL; > > > + } > > > + > > > + if (fltr && fltr->state == IAVF_FDIR_FLTR_DEL_REQUEST) > > > + iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_DEL_FDIR_FILTER); > > > > It seems that prior to this change the condition and call to > > iavf_schedule_aq_request were not protected by fdir_fltr_lock, and now they > > are. If so, is this change intentional. > > > > yes it is, fltr is member of the list that should be protected by the > spinlock. Thanks, I would suggest moving this into a separate patch: changing locking is a bit different to refactoring. Or, if not, at least mentioning it in the patch description. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD9AB17C6A for ; Wed, 24 Jul 2024 16:30:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721838620; cv=none; b=HiZNMUfywVY513+lxnrsp3H5gVyE4zhYNXS1hngRLS2dl5kWax66vbKhQXoiaLd525DUuoKLm/vtzD8pmrPjIZOJ1pSMKUvHUV2BBEjnLMM+eqJXq3xXfr1ci3pBdXE5tfoGHh0sD9rysd8DB6dE2/FesHIM61enCcsKKSpiGS4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721838620; c=relaxed/simple; bh=pdloUzkhjOyyHbG95eWHh1DIEfSYhXIR31SEwN6htKM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jBz2iCvgrlEYEOdqG8/DOL9WS2T5Ts21Ry89sdZaDnlY4O6lHCb8skD8epBp2HKS9Fxdr9Yw5BWxGzmXdAy9svd3E+i0SLyV7iEW0cFahuVBmR032e5AxMaqEexblnI/q6qh5hEK32FUF4/wscaqZoPRqQVu21m+I4RGHecF3/4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hY5k8GqE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hY5k8GqE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 042E8C32781; Wed, 24 Jul 2024 16:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721838620; bh=pdloUzkhjOyyHbG95eWHh1DIEfSYhXIR31SEwN6htKM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hY5k8GqENKG0OR27HYyUIxDVN8GPu3pDYZS1R/j9pCzxr7qolas9c3+CdVjq/cxwV RGYc3u2SSjb/ahXnIJa4x46hRtuOwhwgZl8dc4VUud2+nSnwPqZI+zaAtsqzhRXQhb Onl4uEPRwBS7btndxhck60b61WDVAIesjxdYGUTflLCqiCQNcG51Ja1enAm2SxyeX7 1/ZRkyI+SSzn1ep71a5J/r6W6DUIi59Fbk5QPQUWsgWlfdhakms6NGCJRTDfnIGCBR AUUk/9R4BtNP5WOxRxZEWEbbCrcBZlGGBTVJ1dhF+eh2TbfaNpsJm1h46xSW+97fSs gB7uHDacJ3x/g== Date: Wed, 24 Jul 2024 17:30:16 +0100 From: Simon Horman To: Ahmed Zaki Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, anthony.l.nguyen@intel.com, Sridhar Samudrala , Marcin Szycik Subject: Re: [PATCH iwl-next v3 12/13] iavf: refactor add/del FDIR filters Message-ID: <20240724163016.GB97837@kernel.org> References: <20240710204015.124233-1-ahmed.zaki@intel.com> <20240710204015.124233-13-ahmed.zaki@intel.com> <20240722150431.GK715661@kernel.org> <4691e62b-0597-4184-8e85-0e74d8cdab85@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4691e62b-0597-4184-8e85-0e74d8cdab85@intel.com> On Wed, Jul 24, 2024 at 10:14:19AM -0600, Ahmed Zaki wrote: ... > > > +/** > > > + * iavf_fdir_del_fltr - delete a flow director filter from the list > > > + * @adapter: pointer to the VF adapter structure > > > + * @loc: location to delete. > > > + * > > > + * Return: 0 on success or negative errno on failure. > > > + */ > > > +int iavf_fdir_del_fltr(struct iavf_adapter *adapter, u32 loc) > > > +{ > > > + struct iavf_fdir_fltr *fltr = NULL; > > > + int err = 0; > > > + > > > + spin_lock_bh(&adapter->fdir_fltr_lock); > > > + fltr = iavf_find_fdir_fltr(adapter, loc); > > > + > > > + if (fltr) { > > > + if (fltr->state == IAVF_FDIR_FLTR_ACTIVE) { > > > + fltr->state = IAVF_FDIR_FLTR_DEL_REQUEST; > > > + } else if (fltr->state == IAVF_FDIR_FLTR_INACTIVE) { > > > + list_del(&fltr->list); > > > + kfree(fltr); > > > + adapter->fdir_active_fltr--; > > > + fltr = NULL; > > > + } else { > > > + err = -EBUSY; > > > + } > > > + } else if (adapter->fdir_active_fltr) { > > > + err = -EINVAL; > > > + } > > > + > > > + if (fltr && fltr->state == IAVF_FDIR_FLTR_DEL_REQUEST) > > > + iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_DEL_FDIR_FILTER); > > > > It seems that prior to this change the condition and call to > > iavf_schedule_aq_request were not protected by fdir_fltr_lock, and now they > > are. If so, is this change intentional. > > > > yes it is, fltr is member of the list that should be protected by the > spinlock. Thanks, I would suggest moving this into a separate patch: changing locking is a bit different to refactoring. Or, if not, at least mentioning it in the patch description.