static inline u_long csum_tcpudp_nofold ( u_long saddr, u_long daddr, u_short len, u_short PRoto, unsigned int sum ) { __asm__ (" addl %1, %0 adcl %2, %0 adcl %3, %0 adcl $0, %0 " : "=r" ( sum ) : "g" ( daddr ), "g" ( saddr ), "g" ( ( ntohs( len ) << 16 ) + proto * 256 ), "0" ( sum ) ); return sum; }
static inline unsigned int csum_fold ( unsigned int sum ) { __asm__ (" addl %1, %0 adcl $0xffff, %0 " : "=r" ( sum ) : "r" ( sum << 16 ), "0" ( sum & 0xffff0000 ) ); return( ( ~sum ) >> 16 ); } /* end of csum_fold */
static inline u_short check_tcpudp ( u_long saddr, u_long daddr, u_short len, u_short proto, unsigned int sum ) { return( csum_fold( csum_tcpudp_nofold( saddr, daddr, len, proto, sum ) ) ); } /* end of check_tcpudp */