From fa2a36dedaa987e730d5af05b0bed92ab7e7b13c Mon Sep 17 00:00:00 2001 From: Roy Pledge Date: Mon, 31 Mar 2014 13:49:28 -0400 Subject: Fix USDPAA DMA Mem freespace calculation The USDPAA DMA freespace calculation should only count segments with a reference count of zero as free Signed-off-by: Roy Pledge Change-Id: Ib8752f8ad6cb4179b371b6480f47e84033260efe Reviewed-on: http://git.am.freescale.net:8181/10526 Tested-by: Review Code-CDREVIEW Reviewed-by: Geoff Thorpe Reviewed-by: Jose Rivera diff --git a/drivers/staging/fsl_qbman/fsl_usdpaa.c b/drivers/staging/fsl_qbman/fsl_usdpaa.c index fb4aaba..0e6adca 100644 --- a/drivers/staging/fsl_qbman/fsl_usdpaa.c +++ b/drivers/staging/fsl_qbman/fsl_usdpaa.c @@ -1054,7 +1054,8 @@ static long ioctl_dma_stats(struct ctx *ctx, void __user *arg) result.total_bytes = phys_size; list_for_each_entry(frag, &mem_list, list) { - result.free_bytes += frag->len; + if (frag->refs == 0) + result.free_bytes += frag->len; } return copy_to_user(arg, &result, sizeof(result)); } -- cgit v0.10.2