linux-2.6-microblaze.git
10 years agonet: stmmac: use suspend functions for hibernation
Srinivas Kandagatla [Thu, 16 Jan 2014 10:52:44 +0000 (10:52 +0000)]
net: stmmac: use suspend functions for hibernation

In hibernation freeze case the driver just releases the resources like
dma buffers, irqs, unregisters the drivers and during restore it does
register, request the resources. This is not really necessary, as part
of power management all the data structures are intact, all the
previously allocated resources can be used after coming out of low
power.

This patch uses the suspend and resume callbacks for freeze and
restore which initializes the hardware correctly without unregistering
or releasing the resources, this should also help in reducing the time
to restore.

Also this patch fixes a bug in stmmac_pltfr_restore and
stmmac_pltfr_freeze where it tries to get hold of platform data via
dev_get_platdata call, which would return NULL in device tree cases and
the next if statement would crash as there is no NULL check.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: stmmac: fix power management suspend-resume case
Srinivas Kandagatla [Thu, 16 Jan 2014 10:52:35 +0000 (10:52 +0000)]
net: stmmac: fix power management suspend-resume case

The driver PM resume assumes that the IP is still powered up and the
all the register contents are not disturbed when it comes out of low
power suspend case. This assumption is wrong, basically the driver
should not consider any state of registers after it comes out of low
power. However driver can keep the part of the IP powered up if its a
wake up source. But it can not assume the register state of the IP. Also
its possible that SOC glue layer can take the power off the IP if its
not wake-up source to reduce the power consumption.

This patch re initializes hardware by calling stmmac_hw_setup function in
resume case.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: stmmac: make stmmac_mdio_reset non-static
Srinivas Kandagatla [Thu, 16 Jan 2014 10:52:27 +0000 (10:52 +0000)]
net: stmmac: make stmmac_mdio_reset non-static

This patch promotes stmmac_mdio_reset function from static to
non-static, so that power management functions can decide to reset if
the IP comes out from lowe power state specially hibernation cases.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: stmmac: move hardware setup for stmmac_open to new function
Srinivas Kandagatla [Thu, 16 Jan 2014 10:52:14 +0000 (10:52 +0000)]
net: stmmac: move hardware setup for stmmac_open to new function

This patch moves hardware setup part of the code in stmmac_open to a new
function stmmac_hw_setup, the reason for doing this is to make hw
initialization independent function so that PM functions can re-use it to
re-initialize the IP after returning from low power state.
This will also avoid code duplication across stmmac_resume/restore and
stmmac_open.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: stmmac: move dma allocation to new function
Srinivas Kandagatla [Thu, 16 Jan 2014 10:52:06 +0000 (10:52 +0000)]
net: stmmac: move dma allocation to new function

This patch moves dma resource allocation to a new function
alloc_dma_desc_resources, the reason for moving this to a new function
is to keep the memory allocations in a separate function. One more reason
it to get suspend and hibernation cases working without releasing and
allocating these resources during suspend-resume and freeze-restore
cases.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: stmmac: mdio: remove reset gpio free
Srinivas Kandagatla [Thu, 16 Jan 2014 10:51:58 +0000 (10:51 +0000)]
net: stmmac: mdio: remove reset gpio free

This patch removes gpio_free for reset line of the phy, driver stores
the gpio number in its private data-structure to use in future. As the
driver uses this pin in future this pin should not be freed.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: stmmac: support max-speed device tree property
Srinivas Kandagatla [Thu, 16 Jan 2014 10:51:43 +0000 (10:51 +0000)]
net: stmmac: support max-speed device tree property

This patch adds support to "max-speed" property which is a standard
Ethernet device tree property. max-speed specifies maximum speed
(specified in megabits per second) supported the device.

Depending on the clocking schemes some of the boards can only support
few link speeds, so having a way to limit the link speed in the mac
driver would allow such setups to work reliably.

Without this patch there is no way to tell the driver to limit the
link speed.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'mvneta'
David S. Miller [Thu, 16 Jan 2014 23:15:50 +0000 (15:15 -0800)]
Merge branch 'mvneta'

Willy Tarreau says:

====================
Assorted mvneta fixes and improvements

this series provides some fixes for a number of issues met with the
mvneta driver, then adds some improvements. Patches 1-5 are fixes
and would be needed in 3.13 and likely -stable. The next ones are
performance improvements and cleanups :

  - driver lockup when reading stats while sending traffic from multiple
    CPUs : this obviously only happens on SMP and is the result of missing
    locking on the driver. The problem was present since the introduction
    of the driver in 3.8. The first patch performs some changes that are
    needed for the second one which actually fixes the issue by using
    per-cpu counters. It could make sense to backport this to the relevant
    stable versions.

  - mvneta_tx_timeout calls various functions to reset the NIC, and these
    functions sleep, which is not allowed here, resulting in a panic.
    Better completely disable this Tx timeout handler for now since it is
    never called. The problem was encountered while developing some new
    features, it's uncertain whether it's possible to reproduce it with
    regular usage, so maybe a backport to stable is not needed.

  - replace the Tx timer with a real Tx IRQ. As first reported by Arnaud
    Ebalard and explained by Eric Dumazet, there is no way this driver
    can work correctly if it uses a driver to recycle the Tx descriptors.
    If too many packets are sent at once, the driver quickly ends up with
    no descriptors (which happens twice as easily in GSO) and has to wait
    10ms for recycling its descriptors and being able to send again. Eric
    has worked around this in the core GSO code. But still when routing
    traffic or sending UDP packets, the limitation is very visible. Using
    Tx IRQs allows Tx descriptors to be recycled when sent. The coalesce
    value is still configurable using ethtool. This fix turns the UDP
    send bitrate from 134 Mbps to 987 Mbps (ie: line rate). It's made of
    two patches, one to add the relevant bits from the original Marvell's
    driver, and another one to implement the change. I don't know if it
    should be backported to stable, as the bug only causes poor performance.

  - Patches 6..8 are essentially cleanups, code deduplication and minor
    optimizations for not re-fetching a value we already have (status).

  - patch 9 changes the prefetch of Rx descriptor from current one to
    next one. In benchmarks, it results in about 1% general performance
    increase on HTTP traffic, probably because prefetching the current
    descriptor does not leave enough time between the start of prefetch
    and its usage.

  - patch 10 implements support for build_skb() on Rx path. The driver
    now preallocates frags instead of skbs and builds an skb just before
    delivering it. This results in a 2% performance increase on HTTP
    traffic, and up to 5% on small packet Rx rate.

  - patch 11 implements rx_copybreak for small packets (256 bytes). It
    avoids a dma_map_single()/dma_unmap_single() and increases the Rx
    rate by 16.4%, from 486kpps to 573kpps. Further improvements up to
    711kpps are possible depending how the DMA is used.

  - patches 12 and 13 are extra cleanups made possible by some of the
    simplifications above.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: make mvneta_txq_done() return void
Arnaud Ebalard [Thu, 16 Jan 2014 07:20:19 +0000 (08:20 +0100)]
net: mvneta: make mvneta_txq_done() return void

The function return parameter is not used in mvneta_tx_done_gbe(),
where the function is called. This patch makes the function return
void.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: mvneta_tx_done_gbe() cleanups
Arnaud Ebalard [Thu, 16 Jan 2014 07:20:18 +0000 (08:20 +0100)]
net: mvneta: mvneta_tx_done_gbe() cleanups

mvneta_tx_done_gbe() return value and third parameter are no more
used. This patch changes the function prototype and removes a useless
variable where the function is called.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: implement rx_copybreak
willy tarreau [Thu, 16 Jan 2014 07:20:17 +0000 (08:20 +0100)]
net: mvneta: implement rx_copybreak

calling dma_map_single()/dma_unmap_single() is quite expensive compared
to copying a small packet. So let's copy short frames and keep the buffers
mapped. We set the limit to 256 bytes which seems to give good results both
on the XP-GP board and on the AX3/4.

The Rx small packet rate increased by 16.4% doing this, from 486kpps to
573kpps. It is worth noting that even the call to the function
dma_sync_single_range_for_cpu() is expensive (300 ns) although less
than dma_unmap_single(). Without it, the packet rate raises to 711kpps
(+24% more). Thus on systems where coherency from device to CPU is
guaranteed by a snoop control unit, this patch should provide even more
gains, and probably rx_copybreak could be increased.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: convert to build_skb()
willy tarreau [Thu, 16 Jan 2014 07:20:16 +0000 (08:20 +0100)]
net: mvneta: convert to build_skb()

Make use of build_skb() to allocate frags on the RX path. When frag size
is lower than a page size, we can use netdev_alloc_frag(), and we fall back
to kmalloc() for larger sizes. The frag size is stored into the mvneta_port
struct. The alloc/free functions check the frag size to decide what alloc/
free method to use. MTU changes are safe because the MTU change function
stops the device and clears the queues before applying the change.

With this patch, I observed a reproducible 2% performance improvement on
HTTP-based benchmarks, and 5% on small packet RX rate.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: prefetch next rx descriptor instead of current one
willy tarreau [Thu, 16 Jan 2014 07:20:15 +0000 (08:20 +0100)]
net: mvneta: prefetch next rx descriptor instead of current one

Currently, the mvneta driver tries to prefetch the current Rx
descriptor during read. Tests have shown that prefetching the
next one instead increases general performance by about 1% on
HTTP traffic.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: simplify access to the rx descriptor status
willy tarreau [Thu, 16 Jan 2014 07:20:14 +0000 (08:20 +0100)]
net: mvneta: simplify access to the rx descriptor status

At several places, we already know the value of the rx status but
we call functions which dereference the pointer again to get it
and don't need the descriptor for anything else. Simplify this
task by replacing the rx desc pointer by the status word itself.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: factor rx refilling code
willy tarreau [Thu, 16 Jan 2014 07:20:13 +0000 (08:20 +0100)]
net: mvneta: factor rx refilling code

Make mvneta_rxq_fill() use mvneta_rx_refill() instead of using
duplicate code.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: remove tests for impossible cases in the tx_done path
willy tarreau [Thu, 16 Jan 2014 07:20:12 +0000 (08:20 +0100)]
net: mvneta: remove tests for impossible cases in the tx_done path

Currently, mvneta_txq_bufs_free() calls mvneta_tx_done_policy() with
a non-null cause to retrieve the pointer to the next queue to process.
There are useless tests on the return queue number and on the pointer,
all of which are well defined within a known limited set. This code
path is fast, although not critical. Removing 3 tests here that the
compiler could not optimize (verified) is always desirable.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: replace Tx timer with a real interrupt
willy tarreau [Thu, 16 Jan 2014 07:20:11 +0000 (08:20 +0100)]
net: mvneta: replace Tx timer with a real interrupt

Right now the mvneta driver doesn't handle Tx IRQ, and relies on two
mechanisms to flush Tx descriptors : a flush at the end of mvneta_tx()
and a timer. If a burst of packets is emitted faster than the device
can send them, then the queue is stopped until next wake-up of the
timer 10ms later. This causes jerky output traffic with bursts and
pauses, making it difficult to reach line rate with very few streams.

A test on UDP traffic shows that it's not possible to go beyond 134
Mbps / 12 kpps of outgoing traffic with 1500-bytes IP packets. Routed
traffic tends to observe pauses as well if the traffic is bursty,
making it even burstier after the wake-up.

It seems that this feature was inherited from the original driver but
nothing there mentions any reason for not using the interrupt instead,
which the chip supports.

Thus, this patch enables Tx interrupts and removes the timer. It does
the two at once because it's not really possible to make the two
mechanisms coexist, so a split patch doesn't make sense.

First tests performed on a Mirabox (Armada 370) show that less CPU
seems to be used when sending traffic. One reason might be that we now
call the mvneta_tx_done_gbe() with a mask indicating which queues have
been done instead of looping over all of them.

The same UDP test above now happily reaches 987 Mbps / 87.7 kpps.
Single-stream TCP traffic can now more easily reach line rate. HTTP
transfers of 1 MB objects over a single connection went from 730 to
840 Mbps. It is even possible to go significantly higher (>900 Mbps)
by tweaking tcp_tso_win_divisor.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Arnaud Ebalard <arno@natisbad.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: add missing bit descriptions for interrupt masks and causes
willy tarreau [Thu, 16 Jan 2014 07:20:10 +0000 (08:20 +0100)]
net: mvneta: add missing bit descriptions for interrupt masks and causes

Marvell has not published the chip's datasheet yet, so it's very hard
to find the relevant bits to manipulate to change the IRQ behaviour.
Fortunately, these bits are described in the proprietary LSP patch set
which is publicly available here :

    http://www.plugcomputer.org/downloads/mirabox/

So let's put them back in the driver in order to reduce the burden of
current and future maintenance.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: do not schedule in mvneta_tx_timeout
willy tarreau [Thu, 16 Jan 2014 07:20:09 +0000 (08:20 +0100)]
net: mvneta: do not schedule in mvneta_tx_timeout

If a queue timeout is reported, we can oops because of some
schedules while the caller is atomic, as shown below :

  mvneta d0070000.ethernet eth0: tx timeout
  BUG: scheduling while atomic: bash/1528/0x00000100
  Modules linked in: slhttp_ethdiv(C) [last unloaded: slhttp_ethdiv]
  CPU: 2 PID: 1528 Comm: bash Tainted: G        WC   3.13.0-rc4-mvebu-nf #180
  [<c0011bd9>] (unwind_backtrace+0x1/0x98) from [<c000f1ab>] (show_stack+0xb/0xc)
  [<c000f1ab>] (show_stack+0xb/0xc) from [<c02ad323>] (dump_stack+0x4f/0x64)
  [<c02ad323>] (dump_stack+0x4f/0x64) from [<c02abe67>] (__schedule_bug+0x37/0x4c)
  [<c02abe67>] (__schedule_bug+0x37/0x4c) from [<c02ae261>] (__schedule+0x325/0x3ec)
  [<c02ae261>] (__schedule+0x325/0x3ec) from [<c02adb97>] (schedule_timeout+0xb7/0x118)
  [<c02adb97>] (schedule_timeout+0xb7/0x118) from [<c0020a67>] (msleep+0xf/0x14)
  [<c0020a67>] (msleep+0xf/0x14) from [<c01dcbe5>] (mvneta_stop_dev+0x21/0x194)
  [<c01dcbe5>] (mvneta_stop_dev+0x21/0x194) from [<c01dcfe9>] (mvneta_tx_timeout+0x19/0x24)
  [<c01dcfe9>] (mvneta_tx_timeout+0x19/0x24) from [<c024afc7>] (dev_watchdog+0x18b/0x1c4)
  [<c024afc7>] (dev_watchdog+0x18b/0x1c4) from [<c0020b53>] (call_timer_fn.isra.27+0x17/0x5c)
  [<c0020b53>] (call_timer_fn.isra.27+0x17/0x5c) from [<c0020cad>] (run_timer_softirq+0x115/0x170)
  [<c0020cad>] (run_timer_softirq+0x115/0x170) from [<c001ccb9>] (__do_softirq+0xbd/0x1a8)
  [<c001ccb9>] (__do_softirq+0xbd/0x1a8) from [<c001cfad>] (irq_exit+0x61/0x98)
  [<c001cfad>] (irq_exit+0x61/0x98) from [<c000d4bf>] (handle_IRQ+0x27/0x60)
  [<c000d4bf>] (handle_IRQ+0x27/0x60) from [<c000843b>] (armada_370_xp_handle_irq+0x33/0xc8)
  [<c000843b>] (armada_370_xp_handle_irq+0x33/0xc8) from [<c000fba9>] (__irq_usr+0x49/0x60)

Ben Hutchings attempted to propose a better fix consisting in using a
scheduled work for this, but while it fixed this panic, it caused other
random freezes and panics proving that the reset sequence in the driver
is unreliable and that additional fixes should be investigated.

When sending multiple streams over a link limited to 100 Mbps, Tx timeouts
happen from time to time, and the driver correctly recovers only when the
function is disabled.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: use per_cpu stats to fix an SMP lock up
willy tarreau [Thu, 16 Jan 2014 07:20:08 +0000 (08:20 +0100)]
net: mvneta: use per_cpu stats to fix an SMP lock up

Stats writers are mvneta_rx() and mvneta_tx(). They don't lock anything
when they update the stats, and as a result, it randomly happens that
the stats freeze on SMP if two updates happen during stats retrieval.
This is very easily reproducible by starting two HTTP servers and binding
each of them to a different CPU, then consulting /proc/net/dev in loops
during transfers, the interface should immediately lock up. This issue
also randomly happens upon link state changes during transfers, because
the stats are collected in this situation, but it takes more attempts to
reproduce it.

The comments in netdevice.h suggest using per_cpu stats instead to get
rid of this issue.

This patch implements this. It merges both rx_stats and tx_stats into
a single "stats" member with a single syncp. Both mvneta_rx() and
mvneta_rx() now only update the a single CPU's counters.

In turn, mvneta_get_stats64() does the summing by iterating over all CPUs
to get their respective stats.

With this change, stats are still correct and no more lockup is encountered.

Note that this bug was present since the first import of the mvneta
driver.  It might make sense to backport it to some stable trees. If
so, it depends on "d33dc73 net: mvneta: increase the 64-bit rx/tx stats
out of the hot path".

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: mvneta: increase the 64-bit rx/tx stats out of the hot path
willy tarreau [Thu, 16 Jan 2014 07:20:07 +0000 (08:20 +0100)]
net: mvneta: increase the 64-bit rx/tx stats out of the hot path

Better count packets and bytes in the stack and on 32 bit then
accumulate them at the end for once. This saves two memory writes
and two memory barriers per packet. The incoming packet rate was
increased by 4.7% on the Openblocks AX3 thanks to this.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agodrivers/net: delete non-required instances of include <linux/init.h>
Paul Gortmaker [Wed, 8 Jan 2014 20:32:47 +0000 (15:32 -0500)]
drivers/net: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>.   Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

This covers everything under drivers/net except for wireless, which
has been submitted separately.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nftables
David S. Miller [Thu, 16 Jan 2014 19:44:54 +0000 (11:44 -0800)]
Merge branch 'master' of git://git./linux/kernel/git/pablo/nftables

Pablo Neira Ayuso says:

====================
This small batch contains several Netfilter fixes for your net-next
tree, more specifically:

* Fix compilation warning in nft_ct in NF_CONNTRACK_MARK is not set,
  from Kristian Evensen.

* Add dependency to IPV6 for NF_TABLES_INET. This one has been reported
  by the several robots that are testing .config combinations, from Paul
  Gortmaker.

* Fix default base chain policy setting in nf_tables, from myself.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoneigh: use NEIGH_VAR_INIT in ndo_neigh_setup functions.
Jiri Pirko [Thu, 9 Jan 2014 13:13:47 +0000 (14:13 +0100)]
neigh: use NEIGH_VAR_INIT in ndo_neigh_setup functions.

When ndo_neigh_setup is called, the bitfield used by NEIGH_VAR_SET is
not initialized yet. This might cause confusion for the people who use
NEIGH_VAR_SET in ndo_neigh_setup. So rather introduce NEIGH_VAR_INIT for
usage in ndo_neigh_setup.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'ixgbe'
David S. Miller [Thu, 16 Jan 2014 05:48:42 +0000 (21:48 -0800)]
Merge branch 'ixgbe'

Aaron Brown says:

====================
Intel Wired LAN Driver Updates

This series contains several updates from Alex to ixgbe.

To avoid head of line blocking in the event a VF stops cleaning Rx descriptors
he makes sure QDE bits are set for a VF before the Rx queues are enabled.

To avoid a situation where the head write-back registers can remain set ofter
the driver is unloaded he clears them on a VF reset.

Alexander Duyck (2):
  ixgbe: Force QDE via PFQDE for VFs during reset
  ixgbe: Clear head write-back registers on VF reset
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoixgbe: Clear head write-back registers on VF reset
Alexander Duyck [Thu, 16 Jan 2014 01:38:41 +0000 (17:38 -0800)]
ixgbe: Clear head write-back registers on VF reset

The Tx head write-back registers are not cleared during an FLR or VF reset.
As a result a configuration that had head write-back enabled can leave the
registers set after the driver is unloaded.  If the next driver loaded doesn't
use the write-back registers this can lead to a bad configuration where
head write-back is enabled, but the driver didn't request it.

To avoid this situation the PF should be resetting the Tx head write-back
registers when the VF requests a reset.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoixgbe: Force QDE via PFQDE for VFs during reset
Alexander Duyck [Thu, 16 Jan 2014 01:38:40 +0000 (17:38 -0800)]
ixgbe: Force QDE via PFQDE for VFs during reset

This change makes it so that the QDE bits are set for a VF before the Rx
queues are enabled.  As such we avoid head of line blocking in the event
that the VF stops cleaning Rx descriptors for whatever reason.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c |   14 ++++++++++++++
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h  |    7 ++++---
 2 files changed, 18 insertions(+), 3 deletions(-)
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'noprefixroute'
David S. Miller [Thu, 16 Jan 2014 01:00:47 +0000 (17:00 -0800)]
Merge branch 'noprefixroute'

Thomas Haller says:

====================
ipv6 addrconf: add IFA_F_NOPREFIXROUTE flag to suppress creation of IP6 routes

v1 -> v2: add a second commit, handling NOPREFIXROUTE in ip6_del_addr.
v2 -> v3: reword commit messages, code comments and some refactoring.
v3 -> v4: refactor, rename variables, add enum
v4 -> v5: rebase, so that patch applies cleanly to current net-next/master
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoipv6 addrconf: don't cleanup prefix route for IFA_F_NOPREFIXROUTE
Thomas Haller [Wed, 15 Jan 2014 14:36:59 +0000 (15:36 +0100)]
ipv6 addrconf: don't cleanup prefix route for IFA_F_NOPREFIXROUTE

Refactor the deletion/update of prefix routes when removing an
address. Now also consider IFA_F_NOPREFIXROUTE and if there is an address
present with this flag, to not cleanup the route. Instead, assume
that userspace is taking care of this route.

Also perform the same cleanup, when userspace changes an existing address
to add NOPREFIXROUTE (to an address that didn't have this flag). This is
done because when the address was added, a prefix route was created for it.
Since the user now wants to handle this route by himself, we cleanup this
route.

This cleanup of the route is not totally robust. There is no guarantee,
that the route we are about to delete was really the one added by the
kernel. This behavior does not change by the patch, and in practice it
should work just fine.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoipv6 addrconf: add IFA_F_NOPREFIXROUTE flag to suppress creation of IP6 routes
Thomas Haller [Wed, 15 Jan 2014 14:36:58 +0000 (15:36 +0100)]
ipv6 addrconf: add IFA_F_NOPREFIXROUTE flag to suppress creation of IP6 routes

When adding/modifying an IPv6 address, the userspace application needs
a way to suppress adding a prefix route. This is for example relevant
together with IFA_F_MANAGERTEMPADDR, where userspace creates autoconf
generated addresses, but depending on on-link, no route for the
prefix should be added.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoRevert "batman-adv: drop dependency against CRC16"
David S. Miller [Thu, 16 Jan 2014 00:54:14 +0000 (16:54 -0800)]
Revert "batman-adv: drop dependency against CRC16"

This reverts commit 12afc36e38b3b6a0ec9bda71632c2285e7fdbab2.

The dependency is actually still necessary.

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agosctp: create helper function to enable|disable sackdelay
wangweidong [Wed, 15 Jan 2014 09:24:01 +0000 (17:24 +0800)]
sctp: create helper function to enable|disable sackdelay

add sctp_spp_sackdelay_{enable|disable} helper function for
avoiding code duplication.

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoipv6: move IPV6_TCLASS_SHIFT into ipv6.h and define a helper
Li RongQing [Wed, 15 Jan 2014 09:03:30 +0000 (17:03 +0800)]
ipv6: move IPV6_TCLASS_SHIFT into ipv6.h and define a helper

Two places defined IPV6_TCLASS_SHIFT, so we should move it into ipv6.h,
and use this macro as possible. And define ip6_tclass helper to return
tclass

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'be2net'
David S. Miller [Wed, 15 Jan 2014 23:52:07 +0000 (15:52 -0800)]
Merge branch 'be2net'

Sathya Perla says:

====================
be2net: patch set

The following patch set is best suited for net-next as it
contains code-cleanup, support for newer versions of FW cmds and
a few minor fixes. Please apply. Thanks!
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobe2net: update driver version to 10.0.x
Sathya Perla [Wed, 15 Jan 2014 07:53:41 +0000 (13:23 +0530)]
be2net: update driver version to 10.0.x

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobe2net: cleanup wake-on-lan code
Suresh Reddy [Wed, 15 Jan 2014 07:53:40 +0000 (13:23 +0530)]
be2net: cleanup wake-on-lan code

This patch cleans-up wake-on-lan code in the following ways:
1) Removes some driver hacks in be_cmd_get_acpi_wol_cap() that were based
on incorrect assumptions.
2) Uses the adapter->wol_en and wol_cap variables for checking if WoL
is supported and enabled on an interface instead of referring to the
exclusion list via the macro be_is_wol_supported()

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobe2net: use GET_MAC_LIST cmd to query mac-address from a pmac-id
Suresh Reddy [Wed, 15 Jan 2014 07:53:39 +0000 (13:23 +0530)]
be2net: use GET_MAC_LIST cmd to query mac-address from a pmac-id

The use of NTKW_MAC_QUERY cmd has been deprecated for Skyhawk-R.
Replace the last remaining usage in be_vfs_mac_query() routine.

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobe2net: do not use frag index in the RX-compl entry
Suresh Reddy [Wed, 15 Jan 2014 07:53:38 +0000 (13:23 +0530)]
be2net: do not use frag index in the RX-compl entry

Instead, use the tail of the RXQ to pick the associated RXQ entry

This fix is required in preparation for supporting RXQ lengths greater than 1K.
For such queues, the frag index in the RX-compl entry is not valid as it is only a 10 bit entry not capable of addressing RXQs longer than 1K.

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobe2net: Remove "10Gbps" from driver description string
Suresh Reddy [Wed, 15 Jan 2014 07:53:37 +0000 (13:23 +0530)]
be2net: Remove "10Gbps" from driver description string

As be2net is used even by the 40Gbps Skyhawk-R chip

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobe2net: fix incorrect setting of cmd_privileges for VFs
Suresh Reddy [Wed, 15 Jan 2014 07:53:36 +0000 (13:23 +0530)]
be2net: fix incorrect setting of cmd_privileges for VFs

An earlier commit (f25b119c "Fix error messages while driver load for VFs")
incorrectly set the adapter->cmd_privileges value for VFs (in a
multi-channel config) to MAX_PRIVILEGES. This causes FW cmd failures
and avoidable error logs when certian cmds are issued by a VF.
Also, move the multi-channel hack to be_cmds.c inside
be_cmd_get_fn_privileges() routine.

Fixes: f25b119c "Fix error messages while driver load for VFs"

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobe2net: ignore mac-addr set call for an already programmed mac-addr
Vasundhara Volam [Wed, 15 Jan 2014 07:53:35 +0000 (13:23 +0530)]
be2net: ignore mac-addr set call for an already programmed mac-addr

An ndo_set_mac_addr() call may be issued for a mac-addr that is already
active on an interface. If so, silently ignore the request. Sending such
a request to the FW, causes a "mac collision" error. The error is harmless
but is avoidable noise in the kernel log.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobe2net: do not call be_set/get_fw_log_level() on Skyhawk-R
Vasundhara Volam [Wed, 15 Jan 2014 07:53:34 +0000 (13:23 +0530)]
be2net: do not call be_set/get_fw_log_level() on Skyhawk-R

Skyhawk-R FW does not support SET/GET_EXT_FAT_CAPABILITIES cmds via which
FW logging level can be controlled. Also, the hack used in BE3 to control
FW logging level via the ethtool interface is not needed in Skyhawk-R.

This patch also cleans up this code by moving be_set/get_fw_log_level()
routines to be_cmds.c where they belong.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
remove new line
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobe2net: Log the profile-id used by FW during driver initialization
Vasundhara Volam [Wed, 15 Jan 2014 07:53:33 +0000 (13:23 +0530)]
be2net: Log the profile-id used by FW during driver initialization

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobe2net: don't set "pport" field when querying "pvid"
Vasundhara Volam [Wed, 15 Jan 2014 07:53:32 +0000 (13:23 +0530)]
be2net: don't set "pport" field when querying "pvid"

In the GET_HSW_CONFIG cmd, the "pport" field must be set only while
querying the switch mode.  When the "pport" field is set, the
"interface_id" field must be set to the port number, otherwise, it
must be set to adapter->if_handle.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobe2net: Use MCC_CREATE_EXT_V1 cmd for Skyhawk-R
Vasundhara Volam [Wed, 15 Jan 2014 07:53:31 +0000 (13:23 +0530)]
be2net: Use MCC_CREATE_EXT_V1 cmd for Skyhawk-R

Currently this cmd is used only for Lancer.
MCC_CREATE_EXT_V1 supports larger CQ-ids and additional event codes for the
async_event_bitmap field.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoetherdevice: Use ether_addr_copy to copy an Ethernet address
Joe Perches [Tue, 14 Jan 2014 23:18:47 +0000 (15:18 -0800)]
etherdevice: Use ether_addr_copy to copy an Ethernet address

Some systems can use the normally known u16 alignment of
Ethernet addresses to save some code/text bytes and cycles.

This does not change currently emitted code on x86 by gcc 4.8.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: move 6lowpan compression code to separate module
Dmitry Eremin-Solenikov [Tue, 14 Jan 2014 22:50:40 +0000 (02:50 +0400)]
net: move 6lowpan compression code to separate module

IEEE 802.15.4 and Bluetooth networking stacks share 6lowpan compression
code. Instead of introducing Makefile/Kconfig hacks, build this code as
a separate module referenced from both ieee802154 and bluetooth modules.

This fixes the following build error observed in some kernel
configurations:

net/built-in.o: In function `header_create': 6lowpan.c:(.text+0x166149): undefined reference to `lowpan_header_compress'
net/built-in.o: In function `bt_6lowpan_recv': (.text+0x166b3c): undefined reference to `lowpan_process_data'

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'netdev_sysfs_symlink_rename'
David S. Miller [Wed, 15 Jan 2014 23:17:03 +0000 (15:17 -0800)]
Merge branch 'netdev_sysfs_symlink_rename'

Veaceslav Falico says:

====================
net: rename device's sysfs symlinks on name change

First patch only adds helper functions and cleans up the code a bit, second
one already does the renaming.

v1->v2:
Don't export the function, as it's used only in dev.c.
====================

Reported-by: Ding Tianhong <dingtianhong@huawei.com>
CC: Ding Tianhong <dingtianhong@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Eric Dumazet <edumazet@google.com>
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
CC: Cong Wang <amwang@redhat.com>
CC: netdev@vger.kernel.org
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: rename sysfs symlinks on device name change
Veaceslav Falico [Tue, 14 Jan 2014 20:58:51 +0000 (21:58 +0100)]
net: rename sysfs symlinks on device name change

Currently, we don't rename the upper/lower_ifc symlinks in
/sys/class/net/*/ , which might result stale/duplicate links/names.

Fix this by adding netdev_adjacent_rename_links(dev, oldname) which renames
all the upper/lower interface's links to dev from the upper/lower_oldname
to the new name.

We don't need a rollback because only we control these symlinks and if we
fail to rename them - sysfs will anyway complain.

Reported-by: Ding Tianhong <dingtianhong@huawei.com>
CC: Ding Tianhong <dingtianhong@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Eric Dumazet <edumazet@google.com>
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
CC: Cong Wang <amwang@redhat.com>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: add sysfs helpers for netdev_adjacent logic
Veaceslav Falico [Tue, 14 Jan 2014 20:58:50 +0000 (21:58 +0100)]
net: add sysfs helpers for netdev_adjacent logic

They clean up the code a bit and can be used further.

CC: Ding Tianhong <dingtianhong@huawei.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Eric Dumazet <edumazet@google.com>
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
CC: Cong Wang <amwang@redhat.com>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agostmmac: Add vlan rx for better GRO performance.
Vince Bridgers [Tue, 14 Jan 2014 19:42:05 +0000 (13:42 -0600)]
stmmac: Add vlan rx for better GRO performance.

GRO requires VLANs to be removed before aggregation can occur.
The Synopsys EMAC does not strip VLAN tags so this must be
done by the driver.

Signed-off-by: Vince Bridgers <vbridgers2013@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobnx2x: fix sparse warning
stephen hemminger [Tue, 14 Jan 2014 18:14:11 +0000 (10:14 -0800)]
bnx2x: fix sparse warning

Fix new sparse warning about function declared static.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agostaging,lpc32xx_adc: Add dependency on HAS_IOMEM
Richard Weinberger [Tue, 14 Jan 2014 15:45:45 +0000 (16:45 +0100)]
staging,lpc32xx_adc: Add dependency on HAS_IOMEM

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/built-in.o: In function `lpc32xx_adc_probe':
drivers/staging/iio/adc/lpc32xx_adc.c:149: undefined reference to `devm_ioremap'

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agopower,goldfish: Add dependency on HAS_IOMEM
Richard Weinberger [Tue, 14 Jan 2014 15:45:44 +0000 (16:45 +0100)]
power,goldfish: Add dependency on HAS_IOMEM

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/built-in.o: In function `goldfish_battery_probe':
drivers/power/goldfish_battery.c:181: undefined reference to `devm_ioremap'

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet,marvell: Add dependency on HAS_IOMEM
Richard Weinberger [Tue, 14 Jan 2014 15:45:43 +0000 (16:45 +0100)]
net,marvell: Add dependency on HAS_IOMEM

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/built-in.o: In function `orion_mdio_probe':
drivers/net/ethernet/marvell/mvmdio.c:228: undefined reference to `devm_ioremap'

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agophy,exynos: Add dependency on HAS_IOMEM
Richard Weinberger [Tue, 14 Jan 2014 15:45:42 +0000 (16:45 +0100)]
phy,exynos: Add dependency on HAS_IOMEM

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/built-in.o: In function `exynos_mipi_video_phy_probe':
drivers/phy/phy-exynos-mipi-video.c:130: undefined reference to `devm_ioremap_resource'

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agostaging,spear_adc: Add dependency on HAS_IOMEM
Richard Weinberger [Tue, 14 Jan 2014 15:45:41 +0000 (16:45 +0100)]
staging,spear_adc: Add dependency on HAS_IOMEM

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/staging/iio/adc/spear_adc.c: In function โ€˜spear_adc_probeโ€™:
drivers/staging/iio/adc/spear_adc.c:393:2: error: implicit declaration of function โ€˜iounmapโ€™ [-Werror=implicit-function-declaration

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agostaging,dgap: Add dependency on HAS_IOMEM
Richard Weinberger [Tue, 14 Jan 2014 15:45:40 +0000 (16:45 +0100)]
staging,dgap: Add dependency on HAS_IOMEM

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/staging/dgap/dgap_driver.c: In function โ€˜dgap_cleanup_boardโ€™:
drivers/staging/dgap/dgap_driver.c:457:3: error: implicit declaration of function โ€˜iounmapโ€™ [-Werror=implicit-function-declaration]
drivers/staging/dgap/dgap_driver.c: In function โ€˜dgap_do_remapโ€™:
drivers/staging/dgap/dgap_driver.c:694:2: error: implicit declaration of function โ€˜ioremapโ€™ [-Werror=implicit-function-declaration]

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoptp_pch: Add dependency on HAS_IOMEM
Richard Weinberger [Tue, 14 Jan 2014 15:45:39 +0000 (16:45 +0100)]
ptp_pch: Add dependency on HAS_IOMEM

On archs like S390 or um this driver cannot build nor work.
Make it depend on HAS_IOMEM to bypass build failures.

drivers/ptp/ptp_pch.c: In function โ€˜pch_removeโ€™:
drivers/ptp/ptp_pch.c:571:3: error: implicit declaration of function โ€˜iounmapโ€™ [-Werror=implicit-function-declaration]
drivers/ptp/ptp_pch.c: In function โ€˜pch_probeโ€™:
drivers/ptp/ptp_pch.c:621:2: error: implicit declaration of function โ€˜ioremapโ€™ [-Werror=implicit-function-declaration]

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoqeth: bridgeport support - address notifications
Eugene Crosser [Tue, 14 Jan 2014 14:54:13 +0000 (15:54 +0100)]
qeth: bridgeport support - address notifications

Introduce functions to enable and disable bridgeport address
notification feature, sysfs attributes for access to these
functions from userspace, and udev events emitted when a host
joins or exits a bridgeport-enabled HiperSocket channel.

Signed-off-by: Eugene Crosser <eugene.crosser@ru.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Reviewed-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agos390/qdio: bridgeport support - CHSC part
Eugene Crosser [Tue, 14 Jan 2014 14:54:12 +0000 (15:54 +0100)]
s390/qdio: bridgeport support - CHSC part

Introduce function for the "Perform network-subchannel operation"
CHSC command with operation code "bridgeport information",
and bit definitions for "characteristics" pertaning to this command.

Signed-off-by: Eugene Crosser <eugene.crosser@ru.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Reviewed-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoqeth: bridgeport support - basic control
Eugene Crosser [Tue, 14 Jan 2014 14:54:11 +0000 (15:54 +0100)]
qeth: bridgeport support - basic control

Introduce functions to assign roles and check state of bridgeport-capable
HiperSocket devices, and sysfs attributes providing access to these
functions from userspace. Introduce udev events emitted when the state
of a bridgeport device changes.

Signed-off-by: Eugene Crosser <eugene.crosser@ru.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Reviewed-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoneigh: split lines for NEIGH_VAR_SET so they are not too long
Jiri Pirko [Tue, 14 Jan 2014 14:46:07 +0000 (15:46 +0100)]
neigh: split lines for NEIGH_VAR_SET so they are not too long

introduced by:
commit 1f9248e5606afc6485255e38ad57bdac08fa7711
"neigh: convert parms to an array"

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agogianfar: Fix portabilty issues for ethtool and ptp
Claudiu Manoil [Tue, 14 Jan 2014 13:35:00 +0000 (15:35 +0200)]
gianfar: Fix portabilty issues for ethtool and ptp

Fixes unhandled register write in gianfar_ethtool.c.
Fixes following endianess related functional issues,
reported by sparse as well, i.e.:

gianfar_ethtool.c:1058:33: warning:
    incorrect type in argument 1 (different base types)
    expected unsigned int [unsigned] [usertype] value
    got restricted __be32 [usertype] ip4src

gianfar_ethtool.c:1164:33: warning:
    restricted __be16 degrades to integer

gianfar_ethtool.c:1669:32: warning:
    invalid assignment: ^=
    left side has type restricted __be16
    right side has type int

Solves all the sparse warnings for mixig normal pointers
with __iomem pointers for gianfar_ptp.c, i.e.:
gianfar_ptp.c:163:32: warning:
    incorrect type in argument 1 (different address spaces)
    expected unsigned int [noderef] <asn:2>*addr
    got unsigned int *<noident>

Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoksz884x: delete useless variable
Julia Lawall [Mon, 13 Jan 2014 16:17:24 +0000 (17:17 +0100)]
ksz884x: delete useless variable

Delete a variable that is at most only assigned to a constant, but never
used otherwise.  In this code, it is the variable result that is used for
the return code, not rc.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
identifier i;
constant c;
@@

-T i;
<... when != i
-i = c;
...>
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonetfilter: nft_ct: fix compilation warning if NF_CONNTRACK_MARK is not set
Kristian Evensen [Fri, 10 Jan 2014 20:43:20 +0000 (21:43 +0100)]
netfilter: nft_ct: fix compilation warning if NF_CONNTRACK_MARK is not set

net/netfilter/nft_ct.c: In function 'nft_ct_set_eval':
net/netfilter/nft_ct.c:136:6: warning: unused variable 'value' [-Wunused-variable]

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
10 years agoMerge branch 'i40e-next'
David S. Miller [Wed, 15 Jan 2014 08:01:03 +0000 (00:01 -0800)]
Merge branch 'i40e-next'

Aaron Brown says:

====================
Intel Wired LAN Driver Updates

This series contains updates to i40e from Greg Rose for VLAN filtering.

Greg Rose (2):
  i40e: Warn admin to reload VF driver on port VLAN configuration.
    When an administrator sets a port VLAN filters for the virtual
    function (VF) after the VF has already set its own VLAN filters a
    conflict requiring the VF be reloaded can occur.  This patch logs a
    message indicating to the system administrator that the VF driver
    must be reloaded for the new port VLAN settings to take effect

  i40e: Retain MAC filters on port VLAN deletion
    On port VLAN deletion the list of MAC filters for the virtual function
    (VF) VSI were all deleted.  Let's keep them around, they come in
    handy for keeping the VF functional.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoi40e: Retain MAC filters on port VLAN deletion
Greg Rose [Tue, 14 Jan 2014 00:13:04 +0000 (16:13 -0800)]
i40e: Retain MAC filters on port VLAN deletion

On port VLAN deletion the list of MAC filters for the virtual function (VF)
VSI were all deleted.  Let's keep them around, they come in handy for keeping
the VF functional.

Change-Id: I335e760392f274dc8b8b40efcb708f65b49d7973
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoi40e: Warn admin to reload VF driver on port VLAN configuration
Greg Rose [Tue, 14 Jan 2014 00:13:03 +0000 (16:13 -0800)]
i40e: Warn admin to reload VF driver on port VLAN configuration

The i40e Physical Function (PF) driver will allow the
 Virtual Function (VF) driver to configure its own VLAN filters if no port
 VLAN filter has been configured.  This leads to the possibility of the
 administrator setting a port VLAN filter for the VF after the VF has already
 configured its own VLAN filters.  This leads to a conflict that can only be
 resolved by reloading the VF driver.  When the conflicting administrative
 command is detected in setting the port VLAN then log a message indicating to
 the system administrator that he must now reload the VF driver for the new
 port VLAN settings to take effect.

Change-Id: I8de73b885d944a043aff32226297e4249862bcad
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'vxlan_lower_dev_unregister'
David S. Miller [Wed, 15 Jan 2014 07:39:05 +0000 (23:39 -0800)]
Merge branch 'vxlan_lower_dev_unregister'

Daniel Borkmann says:

====================
vxlan updates

Did the split into two patches upon request from Cong Wang.

Changelog:

 v1->v2:
  - Removed BUG_ON as it's not needed.
 v2->v3:
  - Removed dev->reg_state check for netns.
 v3->v4:
  - Removed list_del(), we seem to do it in some places and
    in some others not; we agreed it's not really necessary.
  - Split patch into 2 patches, notifier part and module
    unload cleanup part.
====================

Reviewed-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: vxlan: properly cleanup devs on module unload
Daniel Borkmann [Mon, 13 Jan 2014 17:41:20 +0000 (18:41 +0100)]
net: vxlan: properly cleanup devs on module unload

We should use vxlan_dellink() handler in vxlan_exit_net(), since
i) we're not in fast-path and we should be consistent in dismantle
just as we would remove a device through rtnl ops, and more
importantly, ii) in case future code will kfree() memory in
vxlan_dellink(), we would leak it right here unnoticed. Therefore,
do not only half of the cleanup work, but make it properly.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: vxlan: when lower dev unregisters remove vxlan dev as well
Daniel Borkmann [Mon, 13 Jan 2014 17:41:19 +0000 (18:41 +0100)]
net: vxlan: when lower dev unregisters remove vxlan dev as well

We can create a vxlan device with an explicit underlying carrier.
In that case, when the carrier link is being deleted from the
system (e.g. due to module unload) we should also clean up all
created vxlan devices on top of it since otherwise we're in an
inconsistent state in vxlan device. In that case, the user needs
to remove all such devices, while in case of other virtual devs
that sit on top of physical ones, it is usually the case that
these devices do unregister automatically as well and do not
leave the burden on the user.

This work is not necessary when vxlan device was not created with
a real underlying device, as connections can resume in that case
when driver is plugged again. But at least for the other cases,
we should go ahead and do the cleanup on removal.

We don't register the notifier during vxlan_newlink() here since
I consider this event rather rare, and therefore we should not
bloat vxlan's core structure unecessary. Also, we can simply make
use of unregister_netdevice_many() to batch that. fdb is flushed
upon ndo_stop().

E.g. `ip -d link show vxlan13` after carrier removal before
this patch:

5: vxlan13: <BROADCAST,MULTICAST> mtu 1450 qdisc noop state DOWN mode DEFAULT group default
    link/ether 1e:47:da:6d:4d:99 brd ff:ff:ff:ff:ff:ff promiscuity 0
    vxlan id 13 group 239.0.0.10 dev 2 port 32768 61000 ageing 300
                                 ^^^^^
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'intel-next'
David S. Miller [Wed, 15 Jan 2014 02:59:33 +0000 (18:59 -0800)]
Merge branch 'intel-next'

Aaron Brown says:

====================
Intel Wired LAN Driver Updates, ixgbe: Add LER support

The following patches add Live Error Recovery (LER) support to the
ixgbe driver. This support also improves behavior in Thunderbolt
environments. This involves checking all register reads for a
value of all ones and when that is seen, to read the status
register, which should never properly return all ones, to
confirm whether the received value was correct. When this detects
a removal, the hw_addr field is cleared to indicate the removal.
This then blocks subsequent access to the device registers.

All register access macros have been changed to static inline
functions and all register accesses now use them.ยท Macro versions
are temporarily provided.

The __IXGBE_DOWN bit is no longer overloaded to also mean that
device removal has been initiated. Now the bit can be used to
protect ixgbe_down from multiple entry via test_and_set_bit. A
needed smp_mb__before_clear_bit was also added.

V2 Changes:
- Use ACCESS_ONCE where needed, thanks to Ben Hutchings
- Fix crash on module removal
- Use boolean values for boolean returns instead of 0 and 1
- Reword Kconfig help text

V3 Changes:
- Drop config option, per David Miller
- Drop tail register write checks, per Alexander Duyck
- Change writeq implementation to a static inline, thanks to Joe Perches

V4 Changes:
- Change __IXGBE_REMOVE to __IXGBE_REMOVING, per Scott Feldman's comment
- Add #define writeq writeq, per Alexander Duyck
- Change static inline functions to lower case, per David Miller
- Use new lower case names in added and modified register accesses
- Provide temporary upper case macros for register access functions
- Change IXGBE_REMOVED from macro to static inline and change references
- Correct IXGBE_WRITE_FLUSH to properly enclose parameter expansion
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoixgbe: Additional adapter removal checks
Mark Rustad [Wed, 15 Jan 2014 02:53:17 +0000 (18:53 -0800)]
ixgbe: Additional adapter removal checks

Additional checks are needed for a detected removal not to cause
problems. Some involve simply avoiding a lot of stuff that can't
do anything good, and also cases where the phony return value can
cause problems. In addition, down the adapter when the removal is
sensed.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoixgbe: Check for adapter removal on register writes
Mark Rustad [Wed, 15 Jan 2014 02:53:16 +0000 (18:53 -0800)]
ixgbe: Check for adapter removal on register writes

Prevent writes to an adapter that has been detected as removed
by a previous failing read. This also fixes some include file
ordering confusion that this patch revealed.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoixgbe: Check register reads for adapter removal
Mark Rustad [Wed, 15 Jan 2014 02:53:15 +0000 (18:53 -0800)]
ixgbe: Check register reads for adapter removal

Check all register reads for adapter removal by checking the status
register after any register read that returns 0xFFFFFFFF. Since the
status register will never return 0xFFFFFFFF unless the adapter is
removed, such a value from a status register read confirms the
removal.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoixgbe: Make ethtool register test use accessors
Mark Rustad [Wed, 15 Jan 2014 02:53:14 +0000 (18:53 -0800)]
ixgbe: Make ethtool register test use accessors

Make the ethtool register test use the normal register accessor
functions. Also eliminate macros used for calling register test
functions to make error exits clearer. Use boolean values for
boolean returns instead of 0 and 1.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoixgbe: Use static inlines instead of macros
Mark Rustad [Wed, 15 Jan 2014 02:53:13 +0000 (18:53 -0800)]
ixgbe: Use static inlines instead of macros

Kernel coding standard prefers static inline functions instead
of macros, so use them for register accessors. This is to prepare
for adding LER, Live Error Recovery, checks to those accessors.

Temporarily provide macros for calling the new static inline
accessors until all references are changed.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoixbge: Protect ixgbe_down with __IXGBE_DOWN bit
Mark Rustad [Wed, 15 Jan 2014 02:53:12 +0000 (18:53 -0800)]
ixbge: Protect ixgbe_down with __IXGBE_DOWN bit

The ixgbe_down function can now prevent multiple executions by
doing test_and_set_bit on __IXGBE_DOWN. This did not work before
introduction of the __IXGBE_REMOVING bit, because of overloading
of __IXGBE_DOWN. Also add smp_mb__before_clear_bit call before
clearing the __IXGBE_DOWN bit.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoixgbe: Indicate removal state explicitly
Mark Rustad [Wed, 15 Jan 2014 02:53:11 +0000 (18:53 -0800)]
ixgbe: Indicate removal state explicitly

Add a bit, __IXGBE_REMOVING, to indicate that the module is being
removed. The __IXGBE_DOWN bit had been overloaded for this purpose,
but that leads to trouble. A few places now check both __IXGBE_DOWN
and __IXGBE_REMOVE. Notably, setting either bit will prevent service
task execution.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'i40e'
David S. Miller [Wed, 15 Jan 2014 02:56:14 +0000 (18:56 -0800)]
Merge branch 'i40e'

Aaron Brown says:

====================
Intel Wired LAN Driver Updates

This series contains updates to i40e that are primarily minor fixes or
general cleanup.

Shannon fixes a bug where the VMDq queue is not associated with the
right setup within the hardware.

Mitch provides a patch adjusting where the VF is reset and another
one adding meaningful context to a message.

Jesse cleans up white space comments and parenthesis.

Catherine bumps the version.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoi40e: Bump version number
Catherine Sullivan [Tue, 14 Jan 2014 08:49:54 +0000 (00:49 -0800)]
i40e: Bump version number

Update the driver version to 0.3.30-k.

Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoi40e: trivial cleanup
Jesse Brandeburg [Tue, 14 Jan 2014 08:49:53 +0000 (00:49 -0800)]
i40e: trivial cleanup

Remove some un-necessary parenthesis.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoi40e: whitespace fixes
Jesse Brandeburg [Tue, 14 Jan 2014 08:49:52 +0000 (00:49 -0800)]
i40e: whitespace fixes

Fix some whitespace and comment issues.

Change-ID: I1587599e50ce66fd389965720e86f9e331d86643
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoi40e: make message meaningful
Mitch Williams [Tue, 14 Jan 2014 08:49:51 +0000 (00:49 -0800)]
i40e: make message meaningful

Make this message mean something, rather than just spitting out a VSI id
without any context whatsoever.

Change-ID: Iafb906c6db46d4b5dcbe84adc9ed44730d08bd42
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoi40e: associate VMDq queue with VM type
Shannon Nelson [Tue, 14 Jan 2014 08:49:50 +0000 (00:49 -0800)]
i40e: associate VMDq queue with VM type

Fix a bug where the queue was not associated with the right set-up
within the hardware.  The fix is to use the right QTX_CTL VSI type
when associating it to the VSI.

Change-ID: I65ef6c5a8205601c640a6593e4b7e78d6ba45545
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoi40e: remove extra register write
Mitch Williams [Tue, 14 Jan 2014 08:49:49 +0000 (00:49 -0800)]
i40e: remove extra register write

This write done at the end of VF reset and should not be performed here.

Change-ID: I4d89813b68c6173184293868a6f26cf559bc2405
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agotcp: do not export tcp_gso_segment() and tcp_gro_receive()
Eric Dumazet [Wed, 15 Jan 2014 00:31:46 +0000 (16:31 -0800)]
tcp: do not export tcp_gso_segment() and tcp_gro_receive()

tcp_gso_segment() and tcp_gro_receive() no longer need to be
exported. IPv4 and IPv6 offloads are statically linked.

Note that tcp_gro_complete() is still used by bnx2x, unfortunately.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'dev_get_by_index'
David S. Miller [Wed, 15 Jan 2014 02:52:57 +0000 (18:52 -0800)]
Merge branch 'dev_get_by_index'

Ying Xue says:

====================
use appropriate APIs to get interfaces

Under rtnl_lock protection, we should use __dev_get_name/index()
rather than dev_get_name()/index() to find interface handlers
because the former interfaces can help us avoid to change interface
reference counter.

v2 changes:
 - Change return value of nl80211_set_wiphy() to 0 in patch #10
   by johannes's suggestion.
 - Add 'Acked-by' into several patches which were acknowledged by
   corresponding maintainers.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agonet: nl80211: __dev_get_by_index instead of dev_get_by_index to find interface
Ying Xue [Wed, 15 Jan 2014 02:23:45 +0000 (10:23 +0800)]
net: nl80211: __dev_get_by_index instead of dev_get_by_index to find interface

As __cfg80211_rdev_from_attrs(), nl80211_dump_wiphy_parse() and
nl80211_set_wiphy() are all under rtnl_lock protection,
__dev_get_by_index() instead of dev_get_by_index() should be used
to find interface handler in them allowing us to avoid to change
interface reference counter.

Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agocan: use __dev_get_by_index instead of dev_get_by_index to find interface
Ying Xue [Wed, 15 Jan 2014 02:23:44 +0000 (10:23 +0800)]
can: use __dev_get_by_index instead of dev_get_by_index to find interface

As cgw_create_job() is always under rtnl_lock protection,
__dev_get_by_index() instead of dev_get_by_index() should be used to
find interface handler in it having us avoid to change interface
reference counter.

Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agocaif: __dev_get_by_index instead of dev_get_by_index to find interface
Ying Xue [Wed, 15 Jan 2014 02:23:43 +0000 (10:23 +0800)]
caif: __dev_get_by_index instead of dev_get_by_index to find interface

The following call chains indicate that chnl_net_open() is under
rtnl_lock protection as __dev_open() is protected by rtnl_lock.
So if __dev_get_by_index() instead of dev_get_by_index() is used
to find interface handler in it, this would help us avoid to change
interface reference counter.

__dev_open()
  chnl_net_open()

Cc: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobatman-adv: use __dev_get_by_index instead of dev_get_by_index to find interface
Ying Xue [Wed, 15 Jan 2014 02:23:42 +0000 (10:23 +0800)]
batman-adv: use __dev_get_by_index instead of dev_get_by_index to find interface

The following call chains indicate that batadv_is_on_batman_iface()
is always under rtnl_lock protection as call_netdevice_notifier()
is protected by rtnl_lock. So if __dev_get_by_index() rather than
dev_get_by_index() is used to find interface handler in it, this
would help us avoid to change interface reference counter.

call_netdevice_notifier()
  batadv_hard_if_event()
    batadv_hardif_add_interface()
      batadv_is_valid_iface()
        batadv_is_on_batman_iface()

Cc: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agovxlan: use __dev_get_by_index instead of dev_get_by_index to find interface
Ying Xue [Wed, 15 Jan 2014 02:23:41 +0000 (10:23 +0800)]
vxlan: use __dev_get_by_index instead of dev_get_by_index to find interface

The following call chains indicate that vxlan_fdb_parse() is
under rtnl_lock protection. So if we use __dev_get_by_index()
instead of dev_get_by_index() to find interface handler in it,
this would help us avoid to change interface reference counter.

rtnetlink_rcv()
  rtnl_lock()
  netlink_rcv_skb()
    rtnl_fdb_add()
      vxlan_fdb_add()
        vxlan_fdb_parse()
  rtnl_unlock()

rtnetlink_rcv()
  rtnl_lock()
  netlink_rcv_skb()
    rtnl_fdb_del()
      vxlan_fdb_del()
        vxlan_fdb_parse()
  rtnl_unlock()

Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agodecnet: use __dev_get_by_index instead of dev_get_by_index to find interface
Ying Xue [Wed, 15 Jan 2014 02:23:40 +0000 (10:23 +0800)]
decnet: use __dev_get_by_index instead of dev_get_by_index to find interface

The following call chain we can identify that dn_cache_getroute() is
protected under rtnl_lock. So if we use __dev_get_by_index() instead
of dev_get_by_index() to find interface handlers in it, this would help
us avoid to change interface reference counter.

rtnetlink_rcv()
  rtnl_lock()
    netlink_rcv_skb()
      dn_cache_getroute()
  rtnl_unlock()

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agodcb: use __dev_get_by_name instead of dev_get_by_name to find interface
Ying Xue [Wed, 15 Jan 2014 02:23:39 +0000 (10:23 +0800)]
dcb: use __dev_get_by_name instead of dev_get_by_name to find interface

The following call chain indicates that dcb_doit() is protected
under rtnl_lock. So if we use __dev_get_by_name() instead of
dev_get_by_name() to find interface handlers in it, this would
help us avoid to change interface reference counter.

rtnetlink_rcv()
  rtnl_lock()
  netlink_rcv_skb()
    dcb_doit()
  rtnl_unlock()

Cc: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoeql: use __dev_get_by_name instead of dev_get_by_name to find interface
Ying Xue [Wed, 15 Jan 2014 02:23:38 +0000 (10:23 +0800)]
eql: use __dev_get_by_name instead of dev_get_by_name to find interface

The following call chain indicates that eql_ioctl(), eql_enslave(),
eql_emancipate(), eql_g_slave_cfg() and eql_s_slave_cfg() are
protected under rtnl_lock. So if we use __dev_get_by_name() instead
of dev_get_by_name() to find interface handlers in them, this would
help us avoid to change interface reference counters.

dev_ioctl()
  rtnl_lock()
    dev_ifsioc()
      eql_ioctl()
        eql_enslave()
eql_emancipate()
eql_g_slave_cfg()
eql_s_slave_cfg()
  rtnl_unlock()

Additionally we also change their return values from -EINVAL to
-ENODEV in case that interfaces are no found.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agobonding: use __dev_get_by_name instead of dev_get_by_name to find interface
Ying Xue [Wed, 15 Jan 2014 02:23:37 +0000 (10:23 +0800)]
bonding: use __dev_get_by_name instead of dev_get_by_name to find interface

The following call chain indicates that bond_do_ioctl() is protected
under rtnl_lock. If we use __dev_get_by_name() instead of
dev_get_by_name() to find interface handler in it, this would
help us avoid to change reference counter of interface once.

dev_ioctl()
  rtnl_lock()
  dev_ifsioc()
    bond_do_ioctl()
  rtnl_unlock()

Additionally we also change the coding style in bond_do_ioctl(),
letting it more readable for us.

Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoDrivers: Staging: cxt1e1: use __dev_get_name instead of dev_get_name to find interfaces
Ying Xue [Wed, 15 Jan 2014 02:23:36 +0000 (10:23 +0800)]
Drivers: Staging: cxt1e1: use __dev_get_name instead of dev_get_name to find interfaces

The following call chain denotes that both do_reset() and do_del_chan()
are protected under rtnl_lock. If we use __dev_get_by_name() instead of
dev_get_by_name() to find interface handlers in them, this would help
us avoid to change interface reference counter.

dev_ioctl()
  rtnl_lock()
  dev_ifsioc()
    c4_ioctl()
      do_reset()
      do_del_chan()
  rtnl_unlock()

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 years agoMerge branch 'r8152'
David S. Miller [Wed, 15 Jan 2014 02:49:06 +0000 (18:49 -0800)]
Merge branch 'r8152'

Hayes Wang says:

====================
r8152: remove limitation

Remove the limitation between ecm mode and vendor mode.

v2: replace the patch #3 with "ecm and vendor modes coexist".
====================

Signed-off-by: David S. Miller <davem@davemloft.net>