From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690074.outbound.protection.outlook.com [40.107.69.74]) by dpdk.org (Postfix) with ESMTP id 71FB67EC7 for ; Sat, 29 Sep 2018 10:14:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LnokgToCo+zDUKPyccA5KFO0U2jTwbsDW3dMxesVMjk=; b=Jbw0KXzPwQbmG9wEdyr5TXtCUrHzprys5fVqMByIzuuTOVvyqLB74UTD8YSixzuLWUT8IW4azLClvBC0R/ZO6Mw3uSfrTIgo3qyXRpa81Fnp9fSnMZENYSAZvTvO6MAHoWqyrSBR7kAHYwZKZMUTDHMQPCKPCaLNRrWGXkQwZio= Received: from BYAPR07MB5365.namprd07.prod.outlook.com (20.177.125.18) by BYAPR07MB5320.namprd07.prod.outlook.com (20.177.124.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Sat, 29 Sep 2018 08:14:29 +0000 Received: from BYAPR07MB5365.namprd07.prod.outlook.com ([fe80::2047:9647:f196:bde0]) by BYAPR07MB5365.namprd07.prod.outlook.com ([fe80::2047:9647:f196:bde0%6]) with mapi id 15.20.1143.022; Sat, 29 Sep 2018 08:14:29 +0000 From: "Mody, Rasesh" To: "dev@dpdk.org" CC: "Mody, Rasesh" , "ferruh.yigit@intel.com" , Dept-Eng DPDK Dev Thread-Topic: [PATCH 04/18] net/qede/base: workaround to indicate SHMEM data ready Thread-Index: AQHUV8xx5C3WfwbUz0u4sslu3y6xAQ== Date: Sat, 29 Sep 2018 08:14:29 +0000 Message-ID: <1538208822-9726-5-git-send-email-rasesh.mody@cavium.com> References: <1538208822-9726-1-git-send-email-rasesh.mody@cavium.com> In-Reply-To: <1538208822-9726-1-git-send-email-rasesh.mody@cavium.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR11CA0059.namprd11.prod.outlook.com (2603:10b6:a03:80::36) To BYAPR07MB5365.namprd07.prod.outlook.com (2603:10b6:a03:64::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Rasesh.Mody@cavium.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [198.186.1.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR07MB5320; 6:l4NKb7CkIx5xYaFTbj7s5WWt8XtwsLd/2jB8tWs0utaCapai80+j6tMlGzp9Fe+Bi9QoQar9OaQfJLRt4B4/RRfggh+tsh3gBCP5gGte1uItbFVn9CoHVirg748onXVLT/wqnCVIaunW7x0N+OtxGsdq1ENCoqtKta6+SAgVvqZgVPfKY4XclQo20zjYGOGwTb2IGFGX+eqZUKT6mJgYhe5Azh9sUWwCpCnhQhQzhK0M4SG3nvtO7zbc8iKKfDk9IRN33VXrtydJVi9WqbGebNbbPxjcR2+fafh5prleaktCxousVZCmYnDJ5nSfGuwqzyEGj9+DB71mDTwCNvKxk2OCFC2+DaJr4jMH3DwJAgTCDKszeGIuJGzCYcmSvhFaXbW/+yrMCcGz9Q3W0Ih3xOyAowYQQkRQO94SiRpbRr8/tvFCLt78HIXfHYdzkTLXDavUpU+RnLaeVVbY/sdODA==; 5:amN4ovdikpK/xFJnEzK8HQ3wnu3Snyvr6k9/n3pvDwLZfbrgJF5NdWcbK3snkul+9vnT3vCxgmvjpCdUglFujCbdDqbQjc0bg34VT6u2pchyY+x2uqNSsZQXxua3pY12gv9Ws8Ewgy96XORjAU0fZMSnMcqYHoefs25IQy+K3NQ=; 7:qJVz6/WJk40unHkDf5Xls1lxPO4+Ur5Xv9E3oi/SL7Q3+0Glh1xrvzNEYAJtXRtKygQbJ9zUNLI9XIMVw7d++To8kBXLov2OuE0Rv44weJqPjbSjjRqK4AxK8h9cwfBaueH1cmR1M6OZ+g66f9lVZTvSOQOWOso1BQ/o03rjPiDOo4nVP8sNYoGw68YDYyNva3xZAdvttOLBIlx/s0az8VXEPgMF7OU6HMsB/vBJRIGAESC01YNmmjsihq/kgs/9 x-ms-office365-filtering-correlation-id: 3ff760dd-f357-4af6-0aeb-08d625e3940a x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB5320; x-ms-traffictypediagnostic: BYAPR07MB5320: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(823301075)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(149066)(150057)(6041310)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051); SRVR:BYAPR07MB5320; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB5320; x-forefront-prvs: 0810818DA0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(366004)(396003)(136003)(346002)(39860400002)(199004)(189003)(97736004)(256004)(14454004)(4326008)(11346002)(2501003)(2900100001)(99286004)(54906003)(1730700003)(86362001)(68736007)(446003)(3846002)(25786009)(76176011)(5660300001)(2616005)(8676002)(305945005)(8936002)(486006)(107886003)(2351001)(26005)(2906002)(14444005)(5250100002)(71190400001)(5640700003)(36756003)(6436002)(6486002)(53936002)(316002)(72206003)(386003)(105586002)(71200400001)(6916009)(102836004)(6512007)(6116002)(6506007)(7736002)(81156014)(81166006)(186003)(52116002)(476003)(478600001)(66066001)(34290500001)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB5320; H:BYAPR07MB5365.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: e6PsXbRR4avDlgKUdctwjWTG0m5OTEm47g83GmemGalhxwMcsU5b0YaOFowJRgbkORmqLISzY/XVbNzplysguGm2IhujvFJZFmGBbPiOnqq7YY83nzTKhbz4gXGRQeeKcPHX7Pri+ZxF1Dym/9e8MwBpHT7wWVoQqTC8OxwFQ/kkt1RzNK4F+BM8KzsGvaFSleQMYn2LyQEQUBJAYghZFTfjHWu4nr+NZ9UgefYUUpf0+e+3pxm7MMoXLTcASyUPu3O4iUldO/K0LKvzXrNJU59ZtiWoDmwAB9+fkYCAOFm9Op5Iv2vc7YMPqZXhW9oXo8xFee2qbqyu1Rs0Kl/4MeM1kYwaAwBp+HRPhLWBrC0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ff760dd-f357-4af6-0aeb-08d625e3940a X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Sep 2018 08:14:29.4056 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB5320 Subject: [dpdk-dev] [PATCH 04/18] net/qede/base: workaround to indicate SHMEM data ready 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: Sat, 29 Sep 2018 08:14:37 -0000 The driver can notify that there was an MCP reset and read the SHMEM values before the management FW has completed initializing them. As a temporary solution, the "sup_msgs" field is used as a SHMEM data ready indication. This should be replaced with an actual indication when it is provided by the management FW. Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore_mcp.c | 43 ++++++++++++++++++++++++++++++---= ---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecor= e_mcp.c index 364c146..3811d27 100644 --- a/drivers/net/qede/base/ecore_mcp.c +++ b/drivers/net/qede/base/ecore_mcp.c @@ -177,10 +177,16 @@ enum _ecore_status_t ecore_mcp_free(struct ecore_hwfn= *p_hwfn) return ECORE_SUCCESS; } =20 +/* Maximum of 1 sec to wait for the SHMEM ready indication */ +#define ECORE_MCP_SHMEM_RDY_MAX_RETRIES 20 +#define ECORE_MCP_SHMEM_RDY_ITER_MS 50 + static enum _ecore_status_t ecore_load_mcp_offsets(struct ecore_hwfn *p_hw= fn, struct ecore_ptt *p_ptt) { struct ecore_mcp_info *p_info =3D p_hwfn->mcp_info; + u8 cnt =3D ECORE_MCP_SHMEM_RDY_MAX_RETRIES; + u8 msec =3D ECORE_MCP_SHMEM_RDY_ITER_MS; u32 drv_mb_offsize, mfw_mb_offsize; u32 mcp_pf_id =3D MCP_PF_ID(p_hwfn); =20 @@ -198,6 +204,35 @@ static enum _ecore_status_t ecore_load_mcp_offsets(str= uct ecore_hwfn *p_hwfn, =20 p_info->public_base |=3D GRCBASE_MCP; =20 + /* Get the MFW MB address and number of supported messages */ + mfw_mb_offsize =3D ecore_rd(p_hwfn, p_ptt, + SECTION_OFFSIZE_ADDR(p_info->public_base, + PUBLIC_MFW_MB)); + p_info->mfw_mb_addr =3D SECTION_ADDR(mfw_mb_offsize, mcp_pf_id); + p_info->mfw_mb_length =3D (u16)ecore_rd(p_hwfn, p_ptt, + p_info->mfw_mb_addr); + + /* @@@TBD: + * The driver can notify that there was an MCP reset, and read the SHMEM + * values before the MFW has completed initializing them. + * As a temporary solution, the "sup_msgs" field is used as a data ready + * indication. + * This should be replaced with an actual indication when it is provided + * by the MFW. + */ + while (!p_info->mfw_mb_length && cnt--) { + OSAL_MSLEEP(msec); + p_info->mfw_mb_length =3D (u16)ecore_rd(p_hwfn, p_ptt, + p_info->mfw_mb_addr); + } + + if (!cnt) { + DP_NOTICE(p_hwfn, false, + "Failed to get the SHMEM ready notification after %d msec\n", + ECORE_MCP_SHMEM_RDY_MAX_RETRIES * msec); + return ECORE_TIMEOUT; + } + /* Calculate the driver and MFW mailbox address */ drv_mb_offsize =3D ecore_rd(p_hwfn, p_ptt, SECTION_OFFSIZE_ADDR(p_info->public_base, @@ -208,14 +243,6 @@ static enum _ecore_status_t ecore_load_mcp_offsets(str= uct ecore_hwfn *p_hwfn, " mcp_pf_id =3D 0x%x\n", drv_mb_offsize, p_info->drv_mb_addr, mcp_pf_id); =20 - /* Set the MFW MB address */ - mfw_mb_offsize =3D ecore_rd(p_hwfn, p_ptt, - SECTION_OFFSIZE_ADDR(p_info->public_base, - PUBLIC_MFW_MB)); - p_info->mfw_mb_addr =3D SECTION_ADDR(mfw_mb_offsize, mcp_pf_id); - p_info->mfw_mb_length =3D (u16)ecore_rd(p_hwfn, p_ptt, - p_info->mfw_mb_addr); - /* Get the current driver mailbox sequence before sending * the first command */ --=20 1.7.10.3