]> git.openfabrics.org - compat-rdma/compat-rdma.git/commitdiff
qed: Backport Free RoCE ILT Memory on rmmod qedr
authorMichal Kalderon <michal.kalderon@cavium.com>
Thu, 1 Mar 2018 19:47:48 +0000 (21:47 +0200)
committerMichal Kalderon <michal.kalderon@cavium.com>
Thu, 1 Mar 2018 19:47:48 +0000 (21:47 +0200)
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.

Fixes: dbb799c39717e7b7
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
linux-next-cherry-picks/0203-qed-Free-RoCE-ILT-Memory-on-rmmod-qedr.patch [new file with mode: 0644]

diff --git a/linux-next-cherry-picks/0203-qed-Free-RoCE-ILT-Memory-on-rmmod-qedr.patch b/linux-next-cherry-picks/0203-qed-Free-RoCE-ILT-Memory-on-rmmod-qedr.patch
new file mode 100644 (file)
index 0000000..cc0cc87
--- /dev/null
@@ -0,0 +1,56 @@
+From a3bb559b1a767e36ee9bd63138184fff91821702 Mon Sep 17 00:00:00 2001
+From: Michal Kalderon <michal.kalderon@cavium.com>
+Date: Thu, 1 Mar 2018 21:42:57 +0200
+Subject: [PATCH] qed: Free RoCE ILT Memory on rmmod qedr
+
+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.
+
+Fixes: dbb799c39717e7b7
+Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
+---
+ drivers/net/ethernet/qlogic/qed/qed_cxt.c  | 2 +-
+ drivers/net/ethernet/qlogic/qed/qed_roce.c | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
+index b3aaa98..af21c8b 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c
++++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
+@@ -2355,7 +2355,7 @@ int qed_cxt_free_proto_ilt(struct qed_hwfn *p_hwfn, enum protocol_type proto)
+       /* Free Task CXT */
+       rc = qed_cxt_free_ilt_range(p_hwfn, QED_ELEM_TASK, 0,
+-                                  qed_cxt_get_proto_tid_count(p_hwfn, proto));
++                                  qed_cxt_get_proto_tid_count(p_hwfn, PROTOCOLID_ROCE));
+       if (rc)
+               return rc;
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
+index b8c811f..fea2422 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
++++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
+@@ -350,6 +350,7 @@ static void qed_rdma_free(struct qed_hwfn *p_hwfn)
+       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)
+-- 
+1.8.3.1
+