cascardo/linux.git
11 years agonet-tcp: Fast Open client - sendmsg(MSG_FASTOPEN)
Yuchung Cheng [Thu, 19 Jul 2012 06:43:09 +0000 (06:43 +0000)]
net-tcp: Fast Open client - sendmsg(MSG_FASTOPEN)

sendmsg() (or sendto()) with MSG_FASTOPEN is a combo of connect(2)
and write(2). The application should replace connect() with it to
send data in the opening SYN packet.

For blocking socket, sendmsg() blocks until all the data are buffered
locally and the handshake is completed like connect() call. It
returns similar errno like connect() if the TCP handshake fails.

For non-blocking socket, it returns the number of bytes queued (and
transmitted in the SYN-data packet) if cookie is available. If cookie
is not available, it transmits a data-less SYN packet with Fast Open
cookie request option and returns -EINPROGRESS like connect().

Using MSG_FASTOPEN on connecting or connected socket will result in
simlar errno like repeating connect() calls. Therefore the application
should only use this flag on new sockets.

The buffer size of sendmsg() is independent of the MSS of the connection.

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet-tcp: Fast Open client - receiving SYN-ACK
Yuchung Cheng [Thu, 19 Jul 2012 06:43:08 +0000 (06:43 +0000)]
net-tcp: Fast Open client - receiving SYN-ACK

On receiving the SYN-ACK after SYN-data, the client needs to
a) update the cached MSS and cookie (if included in SYN-ACK)
b) retransmit the data not yet acknowledged by the SYN-ACK in the final ACK of
   the handshake.

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet-tcp: Fast Open client - sending SYN-data
Yuchung Cheng [Thu, 19 Jul 2012 06:43:07 +0000 (06:43 +0000)]
net-tcp: Fast Open client - sending SYN-data

This patch implements sending SYN-data in tcp_connect(). The data is
from tcp_sendmsg() with flag MSG_FASTOPEN (implemented in a later patch).

The length of the cookie in tcp_fastopen_req, init'd to 0, controls the
type of the SYN. If the cookie is not cached (len==0), the host sends
data-less SYN with Fast Open cookie request option to solicit a cookie
from the remote. If cookie is not available (len > 0), the host sends
a SYN-data with Fast Open cookie option. If cookie length is negative,
  the SYN will not include any Fast Open option (for fall back operations).

To deal with middleboxes that may drop SYN with data or experimental TCP
option, the SYN-data is only sent once. SYN retransmits do not include
data or Fast Open options. The connection will fall back to regular TCP
handshake.

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet-tcp: Fast Open client - cookie cache
Yuchung Cheng [Thu, 19 Jul 2012 06:43:06 +0000 (06:43 +0000)]
net-tcp: Fast Open client - cookie cache

With help from Eric Dumazet, add Fast Open metrics in tcp metrics cache.
The basic ones are MSS and the cookies. Later patch will cache more to
handle unfriendly middleboxes.

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet-tcp: Fast Open base
Yuchung Cheng [Thu, 19 Jul 2012 06:43:05 +0000 (06:43 +0000)]
net-tcp: Fast Open base

This patch impelements the common code for both the client and server.

1. TCP Fast Open option processing. Since Fast Open does not have an
   option number assigned by IANA yet, it shares the experiment option
   code 254 by implementing draft-ietf-tcpm-experimental-options
   with a 16 bits magic number 0xF989. This enables global experiments
   without clashing the scarce(2) experimental options available for TCP.

   When the draft status becomes standard (maybe), the client should
   switch to the new option number assigned while the server supports
   both numbers for transistion.

2. The new sysctl tcp_fastopen

3. A place holder init function

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agomlx4_en: map entire pages to increase throughput
Thadeu Lima de Souza Cascardo [Mon, 16 Jul 2012 07:01:53 +0000 (07:01 +0000)]
mlx4_en: map entire pages to increase throughput

In its receive path, mlx4_en driver maps each page chunk that it pushes
to the hardware and unmaps it when pushing it up the stack. This limits
throughput to about 3Gbps on a Power7 8-core machine.

One solution is to map the entire allocated page at once. However, this
requires that we keep track of every page fragment we give to a
descriptor. We also need to work with the discipline that all fragments will
be released (in the sense that it will not be reused by the driver
anymore) in the order they are allocated to the driver.

This requires that we don't reuse any fragments, every single one of
them must be reallocated. We do that by releasing all the fragments that
are processed and only after finished processing the descriptors, we
start the refill.

We also must somehow guarantee that we either refill all fragments in a
descriptor or none at all, without resorting to giving up a page
fragment that we would have already given. Otherwise, we would break the
discipline of only releasing the fragments in the order they were
allocated.

This has passed page allocation fault injections (restricted to the
driver by using required-start and required-end) and device hotplug
while 16 TCP streams were able to deliver more than 9Gbps.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agosfc: initialize dynamic sysfs attributes for lockdep
Michal Schmidt [Thu, 19 Jul 2012 07:04:45 +0000 (07:04 +0000)]
sfc: initialize dynamic sysfs attributes for lockdep

Dynamically allocated sysfs attributes must be initialized using
sysfs_attr_init(), otherwise lockdep complains:
BUG: key <address> not in .data!

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agobridge: update documentation references
stephen hemminger [Thu, 19 Jul 2012 07:01:07 +0000 (07:01 +0000)]
bridge: update documentation references

Update the references to bridge utilities and web pages
to current locations

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: e100: ucode is optional in some cases
Bjørn Mork [Thu, 19 Jul 2012 06:28:40 +0000 (06:28 +0000)]
net: e100: ucode is optional in some cases

commit 9ac32e1b firmware: convert e100 driver to request_firmware()

did a straight conversion of the in-driver ucode to external
files.  This introduced the possibility of the driver failing
to enable an interface due to missing ucode. There was no
evaluation of the importance of the ucode at the time.

Based on comments in earlier versions of this driver, and in
the source code for the FreeBSD fxp driver, we can assume that
the ucode implements the "CPU Cycle Saver" feature on supported
adapters.  Although generally wanted, this is an optional
feature. The ucode source is not available, preventing it from
being included in free distributions. This creates unnecessary
problems for the end users. Doing a network install based on a
free distribution installer requires the user to download and
insert the ucode into the installer.

Making the ucode optional when possible improves the user
experience and driver usability.

The ucode for some adapters include a bugfix, making it
essential.  We continue to fail for these adapters unless the
ucode is available.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoasix: AX88172A driver depends on phylib
Christian Riesch [Thu, 19 Jul 2012 02:02:19 +0000 (02:02 +0000)]
asix: AX88172A driver depends on phylib

Since commit 16626b0cc3d5afe250850f96759b241f8a403b52 the asix
driver depends on the phylib. Select phylib when the asix driver is
selected.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: kernel-janitors@vger.kernel.org
Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Tested-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoasix: Add support for programming the EEPROM
Christian Riesch [Thu, 19 Jul 2012 00:23:07 +0000 (00:23 +0000)]
asix: Add support for programming the EEPROM

This patch adds the asix_set_eeprom() function to provide support for
programming the configuration EEPROM via ethtool.

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoasix: Rework reading from EEPROM
Christian Riesch [Thu, 19 Jul 2012 00:23:06 +0000 (00:23 +0000)]
asix: Rework reading from EEPROM

The current code for reading the EEPROM via ethtool in the asix
driver has a few issues. It cannot handle odd length values
(accesses must be aligned at 16 bit boundaries) and interprets the
offset provided by ethtool as 16 bit word offset instead as byte offset.

The new code for asix_get_eeprom() introduced by this patch is
modeled after the code in
drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c
and provides read access to the entire EEPROM with arbitrary
offsets and lengths.

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: stmmac: Add ip version to dts bindings
Dinh Nguyen [Wed, 18 Jul 2012 13:28:26 +0000 (13:28 +0000)]
net: stmmac: Add ip version to dts bindings

Because there are multiple variants to the stmmac/dwmac driver, the
dts bindings should be updated to include version of the IP used.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Acked-by: Stefan Roese <sr@denx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agocxgb3: Set vlan_feature on net_device
brenohl@br.ibm.com [Wed, 18 Jul 2012 09:29:08 +0000 (09:29 +0000)]
cxgb3: Set vlan_feature on net_device

cxgb3 interface has a bad performance when VLAN is set. On my current
setup, a PowerLinux 7R2, I am able to get around 7 Gbps on a TCP_STREAM
(8 instances, 4k message).
With this patch, I am able to reach 9.5 Gbps.

Signed-off-by: Breno Leitao <brenohl@br.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipx: move peII functions
stephen hemminger [Wed, 18 Jul 2012 09:09:48 +0000 (09:09 +0000)]
ipx: move peII functions

The Ethernet II wrapper is only used by IPX protocol, may have once
been used by Appletalk but not currently. Therefore it makes sense to
move it to the IPX dust bin and drop the exports.

Build tested only.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: Fix warnings in dst_ops.h
David S. Miller [Thu, 19 Jul 2012 17:43:03 +0000 (10:43 -0700)]
net: Fix warnings in dst_ops.h

include/net/dst_ops.h:28:20: warning: ‘struct sock’ declared inside parameter list

Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv4: tcp: remove per net tcp_sock
Eric Dumazet [Thu, 19 Jul 2012 07:34:03 +0000 (07:34 +0000)]
ipv4: tcp: remove per net tcp_sock

tcp_v4_send_reset() and tcp_v4_send_ack() use a single socket
per network namespace.

This leads to bad behavior on multiqueue NICS, because many cpus
contend for the socket lock and once socket lock is acquired, extra
false sharing on various socket fields slow down the operations.

To better resist to attacks, we use a percpu socket. Each cpu can
run without contention, using appropriate memory (local node)

Additional features :

1) We also mirror the queue_mapping of the incoming skb, so that
answers use the same queue if possible.

2) Setting SOCK_USE_WRITE_QUEUE socket flag speedup sock_wfree()

3) We now limit the number of in-flight RST/ACK [1] packets
per cpu, instead of per namespace, and we honor the sysctl_wmem_default
limit dynamically. (Prior to this patch, sysctl_wmem_default value was
copied at boot time, so any further change would not affect tcp_sock
limit)

[1] These packets are only generated when no socket was matched for
the incoming packet.

Reported-by: Bill Sommerfeld <wsommerfeld@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv4: use seqlock for nh_exceptions
Julian Anastasov [Wed, 18 Jul 2012 10:15:35 +0000 (10:15 +0000)]
ipv4: use seqlock for nh_exceptions

Use global seqlock for the nh_exceptions. Call
fnhe_oldest with the right hash chain. Correct the diff
value for dst_set_expires.

v2: after suggestions from Eric Dumazet:
* get rid of spin lock fnhe_lock, rearrange update_or_create_fnhe
* continue daddr search in rt_bind_exception

v3:
* remove the daddr check before seqlock in rt_bind_exception
* restart lookup in rt_bind_exception on detected seqlock change,
as suggested by David Miller

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv4: Fix time difference calculation in rt_bind_exception().
David S. Miller [Thu, 19 Jul 2012 15:46:59 +0000 (08:46 -0700)]
ipv4: Fix time difference calculation in rt_bind_exception().

Reported-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet/mlx4_en: Add accelerated RFS support
Amir Vadai [Wed, 18 Jul 2012 22:33:52 +0000 (22:33 +0000)]
net/mlx4_en: Add accelerated RFS support

Use RFS infrastructure and flow steering in HW to keep CPU
affinity of rx interrupts and application per TCP stream.

A flow steering filter is added to the HW whenever the RFS
ndo callback is invoked by core networking code.

Because the invocation takes place in interrupt context, the
actual setup of HW is done using workqueue. Whenever new filter
is added, the driver checks for expiry of existing filters.

Since there's window in time between the point where the core
RFS code invoked the ndo callback, to the point where the HW
is configured from the workqueue context, the 2nd, 3rd etc
packets from that stream will cause the net core to invoke
the callback again and again.

To prevent inefficient/double configuration of the HW, the filters
are kept in a database which is indexed using hash function to enable
fast access.

Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years ago{NET,IB}/mlx4: Add rmap support to mlx4_assign_eq
Amir Vadai [Wed, 18 Jul 2012 22:33:51 +0000 (22:33 +0000)]
{NET,IB}/mlx4: Add rmap support to mlx4_assign_eq

Enable callers of mlx4_assign_eq to supply a pointer to cpu_rmap.
If supplied, the assigned IRQ is tracked using rmap infrastructure.

Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet/rps: Protect cpu_rmap.h from double inclusion
Amir Vadai [Wed, 18 Jul 2012 22:33:50 +0000 (22:33 +0000)]
net/rps: Protect cpu_rmap.h from double inclusion

Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet/mlx4: Move MAC_MASK to a common place
Amir Vadai [Wed, 18 Jul 2012 22:33:49 +0000 (22:33 +0000)]
net/mlx4: Move MAC_MASK to a common place

Define this macro is one common place instead of duplicating it over the code

Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv4: fix address selection in fib_compute_spec_dst
Julian Anastasov [Wed, 18 Jul 2012 21:35:03 +0000 (21:35 +0000)]
ipv4: fix address selection in fib_compute_spec_dst

ip_options_compile can be called for forwarded packets,
make sure the specific-destionation address is a local one as
specified in RFC 1812, 4.2.2.2 Addresses in Options

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv4: optimize fib_compute_spec_dst call in ip_options_echo
Julian Anastasov [Wed, 18 Jul 2012 21:34:24 +0000 (21:34 +0000)]
ipv4: optimize fib_compute_spec_dst call in ip_options_echo

Move fib_compute_spec_dst at the only place where it
is needed.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoixgbe: Cleanup holes in flags after removing several of them
Alexander Duyck [Sat, 19 May 2012 01:10:50 +0000 (01:10 +0000)]
ixgbe: Cleanup holes in flags after removing several of them

This change is just meant to defragment the flags as there are several hole
that have been introduced since several features, or the flags for them,
have been removed.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbe: Retire RSS enabled and capable flags
Alexander Duyck [Sat, 14 Jul 2012 05:42:36 +0000 (05:42 +0000)]
ixgbe: Retire RSS enabled and capable flags

All of our hardware supports RSS even if it is only for a single queue.  So
instead of toting around the RSS enable flag I am updating the code so that
all devices are enabled and if we want to disable RSS it is indicated via
the RSS mask.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbe: Add support for SR-IOV w/ DCB or RSS
Alexander Duyck [Sat, 14 Jul 2012 06:48:49 +0000 (06:48 +0000)]
ixgbe: Add support for SR-IOV w/ DCB or RSS

This change essentially makes it so that we can enable almost all of the
features all at once.  This patch allows for the combination of SR-IOV,
DCB, and FCoE in the case of the x540.  It also beefs up the SR-IOV by
adding support for RSS to the PF.

The testing matrix gets to be very complex for this patch as there are a
number of different features and subsets for queueing options.  I tried to
narrow these down a bit by restricting the PF to only supporting 4TC DCB
when it is enabled in addition to SR-IOV.

Cc: Greg Rose <gregory.v.rose@intel.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbe: Update configure virtualization to allow for multiple PF pools
Alexander Duyck [Fri, 18 May 2012 06:34:08 +0000 (06:34 +0000)]
ixgbe: Update configure virtualization to allow for multiple PF pools

This change allows all pools from the default pool forward to be enabled vi
ixgbe_configure_virtualization.  This is needed as we are planning to use
queues belonging to adjacent pools for FCoE when SR-IOV and FCoE are both
enabled.

In addition this patch contains some minor formatting changes as there were
a few spots that seemed to be in need of some cleanup.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: Fix multiple issues in ixgbevf_get/set_ringparam
Alexander Duyck [Thu, 19 Jul 2012 00:18:05 +0000 (00:18 +0000)]
ixgbevf: Fix multiple issues in ixgbevf_get/set_ringparam

In ixgbevf_get_ringparam we could run into a NULL pointer dereference
if the rings were not allocated when we attempted the call.  To prevent
that we can just access the tx/rx_ring_count values instead of attempting
to access the rings to get the count.

This change corrects a memory leak and memory corruption in
ixgbevf_set_ringparam.

The memory leak was due to us not freeing the resources from the ring
before overwriting them.  This change corrects the memory leak by making
certain to call ixgbe_free_tx/rx_resources on the rings prior to freeing
them.

The memory corruption was because we were replacing the rings but not
updating the q_vectors.  It addresses the memory corruption by leaving the
rings in place and instead just copying the contents of the new rings into
the existing rings.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: Consolidate Tx context descriptor creation code
Alexander Duyck [Fri, 11 May 2012 08:33:21 +0000 (08:33 +0000)]
ixgbevf: Consolidate Tx context descriptor creation code

There is a good bit of redundancy between the Tx checksum and segmentation
offloads.  In order to reduce some of this I am moving the code for
creating a context descriptor into a separate function.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: Add netdev to ring structure
Alexander Duyck [Fri, 11 May 2012 08:33:16 +0000 (08:33 +0000)]
ixgbevf: Add netdev to ring structure

This change adds the netdev to the ring structure.  This allows for a
quicker transition from ring to netdev without having to go from ring to
adapter to netdev.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: Do not rewind the Rx ring before bumping tail
Alexander Duyck [Fri, 11 May 2012 08:33:11 +0000 (08:33 +0000)]
ixgbevf: Do not rewind the Rx ring before bumping tail

The driver is going back one step from its' previous location before
bumping tail. This is incorrect.  We should just be writing the value of
next_to_use into the tail register.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: fix VF untagging when 802.1 prio is set
Pascal Bouchareine [Thu, 14 Jun 2012 02:18:18 +0000 (02:18 +0000)]
ixgbevf: fix VF untagging when 802.1 prio is set

We have had an issue when using ixgbe+ixgbevf and 802.1 VLAN tagging.

When attaching a VLAN to a VF, frames with a 802.1q priority appeared
untagged on the VF hence not reaching the VLAN, where frames with
priority 0 where tagged as expected and seen by the VLAN device.

This seems due to the way ixgbevf is looking up the full tag
(prio+cfi+vlan) against the adapter active_vlans, as a condition to mark
the skb tagged.

Signed-off-by: Pascal Bouchareine <pascal@gandi.net>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoipv6: add ipv6_addr_hash() helper
Eric Dumazet [Wed, 18 Jul 2012 08:11:12 +0000 (08:11 +0000)]
ipv6: add ipv6_addr_hash() helper

Introduce ipv6_addr_hash() helper doing a XOR on all bits
of an IPv6 address, with an optimized x86_64 version.

Use it in flow dissector, as suggested by Andrew McGregor,
to reduce hash collision probabilities in fq_codel (and other
users of flow dissector)

Use it in ip6_tunnel.c and use more bit shuffling, as suggested
by David Laight, as existing hash was ignoring most of them.

Use it in sunrpc and use more bit shuffling, using hash_32().

Use it in net/ipv6/addrconf.c, using hash_32() as well.

As a cleanup, use it in net/ipv4/tcp_metrics.c

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Andrew McGregor <andrewmcgr@gmail.com>
Cc: Dave Taht <dave.taht@gmail.com>
Cc: Tom Herbert <therbert@google.com>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoteam: refine IFF_XMIT_DST_RELEASE capability
Jiri Pirko [Wed, 18 Jul 2012 07:39:38 +0000 (07:39 +0000)]
team: refine IFF_XMIT_DST_RELEASE capability

Cloned patch of Eric Dumazet for bonding.

Some workloads greatly benefit of IFF_XMIT_DST_RELEASE capability
on output net device, avoiding dirtying dst refcount.

team currently disables IFF_XMIT_DST_RELEASE unconditionally.

If all ports have the IFF_XMIT_DST_RELEASE bit set, then
team dev can also have it in its priv_flags.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agodriver: net: ethernet: cpsw: runtime PM support
Mugunthan V N [Tue, 17 Jul 2012 08:09:50 +0000 (08:09 +0000)]
driver: net: ethernet: cpsw: runtime PM support

Enabling runtime PM support for cpsw driver

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agodriver: net: ethernet: davinci_mdio: runtime PM support
Mugunthan V N [Tue, 17 Jul 2012 08:09:49 +0000 (08:09 +0000)]
driver: net: ethernet: davinci_mdio: runtime PM support

Enabling runtime PM support for davinci mdio driver

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agojme: netpoll support
Peter Wu [Tue, 17 Jul 2012 06:29:34 +0000 (06:29 +0000)]
jme: netpoll support

This patch adds the netpoll function to support netconsole. Tested and works
fine on my "JMC250 PCI Express Gigabit Ethernet Controller" (PCI ID 0250).

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoskbuff: Use correct allocation in skb_copy_ubufs
Krishna Kumar [Tue, 17 Jul 2012 02:05:29 +0000 (02:05 +0000)]
skbuff: Use correct allocation in skb_copy_ubufs

Use correct allocation flags during copy of user space fragments
to the kernel. Also "improve" couple of for loops.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: ethernet: davinci_emac: add OF support
Heiko Schocher [Tue, 17 Jul 2012 00:34:24 +0000 (00:34 +0000)]
net: ethernet: davinci_emac: add OF support

add OF support for the davinci_emac driver.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: netdev@vger.kernel.org
Cc: davinci-linux-open-source@linux.davincidsp.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: devicetree-discuss@lists.ozlabs.org
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Anatoly Sivov <mm05@mail.ru>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoISDN: Add check for usb_alloc_urb() result
Karsten Keil [Thu, 12 Jul 2012 22:59:46 +0000 (22:59 +0000)]
ISDN: Add check for usb_alloc_urb() result

usb_alloc_urb() return value needs to be checked to avoid
later NULL pointer access.
Reported by rucsoftsec@gmail.com via bugzilla.kernel.org #44601.

Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoISDN: Add check for return value of pnp_activate_dev()
Karsten Keil [Thu, 12 Jul 2012 07:01:10 +0000 (07:01 +0000)]
ISDN: Add check for return value of pnp_activate_dev()

pnp_activate_dev() return value needs to be checked to make sure that
following calls calls to the PNP functions do work correctly.
Fix for report #44491 on bugzilla.kernel.org.

Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoqlge: fix an "&&" vs "||" bug
Dan Carpenter [Thu, 12 Jul 2012 04:47:03 +0000 (04:47 +0000)]
qlge: fix an "&&" vs "||" bug

The condition is always true so WOL will never work.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: ftgmac100/ftmac100: dont pull too much data
Eric Dumazet [Thu, 12 Jul 2012 04:19:38 +0000 (04:19 +0000)]
net: ftgmac100/ftmac100: dont pull too much data

Drivers should pull only ethernet header from page frag
to skb->head.

Pulling 64 bytes is too much for TCP (without options) on IPv4.

However, it makes sense to pull all the frame if it fits the
128 bytes bloc allocated for skb->head, to free one page per
small incoming frame.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Po-Yu Chuang <ratbert@faraday-tech.com>
Acked-by: Yan-Pai Chen <yanpai.chen@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: qmi_wwan: add ZTE MF821D
Bjørn Mork [Thu, 12 Jul 2012 01:18:26 +0000 (01:18 +0000)]
net: qmi_wwan: add ZTE MF821D

Sold by O2 (telefonica germany) under the name "LTE4G"

Tested-by: Thomas Schäfer <tschaefer@t-online.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet/ipv4: VTI support new module for ip_vti.
Saurabh [Tue, 17 Jul 2012 09:44:54 +0000 (09:44 +0000)]
net/ipv4: VTI support new module for ip_vti.

New VTI tunnel kernel module, Kconfig and Makefile changes.

Signed-off-by: Saurabh Mohan <saurabh.mohan@vyatta.com>
Reviewed-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet/ipv4: VTI support rx-path hook in xfrm4_mode_tunnel.
Saurabh [Tue, 17 Jul 2012 09:44:49 +0000 (09:44 +0000)]
net/ipv4: VTI support rx-path hook in xfrm4_mode_tunnel.

Incorporated David and Steffen's comments.
Add hook for rx-path xfmr4_mode_tunnel for VTI tunnel module.

Signed-off-by: Saurabh Mohan <saurabh.mohan@vyatta.com>
Reviewed-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoasix: Fix return value in AX88172A driver bind function
Christian Riesch [Wed, 18 Jul 2012 10:56:52 +0000 (12:56 +0200)]
asix: Fix return value in AX88172A driver bind function

Return -ENOTSUPP if the initialization fails because the
device is configured for a mode that is not supported by the driver.

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agotcp: refine SYN handling in tcp_validate_incoming
Eric Dumazet [Tue, 17 Jul 2012 12:29:30 +0000 (12:29 +0000)]
tcp: refine SYN handling in tcp_validate_incoming

Followup of commit 0c24604b68fc (tcp: implement RFC 5961 4.2)

As reported by Vijay Subramanian, we should send a challenge ACK
instead of a dup ack if a SYN flag is set on a packet received out of
window.

This permits the ratelimiting to work as intended, and to increase
correct SNMP counters.

Suggested-by: Vijay Subramanian <subramanian.vijay@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Vijay Subramanian <subramanian.vijay@gmail.com>
Cc: Kiran Kumar Kella <kkiran@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agobonding: refine IFF_XMIT_DST_RELEASE capability
Eric Dumazet [Tue, 17 Jul 2012 12:19:48 +0000 (12:19 +0000)]
bonding: refine IFF_XMIT_DST_RELEASE capability

Some workloads greatly benefit of IFF_XMIT_DST_RELEASE capability
on output net device, avoiding dirtying dst refcount.

bonding currently disables IFF_XMIT_DST_RELEASE unconditionally.

If all slaves have the IFF_XMIT_DST_RELEASE bit set, then
bonding master can also have it in its priv_flags

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Cc: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: qmi_wwan: make dynamic device IDs work
Bjørn Mork [Tue, 17 Jul 2012 11:14:32 +0000 (11:14 +0000)]
net: qmi_wwan: make dynamic device IDs work

The usbnet API use the device ID table to store a pointer to
a minidriver. Setting a generic pointer for dynamic device
IDs will in most cases make them work as expected.  usbnet
will otherwise treat the dynamic IDs as blacklisted. That is
rarely useful.

There is no standard class describing devices supported by
this driver, and most vendors don't even provide enough
information to allow vendor specific wildcard matching. The
result is that most of the supported devices must be
explicitly listed in the device table.  Allowing dynamic IDs
to work both simplifies testing and verification of new
devices, and provides a way for end users to use a device
before the ID is added to the driver.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agob44: add 64 bit stats
Kevin Groeneveld [Tue, 17 Jul 2012 17:46:01 +0000 (17:46 +0000)]
b44: add 64 bit stats

Add support for 64 bit stats to Broadcom b44 ethernet driver.

Signed-off-by: Kevin Groeneveld <kgroeneveld@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agobe2net: Ignore physical link async event for Lancer
Padmanabh Ratnakar [Wed, 18 Jul 2012 02:52:15 +0000 (02:52 +0000)]
be2net: Ignore physical link async event for Lancer

The ability of driver to transmit packets depends on logical state
of the link. Ignore physical link status.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agobe2net: Fix VF driver load for Lancer
Padmanabh Ratnakar [Wed, 18 Jul 2012 02:51:58 +0000 (02:51 +0000)]
be2net: Fix VF driver load for Lancer

Lancer FW has added new capability checks for VFs.
Driver should only use those capabilities which are allowed for VFs.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net...
David S. Miller [Wed, 18 Jul 2012 16:20:03 +0000 (09:20 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/jkirsher/net-next

Jerr Kirsher says:

====================
This series contains updates to ixgbe & ixgbevf.
 ...
Alexander Duyck (6):
  ixgbe: Ping the VFs on link status change to trigger link change
  ixgbe: Handle failures in the ixgbe_setup_rx/tx_resources calls
  ixgbe: Move configuration of set_real_num_rx/tx_queues into open
  ixgbe: Update the logic for ixgbe_cache_ring_dcb and DCB RSS
    configuration
  ixgbe: Cleanup logic for MRQC and MTQC configuration
  ixgbevf: Update descriptor macros to accept pointers and drop _ADV
    suffix
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoMerge branch 'davem-next.r8169' of git://violet.fr.zoreil.com/romieu/linux
David S. Miller [Wed, 18 Jul 2012 16:10:26 +0000 (09:10 -0700)]
Merge branch 'davem-next.r8169' of git://violet.fr.zoreil.com/romieu/linux

Francois Romieu says:

====================
Francois Romieu (1):
      r8169: verbose error message.

Hayes Wang (1):
      r8169: remove rtl_ocpdr_cond.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoMerge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc...
David S. Miller [Wed, 18 Jul 2012 16:08:36 +0000 (09:08 -0700)]
Merge branch 'for-davem' of git://git./linux/kernel/git/bwh/sfc-next

Ben Hutchings says:

====================
1. Fix potential badness when running a self-test with SR-IOV enabled.
2. Fix calculation of some interface statistics that could run backward.
3. Miscellaneous cleanup.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv6: fix inet6_csk_xmit()
Eric Dumazet [Tue, 17 Jul 2012 21:38:04 +0000 (21:38 +0000)]
ipv6: fix inet6_csk_xmit()

We should provide to inet6_csk_route_socket a struct flowi6 pointer,
so that net6_csk_xmit() works correctly instead of sending garbage.

Also add some consts

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoixgbevf: Update descriptor macros to accept pointers and drop _ADV suffix
Alexander Duyck [Fri, 11 May 2012 08:33:00 +0000 (08:33 +0000)]
ixgbevf: Update descriptor macros to accept pointers and drop _ADV suffix

This change updates the descriptor macros to accept pointers, updates the
name to drop the _ADV suffix, and include the IXGBEVF name in the macro.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbe: Cleanup logic for MRQC and MTQC configuration
Alexander Duyck [Fri, 18 May 2012 06:34:02 +0000 (06:34 +0000)]
ixgbe: Cleanup logic for MRQC and MTQC configuration

This change is meant to make the code much more readable for MTQC and MRQC
configuration.

The big change is that I simplified much of the logic so that we are
essentially handling just 4 cases and their variants. In the cases where
RSS is disabled we are actually just programming the RETA table with all
1s resulting in a single queue RSS. In the case of SR-IOV I am treating
that as a subset of VMDq. This all results int he following configuration
for the hardware:
         DCB
         En       Dis
VMDq En  VMDQ/DCB VMDq/RSS
     Dis DCB/RSS  RSS

Cc: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbe: Update the logic for ixgbe_cache_ring_dcb and DCB RSS configuration
Alexander Duyck [Fri, 22 Jun 2012 06:46:33 +0000 (06:46 +0000)]
ixgbe: Update the logic for ixgbe_cache_ring_dcb and DCB RSS configuration

This change cleans up some of the logic in an attempt to try and simplify
things for how we are configuring DCB w/ RSS.

In this patch I basically did 3 things.  I updated the logic for getting
the first register index.  I applied the fact that all TCs get the same
number of queues to simplify the looping logic in caching the DCB ring
register.  Finally I updated how we configure the RQTC register to match
the fact that all TCs are assigned the same number of queues.

Cc: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbe: Move configuration of set_real_num_rx/tx_queues into open
Alexander Duyck [Thu, 12 Jul 2012 05:52:53 +0000 (05:52 +0000)]
ixgbe: Move configuration of set_real_num_rx/tx_queues into open

It makes much more sense for us to configure the real number of Tx and Rx
queues in the ixgbe_open call than it does in ixgbe_set_num_queues.  By
setting the number in ixgbe_open we can avoid a number of unecessary
updates and only have to make the calls once.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbe: Handle failures in the ixgbe_setup_rx/tx_resources calls
Alexander Duyck [Fri, 18 May 2012 06:33:47 +0000 (06:33 +0000)]
ixgbe: Handle failures in the ixgbe_setup_rx/tx_resources calls

Previously we were exiting without cleaning up the memory internally on the
ixgbe_setup_rx_resources and ixgbe_setup_tx_resources calls.  Instead of
forcing the caller to clean things up for us we should instead just unwind
the rings and free the memory as we go.  This way we can more gracefully
clean up the rings in the event of an allocation failure.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbe: Ping the VFs on link status change to trigger link change
Alexander Duyck [Sat, 5 May 2012 05:30:38 +0000 (05:30 +0000)]
ixgbe: Ping the VFs on link status change to trigger link change

When the link status changes on the PF we need to notify the VFs. In order
to do this we should ping all of the VFs in order to trigger a link status
change on them as well.

This fixes issues in which the PF would reset, but the VF didn't because the
NAK flag was not set in the VF mailbox.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agor8169: verbose error message.
Francois Romieu [Wed, 11 Jul 2012 21:39:51 +0000 (23:39 +0200)]
r8169: verbose error message.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
11 years agor8169: remove rtl_ocpdr_cond.
Hayes Wang [Wed, 11 Jul 2012 12:31:56 +0000 (20:31 +0800)]
r8169: remove rtl_ocpdr_cond.

It is not needed for mac_ocp_{write / read}. Actually bit 31 of OCPDR
does not change and r8168_mac_ocp_read always returns ~0.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Tested-by: Francois Romieu <romieu@fr.zoreil.com>
11 years agoipv4: fix rcu splat
Eric Dumazet [Tue, 17 Jul 2012 20:42:13 +0000 (22:42 +0200)]
ipv4: fix rcu splat

free_nh_exceptions() should use rcu_dereference_protected(..., 1)
since its called after one RCU grace period.

Also add some const-ification in recent code.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv4: Fix nexthop exception hash computation.
David S. Miller [Tue, 17 Jul 2012 20:23:08 +0000 (13:23 -0700)]
ipv4: Fix nexthop exception hash computation.

Need to mask it with (FNHE_HASH_SIZE - 1).

Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoMerge branch 'nexthop_exceptions'
David S. Miller [Tue, 17 Jul 2012 17:48:26 +0000 (10:48 -0700)]
Merge branch 'nexthop_exceptions'

These patches implement the final mechanism necessary to really allow
us to go without the route cache in ipv4.

We need a place to have long-term storage of PMTU/redirect information
which is independent of the routes themselves, yet does not get us
back into a situation where we have to write to metrics or anything
like that.

For this we use an "next-hop exception" table in the FIB nexthops.

The one thing I desperately want to avoid is having to create clone
routes in the FIB trie for this purpose, because that is very
expensive.   However, I'm willing to entertain such an idea later
if this current scheme proves to have downsides that the FIB trie
variant would not have.

In order to accomodate this any such scheme, we need to be able to
produce a full flow key at PMTU/redirect time.  That required an
adjustment of the interface call-sites used to propagate these events.

For a PMTU/redirect with a fully specified socket, we pass that socket
and use it to produce the flow key.

Otherwise we use a passed in SKB to formulate the key.  There are two
cases that need to be distinguished, ICMP message processing (in which
case the IP header is at skb->data) and output packet processing
(mostly tunnels, and in all such cases the IP header is at ip_hdr(skb)).

We also have to make the code able to handle the case where the dst
itself passed into the dst_ops->{update_pmtu,redirect} method is
invalidated.  This matters for calls from sockets that have cached
that route.  We provide a inet{,6} helper function for this purpose,
and edit SCTP specially since it caches routes at the transport rather
than socket level.

Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoteam: add netpoll support
Jiri Pirko [Tue, 17 Jul 2012 05:22:36 +0000 (05:22 +0000)]
team: add netpoll support

It's done in very similar way this is done in bonding and bridge.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonetpoll: move np->dev and np->dev_name init into __netpoll_setup()
Jiri Pirko [Tue, 17 Jul 2012 05:22:35 +0000 (05:22 +0000)]
netpoll: move np->dev and np->dev_name init into __netpoll_setup()

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv4: Add FIB nexthop exceptions.
David S. Miller [Tue, 17 Jul 2012 11:19:00 +0000 (04:19 -0700)]
ipv4: Add FIB nexthop exceptions.

In a regime where we have subnetted route entries, we need a way to
store persistent storage about destination specific learned values
such as redirects and PMTU values.

This is implemented here via nexthop exceptions.

The initial implementation is a 2048 entry hash table with relaiming
starting at chain length 5.  A more sophisticated scheme can be
devised if that proves necessary.

Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agosfc: Correct some comments on enum reset_type
Ben Hutchings [Thu, 5 Jul 2012 16:31:04 +0000 (17:31 +0100)]
sfc: Correct some comments on enum reset_type

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
11 years agosfc: Fix interface statistics running backward
Ben Hutchings [Wed, 4 Jul 2012 21:25:07 +0000 (22:25 +0100)]
sfc: Fix interface statistics running backward

Some interface statistics are computed in such a way that they can
sometimes decrease (and even underflow).  Since the computed value
will never be greater than the true value, we fix this by only storing
the computed value when it increases.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
11 years agosfc: Disable VF queues during register self-test
Ben Hutchings [Wed, 4 Jul 2012 02:58:33 +0000 (03:58 +0100)]
sfc: Disable VF queues during register self-test

Currently VF queues and drivers may remain active during this test.
This could cause memory corruption or spurious test failures.
Therefore we reset the port/function before running these tests on
Siena.

On Falcon this doesn't work: we have to do some additional
initialisation before some blocks will work again.  So refactor the
reset/register-test sequence into an efx_nic_type method so
efx_selftest() doesn't have to consider such quirks.

In the process, fix another minor bug: Siena does not have an
'invisible' reset and the self-test currently fails to push the PHY
configuration after resetting.  Passing RESET_TYPE_ALL to
efx_reset_{down,up}() fixes this.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
11 years agosfc: Explain why efx_mcdi_exit_assertion() ignores result of efx_mcdi_rpc()
Ben Hutchings [Mon, 2 Jul 2012 22:37:40 +0000 (23:37 +0100)]
sfc: Explain why efx_mcdi_exit_assertion() ignores result of efx_mcdi_rpc()

Fix CID 113952 in Coverity report on Linux.

This is the one instance where we don't, and shouldn't, check the
return code from efx_mcdi_rpc().  It wasn't immediately obvious to me
why we didn't, so I think an explanation is in order.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
11 years agosfc: Use dev_kfree_skb() in efx_end_loopback()
Ben Hutchings [Mon, 2 Jul 2012 22:03:02 +0000 (23:03 +0100)]
sfc: Use dev_kfree_skb() in efx_end_loopback()

Fix CID 102619 in the Coverity report on Linux.

efx_end_loopback() iterates over an array of skb pointers of which
some may be null (if efx_begin_loopback() failed).  It should not use
dev_kfree_skb_irq(), which requires non-null pointers.  In practice
this is safe because it does not run in interrupt context and
therefore always ends up calling dev_kfree_skb(), which does allow
null pointers.  But we should make that explicit.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
11 years agosfc: Use strlcpy() to copy ethtool stats names
Ben Hutchings [Mon, 2 Jul 2012 20:36:59 +0000 (21:36 +0100)]
sfc: Use strlcpy() to copy ethtool stats names

Fix CID 113703 in the Coverity report on Linux.

ethtool stats names are limited to 32 bytes including a null
terminator.  Use strlcpy() to ensure that we will always include the
null terminator even if a source string becomes longer than this.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
11 years agosfc: Stop changing header offsets on TX
Ben Hutchings [Thu, 28 Jun 2012 20:55:15 +0000 (21:55 +0100)]
sfc: Stop changing header offsets on TX

There is nothing in the VLAN driver or core VLAN support that
invalidates the TCP and IP header offsets.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
11 years agosfc: Remove dead write to tso_state::packet_space
Ben Hutchings [Tue, 19 Jun 2012 18:57:22 +0000 (19:57 +0100)]
sfc: Remove dead write to tso_state::packet_space

tso_state::packet_space is always set in tso_start_packet(); the
value set in tso_start() is not used, and is also incorrect.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
11 years agosfc: Use generic DMA API, not PCI-DMA API
Ben Hutchings [Thu, 17 May 2012 16:46:55 +0000 (17:46 +0100)]
sfc: Use generic DMA API, not PCI-DMA API

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
11 years agosfc: Work around bogus 'uninitialised variable' warning
Ben Hutchings [Thu, 31 May 2012 23:56:22 +0000 (00:56 +0100)]
sfc: Work around bogus 'uninitialised variable' warning

With some gcc versions & optimisations, the compiler will warn that
'depth' in efx_filter_insert_filter() may be used without being
initialised, although this is not the case.

This is related to inlining of efx_filter_search(), which only has
one caller since commit 8db182f4a8a6e2dcb8b65905ea4af56210e65430
('sfc: Remove now-unused filter function').

Shut the compiler up by initialising it to 0.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
11 years agotcp: implement RFC 5961 4.2
Eric Dumazet [Tue, 17 Jul 2012 01:41:30 +0000 (01:41 +0000)]
tcp: implement RFC 5961 4.2

Implement the RFC 5691 mitigation against Blind
Reset attack using SYN bit.

Section 4.2 of RFC 5961 advises to send a Challenge ACK and drop
incoming packet, instead of resetting the session.

Add a new SNMP counter to count number of challenge acks sent
in response to SYN packets.
(netstat -s | grep TCPSYNChallenge)

Remove obsolete TCPAbortOnSyn, since we no longer abort a TCP session
because of a SYN flag.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Kiran Kumar Kella <kkiran@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: Pass optional SKB and SK arguments to dst_ops->{update_pmtu,redirect}()
David S. Miller [Tue, 17 Jul 2012 10:29:28 +0000 (03:29 -0700)]
net: Pass optional SKB and SK arguments to dst_ops->{update_pmtu,redirect}()

This will be used so that we can compose a full flow key.

Even though we have a route in this context, we need more.  In the
future the routes will be without destination address, source address,
etc. keying.  One ipv4 route will cover entire subnets, etc.

In this environment we have to have a way to possess persistent storage
for redirects and PMTU information.  This persistent storage will exist
in the FIB tables, and that's why we'll need to be able to rebuild a
full lookup flow key here.  Using that flow key will do a fib_lookup()
and create/update the persistent entry.

Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoixgbevf: Use igb style interrupt masks instead of ixgbe style
Alexander Duyck [Fri, 11 May 2012 08:32:55 +0000 (08:32 +0000)]
ixgbevf: Use igb style interrupt masks instead of ixgbe style

The interrupt registers accessed in ixgbevf are more similar to the igb
style registers than they are to the ixgbe style registers.  As such we
would be better off setting up the code for the EICS, EIMS, EICS, EIAM, and
EIAC like we do in igb instead of ixgbe.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: Move Tx clean-up into NAPI context
Alexander Duyck [Fri, 11 May 2012 08:32:50 +0000 (08:32 +0000)]
ixgbevf: Move Tx clean-up into NAPI context

Currently the VF driver is processing all of the transmits in interrupt
context.  This can be messy since the Rx is all handled in NAPI and this
may result in interrupts being disabled.  In order to resolve this move all
of the Tx packet processing into NAPI and combine all of the interrupt and
polling routines into just a pair of functions.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: Update q_vector to contain ring pointers instead of bitmaps
Alexander Duyck [Fri, 11 May 2012 08:32:45 +0000 (08:32 +0000)]
ixgbevf: Update q_vector to contain ring pointers instead of bitmaps

For most cases the ixgbevf driver will only ever contain a single Tx and
single Rx queue.  In order to track that it makes more sense to use a
pointer instead of using a bitmap which must be search in order to locate
the ring on an adapter index.  As such I am changing the code to use
pointers and an iterator to access all rings on a given q_vector.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: Cleanup accounting for space needed at start of xmit_frame
Alexander Duyck [Fri, 11 May 2012 08:32:40 +0000 (08:32 +0000)]
ixgbevf: Cleanup accounting for space needed at start of xmit_frame

This change cleans up the accounting needed at the start of xmit_frame so
that we can avoid doing too much work to determine how many descriptors we
will need.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: Drop use of eitr_low and eitr_high for hard coded values
Alexander Duyck [Fri, 11 May 2012 08:32:34 +0000 (08:32 +0000)]
ixgbevf: Drop use of eitr_low and eitr_high for hard coded values

This patch drops the use of eitr_low and eitr_high as values being stored
in the adapter structure.  Since the values have no external way to be
changed they might as well just be hard coded values and save us the space
on the adapter structure.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: Make use of NETIF_F_RXCSUM instead of keeping our own flag
Alexander Duyck [Fri, 11 May 2012 08:32:29 +0000 (08:32 +0000)]
ixgbevf: Make use of NETIF_F_RXCSUM instead of keeping our own flag

The IXGBE_FLAG_RX_CSUM_ENABLED flag is redundant since NETIF_F_RXCSUM is
keeping the value we want to already have.  As such we can drop the
redundant flag and just make use of NETIF_F_RXCSUM.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: Drop netdev_registered value since that is already stored in netdev
Alexander Duyck [Fri, 11 May 2012 08:32:24 +0000 (08:32 +0000)]
ixgbevf: Drop netdev_registered value since that is already stored in netdev

There is no need to keep a separate netdev_registered value since that is
already stored in the netdev itself.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agoixgbevf: Drop all dead or unnecessary code
Alexander Duyck [Fri, 11 May 2012 08:32:19 +0000 (08:32 +0000)]
ixgbevf: Drop all dead or unnecessary code

There is a large amount of code present in this driver to support features
that either do no exist or are not supported such ask packet split, DCA, or
RSC.  This patch strips out almost all of that code and in the case of
conditionals based on unused flags I am flatting the code out to just the
path that would have been selected.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
11 years agotcp: implement RFC 5961 3.2
Eric Dumazet [Tue, 17 Jul 2012 08:13:05 +0000 (10:13 +0200)]
tcp: implement RFC 5961 3.2

Implement the RFC 5691 mitigation against Blind
Reset attack using RST bit.

Idea is to validate incoming RST sequence,
to match RCV.NXT value, instead of previouly accepted
window : (RCV.NXT <= SEG.SEQ < RCV.NXT+RCV.WND)

If sequence is in window but not an exact match, send
a "challenge ACK", so that the other part can resend an
RST with the appropriate sequence.

Add a new sysctl, tcp_challenge_ack_limit, to limit
number of challenge ACK sent per second.

Add a new SNMP counter to count number of challenge acks sent.
(netstat -s | grep TCPChallengeACK)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Kiran Kumar Kella <kkiran@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv6: fix unappropriate errno returned for non-multicast address
Li Wei [Tue, 17 Jul 2012 07:28:59 +0000 (15:28 +0800)]
ipv6: fix unappropriate errno returned for non-multicast address

We need to check the passed in multicast address and return
appropriate errno(EINVAL) if it is not valid. And it's no need
to walk through the ipv6_mc_list in this situation.

Signed-off-by: Li Wei <lw@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoMerge branch 'for-davem' of git://gitorious.org/linux-can/linux-can-next
David S. Miller [Tue, 17 Jul 2012 08:34:11 +0000 (01:34 -0700)]
Merge branch 'for-davem' of git://gitorious.org/linux-can/linux-can-next

Marc Kleine-Budde says:

====================
the fifth pull request for upcoming v3.6 net-next. The first two
patches (created by me) add const qualifiers to the flexcan and
mpc5xxx_can driver. The next patch by Julia Lawall fixes a return value
problem in the error path of the softing driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agobnx2x: organize BDs calculation for stop/resume
Dmitry Kravkov [Mon, 25 Jun 2012 22:32:50 +0000 (22:32 +0000)]
bnx2x: organize BDs calculation for stop/resume

Put the numbers used for stop/resume queue in a single place and
fix the condition for sanity check.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agocan: softing: softing_main: ensure a consistent return value in error case
Julia Lawall [Sat, 14 Jul 2012 16:43:04 +0000 (18:43 +0200)]
can: softing: softing_main: ensure a consistent return value in error case

Typically, the return value desired for the failure of a function with an
integer return value is a negative integer.  In these cases, the return
value is sometimes a negative integer and sometimes 0, due to a subsequent
initialization of the return variable within the loop.

A simplified version of the semantic match that finds this problem is:
(http://coccinelle.lip6.fr/)

//<smpl>
@r exists@
identifier ret;
position p;
constant C;
expression e1,e3,e4;
statement S;
@@

ret = -C
... when != ret = e3
    when any
if@p (...) S
... when any
if (\(ret != 0\|ret < 0\|ret > 0\) || ...) { ... return ...; }
... when != ret = e3
    when any
*if@p (...)
{
  ... when != ret = e4
  return ret;
}
//</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agocan: mpc5xxx_can: make data in mpc5xxx_can_probe const
Marc Kleine-Budde [Fri, 13 Jul 2012 12:54:59 +0000 (14:54 +0200)]
can: mpc5xxx_can: make data in mpc5xxx_can_probe const

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
11 years agocan: flexcan: make flexcan_priv.devtype_data member point to const data
Marc Kleine-Budde [Fri, 13 Jul 2012 12:52:48 +0000 (14:52 +0200)]
can: flexcan: make flexcan_priv.devtype_data member point to const data

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>