: Supporting UDP-Lite (RFC 3828) in Linux
Subsystems (4)
PATCH 1/3 : Supporting UDP-Lite (RFC 3828) in Linux
[NET/IPv4]: Support for the UDP-Lite protocol (RFC 3828)
This adds support for UDP-Lite to the IPv4 stack, provided as an extension to the existing UDPv4 code:
* generic routines are all located in net/ipv4/udp.c
* UDP-Lite specific routines are in net/ipv4/udplite.c
* MIB/statistics support in /proc/net/snmp and /proc/net/udplite
* shared API with extensions for partial checksum coverage
* consolidation of shared code
------------------------------------------------------------------------------
include/linux/in.h | 1 include/linux/socket.h | 1 include/linux/udp.h | 12 + include/net/udp.h | 91 ++++++++- include/net/udplite.h | 149 +++++++++++++++ net/ipv4/af_inet.c | 8 net/ipv4/proc.c | 13 + net/ipv4/udp.c | 481 +++++++++++++++++++++++++++++-------------------- net/ipv4/udplite.c | 118 ++++++++++++ 9 files changed, 673 insertions(+), 201 deletions(-)
------------------------------------------------------------------------------
include/linux/udp.h +12 -0
@@ -38,6 +38,7 @@ #ifdef __KERNEL__#include <linux/types.h> #include <net/inet_sock.h> +#define UDP_HTABLE_SIZE 128struct udp_sock {/* inet_sock has to be the first member */
@@ -50,12 +51,23 @@ struct udp_sock {* when the socket is uncorked. */ __u16 len;/* total length of pending frames */ +/* +* Fields specific to UDP-Lite. +*/ +__u16 pcslen; +__u16 pcrlen; +/* indicator bits used by pcflag: */ +#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 */ + __u8 pcflag; /* marks socket as UDP-Lite if > 0 */ };static inline struct udp_sock *udp_sk (const struct sock *sk) {return (struct udp_sock *)sk; } +#define IS_UDPLITE (__sk) (udp_sk(__sk)->pcflag)#endif
include/net/udp.h +87 -4
123 lines not on this page · raw message
include/net/udplite.h new file +149 -0
149 lines not on this page · raw message
include/linux/in.h +1 -0
@@ -45,6 +45,7 @@ enum {IPPROTO_COMP =108 ,/* Compression Header protocol */ IPPROTO_SCTP =132 ,/* Stream Control Transport Protocol */ +IPPROTO_UDPLITE =136 ,/* UDP-Lite (RFC 3828) */ IPPROTO_RAW =255 ,/* Raw IP packets */ IPPROTO_MAX
include/linux/socket.h +1 -0
@@ -264,6 +264,7 @@ #define SOL_UDP 17#define SOL_IPV6 41#define SOL_ICMPV6 58#define SOL_SCTP 132 +#define SOL_UDPLITE 136/* UDP-Lite (RFC 3828) */ #define SOL_RAW 255#define SOL_IPX 256#define SOL_AX25 257
net/ipv4/udp.c +285 -196
886 lines not on this page · raw message
net/ipv4/udplite.c new file +118 -0
118 lines not on this page · raw message
net/ipv4/af_inet.c +7 -1
@@ -104,6 +104,7 @@ #include <net/ip_fib.h>#include <net/inet_connection_sock.h> #include <net/tcp.h> #include <net/udp.h> +#include <net/udplite.h> #include <linux/skbuff.h> #include <net/sock.h> #include <net/raw.h>
@@ -1223,10 +1224,13 @@ static int __init init_ipv4_mibs(void) tcp_statistics[1] = alloc_percpu(struct tcp_mib); udp_statistics[0] = alloc_percpu(struct udp_mib); udp_statistics[1] = alloc_percpu(struct udp_mib); + udplite_statistics[0] = alloc_percpu(struct udp_mib); + udplite_statistics[1] = alloc_percpu(struct udp_mib);if (! (net_statistics[0 ] && net_statistics[1 ] && ip_statistics[0 ] && ip_statistics[1 ] && tcp_statistics[0 ] && tcp_statistics[1 ] - && udp_statistics[0 ] && udp_statistics[1 ])) + && udp_statistics[0 ] && udp_statistics[1 ] + && udplite_statistics[0 ] && udplite_statistics[1 ] ) )return -ENOMEM ; (void )tcp_mib_init ();
@@ -1313,6 +1317,8 @@ #endif/* Setup TCP slab cache for open requests. */ tcp_init (); +/* Add UDP-Lite (RFC 3828) */ +udplite4_register ();/* * Set the ICMP layer up
net/ipv4/proc.c +13 -0
@@ -38,6 +38,7 @@ #include <net/icmp.h>#include <net/protocol.h> #include <net/tcp.h> #include <net/udp.h> +#include <net/udplite.h> #include <linux/inetdevice.h> #include <linux/proc_fs.h> #include <linux/seq_file.h>
@@ -66,6 +67,7 @@ static int sockstat_seq_show(struct seq_ tcp_death_row.tw_count,atomic_read (&tcp_sockets_allocated), atomic_read(&tcp_memory_allocated));seq_printf (seq,"UDP: inuse %d\n" ,fold_prot_inuse (&udp_prot)); +seq_printf (seq,"UDPLITE: inuse %d\n" ,fold_prot_inuse (&udplite_prot));seq_printf (seq,"RAW: inuse %d\n" ,fold_prot_inuse (&raw_prot));seq_printf (seq,"FRAG: inuse %d memory %d\n" , ip_frag_nqueues,atomic_read (&ip_frag_mem));
@@ -304,6 +306,17 @@ static int snmp_seq_show(struct seq_filefold_field ((void **) udp_statistics, snmp4_udp_list[i].entry)); +/* the UDP and UDP-Lite MIBs are the same */ +seq_puts (seq,"\nUdpLite:" ); +for (i =0 ; snmp4_udp_list[i].name !=NULL ; i++) +seq_printf (seq," %s" , snmp4_udp_list[i].name); + +seq_puts (seq,"\nUdpLite:" ); +for (i =0 ; snmp4_udp_list[i].name !=NULL ; i++) +seq_printf (seq," %lu" , +fold_field ((void **) udplite_statistics, + snmp4_udp_list[i].entry) ); +seq_putc (seq,'\n' );return 0 ; }
Quoted 11 lines · On Fri, 10 Nov 2006 16:09:20 +0000 Gerrit Renker <[email protected]> wrote:
[NET/IPv4]: Support for the UDP-Lite protocol (RFC 3828)
This adds support for UDP-Lite to the IPv4 stack, provided as an extension to the existing UDPv4 code:
* generic routines are all located innet/ipv4/udp.c
* UDP-Lite specific routines are innet/ipv4/udplite.c
* MIB/statistics support in/proc/net/snmpand/proc/net/udplite
* shared API with extensions for partial checksum coverage
* consolidation of shared code
This code is does too much inlining (like existing network code). Should it be made configurable?
Signature · 1 line
Stephen Hemminger <[email protected]>
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Fri, 10 Nov 2006 09:37:15 -0800
Quoted 15 lines
Quoted 11 lines · On Fri, 10 Nov 2006 16:09:20 +0000 Gerrit Renker <[email protected]> wrote:
[NET/IPv4]: Support for the UDP-Lite protocol (RFC 3828)
This adds support for UDP-Lite to the IPv4 stack, provided as an extension to the existing UDPv4 code:
* generic routines are all located innet/ipv4/udp.c
* UDP-Lite specific routines are innet/ipv4/udplite.c
* MIB/statistics support in/proc/net/snmpand/proc/net/udplite
* shared API with extensions for partial checksum coverage
* consolidation of shared code
Quoted 2 lines
This code is does too much inlining (like existing network code). Should it be made configurable?
It doesn't get built at all if you check his patches :-)
But once that's fixed up, I think we can fix that with a followon patch. We've put Gerrit through the ringer enough on this stuff.
Quoted 18 lines · On Fri, 10 Nov 2006 14:38:46 -0800 (PST) David Miller <[email protected]>…
From: Stephen Hemminger <[email protected]>
Date: Fri, 10 Nov 2006 09:37:15 -0800Quoted 15 lines
Quoted 11 lines · On Fri, 10 Nov 2006 16:09:20 +0000 Gerrit Renker <[email protected]> wrote:
[NET/IPv4]: Support for the UDP-Lite protocol (RFC 3828)
This adds support for UDP-Lite to the IPv4 stack, provided as an extension to the existing UDPv4 code:
* generic routines are all located innet/ipv4/udp.c
* UDP-Lite specific routines are innet/ipv4/udplite.c
* MIB/statistics support in/proc/net/snmpand/proc/net/udplite
* shared API with extensions for partial checksum coverage
* consolidation of shared code
Quoted 7 lines
Quoted 2 lines
This code is does too much inlining (like existing network code). Should it be made configurable?
It doesn't get built at all if you check his patches :-)
But once that's fixed up, I think we can fix that with a followon patch. We've put Gerrit through the ringer enough on this stuff.
Agreed. But we can do some code rearranging/deinlining early in 2.6.20
Signature · 1 line
Stephen Hemminger <[email protected]>
| > This code is does too much inlining (like existing network code). | > Should it be made configurable? | | It doesn't get built at all if you check his patches :-)
See previous posting.
Quoting Stephen Hemminger:
| On Fri, 10 Nov 2006 16:09:20 +0000 | Gerrit Renker <[email protected]> wrote: | | > [NET/IPv4]: Support for the UDP-Lite protocol (RFC 3828) | > | > This adds support for UDP-Lite to the IPv4 stack, provided as an extension | > to the existing UDPv4 code: | > * generic routines are all located in net/ipv4/udp.c | > * UDP-Lite specific routines are in net/ipv4/udplite.c | > * MIB/statistics support in /proc/net/snmp and /proc/net/udplite | > * shared API with extensions for partial checksum coverage | > * consolidation of shared code | > | > | | This code is does too much inlining (like existing network code). | Should it be made configurable?
That is a late question for a patch which has been in a RFC phase for several months. This patch had been submitted repeatedly for RFC between middle of September ... end of October.
It used to be configurable and it also used to be much more bloated:
``The in-lining is a feature, not a bug!''
Reason: If you look at udplite.c (which is, despite #including, a fully self-contained
protocol module), the inline functions all call generic code from udp.c. If you then look back at udp.c, you see that UDP almost does the same. What you have here is two protocols for the price of one; the inlines work as wrappers for both UDP and UDP-Lite. And considerable amount of extracting and minimising went into making it that way.
Before: The patch used to be separate and was an `enormous mass of code reduplication'.
Imagine udp.c reduplicated and modified to run UDP-Lite: then you have two highly similar code files, over 90% of code reduplication (bad ... very bad).
Is there someone else supporting `make UDP-Lite' configurable -- in the end I am being asked to re-implement a feature I was asked to remove a couple of months ago. It is not a problem to do this, but this code has cost a lot of work and I would like to finally see it in 2.6.20.
Gerrit
David Miller
maintainerI can't apply any of this Gerrit.
What makes net/ipv4/udplite.c get built at all? I see no changes to net/ipv4/Makefile, so you must have stuffed up the generation of your patches.
Please resubmit all 3 patches once you've corrected this and actually _tested_ the patch you submitted. You know, because I might actually try to build what you send me :-)
Quoting David Miller:
| | I can't apply any of this Gerrit. | | What makes net/ipv4/udplite.c get built at all? I see no | changes to net/ipv4/Makefile, so you must have stuffed up | the generation of your patches.
This is a misunderstanding: udplite.o will never be built, it is #included in udp.c. Witness
==> net/ipv4/udp.c, line 1727:
/* the extensions for UDP-Lite (RFC 3828) */ #include "udplite.c"
==> net/ipv6/udp.c, line 1009:
/* the extensions for UDP-Lite (RFC 3828) */ #include "udplite.c"
| Please resubmit all 3 patches once you've corrected this | and actually _tested_ the patch you submitted. You know,
I do not submit patches that I don't have tested myself. It all works: no compile errors, all functions (UDPv4/v6 and UDP-Litev4/v6) confirmed to work.
You can find test applications for UDP-Lite (IPPROTO=136) on
http://www.erg.abdn.ac.uk/users/gerrit/udp-lite/files/udplite_linux.tar.gz
(subdirectory apps/{sock,ttcp,vlc,client-server,perl_client-server}
Regards
Gerrit
David Miller
maintainerFrom: Gerrit Renker <[email protected]>
Date: Mon, 13 Nov 2006 07:34:48 +0000
Quoted 10 lines
Quoting David Miller:
| | I can't apply any of this Gerrit. | | What makes net/ipv4/udplite.c get built at all? I see no | changes to net/ipv4/Makefile, so you must have stuffed up | the generation of your patches.This is a misunderstanding: udplite.o will never be built, it is #included in
udp.c. Witness
Quoted 8 lines
==>
net/ipv4/udp.c, line 1727:/* the extensions for UDP-Lite (RFC 3828) */ #include "udplite.c"==>
net/ipv6/udp.c, line 1009:/* the extensions for UDP-Lite (RFC 3828) */ #include "udplite.c"
Sorry I misread this.
I'm not a huge fan of source file inclusion like this. It's not a header file, it contains code.
Is there a way to build this as a seperate object somehow?
A message that is not in the archive (sent off-list or not yet received): 200611130809.34613@strip-the-willow
A message that is not in the archive (sent off-list or not yet received): [email protected]
| > It is not a huge problem to change this, but it will also mean a non-trivial redesign.
| > With regards to Stephen's email, can you/Stephen please indicate whether
| >
| > (a) configurable or not (CONFIG_IP_UDPLITE)?
| > (b) re-design as separate object file or not?
| > (c) ... ?
|
| I don't think it needs to be configurable, and I also think the
| split-out is easy as you just need to un-static a few things, and put
| function declarations and perhaps a few inlines into a
| net/ipv{4,6}/udp_impl.h header file that both udp.c and udplite.c both
| include.If you give me time until tomorrow morning, I will re-submit the split version - I would like to take some time to go over it. I will use the filename as suggested for the header file, unless there is another suggestion (the only header file in net/ipv?/ so far is fib_lookup.h).
Thanking you,
Gerrit
David Miller
maintainerFrom: Gerrit Renker <[email protected]>
Date: Mon, 13 Nov 2006 08:32:44 +0000
Quoted 5 lines
If you give me time until tomorrow morning, I will re-submit the split version - I would like to take some time to go over it. I will use the filename as suggested for the header file, unless there is another suggestion (the only header file in net/ipv?/ so far is
fib_lookup.h).
It should be fine as a name, and if you look at fib_lookup.h it's serving the same purpose the udp_impl.h file will, in that it provides interfaces for internals of the fib_*.c files.