firefly-linux-kernel-4.4.55.git
8 years agoNFC: st21nfca: Add support for proprietary commands
Christophe Ricard [Mon, 26 Oct 2015 06:50:11 +0000 (07:50 +0100)]
NFC: st21nfca: Add support for proprietary commands

Add support for proprietary commands useful mainly
for factory testings.

Here is a list:

- FACTORY_MODE: Allow to set the driver into a mode where no
  secure element are activated. It does not consider any
  NFC_ATTR_VENDOR_DATA.
- HCI_CLEAR_ALL_PIPES: Allow to execute a HCI clear all pipes
  command. It does not consider any NFC_ATTR_VENDOR_DATA.
- HCI_DM_PUT_DATA: Allow to configure specific CLF registry as
  for example RF trimmings or low level drivers configurations
  (I2C, SPI, SWP).
- HCI_DM_UPDATE_AID: Allow to configure an AID routing into the
  CLF routing table following RF technology, CLF mode or protocol.
- HCI_DM_GET_INFO: Allow to retrieve CLF information.
- HCI_DM_GET_DATA: Allow to retrieve CLF configurable data such as
  low level drivers configurations or RF trimmings.
- HCI_DM_LOAD: Allow to load a firmware into the CLF. A complete
  packet can be more than 8KB.
- HCI_DM_RESET: Allow to run a CLF reset in order to "commit" CLF
  configuration changes without CLF power off.
- HCI_GET_PARAM: Allow to retrieve an HCI CLF parameter (for example
  the white list).
- HCI_DM_FIELD_GENERATOR: Allow to generate different kind of RF
  technology. When using this command to anti-collision is done.
- HCI_LOOPBACK: Allow to echo a command and test the Dh to CLF
  connectivity.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Replace st21nfcb by st_nci in makefile
Christophe Ricard [Sun, 25 Oct 2015 21:54:50 +0000 (22:54 +0100)]
NFC: st-nci: Replace st21nfcb by st_nci in makefile

Replace 1 missing st21nfcb by st_nci

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: remove duplicated skb dump
Christophe Ricard [Sun, 25 Oct 2015 21:54:49 +0000 (22:54 +0100)]
NFC: st-nci: remove duplicated skb dump

Remove SPI_DUMP_SKB and I2C_DUMP_SKB as skb is already dumped
in ndlc layer.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Disable irq when powering the device up
Christophe Ricard [Sun, 25 Oct 2015 21:54:48 +0000 (22:54 +0100)]
NFC: st-nci: Disable irq when powering the device up

Upon some conditions (timing, CLF errors, platform errors...), the
irq might be already active when powering the device.

Add irq_active variable as a guard to avoid kernel warning message

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st21nfca: Add error messages for unexpected HCI events
Christophe Ricard [Sun, 25 Oct 2015 21:54:47 +0000 (22:54 +0100)]
NFC: st21nfca: Add error messages for unexpected HCI events

Potentially an unexpected HCI event may occur because of a
firmware bug. It could be transparent for the user but we should
at least log it.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st21nfca: Add few code style fixes
Christophe Ricard [Sun, 25 Oct 2015 21:54:45 +0000 (22:54 +0100)]
NFC: st21nfca: Add few code style fixes

Add a minor code style fixes

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Add few code style fixes
Christophe Ricard [Sun, 25 Oct 2015 21:54:44 +0000 (22:54 +0100)]
NFC: st-nci: Add few code style fixes

Add some few code style fixes.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: netlink: Add mode parameter to deactivate_target functions
Christophe Ricard [Sun, 25 Oct 2015 21:54:43 +0000 (22:54 +0100)]
NFC: netlink: Add mode parameter to deactivate_target functions

In order to manage in a better way the nci poll mode state machine,
add mode parameter to deactivate_target functions.
This way we can manage different target state.
mode parameter make sense only in nci core.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st21nfca: Fix host_list verification after SEactivation
Christophe Ricard [Sun, 25 Oct 2015 21:54:42 +0000 (22:54 +0100)]
NFC: st21nfca: Fix host_list verification after SEactivation

A secure element can be activated in different order.
The host_list is updated keeping a fixed order:
<terminal_host_id><uicc_id><ese_id>.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Fix host_list verification after SE activation
Christophe Ricard [Sun, 25 Oct 2015 21:54:41 +0000 (22:54 +0100)]
NFC: st-nci: Fix host_list verification after SE activation

A secure element can be activated in different order.
The host_list is updated keeping a fixed order:
<terminal_host_id><uicc_id><ese_id>.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Increase delay between 2 secure element activations
Christophe Ricard [Sun, 25 Oct 2015 21:54:40 +0000 (22:54 +0100)]
NFC: st-nci: Increase delay between 2 secure element activations

After internal discussion, it appears this timing should be
increased to 20 ms for interoperability reason.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Add ese-present/uicc-present dts properties
Christophe Ricard [Sun, 25 Oct 2015 21:54:39 +0000 (22:54 +0100)]
NFC: st-nci: Add ese-present/uicc-present dts properties

In order to align with st21nfca, dts configuration properties
ese_present and uicc_present are made available in st-nci driver.

So far, in early development firmware, because
nci_nfcee_mode_set(DISABLE) was not supported we had to try to
enable it during the secure element discovery phase.

After several trials on commercial and qualified firmware it appears
that nci_nfcee_mode_set(ENABLE) and nci_nfcee_mode_set(DISABLE) are
properly supported.

Such feature also help us to eventually save some time (~5ms) when
only one secure element is connected.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: netlink: Add missing NFC_ATTR comments
Christophe Ricard [Sun, 25 Oct 2015 21:54:38 +0000 (22:54 +0100)]
NFC: netlink: Add missing NFC_ATTR comments

NFC_CMD_ACTIVATE_TARGET and NFC_ATTR_SE_PARAMS comments are missing.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Add error messages when an unexpected HCI event occurs
Christophe Ricard [Sun, 25 Oct 2015 21:54:37 +0000 (22:54 +0100)]
NFC: st-nci: Add error messages when an unexpected HCI event occurs

Potentially an unexpected HCI event may occur because of a
firmware bug. It could be transparent for the user but we need to
at least log it.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Add support for proprietary commands
Christophe Ricard [Sun, 25 Oct 2015 21:54:36 +0000 (22:54 +0100)]
NFC: st-nci: Add support for proprietary commands

Add support for proprietary commands useful mainly for
factory testings. Here is a list:

- FACTORY_MODE: Allow to set the driver into a mode where
  no secure element are activated. It does not consider any
  NFC_ATTR_VENDOR_DATA.
- HCI_CLEAR_ALL_PIPES: Allow to execute a HCI clear all pipes
  command. It does not consider any NFC_ATTR_VENDOR_DATA.
- HCI_DM_PUT_DATA: Allow to configure specific CLF registry
  like for example RF trimmings or low level drivers
  configurations (I2C, SPI, SWP).
- HCI_DM_UPDATE_AID: Allow to configure an AID routing into the
  CLF routing table following RF technology, CLF mode or protocol.
- HCI_DM_GET_INFO: Allow to retrieve CLF information.
- HCI_DM_GET_DATA: Allow to retrieve CLF configurable data such as
  low level drivers configurations or RF trimmings.
- HCI_DM_DIRECT_LOAD: Allow to load a firmware into the CLF.
  A complete packet can be more than 8KB.
- HCI_DM_RESET: Allow to run a CLF reset in order to "commit" CLF
  configuration changes without CLF power off.
- HCI_GET_PARAM: Allow to retrieve an HCI CLF parameter (for example
  the white list).
- HCI_DM_FIELD_GENERATOR: Allow to generate different kind of RF
  technology. When using this command to anti-collision is done.
- HCI_LOOPBACK: Allow to echo a command and test the Dh to CLF
  connectivity.
- HCI_DM_VDC_MEASUREMENT_VALUE: Allow to measure the field applied
  on the CLF antenna. A value between 0 and 0x0f is returned. 0 is
  maximum.
- HCI_DM_FWUPD_START: Allow to put CLF into firmware update mode.
  It is a specific CLF command as there is no GPIO for this.
- HCI_DM_FWUPD_END:  Allow to complete firmware update.
- HCI_DM_VDC_VALUE_COMPARISON: Allow to compare the field applied
  on the CLF antenna to a reference value.
- MANUFACTURER_SPECIFIC: Allow to retrieve manufacturer specific data
  received during a NCI_CORE_INIT_CMD.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agonet: dsa: bcm_sf2: Unhardcode port numbers
Florian Fainelli [Fri, 23 Oct 2015 19:11:08 +0000 (12:11 -0700)]
net: dsa: bcm_sf2: Unhardcode port numbers

While the current driver mostly supports BCM7445 which has a hardcoded
location for its MoCA port on port 7 and port 0 for its internal PHY,
this is not necessarily true for all other chips out there such as
BCM3390 for instance.

Walk the list of ports from Device Tree, get their port number ("reg"
property), and then parse the "phy-mode" property and initialize two
internal variables: moca_port and a bitmask of internal PHYs. Since we
use interrupts for the MoCA port, we introduce two helper functions to
enable/disable interrupts and do this at the appropriate bank (INTRL2_0
or INTRL2_1).

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: dsa: bcm_sf2: Implement FDB operations
Florian Fainelli [Fri, 23 Oct 2015 18:38:07 +0000 (11:38 -0700)]
net: dsa: bcm_sf2: Implement FDB operations

Add support for the FDB add, delete, and dump operations. The add and
delete operations are implemented using directed ARL operations using
the specified MAC address and consist in a read operation, write and
readback operation.

The dump operation consists in using the ARL search and software
filtering entries which are not for the desired port.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agortl8xxxu: fix unused rtl8192cu_fops compiler warning
Kalle Valo [Sun, 25 Oct 2015 16:24:38 +0000 (18:24 +0200)]
rtl8xxxu: fix unused rtl8192cu_fops compiler warning

kbuild reported:

rtl8xxxu.c:5786:32: warning: ‘rtl8192cu_fops’ defined but not used [-Wunused-variable]

Fix it by adding temporary ifdefs around the static functions.

Fixes: 033695bdf6d7 ("rtl8xxxu: move devices supported by rtlwifi under UNTESTED config")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoarcnet: add netif_carrier_on/off for reconnect
Michael Grzeschik [Wed, 16 Sep 2015 08:15:45 +0000 (10:15 +0200)]
arcnet: add netif_carrier_on/off for reconnect

The arcnet device has no interrupt to detect if the link has changed
from disconnected to connected. This patch adds an timer to toggle the
link detection. The timer will get retriggered as long as the
reconnection interrupts accure. If the recon interrupts hold off
for >1s we define the connection stable again.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
8 years agoarcnet: com20020-pci: add led trigger support
Michael Grzeschik [Wed, 17 Sep 2014 22:12:50 +0000 (00:12 +0200)]
arcnet: com20020-pci: add led trigger support

The EAE PLX-PCI card has special leds on the the main io pci resource
bar. This patch adds support to trigger the conflict and data leds with
the packages.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
8 years agoarcnet: com20020-pci: add rotary index support
Michael Grzeschik [Wed, 17 Sep 2014 22:12:50 +0000 (00:12 +0200)]
arcnet: com20020-pci: add rotary index support

The EAE PLX-PCI card has a special rotary encoder
to configure the address of every card individually.
We take this information for the initial setup of
the cards dev_id.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
8 years agoarcnet: com20020-pci: set dev_port to the subdevice index
Michael Grzeschik [Fri, 20 Mar 2015 14:22:24 +0000 (15:22 +0100)]
arcnet: com20020-pci: set dev_port to the subdevice index

This patch sets the dev_port according to the index of
the card. This can be used by udev to name the ports
in userspace.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
8 years agoarcnet: com20020: add enable and disable device on open/close
Michael Grzeschik [Fri, 20 Mar 2015 14:20:59 +0000 (15:20 +0100)]
arcnet: com20020: add enable and disable device on open/close

This patch changes the driver to properly work with the linux netif
interface. The controller gets enabled on open and disabled on close.
Therefor it removes every bogus start of the xceiver. It only gets
enabled on com20020_open and disabled on com20020_close.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
8 years agoarcnet: move dev_free_skb to its only user
Michael Grzeschik [Wed, 22 Apr 2015 14:41:46 +0000 (16:41 +0200)]
arcnet: move dev_free_skb to its only user

The call for dev_free_skb is done only once. This patch
moves its call to its only user and removes the obsolete
condition variable.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
8 years agoBluetooth: Fix some obvious coding style issues in the SCO module
Marcel Holtmann [Mon, 26 Oct 2015 01:08:38 +0000 (02:08 +0100)]
Bluetooth: Fix some obvious coding style issues in the SCO module

Lets fix this obvious coding style issues in the SCO module and bring it
in line with the rest of the Bluetooth subsystem.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
8 years agoBluetooth: Replace hci_notify with hci_sock_dev_event
Marcel Holtmann [Sun, 25 Oct 2015 22:29:22 +0000 (23:29 +0100)]
Bluetooth: Replace hci_notify with hci_sock_dev_event

There is no point in wrapping hci_sock_dev_event around hci_notify. It
is an empty wrapper which adds no value. So remove it.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
8 years agoBluetooth: Rename bt_cb()->req into bt_cb()->hci
Marcel Holtmann [Sun, 25 Oct 2015 21:45:53 +0000 (22:45 +0100)]
Bluetooth: Rename bt_cb()->req into bt_cb()->hci

The SKB context buffer for HCI request is really not just for requests,
information in their are preserved for the whole HCI layer. So it makes
more sense to actually rename it into bt_cb()->hci and also call it then
struct hci_ctrl.

In addition that allows moving the decoded opcode for outgoing packets
into that struct. So far it was just consuming valuable space from the
main shared items. And opcode are not valid for L2CAP packets.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
8 years agoBluetooth: Remove unneeded parenthesis around MSG_OOB
Marcel Holtmann [Sun, 25 Oct 2015 21:45:18 +0000 (22:45 +0100)]
Bluetooth: Remove unneeded parenthesis around MSG_OOB

There are two checks that are still using (MSG_OOB) instead of just
MSG_OOB and so lets just fix them.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
8 years agoNFC: st21nfca: Fix st21nfca_gates offset
Christophe Ricard [Sun, 25 Oct 2015 21:54:35 +0000 (22:54 +0100)]
NFC: st21nfca: Fix st21nfca_gates offset

It is useless to start from index 0 when looking for a gate
because only dynamic pipes are retrieved with
ST21NFCA_DM_GETINFO(ST21NFCA_DM_GETINFO_PIPE_LIST).

The first dynamic pipe is present at index 3.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Fix st_nci_gates offset
Christophe Ricard [Sun, 25 Oct 2015 21:54:34 +0000 (22:54 +0100)]
NFC: st-nci: Fix st_nci_gates offset

It is useless to start from index 0 when looking for a gate
because only dynamic pipes are retrieved with
ST_NCI_DM_GETINFO(ST_NCI_DM_GETINFO_PIPE_LIST).

The first dynamic pipe is present at index 3.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Add support for NCI_HCI_IDENTITY_MGMT_GATE
Christophe Ricard [Sun, 25 Oct 2015 21:54:33 +0000 (22:54 +0100)]
NFC: st-nci: Add support for NCI_HCI_IDENTITY_MGMT_GATE

NCI_HCI_IDENTITY_MGMT_GATE might be useful to get information
about hardware or firmware version.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: initialize gate_count in st_nci_hci_network_init
Christophe Ricard [Sun, 25 Oct 2015 21:54:32 +0000 (22:54 +0100)]
NFC: st-nci: initialize gate_count in st_nci_hci_network_init

When initializing ndev->hci_dev->init_data, only gates field
was set. gate_count needs to be initialized as well.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st21nfca: Keep st21nfca_gates unchanged in load_session
Christophe Ricard [Sun, 25 Oct 2015 21:54:31 +0000 (22:54 +0100)]
NFC: st21nfca: Keep st21nfca_gates unchanged in load_session

We need to keep initial st_nci_gates values in order for
nfc_hci_dev_connect_gates to create and open pipe when necessary.

For example after a firmware update CLF pipes are cleared. Changing
pipe values in st21nfca_gates was causing nfc_hci_dev_connect_gates
not using accurate pipes value.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Keep st_nci_gates unchanged in load_session
Christophe Ricard [Sun, 25 Oct 2015 21:54:30 +0000 (22:54 +0100)]
NFC: st-nci: Keep st_nci_gates unchanged in load_session

We need to keep initial st_nci_gates values in order for
nci_hci_dev_connect_gates to create and open pipe when necessary.

For example after a firmware update CLF pipes are cleared. Changing
pipe values in st_nci_gates was causing nci_hci_dev_connect_gates
not using accurate pipes value.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st21nfca: Open NFC_HCI_LINK_MGMT_PIPE
Christophe Ricard [Sun, 25 Oct 2015 21:54:29 +0000 (22:54 +0100)]
NFC: st21nfca: Open NFC_HCI_LINK_MGMT_PIPE

NFC_HCI_LINK_MGMT_PIPE was never opened in nfc_hci_load_session.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Open NCI_HCI_LINK_MGMT_PIPE
Christophe Ricard [Sun, 25 Oct 2015 21:54:28 +0000 (22:54 +0100)]
NFC: st-nci: Open NCI_HCI_LINK_MGMT_PIPE

NCI_HCI_LINK_MGMT_PIPE was never opened in st_nci_hci_load_session.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st21nfca: Remove HCI gates initialization in load_session
Christophe Ricard [Sun, 25 Oct 2015 21:54:27 +0000 (22:54 +0100)]
NFC: st21nfca: Remove HCI gates initialization in load_session

hdev->init_data.gates is already initialized in st21nfca_hci_probe.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Remove HCI init_data.gates initialization in load_session
Christophe Ricard [Sun, 25 Oct 2015 21:54:26 +0000 (22:54 +0100)]
NFC: st-nci: Remove HCI init_data.gates initialization in load_session

ndev->hci_dev->init_data.gates is already initialized in
st_nci_hci_network.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: Create pipe on specific gate in nci_hci_connect_gate
Christophe Ricard [Sun, 25 Oct 2015 21:54:25 +0000 (22:54 +0100)]
NFC: nci: Create pipe on specific gate in nci_hci_connect_gate

Some gates might need to have their pipes explicitly created.
Add a call to nci_hci_create_pipe in nci_hci_connect_gate for
every gate that is different than NCI_HCI_LINK_MGMT_GATE or
NCI_HCI_ADMIN_GATE.

In case of an error when opening a pipe, like in hci layer,
delete the pipe if it was created.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: Call nci_hci_clear_all_pipes at HCI initial activation.
Christophe Ricard [Sun, 25 Oct 2015 21:54:24 +0000 (22:54 +0100)]
NFC: nci: Call nci_hci_clear_all_pipes at HCI initial activation.

When session_id is filled to 0xff, the pipe configuration is
probably incorrect and needs to be cleared.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: add nci_hci_clear_all_pipes functions
Christophe Ricard [Sun, 25 Oct 2015 21:54:23 +0000 (22:54 +0100)]
NFC: nci: add nci_hci_clear_all_pipes functions

nci_hci_clear_all_pipes might be use full in some cases
for example after a firmware update.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: extract pipe value using NCI_HCP_MSG_GET_PIPE
Christophe Ricard [Sun, 25 Oct 2015 21:54:22 +0000 (22:54 +0100)]
NFC: nci: extract pipe value using NCI_HCP_MSG_GET_PIPE

When receiving data in nci_hci_msg_rx_work, extract pipe
value using NCI_HCP_MSG_GET_PIPE macro.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: Fix improper management of HCI return code
Christophe Ricard [Sun, 25 Oct 2015 21:54:21 +0000 (22:54 +0100)]
NFC: nci: Fix improper management of HCI return code

When sending HCI data over NCI, HCI return code is part
of the NCI data. In order to get correctly the HCI return
code, we assume the NCI communication is successful and
extract the return code for the nci_hci functions return code.

This is done because nci_to_errno does not match hci return
code value.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: Fix incorrect data chaining when sending data
Christophe Ricard [Sun, 25 Oct 2015 21:54:20 +0000 (22:54 +0100)]
NFC: nci: Fix incorrect data chaining when sending data

When sending HCI data over NCI, cmd information should be
present only on the first packet.
Each packet shall be specifically allocated and sent to the
NCI layer.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Fix incorrect spi buffer size
Christophe Ricard [Sun, 25 Oct 2015 21:54:19 +0000 (22:54 +0100)]
NFC: st-nci: Fix incorrect spi buffer size

When sending data over SPI, the maximum expected length is the maximum
nci packet payload + data header size + the frame head room (1 for the
ndlc header) + the frame trail room (0).

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st21nfca: Align st21nfca driver with other nfc driver
Christophe Ricard [Sun, 25 Oct 2015 21:54:18 +0000 (22:54 +0100)]
NFC: st21nfca: Align st21nfca driver with other nfc driver

Align st21nfca driver with or nfc driver:
- Remove st21nfca_ prefix
- Merge st21nfca_se.h, st21nfca_dep.h in st21nfca.h

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agobnxt_en: Fix compile warnings when CONFIG_INET is not set.
Michael Chan [Mon, 26 Oct 2015 02:27:57 +0000 (22:27 -0400)]
bnxt_en: Fix compile warnings when CONFIG_INET is not set.

bnxt_gro_skb() has unused variables when CONFIG_INET is not set.  We
really cannot support hardware GRO if CONFIG_INET is not set, so
compile out bnxt_gro_skb() completely and define BNXT_FLAG_GRO to be 0
if CONFIG_INET is not set.  This will effectively always disable
hardware GRO if CONFIG_INET is not set.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoNFC: st-nci: include st-nci.h instead of ndlc.h
Christophe Ricard [Sun, 25 Oct 2015 21:54:17 +0000 (22:54 +0100)]
NFC: st-nci: include st-nci.h instead of ndlc.h

st-nci.h already include ndlc.h.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Align st-nci driver with other nfc driver
Christophe Ricard [Mon, 26 Oct 2015 04:55:22 +0000 (05:55 +0100)]
NFC: st-nci: Align st-nci driver with other nfc driver

Align st-nci driver with other NFC drivers:
- Remove st-nci_ prefix
- Merge se.h in st-nci.h

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agonet: encx24j600: Fix mask to update LED configuration
Jon Ringle [Thu, 22 Oct 2015 19:09:04 +0000 (15:09 -0400)]
net: encx24j600: Fix mask to update LED configuration

This fixes the mask used to update the LED configuration so that it clears
the necessary bits as well as setting the bits according to the mask.
Also reverse the LED configuration to show the Link state + collisions in
LEDA and the Link state + TX/RX events in LEDB.

Signed-off-by: Jon Ringle <jringle@gridpoint.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'mvneta-ethtool-stats'
David S. Miller [Mon, 26 Oct 2015 01:20:41 +0000 (18:20 -0700)]
Merge branch 'mvneta-ethtool-stats'

Russell King says:

====================
mvneta ethtool statistics

Sorry for v3 - I forgot to update the commit message on patch 1 as
requested by Marcin.

This short series adds ethtool statistics reporting to mvneta.  Having
discussed with Andrew on IRC, we decided I'd pick up his patch into my
series.

My change for patch 1 compared to the previous RFC splits out the
reading of the statistics from the hardware into a separate function,
in order to facilitate work going on elsewhere to arrange for the
statistics to be preserved across a suspend/resume cycle.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: mvneta: Fix clearing of MIB statistics
Andrew Lunn [Thu, 22 Oct 2015 17:37:36 +0000 (18:37 +0100)]
net: mvneta: Fix clearing of MIB statistics

The existing function to clear the MIB statatistics was using the
wrong address for the registers. Also, the counters would of been
cleared when the interface was brought up, not during the
probe. Fix both of these.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: mvneta: add ethtool statistics
Russell King [Thu, 22 Oct 2015 17:37:30 +0000 (18:37 +0100)]
net: mvneta: add ethtool statistics

Add support for the ethtool statistic interface, returning the full set
of statistics which both Armada 370, 38x and Armada XP can support.

Tested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoBluetooth: Fix locking issue during fast SCO reconnection.
Kuba Pawlak [Mon, 5 Oct 2015 16:44:17 +0000 (18:44 +0200)]
Bluetooth: Fix locking issue during fast SCO reconnection.

When SCO connection is requested and disconnected fast, there is a change
that sco_sock_shutdown is going to preempt thread started in sco_connect_cfm.
When this happens struct sock sk may be removed but a pointer to it is still
held in sco_conn_ready, where embedded spinlock is used. If it is used, but
struct sock has been removed, it will crash.

Block connection object, which will prevent struct sock from being removed
and give connection process chance to finish.

BUG: spinlock bad magic on CPU#0, kworker/u:2H/319
 lock: 0xe3e99434, .magic: f3000000, .owner: (���/0, .owner_cpu: -203804160
Pid: 319, comm: kworker/u:2H Tainted: G           O 3.8.0-115.1-plk-adaptation-byt-ivi-brd #1
Call Trace:
 [<c1155659>] ? do_raw_spin_lock+0x19/0xe9
 [<fb75354f>] ? sco_connect_cfm+0x92/0x236 [bluetooth]
 [<fb731dbc>] ? hci_sync_conn_complete_evt.clone.101+0x18b/0x1cb [bluetooth]
 [<fb734ee7>] ? hci_event_packet+0x1acd/0x21a6 [bluetooth]
 [<c1041095>] ? finish_task_switch+0x50/0x89
 [<c1349a2e>] ? __schedule+0x638/0x6b8
 [<fb727918>] ? hci_rx_work+0xb9/0x2b8 [bluetooth]
 [<c103760a>] ? queue_delayed_work_on+0x21/0x2a
 [<c1035df9>] ? process_one_work+0x157/0x21b
 [<fb72785f>] ? hci_cmd_work+0xef/0xef [bluetooth]
 [<c1036217>] ? worker_thread+0x16e/0x20a
 [<c10360a9>] ? manage_workers+0x1cf/0x1cf
 [<c103a0ef>] ? kthread+0x8d/0x92
 [<c134adf7>] ? ret_from_kernel_thread+0x1b/0x28
 [<c103a062>] ? __init_kthread_worker+0x24/0x24
BUG: unable to handle kernel NULL pointer dereference at   (null)
IP: [<  (null)>]   (null)
*pdpt = 00000000244e1001 *pde = 0000000000000000
Oops: 0010 [#1] PREEMPT SMP
Modules linked in: evdev ecb rfcomm(O) libcomposite usb2380 udc_core bnep(O) btusb(O) btbcm(O) cdc_acm btintel(O) bluetooth(O) arc4 uinput hid_multitouch usbhid hid iwlmvm(O)e
Pid: 319, comm: kworker/u:2H Tainted: G           O 3.8.0-115.1-plk-adaptation-byt-ivi-brd #1
EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 0
EIP is at 0x0
EAX: e3e99400 EBX: e3e99400 ECX: 00000100 EDX: 00000000
ESI: e3e99434 EDI: fb763ce0 EBP: e49b9e44 ESP: e49b9e14
 DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
CR0: 8005003b CR2: 00000000 CR3: 24444000 CR4: 001007f0
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: ffff0ff0 DR7: 00000400
Process kworker/u:2H (pid: 319, ti=e49b8000 task=e4ab9030 task.ti=e49b8000)
Stack:
 fb75355b 00000246 fb763900 22222222 22222222 22222222 e3f94460 e3ca7c0a
 e49b9e4c e3f34c00 e3ca7c0a fb763ce0 e49b9e6c fb731dbc 02000246 e4cec85c
 e4cec008 00000000 e3f34c00 e4cec000 e3c2ce00 0000002c e49b9ed0 fb734ee7
Call Trace:
 [<fb75355b>] ? sco_connect_cfm+0x9e/0x236 [bluetooth]
 [<fb731dbc>] ? hci_sync_conn_complete_evt.clone.101+0x18b/0x1cb [bluetooth]
 [<fb734ee7>] ? hci_event_packet+0x1acd/0x21a6 [bluetooth]
 [<c1041095>] ? finish_task_switch+0x50/0x89
 [<c1349a2e>] ? __schedule+0x638/0x6b8
 [<fb727918>] ? hci_rx_work+0xb9/0x2b8 [bluetooth]
 [<c103760a>] ? queue_delayed_work_on+0x21/0x2a
 [<c1035df9>] ? process_one_work+0x157/0x21b
 [<fb72785f>] ? hci_cmd_work+0xef/0xef [bluetooth]
 [<c1036217>] ? worker_thread+0x16e/0x20a
 [<c10360a9>] ? manage_workers+0x1cf/0x1cf
 [<c103a0ef>] ? kthread+0x8d/0x92
 [<c134adf7>] ? ret_from_kernel_thread+0x1b/0x28
 [<c103a062>] ? __init_kthread_worker+0x24/0x24
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:e49b9e14
CR2: 0000000000000000
---[ end trace 942a6577c0abd725 ]---

Signed-off-by: Kuba Pawlak <kubax.t.pawlak@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
8 years agoBluetooth: Fix locking issue on SCO disconnection
Kuba Pawlak [Mon, 5 Oct 2015 16:44:16 +0000 (18:44 +0200)]
Bluetooth: Fix locking issue on SCO disconnection

Thread handling SCO disconnection may get preempted in '__sco_sock_close'
after dropping a reference to hci_conn but before marking this as NULL
in associated struct sco_conn. When execution returs to this thread,
this connection will possibly be released, resulting in kernel crash

Lock connection before this point.

BUG: unable to handle kernel NULL pointer dereference at   (null)
IP: [<fb770ab9>] __sco_sock_close+0x194/0x1ff [bluetooth]
*pdpt = 0000000023da6001 *pde = 0000000000000000
Oops: 0002 [#1] PREEMPT SMP
Modules linked in: evdev ecb rfcomm(O) libcomposite usb2380 udc_core bnep(O) btusb(O) btbcm(O) cdc_acm btintel(O) bluetooth(O) arc4 uinput hid_multitouch usbhid iwlmvm(O) hide
Pid: 984, comm: bluetooth Tainted: G           O 3.8.0-115.1-plk-adaptation-byt-ivi-brd #1
EIP: 0060:[<fb770ab9>] EFLAGS: 00010282 CPU: 2
EIP is at __sco_sock_close+0x194/0x1ff [bluetooth]
EAX: 00000000 EBX: e49d7600 ECX: ef1ec3c2 EDX: 000000c3
ESI: e4c12000 EDI: 00000000 EBP: ef1edf5c ESP: ef1edf4c
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
CR0: 80050033 CR2: 00000000 CR3: 23da7000 CR4: 001007f0
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: ffff0ff0 DR7: 00000400
Process bluetooth (pid: 984, ti=ef1ec000 task=e47f2550 task.ti=ef1ec000)
Stack:
 e4c120d0 e49d7600 00000000 08421a40 ef1edf70 fb770b7a 00000002 e8a4cc80
 08421a40 ef1ec000 c12966b1 00000001 00000000 0000000b 084954c8 c1296b6c
 0000001b 00000002 0000001b 00000002 00000000 00000002 b2524880 00000046
Call Trace:
 [<fb770b7a>] ? sco_sock_shutdown+0x56/0x95 [bluetooth]
 [<c12966b1>] ? sys_shutdown+0x37/0x53
 [<c1296b6c>] ? sys_socketcall+0x12e/0x1be
 [<c134ae7e>] ? sysenter_do_call+0x12/0x26
 [<c1340000>] ? ip_vs_control_net_cleanup+0x46/0xb1
Code: e8 90 6b 8c c5 f6 05 72 5d 78 fb 04 74 17 8b 46 08 50 56 68 0a fd 77 fb 68 60 5d 78 fb e8 68 95 9e c5 83 c4 10 8b 83 fc 01 00 00 <c7> 00 00 00 00 00 eb 32 ba 68 00 00 0b
EIP: [<fb770ab9>] __sco_sock_close+0x194/0x1ff [bluetooth] SS:ESP 0068:ef1edf4c
CR2: 0000000000000000
---[ end trace 47fa2f55a9544e69 ]---

Signed-off-by: Kuba Pawlak <kubax.t.pawlak@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
8 years agoBluetooth: Fix crash on SCO disconnect
Kuba Pawlak [Mon, 5 Oct 2015 16:44:15 +0000 (18:44 +0200)]
Bluetooth: Fix crash on SCO disconnect

When disconnecting audio from the phone's side, it may happen, that
a thread handling HCI message 'disconnection complete' will get preempted
in 'sco_conn_del' before calling 'sco_sock_kill', still holding a pointer
to struct sock sk. Interrupting thread started in 'sco_sock_shutdown' will
carry on releasing resources and will eventually release struct sock.
When execution goes back to first thread it will call sco_sock_kill using
now invalid pointer to already destroyed socket.

Fix is to grab a reference to the socket a release it after calling
'sco_sock_kill'.

[  166.358213] BUG: unable to handle kernel paging request at 7541203a
[  166.365228] IP: [<fb6e8bfb>] bt_sock_unlink+0x1a/0x38 [bluetooth]
[  166.372068] *pdpt = 0000000024b19001 *pde = 0000000000000000
[  166.378483] Oops: 0002 [#1] PREEMPT SMP
[  166.382871] Modules linked in: evdev ecb rfcomm(O) libcomposite usb2380 udc_core bnep(O) btusb(O) btbcm(O) btintel(O) cdc_acm bluetooth(O) arc4 uinput hid_multitouch iwlmvm(O) usbhid hide
[  166.424233] Pid: 338, comm: kworker/u:2H Tainted: G           O 3.8.0-115.1-plk-adaptation-byt-ivi-brd #1
[  166.435112] EIP: 0060:[<fb6e8bfb>] EFLAGS: 00010206 CPU: 0
[  166.441259] EIP is at bt_sock_unlink+0x1a/0x38 [bluetooth]
[  166.447382] EAX: 632e6563 EBX: e4bfc600 ECX: e466d4d3 EDX: 7541203a
[  166.454369] ESI: fb7278ac EDI: e4d52000 EBP: e4669e20 ESP: e4669e0c
[  166.461366]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
[  166.467391] CR0: 8005003b CR2: 7541203a CR3: 24aba000 CR4: 001007f0
[  166.474387] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[  166.481375] DR6: ffff0ff0 DR7: 00000400
[  166.485654] Process kworker/u:2H (pid: 338, ti=e4668000 task=e466e030 task.ti=e4668000)
[  166.494591] Stack:
[  166.496830]  e4bfc600 e4bfc600 fb715c28 e4717ee0 e4d52000 e4669e3c fb715cf3 e4bfc634
[  166.505518]  00000068 e4d52000 e4c32000 fb7277c0 e4669e6c fb6f2019 0000004a 00000216
[  166.514205]  e4660101 e4c32008 02000001 00000013 e4d52000 e4c32000 e3dc9240 00000005
[  166.522891] Call Trace:
[  166.525654]  [<fb715c28>] ? sco_sock_kill+0x73/0x9a [bluetooth]
[  166.532295]  [<fb715cf3>] ? sco_conn_del+0xa4/0xbf [bluetooth]
[  166.538836]  [<fb6f2019>] ? hci_disconn_complete_evt.clone.55+0x1bd/0x205 [bluetooth]
[  166.547609]  [<fb6f73d3>] ? hci_event_packet+0x297/0x223c [bluetooth]
[  166.554805]  [<c10416da>] ? dequeue_task+0xaf/0xb7
[  166.560154]  [<c1041095>] ? finish_task_switch+0x50/0x89
[  166.566086]  [<c1349a2e>] ? __schedule+0x638/0x6b8
[  166.571460]  [<fb6eb906>] ? hci_rx_work+0xb9/0x2b8 [bluetooth]
[  166.577975]  [<c1035df9>] ? process_one_work+0x157/0x21b
[  166.583933]  [<fb6eb84d>] ? hci_cmd_work+0xef/0xef [bluetooth]
[  166.590448]  [<c1036217>] ? worker_thread+0x16e/0x20a
[  166.596088]  [<c10360a9>] ? manage_workers+0x1cf/0x1cf
[  166.601826]  [<c103a0ef>] ? kthread+0x8d/0x92
[  166.606691]  [<c134adf7>] ? ret_from_kernel_thread+0x1b/0x28
[  166.613010]  [<c103a062>] ? __init_kthread_worker+0x24/0x24
[  166.619230] Code: 85 63 ff ff ff 31 db 8d 65 f4 89 d8 5b 5e 5f 5d c3 56 8d 70 04 53 89 f0 89 d3 e8 7e 17 c6 c5 8b 53 28 85 d2 74 1a 8b 43 24 85 c0 <89> 02 74 03 89 50 04 c7 43 28 00 00 00
[  166.640501] EIP: [<fb6e8bfb>] bt_sock_unlink+0x1a/0x38 [bluetooth] SS:ESP 0068:e4669e0c
[  166.649474] CR2: 000000007541203a
[  166.653420] ---[ end trace 0181ff2c9e42d51e ]---
[  166.658609] note: kworker/u:2H[338] exited with preempt_count 1

Signed-off-by: Kuba Pawlak <kubax.t.pawlak@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
8 years agoBluetooth: btmrvl: add missing of_node_put
Julia Lawall [Sat, 24 Oct 2015 14:42:32 +0000 (16:42 +0200)]
Bluetooth: btmrvl: add missing of_node_put

for_each_compatible_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

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

// <smpl>
@@
expression e;
local idexpression n;
@@

 for_each_compatible_node(n, ...) {
   ... when != of_node_put(n)
       when != e = n
(
   return n;
|
+  of_node_put(n);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
8 years agoNFC: Add Intel Fields Peak NFC solution driver
Robert Dolca [Thu, 22 Oct 2015 09:11:42 +0000 (12:11 +0300)]
NFC: Add Intel Fields Peak NFC solution driver

Fields Peak complies with the ISO/IEC 14443A/B, 15693, 18092,
and JIS X 6319-4. It is an NCI based controller.

RF Protocols supported:
 - NFC Forum Type 1 Tags (Jewel, Topaz)
 - NFC Forum Type 2 Tags (Mifare UL)
 - NFC Forum Type 3 Tags (FeliCa)
 - NFC Forum Type 4A (ISO/IEC 14443 A-4 106kbps to 848kbps)
 - NFC Forum Type 4B (ISO/IEC 14443 B-4 106kbps to 848kbps)
 - NFCIP in passive and active modes (ISO/IEC 18092 106kbps
   to 424kbps)
 - B’ (based on ISO/IEC 14443 B-2)
 - iCLASS (based on ISO/IEC 15693-2)
 - Vicinity cards (ISO/IEC 15693-3)
 - Kovio tags (NFC Forum Type 2)

The device can be enumerated using ACPI using the id INT339A.
The 1st GPIO is the IRQ and the 2nd is the RESET pin.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: add nci_get_conn_info_by_id function
Robert Dolca [Thu, 22 Oct 2015 09:11:41 +0000 (12:11 +0300)]
NFC: nci: add nci_get_conn_info_by_id function

This functin takes as a parameter a pointer to the nci_dev
struct and the first byte from the values of the first domain
specific parameter that was used for the connection creation.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: fix possible crash in nci_core_conn_create
Robert Dolca [Thu, 22 Oct 2015 09:11:40 +0000 (12:11 +0300)]
NFC: nci: fix possible crash in nci_core_conn_create

If the number of destination speific parameters supplied is 0
the call will fail. If the first destination specific parameter
does not have a value, curr_id will be set to 0.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: rename nci_prop_ops to nci_driver_ops
Robert Dolca [Thu, 22 Oct 2015 09:11:39 +0000 (12:11 +0300)]
NFC: nci: rename nci_prop_ops to nci_driver_ops

Initially it was used to create hooks in the driver for
proprietary operations. Currently it is being used for hooks
for both proprietary and generic operations.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: Allow the driver to set handler for core nci ops
Robert Dolca [Thu, 22 Oct 2015 09:11:38 +0000 (12:11 +0300)]
NFC: nci: Allow the driver to set handler for core nci ops

The driver may be required to act when some responses or
notifications arrive. For example the NCI core does not have a
handler for NCI_OP_CORE_GET_CONFIG_RSP. The NFCC can send a
config response that has to be read by the driver and the packet
may contain vendor specific data.

The Fields Peak driver needs to take certain actions when a reset
notification arrives (packet also not handled by the nfc core).

The driver handlers do not interfere with the core and they are
called after the core processes the packet.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: Introduce nci_core_cmd
Robert Dolca [Thu, 22 Oct 2015 09:11:37 +0000 (12:11 +0300)]
NFC: nci: Introduce nci_core_cmd

This allows sending core commands from the driver. The driver
should be able to send NCI core commands like CORE_GET_CONFIG_CMD.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: Do not call post_setup when setup fails
Robert Dolca [Thu, 22 Oct 2015 09:11:36 +0000 (12:11 +0300)]
NFC: nci: Do not call post_setup when setup fails

The driver should know that it can continue with post setup where
setup left off. Being able to execute post_setup when setup fails
may force the developer to keep this state in the driver.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: Introduce new core opcodes
Robert Dolca [Thu, 22 Oct 2015 09:11:35 +0000 (12:11 +0300)]
NFC: nci: Introduce new core opcodes

Add NCI_OP_CORE_GET_CONFIG_CMD, NCI_OP_CORE_GET_CONFIG_RSP
and NCI_OP_CORE_RESET_NTF.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: Add function to get max packet size for conn
Robert Dolca [Thu, 22 Oct 2015 09:11:34 +0000 (12:11 +0300)]
NFC: nci: Add function to get max packet size for conn

FDP driver needs to send the firmware as regular packets
(not fragmented). The driver should have a way to
get the max packet size for a given connection.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: nci: Export nci data send API
Robert Dolca [Thu, 22 Oct 2015 09:11:33 +0000 (12:11 +0300)]
NFC: nci: Export nci data send API

For the firmware update the driver may use nci_send_data.

Signed-off-by: Robert Dolca <robert.dolca@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoNFC: st-nci: Rename st-nci_se.c
Samuel Ortiz [Fri, 23 Oct 2015 15:05:37 +0000 (17:05 +0200)]
NFC: st-nci: Rename st-nci_se.c

Rename it to se.c to keep the driver files namespace consistent.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8 years agoaf_unix: do not report POLLOUT on listeners
Eric Dumazet [Fri, 23 Oct 2015 17:59:16 +0000 (10:59 -0700)]
af_unix: do not report POLLOUT on listeners

poll(POLLOUT) on a listener should not report fd is ready for
a write().

This would break some applications using poll() and pfd.events = -1,
as they would not block in poll()

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Alan Burlison <Alan.Burlison@oracle.com>
Tested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: link_is_bc_sndlink() can be static
Wu Fengguang [Sat, 24 Oct 2015 14:56:01 +0000 (22:56 +0800)]
tipc: link_is_bc_sndlink() can be static

TO: "David S. Miller" <davem@davemloft.net>
CC: netdev@vger.kernel.org
CC: Jon Maloy <jon.maloy@ericsson.com>
CC: Ying Xue <ying.xue@windriver.com>
CC: tipc-discussion@lists.sourceforge.net
CC: linux-kernel@vger.kernel.org
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoiwlwifi: nvm: free old section data when reading nvm file
Moshe Harel [Thu, 10 Sep 2015 12:29:09 +0000 (15:29 +0300)]
iwlwifi: nvm: free old section data when reading nvm file

When reading external NVM file, if a section exists both in OTP
and in the external file, the memory that was allocated at OTP
reading is not freed.
This is possible only on systems that have an external NVM
file which is typically the case on embedded systems.

Signed-off-by: Moshe Harel <moshe.harel@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: disable TDLS ac queues correctly
Arik Nemtsov [Mon, 12 Oct 2015 11:47:11 +0000 (14:47 +0300)]
iwlwifi: mvm: disable TDLS ac queues correctly

The iwl_mvm_disable_queue function requires the TID to be set to
IWL_MAX_TID_COUNT when disabling an AC queue. Call it correctly for TDLS
scenarios.

Fixes: 4ecafae9e568 ("iwlwifi: mvm: support using multiple ACs on single HW queue")
Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: take scan ref only on success
Eliad Peller [Thu, 15 Oct 2015 07:58:48 +0000 (10:58 +0300)]
iwlwifi: mvm: take scan ref only on success

In some cases, scan reference was taken, but wasn't
released even though scan command wasn't actually issued.

Change the current code to simply take the reference
only on success.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: remove pointless scan plan checks
Johannes Berg [Fri, 11 Sep 2015 10:07:21 +0000 (12:07 +0200)]
iwlwifi: mvm: remove pointless scan plan checks

As cfg80211 already enforces these limits, there's little point
in having them again here in our code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: clean up some whitespace in scan code
Johannes Berg [Fri, 11 Sep 2015 10:09:22 +0000 (12:09 +0200)]
iwlwifi: mvm: clean up some whitespace in scan code

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Implement per vif frame registration API
Andrei Otcheretianski [Tue, 30 Jun 2015 09:08:28 +0000 (12:08 +0300)]
iwlwifi: mvm: Implement per vif frame registration API

Implement config_iface_filter() driver op. Currently support only
probe request registration for p2p client vifs, by setting
MAC_FILTER_IN_PROBE_REQUEST flag in MAC_CONTEXT_CMD.
This is needed since WFDS spec and certification require a P2P client
to be discoverable on its operating channel.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: avoid read/write operations if the bus is dead
Eliad Peller [Thu, 10 Sep 2015 12:00:22 +0000 (15:00 +0300)]
iwlwifi: avoid read/write operations if the bus is dead

Recovery takes too much time if the bus is dead (each timeout
is 2000ms, etc.).
Explicitly skip fw dump in this case, as it will result in
garbage data (and might take signifcant time)

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Add support for two scheduled scan plans
Avraham Stern [Wed, 19 Aug 2015 09:46:12 +0000 (12:46 +0300)]
iwlwifi: mvm: Add support for two scheduled scan plans

Add support for two scan plans for scheduled scan. The first plan
will run for a limited number of iterations, then the second plan
will run infinitely.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: let any command flag be passed to iwl_mvm_flushtx_path()
Luca Coelho [Tue, 6 Oct 2015 06:54:57 +0000 (09:54 +0300)]
iwlwifi: mvm: let any command flag be passed to iwl_mvm_flushtx_path()

Instead of only allowing the caller to decide whether the CMD_ASYNC
flag is set, let it pass the entire flags bitmask.  This allows more
flexibility and will be needed when we call this function in the
suspend flow (where other flags are needed).

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Allow setting ctrl-chnl-position in FTM responder
Assaf Krauss [Wed, 12 Aug 2015 14:52:12 +0000 (17:52 +0300)]
iwlwifi: mvm: Allow setting ctrl-chnl-position in FTM responder

This patch enables the debugfs user to configure an FTM responder
with the appropriate control channel position.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: use short timeouts in P2P low latency if supported
Johannes Berg [Tue, 6 Oct 2015 12:07:44 +0000 (14:07 +0200)]
iwlwifi: mvm: use short timeouts in P2P low latency if supported

Those timeouts are used for AM-to-PSM transition.
We already have those pairs defined for default and WOWLAN use cases.
We expect that by using shorter threshold for low latency P2P,
e.g. for Miracast video scenario, we might save a considerable amount of power.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: use wowlan RX/TX timeouts in D0i3
Johannes Berg [Tue, 6 Oct 2015 11:28:48 +0000 (13:28 +0200)]
iwlwifi: mvm: use wowlan RX/TX timeouts in D0i3

In "hostless" mode (D3 or D0i3) the same parameters were intended
to be used, but the code doesn't do that properly. Fix it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: correctly request DTS-measure for new cards
Arik Nemtsov [Tue, 6 Oct 2015 09:22:47 +0000 (12:22 +0300)]
iwlwifi: mvm: correctly request DTS-measure for new cards

Since the 8000 series, the DTS measurement request command has been
changed. Use an ucode capability flag to determine which version is
supported and send the extended command when needed.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: fix (again) prepare card flow
Emmanuel Grumbach [Wed, 21 Oct 2015 16:55:32 +0000 (19:55 +0300)]
iwlwifi: pcie: fix (again) prepare card flow

The hardware bug in the commit mentioned below forces us
not to re-enable the clock gating in the Host Cluster.
The impact on the power consumption is minimal and it allows
the WAKE_ME interrupt to propagate.

CC: <stable@vger.kernel.org> [4.1+]
Fixes: c9fdec9f3970 ("iwlwifi: pcie: fix prepare card flow")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Dump FW's virtual image in the case of a NIC error
Matti Gottlieb [Mon, 20 Jul 2015 14:55:51 +0000 (17:55 +0300)]
iwlwifi: mvm: Dump FW's virtual image in the case of a NIC error

When paging is enabled the driver stores part of the FW's
image in the DRAM.

Dump FW's virtual image in the case of a NIC error.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: rs: Remove workaround that disables MIMO on P2P
Alexander Bondar [Thu, 3 Sep 2015 12:42:09 +0000 (15:42 +0300)]
iwlwifi: rs: Remove workaround that disables MIMO on P2P

Remove an old workaround that's no longer needed and
enable MIMO on P2P interfaces.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoMerge remote-tracking branch 'mac80211-next/master' into next
Emmanuel Grumbach [Sun, 25 Oct 2015 10:38:20 +0000 (12:38 +0200)]
Merge remote-tracking branch 'mac80211-next/master' into next

8 years agoMerge branch 'tipc-next'
David S. Miller [Sat, 24 Oct 2015 13:56:54 +0000 (06:56 -0700)]
Merge branch 'tipc-next'

Jon Maloy says:

====================
tipc: improve broadcast implementation

The TIPC broadcast link implementation is currently complex and hard to
follow. It also incurs some amount of code and structure duplication,
something that can be reduced significantly with a little effort.

This commit series introduces a number of improvements which address
both the locking structure, the code/structure duplication issue, and
the overall readbility of the code.

The series consists of three main parts:

1-7: Adaptation to the new link structure, and preparation for the next
     step. In particular, we want the broadcast transmission link to
     have a life cycle that is longer than any of its potential (unicast
     and broadcast receive links) users. This eliminates the need to
     always test for the presence of this link before accessing it.

8-10: This is what is really new in this series. Commit #9 is by far
      the largest and most important one, because it moves most of
      the broadcast functionality into link.c, partially reusing the
      fields and functionality of the unicast link. The removal of
      the "node_map" infrastructure in commit #10 is also an important
      achievement.

11-16: Some improvements leveraging the changes made in the previous
       commits.

The series needs commit 53387c4e22ac ("tipc: extend broadcast link window size")
and commit e53567948f82 ("tipc: conditionally expand buffer headroom over udp tunnel")
which are both present in 'net' but not yet in 'net-next', to apply cleanly.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: clean up unused code and structures
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:48 +0000 (08:51 -0400)]
tipc: clean up unused code and structures

After the previous changes in this series, we can now remove some
unused code and structures, both in the broadcast, link aggregation
and link code.

There are no functional changes in this commit.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: ensure binding table initial distribution is sent via first link
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:47 +0000 (08:51 -0400)]
tipc: ensure binding table initial distribution is sent via first link

Correct synchronization of the broadcast link at first contact between
two nodes is dependent on the assumption that the binding table "bulk"
update passes via the same link as the initial broadcast syncronization
message, i.e., via the first link that is established.

This is not guaranteed in the current implementation. If two link
come up very close to each other in time, the "bulk" may quite well
pass via the second link, and hence void the guarantee of a correct
initial synchronization before the broadcast link is opened.

This commit makes two small changes to strengthen this guarantee.

1) We let the second established link occupy slot 1 of the
   "active_links" array, while the first link will retain slot 0.
   (This is in reality a cosmetic change, we could just as well keep
    the current, opposite order)

2) We let the name distributor always use link selector/slot 0 when
   it sends it binding table updates.

The extra traffic bias on the first link caused by this change should
be negligible, since binding table updates constitutes a very small
fraction of the total traffic.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: eliminate link's reference to owner node
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:46 +0000 (08:51 -0400)]
tipc: eliminate link's reference to owner node

With the recent commit series, we have established a one-way dependency
between the link aggregation (struct tipc_node) instances and their
pertaining tipc_link instances. This has enabled quite significant code
and structure simplifications.

In this commit, we eliminate the field 'owner', which points to an
instance of struct tipc_node, from struct tipc_link, and replace it with
a pointer to struct net, which is the only external reference now needed
by a link instance.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: eliminate redundant buffer cloning at transmission
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:45 +0000 (08:51 -0400)]
tipc: eliminate redundant buffer cloning at transmission

Since all packet transmitters (link, bcast, discovery) are now sending
consumable buffer clones to the bearer layer, we can remove the
redundant buffer cloning that is perfomed in the lower level functions
tipc_l2_send_msg() and tipc_udp_send_msg().

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: let neighbor discoverer tranmsit consumable buffers
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:44 +0000 (08:51 -0400)]
tipc: let neighbor discoverer tranmsit consumable buffers

The neighbor discovery function currently uses the function
tipc_bearer_send() for transmitting packets, assuming that the
sent buffers are not consumed by the called function.

We want to change this, in order to avoid unnecessary buffer cloning
elswhere in the code.

This commit introduces a new function tipc_bearer_skb() which consumes
the sent buffers, and let the discoverer functions use this new call
instead. The discoverer does now itself perform the cloning when
that is necessary.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: introduce jumbo frame support for broadcast
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:43 +0000 (08:51 -0400)]
tipc: introduce jumbo frame support for broadcast

Until now, we have only been supporting a fix MTU size of 1500 bytes
for all broadcast media, irrespective of their actual capability.

We now make the broadcast MTU adaptable to the carrying media, i.e.,
we use the smallest MTU supported by any of the interfaces attached
to TIPC.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: simplify bearer level broadcast
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:42 +0000 (08:51 -0400)]
tipc: simplify bearer level broadcast

Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.

A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.

This commit introduces these changes.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: let broadcast packet reception use new link receive function
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:41 +0000 (08:51 -0400)]
tipc: let broadcast packet reception use new link receive function

The code path for receiving broadcast packets is currently distinct
from the unicast path. This leads to unnecessary code and data
duplication, something that can be avoided with some effort.

We now introduce separate per-peer tipc_link instances for handling
broadcast packet reception. Each receive link keeps a pointer to the
common, single, broadcast link instance, and can hence handle release
and retransmission of send buffers as if they belonged to the own
instance.

Furthermore, we let each unicast link instance keep a reference to both
the pertaining broadcast receive link, and to the common send link.
This makes it possible for the unicast links to easily access data for
broadcast link synchronization, as well as for carrying acknowledges for
received broadcast packets.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: introduce capability bit for broadcast synchronization
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:40 +0000 (08:51 -0400)]
tipc: introduce capability bit for broadcast synchronization

Until now, we have tried to support both the newer, dedicated broadcast
synchronization mechanism along with the older, less safe, RESET_MSG/
ACTIVATE_MSG based one. The latter method has turned out to be a hazard
in a highly dynamic cluster, so we find it safer to disable it completely
when we find that the former mechanism is supported by the peer node.

For this purpose, we now introduce a new capabability bit,
TIPC_BCAST_SYNCH, to inform any peer nodes that dedicated broadcast
syncronization is supported by the present node. The new bit is conveyed
between peers in the 'capabilities' field of neighbor discovery messages.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: let broadcast transmission use new link transmit function
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:39 +0000 (08:51 -0400)]
tipc: let broadcast transmission use new link transmit function

This commit simplifies the broadcast link transmission function, by
leveraging previous changes to the link transmission function and the
broadcast transmission link life cycle.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: make struct tipc_link generic to support broadcast
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:38 +0000 (08:51 -0400)]
tipc: make struct tipc_link generic to support broadcast

Realizing that unicast is just a special case of broadcast, we also see
that we can go in the other direction, i.e., that modest changes to the
current unicast link can make it generic enough to support broadcast.

The following changes are introduced here:

- A new counter ("ackers") in struct tipc_link, to indicate how many
  peers need to ack a packet before it can be released.
- A corresponding counter in the skb user area, to keep track of how
  many peers a are left to ack before a buffer can be released.
- A new counter ("acked"), to keep persistent track of how far a peer
  has acked at the moment, i.e., where in the transmission queue to
  start updating buffers when the next ack arrives. This is to avoid
  double acknowledgements from a peer, with inadvertent relase of
  packets as a result.
- A more generic tipc_link_retrans() function, where retransmit starts
  from a given sequence number, instead of the first packet in the
  transmision queue. This is to minimize the number of retransmitted
  packets on the broadcast media.

When the new functionality is taken into use in the next commits,
we expect it to have minimal effect on unicast mode performance.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotipc: use explicit allocation of broadcast send link
Jon Paul Maloy [Thu, 22 Oct 2015 12:51:37 +0000 (08:51 -0400)]
tipc: use explicit allocation of broadcast send link

The broadcast link instance (struct tipc_link) used for sending is
currently aggregated into struct tipc_bclink. This means that we cannot
use the regular tipc_link_create() function for initiating the link, but
do instead have to initiate numerous fields directly from the
bcast_init() function.

We want to reduce dependencies between the broadcast functionality
and the inner workings of tipc_link. In this commit, we introduce
a new function tipc_bclink_create() to link.c, and allocate the
instance of the link separately using this function.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>