diff options
author | David S. Miller <davem@davemloft.net> | 2019-11-09 22:04:37 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-09 22:04:37 +0300 |
commit | 14684b93019a2d2ece0df5acaf921924541b928d (patch) | |
tree | 29cf04da2f22b85b6051b47b3731e91a43d4c94d /include/linux/skmsg.h | |
parent | 92da362c07d413786ab59db1665376fb63805586 (diff) | |
parent | 0058b0a506e40d9a2c62015fe92eb64a44d78cd9 (diff) | |
download | linux-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.h | 9 |
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) |