2 From davem@caip.rutgers.edu Tue Sep 3 03:56:22 1996
3 Return-Path: davem@caip.rutgers.edu
4 Received: from caipfs.rutgers.edu (caipfs.rutgers.edu [128.6.155.100]) by redhat.com (8.7.4/8.7.3) with SMTP id DAA05119 for <djb@redhat.com>; Tue, 3 Sep 1996 03:56:19 -0400
5 Received: from huahaga.rutgers.edu (huahaga.rutgers.edu [128.6.155.53]) by caipfs.rutgers.edu (8.6.9+bestmx+oldruq+newsunq+grosshack/8.6.9) with ESMTP id DAA23814 for <djb@redhat.com>; Tue, 3 Sep 1996 03:56:19 -0400
6 Received: (davem@localhost) by huahaga.rutgers.edu (8.6.9+bestmx+oldruq+newsunq+grosshack/8.6.9) id DAA03010; Tue, 3 Sep 1996 03:56:18 -0400
7 Date: Tue, 3 Sep 1996 03:56:18 -0400
8 Message-Id: <199609030756.DAA03010@huahaga.rutgers.edu>
9 From: "David S. Miller" <davem@caip.rutgers.edu>
11 In-reply-to: <199609021829.OAA08401@marvin.redhat.com> (message from Donnie
12 Barnes on Mon, 02 Sep 1996 14:29:39 -0400)
15 Date: Mon, 02 Sep 1996 14:29:39 -0400
16 From: Donnie Barnes <djb@redhat.com>
18 > I'd like to ship dip on the SPARC.
20 > Tell me which SRPM you'd like me to look at, I'll make it work (ftp
21 > location please, thanks).
23 ftp.redhat.com:/pub/redhat/devel/srpms/SRPMS/dip-3.3.7o-7.src.rpm
27 --- command.c.~3~ Tue Sep 3 07:33:28 1996
28 +++ command.c Tue Sep 3 07:46:15 1996
29 @@ -2350,9 +2350,154 @@
33 +#elif defined(__sparc__)
35 -#else /* !__alpha__ */
36 +/* ihl is always 5 or greater, almost always is 5, and iph is not always
37 + * word aligned, although that case is seldom.
39 +static __inline__ unsigned short ip_fast_csum(__const__ unsigned char *iph,
42 + unsigned long tmp1, tmp2, tmp3, tmp4;
45 + __asm__ __volatile__("
47 + be,a 7f ! 4 byte aligned
50 + sll %2, 2, %5 ! number of bytes
52 + be,a 2f ! 2 byte aligned
61 + be 3f ! 4 byte aligned
62 + srl %5, 1, %6 ! number of half words
65 + add %3, %0, %0 ! no carry, add two half words
71 + srl %6, 1, %6 ! number of words
75 + addcc %4, %0, %0 ! sum up words
86 + be,a 6f ! no half words left
96 + be,a 9f ! no bytes left
99 + ldub [%1], %3 ! single byte left
105 + addcc %0, %3, %3 ! merge to half word
109 + srl %0, 8, %3 ! must have been odd if we get here
128 + addxcc %0, %%g0, %0
141 + " : "=r" (sum), "=&r" (iph), "=&r" (ihl),
142 + "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4)
143 + : "1" (iph), "2" (ihl));
149 + * computes the checksum of the TCP/UDP pseudo-header
150 + * returns a 16-bit checksum, already complemented
152 +static __inline__ unsigned short csum_tcpudp_magic(unsigned long saddr,
153 + unsigned long daddr,
155 + unsigned short proto,
158 + __asm__ __volatile__("
168 + " : "=r" (sum), "=r" (saddr)
169 + : "r" (daddr), "r" ((proto<<16)+len), "0" (sum), "1" (saddr));
174 +static unsigned short
175 +udp_check(struct udphdr *uh, int len,
176 + unsigned long saddr, unsigned long daddr)
178 + return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, 0));
181 +#elif defined(__i386__) /* !__alpha__ && !__sparc__ */
183 /* This is a version of ip_compute_csum() optimized for IP headers, which
184 always checksum on 4 octet boundaries. */
185 @@ -2438,7 +2583,11 @@
186 return((~sum) & 0xffff);
189 -#endif /* !__alpha__ */
192 +#error You need to write tcp/ip checksum routines for your architecture
194 +#endif /* !__alpha__ && !__sparc__ && !__i386__*/
196 static void put_bootreq(void)