Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: devmem: support single IOV with sendmsg

sendmsg() with a single iov becomes ITER_UBUF, sendmsg() with multiple
iovs becomes ITER_IOVEC. iter_iov_len does not return correct
value for UBUF, so teach to treat UBUF differently.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Pavel Begunkov <asml.silence@gmail.com>
Cc: Mina Almasry <almasrymina@google.com>
Fixes: bd61848900bf ("net: devmem: Implement TX path")
Signed-off-by: Stanislav Fomichev <stfomichev@gmail.com>
Acked-by: Mina Almasry <almasrymina@google.com>
Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Stanislav Fomichev and committed by
David S. Miller
384492c4 d09a8a4a

+9 -2
+7 -1
include/linux/uio.h
··· 99 99 } 100 100 101 101 #define iter_iov_addr(iter) (iter_iov(iter)->iov_base + (iter)->iov_offset) 102 - #define iter_iov_len(iter) (iter_iov(iter)->iov_len - (iter)->iov_offset) 102 + 103 + static inline size_t iter_iov_len(const struct iov_iter *i) 104 + { 105 + if (i->iter_type == ITER_UBUF) 106 + return i->count; 107 + return iter_iov(i)->iov_len - i->iov_offset; 108 + } 103 109 104 110 static inline enum iter_type iov_iter_type(const struct iov_iter *i) 105 111 {
+2 -1
net/core/datagram.c
··· 702 702 * iov_addrs are interpreted as an offset in bytes into the dma-buf to 703 703 * send from. We do not support other iter types. 704 704 */ 705 - if (iov_iter_type(from) != ITER_IOVEC) 705 + if (iov_iter_type(from) != ITER_IOVEC && 706 + iov_iter_type(from) != ITER_UBUF) 706 707 return -EFAULT; 707 708 708 709 while (length && iov_iter_count(from)) {