]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mptcp: change the parameter of __mptcp_make_csum
authorGeliang Tang <geliang.tang@suse.com>
Fri, 7 Jan 2022 19:25:23 +0000 (11:25 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 8 Jan 2022 03:00:44 +0000 (19:00 -0800)
This patch changed the type of the last parameter of __mptcp_make_csum()
from __sum16 to __wsum. And export this function in protocol.h.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/options.c
net/mptcp/protocol.h

index 38e34a1fb2dd0a2a4fe6385942dbab32a59ff832..8ed2d9f4a84d2adfdc9c3a0c4ffbe4e1660fab11 100644 (file)
@@ -1233,7 +1233,7 @@ static void mptcp_set_rwin(const struct tcp_sock *tp)
                WRITE_ONCE(msk->rcv_wnd_sent, ack_seq);
 }
 
-static u16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __sum16 sum)
+u16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum)
 {
        struct csum_pseudo_header header;
        __wsum csum;
@@ -1248,14 +1248,14 @@ static u16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __sum1
        header.data_len = htons(data_len);
        header.csum = 0;
 
-       csum = csum_partial(&header, sizeof(header), ~csum_unfold(sum));
+       csum = csum_partial(&header, sizeof(header), sum);
        return (__force u16)csum_fold(csum);
 }
 
 static u16 mptcp_make_csum(const struct mptcp_ext *mpext)
 {
        return __mptcp_make_csum(mpext->data_seq, mpext->subflow_seq, mpext->data_len,
-                                mpext->csum);
+                                ~csum_unfold(mpext->csum));
 }
 
 void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
@@ -1376,7 +1376,7 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
                                           __mptcp_make_csum(opts->data_seq,
                                                             opts->subflow_seq,
                                                             opts->data_len,
-                                                            opts->csum), ptr);
+                                                            ~csum_unfold(opts->csum)), ptr);
                } else {
                        put_unaligned_be32(opts->data_len << 16 |
                                           TCPOPT_NOP << 8 | TCPOPT_NOP, ptr);
index a77f512d5ad728e58ab8dca3a3eefb3488539844..0e6b42c76ea072ff6dab000e4ac27f1571b35b34 100644 (file)
@@ -725,6 +725,7 @@ void mptcp_token_destroy(struct mptcp_sock *msk);
 void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn);
 
 void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac);
+u16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum);
 
 void __init mptcp_pm_init(void);
 void mptcp_pm_data_init(struct mptcp_sock *msk);