From patchwork Tue Sep 19 01:29:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mody, Rasesh" X-Patchwork-Id: 28891 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 89D371B203; Tue, 19 Sep 2017 03:31:36 +0200 (CEST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0082.outbound.protection.outlook.com [104.47.37.82]) by dpdk.org (Postfix) with ESMTP id 836A51B199 for ; Tue, 19 Sep 2017 03:31:20 +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; bh=4evNyvKSncBBuP9IfJtjOiXbA83kk+CHuhQ2QxtlYSE=; b=GqPVqNcJEKJOTA29EX/TJQfpv+WvY5XMZQ5m7IYlfAMkQSncjf321B49lDQquc/2p3ng2ksoV8U+i5BgAxjTOxed4Z9wjvMEWtLJQ0wPVL1vjyvYq+LBbTIcpX9r88J8/j/LIFTc1iXRJvA5YC3Ylp6K8TUb1YcXKnZAKP+zfkg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rasesh.Mody@cavium.com; Received: from cavium.com (198.186.0.2) by SN4PR0701MB3838.namprd07.prod.outlook.com (2603:10b6:803:4f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Tue, 19 Sep 2017 01:31:17 +0000 From: Rasesh Mody To: dev@dpdk.org, ferruh.yigit@intel.com Cc: Rasesh Mody , Dept-EngDPDKDev@cavium.com Date: Mon, 18 Sep 2017 18:29:56 -0700 Message-Id: <1505784633-1171-17-git-send-email-rasesh.mody@cavium.com> X-Mailer: git-send-email 1.7.10.3 In-Reply-To: <1505784633-1171-1-git-send-email-rasesh.mody@cavium.com> References: <1505784633-1171-1-git-send-email-rasesh.mody@cavium.com> MIME-Version: 1.0 X-Originating-IP: [198.186.0.2] X-ClientProxiedBy: SN4PR0501CA0015.namprd05.prod.outlook.com (2603:10b6:803:40::28) To SN4PR0701MB3838.namprd07.prod.outlook.com (2603:10b6:803:4f::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 545b6c8f-5210-476f-62fe-08d4fefe201c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN4PR0701MB3838; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3838; 3:g2bxS5okOe53rB7nozBXZEsOPTbzDQ7ueDZVLxQTPE3a8UzIXlyXmEnQ4hkgN4GVphU0dYZJd3RTbgCoZTVxp36ctpJCbN4hqKyVTPo4HadACtYaA7dMwAGjhms4GsJpdlDaO5VAFqCOVuopDanpvWPGEVY9mL5JvEoWSCtRxnD91gZeIomHGRIpUOEPoaQ3KauZSfDsHzvGcqbExu0gPbcJ/RwFQ9dVrGyuMl6TYZ+2tUKGUy/9AJWrMOM2HAVW; 25:1BgLteW3Y1WwqPQX+D1arPPN9lzwT4xquffnyKNaDFwmZ+JqxIXEkQRlSjtGgOBQ6bUURa0i6YYx5ZwYsccMoLLOhqJWvgb0TC7zaPVXRIceMYeZxpwP1paAe0Pja8HvzBl7QxCkt/zLrr8inWuF+GjUwaJgyQzrhgBjy2eu0rdRPputc/mYdKnHxJiaJldUpx3dIhiTqYVSHqDN//bK+CUBsr2+ZNWM46I86knMflmjLduk3RT4/0lTAFSZIyZCo6zpKWLZyucVS3sEI7CD48WKClXRmWFi+ucYUJ9udMu8h+P/rXHmfUUe3SJzAYB/KGDn6xD8svUHW67+FdjF4w==; 31:cMKzDtEMrdxOxZeJtusKl+kFlyNxM9gs0bgYS9JypaMmgSoB3ymWvPFk6S12q5lQOKe7wo1/o/doDNBL2UMeGfaQ8ZxBOqQ8XOdQW40Dxre4F9Xwv/d3NXvHo7nQ7E/O7LoTqjsRkkoJQe3d6W2UNf9D1s5RFOUWim2KCbWXsSF/La0Sj402oGdFjxR/SdBrs6k+FB40Sy4piG/sLb/zaaSc+mvvCuwbsj2J345YBME= X-MS-TrafficTypeDiagnostic: SN4PR0701MB3838: X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3838; 20:HJQo0PbY1tJI9T3vIJK++6ThQdORNNAiIHeEghWto6A9Mh1Xk7xgXYH2pabQprOddTdIYiWDT3VR9O0VuZyKUtYwRmUWTRcDvSwXWC7Wtgosmxs/4gEYEJamSDcjakpDFlwevKk3L/866PaeQZjod8DD/4W2rriu+hCRiMXq8RwaWzaId6aBZfpt4Fi+lbpXTqmZzSEe3Gm6vctI/eHRA7qua30toS3M06cYvZYj/wL6GxDk/UGfPxal/habtprcNUvozMcSgNalpnKK1Ydeu7GaYfGvF2iamVr4FfTpPXKA2p2WdsS8x7XIL/zSdadBiGEfjN3C9fW14fmllkzUQwh2uBJsdfMDAni33aGekXxf7fSIFATI7ND7LGmbZm4xkpXnjTW+rJpgeDPTIqnCDfCW1jBF8At819R0PKasMZ2ExHIwkMj5Ihh5gi9+J9D7kg/kKfmvw3oGOY5tM1hgaDjIpAyR3vKfEmJ3iQaoX3Q4H26kBsxpM+qY+T8eh0dA; 4:jzgGciuOxC7/p7PS0Fr3O7rLJr6cxJsIV6/vj0fi9cVZ9hBknO9L8RoseKsKgEu+sP6tE0m+GblRQcvLC/LEatx5fJRhGDbRVPfMYnDgMJC/FEOTGXpDUM1ULRBCB/h/i/xR7+YQCc84HIEYHOubT5TG10yCjgeyZPZ7saIV4C+EXT1Eg8VAEM53SWtXTw/l5wyTcjVnJYUHp/Ao1ql0l85vAq3AeEtgn9L9rpN+pmNsa5b5SipZWoiDIjhK+Hn8 X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(3002001)(6041248)(20161123555025)(20161123562025)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN4PR0701MB3838; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN4PR0701MB3838; X-Forefront-PRVS: 04359FAD81 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(199003)(189002)(48376002)(33646002)(68736007)(316002)(21086003)(16526017)(16586007)(72206003)(36756003)(478600001)(97736004)(86362001)(66066001)(25786009)(69596002)(47776003)(50986999)(81166006)(8936002)(50226002)(8676002)(5660300001)(7736002)(53936002)(305945005)(81156014)(55016002)(50466002)(76176999)(53946003)(6116002)(3846002)(2950100002)(101416001)(4326008)(4720700003)(2906002)(107886003)(6666003)(189998001)(106356001)(5003940100001)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN4PR0701MB3838; H:cavium.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN4PR0701MB3838; 23:qbmldt4IPXaMQ8ZVlKWS/7VDmItPmhBCui7IPs6?= ycQRAJr8hwpztKs1vohRVEQxeWAH6sgL6WnkYloPtAhHzkRxMpHhkr6jvctjgonokIDnQzqCO4S3Z57MnDEIR8KQRsVXUHQpJed0PjDRqtXh3ORDueyaZcjI+Zzt3j5fblW2V7MFakz03Isudw1T3ZMkmMt9Nsi1n/MWVcfrTzvlOAjCBRv8JlKj68Hy6xe+esRwMkbK/m0eFwzYo+L03+xDzGqdF1Iz3C5k+6N5+Nx4w5L9beqrf7lI+ePeUtsEh2NUmI7UiSekElZ6XR525a1qu6Qt1euz73XR9kCeRVkjDYC4Olt5PWfBFJCWwe/QIEghyl/hdan0vywclj+p8fNKU+6a2n3Fhwj5C+dsgqvq+ZwNpuc9fJYrg7lLsBtx29QUIqHuVSKvH7fF4Ah2kw/vK82JdSYSHTmaDCAGjlr+Goyz1Q46ZTVH7JstMoMv0L4OWOXW+uF0JKdMpppllvQ/DQRwEu/zb1PafLv/VhXiMb7lC4m6HXwx+2uSWYeHfOwTl8woV5u9qS3r4yveqy6dJdOihjEQ4BKs3X1CWDQCsQhpsdO8dos7+LIEJq4/TwtILnzpNDeka18Ahg7RhszgYgULC9zpRQcFrdK4iH9cwKY3N0k5sjlF/f5IrCkOMGq9P/vvGGgcfTjrGb7BFbBix3vr0/F1/rdX7u4l7VfgwqyQCRHzhyPXHKLLOfKiW1kbETr7irTJhcRF/Y8jqd1YT9SyusXS81QF6fcGJTDbKJm1W0szSAl4m4LcKZ5ly8/5cXnhLi9hQE8IUrU2juZa2A/w78+PE03ZTVnVVbSbdDQ6nrDkcvuj70qkqENM4aZFUpS2Yq/SjaoFOQ5lsnmzK4w6or2Sl0epigmwpskU126E+i0yRJfFC2S/CSbEFmO8iY0/P8KTxhZI7r+DwRGstuajnyuei/eQJcC5oxzmg9I0vEXcQWP/Sf+vjT2BunRnLKAF3pzA0bu2aTBWpsjvvV9c4DznpXofGqbqmrRJ9291eBYcbZabsELPK8D+W0VPa1lfpfAEBYyLklgf/RooOdznrgs4bRasfG2FQCvyOsLtSF+G4UOptlJq3ZRwo70QQhsV9JpixHbS8z3lcrVNs X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3838; 6:9km28dHjnrbc268i9Q3sjhB0dRrFIWZcY/xUg14qVn2WmKQrTwBw721hRZ3p0+ospATPUYmWGXRULg4v1kH/2q9BGAQDt4D1dSzvXJskS6dPhy3W583oSZEKTB2TJfAdu0btYfm3SwSxEAtY0bIzHT66BMNxGRtixXo1rn/+YyQ1qeoVxd5xajeqcdAmhNuOQ0Z92HB9yzprXeEAT4RTkYG4fbyehbAbNKtTQOO5e+mrgPh/ktCnkVlRK7SX7xihhAShCeX25h0i5OV4Iq4Wlp0Qu5EuFG+Mdb9mBcmXfG/ZfjYt8r2lv5LRpw1EonpXlkffr4czUee5iIm9aSDu7w==; 5:5paS5eYCr/+aRqW+0oSimyskjZdy14zh2yZU+UGIHxn+ymJ8O+IZ9B7F688Is2FSi+e9T8ZxPuo2jNd5dFmiPL+/9k9ohmyLyeGds9BM88uH0rTwqAxlEOWUKOEv+P+8tB6+fEVzPx+pFg7Oiy7j3Q==; 24:N1+Hv28YPOTCmua78QF3fu+BrnVwEx+w9xL6MHsELPjyGQOoavu+d4rYYqWr+IygMqfmgE5yWUgi0vh1KTSkfAc5B4rZFyrGaRaM+1pRP60=; 7:AQUvkGGiUlvJdJoFQQifl6788nyookgwbbhikaCD9MimBpGqumDa3EUqEtYI6NvrHQC8kgM27rUIFv+N2CV4WjJIFWAnVwb1KVpuOrSH7zu62SXy0vf06ipZlyl0amJtRja4qqXgMKlVXi8G475TgfvY0BFsHYR2SwcC6MzqfmZ6Hw8gNqdVhrEDBeN8EShXlIoFJYSSQVwbH7CwvnkZLid4luOqkcxhC8+s3k+WjH8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2017 01:31:17.6837 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0701MB3838 Subject: [dpdk-dev] [PATCH 16/53] net/qede/base: use passed ptt handler 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Use the ptt[PF translation table] handler that is passed rather than using main ptt from the HW function. In ecore_hw_get_resc()'s error flow, release the MFW generic resource lock only if needed. Change the verbosity level of GRC timeout from DP_INFO() to DP_NOTICE(). Reduce verbosity of print in ecore_hw_bar_size(). Signed-off-by: Rasesh Mody --- drivers/net/qede/base/bcm_osal.h | 5 +- drivers/net/qede/base/ecore_cxt.c | 8 +- drivers/net/qede/base/ecore_cxt.h | 6 +- drivers/net/qede/base/ecore_dev.c | 120 +++++++++++++++++------------ drivers/net/qede/base/ecore_dev_api.h | 8 +- drivers/net/qede/base/ecore_hw.h | 4 +- drivers/net/qede/base/ecore_init_ops.c | 7 +- drivers/net/qede/base/ecore_init_ops.h | 3 +- drivers/net/qede/base/ecore_int.c | 28 +++---- drivers/net/qede/base/ecore_mcp.c | 28 ++++--- drivers/net/qede/base/ecore_mcp_api.h | 6 +- drivers/net/qede/base/ecore_sp_api.h | 2 + drivers/net/qede/base/ecore_sp_commands.c | 14 ++-- drivers/net/qede/base/ecore_sp_commands.h | 2 + drivers/net/qede/base/ecore_spq.c | 8 +- drivers/net/qede/base/ecore_sriov.c | 4 +- drivers/net/qede/base/ecore_sriov.h | 4 +- drivers/net/qede/qede_ethdev.c | 21 ++++- drivers/net/qede/qede_main.c | 27 +++++-- 19 files changed, 186 insertions(+), 119 deletions(-) diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h index bd07724..29edfb2 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -23,13 +23,14 @@ /* Forward declaration */ struct ecore_dev; struct ecore_hwfn; +struct ecore_ptt; struct ecore_vf_acquire_sw_info; struct vf_pf_resc_request; enum ecore_mcp_protocol_type; union ecore_mcp_protocol_stats; enum ecore_hw_err_type; -void qed_link_update(struct ecore_hwfn *hwfn); +void qed_link_update(struct ecore_hwfn *hwfn, struct ecore_ptt *ptt); #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN #undef __BIG_ENDIAN @@ -327,7 +328,7 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *, dma_addr_t *, #define OSAL_BITMAP_WEIGHT(bitmap, count) 0 -#define OSAL_LINK_UPDATE(hwfn) qed_link_update(hwfn) +#define OSAL_LINK_UPDATE(hwfn, ptt) qed_link_update(hwfn, ptt) #define OSAL_DCBX_AEN(hwfn, mib_type) nothing /* SR-IOV channel */ diff --git a/drivers/net/qede/base/ecore_cxt.c b/drivers/net/qede/base/ecore_cxt.c index 8c45315..08a616e 100644 --- a/drivers/net/qede/base/ecore_cxt.c +++ b/drivers/net/qede/base/ecore_cxt.c @@ -1422,7 +1422,7 @@ static void ecore_cdu_init_pf(struct ecore_hwfn *p_hwfn) } } -void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn) +void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt) { struct ecore_qm_info *qm_info = &p_hwfn->qm_info; struct ecore_qm_iids iids; @@ -1430,7 +1430,7 @@ void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn) OSAL_MEM_ZERO(&iids, sizeof(iids)); ecore_cxt_qm_iids(p_hwfn, &iids); - ecore_qm_pf_rt_init(p_hwfn, p_hwfn->p_main_ptt, p_hwfn->port_id, + ecore_qm_pf_rt_init(p_hwfn, p_ptt, p_hwfn->port_id, p_hwfn->rel_pf_id, qm_info->max_phys_tcs_per_port, p_hwfn->first_on_engine, iids.cids, iids.vf_cids, iids.tids, @@ -1785,9 +1785,9 @@ void ecore_cxt_hw_init_common(struct ecore_hwfn *p_hwfn) ecore_cdu_init_common(p_hwfn); } -void ecore_cxt_hw_init_pf(struct ecore_hwfn *p_hwfn) +void ecore_cxt_hw_init_pf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt) { - ecore_qm_init_pf(p_hwfn); + ecore_qm_init_pf(p_hwfn, p_ptt); ecore_cm_init_pf(p_hwfn); ecore_dq_init_pf(p_hwfn); ecore_cdu_init_pf(p_hwfn); diff --git a/drivers/net/qede/base/ecore_cxt.h b/drivers/net/qede/base/ecore_cxt.h index 6ff823a..54761e4 100644 --- a/drivers/net/qede/base/ecore_cxt.h +++ b/drivers/net/qede/base/ecore_cxt.h @@ -98,15 +98,17 @@ u32 ecore_cxt_get_proto_cid_start(struct ecore_hwfn *p_hwfn, * @brief ecore_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path. * * @param p_hwfn + * @param p_ptt */ -void ecore_cxt_hw_init_pf(struct ecore_hwfn *p_hwfn); +void ecore_cxt_hw_init_pf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt); /** * @brief ecore_qm_init_pf - Initailze the QM PF phase, per path * * @param p_hwfn + * @param p_ptt */ -void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn); +void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt); /** * @brief Reconfigures QM pf on the fly diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index 5c37e1c..9af6348 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -56,7 +56,9 @@ enum BAR_ID { BAR_ID_1 /* Used for doorbells */ }; -static u32 ecore_hw_bar_size(struct ecore_hwfn *p_hwfn, enum BAR_ID bar_id) +static u32 ecore_hw_bar_size(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, + enum BAR_ID bar_id) { u32 bar_reg = (bar_id == BAR_ID_0 ? PGLUE_B_REG_PF_BAR0_SIZE : PGLUE_B_REG_PF_BAR1_SIZE); @@ -70,7 +72,7 @@ static u32 ecore_hw_bar_size(struct ecore_hwfn *p_hwfn, enum BAR_ID bar_id) return 1 << 17; } - val = ecore_rd(p_hwfn, p_hwfn->p_main_ptt, bar_reg); + val = ecore_rd(p_hwfn, p_ptt, bar_reg); if (val) return 1 << (val + 15); @@ -79,14 +81,12 @@ static u32 ecore_hw_bar_size(struct ecore_hwfn *p_hwfn, enum BAR_ID bar_id) * In older MFW versions they are set to 0 which means disabled. */ if (p_hwfn->p_dev->num_hwfns > 1) { - DP_NOTICE(p_hwfn, false, - "BAR size not configured. Assuming BAR size of 256kB" - " for GRC and 512kB for DB\n"); + DP_INFO(p_hwfn, + "BAR size not configured. Assuming BAR size of 256kB for GRC and 512kB for DB\n"); val = BAR_ID_0 ? 256 * 1024 : 512 * 1024; } else { - DP_NOTICE(p_hwfn, false, - "BAR size not configured. Assuming BAR size of 512kB" - " for GRC and 512kB for DB\n"); + DP_INFO(p_hwfn, + "BAR size not configured. Assuming BAR size of 512kB for GRC and 512kB for DB\n"); val = 512 * 1024; } @@ -777,7 +777,7 @@ enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn, ecore_init_clear_rt_data(p_hwfn); /* prepare QM portion of runtime array */ - ecore_qm_init_pf(p_hwfn); + ecore_qm_init_pf(p_hwfn, p_ptt); /* activate init tool on runtime array */ rc = ecore_init_run(p_hwfn, p_ptt, PHASE_QM_PF, p_hwfn->rel_pf_id, @@ -1036,7 +1036,7 @@ void ecore_resc_setup(struct ecore_dev *p_dev) ecore_int_setup(p_hwfn, p_hwfn->p_main_ptt); ecore_l2_setup(p_hwfn); - ecore_iov_setup(p_hwfn, p_hwfn->p_main_ptt); + ecore_iov_setup(p_hwfn); } } @@ -1327,11 +1327,11 @@ static enum _ecore_status_t ecore_hw_init_common(struct ecore_hwfn *p_hwfn, ecore_init_cau_rt_data(p_dev); /* Program GTT windows */ - ecore_gtt_init(p_hwfn); + ecore_gtt_init(p_hwfn, p_ptt); #ifndef ASIC_ONLY if (CHIP_REV_IS_EMUL(p_dev)) { - rc = ecore_hw_init_chip(p_hwfn, p_hwfn->p_main_ptt); + rc = ecore_hw_init_chip(p_hwfn, p_ptt); if (rc != ECORE_SUCCESS) return rc; } @@ -1637,7 +1637,7 @@ enum ECORE_ROCE_EDPM_MODE { enum _ecore_status_t rc = ECORE_SUCCESS; u8 cond; - db_bar_size = ecore_hw_bar_size(p_hwfn, BAR_ID_1); + db_bar_size = ecore_hw_bar_size(p_hwfn, p_ptt, BAR_ID_1); if (p_hwfn->p_dev->num_hwfns > 1) db_bar_size /= 2; @@ -1808,7 +1808,7 @@ static enum _ecore_status_t ecore_hw_init_port(struct ecore_hwfn *p_hwfn, /* Update rate limit once we'll actually have a link */ p_hwfn->qm_info.pf_rl = 100000; } - ecore_cxt_hw_init_pf(p_hwfn); + ecore_cxt_hw_init_pf(p_hwfn, p_ptt); ecore_int_igu_init_rt(p_hwfn); @@ -1877,7 +1877,8 @@ static enum _ecore_status_t ecore_hw_init_port(struct ecore_hwfn *p_hwfn, return rc; /* send function start command */ - rc = ecore_sp_pf_start(p_hwfn, p_tunn, p_hwfn->p_dev->mf_mode, + rc = ecore_sp_pf_start(p_hwfn, p_ptt, p_tunn, + p_hwfn->p_dev->mf_mode, allow_npar_tx_switch); if (rc) { DP_NOTICE(p_hwfn, true, @@ -2394,18 +2395,21 @@ enum _ecore_status_t ecore_hw_stop(struct ecore_dev *p_dev) return rc2; } -void ecore_hw_stop_fastpath(struct ecore_dev *p_dev) +enum _ecore_status_t ecore_hw_stop_fastpath(struct ecore_dev *p_dev) { int j; for_each_hwfn(p_dev, j) { struct ecore_hwfn *p_hwfn = &p_dev->hwfns[j]; - struct ecore_ptt *p_ptt = p_hwfn->p_main_ptt; + struct ecore_ptt *p_ptt; if (IS_VF(p_dev)) { ecore_vf_pf_int_cleanup(p_hwfn); continue; } + p_ptt = ecore_ptt_acquire(p_hwfn); + if (!p_ptt) + return ECORE_AGAIN; DP_VERBOSE(p_hwfn, ECORE_MSG_IFDOWN, "Shutting down the fastpath\n"); @@ -2427,15 +2431,22 @@ void ecore_hw_stop_fastpath(struct ecore_dev *p_dev) ecore_int_igu_init_pure_rt(p_hwfn, p_ptt, false, false); /* Need to wait 1ms to guarantee SBs are cleared */ OSAL_MSLEEP(1); + ecore_ptt_release(p_hwfn, p_ptt); } + + return ECORE_SUCCESS; } -void ecore_hw_start_fastpath(struct ecore_hwfn *p_hwfn) +enum _ecore_status_t ecore_hw_start_fastpath(struct ecore_hwfn *p_hwfn) { - struct ecore_ptt *p_ptt = p_hwfn->p_main_ptt; + struct ecore_ptt *p_ptt; if (IS_VF(p_hwfn->p_dev)) - return; + return ECORE_SUCCESS; + + p_ptt = ecore_ptt_acquire(p_hwfn); + if (!p_ptt) + return ECORE_AGAIN; /* If roce info is allocated it means roce is initialized and should * be enabled in searcher. @@ -2448,8 +2459,11 @@ void ecore_hw_start_fastpath(struct ecore_hwfn *p_hwfn) } /* Re-open incoming traffic */ - ecore_wr(p_hwfn, p_hwfn->p_main_ptt, + ecore_wr(p_hwfn, p_ptt, NIG_REG_RX_LLH_BRB_GATE_DNTFWD_PERPF, 0x0); + ecore_ptt_release(p_hwfn, p_ptt); + + return ECORE_SUCCESS; } /* Free hwfn memory and resources acquired in hw_hwfn_prepare */ @@ -2589,12 +2603,14 @@ const char *ecore_hw_get_resc_name(enum ecore_resources res_id) static enum _ecore_status_t __ecore_hw_set_soft_resc_size(struct ecore_hwfn *p_hwfn, - enum ecore_resources res_id, u32 resc_max_val, + struct ecore_ptt *p_ptt, + enum ecore_resources res_id, + u32 resc_max_val, u32 *p_mcp_resp) { enum _ecore_status_t rc; - rc = ecore_mcp_set_resc_max_val(p_hwfn, p_hwfn->p_main_ptt, res_id, + rc = ecore_mcp_set_resc_max_val(p_hwfn, p_ptt, res_id, resc_max_val, p_mcp_resp); if (rc != ECORE_SUCCESS) { DP_NOTICE(p_hwfn, true, @@ -2612,7 +2628,8 @@ const char *ecore_hw_get_resc_name(enum ecore_resources res_id) } static enum _ecore_status_t -ecore_hw_set_soft_resc_size(struct ecore_hwfn *p_hwfn) +ecore_hw_set_soft_resc_size(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt) { bool b_ah = ECORE_IS_AH(p_hwfn->p_dev); u32 resc_max_val, mcp_resp; @@ -2632,7 +2649,7 @@ const char *ecore_hw_get_resc_name(enum ecore_resources res_id) continue; } - rc = __ecore_hw_set_soft_resc_size(p_hwfn, res_id, + rc = __ecore_hw_set_soft_resc_size(p_hwfn, p_ptt, res_id, resc_max_val, &mcp_resp); if (rc != ECORE_SUCCESS) return rc; @@ -2821,6 +2838,7 @@ static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn, #define ECORE_RESC_ALLOC_LOCK_RETRY_INTVL_US 10000 /* 10 msec */ static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, bool drv_resc_alloc) { struct ecore_resc_unlock_params resc_unlock_params; @@ -2858,7 +2876,7 @@ static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn, OSAL_MEM_ZERO(&resc_unlock_params, sizeof(resc_unlock_params)); resc_unlock_params.resource = ECORE_RESC_LOCK_RESC_ALLOC; - rc = ecore_mcp_resc_lock(p_hwfn, p_hwfn->p_main_ptt, &resc_lock_params); + rc = ecore_mcp_resc_lock(p_hwfn, p_ptt, &resc_lock_params); if (rc != ECORE_SUCCESS && rc != ECORE_NOTIMPL) { return rc; } else if (rc == ECORE_NOTIMPL) { @@ -2870,7 +2888,7 @@ static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn, rc = ECORE_BUSY; goto unlock_and_exit; } else { - rc = ecore_hw_set_soft_resc_size(p_hwfn); + rc = ecore_hw_set_soft_resc_size(p_hwfn, p_ptt); if (rc != ECORE_SUCCESS && rc != ECORE_NOTIMPL) { DP_NOTICE(p_hwfn, false, "Failed to set the max values of the soft resources\n"); @@ -2878,7 +2896,7 @@ static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn, } else if (rc == ECORE_NOTIMPL) { DP_INFO(p_hwfn, "Skip the max values setting of the soft resources since it is not supported by the MFW\n"); - rc = ecore_mcp_resc_unlock(p_hwfn, p_hwfn->p_main_ptt, + rc = ecore_mcp_resc_unlock(p_hwfn, p_ptt, &resc_unlock_params); if (rc != ECORE_SUCCESS) DP_INFO(p_hwfn, @@ -2891,7 +2909,7 @@ static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn, goto unlock_and_exit; if (resc_lock_params.b_granted && !resc_unlock_params.b_released) { - rc = ecore_mcp_resc_unlock(p_hwfn, p_hwfn->p_main_ptt, + rc = ecore_mcp_resc_unlock(p_hwfn, p_ptt, &resc_unlock_params); if (rc != ECORE_SUCCESS) DP_INFO(p_hwfn, @@ -2938,7 +2956,7 @@ static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn, } /* This will also learn the number of SBs from MFW */ - if (ecore_int_igu_reset_cam(p_hwfn, p_hwfn->p_main_ptt)) + if (ecore_int_igu_reset_cam(p_hwfn, p_ptt)) return ECORE_INVAL; ecore_hw_set_feat(p_hwfn); @@ -2954,7 +2972,9 @@ static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn, return ECORE_SUCCESS; unlock_and_exit: - ecore_mcp_resc_unlock(p_hwfn, p_hwfn->p_main_ptt, &resc_unlock_params); + if (resc_lock_params.b_granted && !resc_unlock_params.b_released) + ecore_mcp_resc_unlock(p_hwfn, p_ptt, + &resc_unlock_params); return rc; } @@ -3486,7 +3506,7 @@ static void ecore_mcp_get_eee_caps(struct ecore_hwfn *p_hwfn, * the resources/features depends on them. * This order is not harmful if not forcing. */ - rc = ecore_hw_get_resc(p_hwfn, drv_resc_alloc); + rc = ecore_hw_get_resc(p_hwfn, p_ptt, drv_resc_alloc); if (rc != ECORE_SUCCESS && p_params->b_relaxed_probe) { rc = ECORE_SUCCESS; p_params->p_relaxed_res = ECORE_HW_PREPARE_BAD_MCP; @@ -3495,9 +3515,10 @@ static void ecore_mcp_get_eee_caps(struct ecore_hwfn *p_hwfn, return rc; } -static enum _ecore_status_t ecore_get_dev_info(struct ecore_dev *p_dev) +static enum _ecore_status_t ecore_get_dev_info(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt) { - struct ecore_hwfn *p_hwfn = ECORE_LEADING_HWFN(p_dev); + struct ecore_dev *p_dev = p_hwfn->p_dev; u16 device_id_mask; u32 tmp; @@ -3522,16 +3543,15 @@ static enum _ecore_status_t ecore_get_dev_info(struct ecore_dev *p_dev) return ECORE_ABORTED; } - p_dev->chip_num = (u16)ecore_rd(p_hwfn, p_hwfn->p_main_ptt, - MISCS_REG_CHIP_NUM); - p_dev->chip_rev = (u16)ecore_rd(p_hwfn, p_hwfn->p_main_ptt, - MISCS_REG_CHIP_REV); + p_dev->chip_num = (u16)ecore_rd(p_hwfn, p_ptt, + MISCS_REG_CHIP_NUM); + p_dev->chip_rev = (u16)ecore_rd(p_hwfn, p_ptt, + MISCS_REG_CHIP_REV); MASK_FIELD(CHIP_REV, p_dev->chip_rev); /* Learn number of HW-functions */ - tmp = ecore_rd(p_hwfn, p_hwfn->p_main_ptt, - MISCS_REG_CMT_ENABLED_FOR_PAIR); + tmp = ecore_rd(p_hwfn, p_ptt, MISCS_REG_CMT_ENABLED_FOR_PAIR); if (tmp & (1 << p_hwfn->rel_pf_id)) { DP_NOTICE(p_dev->hwfns, false, "device in CMT mode\n"); @@ -3551,10 +3571,10 @@ static enum _ecore_status_t ecore_get_dev_info(struct ecore_dev *p_dev) } #endif - p_dev->chip_bond_id = ecore_rd(p_hwfn, p_hwfn->p_main_ptt, + p_dev->chip_bond_id = ecore_rd(p_hwfn, p_ptt, MISCS_REG_CHIP_TEST_REG) >> 4; MASK_FIELD(CHIP_BOND_ID, p_dev->chip_bond_id); - p_dev->chip_metal = (u16)ecore_rd(p_hwfn, p_hwfn->p_main_ptt, + p_dev->chip_metal = (u16)ecore_rd(p_hwfn, p_ptt, MISCS_REG_CHIP_METAL); MASK_FIELD(CHIP_METAL, p_dev->chip_metal); DP_INFO(p_dev->hwfns, @@ -3571,12 +3591,10 @@ static enum _ecore_status_t ecore_get_dev_info(struct ecore_dev *p_dev) } #ifndef ASIC_ONLY if (CHIP_REV_IS_EMUL(p_dev) && ECORE_IS_AH(p_dev)) - ecore_wr(p_hwfn, p_hwfn->p_main_ptt, - MISCS_REG_PLL_MAIN_CTRL_4, 0x1); + ecore_wr(p_hwfn, p_ptt, MISCS_REG_PLL_MAIN_CTRL_4, 0x1); if (CHIP_REV_IS_EMUL(p_dev)) { - tmp = ecore_rd(p_hwfn, p_hwfn->p_main_ptt, - MISCS_REG_ECO_RESERVED); + tmp = ecore_rd(p_hwfn, p_ptt, MISCS_REG_ECO_RESERVED); if (tmp & (1 << 29)) { DP_NOTICE(p_hwfn, false, "Emulation: Running on a FULL build\n"); @@ -3656,7 +3674,7 @@ void ecore_prepare_hibernate(struct ecore_dev *p_dev) /* First hwfn learns basic information, e.g., number of hwfns */ if (!p_hwfn->my_id) { - rc = ecore_get_dev_info(p_dev); + rc = ecore_get_dev_info(p_hwfn, p_hwfn->p_main_ptt); if (rc != ECORE_SUCCESS) { if (p_params->b_relaxed_probe) p_params->p_relaxed_res = @@ -3785,11 +3803,15 @@ enum _ecore_status_t ecore_hw_prepare(struct ecore_dev *p_dev, /* adjust bar offset for second engine */ addr = (u8 OSAL_IOMEM *)p_dev->regview + - ecore_hw_bar_size(p_hwfn, BAR_ID_0) / 2; + ecore_hw_bar_size(p_hwfn, + p_hwfn->p_main_ptt, + BAR_ID_0) / 2; p_regview = (void OSAL_IOMEM *)addr; addr = (u8 OSAL_IOMEM *)p_dev->doorbells + - ecore_hw_bar_size(p_hwfn, BAR_ID_1) / 2; + ecore_hw_bar_size(p_hwfn, + p_hwfn->p_main_ptt, + BAR_ID_1) / 2; p_doorbell = (void OSAL_IOMEM *)addr; /* prepare second hw function */ diff --git a/drivers/net/qede/base/ecore_dev_api.h b/drivers/net/qede/base/ecore_dev_api.h index 99a9c49..b3c9f89 100644 --- a/drivers/net/qede/base/ecore_dev_api.h +++ b/drivers/net/qede/base/ecore_dev_api.h @@ -142,8 +142,9 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev, * * @param p_dev * + * @return enum _ecore_status_t */ -void ecore_hw_stop_fastpath(struct ecore_dev *p_dev); +enum _ecore_status_t ecore_hw_stop_fastpath(struct ecore_dev *p_dev); #ifndef LINUX_REMOVE /** @@ -160,10 +161,11 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev, * @brief ecore_hw_start_fastpath -restart fastpath traffic, * only if hw_stop_fastpath was called - * @param p_dev + * @param p_hwfn * + * @return enum _ecore_status_t */ -void ecore_hw_start_fastpath(struct ecore_hwfn *p_hwfn); +enum _ecore_status_t ecore_hw_start_fastpath(struct ecore_hwfn *p_hwfn); enum ecore_hw_prepare_result { ECORE_HW_PREPARE_SUCCESS, diff --git a/drivers/net/qede/base/ecore_hw.h b/drivers/net/qede/base/ecore_hw.h index 0750b2e..726bc18 100644 --- a/drivers/net/qede/base/ecore_hw.h +++ b/drivers/net/qede/base/ecore_hw.h @@ -71,8 +71,10 @@ enum _dmae_cmd_crc_mask { * @brief ecore_gtt_init - Initialize GTT windows * * @param p_hwfn +* @param p_ptt */ -void ecore_gtt_init(struct ecore_hwfn *p_hwfn); +void ecore_gtt_init(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt); /** * @brief ecore_ptt_invalidate - Forces all ptt entries to be re-configured diff --git a/drivers/net/qede/base/ecore_init_ops.c b/drivers/net/qede/base/ecore_init_ops.c index 80a52ca..c76cc07 100644 --- a/drivers/net/qede/base/ecore_init_ops.c +++ b/drivers/net/qede/base/ecore_init_ops.c @@ -525,7 +525,8 @@ enum _ecore_status_t ecore_init_run(struct ecore_hwfn *p_hwfn, return rc; } -void ecore_gtt_init(struct ecore_hwfn *p_hwfn) +void ecore_gtt_init(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt) { u32 gtt_base; u32 i; @@ -543,7 +544,7 @@ void ecore_gtt_init(struct ecore_hwfn *p_hwfn) /* initialize PTT/GTT (poll for completion) */ if (!initialized) { - ecore_wr(p_hwfn, p_hwfn->p_main_ptt, + ecore_wr(p_hwfn, p_ptt, PGLUE_B_REG_START_INIT_PTT_GTT, 1); initialized = true; } @@ -552,7 +553,7 @@ void ecore_gtt_init(struct ecore_hwfn *p_hwfn) /* ptt might be overrided by HW until this is done */ OSAL_UDELAY(10); ecore_ptt_invalidate(p_hwfn); - val = ecore_rd(p_hwfn, p_hwfn->p_main_ptt, + val = ecore_rd(p_hwfn, p_ptt, PGLUE_B_REG_INIT_DONE_PTT_GTT); } while ((val != 1) && --poll_cnt); diff --git a/drivers/net/qede/base/ecore_init_ops.h b/drivers/net/qede/base/ecore_init_ops.h index d58c7d6..e293a4a 100644 --- a/drivers/net/qede/base/ecore_init_ops.h +++ b/drivers/net/qede/base/ecore_init_ops.h @@ -107,5 +107,6 @@ void ecore_init_store_rt_agg(struct ecore_hwfn *p_hwfn, * * @param p_hwfn */ -void ecore_gtt_init(struct ecore_hwfn *p_hwfn); +void ecore_gtt_init(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt); #endif /* __ECORE_INIT_OPS__ */ diff --git a/drivers/net/qede/base/ecore_int.c b/drivers/net/qede/base/ecore_int.c index f8b104a..e7dfe04 100644 --- a/drivers/net/qede/base/ecore_int.c +++ b/drivers/net/qede/base/ecore_int.c @@ -248,21 +248,21 @@ static enum _ecore_status_t ecore_grc_attn_cb(struct ecore_hwfn *p_hwfn) tmp2 = ecore_rd(p_hwfn, p_hwfn->p_dpc_ptt, GRC_REG_TIMEOUT_ATTN_ACCESS_DATA_1); - DP_INFO(p_hwfn->p_dev, - "GRC timeout [%08x:%08x] - %s Address [%08x] [Master %s]" - " [PF: %02x %s %02x]\n", - tmp2, tmp, - (tmp & ECORE_GRC_ATTENTION_RDWR_BIT) ? "Write to" : "Read from", - (tmp & ECORE_GRC_ATTENTION_ADDRESS_MASK) << 2, - grc_timeout_attn_master_to_str((tmp & - ECORE_GRC_ATTENTION_MASTER_MASK) >> - ECORE_GRC_ATTENTION_MASTER_SHIFT), - (tmp2 & ECORE_GRC_ATTENTION_PF_MASK), - (((tmp2 & ECORE_GRC_ATTENTION_PRIV_MASK) >> + DP_NOTICE(p_hwfn->p_dev, false, + "GRC timeout [%08x:%08x] - %s Address [%08x] [Master %s] [PF: %02x %s %02x]\n", + tmp2, tmp, + (tmp & ECORE_GRC_ATTENTION_RDWR_BIT) ? "Write to" + : "Read from", + (tmp & ECORE_GRC_ATTENTION_ADDRESS_MASK) << 2, + grc_timeout_attn_master_to_str( + (tmp & ECORE_GRC_ATTENTION_MASTER_MASK) >> + ECORE_GRC_ATTENTION_MASTER_SHIFT), + (tmp2 & ECORE_GRC_ATTENTION_PF_MASK), + (((tmp2 & ECORE_GRC_ATTENTION_PRIV_MASK) >> ECORE_GRC_ATTENTION_PRIV_SHIFT) == - ECORE_GRC_ATTENTION_PRIV_VF) ? "VF" : "(Irrelevant:)", - (tmp2 & ECORE_GRC_ATTENTION_VF_MASK) >> - ECORE_GRC_ATTENTION_VF_SHIFT); + ECORE_GRC_ATTENTION_PRIV_VF) ? "VF" : "(Irrelevant:)", + (tmp2 & ECORE_GRC_ATTENTION_VF_MASK) >> + ECORE_GRC_ATTENTION_VF_SHIFT); out: /* Regardles of anything else, clean the validity bit */ diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecore_mcp.c index 3be23ba..b334997 100644 --- a/drivers/net/qede/base/ecore_mcp.c +++ b/drivers/net/qede/base/ecore_mcp.c @@ -1196,7 +1196,7 @@ static void ecore_mcp_handle_link_change(struct ecore_hwfn *p_hwfn, if (p_hwfn->mcp_info->capabilities & FW_MB_PARAM_FEATURE_SUPPORT_EEE) ecore_mcp_read_eee_config(p_hwfn, p_ptt, p_link); - OSAL_LINK_UPDATE(p_hwfn); + OSAL_LINK_UPDATE(p_hwfn, p_ptt); } enum _ecore_status_t ecore_mcp_set_link(struct ecore_hwfn *p_hwfn, @@ -1832,14 +1832,13 @@ enum _ecore_status_t ecore_mcp_get_mfw_ver(struct ecore_hwfn *p_hwfn, return ECORE_SUCCESS; } -enum _ecore_status_t ecore_mcp_get_media_type(struct ecore_dev *p_dev, +enum _ecore_status_t ecore_mcp_get_media_type(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, u32 *p_media_type) { - struct ecore_hwfn *p_hwfn = &p_dev->hwfns[0]; - struct ecore_ptt *p_ptt; /* TODO - Add support for VFs */ - if (IS_VF(p_dev)) + if (IS_VF(p_hwfn->p_dev)) return ECORE_INVAL; if (!ecore_mcp_is_init(p_hwfn)) { @@ -1847,16 +1846,15 @@ enum _ecore_status_t ecore_mcp_get_media_type(struct ecore_dev *p_dev, return ECORE_BUSY; } - *p_media_type = MEDIA_UNSPECIFIED; - - p_ptt = ecore_ptt_acquire(p_hwfn); - if (!p_ptt) - return ECORE_BUSY; - - *p_media_type = ecore_rd(p_hwfn, p_ptt, p_hwfn->mcp_info->port_addr + - OFFSETOF(struct public_port, media_type)); - - ecore_ptt_release(p_hwfn, p_ptt); + if (!p_ptt) { + *p_media_type = MEDIA_UNSPECIFIED; + return ECORE_INVAL; + } else { + *p_media_type = ecore_rd(p_hwfn, p_ptt, + p_hwfn->mcp_info->port_addr + + OFFSETOF(struct public_port, + media_type)); + } return ECORE_SUCCESS; } diff --git a/drivers/net/qede/base/ecore_mcp_api.h b/drivers/net/qede/base/ecore_mcp_api.h index a3d6bc1..ac889f9 100644 --- a/drivers/net/qede/base/ecore_mcp_api.h +++ b/drivers/net/qede/base/ecore_mcp_api.h @@ -608,14 +608,16 @@ enum _ecore_status_t ecore_mcp_get_mfw_ver(struct ecore_hwfn *p_hwfn, * @brief Get media type value of the port. * * @param p_dev - ecore dev pointer + * @param p_ptt * @param mfw_ver - media type value * * @return enum _ecore_status_t - * ECORE_SUCCESS - Operation was successful. * ECORE_BUSY - Operation failed */ -enum _ecore_status_t ecore_mcp_get_media_type(struct ecore_dev *p_dev, - u32 *media_type); +enum _ecore_status_t ecore_mcp_get_media_type(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, + u32 *media_type); /** * @brief - Sends a command to the MCP mailbox. diff --git a/drivers/net/qede/base/ecore_sp_api.h b/drivers/net/qede/base/ecore_sp_api.h index c8e564f..86e8496 100644 --- a/drivers/net/qede/base/ecore_sp_api.h +++ b/drivers/net/qede/base/ecore_sp_api.h @@ -49,6 +49,7 @@ enum _ecore_status_t ecore_eth_cqe_completion(struct ecore_hwfn *p_hwfn, * for a physical function (PF). * * @param p_hwfn + * @param p_ptt * @param p_tunn - pf update tunneling parameters * @param comp_mode - completion mode * @param p_comp_data - callback function @@ -58,6 +59,7 @@ enum _ecore_status_t ecore_eth_cqe_completion(struct ecore_hwfn *p_hwfn, enum _ecore_status_t ecore_sp_pf_update_tunn_cfg(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, struct ecore_tunnel_info *p_tunn, enum spq_mode comp_mode, struct ecore_spq_comp_cb *p_comp_data); diff --git a/drivers/net/qede/base/ecore_sp_commands.c b/drivers/net/qede/base/ecore_sp_commands.c index d6e4b9e..abfdfbf 100644 --- a/drivers/net/qede/base/ecore_sp_commands.c +++ b/drivers/net/qede/base/ecore_sp_commands.c @@ -232,6 +232,7 @@ static void ecore_set_hw_tunn_mode(struct ecore_hwfn *p_hwfn, } static void ecore_set_hw_tunn_mode_port(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, struct ecore_tunnel_info *p_tunn) { if (ECORE_IS_BB_A0(p_hwfn->p_dev)) { @@ -241,14 +242,14 @@ static void ecore_set_hw_tunn_mode_port(struct ecore_hwfn *p_hwfn, } if (p_tunn->vxlan_port.b_update_port) - ecore_set_vxlan_dest_port(p_hwfn, p_hwfn->p_main_ptt, + ecore_set_vxlan_dest_port(p_hwfn, p_ptt, p_tunn->vxlan_port.port); if (p_tunn->geneve_port.b_update_port) - ecore_set_geneve_dest_port(p_hwfn, p_hwfn->p_main_ptt, + ecore_set_geneve_dest_port(p_hwfn, p_ptt, p_tunn->geneve_port.port); - ecore_set_hw_tunn_mode(p_hwfn, p_hwfn->p_main_ptt, p_tunn); + ecore_set_hw_tunn_mode(p_hwfn, p_ptt, p_tunn); } static void @@ -294,6 +295,7 @@ static void ecore_set_hw_tunn_mode_port(struct ecore_hwfn *p_hwfn, } enum _ecore_status_t ecore_sp_pf_start(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, struct ecore_tunnel_info *p_tunn, enum ecore_mf_mode mode, bool allow_npar_tx_switch) @@ -390,7 +392,8 @@ enum _ecore_status_t ecore_sp_pf_start(struct ecore_hwfn *p_hwfn, rc = ecore_spq_post(p_hwfn, p_ent, OSAL_NULL); if (p_tunn) - ecore_set_hw_tunn_mode_port(p_hwfn, &p_hwfn->p_dev->tunnel); + ecore_set_hw_tunn_mode_port(p_hwfn, p_ptt, + &p_hwfn->p_dev->tunnel); return rc; } @@ -465,6 +468,7 @@ enum _ecore_status_t ecore_sp_rl_update(struct ecore_hwfn *p_hwfn, /* Set pf update ramrod command params */ enum _ecore_status_t ecore_sp_pf_update_tunn_cfg(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, struct ecore_tunnel_info *p_tunn, enum spq_mode comp_mode, struct ecore_spq_comp_cb *p_comp_data) @@ -505,7 +509,7 @@ enum _ecore_status_t if (rc != ECORE_SUCCESS) return rc; - ecore_set_hw_tunn_mode_port(p_hwfn, &p_hwfn->p_dev->tunnel); + ecore_set_hw_tunn_mode_port(p_hwfn, p_ptt, &p_hwfn->p_dev->tunnel); return rc; } diff --git a/drivers/net/qede/base/ecore_sp_commands.h b/drivers/net/qede/base/ecore_sp_commands.h index 33e31e4..b9f40b7 100644 --- a/drivers/net/qede/base/ecore_sp_commands.h +++ b/drivers/net/qede/base/ecore_sp_commands.h @@ -59,6 +59,7 @@ enum _ecore_status_t ecore_sp_init_request(struct ecore_hwfn *p_hwfn, * to the internal RAM of the UStorm by the Function Start Ramrod. * * @param p_hwfn + * @param p_ptt * @param p_tunn - pf start tunneling configuration * @param mode * @param allow_npar_tx_switch - npar tx switching to be used @@ -68,6 +69,7 @@ enum _ecore_status_t ecore_sp_init_request(struct ecore_hwfn *p_hwfn, */ enum _ecore_status_t ecore_sp_pf_start(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, struct ecore_tunnel_info *p_tunn, enum ecore_mf_mode mode, bool allow_npar_tx_switch); diff --git a/drivers/net/qede/base/ecore_spq.c b/drivers/net/qede/base/ecore_spq.c index 3c1d05b..25d573e 100644 --- a/drivers/net/qede/base/ecore_spq.c +++ b/drivers/net/qede/base/ecore_spq.c @@ -87,6 +87,7 @@ static enum _ecore_status_t ecore_spq_block(struct ecore_hwfn *p_hwfn, u8 *p_fw_ret, bool skip_quick_poll) { struct ecore_spq_comp_done *comp_done; + struct ecore_ptt *p_ptt; enum _ecore_status_t rc; /* A relatively short polling period w/o sleeping, to allow the FW to @@ -103,8 +104,13 @@ static enum _ecore_status_t ecore_spq_block(struct ecore_hwfn *p_hwfn, if (rc == ECORE_SUCCESS) return ECORE_SUCCESS; + p_ptt = ecore_ptt_acquire(p_hwfn); + if (!p_ptt) + return ECORE_AGAIN; + DP_INFO(p_hwfn, "Ramrod is stuck, requesting MCP drain\n"); - rc = ecore_mcp_drain(p_hwfn, p_hwfn->p_main_ptt); + rc = ecore_mcp_drain(p_hwfn, p_ptt); + ecore_ptt_release(p_hwfn, p_ptt); if (rc != ECORE_SUCCESS) { DP_NOTICE(p_hwfn, true, "MCP drain failed\n"); goto err; diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ecore_sriov.c index 3f500d3..b8e03d0 100644 --- a/drivers/net/qede/base/ecore_sriov.c +++ b/drivers/net/qede/base/ecore_sriov.c @@ -601,7 +601,7 @@ enum _ecore_status_t ecore_iov_alloc(struct ecore_hwfn *p_hwfn) return ecore_iov_allocate_vfdb(p_hwfn); } -void ecore_iov_setup(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt) +void ecore_iov_setup(struct ecore_hwfn *p_hwfn) { if (!IS_PF_SRIOV(p_hwfn) || !IS_PF_SRIOV_ALLOC(p_hwfn)) return; @@ -2387,7 +2387,7 @@ static void ecore_iov_vf_mbx_update_tunn_param(struct ecore_hwfn *p_hwfn, if (b_update_required) { u16 geneve_port; - rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, &tunn, + rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, p_ptt, &tunn, ECORE_SPQ_MODE_EBLOCK, OSAL_NULL); if (rc != ECORE_SUCCESS) diff --git a/drivers/net/qede/base/ecore_sriov.h b/drivers/net/qede/base/ecore_sriov.h index ade74c9..d190126 100644 --- a/drivers/net/qede/base/ecore_sriov.h +++ b/drivers/net/qede/base/ecore_sriov.h @@ -238,10 +238,8 @@ void ecore_dp_tlv_list(struct ecore_hwfn *p_hwfn, * @brief ecore_iov_setup - setup sriov related resources * * @param p_hwfn - * @param p_ptt */ -void ecore_iov_setup(struct ecore_hwfn *p_hwfn, - struct ecore_ptt *p_ptt); +void ecore_iov_setup(struct ecore_hwfn *p_hwfn); /** * @brief ecore_iov_free - free sriov related resources diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 4e9e89f..1af0427 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -2167,11 +2167,15 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) QEDE_VXLAN_DEF_PORT; for_each_hwfn(edev, i) { p_hwfn = &edev->hwfns[i]; - rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, &tunn, + struct ecore_ptt *p_ptt = IS_PF(edev) ? + ecore_ptt_acquire(p_hwfn) : NULL; + rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, p_ptt, &tunn, ECORE_SPQ_MODE_CB, NULL); if (rc != ECORE_SUCCESS) { DP_ERR(edev, "Unable to config UDP port %u\n", tunn.vxlan_port.port); + if (IS_PF(edev)) + ecore_ptt_release(p_hwfn, p_ptt); return rc; } } @@ -2318,11 +2322,15 @@ static int qede_vxlan_tunn_config(struct rte_eth_dev *eth_dev, qede_set_cmn_tunn_param(&tunn, clss, true, true); for_each_hwfn(edev, i) { p_hwfn = &edev->hwfns[i]; - rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, + struct ecore_ptt *p_ptt = IS_PF(edev) ? + ecore_ptt_acquire(p_hwfn) : NULL; + rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, p_ptt, &tunn, ECORE_SPQ_MODE_CB, NULL); if (rc != ECORE_SUCCESS) { DP_ERR(edev, "Failed to update tunn_clss %u\n", tunn.vxlan.tun_cls); + if (IS_PF(edev)) + ecore_ptt_release(p_hwfn, p_ptt); } } qdev->num_tunn_filters++; /* Filter added successfully */ @@ -2352,12 +2360,17 @@ static int qede_vxlan_tunn_config(struct rte_eth_dev *eth_dev, qede_set_cmn_tunn_param(&tunn, clss, false, true); for_each_hwfn(edev, i) { p_hwfn = &edev->hwfns[i]; - rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, &tunn, - ECORE_SPQ_MODE_CB, NULL); + struct ecore_ptt *p_ptt = IS_PF(edev) ? + ecore_ptt_acquire(p_hwfn) : NULL; + rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, p_ptt, + &tunn, ECORE_SPQ_MODE_CB, NULL); if (rc != ECORE_SUCCESS) { DP_ERR(edev, "Failed to update tunn_clss %u\n", tunn.vxlan.tun_cls); + if (IS_PF(edev)) + ecore_ptt_release(p_hwfn, + p_ptt); break; } } diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index 13b321d..71b3a39 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -178,7 +178,7 @@ static void qed_handle_bulletin_change(struct ecore_hwfn *hwfn) rte_memcpy(hwfn->hw_info.hw_mac_addr, mac, ETH_ALEN); /* Always update link configuration according to bulletin */ - qed_link_update(hwfn); + qed_link_update(hwfn, NULL); } static void qede_vf_task(void *arg) @@ -489,6 +489,7 @@ static void qed_set_name(struct ecore_dev *edev, char name[NAME_SIZE]) } static void qed_fill_link(struct ecore_hwfn *hwfn, + __rte_unused struct ecore_ptt *ptt, struct qed_link_output *if_link) { struct ecore_mcp_link_params params; @@ -559,12 +560,22 @@ static void qed_fill_link(struct ecore_hwfn *hwfn, static void qed_get_current_link(struct ecore_dev *edev, struct qed_link_output *if_link) { - qed_fill_link(&edev->hwfns[0], if_link); + struct ecore_hwfn *hwfn; + struct ecore_ptt *ptt; -#ifdef CONFIG_QED_SRIOV - for_each_hwfn(cdev, i) - qed_inform_vf_link_state(&cdev->hwfns[i]); -#endif + hwfn = &edev->hwfns[0]; + if (IS_PF(edev)) { + ptt = ecore_ptt_acquire(hwfn); + if (!ptt) + DP_NOTICE(hwfn, true, "Failed to fill link; No PTT\n"); + + qed_fill_link(hwfn, ptt, if_link); + + if (ptt) + ecore_ptt_release(hwfn, ptt); + } else { + qed_fill_link(hwfn, NULL, if_link); + } } static int qed_set_link(struct ecore_dev *edev, struct qed_link_params *params) @@ -614,11 +625,11 @@ static int qed_set_link(struct ecore_dev *edev, struct qed_link_params *params) return rc; } -void qed_link_update(struct ecore_hwfn *hwfn) +void qed_link_update(struct ecore_hwfn *hwfn, struct ecore_ptt *ptt) { struct qed_link_output if_link; - qed_fill_link(hwfn, &if_link); + qed_fill_link(hwfn, ptt, &if_link); } static int qed_drain(struct ecore_dev *edev)