From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH 18/29] ixgbe/base: update swfw semaphore function Date: Mon, 13 Jun 2016 17:28:23 +0100 Message-ID: <575EDF27.4090305@intel.com> References: <1462514861-29419-1-git-send-email-beilei.xing@intel.com> <1462514861-29419-19-git-send-email-beilei.xing@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org To: Beilei Xing , helin.zhang@intel.com Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 8ADCD58CF for ; Mon, 13 Jun 2016 18:28:25 +0200 (CEST) In-Reply-To: <1462514861-29419-19-git-send-email-beilei.xing@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 5/6/2016 7:07 AM, Beilei Xing wrote: > For X540 and forward it is possible if a system reset occur at the > right time to leave the SWFW semaphore high. This new function will > attempt to grab and release the semaphore. If the grab times out it > will still release the semaphore placing it in a known good state. > The idea is to call this when you know no one should be holding the > semaphore (i.e. probe time) > This patch alse fixes possible race issue between ports when issuing > host interface command by acquiring/releasing the management host > interface semaphore in ixgbe_host_interface_command. >=20 > Signed-off-by: Beilei Xing > --- Does it make sense to separate this patch into two. ... > +/** > + * ixgbe_init_swfw_semaphore - Clean up SWFW semaphore > + * @hw: pointer to hardware structure > + * > + * Attempts to acquire the SWFW semaphore through SW_FW_SYNC register= . > + * Regardless of whether is succeeds or not it then release the semap= hore. > + * This is function is called to recover from catastrophic failures t= hat > + * may have left the semaphore locked. > + **/ > +void ixgbe_init_swfw_semaphore(struct ixgbe_hw *hw) > +{ > + if (hw->mac.ops.init_swfw_sync) > + hw->mac.ops.init_swfw_sync(hw); > +} One add ixgbe_init_swfw_semaphore related code (init_swfw_sync, ixgbe_init_swfw_sync_X540) ... > @@ -4390,6 +4392,12 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw= *hw, u32 *buffer, > DEBUGOUT1("Buffer length failure buffersize=3D%d.\n", length); > return IXGBE_ERR_HOST_INTERFACE_COMMAND; > } > + /* Take management host interface semaphore */ > + status =3D hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM); > + > + if (status) > + return status; > + Second is fix in ixgbe_host_interface_command, they are unrelated as far as I can see. > /* Set bit 9 of FWSTS clearing FW reset indication */ > fwsts =3D IXGBE_READ_REG(hw, IXGBE_FWSTS); > IXGBE_WRITE_REG(hw, IXGBE_FWSTS, fwsts | IXGBE_FWSTS_FWRI); ...