openwrt/staging/blogic.git
14 years agoBluetooth: Fix spec error in the RemoteBusy Logic
Gustavo F. Padovan [Wed, 5 May 2010 02:16:01 +0000 (23:16 -0300)]
Bluetooth: Fix spec error in the RemoteBusy Logic

On the receipt of an RR(P=1) under RemoteBusy set to TRUE(on the RECV
state table) we have to call sendIorRRorRNR(F=1) and just after set
RemoteBusy to False. This leads to a freeze in the sending process since
it's not allowed send data with RemoteBusy set to true and no one
call SendPending-I-Frames after set RemoteBusy to false(The last action
for that event).

Actually sendIorRRorRNR() calls SendPending-I-Frames but at that moment
RemoteBusy is still True and we cannot send any frame, after, no one
calls SendPending-I-Frames again and the sending process stops.

The solution here is to set RemoteBusy to false inside
SendPending-I-Frames just before call SendPending-I-Frames. That will
make SendPending-I-Frames able to send frames. This solution is similar
to what RR(P=0)(F=0) on the RECV table and RR(P=1) on the SREJ_SENT
table do.

Actually doesn't make any sense call SendPending-I-Frames if we can send
any frame, i. e., RemoteBusy is True.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Prevents buffer overflow on l2cap_ertm_reassembly_sdu()
Gustavo F. Padovan [Sat, 1 May 2010 19:15:45 +0000 (16:15 -0300)]
Bluetooth: Prevents buffer overflow on l2cap_ertm_reassembly_sdu()

The checks should be done before the the memcpy to avoid buffer
overflow.

Reported-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix race condition on l2cap_ertm_send()
Gustavo F. Padovan [Sat, 1 May 2010 19:15:45 +0000 (16:15 -0300)]
Bluetooth: Fix race condition on l2cap_ertm_send()

l2cap_ertm_send() can be called both from user context and bottom half
context. The socket locks for that contexts are different, the user
context uses a mutex(which can sleep) and the second one uses a
spinlock_bh. That creates a race condition when we have interruptions on
both contexts at the same time.

The better way to solve this is to add a new spinlock to lock
l2cap_ertm_send() and the vars it access. The other solution was to defer
l2cap_ertm_send() with a workqueue, but we the sending process already
has one defer on the hci layer. It's not a good idea add another one.

The patch refactor the code to create l2cap_retransmit_frames(), then we
encapulate the lock of l2cap_ertm_send() for some call. It also changes
l2cap_retransmit_frame() to l2cap_retransmit_one_frame() to avoid
confusion

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Add wait_queue to wait ack of all sent packets
Gustavo F. Padovan [Sat, 1 May 2010 19:15:44 +0000 (16:15 -0300)]
Bluetooth: Add wait_queue to wait ack of all sent packets

To guarantee that all packets we sent were received we need to wait for
theirs ack before shutdown the socket.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Implement Local Busy Condition handling
Gustavo F. Padovan [Sat, 1 May 2010 19:15:44 +0000 (16:15 -0300)]
Bluetooth: Implement Local Busy Condition handling

Supports Local Busy condition handling through a waitqueue that wake ups
each 200ms and try to push the packets to the upper layer. If it can
push all the queue then it leaves the Local Busy state.

The patch modifies the behaviour of l2cap_ertm_reassembly_sdu() to
support retry of the push operation.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Completes the I-frame tx_seq check logic on RECV
João Paulo Rechi Vita [Sat, 1 May 2010 19:15:44 +0000 (16:15 -0300)]
Bluetooth: Completes the I-frame tx_seq check logic on RECV

Add checks for invalid tx_seq and fixes the duplicated tx_seq check.

Signed-off-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Implement missing parts of the Invalid Frame Detection
Gustavo F. Padovan [Sat, 1 May 2010 19:15:44 +0000 (16:15 -0300)]
Bluetooth: Implement missing parts of the Invalid Frame Detection

There is a plenty of situation where ERTM shall close the channel, this
commit treats the cases regarding Invalid Frame Detection.
It create one reassembly SDU function for ERTM and other for Streaming
Mode to make the Invalid Frame Detection handling less complex.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Refactor l2cap_retransmit_frame()
Gustavo F. Padovan [Sat, 1 May 2010 19:15:44 +0000 (16:15 -0300)]
Bluetooth: Refactor l2cap_retransmit_frame()

Make the code flow cleaner and changes the function to void.
It also fixes a potential NULL dereference with skb.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Make hci_send_acl() void
Gustavo F. Padovan [Sat, 1 May 2010 19:15:43 +0000 (16:15 -0300)]
Bluetooth: Make hci_send_acl() void

hci_send_acl can't fail, so we can make it void. This patch changes
that and all the funcions that use hci_send_acl().
That change exposed a bug on sending connectionless data. We were not
reporting the lenght send back to the user space.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix lockdep annotation on ERTM
Gustavo F. Padovan [Thu, 6 May 2010 01:09:15 +0000 (22:09 -0300)]
Bluetooth: Fix lockdep annotation on ERTM

A spin_lock_init() call was missing. :)

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Check if we really are in WAIT_F when F bit comes
Gustavo F. Padovan [Wed, 5 May 2010 23:05:57 +0000 (20:05 -0300)]
Bluetooth: Check if we really are in WAIT_F when F bit comes

F-bit set should be processed only if we are in the WAIT_F state.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Remove unneeded control vars
Gustavo F. Padovan [Wed, 5 May 2010 22:58:27 +0000 (19:58 -0300)]
Bluetooth: Remove unneeded control vars

Trivial clean up.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Remove set of SrejSaveReqSeq under receipt of REJ frame
Gustavo F. Padovan [Wed, 5 May 2010 23:56:43 +0000 (20:56 -0300)]
Bluetooth: Remove set of SrejSaveReqSeq under receipt of REJ frame

That action is not specified by the ERTM spec, so removing it.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix errors reported by checkpatch.pl
Gustavo F. Padovan [Sat, 1 May 2010 19:15:43 +0000 (16:15 -0300)]
Bluetooth: Fix errors reported by checkpatch.pl

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Don't set control bits to zero first
Gustavo F. Padovan [Sat, 1 May 2010 19:15:43 +0000 (16:15 -0300)]
Bluetooth: Don't set control bits to zero first

We can set the SAR bits in the control field directly.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Close L2CAP channel on invalid ReqSeq
João Paulo Rechi Vita [Sat, 1 May 2010 19:15:43 +0000 (16:15 -0300)]
Bluetooth: Close L2CAP channel on invalid ReqSeq

Signed-off-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix SDU reassembly under SREJ
Gustavo F. Padovan [Sat, 1 May 2010 19:15:43 +0000 (16:15 -0300)]
Bluetooth: Fix SDU reassembly under SREJ

The code was reusing the control var without its reinitialization.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Check if mode is supported on getsockopt
João Paulo Rechi Vita [Sat, 1 May 2010 19:15:42 +0000 (16:15 -0300)]
Bluetooth: Check if mode is supported on getsockopt

Add this check to getsockopt makes possible to fail early instead of
waiting until listen / connect.

Signed-off-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Add SOCK_STREAM support to L2CAP
Gustavo F. Padovan [Sat, 1 May 2010 19:15:42 +0000 (16:15 -0300)]
Bluetooth: Add SOCK_STREAM support to L2CAP

if enable_ertm is true and we have SOCK_STREAM the default mode will be
ERTM, otherwise Basic Mode.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Add Kconfig option for L2CAP Extended Features
Gustavo F. Padovan [Sat, 1 May 2010 19:15:42 +0000 (16:15 -0300)]
Bluetooth: Add Kconfig option for L2CAP Extended Features

The L2CAP Extended Features are still unstable and under development,
so we are adding them under the EXPERIMENTAL flag to get more feedback
on them. L2CAP Extended Features includes the Enhanced Retransmission
and Streaming Modes, Frame Check Sequence (FCS), and Segmentation and
Reassemby (SAR).

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Optimize SREJ_QUEUE append
Gustavo F. Padovan [Sat, 1 May 2010 19:15:42 +0000 (16:15 -0300)]
Bluetooth: Optimize SREJ_QUEUE append

When the I-frame received is the expected, i.e., its tx_seq is equal to
expected_tx_seq and we are under a SREJ, we can just add it to the tail
of the list. Doing that we change the complexity from O(n) to O(1).

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix drop of acked packets on ERTM
Gustavo F. Padovan [Sat, 1 May 2010 19:15:42 +0000 (16:15 -0300)]
Bluetooth: Fix drop of acked packets on ERTM

l2cap_drop_acked_frames() was droping not sent packets, causing them to
be not transmitted.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix crash when monitor timeout expires
Gustavo F. Padovan [Sat, 1 May 2010 19:15:41 +0000 (16:15 -0300)]
Bluetooth: Fix crash when monitor timeout expires

The code was crashing due to a invalid access to hci_conn after the
channel disconnect.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix bug when retransmitting I-frames
Gustavo F. Padovan [Sat, 1 May 2010 19:15:41 +0000 (16:15 -0300)]
Bluetooth: Fix bug when retransmitting I-frames

If there is no frames to retransmit l2cap was crashing the kernel, now
we check if the queue is empty first.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Enable option to configure Max Transmission value via sockopt
Gustavo F. Padovan [Sat, 1 May 2010 19:15:41 +0000 (16:15 -0300)]
Bluetooth: Enable option to configure Max Transmission value via sockopt

With the sockopt extension we can set a per-channel MaxTx value.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Add module parameter for txWindow size on L2CAP
Gustavo F. Padovan [Sat, 1 May 2010 19:15:41 +0000 (16:15 -0300)]
Bluetooth: Add module parameter for txWindow size on L2CAP

Very useful for testing purposes.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
[jprvita@profusion.mobi: improved parameter description]
Signed-off-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Change acknowledgement to use the value of txWindow
Gustavo F. Padovan [Sat, 1 May 2010 19:15:41 +0000 (16:15 -0300)]
Bluetooth: Change acknowledgement to use the value of txWindow

Now that we can set the txWindow we need to change the acknowledgement
procedure to ack after each (pi->txWindow/6 + 1). The plus 1 is to avoid
the zero value.
It also renames pi->num_to_ack to a better name: pi->num_acked.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Add sockopt configuration for txWindow on L2CAP
Gustavo F. Padovan [Sat, 1 May 2010 19:15:40 +0000 (16:15 -0300)]
Bluetooth: Add sockopt configuration for txWindow on L2CAP

Now we can set/get Transmission Window size via sockopt.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Send Ack after clear the SREJ list
Gustavo F. Padovan [Sat, 1 May 2010 19:15:40 +0000 (16:15 -0300)]
Bluetooth: Send Ack after clear the SREJ list

As specified by Bluetooth 3.0 spec we shall send an acknowledgment using
the Send-Ack() after clear the SREJ list.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Check the SDU size against the MTU value
Gustavo F. Padovan [Sat, 1 May 2010 19:15:40 +0000 (16:15 -0300)]
Bluetooth: Check the SDU size against the MTU value

If the SDU size is greater than the MTU something is wrong, so report
an error.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
[jprvita@profusion.mobi: set err to appropriate errno value]
Signed-off-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Add le16 macro to Retransmission and Monitor Timeouts values
Gustavo F. Padovan [Sat, 1 May 2010 19:15:40 +0000 (16:15 -0300)]
Bluetooth: Add le16 macro to Retransmission and Monitor Timeouts values

Fix a possible problem with Big Endian machines.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix configuration of the MPS value
Gustavo F. Padovan [Sat, 1 May 2010 19:15:40 +0000 (16:15 -0300)]
Bluetooth: Fix configuration of the MPS value

We were accepting values bigger than we can accept. This was leading
ERTM to drop packets because of wrong FCS checks.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Read RFC conf option on a successful Conf RSP
Gustavo F. Padovan [Sat, 1 May 2010 19:15:39 +0000 (16:15 -0300)]
Bluetooth: Read RFC conf option on a successful Conf RSP

On Enhanced Retransmission Mode and Streaming Mode a entity can send, on
a successful Conf RSP, new values for the RFC fields. For example, the
entity can send txWindow and MPS values less than the value received on
a Conf REQ.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Ignore Tx Window value with Streaming mode
Gustavo F. Padovan [Sat, 1 May 2010 19:15:39 +0000 (16:15 -0300)]
Bluetooth: Ignore Tx Window value with Streaming mode

Tx Window value shall not be used with Streaming Mode and the receiver
of the config Request shall ignore its value.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Add timer to Acknowledge I-frames
Gustavo F. Padovan [Sat, 1 May 2010 19:15:39 +0000 (16:15 -0300)]
Bluetooth: Add timer to Acknowledge I-frames

We ack I-frames on each txWindow/5 I-frames received, but if the sender
stop to send I-frames and it's not a txWindow multiple we can leave some
frames unacked.
So I added a timer to ack I-frames on this case. The timer expires in
200ms.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Finish implementation for Rec RR (P=1) on ERTM
Gustavo F. Padovan [Sat, 1 May 2010 19:15:39 +0000 (16:15 -0300)]
Bluetooth: Finish implementation for Rec RR (P=1) on ERTM

Now the code handles the case under SREJ_SENT state.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Remove duplicate use of __get_reqseq() macro on L2CAP
Gustavo F. Padovan [Sat, 1 May 2010 19:15:38 +0000 (16:15 -0300)]
Bluetooth: Remove duplicate use of __get_reqseq() macro on L2CAP

tx_seq var already has the value of __get_reqseq().

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Group the ack of I-frames into l2cap_data_channel_rrframe()
Gustavo F. Padovan [Sat, 1 May 2010 19:15:38 +0000 (16:15 -0300)]
Bluetooth: Group the ack of I-frames into l2cap_data_channel_rrframe()

It also fix a bug: we weren't acknowledging I-frames when P=1.
Note that when F=1 we are acknowledging packets before setting
RemoteBusy to False. The spec says we should do that in the opposite
order, but acknowledment of packets doesn't care about RemoteBusy flag
so we can do that in the order we want.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Handle all cases of receipt of RNR-frames into L2CAP
Gustavo F. Padovan [Sat, 1 May 2010 19:15:38 +0000 (16:15 -0300)]
Bluetooth: Handle all cases of receipt of RNR-frames into L2CAP

We weren't handling the receipt under SREJ_SENT state table.
It also introduce l2cap_send_srejtail(). It will be used in the nexts
commits too.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Split l2cap_data_channel_sframe()
Gustavo F. Padovan [Sat, 1 May 2010 19:15:38 +0000 (16:15 -0300)]
Bluetooth: Split l2cap_data_channel_sframe()

Create a function for each type fo S-frame and avoid a lot of nested
code.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Add Recv RR (P=0)(F=0) for SREJ_SENT state on ERTM
Gustavo F. Padovan [Sat, 1 May 2010 19:15:38 +0000 (16:15 -0300)]
Bluetooth: Add Recv RR (P=0)(F=0) for SREJ_SENT state on ERTM

This finishes the implementation of Recv RR (P=0)(F=0) for the Enhanced
Retransmission Mode on L2CAP.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Move set of P-bit to l2cap_send_sframe()
Gustavo F. Padovan [Sat, 1 May 2010 19:15:37 +0000 (16:15 -0300)]
Bluetooth: Move set of P-bit to l2cap_send_sframe()

Abstract the send of of P-bit and avoids code duplication like we
did with the setting of F-bit.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Implement SendAck() Action on ERTM.
Gustavo F. Padovan [Sat, 1 May 2010 19:15:37 +0000 (16:15 -0300)]
Bluetooth: Implement SendAck() Action on ERTM.

Shall be used to ack received frames, It must decide type of
acknowledgment between a RR frame, a RNR frame or transmission of
pending I-frames.
It also modifies l2cap_ertm_send() to report the number of frames sent.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Check if SDU size is greater than MTU on L2CAP
Gustavo F. Padovan [Sat, 1 May 2010 19:15:37 +0000 (16:15 -0300)]
Bluetooth: Check if SDU size is greater than MTU on L2CAP

After reassembly the SDU we need to check his size. It can't overflow
the MTU size.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Check the minimum {I,S}-frame size into L2CAP
Gustavo F. Padovan [Sat, 1 May 2010 19:15:37 +0000 (16:15 -0300)]
Bluetooth: Check the minimum {I,S}-frame size into L2CAP

All packets with size fewer than the minimum specified is dropped.
Note that the size of the l2cap basic header, FCS and SAR fields are
already subtracted of len at the moment of the size check.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Support case with F bit set under WAIT_F state.
Gustavo F. Padovan [Sat, 1 May 2010 19:15:37 +0000 (16:15 -0300)]
Bluetooth: Support case with F bit set under WAIT_F state.

On receipt of a F=1 under WAIT_F state ERTM shall stop monitor timer and
start retransmission timer (if there are unacked frames).

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Implement 'Send IorRRorRNR' event
Gustavo F. Padovan [Sat, 1 May 2010 19:15:36 +0000 (16:15 -0300)]
Bluetooth: Implement 'Send IorRRorRNR' event

After receive a RR with P bit set ERTM shall use this funcion to choose
what type of frame to reply with F bit = 1.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Use a l2cap_pinfo struct instead l2cap_pi() macro
Gustavo F. Padovan [Sat, 1 May 2010 19:15:36 +0000 (16:15 -0300)]
Bluetooth: Use a l2cap_pinfo struct instead l2cap_pi() macro

Trivial clean up.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix ACL MTU issue
Gustavo F. Padovan [Sat, 1 May 2010 19:15:36 +0000 (16:15 -0300)]
Bluetooth: Fix ACL MTU issue

ERTM and Streaming Modes was having problems when the ACL MTU is lower
than MPS. The 'minus 10' is to take in account the header and fcs
lenghts.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix expected_tx_seq calculation on L2CAP
Gustavo F. Padovan [Sat, 1 May 2010 19:15:36 +0000 (16:15 -0300)]
Bluetooth: Fix expected_tx_seq calculation on L2CAP

All operation related to the txWindow should be modulo 64.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix memory leak of S-frames into L2CAP
Gustavo F. Padovan [Sat, 1 May 2010 19:15:35 +0000 (16:15 -0300)]
Bluetooth: Fix memory leak of S-frames into L2CAP

l2cap_data_channel do not free the S-frame, so we free it here.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Move specific Basic Mode code to the right place
Gustavo F. Padovan [Sat, 1 May 2010 19:15:35 +0000 (16:15 -0300)]
Bluetooth: Move specific Basic Mode code to the right place

Inside "case L2CAP_MODE_BASIC:" we don't need to check for sk_type and
L2CAP mode. So only the length check is fine.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Trivial clean ups to SCO
Gustavo F. Padovan [Sat, 1 May 2010 19:15:35 +0000 (16:15 -0300)]
Bluetooth: Trivial clean ups to SCO

Remove extra braces and labels, break over column 80 lines, etc

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Make hci_send_sco() void
Gustavo F. Padovan [Sat, 1 May 2010 19:15:35 +0000 (16:15 -0300)]
Bluetooth: Make hci_send_sco() void

It also removes an unneeded check for the MTU. The check is done before
on sco_send_frame()

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix wrong packet type count increment
Gustavo F. Padovan [Sat, 1 May 2010 19:15:34 +0000 (16:15 -0300)]
Bluetooth: Fix wrong packet type count increment

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Use the proper function cast to get hdr data
Gustavo F. Padovan [Sat, 1 May 2010 19:15:34 +0000 (16:15 -0300)]
Bluetooth: Use the proper function cast to get hdr data

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix return value when bt_skb_alloc fails
Gustavo F. Padovan [Sat, 1 May 2010 19:15:34 +0000 (16:15 -0300)]
Bluetooth: Fix return value when bt_skb_alloc fails

Set the proper error(ENOMEM), instead of just return 0.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoipv4: remove ip_rt_secret timer (v4)
Neil Horman [Sat, 8 May 2010 08:57:52 +0000 (01:57 -0700)]
ipv4: remove ip_rt_secret timer (v4)

A while back there was a discussion regarding the rt_secret_interval timer.
Given that we've had the ability to do emergency route cache rebuilds for awhile
now, based on a statistical analysis of the various hash chain lengths in the
cache, the use of the flush timer is somewhat redundant.  This patch removes the
rt_secret_interval sysctl, allowing us to rely solely on the statistical
analysis mechanism to determine the need for route cache flushes.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoRevert "microblaze: Kill NET_SKB_PAD and NET_IP_ALIGN overrides."
David S. Miller [Fri, 7 May 2010 09:55:33 +0000 (02:55 -0700)]
Revert "microblaze: Kill NET_SKB_PAD and NET_IP_ALIGN overrides."

This reverts commit 39e0786d3cf39c6d2f47b4818ae2da8b8ebc9ce2.

On request from microblaze developers, they are going to handle
this differently.

Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobnx2: Add prefetches to rx path.
Michael Chan [Thu, 6 May 2010 08:58:13 +0000 (08:58 +0000)]
bnx2: Add prefetches to rx path.

Add prefetches of the skb and the next rx descriptor to speed up rx path.

Use prefetchw() for the skb [suggested by Eric Dumazet].

The rx descriptor is in skb->data which is mapped for streaming mode DMA.
Eric Dumazet pointed out that we should not prefetch the data before
dma_sync.  So we prefetch only if dma_sync is no_op on the system.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobnx2: Add GRO support.
Michael Chan [Thu, 6 May 2010 08:58:12 +0000 (08:58 +0000)]
bnx2: Add GRO support.

And turn on NETIF_F_GRO by default [requested by DaveM].

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotehuti: Remove unnecessary memset of netdev private data
Tobias Klauser [Thu, 6 May 2010 05:43:04 +0000 (05:43 +0000)]
tehuti: Remove unnecessary memset of netdev private data

The memory for the private data is allocated using kzalloc in
alloc_etherdev (or alloc_netdev_mq respectively) so there is no need to
set it to 0 again.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosunhme: Remove unnecessary memset of netdev private data
Tobias Klauser [Thu, 6 May 2010 05:41:44 +0000 (05:41 +0000)]
sunhme: Remove unnecessary memset of netdev private data

The memory for the private data is allocated using kzalloc in
alloc_etherdev (or alloc_netdev_mq respectively) so there is no need to
set it to 0 again.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosmc9194: Remove unnecessary memset of netdev private data
Tobias Klauser [Thu, 6 May 2010 05:41:31 +0000 (05:41 +0000)]
smc9194: Remove unnecessary memset of netdev private data

The memory for the private data is allocated using kzalloc in
alloc_etherdev (or alloc_netdev_mq respectively) so there is no need to
set it to 0 again.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoethoc: Remove unnecessary memset of napi member in netdev private data
Tobias Klauser [Thu, 6 May 2010 05:41:12 +0000 (05:41 +0000)]
ethoc: Remove unnecessary memset of napi member in netdev private data

The memory for the private data is allocated using kzalloc in
alloc_etherdev (or alloc_netdev_mq respectively) so there is no need to
set the napi member it to 0 explicitely.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobcm63xx_enet: Remove unnecessary memset of netdev private data
Tobias Klauser [Thu, 6 May 2010 05:40:58 +0000 (05:40 +0000)]
bcm63xx_enet: Remove unnecessary memset of netdev private data

The memory for the private data is allocated using kzalloc in
alloc_etherdev (or alloc_netdev_mq respectively) so there is no need to
set it to 0 again.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoKS8695: Remove unnecessary memset of netdev private data
Tobias Klauser [Thu, 6 May 2010 05:40:29 +0000 (05:40 +0000)]
KS8695: Remove unnecessary memset of netdev private data

The memory for the private data is allocated using kzalloc in
alloc_etherdev (or alloc_netdev_mq respectively) so there is no need to
set it to 0 again.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years ago3c523: Remove unnecessary memset of netdev private data
Tobias Klauser [Thu, 6 May 2010 05:39:46 +0000 (05:39 +0000)]
3c523: Remove unnecessary memset of netdev private data

The memory for the private data is allocated using kzalloc in
alloc_etherdev (or alloc_netdev_mq respectively) so there is no need to
set it to 0 again.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years ago3c507: Remove unnecessary memset of netdev private data
Tobias Klauser [Thu, 6 May 2010 05:39:11 +0000 (05:39 +0000)]
3c507: Remove unnecessary memset of netdev private data

The memory for the private data is allocated using kzalloc in
alloc_etherdev (or alloc_netdev_mq respectively) so there is no need to
set it to 0 again.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agorps: Various optimizations
Eric Dumazet [Fri, 7 May 2010 05:07:48 +0000 (22:07 -0700)]
rps: Various optimizations

Introduce ____napi_schedule() helper for callers in irq disabled
contexts. rps_trigger_softirq() becomes a leaf function.

Use container_of() in process_backlog() instead of accessing per_cpu
address.

Use a custom inlined version of __napi_complete() in process_backlog()
to avoid one locked instruction :

 only current cpu owns and manipulates this napi,
 and NAPI_STATE_SCHED is the only possible flag set on backlog.
 we can use a plain write instead of clear_bit(),
 and we dont need an smp_mb() memory barrier, since RPS is on,
 backlog is protected by a spinlock.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agomicroblaze: Kill NET_SKB_PAD and NET_IP_ALIGN overrides.
David S. Miller [Fri, 7 May 2010 05:01:53 +0000 (22:01 -0700)]
microblaze: Kill NET_SKB_PAD and NET_IP_ALIGN overrides.

NET_IP_ALIGN defaults to 2, no need to override.

NET_SKB_PAD is now 64, which is much larger than microblaze's
L1_CACHE_SIZE so no need to override that either.

Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: Increase NET_SKB_PAD to 64 bytes
Eric Dumazet [Fri, 7 May 2010 04:58:51 +0000 (21:58 -0700)]
net: Increase NET_SKB_PAD to 64 bytes

eth_type_trans() & get_rps_cpus() currently need two 64bytes cache
lines in packet to compute rxhash.

Increasing NET_SKB_PAD from 32 to 64 reduces the need to one cache
line only, and makes RPS faster.

NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8)

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoipv6: udp: make short packet logging consistent with ipv4
Bjørn Mork [Thu, 6 May 2010 03:44:35 +0000 (03:44 +0000)]
ipv6: udp: make short packet logging consistent with ipv4

Adding addresses and ports to the short packet log message,
like ipv4/udp.c does it, makes these messages a lot more useful:

[  822.182450] UDPv6: short packet: From [2001:db8:ffb4:3::1]:47839 23715/178 to [2001:db8:ffb4:3:5054:ff:feff:200]:1234

This requires us to drop logging in case pskb_may_pull() fails,
which also is consistent with ipv4/udp.c

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: emaclite: Use resource_size
Tobias Klauser [Wed, 5 May 2010 22:12:20 +0000 (22:12 +0000)]
net: emaclite: Use resource_size

Use the resource_size function instead of manually calculating the
resource size.  This reduces the chance of introducing off-by-one
errors.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoe1000e: Reset 82577/82578 PHY before first PHY register read
Bruce Allan [Wed, 5 May 2010 22:00:27 +0000 (22:00 +0000)]
e1000e: Reset 82577/82578 PHY before first PHY register read

Reset the PHY before first accessing it.  Doing so, ensure that the PHY is
in a known good state before we read/write PHY registers. This fixes a
driver probe failure.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoe1000e: reset MAC-PHY interconnect on 82577/82578 during Sx->S0
Bruce Allan [Wed, 5 May 2010 22:00:06 +0000 (22:00 +0000)]
e1000e: reset MAC-PHY interconnect on 82577/82578 during Sx->S0

During Sx->S0 transitions, the interconnect between the MAC and PHY on
82577/82578 can remain in SMBus mode instead of transitioning to the
PCIe-like mode required during normal operation.  Toggling the LANPHYPC
Value bit essentially resets the interconnect forcing it to the correct
mode.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetpoll: Use 'bool' for netpoll_rx() return type.
David S. Miller [Thu, 6 May 2010 08:20:10 +0000 (01:20 -0700)]
netpoll: Use 'bool' for netpoll_rx() return type.

Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobonding: make bonding support netpoll
WANG Cong [Thu, 6 May 2010 07:48:51 +0000 (00:48 -0700)]
bonding: make bonding support netpoll

Based on Andy's work, but I modified a lot.

Similar to the patch for bridge, this patch does:

1) implement the 2 methods to support netpoll for bonding;

2) modify netpoll during forwarding packets via bonding;

3) disable netpoll support of bonding when a netpoll-unabled device
   is added to bonding;

4) enable netpoll support when all underlying devices support netpoll.

Cc: Andy Gospodarek <gospo@redhat.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobridge: make bridge support netpoll
WANG Cong [Thu, 6 May 2010 07:48:24 +0000 (00:48 -0700)]
bridge: make bridge support netpoll

Based on the previous patch, make bridge support netpoll by:

1) implement the 2 methods to support netpoll for bridge;

2) modify netpoll during forwarding packets via bridge;

3) disable netpoll support of bridge when a netpoll-unabled device
   is added to bridge;

4) enable netpoll support when all underlying devices support netpoll.

Cc: David Miller <davem@davemloft.net>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetpoll: add generic support for bridge and bonding devices
WANG Cong [Thu, 6 May 2010 07:47:21 +0000 (00:47 -0700)]
netpoll: add generic support for bridge and bonding devices

This whole patchset is for adding netpoll support to bridge and bonding
devices. I already tested it for bridge, bonding, bridge over bonding,
and bonding over bridge. It looks fine now.

To make bridge and bonding support netpoll, we need to adjust
some netpoll generic code. This patch does the following things:

1) introduce two new priv_flags for struct net_device:
   IFF_IN_NETPOLL which identifies we are processing a netpoll;
   IFF_DISABLE_NETPOLL is used to disable netpoll support for a device
   at run-time;

2) introduce one new method for netdev_ops:
   ->ndo_netpoll_cleanup() is used to clean up netpoll when a device is
     removed.

3) introduce netpoll_poll_dev() which takes a struct net_device * parameter;
   export netpoll_send_skb() and netpoll_poll_dev() which will be used later;

4) hide a pointer to struct netpoll in struct netpoll_info, ditto.

5) introduce ->real_dev for struct netpoll.

6) introduce a new status NETDEV_BONDING_DESLAE, which is used to disable
   netconsole before releasing a slave, to avoid deadlocks.

Cc: David Miller <davem@davemloft.net>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoixgbevf: Cache PF ack bit in interrupt
Greg Rose [Wed, 5 May 2010 19:57:49 +0000 (19:57 +0000)]
ixgbevf: Cache PF ack bit in interrupt

When the PF acks a message from the VF the VF gets an interrupt.  It
must cache the ack bit so that polling SW will not miss the ack.  Also
avoid reading the message buffer on acks because that also will clear
the ack bit.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoixgbe: Streamline MC filter setup for VFs
Greg Rose [Wed, 5 May 2010 19:57:30 +0000 (19:57 +0000)]
ixgbe: Streamline MC filter setup for VFs

The driver was calling the set Rx mode function for every multicast
filter set by the VF.  When starting many VMs where each might have
multiple VLAN interfaces this would result in the function being
called hundreds or even thousands of times.  This is unnecessary
for the case of the imperfect filters used in the MTA and has been
streamlined to be more efficient.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoixgbe: Remove unneeded register writes in VF VLAN setup
Greg Rose [Wed, 5 May 2010 19:57:10 +0000 (19:57 +0000)]
ixgbe: Remove unneeded register writes in VF VLAN setup

The driver is unnecessarily writing values to VLAN control registers.
These writes already done elsewhere and are superfluous here.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoMerge branch 'vhost' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
David S. Miller [Thu, 6 May 2010 07:26:49 +0000 (00:26 -0700)]
Merge branch 'vhost' of git://git./linux/kernel/git/mst/vhost

14 years agoigb: reduce cache misses on tx cleanup
Nick Nunley [Tue, 4 May 2010 21:58:07 +0000 (21:58 +0000)]
igb: reduce cache misses on tx cleanup

This patch reduces the number of skb cache misses in the
clean_tx_irq path, and results in an overall increase
in tx packet throughput.

Signed-off-by: Nicholas Nunley <nicholasx.d.nunley@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoks8851: companion eeprom access through ethtool
Sebastien Jan [Wed, 5 May 2010 08:45:54 +0000 (08:45 +0000)]
ks8851: companion eeprom access through ethtool

Accessing ks8851 companion eeprom permits modifying the ks8851 stored
MAC address.

Example how to change the MAC address using ethtool, to set the
01:23:45:67:89:AB MAC address:
$ echo "0:AB8976452301" | xxd -r > mac.bin
$ sudo ethtool -E eth0 magic 0x8870 offset 2 < mac.bin

Signed-off-by: Sebastien Jan <s-jan@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoks8851: Low level functions for read/write to companion eeprom
Sebastien Jan [Wed, 5 May 2010 08:45:53 +0000 (08:45 +0000)]
ks8851: Low level functions for read/write to companion eeprom

Low-level functions provide 16bits words read and write capability
to ks8851 companion eeprom.

Signed-off-by: Sebastien Jan <s-jan@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoks8851: Add caching of CCR register
Sebastien Jan [Wed, 5 May 2010 08:45:52 +0000 (08:45 +0000)]
ks8851: Add caching of CCR register

CCR register contains information on companion eeprom availability.

Signed-off-by: Sebastien Jan <s-jan@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoforcedeth: Account for consumed budget in napi poll
Tom Herbert [Wed, 5 May 2010 18:15:21 +0000 (18:15 +0000)]
forcedeth: Account for consumed budget in napi poll

Repeated calls to nv_rx_process in napi poll routine do not take
portion of budget that has been consumed in previous calls.  Fix by
subtracting the number of packets processed.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetdev: octeon_mgmt: Remove some gratuitous blank lines.
David Daney [Wed, 5 May 2010 13:03:13 +0000 (13:03 +0000)]
netdev: octeon_mgmt: Remove some gratuitous blank lines.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetdev: octeon_mgmt: Try not to drop TX packets when stopping the queue.
David Daney [Wed, 5 May 2010 13:03:12 +0000 (13:03 +0000)]
netdev: octeon_mgmt: Try not to drop TX packets when stopping the queue.

Stop the queue when we add the packet that will fill it instead of dropping the packet

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetdev: octeon_mgmt: Free TX skbufs in a timely manner.
David Daney [Wed, 5 May 2010 13:03:11 +0000 (13:03 +0000)]
netdev: octeon_mgmt: Free TX skbufs in a timely manner.

We also reduce the high water mark to 1 so skbufs are not stranded for
long periods of time.  Since we are cleaning after each packet, no
need to do it in the transmit path.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetdev: octeon_mgmt: Fix race manipulating irq bits.
David Daney [Wed, 5 May 2010 13:03:10 +0000 (13:03 +0000)]
netdev: octeon_mgmt: Fix race manipulating irq bits.

Don't re-read the interrupt status register, clear the exact bits we
will be testing.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetdev: octeon_mgmt: Fix race condition freeing TX buffers.
David Daney [Wed, 5 May 2010 13:03:09 +0000 (13:03 +0000)]
netdev: octeon_mgmt: Fix race condition freeing TX buffers.

Under heavy load the TX cleanup tasklet and xmit threads would race
and try to free too many buffers.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetdev: octeon_mgmt: Use proper MAC addresses.
David Daney [Wed, 5 May 2010 13:03:08 +0000 (13:03 +0000)]
netdev: octeon_mgmt: Use proper MAC addresses.

The original implementation incorrectly uses netdev->dev_addrs.

Use netdev->uc instead.  Also use netdev_for_each_uc_addr to iterate
over the addresses.  Fix comment.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoixgbe: Add support for VF MAC and VLAN configuration
Greg Rose [Tue, 4 May 2010 22:12:06 +0000 (22:12 +0000)]
ixgbe: Add support for VF MAC and VLAN configuration

Add support for the "ip link set" and "ip link show" commands that allow
configuration of the virtual functions' MAC and port VLAN via user space
command line.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoixgbe: Add boolean parameter to ixgbe_set_vmolr
Greg Rose [Tue, 4 May 2010 22:11:46 +0000 (22:11 +0000)]
ixgbe: Add boolean parameter to ixgbe_set_vmolr

Add a boolean parameter to ixgbe-set_vmolr so that the caller can
specify whether the pool should accept untagged packets.  Required
for a follow on patch to enable administrative configuration of port
VLAN for virtual functions.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoe1000/e1000e: implement a simple interrupt moderation
Jesse Brandeburg [Tue, 4 May 2010 22:26:03 +0000 (22:26 +0000)]
e1000/e1000e: implement a simple interrupt moderation

Back before e1000-7.3.20, the e1000 driver had a simple algorithm that
managed interrupt moderation.  The driver was updated in 7.3.20 to
have the new "adaptive" interrupt moderation but we have customer
requests to redeploy the old way as an option.  This patch adds the
old functionality back.  The new functionality can be enabled via
module parameter or at runtime via ethtool.
Module parameter: (InterruptThrottleRate=4) to use this new
moderation method.
Ethtool method: ethtool -C ethX rx-usecs 4

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoe1000e: increase rx fifo size to 36K on 82574 and 82583
Alexander Duyck [Tue, 4 May 2010 22:25:42 +0000 (22:25 +0000)]
e1000e: increase rx fifo size to 36K on 82574 and 82583

This change increases the RX fifo size to 36K for standard frames and
decreases the TX fifo size to 4K.  The reason for this change is that on
slower systems the RX is much more likely to backfill and need space than
the TX is.  As long as the TX fifo is twice the size of the MTU we should
have more than enough TX fifo.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoe1000e: Save irq into netdev structure
Tom Herbert [Wed, 5 May 2010 14:03:32 +0000 (14:03 +0000)]
e1000e: Save irq into netdev structure

Set net->devirq to pdev->irq.  This should be consistent with other
drivers.

Signed-off-by: Tom Herbert <therbert@google.com>
Acked-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>