cascardo/linux.git
9 years agoipvs: allow rescheduling of new connections when port reuse is detected
Marcelo Ricardo Leitner [Mon, 23 Feb 2015 18:02:34 +0000 (15:02 -0300)]
ipvs: allow rescheduling of new connections when port reuse is detected

Currently, when TCP/SCTP port reusing happens, IPVS will find the old
entry and use it for the new one, behaving like a forced persistence.
But if you consider a cluster with a heavy load of small connections,
such reuse will happen often and may lead to a not optimal load
balancing and might prevent a new node from getting a fair load.

This patch introduces a new sysctl, conn_reuse_mode, that allows
controlling how to proceed when port reuse is detected. The default
value will allow rescheduling of new connections only if the old entry
was in TIME_WAIT state for TCP or CLOSED for SCTP.

Signed-off-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
9 years agonetfilter: ipset: fix boolreturn.cocci warnings
Wu Fengguang [Wed, 11 Feb 2015 12:33:05 +0000 (20:33 +0800)]
netfilter: ipset: fix boolreturn.cocci warnings

net/netfilter/xt_set.c:196:9-10: WARNING: return of 0/1 in function 'set_match_v3' with return type bool
net/netfilter/xt_set.c:242:9-10: WARNING: return of 0/1 in function 'set_match_v4' with return type bool

 Return statements in functions returning bool should use
 true/false instead of 1/0.
Generated by: scripts/coccinelle/misc/boolreturn.cocci

CC: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
9 years agonetfilter: Don't hide NETFILTER_XT_MATCH_ADDRTYPE behind NETFILTER_ADVANCED
Anton Blanchard [Tue, 20 Jan 2015 23:53:50 +0000 (10:53 +1100)]
netfilter: Don't hide NETFILTER_XT_MATCH_ADDRTYPE behind NETFILTER_ADVANCED

Docker needs NETFILTER_XT_MATCH_ADDRTYPE, so move it out from behind
NETFILTER_ADVANCED and make it default to a module.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
9 years agoipvs: use 64-bit rates in stats
Julian Anastasov [Fri, 6 Feb 2015 07:44:44 +0000 (09:44 +0200)]
ipvs: use 64-bit rates in stats

IPVS stats are limited to 2^(32-10) conns/s and packets/s,
2^(32-5) bytes/s. It is time to use 64 bits:

* Change all conn/packet kernel counters to 64-bit and update
them in u64_stats_update_{begin,end} section

* In kernel use struct ip_vs_kstats instead of the user-space
struct ip_vs_stats_user and use new func ip_vs_export_stats_user
to export it to sockopt users to preserve compatibility with
32-bit values

* Rename cpu counters "ustats" to "cnt"

* To netlink users provide additionally 64-bit stats:
IPVS_SVC_ATTR_STATS64 and IPVS_DEST_ATTR_STATS64. Old stats
remain for old binaries.

* We can use ip_vs_copy_stats in ip_vs_stats_percpu_show

Thanks to Chris Caputo for providing initial patch for ip_vs_est.c

Signed-off-by: Chris Caputo <ccaputo@alt.net>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
9 years agonetfilter: nft_lookup: add missing attribute validation for NFTA_LOOKUP_SET_ID
Patrick McHardy [Fri, 30 Jan 2015 07:46:33 +0000 (07:46 +0000)]
netfilter: nft_lookup: add missing attribute validation for NFTA_LOOKUP_SET_ID

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
9 years agonetfilter: nft_compat: add ebtables support
Arturo Borrero [Thu, 29 Jan 2015 18:34:42 +0000 (19:34 +0100)]
netfilter: nft_compat: add ebtables support

This patch extends nft_compat to support ebtables extensions.

ebtables verdict codes are translated to the ones used by the nf_tables engine,
so we can properly use ebtables target extensions from nft_compat.

This patch extends previous work by Giuseppe Longo <giuseppelng@gmail.com>.

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
9 years agoMerge tag 'linux-can-next-for-3.20-20150128' of git://git.kernel.org/pub/scm/linux...
David S. Miller [Thu, 29 Jan 2015 22:54:45 +0000 (14:54 -0800)]
Merge tag 'linux-can-next-for-3.20-20150128' of git://git./linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2015-28-01

this is a pull request of 12 patches for net-next/master.

There are 3 patches by Ahmed S. Darwish, which update the kvaser_usb
driver and add support for the USBcan-II based adapters. Stéphane
Grosjean contributes 7 patches for the peak_usb driver, which add
support for the CANFD USB adapters. I contribute 2 patches which clean
up the peak_usb driver structure a bit.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: gianfar: remove the unneeded check of disabled device
Kevin Hao [Wed, 28 Jan 2015 12:06:48 +0000 (20:06 +0800)]
net: gianfar: remove the unneeded check of disabled device

Since commit cd1e65044d44 ("of/device: Don't register disabled
devices"), the disabled device will not be registered at all. So we
don't need to do the check again in the platform device driver.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agodev: add per net_device packet type chains
Salam Noureddine [Tue, 27 Jan 2015 19:35:48 +0000 (11:35 -0800)]
dev: add per net_device packet type chains

When many pf_packet listeners are created on a lot of interfaces the
current implementation using global packet type lists scales poorly.
This patch adds per net_device packet type lists to fix this problem.

The patch was originally written by Eric Biederman for linux-2.6.29.
Tested on linux-3.16.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Salam Noureddine <noureddine@arista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agortnetlink: pass link_net to the newlink handler
Nicolas Dichtel [Tue, 27 Jan 2015 10:13:08 +0000 (11:13 +0100)]
rtnetlink: pass link_net to the newlink handler

When IFLA_LINK_NETNSID is used, the netdevice should be built in this link netns
and moved at the end to another netns (pointed by the socket netns or
IFLA_NET_NS_[PID|FD]).

Existing user of the newlink handler will use the netns argument (src_net) to
find a link netdevice or to check some other information into the link netns.
For example, to find a netdevice, two information are required: an ifindex
(usually from IFLA_LINK) and a netns (this link netns).

Note: when using IFLA_LINK_NETNSID and IFLA_NET_NS_[PID|FD], a user may create a
netdevice that stands in netnsX and with its link part in netnsY, by sending a
rtnl message from netnsZ.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agopkt_sched: fq: remove useless TIME_WAIT check
Eric Dumazet [Wed, 28 Jan 2015 14:06:36 +0000 (06:06 -0800)]
pkt_sched: fq: remove useless TIME_WAIT check

TIME_WAIT sockets are not owning any skb.

ip_send_unicast_reply() and tcp_v6_send_response() both use
regular sockets.

We can safely remove a test in sch_fq and save one cache line miss,
as sk_state is far away from sk_pacing_rate.

Tested at Google for about one year.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoact_connmark: fix dependencies better
Arnd Bergmann [Wed, 28 Jan 2015 16:30:09 +0000 (17:30 +0100)]
act_connmark: fix dependencies better

NET_ACT_CONNMARK fails to build if NF_CONNTRACK_MARK is disabled,
and d7924450e14ea4 ("act_connmark: Add missing dependency on
NF_CONNTRACK_MARK") fixed that case, but missed the cased where
NF_CONNTRACK is a loadable module.

This adds the second dependency to ensure that NET_ACT_CONNMARK
can only be built-in if NF_CONNTRACK is also part of the kernel
rather than a loadable module.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: remove sock_iocb
Christoph Hellwig [Wed, 28 Jan 2015 17:04:53 +0000 (18:04 +0100)]
net: remove sock_iocb

The sock_iocb structure is allocate on stack for each read/write-like
operation on sockets, and contains various fields of which only the
embedded msghdr and sometimes a pointer to the scm_cookie is ever used.
Get rid of the sock_iocb and put a msghdr directly on the stack and pass
the scm_cookie explicitly to netlink_mmap_sendmsg.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agohisilicon: add some missing curly braces
Dan Carpenter [Wed, 28 Jan 2015 18:58:33 +0000 (21:58 +0300)]
hisilicon: add some missing curly braces

The if block was supposed to have curly braces.  In the current code we
complain about dropped rx packets when we shouldn't.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoopenvswitch: Add support for checksums on UDP tunnels.
Jesse Gross [Thu, 29 Jan 2015 00:32:46 +0000 (16:32 -0800)]
openvswitch: Add support for checksums on UDP tunnels.

Currently, it isn't possible to request checksums on the outer UDP
header of tunnels - the TUNNEL_CSUM flag is ignored. This adds
support for requesting that UDP checksums be computed on transmit
and properly reported if they are present on receive.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge tag 'nfc-next-3.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo...
David S. Miller [Thu, 29 Jan 2015 06:49:55 +0000 (22:49 -0800)]
Merge tag 'nfc-next-3.20-1' of git://git./linux/kernel/git/sameo/nfc-next

NFC: 3.20 first pull request

This is the first NFC pull request for 3.20.

With this one we have:

- Secure element support for the ST Micro st21nfca driver. This depends
  on a few HCI internal changes in order for example to support more
  than one secure element per controller.

- ACPI support for NXP's pn544 HCI driver. This controller is found on
  many x86 SoCs and is typically enumerated on the ACPI bus there.

- A few st21nfca and st21nfcb fixes.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agocan: peak_usb: add support for PEAK new CANFD USB adapters
Stephane Grosjean [Fri, 23 Jan 2015 10:31:25 +0000 (11:31 +0100)]
can: peak_usb: add support for PEAK new CANFD USB adapters

Add support for the following new PEAK-System technik CANFD USB adapters:

PCAN-USB FD             single CANFD channel USB adapter
PCAN-USB Pro FD         dual CANFD channels USB adapter

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Andri Yngvason <andri.yngvason@marel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocan: peak_usb: add peak_usb_netif_rx() new function
Stephane Grosjean [Fri, 23 Jan 2015 10:31:24 +0000 (11:31 +0100)]
can: peak_usb: add peak_usb_netif_rx() new function

Add a common function that pushes the skb in the network queue with adding
timestamps information, converted from time values read from the
PEAK USB adapters.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocan: peak_usb: export pcan_usb_pro functions
Stephane Grosjean [Fri, 23 Jan 2015 10:31:23 +0000 (11:31 +0100)]
can: peak_usb: export pcan_usb_pro functions

Add support for the following new PEAK-System technik CANFD USB adapters:

PCAN-USB FD             single CANFD channel USB adapter
PCAN-USB Pro FD         dual CANFD channels USB adapter

The communication protocol has been developed using some mechanisms that
did exist in the PCAN-USB Pro, thus, this patch also changes some
previously static functions and data into global ones.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocan: peak_usb: upgrade core to new struct canfd_frame
Stephane Grosjean [Fri, 23 Jan 2015 10:31:22 +0000 (11:31 +0100)]
can: peak_usb: upgrade core to new struct canfd_frame

Upgrade PEAK-System USB adapters core to the new data structures (names) and
callbacks added for the support of the CANFD extension. This specific patch
includes changes that deal with the new struct canfd_frame.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocan: peak_usb: upgrade core to data bittiming specs
Stephane Grosjean [Fri, 23 Jan 2015 10:31:21 +0000 (11:31 +0100)]
can: peak_usb: upgrade core to data bittiming specs

Upgrade PEAK-System USB adapters core to the new data structures (names) and
callbacks added for the support of the CANFD extension. This specific patch
does the mandatory changes to support new data bittiming specs.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocan: peak_usb: add adapter BEC callback definition
Stephane Grosjean [Fri, 23 Jan 2015 10:31:20 +0000 (11:31 +0100)]
can: peak_usb: add adapter BEC callback definition

Add the definition of a new callback that enable any PEAK-System CAN USB
adapter to grant read access to its Bus Error Counters value. This ability is
not supported by all the PEAK-System adapters, thus, for those, the callback
pointer will be initiaized to NULL, which is correct regarding the linux-can
device driver specs.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocan: peak_usb: export ctrlmode_supported to adapter specific definition
Stephane Grosjean [Fri, 23 Jan 2015 10:31:19 +0000 (11:31 +0100)]
can: peak_usb: export ctrlmode_supported to adapter specific definition

Export the ctrlmode_supported value from the core file to each adapter specific
file. This has been mandatory for supporting the new CANFD extension.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocan: peak_usb: constify struct peak_usb_adapter
Marc Kleine-Budde [Tue, 27 Jan 2015 16:15:39 +0000 (17:15 +0100)]
can: peak_usb: constify struct peak_usb_adapter

A "struct peak_usb_adapter" describes a certain USB adapter, as this doesn't
change during runtime, this patch marks all USB adapter definitions as const.

Acked-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocan: peak_usb: use ARRAY_SIZE instead of NULL termination for peak_usb_adapters_list
Marc Kleine-Budde [Tue, 27 Jan 2015 15:58:17 +0000 (16:58 +0100)]
can: peak_usb: use ARRAY_SIZE instead of NULL termination for peak_usb_adapters_list

This patch converts the list "static struct peak_usb_adapter
*peak_usb_adapters_list[]" to be used with ARRAY_SIZE not with a NULL
termination, as the size is known during compile time.

Acked-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocan: kvaser_usb: Add support for the USBcan-II family
Ahmed S. Darwish [Mon, 26 Jan 2015 05:33:10 +0000 (07:33 +0200)]
can: kvaser_usb: Add support for the USBcan-II family

CAN to USB interfaces sold by the Swedish manufacturer Kvaser are
divided into two major families: 'Leaf', and 'USBcanII'.  From an
Operating System perspective, the firmware of both families behave
in a not too drastically different fashion.

This patch adds support for the USBcanII family of devices to the
current Kvaser Leaf-only driver.

CAN frames sending, receiving, and error handling paths has been
tested using the dual-channel "Kvaser USBcan II HS/LS" dongle. It
should also work nicely with other products in the same category.

List of new devices supported by this driver update:

         - Kvaser USBcan II HS/HS
         - Kvaser USBcan II HS/LS
         - Kvaser USBcan Rugged ("USBcan Rev B")
         - Kvaser Memorator HS/HS
         - Kvaser Memorator HS/LS
         - Scania VCI2 (if you have the Kvaser logo on top)

Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Acked-by: Andri Yngvason <andri.yngvason@marel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocan: kvaser_usb: Consolidate and unify state change handling
Ahmed S. Darwish [Mon, 26 Jan 2015 05:29:15 +0000 (07:29 +0200)]
can: kvaser_usb: Consolidate and unify state change handling

Replace most of the can interface's state and error counters
handling with the new can-dev can_change_state() mechanism.

Suggested-by: Andri Yngvason <andri.yngvason@marel.com>
Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Acked-by: Andri Yngvason <andri.yngvason@marel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agocan: kvaser_usb: Update interface state before exiting on OOM
Ahmed S. Darwish [Mon, 26 Jan 2015 05:27:19 +0000 (07:27 +0200)]
can: kvaser_usb: Update interface state before exiting on OOM

Update all of the can interface's state and error counters before
trying any skb allocation that can actually fail with -ENOMEM.

Suggested-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Acked-by: Andri Yngvason <andri.yngvason@marel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
9 years agoMerge branch 'stmmac-pci'
David S. Miller [Wed, 28 Jan 2015 05:08:13 +0000 (21:08 -0800)]
Merge branch 'stmmac-pci'

Andy Shevchenko says:

====================
stmmac: Enable Intel Quark SoC X1000 Ethernet support

This is third version of the patch series [1] to bring network card support to
Intel Quark SoC.

The series has been tested on Intel Galileo board.

Changelog v3:
 - rebase on top of recent net-next
 - rework an approach to get the custom configuration
 - rework an approach how to get unique bus_id
 - improve DMI lookup function

[1] http://www.spinics.net/lists/netdev/msg296010.html
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agostmmac: pci: add MSI support for Intel Quark X1000
Kweh, Hock Leong [Tue, 27 Jan 2015 19:44:49 +0000 (21:44 +0200)]
stmmac: pci: add MSI support for Intel Quark X1000

In Intel Quark SoC X1000, both of the Ethernet controllers support
MSI interrupt handling. This patch enables them to use MSI interrupt
servicing in stmmac_pci for Intel Quark X1000.

Signed-off-by: Kweh, Hock Leong <hock.leong.kweh@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agostmmac: pci: introduce Intel Quark X1000 runtime detection
Andy Shevchenko [Tue, 27 Jan 2015 19:44:48 +0000 (21:44 +0200)]
stmmac: pci: introduce Intel Quark X1000 runtime detection

This patch introduces run-time board detection through DMI and MAC-PHY
configuration function used by quark_default_data() during initialization. It
fills up the phy_addr for Galileo and Galileo Gen2 boards to indicate that the
Ethernet MAC controller is or is not connected to any PHY.

The implementation takes into consideration for future expansion in Quark
series boards that may have different PHY address that is linked to its MAC
controllers.

This piece of work is derived from Bryan O'Donoghue's initial work for Quark
X1000 enabling.

Signed-off-by: Kweh, Hock Leong <hock.leong.kweh@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agostmmac: pci: add support for Intel Quark X1000
Kweh, Hock Leong [Tue, 27 Jan 2015 19:44:47 +0000 (21:44 +0200)]
stmmac: pci: add support for Intel Quark X1000

The Intel Quark SoC X1000 provides two 10/100 Mbps Ethernet MAC
controllers which may or may not be connected to PHY on board.
This MAC controller only supports RMII PHY. This patch add Quark
PCI ID as well as Quark default platform data info to this driver.

Signed-off-by: Kweh, Hock Leong <hock.leong.kweh@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: netcp: remove unused kconfig option and code
Karicheri, Muralidharan [Tue, 27 Jan 2015 14:49:54 +0000 (09:49 -0500)]
net: netcp: remove unused kconfig option and code

Currently CPTS is built into the netcp driver even though there is no
call out to the CPTS driver. This patch removes the dependency in Kconfig
and remove cpts.o from the Makefile for NetCP.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agocxgb4: Move firmware version MACRO to t4fw_version.h
Hariprasad Shenai [Tue, 27 Jan 2015 14:42:52 +0000 (20:12 +0530)]
cxgb4: Move firmware version MACRO to t4fw_version.h

Move firmware version MACRO to a new t4fw_version.h file so that csiostor driver
can also use it.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agocsiostor:T5 Firmware fix and cleanup.
Praveen Madhavan [Tue, 27 Jan 2015 14:16:37 +0000 (19:46 +0530)]
csiostor:T5 Firmware fix and cleanup.

This patch fix is to use default firmware configuration files
present in the adapter incase if not available in standard
/lib/firmware/* dir. Additional cleanup is done to reuse flash
related defines from cxgb4 header file.

Please apply over net-next since it depends on previous commit.

Signed-off-by: Praveen Madhavan <praveenm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'mlx4-next'
David S. Miller [Wed, 28 Jan 2015 01:13:01 +0000 (17:13 -0800)]
Merge branch 'mlx4-next'

Amir Vadai says:

====================
Mellanox ethernet driver updates Jan-27-2015

This patchset introduces some bug fixes, code cleanups and support in a new
firmware event called recoverable error events.

Patches were applied and tested against commit b8665c6 ("net: dsa/mv88e6352:
make mv88e6352_wait generic")

Changes from V0:
- Patch 6/11 ("net/mlx4_core: Fix struct mlx4_vhcr_cmd to make implicit padding
  explicit"):
  - Removed __packed
  - Rephrased commit message

- Added a new patch by Majd ("net/mlx4_core: Update the HCA core clock frequency
  after INIT_PORT")
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/mlx4_core: Update the HCA core clock frequency after INIT_PORT
Majd Dibbiny [Tue, 27 Jan 2015 13:58:09 +0000 (15:58 +0200)]
net/mlx4_core: Update the HCA core clock frequency after INIT_PORT

The firmware might change the hca core clock frequency after the driver
issues the INIT_PORT command. Therefore we need to query the new
value again and save in to the cached dev caps.

Fixes: ddd8a6c1 ('net/mlx4_core: Read HCA frequency and map internal clock')
Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/mlx4_core: Fix device capabilities dumping
Or Gerlitz [Tue, 27 Jan 2015 13:58:08 +0000 (15:58 +0200)]
net/mlx4_core: Fix device capabilities dumping

We are dumping device capabilities which are supported both by the
firmware and the driver. Align the array that holds the capability
strings with this practice.

Reported-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/mlx4: Fix memory corruption in mlx4_MAD_IFC_wrapper
Matan Barak [Tue, 27 Jan 2015 13:58:07 +0000 (15:58 +0200)]
net/mlx4: Fix memory corruption in mlx4_MAD_IFC_wrapper

Fix a memory corruption at mlx4_MAD_IFC_wrapper.

A table of size dev->caps.pkey_table_len[port]*sizeof(*table)
was allocated, but get_full_pkey_table() assumes that the number
of entries in the table is a multiplication of 32 (which isn't always
correct).

Fixes: 0a9a018 ('mlx4: MAD_IFC paravirtualization')
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/mlx4_en: Use ethtool cmd->autoneg as a hint for ethtool set settings
Saeed Mahameed [Tue, 27 Jan 2015 13:58:06 +0000 (15:58 +0200)]
net/mlx4_en: Use ethtool cmd->autoneg as a hint for ethtool set settings

Use cmd->autoneg as a user hint to decide what to set in ethtool set settings callback.
When cmd->autoneg == AUTONEG_ENABLE set according to ethtool->advertise otherwise,
set according to ethtool->speed.

Usage:
- ethtool -s eth<x> speed 56000 autoneg off
- ethtool -s eth<x> advertise 0x800000 autoneg on

While we're here:
- Move proto_admin masking outcome check to be adjacent to the operation.
- Move en_warn("port reset..") print to "port reset" block.

Fixes: 312df74 ("net/mlx4_en: mlx4_en_set_settings() always fails when autoneg is set")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/mlx4_core: Remove duplicate code line from procedure mlx4_bf_alloc
Jack Morgenstein [Tue, 27 Jan 2015 13:58:05 +0000 (15:58 +0200)]
net/mlx4_core: Remove duplicate code line from procedure mlx4_bf_alloc

mlx4_bf_alloc had an unnecessary/duplicate code line. Did no harm,
but not good practice.

Reported by the Mellanox Beijing team.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/mlx4_core: Fix struct mlx4_vhcr_cmd to make implicit padding explicit
Jack Morgenstein [Tue, 27 Jan 2015 13:58:04 +0000 (15:58 +0200)]
net/mlx4_core: Fix struct mlx4_vhcr_cmd to make implicit padding explicit

Struct mlx4_vhcr was implicitly padded by the gcc compiler on 64-bit
architectures.

This commit makes that padding explicit, to prevent issues with
changing compilers and with incompatibilities between 32-bit architecture
implicit padding and 64-bit architecture implicit padding.

This structure is used in virtualization for communication between
the Host and its Guests. The explicit padding allows 64-bit Hosts
(old and new) to continue to interoperate with 64-bit Guests (old and new).

However, without this fix, 64-bit Hosts could not interoperate with 32-bit
Guests (since these did not insert the padding dword). With this fix,
32-bit Guests will be able to interoperate with 64-bit Hosts (since
the structure offsets will be identical on both).

Reported-by: Alexander Schmidt <alexs@linux.vnet.ibm.com>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/mlx4_core: Fix HW2SW_EQ to conform to the firmware spec
Jack Morgenstein [Tue, 27 Jan 2015 13:58:03 +0000 (15:58 +0200)]
net/mlx4_core: Fix HW2SW_EQ to conform to the firmware spec

The driver incorrectly assigned an out-mailbox to this command,
and used an opcode modifier = 0, which is a reserved value (it
should use opcode modifier = 1).

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/mlx4_core: Adjust command timeouts to conform to the firmware spec
Jack Morgenstein [Tue, 27 Jan 2015 13:58:02 +0000 (15:58 +0200)]
net/mlx4_core: Adjust command timeouts to conform to the firmware spec

The firmware spec states that the timeout for all commands should be 60 seconds.

In the past, the spec indicated that there were several classes of timeout
(short, medium, and long).  The driver has these different timeout classes.
We leave the class differentiation in the driver as-is (to protect against any
future spec changes), but set the timeout for all classes to be 60 seconds.

In addition, we fix a few commands which had hard-coded numeric timeouts specified.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/mlx4_core: Fix mem leak in SRIOV mlx4_init_one error flow
Jack Morgenstein [Tue, 27 Jan 2015 13:58:01 +0000 (15:58 +0200)]
net/mlx4_core: Fix mem leak in SRIOV mlx4_init_one error flow

Structs allocated for the resource tracker must be freed in
the error flow.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/mlx4_core: Add reserved lkey for VFs to QUERY_FUNC_CAP
Jack Morgenstein [Tue, 27 Jan 2015 13:58:00 +0000 (15:58 +0200)]
net/mlx4_core: Add reserved lkey for VFs to QUERY_FUNC_CAP

The reserved lKey is different for each VF.
A base lkey value is returned in QUERY_DEV_CAP at offset 0x98.

The reserved L_key value for a VF is:
    VF_lkey = base_lkey + (VF_number << 8).

This VF L_key value should be returned in QUERY_FUNC_CAP
(opcode-modifier = 0) at offset 0x48.

To indicate that the lkey value at offset 0x48 is valid, the Hypervisor
sets a flag bit in dword 0x0, offset 27 in the QUERY_FUNC_CAP wrapper
function.

When the VF calls QUERY_FUNC_CAP, it should check if this flag bit is set.
If it is set, the VF should take the reserved lkey value at offset 0x48.
If the bit is not set, the VF should not use a reserved lkey
(i.e., should set its reserved lkey value to 0).

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet/mlx4_core: Add bad-cable event support
Jack Morgenstein [Tue, 27 Jan 2015 13:57:59 +0000 (15:57 +0200)]
net/mlx4_core: Add bad-cable event support

If the firmware can detect a bad cable, allow it to generate an
event, and print the problem in the log.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agovxlan: advertise link netns in fdb messages
Nicolas Dichtel [Mon, 26 Jan 2015 13:10:53 +0000 (14:10 +0100)]
vxlan: advertise link netns in fdb messages

Previous commit is based on a wrong assumption, fdb messages are always sent
into the netns where the interface stands (see vxlan_fdb_notify()).

These fdb messages doesn't embed the rtnl attribute IFLA_LINK_NETNSID, thus we
need to add it (useful to interpret NDA_IFINDEX or NDA_DST for example).

Note also that vxlan_nlmsg_size() was not updated.

Fixes: 193523bf9373 ("vxlan: advertise netns of vxlan dev in fdb msg")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'bonding-next'
David S. Miller [Wed, 28 Jan 2015 01:09:09 +0000 (17:09 -0800)]
Merge branch 'bonding-next'

Jonathan Toppins says:

====================
bonding: various 802.3ad fixes

This patch series is a forward porting of patches we (Cumulus) are shipping
in our 3.2 series kernels. These fixes attempt to make 802.3ad bonding mode
more predictable in certian state machine transtions in addition to fixing
802.3ad bond carrier determination when bonding min_links option is changed.
Specific notes are contained within each patch.

For this patch series there are no userspace facing changes, a diff between
the modinfo output showed no difference. However, there are behavioral
facing changes, primarily in the bond carrier state. Please make sure to
review carefully.

v2:
 * fixed some style issues
 * dropped a portion of patch 1 in favor of more testing on my side
====================

Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobonding: cleanup and remove dead code
Jonathan Toppins [Mon, 26 Jan 2015 06:17:01 +0000 (01:17 -0500)]
bonding: cleanup and remove dead code

fix sparse warning about non-static function

drivers/net/bonding/bond_main.c:3737:5: warning: symbol
'bond_3ad_xor_xmit' was not declared. Should it be static?

Reviewed-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobonding: fix LACP PDU not sent on slave port sometimes
Satish Ashok [Mon, 26 Jan 2015 06:17:00 +0000 (01:17 -0500)]
bonding: fix LACP PDU not sent on slave port sometimes

When a slave is added to a bond and it is not in full duplex mode,
AD_PORT_LACP_ENABLED flag is cleared, due to this LACP PDU is not sent
on slave. When the duplex is changed to full, the flag needs to be set
to send LACP PDU.

Cc: Andy Gospodarek <gospo@cumulusnetworks.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: Satish Ashok <sashok@cumulusnetworks.com>
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobonding: fix incorrect lacp mux state when agg not active
Wilson Kok [Mon, 26 Jan 2015 06:16:59 +0000 (01:16 -0500)]
bonding: fix incorrect lacp mux state when agg not active

This patch attempts to fix the following problems when an actor or
partner's aggregator is not active:
    1. a slave's lacp port state is marked as AD_STATE_SYNCHRONIZATION
       even if it is attached to an inactive aggregator. LACP advertises
       this state to the partner, making the partner think he can move
       into COLLECTING_DISTRIBUTING state even though this link will not
       pass traffic on the local side

    2. a slave goes into COLLECTING_DISTRIBUTING state without checking
       if the aggregator is actually active

    3. when in COLLECTING_DISTRIBUTING state, the partner parameters may
       change, e.g. the partner_oper_port_state.SYNCHRONIZATION. The
       local mux machine is not reacting to the change and continue to
       keep the slave and bond up

    4. When bond slave leaves an inactive aggregator and joins an active
       aggregator, the actor oper port state need to update to SYNC state.

v2:
 * fix style issues in bond_3ad.c

Cc: Andy Gospodarek <gospo@cumulusnetworks.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobonding: fix bond_open() don't always set slave active flag
Wilson Kok [Mon, 26 Jan 2015 06:16:58 +0000 (01:16 -0500)]
bonding: fix bond_open() don't always set slave active flag

Mode 802.3ad, fix incorrect bond slave active state when slave is not in
active aggregator. During bond_open(), the bonding driver always sets
the slave active flag to true if the bond is not in active-backup, alb,
or tlb modes. Bonding should let the aggregator selection logic set the
active flag when in 802.3ad mode.

Cc: Andy Gospodarek <gospo@cumulusnetworks.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobonding: update bond carrier state when min_links option changes
Jonathan Toppins [Mon, 26 Jan 2015 06:16:57 +0000 (01:16 -0500)]
bonding: update bond carrier state when min_links option changes

Cc: Andy Gospodarek <gospo@cumulusnetworks.com>
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agohyperv: match wait_for_completion_timeout return type
Nicholas Mc Guire [Sun, 25 Jan 2015 14:48:23 +0000 (15:48 +0100)]
hyperv: match wait_for_completion_timeout return type

return type of wait_for_completion_timeout is unsigned long not int, this
patch just fixes up the declarations.

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agohyperv: netvsc.c: match wait_for_completion_timeout return type
Nicholas Mc Guire [Sun, 25 Jan 2015 14:46:31 +0000 (15:46 +0100)]
hyperv: netvsc.c: match wait_for_completion_timeout return type

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
David S. Miller [Wed, 28 Jan 2015 00:59:56 +0000 (16:59 -0800)]
Merge git://git./linux/kernel/git/davem/net

Conflicts:
arch/arm/boot/dts/imx6sx-sdb.dts
net/sched/cls_bpf.c

Two simple sets of overlapping changes.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoNFC: Add ACPI support for NXP PN544
Robert Dolca [Mon, 26 Jan 2015 11:13:37 +0000 (13:13 +0200)]
NFC: Add ACPI support for NXP PN544

Currently there is no support for ACPI.
This patch uses the following configuration:
- Device id: NXP5440
- Pin mapping:
- 0 IRQ pin
- 1 enable pin
- 2 firmware pin

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9 years agoNFC: PN544: GPIO access that may sleep
Robert Dolca [Mon, 26 Jan 2015 11:13:36 +0000 (13:13 +0200)]
NFC: PN544: GPIO access that may sleep

gpio_set_value was replaced with gpio_set_value_cansleep in order
to allow GPIO access that may sleep. This is particularelly useful
when GPIO is accessed using busses like I2C, SPI, USB

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9 years agoNFC: dts: st21nfca: Document ese-present & uicc-present DTS property
Christophe Ricard [Tue, 27 Jan 2015 00:18:20 +0000 (01:18 +0100)]
NFC: dts: st21nfca: Document ese-present & uicc-present DTS property

On st21nfca, the mechanism to enable a secure element needs to add 2
properties in order manage the SWP line correctly.

Document ese-present and uicc-present properties.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9 years agoNFC: st21nfca: Adding support for secure element
Christophe Ricard [Tue, 27 Jan 2015 00:18:19 +0000 (01:18 +0100)]
NFC: st21nfca: Adding support for secure element

st21nfca has 1 physical SWP line and can support up to 2 secure elements
(UICC & eSE) thanks to an external switch managed with a gpio.

The platform integrator needs to specify thanks to 2 initialization
properties, uicc-present and ese-present, if it is suppose to have uicc
and/or ese. Of course if the platform does not have an external switch,
only one kind of secure element can be supported. Those parameters are
under platform integrator responsibilities.

During initialization, the white_list will be set according to those
parameters.

The discovery_se function will assume a secure element is physically
present according to uicc-present and ese-present values and will add it
to the secure element list. On ese activation, the atr is retrieved to
calculate a command exchange timeout based on the first atr(TB) value.

The se_io will allow to transfer data over SWP. 2 kind of events may appear
after a data is sent over:
- ST21NFCA_EVT_TRANSMIT_DATA when receiving an apdu answer
- ST21NFCA_EVT_WTX_REQUEST when the secure element needs more time than
expected to compute a command. If this timeout expired, a first recovery
tentative consist to send a simple software reset proprietary command.
If this tentative still fail, a second recovery tentative consist to send
a hardware reset proprietary command.
This function is only relevant for eSE like secure element.

This patch also change the way a pipe is referenced. There can be
different pipe connected to the same gate with different host destination
(ex: CONNECTIVITY). In order to keep host information every pipe are
reference with a tuple (gate, host). In order to reduce changes, we are
keeping unchanged the way a gate is addressed on the Terminal Host.
However, this is working because we consider the apdu reader gate is only
present on the eSE slot also the connectivity gate cannot give a reliable
value; it will give the latest stored pipe value.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9 years agoNFC: hci: Remove nfc_hci_pipe2gate function
Christophe Ricard [Tue, 27 Jan 2015 00:18:18 +0000 (01:18 +0100)]
NFC: hci: Remove nfc_hci_pipe2gate function

With the newly introduced pipes table hci_dev fields,
the nfc_hci_pipe2gate routine is no longer needed.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9 years agoNFC: microread: Change event_received gate parameter to pipe
Christophe Ricard [Tue, 27 Jan 2015 00:18:17 +0000 (01:18 +0100)]
NFC: microread: Change event_received gate parameter to pipe

The below event_received hci handler has change the gate parameter to pipe.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
9 years agoNFC: pn544: Change event_received gate parameter to pipe
Christophe Ricard [Tue, 27 Jan 2015 00:18:16 +0000 (01:18 +0100)]
NFC: pn544: Change event_received gate parameter to pipe

The below event_received hci handler has change the gate parameter to pipe.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
9 years agoNFC: hci: Add cmd_received handler
Christophe Ricard [Tue, 27 Jan 2015 00:18:15 +0000 (01:18 +0100)]
NFC: hci: Add cmd_received handler

When a command is received, it is sometime needed to let the CLF driver do
some additional operations. (ex: count remaining pipe notification...)

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9 years agoNFC: hci: Reference every pipe information according to notification
Christophe Ricard [Tue, 27 Jan 2015 00:18:14 +0000 (01:18 +0100)]
NFC: hci: Reference every pipe information according to notification

We update the tracked pipes status when receiving HCI commands.
Also we forward HCI errors and we reply to any HCI command, even though
we don't support it.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9 years agoNFC: hci: Change nfc_hci_send_response gate parameter to pipe
Christophe Ricard [Tue, 27 Jan 2015 00:18:13 +0000 (01:18 +0100)]
NFC: hci: Change nfc_hci_send_response gate parameter to pipe

As there can be several pipes connected to the same gate, we need
to know which pipe ID to use when sending an HCI response. A gate
ID is not enough.

Instead of changing the nfc_hci_send_response() API to something
not aligned with the rest of the HCI API, we call nfc_hci_hcp_message_tx
directly.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9 years agoNFC: hci: Add pipes table to reference them with a tuple {gate, host}
Christophe Ricard [Tue, 27 Jan 2015 00:18:12 +0000 (01:18 +0100)]
NFC: hci: Add pipes table to reference them with a tuple {gate, host}

In order to keep host source information on specific hci event (such as
evt_connectivity or evt_transaction) and because 2 pipes can be connected
to the same gate, it is necessary to add a table referencing every pipe
with a {gate, host} tuple.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9 years agoNFC: hci: Change event_received handler gate parameter to pipe
Christophe Ricard [Tue, 27 Jan 2015 00:18:11 +0000 (01:18 +0100)]
NFC: hci: Change event_received handler gate parameter to pipe

Several pipes may point to the same CLF gate, so getting the gate ID
as an input is not enough.
For example dual secure element may have 2 pipes (1 for uicc and
1 for eSE) pointing to the connectivity gate.

As resolving gate and host IDs can be done from a pipe, we now pass
the pipe ID to the event received handler.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Linus Torvalds [Tue, 27 Jan 2015 21:55:36 +0000 (13:55 -0800)]
Merge git://git./linux/kernel/git/davem/net

Pull networking fixes from David Miller:

 1) Don't OOPS on socket AIO, from Christoph Hellwig.

 2) Scheduled scans should be aborted upon RFKILL, from Emmanuel
    Grumbach.

 3) Fix sleep in atomic context in kvaser_usb, from Ahmed S Darwish.

 4) Fix RCU locking across copy_to_user() in bpf code, from Alexei
    Starovoitov.

 5) Lots of crash, memory leak, short TX packet et al bug fixes in
    sh_eth from Ben Hutchings.

 6) Fix memory corruption in SCTP wrt.  INIT collitions, from Daniel
    Borkmann.

 7) Fix return value logic for poll handlers in netxen, enic, and bnx2x.
    From Eric Dumazet and Govindarajulu Varadarajan.

 8) Header length calculation fix in mac80211 from Fred Chou.

 9) mv643xx_eth doesn't handle highmem correctly in non-TSO code paths.
    From Ezequiel Garcia.

10) udp_diag has bogus logic in it's hash chain skipping, copy same fix
    tcp diag used.  From Herbert Xu.

11) amd-xgbe programs wrong rx flow control register, from Thomas
    Lendacky.

12) Fix race leading to use after free in ping receive path, from Subash
    Abhinov Kasiviswanathan.

13) Cache redirect routes otherwise we can get a heavy backlog of rcu
    jobs liberating DST_NOCACHE entries.  From Hannes Frederic Sowa.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (48 commits)
  net: don't OOPS on socket aio
  stmmac: prevent probe drivers to crash kernel
  bnx2x: fix napi poll return value for repoll
  ipv6: replacing a rt6_info needs to purge possible propagated rt6_infos too
  sh_eth: Fix DMA-API usage for RX buffers
  sh_eth: Check for DMA mapping errors on transmit
  sh_eth: Ensure DMA engines are stopped before freeing buffers
  sh_eth: Remove RX overflow log messages
  ping: Fix race in free in receive path
  udp_diag: Fix socket skipping within chain
  can: kvaser_usb: Fix state handling upon BUS_ERROR events
  can: kvaser_usb: Retry the first bulk transfer on -ETIMEDOUT
  can: kvaser_usb: Send correct context to URB completion
  can: kvaser_usb: Do not sleep in atomic context
  ipv4: try to cache dst_entries which would cause a redirect
  samples: bpf: relax test_maps check
  bpf: rcu lock must not be held when calling copy_to_user()
  net: sctp: fix slab corruption from use after free on INIT collisions
  net: mv643xx_eth: Fix highmem support in non-TSO egress path
  sh_eth: Fix serialisation of interrupt disable with interrupt & NAPI handlers
  ...

9 years agonet: don't OOPS on socket aio
Christoph Hellwig [Tue, 27 Jan 2015 20:25:33 +0000 (12:25 -0800)]
net: don't OOPS on socket aio

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agostmmac: prevent probe drivers to crash kernel
Andy Shevchenko [Tue, 27 Jan 2015 16:38:03 +0000 (18:38 +0200)]
stmmac: prevent probe drivers to crash kernel

In the case when alloc_netdev fails we return NULL to a caller. But there is no
check for NULL in the probe drivers. This patch changes NULL to an error
pointer. The function description is amended to reflect what we may get
returned.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge tag 'powerpc-3.19-5' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux
Linus Torvalds [Tue, 27 Jan 2015 18:04:38 +0000 (10:04 -0800)]
Merge tag 'powerpc-3.19-5' of git://git./linux/kernel/git/mpe/linux

Pull powerpc fixes from Michael Ellerman:
 "Two powerpc fixes"

* tag 'powerpc-3.19-5' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux:
  powerpc/powernv: Restore LPCR with LPCR_PECE1 cleared
  powerpc/xmon: Fix another endiannes issue in RTAS call from xmon

9 years agoMerge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty...
Linus Torvalds [Tue, 27 Jan 2015 17:02:09 +0000 (09:02 -0800)]
Merge tag 'fixes-for-linus' of git://git./linux/kernel/git/rusty/linux

Pull one more module fix from Rusty Russell:
 "SCSI was using module_refcount() to figure out when the module was
  unloading: this broke with new atomic refcounting.  The code is still
  suspicious, but this solves the WARN_ON()"

* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  scsi: always increment reference count

9 years agonetlink: Kill redundant net argument in netlink_insert
Herbert Xu [Mon, 26 Jan 2015 03:02:56 +0000 (14:02 +1100)]
netlink: Kill redundant net argument in netlink_insert

The socket already carries the net namespace with it so there is
no need to be passing another net around.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobnx2x: fix napi poll return value for repoll
Govindarajulu Varadarajan [Sun, 25 Jan 2015 10:39:23 +0000 (16:09 +0530)]
bnx2x: fix napi poll return value for repoll

With the commit d75b1ade567ffab ("net: less interrupt masking in NAPI") napi
repoll is done only when work_done == budget. When in busy_poll is we return 0
in napi_poll. We should return budget.

Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
Acked-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/klassert/ipsec
David S. Miller [Tue, 27 Jan 2015 08:28:38 +0000 (00:28 -0800)]
Merge branch 'master' of git://git./linux/kernel/git/klassert/ipsec

Steffen Klassert says:

====================
ipsec 2015-01-26

Just two small fixes for _decode_session6() where we
might decode to wrong header information in some rare
situations.

Please pull or let me know if there are problems.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: Invalidate LP advertising flags when restarting or disabling AN
Ben Hutchings [Tue, 27 Jan 2015 00:58:15 +0000 (00:58 +0000)]
net: phy: Invalidate LP advertising flags when restarting or disabling AN

It is possible to see the old value of the LP advertising flags
through ethtool after reconfiguring the PHY and before autonegotiation
completes.  If autonegotiation is turned off then the last value seen
will persist indefinitely.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'sunvnet-next'
David S. Miller [Tue, 27 Jan 2015 08:25:27 +0000 (00:25 -0800)]
Merge branch 'sunvnet-next'

David L Stevens says:

====================
sunvnet: fix null pointer deref and crash recovery

These patches fix an incorrect ordering in releasing ring data, clear pending
tx buffers on a reset, and make the sunvnet driver more reliable when remote
systems crash during active transmits.
====================

Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agosunvnet: improve error handling when a remote crashes
David L Stevens [Mon, 26 Jan 2015 20:54:27 +0000 (15:54 -0500)]
sunvnet: improve error handling when a remote crashes

If a remote machine crashes while there are pending transmit buffers, the
sunvnet driver reallocates the ring descriptors giving us enries that have
state VIO_DESC_FREE but also an allocated skb. This results in a BUG_ON()
call when the remote reboots and we reach that point in the ring.

This patch:

1) clears pending tx packets in the ring on port reset
2) changes a BUG_ON() to a pr_warn() when a remote host has given us an invalid
descriptor state
3) collapses multiple active buffer frees in a ring to a single message per
ring and adds the device name and remote MAC address

This fixes the particular problem of not cleaning up pending buffers on a
reset, but also prevents us from crashing if the remote handles descriptors
out of order or sets an unexpected state for a descriptor.

Signed-off-by: David L Stevens <david.stevens@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agosunvnet: free pending tx buffers before clearing ring data
David L Stevens [Mon, 26 Jan 2015 20:54:35 +0000 (15:54 -0500)]
sunvnet: free pending tx buffers before clearing ring data

This patch moves the clearing of ring data in vnet_port_free_tx_bufs to after
 the freeing of pending buffers in the ring. Otherwise, this can result in
 dereferencing a NULL pointer.

Reported-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David L Stevens <david.stevens@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoipv6: replacing a rt6_info needs to purge possible propagated rt6_infos too
Hannes Frederic Sowa [Mon, 26 Jan 2015 14:11:17 +0000 (15:11 +0100)]
ipv6: replacing a rt6_info needs to purge possible propagated rt6_infos too

Lubomir Rintel reported that during replacing a route the interface
reference counter isn't correctly decremented.

To quote bug <https://bugzilla.kernel.org/show_bug.cgi?id=91941>:
| [root@rhel7-5 lkundrak]# sh -x lal
| + ip link add dev0 type dummy
| + ip link set dev0 up
| + ip link add dev1 type dummy
| + ip link set dev1 up
| + ip addr add 2001:db8:8086::2/64 dev dev0
| + ip route add 2001:db8:8086::/48 dev dev0 proto static metric 20
| + ip route add 2001:db8:8088::/48 dev dev1 proto static metric 10
| + ip route replace 2001:db8:8086::/48 dev dev1 proto static metric 20
| + ip link del dev0 type dummy
| Message from syslogd@rhel7-5 at Jan 23 10:54:41 ...
|  kernel:unregister_netdevice: waiting for dev0 to become free. Usage count = 2
|
| Message from syslogd@rhel7-5 at Jan 23 10:54:51 ...
|  kernel:unregister_netdevice: waiting for dev0 to become free. Usage count = 2

During replacement of a rt6_info we must walk all parent nodes and check
if the to be replaced rt6_info got propagated. If so, replace it with
an alive one.

Fixes: 4a287eba2de3957 ("IPv6 routing, NLM_F_* flag support: REPLACE and EXCL flags support, warn about missing CREATE flag")
Reported-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'sh_eth'
David S. Miller [Tue, 27 Jan 2015 08:18:57 +0000 (00:18 -0800)]
Merge branch 'sh_eth'

Ben Hutchings says:

====================
Fixes for sh_eth #3

I'm continuing review and testing of Ethernet support on the R-Car H2
chip.  This series fixes the last of the more serious issues I've found.

These are not tested on any of the other supported chips.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agosh_eth: Fix DMA-API usage for RX buffers
Ben Hutchings [Tue, 27 Jan 2015 00:50:24 +0000 (00:50 +0000)]
sh_eth: Fix DMA-API usage for RX buffers

- Use the return value of dma_map_single(), rather than calling
  virt_to_page() separately
- Check for mapping failue
- Call dma_unmap_single() rather than dma_sync_single_for_cpu()

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agosh_eth: Check for DMA mapping errors on transmit
Ben Hutchings [Tue, 27 Jan 2015 00:49:47 +0000 (00:49 +0000)]
sh_eth: Check for DMA mapping errors on transmit

dma_map_single() may fail if an IOMMU or swiotlb is in use, so
we need to check for this.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agosh_eth: Ensure DMA engines are stopped before freeing buffers
Ben Hutchings [Tue, 27 Jan 2015 00:49:32 +0000 (00:49 +0000)]
sh_eth: Ensure DMA engines are stopped before freeing buffers

Currently we try to clear EDRRR and EDTRR and immediately continue to
free buffers.  This is unsafe because:

- In general, register writes are not serialised with DMA, so we still
  have to wait for DMA to complete somehow
- The R8A7790 (R-Car H2) manual states that the TX running flag cannot
  be cleared by writing to EDTRR
- The same manual states that clearing the RX running flag only stops
  RX DMA at the next packet boundary

I applied this patch to the driver to detect DMA writes to freed
buffers:

> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -1098,7 +1098,14 @@ static void sh_eth_ring_free(struct net_device *ndev)
>   /* Free Rx skb ringbuffer */
>   if (mdp->rx_skbuff) {
>   for (i = 0; i < mdp->num_rx_ring; i++)
> + memcpy(mdp->rx_skbuff[i]->data,
> +        "Hello, world", 12);
> + msleep(100);
> + for (i = 0; i < mdp->num_rx_ring; i++) {
> + WARN_ON(memcmp(mdp->rx_skbuff[i]->data,
> +        "Hello, world", 12));
>   dev_kfree_skb(mdp->rx_skbuff[i]);
> + }
>   }
>   kfree(mdp->rx_skbuff);
>   mdp->rx_skbuff = NULL;

then ran the loop:

    while ethtool -G eth0 rx 128 ; ethtool -G eth0 rx 64; do echo -n .; done

and 'ping -f' toward the sh_eth port from another machine.  The
warning fired several times a minute.

To fix these issues:

- Deactivate all TX descriptors rather than writing to EDTRR
- As there seems to be no way of telling when RX DMA is stopped,
  perform a soft reset to ensure that both DMA enginess are stopped
- To reduce the possibility of the reset truncating a transmitted
  frame, disable egress and wait a reasonable time to reach a
  packet boundary before resetting
- Update statistics before resetting

(The 'reasonable time' does not allow for CS/CD in half-duplex
mode, but half-duplex no longer seems reasonable!)

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agosh_eth: Remove RX overflow log messages
Ben Hutchings [Tue, 27 Jan 2015 00:41:16 +0000 (00:41 +0000)]
sh_eth: Remove RX overflow log messages

If RX traffic is overflowing the FIFO or DMA ring, logging every time
this happens just makes things worse.  These errors are visible in the
statistics anyway.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'phy-next'
David S. Miller [Tue, 27 Jan 2015 08:16:56 +0000 (00:16 -0800)]
Merge branch 'phy-next'

Florian Fainelli says:

====================
net: phy: prevent double suspend

This patch series addresses a problem that Fugang and I observed on different
platforms where a given PHY device might end-up being suspended twice.

Once as part of the call from ndo_open() all the way down to phy_detach() and
phy_suspend() and a second time when the generic platform device/driver
suspend/resume callbacks are called in drivers/net/phy/mdio_bus.c.

Thanks to Fugang for giving this a quick try on i.MX6/FEC and reporting
positive test results!
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: avoid suspending twice a PHY
Florian Fainelli [Tue, 27 Jan 2015 06:05:40 +0000 (22:05 -0800)]
net: phy: avoid suspending twice a PHY

As part of a call to ndo_close() a netdevice driver may call
phy_disconnect() -> phy_detach() -> phy_suspend(), such that the PHY is
suspsended at this point and a netdevice driver may clock gate the
backing peripheral providing MDIO bus accessses as well.

Update mdio_bus_phy_may_suspend() to return whether a PHY is allowed to
be suspended and conversely resumed if and only if it was not previously
suspended before while it is currently in detached (netdev pointer is
NULL) state.

This fixes bus errors seen during S2/S3 suspend/resume cycles for
netdevice drivers such as GENET which clock gates the entire Ethernet
MAC, including the MDIO bus block.

Acked-by: Fugang Duan <B38611@freescale.com>
Tested-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: keep track of the PHY suspend state
Florian Fainelli [Tue, 27 Jan 2015 06:05:39 +0000 (22:05 -0800)]
net: phy: keep track of the PHY suspend state

In order to avoid double calls to phydev->drv->suspend and resume, keep
track of whether the PHY has already been suspended as a consequence of
a successful call to phy_suspend(). We will use this in our MDIO bus
suspend/resume hooks to avoid a double suspend call.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: document has_fixups field
Florian Fainelli [Tue, 27 Jan 2015 06:05:38 +0000 (22:05 -0800)]
net: phy: document has_fixups field

has_fixups was introduced to help keeping track of fixups/quirks running
on a PHY device, but we did not update the comment above struct
phy_device accordingly.

Fixes: b0ae009f3dc14 (net: phy: add "has_fixups" boolean property")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: utilize phy_suspend and phy_resume
Florian Fainelli [Tue, 27 Jan 2015 06:05:37 +0000 (22:05 -0800)]
net: phy: utilize phy_suspend and phy_resume

phy_suspend and phy_resume are an abstraction on top of the PHY device
driver suspend and resume callbacks, utilize those since they are the
proper interface to suspending and resuming a PHY device.

Acked-by: Fugang Duan <B38611@freescale.com>
Tested-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'cxgb4-next'
David S. Miller [Tue, 27 Jan 2015 08:15:06 +0000 (00:15 -0800)]
Merge branch 'cxgb4-next'

Hariprasad Shenai says:

====================
Add support to dump cim ibq, obq and qinfo, etc

This patch series adds support to dump cim_ibq, cim_obq, sge_qinfo, pm_stats
and clk debugfs entries.

The patches series is created against 'net-next' tree.
And includes patches on cxgb4 driver.

We have included all the maintainers of respective drivers. Kindly review the
change and let us know in case of any review comments.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agocxgb4: Added support in debugfs to dump different timer and clock values of the adapter
Hariprasad Shenai [Tue, 27 Jan 2015 08:17:49 +0000 (13:47 +0530)]
cxgb4: Added support in debugfs to dump different timer and clock values of the adapter

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agocxgb4: Added support in debugfs to dump PM module stats
Hariprasad Shenai [Tue, 27 Jan 2015 08:17:48 +0000 (13:47 +0530)]
cxgb4: Added support in debugfs to dump PM module stats

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agocxgb4: Addded support in debugfs to dump CIM outbound queue content
Hariprasad Shenai [Tue, 27 Jan 2015 08:17:47 +0000 (13:47 +0530)]
cxgb4: Addded support in debugfs to dump CIM outbound queue content

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agocxgb4: Added support in debugfs to dump cim ingress bound queue contents
Hariprasad Shenai [Tue, 27 Jan 2015 08:17:46 +0000 (13:47 +0530)]
cxgb4: Added support in debugfs to dump cim ingress bound queue contents

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agocxgb4: Added support in debugfs to dump sge_qinfo
Hariprasad Shenai [Tue, 27 Jan 2015 08:17:45 +0000 (13:47 +0530)]
cxgb4: Added support in debugfs to dump sge_qinfo

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge tag 'linux-can-fixes-for-3.19-20150127' of git://git.kernel.org/pub/scm/linux...
David S. Miller [Tue, 27 Jan 2015 08:13:05 +0000 (00:13 -0800)]
Merge tag 'linux-can-fixes-for-3.19-20150127' of git://git./linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says:

====================
pull-request: can 2015-01-27

this is another pull request for net/master which consists of 4 patches.

All 4 patches are contributed by Ahmed S. Darwish, he fixes more problems in
the kvaser_usb driver.

David, please merge net/master to net-next/master, as we have more kvaser_usb
patches in the queue, that target net-next.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa/mv88e6352: make mv88e6352_wait generic
Vivien Didelot [Fri, 23 Jan 2015 23:34:41 +0000 (18:34 -0500)]
net: dsa/mv88e6352: make mv88e6352_wait generic

Some busy bits are available in the global register 1, such as the ATU
Busy bit. We may want to use this function to wait for them to change,
so add a new parameter to mv88e6352_wait() instead of hard-coding
REG_GLOBAL2.

In the meantime, since the REG_READ() macro already checks for error,
remove the redundant check for ret < 0.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: David S. Miller <davem@davemloft.net>