hc
2024-02-19 151fecfb72a0d602dfe79790602ef64b4e241574
kernel/include/net/sctp/checksum.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /* SCTP kernel reference Implementation
23 * Copyright (c) 1999-2001 Motorola, Inc.
34 * Copyright (c) 2001-2003 International Business Machines, Corp.
....@@ -5,22 +6,6 @@
56 * This file is part of the SCTP kernel reference Implementation
67 *
78 * SCTP Checksum functions
8
- *
9
- * The SCTP reference implementation is free software;
10
- * you can redistribute it and/or modify it under the terms of
11
- * the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2, or (at your option)
13
- * any later version.
14
- *
15
- * The SCTP reference implementation is distributed in the hope that it
16
- * will be useful, but WITHOUT ANY WARRANTY; without even the implied
17
- * ************************
18
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
- * See the GNU General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU General Public License
22
- * along with GNU CC; see the file COPYING. If not, see
23
- * <http://www.gnu.org/licenses/>.
249 *
2510 * Please send any bug reports or fixes you make to the
2611 * email address(es):
....@@ -58,19 +43,21 @@
5843 (__force __u32)csum2, len);
5944 }
6045
46
+static const struct skb_checksum_ops sctp_csum_ops = {
47
+ .update = sctp_csum_update,
48
+ .combine = sctp_csum_combine,
49
+};
50
+
6151 static inline __le32 sctp_compute_cksum(const struct sk_buff *skb,
6252 unsigned int offset)
6353 {
6454 struct sctphdr *sh = (struct sctphdr *)(skb->data + offset);
65
- const struct skb_checksum_ops ops = {
66
- .update = sctp_csum_update,
67
- .combine = sctp_csum_combine,
68
- };
6955 __le32 old = sh->checksum;
7056 __wsum new;
7157
7258 sh->checksum = 0;
73
- new = ~__skb_checksum(skb, offset, skb->len - offset, ~(__wsum)0, &ops);
59
+ new = ~__skb_checksum(skb, offset, skb->len - offset, ~(__wsum)0,
60
+ &sctp_csum_ops);
7461 sh->checksum = old;
7562
7663 return cpu_to_le32((__force __u32)new);