* Re: [2.6 patch] drivers/char/random.c: unexport secure_ipv6_port_ephemeral
From: Stephen Hemminger @ 2006-04-05 17:11 UTC (permalink / raw)
To: Adrian Bunk; +Cc: mpm, linux-kernel, netdev
In-Reply-To: <20060405163610.GG8673@stusta.de>
On Wed, 5 Apr 2006 18:36:10 +0200
Adrian Bunk <bunk@stusta.de> wrote:
> This patch removes the unused EXPORT_SYMBOL(secure_ipv6_port_ephemeral).
>
> Signed-off-by: Adrian Bunk <bunk@stusta.de>
>
> --- linux-2.6.17-rc1-mm1-full/drivers/char/random.c.old 2006-04-05 17:00:04.000000000 +0200
> +++ linux-2.6.17-rc1-mm1-full/drivers/char/random.c 2006-04-05 17:00:22.000000000 +0200
> @@ -1584,7 +1584,6 @@
>
> return twothirdsMD4Transform(daddr, hash);
> }
> -EXPORT_SYMBOL(secure_ipv6_port_ephemeral);
> #endif
>
> #if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
>
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
NAK
If IPV6 is built as a module, then it is needed.
^ permalink raw reply
* Re: [2.6 patch] drivers/char/random.c: unexport secure_ipv6_port_ephemeral
From: Adrian Bunk @ 2006-04-05 17:19 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: mpm, linux-kernel, netdev
In-Reply-To: <20060405101111.0edc161a@localhost.localdomain>
On Wed, Apr 05, 2006 at 10:11:11AM -0700, Stephen Hemminger wrote:
> On Wed, 5 Apr 2006 18:36:10 +0200
> Adrian Bunk <bunk@stusta.de> wrote:
>
> > This patch removes the unused EXPORT_SYMBOL(secure_ipv6_port_ephemeral).
> >
> > Signed-off-by: Adrian Bunk <bunk@stusta.de>
> >
> > --- linux-2.6.17-rc1-mm1-full/drivers/char/random.c.old 2006-04-05 17:00:04.000000000 +0200
> > +++ linux-2.6.17-rc1-mm1-full/drivers/char/random.c 2006-04-05 17:00:22.000000000 +0200
> > @@ -1584,7 +1584,6 @@
> >
> > return twothirdsMD4Transform(daddr, hash);
> > }
> > -EXPORT_SYMBOL(secure_ipv6_port_ephemeral);
> > #endif
> >
> > #if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> NAK
>
> If IPV6 is built as a module, then it is needed.
No, it isn't:
obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_hashtables.o
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply
* [PATCH] net: Broadcast ARP packets on link local addresses (Version2).
From: David Daney @ 2006-04-05 21:22 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, pgf, freek
From: David Daney
Here is a new version of the patch I sent March 31. For background,
this is my description from the first patch:
> When an internet host joins a network where there is no DHCP server,
> it may auto-allocate an IP address by the method described in RFC
> 3927. There are several user space daemons available that implement
> most of the protocol (zcip, busybox, ...). The kernel's APR driver
> should function in the normal manner except that it is required to
> broadcast all ARP packets that it originates in the link local address
> space (169.254.0.0/16). RFC 3927 section 2.5 explains the requirement.
> The current ARP code is non-compliant because it does not broadcast
> some ARP packets as required by RFC 3927.
> This patch to net/ipv4/arp.c checks the source address of all ARP
> packets and if the fall in 169.254.0.0/16, they are broadcast instead
> of unicast.
All of that is still true.
The changes in this version are that it tests the source IP address
instead of the destination. The test now matches the test described
in the RFC. Also a small cleanup as suggested by Herbert Xu.
Some comments on the first version of the patch suggested that I do
'X' instead. Where 'X' was behavior different than that REQUIRED by
the RFC (the RFC's always seem to capitalize the word 'required').
The reason that I implemented the behavior required by the RFC is so
that a device running the kernel can pass compliance tests that
mandate RFC compliance.
If the patch is deemed good and correct, great, please apply it.
Othwise comments about how to improve it are always welcome. But keep
in mind that I would like to end up with something that complies with
the RFC.
This patch is against 2.6.16.1
Signed-off-by: David Daney <ddaney@avtrex.com>
---
--- net/ipv4/arp.c.orig 2006-03-31 13:44:50.000000000 -0800
+++ net/ipv4/arp.c 2006-04-05 13:33:19.000000000 -0700
@@ -690,6 +690,11 @@ void arp_send(int type, int ptype, u32 d
if (dev->flags&IFF_NOARP)
return;
+ /* If link local address (169.254.0.0/16) we must broadcast
+ * the ARP packet. See RFC 3927 section 2.5 for details. */
+ if ((src_ip & htonl(0xFFFF0000UL)) == htonl(0xA9FE0000UL))
+ dest_hw = NULL;
+
skb = arp_create(type, ptype, dest_ip, dev, src_ip,
dest_hw, src_hw, target_hw);
if (skb == NULL) {
^ permalink raw reply
* Re: [e1000 debug] KERNEL: assertion (!sk_forward_alloc) failed...
From: Jesse Brandeburg @ 2006-04-05 22:05 UTC (permalink / raw)
To: Boris B. Zhmurov
Cc: Phil Oester, Mark Nipper, Herbert Xu, David S. Miller,
Brandeburg, Jesse, jrlundgren, cat, djani22, yoseph.basri, mykleb,
olel, michal, chris, netdev, jesse.brandeburg, E1000-devel,
Andi Kleen, Jeff Garzik
In-Reply-To: <44319AFF.4090101@kernelpanic.ru>
On Mon, 3 Apr 2006, Boris B. Zhmurov wrote:
>
> Hello, Phil Oester.
>
> On 04.04.2006 01:39 you said the following:
>
> > On Mon, Apr 03, 2006 at 04:01:23PM -0500, Mark Nipper wrote:
> >
> >> After three days and some hours, I finally saw another
> >>event:
> >
> >
> > Ack, same here. Looked hopeful, but finally saw the error today.
> >
> > Phil
>
>
> [root@msk4 ~]# dmesg |grep assertion |wc -l
> 176
>
> [root@msk4 ~]# uptime
> 02:00:01 up 3 days, 7:31, 2 users, load average: 1.32, 0.59, 0.41
>
Some earlier had proposed that this problem appeared in 2.6.12, which was
the introduction of the 6.X series e1000 driver.
If someone would like to, can they try the 5.6.10.1 driver from the
2.6.11.X kernel?
I'd like it if you can stick with your current kernel, and if you have
trouble building the driver, go ahead and try the 5.6.10.1 driver from
http://prdownloads.sf.net/e1000
I'll also send a patch today to back-rev the xmit routine to the 5.6.10.1
state.
Jesse
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply
* [PATCH] IrDA: smcinit merged into smsc-ircc driver
From: Samuel Ortiz @ 2006-04-05 23:21 UTC (permalink / raw)
To: ext David S. Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, IrDA users, Jean Tourrilhes
Hi David,
This patch integrates the smcinit code into the smsc-ircc driver.
Some laptops have their smsc-ircc chip not properly configured by the BIOS and needs some preconfiguration. Currently, this can be done from userspace with smcinit, a utility that comes with the irda-utils package. It messes with ioports and PCI settings, from userspace.
Now with this patch, if we happen to be on one of the known to be faulty laptops, we preconfigure the chip from the driver.
Patch from Linus Walleij <triad-HEm3bjczhZmzQB+pC5nmwQ@public.gmane.org>
Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index ec94ecd..f6d98b4 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -11,6 +11,7 @@
* Copyright (c) 2002 Daniele Peri
* All Rights Reserved.
* Copyright (c) 2002 Jean Tourrilhes
+ * Copyright (c) 2006 Linus Walleij
*
*
* Based on smc-ircc.c:
@@ -61,6 +62,9 @@
#include <linux/spinlock.h>
#include <linux/pm.h>
+#ifdef CONFIG_PCI
+#include <linux/pci.h>
+#endif
#include <net/irda/wrapper.h>
#include <net/irda/irda.h>
@@ -100,6 +104,22 @@ MODULE_PARM_DESC(ircc_transceiver, "Tran
/* Types */
+#ifdef CONFIG_PCI
+struct smsc_ircc_subsystem_configuration {
+ unsigned short vendor; /* PCI vendor ID */
+ unsigned short device; /* PCI vendor ID */
+ unsigned short subvendor; /* PCI subsystem vendor ID */
+ unsigned short subdevice; /* PCI sybsystem device ID */
+ unsigned short sir_io; /* I/O port for SIR */
+ unsigned short fir_io; /* I/O port for FIR */
+ unsigned char fir_irq; /* FIR IRQ */
+ unsigned char fir_dma; /* FIR DMA */
+ unsigned short cfg_base; /* I/O port for chip configuration */
+ int (*preconfigure)(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); /* Preconfig function */
+ const char *name; /* name shown as info */
+};
+#endif
+
struct smsc_transceiver {
char *name;
void (*set_for_speed)(int fir_base, u32 speed);
@@ -202,6 +222,16 @@ static int __init smsc_superio_flat(cons
static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned short cfg_base, char *type);
static int __init smsc_superio_fdc(unsigned short cfg_base);
static int __init smsc_superio_lpc(unsigned short cfg_base);
+#ifdef CONFIG_PCI
+static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf);
+static int __init preconfigure_through_82801(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf);
+static int __init preconfigure_through_ali(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf);
+static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg,
+ unsigned short ircc_fir,
+ unsigned short ircc_sir,
+ unsigned char ircc_dma,
+ unsigned char ircc_irq);
+#endif
/* Transceivers specific functions */
@@ -353,6 +383,13 @@ static int __init smsc_ircc_init(void)
return ret;
}
+#ifdef CONFIG_PCI
+ if (smsc_ircc_preconfigure_subsystems(ircc_cfg, ircc_fir, ircc_sir, ircc_dma, ircc_irq) < 0) {
+ /* Ignore errors from preconfiguration */
+ IRDA_ERROR("%s, Preconfiguration failed !\n", driver_name);
+ }
+#endif
+
dev_count = 0;
if (ircc_fir > 0 && ircc_sir > 0) {
@@ -2285,6 +2322,280 @@ static int __init smsc_superio_lpc(unsig
return ret;
}
+/*
+ * Look for some specific subsystem setups that need
+ * pre-configuration not properly done by the BIOS (especially laptops)
+ * This code is based in part on smcinit.c, tosh1800-smcinit.c
+ * and tosh2450-smcinit.c. The table lists the device entries
+ * for ISA bridges with an LPC (Local Peripheral Configurator)
+ * that are in turn used to configure the SMSC device with default
+ * SIR and FIR I/O ports, DMA and IRQ.
+ */
+#ifdef CONFIG_PCI
+#define PCIID_VENDOR_INTEL 0x8086
+#define PCIID_VENDOR_ALI 0x10b9
+static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __devinitdata = {
+ {
+ .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */
+ .device = 0x24cc,
+ .subvendor = 0x103c,
+ .subdevice = 0x088c,
+ .sir_io = 0x02f8, /* Quite certain these are the same for nc8000 as for nc6000 */
+ .fir_io = 0x0130,
+ .fir_irq = 0x09,
+ .fir_dma = 0x03,
+ .cfg_base = 0x004e,
+ .preconfigure = preconfigure_through_82801,
+ .name = "HP nc8000",
+ },
+ {
+ .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */
+ .device = 0x24cc,
+ .subvendor = 0x103c,
+ .subdevice = 0x0890,
+ .sir_io = 0x02f8,
+ .fir_io = 0x0130,
+ .fir_irq = 0x09,
+ .fir_dma = 0x03,
+ .cfg_base = 0x004e,
+ .preconfigure = preconfigure_through_82801,
+ .name = "HP nc6000",
+ },
+ {
+ .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */
+ .device = 0x24c0,
+ .subvendor = 0x1179,
+ .subdevice = 0xffff, /* 0xffff is "any", Not sure, 0x0001 or 0x0002 */
+ .sir_io = 0x03f8,
+ .fir_io = 0x0130,
+ .fir_irq = 0x07,
+ .fir_dma = 0x01,
+ .cfg_base = 0x002e,
+ .preconfigure = preconfigure_through_82801,
+ .name = "Toshiba Satellite 2450",
+ },
+ {
+ .vendor = PCIID_VENDOR_INTEL, /* Intel 82801CAM ISA bridge */
+ .device = 0x248c, /* Some use 24cc? */
+ .subvendor = 0x1179,
+ .subdevice = 0xffff, /* 0xffff is "any", Not sure, 0x0001 or 0x0002 */
+ .sir_io = 0x03f8,
+ .fir_io = 0x0130,
+ .fir_irq = 0x03,
+ .fir_dma = 0x03,
+ .cfg_base = 0x002e,
+ .preconfigure = preconfigure_through_82801,
+ .name = "Toshiba Satellite 5100/5200, Tecra 9100",
+ },
+ {
+ .vendor = PCIID_VENDOR_ALI, /* ALi M1533/M1535 PCI to ISA Bridge [Aladdin IV/V/V+] */
+ .device = 0x1533,
+ .subvendor = 0x1179,
+ .subdevice = 0xffff, /* 0xffff is "any", Not sure, 0x0001 or 0x0002 */
+ .sir_io = 0x02e8,
+ .fir_io = 0x02f8,
+ .fir_irq = 0x07,
+ .fir_dma = 0x03,
+ .cfg_base = 0x002e,
+ .preconfigure = preconfigure_through_ali,
+ .name = "Toshiba Satellite 1800",
+ },
+ { } // Terminator
+};
+
+
+/*
+ * This sets up the basic SMSC parameters (FIR port, SIR port, FIR DMA, FIR IRQ)
+ * through the chip configuration port.
+ */
+static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf)
+{
+ unsigned short iobase = conf->cfg_base;
+ unsigned char tmpbyte;
+
+ outb(LPC47N227_CFGACCESSKEY, iobase); // enter configuration state
+ outb(SMSCSIOFLAT_DEVICEID_REG, iobase); // set for device ID
+ tmpbyte = inb(iobase +1); // Read device ID
+ IRDA_DEBUG(0, "Detected Chip id: 0x%02x, setting up registers...\n",tmpbyte);
+
+ /* Disable UART1 and set up SIR I/O port */
+ outb(0x24, iobase); // select CR24 - UART1 base addr
+ outb(0x00, iobase + 1); // disable UART1
+ outb(SMSCSIOFLAT_UART2BASEADDR_REG, iobase); // select CR25 - UART2 base addr
+ outb( (conf->sir_io >> 2), iobase + 1); // bits 2-9 of 0x3f8
+ tmpbyte = inb(iobase + 1);
+ if (tmpbyte != (conf->sir_io >> 2) ) {
+ IRDA_WARNING("ERROR: could not configure SIR ioport.\n");
+ return -ENXIO;
+ }
+
+ /* Set up FIR IRQ channel for UART2 */
+ outb(SMSCSIOFLAT_UARTIRQSELECT_REG, iobase); // select CR28 - UART1,2 IRQ select
+ tmpbyte = inb(iobase + 1);
+ tmpbyte &= SMSCSIOFLAT_UART1IRQSELECT_MASK; // Do not touch the UART1 portion
+ tmpbyte |= (conf->fir_irq & SMSCSIOFLAT_UART2IRQSELECT_MASK);
+ outb(tmpbyte, iobase + 1);
+ tmpbyte = inb(iobase + 1) & SMSCSIOFLAT_UART2IRQSELECT_MASK;
+ if (tmpbyte != conf->fir_irq) {
+ IRDA_WARNING("ERROR: could not configure FIR IRQ channel.\n");
+ return -ENXIO;
+ }
+
+ /* Set up FIR I/O port */
+ outb(SMSCSIOFLAT_FIRBASEADDR_REG, iobase); // CR2B - SCE (FIR) base addr
+ outb((conf->fir_io >> 3), iobase + 1);
+ tmpbyte = inb(iobase + 1);
+ if (tmpbyte != (conf->fir_io >> 3) ) {
+ IRDA_WARNING("ERROR: could not configure FIR I/O port.\n");
+ return -ENXIO;
+ }
+
+ /* Set up FIR DMA channel */
+ outb(SMSCSIOFLAT_FIRDMASELECT_REG, iobase); // CR2C - SCE (FIR) DMA select
+ outb((conf->fir_dma & LPC47N227_FIRDMASELECT_MASK), iobase + 1); // DMA
+ tmpbyte = inb(iobase + 1) & LPC47N227_FIRDMASELECT_MASK;
+ if (tmpbyte != (conf->fir_dma & LPC47N227_FIRDMASELECT_MASK)) {
+ IRDA_WARNING("ERROR: could not configure FIR DMA channel.\n");
+ return -ENXIO;
+ }
+
+ outb(SMSCSIOFLAT_UARTMODE0C_REG, iobase); // CR0C - UART mode
+ tmpbyte = inb(iobase + 1);
+ tmpbyte &= ~SMSCSIOFLAT_UART2MODE_MASK | SMSCSIOFLAT_UART2MODE_VAL_IRDA;
+ outb(tmpbyte, iobase + 1); // enable IrDA (HPSIR) mode, high speed
+
+ outb(LPC47N227_APMBOOTDRIVE_REG, iobase); // CR07 - Auto Pwr Mgt/boot drive sel
+ tmpbyte = inb(iobase + 1);
+ outb(tmpbyte | LPC47N227_UART2AUTOPWRDOWN_MASK, iobase + 1); // enable UART2 autopower down
+
+ /* This one was not part of tosh1800 */
+ outb(0x0a, iobase); // CR0a - ecp fifo / ir mux
+ tmpbyte = inb(iobase + 1);
+ outb(tmpbyte | 0x40, iobase + 1); // send active device to ir port
+
+ outb(LPC47N227_UART12POWER_REG, iobase); // CR02 - UART 1,2 power
+ tmpbyte = inb(iobase + 1);
+ outb(tmpbyte | LPC47N227_UART2POWERDOWN_MASK, iobase + 1); // UART2 power up mode, UART1 power down
+
+ outb(LPC47N227_FDCPOWERVALIDCONF_REG, iobase); // CR00 - FDC Power/valid config cycle
+ tmpbyte = inb(iobase + 1);
+ outb(tmpbyte | LPC47N227_VALID_MASK, iobase + 1); // valid config cycle done
+
+ outb(LPC47N227_CFGEXITKEY, iobase); // Exit configuration
+
+ return 0;
+}
+
+/* 82801CAM registers */
+#define VID 0x00
+#define DID 0x02
+#define PIRQA_ROUT 0x60
+#define PCI_DMA_C 0x90
+#define COM_DEC 0xe0
+#define LPC_EN 0xe6
+#define GEN2_DEC 0xec
+/*
+ * Sets up the I/O range using the 82801CAM ISA bridge, 82801DBM LPC bridge or
+ * Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge. They all work the same way!
+ */
+static int __init preconfigure_through_82801(struct pci_dev *dev,
+ struct smsc_ircc_subsystem_configuration *conf)
+{
+ unsigned short tmpword;
+ int ret;
+
+ IRDA_MESSAGE("Setting up the SMSC device via the 82801 controller.\n");
+ pci_write_config_byte(dev, COM_DEC, 0x10);
+
+ /* Enable LPC */
+ pci_read_config_word(dev, LPC_EN, &tmpword); /* LPC_EN register */
+ tmpword &= 0xfffd; /* mask bit 1 */
+ tmpword |= 0x0001; /* set bit 0 : COMA addr range enable */
+ pci_write_config_word(dev, LPC_EN, tmpword);
+
+ /* Setup DMA */
+ pci_write_config_word(dev, PCI_DMA_C, 0xc0c0); /* LPC I/F DMA on, channel 3 -- rtm (?? PCI DMA ?) */
+ pci_write_config_word(dev, GEN2_DEC, 0x131); /* LPC I/F 2nd decode range */
+
+ /* Pre-configure chip */
+ ret = preconfigure_smsc_chip(conf);
+
+ /* Disable LPC */
+ pci_read_config_word(dev, LPC_EN, &tmpword); /* LPC_EN register */
+ tmpword &= 0xfffc; /* mask bit 1 and bit 0, COMA addr range disable */
+ pci_write_config_word(dev, LPC_EN, tmpword);
+ return ret;
+}
+
+static int __init preconfigure_through_ali(struct pci_dev *dev,
+ struct smsc_ircc_subsystem_configuration *conf)
+{
+ /* TODO: put in ALi 1533 configuration here. */
+ IRDA_MESSAGE("SORRY: %s has an unsupported bridge controller (ALi): not pre-configured.\n", conf->name);
+ return -ENODEV;
+}
+
+static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg,
+ unsigned short ircc_fir,
+ unsigned short ircc_sir,
+ unsigned char ircc_dma,
+ unsigned char ircc_irq)
+{
+ struct pci_dev *dev = NULL;
+ unsigned short ss_vendor = 0x0000;
+ unsigned short ss_device = 0x0000;
+ int ret = 0;
+
+ dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev);
+
+ while (dev != NULL) {
+ struct smsc_ircc_subsystem_configuration *conf;
+
+ /*
+ * Cache the subsystem vendor/device: some manufacturers fail to set
+ * this for all components, so we save it in case there is just
+ * 0x0000 0x0000 on the device we want to check.
+ */
+ if (dev->subsystem_vendor != 0x0000U) {
+ ss_vendor = dev->subsystem_vendor;
+ ss_device = dev->subsystem_device;
+ }
+ conf = subsystem_configurations;
+ for( ; conf->subvendor; conf++) {
+ if(conf->vendor == dev->vendor &&
+ conf->device == dev->device &&
+ conf->subvendor == ss_vendor && /* Sometimes these are cached values */
+ (conf->subdevice == ss_device || conf->subdevice == 0xffff)) {
+ struct smsc_ircc_subsystem_configuration tmpconf;
+
+ memcpy(&tmpconf, conf, sizeof(struct smsc_ircc_subsystem_configuration));
+
+ /* Override the default values with anything passed in as parameter */
+ if (ircc_cfg != 0)
+ tmpconf.cfg_base = ircc_cfg;
+ if (ircc_fir != 0)
+ tmpconf.fir_io = ircc_fir;
+ if (ircc_sir != 0)
+ tmpconf.sir_io = ircc_sir;
+ if (ircc_dma != 0xff)
+ tmpconf.fir_dma = ircc_dma;
+ if (ircc_irq != 0xff)
+ tmpconf.fir_irq = ircc_irq;
+
+ IRDA_MESSAGE("Detected unconfigured %s SMSC IrDA chip, pre-configuring device.\n", conf->name);
+ if (conf->preconfigure)
+ ret = conf->preconfigure(dev, &tmpconf);
+ else
+ ret = -ENODEV;
+ }
+ }
+ dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev);
+ }
+
+ return ret;
+}
+#endif // CONFIG_PCI
+
/************************************************
*
* Transceivers specific functions
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply related
* [PATCH] IrDA: Support for Sigmatel STIR421x chip
From: Samuel Ortiz @ 2006-04-05 23:21 UTC (permalink / raw)
To: ext David S. Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, IrDA users, Jean Tourrilhes
Hi David,
This patch enables support for the Sigmatel's STIR421x IrDA chip.
Once patched with Sigmatel's firmware, this chip "almost" follows the USB-IrDA spec. Thus this patch is against irda-usb.[ch].
The code has been tested by Nick Fedchik on an STIR4210 chipset based dongle.
Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h
index 4026af4..4e12217 100644
--- a/drivers/net/irda/irda-usb.h
+++ b/drivers/net/irda/irda-usb.h
@@ -1,7 +1,7 @@
/*****************************************************************************
*
* Filename: irda-usb.h
- * Version: 0.9b
+ * Version: 0.10
* Description: IrDA-USB Driver
* Status: Experimental
* Author: Dag Brattli <dag-1K3ejsF8QZHR7s880joybQ@public.gmane.org>
@@ -9,6 +9,9 @@
* Copyright (C) 2001, Roman Weissgaerber <weissg-TVDPYGuBT+ReoWH0uzbU5w@public.gmane.org>
* Copyright (C) 2000, Dag Brattli <dag-1K3ejsF8QZHR7s880joybQ@public.gmane.org>
* Copyright (C) 2001, Jean Tourrilhes <jt-sDzT885Ts8HQT0dZR+AlfA@public.gmane.org>
+ * Copyright (C) 2004, SigmaTel, Inc. <irquality-0iljnS1bRDtWk0Htik3J/w@public.gmane.org>
+ * Copyright (C) 2005, Milan Beno <beno-Rm0zKEqwvD4@public.gmane.org>
+ * Copyright (C) 2006, Nick FEdchik <nick-UvdXiu2sajOKBXSJ/Qx0JQ@public.gmane.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +34,9 @@
#include <net/irda/irda.h>
#include <net/irda/irda_device.h> /* struct irlap_cb */
+#define PATCH_FILE_SIZE_MAX 65536
+#define PATCH_FILE_SIZE_MIN 80
+
#define RX_COPY_THRESHOLD 200
#define IRDA_USB_MAX_MTU 2051
#define IRDA_USB_SPEED_MTU 64 /* Weird, but work like this */
@@ -79,15 +85,16 @@
/* Inbound header */
#define MEDIA_BUSY 0x80
-#define SPEED_2400 0x01
-#define SPEED_9600 0x02
-#define SPEED_19200 0x03
-#define SPEED_38400 0x04
-#define SPEED_57600 0x05
-#define SPEED_115200 0x06
-#define SPEED_576000 0x07
-#define SPEED_1152000 0x08
-#define SPEED_4000000 0x09
+#define SPEED_2400 0x01
+#define SPEED_9600 0x02
+#define SPEED_19200 0x03
+#define SPEED_38400 0x04
+#define SPEED_57600 0x05
+#define SPEED_115200 0x06
+#define SPEED_576000 0x07
+#define SPEED_1152000 0x08
+#define SPEED_4000000 0x09
+#define SPEED_16000000 0x0a
/* Basic capabilities */
#define IUC_DEFAULT 0x00 /* Basic device compliant with 1.0 spec */
@@ -100,11 +107,14 @@
#define IUC_SMALL_PKT 0x10 /* Device doesn't behave with big Rx packets */
#define IUC_MAX_WINDOW 0x20 /* Device underestimate the Rx window */
#define IUC_MAX_XBOFS 0x40 /* Device need more xbofs than advertised */
+#define IUC_STIR_4210 0x80 /* SigmaTel 4210/4220/4116 VFIR */
/* USB class definitions */
-#define USB_IRDA_HEADER 0x01
-#define USB_CLASS_IRDA 0x02 /* USB_CLASS_APP_SPEC subclass */
-#define USB_DT_IRDA 0x21
+#define USB_IRDA_HEADER 0x01
+#define USB_CLASS_IRDA 0x02 /* USB_CLASS_APP_SPEC subclass */
+#define USB_DT_IRDA 0x21
+#define USB_IRDA_SIGMATEL_HEADER 0x03
+#define IU_SIGMATEL_MAX_RX_URBS (IU_MAX_ACTIVE_RX_URBS + USB_IRDA_SIGMATEL_HEADER)
struct irda_class_desc {
__u8 bLength;
@@ -123,6 +133,7 @@ struct irda_class_desc {
* (6.2.5, USB-IrDA class spec 1.0) */
#define IU_REQ_GET_CLASS_DESC 0x06
+#define STIR421X_MAX_PATCH_DOWNLOAD_SIZE 1023
struct irda_usb_cb {
struct irda_class_desc *irda_desc;
@@ -136,7 +147,8 @@ struct irda_usb_cb {
__u16 bulk_out_mtu; /* Max Tx packet size in bytes */
__u8 bulk_int_ep; /* Interrupt Endpoint assignments */
- struct urb *rx_urb[IU_MAX_RX_URBS]; /* URBs used to receive data frames */
+ __u8 max_rx_urb;
+ struct urb **rx_urb; /* URBs used to receive data frames */
struct urb *idle_rx_urb; /* Pointer to idle URB in Rx path */
struct urb *tx_urb; /* URB used to send data frames */
struct urb *speed_urb; /* URB used to send speed commands */
@@ -156,6 +168,9 @@ struct irda_usb_cb {
__s16 new_xbofs; /* xbofs we need to set */
__u32 speed; /* Current speed */
__s32 new_speed; /* speed we need to set */
+
+ __u8 header_length; /* USB-IrDA frame header size */
+ int needspatch; /* device needs firmware patch */
struct timer_list rx_defer_timer; /* Wait for Rx error to clear */
};
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 6e2ec56..390d23b 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1,7 +1,7 @@
/*****************************************************************************
*
* Filename: irda-usb.c
- * Version: 0.9b
+ * Version: 0.10
* Description: IrDA-USB Driver
* Status: Experimental
* Author: Dag Brattli <dag-1K3ejsF8QZHR7s880joybQ@public.gmane.org>
@@ -9,6 +9,9 @@
* Copyright (C) 2000, Roman Weissgaerber <weissg-TVDPYGuBT+ReoWH0uzbU5w@public.gmane.org>
* Copyright (C) 2001, Dag Brattli <dag-1K3ejsF8QZHR7s880joybQ@public.gmane.org>
* Copyright (C) 2001, Jean Tourrilhes <jt-sDzT885Ts8HQT0dZR+AlfA@public.gmane.org>
+ * Copyright (C) 2004, SigmaTel, Inc. <irquality-0iljnS1bRDtWk0Htik3J/w@public.gmane.org>
+ * Copyright (C) 2005, Milan Beno <beno-Rm0zKEqwvD4@public.gmane.org>
+ * Copyright (C) 2006, Nick Fedchik <nick-UvdXiu2sajOKBXSJ/Qx0JQ@public.gmane.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -61,6 +64,7 @@
#include <linux/slab.h>
#include <linux/rtnetlink.h>
#include <linux/usb.h>
+#include <linux/firmware.h>
#include "irda-usb.h"
@@ -78,8 +82,12 @@ static struct usb_device_id dongles[] =
{ USB_DEVICE(0x50f, 0x180), .driver_info = IUC_SPEED_BUG | IUC_NO_WINDOW },
/* Extended Systems, Inc., XTNDAccess IrDA USB (ESI-9685) */
{ USB_DEVICE(0x8e9, 0x100), .driver_info = IUC_SPEED_BUG | IUC_NO_WINDOW },
- { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS |
- USB_DEVICE_ID_MATCH_INT_SUBCLASS,
+ /* SigmaTel STIR4210/4220/4116 USB IrDA (VFIR) Bridge */
+ { USB_DEVICE(0x66f, 0x4210), .driver_info = IUC_STIR_4210 | IUC_SPEED_BUG },
+ { USB_DEVICE(0x66f, 0x4220), .driver_info = IUC_STIR_4210 | IUC_SPEED_BUG },
+ { USB_DEVICE(0x66f, 0x4116), .driver_info = IUC_STIR_4210 | IUC_SPEED_BUG },
+ { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS |
+ USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.bInterfaceClass = USB_CLASS_APP_SPEC,
.bInterfaceSubClass = USB_CLASS_IRDA,
.driver_info = IUC_DEFAULT, },
@@ -99,6 +107,7 @@ MODULE_DEVICE_TABLE(usb, dongles);
/*------------------------------------------------------------------*/
+static void irda_usb_init_qos(struct irda_usb_cb *self) ;
static struct irda_class_desc *irda_usb_find_class_desc(struct usb_interface *intf);
static void irda_usb_disconnect(struct usb_interface *intf);
static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self);
@@ -141,7 +150,24 @@ static void irda_usb_build_header(struct
__u8 *header,
int force)
{
- /* Set the negotiated link speed */
+ /* Here we check if we have an STIR421x chip,
+ * and if either speed or xbofs (or both) needs
+ * to be changed.
+ */
+ if (self->capability & IUC_STIR_4210 &&
+ ((self->new_speed != -1) || (self->new_xbofs != -1))) {
+
+ /* With STIR421x, speed and xBOFs must be set at the same
+ * time, even if only one of them changes.
+ */
+ if (self->new_speed == -1)
+ self->new_speed = self->speed ;
+
+ if (self->new_xbofs == -1)
+ self->new_xbofs = self->xbofs ;
+ }
+
+ /* Set the link speed */
if (self->new_speed != -1) {
/* Hum... Ugly hack :-(
* Some device are not compliant with the spec and change
@@ -191,7 +217,11 @@ static void irda_usb_build_header(struct
*header = SPEED_4000000;
self->new_xbofs = 0;
break;
- }
+ case 16000000:
+ *header = SPEED_16000000;
+ self->new_xbofs = 0;
+ break;
+ }
} else
/* No change */
*header = 0;
@@ -235,6 +265,32 @@ static void irda_usb_build_header(struct
}
}
+/*
+* calculate turnaround time for SigmaTel header
+*/
+static __u8 get_turnaround_time(struct sk_buff *skb)
+{
+ int turnaround_time = irda_get_mtt(skb);
+
+ if ( turnaround_time == 0 )
+ return 0;
+ else if ( turnaround_time <= 10 )
+ return 1;
+ else if ( turnaround_time <= 50 )
+ return 2;
+ else if ( turnaround_time <= 100 )
+ return 3;
+ else if ( turnaround_time <= 500 )
+ return 4;
+ else if ( turnaround_time <= 1000 )
+ return 5;
+ else if ( turnaround_time <= 5000 )
+ return 6;
+ else
+ return 7;
+}
+
+
/*------------------------------------------------------------------*/
/*
* Send a command to change the speed of the dongle
@@ -262,12 +318,18 @@ static void irda_usb_change_speed_xbofs(
/* Set the new speed and xbofs in this fake frame */
irda_usb_build_header(self, frame, 1);
+ if ( self->capability & IUC_STIR_4210 ) {
+ if (frame[0] == 0) return ; // do nothing if no change
+ frame[1] = 0; // other parameters don't change here
+ frame[2] = 0;
+ }
+
/* Submit the 0 length IrDA frame to trigger new speed settings */
usb_fill_bulk_urb(urb, self->usbdev,
usb_sndbulkpipe(self->usbdev, self->bulk_out_ep),
frame, IRDA_USB_SPEED_MTU,
speed_bulk_callback, self);
- urb->transfer_buffer_length = USB_IRDA_HEADER;
+ urb->transfer_buffer_length = self->header_length;
urb->transfer_flags = 0;
/* Irq disabled -> GFP_ATOMIC */
@@ -383,16 +445,35 @@ static int irda_usb_hard_xmit(struct sk_
* allocation will be done lower in skb_push().
* Also, we don't use directly skb_cow(), because it require
* headroom >= 16, which force unnecessary copies - Jean II */
- if (skb_headroom(skb) < USB_IRDA_HEADER) {
+ if (skb_headroom(skb) < self->header_length) {
IRDA_DEBUG(0, "%s(), Insuficient skb headroom.\n", __FUNCTION__);
- if (skb_cow(skb, USB_IRDA_HEADER)) {
+ if (skb_cow(skb, self->header_length)) {
IRDA_WARNING("%s(), failed skb_cow() !!!\n", __FUNCTION__);
goto drop;
}
}
/* Change setting for next frame */
- irda_usb_build_header(self, skb_push(skb, USB_IRDA_HEADER), 0);
+
+ if ( self->capability & IUC_STIR_4210 ) {
+ __u8 turnaround_time;
+ __u8* frame;
+ turnaround_time = get_turnaround_time( skb );
+ frame= skb_push(skb, self->header_length);
+ irda_usb_build_header(self, frame, 0);
+ frame[2] = turnaround_time;
+ if ((skb->len != 0) &&
+ ((skb->len % 128) == 0) &&
+ ((skb->len % 512) != 0)) {
+ /* add extra byte for special SigmaTel feature */
+ frame[1] = 1;
+ skb_put(skb, 1);
+ } else {
+ frame[1] = 0;
+ }
+ } else {
+ irda_usb_build_header(self, skb_push(skb, self->header_length), 0);
+ }
/* FIXME: Make macro out of this one */
((struct irda_skb_cb *)skb->cb)->context = self;
@@ -795,7 +876,7 @@ static void irda_usb_receive(struct urb
}
/* Check for empty frames */
- if (urb->actual_length <= USB_IRDA_HEADER) {
+ if (urb->actual_length <= self->header_length) {
IRDA_WARNING("%s(), empty frame!\n", __FUNCTION__);
goto done;
}
@@ -815,8 +896,12 @@ static void irda_usb_receive(struct urb
* called Rx-copy-break). Jean II */
docopy = (urb->actual_length < IRDA_RX_COPY_THRESHOLD);
- /* Allocate a new skb */
- newskb = dev_alloc_skb(docopy ? urb->actual_length : IRDA_SKB_MAX_MTU);
+ /* Allocate a new skb */
+ if ( self->capability & IUC_STIR_4210 )
+ newskb = dev_alloc_skb(docopy ? urb->actual_length : IRDA_SKB_MAX_MTU + USB_IRDA_SIGMATEL_HEADER);
+ else
+ newskb = dev_alloc_skb(docopy ? urb->actual_length : IRDA_SKB_MAX_MTU);
+
if (!newskb) {
self->stats.rx_dropped++;
/* We could deliver the current skb, but this would stall
@@ -845,7 +930,7 @@ static void irda_usb_receive(struct urb
/* Set proper length on skb & remove USB-IrDA header */
skb_put(dataskb, urb->actual_length);
- skb_pull(dataskb, USB_IRDA_HEADER);
+ skb_pull(dataskb, self->header_length);
/* Ask the networking layer to queue the packet for the IrDA stack */
dataskb->dev = self->netdev;
@@ -937,6 +1022,191 @@ static int irda_usb_is_receiving(struct
return 0; /* For now */
}
+
+#define STIR421X_PATCH_PRODUCT_VERSION_STR "Product Version: "
+#define STIR421X_PATCH_COMPONENT_VERSION_STR "Component Version: "
+#define STIR421X_PATCH_DATA_TAG_STR "STMP"
+#define STIR421X_PATCH_FILE_VERSION_MAX_OFFSET 512 /* version info is before here */
+#define STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET 512 /* patch image starts before here */
+#define STIR421X_PATCH_FILE_END_OF_HEADER_TAG 0x1A /* marks end of patch file header (PC DOS text file EOF character) */
+
+/*
+ * Known firmware patches for STIR421x dongles
+ */
+static char * stir421x_patches[] = {
+ "42101001.sb",
+ "42101002.sb",
+};
+
+static int stir421x_get_patch_version(unsigned char * patch, const unsigned long patch_len)
+{
+ unsigned int version_offset;
+ unsigned long version_major, version_minor, version_build;
+ unsigned char * version_start;
+ int version_found = 0;
+
+ for (version_offset = 0;
+ version_offset < STIR421X_PATCH_FILE_END_OF_HEADER_TAG;
+ version_offset++) {
+ if (!memcmp(patch + version_offset,
+ STIR421X_PATCH_PRODUCT_VERSION_STR,
+ sizeof(STIR421X_PATCH_PRODUCT_VERSION_STR) - 1)) {
+ version_found = 1;
+ version_start = patch +
+ version_offset +
+ sizeof(STIR421X_PATCH_PRODUCT_VERSION_STR) - 1;
+ break;
+ }
+ }
+
+ /* We couldn't find a product version on this patch */
+ if (!version_found)
+ return -EINVAL;
+
+ /* Let's check if the product version is dotted */
+ if (version_start[3] != '.' ||
+ version_start[7] != '.')
+ return -EINVAL;
+
+ version_major = simple_strtoul(version_start, NULL, 10);
+ version_minor = simple_strtoul(version_start + 4, NULL, 10);
+ version_build = simple_strtoul(version_start + 8, NULL, 10);
+
+ IRDA_DEBUG(2, "%s(), Major: %ld Minor: %ld Build: %ld\n",
+ __FUNCTION__,
+ version_major, version_minor, version_build);
+
+ return (((version_major) << 12) +
+ ((version_minor) << 8) +
+ ((version_build / 10) << 4) +
+ (version_build % 10));
+
+}
+
+
+static int stir421x_upload_patch (struct irda_usb_cb *self,
+ unsigned char * patch,
+ const unsigned int patch_len)
+{
+ int retval = 0;
+ int actual_len;
+ unsigned int i = 0, download_amount = 0;
+ unsigned char * patch_chunk;
+
+ IRDA_DEBUG (2, "%s(), Uploading STIR421x Patch\n", __FUNCTION__);
+
+ patch_chunk = kzalloc(STIR421X_MAX_PATCH_DOWNLOAD_SIZE, GFP_KERNEL);
+ if (patch_chunk == NULL)
+ return -ENOMEM;
+
+ /* break up patch into 1023-byte sections */
+ for (i = 0; retval >= 0 && i < patch_len; i += download_amount) {
+ download_amount = patch_len - i;
+ if (download_amount > STIR421X_MAX_PATCH_DOWNLOAD_SIZE)
+ download_amount = STIR421X_MAX_PATCH_DOWNLOAD_SIZE;
+
+ /* download the patch section */
+ memcpy(patch_chunk, patch + i, download_amount);
+
+ retval = usb_bulk_msg (self->usbdev,
+ usb_sndbulkpipe (self->usbdev,
+ self->bulk_out_ep),
+ patch_chunk, download_amount,
+ &actual_len, msecs_to_jiffies (500));
+ IRDA_DEBUG (2, "%s(), Sent %u bytes\n", __FUNCTION__,
+ actual_len);
+ if (retval == 0)
+ mdelay(10);
+ }
+
+ kfree(patch_chunk);
+
+ if (i != patch_len) {
+ IRDA_ERROR ("%s(), Pushed %d bytes (!= patch_len (%d))\n",
+ __FUNCTION__, i, patch_len);
+ retval = -EIO;
+ }
+
+ if (retval < 0)
+ /* todo - mark device as not ready */
+ IRDA_ERROR ("%s(), STIR421x patch upload failed (%d)\n",
+ __FUNCTION__, retval);
+
+ return retval;
+}
+
+
+static int stir421x_patch_device(struct irda_usb_cb *self)
+{
+ unsigned int i, patch_found = 0, data_found = 0, data_offset;
+ int patch_version, ret = 0;
+ const struct firmware *fw_entry;
+
+ for (i = 0; i < ARRAY_SIZE(stir421x_patches); i++) {
+ if(request_firmware(&fw_entry, stir421x_patches[i], &self->usbdev->dev) != 0) {
+ IRDA_ERROR( "%s(), Patch %s is not available\n", __FUNCTION__, stir421x_patches[i]);
+ continue;
+ }
+
+ /* We found a patch from userspace */
+ patch_version = stir421x_get_patch_version (fw_entry->data, fw_entry->size);
+
+ if (patch_version < 0) {
+ /* Couldn't fetch a version, let's move on to the next file */
+ IRDA_ERROR("%s(), version parsing failed\n", __FUNCTION__);
+ ret = patch_version;
+ release_firmware(fw_entry);
+ continue;
+ }
+
+ if (patch_version != self->usbdev->descriptor.bcdDevice) {
+ /* Patch version and device don't match */
+ IRDA_ERROR ("%s(), wrong patch version (%d <-> %d)\n",
+ __FUNCTION__,
+ patch_version, self->usbdev->descriptor.bcdDevice);
+ ret = -EINVAL;
+ release_firmware(fw_entry);
+ continue;
+ }
+
+ /* If we're here, we've found a correct patch */
+ patch_found = 1;
+ break;
+
+ }
+
+ /* We couldn't find a valid firmware, let's leave */
+ if (!patch_found)
+ return ret;
+
+ /* The actual image starts after the "STMP" keyword */
+ for (data_offset = 0; data_offset < STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET; data_offset++) {
+ if (!memcmp(fw_entry->data + data_offset,
+ STIR421X_PATCH_DATA_TAG_STR,
+ sizeof(STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET))) {
+ IRDA_DEBUG(2, "%s(), found patch data for STIR421x at offset %d\n",
+ __FUNCTION__, data_offset);
+ data_found = 1;
+ break;
+ }
+ }
+
+ /* We couldn't find "STMP" from the header */
+ if (!data_found)
+ return -EINVAL;
+
+ /* Let's upload the patch to the target */
+ ret = stir421x_upload_patch(self,
+ &fw_entry->data[data_offset + sizeof(STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET)],
+ fw_entry->size - (data_offset + sizeof(STIR421X_PATCH_FILE_IMAGE_MAX_OFFSET)));
+
+ release_firmware(fw_entry);
+
+ return ret;
+
+}
+
+
/********************** IRDA DEVICE CALLBACKS **********************/
/*
* Main calls from the IrDA/Network subsystem.
@@ -972,6 +1242,11 @@ static int irda_usb_net_open(struct net_
return -1;
}
+ if(self->needspatch) {
+ IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ;
+ return -EIO ;
+ }
+
/* Initialise default speed and xbofs value
* (IrLAP will change that soon) */
self->speed = -1;
@@ -1050,7 +1325,7 @@ static int irda_usb_net_close(struct net
del_timer(&self->rx_defer_timer);
/* Deallocate all the Rx path buffers (URBs and skb) */
- for (i = 0; i < IU_MAX_RX_URBS; i++) {
+ for (i = 0; i < self->max_rx_urb; i++) {
struct urb *urb = self->rx_urb[i];
struct sk_buff *skb = (struct sk_buff *) urb->context;
/* Cancel the receive command */
@@ -1426,8 +1701,22 @@ static int irda_usb_probe(struct usb_int
spin_lock_init(&self->lock);
init_timer(&self->rx_defer_timer);
+ self->capability = id->driver_info;
+ self->needspatch = ((self->capability & IUC_STIR_4210) != 0) ;
+
/* Create all of the needed urbs */
- for (i = 0; i < IU_MAX_RX_URBS; i++) {
+ if (self->capability & IUC_STIR_4210) {
+ self->max_rx_urb = IU_SIGMATEL_MAX_RX_URBS;
+ self->header_length = USB_IRDA_SIGMATEL_HEADER;
+ } else {
+ self->max_rx_urb = IU_MAX_RX_URBS;
+ self->header_length = USB_IRDA_HEADER;
+ }
+
+ self->rx_urb = kzalloc(self->max_rx_urb * sizeof(struct urb *),
+ GFP_KERNEL);
+
+ for (i = 0; i < self->max_rx_urb; i++) {
self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
if (!self->rx_urb[i]) {
goto err_out_1;
@@ -1478,18 +1767,29 @@ static int irda_usb_probe(struct usb_int
ret = -EIO;
goto err_out_3;
}
+
+ self->usbdev = dev;
/* Find IrDA class descriptor */
irda_desc = irda_usb_find_class_desc(intf);
ret = -ENODEV;
if (irda_desc == NULL)
goto err_out_3;
+
+ if (self->needspatch) {
+ ret = usb_control_msg (self->usbdev, usb_sndctrlpipe (self->usbdev, 0),
+ 0x02, 0x40, 0, 0, 0, 0, msecs_to_jiffies(500));
+ if (ret < 0) {
+ IRDA_DEBUG (0, "usb_control_msg failed %d\n", ret);
+ goto err_out_3;
+ } else {
+ mdelay(10);
+ }
+ }
self->irda_desc = irda_desc;
self->present = 1;
self->netopen = 0;
- self->capability = id->driver_info;
- self->usbdev = dev;
self->usbintf = intf;
/* Allocate the buffer for speed changes */
@@ -1508,6 +1808,28 @@ static int irda_usb_probe(struct usb_int
IRDA_MESSAGE("IrDA: Registered device %s\n", net->name);
usb_set_intfdata(intf, self);
+
+ if (self->needspatch) {
+ /* Now we fetch and upload the firmware patch */
+ ret = stir421x_patch_device(self);
+ self->needspatch = (ret < 0);
+ if (ret < 0) {
+ printk("patch_device failed\n");
+ goto err_out_4;
+ }
+
+ /* replace IrDA class descriptor with what patched device is now reporting */
+ irda_desc = irda_usb_find_class_desc (self->usbintf);
+ if (irda_desc == NULL) {
+ ret = -ENODEV;
+ goto err_out_4;
+ }
+ if (self->irda_desc)
+ kfree (self->irda_desc);
+ self->irda_desc = irda_desc;
+ irda_usb_init_qos(self);
+ }
+
return 0;
err_out_4:
@@ -1518,7 +1840,7 @@ err_out_3:
err_out_2:
usb_free_urb(self->tx_urb);
err_out_1:
- for (i = 0; i < IU_MAX_RX_URBS; i++) {
+ for (i = 0; i < self->max_rx_urb; i++) {
if (self->rx_urb[i])
usb_free_urb(self->rx_urb[i]);
}
@@ -1571,7 +1893,7 @@ static void irda_usb_disconnect(struct u
/*netif_device_detach(self->netdev);*/
netif_stop_queue(self->netdev);
/* Stop all the receive URBs. Must be synchronous. */
- for (i = 0; i < IU_MAX_RX_URBS; i++)
+ for (i = 0; i < self->max_rx_urb; i++)
usb_kill_urb(self->rx_urb[i]);
/* Cancel Tx and speed URB.
* Make sure it's synchronous to avoid races. */
@@ -1586,8 +1908,9 @@ static void irda_usb_disconnect(struct u
self->usbintf = NULL;
/* Clean up our urbs */
- for (i = 0; i < IU_MAX_RX_URBS; i++)
+ for (i = 0; i < self->max_rx_urb; i++)
usb_free_urb(self->rx_urb[i]);
+ kfree(self->rx_urb);
/* Clean up Tx and speed URB */
usb_free_urb(self->tx_urb);
usb_free_urb(self->speed_urb);
@@ -1648,6 +1971,6 @@ module_exit(usb_irda_cleanup);
*/
module_param(qos_mtt_bits, int, 0);
MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time");
-MODULE_AUTHOR("Roman Weissgaerber <weissg-TVDPYGuBT+ReoWH0uzbU5w@public.gmane.org>, Dag Brattli <dag-1K3ejsF8QZHR7s880joybQ@public.gmane.org> and Jean Tourrilhes <jt-sDzT885Ts8HQT0dZR+AlfA@public.gmane.org>");
-MODULE_DESCRIPTION("IrDA-USB Dongle Driver");
+MODULE_AUTHOR("Roman Weissgaerber <weissg-TVDPYGuBT+ReoWH0uzbU5w@public.gmane.org>, Dag Brattli <dag-1K3ejsF8QZHR7s880joybQ@public.gmane.org>, Jean Tourrilhes <jt-sDzT885Ts8HQT0dZR+AlfA@public.gmane.org> and Nick Fedchik <nick-UvdXiu2sajOKBXSJ/Qx0JQ@public.gmane.org>");
+MODULE_DESCRIPTION("IrDA-USB Dongle Driver");
MODULE_LICENSE("GPL");
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply related
* Re: [e1000 debug] KERNEL: assertion (!sk_forward_alloc) failed...
From: Jesse Brandeburg @ 2006-04-06 0:42 UTC (permalink / raw)
To: Jesse Brandeburg
Cc: Boris B. Zhmurov, Phil Oester, Mark Nipper, Herbert Xu,
David S. Miller, jrlundgren, cat, djani22, yoseph.basri, mykleb,
olel, michal, chris, netdev, jesse.brandeburg, E1000-devel,
Andi Kleen, Jeff Garzik
In-Reply-To: <Pine.WNT.4.63.0604051500530.2496@jbrandeb-desk.amr.corp.intel.com>
On Wed, 5 Apr 2006, Jesse Brandeburg wrote:
> I'll also send a patch today to back-rev the xmit routine to the 5.6.10.1
> state.
I'm in a bit of a hurry, but I wanted to send these debug patches out.
Forgive me if my mailer decides to munge them.
I'd suggest trying the first one and then both together.
The first fixes up the tso function only to be like 5.6.10.1-k2.
The second builds on the first, and incorporates more of the tx changes.
I built and tested the driver with patches on 2.6.16, with pci-x adapters.
I removed some workarounds for PCIe adapters, but I dont think anyone
having this problem has a PCIe adapter anyway. I saw no TX hangs and ran
some bi-directional tests, so i think the driver should work okay. Just
warning you I did minimal testing.
*********************
e1000: transmit the old fashioned way
It seems back in the day of 2.6.11, there were no sk_forward_alloc
asserions. Forward port that transmit code to see if it fixes the issues
in today's kernel. Unfortunately it doesn't have all the bug fixes that
the current code has, but if we get transmit timeouts we can add in
workarounds appropriately.
this changes only the e1000_tso function
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
drivers/net/e1000/e1000_main.c | 37 ++++++-------------------------------
1 files changed, 6 insertions(+), 31 deletions(-)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
old mode 100644
new mode 100755
index e3d3778..2b8fb87
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2519,57 +2519,34 @@ e1000_tso(struct e1000_adapter *adapter,
{
#ifdef NETIF_F_TSO
struct e1000_context_desc *context_desc;
- struct e1000_buffer *buffer_info;
unsigned int i;
uint32_t cmd_length = 0;
uint16_t ipcse = 0, tucse, mss;
uint8_t ipcss, ipcso, tucss, tucso, hdr_len;
- int err;
if (skb_shinfo(skb)->tso_size) {
- if (skb_header_cloned(skb)) {
- err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
- if (err)
- return err;
- }
-
hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
mss = skb_shinfo(skb)->tso_size;
- if (skb->protocol == ntohs(ETH_P_IP)) {
- skb->nh.iph->tot_len = 0;
- skb->nh.iph->check = 0;
- skb->h.th->check =
- ~csum_tcpudp_magic(skb->nh.iph->saddr,
+ skb->nh.iph->tot_len = 0;
+ skb->nh.iph->check = 0;
+ skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr,
skb->nh.iph->daddr,
0,
IPPROTO_TCP,
0);
- cmd_length = E1000_TXD_CMD_IP;
- ipcse = skb->h.raw - skb->data - 1;
-#ifdef NETIF_F_TSO_IPV6
- } else if (skb->protocol == ntohs(ETH_P_IPV6)) {
- skb->nh.ipv6h->payload_len = 0;
- skb->h.th->check =
- ~csum_ipv6_magic(&skb->nh.ipv6h->saddr,
- &skb->nh.ipv6h->daddr,
- 0,
- IPPROTO_TCP,
- 0);
- ipcse = 0;
-#endif
- }
ipcss = skb->nh.raw - skb->data;
ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data;
+ ipcse = skb->h.raw - skb->data - 1;
tucss = skb->h.raw - skb->data;
tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
tucse = 0;
cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE |
- E1000_TXD_CMD_TCP | (skb->len - (hdr_len)));
+ E1000_TXD_CMD_IP | E1000_TXD_CMD_TCP |
+ (skb->len - (hdr_len)));
i = tx_ring->next_to_use;
context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
- buffer_info = &tx_ring->buffer_info[i];
context_desc->lower_setup.ip_fields.ipcss = ipcss;
context_desc->lower_setup.ip_fields.ipcso = ipcso;
@@ -2581,8 +2558,6 @@ e1000_tso(struct e1000_adapter *adapter,
context_desc->tcp_seg_setup.fields.hdr_len = hdr_len;
context_desc->cmd_and_length = cpu_to_le32(cmd_length);
- buffer_info->time_stamp = jiffies;
-
if (++i == tx_ring->count) i = 0;
tx_ring->next_to_use = i;
*************************************
e1000: implement old xmit_frame
It seems back in the day of 2.6.11, there were no sk_forward_alloc
asserions. Forward port that transmit code to see if it fixes the issues
in today's kernel. Unfortunately it doesn't have all the bug fixes that
the current code has, but if we get transmit timeouts we can add in
workarounds appropriately.
this changes the e1000_xmit_frame function, and some ancilliaries
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
drivers/net/e1000/e1000_main.c | 90 ++--------------------------------------
1 files changed, 4 insertions(+), 86 deletions(-)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 2b8fb87..18790b6 100755
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2725,10 +2725,7 @@ e1000_tx_queue(struct e1000_adapter *ada
if (likely(tx_flags & E1000_TX_FLAGS_TSO)) {
txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D |
E1000_TXD_CMD_TSE;
- txd_upper |= E1000_TXD_POPTS_TXSM << 8;
-
- if (likely(tx_flags & E1000_TX_FLAGS_IPV4))
- txd_upper |= E1000_TXD_POPTS_IXSM << 8;
+ txd_upper |= (E1000_TXD_POPTS_IXSM | E1000_TXD_POPTS_TXSM) << 8;
}
if (likely(tx_flags & E1000_TX_FLAGS_CSUM)) {
@@ -2803,41 +2800,6 @@ no_fifo_stall_required:
return 0;
}
-#define MINIMUM_DHCP_PACKET_SIZE 282
-static inline int
-e1000_transfer_dhcp_info(struct e1000_adapter *adapter, struct sk_buff *skb)
-{
- struct e1000_hw *hw = &adapter->hw;
- uint16_t length, offset;
- if (vlan_tx_tag_present(skb)) {
- if (!((vlan_tx_tag_get(skb) == adapter->hw.mng_cookie.vlan_id) &&
- ( adapter->hw.mng_cookie.status &
- E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) )
- return 0;
- }
- if ((skb->len > MINIMUM_DHCP_PACKET_SIZE) && (!skb->protocol)) {
- struct ethhdr *eth = (struct ethhdr *) skb->data;
- if ((htons(ETH_P_IP) == eth->h_proto)) {
- const struct iphdr *ip =
- (struct iphdr *)((uint8_t *)skb->data+14);
- if (IPPROTO_UDP == ip->protocol) {
- struct udphdr *udp =
- (struct udphdr *)((uint8_t *)ip +
- (ip->ihl << 2));
- if (ntohs(udp->dest) == 67) {
- offset = (uint8_t *)udp + 8 - skb->data;
- length = skb->len - offset;
-
- return e1000_mng_write_dhcp_info(hw,
- (uint8_t *)udp + 8,
- length);
- }
- }
- }
- }
- return 0;
-}
-
#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 )
static int
e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
@@ -2852,7 +2814,6 @@ e1000_xmit_frame(struct sk_buff *skb, st
unsigned int nr_frags = 0;
unsigned int mss = 0;
int count = 0;
- int tso;
unsigned int f;
len -= skb->data_len;
@@ -2876,44 +2837,18 @@ e1000_xmit_frame(struct sk_buff *skb, st
* overrun the FIFO, adjust the max buffer len if mss
* drops. */
if (mss) {
- uint8_t hdr_len;
max_per_txd = min(mss << 2, max_per_txd);
max_txd_pwr = fls(max_per_txd) - 1;
-
- /* TSO Workaround for 82571/2 Controllers -- if skb->data
- * points to just header, pull a few bytes of payload from
- * frags into skb->data */
- hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
- if (skb->data_len && (hdr_len == (skb->len - skb->data_len)) &&
- (adapter->hw.mac_type == e1000_82571 ||
- adapter->hw.mac_type == e1000_82572)) {
- unsigned int pull_size;
- pull_size = min((unsigned int)4, skb->data_len);
- if (!__pskb_pull_tail(skb, pull_size)) {
- printk(KERN_ERR "__pskb_pull_tail failed.\n");
- dev_kfree_skb_any(skb);
- return NETDEV_TX_OK;
- }
- len = skb->len - skb->data_len;
- }
}
/* reserve a descriptor for the offload context */
if ((mss) || (skb->ip_summed == CHECKSUM_HW))
count++;
- count++;
+ count++; /* for sentinel desc */
#else
if (skb->ip_summed == CHECKSUM_HW)
count++;
#endif
-
-#ifdef NETIF_F_TSO
- /* Controller Erratum workaround */
- if (!skb->data_len && tx_ring->last_tx_tso &&
- !skb_shinfo(skb)->tso_size)
- count++;
-#endif
-
count += TXD_USE_COUNT(len, max_txd_pwr);
if (adapter->pcix_82544)
@@ -2933,9 +2868,6 @@ e1000_xmit_frame(struct sk_buff *skb, st
if (adapter->pcix_82544)
count += nr_frags;
- if (adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) )
- e1000_transfer_dhcp_info(adapter, skb);
-
local_irq_save(flags);
if (!spin_trylock(&tx_ring->tx_lock)) {
/* Collision - tell upper layer to requeue */
@@ -2967,25 +2899,11 @@ e1000_xmit_frame(struct sk_buff *skb, st
first = tx_ring->next_to_use;
- tso = e1000_tso(adapter, tx_ring, skb);
- if (tso < 0) {
- dev_kfree_skb_any(skb);
- spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
- return NETDEV_TX_OK;
- }
-
- if (likely(tso)) {
- tx_ring->last_tx_tso = 1;
+ if(likely(e1000_tso(adapter, tx_ring, skb)))
tx_flags |= E1000_TX_FLAGS_TSO;
- } else if (likely(e1000_tx_csum(adapter, tx_ring, skb)))
+ else if(likely(e1000_tx_csum(adapter, tx_ring, skb)))
tx_flags |= E1000_TX_FLAGS_CSUM;
- /* Old method was to assume IPv4 packet by default if TSO was enabled.
- * 82571 hardware supports TSO capabilities for IPv6 as well...
- * no longer assume, we must. */
- if (likely(skb->protocol == ntohs(ETH_P_IP)))
- tx_flags |= E1000_TX_FLAGS_IPV4;
-
e1000_tx_queue(adapter, tx_ring, tx_flags,
e1000_tx_map(adapter, tx_ring, skb, first,
max_per_txd, nr_frags, mss));
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply related
* Re: [2.6 patch] net/core/net-sysfs.c: fix an off-by-21-or-49 error
From: David S. Miller @ 2006-04-06 5:19 UTC (permalink / raw)
To: bunk; +Cc: netdev, linux-kernel
In-Reply-To: <20060404190742.GA6529@stusta.de>
From: Adrian Bunk <bunk@stusta.de>
Date: Tue, 4 Apr 2006 21:07:42 +0200
> This patch fixes an off-by-21-or-49 error ;-) spotted by the Coverity
> checker.
>
> Signed-off-by: Adrian Bunk <bunk@stusta.de>
Applied, thanks Adrian.
^ permalink raw reply
* Re: [2.6 patch] drivers/net/tg3.c: fix a memory leak
From: David S. Miller @ 2006-04-06 5:21 UTC (permalink / raw)
To: bunk; +Cc: netdev, linux-kernel
In-Reply-To: <20060404190935.GB6529@stusta.de>
From: Adrian Bunk <bunk@stusta.de>
Date: Tue, 4 Apr 2006 21:09:35 +0200
> This patch fixes a memory leak (buf wasn't freed) spotted by the
> Coverity checker.
>
> Signed-off-by: Adrian Bunk <bunk@stusta.de>
Applied, thanks Adrian.
^ permalink raw reply
* Re: [PATCH] IrDA: smcinit merged into smsc-ircc driver
From: David S. Miller @ 2006-04-06 5:34 UTC (permalink / raw)
To: samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
jt-sDzT885Ts8HQT0dZR+AlfA
In-Reply-To: <20060405232125.GA377@irie>
From: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Date: Thu, 6 Apr 2006 02:21:25 +0300
> This patch integrates the smcinit code into the smsc-ircc driver.
> Some laptops have their smsc-ircc chip not properly configured by the BIOS and needs some preconfiguration. Currently, this can be done from userspace with smcinit, a utility that comes with the irda-utils package. It messes with ioports and PCI settings, from userspace.
> Now with this patch, if we happen to be on one of the known to be faulty laptops, we preconfigure the chip from the driver.
>
> Patch from Linus Walleij <triad-HEm3bjczhZmzQB+pC5nmwQ@public.gmane.org>
> Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Applied.
This patch added a lot of trailing whitespace which I had to
fix up by hand, I did it for you this time but next time I
will not. You can check you patches with this simple command:
git apply --check --whitespace=error-all diff
Thanks.
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply
* Re: [PATCH] IrDA: Support for Sigmatel STIR421x chip
From: David S. Miller @ 2006-04-06 5:41 UTC (permalink / raw)
To: samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
jt-sDzT885Ts8HQT0dZR+AlfA
In-Reply-To: <20060405232137.GB377@irie>
From: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Date: Thu, 6 Apr 2006 02:21:37 +0300
> This patch enables support for the Sigmatel's STIR421x IrDA chip.
> Once patched with Sigmatel's firmware, this chip "almost" follows the USB-IrDA spec. Thus this patch is against irda-usb.[ch].
>
> The code has been tested by Nick Fedchik on an STIR4210 chipset based dongle.
>
> Signed-off-by: Samuel Ortiz <samuel.ortiz-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Applied, but I had to fix up an enormous amount of trailing
white space on this patch too.
Also, functions such as stir421x_upload_patch() were not properly
indented using tabs, it's using a 4 space indentation.
Lots of other coding style errors such as:
if(cond) {
instead of:
if (cond) {
You may wish to review Documentation/CodingStyle before submitting
future IRDA patches.
Thanks a lot.
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply
* tcf_generic_walker(): what's going on?
From: Denis Vlasenko @ 2006-04-06 6:11 UTC (permalink / raw)
To: linux-kernel, netdev, kuznet, David S. Miller
While hunting down oversized inlines
I stumbled on tcf_generic_walker().
It is defined in two separate files:
once as an inline in include/net/pkt_act.h
(really big one, ~750 bytes of code)
and once as a static function in net/sched/act_police.c
These two instances are not identical.
Second one has one extra parameter (int type)
and it uses it like this:
for (i = 0; i < MY_TAB_SIZE; i++) {
p = tcf_police_ht[tcf_police_hash(i)];
for (; p; p = p->next) {
index++;
if (index < s_i)
continue;
a->priv = p;
a->order = index;
r = (struct rtattr*) skb->tail;
RTA_PUT(skb, a->order, 0, NULL);
+ if (type == RTM_DELACTION)
+ err = tcf_action_dump_1(skb, a, 0, 1);
+ else
+ err = tcf_action_dump_1(skb, a, 0, 0);
Having two functions with same name is rather confusing.
Worse, they are both are called via five different
tc_action_ops structs:
static struct tc_action_ops act_ipt_ops = {
...
.walk = tcf_generic_walker
and I fail to understand how it is supposed to work,
considering the fact that these two tcf_generic_walker's
have different prototypes.
1) What should I do with tcf_generic_walker?
2) Should I deinline huge inlines in include/net/pkt_act.h?
If yes, to which .c file should I move them?
--
vda
^ permalink raw reply
* Re: tcf_generic_walker(): what's going on?
From: Patrick McHardy @ 2006-04-06 8:50 UTC (permalink / raw)
To: Denis Vlasenko; +Cc: linux-kernel, netdev, kuznet, David S. Miller
In-Reply-To: <200604060911.01140.vda@ilport.com.ua>
Denis Vlasenko wrote:
> While hunting down oversized inlines
> I stumbled on tcf_generic_walker().
>
> It is defined in two separate files:
> once as an inline in include/net/pkt_act.h
> (really big one, ~750 bytes of code)
> and once as a static function in net/sched/act_police.c
>
> These two instances are not identical.
> Second one has one extra parameter (int type)
> and it uses it like this:
>
> for (i = 0; i < MY_TAB_SIZE; i++) {
> p = tcf_police_ht[tcf_police_hash(i)];
>
> for (; p; p = p->next) {
> index++;
> if (index < s_i)
> continue;
> a->priv = p;
> a->order = index;
> r = (struct rtattr*) skb->tail;
> RTA_PUT(skb, a->order, 0, NULL);
> + if (type == RTM_DELACTION)
> + err = tcf_action_dump_1(skb, a, 0, 1);
> + else
> + err = tcf_action_dump_1(skb, a, 0, 0);
>
> Having two functions with same name is rather confusing.
> Worse, they are both are called via five different
> tc_action_ops structs:
>
> static struct tc_action_ops act_ipt_ops = {
> ...
> .walk = tcf_generic_walker
>
> and I fail to understand how it is supposed to work,
> considering the fact that these two tcf_generic_walker's
> have different prototypes.
This code is a lazy hack to achieve "genericness" by using
a "generic" inline functions and #defines to create
specialized instances.
> 1) What should I do with tcf_generic_walker?
> 2) Should I deinline huge inlines in include/net/pkt_act.h?
> If yes, to which .c file should I move them?
Unforunately you can't do this without further restructuring,
look at how the tc actions use that file:
/* use generic hash table */
#define MY_TAB_SIZE 8
#define MY_TAB_MASK (MY_TAB_SIZE - 1)
static u32 idx_gen;
static struct tcf_mirred *tcf_mirred_ht[MY_TAB_SIZE];
static DEFINE_RWLOCK(mirred_lock);
/* ovewrride the defaults */
#define tcf_st tcf_mirred
#define tc_st tc_mirred
#define tcf_t_lock mirred_lock
#define tcf_ht tcf_mirred_ht
#define CONFIG_NET_ACT_INIT 1
#include <net/pkt_act.h>
What needs to be done is to put a pointer to the hash, its size
and its lock in struct tc_action_ops and move the "generic"
functions to a seperate .c file and make them work on a struct
tcf_act_common.
^ permalink raw reply
* Re: Broadcast ARP packets on link local addresses (Version2).
From: Janos Farkas @ 2006-04-06 10:24 UTC (permalink / raw)
To: David Daney; +Cc: netdev, linux-kernel, pgf, freek
In-Reply-To: <17460.13568.175877.44476@dl2.hq2.avtrex.com>
On 2006-04-05 at 14:22:08, David Daney wrote:
> The changes in this version are that it tests the source IP address
> instead of the destination. The test now matches the test described
> in the RFC. Also a small cleanup as suggested by Herbert Xu.
>
> Some comments on the first version of the patch suggested that I do
> 'X' instead. Where 'X' was behavior different than that REQUIRED by
> the RFC (the RFC's always seem to capitalize the word 'required').
>
> The reason that I implemented the behavior required by the RFC is so
> that a device running the kernel can pass compliance tests that
> mandate RFC compliance.
Sorry for chiming in this late in the discussion, but... Shouldn't it
be more correct to not depend on the ip address of the used network,
but to use the "scope" parameter of the given address?
Example
# ip ad sh
...
N: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether ...
inet 169.254.3.3/16 brd 169.254.255.255 scope link eth0
inet ... scope global eth0
The only drawback is that the scope is usually set manually, and maybe
some tools don't handle it right now, since it's available since just a
few years :) Scopes, when set right, also may do some appropriate
magic, as I understand, like selecting the correct the source address,
and not allowing link-local addresses to reach out to other scopes.
(Which is also mentioned in the RFC, but this strictness prevent
transparent NAT of clients to the internet.)
I did not look however, whether the scope is available on the place the
patch is modifying currently. Does the idea look sane to anyone else?
> + /* If link local address (169.254.0.0/16) we must broadcast
> + * the ARP packet. See RFC 3927 section 2.5 for details. */
> + if ((src_ip & htonl(0xFFFF0000UL)) == htonl(0xA9FE0000UL))
> + dest_hw = NULL;
Janos
^ permalink raw reply
* [BUG NET/PCMCIA 2.6.17-rc1] Oops with cardctl eject
From: Erik Mouw @ 2006-04-06 10:59 UTC (permalink / raw)
To: linux-kernel; +Cc: netdev
Hi,
I got this oops while ejecting a Lucent Orinico Silver card:
root@arthur:~ # cardctl ident 0
product info: "Lucent Technologies", "WaveLAN/IEEE", "Version 01.01", ""
manfid: 0x0156, 0x0002
function: 6 (network)
root@arthur:~ # ifdown eth2
root@arthur:~ # cardctl eject 0
pccard: card ejected from slot 0
------------[ cut here ]------------
kernel BUG at net/core/dev.c:3140!
invalid opcode: 0000 [#1]
Modules linked in: lp orinoco_cs orinoco hermes af_packet arc4 ieee80211_crypt_wep bcm43xx ieee80211softmac ieee80211 ieee80211_crypt binfmt_misc autofs4 ipv6 ide_cd cdrom 8250_pnp floppy eth1394 8139too mii ohci1394 ieee1394 snd_via82xx_modem snd_via82xx gameport snd_ac97_codec snd_ac97_bus snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc snd_mpu401_uart snd_rawmidi snd_seq_device snd soundcore via686a i2c_isa i2c_core usbhid uhci_hcd usbcore parport_pc parport tun cpufreq_conservative cpufreq_ondemand powernow_k7 freq_table 8250 serial_core psmouse pcspkr r128 drm via_agp agpgart
CPU: 0
EIP: 0060:[<c020d1cb>] Not tainted VLI
EFLAGS: 00210293 (2.6.17-rc1-dirty #2)
EIP is at free_netdev+0x22/0x43
eax: 00000002 ebx: d23ab600 ecx: 00000000 edx: d3dc1000
esi: d23ab684 edi: e0ba08c0 ebp: dfe5e174 esp: d7b29e60
ds: 007b es: 007b ss: 0068
Process cardctl (pid: 12725, threadinfo=d7b29000 task=dfe08110)
Stack: <0>c01f2246 d3dc1000 d23ab6ec d23ab684 e0ba08d8 c01ddba5 d23ab684 d23ab684
dfebd448 dfe5e028 c01ddbe8 d23ab684 d23ab684 c01dd3fc d23ab684 d23ab684
c01dc67a d23ab684 d23ab684 d23ab600 c01dc6b1 d23ab684 00200286 c01f21d9
Call Trace:
<c01f2246> pcmcia_device_remove+0x52/0xbd <c01ddba5> __device_release_driver+0x54/0x7b
<c01ddbe8> device_release_driver+0x1c/0x2b <c01dd3fc> bus_remove_device+0x52/0x65
<c01dc67a> device_del+0x39/0x65 <c01dc6b1> device_unregister+0xb/0x16
<c01f21d9> pcmcia_card_remove+0x64/0x7f <c01f2f6f> ds_event+0x4f/0x8c
<c01ee6f0> send_event+0x42/0x6e <c01ee729> socket_remove_drivers+0xd/0x11
<c01ee7e6> socket_shutdown+0xc/0xc8 <c01ef02d> pcmcia_eject_card+0x41/0x52
<c01f4d7b> ds_ioctl+0x3f5/0x5c6 <c0152ce1> do_ioctl+0x49/0x4f
<c0152f0e> vfs_ioctl+0x170/0x17d <c0152f46> sys_ioctl+0x2b/0x45
<c0102a07> syscall_call+0x7/0xb
Code: df 5e 5b 5e 89 f8 5f 5d c3 8b 54 24 04 8b 82 70 01 00 00 85 c0 75 0f 0f b7 42 64 29 c2 89 54 24 04 e9 a6 57 f3 ff 83 f8 04 74 08 <0f> 0b 44 0c 3b f1 27 c0 c7 82 70 01 00 00 05 00 00 00 8d 82 c4
BUG: cardctl/12725, lock held at task exit time!
[dfe5e140] {pcmcia_register_socket}
.. held by: cardctl:12725 [dfe08110, 115]
... acquired at: pcmcia_eject_card+0x11/0x52
Kernel version: Linux version 2.6.17-rc1-dirty (root@arthur) (gcc
version 3.3.5 (Debian 1:3.3.5-13)) #2 Mon Apr 3 16:18:21 CEST 2006
This used to work with 2.6.16. Cardctl is from the Debian pcmcia-cs
3.2.5-10 package. CPU is a Mobile Athlon 1.2 GHz on a Sony Vaio
PCG-FX505 laptop.
Output from lspci:
0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133] (rev 03)
0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133 AGP]
0000:00:07.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 40)
0000:00:07.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
0000:00:07.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 1a)
0000:00:07.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 1a)
0000:00:07.4 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 40)
0000:00:07.5 Multimedia audio controller: VIA Technologies, Inc. VT82C686 AC97 Audio Controller (rev 50)
0000:00:07.6 Communication controller: VIA Technologies, Inc. AC'97 Modem Controller (rev 30)
0000:00:0a.0 CardBus bridge: Texas Instruments PCI1420
0000:00:0a.1 CardBus bridge: Texas Instruments PCI1420
0000:00:0e.0 FireWire (IEEE 1394): Texas Instruments TSB12LV26 IEEE-1394 Controller (Link)
0000:00:10.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
0000:01:00.0 VGA compatible controller: ATI Technologies Inc Rage Mobility P/M AGP 2x (rev 64)
0000:02:00.0 Network controller: Broadcom Corporation BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller (rev 02)
At time of Oops, the Linksys/Broadcom wireless card wasn't in the
system. I can recreate the Oops also when the Linksys card hasn't been
inserted into the system (and the bcm43xx modules haven't been loaded).
Don't know if it's a locking error or a network error, so I'm sending
this message to lkml and netdev. If you need more information, feel
free to ask.
Erik
--
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands
^ permalink raw reply
* Re: [e1000 debug] KERNEL: assertion (!sk_forward_alloc) failed...
From: Boris B. Zhmurov @ 2006-04-06 11:49 UTC (permalink / raw)
To: Jesse Brandeburg
Cc: Phil Oester, Mark Nipper, Herbert Xu, David S. Miller, jrlundgren,
cat, djani22, yoseph.basri, mykleb, olel, michal, chris, netdev,
jesse.brandeburg, E1000-devel, Andi Kleen, Jeff Garzik
In-Reply-To: <Pine.LNX.4.64.0604051734230.9255@lindenhurst-2.jf.intel.com>
Hello, Jesse Brandeburg.
On 06.04.2006 04:42 you said the following:
> I built and tested the driver with patches on 2.6.16, with pci-x adapters.
> I removed some workarounds for PCIe adapters, but I dont think anyone
> having this problem has a PCIe adapter anyway. I saw no TX hangs and ran
> some bi-directional tests, so i think the driver should work okay. Just
> warning you I did minimal testing.
>
> *********************
> e1000: transmit the old fashioned way
>
> It seems back in the day of 2.6.11, there were no sk_forward_alloc
> asserions. Forward port that transmit code to see if it fixes the issues
> in today's kernel. Unfortunately it doesn't have all the bug fixes that
> the current code has, but if we get transmit timeouts we can add in
> workarounds appropriately.
>
> this changes only the e1000_tso function
With this one still having:
TCP: Treason uncloaked! Peer 80.72.16.78:11460/80 shrinks window
2223569515:2223569516. Repaired.
KERNEL: assertion (!sk->sk_forward_alloc) failed at net/core/stream.c (283)
KERNEL: assertion (!sk->sk_forward_alloc) failed at net/ipv4/af_inet.c (150)
> e1000: implement old xmit_frame
>
> It seems back in the day of 2.6.11, there were no sk_forward_alloc
> asserions. Forward port that transmit code to see if it fixes the issues
> in today's kernel. Unfortunately it doesn't have all the bug fixes that
> the current code has, but if we get transmit timeouts we can add in
> workarounds appropriately.
>
> this changes the e1000_xmit_frame function, and some ancilliaries
>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Can't apply this one:
[zhmurov@builds linux-2.6.16]$ patch -p1 <
../../../SOURCES/linux-2.6.16-e1000-implement_old_xmit_frame.patch
patching file drivers/net/e1000/e1000_main.c
Hunk #1 succeeded at 2620 (offset -105 lines).
Hunk #2 FAILED at 2695.
Hunk #4 FAILED at 2837.
Hunk #5 FAILED at 2868.
Hunk #6 FAILED at 2899.
4 out of 6 hunks FAILED -- saving rejects to file
drivers/net/e1000/e1000_main.c.rej
--
Boris B. Zhmurov
mailto: bb@kernelpanic.ru
"wget http://kernelpanic.ru/bb_public_key.pgp -O - | gpg --import"
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply
* Re: Broadcast ARP packets on link local addresses (Version2).
From: David Daney @ 2006-04-06 16:17 UTC (permalink / raw)
To: Janos Farkas; +Cc: netdev, linux-kernel, pgf, freek
In-Reply-To: <priv$efbe06144502$2d51735f79@200604.gmail.com>
Janos Farkas wrote:
> On 2006-04-05 at 14:22:08, David Daney wrote:
>
>>The changes in this version are that it tests the source IP address
>>instead of the destination. The test now matches the test described
>>in the RFC. Also a small cleanup as suggested by Herbert Xu.
>>
>>Some comments on the first version of the patch suggested that I do
>>'X' instead. Where 'X' was behavior different than that REQUIRED by
>>the RFC (the RFC's always seem to capitalize the word 'required').
>>
>>The reason that I implemented the behavior required by the RFC is so
>>that a device running the kernel can pass compliance tests that
>>mandate RFC compliance.
>
>
> Sorry for chiming in this late in the discussion, but... Shouldn't it
> be more correct to not depend on the ip address of the used network,
> but to use the "scope" parameter of the given address?
>
RFC 3927 specifies the Ethernet arp broadcast behavior for only
169.254.0.0/16. Presumably you could set the scope parameter to local
for addresses outside of that range or even for protocols other than
Ethernet. Since broadcasting ARP packets usually adversely effects
usable network bandwidth, we should probably only do it where it is
absolutely required. The overhead of testing the value required by the
RFC is quite low (3 machine instructions on i686 is the size of the
entire patch), so using some proxy like the scope parameter would not
even be a performance win.
David Daney
^ permalink raw reply
* Re: Broadcast ARP packets on link local addresses (Version2).
From: Janos Farkas @ 2006-04-06 16:53 UTC (permalink / raw)
To: David Daney; +Cc: netdev, linux-kernel, pgf, freek
In-Reply-To: <44353F36.9070404@avtrex.com>
On 4/6/06, David Daney <ddaney@avtrex.com> wrote:
> Janos Farkas wrote:
> > Shouldn't it
> > be more correct to not depend on the ip address of the used network,
> > but to use the "scope" parameter of the given address?
> RFC 3927 specifies the Ethernet arp broadcast behavior for only
> 169.254.0.0/16. Presumably you could set the scope parameter to local
> for addresses outside of that range or even for protocols other than
> Ethernet. Since broadcasting ARP packets usually adversely effects
> usable network bandwidth, we should probably only do it where it is
> absolutely required. The overhead of testing the value required by the
> RFC is quite low (3 machine instructions on i686 is the size of the
> entire patch), so using some proxy like the scope parameter would not
> even be a performance win.
Indeed, I just have a bad feeling about hardwiring IP addresses this deep.
The problems with "my" idea would be, summarily, after a day:
Q: Is there are reason to use broadcast ARP semantics for other IP
address ranges?
A: Maybe, but no RFC defines that.
Q: Is there are reason to NOT use broadcast ARP semantics for the
defined IP address ranges?
A: Maybe, but the RFC is against it.
Q: Is there a reason to expect people (and tools) to use/define scopes?
A: Probably, but it's still uncommon practice :) I mean, how many of
us have 192.168.x.x addresses with "global" scope? I know I do.
I'm still in a losing position :)
Janos
^ permalink raw reply
* Re: [PATCH] scm: fold __scm_send() into scm_send()
From: Xiaolan Zhang @ 2006-04-06 17:52 UTC (permalink / raw)
To: sds
Cc: Andrew Morton, Chris Wright, cxzhang, davem, ioe-lkml,
James Morris, linux-kernel, netdev, netdev
In-Reply-To: <1142948528.28120.34.camel@moss-spartans.epoch.ncsc.mil>
Hi, Stephen and James,
Looks like the selinux_sk_ctxid() call implemented in James' patch also
requires the sk_callback_lock (see below). I am planning to introduce a
new exported fucntion selinux_sock_ctxid() which does not require any
locking. Comments?
thanks,
Catherine
Stephen Smalley <sds@tycho.nsa.gov> wrote on 03/21/2006 08:42:08 AM:
> On Tue, 2006-03-21 at 08:32 -0500, Stephen Smalley wrote:
> > > I don't expect security_sk_sid() to be terribly expensive. It's not
> > > an AVC check, it's just propagating a label. But I've not done any
> > > benchmarking on that.
> >
> > No permission check there, but it looks like it does read lock
> > sk_callback_lock. Not sure if that is truly justified here.
>
> Ah, that is because it is also called from the xfrm code, introduced by
> Trent's patches. But that locking shouldn't be necessary from scm_send,
> right? So she likely wants a separate hook for it to avoid that
> overhead, or even just a direct SELinux interface?
>
> --
> Stephen Smalley
> National Security Agency
>
^ permalink raw reply
* Re: [PATCH] Unaligned accesses in the ethernet bridge
From: Adrian Bunk @ 2006-04-06 20:37 UTC (permalink / raw)
To: Peter Chubb; +Cc: shemminger, linux-kernel, netdev
In-Reply-To: <17442.650.874609.271109@berry.ken.nicta.com.au>
On Thu, Mar 23, 2006 at 01:06:02PM +1100, Peter Chubb wrote:
>
> I see lots of
> kernel unaligned access to 0xa0000001009dbb6f, ip=0xa000000100811591
> kernel unaligned access to 0xa0000001009dbb6b, ip=0xa0000001008115c1
> kernel unaligned access to 0xa0000001009dbb6d, ip=0xa0000001008115f1
> messages in my logs on IA64 when using the ethernet bridge with 2.6.16.
>
>
> Appended is a patch to fix them.
I see this patch already made it into 2.6.17-rc1.
It seems to be a candidate for 2.6.16.3, too?
If yes, please submit it to stable@kernel.org.
> Signed-off-by: Peter Chubb <peterc@gelato.unsw.edu.au>
>
>
> net/bridge/br_stp_bpdu.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> Index: linux-2.6-import/net/bridge/br_stp_bpdu.c
> ===================================================================
> --- linux-2.6-import.orig/net/bridge/br_stp_bpdu.c 2006-03-22 09:11:01.349886375 +1100
> +++ linux-2.6-import/net/bridge/br_stp_bpdu.c 2006-03-23 12:52:13.719239205 +1100
> @@ -19,6 +19,7 @@
> #include <linux/llc.h>
> #include <net/llc.h>
> #include <net/llc_pdu.h>
> +#include <asm/unaligned.h>
>
> #include "br_private.h"
> #include "br_private_stp.h"
> @@ -59,12 +60,12 @@ static inline void br_set_ticks(unsigned
> {
> unsigned long ticks = (STP_HZ * j)/ HZ;
>
> - *((__be16 *) dest) = htons(ticks);
> + put_unaligned(htons(ticks), (__be16 *)dest);
> }
>
> static inline int br_get_ticks(const unsigned char *src)
> {
> - unsigned long ticks = ntohs(*(__be16 *)src);
> + unsigned long ticks = ntohs(get_unaligned((__be16 *)src));
>
> return (ticks * HZ + STP_HZ - 1) / STP_HZ;
> }
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply
* [PATCH] PCI Error Recovery: e100 network device driver
From: Linas Vepstas @ 2006-04-06 22:24 UTC (permalink / raw)
To: Jeff Garzik, netdev, linux-pci
Cc: linuxppc-dev, john.ronciak, linux-kernel, jeffrey.t.kirsher,
jesse.brandeburg
Please apply and forward upstream.
--linas
[PATCH] PCI Error Recovery: e100 network device driver
Various PCI bus errors can be signaled by newer PCI controllers. This
patch adds the PCI error recovery callbacks to the intel ethernet e100
device driver. The patch has been tested, and appears to work well.
Signed-off-by: Linas Vepstas <linas@linas.org>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
----
drivers/net/e100.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+)
Index: linux-2.6.17-rc1/drivers/net/e100.c
===================================================================
--- linux-2.6.17-rc1.orig/drivers/net/e100.c 2006-04-05 09:56:06.000000000 -0500
+++ linux-2.6.17-rc1/drivers/net/e100.c 2006-04-06 15:17:29.000000000 -0500
@@ -2781,6 +2781,70 @@ static void e100_shutdown(struct pci_dev
}
+/* ------------------ PCI Error Recovery infrastructure -------------- */
+/** e100_io_error_detected() is called when PCI error is detected */
+static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
+{
+ struct net_device *netdev = pci_get_drvdata(pdev);
+
+ /* Same as calling e100_down(netdev_priv(netdev)), but generic */
+ netdev->stop(netdev);
+
+ /* Detach; put netif into state similar to hotplug unplug */
+ netif_poll_enable(netdev);
+ netif_device_detach(netdev);
+
+ /* Request a slot reset. */
+ return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/** e100_io_slot_reset is called after the pci bus has been reset.
+ * Restart the card from scratch. */
+static pci_ers_result_t e100_io_slot_reset(struct pci_dev *pdev)
+{
+ struct net_device *netdev = pci_get_drvdata(pdev);
+ struct nic *nic = netdev_priv(netdev);
+
+ if(pci_enable_device(pdev)) {
+ printk(KERN_ERR "e100: Cannot re-enable PCI device after reset.\n");
+ return PCI_ERS_RESULT_DISCONNECT;
+ }
+ pci_set_master(pdev);
+
+ /* Only one device per card can do a reset */
+ if (0 != PCI_FUNC (pdev->devfn))
+ return PCI_ERS_RESULT_RECOVERED;
+ e100_hw_reset(nic);
+ e100_phy_init(nic);
+
+ return PCI_ERS_RESULT_RECOVERED;
+}
+
+/** e100_io_resume is called when the error recovery driver
+ * tells us that its OK to resume normal operation.
+ */
+static void e100_io_resume(struct pci_dev *pdev)
+{
+ struct net_device *netdev = pci_get_drvdata(pdev);
+ struct nic *nic = netdev_priv(netdev);
+
+ /* ack any pending wake events, disable PME */
+ pci_enable_wake(pdev, 0, 0);
+
+ netif_device_attach(netdev);
+ if(netif_running(netdev)) {
+ e100_open (netdev);
+ mod_timer(&nic->watchdog, jiffies);
+ }
+}
+
+static struct pci_error_handlers e100_err_handler = {
+ .error_detected = e100_io_error_detected,
+ .slot_reset = e100_io_slot_reset,
+ .resume = e100_io_resume,
+};
+
+
static struct pci_driver e100_driver = {
.name = DRV_NAME,
.id_table = e100_id_table,
@@ -2791,6 +2855,7 @@ static struct pci_driver e100_driver = {
.resume = e100_resume,
#endif
.shutdown = e100_shutdown,
+ .err_handler = &e100_err_handler,
};
static int __init e100_init_module(void)
^ permalink raw reply
* Re: [PATCH] PCI Error Recovery: e100 network device driver
From: Greg KH @ 2006-04-06 22:46 UTC (permalink / raw)
To: Linas Vepstas
Cc: netdev, linux-kernel, jesse.brandeburg, linuxppc-dev,
john.ronciak, jeffrey.t.kirsher, linux-pci, Jeff Garzik
In-Reply-To: <20060406222359.GA30037@austin.ibm.com>
On Thu, Apr 06, 2006 at 05:24:00PM -0500, Linas Vepstas wrote:
> + if(pci_enable_device(pdev)) {
Add a space after "if" and before "(" please.
You do this in a few different places.
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH] net: Broadcast ARP packets on link local addresses
From: Anand Kumria @ 2006-04-07 7:20 UTC (permalink / raw)
To: linux-kernel; +Cc: netdev
In-Reply-To: <17453.47752.914390.692779@dl2.hq2.avtrex.com>
On Fri, 31 Mar 2006 15:26:00 -0800, David Daney wrote:
> From: David Daney
>
> Greetings,
>
> When an internet host joins a network where there is no DHCP server,
> it may auto-allocate an IP address by the method described in RFC
> 3927. There are several user space daemons available that implement
> most of the protocol (zcip, busybox, ...). The kernel's APR driver
> should function in the normal manner except that it is required to
> broadcast all ARP packets that it originates in the link local address
> space (169.254.0.0/16). RFC 3927 section 2.5 explains the requirement.
>
> The current ARP code is non-compliant because it does not broadcast
> some ARP packets as required by RFC 3927.
I haven't seem anyone comment on this, but it would be useful to see this
integrated.
If you have a bunch of Linux machines and two machines have the same
address allocated (not so impossible) they won't notice until they start
communicating with each other.
A third machine attempting to communicate with either party won't be able
to do so. With this patch in place, overlapping assignments are noticed
much faster due to the broadcast.
Something else I've noticed while I've been implementing my zeroconf
daemon is that the kernel returns link-scoped primary addresses first to
'ifconfig'. Unfortunately quite a lot of user-space programs parse its
output and interpret the address it presents as the primary for the
specified interface.
Is that a case of user-space breakage that the kernel team would
ordinarily worry about?
Thanks,
Anand
^ permalink raw reply
* [PATCHES] Bringing Orinoco to 0.15
From: Pavel Roskin @ 2006-04-07 8:07 UTC (permalink / raw)
To: orinoco-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Andrew Morton,
NetDev
Hello!
I'm about to submit series of 21 patches for Orinoco drivers. Those
patches have been in Orinoco CVS for months, and there have been no bug
reports. I believe it's about time that I submit the patches to the
kernel.
I know, I've missed the boat for 2.6.17 (sorry for that, I was really
overworked), but I hope it's better to submit the patches as early as
possible so that they get some public exposure before ending up in the
kernel.
The changes are minimal, despite the size of the patches. The intention
was to make as much cleanup as possible and call it 0.15, and then start
doing real changes.
The patches are available at http://red-bean.com/proski/orinoco/
This includes the cumulative patch and a zip archive with all patches.
Andrew, maybe you you include the patches into the "mm" kernel?
Here's a brief overview of the changes:
1) Remove old cruft, such as obsolete PCMCIA code, obsolete comments,
obsolete debug code.
2) Fix misleading comments. For instance, Symbol Spectrum24 LA4137 was
called Symbol Spectrum24 LA4100.
3) Fixes for minor annoyances, such as a kernel warning emitted every
time when iwconfig requests stats on recent Symbol firmware.
4) Optimization for Tx exception handling. No need to read the complete
Tx descriptor if just a few fields are needed.
5) Serious rework of the Tx code. The low level function for copying
data to the card has been changed to accept odd number of bytes, which
allows to remove all padding code used in the kernel. Not a single
unwanted byte would leak to the air. Also, error handling has been
redone, transmit errors are counted in one place, and orinoco_xmit()
returns what the network layer expects it to, rather than -errno. 802.3
encapsulation has been slightly simplified.
6) The driver will reset the card in case of some bad Tx errors.
7) The driver will print the firmware version before trying to allocate
the transmission buffer, so that users can report the firmware version
in case of errors.
8) "Pseudo-PCI" drivers (i.e. drivers for cards in primitive
PCI-to-PCMCIA adaptors) support suspend and resume now.
9) PCI suspend frees the IRQ and disables the device.
10) All I/O is done using the iomem API.
11) The code common between PCI and pseudo-PCI drivers has been put to
orinoco_pci.h. The drivers have been changed to minimize differences
between them. Sorry, it's a big patch, but that's how it was made, and
splitting it would be rewriting history. I did split what I could
(comment changes).
--
Regards,
Pavel Roskin
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply
* [PATCH 01/21] orinoco: Remove useless CIS validation
From: Pavel Roskin @ 2006-04-07 8:10 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: orinoco-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
From: Pavel Roskin <proski-mXXj517/zsQ@public.gmane.org>
The PCMCIA drivers would never be loaded if the CIS were wrong.
No other PCMCIA drivers validate CIS.
Signed-off-by: Pavel Roskin <proski-mXXj517/zsQ@public.gmane.org>
---
drivers/net/wireless/orinoco_cs.c | 3 ---
drivers/net/wireless/spectrum_cs.c | 3 ---
2 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index ec6f2a4..05f1762 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -191,12 +191,9 @@ orinoco_cs_config(dev_link_t *link)
int last_fn, last_ret;
u_char buf[64];
config_info_t conf;
- cisinfo_t info;
tuple_t tuple;
cisparse_t parse;
void __iomem *mem;
-
- CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info));
/*
* This reads the card's CONFIG tuple to find its
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index 5fa6fbe..87178a3 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -664,12 +664,9 @@ spectrum_cs_config(dev_link_t *link)
int last_fn, last_ret;
u_char buf[64];
config_info_t conf;
- cisinfo_t info;
tuple_t tuple;
cisparse_t parse;
void __iomem *mem;
-
- CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info));
/*
* This reads the card's CONFIG tuple to find its
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox