diff options
author | Stefan Raspl <stefan.raspl@linux.ibm.com> | 2018-05-03 18:12:38 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-04 11:45:06 -0400 |
commit | 2ef4f27ad00dc9d36cadb81fce9d07366d579451 (patch) | |
tree | c0710e8cd17977812e62f51328ef228838ad1a02 /net | |
parent | b51fa1b135fbfc89e34d90b5bab563745d94186f (diff) | |
download | linux-2ef4f27ad00dc9d36cadb81fce9d07366d579451.tar.bz2 |
smc: allocate RMBs as compound pages
Preparatory work for splice() support.
Signed-off-by: Stefan Raspl <raspl@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com><
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/smc/smc_core.c | 18 | ||||
-rw-r--r-- | net/smc/smc_core.h | 1 |
2 files changed, 10 insertions, 9 deletions
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 79aa7d312d6b..9c74844e2008 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -290,8 +290,8 @@ static void smc_buf_free(struct smc_buf_desc *buf_desc, struct smc_link *lnk, DMA_TO_DEVICE); } sg_free_table(&buf_desc->sgt[SMC_SINGLE_LINK]); - if (buf_desc->cpu_addr) - free_pages((unsigned long)buf_desc->cpu_addr, buf_desc->order); + if (buf_desc->pages) + __free_pages(buf_desc->pages, buf_desc->order); kfree(buf_desc); } @@ -566,16 +566,16 @@ static struct smc_buf_desc *smc_new_buf_create(struct smc_link_group *lgr, if (!buf_desc) return ERR_PTR(-ENOMEM); - buf_desc->cpu_addr = - (void *)__get_free_pages(GFP_KERNEL | __GFP_NOWARN | - __GFP_NOMEMALLOC | - __GFP_NORETRY | __GFP_ZERO, - get_order(bufsize)); - if (!buf_desc->cpu_addr) { + buf_desc->order = get_order(bufsize); + buf_desc->pages = alloc_pages(GFP_KERNEL | __GFP_NOWARN | + __GFP_NOMEMALLOC | __GFP_COMP | + __GFP_NORETRY | __GFP_ZERO, + buf_desc->order); + if (!buf_desc->pages) { kfree(buf_desc); return ERR_PTR(-EAGAIN); } - buf_desc->order = get_order(bufsize); + buf_desc->cpu_addr = (void *)page_address(buf_desc->pages); /* build the sg table from the pages */ lnk = &lgr->lnk[SMC_SINGLE_LINK]; diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index 70ef4f47dc8d..fca8624e5e71 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h @@ -120,6 +120,7 @@ struct smc_link { struct smc_buf_desc { struct list_head list; void *cpu_addr; /* virtual address of buffer */ + struct page *pages; struct sg_table sgt[SMC_LINKS_PER_LGR_MAX];/* virtual buffer */ struct ib_mr *mr_rx[SMC_LINKS_PER_LGR_MAX]; /* for rmb only: memory region |