| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* SCTP kernel reference Implementation |
|---|
| 2 | 3 | * Copyright (c) 1999-2001 Motorola, Inc. |
|---|
| 3 | 4 | * Copyright (c) 2001-2003 International Business Machines, Corp. |
|---|
| .. | .. |
|---|
| 5 | 6 | * This file is part of the SCTP kernel reference Implementation |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * 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/>. |
|---|
| 24 | 9 | * |
|---|
| 25 | 10 | * Please send any bug reports or fixes you make to the |
|---|
| 26 | 11 | * email address(es): |
|---|
| .. | .. |
|---|
| 58 | 43 | (__force __u32)csum2, len); |
|---|
| 59 | 44 | } |
|---|
| 60 | 45 | |
|---|
| 46 | +static const struct skb_checksum_ops sctp_csum_ops = { |
|---|
| 47 | + .update = sctp_csum_update, |
|---|
| 48 | + .combine = sctp_csum_combine, |
|---|
| 49 | +}; |
|---|
| 50 | + |
|---|
| 61 | 51 | static inline __le32 sctp_compute_cksum(const struct sk_buff *skb, |
|---|
| 62 | 52 | unsigned int offset) |
|---|
| 63 | 53 | { |
|---|
| 64 | 54 | 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 | | - }; |
|---|
| 69 | 55 | __le32 old = sh->checksum; |
|---|
| 70 | 56 | __wsum new; |
|---|
| 71 | 57 | |
|---|
| 72 | 58 | 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); |
|---|
| 74 | 61 | sh->checksum = old; |
|---|
| 75 | 62 | |
|---|
| 76 | 63 | return cpu_to_le32((__force __u32)new); |
|---|