summaryrefslogtreecommitdiff
path: root/include/linux/skmsg.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-11-09 22:04:37 +0300
committerDavid S. Miller <davem@davemloft.net>2019-11-09 22:04:37 +0300
commit14684b93019a2d2ece0df5acaf921924541b928d (patch)
tree29cf04da2f22b85b6051b47b3731e91a43d4c94d /include/linux/skmsg.h
parent92da362c07d413786ab59db1665376fb63805586 (diff)
parent0058b0a506e40d9a2c62015fe92eb64a44d78cd9 (diff)
downloadlinux-14684b93019a2d2ece0df5acaf921924541b928d.tar.xz
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
One conflict in the BPF samples Makefile, some fixes in 'net' whilst we were converting over to Makefile.target rules in 'net-next'. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/skmsg.h')
-rw-r--r--include/linux/skmsg.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
index fe80d537945d..6cb077b646a5 100644
--- a/include/linux/skmsg.h
+++ b/include/linux/skmsg.h
@@ -140,6 +140,11 @@ static inline void sk_msg_apply_bytes(struct sk_psock *psock, u32 bytes)
}
}
+static inline u32 sk_msg_iter_dist(u32 start, u32 end)
+{
+ return end >= start ? end - start : end + (MAX_MSG_FRAGS - start);
+}
+
#define sk_msg_iter_var_prev(var) \
do { \
if (var == 0) \
@@ -199,9 +204,7 @@ static inline u32 sk_msg_elem_used(const struct sk_msg *msg)
if (sk_msg_full(msg))
return MAX_MSG_FRAGS;
- return msg->sg.end >= msg->sg.start ?
- msg->sg.end - msg->sg.start :
- msg->sg.end + (MAX_MSG_FRAGS - msg->sg.start);
+ return sk_msg_iter_dist(msg->sg.start, msg->sg.end);
}
static inline struct scatterlist *sk_msg_elem(struct sk_msg *msg, int which)