From 6406a0df6bc9d0f1dc0afdd078208d75ffc9bacf Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Sun, 20 Aug 2017 12:01:33 +0900 Subject: [PATCH] HFI1: compute SDMA pkt length taking large pages into account --- kernel/user_sdma.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/kernel/user_sdma.c b/kernel/user_sdma.c index 9b4ddd26..0be25ac5 100644 --- a/kernel/user_sdma.c +++ b/kernel/user_sdma.c @@ -1460,20 +1460,10 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) len = offset + req->info.fragsize > PAGE_SIZE ? PAGE_SIZE - offset : req->info.fragsize; #else - /* - * This doesn't appear to work. Perhaps the card - * doesn't like it if the physical range in an SDMA - * descriptor crosses page boundaries?? - */ - /* - len = virt + req->info.fragsize > - base_virt + base_pgsize ? - base_virt + base_pgsize - virt : req->info.fragsize; - */ - offset = offset_in_page(base + iovec->offset + - iov_offset); - len = offset + req->info.fragsize > PAGE_SIZE ? - PAGE_SIZE - offset : req->info.fragsize; + len = iovec->phys ? req->info.fragsize : + ((base_virt + base_pgsize - virt) > + req->info.fragsize) ? req->info.fragsize : + (base_virt + base_pgsize - virt); #endif len = min((datalen - queued), len); SDMA_DBG("%s: dl: %d, qd: %d, len: %d\n",