diff options
author | Vipul Pandya <vipul@chelsio.com> | 2012-05-18 05:59:27 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-05-18 16:22:29 -0400 |
commit | 8d81ef34b249109084b2f3c4bb826d0417ef5814 (patch) | |
tree | 77dbd13539db2053cada804c35e4cccd26f4e4c0 /drivers/infiniband/hw/cxgb4/mem.c | |
parent | 3069ee9bc451d90a2fa8c3c7ef2774744d9d3bb0 (diff) |
RDMA/cxgb4: Add debugfs RDMA memory stats
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/cxgb4/mem.c')
-rw-r--r-- | drivers/infiniband/hw/cxgb4/mem.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c index 40c835309e49..2a87379f52a3 100644 --- a/drivers/infiniband/hw/cxgb4/mem.c +++ b/drivers/infiniband/hw/cxgb4/mem.c | |||
@@ -135,6 +135,11 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry, | |||
135 | &rdev->resource.tpt_fifo_lock); | 135 | &rdev->resource.tpt_fifo_lock); |
136 | if (!stag_idx) | 136 | if (!stag_idx) |
137 | return -ENOMEM; | 137 | return -ENOMEM; |
138 | mutex_lock(&rdev->stats.lock); | ||
139 | rdev->stats.stag.cur += 32; | ||
140 | if (rdev->stats.stag.cur > rdev->stats.stag.max) | ||
141 | rdev->stats.stag.max = rdev->stats.stag.cur; | ||
142 | mutex_unlock(&rdev->stats.lock); | ||
138 | *stag = (stag_idx << 8) | (atomic_inc_return(&key) & 0xff); | 143 | *stag = (stag_idx << 8) | (atomic_inc_return(&key) & 0xff); |
139 | } | 144 | } |
140 | PDBG("%s stag_state 0x%0x type 0x%0x pdid 0x%0x, stag_idx 0x%x\n", | 145 | PDBG("%s stag_state 0x%0x type 0x%0x pdid 0x%0x, stag_idx 0x%x\n", |
@@ -165,9 +170,13 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry, | |||
165 | (rdev->lldi.vr->stag.start >> 5), | 170 | (rdev->lldi.vr->stag.start >> 5), |
166 | sizeof(tpt), &tpt); | 171 | sizeof(tpt), &tpt); |
167 | 172 | ||
168 | if (reset_tpt_entry) | 173 | if (reset_tpt_entry) { |
169 | c4iw_put_resource(&rdev->resource.tpt_fifo, stag_idx, | 174 | c4iw_put_resource(&rdev->resource.tpt_fifo, stag_idx, |
170 | &rdev->resource.tpt_fifo_lock); | 175 | &rdev->resource.tpt_fifo_lock); |
176 | mutex_lock(&rdev->stats.lock); | ||
177 | rdev->stats.stag.cur -= 32; | ||
178 | mutex_unlock(&rdev->stats.lock); | ||
179 | } | ||
171 | return err; | 180 | return err; |
172 | } | 181 | } |
173 | 182 | ||