Thread (46 messages) 46 messages, 6 authors, 2017-04-28
STALE3366d
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH v2 10/21] RDS: Make use of the new sg_map helper function

From: Logan Gunthorpe <hidden>
Date: 2017-04-25 18:24:44
Also in: dm-devel, dri-devel, intel-gfx, linux-crypto, linux-media, linux-mmc, linux-rdma, linux-scsi, lkml, netdev, nvdimm
Subsystem: networking [general], rds - reliable datagram sockets, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Allison Henderson, Linus Torvalds

Straightforward conversion except there's no error path, so we
make use of SG_MAP_MUST_NOT_FAIL which may BUG_ON in certain cases
in the future.

Signed-off-by: Logan Gunthorpe <logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
Cc: Santosh Shilimkar <redacted>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
---
 net/rds/ib_recv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index e10624a..c665689 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -800,10 +800,10 @@ static void rds_ib_cong_recv(struct rds_connection *conn,
 
 		to_copy = min(RDS_FRAG_SIZE - frag_off, PAGE_SIZE - map_off);
 		BUG_ON(to_copy & 7); /* Must be 64bit aligned. */
+		addr = sg_map(&frag->f_sg, 0,
+			      SG_KMAP_ATOMIC | SG_MAP_MUST_NOT_FAIL);
 
-		addr = kmap_atomic(sg_page(&frag->f_sg));
-
-		src = addr + frag->f_sg.offset + frag_off;
+		src = addr + frag_off;
 		dst = (void *)map->m_page_addrs[map_page] + map_off;
 		for (k = 0; k < to_copy; k += 8) {
 			/* Record ports that became uncongested, ie
@@ -811,7 +811,7 @@ static void rds_ib_cong_recv(struct rds_connection *conn,
 			uncongested |= ~(*src) & *dst;
 			*dst++ = *src++;
 		}
-		kunmap_atomic(addr);
+		sg_unmap(&frag->f_sg, addr, 0, SG_KMAP_ATOMIC);
 
 		copied += to_copy;
 
-- 
2.1.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help