GitHub/LineageOS/android_kernel_motorola_exynos9610.git
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>
14 years agords: rcu-ize rds_ib_get_device()
Chris Mason [Fri, 23 Apr 2010 01:59:15 +0000 (21:59 -0400)]
rds: rcu-ize rds_ib_get_device()

rds_ib_get_device is called very often as we turn an
ip address into a corresponding device structure.  It currently
take a global spinlock as it walks different lists to find active
devices.

This commit changes the lists over to RCU, which isn't very complex
because they are not updated very often at all.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agords: per-rm flush_wait waitq
Chris Mason [Wed, 21 Apr 2010 20:09:28 +0000 (13:09 -0700)]
rds: per-rm flush_wait waitq

This removes a global waitqueue used to wait for rds messages
and replaces it with a waitqueue inside the rds_message struct.

The global waitqueue turns into a global lock and significantly
bottlenecks operations on large machines.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agords: switch to rwlock on bind_lock
Chris Mason [Wed, 21 Apr 2010 20:04:43 +0000 (13:04 -0700)]
rds: switch to rwlock on bind_lock

The bind_lock is almost entirely readonly, but it gets
hammered during normal operations and is a major bottleneck.

This commit changes it to an rwlock, which takes it from 80%
of the system time on a big numa machine down to much lower
numbers.

A better fix would involve RCU, which is done in a later commit

Signed-off-by: Chris Mason <chris.mason@oracle.com>
14 years agoRDS: Update comments in rds_send_xmit()
Andy Grover [Fri, 16 Apr 2010 00:19:29 +0000 (17:19 -0700)]
RDS: Update comments in rds_send_xmit()

Update comments to reflect changes in previous commit.

Keeping as separate commits due to different authorship.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Use a generation counter to avoid rds_send_xmit loop
Chris Mason [Thu, 15 Apr 2010 20:38:14 +0000 (16:38 -0400)]
RDS: Use a generation counter to avoid rds_send_xmit loop

rds_send_xmit is required to loop around after it releases the lock
because someone else could done a trylock, found someone working on the
list and backed off.

But, once we drop our lock, it is possible that someone else does come
in and make progress on the list.  We should detect this and not loop
around if another process is actually working on the list.

This patch adds a generation counter that is bumped every time we
get the lock and do some send work.  If the retry notices someone else
has bumped the generation counter, it does not need to loop around and
continue working.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Get pong working again
Andy Grover [Thu, 1 Apr 2010 01:56:25 +0000 (18:56 -0700)]
RDS: Get pong working again

Call send_xmit() directly from pong()

Set pongs as op_active

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Do wait_event_interruptible instead of wait_event
Andy Grover [Tue, 30 Mar 2010 00:10:01 +0000 (17:10 -0700)]
RDS: Do wait_event_interruptible instead of wait_event

Can't see a reason not to allow signals to interrupt the wait.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Remove send_quota from send_xmit()
Andy Grover [Tue, 30 Mar 2010 00:08:49 +0000 (17:08 -0700)]
RDS: Remove send_quota from send_xmit()

The purpose of the send quota was really to give fairness
when different connections were all using the same
workq thread to send backlogged msgs -- they could only send
so many before another connection could make progress.

Now that each connection is pushing the backlog from its
completion handler, they are all guaranteed to make progress
and the quota isn't needed any longer.

A thread *will* have to send all previously queued data, as well
as any further msgs placed on the queue while while c_send_lock
was held. In a pathological case a single process can get
roped into doing this for long periods while other threads
get off free. But, since it can only do this until the transport
reports full, this is a bounded scenario.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Move atomic stats from general to ib-specific area
Andy Grover [Tue, 30 Mar 2010 00:47:30 +0000 (17:47 -0700)]
RDS: Move atomic stats from general to ib-specific area

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: rds_message_unmapped() doesn't need to check if queue active
Andy Grover [Mon, 29 Mar 2010 23:52:12 +0000 (16:52 -0700)]
RDS: rds_message_unmapped() doesn't need to check if queue active

If the queue has nobody on it, then wake_up does nothing.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Fix locking in send on m_rs_lock
Andy Grover [Mon, 29 Mar 2010 23:50:54 +0000 (16:50 -0700)]
RDS: Fix locking in send on m_rs_lock

Do not nest m_rs_lock under c_lock

Disable interrupts in {rdma,atomic}_send_complete

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Use NOWAIT in message_map_pages()
Andy Grover [Mon, 29 Mar 2010 23:46:46 +0000 (16:46 -0700)]
RDS: Use NOWAIT in message_map_pages()

Can no longer block, so use NOWAIT.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Bypass workqueue when queueing cong updates
Andy Grover [Mon, 29 Mar 2010 23:45:40 +0000 (16:45 -0700)]
RDS: Bypass workqueue when queueing cong updates

Now that rds_send_xmit() does not block, we can call it directly
instead of going through the helper thread.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Call rds_send_xmit() directly from sendmsg()
Andy Grover [Mon, 29 Mar 2010 23:20:18 +0000 (16:20 -0700)]
RDS: Call rds_send_xmit() directly from sendmsg()

rds_sendmsg() is calling the send worker function to
send the just-queued datagrams, presumably because it wants
the behavior where anything not sent will re-call the send
worker. We now ensure all queued datagrams are sent by retrying
from the send completion handler, so this isn't needed any more.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: rds_send_xmit() locking/irq fixes
Andy Grover [Wed, 24 Mar 2010 00:48:04 +0000 (17:48 -0700)]
RDS: rds_send_xmit() locking/irq fixes

rds_message_put() cannot be called with irqs off, so move it after
irqs are re-enabled.

Spinlocks throughout the function do not to use _irqsave because
the lock of c_send_lock at top already disabled irqs.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Change send lock from a mutex to a spinlock
Andy Grover [Wed, 24 Mar 2010 00:39:07 +0000 (17:39 -0700)]
RDS: Change send lock from a mutex to a spinlock

This change allows us to call rds_send_xmit() from a tasklet,
which is crucial to our new operating model.

* Change c_send_lock to a spinlock
* Update stats fields "sem_" to "_lock"
* Remove unneeded rds_conn_is_sending()

About locking between shutdown and send -- send checks if the
connection is up. Shutdown puts the connection into
DISCONNECTING. After this, all threads entering send will exit
immediately. However, a thread could be *in* send_xmit(), so
shutdown acquires the c_send_lock to ensure everyone is out
before proceeding with connection shutdown.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Refill recv ring directly from tasklet
Andy Grover [Fri, 19 Mar 2010 00:19:52 +0000 (17:19 -0700)]
RDS: Refill recv ring directly from tasklet

Performance is better if we use allocations that don't block
to refill the receive ring. Since the whole reason we were
kicking out to the worker thread was so we could do blocking
allocs, we no longer need to do this.

Remove gfp params from rds_ib_recv_refill(); we always use
GFP_NOWAIT.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Stop supporting old cong map sending method
Andy Grover [Mon, 22 Mar 2010 22:22:04 +0000 (15:22 -0700)]
RDS: Stop supporting old cong map sending method

We now ask the transport to give us a rm for the congestion
map, and then we handle it normally. Previously, the
transport defined a function that we would call to send
a congestion map.

Convert TCP and loop transports to new cong map method.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS/IB: Do not wait for send ring to be empty on conn shutdown
Andy Grover [Thu, 4 Mar 2010 03:25:21 +0000 (19:25 -0800)]
RDS/IB: Do not wait for send ring to be empty on conn shutdown

Now that we are signaling send completions much less, we are likely
to have dirty entries in the send queue when the connection is
shut down (on rmmod, for example.) These are cleaned up a little
further down in conn_shutdown, but if we wait on the ring_empty_wait
for them, it'll never happen, and we hand on unload.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Perform unmapping ops in stages
Andy Grover [Mon, 1 Mar 2010 22:03:09 +0000 (14:03 -0800)]
RDS: Perform unmapping ops in stages

Previously, RDS would wait until the final send WR had completed
and then handle cleanup. With silent ops, we do not know
if an atomic, rdma, or data op will be last. This patch
handles any of these cases by keeping a pointer to the last
op in the message in m_last_op.

When the TX completion event fires, rds dispatches to per-op-type
cleanup functions, and then does whole-message cleanup, if the
last op equalled m_last_op.

This patch also moves towards having op-specific functions take
the op struct, instead of the overall rm struct.

rds_ib_connection has a pointer to keep track of a a partially-
completed data send operation. This patch changes it from an
rds_message pointer to the narrower rm_data_op pointer, and
modifies places that use this pointer as needed.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Make sure cmsgs aren't used in improper ways
Andy Grover [Tue, 13 Apr 2010 19:00:35 +0000 (12:00 -0700)]
RDS: Make sure cmsgs aren't used in improper ways

It hasn't cropped up in the field, but this code ensures it is
impossible to issue operations that pass an rdma cookie (DEST, MAP)
in the same sendmsg call that's actually initiating rdma or atomic
ops.

Disallowing this perverse-but-technically-allowed usage makes silent
RDMA heuristics slightly easier.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Add flag for silent ops. Do atomic op before RDMA
Andy Grover [Tue, 2 Mar 2010 00:10:40 +0000 (16:10 -0800)]
RDS: Add flag for silent ops. Do atomic op before RDMA

Add a flag to the API so users can indicate they want
silent operations. This is needed because silent ops
cannot be used with USE_ONCE MRs, so we can't just
assume silent.

Also, change send_xmit to do atomic op before rdma op if
both are present, and centralize the hairy logic to determine if
we want to attempt silent, or not.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Move some variables around for consistency
Andy Grover [Tue, 2 Mar 2010 00:04:59 +0000 (16:04 -0800)]
RDS: Move some variables around for consistency

Also, add a comment.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: queue failure notifications for dropped atomic ops
Andy Grover [Sat, 20 Feb 2010 02:04:58 +0000 (18:04 -0800)]
RDS: queue failure notifications for dropped atomic ops

When dropping ops in the send queue, we notify the client
of failed rdma ops they asked for notifications on, but not
atomic ops. It should be for both.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Add a warning if trying to allocate 0 sgs
Andy Grover [Thu, 4 Feb 2010 03:41:52 +0000 (19:41 -0800)]
RDS: Add a warning if trying to allocate 0 sgs

rds_message_alloc_sgs() only works when nents is nonzero.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Do not set op_active in r_m_copy_from_user().
Andy Grover [Thu, 4 Feb 2010 03:40:32 +0000 (19:40 -0800)]
RDS: Do not set op_active in r_m_copy_from_user().

Do not allocate sgs for data for 0-length datagrams

Set data.op_active in rds_sendmsg() instead of
rds_message_copy_from_user().

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Rewrite rds_send_xmit
Andy Grover [Thu, 4 Feb 2010 03:36:44 +0000 (19:36 -0800)]
RDS: Rewrite rds_send_xmit

Simplify rds_send_xmit().

Send a congestion map (via xmit_cong_map) without
decrementing send_quota.

Move resetting of conn xmit variables to end of loop.

Update comments.

Implement a special case to turn off sending an rds header
when there is an atomic op and no other data.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Rename data op members prefix from m_ to op_
Andy Grover [Thu, 28 Jan 2010 02:04:18 +0000 (18:04 -0800)]
RDS: Rename data op members prefix from m_ to op_

For consistency.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Remove struct rds_rdma_op
Andy Grover [Mon, 1 Mar 2010 22:11:53 +0000 (14:11 -0800)]
RDS: Remove struct rds_rdma_op

A big changeset, but it's all pretty dumb.

struct rds_rdma_op was already embedded in struct rm_rdma_op.
Remove rds_rdma_op and put its members in rm_rdma_op. Rename
members with "op_" prefix instead of "r_", for consistency.

Of course this breaks a lot, so fixup the code accordingly.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: purge atomic resources too in rds_message_purge()
Andy Grover [Thu, 28 Jan 2010 00:15:48 +0000 (16:15 -0800)]
RDS: purge atomic resources too in rds_message_purge()

Add atomic_free_op function, analogous to rdma_free_op,
and call it in rds_message_purge().

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Inline rdma_prepare into cmsg_rdma_args
Andy Grover [Thu, 28 Jan 2010 00:07:30 +0000 (16:07 -0800)]
RDS: Inline rdma_prepare into cmsg_rdma_args

cmsg_rdma_args just calls rdma_prepare and does a little
arg checking -- not quite enough to justify its existence.
Plus, it is the only caller of rdma_prepare().

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Implement silent atomics
Andy Grover [Wed, 20 Jan 2010 05:25:26 +0000 (21:25 -0800)]
RDS: Implement silent atomics

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Move loop-only function to loop.c
Andy Grover [Wed, 20 Jan 2010 02:14:56 +0000 (18:14 -0800)]
RDS: Move loop-only function to loop.c

Also, try to better-document the locking around the
rm and its m_inc in loop.c.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS/IB: Make all flow control code conditional on i_flowctl
Andy Grover [Fri, 15 Jan 2010 23:55:26 +0000 (15:55 -0800)]
RDS/IB: Make all flow control code conditional on i_flowctl

Maybe things worked fine with the flow control code running
even in the non-flow-control case, but making it explicitly
conditional helps the non-fc case be easier to read.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Remove unsignaled_bytes sysctl
Andy Grover [Thu, 14 Jan 2010 23:08:33 +0000 (15:08 -0800)]
RDS: Remove unsignaled_bytes sysctl

Removed unsignaled_bytes sysctl and code to signal
based on it. I believe unsignaled_wrs is more than
sufficient for our purposes.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: rewrite rds_ib_xmit
Andy Grover [Thu, 14 Jan 2010 20:18:11 +0000 (12:18 -0800)]
RDS: rewrite rds_ib_xmit

Now that the header always goes first, it is possible to
simplify rds_ib_xmit. Instead of having a path to handle 0-byte
dgrams and another path to handle >0, these can both be handled
in one path. This lets us eliminate xmit_populate_wr().

Rename sent to bytes_sent, to differentiate better from other
variable named "send".

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS/IB: Remove ib_[header/data]_sge() functions
Andy Grover [Thu, 14 Jan 2010 00:32:24 +0000 (16:32 -0800)]
RDS/IB: Remove ib_[header/data]_sge() functions

These functions were to cope with differently ordered
sg entries depending on RDS 3.0 or 3.1+. Now that
we've dropped 3.0 compatibility we no longer need them.

Also, modify usage sites for these to refer to sge[0] or [1]
directly. Reorder code to initialize header sgs first.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS/IB: Remove dead code
Andy Grover [Thu, 14 Jan 2010 00:29:37 +0000 (16:29 -0800)]
RDS/IB: Remove dead code

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS/IB: Disallow connections less than RDS 3.1
Andy Grover [Wed, 13 Jan 2010 23:50:09 +0000 (15:50 -0800)]
RDS/IB: Disallow connections less than RDS 3.1

RDS 3.0 connections (in OFED 1.3 and earlier) put the
header at the end. 3.1 connections put it at the head.
The code has significant added complexity in order to
handle both configurations. In OFED 1.6 we can
drop this and simplify the code by only supporting
"header-first" configuration.

This patch checks the protocol version, and if prior
to 3.1, does not complete the connection.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS/IB: eliminate duplicate code
Andy Grover [Tue, 12 Jan 2010 22:43:06 +0000 (14:43 -0800)]
RDS/IB: eliminate duplicate code

both atomics and rdmas need to convert ib-specific completion codes
into RDS status codes. Rename rds_ib_rdma_send_complete to
rds_ib_send_complete, and have it take a pointer to the function to
call with the new error code.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: inc_purge() transport function unused - remove it
Andy Grover [Tue, 12 Jan 2010 22:41:46 +0000 (14:41 -0800)]
RDS: inc_purge() transport function unused - remove it

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Whitespace
Andy Grover [Tue, 12 Jan 2010 18:53:05 +0000 (10:53 -0800)]
RDS: Whitespace

Tidy up some whitespace issues.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Do not mask address when pinning pages
Andy Grover [Tue, 12 Jan 2010 18:52:28 +0000 (10:52 -0800)]
RDS: Do not mask address when pinning pages

This does not appear to be necessary.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Base init_depth and responder_resources on hw values
Andy Grover [Tue, 12 Jan 2010 18:50:48 +0000 (10:50 -0800)]
RDS: Base init_depth and responder_resources on hw values

Instead of using a constant for initiator_depth and
responder_resources, read the per-QP values when the
device is enumerated, and then use these values when creating
the connection.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Implement atomic operations
Andy Grover [Tue, 12 Jan 2010 22:33:38 +0000 (14:33 -0800)]
RDS: Implement atomic operations

Implement a CMSG-based interface to do FADD and CSWP ops.

Alter send routines to handle atomic ops.

Add atomic counters to stats.

Add xmit_atomic() to struct rds_transport

Inline rds_ib_send_unmap_rdma into unmap_rm

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Clear up some confusing code in send_remove_from_sock
Andy Grover [Tue, 12 Jan 2010 22:19:32 +0000 (14:19 -0800)]
RDS: Clear up some confusing code in send_remove_from_sock

The previous code was correct, but made the assumption that
if r_notifier was non-NULL then either r_recverr or r_notify
was true. Valid, but fragile. Changed to explicitly check
r_recverr (shows up in greps for recverr now, too.)

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: make sure all sgs alloced are initialized
Andy Grover [Tue, 12 Jan 2010 22:17:31 +0000 (14:17 -0800)]
RDS: make sure all sgs alloced are initialized

rds_message_alloc_sgs() now returns correctly-initialized
sg lists, so calleds need not do this themselves.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: make m_rdma_op a member of rds_message
Andy Grover [Tue, 12 Jan 2010 22:13:15 +0000 (14:13 -0800)]
RDS: make m_rdma_op a member of rds_message

This eliminates a separate memory alloc, although
it is now necessary to add an "r_active" flag, since
it is no longer to use the m_rdma_op pointer as an
indicator of if an rdma op is present.

rdma SGs allocated from rm sg pool.

rds_rm_size also gets bigger. It's a little inefficient to
run through CMSGs twice, but it makes later steps a lot smoother.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: fold rdma.h into rds.h
Andy Grover [Tue, 12 Jan 2010 20:57:27 +0000 (12:57 -0800)]
RDS: fold rdma.h into rds.h

RDMA is now an intrinsic part of RDS, so it's easier to just have
a single header.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Explicitly allocate rm in sendmsg()
Andy Grover [Tue, 12 Jan 2010 20:56:06 +0000 (12:56 -0800)]
RDS: Explicitly allocate rm in sendmsg()

r_m_copy_from_user used to allocate the rm as well as kernel
buffers for the data, and then copy the data in. Now, sendmsg()
allocates the rm, although the data buffer alloc still happens
in r_m_copy_from_user.

SGs are still allocated with rm, but now r_m_alloc_sgs() is
used to reserve them. This allows multiple SG lists to be
allocated from the one rm -- this is important once we also
want to alloc our rdma sgl from this pool.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: cleanup/fix rds_rdma_unuse
Andy Grover [Tue, 12 Jan 2010 20:37:17 +0000 (12:37 -0800)]
RDS: cleanup/fix rds_rdma_unuse

First, it looks to me like the atomic_inc is wrong.
We should be decrementing refcount only once here, no? It's
already being done by the mr_put() at the end.

Second, simplify the logic a bit by bailing early (with a warning)
if !mr.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: break out rdma and data ops into nested structs in rds_message
Andy Grover [Tue, 12 Jan 2010 20:15:02 +0000 (12:15 -0800)]
RDS: break out rdma and data ops into nested structs in rds_message

Clearly separate rdma-related variables in rm from data-related ones.
This is in anticipation of adding atomic support.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: cleanup: remove "== NULL"s and "!= NULL"s in ptr comparisons
Andy Grover [Tue, 12 Jan 2010 19:56:44 +0000 (11:56 -0800)]
RDS: cleanup: remove "== NULL"s and "!= NULL"s in ptr comparisons

Favor "if (foo)" style over "if (foo != NULL)".

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: move rds_shutdown_worker impl. to rds_conn_shutdown
Andy Grover [Fri, 11 Jun 2010 20:49:13 +0000 (13:49 -0700)]
RDS: move rds_shutdown_worker impl. to rds_conn_shutdown

This fits better in connection.c, rather than threads.c.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Fix locking in send on m_rs_lock
Andy Grover [Mon, 29 Mar 2010 23:50:54 +0000 (16:50 -0700)]
RDS: Fix locking in send on m_rs_lock

Do not nest m_rs_lock under c_lock

Disable interrupts in {rdma,atomic}_send_complete

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Rewrite rds_send_drop_to() for clarity
Andy Grover [Sat, 20 Feb 2010 02:01:41 +0000 (18:01 -0800)]
RDS: Rewrite rds_send_drop_to() for clarity

This function has been the source of numerous bugs; it's just
too complicated. Simplified to nest spinlocks cleanly within
the second loop body, and kick out early if there are no
rms to drop.

This will be a little slower because conn lock is grabbed for
each entry instead of "caching" the lock across rms, but this
should be entirely irrelevant to fastpath performance.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Fix corrupted rds_mrs
Tina Yang [Thu, 1 Apr 2010 21:09:00 +0000 (14:09 -0700)]
RDS: Fix corrupted rds_mrs

On second look at this bug (OFED #2002), it seems that the
collision is not with the retransmission queue (packet acked
by the peer), but with the local send completion.  A theoretical
sequence of events (from time t0 to t3) is thought to be as
follows,

Thread #1
t0:
    sock_release
    rds_release
    rds_send_drop_to /* wait on send completion */
t2:
    rds_rdma_drop_keys()   /* destroy & free all mrs */

Thread #2
t1:
    rds_ib_send_cq_comp_handler
    rds_ib_send_unmap_rm
    rds_message_unmapped   /* wake up #1 @ t0 */
t3:
    rds_message_put
    rds_message_purge
    rds_mr_put   /* memory corruption detected */

The problem with the rds_rdma_drop_keys() is it could
remove a mr's refcount more than its due (i.e. repeatedly
as long as it still remains in the tree (mr->r_refcount > 0)).
Theoretically it should remove only one reference - reference
by the tree.

        /* Release any MRs associated with this socket */
        while ((node = rb_first(&rs->rs_rdma_keys))) {
                mr = container_of(node, struct rds_mr, r_rb_node);
                if (mr->r_trans == rs->rs_transport)
                        mr->r_invalidate = 0;
                rds_mr_put(mr);
        }

I think the correct way of doing it is to remove the mr from
the tree and rds_destroy_mr it first, then a rds_mr_put()
to decrement its reference count by one.  Whichever thread
holds the last reference will free the mr via rds_mr_put().

Signed-off-by: Tina Yang <tina.yang@oracle.com>
Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agoRDS: Fix BUG_ONs to not fire when in a tasklet
Andy Grover [Sat, 13 Mar 2010 00:22:32 +0000 (16:22 -0800)]
RDS: Fix BUG_ONs to not fire when in a tasklet

in_interrupt() is true in softirqs. The BUG_ONs are supposed
to check for if irqs are disabled, so we should use
BUG_ON(irqs_disabled()) instead, duh.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
14 years agonet: poll() optimizations
Eric Dumazet [Mon, 6 Sep 2010 11:13:50 +0000 (11:13 +0000)]
net: poll() optimizations

No need to test twice sk->sk_shutdown & RCV_SHUTDOWN

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agomlx4_en: Fixed Ethtool statistics report
Yevgeny Petrilin [Sun, 5 Sep 2010 22:20:24 +0000 (22:20 +0000)]
mlx4_en: Fixed Ethtool statistics report

The values didn't match the title after removing the LRO
statistics in commit fa37a9586f92051de03a13e55e5ec3880bb6783e

Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agomlx4_en: Consider napi_get_frags() failure.
Yevgeny Petrilin [Sun, 5 Sep 2010 22:20:11 +0000 (22:20 +0000)]
mlx4_en: Consider napi_get_frags() failure.

If failed to get skb frags using napi_get_frags(),
the packet is dropped.

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet/caifcaif_dev.c: Use netdev_<level>
Joe Perches [Sun, 5 Sep 2010 22:08:09 +0000 (22:08 +0000)]
net/caifcaif_dev.c: Use netdev_<level>

Convert pr_<level>("%s" ..., (struct netdev *)->name ...)
to netdev_<level>((struct netdev *), ...)

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet/caif: Use pr_fmt
Joe Perches [Sun, 5 Sep 2010 21:31:11 +0000 (21:31 +0000)]
net/caif: Use pr_fmt

This patch standardizes caif message logging prefixes.

Add #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
Add missing "\n"s to some logging messages
Convert pr_warning to pr_warn

This changes the logging message prefix from CAIF: to caif:
for all uses but caif_socket.c and chnl_net.c.  Those now use
their filename without extension.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/atm/firestream.c: Fix unsigned return type
Julia Lawall [Sun, 5 Sep 2010 09:00:23 +0000 (09:00 +0000)]
drivers/atm/firestream.c: Fix unsigned return type

The function has an unsigned return type, but returns a negative constant
to indicate an error condition.  The result of calling the function is
always stored in a variable of type (signed) int, and thus unsigned can be
dropped from the return type.

A sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@exists@
identifier f;
constant C;
@@

 unsigned f(...)
 { <+...
*  return -C;
 ...+> }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet/9p/trans_fd.c: Fix unsigned return type
Julia Lawall [Sun, 5 Sep 2010 09:00:21 +0000 (09:00 +0000)]
net/9p/trans_fd.c: Fix unsigned return type

The function has an unsigned return type, but returns a negative constant
to indicate an error condition.  The result of calling the function is
always stored in a variable of type (signed) int, and thus unsigned can be
dropped from the return type.

A sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@exists@
identifier f;
constant C;
@@

 unsigned f(...)
 { <+...
*  return -C;
 ...+> }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net: Removing undead ifdef CHELSIO_T1_1G
Christian Dietrich [Mon, 6 Sep 2010 04:36:25 +0000 (04:36 +0000)]
drivers/net: Removing undead ifdef CHELSIO_T1_1G

The CHELSIO_T1_1G ifdef isn't necessary at this point, because it is
checked in an outer ifdef level already and has no effect here.

Signed-off-by: Christian Dietrich <qy03fugy@stud.informatik.uni-erlangen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/jme: Use pr_<level>
Joe Perches [Sat, 4 Sep 2010 22:21:05 +0000 (22:21 +0000)]
drivers/net/jme: Use pr_<level>

Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Convert jeprintk to pr_err
Remove jeprintk macro define
Remove periods from end of logging messages
Coalesce format strings

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoisdn: cleanup: make buffer smaller
Dan Carpenter [Sat, 4 Sep 2010 08:33:03 +0000 (08:33 +0000)]
isdn: cleanup: make buffer smaller

This showed up in my audit because we use strcpy() to copy "ds" into a
32 character buffer inside the isdn_tty_dial() function.  But it turns
out that we only ever use the first 32 characters so it's OK.  I have
changed the declaration to make the static checkers happy.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoisdn: potential buffer overflows
Dan Carpenter [Sat, 4 Sep 2010 08:38:59 +0000 (08:38 +0000)]
isdn: potential buffer overflows

cs->ics.parm.setup.phone is a 32 character array.  In each of these
cases we're copying from a 35 character array into a 32 character array
so we should use strlcpy() instead of strcpy().

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoNET: bna, fix lock imbalance
Jiri Slaby [Sat, 4 Sep 2010 02:08:41 +0000 (02:08 +0000)]
NET: bna, fix lock imbalance

bnad_set_rx_mode omit to unlock bna_lock on one fail path. Fix that.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Debashis Dutt <ddutt@brocade.com>
Cc: Rasesh Mody <rmody@brocade.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/fs_enet/fs_enet-main.c: Add of_node_put to avoid memory leak
Julia Lawall [Sat, 4 Sep 2010 00:12:43 +0000 (00:12 +0000)]
drivers/net/fs_enet/fs_enet-main.c: Add of_node_put to avoid memory leak

In this case, a device_node structure is stored in another structure that
is then freed without first decrementing the reference count of the
device_node structure.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
expression x;
identifier f;
position p1,p2;
@@

x@p1->f = \(of_find_node_by_path\|of_find_node_by_name\|of_find_node_by_phandle\|of_get_parent\|of_get_next_parent\|of_get_next_child\|of_find_compatible_node\|of_match_node\|of_find_node_by_type\|of_find_node_with_property\|of_find_matching_node\|of_parse_phandle\|of_node_get\)(...);
... when != of_node_put(x)
kfree@p2(x)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@
cocci.print_main("call",p1)
cocci.print_secs("free",p2)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: pskb_expand_head() optimization
Eric Dumazet [Thu, 2 Sep 2010 23:09:32 +0000 (23:09 +0000)]
net: pskb_expand_head() optimization

pskb_expand_head() blindly takes references on fragments before calling
skb_release_data(), potentially releasing these references.

We can add a fast path, avoiding these atomic operations, if we own the
last reference on skb->head.

Based on a previous patch from David

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Update module information and version
Santiago Leon [Fri, 3 Sep 2010 18:29:53 +0000 (18:29 +0000)]
ibmveth: Update module information and version

Add an entry to the MAINTAINERS file for ibmveth, clean up the copyright
and add all authors. Change the name of the module to reflect the product name
over the last number of years.

Considering all the changes we have made, bump the driver version.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Remove some unnecessary include files
Santiago Leon [Fri, 3 Sep 2010 18:29:47 +0000 (18:29 +0000)]
ibmveth: Remove some unnecessary include files

These files probably came across from the skeleton driver. Remove them.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Convert driver specific assert to BUG_ON
Santiago Leon [Fri, 3 Sep 2010 18:29:41 +0000 (18:29 +0000)]
ibmveth: Convert driver specific assert to BUG_ON

We had a driver specific assert function which wasn't enabled most of the
time. Convert them to BUG_ON and enable them all the time.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Return -EINVAL on all ->probe errors
Santiago Leon [Fri, 3 Sep 2010 18:29:36 +0000 (18:29 +0000)]
ibmveth: Return -EINVAL on all ->probe errors

We had a few cases where we returned success on error.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Coding style fixes
Santiago Leon [Fri, 3 Sep 2010 18:29:30 +0000 (18:29 +0000)]
ibmveth: Coding style fixes

Fix most of the kernel coding style issues in ibmveth.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Some formatting fixes
Santiago Leon [Fri, 3 Sep 2010 18:29:25 +0000 (18:29 +0000)]
ibmveth: Some formatting fixes

IbmVethNumBufferPools -> IBMVETH_NUM_BUFF_POOLS

Also change IBMVETH_MAX_MTU -> IBMVETH_MIN_MTU, it refers to the minimum
size not the maximum.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Convert driver specific error functions to netdev_err
Santiago Leon [Fri, 3 Sep 2010 18:29:19 +0000 (18:29 +0000)]
ibmveth: Convert driver specific error functions to netdev_err

Use netdev_err to standardise the error output.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Convert driver specific debug to netdev_dbg
Santiago Leon [Fri, 3 Sep 2010 18:29:14 +0000 (18:29 +0000)]
ibmveth: Convert driver specific debug to netdev_dbg

Use netdev_dbg to standardise the debug output.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Remove redundant function prototypes
Santiago Leon [Fri, 3 Sep 2010 18:29:08 +0000 (18:29 +0000)]
ibmveth: Remove redundant function prototypes

These functions appear before their use, so we can remove the redundant
prototypes.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Convert to netdev_alloc_skb
Santiago Leon [Fri, 3 Sep 2010 18:29:03 +0000 (18:29 +0000)]
ibmveth: Convert to netdev_alloc_skb

We were using alloc_skb which doesn't create any headroom. Change it to
use netdev_alloc_skb to match most other drivers.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: remove procfs code
Santiago Leon [Fri, 3 Sep 2010 18:28:58 +0000 (18:28 +0000)]
ibmveth: remove procfs code

We export all the driver specific statistics via ethtool, so there is no need
to duplicate this in procfs.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Enable IPv6 checksum offload
Santiago Leon [Fri, 3 Sep 2010 18:28:52 +0000 (18:28 +0000)]
ibmveth: Enable IPv6 checksum offload

This patch enables TCP checksum offload support for IPv6 on ibmveth.
This completely eliminates the generation and checking of the checksum
for IPv6 packets that are completely virtual and never touch a physical
network.  A basic TCPIPV6_STREAM netperf run showed a ~30% throughput
improvement when an MTU of 64000 was used.

This featured is enabled by default, as is the case for IPv4 checksum
offload.  When checksum offload is enabled the driver will negotiate
IPv4 and IPv6 offload with the firmware separately and enable what
is available.  As long as either IPv4 or IPv6 offload is supported
and enabled the device will report that checksum offload is enabled.
The device stats, available through ethtool, will display which
checksum offload features are supported/enabled by firmware.

Performance testing against a stock kernel shows no regression for IPv4
or IPv6 in terms of throughput or processor utilization with checksum
disabled or enabled.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Remove duplicate checksum offload setup code
Santiago Leon [Fri, 3 Sep 2010 18:28:47 +0000 (18:28 +0000)]
ibmveth: Remove duplicate checksum offload setup code

Remove code in the device probe function where we set up the checksum
offload feature and replace it with a call to an existing function that
is doing the same.  This is done to clean up the driver in preparation
of adding IPv6 checksum offload support.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Add optional flush of rx buffer
Santiago Leon [Fri, 3 Sep 2010 18:28:41 +0000 (18:28 +0000)]
ibmveth: Add optional flush of rx buffer

On some machines we can improve the bandwidth by ensuring rx buffers are
not in the cache. Add a module option that is disabled by default that flushes
rx buffers on insertion.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Add scatter-gather support
Santiago Leon [Fri, 3 Sep 2010 18:28:36 +0000 (18:28 +0000)]
ibmveth: Add scatter-gather support

ibmveth can scatter gather up to 6 segments. If we go over this then
we have no option but to call skb_linearize, like other drivers with
similar limitations do.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Use lighter weight read memory barrier in ibmveth_poll
Anton Blanchard [Tue, 7 Sep 2010 01:21:41 +0000 (18:21 -0700)]
ibmveth: Use lighter weight read memory barrier in ibmveth_poll

We want to order the read in ibmveth_rxq_pending_buffer and the read of
ibmveth_rxq_buffer_valid which are both cacheable memory. smp_rmb() is good
enough for this.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibmveth: Add rx_copybreak
Santiago Leon [Fri, 3 Sep 2010 18:28:25 +0000 (18:28 +0000)]
ibmveth: Add rx_copybreak

For small packets, create a new skb and copy the packet into it so we
avoid tearing down and creating a TCE entry.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>