From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 290566837 for ; Fri, 21 Feb 2014 17:29:11 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 21 Feb 2014 08:30:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,520,1389772800"; d="scan'208";a="459531707" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga001.jf.intel.com with ESMTP; 21 Feb 2014 08:30:33 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.202]) by IRSMSX102.ger.corp.intel.com ([169.254.2.180]) with mapi id 14.03.0123.003; Fri, 21 Feb 2014 16:30:31 +0000 From: "Ananyev, Konstantin" To: Thomas Monjalon , "'Didier Pallard' (didier.pallard@6wind.com)" Thread-Topic: [dpdk-dev] [RFC PATCH 2/2] ixgbe: release software locked semaphores on initialization Thread-Index: AQHPLZtbY9N48dhGHkyTBenuV2sl2Jq/5h9g Date: Fri, 21 Feb 2014 16:30:31 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725808E692BE@IRSMSX105.ger.corp.intel.com> References: <1392811162-28527-1-git-send-email-didier.pallard@6wind.com> <1392811162-28527-2-git-send-email-didier.pallard@6wind.com> <2601191342CEEE43887BDE71AB97725808E689E6@IRSMSX105.ger.corp.intel.com> <201402191752.11989.thomas.monjalon@6wind.com> <2601191342CEEE43887BDE71AB97725808E68AFB@IRSMSX105.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB97725808E68AFB@IRSMSX105.ger.corp.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [RFC PATCH 2/2] ixgbe: release software locked semaphores on initialization 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, 21 Feb 2014 16:29:13 -0000 To be more specific, I am talking about something like the patch below. It is just a copy-paste of your fix, but implemented and called from ixgbe_= ethdev.c Konstantin diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixg= be_et hdev.c index 7e068c2..5d8744a 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c @@ -561,6 +561,42 @@ ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_co= nfig *dcb_config) } } +static void +ixgbe_swfw_lock_reset(struct ixgbe_hw *hw) +{ + uint16_t mask; + + /* Get bus info */ + hw->mac.ops.get_bus_info(hw); + + /* Ensure that all locks are released before first NVM or PHY acces= s */ + + /* + * Phy lock should not fail in this early stage. If this is the cas= e, + * it is due to an improper exit of the application. + * So force the release of the faulty lock. Release of common lock + * is done automatically by swfw_sync function. + */ + mask =3D IXGBE_GSSR_PHY0_SM << hw->bus.func; + if (hw->mac.ops.acquire_swfw_sync(hw, mask) < 0) { + DEBUGOUT1("SWFW phy%d lock released", hw->bus.func); + } + hw->mac.ops.release_swfw_sync(hw, mask); + + /* + * Those one are more tricky since they are common to all ports; but + * swfw_sync retries last long enough (1s) to be almost sure that if + * lock can not be taken it is due to an improper lock of the + * semaphore. + */ + mask =3D IXGBE_GSSR_EEP_SM | IXGBE_GSSR_MAC_CSR_SM | IXGBE_GSSR_SW_= MNG_SM; + if (hw->mac.ops.acquire_swfw_sync(hw, mask) < 0) { + DEBUGOUT("SWFW common locks released"); + } + hw->mac.ops.release_swfw_sync(hw, mask); +} + + /* * This function is based on code in ixgbe_attach() in ixgbe/ixgbe.c. * It returns 0 on success. @@ -618,6 +654,11 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_= driver *eth_drv, return -EIO; } + if (hw->mac.type =3D=3D ixgbe_mac_82598EB || + hw->mac.type =3D=3D ixgbe_mac_82599EB || + hw->mac.type =3D=3D ixgbe_mac_X540) + ixgbe_swfw_lock_reset(hw); + /* Initialize DCB configuration*/ memset(dcb_config, 0, sizeof(struct ixgbe_dcb_config)); ixgbe_dcb_init(hw,dcb_config); -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ananyev, Konstantin Sent: Wednesday, February 19, 2014 5:52 PM To: Thomas Monjalon Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [RFC PATCH 2/2] ixgbe: release software locked sema= phores on initialization Hi Thomas, I am afraid I couldn't send you an url we are using. We take it from internal Intel ND repository. Though I think, that latest available to download from Intel ixgbe driver f= or FreeBSD should have pretty close codebase. = As a rule of thumb in our internal policy: we take shared code from ND and = treat it as read-only (the only exception: ixgbe/ixgbe_osdep.h). Otherwise it might become quite messy pretty quickly. To overcome some problems or shortcomings in ND code people usually use wra= ppers at the upper layer - that way was implemented bypass support, loopba= ck support, plus some other fixes (reported number of queues per VF, etc). I wonder couldn't your fix also be pushed to the upper layer (in ixgbe_ethd= ev.c or something)? Thanks Konstantin = -----Original Message----- From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] Sent: Wednesday, February 19, 2014 4:52 PM To: Ananyev, Konstantin Cc: Didier Pallard; dev@dpdk.org Subject: Re: [dpdk-dev] [RFC PATCH 2/2] ixgbe: release software locked sema= phores on initialization 19/02/2014 13:41, Ananyev, Konstantin: > Can the patch be reworked to keep changes under librte_pmd_ixgbe/ixgbe = > directory untouched? Those files are derived directly from the BSD = > driver baseline, and any changes will make future merges of newer code = > more challenging. The changes should be limited to files in the = > librte_pmd_ixgbe directory (and ethdev). Thanks Please, could you send an url to the BSD driver baseline ? By the way, git is very good at rebasing such patches. And if the fix is good, it should be applied on the baseline. Refusing a fix without alternative is not an option. -- Thomas -------------------------------------------------------------- Intel Shannon Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Reg= istered Number: 308263 Business address: Dromore House, East Park, Shannon,= Co. Clare This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). Any review or distribution by others = is strictly prohibited. If you are not the intended recipient, please conta= ct the sender and delete all copies. -------------------------------------------------------------- Intel Shannon Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 Business address: Dromore House, East Park, Shannon, Co. Clare This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). Any review or distribution by others = is strictly prohibited. If you are not the intended recipient, please conta= ct the sender and delete all copies.