* Re: [PATCH 2/3] x86_64: Define 128-bit memory-mapped I/O operations
From: H. Peter Anvin @ 2012-08-22 1:37 UTC (permalink / raw)
To: Ben Hutchings
Cc: Thomas Gleixner, Ingo Molnar, netdev, linux-net-drivers, x86
In-Reply-To: <1345598601.2659.76.camel@bwh-desktop.uk.solarflarecom.com>
On 08/21/2012 06:23 PM, Ben Hutchings wrote:
> Define reado(), writeo() and their raw counterparts using SSE.
>
> Based on work by Stuart Hodgson <smhodgson@solarflare.com>.
It would be vastly better if we explicitly controlled this with
kernel_fpu_begin()/kernel_fpu_end() rather than hiding it in primitives
than might tempt the user to do very much the wrong thing.
Also, it needs to be extremely clear to the user that these operations
use the FPU, and all the requirements there need to be met, including
not using them at interrupt time.
-hpa
^ permalink raw reply
* [PATCH 3/3] sfc: Use __raw_writeo() to perform TX descriptor push where possible
From: Ben Hutchings @ 2012-08-22 1:26 UTC (permalink / raw)
To: David Miller, Thomas Gleixner, Ingo Molnar, H. Peter Anvin
Cc: netdev, linux-net-drivers, x86
In-Reply-To: <1345598275.2659.71.camel@bwh-desktop.uk.solarflarecom.com>
Use the new __raw_writeo() function for TX descriptor push where
available. This means we now use only a single PCIe transaction
on x86_64 (vs 2 before), reducing TX latency slightly.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
David,
Assuming the previous 2 patches are accepted for x86, I expect you'll
still want to take this into the net-next tree. So perhaps they should
go onto a separate branch that you can pull?
Ben.
drivers/net/ethernet/sfc/bitfield.h | 3 +++
drivers/net/ethernet/sfc/io.h | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/sfc/bitfield.h b/drivers/net/ethernet/sfc/bitfield.h
index b26a954..5feeba2 100644
--- a/drivers/net/ethernet/sfc/bitfield.h
+++ b/drivers/net/ethernet/sfc/bitfield.h
@@ -83,6 +83,9 @@ typedef union efx_qword {
/* An octword (eight-word, i.e. 16 byte) datatype - little-endian in HW */
typedef union efx_oword {
+#ifdef HAVE_INT128
+ __le128 u128;
+#endif
__le64 u64[2];
efx_qword_t qword[2];
__le32 u32[4];
diff --git a/drivers/net/ethernet/sfc/io.h b/drivers/net/ethernet/sfc/io.h
index 751d1ec..fbcdc6d 100644
--- a/drivers/net/ethernet/sfc/io.h
+++ b/drivers/net/ethernet/sfc/io.h
@@ -57,10 +57,22 @@
* current state.
*/
-#if BITS_PER_LONG == 64
+#if defined(writeo)
+#define EFX_USE_OWORD_IO 1
+#endif
+
+#if defined(readq) && defined(writeq)
#define EFX_USE_QWORD_IO 1
#endif
+#ifdef EFX_USE_OWORD_IO
+static inline void _efx_writeo(struct efx_nic *efx, __le128 value,
+ unsigned int reg)
+{
+ __raw_writeo((__force u128)value, efx->membase + reg);
+}
+#endif
+
#ifdef EFX_USE_QWORD_IO
static inline void _efx_writeq(struct efx_nic *efx, __le64 value,
unsigned int reg)
@@ -235,7 +247,9 @@ static inline void _efx_writeo_page(struct efx_nic *efx, efx_oword_t *value,
"writing register %x with " EFX_OWORD_FMT "\n", reg,
EFX_OWORD_VAL(*value));
-#ifdef EFX_USE_QWORD_IO
+#if defined(EFX_USE_OWORD_IO)
+ _efx_writeo(efx, value->u128, reg);
+#elif defined(EFX_USE_QWORD_IO)
_efx_writeq(efx, value->u64[0], reg + 0);
_efx_writeq(efx, value->u64[1], reg + 8);
#else
--
1.7.7.6
--
Ben Hutchings, Staff Engineer, Solarflare
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 2/3] x86_64: Define 128-bit memory-mapped I/O operations
From: Ben Hutchings @ 2012-08-22 1:23 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
Cc: netdev, linux-net-drivers, x86
In-Reply-To: <1345598275.2659.71.camel@bwh-desktop.uk.solarflarecom.com>
Define reado(), writeo() and their raw counterparts using SSE.
Based on work by Stuart Hodgson <smhodgson@solarflare.com>.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
arch/x86/Kconfig.cpu | 4 +++
arch/x86/include/asm/io.h | 14 +++++++++
arch/x86/lib/Makefile | 1 +
arch/x86/lib/oword_io.c | 65 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 84 insertions(+), 0 deletions(-)
create mode 100644 arch/x86/lib/oword_io.c
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 706e12e..802508e 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -372,6 +372,10 @@ config X86_USE_3DNOW
def_bool y
depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML
+config X86_USE_SSE
+ def_bool y
+ depends on X86_64
+
config X86_OOSTORE
def_bool y
depends on (MWINCHIP3D || MWINCHIPC6) && MTRR
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index d8e8eef..06b3e23 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -95,6 +95,20 @@ build_mmio_write(writeq, "q", unsigned long, "r", :"memory")
#endif
+#ifdef CONFIG_X86_USE_SSE
+
+u128 reado(const volatile void __iomem *addr);
+void writeo(u128 val, volatile void __iomem *addr);
+
+#define __raw_reado(addr) reado(addr)
+#define __raw_writeo(val, addr) writeo(val, addr)
+
+/* Let people know that we have them */
+#define reado reado
+#define writeo writeo
+
+#endif
+
/**
* virt_to_phys - map virtual addresses to physical
* @address: address to remap
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index b00f678..1791198 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -25,6 +25,7 @@ lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o
obj-y += msr.o msr-reg.o msr-reg-export.o
+obj-$(CONFIG_X86_USE_SSE) += oword_io.o
ifeq ($(CONFIG_X86_32),y)
obj-y += atomic64_32.o
diff --git a/arch/x86/lib/oword_io.c b/arch/x86/lib/oword_io.c
new file mode 100644
index 0000000..8189bf3
--- /dev/null
+++ b/arch/x86/lib/oword_io.c
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * 128-bit MMIO for x86
+ * Copyright 2012 Solarflare Communications Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation, incorporated herein by reference.
+ */
+
+#include <linux/export.h>
+#include <linux/preempt.h>
+#include <linux/types.h>
+#include <asm/io.h>
+
+/*
+ * We copy the data between a memory buffer and the MMIO address via
+ * register xmm0. We have to save and restore the SSE state, and
+ * disable preemption. Only the MMIO address is required to be
+ * 128-bit aligned, since the stack generally is not.
+ */
+
+u128 reado(const volatile void __iomem *addr)
+{
+ u128 ret;
+ u64 cr0;
+ u128 xmm0;
+
+ preempt_disable();
+ asm volatile (
+ "movq %%cr0,%0\n\t"
+ "clts\n\t"
+ "movups %%xmm0,%1\n\t"
+ "movaps %3,%%xmm0\n\t"
+ "movups %%xmm0,%2\n\t"
+ "sfence\n\t"
+ "movups %1,%%xmm0\n\t"
+ "movq %0,%%cr0\n\t"
+ : "=r"(cr0), "=m"(xmm0), "=m"(ret)
+ : "m"(*(const volatile u128 __iomem *)addr));
+ preempt_enable();
+
+ return ret;
+}
+EXPORT_SYMBOL(reado);
+
+void writeo(u128 val, volatile void __iomem *addr)
+{
+ u64 cr0;
+ u128 xmm0;
+
+ preempt_disable();
+ asm volatile (
+ "movq %%cr0,%0\n\t"
+ "clts\n\t"
+ "movups %%xmm0,%1\n\t"
+ "movups %3,%%xmm0\n\t"
+ "movaps %%xmm0,%2\n\t"
+ "sfence\n\t"
+ "movups %1,%%xmm0\n\t"
+ "movq %0,%%cr0\n\t"
+ : "=r"(cr0), "=m"(xmm0), "=m"(*(volatile u128 __iomem *)addr)
+ : "m"(val));
+ preempt_enable();
+}
+EXPORT_SYMBOL(writeo);
--
1.7.7.6
--
Ben Hutchings, Staff Engineer, Solarflare
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 1/3] x86_64: Define 128-bit types for kernel code only
From: Ben Hutchings @ 2012-08-22 1:20 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
Cc: netdev, linux-net-drivers, x86
In-Reply-To: <1345598275.2659.71.camel@bwh-desktop.uk.solarflarecom.com>
These types will initially be used for 128-bit I/O operations.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
I'm not sure whether there is any point in all the _t type aliases, but
they're defined for all the other explicit-width types.
Ben.
arch/x86/include/asm/types.h | 8 ++++++++
include/linux/types.h | 12 ++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
index 8e8c23f..0829082 100644
--- a/arch/x86/include/asm/types.h
+++ b/arch/x86/include/asm/types.h
@@ -3,4 +3,12 @@
#include <asm-generic/types.h>
+#ifdef __KERNEL__
+#if defined(CONFIG_X86_64) && !defined(__ASSEMBLY__) && !defined(_SETUP)
+#define HAVE_INT128
+typedef __int128 s128;
+typedef unsigned __int128 u128;
+#endif
+#endif
+
#endif /* _ASM_X86_TYPES_H */
diff --git a/include/linux/types.h b/include/linux/types.h
index 9c1bd53..46e67ad 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -127,6 +127,12 @@ typedef __s64 int64_t;
#define aligned_be64 __be64 __attribute__((aligned(8)))
#define aligned_le64 __le64 __attribute__((aligned(8)))
+#ifdef HAVE_INT128
+typedef u128 u_int128_t;
+typedef u128 uint128_t;
+typedef s128 int128_t;
+#endif
+
/**
* The type used for indexing onto a disc or disc partition.
*
@@ -199,6 +205,12 @@ typedef __u32 __bitwise __wsum;
#define __aligned_le64 __le64 __attribute__((aligned(8)))
#ifdef __KERNEL__
+
+#ifdef HAVE_INT128
+typedef u128 __bitwise __le128;
+typedef u128 __bitwise __be128;
+#endif
+
typedef unsigned __bitwise__ gfp_t;
typedef unsigned __bitwise__ fmode_t;
--
1.7.7.6
--
Ben Hutchings, Staff Engineer, Solarflare
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 0/3] x86_64, sfc: 128-bit memory-mapped I/O
From: Ben Hutchings @ 2012-08-22 1:17 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
Cc: netdev, linux-net-drivers, x86
Current Solarflare network controllers have 128-bit memory-mapped
registers which are normally accessed through a series of I/O
operations. However, it is also possible to access them with a single
MOVAPS instruction on x86_64, and this is measurably faster as it
requires only one PCIe transaction.
This series introduces reado(), writeo() and the corresponding raw
operations on x86_64. These could also be implemented on i386 with an
appropriate CPU selection, but it would require u128 etc. to be defined
as structure types.
The sfc driver can potentially take advantage of both 128-bit reads and
writes, but as a first step this changes only one particular write that
may be done on the data path.
Ben.
Ben Hutchings (3):
x86_64: Define 128-bit types for kernel code only
x86_64: Define 128-bit memory-mapped I/O operations
sfc: Use __raw_writeo() to perform TX descriptor push where possible
arch/x86/Kconfig.cpu | 4 ++
arch/x86/include/asm/io.h | 14 +++++++
arch/x86/include/asm/types.h | 8 ++++
arch/x86/lib/Makefile | 1 +
arch/x86/lib/oword_io.c | 65 +++++++++++++++++++++++++++++++++++
drivers/net/ethernet/sfc/bitfield.h | 3 ++
drivers/net/ethernet/sfc/io.h | 18 ++++++++-
include/linux/types.h | 12 ++++++
8 files changed, 123 insertions(+), 2 deletions(-)
create mode 100644 arch/x86/lib/oword_io.c
--
1.7.7.6
--
Ben Hutchings, Staff Engineer, Solarflare
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: [GIT] Networking
From: Al Viro @ 2012-08-22 0:08 UTC (permalink / raw)
To: David Miller; +Cc: torvalds, akpm, netdev, linux-kernel
In-Reply-To: <20120821.163823.1448570709635488157.davem@davemloft.net>
On Tue, Aug 21, 2012 at 04:38:23PM -0700, David Miller wrote:
> 8) Fix all the netprio file handling bugs found by Al Viro, from John
> Fastabend.
Great, I was just about to start figuring out how to deal with inter-tree
dependencies; now I'll just rebase my internal queue ;-) (I've added
iterate_fd(files, from, callback) that goes through the descriptor
table starting at given fd, calling the non-blocking callback for files in
there until the callback returns 0; that kills open-coded loops of that
kind in tty_io and netprio, as well as most of the crap in selinux
flush_unauthorized_files(); for now I just have a copy of John's patch
in my tree, but if it's about to go into the mainline - great, less
potential PITA for me).
^ permalink raw reply
* [GIT] Networking
From: David Miller @ 2012-08-21 23:38 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
A couple weeks of bug fixing in there. The largest chunk is all the
broken crap Amerigo Wang found in the netpoll layer.
1) netpoll and it's users has several serious bugs:
a) uses GFP_KERNEL with locks held
b) interfaces requiring interrupts disabled are called with them
enabled
c) and vice versa
d) VLAN tag demuxing, as per all other RX packet input paths, is
not applied
All from Amerigo Wang.
2) Hopefully cure the ipv4 mapped ipv6 address TCP early demux bugs
for good, from Neal Cardwell.
3) Unlike AF_UNIX, AF_PACKET sockets don't set a default credentials
when the user doesn't specify one explicitly during sendmsg().
Instead we attach an empty (zero) SCM credential block which
is definitely not what we want. Fix from Eric Dumazet.
4) IPv6 illegally invokes netdevice notifiers with RCU lock held, fix
from Ben Hutchings.
5) inet_csk_route_child_sock() checks wrong inet options pointer, fix
from Christoph Paasch.
6) When AF_PACKET is used for transmit, packet loopback doesn't behave
properly when a socket fanout is enabled, from Eric Leblond.
7) On bluetooth l2cap channel create failure, we leak the socket, from
Jaganath Kanakkassery.
8) Fix all the netprio file handling bugs found by Al Viro, from John
Fastabend.
9) Several error return and NULL deref bug fixes in networking drivers
from Julia Lawall.
10) A large smattering of struct padding et al. kernel memory leaks
to userspace found of Mathias Krause.
11) Conntrack expections in netfilter can access an uninitialized timer,
fix from Pablo Neira Ayuso.
12) Several netfilter SIP tracker bug fixes from Patrick McHardy.
13) IPSEC ipv6 routes are not initialized correctly all the time,
resulting in an OOPS in inet_putpeer(). Also from Patrick
McHardy.
14) Bridging does rcu_dereference() outside of RCU protected area,
from Stephen Hemminger.
15) Fix routing cache removal performance regression when looking up
output routes that have a local destination. From Zheng Yan.
Please pull, thanks a lot!
The following changes since commit ddf343f635fe4440cad528e12f96f28bd50aa099:
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux (2012-08-14 07:58:59 +0300)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
for you to fetch changes up to e0e3cea46d31d23dc40df0a49a7a2c04fe8edfea:
af_netlink: force credentials passing [CVE-2012-3520] (2012-08-21 14:53:01 -0700)
----------------------------------------------------------------
Alexey Khoroshilov (1):
rndis_wlan: Fix potential memory leak in update_pmkid()
Amerigo Wang (15):
netpoll: use GFP_ATOMIC in slave_enable_netpoll() and __netpoll_setup()
netpoll: make __netpoll_cleanup non-block
netconsole: do not release spin_lock when calling __netpoll_cleanup
netpoll: take rcu_read_lock_bh() in netpoll_rx()
netpoll: use netpoll_rx_on() in netpoll_rx()
netpoll: take rcu_read_lock_bh() in netpoll_send_skb_on_dev()
bridge: add some comments for NETDEV_RELEASE
bridge: use list_for_each_entry() in netpoll functions
netpoll: check netpoll tx status on the right device
netpoll: convert several functions to bool
vlan: clean up some variable names
vlan: clean up vlan_dev_hard_start_xmit()
netpoll: handle vlan tags in netpoll tx and rx path
netpoll: re-enable irq in poll_napi()
netconsole: remove a redundant netconsole_target_put()
Andrei Emeltchenko (1):
Bluetooth: smp: Fix possible NULL dereference
Ben Hutchings (4):
llc2: Fix silent failure of llc_station_init()
llc2: Call llc_station_exit() on llc2_init() failure path
llc: Fix races between llc2 handler use and (un)registration
ipv6: addrconf: Avoid calling netdevice notifiers with RCU read-side lock
Bjørn Mork (5):
net: qmi_wwan: use fixed interface number matching
net: qmi_wwan: add Sierra Wireless devices
net: qmi_wwan: compress device_id list using macros
net: sierra_net: replace whitelist with ifnumber match
net: qmi_wwan: new devices: UML290 and K5006-Z
Bob Copeland (1):
ath5k: fix spin_lock_irqsave/spin_lock_bh nesting in mesh
Christoph Paasch (1):
ipv4: Use newinet->inet_opt in inet_csk_route_child_sock()
Dan Carpenter (1):
wireless: at76c50x: signedness bug in at76_dfu_get_state()
David S. Miller (2):
Merge branch 'for-davem' of git://git.kernel.org/.../linville/wireless
Merge git://1984.lsi.us.es/nf
Dirk Gouders (1):
netconsole.txt: revision of examples for the receiver of kernel messages
Eric Dumazet (3):
tcp: fix possible socket refcount problem
ipv4: fix ip header ident selection in __ip_make_skb()
af_netlink: force credentials passing [CVE-2012-3520]
Eric Leblond (1):
af_packet: don't emit packet on orig fanout group
Felix Fietkau (1):
ath9k: fix interrupt storms on queued hardware reset
Gustavo Padovan (1):
Bluetooth: Fix possible deadlock in SCO code
Igor Maravic (1):
net: ipv6: proc: Fix error handling
Jaganath Kanakkassery (1):
Bluetooth: Fix socket not getting freed if l2cap channel create fails
Jason Wang (1):
act_mirred: do not drop packets when fails to mirror it
Jesper Juhl (1):
caif: Do not dereference NULL in chnl_recv_cb()
John Fastabend (3):
net: netprio: fix files lock and remove useless d_path bits
net: netprio: fd passed in SCM_RIGHTS datagram not set correctly
net: netprio: fix cgrp create and write priomap race
John W. Linville (2):
Merge branch 'master' of git://git.kernel.org/.../bluetooth/bluetooth
Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
Julia Lawall (6):
drivers/net/ethernet/ti/davinci_cpdma.c: Remove potential NULL dereference
drivers/net/ethernet/freescale/fs_enet: fix error return code
drivers/net/ethernet/mellanox/mlx4/mcg.c: fix error return code
drivers/net/wimax/i2400m/fw.c: fix error return code
drivers/net/wan/dscc4.c: fix error return code
drivers/net/irda: fix error return code
Kelvin Cheung (1):
net/stmmac: fix issue of clk_get for Loongson1B.
Lorenzo Bianconi (1):
ath9k: fix decrypt_error initialization in ath_rx_tasklet()
Manoj Iyer (1):
Bluetooth: btusb: Add vendor specific ID (0a5c:21f4) BCM20702A0
Mathias Krause (14):
atm: fix info leak in getsockopt(SO_ATMPVC)
atm: fix info leak via getsockname()
Bluetooth: HCI - Fix info leak in getsockopt(HCI_FILTER)
Bluetooth: HCI - Fix info leak via getsockname()
Bluetooth: RFCOMM - Fix info leak in getsockopt(BT_SECURITY)
Bluetooth: RFCOMM - Fix info leak in ioctl(RFCOMMGETDEVLIST)
Bluetooth: RFCOMM - Fix info leak via getsockname()
Bluetooth: L2CAP - Fix info leak via getsockname()
l2tp: fix info leak via getsockname()
llc: fix info leak via getsockname()
dccp: check ccid before dereferencing
dccp: fix info leak via getsockopt(DCCP_SOCKOPT_CCID_TX_INFO)
ipvs: fix info leak in getsockopt(IP_VS_SO_GET_TIMEOUT)
net: fix info leak in compat dev_ifconf()
Neal Cardwell (1):
net: tcp: move sk_rx_dst_set call after tcp_create_openreq_child()
Pablo Neira Ayuso (2):
netfilter: ctnetlink: fix missing locking while changing conntrack from nfqueue
netfilter: nf_ct_expect: fix possible access to uninitialized timer
Patrick McHardy (4):
netfilter: nf_ct_sip: fix helper name
netfilter: nf_ct_sip: fix IPv6 address parsing
netfilter: nf_nat_sip: fix via header translation with multiple parameters
net: ipv6: fix oops in inet_putpeer()
Peng Chen (1):
Bluetooth: add support for atheros 0489:e057
Phil Edworthy (1):
net: sh_eth: Add eth support for R8A7779 device
Rajkumar Manoharan (1):
ath9k: stop btcoex on device suspend
Ram Malovany (3):
Bluetooth: Fix using NULL inquiry entry
Bluetooth: Fix using a NULL inquiry cache entry
Bluetooth: Set name_state to unknown when entry name is empty
Randy Dunlap (1):
net/core/dev.c: fix kernel-doc warning
Stephen Hemminger (1):
bridge: fix rcu dereference outside of rcu_read_lock
Steve Glendinning (1):
smsc75xx: add missing entry to MAINTAINERS
Steve Hodgson (1):
vmxnet3: Fix race between dev_open() and register_netdev()
Szymon Janc (1):
Bluetooth: Fix legacy pairing with some devices
Timur Tabi (2):
dt: introduce for_each_available_child_of_node, of_get_next_available_child
netdev/phy: skip disabled mdio-mux nodes
Yan, Zheng (1):
ipv4: Cache local output routes
Documentation/networking/netconsole.txt | 19 +++-
MAINTAINERS | 6 ++
drivers/bluetooth/ath3k.c | 2 +
drivers/bluetooth/btusb.c | 2 +
drivers/net/bonding/bond_main.c | 12 ++-
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 4 +-
drivers/net/ethernet/freescale/fs_enet/mii-fec.c | 8 +-
drivers/net/ethernet/mellanox/mlx4/mcg.c | 4 +-
drivers/net/ethernet/renesas/Kconfig | 4 +-
drivers/net/ethernet/renesas/sh_eth.c | 11 ++-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
drivers/net/ethernet/ti/davinci_cpdma.c | 3 +-
drivers/net/irda/ks959-sir.c | 1 +
drivers/net/irda/ksdazzle-sir.c | 1 +
drivers/net/netconsole.c | 6 --
drivers/net/phy/mdio-mux.c | 2 +-
drivers/net/team/team.c | 16 ++--
drivers/net/usb/qmi_wwan.c | 251 +++++++++-------------------------------------------
drivers/net/usb/sierra_net.c | 52 +++--------
drivers/net/vmxnet3/vmxnet3_drv.c | 2 +-
drivers/net/wan/dscc4.c | 5 +-
drivers/net/wimax/i2400m/fw.c | 4 +-
drivers/net/wireless/at76c50x-usb.c | 2 +-
drivers/net/wireless/ath/ath5k/base.c | 6 +-
drivers/net/wireless/ath/ath5k/mac80211-ops.c | 5 +-
drivers/net/wireless/ath/ath9k/mac.c | 18 ++--
drivers/net/wireless/ath/ath9k/mac.h | 1 +
drivers/net/wireless/ath/ath9k/main.c | 4 +-
drivers/net/wireless/ath/ath9k/pci.c | 1 +
drivers/net/wireless/ath/ath9k/recv.c | 2 +-
drivers/net/wireless/rndis_wlan.c | 6 +-
drivers/of/base.c | 27 ++++++
include/linux/if_team.h | 30 +++----
include/linux/netdevice.h | 5 +-
include/linux/netfilter/nf_conntrack_sip.h | 2 +-
include/linux/netpoll.h | 42 +++++----
include/linux/of.h | 7 ++
include/net/llc.h | 2 +-
include/net/scm.h | 4 +-
include/net/xfrm.h | 2 +
net/8021q/vlan_dev.c | 52 ++++++-----
net/atm/common.c | 1 +
net/atm/pvc.c | 1 +
net/bluetooth/hci_event.c | 28 ++++--
net/bluetooth/hci_sock.c | 2 +
net/bluetooth/l2cap_core.c | 1 +
net/bluetooth/l2cap_sock.c | 3 +-
net/bluetooth/rfcomm/sock.c | 2 +
net/bluetooth/rfcomm/tty.c | 2 +-
net/bluetooth/sco.c | 19 ++--
net/bluetooth/smp.c | 5 +-
net/bridge/br_device.c | 30 +++----
net/bridge/br_forward.c | 2 +-
net/bridge/br_if.c | 6 +-
net/bridge/br_private.h | 4 +-
net/caif/chnl_net.c | 4 +
net/core/dev.c | 17 +++-
net/core/netpoll.c | 109 ++++++++++++++++-------
net/core/netprio_cgroup.c | 30 ++-----
net/core/scm.c | 4 +
net/dccp/ccid.h | 4 +-
net/dccp/ccids/ccid3.c | 1 +
net/ipv4/inet_connection_sock.c | 7 +-
net/ipv4/ip_output.c | 2 +-
net/ipv4/netfilter/nf_nat_sip.c | 9 +-
net/ipv4/route.c | 1 -
net/ipv4/tcp_ipv4.c | 9 +-
net/ipv4/tcp_minisocks.c | 2 -
net/ipv4/tcp_output.c | 14 +--
net/ipv4/tcp_timer.c | 6 +-
net/ipv6/addrconf.c | 4 +-
net/ipv6/proc.c | 4 +-
net/ipv6/tcp_ipv6.c | 25 +++---
net/ipv6/xfrm6_policy.c | 8 ++
net/l2tp/l2tp_ip6.c | 1 +
net/llc/af_llc.c | 8 +-
net/llc/llc_input.c | 21 ++++-
net/llc/llc_station.c | 23 +----
net/netfilter/ipvs/ip_vs_ctl.c | 1 +
net/netfilter/nf_conntrack_expect.c | 29 ++----
net/netfilter/nf_conntrack_netlink.c | 7 +-
net/netfilter/nf_conntrack_sip.c | 92 ++++++++++++++-----
net/netlink/af_netlink.c | 2 +-
net/packet/af_packet.c | 9 ++
net/sched/act_mirred.c | 11 ++-
net/socket.c | 1 +
net/unix/af_unix.c | 4 +-
net/xfrm/xfrm_policy.c | 2 +
88 files changed, 637 insertions(+), 575 deletions(-)
^ permalink raw reply
* [PATCH 1/1] tcp: Wrong timeout for SYN segments
From: Alex Bergmann @ 2012-08-21 23:29 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel
Hi David,
I'm not 100% sure, but it looks like I found an RFC mismatch with the
current default values of the TCP implementation.
Alex
>From 8b854a525eb45f64ad29dfab16f9d9f681e84495 Mon Sep 17 00:00:00 2001
From: Alexander Bergmann <alex@linlab.net>
Date: Wed, 22 Aug 2012 00:29:08 +0200
Subject: [PATCH 1/1] tcp: Wrong timeout for SYN segments
Commit 9ad7c049 changed the initRTO from 3secs to 1sec in accordance to
RFC6298 (former RFC2988bis). This introduced a gap with RFC1122 that
defines a minimum retransmission window for SYN segments of at least
180secs.
Prior to 9ad7c049 the timeout was defined with 189secs. Now we have only
a timeout of 63secs.
((2 << 5) - 1) * 3 secs = 189 secs
((2 << 5) - 1) * 1 secs = 63 secs
To fulfill the MUST constraint in RFC1122 section 4.2.3.5 about R2 for
SYN segments, the values of TCP_SYN_RETRIES and TCP_SYNACK_RETRIES must
be changed to 7 reties.
((2 << 7) - 1) * 1 secs = 255 secs
This would result in an ETIMEDOUT of 4 minutes 15 seconds.
Signed-off-by: Alexander Bergmann <alex@linlab.net>
---
include/net/tcp.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 1f000ff..7eaae19 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -98,10 +98,10 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
* 15 is ~13-30min depending on RTO.
*/
-#define TCP_SYN_RETRIES 5 /* number of times to retry active opening a
+#define TCP_SYN_RETRIES 7 /* number of times to retry active opening a
* connection: ~180sec is RFC minimum */
-#define TCP_SYNACK_RETRIES 5 /* number of times to retry passive opening a
+#define TCP_SYNACK_RETRIES 7 /* number of times to retry passive opening a
* connection: ~180sec is RFC minimum */
#define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME-WAIT
--
1.7.8.6
^ permalink raw reply related
* Re: [PATCH v6] bonding support for IPv6 transmit hashing
From: John Eaglesham @ 2012-08-21 22:21 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: Jeremy Brookman, netdev
In-Reply-To: <11100.1345576795@death.nxdomain>
On 8/21/2012 12:19 PM, Jay Vosburgh wrote:
> Jeremy Brookman <jeremy.brookman@gmail.com> wrote:
>
>>> You should use a mix of tabs, as necessary, to get things to line up
>>> how I told you they need to line up.
>>
>> Unless I'm missing something, this change doesn't seem to have made it
>> through to the kernel tip, but we could really use this bugfix. Is it
>> in a repository I didn't notice, or not yet through the review? If
>> it's not through the review, is any help needed to get it there?
>
> The submitter (John Eaglesham) never posted an updated version
> that addressed the various comments, nor did his original patch
> submission include a Signed-off-by.
>
> I went ahead and updated the patch to address the comments; I've
> only compile tested this. Are you (Jeremy or John) able to test this to
> confirm that it will hash ipv6 traffic as expected (I can test it, but
> it won't be today)?
>
> John, can you post a Signed-off-by for your patch (really, this
> updated version of your patch)?
>
> If John signs off and somebody tests this, I'll post a formal
> submssion with the full commit message.
>
> -J
>
Since my last submission I ended up making some changes on my end to
streamline the logic. I can fold together my patch with yours and test
them later tonight. If everything looks good I'll post the changes back
to the list.
Thanks!
John
^ permalink raw reply
* Re: [PATCH 05/19] netfilter: nf_conntrack_ipv6: improve fragmentation handling
From: Jesper Dangaard Brouer @ 2012-08-21 22:21 UTC (permalink / raw)
To: Patrick McHardy
Cc: netfilter-devel, netdev, Julian Anastasov, Hans Schillstrom,
Hans Schillstrom
In-Reply-To: <Pine.GSO.4.63.1208192141570.3016@stinky-local.trash.net>
On Sun, 2012-08-19 at 21:44 +0200, Patrick McHardy wrote:
> On Sun, 19 Aug 2012, Jesper Dangaard Brouer wrote:
> > On Sat, 2012-08-18 at 14:26 +0200, Patrick McHardy wrote:
[...]
> > Don't I need to load some of the helper modules, or just the
> > nf_conntrack_ipv6 module, or perhaps only nf_defrag_ipv6 ?
>
> Not with the entire patchset, just IPv6 conntrack is enough. Aith IPv6 NAT
> the first packet of a connection must always be defragemented, independant
> of an assigned helper.
When loading "nf_conntrack_ipv6" I run into issues.
When sending a fragmented UDP packet. With these patches, the IPVS
stack will no longer see the fragmented packets, but instead see one
large SKB. This will trigger a MTU path check in e.g.
ip_vs_dr_xmit_v6() and an ICMPv6 too big packet is send back.
IPVS: ip_vs_dr_xmit_v6(): frag needed
Perhaps we could change/fix the MTU check in IPVS?
(This would also solve issues I've seen with TSO/GSO frames, hitting
this code path).
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Sr. Network Kernel Developer at Red Hat
Author of http://www.iptv-analyzer.org
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply
* Re: [PATCH] af_netlink: force credentials passing [CVE-2012-3520]
From: David Miller @ 2012-08-21 21:53 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, pmatouse, fweimer, pablo
In-Reply-To: <1345566077.5158.530.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 21 Aug 2012 18:21:17 +0200
> From: Eric Dumazet <edumazet@google.com>
>
> Pablo Neira Ayuso discovered that avahi and
> potentially NetworkManager accept spoofed Netlink messages because of a
> kernel bug. The kernel passes all-zero SCM_CREDENTIALS ancillary data
> to the receiver if the sender did not provide such data, instead of not
> including any such data at all or including the correct data from the
> peer (as it is the case with AF_UNIX).
>
> This bug was introduced in commit 16e572626961
> (af_unix: dont send SCM_CREDENTIALS by default)
>
> This patch forces passing credentials for netlink, as
> before the regression.
>
> Another fix would be to not add SCM_CREDENTIALS in
> netlink messages if not provided by the sender, but it
> might break some programs.
>
> With help from Florian Weimer & Petr Matousek
>
> This issue is designated as CVE-2012-3520
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied and queued up for -stable, thanks Eric.
^ permalink raw reply
* Re: Bug with IPv6-UDP address binding
From: Jesper Dangaard Brouer @ 2012-08-21 21:51 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, Thomas Graf
In-Reply-To: <1344512634.28967.732.camel@edumazet-glaptop>
On Thu, 2012-08-09 at 13:43 +0200, Eric Dumazet wrote:
> Here is an IPv4 sample UDP application, able to echo packets with the IP
> source set to original DST address of the ping packet.
>
> Doing the same on IPv6 is probably trivial as well
I have implemented a combined IPv6 + IPv4 version of the udp echo code,
and placed it on github here:
https://github.com/netoptimizer/network-testing/blob/master/src/udp_echo.c
Comments and patches are welcome ;-)
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <linux/udp.h>
> #include <string.h>
> #include <stdio.h>
> #include <unistd.h>
> #include <arpa/inet.h>
>
> #define PORT 4040
>
> int pktinfo_get(struct msghdr *my_hdr, struct in_pktinfo *pktinfo)
> {
> int res = -1;
>
> if (my_hdr->msg_controllen > 0) {
> struct cmsghdr *get_cmsg;
> for (get_cmsg = CMSG_FIRSTHDR(my_hdr); get_cmsg;
> get_cmsg = CMSG_NXTHDR(my_hdr, get_cmsg)) {
> if (get_cmsg->cmsg_type == IP_PKTINFO) {
> struct in_pktinfo *get_pktinfo = (struct in_pktinfo *)CMSG_DATA(get_cmsg);
> memcpy(pktinfo, get_pktinfo, sizeof(*pktinfo));
> res = 0;
> }
> }
> }
> return res;
> }
>
> int main(int argc, char *argv[])
> {
> int fd = socket(AF_INET, SOCK_DGRAM, 0);
> struct sockaddr_in addr, rem_addr;
> int res, on = 1;
> struct msghdr msghdr;
> struct iovec vec[1];
> char cbuf[512];
> char frame[4096];
> struct in_pktinfo pktinfo;
> int c, count = 1000000;
>
> while ((c = getopt(argc, argv, "c:")) != -1) {
> if (c == 'c') count = atoi(optarg);
> }
> memset(&addr, 0, sizeof(addr));
> addr.sin_family = AF_INET;
> addr.sin_port = htons(PORT);
> if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
> perror("bind");
> return 1;
> }
> setsockopt(fd, SOL_IP, IP_PKTINFO, &on, sizeof(on));
>
> while (1) {
> memset(&msghdr, 0, sizeof(msghdr));
> msghdr.msg_control = cbuf;
> msghdr.msg_controllen = sizeof(cbuf);
> msghdr.msg_iov = vec;
> msghdr.msg_iovlen = 1;
> vec[0].iov_base = frame;
> vec[0].iov_len = sizeof(frame);
> msghdr.msg_name = &rem_addr;
> msghdr.msg_namelen = sizeof(rem_addr);
> res = recvmsg(fd, &msghdr, 0);
> if (res == -1)
> break;
> if (pktinfo_get(&msghdr, &pktinfo) == 0)
> printf("Got IP_PKTINFO dst addr=%s\n", inet_ntoa(pktinfo.ipi_spec_dst));
>
> /* ok, just echo reply this frame.
> * Using sendmsg() will provide IP_PKTINFO back to kernel
> * to let it use the 'right' source address
> * (destination address of the incoming packet)
> */
> vec[0].iov_len = res;
> sendmsg(fd, &msghdr, 0);
> if (--count == 0)
> break;
> }
> return 0;
> }
>
>
^ permalink raw reply
* Re: [PATCH] ipv4: fix ip header ident selection in __ip_make_skb()
From: David Miller @ 2012-08-21 21:51 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, shemminger, casteyde.christian
In-Reply-To: <1345483605.5158.345.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 20 Aug 2012 19:26:45 +0200
> From: Eric Dumazet <edumazet@google.com>
>
> Christian Casteyde reported a kmemcheck 32-bit read from uninitialized
> memory in __ip_select_ident().
>
> It turns out that __ip_make_skb() called ip_select_ident() before
> properly initializing iph->daddr.
>
> This is a bug uncovered by commit 1d861aa4b3fb (inet: Minimize use of
> cached route inetpeer.)
>
> Addresses https://bugzilla.kernel.org/show_bug.cgi?id=46131
>
> Reported-by: Christian Casteyde <casteyde.christian@free.fr>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Stephen Hemminger <shemminger@vyatta.com>
Applied, thanks Eric.
^ permalink raw reply
* Re: [PATCH v2] ipv4: Use newinet->inet_opt in inet_csk_route_child_sock()
From: David Miller @ 2012-08-21 21:49 UTC (permalink / raw)
To: christoph.paasch; +Cc: netdev
In-Reply-To: <1345467129-4540-1-git-send-email-christoph.paasch@uclouvain.be>
From: Christoph Paasch <christoph.paasch@uclouvain.be>
Date: Mon, 20 Aug 2012 14:52:09 +0200
> Since 0e734419923bd ("ipv4: Use inet_csk_route_child_sock() in DCCP and
> TCP."), inet_csk_route_child_sock() is called instead of
> inet_csk_route_req().
>
> However, after creating the child-sock in tcp/dccp_v4_syn_recv_sock(),
> ireq->opt is set to NULL, before calling inet_csk_route_child_sock().
> Thus, inside inet_csk_route_child_sock() opt is always NULL and the
> SRR-options are not respected anymore.
> Packets sent by the server won't have the correct destination-IP.
>
> This patch fixes it by accessing newinet->inet_opt instead of ireq->opt
> inside inet_csk_route_child_sock().
>
> Reported-by: Luca Boccassi <luca.boccassi@gmail.com>
> Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH] tcp: fix possible socket refcount problem
From: David Miller @ 2012-08-21 21:43 UTC (permalink / raw)
To: eric.dumazet; +Cc: fengguang.wu, netdev
In-Reply-To: <1345458166.5158.316.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 20 Aug 2012 12:22:46 +0200
> From: Eric Dumazet <edumazet@google.com>
>
> Commit 6f458dfb40 (tcp: improve latencies of timer triggered events)
> added bug leading to following trace :
...
> The bug comes from the fact that timer set in sk_reset_timer() can run
> before we actually do the sock_hold(). socket refcount reaches zero and
> we free the socket too soon.
>
> timer handler is not allowed to reduce socket refcnt if socket is owned
> by the user, or we need to change sk_reset_timer() implementation.
>
> We should take a reference on the socket in case TCP_DELACK_TIMER_DEFERRED
> or TCP_DELACK_TIMER_DEFERRED bit are set in tsq_flags
>
> Also fix a typo in tcp_delack_timer(), where TCP_WRITE_TIMER_DEFERRED
> was used instead of TCP_DELACK_TIMER_DEFERRED.
>
> For consistency, use same socket refcount change for TCP_MTU_REDUCED_DEFERRED,
> even if not fired from a timer.
>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Tested-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply
* Re: IP fragmentation broken in 3.6-rc ?
From: Julian Anastasov @ 2012-08-21 21:07 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Sylvain Munaut, netdev
In-Reply-To: <1345582019.5158.547.camel@edumazet-glaptop>
Hello,
On Tue, 21 Aug 2012, Eric Dumazet wrote:
> > dst_update_expires will be like dst_set_expires
> > but with this difference (time_after):
> >
> > if (dst->expires == 0 || time_after(expires, dst->expires) ||
> > !timeout)
>
> Hmm, all these tests are not really needed, what about :
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index e4ba974..8d6d320 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -956,7 +956,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
> dst->obsolete = DST_OBSOLETE_KILL;
> } else {
> rt->rt_pmtu = mtu;
> - dst_set_expires(&rt->dst, ip_rt_mtu_expires);
> + rt->dst.expires = max(1UL, jiffies + ip_rt_mtu_expires);
The best solution, I think.
> }
> }
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* Re: skb_under_panic bug
From: Xiaochun Lu @ 2012-08-21 20:50 UTC (permalink / raw)
To: Pieper, Jeffrey E; +Cc: netdev@vger.kernel.org
In-Reply-To: <2A35EA60C3C77D438915767F458D65684817FFC9@ORSMSX102.amr.corp.intel.com>
Hi, Jeff:
Have you resolved this one. I see similar issue. But my kernel is
based on 3.0.36. here is the trace:
Aug 20 20:50:51 Ericsson kernel: skb_under_panic:
text:ffffffff8133ea84 len:112 put:14 head:ffff8806187e0a00
data:ffff8806187e09f4 tail:0x64 end:0x80 dev:ethSw0.1
Aug 20 20:50:54 Ericsson kernel: ------------[ cut here ]------------
Aug 20 20:50:54 Ericsson kernel: Kernel BUG at ffffffff8131b73a
[verbose debug info unavailable]
Aug 20 20:50:54 Ericsson kernel: invalid opcode: 0000 [#1] PREEMPT SMP
Aug 20 20:50:54 Ericsson kernel: CPU 0
Aug 20 20:50:54 Ericsson kernel: Modules linked in: cls_u32 sch_htb
uio_pch_smb ixgbe mdio bonding 8021q iflc uio_spanky_shiba uio_phalanx
uio rbn_pci_hotswap msr fuse tipc sctp crc32c libcrc32c rbn_nf_ipacl
rbn_nf_tcp rbn_nf_ips rbn_ctx_kmod ipv6 rbn_ext_ip_so af_isis
af_rbn_netlink af_ipc xcrp rbn_platform loop rbn_swrp_wd igb
Aug 20 20:50:54 Ericsson kernel:
Aug 20 20:50:54 Ericsson kernel: Pid: 3616, comm: pad Not tainted
3.0.36-869-g241f2ae #2 Ericsson Smart Service Router/SWRP
Aug 20 20:50:54 Ericsson kernel: RIP: 0010:[<ffffffff8131b73a>]
[<ffffffff8131b73a>] skb_push+0x7a/0x80
Aug 20 20:50:54 Ericsson kernel: RSP: 0000:ffff88060a1f9a18 EFLAGS: 00010292
Aug 20 20:50:54 Ericsson kernel: RAX: 0000000000000088 RBX:
0000000000000800 RCX: 0000000000000000
Aug 20 20:50:54 Ericsson kernel: RDX: ffff88060a1f8010 RSI:
0000000000000000 RDI: 0000000000000001
Aug 20 20:50:54 Ericsson kernel: RBP: 0000000000000000 R08:
ffff88060a1f8000 R09: 0000000000000000
Aug 20 20:50:54 Ericsson kernel: R10: 0000000000000002 R11:
0000000000000000 R12: ffff8805ea421398
Aug 20 20:50:54 Ericsson kernel: R13: 0000000000000062 R14:
ffff880619089000 R15: ffff88061a814dd8
Aug 20 20:50:54 Ericsson kernel: FS: 0000000000000000(0000)
GS:ffff88063fc00000(0063) knlGS:00000000578d0b90
Aug 20 20:50:54 Ericsson kernel: CS: 0010 DS: 002b ES: 002b CR0:
000000008005003b
Aug 20 20:50:54 Ericsson kernel: CR2: 00002aaaaaae4000 CR3:
00000006162ab000 CR4: 00000000000006f0
Aug 20 20:50:54 Ericsson kernel: DR0: 0000000000000000 DR1:
0000000000000000 DR2: 0000000000000000
Aug 20 20:50:54 Ericsson kernel: DR3: 0000000000000000 DR6:
00000000ffff0ff0 DR7: 0000000000000400
Aug 20 20:50:54 Ericsson kernel: Process pad (pid: 3616, threadinfo
ffff88060a1f8000, task ffff88061abfbd40)
Aug 20 20:50:54 Ericsson kernel: Stack:
Aug 20 20:50:54 Ericsson kernel: 0000000000000064 0000000000000080
ffff880619089000 ffffffff8133ea84
Aug 20 20:50:54 Ericsson kernel: 000000000000017e ffff8805ea421300
ffff8805ea421390 ffff8805ea56d040
Aug 20 20:50:54 Ericsson kernel: ffff8805ea421398 ffffffff8133088e
ffff880619089000 000000000000017a
Aug 20 20:50:54 Ericsson kernel: Call Trace:
Aug 20 20:50:54 Ericsson kernel: [<ffffffff8133ea84>] ? eth_header+0x34/0xe0
Aug 20 20:50:54 Ericsson kernel: [<ffffffff8133088e>] ?
neigh_resolve_output+0x10e/0x320
Aug 20 20:50:54 Ericsson kernel: [<ffffffff81357ae1>] ?
ip_finish_output+0x1f1/0x400
Aug 20 20:50:54 Ericsson kernel: [<ffffffff81356c39>] ? ip_send_skb+0x9/0x60
Aug 20 20:50:54 Ericsson kernel: [<ffffffff8137a525>] ?
udp_send_skb+0x125/0x3c0
Aug 20 20:50:54 Ericsson kernel: [<ffffffff8137cd0a>] ? udp_sendmsg+0x73a/0x870
Aug 20 20:50:54 Ericsson kernel: [<ffffffff810ecde0>] ? __pollwait+0x120/0x120
Aug 20 20:50:54 Ericsson kernel: [<ffffffff81356210>] ?
ip_append_page+0x5e0/0x5e0
Aug 20 20:50:54 Ericsson kernel: [<ffffffff81312b50>] ?
sock_sendmsg+0x110/0x130
Aug 20 20:50:54 Ericsson kernel: [<ffffffff813128a7>] ?
sock_recvmsg+0x127/0x140
Aug 20 20:50:54 Ericsson kernel: [<ffffffff813ed091>] ?
_raw_spin_unlock_irq+0x11/0x40
Aug 20 20:50:54 Ericsson kernel: [<ffffffff810358bc>] ?
finish_task_switch+0x5c/0xd0
Aug 20 20:50:54 Ericsson kernel: [<ffffffff8111dd9a>] ?
compat_core_sys_select+0x2ba/0x2d0
Aug 20 20:50:54 Ericsson kernel: [<ffffffff810dbbdf>] ? fget_light+0xbf/0x100
Aug 20 20:50:54 Ericsson kernel: [<ffffffff813132c8>] ? sys_sendto+0x138/0x1a0
Aug 20 20:50:54 Ericsson kernel: [<ffffffff81031449>] ? get_parent_ip+0x9/0x20
Aug 20 20:50:54 Ericsson kernel: [<ffffffff81036297>] ?
sub_preempt_count+0x87/0xc0
Aug 20 20:50:54 Ericsson kernel: [<ffffffff813eb4c3>] ?
preempt_schedule_irq+0x43/0x60
Aug 20 20:50:54 Ericsson kernel: [<ffffffff813ed846>] ? retint_kernel+0x26/0x30
Aug 20 20:50:54 Ericsson kernel: [<ffffffff81060b5b>] ? ktime_get_ts+0x6b/0xd0
Aug 20 20:50:54 Ericsson kernel: [<ffffffff8133def5>] ?
compat_sys_socketcall+0x175/0x250
Aug 20 20:50:54 Ericsson kernel: [<ffffffff813eef03>] ? ia32_do_call+0x13/0x13
Aug 20 20:50:54 Ericsson kernel: Code: 8b 57 68 48 89 44 24 10 8b 87
e8 00 00 00 48 89 44 24 08 31 c0 8b bf e4 00 00 00 48 89 3c 24 48 c7
c7 50 61 4d 81 e8 c2 eb 0c 00 <0f> 0b eb fe 66 90 48 83 ec 18 89 f1 44
8b 57 6c 4c 8b 87 f0 00
Aug 20 20:50:54 Ericsson kernel: RIP [<ffffffff8131b73a>] skb_push+0x7a/0x80
Aug 20 20:50:54 Ericsson kernel: RSP <ffff88060a1f9a18>
Aug 20 20:50:54 Ericsson kernel: ---[ end trace 3856d31346ddf680 ]---
Thanks
Shawn Lu
On Tue, May 1, 2012 at 10:08 AM, Pieper, Jeffrey E
<jeffrey.e.pieper@intel.com> wrote:
> I've seen the following stack trace several times recently, and was wondering if anyone else has ran into this. This occurs during bi-directional TCP/UDP traffic (netperf) on multiple platforms/devices. Whatever is occurring also seems to invoke hdparm. I'm running 3.4.0-rc4 (recent net-next pull) with CONFIG_PREEMPT=y:
>
> skb_under_panic: text:ffffffff8130d538 len:120 put:14 head:ffff880128c89800 data:ffff880128c897f4 tail:0x6c end:0xc0 dev:eth0
> ------------[ cut here ]------------
> kernel BUG at net/core/skbuff.c:145!
> invalid opcode: 0000 [#1] PREEMPT SMP
> CPU 4
> Modules linked in: nfsd lockd exportfs sunrpc e1000e [last unloaded: scsi_wait_scan]
>
> Pid: 5030, comm: netperf Not tainted 3.4.0-rc2-net-next-e1000e-queue_20120423 #2 /DQ57TM
> RIP: 0010:[<ffffffff812ef1b4>] [<ffffffff812ef1b4>] skb_push+0x72/0x7b
> RSP: 0018:ffff8801283459d8 EFLAGS: 00010292
> RAX: 0000000000000084 RBX: ffff880127ffc000 RCX: 00000000fffffff3
> RDX: 00000000000000d6 RSI: 0000000000000046 RDI: ffffffff8162375a
> RBP: ffff8801283459f8 R08: 0000000000008d0a R09: ffff88012f019000
> R10: 0000000000000001 R11: 0000000000000078 R12: ffff880128ff6ca0
> R13: 0000000000000800 R14: 0000000000000212 R15: ffff880128ff6c98
> FS: 00007fc4c3feb700(0000) GS:ffff88012fc80000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> CR2: ffffffffff600400 CR3: 0000000127e81000 CR4: 00000000000007e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> Process netperf (pid: 5030, threadinfo ffff880128344000, task ffff8801279859d0)
> Stack:
> 000000000000006c 00000000000000c0 ffff880127ffc000 ffff880128ff6ca0
> ffff880128345a38 ffffffff8130d538 ffff88010000006a 0000000000000000
> ffffffff81300cd5 ffff88011dfad9c0 ffff880128ff6c00 ffff880127ffc000
> Call Trace:
> [<ffffffff8130d538>] eth_header+0x28/0xb4
> [<ffffffff81300cd5>] ? neigh_resolve_output+0x14d/0x19a
> [<ffffffff81300cd7>] neigh_resolve_output+0x14f/0x19a
> [<ffffffff8131c35a>] ip_finish_output+0x22f/0x271
> [<ffffffff8131c3d9>] ip_output+0x3d/0x3f
> [<ffffffff81319dd4>] ip_local_out+0x62/0x64
> [<ffffffff81319ddf>] ip_send_skb+0x9/0x2c
> [<ffffffff81337a85>] udp_send_skb+0x250/0x2aa
> [<ffffffff81338fa2>] udp_sendmsg+0x4e3/0x6f8
> [<ffffffff8131b345>] ? ip_append_page+0x4b2/0x4b2
> [<ffffffff813a442b>] ? preempt_schedule_irq+0x3c/0x51
> [<ffffffff81049998>] ? __dequeue_entity+0x2e/0x33
> [<ffffffff8133f654>] inet_sendmsg+0x93/0x9c
> [<ffffffff812e741d>] sock_sendmsg+0xbb/0xd4
> [<ffffffff81049998>] ? __dequeue_entity+0x2e/0x33
> [<ffffffff81049998>] ? __dequeue_entity+0x2e/0x33
> [<ffffffff813a442b>] ? preempt_schedule_irq+0x3c/0x51
> [<ffffffff813a5516>] ? retint_kernel+0x26/0x30
> [<ffffffff812e748f>] ? sockfd_lookup_light+0x1b/0x54
> [<ffffffff812e7b3f>] sys_sendto+0xfa/0x122
> [<ffffffff813a442b>] ? preempt_schedule_irq+0x3c/0x51
> [<ffffffff813a97a2>] system_call_fastpath+0x16/0x1b
> Code: 8b 57 68 48 89 44 24 10 8b 87 b0 00 00 00 48 89 44 24 08 31 c0 8b bf ac 00 00 00 48 89 3c 24 48 c7 c7 b7 6d 4c 81 e8 26 37 0b 00 <0f> 0b eb fe 4c 89 c8 c9 c3 55 89 f1 48 89 e5 48 83 ec 20 4c 8b
> RIP [<ffffffff812ef1b4>] skb_push+0x72/0x7b
> RSP <ffff8801283459d8>
> ---[ end trace 35a690c4aebb4bd0 ]---
> hdparm: sending ioctl 330 to a partition!
> hdparm: sending ioctl 330 to a partition!
> hdparm: sending ioctl 330 to a partition!
> hdparm: sending ioctl 330 to a partition!
>
> Thanks in advance,
>
> Jeff Pieper
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: IP fragmentation broken in 3.6-rc ?
From: Eric Dumazet @ 2012-08-21 20:46 UTC (permalink / raw)
To: Julian Anastasov; +Cc: Sylvain Munaut, netdev
In-Reply-To: <alpine.LFD.2.00.1208212102540.2149@ja.ssi.bg>
On Tue, 2012-08-21 at 23:00 +0300, Julian Anastasov wrote:
> Hello,
>
> On Tue, 21 Aug 2012, Eric Dumazet wrote:
>
> > In fact we re-enter ip_rt_update_pmtu() if we receive a second ICMP,
> > and rt->rt_pmtu is already set, but dst is expired.
> >
> > Thats why Sylvain said it was not happening in the 10 minutes following
> > boot.
> >
> > So calling again dst_set_expires(&rt->dst, ip_rt_mtu_expires) does
> > nothing : rt_pmtu is ignored because dst.expires is too old.
>
> Oh, well. I thought dst_set_expires was used
> before for IPv4, it was not. I didn't expected function
> that was old to cause problem. So, you are right that
> MTU is not updated second time. But we must check if
> such change will harm IPv6, dst_set_expires was/is
> used there.
>
> > Maybe we should just do :
> >
> > diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> > index e4ba974..d0181e2 100644
> > --- a/net/ipv4/route.c
> > +++ b/net/ipv4/route.c
> > @@ -952,7 +952,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
> > ip_rt_build_flow_key(&fl4, sk, skb);
> > mtu = __ip_rt_update_pmtu(rt, &fl4, mtu);
> >
> > - if (!rt->rt_pmtu) {
> > + if (!rt->rt_pmtu || time_after_eq(jiffies, rt->dst.expires)) {
>
> At first look it should not be needed to cause route
> relookup here. tcp_v4_mtu_reduced is prepared to use the new
> dst_mtu for mss after calling inet_csk_update_pmtu. It seems the
> new code expects that every socket that performs PMTU Discovery
> will get ICMP error, so tcp_v4_mtu_reduced should be called
> for every socket with every new ICMP. If there are 100 sockets
> we will get 100 ICMPs. If we set DST_OBSOLETE_KILL as you
> propose, all sockets will notice the need to relookup
> route and will learn the new PMTU from fnhe exception with less
> chances for other ICMP events. At first look, this variant looks
> better to me in case if we want single PMTU to be propagated
> to all sockets immediately. Can it cause other problems?
> Now the rt life with PMTU will be limited to 600 secs.
>
> OTOH, tcp_current_mss() is called often, it will
> notice the new dst_mtu, so may be there is no need for
> route relookup by setting DST_OBSOLETE_KILL?
>
> Not sure if we still have to support this second
> option, to change dst_set_expires to check for timeout=0:
>
> if (dst->expires == 0 || time_after(expires, dst->expires) ||
> !timeout)
>
> In IPv4, ip_rt_update_pmtu was the only place that
> can extend dst->expires, for the rt_bind_exception case
> I assume expires is still 0 before the checks. Not sure if
> IPv6 needs to use time_after, may be it prefers the
> time_before variant? IPv6 updates MTU in rt6_update_expires
> and we call dst_set_expires where the timer will not be
> extended. But may be the intention is that MTU only
> can reduce the expiration, not to extend it after timer
> was set when route was added.
>
> So, another option is to create new function
> dst_update_expires and to use it just for IPv4, it will
> use time_after because IPv4 uses the timer just for
> PMTU while IPv6 uses it in ip6_route_add() to limit
> route lifetime due to lft values.
>
> dst_update_expires will be like dst_set_expires
> but with this difference (time_after):
>
> if (dst->expires == 0 || time_after(expires, dst->expires) ||
> !timeout)
Hmm, all these tests are not really needed, what about :
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index e4ba974..8d6d320 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -956,7 +956,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
dst->obsolete = DST_OBSOLETE_KILL;
} else {
rt->rt_pmtu = mtu;
- dst_set_expires(&rt->dst, ip_rt_mtu_expires);
+ rt->dst.expires = max(1UL, jiffies + ip_rt_mtu_expires);
}
}
^ permalink raw reply related
* Re: IP fragmentation broken in 3.6-rc ?
From: Julian Anastasov @ 2012-08-21 20:00 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Sylvain Munaut, netdev
In-Reply-To: <1345569824.5158.540.camel@edumazet-glaptop>
Hello,
On Tue, 21 Aug 2012, Eric Dumazet wrote:
> In fact we re-enter ip_rt_update_pmtu() if we receive a second ICMP,
> and rt->rt_pmtu is already set, but dst is expired.
>
> Thats why Sylvain said it was not happening in the 10 minutes following
> boot.
>
> So calling again dst_set_expires(&rt->dst, ip_rt_mtu_expires) does
> nothing : rt_pmtu is ignored because dst.expires is too old.
Oh, well. I thought dst_set_expires was used
before for IPv4, it was not. I didn't expected function
that was old to cause problem. So, you are right that
MTU is not updated second time. But we must check if
such change will harm IPv6, dst_set_expires was/is
used there.
> Maybe we should just do :
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index e4ba974..d0181e2 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -952,7 +952,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
> ip_rt_build_flow_key(&fl4, sk, skb);
> mtu = __ip_rt_update_pmtu(rt, &fl4, mtu);
>
> - if (!rt->rt_pmtu) {
> + if (!rt->rt_pmtu || time_after_eq(jiffies, rt->dst.expires)) {
At first look it should not be needed to cause route
relookup here. tcp_v4_mtu_reduced is prepared to use the new
dst_mtu for mss after calling inet_csk_update_pmtu. It seems the
new code expects that every socket that performs PMTU Discovery
will get ICMP error, so tcp_v4_mtu_reduced should be called
for every socket with every new ICMP. If there are 100 sockets
we will get 100 ICMPs. If we set DST_OBSOLETE_KILL as you
propose, all sockets will notice the need to relookup
route and will learn the new PMTU from fnhe exception with less
chances for other ICMP events. At first look, this variant looks
better to me in case if we want single PMTU to be propagated
to all sockets immediately. Can it cause other problems?
Now the rt life with PMTU will be limited to 600 secs.
OTOH, tcp_current_mss() is called often, it will
notice the new dst_mtu, so may be there is no need for
route relookup by setting DST_OBSOLETE_KILL?
Not sure if we still have to support this second
option, to change dst_set_expires to check for timeout=0:
if (dst->expires == 0 || time_after(expires, dst->expires) ||
!timeout)
In IPv4, ip_rt_update_pmtu was the only place that
can extend dst->expires, for the rt_bind_exception case
I assume expires is still 0 before the checks. Not sure if
IPv6 needs to use time_after, may be it prefers the
time_before variant? IPv6 updates MTU in rt6_update_expires
and we call dst_set_expires where the timer will not be
extended. But may be the intention is that MTU only
can reduce the expiration, not to extend it after timer
was set when route was added.
So, another option is to create new function
dst_update_expires and to use it just for IPv4, it will
use time_after because IPv4 uses the timer just for
PMTU while IPv6 uses it in ip6_route_add() to limit
route lifetime due to lft values.
dst_update_expires will be like dst_set_expires
but with this difference (time_after):
if (dst->expires == 0 || time_after(expires, dst->expires) ||
!timeout)
while dst_set_expires will be as before, used by IPv6.
> dst->obsolete = DST_OBSOLETE_KILL;
> } else {
> rt->rt_pmtu = mtu;
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* Re: [PATCH v6] bonding support for IPv6 transmit hashing
From: Jay Vosburgh @ 2012-08-21 19:19 UTC (permalink / raw)
To: Jeremy Brookman; +Cc: linux, netdev
In-Reply-To: <CAPc2XZDHBPKEM+WsWTL+9N_sfgVhOZAoiY3LU=v-QTCb9eQObQ@mail.gmail.com>
Jeremy Brookman <jeremy.brookman@gmail.com> wrote:
>> You should use a mix of tabs, as necessary, to get things to line up
>> how I told you they need to line up.
>
>Unless I'm missing something, this change doesn't seem to have made it
>through to the kernel tip, but we could really use this bugfix. Is it
>in a repository I didn't notice, or not yet through the review? If
>it's not through the review, is any help needed to get it there?
The submitter (John Eaglesham) never posted an updated version
that addressed the various comments, nor did his original patch
submission include a Signed-off-by.
I went ahead and updated the patch to address the comments; I've
only compile tested this. Are you (Jeremy or John) able to test this to
confirm that it will hash ipv6 traffic as expected (I can test it, but
it won't be today)?
John, can you post a Signed-off-by for your patch (really, this
updated version of your patch)?
If John signs off and somebody tests this, I'll post a formal
submssion with the full commit message.
-J
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
index 6b1c711..834c919 100644
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -752,12 +752,23 @@ xmit_hash_policy
protocol information to generate the hash.
Uses XOR of hardware MAC addresses and IP addresses to
- generate the hash. The formula is
+ generate the hash. The IPv4 formula is
(((source IP XOR dest IP) AND 0xffff) XOR
( source MAC XOR destination MAC ))
modulo slave count
+ The IPv6 formula is
+
+ hash =
+ (source ip quad 2 XOR dest IP quad 2) XOR
+ (source ip quad 3 XOR dest IP quad 3) XOR
+ (source ip quad 4 XOR dest IP quad 4)
+
+ (((hash >> 24) XOR (hash >> 16) XOR (hash >> 8) XOR hash)
+ XOR (source MAC XOR destination MAC))
+ modulo slave count
+
This algorithm will place all traffic to a particular
network peer on the same slave. For non-IP traffic,
the formula is the same as for the layer2 transmit
@@ -778,19 +789,30 @@ xmit_hash_policy
slaves, although a single connection will not span
multiple slaves.
- The formula for unfragmented TCP and UDP packets is
+ The formula for unfragmented IPv4 TCP and UDP packets is
((source port XOR dest port) XOR
((source IP XOR dest IP) AND 0xffff)
modulo slave count
- For fragmented TCP or UDP packets and all other IP
- protocol traffic, the source and destination port
+ The formula for unfragmented IPv6 TCP and UDP packets is
+
+ hash =
+ (source ip quad 2 XOR dest IP quad 2) XOR
+ (source ip quad 3 XOR dest IP quad 3) XOR
+ (source ip quad 4 XOR dest IP quad 4)
+
+ ((source port XOR dest port) XOR
+ (hash >> 24) XOR (hash >> 16) XOR (hash >> 8) XOR hash)
+ modulo slave count
+
+ For fragmented TCP or UDP packets and all other IPv4 and
+ IPv6 protocol traffic, the source and destination port
information is omitted. For non-IP traffic, the
formula is the same as for the layer2 transmit hash
policy.
- This policy is intended to mimic the behavior of
+ The IPv4 policy is intended to mimic the behavior of
certain switches, notably Cisco switches with PFC2 as
well as some Foundry and IBM products.
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d95fbc3..4dfe7e3 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3354,56 +3354,99 @@ static struct notifier_block bond_netdev_notifier = {
/*---------------------------- Hashing Policies -----------------------------*/
/*
+ * Hash for the output device based upon layer 2 data
+ */
+static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count)
+{
+ struct ethhdr *data = (struct ethhdr *)skb->data;
+
+ if (skb_headlen(skb) >= offsetof(struct ethhdr, h_proto))
+ return (data->h_dest[5] ^ data->h_source[5]) % count;
+
+ return 0;
+}
+
+/*
* Hash for the output device based upon layer 2 and layer 3 data. If
- * the packet is not IP mimic bond_xmit_hash_policy_l2()
+ * the packet is not IP, fall back on bond_xmit_hash_policy_l2()
*/
static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
{
struct ethhdr *data = (struct ethhdr *)skb->data;
- struct iphdr *iph = ip_hdr(skb);
-
- if (skb->protocol == htons(ETH_P_IP)) {
+ struct iphdr *iph;
+ struct ipv6hdr *ipv6h;
+ u32 v6hash;
+ __be32 *s, *d;
+
+ if (skb->protocol == htons(ETH_P_IP) &&
+ skb_network_header_len(skb) >= sizeof(struct iphdr)) {
+ iph = ip_hdr(skb);
return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
(data->h_dest[5] ^ data->h_source[5])) % count;
+ } else if (skb->protocol == htons(ETH_P_IPV6) &&
+ skb_network_header_len(skb) >= sizeof(struct ipv6hdr)) {
+ ipv6h = ipv6_hdr(skb);
+ s = &ipv6h->saddr.s6_addr32[0];
+ d = &ipv6h->daddr.s6_addr32[0];
+ v6hash = (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]);
+ v6hash ^= (v6hash >> 24) ^ (v6hash >> 16) ^ (v6hash >> 8);
+ return (v6hash ^ data->h_dest[5] ^ data->h_source[5]) % count;
}
- return (data->h_dest[5] ^ data->h_source[5]) % count;
+ return bond_xmit_hash_policy_l2(skb, count);
}
/*
* Hash for the output device based upon layer 3 and layer 4 data. If
* the packet is a frag or not TCP or UDP, just use layer 3 data. If it is
- * altogether not IP, mimic bond_xmit_hash_policy_l2()
+ * altogether not IP, fall back on bond_xmit_hash_policy_l2()
*/
static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count)
{
- struct ethhdr *data = (struct ethhdr *)skb->data;
- struct iphdr *iph = ip_hdr(skb);
- __be16 *layer4hdr = (__be16 *)((u32 *)iph + iph->ihl);
- int layer4_xor = 0;
+ u32 layer4_xor = 0;
+ struct iphdr *iph;
+ struct ipv6hdr *ipv6h;
+ __be32 *s, *d;
+ __be16 *layer4hdr;
if (skb->protocol == htons(ETH_P_IP)) {
+ iph = ip_hdr(skb);
if (!ip_is_fragment(iph) &&
(iph->protocol == IPPROTO_TCP ||
iph->protocol == IPPROTO_UDP)) {
+ if (iph->ihl * sizeof(u32) + sizeof(__be16) * 2 >
+ skb_headlen(skb) - skb_network_offset(skb))
+ goto short_header;
+ layer4hdr = (__be16 *)((u32 *)iph + iph->ihl);
layer4_xor = ntohs((*layer4hdr ^ *(layer4hdr + 1)));
+ } else if (skb_network_header_len(skb) < sizeof(struct iphdr)) {
+ goto short_header;
}
return (layer4_xor ^
((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count;
-
+ } else if (skb->protocol == htons(ETH_P_IPV6)) {
+ ipv6h = ipv6_hdr(skb);
+ if (ipv6h->nexthdr == IPPROTO_TCP ||
+ ipv6h->nexthdr == IPPROTO_UDP) {
+ layer4hdr = (__be16 *)(ipv6h + 1);
+ if (sizeof(struct ipv6hdr) + sizeof(__be16) * 2 >
+ skb_headlen(skb) - skb_network_offset(skb))
+ goto short_header;
+ layer4_xor = (*layer4hdr ^ *(layer4hdr + 1));
+ } else if (skb_network_header_len(skb) <
+ sizeof(struct ipv6hdr)) {
+ goto short_header;
+ }
+ s = &ipv6h->saddr.s6_addr32[0];
+ d = &ipv6h->daddr.s6_addr32[0];
+ layer4_xor ^= (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]);
+ layer4_xor ^= (layer4_xor >> 24) ^ (layer4_xor >> 16) ^
+ (layer4_xor >> 8);
+ return layer4_xor % count;
}
- return (data->h_dest[5] ^ data->h_source[5]) % count;
-}
-
-/*
- * Hash for the output device based upon layer 2 data
- */
-static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count)
-{
- struct ethhdr *data = (struct ethhdr *)skb->data;
-
- return (data->h_dest[5] ^ data->h_source[5]) % count;
+short_header:
+ return bond_xmit_hash_policy_l2(skb, count);
}
/*-------------------------- Device entry points ----------------------------*/
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply related
* [PATCH 8/8] netdev: octeon_mgmt: Make multi-line comment style consistent.
From: David Daney @ 2012-08-21 18:45 UTC (permalink / raw)
To: linux-mips, ralf, David S. Miller, netdev; +Cc: linux-kernel, David Daney
In-Reply-To: <1345574712-21444-1-git-send-email-ddaney.cavm@gmail.com>
From: David Daney <david.daney@cavium.com>
No code changes. Recent patches have used the netdev style multi-line
comment formatting, making the style inconsistent within octeon_mgmt.c
Update the remaining comment blocks to achieve style harmony.
Signed-off-by: David Daney <david.daney@cavium.com>
---
drivers/net/ethernet/octeon/octeon_mgmt.c | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index ccb1f81..5be431c 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -34,8 +34,7 @@
#define OCTEON_MGMT_NAPI_WEIGHT 16
-/*
- * Ring sizes that are powers of two allow for more efficient modulo
+/* Ring sizes that are powers of two allow for more efficient modulo
* opertions.
*/
#define OCTEON_MGMT_RX_RING_SIZE 512
@@ -431,8 +430,7 @@ good:
netif_receive_skb(skb);
rc = 0;
} else if (re.s.code == RING_ENTRY_CODE_MORE) {
- /*
- * Packet split across skbs. This can happen if we
+ /* Packet split across skbs. This can happen if we
* increase the MTU. Buffers that are already in the
* rx ring can then end up being too small. As the rx
* ring is refilled, buffers sized for the new MTU
@@ -462,8 +460,7 @@ good:
} else {
/* Some other error, discard it. */
dev_kfree_skb_any(skb);
- /*
- * Error statistics are accumulated in
+ /* Error statistics are accumulated in
* octeon_mgmt_update_rx_stats.
*/
}
@@ -590,8 +587,7 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev)
cam_mode = 0;
available_cam_entries = 8;
} else {
- /*
- * One CAM entry for the primary address, leaves seven
+ /* One CAM entry for the primary address, leaves seven
* for the secondary addresses.
*/
available_cam_entries = 7 - netdev->uc.count;
@@ -663,8 +659,7 @@ static int octeon_mgmt_change_mtu(struct net_device *netdev, int new_mtu)
struct octeon_mgmt *p = netdev_priv(netdev);
int size_without_fcs = new_mtu + OCTEON_MGMT_RX_HEADROOM;
- /*
- * Limit the MTU to make sure the ethernet packets are between
+ /* Limit the MTU to make sure the ethernet packets are between
* 64 bytes and 16383 bytes.
*/
if (size_without_fcs < 64 || size_without_fcs > 16383) {
@@ -1044,8 +1039,7 @@ static int octeon_mgmt_open(struct net_device *netdev)
}
if (OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)
|| OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X)) {
- /*
- * Force compensation values, as they are not
+ /* Force compensation values, as they are not
* determined properly by HW
*/
union cvmx_agl_gmx_drv_ctl drv_ctl;
@@ -1078,8 +1072,7 @@ static int octeon_mgmt_open(struct net_device *netdev)
octeon_mgmt_change_mtu(netdev, netdev->mtu);
- /*
- * Enable the port HW. Packets are not allowed until
+ /* Enable the port HW. Packets are not allowed until
* cvmx_mgmt_port_enable() is called.
*/
mix_ctl.u64 = 0;
@@ -1196,8 +1189,7 @@ static int octeon_mgmt_open(struct net_device *netdev)
rxx_frm_ctl.u64 = 0;
rxx_frm_ctl.s.ptp_mode = p->has_rx_tstamp ? 1 : 0;
rxx_frm_ctl.s.pre_align = 1;
- /*
- * When set, disables the length check for non-min sized pkts
+ /* When set, disables the length check for non-min sized pkts
* with padding in the client data.
*/
rxx_frm_ctl.s.pad_len = 1;
@@ -1215,8 +1207,7 @@ static int octeon_mgmt_open(struct net_device *netdev)
rxx_frm_ctl.s.ctl_drp = 1;
/* Strip off the preamble */
rxx_frm_ctl.s.pre_strp = 1;
- /*
- * This port is configured to send PREAMBLE+SFD to begin every
+ /* This port is configured to send PREAMBLE+SFD to begin every
* frame. GMX checks that the PREAMBLE is sent correctly.
*/
rxx_frm_ctl.s.pre_chk = 1;
--
1.7.11.4
^ permalink raw reply related
* [PATCH 7/8] netdev: octeon_mgmt: Remove some useless 'inline'
From: David Daney @ 2012-08-21 18:45 UTC (permalink / raw)
To: linux-mips, ralf, David S. Miller, netdev; +Cc: linux-kernel, David Daney
In-Reply-To: <1345574712-21444-1-git-send-email-ddaney.cavm@gmail.com>
From: David Daney <david.daney@cavium.com>
Signed-off-by: David Daney <david.daney@cavium.com>
---
drivers/net/ethernet/octeon/octeon_mgmt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index 9b526da..ccb1f81 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -173,22 +173,22 @@ static void octeon_mgmt_set_tx_irq(struct octeon_mgmt *p, int enable)
spin_unlock_irqrestore(&p->lock, flags);
}
-static inline void octeon_mgmt_enable_rx_irq(struct octeon_mgmt *p)
+static void octeon_mgmt_enable_rx_irq(struct octeon_mgmt *p)
{
octeon_mgmt_set_rx_irq(p, 1);
}
-static inline void octeon_mgmt_disable_rx_irq(struct octeon_mgmt *p)
+static void octeon_mgmt_disable_rx_irq(struct octeon_mgmt *p)
{
octeon_mgmt_set_rx_irq(p, 0);
}
-static inline void octeon_mgmt_enable_tx_irq(struct octeon_mgmt *p)
+static void octeon_mgmt_enable_tx_irq(struct octeon_mgmt *p)
{
octeon_mgmt_set_tx_irq(p, 1);
}
-static inline void octeon_mgmt_disable_tx_irq(struct octeon_mgmt *p)
+static void octeon_mgmt_disable_tx_irq(struct octeon_mgmt *p)
{
octeon_mgmt_set_tx_irq(p, 0);
}
--
1.7.11.4
^ permalink raw reply related
* [PATCH 6/8] netdev: octeon_mgmt: Cleanup and modernize MAC address handling.
From: David Daney @ 2012-08-21 18:45 UTC (permalink / raw)
To: linux-mips, ralf, David S. Miller, netdev; +Cc: linux-kernel, David Daney
In-Reply-To: <1345574712-21444-1-git-send-email-ddaney.cavm@gmail.com>
From: David Daney <david.daney@cavium.com>
Use eth_mac_addr(), and generate a random address if none is otherwise
assigned.
Signed-off-by: David Daney <david.daney@cavium.com>
---
drivers/net/ethernet/octeon/octeon_mgmt.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index 3bae01f..9b526da 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -648,12 +648,10 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev)
static int octeon_mgmt_set_mac_address(struct net_device *netdev, void *addr)
{
- struct sockaddr *sa = addr;
+ int r = eth_mac_addr(netdev, addr);
- if (!is_valid_ether_addr(sa->sa_data))
- return -EADDRNOTAVAIL;
-
- memcpy(netdev->dev_addr, sa->sa_data, ETH_ALEN);
+ if (r)
+ return r;
octeon_mgmt_set_rx_filtering(netdev);
@@ -1545,8 +1543,12 @@ static int __devinit octeon_mgmt_probe(struct platform_device *pdev)
mac = of_get_mac_address(pdev->dev.of_node);
- if (mac)
- memcpy(netdev->dev_addr, mac, 6);
+ if (mac && is_valid_ether_addr(mac)) {
+ memcpy(netdev->dev_addr, mac, ETH_ALEN);
+ netdev->addr_assign_type &= ~NET_ADDR_RANDOM;
+ } else {
+ eth_hw_addr_random(netdev);
+ }
p->phy_np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
--
1.7.11.4
^ permalink raw reply related
* [PATCH 5/8] netdev: octeon_mgmt: Set the parent device.
From: David Daney @ 2012-08-21 18:45 UTC (permalink / raw)
To: linux-mips, ralf, David S. Miller, netdev; +Cc: linux-kernel, David Daney
In-Reply-To: <1345574712-21444-1-git-send-email-ddaney.cavm@gmail.com>
From: David Daney <david.daney@cavium.com>
This establishes useful links in sysfs.
Signed-off-by: David Daney <david.daney@cavium.com>
---
drivers/net/ethernet/octeon/octeon_mgmt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index cf06cf2..3bae01f 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -1446,6 +1446,8 @@ static int __devinit octeon_mgmt_probe(struct platform_device *pdev)
if (netdev == NULL)
return -ENOMEM;
+ SET_NETDEV_DEV(netdev, &pdev->dev);
+
dev_set_drvdata(&pdev->dev, netdev);
p = netdev_priv(netdev);
netif_napi_add(netdev, &p->napi, octeon_mgmt_napi_poll,
--
1.7.11.4
^ permalink raw reply related
* [PATCH 4/8] netdev: octeon_mgmt: Improve ethtool_ops.
From: David Daney @ 2012-08-21 18:45 UTC (permalink / raw)
To: linux-mips, ralf, David S. Miller, netdev; +Cc: linux-kernel, David Daney
In-Reply-To: <1345574712-21444-1-git-send-email-ddaney.cavm@gmail.com>
From: David Daney <david.daney@cavium.com>
Correctly show no link when the interface is down, and return
-EOPNOTSUPP for things that don't work. This quiets the ethtool
program when run on down interfaces.
Signed-off-by: David Daney <david.daney@cavium.com>
---
drivers/net/ethernet/octeon/octeon_mgmt.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index 687a6a0..cf06cf2 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -1379,7 +1379,7 @@ static int octeon_mgmt_get_settings(struct net_device *netdev,
if (p->phydev)
return phy_ethtool_gset(p->phydev, cmd);
- return -EINVAL;
+ return -EOPNOTSUPP;
}
static int octeon_mgmt_set_settings(struct net_device *netdev,
@@ -1393,14 +1393,28 @@ static int octeon_mgmt_set_settings(struct net_device *netdev,
if (p->phydev)
return phy_ethtool_sset(p->phydev, cmd);
- return -EINVAL;
+ return -EOPNOTSUPP;
+}
+
+static int octeon_mgmt_nway_reset(struct net_device *dev)
+{
+ struct octeon_mgmt *p = netdev_priv(dev);
+
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+
+ if (p->phydev)
+ return phy_start_aneg(p->phydev);
+
+ return -EOPNOTSUPP;
}
static const struct ethtool_ops octeon_mgmt_ethtool_ops = {
.get_drvinfo = octeon_mgmt_get_drvinfo,
- .get_link = ethtool_op_get_link,
.get_settings = octeon_mgmt_get_settings,
- .set_settings = octeon_mgmt_set_settings
+ .set_settings = octeon_mgmt_set_settings,
+ .nway_reset = octeon_mgmt_nway_reset,
+ .get_link = ethtool_op_get_link,
};
static const struct net_device_ops octeon_mgmt_ops = {
--
1.7.11.4
^ 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