This source file includes following definitions.
- ip_fast_csum
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef _IP_H
20 #define _IP_H
21
22
23 #include <linux/ip.h>
24 #include <linux/config.h>
25
26 #ifndef _SNMP_H
27 #include "snmp.h"
28 #endif
29
30 #include "sock.h"
31
32
33 #define IP_CE 0x8000
34 #define IP_DF 0x4000
35 #define IP_MF 0x2000
36 #define IP_OFFSET 0x1FFF
37
38 #define IP_FRAG_TIME (30 * HZ)
39
40 #ifdef CONFIG_IP_MULTICAST
41 extern void ip_mc_dropsocket(struct sock *);
42 extern void ip_mc_dropdevice(struct device *dev);
43 extern int ip_mc_procinfo(char *, char **, off_t, int);
44 #define MULTICAST(x) (IN_MULTICAST(htonl(x)))
45 #endif
46
47
48
49 struct ipfrag {
50 int offset;
51 int end;
52 int len;
53 struct sk_buff *skb;
54 unsigned char *ptr;
55 struct ipfrag *next;
56 struct ipfrag *prev;
57 };
58
59
60 struct ipq {
61 unsigned char *mac;
62 struct iphdr *iph;
63 int len;
64 short ihlen;
65 short maclen;
66 struct timer_list timer;
67 struct ipfrag *fragments;
68 struct ipq *next;
69 struct ipq *prev;
70 struct device *dev;
71 };
72
73
74 extern int backoff(int n);
75
76 extern void ip_print(const struct iphdr *ip);
77 extern int ip_ioctl(struct sock *sk, int cmd,
78 unsigned long arg);
79 extern void ip_route_check(unsigned long daddr);
80 extern int ip_build_header(struct sk_buff *skb,
81 unsigned long saddr,
82 unsigned long daddr,
83 struct device **dev, int type,
84 struct options *opt, int len,
85 int tos,int ttl);
86 extern unsigned short ip_compute_csum(unsigned char * buff, int len);
87 extern int ip_rcv(struct sk_buff *skb, struct device *dev,
88 struct packet_type *pt);
89 extern void ip_send_check(struct iphdr *ip);
90 extern int ip_id_count;
91 extern void ip_queue_xmit(struct sock *sk,
92 struct device *dev, struct sk_buff *skb,
93 int free);
94 extern int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int optlen);
95 extern int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen);
96 extern void ip_init(void);
97
98 extern struct ip_mib ip_statistics;
99
100
101
102
103
104
105
106
107 static inline unsigned short ip_fast_csum(unsigned char * buff, int wlen)
108 {
109 unsigned long sum = 0;
110
111 if (wlen)
112 {
113 unsigned long bogus;
114 __asm__("clc\n"
115 "1:\t"
116 "lodsl\n\t"
117 "adcl %3, %0\n\t"
118 "decl %2\n\t"
119 "jne 1b\n\t"
120 "adcl $0, %0\n\t"
121 "movl %0, %3\n\t"
122 "shrl $16, %3\n\t"
123 "addw %w3, %w0\n\t"
124 "adcw $0, %w0"
125 : "=r" (sum), "=S" (buff), "=r" (wlen), "=a" (bogus)
126 : "0" (sum), "1" (buff), "2" (wlen));
127 }
128 return (~sum) & 0xffff;
129 }
130 #endif