net, diet: Use small UDP hash tables on small kernels

UDP has two hash tables, for UDP and UDP lite. Default
them to 16 entries each on small kernels. This can be
still overriden on the command line.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make ping sockets optional

This saves about 6k text/data. ping still works fine using raw
sockets like it always did.

   text	   data	    bss	    dec	    hex	filename
 268128	  11555	   7872	 287555	  46343	net/ipv4/built-in.o-noping
 273610	  11843	   8176	 293629	  47afd	net/ipv4/built-in.o-ping

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make TCP metrics optional

This is all the code that saves connection information
between different sockets. Not really essential for
small systems.

Saves about 5.5k text

   text	   data	    bss	    dec	    hex	filename
 492952	  19571	  13480	 526003	  806b3	net/built-in.o-with-metrics
 487675	  19275	  13480	 520430	  7f0ee	net/built-in.o-without-metrics

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make ethtool optional

Small embedded systems don't need ethtool, so make it optional.

Right now the driver code is not removed, unless the driver
uses SET_ETHTOOL_OPS and LTO (which can eliminate unused code)

Saves about 10k text(without driver code):

   text	   data	    bss	    dec	    hex	filename
 489877	  19371	  13480	 522728	  7f9e8	net/built-in.o
 478967	  19369	  13480	 511816	  7cf48	net/built-in.o-wo-ethtool

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make LPF filter optional

Small systems don't need the LPF filter, so make it all
optional

XXX seccomp and other users should auto enable

Saves about 4K text

   text	   data	    bss	    dec	    hex	filename
 483545	  19371	  13480	 516396	  7e12c	net/built-in.o-wo-filter
 487675	  19275	  13480	 520430	  7f0ee	net/built-in.o-with-filter

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Move rtnl_lock to separate file

rtnl_lock is used in a lot of places independently from rtnetlink.
Move it to an own file.

Only ugly part is that the rtnetlink init still needs to access
the mutex. do this through a private backdoor, to avoid putting
it into the headers for everyone.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make rtnetlink optional

Small systems can use ioctl/ifconfig for routing and
interface configuration. Make rtnetlink optional
This saves ~29k without LTO, more with LTO.

   text    data     bss     dec     hex filename
 483545   19371   13480  516396   7e12c net/built-in.o-with-rtnetlink
 454365   19275   12936  486576   76cb0 net/built-in.o-wo-rtnetlink

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make GRO offload optional

Make the GRO offload code optional.  It's not needed on small systems.
Since it's not a single file there are a couple of ifdefs.

Some code is still there (not ifdef'ed) but can be removed now with LTO.

Without LTO it gives about 3K.

   text    data     bss     dec     hex filename
 432712   18689   12616  464017   71491 net/built-in.o-with-offload
 429737   17665   12616  460018   704f2 net/built-in.o-wo-offload

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make MIB statistics collections depend on PROC_FS

When PROC_FS is not compiled in we don't need the statistics
gathering code, as the only way to see the output is through
/proc. Saves about 5k text, likely more in dynamic memory.

   text    data     bss     dec     hex filename
 386302    8993   12564  407859   63933 net/built-in.o-with-mib
 381542    8933   12564  403039   6265f net/built-in.o-wo-mib

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make igmp and mcast ioctls depend on IP_MULTICAST

There was already a CONFIG_IP_MULTICAST, but it didn't control
the multicasting code (like igmp) in the IP stack, only some
driver code.  Change this.

This disables some multi cast filters in TCP/UDP too, but
that should be ok because we never joing multicast groups
without this options, so the packets should never arrive up-stack.

Worth ~20k when disabled

   text	   data	    bss	    dec	    hex	filename
 420363	  17509	  11624	 449496	  6dbd8	net/built-in.o-with-mcast
 399649	  17381	  11624	 428654	  68a6e	net/built-in.o-wo-mcast

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make TCP fastopen optional

Make TCP fast open a config option. It's not really needed
on small systems. By itself it saves about 3k text,
but the main advantage is that CONFIG_INET doesn't
pull in AES and the crypto subsystem anymore, which
is worth far more savings.

   text	   data	    bss	    dec	    hex	filename
6954762	1404960	 765952	9125674	 8b3f2a	vmlinux-with-fastopen
6951618	1400608	 765952	9118178	 8b21e2	vmlinux-wo-fastopen

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make internal control sockets use UDP

Make the internal stack socket use UDP. This avoids a dependency
to the soon optional RAW sockets.

Generally the users only use rudimential socket services, mostly
for managing the socket buffer. This is the same for UDP and RAW.

Could in fact remove the arguments.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make raw sockets optional

Not really needed on small embedded systems.  Saves about 5k text,
more with IPv6.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make RPS configurable

Multiple receive queues are not needed on small systems,
so allow disabling them.

This is already disabled with !SMP, but it also makes
sense to disable on very small SMP systems (like
dual core SOC)

Can be worth ~30k code and 6k data

   text	   data	    bss	    dec	    hex	filename
6923914	1398176	 634880	8956970	 88ac2a	vmlinux-with-rps
6893698	1392544	 634880	8921122	 882022	vmlinux-wo-rps

Signed-off-by: Andi Kleen <ak@linux.intel.com>
net, diet: Make XPS configurable

Not needed on small systems. Already disabled with !SMP,
but also makes sense to explicitely disabled on very
small multi-core SOCKs.

Saves ~6k text, but increases the data segment by a
mysterious ~4k (some padding?)

   text	   data	    bss	    dec	    hex	filename
6893698	1392544	 634880	8921122	 882022	vmlinux-with-xps
6887542	1396544	 634880	8918966	 8817b6	vmlinux-wo-xps

Signed-off-by: Andi Kleen <ak@linux.intel.com>