History log of /drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
Revision Date Author Comments
83bad206f7dd6638251840fa7846680f44c30bb4 17-Sep-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Add a fallback multi-function mode NPAR1.5

When using new Multi-function modes it's possible that due to incompatible
configuration management FW will fallback into an existing mode.

Notice that at the moment this fallback is exactly the same as the already
existing switch-independent multi-function mode, but we still use existing
infrastructure to hold this information [in case some small differences will
arise in the future].

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Dmitry Kravkov <Dmitry.Kravkov@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7609647e25a486174333ab01dcdaa23b517b8684 17-Sep-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: New multi-function mode: UFP

Add support for a new multi-function mode based on the Unified Fabric Port
system specifications.
Support includes configuration of:
1. Outer vlan tags.
2. Bandwidth settings.
3. Virtual link enable/disable.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Dmitry Kravkov <Dmitry.Kravkov@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2e98ffc21cacb170c2d2c01d110ed53fedb95768 17-Sep-2014 Dmitry Kravkov <Dmitry.Kravkov@qlogic.com> bnx2x: Changes with storage & MAC macros

Rearrange macros to query for storage-only modes in different MF environment.
Improves the readibility and maintainability of the code. E.g.:
- if (IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp))
+ if (IS_MF_STORAGE_ONLY(bp))

In addition, this removes the need for bnx2x_is_valid_ether_addr().

Signed-off-by: Dmitry Kravkov <Dmitry.Kravkov@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
04860eb7d911bbd958463416cc045b69ffdf73b3 02-Sep-2014 Manish Chopra <manish.chopra@qlogic.com> bnx2x: Configure device endianity on driver load and reset endianity on removal.

Some hosts can be both little and big endian.
In certain scenarios a big endian kernel can kexec a little endian kernel.

This patch fixes this case from both ends:
1) Return endianity to original values on shutdown (in case little endian kernel boots after we shutdown).
2) Do not rely on HW reset values when loading driver in little endian kernel
but configure them explicitly (in case previous kernel was big endian and did not reset the HW).

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1fc3de94076cd0c1e53e5ba8061763b33c7b27c2 26-Aug-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Fix static checker warning regarding `txdata_ptr'

Incorrect checking of array instead of array contents in panic_dump
flow - results of commit e261199872a2 ("bnx2x: Safe bnx2x_panic_dump()").

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ea36475a22ded71633331a0b9b3cddd7f1d6983a 25-Aug-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Fix stop-on-error

When STOP_ON_ERROR is set driver will not compile. Even if it did,
traffic will not pass without this patch as several fields which are
verified by FW/HW on the Tx path are not properly set.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c993189601fa89842eee96814e3ab2277fae3076 25-Aug-2014 Amir Vadai <amirv@mellanox.com> net/bnx2x: Use is_kdump_kernel() to detect kdump kernel

Use is_kdump_kernel() to detect kdump kernel, instead of
reset_devices.

CC: Ariel Elior <ariel.elior@qlogic.com>
CC: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
97539f1e4f1e4b53604970b2dfe7794794f57a76 17-Aug-2014 Ariel Elior <Ariel.Elior@qlogic.com> bnx2x: FW assertion changes

This is mostly a semantic change which modifies the code parsing and printing
of FW asserts.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
e261199872a232beb6541c7dc6af2af0de840a27 17-Aug-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Safe bnx2x_panic_dump()

The bnx2x panic dump spills a lot of information from the driver's
fastpath, but may be called while some of the fastpath is uninitialized.

This patch verifies that pointers are already allocated before dereferencing
them to prevent possible kernel panics.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0c23ad37a220b6a58b90e36203fe915c80dbd403 17-Aug-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Code cleanup

This patch does several semantic things:
- Fixing typos.
- Removing unnecessary prints.
- Removing unused functions and definitions.
- Change 'strange' usage of boolean variables.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
eeed018cbfa30c0bde89075b06b62fc198afb51c 17-Aug-2014 Michal Kalderon <Michal.Kalderon@qlogic.com> bnx2x: Add timestamping and PTP hardware clock support

This adds a PHC to the bnx2x driver. Driver supports timestamping send/receive
PTP packets, as well as adjusting the on-chip clock.

The driver has been tested with linuxptp project.

Signed-off-by: Michal Kalderon <Michal.Kalderon@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
e42780b66aab88d3a82b6087bcd6095b90eecde7 17-Aug-2014 Dmitry Kravkov <Dmitry.Kravkov@qlogic.com> bnx2x: Utilize FW 7.10.51

- (L2) In some multi-function configurations, inter-PF and inter-VF
Tx switching is incorrectly enabled.

- (L2) Wrong assert code in FLR final cleanup in case it is sent not
after FLR.

- (L2) Chip may stall in very rare cases under heavy traffic with FW GRO
enabled.

- (L2) VF malicious notification error fixes.

- (L2) Default gre tunnel to IPGRE which allows proper RSS for IPGRE packets,
L2GRE traffic will reach single queue.

- (FCoE) Fix data being placed in wrong buffer when corrupt FCoE frame is
received.

- (FCoE) Burst of FIP packets with destination MAC of ALL-FCF_MACs
causes FCoE traffic to stop.

Signed-off-by: Dmitry Kravkov <Dmitry.Kravkov@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7c3afd85dc1610bb2fc049644cd1b52c7af96f98 18-Aug-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Revert UNDI flushing mechanism

Commit 91ebb929b6f8 ("bnx2x: Add support for Multi-Function UNDI") [which was
later supposedly fixed by de682941eef3 ("bnx2x: Fix UNDI driver unload")]
introduced a bug in which in some [yet-to-be-determined] scenarios the
alternative flushing mechanism which was to guarantee the Rx buffers are
empty before resetting them during device probe will fail.
If this happens, when device will be loaded once more a fatal attention will
occur; Since this most likely happens in boot from SAN scenarios, the machine
will fail to load.

Notice this may occur not only in the 'Multi-Function' scenario but in the
regular scenario as well, i.e., this introduced a regression in the driver's
ability to perform boot from SAN.

The patch reverts the mechanism and applies the old scheme to multi-function
devices as well as to single-function devices.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9baa3c34ac4e27f7e062f266f50cc5dbea26a6c1 08-Aug-2014 Benoit Taine <benoit.taine@lip6.fr> PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use

We should prefer `struct pci_device_id` over `DEFINE_PCI_DEVICE_TABLE` to
meet kernel coding style guidelines. This issue was reported by checkpatch.

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

// <smpl>

@@
identifier i;
declarer name DEFINE_PCI_DEVICE_TABLE;
initializer z;
@@

- DEFINE_PCI_DEVICE_TABLE(i)
+ const struct pci_device_id i[]
= z;

// </smpl>

[bhelgaas: add semantic patch]
Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
6495d15a7cb1f3328dc38557c48afb754f900c14 26-Jun-2014 Dmitry Kravkov <Dmitry.Kravkov@qlogic.com> bnx2x: VF can report link speed

Until now VFs were oblvious to the actual configured link parameters.
This patch does 2 things:

1. It enables a PF to inform its VF using the bulletin board of the link
configured, and allows the VF to present that information.

2. It adds support of `ndo_set_vf_link_state', allowing the hypervisor
to set the VF link state.

Signed-off-by: Dmitry Kravkov <Dmitry.Kravkov@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
73413ffac3b713231dac466bca216f970042c5e5 24-Jun-2014 Yijing Wang <wangyijing@huawei.com> bnx2x: Fix the MSI flags

MSI-X should use PCI_MSIX_FLAGS not PCI_MSI_FLAGS.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b17b0ca1642c23f0cd4e4cf52cdb9970798f3501 12-Jun-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Check for UNDI in uncommon branch

If L2FW utilized by the UNDI driver has the same version number as that
of the regular FW, a driver loading after UNDI and receiving an uncommon
answer from management will mistakenly assume the loaded FW matches its
own requirement and try to exist the flow via FLR.

Signed-off-by: Yuval Mintz <yuval.mintz@qlogic.com>
Signed-off-by: Ariel Elior <ariel.elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0c0e63410a393aae4b615849625f539db775d586 03-Jun-2014 wenxiong@linux.vnet.ibm.com <wenxiong@linux.vnet.ibm.com> bnx2x: Adapter not recovery from EEH error injection

When injecting EEH error to bnx2x adapter, adapter couldn't be recovery
and caused recursive EEH errors. The patch fixes the issue.

Signed-off-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
08f6dd89d26f8599dd138c25506960e3856fd062 27-May-2014 Ariel Elior <ariel.elior@qlogic.com> bnx2x: update MAINTAINERS for bnx2x and e-mail addresses

The bnx2x development team has transferred from Broadcom to Qlogic.
This patch updates some obsolete email addresses to usable ones.
The bnx2x files contain headers with legal information from
Broadcom. Qlogic Legal depratment is taking their time coming up
with their own legal info. So this patch only updates contact
information. I will follow up with a patch for the headers once I
have the required info.

Signed-off-by: Ariel Elior <ariel.elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
de682941eef3e5f6d1b653a6c214bc8a288f17c1 07-May-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Fix UNDI driver unload

Commit 91ebb928b "bnx2x: Add support for Multi-Function UNDI" contains a bug
which prevent the emptying of the device's Rx buffers before reset.
As a result, on new boards it is likely HW will reach some fatal assertion
once its interfaces load after UNDI was previously loaded.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
e2a367f8e3c2afd5cfd5f0892844c74960ecc031 24-Apr-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Memory leak during VF removal

When removing a VF interface, the driver fails to release that VF's mailbox
and bulletin board allocated memory.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4e857c58efeb99393cba5a5d0d8ec7117183137c 17-Mar-2014 Peter Zijlstra <peterz@infradead.org> arch: Mass conversion of smp_mb__*()

Mostly scripted conversion of the smp_mb__* barriers.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/n/tip-55dhyhocezdw1dg7u19hmh1u@git.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-arch@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2dc33bbc4f8a5d6a05bf3c673b86c37b825450f3 23-Mar-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Remove the sriov VFOP mechanism

Since we now posses a workqueue dedicated for sriov, the paradigm that sriov-
related tasks cannot sleep is no longer correct.

The VFOP mechanism was the one previously supporting said paradigm - the sriov
related tasks were broken into segments which did not require sleep, and the
mechanism re-scheduled the next segment whenever possible.

This patch remvoes the VFOP mechanism altogether - the resulting code is a much
easier to follow code; The segments are gathered into straight-forward
functions which sleep whenever neccessary.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
370d4a26590fcc7510ad4a8432e4982a209f1b59 23-Mar-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Create workqueue for IOV related tasks

The bnx2x sriov mechanisms were done in the bnx2x slowpath workitem which
runs on the bnx2x's workqueue; This workitem is also responsible for the bottom
half of interrupt handling in the driver, and specifically it also receives
FW notifications of ramrod completions, allowing other flows to progress.

The original design of the sriov reltaed-flows was based on the notion such
flows must not sleep, since their context is the slowpath workitem.
Otherwise, we might reach timeouts - those flows may wait for ramrod completion
that will never arrive as the workitem wlll not be re-scheduled until that same
flow will be over.

In more recent time bnx2x started supporting features in which the VF interface
can be configured by the tools accessing the PF on the hypervisor.
This support created possible races on the VF-PF lock (which is taken either
when the PF is handling a VF message or when the PF is doing some slowpath work
on behalf of the VF) which may cause timeouts on the VF side and lags on the PF
side.

This patch changes the scheme - it creates a new workqueue for sriov related
tasks and moves all handling currently done in the slowpath task into the the
new workqueue.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
42f8277f56cf4a9570b1f0fe10a4fec3f48c832a 23-Mar-2014 Yuval Mintz <Yuval.Mintz@qlogic.com> bnx2x: Support mng. request for driver version

This adds support in a new management feature which needs the driver versions
(bnx2x, bnx2fc and bnx2i) loaded for each interface.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
94d9de3cf7b7902253e65d7aef30f2db051c1ac6 25-Feb-2014 Michal Schmidt <mschmidt@redhat.com> bnx2x: save RAM in kdump kernel by disabling TPA

When running in a kdump kernel, disable TPA. This saves memory, which
tends to be scarce in kdump.

TPA, being a receive acceleration, is unlikely to be useful for kdump,
whose purpose is to send the memory image out.

This saves additional 5 MB in the kdump environment.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
cd2b0389dc304c6a7fa2ebae200f246059c68dd9 20-Feb-2014 Joe Perches <joe@perches.com> bnx2x: Remove hidden flow control goto from BNX2X_ALLOC macros

BNX2X_ALLOC macros use "goto alloc_mem_err"
so these labels appear unused in some functions.

Expand these macros in-place via coccinelle and
some typing.

Update the macros to use statement expressions
and remove the BNX2X_ALLOC macro.

This adds some > 80 char lines.

$ cat bnx2x_pci_alloc.cocci
@@
expression e1;
expression e2;
expression e3;
@@
- BNX2X_PCI_ALLOC(e1, e2, e3);
+ e1 = BNX2X_PCI_ALLOC(e2, e3); if (!e1) goto alloc_mem_err;

@@
expression e1;
expression e2;
expression e3;
@@
- BNX2X_PCI_FALLOC(e1, e2, e3);
+ e1 = BNX2X_PCI_FALLOC(e2, e3); if (!e1) goto alloc_mem_err;

@@
expression e1;
expression e2;
@@
- BNX2X_ALLOC(e1, e2);
+ e1 = kzalloc(e2, GFP_KERNEL); if (!e1) goto alloc_mem_err;

@@
expression e1;
expression e2;
expression e3;
@@
- kzalloc(sizeof(e1) * e2, e3)
+ kcalloc(e2, sizeof(e1), e3)

@@
expression e1;
expression e2;
expression e3;
@@
- kzalloc(e1 * sizeof(e2), e3)
+ kcalloc(e1, sizeof(e2), e3)

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
230bb0f33672b5fad1c485ca82789f427fc1b253 12-Feb-2014 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: (semantic) revise scheduling of sp_rtnl

This removes the various points where the driver use bit operations in order
to schedule the sp_rtnl_task from the code, adding a single utility function
that does it instead.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0155a27cda683641d29e04e0fbea44afbd302fff 12-Feb-2014 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Fix bnx2x_panic_dump for VFs

bnx2x_panic_dump() prints all kind of driver information, including slowpath
information. Since VFs don't initialize slowpath information, a VF reaching
this flow will likely cause a panic in the system as it will access NULL
pointers.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14a94ebd48c12f1aee7495c1a1518c33efd3647c 12-Feb-2014 Michal Kalderon <michals@broadcom.com> bnx2x: Add support in PF driver for RSC

This provides PF-side support for VFs assigned to a VM running windows
2012 with the RSC feature enabled.

Signed-off-by: Michal Kalderon <michals@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f96d8d8577f8b99125d576ddf0321fee996ed54b 12-Feb-2014 Ariel Elior <ariele@broadcom.com> bnx2x: Remove unnecessary internal mem config

Latest FW performs this autonomously, makes this code surplus.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
76ca70fabbdaa3d5318748921f79bfdeba7a2ed8 12-Feb-2014 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: [Debug] change verbosity of some prints

There are some debug prints (mostly iov/statistics related) which clobber
system logs whenever their verbosity level is set for an interface.
This patch puts harsher verbosity requirements for such debug prints to be
printed.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1c8bb760b632b4328f06066a6813f3758e54d8cb 04-Feb-2014 James M Leddy <james.leddy@redhat.com> bnx2[x]: Make module parameters readable

Occasionally users want to know what parameters their Broadcom drivers
are running with. For example, a user may want to know if MSI is
disabled.

This patch has been compile tested.

Signed-off-by: James M Leddy <james.leddy@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5f6db130b5dab96eb1fe6b2c1d1131a74149f949 27-Jan-2014 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: More Shutdown revisions

Submission d9aee59 "bnx2x: Don't release PCI bars on shutdown" separated
the PCI remove and shutdown flows, but pci_disable_device() is still
being called on both.
As a result, a dev_WARN_ONCE will be hit during shutdown for every bnx2x
VF probed on a hypervisor (as its shutdown callback will be called and later
pci_disable_sriov() will call its remove callback).

This calls the pci_disable_device() only on the remove flow.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
d9aee591b0f06bd44cd577b757d3f267bc35fe4d 14-Jan-2014 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Don't release PCI bars on shutdown

The bnx2x driver in its pci shutdown() callback releases its pci bars (in the
same manner it does during its pci remove() callback).
During a system reboot while VFs are enabled, its possible for the VF's remove
to be called (as a result of pci_disable_sriov()) after its shutdown callback
has already finished running; This will cause a paging request fault as the VF
tries to access the pci bar which it has previously released, crashing the
system.

This patch further differentiates the shutdown and remove callbacks, preventing the
pci release procedures from being called during shutdown.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c14db20259ccb623171d4b788e51dd3e8df901d7 12-Jan-2014 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Correct default Tx switching behaviour

With this patch bnx2x will configure the PF to perform Tx switching on
out-going traffic as soon as SR-IOV is dynamically enabled and de-activate
it when it is disabled.
This will allow VFs to communicate with their parent PFs.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
a8f47eb701a562f6b5c81e2e0c143148915d7913 10-Jan-2014 stephen hemminger <stephen@networkplumber.org> bnx2x: namespace and dead code cleanups

Fix a bunch of whole lot of namespace issues with the Broadcom bnx2x driver
found by running 'make namespacecheck'

* global variables must be prefixed with bnx2x_
naming a variable int_mode, or num_queue is invitation to disaster

* make local functions static

* move some inline's used in one file out of header
(this driver has a bad case of inline-itis)

* remove resulting dead code fallout
bnx2x_pfc_statistic,
bnx2x_emac_get_pfc_stat
bnx2x_init_vlan_mac_obj,
Looks like vlan mac support in this driver was a botch from day one
either never worked, or not implemented or missing support functions

Compile tested only.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
e848582cee23f7ab540ec49ab1c7d7f8bfefcd84 05-Jan-2014 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: limit number of interrupt vectors for 57711

Original straightforward division may lead to zeroing number of SB and
null-pointer dereference when device is short of MSIX vectors or lacks
MSIX capabilities.

Reported-by: Vladislav Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
fcf93a0a2f9d317c0bffc430ddf8950041d13265 27-Dec-2013 David S. Miller <davem@davemloft.net> bnx2x: Fix build with SRIOV disabled.

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c: In function 'bnx2x_drv_info_ether_stat':
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:3302:46: error: dereferencing pointer to incomplete type
make[6]: *** [drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.o] Error 1

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0c757dee6af1bd9eb7ed615c97615202d4aeed09 26-Dec-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Add num of VFs to Management statistics

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
33d8e6a5f555b0d61cb3cb0e3c28e611c7408f4e 26-Dec-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Add AER support (missing bits)

This function adds several OS calls required to fully enable PCIe AER support -
pci_enable_pcie_error_reporting() and pci_cleanup_aer_uncorrect_error_status().

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
91ebb929b6f802604bb0ccdd3fec9c7b30d804f1 26-Dec-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Add support for Multi-Function UNDI

This adds the ability for bnx2x to load after UNDI is used in the
preboot environment on a multi-function interface which is not the first
interface of a given device.
Notice a side-effect is that the order by which the functions are probed and
thus interfaces appear might change, as this patch utilizes the EPROBE_DEFER
return value (and mechanism).

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6ffa39f2f59e4555239cc23a3488ad789b557166 17-Nov-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Prevent "timeout waiting for state X"

Current driver release rtnl lock in between DCB re-configuration.
As a result, other flows (e.g., mtu config) may enter in between and fail
due to halted tx path for dcb configuration.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9dcd9acd69b1321fa008c3ce3ec299d04cd46774 17-Nov-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Prevent panic during DMAE timeout

If chip enters a recovery flow just after the driver issues a DMAE request
the DMAE will timeout. Current code will cause a bnx2x_panic() as a result,
which means interface will no longer be usable (regardless of the recovery
results), as bnx2x_panic() is irreversible for the driver.

As this is a possible flow, the panic should be reached only when driver
is compiled with STOP_ON_ERROR.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2e3bd6a40865a7da486eaa36bb52a781bd70f5a1 21-Oct-2013 Eric Dumazet <edumazet@google.com> bnx2x: add TSO support for SIT tunnels

bnx2x driver already handles TSO for GRE and IPIP, current code
is the same for SIT.

Performance results : (Note we are now limited by receiver,
as it does not support GRO for SIT yet)

Before patch :

lpq84:~# ./netperf -H 2002:af6:1153:: -Cc
MIGRATED TCP STREAM TEST from ::0 (::) port 0 AF_INET6 to 2002:af6:1153:: () port 0 AF_INET6
Recv Send Send Utilization Service Demand
Socket Socket Message Elapsed Send Recv Send Recv
Size Size Size Time Throughput local remote local remote
bytes bytes bytes secs. 10^6bits/s % S % S us/KB us/KB

87380 16384 16384 10.00 5525.00 7.76 5.17 2.763 1.840

lpq84:~# ./netperf -H 2002:af6:1153:: -Cc
MIGRATED TCP STREAM TEST from ::0 (::) port 0 AF_INET6 to 2002:af6:1153:: () port 0 AF_INET6
Recv Send Send Utilization Service Demand
Socket Socket Message Elapsed Send Recv Send Recv
Size Size Size Time Throughput local remote local remote
bytes bytes bytes secs. 10^6bits/s % S % S us/KB us/KB

87380 16384 16384 10.00 6006.97 1.86 5.48 0.608 1.795

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
edd31476011052d8f6591a3194ba0716b0cea681 20-Oct-2013 Merav Sicron <meravs@broadcom.com> bnx2x: Set NETIF_F_HIGHDMA unconditionally

Current driver implementation incorrectly sets the flag only if 64-bit
DMA mask succeeded.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4293b9f57a46469d6762be3300e2c3fa6515905d 20-Oct-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Don't pretend during register dump

As part of a register dump, the interface pretends to have the identity
of other interfaces of the same physical device in order to perform
HW configuration for them - specifically, it needs to prevent attentions
from generating on those functions as the register dump accesses registers
in common blocks which whose reading might generate an attention.

However, such pretension is unsafe - unlike other flows in which the driver
uses pretend, during register dump there is no guarantee no other HW access
will take place (by other flows). If such access will take place, the HW will
be accessed by the wrong interface, and leave both functions in an incorrect
state.

This patch removes all pretensions from the register dump flow. Instead, it
changes initial configuration of attentions such that no fatal attention will
be generated for other functions as a result of the register dump
(notice however, a debug print claiming an attention from other functions IS
possible during the register dump)

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
32316a46f2bbd4a898acf86547197cff8476f442 20-Oct-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Lock DMAE when used by statistic flow

bnx2x has several clients to its DMAE machines - all of them with the exception
of the statistics flow used the same locking mechanisms to synchronize the DMAE
machines' usage.

Since statistics (which are periodically entered) use DMAE without taking the
locks, they may erase the commands which were previously set -
e.g., it may cause a VF to timeout while waiting for a PF answer on the VF-PF
channel as that command header would have been overwritten by the statistics'
header.

This patch makes certain that all flows utilizing DMAE will use the same
API, assuring that the locking scheme will be kept by all said flows.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1a6974b2c78755ae55d7be738866eb8d57c3ed45 20-Oct-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Prevent an illegal pointer dereference during panic

During a panic, the driver tries to print the Management FW buffer of recent
commands. To do so, the driver reads the address of that buffer from a known
address. If the buffer is unavailable (e.g., PCI reads don't work, MCP is
failing, etc.), the driver will try to access the address it has read, possibly
causing a kernel panic.

This check 'sanitizes' the access, validating the read value is indeed a valid
address inside the management FW's buffers.
The patch also removes a read outside the scope of the buffer, which resulted
in some unrelated chraracters appearing in the log.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b1239723f0564778d993d51d18afdfda01bdaca3 20-Oct-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Fix Maximum CoS estimation for VFs

bnx2x VFs do not support Multi-CoS; Current implementation
erroneously sets the VFs maximal number of CoS to be > 1.

This will cause the driver to call alloc_etherdev_mqs() with
a number of queues it cannot possibly support and reflects
in 'odd' driver prints.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
117401ee1df6517203454637fbc3e7e660ce45f6 19-Oct-2013 Eric Dumazet <edumazet@google.com> bnx2x: add TSO support for IPIP

bnx2x driver already handles TSO for GRE, current code
is the same for IPIP.

Performance results : (Note we are now limited by receiver,
as it does not support GRO for IPIP yet)

Before patch :

lpq83:~# ./netperf -H 7.7.9.84 -Cc
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 7.7.9.84 () port 0 AF_INET
Recv Send Send Utilization Service Demand
Socket Socket Message Elapsed Send Recv Send Recv
Size Size Size Time Throughput local remote local remote
bytes bytes bytes secs. 10^6bits/s % S % S us/KB us/KB

87380 16384 16384 10.00 7710.19 4.52 6.62 1.152 1.687

After patch :

lpq83:~# ./netperf -H 7.7.9.84 -Cc
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 7.7.9.84 () port 0 AF_INET
Recv Send Send Utilization Service Demand
Socket Socket Message Elapsed Send Recv Send Recv
Size Size Size Time Throughput local remote local remote
bytes bytes bytes secs. 10^6bits/s % S % S us/KB us/KB

87380 16384 16384 10.00 8532.40 2.55 7.73 0.588 1.781

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
932257efaeaa83e2b09b2dc5d41e34c3e4e0bc3c 18-Oct-2013 Jingoo Han <jg1.han@samsung.com> net: bnx2x: remove unnecessary pci_set_drvdata()

The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3d7d562ca4a884089344eb13451b5903a18d3817 09-Oct-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Add ndo_get_phys_port_id support

Each network interface (either PF or VF) is identified by its port's MAC id.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b85d717c1b66a40f006148a31e6bbb88ca6b45c0 02-Oct-2013 Peter Senna Tschudin <peter.senna@gmail.com> net: bnx2x: Change variable type to bool

The variable rc is only assigned the values true and false.
The function bnx2x_prev_is_path_marked already returns bool.
Change rc type to bool.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@exists@
type T;
identifier b;
@@
- T
+ bool
b = ...;
... when any
b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b91e1a1aa5d4f68ea5153bf65c54ebc693c30e4f 28-Sep-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: use pcie_get_minimum_link()

Use common code for getting the pcie link speed/width for debug printing.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9a8130bc381592877bdad08f81e9b10147933d16 28-Sep-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Don't disable/enable SR-IOV when loading

Current bnx2x implementation controls the number of VFs only by
standard sysfs support, and will reject setting the number of VFs
when the PF is not loaded.
As a result, there is no need to schedule a delayed work to enable
SR-IOV when PF is loaded, as the number of VFs at that point
must be 0.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0a5ccb759dc6cf17591e8b77d1fe0b52c2cf706d 23-Sep-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: prevent masked MCP parities from appearing

During flows which mask block attentions (e.g., register dump) all parities
are masked. However, unlike other blocks the MCP's attention is not masked
inside the block but rather the indication to the driver. If another attention
(e.g., link change) will occour while there's an MCP parity, the driver will
ignore the fact that the parity is masked and erroneously report a parity.

This patch forces the driver to read the MCP masking while checking for
parities.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4c868664344d0022699353ff324bf9eb39643265 23-Sep-2013 Eilon Greenstein <eilong@broadcom.com> bnx2x: Prevent mistaken hangup between driver & FW

When system CPU is stressed it's possible that the driver will not be able
to pulse the FW every second, which will cause the log to be filled with
error messages.

Increasing the threshold to 5 seconds seems to be enough to eliminate the
issue.

Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1bfa2c40ced07bae83839840be5143a7b09af714 26-Jun-2013 Russell King <rmk+kernel@arm.linux.org.uk> DMA-API: net: broadcom/bnx2x: replace dma_set_mask()+dma_set_coherent_mask() with new helper

Replace the following sequence:

dma_set_mask(dev, mask);
dma_set_coherent_mask(dev, mask);

with a call to the new helper dma_set_mask_and_coherent().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
f78afb356303e5f78750321a63809ef5c2d13c0d 18-Sep-2013 Michael Chan <mchan@broadcom.com> bnx2x, cnic, bnx2i, bnx2fc: Fix bnx2i and bnx2fc regressions.

commit b9871bcfd211d316adee317608dab44c58d6ea2d
bnx2x: VF RSS support - PF side

changed the configuration of the doorbell HW and it broke iSCSI and FCoE.
We fix this by making compatible changes to the doorbell address in bnx2i
and bnx2fc. For the userspace driver, we need to pass a modified CID
so that the existing userspace driver will calculate the correct doorbell
address and continue to work.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
29ed74c35088a775807743a5c84eecf6efa85d9f 11-Sep-2013 Jon Mason <jdmason@kudzu.us> bnx2x: Use pci_dev pm_cap

Use the already existing pm_cap variable in struct pci_dev for
determining the power management offset. This saves the driver from
having to keep track of an extra variable.

Signed-off-by: Jon Mason <jdmason@kudzu.us>
Cc: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c19d65c95c6d472d69829fea7d473228493d5245 09-Sep-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Fix configuration of doorbell block

As part of VF RSS feature doorbell block was configured not to use dpm, but
a small part of configuration was left out, preventing the driver from sending
tx messages to the device. This patch adds the missing configuration.

Reported-by: Eric Dumazet <eric.dumazet@gmil.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Tested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
60cad4e67bd6ff400e7ea61fe762b3042b12ae9d 04-Sep-2013 Ariel Elior <ariele@broadcom.com> bnx2x: VF RSS support - VF side

In this patch capabilities are added to the Vf driver to request
multiple queues over the VF PF channel, and the logic for requesting
rss configuration for said queues.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilong Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b9871bcfd211d316adee317608dab44c58d6ea2d 04-Sep-2013 Ariel Elior <ariele@broadcom.com> bnx2x: VF RSS support - PF side

This patch adds support for Receive Side Scaling for queues of
Virtual Functions on the PF side. This includes support for the
requests for multiple queues from VF drivers, configuration of the
HW for multiple queues per VF, and support for rss configuration
of said queues.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b4cddbd6dd9b3b9e08c26d8b7247e4e011092117 28-Aug-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Fix VF memory leak unload

Due to incorrect VF/PF conditions, when unloading a VF it will not release
part of the memory it has previously allocated.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
aeeddb8b9e76d1f250d58b40e8dba8614d61368b 19-Aug-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: prevent VF benign attentions

During probe, VFs might erroneously try to access the shared memory (which
only PFs are capabale of accessing), causing benign attentions to appear.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
07b4eb3b53f692a75fc0bc35c43345f331b7cca4 19-Aug-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Change DCB context handling

After notification that DCBX configuration has ended arrived to the driver,
the driver configured the FW/HW in sleepless context.
As a result, it was possible to reach a race (mostly with CNIC registration)
in which the configuration will return a timeout, failing to set the DCBX
results correctly.

This patch moves the configuration following the DCBX end into the slowpath
RTNL task (i.e., sleepless context protected by the RTNL lock), allowing the
configuration to cope with such races.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9156b30b33acaef9ce602fb31230154f13af4881 19-Aug-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: dropless flow control not always functional

Since commit 3deb816 "bnx2x: Add a periodic task for link PHY events"
link state changes can be detected not only via the attention flow but also
from the periodic task.
If the link state will change in such a manner (i.e., via the periodic task),
dropless flow-control will not be configured.

This patch remedies the issue, adding the missing configuration to all required
flows.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6ef5a92cdf5ee65578a287b9a030964b03a538ed 13-Aug-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: prevent crash in shutdown flow with CNIC

There might be a crash as during shutdown flow CNIC might try
to access resources already freed by bnx2x.
Change bnx2x_close() into dev_close() in __bnx2x_remove (shutdown flow)
to guarantee CNIC is notified of the device's change of status.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
a6d3a5ba3e0c4ed127976c52229d7a277da4d82c 13-Aug-2013 Barak Witkowsky <barak@broadcom.com> bnx2x: fix PTE write access error

PTE write access error might occur in MF_ALLOWED mode when IOMMU
is active. The patch adds rmmod HSI indicating to MFW to stop
running queries which might trigger this failure.

Signed-off-by: Barak Witkowsky <barak@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
568e24260fdc33d8a172a4d8da799cace4111b6e 13-Aug-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: update fairness parameters following DCB negotiation

ETS can be enabled as a result of DCB negotiation, then
fairness must be recalculated after each negotiation.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
507393eb2909ddf39edf3f8f4cd0fd914b720006 13-Aug-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: protect different statistics flows

Add locking to protect different statistics flows from
running simultaneously.
This in order to serialize statistics requests sent to FW,
otherwise two outstanding queries may cause FW assert.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8903b9eb19e0e2ca5ec0fc257cb0e5d9e94c75f4 06-Aug-2013 Casey Leedom <leedom@chelsio.com> bnx2x: Use pci_wait_for_pending_transaction() instead of for loop

New routine has been added to avoid duplication of code to wait for
pending PCI transactions to complete. This makes use of that routine.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Acked-by: David S. Miller <davem@davemloft.net>
ae2104be25a5698bb24d436855f6af9b65ea26fe 08-Aug-2013 Yijing Wang <wangyijing@huawei.com> bnx2x: clean up unnecessary MSI/MSI-X capability find

PCI core will initialize device MSI/MSI-X capability in
pci_msi_init_pci_dev(). So device driver should use
pci_dev->msi_cap/msix_cap to determine whether the device
support MSI/MSI-X instead of using
pci_find_capability(pci_dev, PCI_CAP_ID_MSI/MSIX).
Access to PCIe device config space again will consume more time.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: netdev@vger.kernel.org
Acked-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8b09be5f173759c87159b2f300c18f2ace9587de 01-Aug-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Revising locking scheme for MAC configuration

On very rare occasions, repeated load/unload stress test in the presence of
our storage driver (bnx2i/bnx2fc) causes a kernel panic in bnx2x code
(NULL pointer dereference). Stack traces indicate the issue happens during MAC
configuration; thorough code review showed that indeed several races exist
in which one thread can iterate over the list of configured MACs while another
deletes entries from the same list.

This patch adds a varient on the single-writer/Multiple-reader lock mechanism -
It utilizes an already exsiting bottom-half lock, using it so that Whenever
a writer is unable to continue due to the existence of another writer/reader,
it pends its request for future deliverance.
The writer / last readers will check for the existence of such requests and
perform them instead of the original initiator.
This prevents the writer from having to sleep while waiting for the lock
to be accessible, which might cause deadlocks given the locks already
held by the writer.

Another result of this patch is that setting of Rx Mode is now made in
sleepable context - Setting of Rx Mode is made under a bottom-half lock, which
was always nontrivial for the bnx2x driver, as the HW/FW configuration requires
wait for completions.
Since sleep was impossible (due to the sleepless-context), various mechanisms
were utilized to prevent the calling thread from sleep, but the truth was that
when the caller thread (i.e, the one calling ndo_set_rx_mode()) returned, the
Rx mode was still not set in HW/FW.

bnx2x_set_rx_mode() will now overtly schedule for the Rx changes to be
configured by the sp_rtnl_task which hold the RTNL lock and is sleepable
context.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
e0d1095ae3405404d247afb00233ef837d58da83 01-Aug-2013 Cong Wang <amwang@redhat.com> net: rename CONFIG_NET_LL_RX_POLL to CONFIG_NET_RX_BUSY_POLL

Eliezer renames several *ll_poll to *busy_poll, but forgets
CONFIG_NET_LL_RX_POLL, so in case of confusion, rename it too.

Cc: Eliezer Tamir <eliezer.tamir@linux.intel.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8b80cda536ea9bceec0364e897868a30ee13b992 10-Jul-2013 Eliezer Tamir <eliezer.tamir@linux.intel.com> net: rename ll methods to busy-poll

Rename ndo_ll_poll to ndo_busy_poll.
Rename sk_mark_ll to sk_mark_napi_id.
Rename skb_mark_ll to skb_mark_napi_id.
Correct all useres of these functions.
Update comments and defines in include/net/busy_poll.h

Signed-off-by: Eliezer Tamir <eliezer.tamir@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5bb680d6cbe36de9d7ba12b05f845c91a8692318 01-Jul-2013 Michal Schmidt <mschmidt@redhat.com> bnx2x: fix dump flag handling

bnx2x interprets the dump flag as an index of a register preset.
It is important to validate the index to avoid out of bounds
memory accesses.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c957d09ffda417f6c8e3d1f10e2b05228607d6d7 25-Jun-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Remove sparse and coccinelle warnings

This patch solves several sparse issues as well as an unneeded semicolon
found via coccinelle.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
37173488400704f1a05656616cd12baa9e03173b 24-Jun-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Fix compilation with no IOV support

This fixes an issue caused by submit 78c3bcc5d1af64f51d9f30b0f5a2d1985bf69734
`bnx2x: Improve PF behaviour toward VF', which made the bnx2x driver fail
compilation when PCI_IOV is not set.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b8e0d884cba6b9cd6e43adfaab9e67096ee8fb28 20-Jun-2013 Yaniv Rosner <yanivr@broadcom.com> bnx2x: Fix 20G KR2 support claims

Don't claim 20G is supported if the speed is unsupported by the phys
(reflected by various ethtools and ndos).

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
78c3bcc5d1af64f51d9f30b0f5a2d1985bf69734 20-Jun-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Improve PF behaviour toward VF

If PF is unloaded with loaded VFs, signal towards VFs so they can detect
this gracefully.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
----
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 2 ++
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 3 +++
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 23 +++++++++++++++++++---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 24 ++++++++++++++++++++---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h | 2 ++
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | 12 +++++++++++-
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h | 5 ++++-
7 files changed, 63 insertions(+), 8 deletions(-)
Signed-off-by: David S. Miller <davem@davemloft.net>
b8a39dd292af453f42ebcdbad229f7d9d1282ec2 18-Jun-2013 Yijing Wang <wangyijing@huawei.com> Bnx2x: remove redundant D0 power state set

Pci_enable_device() will set device power state to D0,
so it's no need to do it again in bnx2x_init_dev().
Also remove redundant PM Cap find code, because pci core
has been saved the pci device pm cap value.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
75b2945988274078bccf4c0b84e90c77b4fcaf96 19-Jun-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: replace mechanism to check for next available packet

Check next packet availability by validating that HW has finished CQE
placement. This saves latency of another dma transaction performed to update
SB indexes.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8f20aa575c0a69ccbdce325818f2b3878bfed61c 19-Jun-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: add support for ndo_ll_poll

Adds ndo_ll_poll method and locking for FPs between LL and the napi.

When receiving a packet we use skb_mark_ll to record the napi it came from.
Add each napi to the napi_hash right after netif_napi_add().

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
639d65b85592cf31eca24f33ff00e309ebbf0d2b 02-Jun-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: semi-Semantic changes

This patch includes a few changes that change the driver's flow without truly
changing anything in its functionality - use usleep_range for short sleeps
instead of msleep and initialize Tx consumer during initialization for better
information during errors.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6bf07b8e3666257c5172ab1681b377e547747d9b 02-Jun-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Revise prints

This patch revises many bnx2x prints - mainly fixing print typos and
adding some new debug prints (mostly for parity issues).

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3cdeec22e40264e40d34d8242b4ce7461329a80a 02-Jun-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Semantic removal and beautification

This patch introduces several small changes to the driver, none which actually
change any flow:
1. Removes prototypes of unexisting functions and unused defines.
2. Fixes alignment and spacing issues.
3. Changes numeric usage into constants.
4. Remove unnecessary parenthesis.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16a5fd9265e757121bb5f1b9ad757836f370e76c 02-Jun-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Revise comments and alignment

This patch correct various typos, fix comments conventions and
adds/removes a few comments.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
d76a611187c4840a4a45fb3f493f9b63c19df4ca 02-Jun-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Semantic change of empty lines

This patch removes unnecessary blank lines and adds a few where such are needed
(between variable declarations and code)

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3fb43eb20aec3f5ceed5813a035f200dafb51257 27-May-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Change to D3hot only on removal

This changes the PCI power management scheme of the bnx2x driver to be similar
to those of most network drivers - the driver will now changes the power state
into D3hot whenever the driver will be removed, instead of whenever an
interface is unloaded.

This change enables the driver to access its eeprom via ethtool callbacks
even when interfaces are unloaded (such access requires the function to be
in D0active).

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b030ed2fdc8a396dba71e4d550236a0f1bb38b40 27-May-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Implement PCI shutdown

Implement the PCI shutdown callback to support un-orderly shutdown, i.e.,
shutdowns in which the remove callback will not be called.

Due to the lack of this functionality, when an un-orderly shutdown occurred,
it was possible for wake-on-lan to remain disabled.

This is now fixed as the callback introduces the correct place in which
`system_state' can be queried and wake-on-lan be configured accordingly.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
868001946e39627ec439921eeb0f5fa020e1e31d 27-May-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Count number of possible FCoE interfaces

Commit 0eb43b4bb081a1a22574daab9c05286a600dd7fe
"bnx2x, bnx2fc: Use per port max exchange resources" has changed the number
of available FCoE exchanges, even in scenarios when some of the functions has
no FCoE support; This needlessly degraded the available resources.

Remedy this by calculating the maximal number of functions that may actually
utilize said connection.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
CC: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ca1ee4b259ea8c4f91c84ee4c737338658711272 27-May-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Add and correct PCI link speed prints

This adds the print of the PCI gen3 link speed (8GHz), as well as correcting
the same print for 57712 boards (the print erroneously showed a 2.5GHz speed).

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
e09b74d0195496fdc2dbe106eaa55da48873876e 27-May-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Zero VFs starting MACs

Hypervisor/Supervisor should set the VF's MAC prior to its load;
Using a randomly generated MAC as a default is a bad practice.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
e68072ef46bcfb609ea16d45f115896a0dfbd3ff 22-May-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Wait for MCP validity during AER

During PCIe advanced error recovery, the secondary bus reset will cause FW
to reset; This will cause the shared memory between it and the driver to be
invalidated.

During the driver's recovery flow, the driver should not make any assumption
on the validity of that memory and instead re-initialize it.

This also removes a redundant re-initialization of a previously
initialized mutex.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
178135c11611c02161c5b64aeba341d777f2d64d 22-May-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Link-flap avoidance in switch dependent mode

As part of the previous unload flow, probed devices will reset the chip
in order to clean the remains of the UNDI driver.
As a result, it's possible for the FW to toggle the link.

This toggling can prove fatal, as long periods without link can cause the
filesystem mount to fail as the storage protocol timeouts. This has been
observed against particular switches with long link re-establishment time.

This patch informs FW during the reset period that the link should not
be toggled - the FW will keep it alive until some interface will load and claim
the link as its own.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
05952246cdbf62da797323e7ce156be2e24b4d8c 01-May-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Prevent memory leak when cnic is absent

bnx2x driver allocates searcher T2 tables, but it releases that memory
during unload only released if the cnic is loaded.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b0261926ef666142ff9f7de92622172bf1164a26 01-May-2013 Yaniv Rosner <yanivr@broadcom.com> bnx2x: correct reading of speed capabilities

When the bnx2x driver reads the port configuration - mask irrelevant bits.

Without this change, the unintended bits may cause the driver to needlessly
toggle the link, as a comparison in the link flap avoidance flow will show
that the old link did not advertise the same capabilities and thus cannot
be retained.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
65bc0cfe492a6deb66daa123de94bbb62e01f21b 28-Apr-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: allow handling tunnel over udp offload

CC: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0eb43b4bb081a1a22574daab9c05286a600dd7fe 22-Apr-2013 Bhanu Prakash Gollapudi <bprakash@broadcom.com> bnx2x, bnx2fc: Use per port max exchange resources

The firmware supports a maximum of 4K FCoE exchanges. In 4-port devices,
or when working in multi-function mode, this resource needs to be distributed
between the various possible FCoE functions.

This information needs to be calculated by bnx2x and propagated into bnx2fc
via cnic. bnx2fc can then use this value to calculate corresponding xid
resources instead of using global constants.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ecf01c22be034690b621d92c9ff488d607a9995a 22-Apr-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Prevent NULL pointer dereference in kdump

In scenarios in which a previous driver was removed without proper cleanup
(e.g., kdump), it is possible for the chip to generate an interrupt without
any apparent reason once interrupts are requested.

Due to an erroneous initialization of resources, some of the bnx2x structs
which are required for interrupt handling are initialized only after an
interface's interrupt is requested from the OS.

As a result, once such a spurious interrupt occurs, it will cause a NULL
pointer dereference - the driver will access those structs in its interrupt
handling routine.

This patch change the interrupt request scheme so that bnx2x would only
request interrupts from the kernel after it has finished initializing
all the inner structs required for interrupt handling.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
70632d0afe749c44562c1112eea0839774bcf578 24-Apr-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Allow recovery from second slot reset

As part of PCIe Advanced Error Reporting flow, if a fatal PCI error occurs,
the AER driver will cause bnx2x's PCI-core to reset. The driver's PCI error
handlers will in turn restore the PCI configuration space values by calling
`pci_restore_state'.

However, as bnx2x does not save the PCI configuration after restoration,
An additional fatal PCI error will leave the function in an unstable state
until reboot, as the registers in the PCI configuration space will contain
reset values.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2f7a312230e0d24e8913e7eff7b24d34b7092fcd 24-Apr-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Fix memory leak

There exists an `allocation race' between the CNIC and bnx2x drivers,
in which both drivers allocate the same t2 memory while disregarding a possible
previous allocation.

Additionally, due to the current order of memory releases, some of the
ILT memory in the driver is not released correctly when unloading the driver.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f8f4f61a5a358841c5acf144f6fa13a6b475ec2c 24-Apr-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Enhance MAC configuration for VFs

Improved support for adding/removing vf mac addresses.

This includes the case where HyperVisor forced the address (sampled from
bulletin board), and the case where it did not in which the VF can
configure its own mac address.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f646968f8f7c624587de729115d802372b9063dd 19-Apr-2013 Patrick McHardy <kaber@trash.net> net: vlan: rename NETIF_F_HW_VLAN_* feature flags to NETIF_F_HW_VLAN_CTAG_*

Rename the hardware VLAN acceleration features to include "CTAG" to indicate
that they only support CTAGs. Follow up patches will introduce 802.1ad
server provider tagging (STAGs) and require the distinction for hardware not
supporting acclerating both.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
d46f7c4df342c27cea676939d7c005f1e86173e9 18-Apr-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Prevent UNDI FW illegal host access

When loading after UNDI (e.g., Boot from SAN) the UNDI does not
gracefully yield its resources; The bnx2x driver handles that release
itself.

During the manipulation required to release those resources, it's possible
for the UNDI to try and write to memory regions which are no longer accessible,
causing the PCI bus to prevent further writes from the chip.

This would in turn cause DMAE timeouts later on in the driver, as the driver
will be unable to use the chip's DMA engines.

This patch prevents the chip from actually writing through the PCI bus
in said scenario, thus allowing the release without the unfortunate by-product.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
fea75645342c7ad574214497a78e562db12dfd7b 10-Apr-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Prevent null pointer dereference in AFEX mode

The cnic module is responsible for initializing various bnx2x structs
via callbacks provided by the bnx2x module.
One such struct is the queue object for the FCoE queue.

If a device is working in AFEX mode and its configuration allows FCoE yet
the cnic module is not loaded, it's very likely a null pointer dereference
will occur, as the bnx2x will erroneously access the FCoE's queue object.

Prevent said access until cnic properly registers itself.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8b49a4c75965ed157e21450d23dcadd6b27c1aa3 27-Mar-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: fix compilation without CONFIG_BNX2X_SRIOV

Move mutex initialization by allocation of the mailbox it protects.

introduced in commit 1d6f3cd89 'bnx2x: Prevent VF race'

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1d6f3cd8988822c7bdc3c685fac0a99315e83400 27-Mar-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Prevent VF race

The mail box containing the Vf-Pf messages is susceptible
to a race - it's possible for 2 flows to try and write commands,
causing one to override the other's message.
Use a mutex to synchronize the access, preventing said race.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5b0752c863d70cd1cc96d22eebfc991dd67864de 27-Mar-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Fix VF statistics

After a VF performs load/unload its statistics become corrupt -
we now zero the statistics structures upon a VF device load.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
60cde81f9dc9d70fa4462f4fefb72a1f27333af8 27-Mar-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Fix AER semaphore release

Commit 7fa6f34 "AER revised" erroneously inserted an error-flow
in which a semaphore is released even though the attempt to take it
has failed.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
e287a75c6806892c0180005c462cd3be5cf93611 21-Mar-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: increase inner ip id during encapsulated tso

57712/578xx devices during handling of encapsulated TSO can
properly increase ip id for only one ip header.
The patch selects inner header to be increased.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
CC: Eilon Greenstein <eilong@broadcom.com>
CC: Ariel Elior <ariele@broadcom.com>
CC: Maciej Zenczykowski <maze@google.com>
CC: Jesse Gross <jesse@nicira.com>
Reported-by: Eric Dumazet <edumazet@google.com>
Tested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7fa6f34081f168975af72be51715bdc6601931f7 20-Mar-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: AER revised

Revised bnx2x implementation of PCI Express Advanced Error Recovery -
stop and free driver resources according to the AER flow (instead of the
currently implemented `hope-for-the-best' release approach), and do not make
any assumptions on the HW state after slot reset.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
a848ade408b6bfab59d575d6c246efb20afe88e3 18-Mar-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: add CSUM and TSO support for encapsulation protocols

The patch utilizes FW offload capabilities for
encapsulation protocols.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
704ba4b7778f60e0a22108ebda3f7f6dba32ab9a 11-Mar-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Restore FCoE 4-port devices support

bnx2x FW 1.78.17 properly supports DCBX configuration for 4-port devices,
enabling FCoE support on 57840 boards.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
91226790bbe2dbfbba48dd79d49f2b38ef10eb97 11-Mar-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: use FW 7.8.17

Update appropriate HSI files and adapt driver accordingly.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
82594f8f47bc1167d55776cfb599633ec4ac8e77 11-Mar-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Avoid using zero MAC

Prevent bnx2x devices which are used mainly for storage from using zero
MAC addresses as their primary MAC address.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3c76feff68559bf9ec08d4d86abe57bc56a9847a 11-Mar-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Control number of vfs dynamically

1. Support sysfs interface for getting the maximal number of virtual functions
of a given physical function.
2. Support sysfs interface for getting and setting the current number of
virtual functions.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3ec9f9ca79757c54b12f87e51a6664ba1e597b17 11-Mar-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Add iproute2 support for vfs

This patch adds support for iproute2 callbacks allowing querying a physical
function as to its child virtual functions, and setting the macs and vlans
of said virtual functions.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3786b9426d943ef167575be2ba20dab3d858243e 11-Mar-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Prevent "Unknown MF" print in SF mode

When using a chip operating in Single Function mode, when the chip is probed
the bnx2x would print a message warning of an unknown Multi Function mode.

This patch prevents said message.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f22fdf25f4d4e9a2124ca6a2521f36dd73a32dad 11-Mar-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Take chip version from MFW

In latest boards, the CHIP_METAL register contains an incorrect
revision value, so the correct one needs to be obtained in a
different manner.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
005a07baa1713861a060fab66a3d7d91f8d759c6 11-Mar-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Set ethtool ops for vfs

Virtual functions don't have access to HW registers, therefore most ethtool ops
are forbidden to them. Instead of checking in each op whether the device being
driven is a virtual function or a physical function, this patch creates a
separate ethtool ops struct for virtual functions and uses it to initialize
the ethtool ops of the driver in case it is driving a virtual function device.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ad9b4359c7839d4d87aad2c0d50c8a2ef3bcddb3 23-Jan-2013 Michael Chan <mchan@broadcom.com> cnic, bnx2x: Add CNIC_DRV_STATE_HANDLES_IRQ to ethdev->drv_state

In INTA mode, cnic and bnx2x share the same IRQ. During chip reset,
for example, cnic will stop servicing IRQs after it has shutdown the
cnic hardware resources. However, the shared IRQ is still active as
bnx2x needs to finish the reset. There is a window when bnx2x does
not know that cnic is no longer handling IRQ and things don't always
work properly.

Add a flag to tell bnx2x that cnic is handling IRQ. The flag is set
before the first cnic IRQ is expected and cleared when no more cnic
IRQs are expected, so there should be no race conditions.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
580d9d081341aad5341884f9e6b070c01512e94c 23-Jan-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: correct memory release scheme

Fix an incorrect SR-IOV memory release which was committed in 1ab4434.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
86564c3f0fe7ff3ffe452fcc54a774eeadc1cf45 23-Jan-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Remove many sparse warnings

Remove most of the sparse warnings in the bnx2x compilation
(i.e., thus resulting when compiling with `C=2 CF=-D__CHECK_ENDIAN__').

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
04c467366553680283f953887214854f9b30a59a 23-Jan-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Add additional debug information

Add/Revise several debug prints in the bnx2x driver - on regular flows
as well as error flows.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0926d499e24d22da77f83cbfb3b22e1ad89aa7db 23-Jan-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: correct usleep_range usage

Change the incorrect usage of `usleep_range(1000, 1000)' into
`usleep_range(1000, 2000)'.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
924d75ab3da25c3498b329158f7226fb80cd8cec 23-Jan-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: reorganization and beautification

Slightly changes the bnx2x code without `true' functional changes.
Changes include:
1. Gathering macros into a single macro when combination is used multiple
times.
2. Exporting parts of functions into their own functions.
3. Return values after if-else instead of only on the else condition
(where current flow would simply return same value later in the code)
4. Removing some unnecessary code (either dead-code or incorrect conditions)

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2de67439c1f50e32fb54ca70786fcfa96c5bfd53 23-Jan-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Semantic renovation

Mostly corrects white spaces, indentations, and comments.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
247fa82be1301e4f89eaa5dc10be62a9cc84e8c5 14-Jan-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Introduce 2013 and advance version to 1.78.02

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ebe61d80b42662a1cf8d24e0b8605aa16fa6e4d0 14-Jan-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Clean previous IGU status before ack

When enabling interrupts, acknowledge the interrupt only
after configuring the IGU to the correct interrupt mode
(otherwise it would dirty selftests)

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
823e1d90797552687d2dfab2299464e5b663a8a9 14-Jan-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: improve stop-on-error

Get better control over interrupts during panic, and allow FW to
test outgoing Tx packets when stop-on-error is allowed.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4ba7699be9e038b3f4d4857ef5d2150ebd9a7b60 14-Jan-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Added nvram personalities support

When a device is configured to act as either iscsi or fcoe
device in its nvram, prevent the other from being misused by
preventing its activation in the driver.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f72839d036d5ae7db43772224eb33608bcb9b5f5 14-Jan-2013 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: use SAN Mac for FCoE.

Current logic causes chips running in switch dependent multi-function
FCoE mode not to configure their MAC, leading to an all 0s MAC.

This patch configures the interface with the SAN Mac instead.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
a74801c59ec1e463d93fbb670d16e4f8f4044c7d 14-Jan-2013 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Clear dirty status when booting after UNDI

Self-tests following boot from SAN have failed as the
UNDI driver might leave some NIG interrupt indications.

This patch does the clean-up, clearing those indications
and allowing the test to pass.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1ef1d45a9e54814cc0b471e5377e47bd7e0cd2a8 10-Jan-2013 Barak Witkowski <barak@broadcom.com> bnx2x: Allow management traffic after boot from SAN

As part of the previous driver unload flow, whenever bnx2x is
loaded after the UNDI driver it closes all Rx traffic.
However, this leads to management traffic also being stopped until
the network interface associated with one of its functions gets loaded.

To remedy this, management traffic is re-opened once the 'cleaning'
after the previous driver ends.

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
238268503f306cdc435eff2181e38c08ce412ed5 09-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: align define usage to satisfy static checkers

Static checkers complained that the E1H_FUNC_MAX define is used
incorrectly in bnx2x_pretend_func(). The complaint was justified,
although its not a real bug, as the first part of the conditional
protects us in this case (a real bug would happen if a VF tried to
use the pretend func, but there are no VFs in E1H chips).

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
aaeb6cdfa5c07533c2cd6d2c381374c69f7db9dc 08-Jan-2013 Jiri Pirko <jiri@resnulli.us> remove init of dev->perm_addr in drivers

perm_addr is initialized correctly in register_netdevice() so to init it in
drivers is no longer needed.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
6411280ac94db94a09770807d3871d2661803604 07-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Segregate SR-IOV code

In this patch the SR-IOV code is segregated from the main bulk of
the bnx2x code. The CONFIG_BNX2X_SRIOV define is added to Broadcom's
Kconfig, and allows the elision of the building of all the SR-IOV
support code in the driver.
The define is dependant on the kernel CONFIG_PCI_IOV configuration
define.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
d82603c6da7579c50ebe3fe7da6e3e267d9f6427 27-Dec-2012 Jorrit Schippers <jorrit@ncode.nl> treewide: Replace incomming with incoming in all comments and strings

Signed-off-by: Jorrit Schippers <jorrit@ncode.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
8395be5e04647c56fa6b9cac6dfd6ae16bcb7de3 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Add VF device ids and enable feature

Add the various VF device ids (of all supported hardware)
Add the calls to enable_sriov and disable_sriov to enable the
SR-IOV feature. This patch also advances the version and release
date of the bnx2x module.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
abc5a021ba645cd162205209bd5664a0d4b866a6 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Support PF <-> VF Bulletin Board

The PF <-> VF Bulletin Board is a simple interface between the
PF and the VF. The main reason for the Bulletin Board is to allow
the PF to be the initiator. The VF publishes at 'acquire' stage
the GPA of a Bulletin Board structure it has allocated. The PF notes
this GPA in the VF database. The VF samples the Bulletin Board
periodically for new messages. The latest version of the BB is always
used.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
d16132cef8a72ff7563aff95f03bf505779fe3e6 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Support VF FLR

The FLR indication arrives as an attention from the management processor.
Upon VF flr all FLRed function in the indication have already been
released by Firmware and now we basically need to free the resources
allocated to those VFs, and clean any remainders from the device
(FLR final cleanup).

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f1929b016c2161c364e45c21788aaae938ae557c 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Support of PF driver of a VF release request

The 'release' request is the opposite of the 'acquire' request.
At release, all the resources allocated to the VF are reclaimed.
The release flow applies the close flow if applicable.
Note that there are actually two types of release:
1. The VF has been removed, and so issued a 'release' request
over the VF <-> PF Channel.
2. The PF is going down and so has to release all of it's VFs.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
67c431a5f2f3e0dda511509ed5773346839c07c0 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Support statistics collection for VFs by the PF

Statistics are collected by the PF driver. The collection is
performed via a query sent to the device which is basically an array
of 3-tuples of the form (statistics client, function, DMAE address).
In this patch the PF driver adds to the query, on top of the
statistics clients it is maintaining for itself (rss queues, storage,
etc), the 3-tuples for the VFs it is maintaining. The addresses used
are the GPAs of the statistics buffers supplied by the VF in the
init message on the VF <-> PF channel. The function parameter
ensures that the iommu will translate the GPA to the correct physical
address.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b93288d5e7efc57628c59fe3f1844fb87982b409 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Support of PF driver of a VF init request

The VF driver will send an 'init' request as part of its nic load
flow. This message is used by the VF to publish the GPA's of its
status blocks, slow path ring and statistics buffer.
The PF driver notes all this down in the VF database, and also uses
this message to transfer the VF to VF_INIT state internally.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
fd1fc79dd6deb88ebf38ae9673190da999b3209f 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Infrastructure for VF <-> PF request on PF side

Support interrupt from device which indicates VF has placed
A request on the VF <-> PF channel.
The PF driver issues a DMAE to retrieve the request from the VM
memory (the Ghost Physical Address of the request is contained
in the interrupt. The PF driver uses the GPA in the DMAE request,
which is translated by the IOMMU to the correct physical address).
The request which arrives is examined to recognize the sending VF.
The PF driver allocates a workitem to handle the VF Operation (vfop).

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b56e9670ffa4de1a3cf0ca2f89ff5e2e0c31a1f7 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Prepare device and initialize VF database

At nic load of the PF, if VFs may be present, prepare the device
for the VFs. Initialize the VF database in preparation of VF arrival.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
290ca2bb456d4214f00ba0b83fcb9793963fe007 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Allocate VF database in PF when VFs are present

When A PF determines that it may have to manage SRIOV VFs it
allocates a database for this purpose. The database is intended to
keep track of the VF state, the resources allocated for each VF
(queues, interrupt vectors, etc), the state of the VF's queues.
When the VF loads the database is updated accordingly.
When A VF closes the database is consulted to determine which
resources need to be released (close queues against device, reclaim
interrupt vectors, etc).

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
dc1ba591463ca0f7ba2ac9af6ee4a5305f27ca1f 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: VF fastpath

When VF driver is transmitting it must supply the correct mac
address in the parsing BD. This is used for firmware validation
and enforcement and also for tx-switching.
Refactor interrupt ack flow to allow for different BAR addresses of
the hardware in the PF BAR vs the VF BAR.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
381ac16b10ae9369ebbbd74bb52b970818f68022 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Support ndo_set_rxmode in VF driver

The VF driver uses the 'q_filter' request in the VF <-> PF channel to
have the PF configure the requested rxmode to device. ndo_set_rxmode
is called under bottom half lock, so sleeping until the response
arrives over the VF <-> PF channel is out of the question. For this reason
the VF driver returns from the ndo after scheduling a work item, which
in turn processes the rx mode request and adds the classification
information through the VF <-> PF channel accordingly.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9b176b6b63ed07472c26b6833a0ac23b373e6bf8 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Add teardown_q and close to VF <-> PF channel

When a VF is being closed its queues are released via
the 'teardown_q' and the VF itself is closed with
'close'. These are essentially the unload counterparts of
'init' and 'setup_q' from the load flow.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8d9ac297d18dbe05b6e7cb4378da51e67143b452 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Add init, setup_q, set_mac to VF <-> PF channel

'init' - init an acquired VF. Supply allocation GPAs to PF.
'setup_q' - PF to allocate a queue in device on behalf of the VF.
'set_mac' - PF to configure a mac in device on behalf of the VF.
VF driver uses these requests in the VF <-> PF channel in nic_load
flow.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ad5afc89365e981cffafc241a4c46f56ca943370 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Separate VF and PF logic

Generally, the VF driver cannot access the chip, except by the
narrow window its BAR allows. Care had to be taken so the VF driver
will not reach code which accesses the chip elsewhere.
Refactor the nic_load flow into parts so it would be
easier to separate the VF-only logic from the PF-only logic.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4513f92576856c552212fb9608aca56b88022454 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Add to VF <-> PF channel the release request

VF driver uses this request when removed. The PF driver
reclaims all resources allocated for that VF at this
time.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
be1f1ffaf9acf06f556a00e2d1548c70af2b6dea 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: VF <-> PF channel 'acquire' at vf probe

Add the 'acquire' request to VF <-> PF channel and use it at
VF probe. In the acquire request the VF driver lists the resources
it would like to have. In the response the PF either ratifies the
request, or denies it and supplies the maximum values supported.
The VF may then attempt another acquire request.
This patch adds the bnx2x_vfpf.c file which contains the
implementation of the VF to PF hardware channel.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1ab4434c64f8d4786e4a26299e0ebb138a0a6415 01-Jan-2013 Ariel Elior <ariele@broadcom.com> bnx2x: Support probing and removing of VF device

To support probing and removing of a bnx2x virtual function
the following were added:
1. add bnx2x_vfpf.h: defines the VF to PF channel
2. add bnx2x_sriov.h: header for bnx2x SR-IOV functionality
3. enumerate VF hw types (identify VFs)
4. if driving a VF, map VF bar
5. if driving a VF, allocate Vf to PF channel
6. refactor interrupt flows to include VF

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1dd06ae8db716e17ec7e06244b858606edf378c0 06-Dec-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> drivers/net: fix up function prototypes after __dev* removals

The __dev* removal patches for the network drivers ended up messing up
the function prototypes for a bunch of drivers. This patch fixes all of
them back up to be properly aligned.

Bonus is that this almost removes 100 lines of code, always a nice
surprise.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
c63da990cd63153ce5203f96822638a7ef0f9bf7 06-Dec-2012 Barak Witkowski <barak@broadcom.com> bnx2x: Prevent link flaps when booting from SAN.

It is possible that the driver is configured to operate with a certain
link configuration which differs from the link's configuration during
boot from SAN - this would cause the driver to flap the link.

Said flap may be missed by specific switches, causing dcbx convergence
to be too long and boot sequence to fail. Convergence is longer because
switch ignores new dcbx packets due to counters mismatch, as only host
side reset the counters due to the link flap.

This patch causes the driver to ignore user's initial configuration during
boot from SAN, and continues with the existing link configuration.

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4bd9b0fffb193d2e288f67f81821af32df8d4349 06-Dec-2012 Michael Chan <mchan@broadcom.com> cnic, bnx2x, bnx2: Simplify cnic probing.

Instead of using symbol_get(), cnic can now directly call the cnic_probe
functions in struct bnx2x and struct bnx2. symbol_get() is not reliable
as it fails when the module is still initializing.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0329aba13791ec256dacdfdc74eca8673f6dd2e8 03-Dec-2012 Bill Pemberton <wfp5p@virginia.edu> bnx2x: remove __dev* attributes

CONFIG_HOTPLUG is going away as an option. As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
092a5fc9636268bc2c0fef4d9b99845699cf19f9 03-Dec-2012 Yaniv Rosner <yaniv.rosner@broadcom.com> bnx2x: recognize fan failure

If fan failure is detected, MCP prevents PCI I/O registers from being
mapped to the bar, causing a fatal error as driver is unaware.

This patch recognizes such an event occurred and gracefully terminates
the probe process.

Signed-off-by: Yaniv Rosner <yaniv.rosner@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
cd1dfce2ed571bc3d1962987b5c7d2d6e936bb27 02-Dec-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: fix 'Ethtool -A' when autoneg

When configuring pauses using 'ethtool -A', the requested values have
effect when used together with autoneg (up to this point, when configured
for autoneg, driver ignored requested pause configuration)

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0370cf901dd923ce784efe486c8ba66babad693b 02-Dec-2012 Barak Witkowski <barak@broadcom.com> bnx2x: prevent DCB if disabled in nvram

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
27c1151c324b5a7dacd2d03e54b7c99aa5b67f27 02-Dec-2012 Yaniv Rosner <yaniv.rosner@broadcom.com> bnx2x: Handle a rarely missed interrupt

A rare case of no link due to a missed interrupt may occur due to a
race condition between acknowledging the IGU via the BAR and restoring the NIG
interrupt mask via the GRC.
To solve it, we wait for the IGU ack command to finish prior to restoring the
NIG interrupt mask.

Signed-off-by: Yaniv Rosner <yaniv.rosner@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b343d0025b08a1ef543e3cabf8b753d84b938d48 02-Dec-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: mask CPL_OF interrupt

Unmasked interrupt caused "FATAL HW block attention set2 0x20" messages
to erroneously appear, as the associated interrupt is fully recoverable.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9b341bb1d8e6bc9f00044bd9d66824505b127e4a 02-Dec-2012 Barak Witkowski <barak@broadcom.com> bnx2x: IGU parse error cause probe failure

If IGU parse error is encountered during the probing process, the error
propagates and the probe gracefully fails (until now, such errors were ignored,
later causing mischief).

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
382e513a18ef988e547b0744c63c110aa052afd2 02-Dec-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Ext. config accessed only on non-E1x.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7964211d3891d0271c5fc8087cd49c018b30476d 02-Dec-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: nvram enables dropless flow control

It is now possible to enable dropless flow control via nvram.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c55e771b7e6274f7e12d5bcaa8e7dec8a1e41c42 02-Dec-2012 Barak Witkowski <barak@broadcom.com> bnx2x: parity recovery flow enhancement

Parity recovery was enhanced in order to handle a few more corner cases.

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
d6d99a3f7e9169ef351340b217b48accab78e849 02-Dec-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: revised and corrected SPIO access

Changed naming convention of SPIO macros, and prevented access to invalid SPIOs.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8203c4b6c9debbf19517cc6594d5d6779e2c57bf 27-Nov-2012 Yaniv Rosner <yanivr@broadcom.com> bnx2x: Always take PHY lock

Taking PHY lock is not required on some older designs, but we are removing this
complication and always taking it since it is always required on newer designs
and does not worth the code complication on the older boards.

Taking PHY lock was initially required only on specific boards which had their
MDC/MDIO bus crossed, but since this lock is now always required, for example,
when NCSI is present, the PHY lock will always be taken.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
55386fe88349706ae570522180d89892883af2b5 27-Nov-2012 Yaniv Rosner <yanivr@broadcom.com> bnx2x: Change MDIO clock settings

When drivers works on top of an old bootcode, it is theoretically subjected to
MDC/MDIO failures since the MDIO clock is set in the beginning of each sequence,
rather than per CL45 command. On rare cases an old bootcodes may change that in
the middle, so to address that, the MDIO clock is set for each CL45 access.
In addition, setting the MDIO clock is now done per EMAC base, and
not per port number, since a specific port can potentially use both EMACs for
different PHY accesses.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b884d95b8222a50144e3d84fe9becedae836e56d 27-Nov-2012 Yaniv Rosner <yanivr@broadcom.com> bnx2x: Activate LFA

In case Link Flap Avoidance feature is supported by the MCP, bnx2x will enable
it, and will pass the appropriate parameter when load request is sent to
the MCP.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4a25417c20fac00b3afd58ce27408f964d19e708 22-Nov-2012 Ariel Elior <ariele@broadcom.com> bnx2x: remove redundant warning log

fix bug where a register which was only meant to be read in 578xx/57712
devices causes a bogus error message to be logged when read from other
devices.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
910cc727bf5cba11ce51be86fa2fb2454b10f3d9 11-Nov-2012 Merav Sicron <meravs@broadcom.com> bnx2x: Add static declaration to several functions

This patch adds static declaration to several functions in bnx2x. It eliminates
newly introduced sparse warnings reported by Fengguang Wu.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
55c11941e382cb26010138ab824216f47af37606 07-Nov-2012 Merav Sicron <meravs@broadcom.com> bnx2x: Support loading cnic resources at run-time

This patch replaces the BCM_CNIC define with a flag which can change at run-time
and which does not use the CONFIG_CNIC kconfig option.
For the PF/hypervisor driver cnic is always supported, however allocation of
cnic resources and configuration of the HW for offload mode is done only when
the cnic module registers bnx2x.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2b674047bef23d49a7ca8ec32f4b9e4e12588621 28-Oct-2012 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: fix HW initialization using fw 7.8.x

Since commit 96bed4b9 (use FW 7.8.2) BRB HW block needs to be
initialized using fw values for all devices.
Otherwise ETS on 57712/578xx will not work.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
477864ddd36510e9802c2adb6d9445c2d7783fe5 31-Oct-2012 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: Disable FCoE for 57840 since not yet supported by FW

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
786fdf0bbf1c3a1b402bb2da946b93e0b36a8f32 02-Oct-2012 Dan Carpenter <dan.carpenter@oracle.com> bnx2x: use strlcpy() to copy a string

DRV_MODULE_VERSION is smaller than the ->version buffer so the memcpy()
copies 1 byte past the end of the string. It's not super harmful, but
it makes the static checkers complain.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
185d4c8bf579322e1c2835d70729bc30f6f80f55 20-Sep-2012 Ariel Elior <ariele@broadcom.com> bnx2x: remove false warning regarding interrupt number

Since version 7.4 the FW configures in the pci config space the max
number of interrupts available to the physical function, instead of
the exact number to use.
This causes a false warning in driver when comparing the number of
configured interrupts to the number about to be used.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7b5342d9026d537cbc01fd30b7cd9bac9b07b5ad 11-Sep-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Add missing afex code

Commit a334872224a67b614dc888460377862621f3dac7 added afex support but lacked
several logical changes. This lack can cause afex to crash, and also
have a slight effect on other flows (i.e., driver always assumes the Tx ring
has less available buffers than what it actually has).

This patch adds the missing segments, fixing said issues.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5d07d8680692a208be0466a352c9fde7eec2afa7 13-Sep-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Utilize Link Flap Avoidance

Change various flows in the bnx2x driver which up until now flapped
the link - these flows now benefit from the link flap avoidance mechanism.

This includes the removal of the link reset made upon nic init, as it is
possible the link is already active at that time.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Yaniv Rosner <yaniv.rosner@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3646f0e5c97703cecfd96cdabb085e78d9b7f680 07-Sep-2012 Stephen Hemminger <shemminger@vyatta.com> netdev: make pci_error_handlers const

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
14a15d618743ebc4936fe03073bf0c75024d3a07 27-Aug-2012 Merav Sicron <meravs@broadcom.com> bnx2x: Correct the ndo_poll_controller call

This patch correct poll_bnx2x (ndo_poll_controller call) which was not
functioning well with MSI-X.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
26614ba5445fe31a69068a5e94266fa08b4ee345 27-Aug-2012 Merav Sicron <meravs@broadcom.com> bnx2x: Move netif_napi_add to the open call

Move netif_napi_add for all queues from the probe call to the open call, to
avoid the case that napi objects are added for queues that may eventually not
be initialized and activated. With the former behavior, the driver could crash
when netpoll was calling ndo_poll_controller.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2a80eebcbf3e0f2cc7df6aced54058fbdff37518 20-Aug-2012 Jiang Liu <jiang.liu@huawei.com> bnx2x: Use PCI Express Capability accessors

Use PCI Express Capability access functions to simplify bnx2x driver.

[bhelgaas: split bnx2x and tg3 into separate patches]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2070ffa2c8d4dc17cd8fc4b30d2710bcde27b051 09-Aug-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Fix recovery flow cleanup during probe

During probe, every function probed clears the recovery registers from
all functions on its path - thus signaling that given a future recovery
event, there will be no need to wait for those functions.

This is a flawed behaviour - each function should only be responsible
for its own bit.

Since this registers are handled during the load/unload routines,
this cleanup is removed altogether.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8eee694c3e667e6f0856d9c8525208058f9d42bf 09-Aug-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: fix unload previous driver flow when flr-capable

The existing previous driver unload flow is flawed, causing the probe of
functions reaching the 'uncommon fork' in flr-capable devices to fail.

This patch resolves this, as well as fixing the flow for hypervisors which
disable flr capabilities from functions as they pass them as PDA to VMs,
as we cannot base the flow on the pci configuration space.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ea4b3857861fe147137517da200d04cbbc91ad49 29-Jul-2012 Devendra Naga <develkernel412222@gmail.com> bnx2x: remove cast around the kmalloc in bnx2x_prev_mark_path

casting the void pointer is redundant (Documentation/CodingStyle)

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c3def943c7117d42caaed3478731ea7c3c87190e 23-Jul-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Add new 57840 device IDs

The 57840 boards come in two flavours: 2 x 20G and 4 x 10G.
To better differentiate between the two flavours, a separate device ID
was assigned to each.
The silicon default value is still the currently supported 57840 device ID
(0x168d), and since a user can damage the nvram (e.g., 'ethtool -E')
the driver will still support this device ID to allow the user to amend the
nvram back into a supported configuration.

Notice this patch contains lines longer than 80 characters (strings).

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1aa8b471e09f227455c11d55c4bc94a655ee8497 10-Jul-2012 Ben Hutchings <bhutchings@solarflare.com> drivers/net/ethernet: Fix non-kernel-doc comments with kernel-doc start markers

Convert doxygen (or similar) formatted comments to kernel-doc or
unformatted comment. Delete a few that are content-free.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2e499d3cc13365a87815266dda59904dcb8c8d6c 26-Jun-2012 Barak Witkowski <barak@broadcom.com> bnx2x, bnx2fc, bnx2i, cnic: Add statistics support and FCoE capabilities advertisement

1. When FCoE offload driver is registered, copy its capabilities to the chip
scratchpad.
2. Copy FCoE/iSCSI MAC addresses in aligned manner to chip scratchpad.
3. Add FCoE/iSCSI statistics collection support

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9876879fce3081cd9f3f2b9e995954d423bcd863 19-Jun-2012 Barak Witkowski <barak@broadcom.com> bnx2x: Support DCBX for all functions

In multi-function device, allow configuring dcbx admin params from all drivers
on a single physical port.

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0e8d2ec5c6ccf74dbe40216bb62d82c2f73fe836 19-Jun-2012 Merav Sicron <meravs@broadcom.com> bnx2x: Add support for ethtool -L

Add support for ethtool -L/-l for setting and getting the number of RSS queues.
The 'combined' field is used as we don't support separate IRQ for Rx and Tx.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
60aa0509056616afe9d66cf0fcd290589395032c 19-Jun-2012 Merav Sicron <meravs@broadcom.com> bnx2x: Allow up to 63 RSS queues

This patch removed the limitation in the code for 16 RSS queues.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15192a8cf8a8d16e0ff38a144c8a4630c94f9fd6 19-Jun-2012 Barak Witkowski <barak@broadcom.com> bnx2x: Split the FP structure

This patch moves some fields out of the FP structure to different structures, in
order to minimize size of contigiuous memory allocated.

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
37ae41a965fbb810b6a98df7df8ab46fefcc15eb 19-Jun-2012 Merav Sicron <meravs@broadcom.com> bnx2x: Move the CNIC L2 CIDs to be right after the RSS CIDs

Currently the CNIC-related L2 CIDs (for sending control FCoE / iSCSI packets)
were at fixed position, according to the maximal number of RSS queues multiplied
by the number of traffic-classes. This change makes the CIDs dynamic, as they
are defined to be right after the highest RSS CID. This decreases the memory
allocated for the context.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
65565884fba67d9254f32d239b0fb6c38fae88aa 19-Jun-2012 Merav Sicron <meravs@broadcom.com> bnx2x: Make the transmission queues adjacent

In the current scheme the transmission queues of traffic-class 0 were 0-15, the
transmission queues of traffic-class 1 were 16-31 and so on. If the number of
RSS queues was smaller than 16, there were gaps in transmission queues
numbering, as well as in CIDs numbering. This is both a waste (especially when
16 is increased to 64), and may causes problems with flushing queues when
reducing the number of RSS queues (using ethtool -L). The new scheme eliminates
the gaps.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
a052997ea32164b2466daff8db5f783131184dae 19-Jun-2012 Merav Sicron <meravs@broadcom.com> bnx2x: Allow more than 64 L2 CIDs

With increased number of RSS queues, each multiplied by the number of traffic-
classes, we may have up to 64*3=192 CIDs. The current driver scheme with regard
to context allocation supports only 64 CIDs. The new scheme enables scatter-
gatehr list of pages for the context.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8970b2e4393a34ddf5832f9c1568a88087b0d948 19-Jun-2012 Merav Sicron <meravs@broadcom.com> bnx2x: Add support for external LB

This change enables to do self-test with external loopback via ethtool.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c8c60d88c59cbb48737732ba948663a3efe882aa 06-Jun-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: Added EEE support

This patch adds energy efficient energy support (802.3az) to bnx2x
boards with 84833 phys (and sufficiently new BC and external FW).

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
24f06716cd5dbfc3d737ec2a24ac58ef76f68dc7 06-May-2012 Ariel Elior <ariele@broadcom.com> bnx2x: bug fix when loading after SAN boot

This is a bug fix for an "interface fails to load" issue.
The issue occurs when bnx2x driver loads after UNDI driver was previously
loaded over the chip. In such a scenario the UNDI driver is loaded and operates
in the pre-boot kernel, within its own specific host memory address range.
When the pre-boot stage is complete, the real kernel is loaded, in a new and
distinct host memory address range. The transition from pre-boot stage to boot
is asynchronous from UNDI point of view.

A race condition occurs when UNDI driver triggers a DMAE transaction to valid
host addresses in the pre-boot stage, when control is diverted to the real
kernel. This results in access to illegal addresses by our HW as the addresses
which were valid in the preboot stage are no longer considered valid.
Specifically, the 'was_error' bit in the pci glue of our device is set. This
causes all following pci transactions from chip to host to timeout (in
accordance to the pci spec).

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
69c326b38f2f895ca4f09fd9b65782a021f4ba6c 02-May-2012 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: fix handling single MSIX mode for 57710/57711

commit 30a5de7723a8a4211be02e94236e9167a424fd07 added
ability to use single MSI-X vector, but lack proper
handling for 57710/57711 HW

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1191cb83489e6ee87a38ae5b127651f4a7c438dc 27-Apr-2012 Eric Dumazet <edumazet@google.com> bnx2x: remove some bloat

Before doing skb->head_frag work on bnx2x driver, I found too much stuff
was inlined in bnx2x/bnx2x_cmn.h for no good reason and made my work not
very easy.

Move some big functions out of this include file to the respective .c
file.

A lot of inline keywords are not needed at all in this huge driver.

text data bss dec hex filename
490083 1270 56 491409 77f91 bnx2x/bnx2x.ko.before
484206 1270 56 485532 7689c bnx2x/bnx2x.ko

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Maciej Żenczykowski <maze@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Tom Herbert <therbert@google.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Ben Hutchings <bhutchings@solarflare.com>
Cc: Matt Carlson <mcarlson@broadcom.com>
Cc: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
94b2f9ba4c87d155446957ee413e34298cbe7554 23-Apr-2012 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: remove gro workaround

Removes GRO workaround, as issue is fixed in FW 7.2.51.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
a334872224a67b614dc888460377862621f3dac7 23-Apr-2012 Barak Witkowski <barak@broadcom.com> bnx2x: add afex support

Following patch adds afex multifunction support to the driver (afex
multifunction is based on vntag header) and updates FW version used to 7.2.51.

Support includes the following:

1. Configure vif parameters in firmware (default vlan, vif id, default
priority, allowed priorities) according to values received from NIC.
2. Configure FW to strip/add default vlan according to afex vlan mode.
3. Notify link up to OS only after vif is fully initialized.
4. Support vif list set/get requests and configure FW accordingly.
5. Supply afex statistics upon request from NIC.
6. Special handling to L2 interface in case of FCoE vif.

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
963052348fd33221d9ae4212d6cdaa2346e2678e 03-Apr-2012 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: change to the rss engine

This patch revises the way by which rss are configured, removing
an unnecessary module paramater and unrequired modes.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b475d78f464195cbdeeda0d80a2ffbd54653a4bd 03-Apr-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: congestion management re-organization

The congestion management code has migrated into a common location,
allowing all fw writes controlling mf congestion to be made in a
single function in the code. This is a semantic change.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7e8e02df17106007f4b043a39d22682f74df6f6f 03-Apr-2012 Barak Witkowski <barak@broadcom.com> bnx2x: Added support for a new device - 57811

Notice this patch includes lines with over 80 characters, as to not
break strings.

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
30a5de7723a8a4211be02e94236e9167a424fd07 03-Apr-2012 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: added support for working with one msix irq.

Until now, the bnx2x driver needed at least 2 available msix interrupt
vectors in order to use msix. This patch add the possibility of configuring
msix when only one interrupt vector is available.
Notice this patch contains lines with over 80 characters, as it keeps print
strings in a single line.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
79a8557a6d18c3861d64ae110ddd7606c65d7504 03-Apr-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: enable inta on the pci bus when used

During boot-from-SAN, if msix interrupts are unavailable and inta
is requested, it is possible that inta would be disabled in the
pci bus. This patch enables inta when requested.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
32d68de1cd267f811d72f189cbaba3af624f0fd5 03-Apr-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: remove unnecessary dmae code

Removed uninformative debug prints, as well as two functions
which were hardly used in the code.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ef81442f728ffcf30ccbc6db253df8e35a5182c4 03-Apr-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: remove unnecessary .h dependencies

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
452427b015b1b0cbbef7b6207908726837d39d57 26-Mar-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: previous driver unload revised

The flow in which the bnx2x driver starts after a previous driver
has been terminated in an 'unclean' manner has several bugs and
FW risks, which makes it possible for the driver to fail after
boot-from-SAN or kdump.
This patch contains a revised flow which performs a safer
initialization, solving the possible crash scenarios.
Notice this patch contains lines with over 80 characters, as it
keeps print-strings in a single line.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
de1288041d01120559d53ebd98e0f92476ee56d3 18-Mar-2012 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: validate FW trace prior to its printing

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9e62e912e56742af7eb7e0eeba3c7af4bb2f8537 18-Mar-2012 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: changed iscsi/fcoe mac init and macros

This includes changes in macros to better distinguish between the two
protocols, and slightly changed the way their macs are set.
Notice this file contains string print lines with more than 80 characters,
as to not break prints.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3b60306690569927951be09160e80a8af9c94db4 18-Mar-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: reduced sparse warnings

This patch reduces sparse warnings in the bnx2x code,
mostly by changing functions into static and changing
initialization of structures.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
51c1a580b1e07d58eb063f9f4a70aea8ad32fe23 18-Mar-2012 Merav Sicron <meravs@broadcom.com> bnx2x: revised driver prints

We've revised driver prints, changing the mask of existing prints
to allow better control over the debug messages, added prints to
error scenarios, removed unnecessary prints and corrected some spelling.
Please note that this patch contains lines with over 80 characters,
as string messages were kept in a single line.

Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c0ea452e422a1fc78ec8c639df64012d0b8dbb4a 15-Mar-2012 Michal Schmidt <mschmidt@redhat.com> bnx2x: fix memory leak in bnx2x_init_firmware()

When cycling the interface down and up, bnx2x_init_firmware() knows that
the firmware is already loaded, but nevertheless it allocates certain
arrays anew (init_data, init_ops, init_ops_offsets, iro_arr). The old
arrays are leaked.

Fix the leaks by returning early if the firmware was already loaded.
Because if the firmware is loaded, so are the arrays.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
127d0a198a310970b31866af8bbb6d4b1068e546 15-Mar-2012 Michal Schmidt <mschmidt@redhat.com> bnx2x: fix a crash on corrupt firmware file

If the requested firmware is deemed corrupt and then released, reset the
pointer to NULL in order to avoid double-freeing it in
bnx2x_release_firmware() or dereferencing it in bnx2x_init_firmware().

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
259afa1f725dc7ec1626835b9ac54827a46cdf80 12-Mar-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: use param's id instead of sp_obj's id

Previously, we've used the object's function id instead of using the
input's value. This is remedied, as in other flows.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
fe603b4d680a2bba9d8c6d4267450fcf295f30d1 20-Feb-2012 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: add gro_check

The patch provides workaround for BUG in FW 7.2.16,
which in GRO mode may miscalculate buffer and
place on SGE one frag less than it could.
It may happen only for some MTUs, we mark these MTUs
with gro_check flag during device initialization or
MTU change.

Next FW should include fix for the issue and the
patch could be reverted.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
621b4d66b27e70ba9a0e8fa4676d9c4f916c8343 20-Feb-2012 Dmitry Kravkov <dmitry@broadcom.com> use FW 7.2.16

The patch integrates FW 7.2.16 HSI and implements driver
part of GRO flow.

FW 7.2.16 adds the ability to aggregate packets for GRO
(and not just LRO) and also fixes some bugs.

1. Added new aggregation mode: GRO. In this mode packets are aggregated
such that the original packets can be reconstructed by the OS.
2. 57712 HW bug workaround - initialized all CAM TM registers to 0x32.
3. Adding the FCoE statistics structures to the BNX2X HSI.
4. Wrong configuration of TX HW input buffer size may cause theoretical
performance effect. Performed configuration fix.
5. FCOE - Arrival of packets beyond task IO size can lead to crash.
Fix firmware data-in flow.
6. iSCSI - In rare cases of on-chip termination the graceful termination
timer hangs, and the termination doesn't complete. Firmware fix to MSL
timer tolerance.
7. iSCSI - Chip hangs when target sends FIN out-of-order or with isles
open at the initiator side. Firmware implementation corrected to drop
FIN received out-of-order or with isles still open.
8. iSCSI - Chip hangs when in case of retransmission not aligned to 4-bytes
from the beginning of iSCSI PDU. Firmware implementation corrected
to support arbitrary aligned retransmissions.
9. iSCSI - Arrival of target-initiated NOP-IN during intense ISCSI traffic
might lead to crash. Firmware fix to relevant flow.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
56ad315250bec1cd239c18712e072d1ff1f4aaf3 16-Feb-2012 Michal Schmidt <mschmidt@redhat.com> bnx2x: make bnx2x_close() static again

Commit 8304859a "bnx2x: add fan failure event handling" made the function
bnx2x_close() non-static unnecessarily. The function is not called from
other sources. Make it static again.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Acked-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7ce5d222190cb3ce3ae88bafde7c4fa52a5103e0 15-Feb-2012 Danny Kukawka <danny.kukawka@bisect.de> net: use eth_hw_addr_random() and reset addr_assign_type

Use eth_hw_addr_random() instead of calling random_ether_addr()
to set addr_assign_type correctly to NET_ADDR_RANDOM.

Reset the state to NET_ADDR_PERM as soon as the MAC get
changed via .ndo_set_mac_address.

v2: adapt to renamed eth_hw_addr_random()

Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
04f2d51313938d004983652ea6162d4940d83a04 15-Feb-2012 Mintz Yuval <yuvalmin@broadcom.com> bnx2x: removed code re-checking memory base after device open

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10bd1f243c3a5ea1aebae88d21932e5614afa9cc 15-Feb-2012 Mintz Yuval <yuvalmin@broadcom.com> bnx2x: allow BCM84833 phy to advertise 100Base-T speeds

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
82fa848c117e57f0b3fd848f2aaf3f6859f42201 15-Feb-2012 Mintz Yuval <yuvalmin@broadcom.com> bnx2x: notify cnic of address of info-to-the-mcp

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1355b704b9ba44182a97c90b4480d79f0de8f040 15-Feb-2012 Mintz Yuval <yuvalmin@broadcom.com> bnx2x: consistent statistics after internal driver reload

Currently bnx2x statistics are reset by inner driver reload, e.g. by MTU
change. This patch fixes this issue - from now on statistics should only
be reset upon device closure.
Thanks to Michal Schmidt <mschmidt@redhat.com> for his initial patch
regarding this issue.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
fc543637525b59af38af2ce09a4dbdd7d5eb27bf 14-Feb-2012 Michal Schmidt <mschmidt@redhat.com> bnx2x: remove the 'poll' module option

'poll' was a debugging option, but turning it on these days leads to
kernel panic. Remove it.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
41de8d4cff21a2e81e3d9ff66f5f7c903f9c3ab1 29-Jan-2012 Joe Perches <joe@perches.com> drivers/net: Remove alloc_etherdev error messages

alloc_etherdev has a generic OOM/unable to alloc message.
Remove the duplicative messages after alloc_etherdev calls.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
e404decb0fb017be80552adee894b35307b6c7b4 29-Jan-2012 Joe Perches <joe@perches.com> drivers/net: Remove unnecessary k.alloc/v.alloc OOM messages

alloc failures use dump_stack so emitting an additional
out-of-memory message is an unnecessary duplication.

Remove the allocation failure messages.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
85b26ea18ee63be83d65ec6db72ad7857980a04b 26-Jan-2012 Ariel Elior <ariele@broadcom.com> bnx2x: Update version to 1.72.0 and copyrights

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7a752993fe90adf8e150cc1a85beef5f782429e7 26-Jan-2012 Ariel Elior <ariele@broadcom.com> bnx2x: Recoverable and unrecoverable error statistics

Add statistics for tracking parity errors from which we successfully
recovered and those which were deemed unrecoverable.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
95c6c6165eaf5a031bcf31606e081c72e4acdeb8 26-Jan-2012 Ariel Elior <ariele@broadcom.com> bnx2x: Recovery flow bug fixes

1. Sample mcp pulse and mcp sequence in nic load instead of in init_one
as they may change by the time we want to use them.

2. Allow cnic to access device during nic load (by adding a new "LOADING" state
to recovery flow). This prevents the unnecessary cnic timeout which resulted
by cnic attempting to access because nic is loading, but being blocked because
of the Recovery state.

3. Issue 'fake' driver load command to mcp when last driver unloads to prevent
mcp from taking ownership. When recovery is complete unload fake driver to
allow mcp to initialize the hardware before first driver loads.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
889b9af34f986138eebebfe781567cb950b3a22b 26-Jan-2012 Ariel Elior <ariele@broadcom.com> bnx2x: Track active PFs with bitmap

The recovery register (to which a hardware lock has been added in previous
patch) is used amongst other things to track the active PFs. The old
implementation which used a per path counter is not viable in a virtualized
environment where a pf may increment the counter and then have the kernel
crash around it preventing the counter from ever reaching zero.
In the new implementation the scenario described will result in the PF timing
out against the mcp, which will clear the PF's bit in the bitmask allowing
recovery process to proceed.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f16da43b5df947cef427f19b8f5c4b2f5d566231 26-Jan-2012 Ariel Elior <ariele@broadcom.com> bnx2x: Lock PF-common resources

Use hardware locks to protect resources common to several Physical Functions. In
a virtualized environment the RTNL lock only protects a PF's driver against
the PFs sharing it's VMs with regard to device resources. Other PFs may reside
in other VMs under other OSs, and are not subject to the lock. Such resources
which were previously protected implicitly by the RTNL lock must now be
protected explicitly with dedicated HW locks.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
89db4ad830fbdde9c2d990b88bbac8245718177d 26-Jan-2012 Ariel Elior <ariele@broadcom.com> bnx2x: Function Level Reset Final Cleanup

1. Fix bug where return value is ignored
2. Improve printouts
3. Fix typos

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c22610d0001ebf3420d39f419056a56c5aa43096 26-Jan-2012 Ariel Elior <ariele@broadcom.com> bnx2x: Obtain Bus Device Function from register

BDF was obtained from kernel but since in virtualized environment
(e.g. physical device assigment in KVM) the function number may
not be the real one, the info must be obtained from the device.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
127a425e8f05b9813879e8ca909ef4338ec8ec04 26-Jan-2012 Ariel Elior <ariele@broadcom.com> bnx2x: Removing indirect register access

In virtualized environments indirect access to the device may not be supported
(depending on the Hypervisor type). Indirect device access was used since in
some harware contexts (i.e. certain chipset and BIOS) every access the driver
makes across the pci is followed by a BIOS initiated Zero Length Read to the
same address. When accessing widebus registers this zero length read corrupts
the serialization of the read/write sequence resulting with errors. To avoid
this problem widebus registers are always accessed via the DMAE or the indirect
interface. However, the 57712x and 578xx devices intercept the zero length read
and so using the indirect interface with these devices is not necessary. Since
PDA is only supported for 57712x and 578xx the indirect access to device was
restricted to 57710 and 57711x.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
44151acb9f13563e40d40d14c3e5c11ce21b59e1 23-Jan-2012 Yuval Mintz <yuvalmin@broadcom.com> bnx2x: fix compilation error with SOE in fw_dump

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
65087cfee50595185f6bbf3d78272eeb34186d2b 23-Jan-2012 Ariel Elior <ariele@broadcom.com> bnx2x: handle CHIP_REVISION during init_one

The macro `CHIP_IS_E1x' requires `bp' to be initialized.
As `bp' is not yet initialized during this phase of `bnx2x_init_dev',
it accessed uninitialized fields in the struct.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
fcdf95cb293603acdff910715c8aa2b19ed29df4 14-Dec-2011 Barak Witkowski <barak@broadcom.com> bnx2x: handle vpd data longer than 128 bytes

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7185bb335a1493f0ce27e9e94a1645a15db0fc0f 08-Dec-2011 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: properly initialize L5 features

The code is missing initialization of NO_FCOE_FLAG and NO_ISCSI*FLAGS
when CONFIG_CNIC is not selected.
This causes panic during driver load since commit
1d187b34daaecbb87aa523ba46b92930a388cb21 where NO_FCOE tested
unconditionally (outside #ifdef BCM_CNIC structure) and
accessed fp[FCOE_IDX] which is not allocated.

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f33f1fccbf67b3d9b310a4b09114b7c670320ad4 07-Dec-2011 Barak Witkowski <barak@broadcom.com> bnx2x: fix typo in fcoe stats collection

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f2fd5c3458ffcf4f9b4fbfa64980dffe1850f7de 06-Dec-2011 Michael Chan <mchan@broadcom.com> bnx2x: Fix compile errors if CONFIG_CNIC is not set

Don't provide FCoE and iSCSI statistics to management firmware if
CONFIG_CNIC is not set. Some needed structure fields are not defined
without CONFIG_CNIC.

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1d187b34daaecbb87aa523ba46b92930a388cb21 05-Dec-2011 Barak Witkowski <barak@broadcom.com> bnx2x, cnic: support DRV_INFO upon FW request

Add support to send driver capabilities, settings and statistics to
management firmware.

[ Redone using many local variables, removed many unnecessary inlines,
and put #defines at the left margin suggested by Joe Perches ]

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
50f0a562f8cc9ed9d9f7f7380434c3c8646172d5 05-Dec-2011 Barak Witkowski <barak@broadcom.com> bnx2x: add fcoe statistics

Add FCoE statistics support for FCoE capable devices.

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0e898dd7a820c258270af36074427e0bed48c8db 05-Dec-2011 Barak Witkowski <barak@broadcom.com> bnx2x: add PFC statistics

Add Priority flow control counters for ethtool -S.

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
614c76df1d1224dc2eee8678fab6e0b95b49b7da 28-Nov-2011 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: handle iSCSI SD mode

in iSCSI SD mode to bnx2x device assigned single mac address
which is supposted to be iscsi mac. If this mode is recognized
bnx2x will disable LRO, decrease number of queues to 1 and rx ring
size to the minumum allowed by FW, this in order minimize memory use.
It will tranfer mac for iscsi usage and zero primary mac of the netdev.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2cfa5a0471fef43fda0b7bd87e3a5e4dbadb7809 23-Nov-2011 Eric Dumazet <eric.dumazet@gmail.com> net: treewide use of RCU_INIT_POINTER

rcu_assign_pointer(ptr, NULL) can be safely replaced by
RCU_INIT_POINTER(ptr, NULL)

(old rcu_assign_pointer() macro was testing the NULL value and could
omit the smp_wmb(), but this had to be removed because of compiler
warnings)

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
eb2afd4a622985eaccfa8c7fc83e890b8930e0ab 15-Nov-2011 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: cache-in compressed fw image

Re-request fw from fs may fail for different reasons, once the fw was
loaded we won't release it until driver is removed.

This also resolves the boot problem when initial fw is located on initrd,
but rootfs is still unavailable, in this case device reset will fail due
to absence of fw files.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5219e4c93c281377700206ae2b3ba4d91653d2ba 14-Nov-2011 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: add endline at end of message

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
e52fcb2462ac484e6dd6e68869536609f0216938 14-Nov-2011 Eric Dumazet <eric.dumazet@gmail.com> bnx2x: uses build_skb() in receive path

bnx2x uses following formula to compute its rx_buf_sz :

dev->mtu + 2*L1_CACHE_BYTES + 14 + 8 + 8 + 2

Then core network adds NET_SKB_PAD and SKB_DATA_ALIGN(sizeof(struct
skb_shared_info))

Final allocated size for skb head on x86_64 (L1_CACHE_BYTES = 64,
MTU=1500) : 2112 bytes : SLUB/SLAB round this to 4096 bytes.

Since skb truesize is then bigger than SK_MEM_QUANTUM, we have lot of
false sharing because of mem_reclaim in UDP stack.

One possible way to half truesize is to reduce the need by 64 bytes
(2112 -> 2048 bytes)

Instead of allocating a full cache line at the end of packet for
alignment, we can use the fact that skb_shared_info sits at the end of
skb->head, and we can use this room, if we convert bnx2x to new
build_skb() infrastructure.

skb_shared_info will be initialized after hardware finished its
transfert, so we can eventually overwrite the final padding.

Using build_skb() also reduces cache line misses in the driver, since we
use cache hot skb instead of cold ones. Number of in-flight sk_buff
structures is lower, they are recycled while still hot.

Performance results :

(820.000 pps on a rx UDP monothread benchmark, instead of 720.000 pps)

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Eilon Greenstein <eilong@broadcom.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
CC: Tom Herbert <therbert@google.com>
CC: Jamal Hadi Salim <hadi@mojatatu.com>
CC: Stephen Hemminger <shemminger@vyatta.com>
CC: Thomas Graf <tgraf@infradead.org>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8304859adc213df9f69a86e06164683f76cd5d49 13-Nov-2011 Ariel Elior <ariele@broadcom.com> bnx2x: add fan failure event handling

Shut down the device in case of fan failure to prevent HW damage.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
00253a8cf3119af6cb07c9de2c08a50d39fc7201 13-Nov-2011 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: propagate DCBX negotiation

We need propagate the DCBX results from PMF to other functions
on the same port, in order to properly update netdev structure
and allow following new ETS and PFC configurations.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
b306f5edf6615d3abeba16914872c24c9be29051 13-Nov-2011 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: separate FCoE and iSCSI license initialization.

FCoE license info must be initialized at probe(), but
iSCSI at open().

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f233cafe1a9df8de75f446bc6f5dc715cc564325 13-Nov-2011 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: use rx_queue index for skb_record_rx_queue()

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
62ac0dc9ec0b90b83103ebb659e0696c344e4be4 13-Nov-2011 Dmitry Kravkov <dmitry@broadcom.com> bnx2x: allow FCoE and DCB for 578xx

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f0cd7bdc042310b6b104f133bbfd520a72b3c08a 05-Oct-2011 Dan Carpenter <dan.carpenter@oracle.com> bnx2x: remove some dead code

This code is after the break statement so it never gets used. The
"vlan_mac_obj" variable does get initialized properly, so we can just
delete this.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6e68c912eee8f5ebc975cfb81d66d4a214b07d46 23-Aug-2011 Michal Schmidt <mschmidt@redhat.com> bnx2x: resurrect RX hashing

bnx2x used to be able to set rxhash, but this was lost in the conversion
to hw_features (commit 66371c441).
Restore it and enable it by default.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
CC: Vladislav Zolotarov <vladz@broadcom.com>
CC: Eilon Greenstein <eilong@broadcom.com>
CC: Dmitry Kravkov <dmitry@broadcom.com>
CC: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
01789349ee52e4a3faf376f1485303d9723c4f1f 16-Aug-2011 Jiri Pirko <jpirko@redhat.com> net: introduce IFF_UNICAST_FLT private flag

Use IFF_UNICAST_FTL to find out if driver handles unicast address
filtering. In case it does not, promisc mode is entered.

Patch also fixes following drivers:
stmmac, niu: support uc filtering and yet it propagated
ndo_set_multicast_list
bna, benet, pxa168_eth, ks8851, ks8851_mll, ksz884x : has set
ndo_set_rx_mode but do not support uc filtering

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f1deab502206ab7e4470334b7738383c76e4ddd9 14-Aug-2011 Joe Perches <joe@perches.com> bnx2x: Use pr_fmt and message logging cleanups

Add pr_fmt(fmt) KBUILD_MODNAME ": " to prefix messages with "bnx2x: ".
Remove #define DP_LEVEL and use pr_notice.
Repeating KERN_<LEVEL> isn't necessary in multi-line printks.
printk macro neatening, use fmt and ##__VA_ARGS__.
Coalesce long formats.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
94f05b0f60de32e6efa19310bd142f1519e2abdb 14-Aug-2011 Joe Perches <joe@perches.com> bnx2x: Coalesce pr_cont uses and fix DP typos

Uses of pr_cont should be avoided where reasonably possible
because they can be interleaved by other threads and processes.

Coalesce pr_cont uses.

Fix typos, duplicated words and spacing in DP uses caused
by split multi-line formats. Coalesce some of these
split formats. Add missing terminating newlines to DP uses.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0f9dad10a040fa72c588db46a94c9e96545cc509 14-Aug-2011 Joe Perches <joe@perches.com> bnx2x: Remove local defines for %pM and mac address

Use %pM and mac address directly instead.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
adfc5217e9db68d3f0cec8dd847c1a6d3ab549ee 07-Apr-2011 Jeff Kirsher <jeffrey.t.kirsher@intel.com> broadcom: Move the Broadcom drivers

Moves the drivers for Broadcom devices into
drivers/net/ethernet/broadcom/ and the necessary Kconfig and Makefile
changes.

CC: Eilon Greenstein <eilong@broadcom.com>
CC: Michael Chan <mchan@broadcom.com>
CC: Matt Carlson <mcarlson@broadcom.com>
CC: Gary Zambrano <zambrano@broadcom.com>
CC: "Maciej W. Rozycki" <macro@linux-mips.org>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>