svn commit: r219417 - projects/ofed/head/sys/ofed/drivers/net/mlx4
Jeff Roberson
jeff at FreeBSD.org
Tue Mar 8 23:33:30 UTC 2011
Author: jeff
Date: Tue Mar 8 23:33:29 2011
New Revision: 219417
URL: http://svn.freebsd.org/changeset/base/219417
Log:
- Handle the direct map properly using the new vmap() implementation.
- Only assume the memory is contiguous if direct.map is set, otherwise
use the page list.
Modified:
projects/ofed/head/sys/ofed/drivers/net/mlx4/alloc.c
projects/ofed/head/sys/ofed/drivers/net/mlx4/mr.c
Modified: projects/ofed/head/sys/ofed/drivers/net/mlx4/alloc.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/net/mlx4/alloc.c Tue Mar 8 22:01:47 2011 (r219416)
+++ projects/ofed/head/sys/ofed/drivers/net/mlx4/alloc.c Tue Mar 8 23:33:29 2011 (r219417)
@@ -229,6 +229,7 @@ int mlx4_buf_alloc(struct mlx4_dev *dev,
int i;
buf->direct.buf = NULL;
+ buf->direct.map = 0;
buf->nbufs = (size + PAGE_SIZE - 1) / PAGE_SIZE;
buf->npages = buf->nbufs;
buf->page_shift = PAGE_SHIFT;
@@ -249,7 +250,6 @@ int mlx4_buf_alloc(struct mlx4_dev *dev,
memset(buf->page_list[i].buf, 0, PAGE_SIZE);
}
-#ifdef __linux__
if (BITS_PER_LONG == 64) {
struct page **pages;
pages = kmalloc(sizeof *pages * buf->nbufs, GFP_KERNEL);
@@ -262,7 +262,6 @@ int mlx4_buf_alloc(struct mlx4_dev *dev,
if (!buf->direct.buf)
goto err_free;
}
-#endif
}
return 0;
@@ -282,10 +281,8 @@ void mlx4_buf_free(struct mlx4_dev *dev,
dma_free_coherent(&dev->pdev->dev, size, buf->direct.buf,
buf->direct.map);
else {
-#ifdef __linux__
if (BITS_PER_LONG == 64 && buf->direct.buf)
vunmap(buf->direct.buf);
-#endif
for (i = 0; i < buf->nbufs; ++i)
if (buf->page_list[i].buf)
Modified: projects/ofed/head/sys/ofed/drivers/net/mlx4/mr.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/net/mlx4/mr.c Tue Mar 8 22:01:47 2011 (r219416)
+++ projects/ofed/head/sys/ofed/drivers/net/mlx4/mr.c Tue Mar 8 23:33:29 2011 (r219417)
@@ -484,7 +484,7 @@ int mlx4_buf_write_mtt(struct mlx4_dev *
return -ENOMEM;
for (i = 0; i < buf->npages; ++i)
- if (buf->direct.buf)
+ if (buf->direct.map)
page_list[i] = buf->direct.map + (i << buf->page_shift);
else
page_list[i] = buf->page_list[i].map;
More information about the svn-src-projects
mailing list