| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * INET An implementation of the TCP/IP protocol suite for the LINUX |
|---|
| .. | .. |
|---|
| 22 | 23 | * data-registers to hold input values and one tries to |
|---|
| 23 | 24 | * specify d0 and d1 as scratch registers. Letting gcc |
|---|
| 24 | 25 | * choose these registers itself solves the problem. |
|---|
| 25 | | - * |
|---|
| 26 | | - * This program is free software; you can redistribute it and/or |
|---|
| 27 | | - * modify it under the terms of the GNU General Public License |
|---|
| 28 | | - * as published by the Free Software Foundation; either version |
|---|
| 29 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 30 | 26 | */ |
|---|
| 31 | 27 | |
|---|
| 32 | 28 | /* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access |
|---|
| .. | .. |
|---|
| 148 | 144 | return (__force __sum16)~do_csum(buff, len); |
|---|
| 149 | 145 | } |
|---|
| 150 | 146 | EXPORT_SYMBOL(ip_compute_csum); |
|---|
| 151 | | - |
|---|
| 152 | | -/* |
|---|
| 153 | | - * copy from fs while checksumming, otherwise like csum_partial |
|---|
| 154 | | - */ |
|---|
| 155 | | -__wsum |
|---|
| 156 | | -csum_partial_copy_from_user(const void __user *src, void *dst, int len, |
|---|
| 157 | | - __wsum sum, int *csum_err) |
|---|
| 158 | | -{ |
|---|
| 159 | | - int missing; |
|---|
| 160 | | - |
|---|
| 161 | | - missing = __copy_from_user(dst, src, len); |
|---|
| 162 | | - if (missing) { |
|---|
| 163 | | - memset(dst + len - missing, 0, missing); |
|---|
| 164 | | - *csum_err = -EFAULT; |
|---|
| 165 | | - } else |
|---|
| 166 | | - *csum_err = 0; |
|---|
| 167 | | - |
|---|
| 168 | | - return csum_partial(dst, len, sum); |
|---|
| 169 | | -} |
|---|
| 170 | | -EXPORT_SYMBOL(csum_partial_copy_from_user); |
|---|
| 171 | | - |
|---|
| 172 | | -/* |
|---|
| 173 | | - * copy from ds while checksumming, otherwise like csum_partial |
|---|
| 174 | | - */ |
|---|
| 175 | | -__wsum |
|---|
| 176 | | -csum_partial_copy(const void *src, void *dst, int len, __wsum sum) |
|---|
| 177 | | -{ |
|---|
| 178 | | - memcpy(dst, src, len); |
|---|
| 179 | | - return csum_partial(dst, len, sum); |
|---|
| 180 | | -} |
|---|
| 181 | | -EXPORT_SYMBOL(csum_partial_copy); |
|---|
| 182 | 147 | |
|---|
| 183 | 148 | #ifndef csum_tcpudp_nofold |
|---|
| 184 | 149 | static inline u32 from64to32(u64 x) |
|---|