2 * arch/s390/lib/checksum.c
3 * S390 fast network checksum routines
6 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Ulrich Hild (first version),
8 * Martin Schwidefsky (schwidefsky@de.ibm.com),
9 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
11 * This file contains network checksum routines
14 #include <linux/string.h>
15 #include <linux/types.h>
16 #include <asm/uaccess.h>
17 #include <asm/byteorder.h>
18 #include <asm/checksum.h>
21 * computes a partial checksum, e.g. for TCP/UDP fragments
24 csum_partial (const unsigned char *buff, int len, unsigned int sum)
27 * Experiments with ethernet and slip connections show that buff
28 * is aligned on either a 2-byte or 4-byte boundary.
30 __asm__ __volatile__ (
31 " lgr 2,%1\n" /* address in gpr 2 */
32 " lgfr 3,%2\n" /* length in gpr 3 */
33 "0: cksm %0,2\n" /* do checksum on longs */
36 : "d" (buff), "d" (len)