From patchwork Mon Mar 5 21:50:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalderon, Michal" X-Patchwork-Id: 10259981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C34BE60365 for ; Mon, 5 Mar 2018 21:51:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2C7D28CA4 for ; Mon, 5 Mar 2018 21:51:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A761728CAC; Mon, 5 Mar 2018 21:51:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BFEE28CA8 for ; Mon, 5 Mar 2018 21:51:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753187AbeCEVvb (ORCPT ); Mon, 5 Mar 2018 16:51:31 -0500 Received: from mail-dm3nam03on0087.outbound.protection.outlook.com ([104.47.41.87]:60997 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753135AbeCEVv0 (ORCPT ); Mon, 5 Mar 2018 16:51:26 -0500 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=qKWTeFFAaqVrLf628ac0ZEE/Mv4VPDNfPpEvSKEEEqg=; b=bvASF71cYc4M/nODd9fxI+1Ta9VX73njoGsEf6U7qdyg12fJ8fQMSaWnNl+17y5stVV3TJpzk9gXGGE7id/Q2xkLyrf/378+GvldgfZimOegbfiKSPBtSiqmC2gOemTM+8141MkVAhmNa6EPuYrlR2DjAgkttQhDVo2fUBS8FbE= Received: from SN1PR0701CA0061.namprd07.prod.outlook.com (2a01:111:e400:52fd::29) by BYAPR07MB4216.namprd07.prod.outlook.com (2603:10b6:a02:be::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Mon, 5 Mar 2018 21:51:23 +0000 Received: from BY2FFO11FD009.protection.gbl (2a01:111:f400:7c0c::105) by SN1PR0701CA0061.outlook.office365.com (2a01:111:e400:52fd::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.548.13 via Frontend Transport; Mon, 5 Mar 2018 21:51:22 +0000 Authentication-Results: spf=fail (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; mellanox.com; dkim=none (message not signed) header.d=none; mellanox.com; dmarc=none action=none header.from=cavium.com; Received-SPF: Fail (protection.outlook.com: domain of cavium.com does not designate 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BY2FFO11FD009.mail.protection.outlook.com (10.1.14.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.506.19 via Frontend Transport; Mon, 5 Mar 2018 21:51:22 +0000 Received: from lb-tlvb-michal.il.qlogic.com.com (10.185.6.89) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Mon, 5 Mar 2018 13:51:09 -0800 From: Michal Kalderon To: , CC: , , , , Michal Kalderon , Ariel Elior Subject: [PATCH V3 net] qed: Free RoCE ILT Memory on rmmod qedr Date: Mon, 5 Mar 2018 23:50:46 +0200 Message-ID: <1520286646-24583-1-git-send-email-Michal.Kalderon@cavium.com> X-Mailer: git-send-email 1.9.3 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(396003)(39380400002)(346002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(6666003)(104016004)(50226002)(478600001)(305945005)(356003)(107886003)(85426001)(36756003)(110136005)(51416003)(72206003)(336012)(2906002)(8676002)(81156014)(316002)(26005)(106466001)(8936002)(86362001)(69596002)(186003)(47776003)(5660300001)(81166006)(16586007)(105606002)(4326008)(59450400001)(77096007)(50466002)(54906003)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4216; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Fail; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD009; 1:65hpI4Wmj7PK3xN+Bi4AzL7GK+ef1vBLXXFOHY1vJjr/gB2MiS0dYeHCeKSjJRE+eLInb6B+g43pR2QD1G0KMrYad+F3JpCbmzImGtlAW1phPEiUQbCyjUHATdzgIEzs X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00ffdff6-4b7c-4038-2baf-08d582e33c70 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BYAPR07MB4216; X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4216; 3:QGKN5BmGgzrPbaPT72JzMYQqlXsx/ZSkiqhfJZe4t6Az6bfU+C+u/21t3uRP8UqeSb+uCXCEYsLbgJRjEhL4uidWUl1k4uj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ik6RPxwv/6ywuu6lNc6sFoRkBWQ+XQh7qu8FW3wGzAgfEGr8J6Ebt2MFB31CmH/b18xcx5XEJBU/8Mab0xV0MK78MkazoH7vinTlI2J3wV+5E47ajCBV8l/lNPSK4pzXY/6eB1dWMykgcxV9zA5WwjrdDEfaGyAM55KkizWDB5j/bt+QGM1PfJVAdAXFYjVbNac5h0ef19PZquV1QkQV1l/bI19L0qSMJNHTZ8ueaaBxPBJlQUopwBobwlVi+228VxWoQ5Z+d1j4VgdHWh1izh7PY93DgfEj1k/60l/oxhUWjXEUqIR9yDafctFN5CR+ZfuJadZ3KyS14bS3HWq4hwF7OV0qJd8qcUv9Xr0DZBp/ilwV X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(3231220)(944501244)(52105095)(10201501046)(3002001)(93006095)(93001095)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:BYAPR07MB4216; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4216; X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4216; 4:CVNBQFcN1GJEqqxJOIYxiQPiBMht5SXJxM4vO8ygTo/lynq3ZzCGtHcnaFfFic5mdGsgYXI6wd2R/mDCMWF7+MbqZf1K2OyTnxoS55kAHMRhvI6+qapSj6OcsNJXVfQzb92YyL+0BFH3USbxuE5nOD3t5UBD6yEsXwX62XOOEu9VN8eg1g/VHGeamrt8FfS8jFOA0MswXdBXTLG5pfDCkBAzXxRyEIeZCQ5AdsPzJuLHh/0MjDLaBZR1KNvKf2fSesyf1gHd62zzfvxiDPZl0g== X-Forefront-PRVS: 06022AA85F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BYAPR07MB4216; 23:fSZhZ6CpynjVXplw/JUGWNzL7XP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nSrDbRV7HyJvT66OEsLRSkVn+BbqTGKqScy36cG0ECjztwsyqzbGd2dUs=; 7:n5fv+p3fRF7m+HX0tygaKyWuU1wjNVjL3AbDcn3rpGF5Baq7hyogpX1cEPGQfeCDJmpu9dhbHCDxwaBPiTdrs9Glnk+qa72TtKzPDvHGZ68dC+B/Z03jJEv03Z2UPmf8CwIZtzGTcGwcNAKIDJnANVF6uBeINACzGHhcpGfWfm7M5wUvKltHFgpIuDYQs5nv3HPapNjP/FpW8Kpnx6KFkQukNdmxdZP1UXhPyGoWy4UgyyPuMW5agiql65IHMYSj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2018 21:51:22.3936 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00ffdff6-4b7c-4038-2baf-08d582e33c70 X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4216 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Rdma requires ILT Memory to be allocated for it's QPs. Each ILT entry points to a page used by several Rdma QPs. To avoid allocating all the memory in advance, the rdma implementation dynamically allocates memory as more QPs are added, however it does not dynamically free the memory. The memory should have been freed on rmmod qedr, but isn't. This patch adds the memory freeing on rmmod qedr (currently it will be freed with qed is removed). An outcome of this bug, is that if qedr is unloaded and loaded without unloaded qed, there will be no more RoCE traffic. The reason these are related, is that the logic of detecting the first QP ever opened is by asking whether ILT memory for RoCE has been allocated. In addition, this patch modifies freeing of the Task context to always use the PROTOCOLID_ROCE and not the protocol passed, this is because task context for iWARP and ROCE both use the ROCE protocol id, as opposed to the connection context. Fixes: dbb799c39717 ("qed: Initialize hardware for new protocols") Signed-off-by: Michal Kalderon Signed-off-by: Ariel Elior --- Difference from V2: Fixed Broken parenthesis In comment --- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 5 ++++- drivers/net/ethernet/qlogic/qed/qed_rdma.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c index 6f546e8..b6f55bc 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c +++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c @@ -2480,7 +2480,10 @@ int qed_cxt_free_proto_ilt(struct qed_hwfn *p_hwfn, enum protocol_type proto) if (rc) return rc; - /* Free Task CXT */ + /* Free Task CXT ( Intentionally RoCE as task-id is shared between + * RoCE and iWARP ) + */ + proto = PROTOCOLID_ROCE; rc = qed_cxt_free_ilt_range(p_hwfn, QED_ELEM_TASK, 0, qed_cxt_get_proto_tid_count(p_hwfn, proto)); if (rc) diff --git a/drivers/net/ethernet/qlogic/qed/qed_rdma.c b/drivers/net/ethernet/qlogic/qed/qed_rdma.c index 5d040b8..f3ee653 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_rdma.c +++ b/drivers/net/ethernet/qlogic/qed/qed_rdma.c @@ -380,6 +380,7 @@ static void qed_rdma_free(struct qed_hwfn *p_hwfn) qed_rdma_free_reserved_lkey(p_hwfn); qed_rdma_resc_free(p_hwfn); + qed_cxt_free_proto_ilt(p_hwfn, p_hwfn->p_rdma_info->proto); } static void qed_rdma_get_guid(struct qed_hwfn *p_hwfn, u8 *guid)