linux/arch/unicore32/include/asm/checksum.h
<<
>>
Prefs
   1/*
   2 * linux/arch/unicore32/include/asm/checksum.h
   3 *
   4 * Code specific to PKUnity SoC and UniCore ISA
   5 *
   6 * Copyright (C) 2001-2010 GUAN Xue-tao
   7 *
   8 * This program is free software; you can redistribute it and/or modify
   9 * it under the terms of the GNU General Public License version 2 as
  10 * published by the Free Software Foundation.
  11 *
  12 * IP checksum routines
  13 */
  14#ifndef __UNICORE_CHECKSUM_H__
  15#define __UNICORE_CHECKSUM_H__
  16
  17/*
  18 * computes the checksum of the TCP/UDP pseudo-header
  19 * returns a 16-bit checksum, already complemented
  20 */
  21
  22static inline __wsum
  23csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
  24                   unsigned short proto, __wsum sum)
  25{
  26        __asm__(
  27        "add.a  %0, %1, %2\n"
  28        "addc.a %0, %0, %3\n"
  29        "addc.a %0, %0, %4 << #8\n"
  30        "addc.a %0, %0, %5\n"
  31        "addc   %0, %0, #0\n"
  32        : "=&r"(sum)
  33        : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto))
  34        : "cc");
  35        return sum;
  36}
  37#define csum_tcpudp_nofold      csum_tcpudp_nofold
  38
  39#include <asm-generic/checksum.h>
  40
  41#endif
  42