Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2331112imm; Mon, 28 May 2018 06:12:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoG/wGwn9bXOPqNd7h2W0D3TmXQZBpZ0fmp7kIkhU7M2y24u8ov6zlR14t8IuJHUdIybA0m X-Received: by 2002:a62:f909:: with SMTP id o9-v6mr13512344pfh.256.1527513130069; Mon, 28 May 2018 06:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527513130; cv=none; d=google.com; s=arc-20160816; b=dK0Vn3qIvauu+G/Og8vVReKtkiCyQqq4aJiWMM+JwhlxRp2fUpr3++5fA/ZQhw3QVp OrmXoiWQBLjsf0kWVfoeweHoPOdAmf+HPZY870BaMaRTLgwBePvjvEyC7UFM7foMii/8 XTd1Ampf3IeadRehQanmvKPcb1E8ALJNvoDR4FXQYp6kmhaFIUlNWjN4upgCs1DUBwum XbG83oCBEsSyOG5Oq8kZMqbEfsKg6PwyCdUN1y217YDRqic6zS25aSEh1yy/AkbbmRyg Z9ygUcA9sKASxi4wA8/7SkeGbuhqWwcpSi4uXBxWOIlE/uFhByswvV9nPYbsyPorWu7D pMaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Q4kHPjpkUpfz8wJ4p4JCiaMKEr/ZkmUpqvg4e05Uqi0=; b=fWmWar0x5i6o3Ma0P36Ru/PqtWp5m0QkLHzfsG3OLdRgog+EAl3YuGRahKf2GSNR2P jimwSclPBN6QsqxJ14n8YuO8tv0fDiNkOERIoKSh8cUdMNIeajsec16gZv83BsirGcMb JXKw+mbeH1P0V5v44FAXsflqXyyA+qn8ycQzLAX7DHdp5Z/ExfeKOtMaUeGvr0SIRA5v +qFSMx2v0SzD/Wno1hKSpcD5ub1OPxJMmXSz+2CSIUxY08aGF7yPYI4OGO5qjpbQ88Z5 ACLfiWZM5bz26tFIB6FJ8Q/Vo3SpQrxFhACdewwkfGIHHUrxAhSvILiG4xTXfHvpxpZB vDTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r5fy5qn1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e11-v6si23615449pgu.459.2018.05.28.06.11.55; Mon, 28 May 2018 06:12:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r5fy5qn1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S939085AbeE1NK6 (ORCPT + 99 others); Mon, 28 May 2018 09:10:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:40810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163763AbeE1KvX (ORCPT ); Mon, 28 May 2018 06:51:23 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 331CA204EE; Mon, 28 May 2018 10:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504682; bh=TcTm3YXFNCwIJo72OoCd3utipYZmaGil+Gg1DYSqCwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r5fy5qn1H5bMDhhMkh7rx86qt6YeSIHMM2HHr9f1z+uy7gObVT4VhjD0ehlgoj9NM lKE7WdcW0sx4u8joWBcdpopizY55+etpTJB4oeUmBtOd4nwhWbXLjqAk5f3iGk+ae2 XrkFQrIrxU8JZdh+gnnqgr/7CTFETuVQnKWlLl48= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Kalderon , Ariel Elior , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 227/496] qed: Free RoCE ILT Memory on rmmod qedr Date: Mon, 28 May 2018 12:00:12 +0200 Message-Id: <20180528100329.471167715@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michal Kalderon [ Upstream commit 9de506a547c0d172d13a91d69b1a399e6a2c0efa ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- 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(-) --- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c +++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c @@ -2471,7 +2471,10 @@ int qed_cxt_free_proto_ilt(struct qed_hw 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) --- a/drivers/net/ethernet/qlogic/qed/qed_rdma.c +++ b/drivers/net/ethernet/qlogic/qed/qed_rdma.c @@ -360,6 +360,7 @@ static void qed_rdma_free(struct qed_hwf DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "Freeing RDMA\n"); 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)