Commit 4db8fd49 authored by Bernard Metzler's avatar Bernard Metzler Committed by Jason Gunthorpe

RDMA/siw: Relax from kmap_atomic() use in TX path

Since the transmit path is never executed in an atomic context, we do not
need kmap_atomic() and can always use less demanding kmap().

Link: https://lore.kernel.org/r/20190909132945.30462-1-bmt@zurich.ibm.comSigned-off-by: default avatarBernard Metzler <bmt@zurich.ibm.com>
Reviewed-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 75c66515
...@@ -76,16 +76,15 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr) ...@@ -76,16 +76,15 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
if (unlikely(!p)) if (unlikely(!p))
return -EFAULT; return -EFAULT;
buffer = kmap_atomic(p); buffer = kmap(p);
if (likely(PAGE_SIZE - off >= bytes)) { if (likely(PAGE_SIZE - off >= bytes)) {
memcpy(paddr, buffer + off, bytes); memcpy(paddr, buffer + off, bytes);
kunmap_atomic(buffer);
} else { } else {
unsigned long part = bytes - (PAGE_SIZE - off); unsigned long part = bytes - (PAGE_SIZE - off);
memcpy(paddr, buffer + off, part); memcpy(paddr, buffer + off, part);
kunmap_atomic(buffer); kunmap(p);
if (!mem->is_pbl) if (!mem->is_pbl)
p = siw_get_upage(mem->umem, p = siw_get_upage(mem->umem,
...@@ -97,11 +96,10 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr) ...@@ -97,11 +96,10 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
if (unlikely(!p)) if (unlikely(!p))
return -EFAULT; return -EFAULT;
buffer = kmap_atomic(p); buffer = kmap(p);
memcpy(paddr + part, buffer, memcpy(paddr + part, buffer, bytes - part);
bytes - part);
kunmap_atomic(buffer);
} }
kunmap(p);
} }
} }
return (int)bytes; return (int)bytes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment