summaryrefslogtreecommitdiffstats
path: root/tools/testing/scatterlist/linux
diff options
context:
space:
mode:
authorMaor Gottlieb <maorg@nvidia.com>2020-11-15 14:06:23 +0200
committerJason Gunthorpe <jgg@nvidia.com>2020-11-17 20:02:20 -0400
commitee415d73dcc24caef7f6bbf292dcc365613d2188 (patch)
tree5b4e911c9db9ab7dc194733ad31f82988aa57c78 /tools/testing/scatterlist/linux
parentdabbd6abcdbeb1358a53ec28a244429320eb0e3a (diff)
downloadcachepc-linux-ee415d73dcc24caef7f6bbf292dcc365613d2188.tar.gz
cachepc-linux-ee415d73dcc24caef7f6bbf292dcc365613d2188.zip
tools/testing/scatterlist: Fix test to compile and run
Add missing define of ALIGN_DOWN to make the test build and run. In addition, __sg_alloc_table_from_pages now support unaligned maximum segment, so adapt the test result accordingly. Fixes: 07da1223ec93 ("lib/scatterlist: Add support in dynamic allocation of SG table from pages") Link: https://lore.kernel.org/r/20201115120623.139113-1-leon@kernel.org Signed-off-by: Maor Gottlieb <maorg@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'tools/testing/scatterlist/linux')
-rw-r--r--tools/testing/scatterlist/linux/mm.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/scatterlist/linux/mm.h b/tools/testing/scatterlist/linux/mm.h
index 6ae907f375d2..f9a12005fcea 100644
--- a/tools/testing/scatterlist/linux/mm.h
+++ b/tools/testing/scatterlist/linux/mm.h
@@ -33,6 +33,7 @@ typedef unsigned long dma_addr_t;
#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
+#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)