diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-02-29 11:06:47 -0500 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-04 01:18:22 -0500 |
commit | e898d4db2749c6052072e9bc4448e396cbdeb06a (patch) | |
tree | 2b8673d85210a23e67d0817b18f401411e8936f3 /include | |
parent | c6aefafb7ec620911d46174eed514f9df639e5a4 (diff) |
[UDP]: Allow users to configure UDP-Lite.
Let's give users an option for disabling UDP-Lite (~4K).
old:
| text data bss dec hex filename
| 286498 12432 6072 305002 4a76a net/ipv4/built-in.o
| 193830 8192 3204 205226 321aa net/ipv6/ipv6.o
new (without UDP-Lite):
| text data bss dec hex filename
| 284086 12136 5432 301654 49a56 net/ipv4/built-in.o
| 191835 7832 3076 202743 317f7 net/ipv6/ipv6.o
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/udp.h | 11 | ||||
-rw-r--r-- | include/net/ipv6.h | 5 | ||||
-rw-r--r-- | include/net/transp_v6.h | 5 | ||||
-rw-r--r-- | include/net/udplite.h | 9 |
4 files changed, 28 insertions, 2 deletions
diff --git a/include/linux/udp.h b/include/linux/udp.h index 8ec703f462da..4144664d69d9 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h | |||
@@ -70,8 +70,10 @@ struct udp_sock { | |||
70 | #define UDPLITE_BIT 0x1 /* set by udplite proto init function */ | 70 | #define UDPLITE_BIT 0x1 /* set by udplite proto init function */ |
71 | #define UDPLITE_SEND_CC 0x2 /* set via udplite setsockopt */ | 71 | #define UDPLITE_SEND_CC 0x2 /* set via udplite setsockopt */ |
72 | #define UDPLITE_RECV_CC 0x4 /* set via udplite setsocktopt */ | 72 | #define UDPLITE_RECV_CC 0x4 /* set via udplite setsocktopt */ |
73 | #ifdef CONFIG_IP_UDPLITE | ||
73 | __u8 pcflag; /* marks socket as UDP-Lite if > 0 */ | 74 | __u8 pcflag; /* marks socket as UDP-Lite if > 0 */ |
74 | __u8 unused[3]; | 75 | __u8 unused[3]; |
76 | #endif | ||
75 | /* | 77 | /* |
76 | * For encapsulation sockets. | 78 | * For encapsulation sockets. |
77 | */ | 79 | */ |
@@ -82,7 +84,16 @@ static inline struct udp_sock *udp_sk(const struct sock *sk) | |||
82 | { | 84 | { |
83 | return (struct udp_sock *)sk; | 85 | return (struct udp_sock *)sk; |
84 | } | 86 | } |
87 | |||
88 | #ifdef CONFIG_IP_UDPLITE | ||
85 | #define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag) | 89 | #define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag) |
90 | #define IS_PROTO_UDPLITE(__proto) ((__proto) == IPPROTO_UDPLITE) | ||
91 | #define IS_SOL_UDPFAMILY(level) ((level) == SOL_UDP || (level) == SOL_UDPLITE) | ||
92 | #else | ||
93 | #define IS_UDPLITE(__sk) 0 | ||
94 | #define IS_PROTO_UDPLITE(__proto) 0 | ||
95 | #define IS_SOL_UDPFAMILY(level) ((level) == SOL_UDP) | ||
96 | #endif | ||
86 | 97 | ||
87 | #endif | 98 | #endif |
88 | 99 | ||
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 8b05c65415cb..96b1763bfcaa 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -603,8 +603,13 @@ extern int tcp6_proc_init(void); | |||
603 | extern void tcp6_proc_exit(void); | 603 | extern void tcp6_proc_exit(void); |
604 | extern int udp6_proc_init(void); | 604 | extern int udp6_proc_init(void); |
605 | extern void udp6_proc_exit(void); | 605 | extern void udp6_proc_exit(void); |
606 | #ifdef CONFIG_IP_UDPLITE | ||
606 | extern int udplite6_proc_init(void); | 607 | extern int udplite6_proc_init(void); |
607 | extern void udplite6_proc_exit(void); | 608 | extern void udplite6_proc_exit(void); |
609 | #else | ||
610 | static inline int udplite6_proc_init(void) { return 0; } | ||
611 | static inline void udplite6_proc_exit(void) { } | ||
612 | #endif | ||
608 | extern int ipv6_misc_proc_init(void); | 613 | extern int ipv6_misc_proc_init(void); |
609 | extern void ipv6_misc_proc_exit(void); | 614 | extern void ipv6_misc_proc_exit(void); |
610 | extern int snmp6_register_dev(struct inet6_dev *idev); | 615 | extern int snmp6_register_dev(struct inet6_dev *idev); |
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 27394e0447d8..902e6c6bc793 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h | |||
@@ -27,8 +27,13 @@ extern int rawv6_init(void); | |||
27 | extern void rawv6_exit(void); | 27 | extern void rawv6_exit(void); |
28 | extern int udpv6_init(void); | 28 | extern int udpv6_init(void); |
29 | extern void udpv6_exit(void); | 29 | extern void udpv6_exit(void); |
30 | #ifdef CONFIG_IP_UDPLITE | ||
30 | extern int udplitev6_init(void); | 31 | extern int udplitev6_init(void); |
31 | extern void udplitev6_exit(void); | 32 | extern void udplitev6_exit(void); |
33 | #else | ||
34 | static inline int udplitev6_init(void) { return 0; } | ||
35 | static inline void udplitev6_exit(void) { } | ||
36 | #endif | ||
32 | extern int tcpv6_init(void); | 37 | extern int tcpv6_init(void); |
33 | extern void tcpv6_exit(void); | 38 | extern void tcpv6_exit(void); |
34 | 39 | ||
diff --git a/include/net/udplite.h b/include/net/udplite.h index b76b2e377af4..01ddb2c20264 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h | |||
@@ -25,7 +25,9 @@ static __inline__ int udplite_getfrag(void *from, char *to, int offset, | |||
25 | /* Designate sk as UDP-Lite socket */ | 25 | /* Designate sk as UDP-Lite socket */ |
26 | static inline int udplite_sk_init(struct sock *sk) | 26 | static inline int udplite_sk_init(struct sock *sk) |
27 | { | 27 | { |
28 | #ifdef CONFIG_IP_UDPLITE | ||
28 | udp_sk(sk)->pcflag = UDPLITE_BIT; | 29 | udp_sk(sk)->pcflag = UDPLITE_BIT; |
30 | #endif | ||
29 | return 0; | 31 | return 0; |
30 | } | 32 | } |
31 | 33 | ||
@@ -69,7 +71,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) | |||
69 | static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) | 71 | static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) |
70 | { | 72 | { |
71 | int cscov = up->len; | 73 | int cscov = up->len; |
72 | 74 | #ifdef CONFIG_IP_UDPLITE | |
73 | /* | 75 | /* |
74 | * Sender has set `partial coverage' option on UDP-Lite socket | 76 | * Sender has set `partial coverage' option on UDP-Lite socket |
75 | */ | 77 | */ |
@@ -93,13 +95,15 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) | |||
93 | * illegal, we fall back to the defaults here. | 95 | * illegal, we fall back to the defaults here. |
94 | */ | 96 | */ |
95 | } | 97 | } |
98 | #endif | ||
96 | return cscov; | 99 | return cscov; |
97 | } | 100 | } |
98 | 101 | ||
99 | static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) | 102 | static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) |
100 | { | 103 | { |
101 | int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb)); | ||
102 | __wsum csum = 0; | 104 | __wsum csum = 0; |
105 | #ifdef CONFIG_IP_UDPLITE | ||
106 | int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb)); | ||
103 | 107 | ||
104 | skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ | 108 | skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ |
105 | 109 | ||
@@ -112,6 +116,7 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) | |||
112 | if ((cscov -= len) <= 0) | 116 | if ((cscov -= len) <= 0) |
113 | break; | 117 | break; |
114 | } | 118 | } |
119 | #endif | ||
115 | return csum; | 120 | return csum; |
116 | } | 121 | } |
117 | 122 | ||