cascardo/linux.git
9 years agoenic: fix return values in enic_set_coalesce
Govindarajulu Varadarajan [Wed, 2 Jul 2014 10:12:15 +0000 (15:42 +0530)]
enic: fix return values in enic_set_coalesce

enic_set_coalesce() has two problems.

* It should return -EINVAL and not -EOPNOTSUPP for invalid coalesce values.

* In case of MSIX, enic_set_coalesce return error after applying requested
  coalescing setting partially. We should either apply all the setting requeste
  and return success or apply non and return error.

* This patch also simplifies the algo.

This was introduced by
'7c2ce6e60f703 enic: Add support for adaptive interrupt coalescing'

These changes were suggested by Ben Hutchings here
http://www.spinics.net/lists/netdev/msg283972.html

Also change enic driver version.

Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobonding: remove no longer relevant vlan warnings
Jiri Pirko [Wed, 2 Jul 2014 09:55:38 +0000 (11:55 +0200)]
bonding: remove no longer relevant vlan warnings

These warnings are no longer relevant. Even when last slave is
removed, there is a valid address assigned to bond (random).
The correct functionality of vlans is ensured by maintaining unicast
list in vlan_sync_address().

Suggested-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Veaceslav Falico <vfalico@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'at86rf230-next'
David S. Miller [Tue, 8 Jul 2014 04:29:31 +0000 (21:29 -0700)]
Merge branch 'at86rf230-next'

Alexander Aring says:

====================
at86rf230: rework driver implementation

this patch series includes a rework of the at86rf230 driver.

There are several changes:

 - Add regmap support.
 - Merge at86rf212 operations with generic at86rf2xx operations, all chips
   supports these operations.
 - Drop of irqworker. This is a workqueue which will scheduled by an irq to
   handle synchronous spi handling. Instead using asynchronous spi handling,
   then no scheduler is involved at irq handling.
 - Also detected some bugs by receiving frame like CRC can be correct and a
   802.15.4 frame length could be above 127 bytes. This would crash the whole
   kernel (but should be handled by the mac layer). Another bug is the handling
   with RX_SAFE_MODE which protect the frame buffer after a readout. This is
   currently not working because we read out the buffer twice and the first one
   to get the frame size. Solution is to readout always the whole frame buffer.
 - Added some timing relevants things from the datasheet for state changes And
   IEEE 802.15.4 standard like interframe spacing. Interframe spacing is needed
   to insert some receiving space time between frame transmitting. This should be
   also handled by MAC layer, but it's currently a workaround to add this inside
   the driver layer.
 - Add some callback setting for chip specific handling, instead of runtime decisions
   if (is_chip_type()). Callbacks are set only once at probe time.
 - We don't using a force state change anymore. A force state change will do a
   abort of receiving frames while we want to transmit a new frame. This should
   decrease the drop rate of packets.
 - And many others changes and bug fixes...

changes since v3:
 - fix irq polarity in patch ("at86rf230: rework irq_pol setting").

changes since v2:
 - add check if necessary functions are implemented when hw flags are set in patch
   ("mac802154: at86rf230: add hw flags and merge ops"). I choosed the second variant.
 - remove unnecessary includes for workqueue and mutex in patch
   ("at86rf230: rework transmit and receive").
 - remove unnecessary cast in patch ("at86rf230: rework transmit and receive").
 - acivate regmap cache with REGCACHE_RBTREE in patch
   ("at86rf230: add regmap support").
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: add new author
Alexander Aring [Wed, 2 Jul 2014 22:20:55 +0000 (00:20 +0200)]
at86rf230: add new author

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: add sleep cycle timing
Alexander Aring [Wed, 2 Jul 2014 22:20:54 +0000 (00:20 +0200)]
at86rf230: add sleep cycle timing

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: add timing for channel switch
Alexander Aring [Wed, 2 Jul 2014 22:20:53 +0000 (00:20 +0200)]
at86rf230: add timing for channel switch

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: rework reset to trx_off state change
Alexander Aring [Wed, 2 Jul 2014 22:20:52 +0000 (00:20 +0200)]
at86rf230: rework reset to trx_off state change

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: rework state change and start/stop
Alexander Aring [Wed, 2 Jul 2014 22:20:51 +0000 (00:20 +0200)]
at86rf230: rework state change and start/stop

This patch removes the current synchron state change function and add a
new function for a state assert. Change the start and stop callbacks to
use this new synchron state change behaviour. It's a wrapper around the
async state change function.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: rework irq_pol setting
Alexander Aring [Wed, 2 Jul 2014 22:20:50 +0000 (00:20 +0200)]
at86rf230: rework irq_pol setting

This patch rework the irq_pol register setting for rising and falling
interrupt settings only. The default behaviour should be rising flag.

Also use IRQ_TYPE_* defines instead of IRQF_* defines. There is no
functionality change but irq_get_trigger_type returns IRQ_TYPE_* defines.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: move RX_SAFE_MODE setting to hw_init
Alexander Aring [Wed, 2 Jul 2014 22:20:49 +0000 (00:20 +0200)]
at86rf230: move RX_SAFE_MODE setting to hw_init

There is no need to set this bit in start callback which could be
called more than once.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: rework transmit and receive handling
Alexander Aring [Wed, 2 Jul 2014 22:20:48 +0000 (00:20 +0200)]
at86rf230: rework transmit and receive handling

This patch is a complete reimplementation of transmit and receive
handling for the at86rf230 driver.

It solves also six bugs:

First:

The RX_SAFE_MODE is enabled and the transceiver doesn't leave the
receive state while the framebuffer isn't read by a CMD_FB command.
This is useful to read out the frame and don't get into another receive
or transmit state, otherwise the frame would be overwritten.
The current driver do twice CMD_FB calls, the first one leaves this
protection.

Second:

Sometimes the CRC calculation is correct and the length field is greater
127. The current mac802154 layer and filter of a at86rf2xx doesn't check
on this and the kernel crashes. In this case the frame is corrupted, we
send the whole receive buffer to the next layer which can be useful for
sniffing.

Thrid:
There is a undocumented race condition. When we are go into the
RX_AACK_ON state the transceiver could be changed into RX_AACK_BUSY
state. This is a normal behaviour. In this case the transceiver received
a SHR while assert wasn't finished.

Fourth:
It also handle some more "correct" state changes. In aret mode the
transceiver need to go to TX_ON before the transceiver go into
RX_AACK_ON.

Fifth:
The programming model [0] describes also a error handling in ARET mode
if the trac status is different than zero. This is patch adds support
for handling this.

Sixth:
In receive handling the transceiver should also get the trac status
according [0]. The driver could use the trac status as error statistic
handling, but the driver doesn't use this currently. There is maybe some
timing behaviour or the read of this register change some transceiver
states.

In addition the irqworker is removed. Instead we do async spi calls and
no scheduling is involved anymore. The transmit function is also
asynchron but with a wait_for_completion handling. The mac802154 layer
doesn't support asynchron transmit handling right now.

The state change behaviour is now changes, before it was:

1. assert while(!STATE_TRANSITION_IN_PROGRESS)
2. state change
3. assert while(!STATE_TRANSITION_IN_PROGRESS)
4. assert once(wanted state != current state)

Sometimes a unexcepted state change occurs when 4. assert was violated.
The new state change behaviour is:

1. assert while(!STATE_TRANSITION_IN_PROGRESS)
2. state change
3. wait state change timing according datasheet
4. assert once(wanted state != current state)

This behaviour is described in the at86rf231 software programming model [0].
The state change documentation in this programming guide should also valid for
at86rf212 and at86rf233 chips.

The transceiver don't do a FORCE_TX_ON while we want to transmit a PDU.
The new behaviour is a TX_ON and wait a receiving time (tFrame + tPAck).
If we are still in RX_AACK_BUSY then we transmit a FORCE_TX_ON as timeout
handling. The different is that FORCE_TX_ON aborts receiving and TX_ON
waits if RX_AACK_BUSY is finished. This should decrease the drop rate of
packets.

[0] http://www.atmel.com/Images/AVR2022_swpm231-2.0.zip

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: add support for at86rf23x desense
Alexander Aring [Wed, 2 Jul 2014 22:20:47 +0000 (00:20 +0200)]
at86rf230: add support for at86rf23x desense

To set the CCA_ED_THRES register the calculation for at86rf23x is
different than for at86rf212. This patch adds a new callback for this
calculation in chip data struct.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: remove is212 and add driver data
Alexander Aring [Wed, 2 Jul 2014 22:20:46 +0000 (00:20 +0200)]
at86rf230: remove is212 and add driver data

This patch adds a new at86rf2xx_chip_data structure which holds device
specific attributes. Instead of runtime decisions "if (is212())" we set
callbacks/attributes while device detection.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: rework detect device handling
Alexander Aring [Wed, 2 Jul 2014 22:20:45 +0000 (00:20 +0200)]
at86rf230: rework detect device handling

This patch drops the current lowlevel spi calls for the detect device
function instead we handle this via regmap. Also put the detection of
in a seperate function and set all device specific attributes while detection.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoat86rf230: add regmap support
Alexander Aring [Wed, 2 Jul 2014 22:20:44 +0000 (00:20 +0200)]
at86rf230: add regmap support

This patch adds regmap support for the at86rf230 driver and drop the
lowlevel spi access functions and use the regmap access functions.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agomac802154: at86rf230: add hw flags and merge ops
Alexander Aring [Wed, 2 Jul 2014 22:20:43 +0000 (00:20 +0200)]
mac802154: at86rf230: add hw flags and merge ops

This patch adds new mac802154 hw flags for transmit power, csma and
listen before transmit (lbt). These flags indicates that the transceiver
supports these features. If the flags are set and the driver doesn't
implement the necessary functions, then ieee802154_register_device
returns -ENOSYS "Function not implemented".

This patch merges also all at86rf230 operations into one operations structure
and set the right hw flags for the at86rf230 transceivers.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net...
David S. Miller [Tue, 8 Jul 2014 04:22:58 +0000 (21:22 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/jkirsher/net-next

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2014-07-02

This series contains updates to i40e and i40evf.

Anjali fixes a possible race where we were trying to free the dummy packet
buffer in the function that created it, so cleanup the dummy packet buffer
in i40e_clean_tx_ring() instead.  Also fixes an issue where the filter
program routine was not checking if there were descriptors available for
programming a filter.

Mitch fixes unnecessary delays when sending the admin queue commands by
moving a declaration up one level so we do not dereference it out of scope.
Fixes an issue with the VF where if the admin queue interrupts get lost for
some reason, the VF communication will stall as the VFs have no way of
reaching the PF.  To alleviate this condition, go ahead and check the ARQ
every time we run the service task.  Updates i40evf to allow the watchdog
to fire vector 0 via software, which makes the driver tolerant of dropped
interrupts on that vector.

Paul fixes a shifted '1' to be unsigned to avoid shifting a signed integer.

Jesse disables TPH by default since it is currently not enabled in the
current hardware.  Also finishes the i40e implementation of get_settings
for ethtool.

Catherine adds a new variable (hw.phy.link_info.an_enabled) to track whether
auto-negotiation is enabled, along with the functionality to update the
variable.  Adds the functionality to set the requested flow control mode.
Adds i40e implementation of setpauseparam and set_settings to ethtool.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'fec-next'
David S. Miller [Tue, 8 Jul 2014 04:21:45 +0000 (21:21 -0700)]
Merge branch 'fec-next'

Russell King says:

====================
Freescale ethernet driver updates

Here's the first batch of patches for the Freescale FEC ethernet driver.
They require the previously applied "net: fec: Don't clear IPV6 header
checksum field when IP accelerator enable" patch.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: fix missing kmalloc() failure check in fec_enet_alloc_buffers()
Russell King [Mon, 7 Jul 2014 23:23:30 +0000 (00:23 +0100)]
net: fec: fix missing kmalloc() failure check in fec_enet_alloc_buffers()

fec_enet_alloc_buffers() assumes that kmalloc() will never fail, which
is an invalid assumption.  Fix this by implementing a common error
cleanup path, and use it to also clean up after failed bounce buffer
allocation.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: ensure fec_enet_free_buffers() properly cleans the rings
Russell King [Mon, 7 Jul 2014 23:23:25 +0000 (00:23 +0100)]
net: fec: ensure fec_enet_free_buffers() properly cleans the rings

Ensure that we do not double-free any allocations, and that any transmit
skbuffs are properly freed when we clean up the rings.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: clean up transmit descriptor setup
Russell King [Mon, 7 Jul 2014 23:23:19 +0000 (00:23 +0100)]
net: fec: clean up transmit descriptor setup

Avoid writing any state until we're certain we can proceed with the
transmission: this avoids writing mapping error address values to the
descriptors, or setting the skbuff pointer until we have successfully
mapped the skb.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: make rx skb handling more robust
Russell King [Mon, 7 Jul 2014 23:23:14 +0000 (00:23 +0100)]
net: fec: make rx skb handling more robust

Allocate, and then map the receive skb before writing any data to the
ring descriptor or storing the skb.  When freeing the receive ring
entries, unmap and free the skb, and then clear the stored skb pointer.

This means we have ring data and skb pointer in one of two states:
either both fully setup, or nothing setup.

This simplifies the cleanup, as we can use just the skb pointer to
indicate whether the descriptor is setup, and thus avoids potentially
calling dma_unmap_single() on a DMA error value.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: remove useless fep->opened
Russell King [Mon, 7 Jul 2014 23:23:09 +0000 (00:23 +0100)]
net: fec: remove useless fep->opened

napi_disable() waits until the NAPI processing has completed, and then
prevents any further polls.  At this point, the driver then clears
fep->opened.  The NAPI poll function uses this to stop processing in
the receive path.  Hence, it will never see this variable cleared,
because the NAPI poll has to complete before it will be cleared.

Therefore, this variable serves no purpose, so let's remove it.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: stop the phy before shutting down the MAC
Russell King [Mon, 7 Jul 2014 23:23:04 +0000 (00:23 +0100)]
net: fec: stop the phy before shutting down the MAC

When the network interface goes down, stop the phy to prevent further
link up status changes before taking the MAC or netif sections down.
This prevents further reception of link up events which could
potentially call fec_restart().

Since phy_stop() takes the mutex which adjust_link() runs under, we
also ensure that adjust_link() will not already be processing a link
up event.

We also need to do this when suspending as well - we don't want a
mis-timed phy state change to restart the MAC after we have stopped
it for suspend, and thus need to restart the phy when resuming.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: ensure that a disconnected phy isn't configured
Russell King [Mon, 7 Jul 2014 23:22:59 +0000 (00:22 +0100)]
net: fec: ensure that a disconnected phy isn't configured

When we disconnect from a phy, we should forget our pointer to it so we
don't accidentally try to configure it.  We handle a NULL phy pointer
correctly in most places, except fec_enet_set_pauseparam().  Fix this
too.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: remove checking for NULL phy_dev in fec_enet_close()
Russell King [Mon, 7 Jul 2014 23:22:54 +0000 (00:22 +0100)]
net: fec: remove checking for NULL phy_dev in fec_enet_close()

fep->phy_dev can not be NULL here for two reasons:
- fec_enet_open() will have successfully connected the phy, or will have
  failed.
- fec_enet_open() will have called phy_start(fep->phy_dev), which
  unconditionally dereferences this pointer.

If it were to be NULL here, then fec_enet_open() will have already
oopsed.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: use netif_tx_disable() rather than netif_stop_queue()
Russell King [Mon, 7 Jul 2014 23:22:49 +0000 (00:22 +0100)]
net: fec: use netif_tx_disable() rather than netif_stop_queue()

We use netif_stop_queue() in several places where we want to ensure that
the start_xmit function is not running.  netif_stop_queue() is not
sufficient to achieve that - it merely sets a flag to indicate that the
transmit queue(s) should not be run.

netif_tx_disable() gives this guarantee, since it takes the transmit
queue lock while marking the queue stopped.  This will wait for the
transmit function to complete before returning.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: fix interrupt handling races
Russell King [Mon, 7 Jul 2014 23:22:44 +0000 (00:22 +0100)]
net: fec: fix interrupt handling races

While running: while :; do iperf -c <HOST> -P 4; done, transmit timeouts
are regularly reported.  With the tx ring dumping in place, we can see
that all entries are in use, and the hardware has finished transmitting
these packets.  However, the driver has not reclaimed these ring
entries.

This can occur if the interrupt handler is invoked at the wrong moment -
eg:

CPU0 CPU1
fec_enet_tx()
interrupt, IEVENT = FEC_ENET_TXF
FEC_ENET_TXF cleared
napi_schedule_prep()
napi_complete()

The result is that we clear the transmit interrupt, but we don't trigger
any cleaning of the transmit ring.  Instead, use a different strategy:

- When receiving a transmit or receive interrupt, disable both tx and rx
  interrupts, but do not acknowledge them.  Schedule a napi poll.  Don't
  loop.

- When we are polled, read IEVENT, acknowledging the pending transmit
  and receive interrupts, before then going on to process the
  appropriate rings.

This allows us to avoid the race, and has a number of other advantages:
- we cut down on the number of transmit interrupts we have to process.
- we only look at the rings which have pending events.
- we gain additional throughput: the iperf total bandwidth increases
  from about 180Mbps to 240Mbps:

[  3]  0.0-10.0 sec  68.1 MBytes  57.0 Mbits/sec
[  5]  0.0-10.0 sec  72.4 MBytes  60.5 Mbits/sec
[  4]  0.0-10.1 sec  76.1 MBytes  63.5 Mbits/sec
[  6]  0.0-10.1 sec  71.9 MBytes  59.9 Mbits/sec
[SUM]  0.0-10.1 sec   288 MBytes   241 Mbits/sec

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: fix ethtool set_pauseparam duplex bug
Russell King [Mon, 7 Jul 2014 23:22:39 +0000 (00:22 +0100)]
net: fec: fix ethtool set_pauseparam duplex bug

Setting the pause parameters causes a running network interface to be
restarted.  However, the restart forces the FEC into half-duplex mode,
whether or not the remote end is in half-duplex mode.  Misconfigured
duplex mode is a known source of problems on a link.

Fix this by always preserving the duplex mode on configuration changes.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: fec: iMX6 FEC does not support half-duplex gigabit
Russell King [Mon, 7 Jul 2014 23:22:34 +0000 (00:22 +0100)]
net: fec: iMX6 FEC does not support half-duplex gigabit

The iMX6 gigabit FEC does not support half-duplex gigabit operation.
Phys attacked to the FEC may support this, and we currently do nothing
to disable this feature.  This may result in an invalid configuration.
Mask out phy support for gigabit half-duplex operation.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'net-hash-tx'
David S. Miller [Tue, 8 Jul 2014 04:14:29 +0000 (21:14 -0700)]
Merge branch 'net-hash-tx'

Tom Herbert says:

====================
net: Improvements and applications of packet flow hash in transmit path

This patch series includes some patches which improve and make use
of skb->hash in the transmit path.

What is included:

- Infrastructure to save a precomputed hash in the sock structure.
  For connected TCP and UDP sockets we only need to compute the
  flow hash once and not once for every packet.
- Call skb_get_hash in get_xps_queue and __skb_tx_hash. This eliminates
  the awkward access to skb->sk->sk_hash in the lower transmit path.
- Move UDP source port generation into a common function in udp.h This
  implementation is mostly based on vxlan_src_port.
- Use non-zero IPv6 flow labels in flow_dissector as port information
  for flow hash calculation.
- Implement automatic flow label generation on transmit (per RFC 6438).
- Don't repeatedly try to compute an L4 hash in skb_get_hash if we've
  already tried to find one in software stack calculation.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Only do flow_dissector hash computation once per packet
Tom Herbert [Wed, 2 Jul 2014 04:33:17 +0000 (21:33 -0700)]
net: Only do flow_dissector hash computation once per packet

Add sw_hash flag to skbuff to indicate that skb->hash was computed
from flow_dissector. This flag is checked in skb_get_hash to avoid
repeatedly trying to compute the hash (ie. in the case that no L4 hash
can be computed).

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoipv6: Implement automatic flow label generation on transmit
Tom Herbert [Wed, 2 Jul 2014 04:33:10 +0000 (21:33 -0700)]
ipv6: Implement automatic flow label generation on transmit

Automatically generate flow labels for IPv6 packets on transmit.
The flow label is computed based on skb_get_hash. The flow label will
only automatically be set when it is zero otherwise (i.e. flow label
manager hasn't set one). This supports the transmit side functionality
of RFC 6438.

Added an IPv6 sysctl auto_flowlabels to enable/disable this behavior
system wide, and added IPV6_AUTOFLOWLABEL socket option to enable this
functionality per socket.

By default, auto flowlabels are disabled to avoid possible conflicts
with flow label manager, however if this feature proves useful we
may want to enable it by default.

It should also be noted that FreeBSD has already implemented automatic
flow labels (including the sysctl and socket option). In FreeBSD,
automatic flow labels default to enabled.

Performance impact:

Running super_netperf with 200 flows for TCP_RR and UDP_RR for
IPv6. Note that in UDP case, __skb_get_hash will be called for
every packet with explains slight regression. In the TCP case
the hash is saved in the socket so there is no regression.

Automatic flow labels disabled:

  TCP_RR:
    86.53% CPU utilization
    127/195/322 90/95/99% latencies
    1.40498e+06 tps

  UDP_RR:
    90.70% CPU utilization
    118/168/243 90/95/99% latencies
    1.50309e+06 tps

Automatic flow labels enabled:

  TCP_RR:
    85.90% CPU utilization
    128/199/337 90/95/99% latencies
    1.40051e+06

  UDP_RR
    92.61% CPU utilization
    115/164/236 90/95/99% latencies
    1.4687e+06

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoflow_dissector: Use IPv6 flow label in flow_dissector
Tom Herbert [Wed, 2 Jul 2014 04:33:01 +0000 (21:33 -0700)]
flow_dissector: Use IPv6 flow label in flow_dissector

This patch implements the receive side to support RFC 6438 which is to
use the flow label as an ECMP hash. If an IPv6 flow label is set
in a packet we can use this as input for computing an L4-hash. There
should be no need to parse any transport headers in this case.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agovxlan: Call udp_flow_src_port
Tom Herbert [Wed, 2 Jul 2014 04:32:49 +0000 (21:32 -0700)]
vxlan: Call udp_flow_src_port

In vxlan and OVS vport-vxlan call common function to get source port
for a UDP tunnel. Removed vxlan_src_port since the functionality is
now in udp_flow_src_port.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoudp: Add function to make source port for UDP tunnels
Tom Herbert [Wed, 2 Jul 2014 04:32:39 +0000 (21:32 -0700)]
udp: Add function to make source port for UDP tunnels

This patch adds udp_flow_src_port function which is intended to be
a common function that UDP tunnel implementations call to set the source
port. The source port is chosen so that a hash over the outer headers
(IP addresses and UDP ports) acts as suitable hash for the flow of the
encapsulated packet. In this manner, UDP encapsulation works with RSS
and ECMP based wrt the inner flow.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Call skb_get_hash in get_xps_queue and __skb_tx_hash
Tom Herbert [Wed, 2 Jul 2014 04:32:27 +0000 (21:32 -0700)]
net: Call skb_get_hash in get_xps_queue and __skb_tx_hash

Call standard function to get a packet hash instead of taking this from
skb->sk->sk_hash or only using skb->protocol.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Save TX flow hash in sock and set in skbuf on xmit
Tom Herbert [Wed, 2 Jul 2014 04:32:17 +0000 (21:32 -0700)]
net: Save TX flow hash in sock and set in skbuf on xmit

For a connected socket we can precompute the flow hash for setting
in skb->hash on output. This is a performance advantage over
calculating the skb->hash for every packet on the connection. The
computation is done using the common hash algorithm to be consistent
with computations done for packets of the connection in other states
where thers is no socket (e.g. time-wait, syn-recv, syn-cookies).

This patch adds sk_txhash to the sock structure. inet_set_txhash and
ip6_set_txhash functions are added which are called from points in
TCP and UDP where socket moves to established state.

skb_set_hash_from_sk is a function which sets skb->hash from the
sock txhash value. This is called in UDP and TCP transmit path when
transmitting within the context of a socket.

Tested: ran super_netperf with 200 TCP_RR streams over a vxlan
interface (in this case skb_get_hash called on every TX packet to
create a UDP source port).

Before fix:

  95.02% CPU utilization
  154/256/505 90/95/99% latencies
  1.13042e+06 tps

  Time in functions:
    0.28% skb_flow_dissect
    0.21% __skb_get_hash

After fix:

  94.95% CPU utilization
  156/254/485 90/95/99% latencies
  1.15447e+06

  Neither __skb_get_hash nor skb_flow_dissect appear in perf

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoflow_dissector: Abstract out hash computation
Tom Herbert [Wed, 2 Jul 2014 04:32:05 +0000 (21:32 -0700)]
flow_dissector: Abstract out hash computation

Move the hash computation located in __skb_get_hash to be a separate
function which takes flow_keys as input. This will allow flow hash
computation in other contexts where we only have addresses and ports.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'systemport-next'
David S. Miller [Tue, 8 Jul 2014 03:56:55 +0000 (20:56 -0700)]
Merge branch 'systemport-next'

Florian Fainelli says:

====================
net: systemport: PM and Wake-on-LAN support

This patchset brings Power Management and Wake-on-LAN support to the
Broadcom SYSTEM PORT driver.

S2 and S3 modes are supported, while we only support Wake-on-LAN using
MagicPackets for now
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: systemport: add Wake-on-LAN support
Florian Fainelli [Wed, 2 Jul 2014 04:08:40 +0000 (21:08 -0700)]
net: systemport: add Wake-on-LAN support

Support for Wake-on-LAN using Magic Packet with or without SecureOn
password is implemented doing the following:

- setting the password to the relevant UniMAC registers
- flagging the device as a wakeup source for the system, as well as
  its Wake-on-LAN interrupt
- prepare the hardware for entering WoL mode
- enabling the MPD interrupt to wake us

The Device Tree binding documentation is also reflected to specify the
third optional Wake-on-LAN interrupt line.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: systemport: rename rx_csum_en to rx_chk_en
Florian Fainelli [Wed, 2 Jul 2014 04:08:39 +0000 (21:08 -0700)]
net: systemport: rename rx_csum_en to rx_chk_en

This boolean tells us whether we are using the RXCHK hardware block,
so use a variable name that reflects that. RXCHK might be used in the
future to implement Wake-on-LAN using ARP or unicast packets.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: systemport: add suspend and resume support
Florian Fainelli [Wed, 2 Jul 2014 04:08:38 +0000 (21:08 -0700)]
net: systemport: add suspend and resume support

Implement the hardware recommended suspend/resume procedure for
SYSTEMPORT. We leverage the previous factoring work such that we can
logically break all suspend/resume operations into disctint RX and TX
code paths.

When the system enters S3, we will loose all register contents, so
make sure that we correctly re-program all the hardware and software
views of the RX & TX rings as well.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: systemport: add bcm_sysport_netif_{enable,stop}
Florian Fainelli [Wed, 2 Jul 2014 04:08:37 +0000 (21:08 -0700)]
net: systemport: add bcm_sysport_netif_{enable,stop}

Factor common code that either enables or disables the network
interface with the networking stack. We are going to reuse these
functions for suspend/resume callbacks.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: systemport: update umac_enable_set to take a bitmask
Florian Fainelli [Wed, 2 Jul 2014 04:08:36 +0000 (21:08 -0700)]
net: systemport: update umac_enable_set to take a bitmask

Quite often we need to enable either the transmitter or the receiver
bits in UMAC_CMD, use umac_enable_set() to do that for us.

This is a preliminary change to introduce suspend/resume support in the
driver.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years ago6lowpan: mac802154: fix coding style issues
Varka Bhadram [Wed, 2 Jul 2014 03:31:09 +0000 (09:01 +0530)]
6lowpan: mac802154: fix coding style issues

This patch fixed the coding style issues reported by checkpatch.pl

following issues fixed:
CHECK: Alignment should match open parenthesis
WARNING: line over 80 characters
CHECK: Blank lines aren't necessary before a close brace '}'
WARNING: networking block comments don't use an empty /* line, use /* Comment...
WARNING: Missing a blank line after declarations
WARNING: networking block comments start with * on subsequent lines
CHECK: braces {} should be used on all arms of this statement

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Tested-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonetlink: Fix do_one_broadcast() prototype.
Rami Rosen [Tue, 1 Jul 2014 18:17:35 +0000 (21:17 +0300)]
netlink: Fix do_one_broadcast() prototype.

This patch changes the prototype of the do_one_broadcast() method so that it will return void.

Signed-off-by: Rami Rosen <ramirose@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'tipc-next'
David S. Miller [Tue, 8 Jul 2014 02:55:49 +0000 (19:55 -0700)]
Merge branch 'tipc-next'

Erik Hugne says:

====================
tipc: link state processing improvements

Message delivery is separated from the link state processing, and
we fix a bug in receive-path triggered acks.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotipc: fix link acknowledge logic in receive path
Erik Hugne [Tue, 1 Jul 2014 08:22:41 +0000 (10:22 +0200)]
tipc: fix link acknowledge logic in receive path

Link state acks triggered from the receive path is done before
the last received packet have been processed by the link layer.
The effect of this is that the last received packet will not be
included in the ack. This causes problems if the link window is
set to TIPC_MIN_LINK_WIN, where the ack interval will be equal to
the link tolerance, and the link enters a stop-and-go behavior.
We move the ack logic to after link state processing, just before
the packet is delivered to higher layers.

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Carl Sigurjonsson <carl.sigurjonsson@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotipc: refactor message delivery out of tipc_rcv
Erik Hugne [Tue, 1 Jul 2014 08:22:40 +0000 (10:22 +0200)]
tipc: refactor message delivery out of tipc_rcv

This is a cosmetic change, separating message delivery from the
link state processing.

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotcp: switch snt_synack back to measuring transmit time of first SYNACK
Neal Cardwell [Mon, 30 Jun 2014 19:09:49 +0000 (15:09 -0400)]
tcp: switch snt_synack back to measuring transmit time of first SYNACK

Always store in snt_synack the time at which the server received the
first client SYN and attempted to send the first SYNACK.

Recent commit aa27fc501 ("tcp: tcp_v[46]_conn_request: fix snt_synack
initialization") resolved an inconsistency between IPv4 and IPv6 in
the initialization of snt_synack. This commit brings back the idea
from 843f4a55e (tcp: use tcp_v4_send_synack on first SYN-ACK), which
was going for the original behavior of snt_synack from the commit
where it was added in 9ad7c049f0f79 ("tcp: RFC2988bis + taking RTT
sample from 3WHS for the passive open side") in v3.1.

In addition to being simpler (and probably a tiny bit faster),
unconditionally storing the time of the first SYNACK attempt has been
useful because it allows calculating a performance metric quantifying
how long it took to establish a passive TCP connection.

Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Cc: Octavian Purdila <octavian.purdila@intel.com>
Cc: Jerry Chu <hkchu@google.com>
Acked-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'tlan-next'
David S. Miller [Tue, 8 Jul 2014 00:07:05 +0000 (17:07 -0700)]
Merge branch 'tlan-next'

Ondrej Zary says:

====================
tlan: Link handling improvements and Olicom fixes

This patch series improves link handling in tlan driver, allowing the
cable to be (un)plugged anytime and NetworkManager to work properly.

Also there are some bugfixes related to Olicom OC-2326 card.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotlan: Isolate external PHY when using internal PHY
Ondrej Zary [Mon, 30 Jun 2014 16:38:37 +0000 (18:38 +0200)]
tlan: Isolate external PHY when using internal PHY

When using internal 10 Mbps PHY, isolate the external PHY from MII bus.
External PHY must be kept powered up because it passes TX from tlan chip to
network.

This fixes weird link-loss problems under load with OC-2326 card at 10 Mbps.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotlan: Enable device at resume
Ondrej Zary [Mon, 30 Jun 2014 16:38:36 +0000 (18:38 +0200)]
tlan: Enable device at resume

pci_disable_device() is called in _suspend but there's no corresponding
pci_enable_device() in _resume.
This causes "disabling already-disabled device" warning on 2nd suspend.

Add pci_enable_device() call to _resume to fix this problem.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotlan: Don't disable internal PHY on cards that use it in 10 Mbps mode
Ondrej Zary [Mon, 30 Jun 2014 16:38:35 +0000 (18:38 +0200)]
tlan: Don't disable internal PHY on cards that use it in 10 Mbps mode

In tlan_reset_adapter, we disable internal PHY when an external one is used.
On cards which use internal PHY in 10 Mbps mode, we enable it later when
setting 10 Mbps mode but it does not really work (PHY fails to reset).
Leave it enabled instead.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotlan: Add PHY reset timeout
Ondrej Zary [Mon, 30 Jun 2014 16:38:34 +0000 (18:38 +0200)]
tlan: Add PHY reset timeout

Add a timeout to prevent infinite loop waiting for PHY to reset.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotlan: Make autonegotiation faster
Ondrej Zary [Mon, 30 Jun 2014 16:38:33 +0000 (18:38 +0200)]
tlan: Make autonegotiation faster

Reduce the autonegotiation poll interval from 8 seconds to 2.
This greatly reduces the time needed to detect link presence,
especially on Olicom cards at 10 Mbps (two autonegoatiations required).

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotlan: Don't scream if no link
Ondrej Zary [Mon, 30 Jun 2014 16:38:32 +0000 (18:38 +0200)]
tlan: Don't scream if no link

Remove excess printks when the link is down.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotlan: Restart autonegotiation on link loss
Ondrej Zary [Mon, 30 Jun 2014 16:38:31 +0000 (18:38 +0200)]
tlan: Restart autonegotiation on link loss

When link is lost on a card which uses internal PHY for 10 Mbit speeds,
restart autonegotiation to allow switching between 10 and 100 Mbps speeds.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotlan: Fix MAC address byte order on OC-2325/OC-2326
Ondrej Zary [Mon, 30 Jun 2014 16:38:30 +0000 (18:38 +0200)]
tlan: Fix MAC address byte order on OC-2325/OC-2326

Olicom OC-2325 and OC-2326 cards have the MAC address byte-swapped in EEPROM.
Byte-swap the MAC address if it's located at offset 0xF8.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotlan: Add ethtool support
Ondrej Zary [Mon, 30 Jun 2014 16:38:29 +0000 (18:38 +0200)]
tlan: Add ethtool support

Add basic ethtool support to tlan driver:
 - driver info  - link detect (this allows NetworkManager to detect carrier)
 - EEPROM read

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotlan: Enable link monitoring
Ondrej Zary [Mon, 30 Jun 2014 16:38:28 +0000 (18:38 +0200)]
tlan: Enable link monitoring

Enable old link monitoring code and modify it:
 - control LINK LED
 - use separate timer so it does not interfere with ACT LED

Tested with Olicom OC-2326.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotlan: Enable activity LED on Olicom OC-2325 and OC-2326
Ondrej Zary [Mon, 30 Jun 2014 16:38:27 +0000 (18:38 +0200)]
tlan: Enable activity LED on Olicom OC-2325 and OC-2326

Olicom OC-2325 and OC-2326 ethernet cards have an activity LED but it does not
work with tlan driver as it's not enabled. Enable it.
Tested with OC-2326.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobatman-adv: Use kasprintf
Himangi Saraogi [Sat, 28 Jun 2014 18:36:29 +0000 (00:06 +0530)]
batman-adv: Use kasprintf

kasprintf combines kmalloc and sprintf, and takes care of the size
calculation itself.

The semantic patch that makes this change is as follows:

// <smpl>
@@
expression a,flag;
expression list args;
statement S;
@@

  a =
-  \(kmalloc\|kzalloc\)(...,flag)
+  kasprintf(flag,args)
  <... when != a
  if (a == NULL || ...) S
  ...>
- sprintf(a,args);
// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'ptp-vlan'
David S. Miller [Mon, 7 Jul 2014 23:57:32 +0000 (16:57 -0700)]
Merge branch 'ptp-vlan'

Stefan Sørensen says:

====================
Add ptp vlan support

This patch series adds functionality for running ptp/ieee1588 over vlan.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agovlan: Pass SIOC[SG]HWTSTAMP ioctls to real device
Stefan Sørensen [Fri, 27 Jun 2014 09:59:11 +0000 (11:59 +0200)]
vlan: Pass SIOC[SG]HWTSTAMP ioctls to real device

This allows applications to enable hardware timestamping without being aware
of it being a vlan device and figuring out the real device.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoptp: Classify ptp over ip over vlan packets
Stefan Sørensen [Fri, 27 Jun 2014 09:59:10 +0000 (11:59 +0200)]
ptp: Classify ptp over ip over vlan packets

This extends the ptp bpf to also match ptp over ip over vlan packets. The ptp
classes are changed to orthogonal bitfields representing version, transport
and vlan values to simplify matching.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Simplify ptp class checks
Stefan Sørensen [Fri, 27 Jun 2014 09:59:09 +0000 (11:59 +0200)]
net: Simplify ptp class checks

Replace two switch statements enumerating all valid ptp classes with an if
statement matching for not PTP_CLASS_NONE.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoi40e/i40evf: Bump i40e to 0.4.21 and i40evf to 0.9.40
Catherine Sullivan [Wed, 4 Jun 2014 08:45:29 +0000 (08:45 +0000)]
i40e/i40evf: Bump i40e to 0.4.21 and i40evf to 0.9.40

Bump.

Change-ID: Ie0c36583ffd9997679f46bdf89bc462d3e992995
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e: Implement set_settings for ethtool
Catherine Sullivan [Wed, 4 Jun 2014 08:45:28 +0000 (08:45 +0000)]
i40e: Implement set_settings for ethtool

Implement set_settings for ethtool in i40e.

Change-ID: Ie3c3fe18e8ff86c3f25b842844b3d9aabc9bba57
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e: Add set_pauseparam to ethtool
Catherine Sullivan [Wed, 4 Jun 2014 08:45:27 +0000 (08:45 +0000)]
i40e: Add set_pauseparam to ethtool

Add i40e implementation of setpauseparam to ethtool.

Change-ID: Ie7766b2091ec8f934737573c9ffd426081966718
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e/i40evf: Add set_fc and init of FC settings
Catherine Sullivan [Wed, 4 Jun 2014 08:45:26 +0000 (08:45 +0000)]
i40e/i40evf: Add set_fc and init of FC settings

Add function set_fc to set the requested FC mode. This patch also
adds the init of FC setting to get_link_info and replaces the init
code to set FC off by default in main. Also adds i40e_set_phy_config
to support this.

Change-ID: I7b25bbaec81f15777137ab324a095f916e44351d
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e: move nway reset
Jesse Brandeburg [Wed, 4 Jun 2014 08:45:25 +0000 (08:45 +0000)]
i40e: move nway reset

Just move nway reset up, will be used in the next patch.

Change-ID: Ice3b631fa2044debc5c4541b42872a48163f8452
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e/i40evf: Add new HW link info variable an_enabled and function update_link_info
Catherine Sullivan [Wed, 4 Jun 2014 08:45:24 +0000 (08:45 +0000)]
i40e/i40evf: Add new HW link info variable an_enabled and function update_link_info

Add a new variable, hw.phy.link_info.an_enabled, to track whether autoneg is
enabled.  Also add a new function update_link_info that will update that
variable as well as calling get_link_info to update the rest of the link info.
Also add get_phy_capabilities to support this.

Change-ID: I5157ef03492b6dd8ec5e608ba0cf9b0db9c01710
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e: Finish implementation of ethtool get settings
Jesse Brandeburg [Wed, 4 Jun 2014 08:45:23 +0000 (08:45 +0000)]
i40e: Finish implementation of ethtool get settings

Finish the i40e implementation of get_settings for ethtool.

Change-ID: Iec81835aa9380723ae9288bcb79b30a6a1ecd498
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e: disable TPH
Jesse Brandeburg [Wed, 4 Jun 2014 08:45:21 +0000 (08:45 +0000)]
i40e: disable TPH

TPH is not currently enabled in this product, make sure it
isn't enabled by default.

Change-ID: Ibb1a10799c33c4c76dec06fcd53b1d6efa13c1f5
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e: Fix a boundary condition and turning off of ntuple
Anjali Singhai Jain [Wed, 4 Jun 2014 08:45:20 +0000 (08:45 +0000)]
i40e: Fix a boundary condition and turning off of ntuple

When turning off ntuple with a FD table full situation,
the driver would have auto disabled FD filter additions.
Clear the auto disable flag for FD_SB so that when the
feature is turned on again using "ethtool -K ethx ntuple on"
we can start adding filters once again.

Change-ID: I036a32e7331bcae765b657c8abb4fa070940b163
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40evf: invite vector 0 to the interrupt party
Mitch Williams [Wed, 4 Jun 2014 08:45:19 +0000 (08:45 +0000)]
i40evf: invite vector 0 to the interrupt party

The i40evf_irq_enable and i40evf_fire_sw_interrupt functions were
unfairly discriminating against MSI-X vector 0, just because it doesn't
handle traffic. That doesn't mean it's not essential to the operation of
the driver. This change allows the watchdog to fire vector 0 via
software, which makes the driver tolerant of dropped interrupts on that
vector.

Buck up, vector 0! You can be part of our gang!

Change-ID: I37131d955018a6b3e711e1732d21428acd0d767e
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e: tolerate lost interrupts
Mitch Williams [Wed, 4 Jun 2014 08:45:18 +0000 (08:45 +0000)]
i40e: tolerate lost interrupts

If the AQ interrupt gets lost for some reason, VF communications will
stall as the VFs have no way of reaching the PF, which is essentially
deaf. The VFs end up waiting forever for a reply that will never come.

To alleviate this condition, go ahead and check the ARQ every time we
run the service task. Remove the check for a pending event, and get rid
of a chatty error message that is now meaningless.

Change-ID: I0fc9d18169cd45c98f60188aef872cd6cee9a027
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e/i40evf: Force a shifted '1' to be unsigned
Paul M Stillwell Jr [Wed, 4 Jun 2014 08:45:17 +0000 (08:45 +0000)]
i40e/i40evf: Force a shifted '1' to be unsigned

Force a shifted '1' to be unsiged to avoid shifting a signed int

Change-ID: I688cbd082af0f2e1df548fda25847a5ca04babcf
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40evf: don't violate scope
Mitch Williams [Wed, 4 Jun 2014 08:45:16 +0000 (08:45 +0000)]
i40evf: don't violate scope

Move a declaration up one level so we don't dereference it out of scope.
This didn't cause any panics, but the details->async field would
mysteriously disappear, causing unnecessary delays when sending AQ
commands. Also, the code is just plain wrong.

Change-ID: I753f64f13c55e5d75ea4351e29b14fb53b2f0104
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e/i40evf: Do not free the dummy packet buffer synchronously
Anjali Singhai Jain [Wed, 4 Jun 2014 08:45:15 +0000 (08:45 +0000)]
i40e/i40evf: Do not free the dummy packet buffer synchronously

The HW still needs to consume it and freeing it in the function
that created it would mean we will be racing with the HW. The
i40e_clean_tx_ring() routine will free up the buffer attached once
the HW has consumed it.  The clean_fdir_tx_irq function had to be fixed
to handle the freeing correctly.

Cases where we program more than one filter per flow (Ipv4), the
code had to be changed to allocate dummy buffer multiple times
since it will be freed by the clean routine.  This also fixes an issue
where the filter program routine was not checking if there were
descriptors available for programming a filter.

Change-ID: Idf72028fd873221934e319d021ef65a1e51acaf7
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoMerge branch 'sctp'
David S. Miller [Thu, 3 Jul 2014 01:44:14 +0000 (18:44 -0700)]
Merge branch 'sctp'

Daniel Borkmann says:

====================
Misc SCTP updates

Daniel Borkmann (2):
  net: sctp: improve timer slack calculation for transport HBs
  net: sctp: only warn in proc_sctp_do_alpha_beta if write
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agonet: sctp: only warn in proc_sctp_do_alpha_beta if write
Daniel Borkmann [Mon, 30 Jun 2014 11:52:09 +0000 (13:52 +0200)]
net: sctp: only warn in proc_sctp_do_alpha_beta if write

Only warn if the value is written to alpha or beta. We don't care
emitting a one-time warning when only reading it.

Reported-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: sctp: improve timer slack calculation for transport HBs
Daniel Borkmann [Mon, 30 Jun 2014 11:52:08 +0000 (13:52 +0200)]
net: sctp: improve timer slack calculation for transport HBs

RFC4960, section 8.3 says:

  On an idle destination address that is allowed to heartbeat,
  it is recommended that a HEARTBEAT chunk is sent once per RTO
  of that destination address plus the protocol parameter
  'HB.interval', with jittering of +/- 50% of the RTO value,
  and exponential backoff of the RTO if the previous HEARTBEAT
  is unanswered.

Currently, we calculate jitter via sctp_jitter() function first,
and then add its result to the current RTO for the new timeout:

  TMO = RTO + (RAND() % RTO) - (RTO / 2)
              `------------------------^-=> sctp_jitter()

Instead, we can just simplify all this by directly calculating:

  TMO = (RTO / 2) + (RAND() % RTO)

With the help of prandom_u32_max(), we don't need to open code
our own global PRNG, but can instead just make use of the per
CPU implementation of prandom with better quality numbers. Also,
we can now spare us the conditional for divide by zero check
since no div or mod operation needs to be used. Note that
prandom_u32_max() won't emit the same result as a mod operation,
but we really don't care here as we only want to have a random
number scaled into RTO interval.

Note, exponential RTO backoff is handeled elsewhere, namely in
sctp_do_8_2_transport_strike().

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'be2net'
David S. Miller [Thu, 3 Jul 2014 01:41:05 +0000 (18:41 -0700)]
Merge branch 'be2net'

Sathya Perla says:

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

v2 change: merged 2 lines into one in patch 4

Patch 1 refactors be_cmd_get_profile_config() routine to reduce
code duplication by using the be_cmd_notify_wait() routine, instead
of using a separate variant of the code for MBOX and MCCQ.

Patch 2 introduces the required FW-cmd code in the PF to query
RSS support on a VF. This is in preparation for patch 3.

Patch 3 adds support for the PF driver to re-configure the resource
distribution in FW based on the number of VFs enabled by the user. When
the user is not interested in enabling VFs, all resources of a port are
set-aside for the PF. If less than maximum number of VFs are enabled, then
each VF gets a better share of the resources and can now enable RSS (if
the interface supports it.)

Patch 4 is a minor fix to re-enable HW vlan filtering as soon as the number
of vlans programmed is within the HW limit.

Please consider applying to net-next tree. Thanks!
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobe2net: re-enable vlan filtering mode asap
Kalesh AP [Mon, 30 Jun 2014 07:31:33 +0000 (13:01 +0530)]
be2net: re-enable vlan filtering mode asap

While adding vlans, when the HW limit of vlan filters is reached, the
driver enables vlan promiscuous mode.
Similarily, while removing vlans, the driver must re-enable HW filtering
as soon as the number of vlan filters is within the HW limit.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobe2net: create optimal number of queues on SR-IOV config
Vasundhara Volam [Mon, 30 Jun 2014 07:31:32 +0000 (13:01 +0530)]
be2net: create optimal number of queues on SR-IOV config

If SR-IOV is enabled in the adapter, the FW distributes queue resources
evenly across the PF and it's VFs. If the user is not interested in enabling
VFs, the queues set aside for VFs are wasted.
This patch adds support for the PF driver to re-configure the resource
distribution in FW based on the number of VFs enabled by the user.
This also allows for supporting RSS queues on VFs, when less number of VFs
are enabled per PF. When maximum number of VFs are enabled, each VF typically
gets only one RXQ.

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>
9 years agobe2net: read VF's capabilities from GET_PROFILE_CONFIG cmd
Vasundhara Volam [Mon, 30 Jun 2014 07:31:31 +0000 (13:01 +0530)]
be2net: read VF's capabilities from GET_PROFILE_CONFIG cmd

The PF driver must query the FW for VF's interface capabilities
to know if the VF is RSS capable or not.
This patch is in preparation for enabling RSS on VFs on Skyhawk-R.

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>
9 years agobe2net: remove be_cmd_get_profile_config_mbox/mccq() variants
Vasundhara Volam [Mon, 30 Jun 2014 07:31:30 +0000 (13:01 +0530)]
be2net: remove be_cmd_get_profile_config_mbox/mccq() variants

Fix be_cmd_get_profile_cmd() to use be_cmd_notify_wait() routine,
which uses MBOX if MCCQ has not been created. Doing this reduces
code duplication; we don't need the _mbox/_mccq() variants anymore.

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>
9 years agodrivers/net/hyperv/netvsc.c: remove unnecessary null test before kfree
Fabian Frederick [Sat, 28 Jun 2014 18:44:19 +0000 (20:44 +0200)]
drivers/net/hyperv/netvsc.c: remove unnecessary null test before kfree

Fix checkpatch warning:
WARNING: kfree(NULL) is safe this check is probably not required

Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agosh_eth: remove checks around dev_kfree_skb() calls
Sergei Shtylyov [Sat, 28 Jun 2014 00:10:00 +0000 (04:10 +0400)]
sh_eth: remove checks around dev_kfree_skb() calls

Since consume_skb() (and hence dev_kfree_skb() macro) checks the passed pointer
for NULL, there's no need to check for NULL before invoking dev_kfree_skb().

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMAINTAINERS: Update tg3 maintainer
Prashant Sreedharan [Fri, 27 Jun 2014 23:21:50 +0000 (16:21 -0700)]
MAINTAINERS: Update tg3 maintainer

Signed-off-by: Prashant Sreedharan <prashant@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'qlcnic-next'
David S. Miller [Thu, 3 Jul 2014 00:11:00 +0000 (17:11 -0700)]
Merge branch 'qlcnic-next'

Harish Patil says:

====================
qlcnic: Enhance Tx timeout debug data collection.

The following set of patches are for enhancing Tx timeout debug collection

- Collect a firmware dump on first Tx timeout if netif_msg_tx_err() is set
- Log Receive and Status ring info on Tx timeout, in addition to Tx ring info
- Log additional Tx ring info if netif_msg_tx_err() is set
- Update driver version to 5.3.61

Please apply this series to net-next.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoqlcnic: Update version to 5.3.61
Harish Patil [Fri, 27 Jun 2014 23:01:39 +0000 (19:01 -0400)]
qlcnic: Update version to 5.3.61

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoqlcnic: Enhance Tx timeout debug data collection.
Harish Patil [Fri, 27 Jun 2014 23:01:38 +0000 (19:01 -0400)]
qlcnic: Enhance Tx timeout debug data collection.

- Collect a firmware dump on first Tx timeout if netif_msg_tx_err() is set
- Log Receive and Status ring info on Tx timeout, in addition to Tx ring info
- Log additional Tx ring info if netif_msg_tx_err() is set

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/caif/caif_socket.c: remove unnecessary null test before debugfs_remove_recursive
Fabian Frederick [Fri, 27 Jun 2014 21:07:43 +0000 (23:07 +0200)]
net/caif/caif_socket.c: remove unnecessary null test before debugfs_remove_recursive

based on checkpatch:
"debugfs_remove_recursive(NULL) is safe this check is probably not required"

Cc: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agodrivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c: remove unnecessary null test before...
Fabian Frederick [Fri, 27 Jun 2014 20:51:52 +0000 (22:51 +0200)]
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c: remove unnecessary null test before debugfs_remove_recursive

Fix checkpatch warning:
"WARNING: debugfs_remove_recursive(NULL) is safe this check is probably not required"

Cc: Hariprasad S <hariprasad@chelsio.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoinet: move ipv6only in sock_common
Eric Dumazet [Fri, 27 Jun 2014 15:36:16 +0000 (08:36 -0700)]
inet: move ipv6only in sock_common

When an UDP application switches from AF_INET to AF_INET6 sockets, we
have a small performance degradation for IPv4 communications because of
extra cache line misses to access ipv6only information.

This can also be noticed for TCP listeners, as ipv6_only_sock() is also
used from __inet_lookup_listener()->compute_score()

This is magnified when SO_REUSEPORT is used.

Move ipv6only into struct sock_common so that it is available at
no extra cost in lookups.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net...
David S. Miller [Wed, 2 Jul 2014 06:09:32 +0000 (23:09 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/jkirsher/net-next

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2014-07-01

This series contains updates to i40e, i40evf, igb and ixgbe.

Shannon adds the Base Address High and Low to the admin queue structure
to simplify the logic in the configuration routines.  Also adds code to
clear all queues and interrupts to help clean up after a PXE or other
early boot activity.

Kevin fixes mask assignment value since -1 cannot be used for unsigned
integer types.

Mitch fixes an issue where in some circumstances the reply from the PF
would come back before we were able to properly modify the admin queue
pending and required flags.  This would mess up the flags and put the
driver in an indeterminate state, so fix this by simply setting the flags
before sending the request to the admin queue.  Also changes the branding
string for i40evf to reduce confusion and to match up with our other
marketing materials.

Kamil adds a new variable defining admin send queue (ASQ) command write
back timeout to allow for dynamic modification of this timeout.

Anjali fix a bug in the flow director filter replay logic, so that we
call a replay after a sideband reset correctly.

Jesse adds code to initialize all members of the context descriptor to
prevent possible stale data.

Christopher fixes i40e to prevent writing to reserved bits, since the
queue index is only 0-127.

Jacob removes the unneeded header export.h from the i40e PTP code.
Fixes ixgbe PTP code where the PPS signal was not correct, as it
generates a one half HZ clock signal, it only generates one level
change per second.  To generate a full clock, we need two level changes
per second.

Todd provides a fix for igb to bring up link when the PHY has powered
up, which was reported by Jeff Westfahl.
====================

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