aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-01 01:06:47 +0900
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-03-04 15:18:22 +0900
commite898d4db2749c6052072e9bc4448e396cbdeb06a (patch)
tree2b8673d85210a23e67d0817b18f401411e8936f3 /include
parentc6aefafb7ec620911d46174eed514f9df639e5a4 (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.h11
-rw-r--r--include/net/ipv6.h5
-rw-r--r--include/net/transp_v6.h5
-rw-r--r--include/net/udplite.h9
4 files changed, 28 insertions, 2 deletions
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 8ec703f462d..4144664d69d 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -70,8 +70,10 @@ struct udp_sock {
#define UDPLITE_BIT 0x1 /* set by udplite proto init function */
#define UDPLITE_SEND_CC 0x2 /* set via udplite setsockopt */
#define UDPLITE_RECV_CC 0x4 /* set via udplite setsocktopt */
+#ifdef CONFIG_IP_UDPLITE
__u8 pcflag; /* marks socket as UDP-Lite if > 0 */
__u8 unused[3];
+#endif
/*
* For encapsulation sockets.
*/
@@ -82,7 +84,16 @@ static inline struct udp_sock *udp_sk(const struct sock *sk)
{
return (struct udp_sock *)sk;
}
+
+#ifdef CONFIG_IP_UDPLITE
#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag)
+#define IS_PROTO_UDPLITE(__proto) ((__proto) == IPPROTO_UDPLITE)
+#define IS_SOL_UDPFAMILY(level) ((level) == SOL_UDP || (level) == SOL_UDPLITE)
+#else
+#define IS_UDPLITE(__sk) 0
+#define IS_PROTO_UDPLITE(__proto) 0
+#define IS_SOL_UDPFAMILY(level) ((level) == SOL_UDP)
+#endif
#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 8b05c65415c..96b1763bfca 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -603,8 +603,13 @@ extern int tcp6_proc_init(void);
extern void tcp6_proc_exit(void);
extern int udp6_proc_init(void);
extern void udp6_proc_exit(void);
+#ifdef CONFIG_IP_UDPLITE
extern int udplite6_proc_init(void);
extern void udplite6_proc_exit(void);
+#else
+static inline int udplite6_proc_init(void) { return 0; }
+static inline void udplite6_proc_exit(void) { }
+#endif
extern int ipv6_misc_proc_init(void);
extern void ipv6_misc_proc_exit(void);
extern int snmp6_register_dev(struct inet6_dev *idev);
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 27394e0447d..902e6c6bc79 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -27,8 +27,13 @@ extern int rawv6_init(void);
extern void rawv6_exit(void);
extern int udpv6_init(void);
extern void udpv6_exit(void);
+#ifdef CONFIG_IP_UDPLITE
extern int udplitev6_init(void);
extern void udplitev6_exit(void);
+#else
+static inline int udplitev6_init(void) { return 0; }
+static inline void udplitev6_exit(void) { }
+#endif
extern int tcpv6_init(void);
extern void tcpv6_exit(void);
diff --git a/include/net/udplite.h b/include/net/udplite.h
index b76b2e377af..01ddb2c2026 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,
/* Designate sk as UDP-Lite socket */
static inline int udplite_sk_init(struct sock *sk)
{
+#ifdef CONFIG_IP_UDPLITE
udp_sk(sk)->pcflag = UDPLITE_BIT;
+#endif
return 0;
}
@@ -69,7 +71,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
{
int cscov = up->len;
-
+#ifdef CONFIG_IP_UDPLITE
/*
* Sender has set `partial coverage' option on UDP-Lite socket
*/
@@ -93,13 +95,15 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
* illegal, we fall back to the defaults here.
*/
}
+#endif
return cscov;
}
static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
{
- int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
__wsum csum = 0;
+#ifdef CONFIG_IP_UDPLITE
+ int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
@@ -112,6 +116,7 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
if ((cscov -= len) <= 0)
break;
}
+#endif
return csum;
}