Commit Graph

521232 Commits

Author SHA1 Message Date
Markus Pargmann
e8ad3b1acf batman-adv: main, Convert is_my_mac() to bool
It is much clearer to see a bool type as return value than 'int' for
functions that are supposed to return true or false.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03 15:57:24 +02:00
Sven Eckelmann
a0c77227ff batman-adv: Remove unnecessary check for orig_ifinfo not NULL
orig_ifinfo is dereferenced multiple times in batadv_iv_ogm_update_seqnos
before the check for NULL is done. The function also exists at the
beginning when orig_ifinfo would have been NULL. This makes the check at
the end unnecessary and only confuses the reader/code analyzers.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03 15:57:23 +02:00
Markus Pargmann
21102626da batman-adv: types, Fix comment on bcast_own
batadv_orig_bat_iv->bcast_own is actually not a bitfield, it is an
array. Adjust the comment accordingly.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03 15:57:23 +02:00
Yanir Lubetkin
529498cde0 e1000e: Bump the version to 3.2.5
Bump the version to reflect the driver changes and bug fixes for i219.
Also update the copyright, while we are at it.

Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-06-03 04:13:39 -07:00
Yanir Lubetkin
2ec7d2974c e1000e: fix unit hang during loopback test
System would hang during execution of "ethtool -t <NIC>" for the same
reason that required flushing the descriptor rings. This fix disables
MULR for the loopback test to avoid the hang state.

Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-06-03 04:11:21 -07:00
Yanir Lubetkin
83129b37ef e1000e: fix systim issues
Two issues involving systim were reported.
1. Clock is not running in the correct frequency
2. In some situations, systim values were not incremented linearly
This patch fixes the hardware clock configuration and the spurious
non-linear increment.

Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-06-03 04:06:56 -07:00
Yanir Lubetkin
ec945cfbbf e1000e: fix legacy interrupt handling in i219
This fix handles a hardware issue that prevented i219 from
working in legacy interrupts mode (IntMode=0)

Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-06-03 04:02:39 -07:00
Yanir Lubetkin
ff9174291e e1000e: fix flush_desc_ring implementation
The indication that a descriptor ring flush is required was read from
FEXTNVM7 by mistake. It should be read from the PCI config space.

Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-06-03 03:38:01 -07:00
Yanir Lubetkin
95f0d95046 e1000e: fix logical error in flush_desc_rings
The condition under which the flush should occur was reversed.  The fix
should be applied before any HW reset (unless followed by bus reset)
and before any power state transition from D0.

If E1000_FEXTNVM7_NEED_DESCRING_FLUSH bit is set in FEXTNVM7 and TDLEN > 0
the Tx ring should be flushed. (fixes ~95% of the hang states).
If the E1000_FEXTNVM7_NEED_DESCRING_FLUSH did not clear, we should also
flush the RX ring. Bug was caught by Alexander Duyck during a code review
when examining this fix.

Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-06-03 03:29:52 -07:00
Yanir Lubetkin
bfc9473bf9 e1000e: remove call to do_div and sign mismatch warning
Fixes a warning that was reported by Yanjiang Jin
<yanjiang.jin@windriver.com> by implementing the solution suggested by
Alexander Duyck <alexander.h.duyck@redhat.com>.

Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-06-03 03:24:42 -07:00
Yanir Lubetkin
0ffc56464b e1000e: i219 execute unit hang fix on every reset or power state transition
After testing various cases, the conclusion is that the fix MUST be
executed BEFORE any event that the HW is reset or transition to D3.
To fix that I moved the execution to the relevant places but per
Alexander Duyck's review, ensure now that the DMA is valid and was not
freed before manipulating the ring.

Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-06-03 03:21:30 -07:00
Yanir Lubetkin
ad851fbb73 e1000e: i219 fix unit hang on reset and runtime D3
Unit hang may occur if multiple descriptors are available in the rings
during reset or runtime suspend. This state can be detected by testing
bit 8 in the FEXTNVM7 register. If this bit is set and there are pending
descriptors in one of the rings, we must flush them prior to reset. Same
applies entering runtime suspend.

Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Reviewed-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-06-03 03:10:20 -07:00
Kalle Valo
1690faef64 * a few fixes (re-enablement of interrupts for certain new
platforms that have special power states)
 * Rework completely the RBD allocation model towards new
   multi RX hardware.
 * cleanups
 * scan reworks continuation (Luca)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVbrcWAAoJEC0Llv5uNjIB/I8P/iY3Cz+1pZY8yPnHPIxzGh0Q
 wGcZoiDGjVcblFkMzx9mvtMkBc/3Nb+e0UBKkzBH5DIwOHEum1Bf2fO+HQgKT4r+
 xMD5vJ8dtpG++38UK90ouAW3UbSmcq21gUaKNZJtt6CThAuXuqtQthqrB+MC0L0p
 VMix1+eY4MfsP6YKjszeLTro2RMjadKjGcmW5g1y5CI8yYyZIvN/J9m5Mdq9oixx
 1RE8A7HNE6si22GUSuUm5l1Nb4kvCOsHvnERtMigy/lgsRyfVaKiwkFF9aEJRqpr
 GxZ0yZivMVzi6cdx9wGZz0iTRAA+nwIjK5dUiHKTVrG/j4M0NFqTXHkJCR5T4wv0
 Lsd8AT4d3u2ipu/g+pZhsMzhl2WPdoTfQWvN/iT4VBTYiZzAHaK9eOxa0Qn92NAR
 uQAEx9bvF3mxfGTiL/E01DTd2CglxcQ8Xx/PPxrFR9X2xCD46o5t7z9KoZdLgK1z
 0DZJ/EMjwYZnB/pepe2OyeGR34QLY83N/pJiUMLHoDL7tyc7Gu02RtQ6JxzMoqf3
 K6G2QSbD33CBvUL/InmDgeNcGzrxle6jme7ErwKpa4AmgnYaMfL0fY9LU5OclKkr
 87nrapL4WffopCP8eQNdu0oLP74IHFyePdt8+bgwqMK5iUVTBXPYepdCDAey3IWI
 mv5621I/XDlg4nKO0fnL
 =9GDL
 -----END PGP SIGNATURE-----

Merge tag 'iwlwifi-next-for-kalle-2015-06-03' of https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next

* a few fixes (re-enablement of interrupts for certain new
  platforms that have special power states)
* Rework completely the RBD allocation model towards new
  multi RX hardware.
* cleanups
* scan reworks continuation (Luca)
2015-06-03 12:15:51 +03:00
Markus Pargmann
d491dbb68b batman-adv: iv_ogm, fix comment function name
This is a small copy paste fix for batadv_ing_buffer_avg.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03 10:58:32 +02:00
Markus Pargmann
6c4a1622e2 batman-adv: iv_ogm, fix coding style
The kernel coding style says, that there should not be multiple
assignments in one row.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03 10:58:31 +02:00
Markus Pargmann
9f52ee19c3 batman-adv: iv_ogm, Fix dup_status comment
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03 10:58:31 +02:00
Markus Pargmann
23badd6dbe batman-adv: iv_ogm_orig_update, style, add missing brackets
CodingStyle describes that either none or both branches of a conditional
have to have brackets.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03 10:58:31 +02:00
Markus Pargmann
564891510e batman-adv: iv_ogm_queue_add, Simplify expressions
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03 10:58:30 +02:00
Markus Pargmann
940d156f52 batman-adv: iv_ogm_aggregate_new, simplify error handling
It is just a bit easier to put the error handling at one place and let
multiple error paths use the same calls.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
2015-06-03 10:58:30 +02:00
Johannes Berg
5f4c02e2b8 iwlwifi: mvm: advertise only HW-supported ciphers
After the new ciphers CCMP-256 and GCMP-128/256 were implemented,
wpa_supplicant could start negotiating them and use the software
implementation. This, however, breaks D3 behaviour in the driver
since it means that WoWLAN will not be possible.

To avoid breaking that feature, advertise only ciphers that the
hardware supports.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 10:12:26 +03:00
Emmanuel Grumbach
42bbd6ecca iwlwifi: bump the iwlmvm API number to 15
The driver is now ready to handle the -15.ucode.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:54:18 +03:00
Matti Gottlieb
0becb37780 iwlwifi: mvm: Add DC2DC_CONFIG_CMD (0x83) cmd & TLV
Add DC2DC_CONFIG_CMD (0x83) cmd.

Add IWL_UCODE_TLV_CAPA_DC2DC_CONFIG_SUPPORT tlv.

The command allows the driver get & set the DCDC's frequency tune.
(freq_tune is the divider that is used to calculate the actual DCDC's
clock rate)
The command always returns the current/updated frequency tune values of
the DCDC.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:52:44 +03:00
Matti Gottlieb
2b4737dd81 iwlwifi: mvm: Remove old scan commands
The firmwares that used these commands is not supported
anymore. Remove them.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:51:30 +03:00
Johannes Berg
859d914c8f iwlwifi: prepare for higher API/CAPA bits
Currently, loading the firmware fails when it has higher API or CAPA
bits than the driver supports. That's an issue with integration.

At the same time, actually using api[0] and capa[0] will become
confusing when we also have api[1] and capa[1], and it's almost
certain that we'll mix up the bits and use the bits for api[1] with
api[0] by accident.

Avoid all this by translating the API/CAPA bits to the regular kernel
test_bit() format, and also providing wrapper functions. Also use the
__bitwise__ facility of sparse to check that we're testing the right
one.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:45:37 +03:00
Johannes Berg
ebf17ff9bb iwlwifi: mvm: simplify iwl_mvm_stop_roc()
As pointed out by smatch, there's no need for a loop that always
immediately terminates. Use an if statement instead and while at
it clean up the mvmvif initialization.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:43:20 +03:00
Johannes Berg
aa42fb2420 iwlwifi: dvm: enable IEEE80211_HW_SUPPORT_FAST_XMIT
Since the firmware is responsible for duration calculation, the
driver can easily support fast-xmit.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:42:58 +03:00
Johannes Berg
0d060384be iwlwifi: mvm: enable IEEE80211_HW_SUPPORT_FAST_XMIT
Since the firmware is responsible for duration calculation, the
driver can easily support fast-xmit.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:42:47 +03:00
Sara Sharon
5f17570354 iwlwifi: pcie: New RBD allocation model
As a preperation for multiple RX queues change the RBD
allocation model.

The new model includes a background allocator. The allocator is
called by the interrupt handler when there are two released
buffers by the queue, and the allocator starts allocating eight
pages per request.
When the queue has released 8 pages it tries claiming the
request. If the pages are not ready - it keeps claiming.
This new model should make sure that RBDs are always available
across the multiple queues.

The RBDs are transferred between the allocator and the queue.
The queue moves the free RBDs upon freeing them to the allocator.
The allocator moves them back to the queue's possession when the
request is claimed.
The allocator has an initial pool to make sure there are always RBDs
available for the request completion.
Release of the buffers at exit is done per pools - the allocator
frees its own initial pool and the queue frees its own pool.

Existing code refactor -
-Queue's initial pool is the size of the queue only as the allocation
of the new buffers no longer uses this pool.
-Removal of replenish background work, and replenish calls in the
interrupt handler and restock().
-The replenish() and the rxq used_list are used only during
initialization.
-Moved page allocation to a new function for code reuse.

New code -
Allocator code - new structure and functions.
Interrupt handler uses the allocator functions for replenishing buffers.
Reuse of the restock() method.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:42:04 +03:00
Eliad Peller
54154618b5 iwlwifi: pcie: re-enable interrupts on resume
On resume, all the interrupts are masked (CSR_INT_MASK is 0),
and ict is disabled.

Re-configure them both.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:41:42 +03:00
David Spinadel
15286e26d2 iwlwifi: mvm: don't use EBS for P2P find
Don't use EBS for P2P find to make sure we find all GOs in
our only attempt.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:41:28 +03:00
David Spinadel
f0bf859304 iwlwifi: mvm: add inactive state to ebs status
Currently EBS status in scan complete notifications is set to
success if EBS wasn't activated. FW will add a special return
value for cases when EBS wasn't activated and we add a print
of this status.

This change is needed for debug only, no behavior changes.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:41:15 +03:00
Avri Altman
95411d0455 iwlwifi: pcie: Control access to the NIC's PM registers via iwl_cfg
Allow a cleaner way to access those hw-dependent registers,
instead of using the product family type etc.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:40:56 +03:00
Liad Kaufman
6a8ac59c80 iwlwifi: wrt: add mipi type to debug types
This adds the MIPI mode type to the types declared supported
by the driver. Without this patch, when using MIPI mode and
looking at the logs the user would see the debug destination
"UNKNOWN".

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:40:13 +03:00
Eyal Shapira
bb8f44c919 iwlwifi: mvm: rs: pass rate directly to column checks
A minor refactoring for following patches.
This enables the reuse of the checks functions.

type=cleanup

Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-06-03 09:39:59 +03:00
Shailendra Verma
fa2ab69718 ray_cs: Change 1 to true for bool type variable.
The variable translate is bool type. So assigning true instead of 1.

Signed-off-by: Shailendra Verma <shailendra.capricorn@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-06-02 23:30:14 +03:00
Amitkumar Karwar
57670ee882 mwifiex: device dump support via devcoredump framework
Currently device dump generated in the driver is retrieved
using ethtool set/get dump commands. We will get rid of
ethtool approach and use devcoredump framework.

Device dump can be trigger by
cat /debugfs/mwifiex/mlanX/device_dump
and when the dump operation is completed, data can be read by
cat /sys/class/devcoredump/devcdX/data

We have prepared following script to split device dump data
into multiple files.

 [root]# cat mwifiex_split_dump_data.sh
 #!/bin/bash
 # usage: ./mwifiex_split_dump_data.sh dump_data

 fw_dump_data=$1

 mem_type="driverinfo ITCM DTCM SQRAM APU CIU ICU MAC"

 for name in ${mem_type[@]}
 do
     sed -n "/Start dump $name/,/End dump/p" $fw_dump_data  > tmp.$name.log
     if [ ! -s tmp.$name.log ]
     then
         rm -rf tmp.$name.log
     else
         #Remove the describle info "Start dump" and "End dump"
         sed '1d' tmp.$name.log | sed '$d' > /data/$name.log
         if [ -s /data/$name.log ]
         then
             echo "generate /data/$name.log"
         else
             sed '1d' tmp.$name.log | sed '$d' > /var/$name.log
             echo "generate /var/$name.log"
         fi
         rm -rf tmp.$name.log
     fi
 done

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-06-02 23:16:01 +03:00
Amitkumar Karwar
fc697159ad mwifiex: use generic name 'device dump'
Currently we are dumping driver information also inside
firmware dump API. We will call it as device dump and
dump driver and firmware data separately.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-06-02 23:15:59 +03:00
Amitkumar Karwar
9cc0dbf043 mwifiex: minor changes in debug messages
Small letters are used in debug messages to match coding style
at other places.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-06-02 23:15:58 +03:00
Amitkumar Karwar
38b130e22e mwifiex: dump driver information for PCIe interface
Currently we are dumping driver information only for SDIO
interface. This patch adds missing mwifiex_dump_drv_info()
call for PCIe interface.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-06-02 23:15:57 +03:00
Amitkumar Karwar
0769b27739 mwifiex: fix a possible double free issue
As drv_info_dump pointer doesn't get reset, we may end up
freeing the allocated memory twice.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-06-02 23:15:56 +03:00
Amitkumar Karwar
e065ddb891 mwifiex: fix SDIO firmware dump problem
It's been observed that firmware doesn't go back to normal
state when all firmware memories are dumped. As a result,
further commands are blocked. This happens due to missing
driver change of writing READ DONE to control register for
SDIO interface.

This patch adds a missing change to fix the problem.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-06-02 23:15:53 +03:00
David S. Miller
df905ceae3 Merge branch 'sfc-next'
Shradha Shah says:

====================
sfc: ndo_get_phys_port_id, vadaptor stats and PF unload when Vf's assigned to guest

This is the third and last instalment of SRIOV for EF10 patches.

This patch set includes implementation of ndo_get_phys_port_id
and changes to the MAC statistics code in order to support
vadaptor statistics.

It also includes code to deal with PF unload when Vf's are still
assigned to the guest.

The first couple of patches create sysfs files for physical port
and link control flags which are particularly useful when we have
enabled a large number of VF's.

These patches have been tested with and without CONFIG_SFC_SRIOV.
The creation and content of the sysfs files has been tested.
The statistics are tested using ethtool for monitoring.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02 12:57:39 -07:00
Daniel Pieczko
6598dad26b sfc: leak vports if a VF is assigned during PF unload
If any VF is assigned as the PF is unloaded, do not attempt to
remove its vport or the vswitch.  These will be removed if the
driver binds to the PF again, as an entity reset occurs during
probe.

A 'force' flag is added to efx_ef10_pci_sriov_disable() to
distinguish between disabling SR-IOV and driver unload.
SR-IOV cannot be disabled if VFs are assigned to guests.

If the PF driver is unloaded while VFs are assigned, the driver
may try to bind to the VF again at a later point if the driver
has been reloaded and the VF returns to the same domain as the PF.
In this case, the PF will not have a VF data structure, so the VF
can check this and drop out of probe early.

In this case, efx->vf_count will be zero but VFs will be present.
The user is advised to remove the VF and re-create it. The check
at the beginning of efx_ef10_pci_sriov_disable() that
efx->vf_count is non-zero is removed to allow SR-IOV to be
disabled in this case. Also, if the PF driver is unloaded, it
will disable SR-IOV to remove these unknown VFs.

By not disabling bus-mastering if VFs are still assigned, the VF
will continue to pass traffic after the PF has been removed.

When using the max_vfs module parameter, if VFs are already
present do not try to initialise any more.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02 12:57:32 -07:00
Daniel Pieczko
2a3fc31122 sfc: force removal of VF and vport on driver removal
When the driver unloads, force the unbind and removal of any
VFs in the host with the PF.  The PF cannot remove vports and
vswitches if they are still being used by a VF driver, and when
unloading the sfc driver the removal order is not guaranteed,
so the instruction from the PF to the VF to unbind enforces a
suitable ordering so that vswitches and vports can be removed.

As a result of this, manually unbinding the driver from a single
PF will result in all of its VFs in the host also being removed.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02 12:57:31 -07:00
Daniel Pieczko
71158bf2e7 sfc: do not allow VFs to be destroyed if assigned to guests
Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02 12:57:31 -07:00
Daniel Pieczko
f00bf2305c sfc: don't update stats on VF when called in atomic context
The ifenslave command to set up a bond runs in an atomic
context, and it queries the stats on the devices that are
being enslaved. A VF needs to make an MCDI call to update
its stats, which is not allowed in atomic context.

The releasing of the stats_lock is moved to the beginning of
the VF stats update function so that in_interrupt() can be
used; it must be taken again before returning from this
function.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02 12:57:29 -07:00
Daniel Pieczko
d94619cdfc sfc: suppress vadaptor stats when EVB is not present
The raw_mask array is not initialised, so it needs to be
explicitly set to zero in the 'else' branch.

If the EVB capability is not present, a port cannot have multiple
functions so the per-port MAC stats are correct and should match
the corresponding vadaptor stats, so this redundancy can be
removed from the ethtool stats output.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02 12:57:29 -07:00
Daniel Pieczko
6dd4859b28 sfc: suppress ENOENT error messages from MC_CMD_MAC_STATS
MC_CMD_MAC_STATS can be called on a function before a
vadaptor has been created, as the kernel can call into this
through ndo_get_stats/ndo_get_stats64.

If MC_CMD_MAC_STATS is called before the DMA queues have been
setup, so that a vadaptor has not been created yet, firmware
will return ENOENT. This is expected, so suppress the MCDI
error message in this case.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02 12:57:29 -07:00
Daniel Pieczko
0fc95fca5a sfc: update netdevice statistics to use vadaptor stats
The netdevice statistics (in /proc/net/dev) are per-function
stats so they must use the vadaptor stats. Change the use of
MAC stats to vadaptor stats, and remove any statistics that
can only be measured per-port.  All stats that are removed
will be shown as zeroes when these statistics are displayed.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02 12:57:28 -07:00
Daniel Pieczko
d778819609 sfc: DMA the VF stats only when requested
Firmware does not support a periodic DMA of vadaptor-stats
on VFs, so only update the stats buffer when stats are
requested (when running "ethtool -S" or an ip/ifconfig
command that reports stats).

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02 12:57:28 -07:00