Created attachment 24493 [details] lspci -vv Since kernel 2.6.32 i noticed degraded performance on network file transfers from my 8139too pcmcia card (3MB/sec instead of 11MB/sec). I bisected till this: 1ff84890b62b20823b3697a6041bbec1b5280cee is the first bad commit commit 1ff84890b62b20823b3697a6041bbec1b5280cee Author: Tomas Kovacik <nail@nodomain.sk> Date: Sun Jul 26 22:04:58 2009 +0200 pcmcia: disable prefetch/burst for OZ6933 Problems have been reported [1], so disable prefetch/burst, to be on the safe side. [1] http://www.mail-archive.com/linux-pcmcia@lists.infradead.org/msg02048.html Signed-off-by: Tomáš KováÄik <nail@nodomain.sk> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> :040000 040000 bc4841745f3cba3e1cf1c952d4ce987572fa40f8 8b5f282e917ce1b11b499f81ad219a71487faccd M drivers I agree with the "be on the safe side" statement, but... Bye
> I agree with the "be on the safe side" statement, but... :) Hmm, I'm thinking about a module parameter which can force this on/off while the default behaviour is the currently implemented one. Regards, Wolfram -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
O2-bridges can do read prefetch and write burst. However, for some combinations of older bridges and cards, this causes problems, so it is disabled for those bridges. Now, as some users know their setup works with the speedups enabled, a new parameter is introduced to the driver. Now, a user can specifically enable or disable these features, while the default is what we have today: detect the bridge and decide accordingly. Simplify and unify the printouts while we are here. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: frodone@gmail.com Cc: Dominik Brodowski <linux@dominikbrodowski.net> --- frodone: Can you please test this patch? It is just compile-tested as I don't have access to the hardware I'd need this weekend. drivers/pcmcia/o2micro.h | 38 +++++++++++++++++++++++++------------- drivers/pcmcia/yenta_socket.c | 5 +++++ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/drivers/pcmcia/o2micro.h b/drivers/pcmcia/o2micro.h index 624442f..d98cc01 100644 --- a/drivers/pcmcia/o2micro.h +++ b/drivers/pcmcia/o2micro.h @@ -116,13 +116,12 @@ static int o2micro_override(struct yenta_socket *socket) * from Eric Still, 02Micro. */ u8 a, b; + bool use_speedup; if (PCI_FUNC(socket->dev->devfn) == 0) { a = config_readb(socket, O2_RESERVED1); b = config_readb(socket, O2_RESERVED2); - - dev_printk(KERN_INFO, &socket->dev->dev, - "O2: res at 0x94/0xD4: %02x/%02x\n", a, b); + dev_dbg(&socket->dev->dev, "O2: 0x94/0xD4: %02x/%02x\n", a, b); switch (socket->dev->device) { /* @@ -136,22 +135,35 @@ static int o2micro_override(struct yenta_socket *socket) case PCI_DEVICE_ID_O2_6832: case PCI_DEVICE_ID_O2_6836: case PCI_DEVICE_ID_O2_6933: - dev_printk(KERN_INFO, &socket->dev->dev, - "Yenta O2: old bridge, disabling read " - "prefetch/write burst\n"); - config_writeb(socket, O2_RESERVED1, - a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST)); - config_writeb(socket, O2_RESERVED2, - b & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST)); + use_speedup = false; break; - default: - dev_printk(KERN_INFO , &socket->dev->dev, - "O2: enabling read prefetch/write burst\n"); + use_speedup = true; + break; + } + + if (strcasecmp(o2_speedup, "on") == 0) + use_speedup = true; + else if (strcasecmp(o2_speedup, "off") == 0) + use_speedup = false; + else if (strcasecmp(o2_speedup, "default") != 0) + dev_warn(&socket->dev->dev, + "O2: Unknown parameter, using 'default'"); + + if (use_speedup) { + dev_info(&socket->dev->dev, + "O2: enabling read prefetch/write burst\n"); config_writeb(socket, O2_RESERVED1, a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); config_writeb(socket, O2_RESERVED2, b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); + } else { + dev_info(&socket->dev->dev, + "O2: disabling read prefetch/write burst\n"); + config_writeb(socket, O2_RESERVED1, + a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST)); + config_writeb(socket, O2_RESERVED2, + b & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST)); } } diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index e4d12ac..041a75a 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c @@ -37,6 +37,11 @@ static int pwr_irqs_off; module_param(pwr_irqs_off, bool, 0644); MODULE_PARM_DESC(pwr_irqs_off, "Force IRQs off during power-on of slot. Use only when seeing IRQ storms!"); +static char o2_speedup[] = "default"; +module_param_string(o2_speedup, o2_speedup, sizeof(o2_speedup), 0444); +MODULE_PARM_DESC(o2_speedup, "Use prefetch/burst for O2-bridges: 'on', 'off' " + "or 'default' (uses recommended behaviour for the detected bridge)"); + #define debug(x, s, args...) dev_dbg(&s->dev->dev, x, ##args) /* Don't ask.. */
Works as expected, thank you very much. Quick and clean! :)
Commited as 35169529093be3bbef70afd3c4125e35cece7e03. Can be closed now.