platform/kernel/linux-3.10.git
14 years agodccp ccid-3: remove buggy RTT-sampling history lookup
Gerrit Renker [Tue, 14 Sep 2010 18:18:00 +0000 (20:18 +0200)]
dccp ccid-3: remove buggy RTT-sampling history lookup

This removes the RTT-sampling function tfrc_tx_hist_rtt(), since

 1. it suffered from complex passing of return values (the return value both
    indicated successful lookup while the value doubled as RTT sample);

 2. when for some odd reason the sample value equalled 0, this triggered a bug
    warning about "bogus Ack", due to the ambiguity of the return value;

 3. on a passive host which has not sent anything the TX history is empty and
    thus will lead to unwanted "bogus Ack" warnings such as
    ccid3_hc_tx_packet_recv: server(e7b7d518): DATAACK with bogus ACK-28197148
    ccid3_hc_tx_packet_recv: server(e7b7d518): DATAACK with bogus ACK-26641606.

The fix is to replace the implicit encoding by performing the steps manually.

Furthermore, the "bogus Ack" warning has been removed, since it can actually be
triggered due to several reasons (network reordering, old packet, (3) above),
hence it is not very useful.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
14 years agodccp ccid-3: A lower bound for the inter-packet scheduling algorithm
Gerrit Renker [Tue, 14 Sep 2010 18:16:59 +0000 (20:16 +0200)]
dccp ccid-3: A lower bound for the inter-packet scheduling algorithm

This fixes a subtle bug in the calculation of the inter-packet gap and shows
that t_delta, as it is currently used, is not needed.

The algorithm from RFC 5348, 8.3 below continually computes a send time t_nom,
which is initialised with the current time t_now; t_gran = 1E6 / HZ specifies
the scheduling granularity, s the packet size, and X the sending rate:

  t_distance = t_nom - t_now; // in microseconds
  t_delta    = min(t_ipi, t_gran) / 2; // `delta' parameter in microseconds

  if (t_distance >= t_delta) {
reschedule after (t_distance / 1000) milliseconds;
  } else {
   t_ipi  = s / X; // inter-packet interval in usec
t_nom += t_ipi; // compute the next send time
send packet now;
  }

Problem:
--------
Rescheduling requires a conversion into milliseconds (sk_reset_timer()). The
highest jiffy resolution with HZ=1000 is 1 millisecond, so using a higher
granularity does not make much sense here.

As a consequence, values of t_distance < 1000 are truncated to 0. This issue
has so far been resolved by using instead

  if (t_distance >= t_delta + 1000)
reschedule after (t_distance / 1000) milliseconds;

This is unnecessarily large, a lower bound is t_delta' = max(t_delta, 1000).
And it implies a further simplification:

 a) when HZ >= 500, then t_delta <= t_gran/2 = 10^6/(2*HZ) <= 1000, so that
    t_delta' = MAX(1000, t_delta) = 1000 (constant value);

 b) when HZ < 500, then t_delta = 1/2*MIN(rtt, t_ipi, t_gran) <= t_gran/2,
    so that 1000 <= t_delta' <= t_gran/2.

The maximum error of using a constant t_delta in (b) is less than half a jiffy.

Fix:
----
The patch replaces t_delta with a constant, whose value depends on CONFIG_HZ,
changing the above algorithm to:

  if (t_distance >= t_delta')
reschedule after (t_distance / 1000) milliseconds;

where t_delta' = 10^6/(2*HZ) if HZ < 500, and t_delta' = 1000 otherwise.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
14 years agoe1000e: Simplify MSI interrupt testing
Jean Delvare [Sun, 12 Sep 2010 22:45:39 +0000 (22:45 +0000)]
e1000e: Simplify MSI interrupt testing

The code is quite convoluted, simplify it. This also avoids calling
e1000_request_irq() without testing the value it returned, which was
bad.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Bruce Allan <bruce.w.allan@intel.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agouwb: use '%pM' format to print MAC address
Andy Shevchenko [Sun, 12 Sep 2010 08:16:26 +0000 (08:16 +0000)]
uwb: use '%pM' format to print MAC address

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobnx2x: Spread rx buffers between allocated queues
Dmitry Kravkov [Sun, 12 Sep 2010 05:48:28 +0000 (05:48 +0000)]
bnx2x: Spread rx buffers between allocated queues

Default number of rx buffers will be divided equally
 between allocated queues. This will decrease amount of
 pre-allocated buffers on systems with multiple CPUs.
 User can override this behavior with ethtool -G.
 Minimum amount of rx buffers per queue set to 128.

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocx82310_eth: allow empty URBs
Ondrej Zary [Sat, 11 Sep 2010 05:40:16 +0000 (05:40 +0000)]
cx82310_eth: allow empty URBs

Empty received URBs are currently counted as errors but the device sends them
sometimes as part of regular traffic - so remove this check.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocx82310_eth: check usb_string() return value for error
Ondrej Zary [Sat, 11 Sep 2010 05:39:57 +0000 (05:39 +0000)]
cx82310_eth: check usb_string() return value for error

Fix that usb_string() return value is not checked for error (negative value).
Also change the ignore message a bit and lower its level to info.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/skfp: Remove pr_<level> uses of KERN_<level>
Joe Perches [Sat, 11 Sep 2010 19:10:56 +0000 (19:10 +0000)]
drivers/net/skfp: Remove pr_<level> uses of KERN_<level>

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet/cxgb3: remove undefined operations
Andreas Schwab [Sat, 11 Sep 2010 01:12:34 +0000 (01:12 +0000)]
net/cxgb3: remove undefined operations

Modifying an object twice without an intervening sequence point is
undefined.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet/de4x5: remove undefined operations
Andreas Schwab [Sat, 11 Sep 2010 01:08:58 +0000 (01:08 +0000)]
net/de4x5: remove undefined operations

Modifying an object twice without an intervening sequence point is
undefined.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosundance: Add power management hooks
Denis Kirjanov [Fri, 10 Sep 2010 23:23:13 +0000 (23:23 +0000)]
sundance: Add power management hooks

This patch to adds support for PM hooks into sundance driver

Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoflow: better memory management
Eric Dumazet [Fri, 10 Sep 2010 07:00:25 +0000 (07:00 +0000)]
flow: better memory management

Allocate hash tables for every online cpus, not every possible ones.

NUMA aware allocations.

Dont use a full page on arches where PAGE_SIZE > 1024*sizeof(void *)

misc:
  __percpu , __read_mostly, __cpuinit annotations
  flow_compare_t is just an "unsigned long"

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Fix order of channel_name array dimensions
Ben Hutchings [Mon, 13 Sep 2010 04:14:49 +0000 (04:14 +0000)]
sfc: Fix order of channel_name array dimensions

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobna: Check for NULL before deref in bnad_cb_tx_cleanup
David S. Miller [Sun, 12 Sep 2010 19:06:00 +0000 (12:06 -0700)]
bna: Check for NULL before deref in bnad_cb_tx_cleanup

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agopkt_sched: remov unnecessary bh_disable
stephen hemminger [Wed, 8 Sep 2010 09:16:28 +0000 (09:16 +0000)]
pkt_sched: remov unnecessary bh_disable

Now that est_tree_lock is acquired with BH protection, the other
call is unnecessary.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agofib: cleanups
Eric Dumazet [Thu, 9 Sep 2010 23:32:28 +0000 (23:32 +0000)]
fib: cleanups

Use rcu_dereference_rtnl() helper

Change hard coded constants in fib_flag_trans()
 7 -> RTN_UNREACHABLE
 8 -> RTN_PROHIBIT

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Allow changing the DMA ring sizes dynamically via ethtool
Ben Hutchings [Fri, 10 Sep 2010 06:42:33 +0000 (06:42 +0000)]
sfc: Allow changing the DMA ring sizes dynamically via ethtool

This requires some reorganisation of channel setup and teardown to
ensure that we can always roll-back a failed change.

Based on work by Steve Hodgson <shodgson@solarflare.com>

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Make the dmaq size a run-time setting (rather than compile-time)
Steve Hodgson [Fri, 10 Sep 2010 06:42:22 +0000 (06:42 +0000)]
sfc: Make the dmaq size a run-time setting (rather than compile-time)

- Allow the ring size to be specified in non
   power-of-two sizes (for instance to limit
   the amount of receive buffers).
 - Automatically size the event queue.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Allocate each channel separately, along with its RX and TX queues
Ben Hutchings [Fri, 10 Sep 2010 06:41:57 +0000 (06:41 +0000)]
sfc: Allocate each channel separately, along with its RX and TX queues

This will allow for reallocation of channel structures and rings.

Change module parameter separate_tx_channels to be read-only, since we
now require its value to be constant.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Refactor channel and queue lookup and iteration
Ben Hutchings [Fri, 10 Sep 2010 06:41:47 +0000 (06:41 +0000)]
sfc: Refactor channel and queue lookup and iteration

In preparation for changes to the way channels and queue structures
are allocated, revise the macros and functions used to look up and
iterator over them.

- Replace efx_for_each_tx_queue() with iteration over channels then TX
  queues
- Replace efx_for_each_rx_queue() with iteration over channels then RX
  queues (with one exception, shortly to be removed)
- Introduce efx_get_{channel,rx_queue,tx_queue}() functions to look up
  channels and queues by index
- Introduce efx_channel_get_{rx,tx}_queue() functions to look up a
  channel's queues

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Abstract channel and index lookup for RX queues
Ben Hutchings [Fri, 10 Sep 2010 06:41:36 +0000 (06:41 +0000)]
sfc: Abstract channel and index lookup for RX queues

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Allocate DMA and event rings using GFP_KERNEL
Ben Hutchings [Fri, 10 Sep 2010 06:41:26 +0000 (06:41 +0000)]
sfc: Allocate DMA and event rings using GFP_KERNEL

Currently we allocate DMA descriptor rings and event rings using
pci_alloc_consistent() which selects non-blocking behaviour from the
page allocator (GFP_ATOMIC). This is unnecessary, and since we
currently allocate a single contiguous block for each ring (up to 32
pages!) these allocations are likely to fail if there is any
significant memory pressure.  Use dma_alloc_coherent() and GFP_KERNEL
instead.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Fix failure paths in efx_probe_port()
Ben Hutchings [Fri, 10 Sep 2010 06:41:19 +0000 (06:41 +0000)]
sfc: Fix failure paths in efx_probe_port()

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Remove declarations of functions that no longer exist
Ben Hutchings [Fri, 10 Sep 2010 06:41:12 +0000 (06:41 +0000)]
sfc: Remove declarations of functions that no longer exist

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Accumulate RX_NODESC_DROP count in rx_dropped, not rx_over_errors
Ben Hutchings [Fri, 10 Sep 2010 06:41:06 +0000 (06:41 +0000)]
sfc: Accumulate RX_NODESC_DROP count in rx_dropped, not rx_over_errors

rx_over_errors appears to be intended as a count of packets that
overflow a packet buffer in the NIC.  Given that we implement a
cut-through receive path, this should always be 0.

rx_dropped appears to be the correct counter for packets dropped due
to lack of host buffers.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Use MCDI RX_BAD_FCS_PKTS count as MAC rx_bad count
Ben Hutchings [Fri, 10 Sep 2010 06:41:00 +0000 (06:41 +0000)]
sfc: Use MCDI RX_BAD_FCS_PKTS count as MAC rx_bad count

Calculating rx_bad as rx_packets - rx_good is unnecessary and
incorrect, since rx_good does not include control frames (e.g.
pause frames) and rx_packets does.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
David S. Miller [Fri, 10 Sep 2010 05:27:33 +0000 (22:27 -0700)]
Merge branch 'master' of /linux/kernel/git/davem/net-2.6

Conflicts:
net/mac80211/main.c

14 years agoMerge branch 'vhost-net' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
David S. Miller [Fri, 10 Sep 2010 04:59:51 +0000 (21:59 -0700)]
Merge branch 'vhost-net' of git://git./linux/kernel/git/mst/vhost

14 years agodrivers/net/bnx2x: use ARRAY_SIZE macro in bnx2x_main.c
Nikitas Angelinas [Wed, 8 Sep 2010 11:20:37 +0000 (11:20 +0000)]
drivers/net/bnx2x: use ARRAY_SIZE macro in bnx2x_main.c

Replace sizeof(bnx2x_parity_mask)/(sizeof(bnx2x_parity_mask[0]) with
ARRAY_SIZE(bnx2x_parity_mask) in drivers/net/bnx2x/bnx2x_main.c

Signed-off-by: Nikitas Angelinas <nikitasangelinas@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoipheth: remove incorrect devtype to WWAN
Dan Williams [Wed, 8 Sep 2010 07:50:47 +0000 (07:50 +0000)]
ipheth: remove incorrect devtype to WWAN

The 'wwan' devtype is meant for devices that require preconfiguration
and *every* time setup before the ethernet interface can be used, like
cellular modems which require a series of setup commands on serial ports
or other mechanisms before the ethernet interface will handle packets.

As ipheth only requires one-per-hotplug pairing setup with no
preconfiguration (like APN, phone #, etc) and the network interface is
usable at any time after that initial setup, remove the incorrect
devtype wwan.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoMAINTAINERS: Add CAIF
Joe Perches [Tue, 7 Sep 2010 20:33:24 +0000 (20:33 +0000)]
MAINTAINERS: Add CAIF

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoau1000-eth: change multi-line comments style
Florian Fainelli [Wed, 8 Sep 2010 11:11:59 +0000 (11:11 +0000)]
au1000-eth: change multi-line comments style

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoau1000-eth: remove volatiles, switch to I/O accessors
Florian Fainelli [Wed, 8 Sep 2010 11:15:13 +0000 (11:15 +0000)]
au1000-eth: remove volatiles, switch to I/O accessors

Remove all the volatile keywords where they were used, switch to using the
proper readl/writel accessors.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoau1000-eth: fix asm -> linux headers inclusion
Florian Fainelli [Wed, 8 Sep 2010 11:11:49 +0000 (11:11 +0000)]
au1000-eth: fix asm -> linux headers inclusion

Replace asm/io.h and asm/cpu.h wih linux/io.h and linux/cpu.h

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoau1000-eth: fix bad printk usages
Florian Fainelli [Wed, 8 Sep 2010 11:11:45 +0000 (11:11 +0000)]
au1000-eth: fix bad printk usages

Use pr_(info|err) and pr_cont where required instead of calls to printk.
Add missing pr_fmt to the driver.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoau1000-eth: fix all but one "line over 80 characters warnings"
Florian Fainelli [Wed, 8 Sep 2010 11:11:40 +0000 (11:11 +0000)]
au1000-eth: fix all but one "line over 80 characters warnings"

One line has not been changed because it would not improve readability.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoau1000-eth: stylistic fixes
Florian Fainelli [Wed, 8 Sep 2010 11:11:31 +0000 (11:11 +0000)]
au1000-eth: stylistic fixes

This patch fixes the following checkpatch.pl warnings:
- spaces after tabs
- space between function and arguments
- one-line statement braces
- tabs instead of spaces

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoau1000-eth: typedefs removal
Florian Fainelli [Wed, 8 Sep 2010 11:11:25 +0000 (11:11 +0000)]
au1000-eth: typedefs removal

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotipc: Optimize handling excess content on incoming messages
Paul Gortmaker [Wed, 8 Sep 2010 13:31:24 +0000 (13:31 +0000)]
tipc: Optimize handling excess content on incoming messages

Remove code that trimmed excess trailing info from incoming messages
arriving over an Ethernet interface.  TIPC now ignores the extra info
while the message is being processed by the node, and only trims it off
if the message is retransmitted to another node.  (This latter step is
done to ensure the extra info doesn't cause the sk_buff to exceed the
outgoing interface's MTU limit.) The outgoing buffer is guaranteed to
be linear.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoixgbevf: remove private net_device_stats
Eric Dumazet [Wed, 8 Sep 2010 22:48:31 +0000 (22:48 +0000)]
ixgbevf: remove private net_device_stats

Use the net_device provided net_device_stats structure.

Remove ixgbevf_get_stats() now its not needed.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotunnels: missing rcu_assign_pointer()
Eric Dumazet [Thu, 9 Sep 2010 05:33:43 +0000 (05:33 +0000)]
tunnels: missing rcu_assign_pointer()

xfrm4_tunnel_register() & xfrm6_tunnel_register() should
use rcu_assign_pointer() to make sure previous writes
(to handler->next) are committed to memory before chain
insertion.

deregister functions dont need a particular barrier.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet/core: add lock context change annotations in net/core/sock.c
Namhyung Kim [Wed, 8 Sep 2010 03:48:48 +0000 (03:48 +0000)]
net/core: add lock context change annotations in net/core/sock.c

__lock_sock() and __release_sock() releases and regrabs lock but
were missing proper annotations. Add it. This removes following
warning from sparse. (Currently __lock_sock() does not emit any
warning about it but I think it is better to add also.)

 net/core/sock.c:1580:17: warning: context imbalance in '__release_sock' - unexpected unlock

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet/core: remove address space warnings on verify_iovec()
Namhyung Kim [Wed, 8 Sep 2010 03:48:47 +0000 (03:48 +0000)]
net/core: remove address space warnings on verify_iovec()

move_addr_to_kernel() and copy_from_user() requires their argument
as __user pointer but were missing proper markups. Add it.
This removes following warnings from sparse.

 net/core/iovec.c:44:52: warning: incorrect type in argument 1 (different address spaces)
 net/core/iovec.c:44:52:    expected void [noderef] <asn:1>*uaddr
 net/core/iovec.c:44:52:    got void *msg_name
 net/core/iovec.c:55:34: warning: incorrect type in argument 2 (different address spaces)
 net/core/iovec.c:55:34:    expected void const [noderef] <asn:1>*from
 net/core/iovec.c:55:34:    got struct iovec *msg_iov

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosctp: fix test for end of loop
Joe Perches [Wed, 8 Sep 2010 11:04:21 +0000 (11:04 +0000)]
sctp: fix test for end of loop

Add a list_has_sctp_addr function to simplify loop

Based on a patches by Dan Carpenter and David Miller

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoMerge branch 'for-davem' of git://oss.oracle.com/git/agrover/linux-2.6
David S. Miller [Thu, 9 Sep 2010 21:58:11 +0000 (14:58 -0700)]
Merge branch 'for-davem' of git://oss.oracle.com/git/agrover/linux-2.6

14 years agoMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
David S. Miller [Thu, 9 Sep 2010 06:49:04 +0000 (23:49 -0700)]
Merge branch 'master' of /linux/kernel/git/torvalds/linux-2.6

14 years agoKS8851: Correct RX packet allocation
Eric Dumazet [Wed, 8 Sep 2010 13:26:55 +0000 (13:26 +0000)]
KS8851: Correct RX packet allocation

Use netdev_alloc_skb_ip_align() helper and do correct allocation

Tested-by: Abraham Arce <x0066660@ti.com>
Signed-off-by: Abraham Arce <x0066660@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoudp: add rehash on connect()
Eric Dumazet [Wed, 8 Sep 2010 05:08:44 +0000 (05:08 +0000)]
udp: add rehash on connect()

commit 30fff923 introduced in linux-2.6.33 (udp: bind() optimisation)
added a secondary hash on UDP, hashed on (local addr, local port).

Problem is that following sequence :

fd = socket(...)
connect(fd, &remote, ...)

not only selects remote end point (address and port), but also sets
local address, while UDP stack stored in secondary hash table the socket
while its local address was INADDR_ANY (or ipv6 equivalent)

Sequence is :
 - autobind() : choose a random local port, insert socket in hash tables
              [while local address is INADDR_ANY]
 - connect() : set remote address and port, change local address to IP
              given by a route lookup.

When an incoming UDP frame comes, if more than 10 sockets are found in
primary hash table, we switch to secondary table, and fail to find
socket because its local address changed.

One solution to this problem is to rehash datagram socket if needed.

We add a new rehash(struct socket *) method in "struct proto", and
implement this method for UDP v4 & v6, using a common helper.

This rehashing only takes care of secondary hash table, since primary
hash (based on local port only) is not changed.

Reported-by: Krzysztof Piotr Oledzki <ole@ans.pl>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Tested-by: Krzysztof Piotr Oledzki <ole@ans.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoatlx: make strings const
Stephen Hemminger [Thu, 9 Sep 2010 04:32:12 +0000 (21:32 -0700)]
atlx: make strings const

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Chris Snook <chris.snook@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: inet_add_protocol() can use cmpxchg()
Eric Dumazet [Thu, 9 Sep 2010 04:31:35 +0000 (21:31 -0700)]
net: inet_add_protocol() can use cmpxchg()

Use cmpxchg() to get rid of spinlocks in inet_add_protocol() and
friends.

inet_protos[] & inet6_protos[] are moved to read_mostly section

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocxacru: ignore cx82310_eth devices
Ondrej Zary [Thu, 9 Sep 2010 04:29:20 +0000 (21:29 -0700)]
cxacru: ignore cx82310_eth devices

Ignore ADSL routers, which can have the same vendor and product IDs
as ADSL modems but should be handled by the cx82310_eth driver.

This intentionally ignores device IDs that aren't currently handled
by cx82310_eth. There may be other device IDs that perhaps shouldn't
be claimed by cxacru.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoRDS: Remove dead struct from rds.h
Andy Grover [Thu, 9 Sep 2010 01:03:54 +0000 (18:03 -0700)]
RDS: Remove dead struct from rds.h

flows are an obsolete date type.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: rds.h: Replace u_int[size]_t with uint[size]_t
Andy Grover [Wed, 25 Aug 2010 16:34:10 +0000 (09:34 -0700)]
RDS: rds.h: Replace u_int[size]_t with uint[size]_t

Replace e.g. u_int32_t types with the more common uint32_t.

Reported-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Add rds.h to exported headers list
Andy Grover [Wed, 25 Aug 2010 16:32:17 +0000 (09:32 -0700)]
RDS: Add rds.h to exported headers list

Also, a number of changes were made based on the assumption that
rds.h wasn't exported, so roll these back.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Implement masked atomic operations
Andy Grover [Wed, 25 Aug 2010 12:51:28 +0000 (05:51 -0700)]
RDS: Implement masked atomic operations

Add two CMSGs for masked versions of cswp and fadd. args
struct modified to use a union for different atomic op type's
arguments. Change IB to do masked atomic ops. Atomic op type
in rds_message similarly unionized.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS/IB: print string constants in more places
Zach Brown [Tue, 3 Aug 2010 20:52:47 +0000 (13:52 -0700)]
RDS/IB: print string constants in more places

This prints the constant identifier for work completion status and rdma
cm event types, like we already do for IB event types.

A core string array helper is added that each string type uses.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS: cancel connection work structs as we shut down
Zach Brown [Fri, 23 Jul 2010 17:37:33 +0000 (10:37 -0700)]
RDS: cancel connection work structs as we shut down

Nothing was canceling the send and receive work that might have been
queued as a conn was being destroyed.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS: don't call rds_conn_shutdown() from rds_conn_destroy()
Zach Brown [Fri, 23 Jul 2010 17:36:58 +0000 (10:36 -0700)]
RDS: don't call rds_conn_shutdown() from rds_conn_destroy()

rds_conn_shutdown() can return before the connection is shut down when
it encounters an existing state that it doesn't understand.  This lets
rds_conn_destroy() then start tearing down the conn from under paths
that are still using it.

It's more reliable the shutdown work and wait for krdsd to complete the
shutdown callback.  This stopped some hangs I was seeing where krdsd was
trying to shut down a freed conn.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS: have sockets get transport module references
Zach Brown [Fri, 23 Jul 2010 17:32:31 +0000 (10:32 -0700)]
RDS: have sockets get transport module references

Right now there's nothing to stop the various paths that use
rs->rs_transport from racing with rmmod and executing freed transport
code.  The simple fix is to have binding to a transport also hold a
reference to the transport's module, removing this class of races.

We already had an unused t_owner field which was set for the modular
transports and which wasn't set for the built-in loop transport.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS: remove old rs_transport comment
Zach Brown [Wed, 21 Jul 2010 22:13:25 +0000 (15:13 -0700)]
RDS: remove old rs_transport comment

rs_transport is now also used by the rdma paths once the socket is
bound.  We don't need this stale comment to tell us what cscope can.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS: lock rds_conn_count decrement in rds_conn_destroy()
Zach Brown [Fri, 23 Jul 2010 17:30:45 +0000 (10:30 -0700)]
RDS: lock rds_conn_count decrement in rds_conn_destroy()

rds_conn_destroy() can race with all other modifications of the
rds_conn_count but it was modifying the count without locking.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS/IB: protect the list of IB devices
Zach Brown [Thu, 15 Jul 2010 19:34:33 +0000 (12:34 -0700)]
RDS/IB: protect the list of IB devices

The RDS IB device list wasn't protected by any locking.  Traversal in
both the get_mr and FMR flushing paths could race with additon and
removal.

List manipulation is done with RCU primatives and is protected by the
write side of a rwsem.  The list traversal in the get_mr fast path is
protected by a rcu read critical section.  The FMR list traversal is
more problematic because it can block while traversing the list.  We
protect this with the read side of the rwsem.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS/IB: print IB event strings as well as their number
Zach Brown [Wed, 14 Jul 2010 21:01:21 +0000 (14:01 -0700)]
RDS/IB: print IB event strings as well as their number

It's nice to not have to go digging in the code to see which event
occurred.  It's easy to throw together a quick array that maps the ib
event enums to their strings.  I didn't see anything in the stack that
does this translation for us, but I also didn't look very hard.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS: flush fmrs before allocating new ones
Chris Mason [Tue, 20 Jul 2010 00:06:46 +0000 (17:06 -0700)]
RDS: flush fmrs before allocating new ones

Flushing FMRs is somewhat expensive, and is currently kicked off when
the interrupt handler notices that we are getting low.  The result of
this is that FMR flushing only happens from the interrupt cpus.

This spreads the load more effectively by triggering flushes just before
we allocate a new FMR.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agoRDS: properly use sg_init_table
Chris Mason [Tue, 20 Jul 2010 00:02:41 +0000 (17:02 -0700)]
RDS: properly use sg_init_table

This is only needed to keep debugging code from bugging.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agoRDS/IB: track signaled sends
Zach Brown [Wed, 14 Jul 2010 20:55:35 +0000 (13:55 -0700)]
RDS/IB: track signaled sends

We're seeing bugs today where IB connection shutdown clears the send
ring while the tasklet is processing completed sends.  Implementation
details cause this to dereference a null pointer.  Shutdown needs to
wait for send completion to stop before tearing down the connection.  We
can't simply wait for the ring to empty because it may contain
unsignaled sends that will never be processed.

This patch tracks the number of signaled sends that we've posted and
waits for them to complete.  It also makes sure that the tasklet has
finished executing.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS: remove __init and __exit annotation
Zach Brown [Fri, 9 Jul 2010 19:26:20 +0000 (12:26 -0700)]
RDS: remove __init and __exit annotation

The trivial amount of memory saved isn't worth the cost of dealing with section
mismatches.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS/IB: Use SLAB_HWCACHE_ALIGN flag for kmem_cache_create()
Andy Grover [Wed, 7 Jul 2010 23:46:26 +0000 (16:46 -0700)]
RDS/IB: Use SLAB_HWCACHE_ALIGN flag for kmem_cache_create()

We are *definitely* counting cycles as closely as DaveM, so
ensure hwcache alignment for our recv ring control structs.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS/IB: always process recv completions
Zach Brown [Tue, 6 Jul 2010 22:04:34 +0000 (15:04 -0700)]
RDS/IB: always process recv completions

The recv refill path was leaking fragments because the recv event handler had
marked a ring element as free without freeing its frag.  This was happening
because it wasn't processing receives when the conn wasn't marked up or
connecting, as can be the case if it races with rmmod.

Two observations support always processing receives in the callback.

First, buildup should only post receives, thus triggering recv event handler
calls, once it has built up all the state to handle them.  Teardown should
destroy the CQ and drain the ring before tearing down the state needed to
process recvs.  Both appear to be true today.

Second, this test was fundamentally racy.  There is nothing to stop rmmod and
connection destruction from swooping in the moment after the conn state was
sampled but before real receive procesing starts.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS: return to a single-threaded krdsd
Zach Brown [Tue, 6 Jul 2010 22:08:48 +0000 (15:08 -0700)]
RDS: return to a single-threaded krdsd

We were seeing very nasty bugs due to fundamental assumption the current code
makes about concurrent work struct processing.  The code simpy isn't able to
handle concurrent connection shutdown work function execution today, for
example, which is very much possible once a multi-threaded krdsd was
introduced.  The problem compounds as additional work structs are added to the
mix.

krdsd is no longer perforance critical now that send and receive posting and
FMR flushing are done elsewhere, so the safest fix is to move back to the
single threaded krdsd that the current code was built around.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS/IB: create a work queue for FMR flushing
Zach Brown [Tue, 6 Jul 2010 22:09:56 +0000 (15:09 -0700)]
RDS/IB: create a work queue for FMR flushing

This patch moves the FMR flushing work in to its own mult-threaded work queue.
This is to maintain performance in preparation for returning the main krdsd
work queue back to a single threaded work queue to avoid deep-rooted
concurrency bugs.

This is also good because it further separates FMRs, which might be removed
some day, from the rest of the code base.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS/IB: destroy connections on rmmod
Zach Brown [Fri, 25 Jun 2010 21:58:16 +0000 (14:58 -0700)]
RDS/IB: destroy connections on rmmod

IB connections were not being destroyed during rmmod.

First, recently IB device removal callback was changed to disconnect
connections that used the removing device rather than destroying them.  So
connections with devices during rmmod were not being destroyed.

Second, rds_ib_destroy_nodev_conns() was being called before connections are
disassociated with devices.  It would almost never find connections in the
nodev list.

We first get rid of rds_ib_destroy_conns(), which is no longer called, and
refactor the existing caller into the main body of the function and get rid of
the list and lock wrappers.

Then we call rds_ib_destroy_nodev_conns() *after* ib_unregister_client() has
removed the IB device from all the conns and put the conns on the nodev list.

The result is that IB connections are destroyed by rmmod.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS/IB: wait for IB dev freeing work to finish during rmmod
Zach Brown [Fri, 25 Jun 2010 21:59:49 +0000 (14:59 -0700)]
RDS/IB: wait for IB dev freeing work to finish during rmmod

The RDS IB client removal callback can queue work to drop the final reference
to an IB device.  We have to make sure that this function has returned before
we complete rmmod or the work threads can try to execute freed code.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS/IB: Make ib_recv_refill return void
Andy Grover [Thu, 24 Jun 2010 01:06:30 +0000 (18:06 -0700)]
RDS/IB: Make ib_recv_refill return void

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Remove unused XLIST_PTR_TAIL and xlist_protect()
Andy Grover [Fri, 11 Jun 2010 23:24:42 +0000 (16:24 -0700)]
RDS: Remove unused XLIST_PTR_TAIL and xlist_protect()

Not used.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: whitespace
Andy Grover [Fri, 11 Jun 2010 22:18:51 +0000 (15:18 -0700)]
RDS: whitespace

14 years agoRDS: use delayed work for the FMR flushes
Chris Mason [Fri, 11 Jun 2010 18:26:02 +0000 (11:26 -0700)]
RDS: use delayed work for the FMR flushes

Using a delayed work queue helps us make sure a healthy number of FMRs
have queued up over the limit.  It makes for a large improvement in RDMA
iops.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agords: more FMRs are faster
Chris Mason [Fri, 11 Jun 2010 18:18:57 +0000 (11:18 -0700)]
rds: more FMRs are faster

When we add more FMRs, we flush them less often and so we go faster.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agords: recycle FMRs through lockless lists
Chris Mason [Fri, 11 Jun 2010 18:17:59 +0000 (11:17 -0700)]
rds: recycle FMRs through lockless lists

FRM allocation and recycling is performance critical and fairly lock
intensive.  The current code has a per connection lock that all
processes bang on and it becomes a major bottleneck on large systems.

This changes things to use a number of cmpxchg based lists instead,
allowing us to go through the whole FMR lifecycle without locking inside
RDS.

Zach Brown pointed out that our usage of cmpxchg for xlist removal is
racey if someone manages to remove and add back an FMR struct into the list
while another CPU can see the FMR's address at the head of the list.

The second CPU might assume the list hasn't changed when in fact any
number of operations might have happened in between the deletion and
reinsertion.

This commit maintains a per cpu count of CPUs that are currently
in xlist removal, and establishes a grace period to make sure that
nobody can see an entry we have just removed from the list.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agords: fix rds_send_xmit() serialization
Zach Brown [Fri, 4 Jun 2010 21:41:41 +0000 (14:41 -0700)]
rds: fix rds_send_xmit() serialization

rds_send_xmit() was changed to hold an interrupt masking spinlock instead of a
mutex so that it could be called from the IB receive tasklet path.  This broke
the TCP transport because its xmit method can block and masks and unmasks
interrupts.

This patch serializes callers to rds_send_xmit() with a simple bit instead of
the current spinlock or previous mutex.  This enables rds_send_xmit() to be
called from any context and to call functions which block.  Getting rid of the
c_send_lock exposes the bare c_lock acquisitions which are changed to block
interrupts.

A waitqueue is added so that rds_conn_shutdown() can wait for callers to leave
rds_send_xmit() before tearing down partial send state.  This lets us get rid
of c_senders.

rds_send_xmit() is changed to check the conn state after acquiring the
RDS_IN_XMIT bit to resolve races with the shutdown path.  Previously both
worked with the conn state and then the lock in the same order, allowing them
to race and execute the paths concurrently.

rds_send_reset() isn't racing with rds_send_xmit() now that rds_conn_shutdown()
properly ensures that rds_send_xmit() can't start once the conn state has been
changed.  We can remove its previous use of the spinlock.

Finally, c_send_generation is redundant.  Callers can race to test the c_flags
bit by simply retrying instead of racing to test the c_send_generation atomic.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agords: block ints when acquiring c_lock in rds_conn_message_info()
Zach Brown [Fri, 4 Jun 2010 21:25:27 +0000 (14:25 -0700)]
rds: block ints when acquiring c_lock in rds_conn_message_info()

conn->c_lock is acquired in interrupt context.  rds_conn_message_info() is
called from user context and was acquiring c_lock without blocking interrupts,
leading to possible deadlocks.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agords: remove unused rds_send_acked_before()
Zach Brown [Fri, 4 Jun 2010 21:26:32 +0000 (14:26 -0700)]
rds: remove unused rds_send_acked_before()

rds_send_acked_before() wasn't blocking interrupts when acquiring c_lock from
user context but nothing calls it.  Rather than fix its use of c_lock we just
remove the function.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS: use friendly gfp masks for prefill
Chris Mason [Thu, 27 May 2010 04:45:06 +0000 (21:45 -0700)]
RDS: use friendly gfp masks for prefill

When prefilling the rds frags, we end up doing a lot of allocations.
We're not in atomic context here, and so there's no reason to dip into
atomic reserves.  This changes the prefills to use masks that allow
waiting.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agoRDS/IB: Add caching of frags and incs
Chris Mason [Thu, 27 May 2010 05:05:37 +0000 (22:05 -0700)]
RDS/IB: Add caching of frags and incs

This patch is based heavily on an initial patch by Chris Mason.
Instead of freeing slab memory and pages, it keeps them, and
funnels them back to be reused.

The lock minimization strategy uses xchg and cmpxchg atomic ops
for manipulation of pointers to list heads. We anchor the lists with a
pointer to a list_head struct instead of a static list_head struct.
We just have to carefully use the existing primitives with
the difference between a pointer and a static head struct.

For example, 'list_empty()' means that our anchor pointer points to a list with
a single item instead of meaning that our static head element doesn't point to
any list items.

Original patch by Chris, with significant mods and fixes by Andy and Zach.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Andy Grover <andy.grover@oracle.com>
Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS/IB: Remove ib_recv_unmap_page()
Andy Grover [Tue, 25 May 2010 18:20:09 +0000 (11:20 -0700)]
RDS/IB: Remove ib_recv_unmap_page()

All it does is call unmap_sg(), so just call that directly.

The comment above unmap_page also may be incorrect, so we
shouldn't hold on to it, either.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Assume recv->r_frag is always NULL in refill_one()
Andy Grover [Tue, 25 May 2010 03:28:49 +0000 (20:28 -0700)]
RDS: Assume recv->r_frag is always NULL in refill_one()

refill_one() should never be called on a recv struct that
doesn't need a new r_frag allocated. Add a WARN and remove
conditional around r_frag alloc code.

Also, add a comment to explain why r_ibinc may or may not
need refilling.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Use page_remainder_alloc() for recv bufs
Andy Grover [Tue, 25 May 2010 03:12:41 +0000 (20:12 -0700)]
RDS: Use page_remainder_alloc() for recv bufs

Instead of splitting up a page into RDS_FRAG_SIZE chunks
ourselves, ask rds_page_remainder_alloc() to do it. While it
is possible PAGE_SIZE > FRAG_SIZE, on x86en it isn't, so having
duplicate "carve up a page into buffers" code seems excessive.

The other modification this spawns is the use of a single
struct scatterlist in rds_page_frag instead of a bare page ptr.
This causes verbosity to increase in some places, and decrease
in others.

Finally, I decided to unify the lifetimes and alloc/free of
rds_page_frag and its page. This is a nice simplification in itself,
but will be extra-nice once we come to adding cmason's recycling
patch.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS/IB: disconnect when IB devices are removed
Zach Brown [Mon, 24 May 2010 20:16:57 +0000 (13:16 -0700)]
RDS/IB: disconnect when IB devices are removed

Currently IB device removal destroys connections which are associated with the
device.  This prevents connections from being re-established when replacement
devices are added.

Instead we'll queue shutdown work on the connections as their devices are
removed.  When we see that devices are added we triger connection attempts on
all connections that don't currently have a device.

The result is that RDS sockets can resume device-independent work (bcopy, not
RDMA) across IB device removal and restoration.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS: introduce rds_conn_connect_if_down()
Zach Brown [Mon, 24 May 2010 20:14:36 +0000 (13:14 -0700)]
RDS: introduce rds_conn_connect_if_down()

A few paths had the same block of code to queue a connection's connect work if
it was in the right state.  Let's move this in to a helper function.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS/IB: add refcount tracking to struct rds_ib_device
Zach Brown [Tue, 18 May 2010 22:48:51 +0000 (15:48 -0700)]
RDS/IB: add refcount tracking to struct rds_ib_device

The RDS IB client .remove callback used to free the rds_ibdev for the given
device unconditionally.  This could race other users of the struct.  This patch
adds refcounting so that we only free the rds_ibdev once all of its users are
done.

Many rds_ibdev users are tied to connections.  We give the connection a
reference and change these users to reference the device in the connection
instead of looking it up in the IB client data.  The only user of the IB client
data remaining is the first lookup of the device as connections are built up.

Incrementing the reference count of a device found in the IB client data could
race with final freeing so we use an RCU grace period to make sure that freeing
won't happen until those lookups are done.

MRs need the rds_ibdev to get at the pool that they're freed in to.  They exist
outside a connection and many MRs can reference different devices from one
socket, so it was natural to have each MR hold a reference.  MR refs can be
dropped from interrupt handlers and final device teardown can block so we push
it off to a work struct.  Pool teardown had to be fixed to cancel its pending
work instead of deadlocking waiting for all queued work, including itself, to
finish.

MRs get their reference from the global device list, which gets a reference.
It is left unprotected by locks and remains racy.  A simple global lock would
be a significant bottleneck.  More scalable (complicated) locking should be
done carefully in a later patch.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS/IB: get the xmit max_sge from the RDS IB device on the connection
Zach Brown [Tue, 18 May 2010 22:44:50 +0000 (15:44 -0700)]
RDS/IB: get the xmit max_sge from the RDS IB device on the connection

rds_ib_xmit_rdma() was calling ib_get_client_data() to get at the rds_ibdevice
just to get the max_sge for the transmit.  This patch instead has it get it
directly off the rds_ibdev which is stored on the connection.

The current code won't free the rds_ibdev until all the IB connections that use
it are freed.  So it's safe to reference the rds_ibdev this way.  In the future
it also makes it easier to support proper reference counting of the rds_ibdev
struct.

As an additional bonus, this gets rid of the performance hit of calling in to
the IB stack to look up the rds_ibdev.  The current implementation in the IB
stack acquires an interrupt blocking spinlock to protect the registration of
client callback data.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agoRDS/IB: rds_ib_cm_handle_connect() forgot to unlock c_cm_lock
Zach Brown [Mon, 24 May 2010 20:14:59 +0000 (13:14 -0700)]
RDS/IB: rds_ib_cm_handle_connect() forgot to unlock c_cm_lock

rds_ib_cm_handle_connect() could return without unlocking the c_conn_lock if
rds_setup_qp() failed.  Rather than adding another imbalanced mutex_unlock() to
this error path we only unlock the mutex once as we exit the function, reducing
the likelyhood of making this same mistake in the future.  We remove the
previous mulitple return sites, leaving one unambigious return path.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
14 years agords: Fix reference counting on the for xmit_atomic and xmit_rdma
Chris Mason [Tue, 11 May 2010 23:15:35 +0000 (16:15 -0700)]
rds: Fix reference counting on the for xmit_atomic and xmit_rdma

This makes sure we have the proper number of references in
rds_ib_xmit_atomic and rds_ib_xmit_rdma.  We also consistently
drop references the same way for all message types as the IOs end.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agords: use RCU to protect the connection hash
Chris Mason [Tue, 11 May 2010 22:15:15 +0000 (15:15 -0700)]
rds: use RCU to protect the connection hash

The connection hash was almost entirely RCU ready, this
just makes the final couple of changes to use RCU instead
of spinlocks for everything.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agoRDS: use locking on the connection hash list
Chris Mason [Tue, 11 May 2010 22:14:52 +0000 (15:14 -0700)]
RDS: use locking on the connection hash list

rds_conn_destroy really needs locking while it changes the
connection hash.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agords: Fix RDMA message reference counting
Chris Mason [Tue, 11 May 2010 22:14:16 +0000 (15:14 -0700)]
rds: Fix RDMA message reference counting

The RDS send_xmit code was trying to get fancy with message
counting and was dropping the final reference on the RDMA messages
too early.  This resulted in memory corruption and oopsen.

The fix here is to always add a ref as the parts of the message passes
through rds_send_xmit, and always drop a ref as the parts of the message
go through completion handling.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agords: don't let RDS shutdown a connection while senders are present
Chris Mason [Tue, 11 May 2010 22:11:11 +0000 (15:11 -0700)]
rds: don't let RDS shutdown a connection while senders are present

This is the first in a long line of patches that tries to fix races
between RDS connection shutdown and RDS traffic.

Here we are maintaining a count of active senders to make sure
the connection doesn't go away while they are using it.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agords: Use RCU for the bind lookup searches
Chris Mason [Tue, 11 May 2010 22:09:45 +0000 (15:09 -0700)]
rds: Use RCU for the bind lookup searches

The RDS bind lookups are somewhat expensive in terms of CPU
time and locking overhead.  This commit changes them into a
faster RCU based hash tree instead of the rbtrees they were using
before.

On large NUMA systems it is a significant improvement.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agoRDS/IB: add _to_node() macros for numa and use {k,v}malloc_node()
Andy Grover [Fri, 23 Apr 2010 17:49:53 +0000 (10:49 -0700)]
RDS/IB: add _to_node() macros for numa and use {k,v}malloc_node()

Allocate send/recv rings in memory that is node-local to the HCA.
This significantly helps performance.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS/IB: Remove unused variable in ib_remove_addr()
Andy Grover [Fri, 23 Apr 2010 18:04:21 +0000 (11:04 -0700)]
RDS/IB: Remove unused variable in ib_remove_addr()

Signed-off-by: Andy Grover <andy.grover@oracle.com>