* Re: 64-bit net_device_stats
From: Arnd Bergmann @ 2010-06-02 23:38 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Ben Hutchings, David Miller, junchangwang, romieu, netdev
In-Reply-To: <20100602145912.56ef62c2@nehalam>
On Wednesday 02 June 2010 23:59:12 Stephen Hemminger wrote:
> On Wed, 02 Jun 2010 22:34:29 +0100
> Ben Hutchings <bhutchings@solarflare.com> wrote:
>
> > Changing the counter types to u64 for 32-bit architectures would remove
> > atomicity and expose half-updated counters to userland. Changing the
> > driver interface significantly so that atomicity is not needed would
> > require changes to hundreds of drivers.
>
> Another big issue is maintaining ABI compatibility for /proc and ioctl
> interfaces. So bigger values would only be available through netlink,
> and most applications using counters don't use netlink.
Doesn't the /proc interface already allow 64 bit values in case of
64 bit hosts running the same 32 bit user space?
For the ioctl interfaces, we can of course introduce additional
ioctl commands that always deal with 64 bit values, many other
subsystems have been extended in similar ways.
We don't mandate that a program built against new kernel headers
must work on old kernels, so it is possibly to actually change
the definitions, as long as the kernel still supports the old
interfaces for existing binaries. We should still have a
good reason even for breaking the ABI in ways that we don't
guarantee to be stable.
Arnd
^ permalink raw reply
* Re: Bug#584238: linux-image-2.6.32-3-486: When using USB to Ethernet nework adapter later on get error: blocked for more than 120 seconds
From: Ben Hutchings @ 2010-06-02 23:24 UTC (permalink / raw)
To: Paul Chany, 584238; +Cc: Petko Manolov, netdev
In-Reply-To: <20100602144551.2330.64473.reportbug@debian-laptop.localdomain>
[-- Attachment #1: Type: text/plain, Size: 22568 bytes --]
On Wed, 2010-06-02 at 16:45 +0200, Paul Chany wrote:
> Package: linux-2.6
> Version: 2.6.32-9
> Severity: normal
> Tags: squeeze
>
> When using USB to Ethernet adapter later on get error on console:
>
> [11531.988248] INOF: task khubd:618 blocked for more than 120 seconds.
> [11531.988377] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this
> message.
> [11531.990656] INFO: task pegasus:1156 blocked for more than 120 seconds.
> [11531.990722] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this
> message.
>
> After that I can't reconfigure anymore network, nor reboot the system with the command:
> sudo shutdown -t 1 -r now
> because the system hangs forever.
>
> It is not help if I unplug and plug in again the network adapter, it is not recognised by
> the kernel anymore.
I'm forwarding this to the pegasus driver developers so they can comment
on it.
Debian kernel version 2.6.32-9 is closely based on stable kernel
2.6.32.9.
Ben.
> -- Package-specific info:
> ** Version:
> Linux version 2.6.32-3-486 (Debian 2.6.32-9) (maks@debian.org) (gcc version 4.3.4 (Debian 4.3.4-8) ) #1 Thu Feb 25 05:35:13 UTC 2010
>
> ** Command line:
> BOOT_IMAGE=/boot/vmlinuz-2.6.32-3-486 root=UUID=127a8e72-b9d4-4a28-8aa9-e6cdcb3985c9 ro all_generic_ide quiet
>
> ** Not tainted
>
> ** Kernel log:
> [ 9.225611] PM: Error -22 checking image file
> [ 9.225628] PM: Resume from disk failed.
> [ 9.414135] EXT3-fs: INFO: recovery required on readonly filesystem.
> [ 9.414163] EXT3-fs: write access will be enabled during recovery.
> [ 10.688535] kjournald starting. Commit interval 5 seconds
> [ 10.688652] EXT3-fs: recovery complete.
> [ 10.710733] EXT3-fs: mounted filesystem with ordered data mode.
> [ 14.472786] udev: starting version 154
> [ 16.350029] Marking TSC unstable due to TSC halts in idle
> [ 16.360220] Switching to clocksource acpi_pm
> [ 16.364952] processor LNXCPU:00: registered as cooling_device1
> [ 16.973885] ACPI: AC Adapter [ADP1] (on-line)
> [ 17.006719] input: Lid Switch as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input1
> [ 17.009207] ACPI: Lid Switch [LID]
> [ 17.014108] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input2
> [ 17.016375] ACPI: Power Button [PWRF]
> [ 17.061928] ACPI: Battery Slot [MBAT] (battery absent)
> [ 17.171064] input: PC Speaker as /devices/platform/pcspkr/input/input3
> [ 17.264959] psmouse serio1: ID: 12 02 3c
> [ 17.988705] input: PS/2 Generic Mouse as /devices/platform/i8042/serio1/input/input4
> [ 18.017149] NET: Registered protocol family 23
> [ 18.052666] yenta_cardbus 0000:00:13.0: CardBus bridge found [1179:0001]
> [ 18.116480] parport_pc 00:0b: reported by Plug and Play ACPI
> [ 18.116647] parport0: PC-style at 0x378 (0x778), irq 7 [PCSPP,TRISTATE]
> [ 18.137705] toshiba_acpi: Toshiba Laptop ACPI Extras version 0.19
> [ 18.137734] toshiba_acpi: HCI method: \_SB_.VALD.GHCI
> [ 18.232354] yenta_cardbus 0000:00:13.0: ISA IRQ mask 0x0638, PCI irq 11
> [ 18.232382] yenta_cardbus 0000:00:13.0: Socket status: 30000007
> [ 18.237856] yenta_cardbus 0000:00:13.1: CardBus bridge found [1179:0001]
> [ 18.365096] yenta_cardbus 0000:00:13.1: ISA IRQ mask 0x0638, PCI irq 11
> [ 18.365127] yenta_cardbus 0000:00:13.1: Socket status: 30000007
> [ 18.589661] donauboe 0000:00:11.0: power state changed by ACPI to D0
> [ 18.673099] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
> [ 18.673147] donauboe 0000:00:11.0: PCI INT A -> Link[LNKC] -> GSI 11 (level, low) -> IRQ 11
> [ 18.683045] IrDA: Registered device irda0
> [ 18.683071] toshoboe: Using multiple tasks
> [ 19.942533] pcmcia_socket pcmcia_socket0: cs: IO port probe 0x100-0x3af: excluding 0x220-0x22f 0x330-0x337 0x388-0x38f
> [ 19.943975] pcmcia_socket pcmcia_socket0: cs: IO port probe 0x3e0-0x4ff: clean.
> [ 19.946283] pcmcia_socket pcmcia_socket1: cs: IO port probe 0x100-0x3af: excluding 0x220-0x22f 0x330-0x337 0x388-0x38f
> [ 19.947698] pcmcia_socket pcmcia_socket1: cs: IO port probe 0x3e0-0x4ff: clean.
> [ 19.948699] pcmcia_socket pcmcia_socket1: cs: IO port probe 0x820-0x8ff: clean.
> [ 19.949502] pcmcia_socket pcmcia_socket1: cs: IO port probe 0xc00-0xcf7: clean.
> [ 19.951565] pcmcia_socket pcmcia_socket1: cs: IO port probe 0xa00-0xaff: clean.
> [ 19.952689] pcmcia_socket pcmcia_socket0: cs: IO port probe 0x820-0x8ff: clean.
> [ 19.953498] pcmcia_socket pcmcia_socket0: cs: IO port probe 0xc00-0xcf7: clean.
> [ 19.955555] pcmcia_socket pcmcia_socket0: cs: IO port probe 0xa00-0xaff: clean.
> [ 22.724794] Adding 176672k swap on /dev/sda8. Priority:-1 extents:1 across:176672k
> [ 23.986386] EXT3 FS on sda1, internal journal
> [ 24.322216] device-mapper: uevent: version 1.0.3
> [ 24.330289] device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
> [ 25.052483] loop: module loaded
> [ 48.955794] kjournald starting. Commit interval 5 seconds
> [ 48.956308] EXT3 FS on sda6, internal journal
> [ 48.956349] EXT3-fs: mounted filesystem with ordered data mode.
> [ 49.174455] kjournald starting. Commit interval 5 seconds
> [ 49.174926] EXT3 FS on sda7, internal journal
> [ 49.174962] EXT3-fs: mounted filesystem with ordered data mode.
> [ 49.432381] kjournald starting. Commit interval 5 seconds
> [ 49.432966] EXT3 FS on sda5, internal journal
> [ 49.433005] EXT3-fs: mounted filesystem with ordered data mode.
> [ 49.665115] kjournald starting. Commit interval 5 seconds
> [ 49.665786] EXT3 FS on sda9, internal journal
> [ 49.665823] EXT3-fs: mounted filesystem with ordered data mode.
> [ 54.377286] fuse init (API version 7.13)
> [ 74.213762] Program wdm tried to access /dev/mem between 100000->102000.
> [ 567.364143] usb 1-1: new full speed USB device using ohci_hcd and address 2
> [ 567.582139] usb 1-1: New USB device found, idVendor=07a6, idProduct=8515
> [ 567.582166] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [ 567.582188] usb 1-1: Product: USB To LAN Converter
> [ 567.582205] usb 1-1: Manufacturer: ADMtek
> [ 567.582221] usb 1-1: SerialNumber: 0001
> [ 567.583936] usb 1-1: configuration #1 chosen from 1 choice
> [ 571.013676] pegasus: v0.6.14 (2006/09/27), Pegasus/Pegasus II USB Ethernet driver
> [ 571.045528] pegasus 1-1:1.0: setup Pegasus II specific registers
> [ 571.210220] pegasus 1-1:1.0: eth0, ADMtek ADM8515 "Pegasus II" USB-2.0 Ethernet, 00:00:70:01:11:f1
> [ 571.211093] usbcore: registered new interface driver pegasus
> [ 574.285384] pegasus 1-1:1.0: update_eth_regs_async, status -22
> [ 574.285772] pegasus 1-1:1.0: update_eth_regs_async, status -22
> [ 574.285887] pegasus 1-1:1.0: update_eth_regs_async, status -22
> [ 574.286411] pegasus 1-1:1.0: update_eth_regs_async, status -22
> [ 578.781286] pegasus 1-1:1.0: update_eth_regs_async, status -22
> [ 585.052090] eth0: no IPv6 routers present
> [ 1947.028159] end_request: I/O error, dev fd0, sector 0
> [ 1947.232118] end_request: I/O error, dev fd0, sector 0
> [ 2105.253068] usb 1-1: USB disconnect, address 2
> [ 2544.772228] usb 1-1: new full speed USB device using ohci_hcd and address 3
> [ 2544.990232] usb 1-1: New USB device found, idVendor=07a6, idProduct=8515
> [ 2544.990264] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [ 2544.990287] usb 1-1: Product: USB To LAN Converter
> [ 2544.990304] usb 1-1: Manufacturer: ADMtek
> [ 2544.990320] usb 1-1: SerialNumber: 0001
> [ 2544.991871] usb 1-1: configuration #1 chosen from 1 choice
> [ 2545.028225] pegasus 1-1:1.0: setup Pegasus II specific registers
> [ 2545.254633] pegasus 1-1:1.0: eth0, ADMtek ADM8515 "Pegasus II" USB-2.0 Ethernet, 00:00:70:01:11:f1
> [ 2556.080650] pegasus 1-1:1.0: update_eth_regs_async, status -22
> [ 2556.081018] pegasus 1-1:1.0: update_eth_regs_async, status -22
> [ 2556.081132] pegasus 1-1:1.0: update_eth_regs_async, status -22
> [ 2556.081408] pegasus 1-1:1.0: update_eth_regs_async, status -22
> [ 2558.463393] pegasus 1-1:1.0: update_eth_regs_async, status -22
> [ 2566.472084] eth0: no IPv6 routers present
>
> ** Model information
> not available
>
> ** Loaded modules:
> Module Size Used by
> pegasus 14734 0
> mii 2654 1 pegasus
> fuse 42747 1
> loop 9561 0
> dm_crypt 9023 0
> dm_mod 45901 1 dm_crypt
> snd_opl3sa2 10888 1
> snd_wss_lib 17401 1 snd_opl3sa2
> snd_pcm_oss 28551 0
> snd_mixer_oss 10473 2 snd_pcm_oss
> snd_pcm 46210 2 snd_wss_lib,snd_pcm_oss
> snd_page_alloc 5017 2 snd_wss_lib,snd_pcm
> snd_opl3_lib 6130 1 snd_opl3sa2
> snd_hwdep 4022 1 snd_opl3_lib
> snd_mpu401_uart 4155 1 snd_opl3sa2
> snd_seq_midi 3572 0
> snd_rawmidi 12737 2 snd_mpu401_uart,snd_seq_midi
> snd_seq_midi_event 3848 1 snd_seq_midi
> snd_seq 35413 2 snd_seq_midi,snd_seq_midi_event
> snd_timer 12292 4 snd_wss_lib,snd_pcm,snd_opl3_lib,snd_seq
> snd_seq_device 3661 4 snd_opl3_lib,snd_seq_midi,snd_rawmidi,snd_seq
> pcmcia 16438 0
> donauboe 6996 0
> snd 34102 12 snd_opl3sa2,snd_wss_lib,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_opl3_lib,snd_hwdep,snd_mpu401_uart,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
> toshiba_acpi 4361 0
> parport_pc 15783 0
> serio_raw 2912 0
> yenta_socket 16335 2
> irda 71654 1 donauboe
> rsrc_nonstatic 7061 1 yenta_socket
> parport 22170 1 parport_pc
> soundcore 3294 2 snd
> pcspkr 1235 0
> container 1833 0
> rfkill 10658 1 toshiba_acpi
> battery 3774 0
> crc_ccitt 1039 2 donauboe,irda
> button 3578 0
> ac 1628 0
> psmouse 48174 0
> pcmcia_core 20506 3 pcmcia,yenta_socket,rsrc_nonstatic
> evdev 5520 6
> processor 23235 1
> ext3 92724 5
> jbd 27946 1 ext3
> mbcache 3482 1 ext3
> sg 16463 0
> ohci_hcd 17096 0
> ehci_hcd 27716 0
> fan 2590 0
> sr_mod 10734 1
> floppy 41131 0
> usbcore 98034 4 pegasus,ohci_hcd,ehci_hcd
> sd_mod 25733 7
> cdrom 26475 1 sr_mod
> thermal 9210 0
> crc_t10dif 1012 1 sd_mod
> nls_base 4445 1 usbcore
> thermal_sys 9346 3 processor,fan,thermal
> ata_generic 2011 7
> libata 115918 1 ata_generic
> scsi_mod 102173 4 sg,sr_mod,sd_mod,libata
>
> ** Network interface configuration:
>
> auto lo
> iface lo inet loopback
>
> allow-hotplug eth0
> iface eth0 inet dhcp
>
> ** Network status:
> *** IP interfaces and addresses:
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
> inet 127.0.0.1/8 scope host lo
> inet6 ::1/128 scope host
> valid_lft forever preferred_lft forever
> 2: irda0: <NOARP> mtu 2048 qdisc noop state DOWN qlen 8
> link/irda 00:00:00:00 brd ff:ff:ff:ff
> 4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
> link/ether 00:00:70:01:11:f1 brd ff:ff:ff:ff:ff:ff
> inet 192.168.10.92/24 brd 192.168.10.255 scope global eth0
> inet6 fe80::200:70ff:fe01:11f1/64 scope link
> valid_lft forever preferred_lft forever
>
> *** Device statistics:
> Inter-| Receive | Transmit
> face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
> lo: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> irda0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> eth0: 179607 301 0 0 0 0 0 0 22820 231 0 0 0 0 0 0
>
> *** Protocol statistics:
> Ip:
> 1833 total packets received
> 4 with invalid addresses
> 0 forwarded
> 0 incoming packets discarded
> 1649 incoming packets delivered
> 1312 requests sent out
> 44 dropped because of missing route
> Icmp:
> 0 ICMP messages received
> 0 input ICMP message failed.
> ICMP input histogram:
> 0 ICMP messages sent
> 0 ICMP messages failed
> ICMP output histogram:
> Tcp:
> 33 active connections openings
> 0 passive connection openings
> 0 failed connection attempts
> 16 connection resets received
> 0 connections established
> 1363 segments received
> 1086 segments send out
> 0 segments retransmited
> 0 bad segments received.
> 27 resets sent
> Udp:
> 213 packets received
> 0 packets to unknown port received.
> 0 packet receive errors
> 222 packets sent
> UdpLite:
> TcpExt:
> 1 TCP sockets finished time wait in fast timer
> 33 delayed acks sent
> 923 packets directly queued to recvmsg prequeue.
> 8688 bytes directly in process context from backlog
> 1131509 bytes directly received in process context from prequeue
> 275 packet headers predicted
> 784 packets header predicted and directly queued to user
> 51 acknowledgments not containing data payload received
> 131 predicted acknowledgments
> 1 connections reset due to unexpected data
> 16 connections reset due to early user close
> IpExt:
> InMcastPkts: 21
> OutMcastPkts: 25
> InBcastPkts: 73
> InOctets: 1695218
> OutOctets: 106998
> InMcastOctets: 5451
> OutMcastOctets: 5611
> InBcastOctets: 13564
>
> *** Device features:
> eth0: 0x0
> irda0: 0x0
> lo: 0x13865
>
> ** PCI devices:
> 00:00.0 Host bridge [0600]: Toshiba America Info Systems CPU to PCI bridge [1179:0601] (rev a2)
> Subsystem: Toshiba America Info Systems Satellite Pro [1179:0001]
> Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort+ >SERR- <PERR- INTx-
> Latency: 0, Cache Line Size: 32 bytes
>
> 00:07.0 Communication controller [0780]: Agere Systems 56k WinModem [11c1:0441] (rev 01)
> Subsystem: Toshiba America Info Systems Internal V.90 Modem [1179:0001]
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> Latency: 0 (63000ns min, 3500ns max)
> Interrupt: pin A routed to IRQ 3
> Region 0: Memory at ffefff00 (32-bit, non-prefetchable) [size=256]
> Region 1: I/O ports at 02f8 [size=8]
> Region 2: I/O ports at 1c00 [size=256]
> Capabilities: <access denied>
>
> 00:08.0 VGA compatible controller [0300]: S3 Inc. ViRGE/MX [5333:8c01] (rev 06) (prog-if 00 [VGA controller])
> Subsystem: Toshiba America Info Systems ViRGE/MX [1179:0001]
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> Latency: 0 (1000ns min, 63750ns max)
> Region 0: Memory at f8000000 (32-bit, non-prefetchable) [size=64M]
> Expansion ROM at 18000000 [disabled] [size=64K]
>
> 00:0b.0 USB Controller [0c03]: NEC Corporation USB [1033:0035] (rev 02) (prog-if 10 [OHCI])
> Subsystem: Toshiba America Info Systems USB [1179:0001]
> Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR+ INTx-
> Latency: 64 (250ns min, 5250ns max)
> Interrupt: pin A routed to IRQ 11
> Region 0: Memory at f7fff000 (32-bit, non-prefetchable) [size=4K]
> Kernel driver in use: ohci_hcd
> Kernel modules: ohci-hcd
>
> 00:10.0 IDE interface [0101]: Toshiba America Info Systems Extended IDE Controller [1179:0102] (rev 34) (prog-if f0)
> Subsystem: Toshiba America Info Systems Device [1179:0002]
> Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=slow >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> Latency: 64 (500ns min, 10000ns max)
> Region 0: [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
> Region 1: [virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
> Region 2: [virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]
> Region 3: [virtual] Memory at 00000370 (type 3, non-prefetchable) [size=1]
> Region 4: I/O ports at 1800 [size=16]
> Kernel driver in use: ata_generic
> Kernel modules: ata_generic, ide-pci-generic
>
> 00:11.0 Communication controller [0780]: Toshiba America Info Systems FIR Port Type-O [1179:0701] (rev 23)
> Subsystem: Toshiba America Info Systems Device [1179:0001]
> Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=slow >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> Latency: 64
> Interrupt: pin A routed to IRQ 11
> Region 0: I/O ports at ffe0 [size=32]
> Kernel driver in use: donauboe
> Kernel modules: donauboe
>
> 00:13.0 CardBus bridge [0607]: Toshiba America Info Systems ToPIC97 [1179:060f] (rev 07)
> Subsystem: Toshiba America Info Systems Satellite 4010 [1179:0001]
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=slow >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> Latency: 0
> Interrupt: pin A routed to IRQ 11
> Region 0: Memory at 18010000 (32-bit, non-prefetchable) [size=4K]
> Bus: primary=00, secondary=01, subordinate=04, sec-latency=0
> Memory window 0: 08000000-0bfff000 (prefetchable)
> Memory window 1: 0c000000-0ffff000
> I/O window 0: 00001000-000010ff
> I/O window 1: 00001400-000014ff
> BridgeCtl: Parity- SERR- ISA- VGA- MAbort- >Reset- 16bInt+ PostWrite+
> 16-bit legacy interface ports at 0001
> Kernel driver in use: yenta_cardbus
> Kernel modules: yenta_socket
>
> 00:13.1 CardBus bridge [0607]: Toshiba America Info Systems ToPIC97 [1179:060f] (rev 07)
> Subsystem: Toshiba America Info Systems Satellite 4010 [1179:0001]
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=slow >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> Latency: 0
> Interrupt: pin B routed to IRQ 11
> Region 0: Memory at 18011000 (32-bit, non-prefetchable) [size=4K]
> Bus: primary=00, secondary=05, subordinate=08, sec-latency=0
> Memory window 0: 10000000-13fff000 (prefetchable)
> Memory window 1: 14000000-17fff000
> I/O window 0: 00002000-000020ff
> I/O window 1: 00002400-000024ff
> BridgeCtl: Parity- SERR- ISA- VGA- MAbort- >Reset- 16bInt+ PostWrite+
> 16-bit legacy interface ports at 0001
> Kernel driver in use: yenta_cardbus
> Kernel modules: yenta_socket
>
>
> ** USB devices:
> Bus 001 Device 003: ID 07a6:8515 ADMtek, Inc. AN8515 Ethernet
> Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
>
>
> -- System Information:
> Debian Release: squeeze/sid
> APT prefers testing
> APT policy: (500, 'testing')
> Architecture: i386 (i586)
>
> Kernel: Linux 2.6.32-3-486
> Locale: LANG=hu_HU.UTF-8, LC_CTYPE=hu_HU.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
>
> Versions of packages linux-image-2.6.32-3-486 depends on:
> ii debconf [debconf-2.0] 1.5.32 Debian configuration management sy
> ii initramfs-tools [linux-initr 0.94.4 tools for generating an initramfs
> ii module-init-tools 3.12~pre2-3 tools for managing Linux kernel mo
>
> Versions of packages linux-image-2.6.32-3-486 recommends:
> ii firmware-linux-free 2.6.32-9 Binary firmware for various driver
>
> Versions of packages linux-image-2.6.32-3-486 suggests:
> ii grub 0.97-61 GRand Unified Bootloader (dummy pa
> pn linux-doc-2.6.32 <none> (no description available)
>
> Versions of packages linux-image-2.6.32-3-486 is related to:
> pn firmware-bnx2 <none> (no description available)
> pn firmware-bnx2x <none> (no description available)
> pn firmware-ipw2x00 <none> (no description available)
> pn firmware-ivtv <none> (no description available)
> pn firmware-iwlwifi <none> (no description available)
> pn firmware-linux <none> (no description available)
> pn firmware-linux-nonfree <none> (no description available)
> pn firmware-qlogic <none> (no description available)
> pn firmware-ralink <none> (no description available)
>
> -- debconf information:
> shared/kernel-image/really-run-bootloader: true
> linux-image-2.6.32-3-486/prerm/removing-running-kernel-2.6.32-3-486: true
> linux-image-2.6.32-3-486/postinst/bootloader-error-2.6.32-3-486:
> linux-image-2.6.32-3-486/postinst/missing-firmware-2.6.32-3-486:
> linux-image-2.6.32-3-486/postinst/bootloader-test-error-2.6.32-3-486:
> linux-image-2.6.32-3-486/postinst/depmod-error-initrd-2.6.32-3-486: false
> linux-image-2.6.32-3-486/prerm/would-invalidate-boot-loader-2.6.32-3-486: true
>
>
>
--
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* Re: sysfs class/net/ problem
From: Eric W. Biederman @ 2010-06-02 23:09 UTC (permalink / raw)
To: Johannes Berg; +Cc: Greg KH, netdev
In-Reply-To: <1275506732.3915.41.camel@jlt3.sipsolutions.net>
Johannes Berg <johannes@sipsolutions.net> writes:
> On Wed, 2010-06-02 at 11:05 -0700, Eric W. Biederman wrote:
>
>> My current hypothesis is something is causing us to try and delete
>> the symlink from the wrong namespace, so we just skip that part of it.
>
> Hmm... ok:
>
> [ 70.338274] create link wlan2 ns=(null)
Inside of sysfs_do_create_link we compute sd->s_ns just before
sysfs_addrm_start.
With this sequence:
if (sysfs_ns_type(parent_sd))
sd->s_ns = target->ktype->namespace(target);
> ...
> [ 71.881775] delete link wlan2 ns=(null)
> [ 71.881777] hash_and_remove ffff88001f9563c0, (null), wlan2
> [ 71.881782] sd=ffff88001ce2d9c0, sdns=ffffffff8271c260
>
> and thus we skip sysfs_remove_one() in sysfs_hash_and_remove() because
> sysfs_find_dirent() return an sd with a different ns than we passed in.
> Why is the ns we pass in NULL, shouldn't it be init_ns?
NULL is what is used in the case where something is not bound to a
namespace (most of sysfs). It should be init_ns.
If we have a NULL ns in sysfs_delete_link than I expect targ->sd == NULL.
As targ->sd->s_ns should equal init_ns.
So now I just need to figure out if targ->sd is NULL in delete link is
NULL in which case we have an ordering issue or if targ->sd->s_ns is NULL
in which case I have something confused with the network namespaces.
Looking at your report:
# ls -l /sys/class/net/
total 0
lrwxrwxrwx 1 root root 0 Jun 2 13:12 eth0 -> ../../devices/pci0000:00/0000:00:03.0/net/eth0
lrwxrwxrwx 1 root root 0 Jun 2 13:12 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx 1 root root 0 Jun 2 13:14 wlan0 -> ../../devices/virtual/mac80211_hwsim/hwsim0/wlan0
lrwxrwxrwx 1 root root 0 Jun 2 13:14 wlan1 -> ../../devices/virtual/mac80211_hwsim/hwsim1/wlan1
lrwxrwxrwx 1 root root 0 Jun 2 13:14 wlan2 -> ../../devices/virtual/mac80211_hwsim/hwsim2/wlan2
It appears that devices/virtual/mac80211_hwsim/hwsim0/wlan0 is not a
normal network device. The symlink does not point into a net
directory. Which is done with the normal network devices to ensure
they don't have conflicting names with anything else.
Are your network devices not members of net_class (defined in
net/core/net-sysfs.c)? There is some odd class_create magic going on
in init_mac80211_hwsim.
Let's see.
netdev_register_kobject unconditionally sets dev->class = &net_class.
device_add calls setup_parent which calls get_device_parent.
get_device_parent calls virtual_device_parent if no parent is present,
or it the parent does not have a class it creates a net directory.
So we are in the case where the parent directory has a class, which I did
not realize was there. Ugh. Does this matter?
Let's see.
In sysfs_create_link if the parent sysfs_dirent has a namespace type I
assume that the kobject target of the symlink will have a ktype that
returns the namespace the dirent should be in. Since the target kobject
is a normal network device that assumption is fulfilled.
In sysfs_delete_link I assume that the target kobject dirent has a useful
sd->s_ns, which it will if you are in a class_net subdirectory but hwsim0
seems to be something else. So the target of the sysfs_dirent does not
appear to meet these requirements, because the target directory is not
name-spacified.
This appears to be specific to the mac80211_hwsim driver I don't think it even
affects other wireless drivers.
What I don't see at the moment is how we get
devices/virtual/mac80211_hwsim/hwsim0/ as our parent directory for
network devices.
Johannes any clues?
If I have read this right this is a bug that only affects mac80211_hwsim because
it does magic creating it's own devices and classes, which ordinary drivers don't
do.
Eric
^ permalink raw reply
* [net-2.6 PATCH] ixgbe: return IXGBE_ERR_RAR_INDEX when out of range
From: Jeff Kirsher @ 2010-06-02 22:44 UTC (permalink / raw)
To: davem; +Cc: netdev, gospo, Shirley Ma, Jeff Kirsher, Don Skidmore
Based on original patch from Shirley Ma <xma@us.ibm.com>
Return IXGBE_ERR_RAR_INDEX when RAR index is out of range, instead of
returning IXGBE_SUCCESS.
CC: Shirley Ma <xma@us.ibm.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Acked-by: Don Skidmore <donald.c.skidmore@intel.com>
---
drivers/net/ixgbe/ixgbe_common.c | 2 ++
drivers/net/ixgbe/ixgbe_type.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 1159d91..9595b1b 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -1188,6 +1188,7 @@ s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high);
} else {
hw_dbg(hw, "RAR index %d is out of range.\n", index);
+ return IXGBE_ERR_RAR_INDEX;
}
return 0;
@@ -1219,6 +1220,7 @@ s32 ixgbe_clear_rar_generic(struct ixgbe_hw *hw, u32 index)
IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high);
} else {
hw_dbg(hw, "RAR index %d is out of range.\n", index);
+ return IXGBE_ERR_RAR_INDEX;
}
/* clear VMDq pool/queue selection for this RAR */
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 2eb6e15..cdd1998 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -2609,6 +2609,7 @@ struct ixgbe_info {
#define IXGBE_ERR_EEPROM_VERSION -24
#define IXGBE_ERR_NO_SPACE -25
#define IXGBE_ERR_OVERTEMP -26
+#define IXGBE_ERR_RAR_INDEX -27
#define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF
#endif /* _IXGBE_TYPE_H_ */
^ permalink raw reply related
* Re: [net-next-2.6 PATCH 2/2] x86: Align skb w/ start of cache line on newer core 2/Xeon Arch
From: Eric Dumazet @ 2010-06-02 22:44 UTC (permalink / raw)
To: Jeff Kirsher
Cc: davem, mingo, tglx, hpa, x86, linux-kernel, netdev, gospo,
Alexander Duyck
In-Reply-To: <20100602222506.12962.49240.stgit@localhost.localdomain>
Le mercredi 02 juin 2010 à 15:25 -0700, Jeff Kirsher a écrit :
> From: Alexander Duyck <alexander.h.duyck@intel.com>
>
> x86 architectures can handle unaligned accesses in hardware, and it has
> been shown that unaligned DMA accesses can be expensive on Nehalem
> architectures. As such we should overwrite NET_IP_ALIGN and NET_SKB_PAD
> to resolve this issue.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>
> arch/x86/include/asm/system.h | 12 ++++++++++++
> 1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
> index b8fe48e..8acb44e 100644
> --- a/arch/x86/include/asm/system.h
> +++ b/arch/x86/include/asm/system.h
> @@ -457,4 +457,16 @@ static inline void rdtsc_barrier(void)
> alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
> }
>
> +#ifdef CONFIG_MCORE2
> +/*
> + * We handle most unaligned accesses in hardware. On the other hand
> + * unaligned DMA can be quite expensive on some Nehalem processors.
> + *
> + * Based on this we disable the IP header alignment in network drivers.
> + * We also modify NET_SKB_PAD to be a cacheline in size, thus maintaining
> + * cacheline alignment of buffers.
> + */
> +#define NET_IP_ALIGN 0
> +#define NET_SKB_PAD L1_CACHE_BYTES
> +#endif
> #endif /* _ASM_X86_SYSTEM_H */
>
> --
But... L1_CACHE_BYTES is 64 on MCORE2, so this matches current
NET_SKB_PAD definition...
#ifndef NET_SKB_PAD
#define NET_SKB_PAD 64
#endif
^ permalink raw reply
* [net-next-2.6 PATCH 2/2] x86: Align skb w/ start of cache line on newer core 2/Xeon Arch
From: Jeff Kirsher @ 2010-06-02 22:25 UTC (permalink / raw)
To: davem, mingo, tglx, hpa
Cc: x86, linux-kernel, netdev, gospo, Alexander Duyck, Jeff Kirsher
In-Reply-To: <20100602222230.12962.97260.stgit@localhost.localdomain>
From: Alexander Duyck <alexander.h.duyck@intel.com>
x86 architectures can handle unaligned accesses in hardware, and it has
been shown that unaligned DMA accesses can be expensive on Nehalem
architectures. As such we should overwrite NET_IP_ALIGN and NET_SKB_PAD
to resolve this issue.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
arch/x86/include/asm/system.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
index b8fe48e..8acb44e 100644
--- a/arch/x86/include/asm/system.h
+++ b/arch/x86/include/asm/system.h
@@ -457,4 +457,16 @@ static inline void rdtsc_barrier(void)
alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
}
+#ifdef CONFIG_MCORE2
+/*
+ * We handle most unaligned accesses in hardware. On the other hand
+ * unaligned DMA can be quite expensive on some Nehalem processors.
+ *
+ * Based on this we disable the IP header alignment in network drivers.
+ * We also modify NET_SKB_PAD to be a cacheline in size, thus maintaining
+ * cacheline alignment of buffers.
+ */
+#define NET_IP_ALIGN 0
+#define NET_SKB_PAD L1_CACHE_BYTES
+#endif
#endif /* _ASM_X86_SYSTEM_H */
^ permalink raw reply related
* [net-next-2.6 PATCH 1/2] skbuff: add check for non-linear to warn_if_lro and needs_linearize
From: Jeff Kirsher @ 2010-06-02 22:24 UTC (permalink / raw)
To: davem, mingo, tglx, hpa
Cc: x86, linux-kernel, netdev, gospo, Alexander Duyck, Jeff Kirsher
From: Alexander Duyck <alexander.h.duyck@intel.com>
We can avoid an unecessary cache miss by checking if the skb is non-linear
before accessing gso_size/gso_type in skb_warn_if_lro, the same can also be
done to avoid a cache miss on nr_frags if data_len is 0.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
include/linux/skbuff.h | 3 ++-
net/core/dev.c | 7 ++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bf243fc..645e78d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2129,7 +2129,8 @@ static inline bool skb_warn_if_lro(const struct sk_buff *skb)
/* LRO sets gso_size but not gso_type, whereas if GSO is really
* wanted then gso_type will be set. */
struct skb_shared_info *shinfo = skb_shinfo(skb);
- if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) {
+ if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 &&
+ unlikely(shinfo->gso_type == 0)) {
__skb_warn_lro_forwarding(skb);
return true;
}
diff --git a/net/core/dev.c b/net/core/dev.c
index d03470f..9f7c407 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2080,9 +2080,10 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
static inline int skb_needs_linearize(struct sk_buff *skb,
struct net_device *dev)
{
- return (skb_has_frags(skb) && !(dev->features & NETIF_F_FRAGLIST)) ||
- (skb_shinfo(skb)->nr_frags && (!(dev->features & NETIF_F_SG) ||
- illegal_highdma(dev, skb)));
+ return skb_is_nonlinear(skb) &&
+ ((skb_has_frags(skb) && !(dev->features & NETIF_F_FRAGLIST)) ||
+ (skb_shinfo(skb)->nr_frags && (!(dev->features & NETIF_F_SG) ||
+ illegal_highdma(dev, skb))));
}
/**
^ permalink raw reply related
* [PATCH net-next-2.6] net: use __packed annotation
From: Eric Dumazet @ 2010-06-02 22:20 UTC (permalink / raw)
To: David Miller; +Cc: netdev
cleanup patch.
Use new __packed annotation in net/ and include/
(except netfilter)
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
include/linux/if_ether.h | 2
include/linux/if_fddi.h | 8 +--
include/linux/if_frad.h | 2
include/linux/if_hippi.h | 8 +--
include/linux/if_pppox.h | 8 +--
include/linux/ipv6.h | 4 -
include/linux/isdnif.h | 2
include/linux/mISDNif.h | 2
include/linux/nbd.h | 2
include/linux/ncp.h | 10 ++--
include/linux/ncp_fs_sb.h | 14 +++---
include/linux/phonet.h | 4 -
include/linux/rds.h | 12 ++---
include/linux/sctp.h | 80 +++++++++++++++++------------------
include/linux/wlp.h | 22 ++++-----
include/net/dn_dev.h | 8 +--
include/net/dn_nsp.h | 16 +++----
include/net/ip6_tunnel.h | 2
include/net/ipx.h | 8 +--
include/net/mip6.h | 2
include/net/ndisc.h | 2
include/net/sctp/structs.h | 4 -
include/rxrpc/packet.h | 8 +--
net/bluetooth/bnep/bnep.h | 8 +--
net/compat.c | 6 +-
net/iucv/iucv.c | 14 +++---
net/mac80211/cfg.c | 2
net/mac80211/ieee80211_i.h | 2
net/mac80211/rx.c | 2
net/sctp/sm_make_chunk.c | 2
30 files changed, 133 insertions(+), 133 deletions(-)
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index bed7a46..c831467 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -119,7 +119,7 @@ struct ethhdr {
unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
unsigned char h_source[ETH_ALEN]; /* source ether addr */
__be16 h_proto; /* packet type ID field */
-} __attribute__((packed));
+} __packed;
#ifdef __KERNEL__
#include <linux/skbuff.h>
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h
index 5459c5c..9947c39 100644
--- a/include/linux/if_fddi.h
+++ b/include/linux/if_fddi.h
@@ -67,7 +67,7 @@ struct fddi_8022_1_hdr {
__u8 dsap; /* destination service access point */
__u8 ssap; /* source service access point */
__u8 ctrl; /* control byte #1 */
-} __attribute__ ((packed));
+} __packed;
/* Define 802.2 Type 2 header */
struct fddi_8022_2_hdr {
@@ -75,7 +75,7 @@ struct fddi_8022_2_hdr {
__u8 ssap; /* source service access point */
__u8 ctrl_1; /* control byte #1 */
__u8 ctrl_2; /* control byte #2 */
-} __attribute__ ((packed));
+} __packed;
/* Define 802.2 SNAP header */
#define FDDI_K_OUI_LEN 3
@@ -85,7 +85,7 @@ struct fddi_snap_hdr {
__u8 ctrl; /* always 0x03 */
__u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
__be16 ethertype; /* packet type ID field */
-} __attribute__ ((packed));
+} __packed;
/* Define FDDI LLC frame header */
struct fddihdr {
@@ -98,7 +98,7 @@ struct fddihdr {
struct fddi_8022_2_hdr llc_8022_2;
struct fddi_snap_hdr llc_snap;
} hdr;
-} __attribute__ ((packed));
+} __packed;
#ifdef __KERNEL__
#include <linux/netdevice.h>
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 80b3a10..191ee08 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -135,7 +135,7 @@ struct frhdr
__be16 PID;
#define IP_NLPID pad
-} __attribute__((packed));
+} __packed;
/* see RFC 1490 for the definition of the following */
#define FRAD_I_UI 0x03
diff --git a/include/linux/if_hippi.h b/include/linux/if_hippi.h
index 8d038eb..5fe5f30 100644
--- a/include/linux/if_hippi.h
+++ b/include/linux/if_hippi.h
@@ -104,7 +104,7 @@ struct hippi_fp_hdr {
__be32 fixed;
#endif
__be32 d2_size;
-} __attribute__ ((packed));
+} __packed;
struct hippi_le_hdr {
#if defined (__BIG_ENDIAN_BITFIELD)
@@ -129,7 +129,7 @@ struct hippi_le_hdr {
__u8 daddr[HIPPI_ALEN];
__u16 locally_administered;
__u8 saddr[HIPPI_ALEN];
-} __attribute__ ((packed));
+} __packed;
#define HIPPI_OUI_LEN 3
/*
@@ -142,12 +142,12 @@ struct hippi_snap_hdr {
__u8 ctrl; /* always 0x03 */
__u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/
__be16 ethertype; /* packet type ID field */
-} __attribute__ ((packed));
+} __packed;
struct hippi_hdr {
struct hippi_fp_hdr fp;
struct hippi_le_hdr le;
struct hippi_snap_hdr snap;
-} __attribute__ ((packed));
+} __packed;
#endif /* _LINUX_IF_HIPPI_H */
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index a6577af..2d54b53 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -59,7 +59,7 @@ struct sockaddr_pppox {
union{
struct pppoe_addr pppoe;
}sa_addr;
-}__attribute__ ((packed));
+} __packed;
/* The use of the above union isn't viable because the size of this
* struct must stay fixed over time -- applications use sizeof(struct
@@ -70,7 +70,7 @@ struct sockaddr_pppol2tp {
sa_family_t sa_family; /* address family, AF_PPPOX */
unsigned int sa_protocol; /* protocol identifier */
struct pppol2tp_addr pppol2tp;
-}__attribute__ ((packed));
+} __packed;
/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
* bits. So we need a different sockaddr structure.
@@ -79,7 +79,7 @@ struct sockaddr_pppol2tpv3 {
sa_family_t sa_family; /* address family, AF_PPPOX */
unsigned int sa_protocol; /* protocol identifier */
struct pppol2tpv3_addr pppol2tp;
-} __attribute__ ((packed));
+} __packed;
/*********************************************************************
*
@@ -129,7 +129,7 @@ struct pppoe_hdr {
__be16 sid;
__be16 length;
struct pppoe_tag tag[0];
-} __attribute__ ((packed));
+} __packed;
/* Length of entire PPPoE + PPP header */
#define PPPOE_SES_HLEN 8
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 99e1ab7..940e215 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -58,7 +58,7 @@ struct ipv6_opt_hdr {
/*
* TLV encoded option data follows.
*/
-} __attribute__ ((packed)); /* required for some archs */
+} __packed; /* required for some archs */
#define ipv6_destopt_hdr ipv6_opt_hdr
#define ipv6_hopopt_hdr ipv6_opt_hdr
@@ -99,7 +99,7 @@ struct ipv6_destopt_hao {
__u8 type;
__u8 length;
struct in6_addr addr;
-} __attribute__ ((__packed__));
+} __packed;
/*
* IPv6 fixed header
diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h
index b9b5a68..b8c23f8 100644
--- a/include/linux/isdnif.h
+++ b/include/linux/isdnif.h
@@ -317,7 +317,7 @@ typedef struct T30_s {
__u8 r_scantime;
__u8 r_id[FAXIDLEN];
__u8 r_code;
-} __attribute__((packed)) T30_s;
+} __packed T30_s;
#define ISDN_TTY_FAX_CONN_IN 0
#define ISDN_TTY_FAX_CONN_OUT 1
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index 78c3bed..b5e7f22 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -251,7 +251,7 @@
struct mISDNhead {
unsigned int prim;
unsigned int id;
-} __attribute__((packed));
+} __packed;
#define MISDN_HEADER_LEN sizeof(struct mISDNhead)
#define MAX_DATA_SIZE 2048
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 155719d..bb58854 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -88,7 +88,7 @@ struct nbd_request {
char handle[8];
__be64 from;
__be32 len;
-} __attribute__ ((packed));
+} __packed;
/*
* This is the reply packet that nbd-server sends back to the client after
diff --git a/include/linux/ncp.h b/include/linux/ncp.h
index 99f0ade..3ace837 100644
--- a/include/linux/ncp.h
+++ b/include/linux/ncp.h
@@ -27,7 +27,7 @@ struct ncp_request_header {
__u8 conn_high;
__u8 function;
__u8 data[0];
-} __attribute__((packed));
+} __packed;
#define NCP_REPLY (0x3333)
#define NCP_WATCHDOG (0x3E3E)
@@ -42,7 +42,7 @@ struct ncp_reply_header {
__u8 completion_code;
__u8 connection_state;
__u8 data[0];
-} __attribute__((packed));
+} __packed;
#define NCP_VOLNAME_LEN (16)
#define NCP_NUMBER_OF_VOLUMES (256)
@@ -158,7 +158,7 @@ struct nw_info_struct {
#ifdef __KERNEL__
struct nw_nfs_info nfs;
#endif
-} __attribute__((packed));
+} __packed;
/* modify mask - use with MODIFY_DOS_INFO structure */
#define DM_ATTRIBUTES (cpu_to_le32(0x02))
@@ -190,12 +190,12 @@ struct nw_modify_dos_info {
__u16 inheritanceGrantMask;
__u16 inheritanceRevokeMask;
__u32 maximumSpace;
-} __attribute__((packed));
+} __packed;
struct nw_search_sequence {
__u8 volNumber;
__u32 dirBase;
__u32 sequence;
-} __attribute__((packed));
+} __packed;
#endif /* _LINUX_NCP_H */
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
index 5ec9ca6..8da05bc 100644
--- a/include/linux/ncp_fs_sb.h
+++ b/include/linux/ncp_fs_sb.h
@@ -104,13 +104,13 @@ struct ncp_server {
unsigned int state; /* STREAM only: receiver state */
struct {
- __u32 magic __attribute__((packed));
- __u32 len __attribute__((packed));
- __u16 type __attribute__((packed));
- __u16 p1 __attribute__((packed));
- __u16 p2 __attribute__((packed));
- __u16 p3 __attribute__((packed));
- __u16 type2 __attribute__((packed));
+ __u32 magic __packed;
+ __u32 len __packed;
+ __u16 type __packed;
+ __u16 p1 __packed;
+ __u16 p2 __packed;
+ __u16 p3 __packed;
+ __u16 type2 __packed;
} buf; /* STREAM only: temporary buffer */
unsigned char* ptr; /* STREAM only: pointer to data */
size_t len; /* STREAM only: length of data to receive */
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index e5126cf..24426c3 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -56,7 +56,7 @@ struct phonethdr {
__be16 pn_length;
__u8 pn_robj;
__u8 pn_sobj;
-} __attribute__((packed));
+} __packed;
/* Common Phonet payload header */
struct phonetmsg {
@@ -98,7 +98,7 @@ struct sockaddr_pn {
__u8 spn_dev;
__u8 spn_resource;
__u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
-} __attribute__ ((packed));
+} __packed;
/* Well known address */
#define PN_DEV_PC 0x10
diff --git a/include/linux/rds.h b/include/linux/rds.h
index cab4994..24bce3d 100644
--- a/include/linux/rds.h
+++ b/include/linux/rds.h
@@ -100,7 +100,7 @@
struct rds_info_counter {
u_int8_t name[32];
u_int64_t value;
-} __attribute__((packed));
+} __packed;
#define RDS_INFO_CONNECTION_FLAG_SENDING 0x01
#define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02
@@ -115,7 +115,7 @@ struct rds_info_connection {
__be32 faddr;
u_int8_t transport[TRANSNAMSIZ]; /* null term ascii */
u_int8_t flags;
-} __attribute__((packed));
+} __packed;
struct rds_info_flow {
__be32 laddr;
@@ -123,7 +123,7 @@ struct rds_info_flow {
u_int32_t bytes;
__be16 lport;
__be16 fport;
-} __attribute__((packed));
+} __packed;
#define RDS_INFO_MESSAGE_FLAG_ACK 0x01
#define RDS_INFO_MESSAGE_FLAG_FAST_ACK 0x02
@@ -136,7 +136,7 @@ struct rds_info_message {
__be16 lport;
__be16 fport;
u_int8_t flags;
-} __attribute__((packed));
+} __packed;
struct rds_info_socket {
u_int32_t sndbuf;
@@ -146,7 +146,7 @@ struct rds_info_socket {
__be16 connected_port;
u_int32_t rcvbuf;
u_int64_t inum;
-} __attribute__((packed));
+} __packed;
struct rds_info_tcp_socket {
__be32 local_addr;
@@ -158,7 +158,7 @@ struct rds_info_tcp_socket {
u_int32_t last_sent_nxt;
u_int32_t last_expected_una;
u_int32_t last_seen_una;
-} __attribute__((packed));
+} __packed;
#define RDS_IB_GID_LEN 16
struct rds_info_rdma_connection {
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index c20d3ce..c11a287 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -61,7 +61,7 @@ typedef struct sctphdr {
__be16 dest;
__be32 vtag;
__le32 checksum;
-} __attribute__((packed)) sctp_sctphdr_t;
+} __packed sctp_sctphdr_t;
#ifdef __KERNEL__
#include <linux/skbuff.h>
@@ -77,7 +77,7 @@ typedef struct sctp_chunkhdr {
__u8 type;
__u8 flags;
__be16 length;
-} __attribute__((packed)) sctp_chunkhdr_t;
+} __packed sctp_chunkhdr_t;
/* Section 3.2. Chunk Type Values.
@@ -167,7 +167,7 @@ enum { SCTP_CHUNK_FLAG_T = 0x01 };
typedef struct sctp_paramhdr {
__be16 type;
__be16 length;
-} __attribute__((packed)) sctp_paramhdr_t;
+} __packed sctp_paramhdr_t;
typedef enum {
@@ -228,12 +228,12 @@ typedef struct sctp_datahdr {
__be16 ssn;
__be32 ppid;
__u8 payload[0];
-} __attribute__((packed)) sctp_datahdr_t;
+} __packed sctp_datahdr_t;
typedef struct sctp_data_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_datahdr_t data_hdr;
-} __attribute__((packed)) sctp_data_chunk_t;
+} __packed sctp_data_chunk_t;
/* DATA Chuck Specific Flags */
enum {
@@ -259,78 +259,78 @@ typedef struct sctp_inithdr {
__be16 num_inbound_streams;
__be32 initial_tsn;
__u8 params[0];
-} __attribute__((packed)) sctp_inithdr_t;
+} __packed sctp_inithdr_t;
typedef struct sctp_init_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_inithdr_t init_hdr;
-} __attribute__((packed)) sctp_init_chunk_t;
+} __packed sctp_init_chunk_t;
/* Section 3.3.2.1. IPv4 Address Parameter (5) */
typedef struct sctp_ipv4addr_param {
sctp_paramhdr_t param_hdr;
struct in_addr addr;
-} __attribute__((packed)) sctp_ipv4addr_param_t;
+} __packed sctp_ipv4addr_param_t;
/* Section 3.3.2.1. IPv6 Address Parameter (6) */
typedef struct sctp_ipv6addr_param {
sctp_paramhdr_t param_hdr;
struct in6_addr addr;
-} __attribute__((packed)) sctp_ipv6addr_param_t;
+} __packed sctp_ipv6addr_param_t;
/* Section 3.3.2.1 Cookie Preservative (9) */
typedef struct sctp_cookie_preserve_param {
sctp_paramhdr_t param_hdr;
__be32 lifespan_increment;
-} __attribute__((packed)) sctp_cookie_preserve_param_t;
+} __packed sctp_cookie_preserve_param_t;
/* Section 3.3.2.1 Host Name Address (11) */
typedef struct sctp_hostname_param {
sctp_paramhdr_t param_hdr;
uint8_t hostname[0];
-} __attribute__((packed)) sctp_hostname_param_t;
+} __packed sctp_hostname_param_t;
/* Section 3.3.2.1 Supported Address Types (12) */
typedef struct sctp_supported_addrs_param {
sctp_paramhdr_t param_hdr;
__be16 types[0];
-} __attribute__((packed)) sctp_supported_addrs_param_t;
+} __packed sctp_supported_addrs_param_t;
/* Appendix A. ECN Capable (32768) */
typedef struct sctp_ecn_capable_param {
sctp_paramhdr_t param_hdr;
-} __attribute__((packed)) sctp_ecn_capable_param_t;
+} __packed sctp_ecn_capable_param_t;
/* ADDIP Section 3.2.6 Adaptation Layer Indication */
typedef struct sctp_adaptation_ind_param {
struct sctp_paramhdr param_hdr;
__be32 adaptation_ind;
-} __attribute__((packed)) sctp_adaptation_ind_param_t;
+} __packed sctp_adaptation_ind_param_t;
/* ADDIP Section 4.2.7 Supported Extensions Parameter */
typedef struct sctp_supported_ext_param {
struct sctp_paramhdr param_hdr;
__u8 chunks[0];
-} __attribute__((packed)) sctp_supported_ext_param_t;
+} __packed sctp_supported_ext_param_t;
/* AUTH Section 3.1 Random */
typedef struct sctp_random_param {
sctp_paramhdr_t param_hdr;
__u8 random_val[0];
-} __attribute__((packed)) sctp_random_param_t;
+} __packed sctp_random_param_t;
/* AUTH Section 3.2 Chunk List */
typedef struct sctp_chunks_param {
sctp_paramhdr_t param_hdr;
__u8 chunks[0];
-} __attribute__((packed)) sctp_chunks_param_t;
+} __packed sctp_chunks_param_t;
/* AUTH Section 3.3 HMAC Algorithm */
typedef struct sctp_hmac_algo_param {
sctp_paramhdr_t param_hdr;
__be16 hmac_ids[0];
-} __attribute__((packed)) sctp_hmac_algo_param_t;
+} __packed sctp_hmac_algo_param_t;
/* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2):
* The INIT ACK chunk is used to acknowledge the initiation of an SCTP
@@ -342,13 +342,13 @@ typedef sctp_init_chunk_t sctp_initack_chunk_t;
typedef struct sctp_cookie_param {
sctp_paramhdr_t p;
__u8 body[0];
-} __attribute__((packed)) sctp_cookie_param_t;
+} __packed sctp_cookie_param_t;
/* Section 3.3.3.1 Unrecognized Parameters (8) */
typedef struct sctp_unrecognized_param {
sctp_paramhdr_t param_hdr;
sctp_paramhdr_t unrecognized;
-} __attribute__((packed)) sctp_unrecognized_param_t;
+} __packed sctp_unrecognized_param_t;
@@ -363,7 +363,7 @@ typedef struct sctp_unrecognized_param {
typedef struct sctp_gap_ack_block {
__be16 start;
__be16 end;
-} __attribute__((packed)) sctp_gap_ack_block_t;
+} __packed sctp_gap_ack_block_t;
typedef __be32 sctp_dup_tsn_t;
@@ -378,12 +378,12 @@ typedef struct sctp_sackhdr {
__be16 num_gap_ack_blocks;
__be16 num_dup_tsns;
sctp_sack_variable_t variable[0];
-} __attribute__((packed)) sctp_sackhdr_t;
+} __packed sctp_sackhdr_t;
typedef struct sctp_sack_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_sackhdr_t sack_hdr;
-} __attribute__((packed)) sctp_sack_chunk_t;
+} __packed sctp_sack_chunk_t;
/* RFC 2960. Section 3.3.5 Heartbeat Request (HEARTBEAT) (4):
@@ -395,12 +395,12 @@ typedef struct sctp_sack_chunk {
typedef struct sctp_heartbeathdr {
sctp_paramhdr_t info;
-} __attribute__((packed)) sctp_heartbeathdr_t;
+} __packed sctp_heartbeathdr_t;
typedef struct sctp_heartbeat_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_heartbeathdr_t hb_hdr;
-} __attribute__((packed)) sctp_heartbeat_chunk_t;
+} __packed sctp_heartbeat_chunk_t;
/* For the abort and shutdown ACK we must carry the init tag in the
@@ -409,7 +409,7 @@ typedef struct sctp_heartbeat_chunk {
*/
typedef struct sctp_abort_chunk {
sctp_chunkhdr_t uh;
-} __attribute__((packed)) sctp_abort_chunk_t;
+} __packed sctp_abort_chunk_t;
/* For the graceful shutdown we must carry the tag (in common header)
@@ -417,12 +417,12 @@ typedef struct sctp_abort_chunk {
*/
typedef struct sctp_shutdownhdr {
__be32 cum_tsn_ack;
-} __attribute__((packed)) sctp_shutdownhdr_t;
+} __packed sctp_shutdownhdr_t;
struct sctp_shutdown_chunk_t {
sctp_chunkhdr_t chunk_hdr;
sctp_shutdownhdr_t shutdown_hdr;
-} __attribute__ ((packed));
+} __packed;
/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
@@ -430,12 +430,12 @@ typedef struct sctp_errhdr {
__be16 cause;
__be16 length;
__u8 variable[0];
-} __attribute__((packed)) sctp_errhdr_t;
+} __packed sctp_errhdr_t;
typedef struct sctp_operr_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_errhdr_t err_hdr;
-} __attribute__((packed)) sctp_operr_chunk_t;
+} __packed sctp_operr_chunk_t;
/* RFC 2960 3.3.10 - Operation Error
*
@@ -525,7 +525,7 @@ typedef struct sctp_ecnehdr {
typedef struct sctp_ecne_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_ecnehdr_t ence_hdr;
-} __attribute__((packed)) sctp_ecne_chunk_t;
+} __packed sctp_ecne_chunk_t;
/* RFC 2960. Appendix A. Explicit Congestion Notification.
* Congestion Window Reduced (CWR) (13)
@@ -537,7 +537,7 @@ typedef struct sctp_cwrhdr {
typedef struct sctp_cwr_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_cwrhdr_t cwr_hdr;
-} __attribute__((packed)) sctp_cwr_chunk_t;
+} __packed sctp_cwr_chunk_t;
/* PR-SCTP
* 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN)
@@ -588,17 +588,17 @@ typedef struct sctp_cwr_chunk {
struct sctp_fwdtsn_skip {
__be16 stream;
__be16 ssn;
-} __attribute__((packed));
+} __packed;
struct sctp_fwdtsn_hdr {
__be32 new_cum_tsn;
struct sctp_fwdtsn_skip skip[0];
-} __attribute((packed));
+} __packed;
struct sctp_fwdtsn_chunk {
struct sctp_chunkhdr chunk_hdr;
struct sctp_fwdtsn_hdr fwdtsn_hdr;
-} __attribute((packed));
+} __packed;
/* ADDIP
@@ -636,17 +636,17 @@ struct sctp_fwdtsn_chunk {
typedef struct sctp_addip_param {
sctp_paramhdr_t param_hdr;
__be32 crr_id;
-} __attribute__((packed)) sctp_addip_param_t;
+} __packed sctp_addip_param_t;
typedef struct sctp_addiphdr {
__be32 serial;
__u8 params[0];
-} __attribute__((packed)) sctp_addiphdr_t;
+} __packed sctp_addiphdr_t;
typedef struct sctp_addip_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_addiphdr_t addip_hdr;
-} __attribute__((packed)) sctp_addip_chunk_t;
+} __packed sctp_addip_chunk_t;
/* AUTH
* Section 4.1 Authentication Chunk (AUTH)
@@ -701,11 +701,11 @@ typedef struct sctp_authhdr {
__be16 shkey_id;
__be16 hmac_id;
__u8 hmac[0];
-} __attribute__((packed)) sctp_authhdr_t;
+} __packed sctp_authhdr_t;
typedef struct sctp_auth_chunk {
sctp_chunkhdr_t chunk_hdr;
sctp_authhdr_t auth_hdr;
-} __attribute__((packed)) sctp_auth_chunk_t;
+} __packed sctp_auth_chunk_t;
#endif /* __LINUX_SCTP_H__ */
diff --git a/include/linux/wlp.h b/include/linux/wlp.h
index ac95ce6..c76fe23 100644
--- a/include/linux/wlp.h
+++ b/include/linux/wlp.h
@@ -300,7 +300,7 @@ struct wlp_ie {
__le16 cycle_param;
__le16 acw_anchor_addr;
u8 wssid_hash_list[];
-} __attribute__((packed));
+} __packed;
static inline int wlp_ie_hash_length(struct wlp_ie *ie)
{
@@ -324,7 +324,7 @@ static inline void wlp_ie_set_hash_length(struct wlp_ie *ie, int hash_length)
*/
struct wlp_nonce {
u8 data[16];
-} __attribute__((packed));
+} __packed;
/**
* WLP UUID
@@ -336,7 +336,7 @@ struct wlp_nonce {
*/
struct wlp_uuid {
u8 data[16];
-} __attribute__((packed));
+} __packed;
/**
@@ -348,7 +348,7 @@ struct wlp_dev_type {
u8 OUI[3];
u8 OUIsubdiv;
__le16 subID;
-} __attribute__((packed));
+} __packed;
/**
* WLP frame header
@@ -357,7 +357,7 @@ struct wlp_dev_type {
struct wlp_frame_hdr {
__le16 mux_hdr; /* WLP_PROTOCOL_ID */
enum wlp_frame_type type:8;
-} __attribute__((packed));
+} __packed;
/**
* WLP attribute field header
@@ -368,7 +368,7 @@ struct wlp_frame_hdr {
struct wlp_attr_hdr {
__le16 type;
__le16 length;
-} __attribute__((packed));
+} __packed;
/**
* Device information commonly used together
@@ -401,13 +401,13 @@ struct wlp_device_info {
struct wlp_attr_##name { \
struct wlp_attr_hdr hdr; \
type name; \
-} __attribute__((packed));
+} __packed;
#define wlp_attr_array(type, name) \
struct wlp_attr_##name { \
struct wlp_attr_hdr hdr; \
type name[]; \
-} __attribute__((packed));
+} __packed;
/**
* WLP association attribute fields
@@ -483,7 +483,7 @@ struct wlp_wss_info {
struct wlp_attr_accept_enrl accept;
struct wlp_attr_wss_sec_status sec_stat;
struct wlp_attr_wss_bcast bcast;
-} __attribute__((packed));
+} __packed;
/* WLP WSS Information */
wlp_attr_array(struct wlp_wss_info, wss_info)
@@ -520,7 +520,7 @@ wlp_attr(u8, wlp_assc_err)
struct wlp_frame_std_abbrv_hdr {
struct wlp_frame_hdr hdr;
u8 tag;
-} __attribute__((packed));
+} __packed;
/**
* WLP association frames
@@ -533,7 +533,7 @@ struct wlp_frame_assoc {
struct wlp_attr_version version;
struct wlp_attr_msg_type msg_type;
u8 attr[];
-} __attribute__((packed));
+} __packed;
/* Ethernet to dev address mapping */
struct wlp_eda {
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h
index 511a459..0916bbf 100644
--- a/include/net/dn_dev.h
+++ b/include/net/dn_dev.h
@@ -101,7 +101,7 @@ struct dn_short_packet {
__le16 dstnode;
__le16 srcnode;
__u8 forward;
-} __attribute__((packed));
+} __packed;
struct dn_long_packet {
__u8 msgflg;
@@ -115,7 +115,7 @@ struct dn_long_packet {
__u8 visit_ct;
__u8 s_class;
__u8 pt;
-} __attribute__((packed));
+} __packed;
/*------------------------- DRP - Routing messages ---------------------*/
@@ -132,7 +132,7 @@ struct endnode_hello_message {
__u8 mpd;
__u8 datalen;
__u8 data[2];
-} __attribute__((packed));
+} __packed;
struct rtnode_hello_message {
__u8 msgflg;
@@ -144,7 +144,7 @@ struct rtnode_hello_message {
__u8 area;
__le16 timer;
__u8 mpd;
-} __attribute__((packed));
+} __packed;
extern void dn_dev_init(void);
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h
index 17d43d2..e43a289 100644
--- a/include/net/dn_nsp.h
+++ b/include/net/dn_nsp.h
@@ -74,18 +74,18 @@ struct nsp_data_seg_msg {
__u8 msgflg;
__le16 dstaddr;
__le16 srcaddr;
-} __attribute__((packed));
+} __packed;
struct nsp_data_opt_msg {
__le16 acknum;
__le16 segnum;
__le16 lsflgs;
-} __attribute__((packed));
+} __packed;
struct nsp_data_opt_msg1 {
__le16 acknum;
__le16 segnum;
-} __attribute__((packed));
+} __packed;
/* Acknowledgment Message (data/other data) */
@@ -94,13 +94,13 @@ struct nsp_data_ack_msg {
__le16 dstaddr;
__le16 srcaddr;
__le16 acknum;
-} __attribute__((packed));
+} __packed;
/* Connect Acknowledgment Message */
struct nsp_conn_ack_msg {
__u8 msgflg;
__le16 dstaddr;
-} __attribute__((packed));
+} __packed;
/* Connect Initiate/Retransmit Initiate/Connect Confirm */
@@ -117,7 +117,7 @@ struct nsp_conn_init_msg {
#define NSP_FC_MASK 0x0c /* FC type mask */
__u8 info;
__le16 segsize;
-} __attribute__((packed));
+} __packed;
/* Disconnect Initiate/Disconnect Confirm */
struct nsp_disconn_init_msg {
@@ -125,7 +125,7 @@ struct nsp_disconn_init_msg {
__le16 dstaddr;
__le16 srcaddr;
__le16 reason;
-} __attribute__((packed));
+} __packed;
@@ -135,7 +135,7 @@ struct srcobj_fmt {
__le16 grpcode;
__le16 usrcode;
__u8 dlen;
-} __attribute__((packed));
+} __packed;
/*
* A collection of functions for manipulating the sequence
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index fbf9d1c..fc94ec5 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -27,6 +27,6 @@ struct ipv6_tlv_tnl_enc_lim {
__u8 type; /* type-code for option */
__u8 length; /* option length */
__u8 encap_limit; /* tunnel encapsulation limit */
-} __attribute__ ((packed));
+} __packed;
#endif
diff --git a/include/net/ipx.h b/include/net/ipx.h
index ef51a66..05d7e4a 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -27,9 +27,9 @@ struct ipx_address {
#define IPX_MAX_PPROP_HOPS 8
struct ipxhdr {
- __be16 ipx_checksum __attribute__ ((packed));
+ __be16 ipx_checksum __packed;
#define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF)
- __be16 ipx_pktsize __attribute__ ((packed));
+ __be16 ipx_pktsize __packed;
__u8 ipx_tctrl;
__u8 ipx_type;
#define IPX_TYPE_UNKNOWN 0x00
@@ -38,8 +38,8 @@ struct ipxhdr {
#define IPX_TYPE_SPX 0x05 /* SPX protocol */
#define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */
#define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */
- struct ipx_address ipx_dest __attribute__ ((packed));
- struct ipx_address ipx_source __attribute__ ((packed));
+ struct ipx_address ipx_dest __packed;
+ struct ipx_address ipx_source __packed;
};
static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
diff --git a/include/net/mip6.h b/include/net/mip6.h
index a83ad19..26ba99b 100644
--- a/include/net/mip6.h
+++ b/include/net/mip6.h
@@ -39,7 +39,7 @@ struct ip6_mh {
__u16 ip6mh_cksum;
/* Followed by type specific messages */
__u8 data[0];
-} __attribute__ ((__packed__));
+} __packed;
#define IP6_MH_TYPE_BRR 0 /* Binding Refresh Request */
#define IP6_MH_TYPE_HOTI 1 /* HOTI Message */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index f76f22d..895997b 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -82,7 +82,7 @@ struct ra_msg {
struct nd_opt_hdr {
__u8 nd_opt_type;
__u8 nd_opt_len;
-} __attribute__((__packed__));
+} __packed;
extern int ndisc_init(void);
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 4b86011..f9e7473 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -443,7 +443,7 @@ struct sctp_signed_cookie {
__u8 signature[SCTP_SECRET_SIZE];
__u32 __pad; /* force sctp_cookie alignment to 64 bits */
struct sctp_cookie c;
-} __attribute__((packed));
+} __packed;
/* This is another convenience type to allocate memory for address
* params for the maximum size and pass such structures around
@@ -488,7 +488,7 @@ typedef struct sctp_sender_hb_info {
union sctp_addr daddr;
unsigned long sent_at;
__u64 hb_nonce;
-} __attribute__((packed)) sctp_sender_hb_info_t;
+} __packed sctp_sender_hb_info_t;
/*
* RFC 2960 1.3.2 Sequenced Delivery within Streams
diff --git a/include/rxrpc/packet.h b/include/rxrpc/packet.h
index b69e6e1..9b2c308 100644
--- a/include/rxrpc/packet.h
+++ b/include/rxrpc/packet.h
@@ -65,7 +65,7 @@ struct rxrpc_header {
};
__be16 serviceId; /* service ID */
-} __attribute__((packed));
+} __packed;
#define __rxrpc_header_off(X) offsetof(struct rxrpc_header,X)
@@ -120,7 +120,7 @@ struct rxrpc_ackpacket {
#define RXRPC_ACK_TYPE_NACK 0
#define RXRPC_ACK_TYPE_ACK 1
-} __attribute__((packed));
+} __packed;
/*
* ACK packets can have a further piece of information tagged on the end
@@ -141,7 +141,7 @@ struct rxkad_challenge {
__be32 nonce; /* encrypted random number */
__be32 min_level; /* minimum security level */
__be32 __padding; /* padding to 8-byte boundary */
-} __attribute__((packed));
+} __packed;
/*****************************************************************************/
/*
@@ -164,7 +164,7 @@ struct rxkad_response {
__be32 kvno; /* Kerberos key version number */
__be32 ticket_len; /* Kerberos ticket length */
-} __attribute__((packed));
+} __packed;
/*****************************************************************************/
/*
diff --git a/net/bluetooth/bnep/bnep.h b/net/bluetooth/bnep/bnep.h
index 0d9e506..7067254 100644
--- a/net/bluetooth/bnep/bnep.h
+++ b/net/bluetooth/bnep/bnep.h
@@ -86,26 +86,26 @@ struct bnep_setup_conn_req {
__u8 ctrl;
__u8 uuid_size;
__u8 service[0];
-} __attribute__((packed));
+} __packed;
struct bnep_set_filter_req {
__u8 type;
__u8 ctrl;
__be16 len;
__u8 list[0];
-} __attribute__((packed));
+} __packed;
struct bnep_control_rsp {
__u8 type;
__u8 ctrl;
__be16 resp;
-} __attribute__((packed));
+} __packed;
struct bnep_ext_hdr {
__u8 type;
__u8 len;
__u8 data[0];
-} __attribute__((packed));
+} __packed;
/* BNEP ioctl defines */
#define BNEPCONNADD _IOW('B', 200, int)
diff --git a/net/compat.c b/net/compat.c
index ec24d9e..1cf7590 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -531,7 +531,7 @@ struct compat_group_req {
__u32 gr_interface;
struct __kernel_sockaddr_storage gr_group
__attribute__ ((aligned(4)));
-} __attribute__ ((packed));
+} __packed;
struct compat_group_source_req {
__u32 gsr_interface;
@@ -539,7 +539,7 @@ struct compat_group_source_req {
__attribute__ ((aligned(4)));
struct __kernel_sockaddr_storage gsr_source
__attribute__ ((aligned(4)));
-} __attribute__ ((packed));
+} __packed;
struct compat_group_filter {
__u32 gf_interface;
@@ -549,7 +549,7 @@ struct compat_group_filter {
__u32 gf_numsrc;
struct __kernel_sockaddr_storage gf_slist[1]
__attribute__ ((aligned(4)));
-} __attribute__ ((packed));
+} __packed;
#define __COMPAT_GF0_SIZE (sizeof(struct compat_group_filter) - \
sizeof(struct __kernel_sockaddr_storage))
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index f28ad2c..499c045 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -1463,7 +1463,7 @@ struct iucv_path_pending {
u32 res3;
u8 ippollfg;
u8 res4[3];
-} __attribute__ ((packed));
+} __packed;
static void iucv_path_pending(struct iucv_irq_data *data)
{
@@ -1524,7 +1524,7 @@ struct iucv_path_complete {
u32 res3;
u8 ippollfg;
u8 res4[3];
-} __attribute__ ((packed));
+} __packed;
static void iucv_path_complete(struct iucv_irq_data *data)
{
@@ -1554,7 +1554,7 @@ struct iucv_path_severed {
u32 res4;
u8 ippollfg;
u8 res5[3];
-} __attribute__ ((packed));
+} __packed;
static void iucv_path_severed(struct iucv_irq_data *data)
{
@@ -1590,7 +1590,7 @@ struct iucv_path_quiesced {
u32 res4;
u8 ippollfg;
u8 res5[3];
-} __attribute__ ((packed));
+} __packed;
static void iucv_path_quiesced(struct iucv_irq_data *data)
{
@@ -1618,7 +1618,7 @@ struct iucv_path_resumed {
u32 res4;
u8 ippollfg;
u8 res5[3];
-} __attribute__ ((packed));
+} __packed;
static void iucv_path_resumed(struct iucv_irq_data *data)
{
@@ -1649,7 +1649,7 @@ struct iucv_message_complete {
u32 ipbfln2f;
u8 ippollfg;
u8 res2[3];
-} __attribute__ ((packed));
+} __packed;
static void iucv_message_complete(struct iucv_irq_data *data)
{
@@ -1694,7 +1694,7 @@ struct iucv_message_pending {
u32 ipbfln2f;
u8 ippollfg;
u8 res2[3];
-} __attribute__ ((packed));
+} __packed;
static void iucv_message_pending(struct iucv_irq_data *data)
{
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index c7000a6..a2ed0f7 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -600,7 +600,7 @@ struct iapp_layer2_update {
u8 ssap; /* 0 */
u8 control;
u8 xid_info[3];
-} __attribute__ ((packed));
+} __packed;
static void ieee80211_send_layer2_update(struct sta_info *sta)
{
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 1a9e2da..ec3e5c3 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1084,7 +1084,7 @@ struct ieee80211_tx_status_rtap_hdr {
u8 padding_for_rate;
__le16 tx_flags;
u8 data_retries;
-} __attribute__ ((packed));
+} __packed;
/* HT */
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 6e2a7bc..2d9a2ee 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2139,7 +2139,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
u8 rate_or_pad;
__le16 chan_freq;
__le16 chan_flags;
- } __attribute__ ((packed)) *rthdr;
+ } __packed *rthdr;
struct sk_buff *skb = rx->skb, *skb2;
struct net_device *prev_dev = NULL;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index bd2a50b..246f929 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1817,7 +1817,7 @@ malformed:
struct __sctp_missing {
__be32 num_missing;
__be16 type;
-} __attribute__((packed));
+} __packed;
/*
* Report a missing mandatory parameter.
^ permalink raw reply related
* [PATCH net-next-2.6] ipv4: add LINUX_MIB_IPRPFILTER snmp counter
From: Eric Dumazet @ 2010-06-02 22:05 UTC (permalink / raw)
To: Christoph Lameter; +Cc: David Miller, netdev, shemminger
In-Reply-To: <alpine.DEB.2.00.1006021506560.32431@router.home>
Le mercredi 02 juin 2010 à 15:11 -0500, Christoph Lameter a écrit :
> On Wed, 2 Jun 2010, Eric Dumazet wrote:
>
> > Here is patch I am currently testing.
> >
> > I finaly created a new counter, because its a linux specific check.
>
> Looks good which does not say too much given my limited networking
> knowledge.
>
> Reviewed-by: Christoph Lameter <cl@linux-foundation.org>
I had one correction to do, here is the official submission.
I did unicast tests only.
Thanks !
[PATCH net-next-2.6] ipv4: add LINUX_MIB_IPRPFILTER snmp counter
Christoph Lameter mentioned that packets could be dropped in input path
because of rp_filter settings, without any SNMP counter being
incremented. System administrator can have a hard time to track the
problem.
This patch introduces a new counter, LINUX_MIB_IPRPFILTER, incremented
each time we drop a packet because Reverse Path Filter triggers.
(We receive an IPv4 datagram on a given interface, and find the route to
send an answer would use another interface)
netstat -s | grep IPReversePathFilter
IPReversePathFilter: 21714
Reported-by: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
include/linux/snmp.h | 1 +
net/ipv4/fib_frontend.c | 6 ++++--
net/ipv4/ip_input.c | 3 +++
net/ipv4/proc.c | 1 +
net/ipv4/route.c | 31 ++++++++++++++++++-------------
5 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 5279771..ebb0c80 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -229,6 +229,7 @@ enum
LINUX_MIB_TCPBACKLOGDROP,
LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
LINUX_MIB_TCPDEFERACCEPTDROP,
+ LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */
__LINUX_MIB_MAX
};
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 4f0ed45..e830f7a 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -284,7 +284,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
if (no_addr)
goto last_resort;
if (rpf == 1)
- goto e_inval;
+ goto e_rpf;
fl.oif = dev->ifindex;
ret = 0;
@@ -299,7 +299,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
last_resort:
if (rpf)
- goto e_inval;
+ goto e_rpf;
*spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE);
*itag = 0;
return 0;
@@ -308,6 +308,8 @@ e_inval_res:
fib_res_put(&res);
e_inval:
return -EINVAL;
+e_rpf:
+ return -EXDEV;
}
static inline __be32 sk_extract_addr(struct sockaddr *addr)
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index d930dc5..d52c9da 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -340,6 +340,9 @@ static int ip_rcv_finish(struct sk_buff *skb)
else if (err == -ENETUNREACH)
IP_INC_STATS_BH(dev_net(skb->dev),
IPSTATS_MIB_INNOROUTES);
+ else if (err == -EXDEV)
+ NET_INC_STATS_BH(dev_net(skb->dev),
+ LINUX_MIB_IPRPFILTER);
goto drop;
}
}
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 3dc9914..e320ca6 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -252,6 +252,7 @@ static const struct snmp_mib snmp4_net_list[] = {
SNMP_MIB_ITEM("TCPBacklogDrop", LINUX_MIB_TCPBACKLOGDROP),
SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP),
SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP),
+ SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER),
SNMP_MIB_SENTINEL
};
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 8495bce..d377b45 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1851,6 +1851,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
__be32 spec_dst;
struct in_device *in_dev = in_dev_get(dev);
u32 itag = 0;
+ int err;
/* Primary sanity checks. */
@@ -1865,10 +1866,12 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
if (!ipv4_is_local_multicast(daddr))
goto e_inval;
spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK);
- } else if (fib_validate_source(saddr, 0, tos, 0,
- dev, &spec_dst, &itag, 0) < 0)
- goto e_inval;
-
+ } else {
+ err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
+ &itag, 0);
+ if (err < 0)
+ goto e_err;
+ }
rth = dst_alloc(&ipv4_dst_ops);
if (!rth)
goto e_nobufs;
@@ -1920,8 +1923,10 @@ e_nobufs:
return -ENOBUFS;
e_inval:
+ err = -EINVAL;
+e_err:
in_dev_put(in_dev);
- return -EINVAL;
+ return err;
}
@@ -1985,7 +1990,6 @@ static int __mkroute_input(struct sk_buff *skb,
ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,
saddr);
- err = -EINVAL;
goto cleanup;
}
@@ -2157,13 +2161,12 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
goto brd_input;
if (res.type == RTN_LOCAL) {
- int result;
- result = fib_validate_source(saddr, daddr, tos,
+ err = fib_validate_source(saddr, daddr, tos,
net->loopback_dev->ifindex,
dev, &spec_dst, &itag, skb->mark);
- if (result < 0)
- goto martian_source;
- if (result)
+ if (err < 0)
+ goto martian_source_keep_err;
+ if (err)
flags |= RTCF_DIRECTSRC;
spec_dst = daddr;
goto local_input;
@@ -2191,7 +2194,7 @@ brd_input:
err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
&itag, skb->mark);
if (err < 0)
- goto martian_source;
+ goto martian_source_keep_err;
if (err)
flags |= RTCF_DIRECTSRC;
}
@@ -2272,8 +2275,10 @@ e_nobufs:
goto done;
martian_source:
+ err = -EINVAL;
+martian_source_keep_err:
ip_handle_martian_source(dev, in_dev, skb, daddr, saddr);
- goto e_inval;
+ goto done;
}
int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
^ permalink raw reply related
* Re: 64-bit net_device_stats
From: Stephen Hemminger @ 2010-06-02 21:59 UTC (permalink / raw)
To: Ben Hutchings; +Cc: David Miller, junchangwang, romieu, netdev
In-Reply-To: <1275514469.2115.70.camel@achroite.uk.solarflarecom.com>
On Wed, 02 Jun 2010 22:34:29 +0100
Ben Hutchings <bhutchings@solarflare.com> wrote:
> Changing the counter types to u64 for 32-bit architectures would remove
> atomicity and expose half-updated counters to userland. Changing the
> driver interface significantly so that atomicity is not needed would
> require changes to hundreds of drivers.
Another big issue is maintaining ABI compatibility for /proc and ioctl
interfaces. So bigger values would only be available through netlink,
and most applications using counters don't use netlink.
--
^ permalink raw reply
* Re: [PATCH 1/8] ath9k: Determine Firmware on probe
From: Luis R. Rodriguez @ 2010-06-02 21:54 UTC (permalink / raw)
To: Sujith, Marcel Holtmann; +Cc: linville, linux-wireless, linux-kernel, netdev
In-Reply-To: <19462.12578.143627.398866@gargle.gargle.HOWL>
On Wed, Jun 2, 2010 at 3:23 AM, Sujith <Sujith.Manoharan@atheros.com> wrote:
> Do not assign the FW name to driver_info but determine
> it dynamically on device probe. This facilitates adding new
> firmware.
>
> Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
> ---
> drivers/net/wireless/ath/ath9k/hif_usb.c | 39 ++++++++++++++++++++----------
> drivers/net/wireless/ath/ath9k/hif_usb.h | 1 +
> 2 files changed, 27 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
> index 77b3591..7da55eb 100644
> --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
> +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
> @@ -16,12 +16,9 @@
>
> #include "htc.h"
>
> -#define ATH9K_FW_USB_DEV(devid, fw) \
> - { USB_DEVICE(0x0cf3, devid), .driver_info = (unsigned long) fw }
> -
> static struct usb_device_id ath9k_hif_usb_ids[] = {
> - ATH9K_FW_USB_DEV(0x9271, "ar9271.fw"),
> - ATH9K_FW_USB_DEV(0x1006, "ar9271.fw"),
> + { USB_DEVICE(0x0cf3, 0x9271) },
> + { USB_DEVICE(0x0cf3, 0x1006) },
> { },
> };
>
> @@ -790,21 +787,21 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
> return -EIO;
>
> dev_info(&hif_dev->udev->dev, "ath9k_htc: Transferred FW: %s, size: %ld\n",
> - "ar9271.fw", (unsigned long) hif_dev->firmware->size);
> + hif_dev->fw_name, (unsigned long) hif_dev->firmware->size);
>
> return 0;
> }
>
> -static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev,
> - const char *fw_name)
> +static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
> {
> int ret;
>
> /* Request firmware */
> - ret = request_firmware(&hif_dev->firmware, fw_name, &hif_dev->udev->dev);
> + ret = request_firmware(&hif_dev->firmware, hif_dev->fw_name,
> + &hif_dev->udev->dev);
> if (ret) {
> dev_err(&hif_dev->udev->dev,
> - "ath9k_htc: Firmware - %s not found\n", fw_name);
> + "ath9k_htc: Firmware - %s not found\n", hif_dev->fw_name);
> goto err_fw_req;
> }
>
> @@ -820,7 +817,8 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev,
> ret = ath9k_hif_usb_download_fw(hif_dev);
> if (ret) {
> dev_err(&hif_dev->udev->dev,
> - "ath9k_htc: Firmware - %s download failed\n", fw_name);
> + "ath9k_htc: Firmware - %s download failed\n",
> + hif_dev->fw_name);
> goto err_fw_download;
> }
>
> @@ -847,7 +845,6 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
> {
> struct usb_device *udev = interface_to_usbdev(interface);
> struct hif_device_usb *hif_dev;
> - const char *fw_name = (const char *) id->driver_info;
> int ret = 0;
>
> hif_dev = kzalloc(sizeof(struct hif_device_usb), GFP_KERNEL);
> @@ -872,7 +869,23 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
> goto err_htc_hw_alloc;
> }
>
> - ret = ath9k_hif_usb_dev_init(hif_dev, fw_name);
> + /* Find out which firmware to load */
> +
> + switch(hif_dev->device_id) {
> + case 0x9271:
> + case 0x1006:
> + hif_dev->fw_name = "ar9271.fw";
> + break;
> + default:
> + break;
> + }
> +
> + if (!hif_dev->fw_name) {
> + dev_err(&udev->dev, "Can't determine firmware !\n");
> + goto err_htc_hw_alloc;
> + }
> +
> + ret = ath9k_hif_usb_dev_init(hif_dev);
> if (ret) {
> ret = -EINVAL;
> goto err_hif_init_usb;
> diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h
> index 0aca49b..b2647e8 100644
> --- a/drivers/net/wireless/ath/ath9k/hif_usb.h
> +++ b/drivers/net/wireless/ath/ath9k/hif_usb.h
> @@ -90,6 +90,7 @@ struct hif_device_usb {
> struct usb_anchor regout_submitted;
> struct usb_anchor rx_submitted;
> struct sk_buff *remain_skb;
> + const char *fw_name;
> int rx_remain_len;
> int rx_pkt_len;
> int rx_transfer_len;
I had done some something similar for ar9170 a while back [1] when
adding AVM FRITZ support to ar9170 and then got complaints from Marcel
on this approach since it requires synching the PCI device IDs in two
places. I frankly don't care how we do this but we should try to at
least stick to one way of doing this.
[1] http://osdir.com/ml/linux-wireless/2009-05/msg01219.html
Luis
^ permalink raw reply
* 64-bit net_device_stats
From: Ben Hutchings @ 2010-06-02 21:34 UTC (permalink / raw)
To: David Miller; +Cc: junchangwang, romieu, netdev
In-Reply-To: <20100525.161539.104072714.davem@davemloft.net>
On Tue, 2010-05-25 at 16:15 -0700, David Miller wrote:
[...]
> If the problem is that people want 64-bit counters available for core
> statistics on 32-bit systems, we do not fix that problem by hacking
> every single driver to provide them side-band via ethtool.
>
> First of all, we now have "struct rtnl_link_stats64" in
> linux/if_link.h, it's there to start combating this problem
> generically, for every device, rather than the way you are trying
> handle it only for one specific driver at a time.
>
> So that's the area where you should start looking to solve these kinds
> of problem.
My understand of the current situation is as follows; correct me if any
of this is wrong:
The standard counters in struct net_device_stats have type unsigned long
which is the native word size and so can be read and updated
automatically. Net drivers can update counters from the data path
without any interlocking with their ndo_get_stats implementation or the
networking core code which reads them.
The values returned by ndo_get_stats (by reference) are exposed:
- Through procfs (/proc/net/dev) as columns of numbers
- Through sysfs (/sys/class/net/*/stats/*) as single numeric strings
- Through netlink (IFLA_STATS and IFLA_STATS64) as 32-bit or 64-bit
values in binary structures
Changing the counter types to u64 for 32-bit architectures would remove
atomicity and expose half-updated counters to userland. Changing the
driver interface significantly so that atomicity is not needed would
require changes to hundreds of drivers.
Assuming the above is all correct, I think we can only solve this with a
gradual change (as for net_device_ops). The following might work:
1. a. Define struct net_device_stats64 identically to rtnl_link_stats64.
b. Add net_device_ops::ndo_get_stats64, the implementation of which
will return a pointer to such a structure. The referenced
structure must only be updated atomically, except within the
call to ndo_get_stats64.
(For 64-bit architectures, these could be macro aliases to the
existing structure and operations.)
c. On 32-bit architectures, insert unsigned long padding after each
member of struct net_device_stats.
d. Add an anonymous union in net_device; move stats into the union
and add struct net_device_stats64 stats64.
e. Change dev_get_stats() to return a pointer to struct
net_device_stats64, and to call ndo_get_stats64 if available in
preference to ndo_get_stats. Adjust callers accordingly.
f. Either change dev_get_stats() to clear the padding members, or
change drivers to ensure that the padding is cleared.
2. Change drivers to define ndo_get_stats64, following the rule
stated in 1b.
3. Much later, remove net_device_stats.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH UPDATED 1/3] vhost: replace vhost_workqueue with per-vhost kthread
From: Sridhar Samudrala @ 2010-06-02 21:34 UTC (permalink / raw)
To: Tejun Heo
Cc: Michael S. Tsirkin, Oleg Nesterov, netdev, lkml,
kvm@vger.kernel.org, Andrew Morton, Dmitri Vorobiev, Jiri Kosina,
Thomas Gleixner, Ingo Molnar, Andi Kleen
In-Reply-To: <4C06A580.9060300@kernel.org>
On 6/2/2010 11:40 AM, Tejun Heo wrote:
> Replace vhost_workqueue with per-vhost kthread. Other than callback
> argument change from struct work_struct * to struct vhost_work *,
> there's no visible change to vhost_poll_*() interface.
>
> This conversion is to make each vhost use a dedicated kthread so that
> resource control via cgroup can be applied.
>
> Partially based on Sridhar Samudrala's patch.
>
> * Updated to use sub structure vhost_work instead of directly using
> vhost_poll at Michael's suggestion.
>
> * Added flusher wake_up() optimization at Michael's suggestion.
>
> Signed-off-by: Tejun Heo<tj@kernel.org>
> Cc: Michael S. Tsirkin<mst@redhat.com>
> Cc: Sridhar Samudrala<samudrala.sridhar@gmail.com>
> ---
> Okay, just tested it. dev->work_lock had to be updated to use irq
> operations but other than that it worked just fine. Copied a large
> file using scp and it seems to perform pretty well although I don't
> have any reference of comparison. So, here's the updated version with
> the sign off.
>
I tested this with 4 VMs running netperf TCP stream tests from guest to
host and i am seeing similar
level of scalability in throughput i saw with the multi-thread workqueue
patch.
11200Mb/s - default (host cpu utilization: 40%)
21600Mb/s - multi-thread (host cpu utilization: 86%)
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
Thanks
Sridhar
> Thanks.
>
> drivers/vhost/net.c | 56 ++++++++++---------------
> drivers/vhost/vhost.c | 111 ++++++++++++++++++++++++++++++++++++++------------
> drivers/vhost/vhost.h | 38 +++++++++++------
> 3 files changed, 134 insertions(+), 71 deletions(-)
>
> Index: work/drivers/vhost/net.c
> ===================================================================
> --- work.orig/drivers/vhost/net.c
> +++ work/drivers/vhost/net.c
> @@ -294,54 +294,58 @@ static void handle_rx(struct vhost_net *
> unuse_mm(net->dev.mm);
> }
>
> -static void handle_tx_kick(struct work_struct *work)
> +static void handle_tx_kick(struct vhost_work *work)
> {
> - struct vhost_virtqueue *vq;
> - struct vhost_net *net;
> - vq = container_of(work, struct vhost_virtqueue, poll.work);
> - net = container_of(vq->dev, struct vhost_net, dev);
> + struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
> + poll.work);
> + struct vhost_net *net = container_of(vq->dev, struct vhost_net, dev);
> +
> handle_tx(net);
> }
>
> -static void handle_rx_kick(struct work_struct *work)
> +static void handle_rx_kick(struct vhost_work *work)
> {
> - struct vhost_virtqueue *vq;
> - struct vhost_net *net;
> - vq = container_of(work, struct vhost_virtqueue, poll.work);
> - net = container_of(vq->dev, struct vhost_net, dev);
> + struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
> + poll.work);
> + struct vhost_net *net = container_of(vq->dev, struct vhost_net, dev);
> +
> handle_rx(net);
> }
>
> -static void handle_tx_net(struct work_struct *work)
> +static void handle_tx_net(struct vhost_work *work)
> {
> - struct vhost_net *net;
> - net = container_of(work, struct vhost_net, poll[VHOST_NET_VQ_TX].work);
> + struct vhost_net *net = container_of(work, struct vhost_net,
> + poll[VHOST_NET_VQ_TX].work);
> handle_tx(net);
> }
>
> -static void handle_rx_net(struct work_struct *work)
> +static void handle_rx_net(struct vhost_work *work)
> {
> - struct vhost_net *net;
> - net = container_of(work, struct vhost_net, poll[VHOST_NET_VQ_RX].work);
> + struct vhost_net *net = container_of(work, struct vhost_net,
> + poll[VHOST_NET_VQ_RX].work);
> handle_rx(net);
> }
>
> static int vhost_net_open(struct inode *inode, struct file *f)
> {
> struct vhost_net *n = kmalloc(sizeof *n, GFP_KERNEL);
> + struct vhost_dev *dev;
> int r;
> +
> if (!n)
> return -ENOMEM;
> +
> + dev =&n->dev;
> n->vqs[VHOST_NET_VQ_TX].handle_kick = handle_tx_kick;
> n->vqs[VHOST_NET_VQ_RX].handle_kick = handle_rx_kick;
> - r = vhost_dev_init(&n->dev, n->vqs, VHOST_NET_VQ_MAX);
> + r = vhost_dev_init(dev, n->vqs, VHOST_NET_VQ_MAX);
> if (r< 0) {
> kfree(n);
> return r;
> }
>
> - vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT);
> - vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN);
> + vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
> + vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
> n->tx_poll_state = VHOST_NET_POLL_DISABLED;
>
> f->private_data = n;
> @@ -644,25 +648,13 @@ static struct miscdevice vhost_net_misc
>
> static int vhost_net_init(void)
> {
> - int r = vhost_init();
> - if (r)
> - goto err_init;
> - r = misc_register(&vhost_net_misc);
> - if (r)
> - goto err_reg;
> - return 0;
> -err_reg:
> - vhost_cleanup();
> -err_init:
> - return r;
> -
> + return misc_register(&vhost_net_misc);
> }
> module_init(vhost_net_init);
>
> static void vhost_net_exit(void)
> {
> misc_deregister(&vhost_net_misc);
> - vhost_cleanup();
> }
> module_exit(vhost_net_exit);
>
> Index: work/drivers/vhost/vhost.c
> ===================================================================
> --- work.orig/drivers/vhost/vhost.c
> +++ work/drivers/vhost/vhost.c
> @@ -17,12 +17,12 @@
> #include<linux/mm.h>
> #include<linux/miscdevice.h>
> #include<linux/mutex.h>
> -#include<linux/workqueue.h>
> #include<linux/rcupdate.h>
> #include<linux/poll.h>
> #include<linux/file.h>
> #include<linux/highmem.h>
> #include<linux/slab.h>
> +#include<linux/kthread.h>
>
> #include<linux/net.h>
> #include<linux/if_packet.h>
> @@ -37,8 +37,6 @@ enum {
> VHOST_MEMORY_F_LOG = 0x1,
> };
>
> -static struct workqueue_struct *vhost_workqueue;
> -
> static void vhost_poll_func(struct file *file, wait_queue_head_t *wqh,
> poll_table *pt)
> {
> @@ -52,23 +50,31 @@ static void vhost_poll_func(struct file
> static int vhost_poll_wakeup(wait_queue_t *wait, unsigned mode, int sync,
> void *key)
> {
> - struct vhost_poll *poll;
> - poll = container_of(wait, struct vhost_poll, wait);
> + struct vhost_poll *poll = container_of(wait, struct vhost_poll, wait);
> +
> if (!((unsigned long)key& poll->mask))
> return 0;
>
> - queue_work(vhost_workqueue,&poll->work);
> + vhost_poll_queue(poll);
> return 0;
> }
>
> /* Init poll structure */
> -void vhost_poll_init(struct vhost_poll *poll, work_func_t func,
> - unsigned long mask)
> +void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
> + unsigned long mask, struct vhost_dev *dev)
> {
> - INIT_WORK(&poll->work, func);
> + struct vhost_work *work =&poll->work;
> +
> init_waitqueue_func_entry(&poll->wait, vhost_poll_wakeup);
> init_poll_funcptr(&poll->table, vhost_poll_func);
> poll->mask = mask;
> + poll->dev = dev;
> +
> + INIT_LIST_HEAD(&work->node);
> + work->fn = fn;
> + init_waitqueue_head(&work->done);
> + atomic_set(&work->flushing, 0);
> + work->queue_seq = work->done_seq = 0;
> }
>
> /* Start polling a file. We add ourselves to file's wait queue. The caller must
> @@ -92,12 +98,29 @@ void vhost_poll_stop(struct vhost_poll *
> * locks that are also used by the callback. */
> void vhost_poll_flush(struct vhost_poll *poll)
> {
> - flush_work(&poll->work);
> + struct vhost_work *work =&poll->work;
> + int seq = work->queue_seq;
> +
> + atomic_inc(&work->flushing);
> + smp_mb__after_atomic_inc(); /* mb flush-b0 paired with worker-b1 */
> + wait_event(work->done, seq - work->done_seq<= 0);
> + atomic_dec(&work->flushing);
> + smp_mb__after_atomic_dec(); /* rmb flush-b1 paired with worker-b0 */
> }
>
> void vhost_poll_queue(struct vhost_poll *poll)
> {
> - queue_work(vhost_workqueue,&poll->work);
> + struct vhost_dev *dev = poll->dev;
> + struct vhost_work *work =&poll->work;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&dev->work_lock, flags);
> + if (list_empty(&work->node)) {
> + list_add_tail(&work->node,&dev->work_list);
> + work->queue_seq++;
> + wake_up_process(dev->worker);
> + }
> + spin_unlock_irqrestore(&dev->work_lock, flags);
> }
>
> static void vhost_vq_reset(struct vhost_dev *dev,
> @@ -125,10 +148,52 @@ static void vhost_vq_reset(struct vhost_
> vq->log_ctx = NULL;
> }
>
> +static int vhost_worker(void *data)
> +{
> + struct vhost_dev *dev = data;
> + struct vhost_work *work;
> +
> +repeat:
> + set_current_state(TASK_INTERRUPTIBLE); /* mb paired w/ kthread_stop */
> +
> + if (kthread_should_stop()) {
> + __set_current_state(TASK_RUNNING);
> + return 0;
> + }
> +
> + work = NULL;
> + spin_lock_irq(&dev->work_lock);
> + if (!list_empty(&dev->work_list)) {
> + work = list_first_entry(&dev->work_list,
> + struct vhost_work, node);
> + list_del_init(&work->node);
> + }
> + spin_unlock_irq(&dev->work_lock);
> +
> + if (work) {
> + __set_current_state(TASK_RUNNING);
> + work->fn(work);
> + smp_wmb(); /* wmb worker-b0 paired with flush-b1 */
> + work->done_seq = work->queue_seq;
> + smp_mb(); /* mb worker-b1 paired with flush-b0 */
> + if (atomic_read(&work->flushing))
> + wake_up_all(&work->done);
> + } else
> + schedule();
> +
> + goto repeat;
> +}
> +
> long vhost_dev_init(struct vhost_dev *dev,
> struct vhost_virtqueue *vqs, int nvqs)
> {
> + struct task_struct *worker;
> int i;
> +
> + worker = kthread_create(vhost_worker, dev, "vhost-%d", current->pid);
> + if (IS_ERR(worker))
> + return PTR_ERR(worker);
> +
> dev->vqs = vqs;
> dev->nvqs = nvqs;
> mutex_init(&dev->mutex);
> @@ -136,6 +201,9 @@ long vhost_dev_init(struct vhost_dev *de
> dev->log_file = NULL;
> dev->memory = NULL;
> dev->mm = NULL;
> + spin_lock_init(&dev->work_lock);
> + INIT_LIST_HEAD(&dev->work_list);
> + dev->worker = worker;
>
> for (i = 0; i< dev->nvqs; ++i) {
> dev->vqs[i].dev = dev;
> @@ -143,9 +211,10 @@ long vhost_dev_init(struct vhost_dev *de
> vhost_vq_reset(dev, dev->vqs + i);
> if (dev->vqs[i].handle_kick)
> vhost_poll_init(&dev->vqs[i].poll,
> - dev->vqs[i].handle_kick,
> - POLLIN);
> + dev->vqs[i].handle_kick, POLLIN, dev);
> }
> +
> + wake_up_process(worker); /* avoid contributing to loadavg */
> return 0;
> }
>
> @@ -217,6 +286,9 @@ void vhost_dev_cleanup(struct vhost_dev
> if (dev->mm)
> mmput(dev->mm);
> dev->mm = NULL;
> +
> + WARN_ON(!list_empty(&dev->work_list));
> + kthread_stop(dev->worker);
> }
>
> static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz)
> @@ -1113,16 +1185,3 @@ void vhost_disable_notify(struct vhost_v
> vq_err(vq, "Failed to enable notification at %p: %d\n",
> &vq->used->flags, r);
> }
> -
> -int vhost_init(void)
> -{
> - vhost_workqueue = create_singlethread_workqueue("vhost");
> - if (!vhost_workqueue)
> - return -ENOMEM;
> - return 0;
> -}
> -
> -void vhost_cleanup(void)
> -{
> - destroy_workqueue(vhost_workqueue);
> -}
> Index: work/drivers/vhost/vhost.h
> ===================================================================
> --- work.orig/drivers/vhost/vhost.h
> +++ work/drivers/vhost/vhost.h
> @@ -5,13 +5,13 @@
> #include<linux/vhost.h>
> #include<linux/mm.h>
> #include<linux/mutex.h>
> -#include<linux/workqueue.h>
> #include<linux/poll.h>
> #include<linux/file.h>
> #include<linux/skbuff.h>
> #include<linux/uio.h>
> #include<linux/virtio_config.h>
> #include<linux/virtio_ring.h>
> +#include<asm/atomic.h>
>
> struct vhost_device;
>
> @@ -20,19 +20,31 @@ enum {
> VHOST_NET_MAX_SG = MAX_SKB_FRAGS + 2,
> };
>
> +struct vhost_work;
> +typedef void (*vhost_work_fn_t)(struct vhost_work *work);
> +
> +struct vhost_work {
> + struct list_head node;
> + vhost_work_fn_t fn;
> + wait_queue_head_t done;
> + atomic_t flushing;
> + int queue_seq;
> + int done_seq;
> +};
> +
> /* Poll a file (eventfd or socket) */
> /* Note: there's nothing vhost specific about this structure. */
> struct vhost_poll {
> poll_table table;
> wait_queue_head_t *wqh;
> wait_queue_t wait;
> - /* struct which will handle all actual work. */
> - struct work_struct work;
> + struct vhost_work work;
> unsigned long mask;
> + struct vhost_dev *dev;
> };
>
> -void vhost_poll_init(struct vhost_poll *poll, work_func_t func,
> - unsigned long mask);
> +void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
> + unsigned long mask, struct vhost_dev *dev);
> void vhost_poll_start(struct vhost_poll *poll, struct file *file);
> void vhost_poll_stop(struct vhost_poll *poll);
> void vhost_poll_flush(struct vhost_poll *poll);
> @@ -63,7 +75,7 @@ struct vhost_virtqueue {
> struct vhost_poll poll;
>
> /* The routine to call when the Guest pings us, or timeout. */
> - work_func_t handle_kick;
> + vhost_work_fn_t handle_kick;
>
> /* Last available index we saw. */
> u16 last_avail_idx;
> @@ -86,11 +98,11 @@ struct vhost_virtqueue {
> struct iovec hdr[VHOST_NET_MAX_SG];
> size_t hdr_size;
> /* We use a kind of RCU to access private pointer.
> - * All readers access it from workqueue, which makes it possible to
> - * flush the workqueue instead of synchronize_rcu. Therefore readers do
> + * All readers access it from worker, which makes it possible to
> + * flush the vhost_work instead of synchronize_rcu. Therefore readers do
> * not need to call rcu_read_lock/rcu_read_unlock: the beginning of
> - * work item execution acts instead of rcu_read_lock() and the end of
> - * work item execution acts instead of rcu_read_lock().
> + * vhost_work execution acts instead of rcu_read_lock() and the end of
> + * vhost_work execution acts instead of rcu_read_lock().
> * Writers use virtqueue mutex. */
> void *private_data;
> /* Log write descriptors */
> @@ -110,6 +122,9 @@ struct vhost_dev {
> int nvqs;
> struct file *log_file;
> struct eventfd_ctx *log_ctx;
> + spinlock_t work_lock;
> + struct list_head work_list;
> + struct task_struct *worker;
> };
>
> long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue *vqs, int nvqs);
> @@ -136,9 +151,6 @@ bool vhost_enable_notify(struct vhost_vi
> int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
> unsigned int log_num, u64 len);
>
> -int vhost_init(void);
> -void vhost_cleanup(void);
> -
> #define vq_err(vq, fmt, ...) do { \
> pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
> if ((vq)->error_ctx) \
>
^ permalink raw reply
* Re: [PATCH v2] netfilter: Xtables: idletimer target implementation
From: Luciano Coelho @ 2010-06-02 21:01 UTC (permalink / raw)
To: ext Jan Engelhardt
Cc: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
kaber@trash.net, Timo Teras
In-Reply-To: <1275509088.2797.29.camel@powerslave>
On Wed, 2010-06-02 at 22:04 +0200, Coelho Luciano (Nokia-D/Helsinki)
wrote:
> What causes printk to appear under /sys/module even when compiled in, is
> that it uses a module param. This line:
>
> module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
>
> ...is what triggers the printk directory to be created in sysfs. If I
> add a similar line in my module, it shows up there too.
>
> I still don't know if there is an actual kobject associated with it,
> I'll check that next.
Okay, so here is how it goes: if the module is linked into the kernel
and it has module parameters, the kernel creates a kobj for it as a
module_ktype without parent, which will cause it to show up
in /sys/modules.
I could do the same in the module initialization when THIS_MODULE ==
NULL, but I don't see any other module doing this. In fact, I only see
the kernel itself creating kobjects of module_ktype (in load_module()
and in the case I just described). Smells like a terrible hack to do
that in the module itself... :(
Adding bogus parameters to the module just to trig the kernel to create
the kobject also seems to be too hacky...
--
Cheers,
Luca.
^ permalink raw reply
* Re: [PATCH net-next-2.6] net: replace hooks in __netif_receive_skb V5
From: Paul E. McKenney @ 2010-06-02 20:43 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Stephen Hemminger, Jiri Pirko, netdev, davem, kaber
In-Reply-To: <1275491722.2725.184.camel@edumazet-laptop>
On Wed, Jun 02, 2010 at 05:15:22PM +0200, Eric Dumazet wrote:
> Le mercredi 02 juin 2010 à 08:07 -0700, Stephen Hemminger a écrit :
> > On Wed, 2 Jun 2010 09:52:08 +0200
> > Jiri Pirko <jpirko@redhat.com> wrote:
> >
> > > +
> > > + err = netdev_rx_handler_register(dev, macvlan_handle_frame);
> > > + if (err) {
> > > + rcu_assign_pointer(dev->macvlan_port, NULL);
> > > + kfree(port);
> > > + }
> > > +
> > > + return err;
> > > }
> >
> > Rcu assign is not necessary here for because the hook didn't
> > get registered so there is no way for other CPU to see it.
> >
>
> Thats a valid point, but we should use it, and not care of this litle
> detail. Compiler generates same code anyway, since NULL value is tested
> by rcu_assign_pointer().
>
> If we dont use rcu_assign_pointer() ourself, Paul or Arnd will put it
> one day or another :)
>
> http://lkml.org/lkml/2010/6/1/290
Some year soon, I hope. ;-)
Thanx, Paul
^ permalink raw reply
* [PATCH] sfc: Store port number in net_device::dev_id
From: Ben Hutchings @ 2010-06-02 20:39 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
This exposes the port number to userland through sysfs.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
Following on from the earlier discussion of dev_id, here's the necessary
change for sfc. This depends on commit dd8f61d "sfc: Get port number
from CS_PORT_NUM, not PCI function number". Please consider including
both of these in net-2.6.
Ben.
drivers/net/sfc/net_driver.h | 4 +---
drivers/net/sfc/siena.c | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 6b2e440..a8783b4 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -649,7 +649,6 @@ union efx_multicast_hash {
* struct efx_nic - an Efx NIC
* @name: Device name (net device name or bus id before net device registered)
* @pci_dev: The PCI device
- * @port_num: Index of this host port within the controller
* @type: Controller type attributes
* @legacy_irq: IRQ number
* @workqueue: Workqueue for port reconfigures and the HW monitor.
@@ -733,7 +732,6 @@ union efx_multicast_hash {
struct efx_nic {
char name[IFNAMSIZ];
struct pci_dev *pci_dev;
- unsigned port_num;
const struct efx_nic_type *type;
int legacy_irq;
struct workqueue_struct *workqueue;
@@ -836,7 +834,7 @@ static inline const char *efx_dev_name(struct efx_nic *efx)
static inline unsigned int efx_port_num(struct efx_nic *efx)
{
- return efx->port_num;
+ return efx->net_dev->dev_id;
}
/**
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c
index 7ecd255..f2b1e61 100644
--- a/drivers/net/sfc/siena.c
+++ b/drivers/net/sfc/siena.c
@@ -222,7 +222,7 @@ static int siena_probe_nic(struct efx_nic *efx)
}
efx_reado(efx, ®, FR_AZ_CS_DEBUG);
- efx->port_num = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1;
+ efx->net_dev->dev_id = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1;
efx_mcdi_init(efx);
--
1.6.2.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related
* [PATCH] epic100: Test __BIG_ENDIAN instead of (non-existent) CONFIG_BIG_ENDIAN
From: Roland Dreier @ 2010-06-02 20:36 UTC (permalink / raw)
To: David S. Miller, netdev
Probably no one has used this driver on big-endian systems, since it was
setting up descriptor swapping if CONFIG_BIG_ENDIAN is set, which it
never is, since that symbol is not mentioned anywhere else in the kernel
source. Switch this test to a check for __BIG_ENDIAN so it has a chance
at working.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
---
drivers/net/epic100.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index 6838dfc..4c27465 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -87,6 +87,7 @@ static int rx_copybreak;
#include <linux/bitops.h>
#include <asm/io.h>
#include <asm/uaccess.h>
+#include <asm/byteorder.h>
/* These identify the driver base version and may not be removed. */
static char version[] __devinitdata =
@@ -230,7 +231,7 @@ static const u16 media2miictl[16] = {
* The EPIC100 Rx and Tx buffer descriptors. Note that these
* really ARE host-endian; it's not a misannotation. We tell
* the card to byteswap them internally on big-endian hosts -
- * look for #ifdef CONFIG_BIG_ENDIAN in epic_open().
+ * look for #ifdef __BIG_ENDIAN in epic_open().
*/
struct epic_tx_desc {
@@ -690,7 +691,7 @@ static int epic_open(struct net_device *dev)
outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL);
/* Tell the chip to byteswap descriptors on big-endian hosts */
-#ifdef CONFIG_BIG_ENDIAN
+#ifdef __BIG_ENDIAN
outl(0x4432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
inl(ioaddr + GENCTL);
outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
@@ -806,7 +807,7 @@ static void epic_restart(struct net_device *dev)
for (i = 16; i > 0; i--)
outl(0x0008, ioaddr + TEST1);
-#ifdef CONFIG_BIG_ENDIAN
+#ifdef __BIG_ENDIAN
outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
#else
outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
--
Roland Dreier <rolandd@cisco.com> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
^ permalink raw reply related
* Re: [PATCH] IP: Increment INADDRERRORS if routing for a packet is not successful
From: Christoph Lameter @ 2010-06-02 20:11 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev, shemminger
In-Reply-To: <1275506732.2519.23.camel@edumazet-laptop>
On Wed, 2 Jun 2010, Eric Dumazet wrote:
>
> Say we have eth0 on 192.168.0.1/24 and eth1 on 192.168.0.2/24
>
> Then we cannot use rp_filter = 1, even with unicast trafic.
>
> I really dont understand why you would setup rp_filter in such a
> situation. This wont work.
rp_filter was setup in the past and it worked. Stephen fixed it in 2.6.31
for multicast and thus suddenly multicast stopped working on secondary
interfaces when we moved to 2.6.32. rp_filter having to be off is okay but
it does not feel correct.
> Now, I agree we should have a counter somewhere to help admins to
> understand their error ;)
Ah. Good.
> Here is patch I am currently testing.
>
> I finaly created a new counter, because its a linux specific check.
Looks good which does not say too much given my limited networking
knowledge.
Reviewed-by: Christoph Lameter <cl@linux-foundation.org>
^ permalink raw reply
* Re: [PATCH v2] netfilter: Xtables: idletimer target implementation
From: Luciano Coelho @ 2010-06-02 20:04 UTC (permalink / raw)
To: ext Jan Engelhardt
Cc: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
kaber@trash.net, Timo Teras
In-Reply-To: <1275508348.2797.26.camel@powerslave>
On Wed, 2010-06-02 at 21:52 +0200, Coelho Luciano (Nokia-D/Helsinki)
wrote:
> On Wed, 2010-06-02 at 21:29 +0200, ext Jan Engelhardt wrote:
> > On Wednesday 2010-06-02 21:05, Luciano Coelho wrote:
> > >> > >+ idletimer_tg_kobj = kobject_create_and_add("idletimer",
> > >> > >+ &THIS_MODULE->mkobj.kobj);
> > >> >
> > >> > Isn't this going to oops when you compile this module as =y?
> > >>
> > >> Damn, that's true. :(
> > >>
> > >> I'll investigate how to fix this.
> > >
> > >Would it be too hacky to force it to be a module (ie. add "depends on m"
> > >in Kconfig)?
> > >
> > >Besides /sys/module/xt_IDLETIMER and /sys/class/net, which we have
> > >already discarded, I can't find any other place that would make sense to
> > >add the idletimer in the kernel object hierarchy...
> >
> > While THIS_MODULE is NULL in =y mode, /sys/module/<xyz> can still exist
> > (cf. /sys/module/printk). I just don't know how to get at the kobj for
> > it, but the existence of it must mean it's there somewhere. Might ask
> > sysfs authors.
>
> Okay, good to know. My initial theory was that /sys/module/xt_IDLETIMER
> (pointed to by THIS_MODULE) would exist even if it was linked into the
> kernel itself, but now it's obvious that it doesn't.
>
> I'll investigate how printk does that.
What causes printk to appear under /sys/module even when compiled in, is
that it uses a module param. This line:
module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
...is what triggers the printk directory to be created in sysfs. If I
add a similar line in my module, it shows up there too.
I still don't know if there is an actual kobject associated with it,
I'll check that next.
--
Cheers,
Luca.
^ permalink raw reply
* Re: [PATCH 3/3] net: deliver skbs on inactive slaves to exact matches
From: Jay Vosburgh @ 2010-06-02 20:01 UTC (permalink / raw)
To: David Miller; +Cc: john.r.fastabend, andy, nhorman, bonding-devel, netdev
In-Reply-To: <20100602.033623.84369970.davem@davemloft.net>
David Miller <davem@davemloft.net> wrote:
>From: John Fastabend <john.r.fastabend@intel.com>
>Date: Wed, 26 May 2010 21:52:58 -0700
>
>> I know you were looking over this series at one point. Did you have
>> any comments? Sorry for the ping just wanted to keep this on my
>> radar.
>
>I'll hold this last one until Jay has a chance to comment on it.
I've looked at it, and was initially hoping to combine this with
Andy/Neil's vaguely similar changes, but I don't see a reasonable way to
do that.
I think the functionality is reasonable, i.e., adding a facility
to implement "direct bind" delivery of packets on inactive bonding
slaves (where direct bind means that the struct packet_type has a
non-NULL dev).
I have a couple of concerns about the patch itself:
>From: John Fastabend <john.r.fastabend@intel.com>
>Subject: [PATCH 3/3] net: deliver skbs on inactive slaves to exact matches
>To: andy@greyhouse.net, fubar@us.ibm.com, nhorman@tuxdriver.com,
> bonding-devel@lists.sourceforge.net, netdev@vger.kernel.org
>Cc: john.r.fastabend@intel.com
>Date: Thu, 13 May 2010 00:31:17 -0700
>
>Currently, the accelerated receive path for VLAN's will
>drop packets if the real device is an inactive slave and
>is not one of the special pkts tested for in
>skb_bond_should_drop(). This behavior is different then
>the non-accelerated path and for pkts over a bonded vlan.
>
>For example,
>
>vlanx -> bond0 -> ethx
>
>will be dropped in the vlan path and not delivered to any
>packet handlers at all. However,
>
>bond0 -> vlanx -> ethx
>
>and
>
>bond0 -> ethx
>
>will be delivered to handlers that match the exact dev,
>because the VLAN path checks the real_dev which is not a
>slave and netif_recv_skb() doesn't drop frames but only
>delivers them to exact matches.
>
>This patch adds a sk_buff flag which is used for tagging
>skbs that would previously been dropped and allows the
>skb to continue to skb_netif_recv(). Here we add
>logic to check for the bond_should_drop flag and if it
>is set only deliver to handlers that match exactly. This
>makes both paths above consistent and gives pkt handlers
>a way to identify skbs that come from inactive slaves.
>Without this patch in some configurations skbs will be
>delivered to handlers with exact matches and in others
>be dropped out right in the vlan path.
>
>I have tested the following 4 configurations in failover modes
>and load balancing modes.
>
># bond0 -> ethx
>
># vlanx -> bond0 -> ethx
>
># bond0 -> vlanx -> ethx
>
># bond0 -> ethx
> |
> vlanx -> --
>
>Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
>---
>
> include/linux/skbuff.h | 8 +++++++-
> net/8021q/vlan_core.c | 8 ++++++--
> net/core/dev.c | 23 +++++++++++++++++++----
> 3 files changed, 32 insertions(+), 7 deletions(-)
>
>diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>index c9525bc..5ba4fd5 100644
>--- a/include/linux/skbuff.h
>+++ b/include/linux/skbuff.h
>@@ -379,8 +379,14 @@ struct sk_buff {
>
> kmemcheck_bitfield_begin(flags2);
> __u16 queue_mapping:16;
>-#ifdef CONFIG_IPV6_NDISC_NODETYPE
>+#if defined(CONFIG_IPV6_NDISC_NODETYPE) && \
>+ (defined(CONFIG_BONDING) || defined(CONFIG_BONDING_MODULE))
>+ __u8 ndisc_nodetype:2,
>+ bond_should_drop:1;
>+#elif defined(CONFIG_IPV6_NDISC_NODETYPE)
> __u8 ndisc_nodetype:2;
>+#elif defined(CONFIG_BONDING) || defined(CONFIG_BONDING_MODULE)
>+ __u8 bond_should_drop:1;
> #endif
First, this looks like too much #ifdef soup here. None of the
bonding-specific code in the packet receive processing path has
historically been #ifdefed out; there are more examples further down in
the patch.
Second, should the field be named something generic, e.g.,
"deliver_no_wcard" to indicate its function? "bond_should_drop" doesn't
really describe what the field is used for (which is to specify that the
packet should be delivered only to non-wildcard packet handlers). With
this change, packets are never dropped outright as the result of what
the bonding "should drop" logic says.
I'm open to alternatives to using a field in the sk_buff; John's
original submission added a PACKET_DROP (to supplant PACKET_LOCAL,
PACKET_BROADCAST, etc), but that seemed like a loss of information to
me. I haven't thought of a way to efficiently accomplish John's goal
without putting state into the skb somewhere.
-J
> kmemcheck_bitfield_end(flags2);
>
>diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
>index c584a0a..57ac2d3 100644
>--- a/net/8021q/vlan_core.c
>+++ b/net/8021q/vlan_core.c
>@@ -11,8 +11,10 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
> if (netpoll_rx(skb))
> return NET_RX_DROP;
>
>+#if defined(CONFIG_BONDING) || defined(CONFIG_BONDING_MODULE)
> if (skb_bond_should_drop(skb, ACCESS_ONCE(skb->dev->master)))
>- goto drop;
>+ skb->bond_should_drop = 1;
>+#endif
> skb->skb_iif = skb->dev->ifindex;
> __vlan_hwaccel_put_tag(skb, vlan_tci);
>@@ -83,8 +85,10 @@ vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp,
> {
> struct sk_buff *p;
>
>+#if defined(CONFIG_BONDING) || defined(CONFIG_BONDING_MODULE)
> if (skb_bond_should_drop(skb, ACCESS_ONCE(skb->dev->master)))
>- goto drop;
>+ skb->bond_should_drop = 1;
>+#endif
>
> skb->skb_iif = skb->dev->ifindex;
> __vlan_hwaccel_put_tag(skb, vlan_tci);
>diff --git a/net/core/dev.c b/net/core/dev.c
>index 3dc691d..92fdff4 100644
>--- a/net/core/dev.c
>+++ b/net/core/dev.c
>@@ -2782,11 +2782,13 @@ static int __netif_receive_skb(struct sk_buff *skb)
> {
> struct packet_type *ptype, *pt_prev;
> struct net_device *orig_dev;
>- struct net_device *master;
> struct net_device *null_or_orig;
> struct net_device *orig_or_bond;
> int ret = NET_RX_DROP;
> __be16 type;
>+#if defined(CONFIG_BONDING) || defined(CONFIG_BONDING_MODULE)
>+ struct net_device *master;
>+#endif
>
> if (!skb->tstamp.tv64)
> net_timestamp(skb);
>@@ -2801,15 +2803,28 @@ static int __netif_receive_skb(struct sk_buff *skb)
> if (!skb->skb_iif)
> skb->skb_iif = skb->dev->ifindex;
>
>+ /*
>+ * bonding note: skbs received on inactive slaves should only
>+ * be delivered to pkt handlers that are exact matches. Also
>+ * the bond_should_drop flag will be set. If packet handlers
>+ * are sensitive to duplicate packets these skbs will need to
>+ * be dropped at the handler. The vlan accel path may have
>+ * already set the bond_should_drop flag.
>+ */
> null_or_orig = NULL;
> orig_dev = skb->dev;
>+#if defined(CONFIG_BONDING) || defined(CONFIG_BONDING_MODULE)
> master = ACCESS_ONCE(orig_dev->master);
>- if (master) {
>- if (skb_bond_should_drop(skb, master))
>+ if (skb->bond_should_drop)
>+ null_or_orig = orig_dev;
>+ else if (master) {
>+ if (skb_bond_should_drop(skb, master)) {
>+ skb->bond_should_drop = 1;
> null_or_orig = orig_dev; /* deliver only exact match */
>- else
>+ } else
> skb->dev = master;
> }
>+#endif
>
> __get_cpu_var(softnet_data).processed++;
>
>
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply
* Re: [PATCH v2] netfilter: Xtables: idletimer target implementation
From: Luciano Coelho @ 2010-06-02 19:52 UTC (permalink / raw)
To: ext Jan Engelhardt
Cc: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
kaber@trash.net, Timo Teras
In-Reply-To: <alpine.LSU.2.01.1006022127430.32028@obet.zrqbmnf.qr>
On Wed, 2010-06-02 at 21:29 +0200, ext Jan Engelhardt wrote:
> On Wednesday 2010-06-02 21:05, Luciano Coelho wrote:
> >> > >+ idletimer_tg_kobj = kobject_create_and_add("idletimer",
> >> > >+ &THIS_MODULE->mkobj.kobj);
> >> >
> >> > Isn't this going to oops when you compile this module as =y?
> >>
> >> Damn, that's true. :(
> >>
> >> I'll investigate how to fix this.
> >
> >Would it be too hacky to force it to be a module (ie. add "depends on m"
> >in Kconfig)?
> >
> >Besides /sys/module/xt_IDLETIMER and /sys/class/net, which we have
> >already discarded, I can't find any other place that would make sense to
> >add the idletimer in the kernel object hierarchy...
>
> While THIS_MODULE is NULL in =y mode, /sys/module/<xyz> can still exist
> (cf. /sys/module/printk). I just don't know how to get at the kobj for
> it, but the existence of it must mean it's there somewhere. Might ask
> sysfs authors.
Okay, good to know. My initial theory was that /sys/module/xt_IDLETIMER
(pointed to by THIS_MODULE) would exist even if it was linked into the
kernel itself, but now it's obvious that it doesn't.
I'll investigate how printk does that.
--
Cheers,
Luca.
^ permalink raw reply
* Re: [PATCH] phylib: Add support for the LXT973 phy.
From: Andy Fleming @ 2010-06-02 19:32 UTC (permalink / raw)
To: David Miller; +Cc: richardcochran, netdev
In-Reply-To: <20100602.065017.139108801.davem@davemloft.net>
On Wed, Jun 2, 2010 at 8:50 AM, David Miller <davem@davemloft.net> wrote:
> From: Richard Cochran <richardcochran@gmail.com>
> Date: Wed, 2 Jun 2010 14:55:27 +0200
>
>> On Tue, Jun 01, 2010 at 05:39:22PM -0500, Andy Fleming wrote:
>>> That's a bit hacky. There is a dev_flags field, which could be used
>>> for this. Probably, we should add a more general way of saying what
>>> sort of port this is. But don't use the presence and absence of
>>> "priv", as it could one day get used for a different purpose, and this
>>> seems like it would leave us open to strange bugs.
>>
>> Okay, I changed it.
>>
>> At first, I was worried about using 'dev_flags' because I couldn't
>> tell exactly who may write to this field. Looking at tg.c and
>> broadcom.c, it appears that the MAC drivers may also write this
>> field. In contrast, the 'priv' field is surely private.
>
> No, I think using dev_flags is absolutely the wrong way to do about
> this.
Yeah, I was clearly not thinking clearly. dev_flags will be
overwritten, and is not meant for this. I believe, what we should do
is add a "port" field to the PHY device, and if PCR_FIBER_SELECT is
set, then set the port field to PORT_FIBRE. I'm not entirely clear on
the semantics of that field in the ethtool cmd, but it seems like the
right idea.
>
> phy_device->priv "could one day get used for a different purpose"?
> What in the world are you smoking Andy?
>
> It's clearly a private state pointer for the PHY driver to use,
> full stop. There is absolutely no ambiguity of what this value
> is and what it is used for and who owns it. The comments in the
> layout of struct phy_device state this clearly as well.
Yes, it's private, and I would be fine with using priv, I just didn't
think that it was correct to assign priv to point at the probe
function as a mechanism for indicating that fiber is being used. I
believe that code should be more explicit than that. priv is meant to
point at private data, not to indicate an arbitrary attribute of the
link by virtue of being non-null.
Andy
^ permalink raw reply
* Re: [PATCH v2] netfilter: Xtables: idletimer target implementation
From: Jan Engelhardt @ 2010-06-02 19:29 UTC (permalink / raw)
To: Luciano Coelho
Cc: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
kaber@trash.net, Timo Teras
In-Reply-To: <1275505553.2797.2.camel@powerslave>
On Wednesday 2010-06-02 21:05, Luciano Coelho wrote:
>> > >+ idletimer_tg_kobj = kobject_create_and_add("idletimer",
>> > >+ &THIS_MODULE->mkobj.kobj);
>> >
>> > Isn't this going to oops when you compile this module as =y?
>>
>> Damn, that's true. :(
>>
>> I'll investigate how to fix this.
>
>Would it be too hacky to force it to be a module (ie. add "depends on m"
>in Kconfig)?
>
>Besides /sys/module/xt_IDLETIMER and /sys/class/net, which we have
>already discarded, I can't find any other place that would make sense to
>add the idletimer in the kernel object hierarchy...
While THIS_MODULE is NULL in =y mode, /sys/module/<xyz> can still exist
(cf. /sys/module/printk). I just don't know how to get at the kobj for
it, but the existence of it must mean it's there somewhere. Might ask
sysfs authors.
^ permalink raw reply
* [PATCH] fec: convert legacy PM hooks to dem_pm_ops
From: Denis Kirjanov @ 2010-06-02 19:27 UTC (permalink / raw)
To: davem; +Cc: s.hauer, eric, gerg, linux-arm-kernel, netdev
This patch compile tested only.
Convert legacy PM hooks to dev_pm_ops
Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
---
drivers/net/fec.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 42d9ac9..6990791 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -1339,6 +1339,8 @@ fec_drv_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+
static int
fec_suspend(struct platform_device *dev, pm_message_t state)
{
@@ -1369,15 +1371,31 @@ fec_resume(struct platform_device *dev)
return 0;
}
+static const struct dev_pm_ops fec_pm_ops = {
+ .suspend = fec_suspend,
+ .resume = fec_resume,
+ .freeze = fec_suspend,
+ .thaw = fec_resume,
+ .poweroff = fec_suspend,
+ .restore = fec_resume,
+};
+
+#define FEC_PM_OPS (&fec_pm_ops)
+
+#else /* !CONFIG_PM */
+
+#define FEC_PM_OPS NULL
+
+#endif /* !CONFIG_PM */
+
static struct platform_driver fec_driver = {
.driver = {
.name = "fec",
.owner = THIS_MODULE,
+ .pm = FEC_PM_OPS,
},
.probe = fec_probe,
.remove = __devexit_p(fec_drv_remove),
- .suspend = fec_suspend,
- .resume = fec_resume,
};
static int __init
^ permalink raw reply related
* Re: [PATCH] IP: Increment INADDRERRORS if routing for a packet is not successful
From: Eric Dumazet @ 2010-06-02 19:25 UTC (permalink / raw)
To: Christoph Lameter; +Cc: David Miller, netdev, shemminger
In-Reply-To: <alpine.DEB.2.00.1006021355040.32431@router.home>
Le mercredi 02 juin 2010 à 13:59 -0500, Christoph Lameter a écrit :
> The rp_filter is rejecting traffic coming into a NIC for which the kernel
> has a multicast join list that indicates that this traffic is expected on
> this NIC. You could consult the MC subscription list to verify that the
> traffic is coming into the right NIC.
>
> In the MC case the user can explicitly specify through which NIC the
> traffic is expected. See IP_ADD_MEMBERSHIP.
This has litle to do with MC. We certainly are not going to check MC
membership in fib_validate_source() !
Say we have eth0 on 192.168.0.1/24 and eth1 on 192.168.0.2/24
Then we cannot use rp_filter = 1, even with unicast trafic.
I really dont understand why you would setup rp_filter in such a
situation. This wont work.
Now, I agree we should have a counter somewhere to help admins to
understand their error ;)
Here is patch I am currently testing.
I finaly created a new counter, because its a linux specific check.
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 5279771..ebb0c80 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -229,6 +229,7 @@ enum
LINUX_MIB_TCPBACKLOGDROP,
LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
LINUX_MIB_TCPDEFERACCEPTDROP,
+ LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */
__LINUX_MIB_MAX
};
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 4f0ed45..e830f7a 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -284,7 +284,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
if (no_addr)
goto last_resort;
if (rpf == 1)
- goto e_inval;
+ goto e_rpf;
fl.oif = dev->ifindex;
ret = 0;
@@ -299,7 +299,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
last_resort:
if (rpf)
- goto e_inval;
+ goto e_rpf;
*spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE);
*itag = 0;
return 0;
@@ -308,6 +308,8 @@ e_inval_res:
fib_res_put(&res);
e_inval:
return -EINVAL;
+e_rpf:
+ return -EXDEV;
}
static inline __be32 sk_extract_addr(struct sockaddr *addr)
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index d930dc5..d52c9da 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -340,6 +340,9 @@ static int ip_rcv_finish(struct sk_buff *skb)
else if (err == -ENETUNREACH)
IP_INC_STATS_BH(dev_net(skb->dev),
IPSTATS_MIB_INNOROUTES);
+ else if (err == -EXDEV)
+ NET_INC_STATS_BH(dev_net(skb->dev),
+ LINUX_MIB_IPRPFILTER);
goto drop;
}
}
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 3dc9914..e320ca6 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -252,6 +252,7 @@ static const struct snmp_mib snmp4_net_list[] = {
SNMP_MIB_ITEM("TCPBacklogDrop", LINUX_MIB_TCPBACKLOGDROP),
SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP),
SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP),
+ SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER),
SNMP_MIB_SENTINEL
};
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 8495bce..3a264f7 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1851,6 +1851,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
__be32 spec_dst;
struct in_device *in_dev = in_dev_get(dev);
u32 itag = 0;
+ int err;
/* Primary sanity checks. */
@@ -1865,10 +1866,12 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
if (!ipv4_is_local_multicast(daddr))
goto e_inval;
spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK);
- } else if (fib_validate_source(saddr, 0, tos, 0,
- dev, &spec_dst, &itag, 0) < 0)
- goto e_inval;
-
+ } else {
+ err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
+ &itag, 0);
+ if (err < 0)
+ goto e_err;
+ }
rth = dst_alloc(&ipv4_dst_ops);
if (!rth)
goto e_nobufs;
@@ -1922,6 +1925,9 @@ e_nobufs:
e_inval:
in_dev_put(in_dev);
return -EINVAL;
+e_err:
+ in_dev_put(in_dev);
+ return err;
}
@@ -1985,7 +1991,6 @@ static int __mkroute_input(struct sk_buff *skb,
ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,
saddr);
- err = -EINVAL;
goto cleanup;
}
@@ -2191,7 +2196,7 @@ brd_input:
err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
&itag, skb->mark);
if (err < 0)
- goto martian_source;
+ goto martian_source_keep_err;
if (err)
flags |= RTCF_DIRECTSRC;
}
@@ -2272,8 +2277,10 @@ e_nobufs:
goto done;
martian_source:
+ err = -EINVAL;
+martian_source_keep_err:
ip_handle_martian_source(dev, in_dev, skb, daddr, saddr);
- goto e_inval;
+ goto done;
}
int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
^ 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