kernel_optimize_test/drivers/net
Alan Cox 33f0f88f1c [PATCH] TTY layer buffering revamp
The API and code have been through various bits of initial review by
serial driver people but they definitely need to live somewhere for a
while so the unconverted drivers can get knocked into shape, existing
drivers that have been updated can be better tuned and bugs whacked out.

This replaces the tty flip buffers with kmalloc objects in rings. In the
normal situation for an IRQ driven serial port at typical speeds the
behaviour is pretty much the same, two buffers end up allocated and the
kernel cycles between them as before.

When there are delays or at high speed we now behave far better as the
buffer pool can grow a bit rather than lose characters. This also means
that we can operate at higher speeds reliably.

For drivers that receive characters in blocks (DMA based, USB and
especially virtualisation) the layer allows a lot of driver specific
code that works around the tty layer with private secondary queues to be
removed. The IBM folks need this sort of layer, the smart serial port
people do, the virtualisers do (because a virtualised tty typically
operates at infinite speed rather than emulating 9600 baud).

Finally many drivers had invalid and unsafe attempts to avoid buffer
overflows by directly invoking tty methods extracted out of the innards
of work queue structs. These are no longer needed and all go away. That
fixes various random hangs with serial ports on overflow.

The other change in here is to optimise the receive_room path that is
used by some callers. It turns out that only one ldisc uses receive room
except asa constant and it updates it far far less than the value is
read. We thus make it a variable not a function call.

I expect the code to contain bugs due to the size alone but I'll be
watching and squashing them and feeding out new patches as it goes.

Because the buffers now dynamically expand you should only run out of
buffering when the kernel runs out of memory for real.  That means a lot of
the horrible hacks high performance drivers used to do just aren't needed any
more.

Description:

tty_insert_flip_char is an old API and continues to work as before, as does
tty_flip_buffer_push() [this is why many drivers dont need modification].  It
does now also return the number of chars inserted

There are also

tty_buffer_request_room(tty, len)

which asks for a buffer block of the length requested and returns the space
found.  This improves efficiency with hardware that knows how much to
transfer.

and tty_insert_flip_string_flags(tty, str, flags, len)

to insert a string of characters and flags

For a smart interface the usual code is

    len = tty_request_buffer_room(tty, amount_hardware_says);
    tty_insert_flip_string(tty, buffer_from_card, len);

More description!

At the moment tty buffers are attached directly to the tty.  This is causing a
lot of the problems related to tty layer locking, also problems at high speed
and also with bursty data (such as occurs in virtualised environments)

I'm working on ripping out the flip buffers and replacing them with a pool of
dynamically allocated buffers.  This allows both for old style "byte I/O"
devices and also helps virtualisation and smart devices where large blocks of
data suddenely materialise and need storing.

So far so good.  Lots of drivers reference tty->flip.*.  Several of them also
call directly and unsafely into function pointers it provides.  This will all
break.  Most drivers can use tty_insert_flip_char which can be kept as an API
but others need more.

At the moment I've added the following interfaces, if people think more will
be needed now is a good time to say

 int tty_buffer_request_room(tty, size)

Try and ensure at least size bytes are available, returns actual room (may be
zero).  At the moment it just uses the flipbuf space but that will change.
Repeated calls without characters being added are not cumulative.  (ie if you
call it with 1, 1, 1, and then 4 you'll have four characters of space.  The
other functions will also try and grow buffers in future but this will be a
more efficient way when you know block sizes.

 int tty_insert_flip_char(tty, ch, flag)

As before insert a character if there is room.  Now returns 1 for success, 0
for failure.

 int tty_insert_flip_string(tty, str, len)

Insert a block of non error characters.  Returns the number inserted.

 int tty_prepare_flip_string(tty, strptr, len)

Adjust the buffer to allow len characters to be added.  Returns a buffer
pointer in strptr and the length available.  This allows for hardware that
needs to use functions like insl or mencpy_fromio.

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: John Hawkes <hawkes@sgi.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-10 08:01:59 -08:00
..
appletalk
arcnet
arm [ARM] Update am79c961 to use struct platform_driver 2006-01-09 13:59:36 +00:00
bonding [PATCH] drivers/net/bonding/bonding.h: "extern inline" -> "static inline" 2006-01-09 10:54:47 -05:00
chelsio [PATCH] chelsio: transmit routine return values 2005-12-24 09:35:17 -05:00
cris [PATCH] cris v10 eth: use ethtool_ops 2005-11-09 01:10:09 -05:00
e1000 [PATCH] e1000: Fix invalid memory reference 2006-01-09 10:54:48 -05:00
fec_8xx [PATCH] fec_8xx: make CONFIG_FEC_8XX depend on CONFIG_8xx 2005-11-18 13:51:34 -05:00
fs_enet [PATCH] fs_enet build fix 2005-11-10 11:25:02 +11:00
hamradio [PATCH] TTY layer buffering revamp 2006-01-10 08:01:59 -08:00
ibm_emac [PATCH] PPC44x EMAC driver: disable TX status deferral in half-duplex mode 2006-01-09 10:34:25 -05:00
irda [PATCH] TTY layer buffering revamp 2006-01-10 08:01:59 -08:00
ixgb [PATCH] drivers/net/ixgb/: make some code static 2005-11-05 21:00:01 -05:00
ixp2000 [PATCH] ixp2000: change netif_schedule_test to __netif_schedule_prep 2005-12-03 20:29:03 -05:00
pcmcia spelling: s/trough/through/ 2006-01-10 00:13:33 +01:00
phy [PATCH] s390: cleanup Kconfig 2006-01-06 08:33:53 -08:00
sk98lin spelling: s/usefull/useful/ 2006-01-10 00:08:17 +01:00
skfp [PATCH] sparse cleanups: NULL pointers, C99 struct init. 2005-10-30 17:37:29 -08:00
tokenring [DRIVER MODEL] Convert platform drivers to use struct platform_driver 2005-11-09 22:32:44 +00:00
tulip [PATCH] tulip: enable multiport NIC BIOS fixups for x86_64 2006-01-09 10:48:09 -05:00
wan [PATCH] TTY layer buffering revamp 2006-01-10 08:01:59 -08:00
wireless [PATCH] TTY layer buffering revamp 2006-01-10 08:01:59 -08:00
3c59x.c [PATCH] 3c59x: don't enable scatter/gather w/o checksum support 2005-11-07 07:53:25 -08:00
3c501.c
3c501.h
3c503.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
3c503.h
3c505.c
3c505.h
3c507.c
3c509.c [PATCH] move pm_register/etc. to CONFIG_PM_LEGACY, pm_legacy.h 2005-11-13 18:14:10 -08:00
3c515.c
3c523.c
3c523.h
3c527.c
3c527.h [PATCH] Eliminate __attribute__ ((packed)) warnings for gcc-4.1 2006-01-08 20:14:07 -08:00
7990.c
7990.h
8139cp.c
8139too.c [PATCH] turn "const static" into "static const" 2006-01-10 08:01:55 -08:00
8390.c
8390.h
82596.c
a2065.c
a2065.h
ac3200.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
acenic_firmware.h
acenic.c drivers/net: Remove pointless checks for NULL prior to calling kfree() 2005-10-28 16:53:13 -04:00
acenic.h
amd8111e.c [git] change permissions on drivers/net/amd8111e.[ch] to 0644, 2005-10-28 16:43:40 -04:00
amd8111e.h [git] change permissions on drivers/net/amd8111e.[ch] to 0644, 2005-10-28 16:43:40 -04:00
apne.c
ariadne.c
ariadne.h
at1700.c
atari_bionet.c
atari_pamsnet.c
atarilance.c
atp.c
atp.h
au1000_eth.c [PATCH] au1000_eth: Include <linux/config.h> 2005-11-18 13:29:41 -05:00
au1000_eth.h
b44.c b44: increase version number 2005-11-30 22:35:39 +01:00
b44.h [PATCH] b44: replace B44_FLAG_INIT_COMPLETE with netif_running() 2005-11-09 01:02:41 -05:00
bmac.c Merge ../linux-2.6 by hand 2005-10-31 13:37:12 +11:00
bmac.h
bnx2_fw.h [PATCH] bnx2: update firmware for 5708 2005-11-05 21:00:02 -05:00
bnx2.c [BNX2]: simplify parameter checks in bnx2_{get,set}_eeprom 2005-11-10 12:58:24 -08:00
bnx2.h [PATCH] bnx2: refine bnx2_poll 2005-11-05 21:00:03 -05:00
bsd_comp.c
cassini.c [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason 2005-11-09 07:55:57 -08:00
cassini.h
cs89x0.c [PATCH] cs89x0: fix up after pnx0105 Kconfig symbol renaming 2006-01-08 20:12:46 -08:00
cs89x0.h [PATCH] cs89x0: cleanly implement ixdp2x01 and pnx0501 support 2006-01-08 20:12:45 -08:00
de600.c
de600.h
de620.c
de620.h
declance.c
defxx.c
defxx.h
depca.c [DRIVER MODEL] Convert platform drivers to use struct platform_driver 2005-11-09 22:32:44 +00:00
depca.h
dgrs_asstruct.h
dgrs_bcomm.h
dgrs_es4h.h
dgrs_ether.h
dgrs_firmware.c
dgrs_i82596.h
dgrs_plx9060.h
dgrs.c [PATCH] net: Fix compiler-error on dgrs.c when !CONFIG_PCI 2005-11-22 09:13:41 -08:00
dgrs.h
dl2k.c
dl2k.h
dm9000.c Merge master.kernel.org:/home/rmk/linux-2.6-drvmodel 2005-11-11 09:24:26 -08:00
dm9000.h
dummy.c
e100.c [PATCH] e100: re-enable microcode with more useful defaults 2005-11-18 13:27:07 -05:00
e2100.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
eepro100.c
eepro.c [PATCH] remove some more check_region stuff 2005-10-30 17:37:18 -08:00
eexpress.c
eexpress.h
epic100.c
eql.c
es3210.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
eth16i.c
ewrk3.c
ewrk3.h
fealnx.c
fec.c [PATCH] m68knommu: FEC ethernet support for the ColdFire 5208 2005-11-07 08:00:47 -08:00
fec.h [PATCH] m68knommu: FEC ethernet header support for the ColdFire 5208 2005-11-07 08:00:47 -08:00
forcedeth.c [PATCH] forcedeth: TSO fix for large buffers 2006-01-09 10:54:48 -05:00
gianfar_ethtool.c [PATCH] Gianfar update and sysfs support 2005-11-18 13:31:26 -05:00
gianfar_mii.c [PATCH] Update email address for Kumar 2005-11-13 18:14:10 -08:00
gianfar_mii.h [PATCH] Gianfar update and sysfs support 2005-11-18 13:31:26 -05:00
gianfar_sysfs.c [PATCH] Gianfar update and sysfs support 2005-11-18 13:31:26 -05:00
gianfar.c [PATCH] Gianfar update and sysfs support 2005-11-18 13:31:26 -05:00
gianfar.h [PATCH] drivers/net/gianfar.h: "extern inline" -> "static inline" 2006-01-09 10:54:47 -05:00
gt64240eth.h
gt96100eth.c [PATCH] gt96100eth.c: Don't concatenate __FUNCTION__ with strings. 2005-11-11 08:32:47 -05:00
gt96100eth.h
hamachi.c
hp100.c spelling: s/retreive/retrieve/ 2006-01-10 00:10:13 +01:00
hp100.h
hp-plus.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
hp.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
hplance.c
hplance.h
hydra.c
hydra.h
ibmlana.c
ibmlana.h
ibmveth.c [PATCH] disable DEBUG in ibmveth 2005-11-11 05:47:04 -05:00
ibmveth.h [PATCH] ibmveth lockless TX 2005-10-28 16:07:30 -04:00
ifb.c [NET]: Add IFB (Intermediate Functional Block) network device. 2006-01-09 14:16:23 -08:00
ioc3-eth.c [PATCH] IOC3: Replace obsolete PCI API 2005-11-18 13:29:41 -05:00
isa-skeleton.c
iseries_veth.c [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason 2005-11-09 07:55:57 -08:00
jazzsonic.c [PATCH] jazzsonic: Fix platform device code 2005-12-01 02:26:46 -05:00
Kconfig [NET]: Add IFB (Intermediate Functional Block) network device. 2006-01-09 14:16:23 -08:00
lance.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
lasi_82596.c
LICENSE.SRC
lne390.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
loopback.c
lp486e.c
mac89x0.c
mac8390.c [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason 2005-11-09 07:55:57 -08:00
mace.c Merge ../linux-2.6 by hand 2005-10-31 13:37:12 +11:00
mace.h
macmace.c
macsonic.c [DRIVER MODEL] Convert platform drivers to use struct platform_driver 2005-11-09 22:32:44 +00:00
Makefile [NET]: Add IFB (Intermediate Functional Block) network device. 2006-01-09 14:16:23 -08:00
meth.c
meth.h
mii.c
mipsnet.c Create platform_device.h to contain all the platform device details. 2005-10-29 19:07:23 +01:00
mipsnet.h [PATCH] mipsnet: Fix Copyright notice. 2005-12-01 02:26:45 -05:00
mv643xx_eth.c [PATCH] remove bouncing mail address of mv643xx_eth maintainer 2006-01-09 10:54:48 -05:00
mv643xx_eth.h [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason 2005-11-09 07:55:57 -08:00
mvme147.c
myri_code.h
myri_sbus.c
myri_sbus.h
natsemi.c
ne2.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
ne2k-pci.c [netdrvr] ne2k-pci based card does not support bus-mastering. 2005-10-28 16:55:55 -04:00
ne3210.c
ne-h8300.c
ne.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
netconsole.c
ni52.c
ni52.h
ni65.c drivers/net: Remove pointless checks for NULL prior to calling kfree() 2005-10-28 16:53:13 -04:00
ni65.h
ni5010.c
ni5010.h
ns83820.c [INET_SOCK]: Move struct inet_sock & helper functions to net/inet_sock.h 2006-01-03 13:11:21 -08:00
oaknet.c
pci-skeleton.c [PATCH] turn "const static" into "static const" 2006-01-10 08:01:55 -08:00
pcnet32.c [PATCH] pcnet32: use MAC address from prom also on powerpc 2005-12-12 15:30:38 -05:00
plip.c [PATCH] parport: include fixes 2006-01-06 08:33:58 -08:00
ppp_async.c [PATCH] TTY layer buffering revamp 2006-01-10 08:01:59 -08:00
ppp_deflate.c
ppp_generic.c [NET]: Validate socket filters against BPF_MAXINSNS in one spot. 2005-12-27 13:57:59 -08:00
ppp_mppe.c [PPP]: add PPP MPPE encryption module 2005-11-08 09:40:47 -08:00
ppp_mppe.h [PPP]: add PPP MPPE encryption module 2005-11-08 09:40:47 -08:00
ppp_synctty.c [PATCH] TTY layer buffering revamp 2006-01-10 08:01:59 -08:00
pppoe.c [PPPOX]: Fix assignment into const proto_ops. 2006-01-03 13:11:23 -08:00
pppox.c [PPPOX]: Fix assignment into const proto_ops. 2006-01-03 13:11:23 -08:00
r8169.c [PATCH] turn "const static" into "static const" 2006-01-10 08:01:55 -08:00
rionet.c
rrunner.c drivers/net: Remove pointless checks for NULL prior to calling kfree() 2005-10-28 16:53:13 -04:00
rrunner.h
s2io-regs.h
s2io.c [PATCH] git-netdev-all: s2io warning fix 2005-12-24 09:37:38 -05:00
s2io.h [PATCH] s2io: UFO support 2005-11-18 13:28:15 -05:00
saa9730.c [PATCH] SAA9730: Driver overhaul 2005-11-11 08:31:35 -05:00
saa9730.h [PATCH] SAA9730: Add missing header bits. 2005-11-18 13:29:41 -05:00
sb1000.c
sb1250-mac.c
seeq8005.c
seeq8005.h
sgiseeq.c
sgiseeq.h
shaper.c
sis190.c [PATCH] turn "const static" into "static const" 2006-01-10 08:01:55 -08:00
sis900.c [PATCH] Add Wake on LAN support to sis900 (2) 2005-10-28 16:48:19 -04:00
sis900.h [PATCH] Add Wake on LAN support to sis900 (2) 2005-10-28 16:48:19 -04:00
sk_mca.c [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason 2005-11-09 07:55:57 -08:00
sk_mca.h [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason 2005-11-09 07:55:57 -08:00
skge.c Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6 2006-01-04 16:31:56 -08:00
skge.h [PATCH] skge: get rid of Yukon2 defines 2005-12-24 09:36:06 -05:00
sky2.c [PATCH] sky2: version 0.11 2005-12-24 09:38:35 -05:00
sky2.h [PATCH] sky2: tx/rx ring data structure split 2005-12-12 15:27:20 -05:00
slhc.c
slip.c [PATCH] TTY layer buffering revamp 2006-01-10 08:01:59 -08:00
slip.h
smc91x.c [PATCH] IRQ type flags 2006-01-08 20:13:46 -08:00
smc91x.h [PATCH] IRQ type flags 2006-01-08 20:13:46 -08:00
smc9194.c
smc9194.h
smc-mca.c
smc-ultra32.c
smc-ultra.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
sonic.c
sonic.h
Space.c
spider_net_ethtool.c
spider_net.c [PATCH] PCI: removed unneeded .owner field from struct pci_driver 2005-11-10 16:09:17 -08:00
spider_net.h
starfire_firmware.h
starfire_firmware.pl
starfire.c [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason 2005-11-09 07:55:57 -08:00
stnic.c
sun3_82586.c
sun3_82586.h
sun3lance.c
sunbmac.c
sunbmac.h
sundance.c [PATCH] sundance: fix DFE-580TX Tx Underrun 2005-10-28 16:40:33 -04:00
sungem_phy.c
sungem_phy.h
sungem.c [SUNGEM]: Fix link error with CONFIG_HOTPLUG disabled. 2005-12-22 23:09:44 -08:00
sungem.h
sunhme.c
sunhme.h
sunlance.c
sunqe.c
sunqe.h
tc35815.c
tg3.c [TG3]: fixup tot_len calculation 2006-01-03 14:19:25 -08:00
tg3.h [TG3]: ethtool -d hangs PCIe systems 2005-12-28 13:04:52 -08:00
tlan.c s/retreiv/retriev/g 2006-01-03 13:27:11 +01:00
tlan.h
tun.c
typhoon-firmware.h
typhoon.c
typhoon.h
via-rhine.c
via-velocity.c [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason 2005-11-09 07:55:57 -08:00
via-velocity.h
wd.c [PATCH] fix a few "warning: 'cleanup_card' defined but not used" 2006-01-09 10:54:48 -05:00
yellowfin.c
znet.c
zorro8390.c