From patchwork Mon Mar 5 09:04:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalderon, Michal" X-Patchwork-Id: 10258451 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 5E60660134 for ; Mon, 5 Mar 2018 09:04:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D60726E54 for ; Mon, 5 Mar 2018 09:04:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F9332899B; Mon, 5 Mar 2018 09:04:52 +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 9B4A826E54 for ; Mon, 5 Mar 2018 09:04:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932918AbeCEJEu (ORCPT ); Mon, 5 Mar 2018 04:04:50 -0500 Received: from mail-co1nam03on0063.outbound.protection.outlook.com ([104.47.40.63]:41376 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932721AbeCEJEp (ORCPT ); Mon, 5 Mar 2018 04:04:45 -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=Duu+eNU8jdGm1EICZk1/bcorLOelnl8Thu8OS6xL6sg=; b=BlrL5keYrQPrRUIMyC4JD687vlzzinhdmw5TzaNBvuSCe0kjuGprbaHabM9uQUfF/gIbF6Kcv4l4U1myVxMBiM3e5iezANMruMD5/YZ3TkkzX5d1nYi8WxeaOs8WlTuR8L1cH/11IJuqdqBrQtfnRSXLqPNuTb2JIlIZELaMYdo= Received: from BY2PR07CA0081.namprd07.prod.outlook.com (2a01:111:e400:7bff::34) by SN6PR07MB4222.namprd07.prod.outlook.com (2603:10b6:805:62::14) 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 09:04:43 +0000 Received: from BL2FFO11FD021.protection.gbl (2a01:111:f400:7c09::188) by BY2PR07CA0081.outlook.office365.com (2a01:111:e400:7bff::34) 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 09:04:42 +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 BL2FFO11FD021.mail.protection.outlook.com (10.173.161.100) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.527.18 via Frontend Transport; Mon, 5 Mar 2018 09:04:41 +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 01:04:38 -0800 From: Michal Kalderon To: , CC: , , , , Michal Kalderon , Ariel Elior Subject: [PATCH net] qed: Free RoCE ILT Memory on rmmod qedr Date: Mon, 5 Mar 2018 11:04:11 +0200 Message-ID: <1520240651-11308-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)(396003)(39850400004)(346002)(39380400002)(376002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(59450400001)(186003)(106466001)(26005)(72206003)(77096007)(36756003)(478600001)(105606002)(107886003)(50226002)(8936002)(8676002)(81156014)(81166006)(48376002)(6666003)(50466002)(5660300001)(104016004)(4326008)(69596002)(356003)(2906002)(305945005)(86362001)(47776003)(316002)(110136005)(51416003)(16586007)(85426001)(54906003)(336012); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4222; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Fail; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD021; 1:tGws/GNGviNsqKlFboPM4VKxO7uKMaSh2LU52s2oDkOYUKvHsKe3yJjPhPYVJyzIN+OBiizkQ1FFCeHLloMC+FqdYSYLZVCz8zdCjUE1CaKCZ1wQU+KB7QD8XoVtTIHm X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 231e4b58-abce-4352-b36c-08d582782216 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060); SRVR:SN6PR07MB4222; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4222; 3:BIcUaSV1jpV0OdFoECrDHQXMXYcJDskiXw834ZJtQa7h0PbqrrbiLfcO7dPjsFJDmEKpCxdUtXtlBDh114rk4b23KbcKke2ziwRrf44sOzw12PFIC37wlDb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PoOAGOHaEAHqYV5gGOSSENyZZz8TCxu8j8UBfh7W+1Sv6Khd5rMKveEZMWL7Gzel3z4cFTy0egRvHDuFSg2cVU8xfelexaGDq32cXZ2NaLjITdYpTslzqu9t3vfZBgvzEcMXusU0q0rcJXW0oC5arhDWTbT0bEws7vtAkc915GC8sGOM9RRFCN+6qA3OSkQvOxyloM5p5mLTeVVJ34Trnqruun+yZj0Sd4Qm0uLvuGLTlfeqSABHB6kUNUbr/JLjzYxq5OXB7SiHZetHG6BDYdll1sG7ij2Fpxs0SM/fb5cXV+Ji1PSswVyMpyuPa8xAHG4ugUp7EsnL 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)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(3002001)(6041288)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:SN6PR07MB4222; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4222; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4222; 4:mPFYVpSKVr/HTXkA4IB3bK032d4xCjulTxkDoc1pMXFUf5tyO1EwtgHUKSSvSYzeRwpyYkdCbWNmlpLOTOViKvI/QYcn0H0zoTY9qualXYP2OiGgTwh5I2YibiX+z934eVUIriuKd3/3lmDHZtGzbdr01JXgCrG7MxozeiFoXnYfg7419XlvaLsG/pmEVRrx7uLG8m/d6Y+FDyFXnYV798aMNCVC1DAZ2bSiItvPGiRIUiFTxTAUdzcanFdJLir77e7gj5clHfQNz/zZRC19Tw== X-Forefront-PRVS: 06022AA85F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN6PR07MB4222; 23:Ivw6svMfIT/H26f6wCgEUwx4aiRA+2b1A/196lqFT?= =?us-ascii?Q?KnYv4lhEVfGqD/ZxQ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=; 7:KcXTpmgwza9uTsCYFoEDK0DVyNXqCItcPeLcO7ZtJoucIqoeb/iKzmud7JENwRI8Xe41kU8rSNjrmGfLzvQYEl9lrDgVoHSxCbVHpW0JsjK58terkxKtpO5QcDclRQqwzpTygb5wBLFtoAJF4cQkxNIc+SPdF/mPikObisLjr2nvitGkpJpfTB1CP1BRmlb5nZI3j12KL6mwqEdBHmZ/ruSgENMHHQ93i8yVS99DXGehdNBHY3VBUK5J3xkZVc5T SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2018 09:04:41.8960 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 231e4b58-abce-4352-b36c-08d582782216 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: SN6PR07MB4222 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: dbb799c39717e7b7 Signed-off-by: Michal Kalderon Signed-off-by: Ariel Elior --- 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)