History log of /linux-master/drivers/net/ethernet/emulex/benet/be_cmds.c
Revision Date Author Comments
# ecf729f9 06-Mar-2023 Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

emulex/benet: clean up some inconsistent indenting

No functional modification involved.

drivers/net/ethernet/emulex/benet/be_cmds.c:1120 be_cmd_pmac_add() warn: inconsistent indenting.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4396
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f029c781 30-Aug-2022 Wolfram Sang <wsa+renesas@sang-engineering.com>

net: ethernet: move from strlcpy with unused retval to strscpy

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Petr Machata <petrm@nvidia.com> # For drivers/net/ethernet/mellanox/mlxsw
Acked-by: Geoff Levand <geoff@infradead.org> # For ps3_gelic_net and spider_net_ethtool
Acked-by: Tom Lendacky <thomas.lendacky@amd.com> # For drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
Acked-by: Marcin Wojtas <mw@semihalf.com> # For drivers/net/ethernet/marvell/mvpp2
Reviewed-by: Leon Romanovsky <leonro@nvidia.com> # For drivers/net/ethernet/mellanox/mlx{4|5}
Reviewed-by: Shay Agroskin <shayagr@amazon.com> # For drivers/net/ethernet/amazon/ena
Acked-by: Krzysztof Hałasa <khalasa@piap.pl> # For IXP4xx Ethernet
Link: https://lore.kernel.org/r/20220830201457.7984-3-wsa+renesas@sang-engineering.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>


# d7241f67 16-Jul-2022 Hristo Venev <hristo@venev.name>

be2net: Fix buffer overflow in be_get_module_eeprom

be_cmd_read_port_transceiver_data assumes that it is given a buffer that
is at least PAGE_DATA_LEN long, or twice that if the module supports SFF
8472. However, this is not always the case.

Fix this by passing the desired offset and length to
be_cmd_read_port_transceiver_data so that we only copy the bytes once.

Fixes: e36edd9d26cf ("be2net: add ethtool "-m" option support")
Signed-off-by: Hristo Venev <hristo@venev.name>
Link: https://lore.kernel.org/r/20220716085134.6095-1-hristo@venev.name
Signed-off-by: Paolo Abeni <pabeni@redhat.com>


# 76660757 14-Oct-2021 Jakub Kicinski <kuba@kernel.org>

ethernet: constify references to netdev->dev_addr in drivers

This big patch sprinkles const on local variables and
function arguments which may refer to netdev->dev_addr.

Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Some of the changes here are not strictly required - const
is sometimes cast off but pointer is not used for writing.
It seems like it's still better to add the const in case
the code changes later or relevant -W flags get enabled
for the build.

No functional changes.

Link: https://lore.kernel.org/r/20211014142432.449314-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>


# d6765985 25-Jun-2021 Petr Oros <poros@redhat.com>

Revert "be2net: disable bh with spin_lock in be_process_mcc"

Patch was based on wrong presumption that be_poll can be called only
from bh context. It reintroducing old regression (also reverted) and
causing deadlock when we use netconsole with benet in bonding.

Old revert: commit 072a9c486004 ("netpoll: revert 6bdb7fe3104 and fix
be_poll() instead")

[ 331.269715] bond0: (slave enp0s7f0): Releasing backup interface
[ 331.270121] CPU: 4 PID: 1479 Comm: ifenslave Not tainted 5.13.0-rc7+ #2
[ 331.270122] Call Trace:
[ 331.270122] [c00000001789f200] [c0000000008c505c] dump_stack+0x100/0x174 (unreliable)
[ 331.270124] [c00000001789f240] [c008000001238b9c] be_poll+0x64/0xe90 [be2net]
[ 331.270125] [c00000001789f330] [c000000000d1e6e4] netpoll_poll_dev+0x174/0x3d0
[ 331.270127] [c00000001789f400] [c008000001bc167c] bond_poll_controller+0xb4/0x130 [bonding]
[ 331.270128] [c00000001789f450] [c000000000d1e624] netpoll_poll_dev+0xb4/0x3d0
[ 331.270129] [c00000001789f520] [c000000000d1ed88] netpoll_send_skb+0x448/0x470
[ 331.270130] [c00000001789f5d0] [c0080000011f14f8] write_msg+0x180/0x1b0 [netconsole]
[ 331.270131] [c00000001789f640] [c000000000230c0c] console_unlock+0x54c/0x790
[ 331.270132] [c00000001789f7b0] [c000000000233098] vprintk_emit+0x2d8/0x450
[ 331.270133] [c00000001789f810] [c000000000234758] vprintk+0xc8/0x270
[ 331.270134] [c00000001789f850] [c000000000233c28] printk+0x40/0x54
[ 331.270135] [c00000001789f870] [c000000000ccf908] __netdev_printk+0x150/0x198
[ 331.270136] [c00000001789f910] [c000000000ccfdb4] netdev_info+0x68/0x94
[ 331.270137] [c00000001789f950] [c008000001bcbd70] __bond_release_one+0x188/0x6b0 [bonding]
[ 331.270138] [c00000001789faa0] [c008000001bcc6f4] bond_do_ioctl+0x42c/0x490 [bonding]
[ 331.270139] [c00000001789fb60] [c000000000d0d17c] dev_ifsioc+0x17c/0x400
[ 331.270140] [c00000001789fbc0] [c000000000d0db70] dev_ioctl+0x390/0x890
[ 331.270141] [c00000001789fc10] [c000000000c7c76c] sock_do_ioctl+0xac/0x1b0
[ 331.270142] [c00000001789fc90] [c000000000c7ffac] sock_ioctl+0x31c/0x6e0
[ 331.270143] [c00000001789fd60] [c0000000005b9728] sys_ioctl+0xf8/0x150
[ 331.270145] [c00000001789fdb0] [c0000000000336c0] system_call_exception+0x160/0x2f0
[ 331.270146] [c00000001789fe10] [c00000000000d35c] system_call_common+0xec/0x278
[ 331.270147] --- interrupt: c00 at 0x7fffa6c6ec00
[ 331.270147] NIP: 00007fffa6c6ec00 LR: 0000000105c4185c CTR: 0000000000000000
[ 331.270148] REGS: c00000001789fe80 TRAP: 0c00 Not tainted (5.13.0-rc7+)
[ 331.270148] MSR: 800000000280f033 <SF,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE> CR: 28000428 XER: 00000000
[ 331.270155] IRQMASK: 0
[ 331.270156] GPR00: 0000000000000036 00007fffd494d5b0 00007fffa6d57100 0000000000000003
[ 331.270158] GPR04: 0000000000008991 00007fffd494d6d0 0000000000000008 00007fffd494f28c
[ 331.270161] GPR08: 0000000000000003 0000000000000000 0000000000000000 0000000000000000
[ 331.270164] GPR12: 0000000000000000 00007fffa6dfa220 0000000000000000 0000000000000000
[ 331.270167] GPR16: 0000000105c44880 0000000000000000 0000000105c60088 0000000105c60318
[ 331.270170] GPR20: 0000000105c602c0 0000000105c44560 0000000000000000 0000000000000000
[ 331.270172] GPR24: 00007fffd494dc50 00007fffd494d6a8 0000000105c60008 00007fffd494d6d0
[ 331.270175] GPR28: 00007fffd494f27e 0000000105c6026c 00007fffd494f284 0000000000000000
[ 331.270178] NIP [00007fffa6c6ec00] 0x7fffa6c6ec00
[ 331.270178] LR [0000000105c4185c] 0x105c4185c
[ 331.270179] --- interrupt: c00

This reverts commit d0d006a43e9a7a796f6f178839c92fcc222c564d.

Fixes: d0d006a43e9a7a ("be2net: disable bh with spin_lock in be_process_mcc")
Signed-off-by: Petr Oros <poros@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f4ee1476 05-Sep-2019 Colin Ian King <colin.king@canonical.com>

be2net: make two arrays static const, makes object smaller

Don't populate the arrays on the stack but instead make them
static const. Makes the object code smaller by 281 bytes.

Before:
text data bss dec hex filename
87553 5672 0 93225 16c29 benet/be_cmds.o

After:
text data bss dec hex filename
87112 5832 0 92944 16b10 benet/be_cmds.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d0d006a4 05-Aug-2019 Denis Kirjanov <kda@linux-powerpc.org>

be2net: disable bh with spin_lock in be_process_mcc

be_process_mcc() is invoked in 3 different places and
always with BHs disabled except the be_poll function
but since it's invoked from softirq with BHs
disabled it won't hurt.

v1->v2: added explanation to the patch
v2->v3: add a missing call from be_cmds.c

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 6e9ef509 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 338

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation the full gnu general
public license is included in this distribution in the file called
copying

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 14 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190530000436.856338015@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 750afb08 04-Jan-2019 Luis Chamberlain <mcgrof@kernel.org>

cross-tree: phase out dma_zalloc_coherent()

We already need to zero out memory for dma_alloc_coherent(), as such
using dma_zalloc_coherent() is superflous. Phase it out.

This change was generated with the following Coccinelle SmPL patch:

@ replace_dma_zalloc_coherent @
expression dev, size, data, handle, flags;
@@

-dma_zalloc_coherent(dev, size, handle, flags)
+dma_alloc_coherent(dev, size, handle, flags)

Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
[hch: re-ran the script on the latest tree]
Signed-off-by: Christoph Hellwig <hch@lst.de>


# 9d7f19dc 05-Sep-2018 Petr Oros <poros@redhat.com>

be2net: Fix memory leak in be_cmd_get_profile_config()

DMA allocated memory is lost in be_cmd_get_profile_config() when we
call it with non-NULL port_res parameter.

Signed-off-by: Petr Oros <poros@redhat.com>
Reviewed-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 262c9740 27-Feb-2018 Hernán Gonzalez <hernan@vanguardiasur.com.ar>

emulex/benet: Constify *be_misconfig_evt_port_state[]

Note: This is compile only tested as I have no access to the hw.
No benefit gained except for some self-documenting.

add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
Function old new delta
Total: Before=2757703, After=2757703, chg +0.00%

Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 2b1eaa66 07-Jan-2018 Colin Ian King <colin.king@canonical.com>

be2net: use ARRAY_SIZE for array sizing calculation on array cmd_priv_map

Use the ARRAY_SIZE macro on array cmd_priv_map to determine size of the
array. Improvement suggested by coccinelle.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 0b98ca2a 29-Mar-2017 Suresh Reddy <suresh.reddy@broadcom.com>

be2net: Fix endian issue in logical link config command

Use cpu_to_le32() for link_config variable in set_logical_link_config
command as this variable is of type u32.

Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# fe68d8bf 13-Jan-2017 Ivan Vecera <cera@cera.cz>

be2net: fix status check in be_cmd_pmac_add()

Return value from be_mcc_notify_wait() contains a base completion status
together with an additional status. The base_status() macro need to be
used to access base status.

Fixes: e3a7ae2 be2net: Changing MAC Address of a VF was broken
Cc: Sathya Perla <sathya.perla@broadcom.com>
Cc: Ajit Khaparde <ajit.khaparde@broadcom.com>
Cc: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Cc: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ivan Vecera <cera@cera.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d14584d9 05-Dec-2016 Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>

be2net: Add DEVSEC privilege to SET_HSW_CONFIG command.

OPCODE_COMMON_GET_FN_PRIVILEGES is returning only DEVSEC
privilege (Unrestricted Administrative Privilege) for Lancer NIC functions.
So, driver is failing SET_HSW_CONFIG command, as DEVSEC privilege was not
set in the privilege bitmap. This patch fixes the problem by setting DEVSEC
privilege in SET_HSW_CONFIG’s privilege bitmap.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# dc6e8511 08-Oct-2016 Suresh Reddy <suresh.reddy@broadcom.com>

be2net: Enable VF link state setting for BE3

The VF link state setting feature now works on BE3 chips too from
FW ver 11.1.192.0 onwards.

Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f5ef017e 08-Oct-2016 Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>

be2net: NCSI FW section should be properly updated with ethtool for BE3

The driver has a check to ensure that NCSI FW section is updated only
if the current FW version in the card supports it. This FW version check
is done using memcmp() which obviously fails in some cases. Fix this by
breaking up the version string into integer version components and
comparing them.

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 6ee080bb 08-Oct-2016 Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>

be2net: Provide an alternate way to read pf_num for BEx chips

The driver gets the pf_num for Skyhawk and Lancer using
GET_FUNC_CONFIG FW command. But since that command is not
supported in BEx, we need to get it from some other command.
Otherwise TPE recovery would fail since all NIC PFs would
end up with a func num of 0. There's a pci function number
field in the response of GET_CNTL_ATTRIBUTES command that
can be read to get the same info for BEx adapters.

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d766e7e6 18-Sep-2016 Baoyou Xie <baoyou.xie@linaro.org>

be2net: mark symbols static where possible

We get 4 warnings when building kernel with W=1:
drivers/net/ethernet/emulex/benet/be_main.c:4368:6: warning: no previous prototype for 'be_calculate_pf_pool_rss_tables' [-Wmissing-prototypes]
drivers/net/ethernet/emulex/benet/be_cmds.c:4385:5: warning: no previous prototype for 'be_get_nic_pf_num_list' [-Wmissing-prototypes]
drivers/net/ethernet/emulex/benet/be_cmds.c:4537:6: warning: no previous prototype for 'be_reset_nic_desc' [-Wmissing-prototypes]
drivers/net/ethernet/emulex/benet/be_cmds.c:4910:5: warning: no previous prototype for '__be_cmd_set_logical_link_config' [-Wmissing-prototypes]

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
so this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 62259ac4 07-Sep-2016 Somnath Kotur <somnath.kotur@broadcom.com>

be2net: Add privilege level check for OPCODE_COMMON_GET_EXT_FAT_CAPABILITIES SLI cmd.

Driver issues OPCODE_COMMON_GET_EXT_FAT_CAPABILITIES cmd during init which
when issued by VFs results in the logging of a cmd failure message since
they don't have the required privilege for this cmd. Fix by checking
privilege before issuing the cmd.

Also fixed typo in CAPABILITIES.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 710f3e59 07-Sep-2016 Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>

be2net: Support UE recovery in BEx/Skyhawk adapters

This patch supports recovery from UEs caused due to Transient Parity
Errors (TPE), in BE2, BE3 and Skyhawk adapters. This change avoids
system reboot when such errors occur. The driver recovers from these
errors such that the adapter resumes full operational status as prior
to the UE.

Following is the list of changes in the driver to support this:

o The driver registers its UE recoverable capability with ARM FW at init
time. This also allows the driver to know if the feature is supported in
the FW.

o As the UE recovery requires precise time bound processing, the driver
creates its own error recovery work queue with a single worker thread (per
module, shared across functions).

o Each function runs an error detection task at an interval of 1 second as
required by the FW. The error detection logic already exists for BEx/SH,
but it now runs in the context of a separate worker thread.

o When an error is detected by the task, if it is recoverable, the PF0
driver instance initiates a soft reset, while other PF driver instances
wait for the reset to complete and the chip to become ready. Once
the chip is ready, all driver instances including PF0, resume to
reinitialize the respective functions.

o The PF0 driver checks for some recovery criteria, to determine if the
recovery can be initiated. If the criteria is not met, the PF0 driver does
not initiate a soft reset, it retains the existing behavior to stop
further processing and requires a reboot to get the chip to operational
state again.

o To allow each function to share the workq, while also making progress in
its recovery process, a per-function recovery state machine is used.
The per-function tasks avoid blocking operations like msleep() while in
this state machine (until reinit state) and instead reschedule for the
required delay.

o With these changes, the existing error recovery code for Lancer also
runs in the context of the new worker thread.

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# b7172414 27-Jul-2016 Sathya Perla <sathya.perla@broadcom.com>

be2net: replace polling with sleeping in the FW completion path

The ndo_set_rx_mode() and ndo_add/del_vxlan_port() calls may be called with
BHs disabled. The driver currently issues the required cmds to the FW in
these contexts and polls on completions from the FW, while BHs remain
disabled. This can cause either packet loss or packet reception to be
delayed on that CPU.

This patch defers processing of the above cmds to a separate workqueue.
With this change, FW cmds are now issued only in process context.
Now that the FW cmds are issued only in process context, they can sleep
waiting for a completion instead of polling. All the spin_lock_bh(mcc_lock)
calls are now replaced with mutex calls.

Also a new rx_filter_lock is now needed to protect the RX filtering fields
like vids[] between be_vlan_add/rem_vid() and __be_set_rx_mode() contexts.

Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 7dfbe7d7 22-Jun-2016 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Change copyright markings in source files

This patch updates year and company name in the copyright markings in the
be2net source files.

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 884476be 22-Jun-2016 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Fix broadcast echoes from EVB in BE3

On SR-IOV profiles, when the user connects a Linux Bridge or OVS to a BE3
vport, they suffer the "broadcast/multicast echo" problem. BE3 EVB echoes
broadcast and multicast packets back to PF's vport confusing the
Linux bridge. BE3 relies on the src-mac addr being programmed on the
interface to avoid sending back an echo of a broadcast or multicast packet
on a vPort. When a Linux bridge is connected to a BE3, the mac-addr of the
VM behind the bridge doesn't get configured on the vPort and so echo
cancellation doesn't work.
This patch worksaround this problem by disabling the EVB initially
and re-enabling it *only* when SR-IOV is enabled by the user. For the
driver fix to work, the BE3 FW version must be >= 11.1.84.0.

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# de2b1e03 06-Jun-2016 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Fix provisioning of RSS for VFs in multi-partition configurations

Currently, we do not distribute queue resources to enable RSS for VFs
in multi-channel/partition configurations.
Fix this by having each PF(SRIOV capable) calculate it's share of the
15 RSS Policy Tables available per port before provisioning resources for
all the VFs.
This proportional share calculation is done based on division of the
PF's MAX VFs with the Total MAX VFs on that port. It also needs to
learn about the no: of NIC PFs on the port and subtract that from
the 15 RSS Policy Tables on the port.

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 45f13df7 06-Jun-2016 Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>

be2net: Enable Wake-On-LAN from shutdown for Skyhawk

Skyhawk does support wake-up from ACPI shutdown state - S5, provided the
platform supports it (like Auxiliary power source etc). The changes listed
below are done to fix this.

1) There's no need to defer the HW configuration of WOL to be_suspend().
Remove this in be_suspend() and move it to be_set_wol() ethtool function
so it is configured directly in the context of ethtool. This automatically
takes care of the shutdown case.

2) The driver incorrectly uses WOL_CAP field in the FW response to
get_acpi_wol_cap() command, to determine if WOL is enabled. Instead the
driver must rely on the macaddr field in the response to infer WOL state.

3) In be_get_config() during init, if we find that WOL is enabled in FW,
call pci_enable_wake() to enable pmcsr.pme_en bit. This is needed to
support persistent WOL configuration provided by the FW in some platforms.

4) Remove code in be_set_wol() that writes to PCICFG_PM_CONTROL_OFFSET
to set pme_en bit; pci_enable_wake() sets that.

Fixes: 028991e49 ("Enabling Wake-on-LAN is not supported in S5 state")
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# b9263cbf 06-Jun-2016 Suresh Reddy <suresh.reddy@broadcom.com>

be2net: use max-TXQs limit too while provisioning VF queue pairs

When the PF driver provisions resources for VFs, it currently only looks
at max RSS queues available to calculate the number of VF queue pairs.
This logic breaks when there are less number of TX-queues than RSS-queues.
This patch fixes this problem by using the max-TXQs available in the
PF-pool in the calculations. As a part of this change the
be_calculate_vf_qs() routine is renamed as be_calculate_vf_res() and the
code that calculates limits on other related resources is moved here to
contain all resource calculation code inside one routine.

Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# b0fd2eb2 22-Feb-2016 ajit.khaparde@broadcom.com <ajit.khaparde@broadcom.com>

be2net: Declare some u16 fields as u32 to improve performance

When 16-bit integers are loaded on CPUs with high order native
register sizes, the CPU could use some extra ops before using them.
And currently some of the frequently used fields in the driver like
the producer and consumer indices of the queues are declared as u16.

This patch declares such fields as u32. With this change we see the
64-byte packets per second numbers improve by about 4%.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 51d1f98a 10-Feb-2016 Ajit Khaparde <ajit.khaparde@broadcom.com>

be2net: Interpret and log new data that's added to the port misconfigure async event

>From FW version 11.0. onwards, the PORT_MISCONFIG event generated by the FW
will carry more information about the event in the "data_word1"
and "data_word2" fields. This patch adds support in the driver to parse the
new information and log it accordingly. This patch also changes some of the
messages that are being logged currently.

Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 62219066 10-Feb-2016 Ajit Khaparde <ajit.khaparde@broadcom.com>

be2net: Request RSS capability of Rx interface depending on number of Rx rings

Currently we request RSS capability even if a single Rx ring is created.
As a result in few cases we unnecessarily consume an RSS capable interface
which is a limited resource in the chip.
This patch enables RSS on an interface only if more than one Rx ring
is created.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 2e365b1b 02-Feb-2016 Somnath Kotur <somnath.kotur@broadcom.com>

be2net: Don't run ethtool self-tests for VFs

The CMD_SUBSYSTEM_LOWLEVEL cmds need DEV_CFG Privilege to run
which VFs don't have by default.
Self-tests need to be issued only for PFs.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# fa5c867d 02-Feb-2016 Suresh Reddy <suresh.reddy@broadcom.com>

be2net: check for INSUFFICIENT_PRIVILEGES error

The driver currently logs the message "VF is not privileged to issue
opcode" by checking only the base_status field for UNAUTHORIZED_REQUEST.
Add check to look for INSUFFICIENT_PRIVILEGES in the additional status
field also as not all cmds fail with that base status.

Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# fd7ff6f0 29-Dec-2015 Venkat Duvvuru <venkatkumar.duvvuru@avagotech.com>

be2net: support ethtool get-dump option

This patch adds support for ethtool's --get-dump option in be2net,
to retrieve FW dump. In the past when this option was not yet available,
this feature was supported via the --register-dump option as a workaround.
This patch removes support for FW-dump via --register-dump option as it is
now available via --get-dump option. Even though the
"ethtool --register-dump" cmd which used to work earlier, will now fail
with ENOTSUPP error, we feel it is not an issue as this is used only
for diagnostics purpose.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 980df249 29-Dec-2015 Suresh Reddy <suresh.reddy@avagotech.com>

be2net: fix port-res desc query of GET_PROFILE_CONFIG FW cmd

Commit 72ef3a88fa8e ("be2net: set pci_func_num while issuing
GET_PROFILE_CONFIG cmd") passed a specific pf_num while issuing a
GET_PROFILE_CONFIG cmd as FW returns descriptors for all functions when
pf_num is zero. But, when pf_num is set to a non-zero value, FW does not
return the Port resource descriptor.
This patch fixes this by setting pf_num to 0 while issuing the query cmd
and adds code to pick the correct NIC resource descriptor from the list of
descriptors returned by FW.

Fixes: 72ef3a88fa8e ("be2net: set pci_func_num while issuing
GET_PROFILE_CONFIG cmd")
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>

Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# fdf81bfb 29-Dec-2015 Sathya Perla <sathya.perla@avagotech.com>

be2net: remove a line of code that has no effect

This patch removes a line of code that changes adapter->recommended_prio
value followed by yet another assignment.
Also, the variable is used to store the vlan priority value that is already
shifted to the PCP bits position in the vlan tag format. Hence, the name of
this variable is changed to recommended_prio_bits.

Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 6b525782 29-Dec-2015 Suresh Reddy <suresh.reddy@avagotech.com>

be2net: log digital signature errors while flashing FW image

(based on a jumper setting on the adapter.) In this mode, the FW image when
flashed is authenticated with a digital signature. This patch logs
appropriate error messages and return a status to ethtool when errors
relating to FW image authentication occur.

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# a23113b5 29-Dec-2015 Suresh Reddy <suresh.reddy@avagotech.com>

be2net: move FW flash cmd code to be_cmds.c

All code relating to FW cmds is in be_cmds.[ch] excepting FW flash cmd
related code. This patch moves these routines from be_main.c to be_cmds.c

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d9d426af 29-Dec-2015 Suresh Reddy <suresh.reddy@avagotech.com>

be2net: fix VF link state transition from disabled to auto

The VF link state setting transition from "disable" to "auto" does not work
due to a bug in SET_LOGICAL_LINK_CONFIG_V1 cmd in FW. This issue could not
be fixed in FW due to some backward compatibility issues it causes with
some released drivers. The issue has been fixed by introducing a new
version (v2) of the cmd from 10.6 FW onwards. In v2, to set the VF link
state to auto, both PLINK_ENABLE and PLINK_TRACK bits have to be set to 1.

The VF link state setting feature now works on Lancer chips too from
FW ver 10.6.315.0 onwards.

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 196e3735 12-Oct-2015 Kalesh AP <kalesh.purayil@avagotech.com>

be2net: remove vlan promisc capability from VF's profile descriptors

The commit 435452aa8847 ("Prevent VFs from enabling VLAN promiscuous mode")
fixed the PF driver to not include the VLAN promisc capability while
provisioning the interface for a VF. But the fix did not remove this
capability from the profile descriptor of the VF. This causes the VF
driver to request this capability when it tries to create it's interface
at probe time. This could potentailly cause the VF probe to fail if the
FW enforces strict checking of the flags based on what was provisoned
by the PF. This strict checking is not being done by FW currently but
will be fixed in a future version. This patch fixes this issue by updating
the VF's profile descriptor so that they match the interface capability
flags provisioned by the PF.

Fixes: 435452aa8847 ("Prevent VFs from enabling VLAN promiscuous mode")
Signed-off-by: Kalesh AP <kalesh.purayil@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 72ef3a88 12-Oct-2015 Somnath Kotur <somnath.kotur@emulex.com>

be2net: set pci_func_num while issuing GET_PROFILE_CONFIG cmd

The FW requires the pf_num field in the cmd hdr to be set for it to return
the specific function's descriptors in the GET_PROFILE_CONFIG cmd. If not
set, the FW returns the descriptors of all the functions on the device.
If the first descriptor is not what is being queried for, the driver will
read wrong data. This patch fixes this issue by using the GET_CNTL_ATTRIB
cmd to query the real pci_func_num of a function and then uses it in the
GET_PROFILE_CONFIG cmd.

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 0c884567 12-Oct-2015 Suresh Reddy <Suresh.Reddy@avagotech.com>

be2net: release mcc-lock in a failure case in be_cmd_notify_wait()

The mcc/mbox lock is not being released when be_cmd_copy() returns
an error.

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# b6588879 03-Sep-2015 Sathya Perla <sathya.perla@avagotech.com>

be2net: Revert "make the RX_FILTER command asynchronous" commit

The be_cmd_rx_filter() routine sends a non-embedded cmd to the FW and used
a pre-allocated dma memory to hold the cmd payload. This worked fine when
this cmd was synchronous. This cmd was changed to asynchronous mode by the
commit 8af65c2f4("make the RX_FILTER command asynchronous"). So now when
there are two quick invocations of this cmd, the 2nd request may end up
overwriting the first request, causing FW cmd corruption.

This patch reverts the offending commit and hence fixes the regression.

Fixes: 8af65c2f4("be2net: make the RX_FILTER command asynchronous")
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# a155a5db 21-Jul-2015 Sriharsha Basavapatna <sriharsha.basavapatna@avagotech.com>

be2net: support ndo_get_phys_port_id()

Add be_get_phys_port_id() function to report physical port id. The port id
should be unique across different be2net devices in the system. We use the
chip serial number along with the physical port number for this.

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 9c855975 10-Jul-2015 Suresh Reddy <Suresh.Reddy@emulex.com>

be2net: make SET_LOOPBACK_MODE cmd asynchrounous

The SET_LOOPBACK_MODE command is always issued from ethtool only in a
process context. So, while waiting for the cmd to complete, the driver
can sleep instead of holding spin_lock_bh() on the mcc_lock. This is done
by calling be_mcc_notify() instead of be_mcc_notify_wait() (that returns
only after the cmd completes while the MCCQ is locked).

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 8af65c2f 10-Jul-2015 Suresh Reddy <suresh.reddy@avagotech.com>

be2net: make the RX_FILTER command asynchronous

This fix makes the RX_FILTER cmd asynchronous, i.e., the caller issues
this cmd and doesn't wait for a completion from the FW. If the FW/adapter
is in an error state, this change helps in not holding up the rtnl_lock
and keeping bottom halves disabled while the driver timesout waiting for
a response from the FW.

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# efaa408e 10-Jul-2015 Suresh Reddy <Suresh.Reddy@emulex.com>

be2net: return error status from be_mcc_notify()

When the adapter is in error state, return error from be_mcc_notify()
so that the caller routines need not sleep waiting for a response.

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e51000db 05-Jun-2015 Sriharsha Basavapatna <sriharsha.basavapatna@avagotech.com>

be2net: Replace dma/pci_alloc_coherent() calls with dma_zalloc_coherent()

There are several places in the driver (all in control paths) where
coherent dma memory is being allocated using either dma_alloc_coherent()
or the deprecated pci_alloc_consistent(). All these calls should be
changed to use dma_zalloc_coherent() to avoid uninitialized fields in
data structures backed by this memory.

Reported-by: Joerg Roedel <jroedel@suse.de>
Tested-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 760c295e 13-May-2015 Venkata Duvvuru <VenkatKumar.Duvvuru@Emulex.Com>

be2net: Support for OS2BMC.

OS2BMC feature will allow the server to communicate with the on-board
BMC/idrac (Baseboard Management Controller) over the LOM via
standard Ethernet.

When OS2BMC feature is enabled, the LOM will filter traffic coming
from the host. If the destination MAC address matches the iDRAC MAC
address, it will forward the packet to the NC-SI side band interface
for iDRAC processing. Otherwise, it would send it out on the wire to
the external network. Broadcast and multicast packets are sent on the
side-band NC-SI channel and on the wire as well. Some of the packet
filters are not supported in the NIC and hence driver will identify
such packets and will hint the NIC to send those packets to the BMC.
This is done by duplicating packets on the management ring. Packets
are sent to the management ring, by setting mgmt bit in the wrb header.
The NIC will forward the packets on the management ring to the BMC
through the side-band NC-SI channel.

Please refer to this online document for more details,
http://www.dell.com/downloads/global/products/pedge/
os_to_bmc_passthrough_a_new_chapter_in_system_management.pdf

Signed-off-by: Venkat Duvvuru <VenkatKumar.Duvvuru@Emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 954f6825 13-May-2015 Venkata Duvvuru <VenkatKumar.Duvvuru@Emulex.Com>

be2net: Report a "link down" to the stack when a fatal error or fw reset happens.

When an error (related to HW or FW) is detected on a function, the driver
must pro-actively report a "link down" to the stack so that a possible
failover can be initiated. This is being done currently only for some
HW errors. This patch reports a "link down" even for fatal FW errors and
EEH errors.

Signed-off-by: Venkat Duvvuru <VenkatKumar.Duvvuru@Emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 29e9122b 13-May-2015 Venkata Duvvuru <VenkatKumar.Duvvuru@Emulex.Com>

be2net: Export board temperature using hwmon-sysfs interface.

Ethtool statistics is not the right place to display board temperature.
This patch adds support to export die temperature of devices supported
by be2net driver via the sysfs hwmon interface.

Signed-off-by: Venkat Duvvuru <VenkatKumar.Duvvuru@Emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d19261b8 06-May-2015 Vasundhara Volam <vasundhara.volam@avagotech.com>

be2net: update copyright year to 2015

Signed-off-by: Vasundhara Volam <vasundhara.volam@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 18c57c74 06-May-2015 Kalesh AP <kalesh.purayil@emulex.com>

be2net: use be_virtfn() instead of !be_physfn()

Use be_virtfn() to determine a VF instead of !be_physfn() for better
readability.

Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 77be8c1c 06-May-2015 Kalesh AP <kalesh.purayil@emulex.com>

be2net: check for INSUFFICIENT_VLANS error

When the FW runs out of vlan filters it can either return an
INSUFFICIENT_RESOURCES error or an INSUFFICIENT_VLANS error.
The driver currently checks only for the former error value.
This patch adds a check for the latter value too.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e7bcbd7b 06-May-2015 Kalesh AP <kalesh.purayil@emulex.com>

be2net: add support for spoofchk setting

This patch adds support for spoofchk configuration for VFs.
When it is enabled, "spoof checking" is done for both MAC-address and VLAN.
For each VF, the HW ensures that the source MAC address (or vlan) of
every outgoing packet exists in the MAC-list (or vlan-list) configured
for RX filtering for that VF. If not, the packet is dropped and an error
is reported to the driver in the TX completion; this is reflected in the
"tx_spoof_check_err" ethtool counter.
This feature is supported in Skyhawk FW version 10.6.31.0 and above.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# c8ba4ad0 20-Mar-2015 Suresh Reddy <Suresh.Reddy@emulex.com>

be2net: restrict MODIFY_EQ_DELAY cmd to a max of 8 EQs

Issuing this cmd for more than 8 EQs does not have the intended effect
even on BEx and Skyhawk-R.

This patch fixes this by issuing this cmd for upto 8 EQs at a time.
Signed-off-by: Suresh Reddy <Suresh.Reddy@emulex.com>

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 435452aa 20-Mar-2015 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Prevent VFs from enabling VLAN promiscuous mode

Currently, a PF does not restrict its VF interface from enabling vlan
promiscuous mode. This breaks vlan isolation when a vlan
(transparent tagging) is configured on a VF.

This patch fixes this problem by disabling the vlan promisc capability
for VFs.

Reported-by: Yoann Juet <veilletechno-irts@univ-nantes.fr>
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# dbedd44e 06-Mar-2015 Joe Perches <joe@perches.com>

ethernet: codespell comment spelling fixes

To test a checkpatch spelling patch, I ran codespell against
drivers/net/ethernet/.

$ git ls-files drivers/net/ethernet/ | \
while read file ; do \
codespell -w $file; \
done

I removed a false positive in e1000_hw.h

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# ace40aff 03-Mar-2015 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: implement .sriov_configure() PCI callback

This patch implements the .sriov_configure() PCI method to allow for
runtime enabling/disabling of VFs. The module param "num_vfs" is now
deprecated.
At the time of driver load the PF-pool resources are allocated to the PF.
When the user enables VFs, the resources are then re-distributed across
PFs and VFs based on the number of VFs enabled.
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f2858738 03-Mar-2015 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: re-distribute SRIOV resources allowed by FW

When SR-IOV is enabled in the adapter, the FW distributes resources
evenly across the PF and it's VFs. This is currently done only for some
resources.

This patch adds support for a new cmd that queries the FW for the list
of resources for which the distribution is allowed and distributes them
accordingly.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 71bb8bd0 03-Mar-2015 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: avoid creating the non-RSS default RXQ if FW allows to

On BE2, BE3 and Skhawk-R chips one non-RSS (called "default") RXQ was
needed to receive non-IP traffic. Some FW versions now export a
capability called IFACE_FLAGS_DEFQ_RSS where this requirement doesn't hold.
On such FWs the driver now does not create the non-RSS default queue.
This prevents wasting one RXQ per VF.
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# c7bf7169 02-Mar-2015 Joe Perches <joe@perches.com>

ethernet: Use eth_<foo>_addr instead of memset

Use the built-in function instead of memset.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 9fa465c0 23-Feb-2015 Sathya Perla <sathya.perla@emulex.com>

be2net: remove code duplication relating to Lancer reset sequence

The steps needed for Lancer's reset/initialization sequence are:
a) wait for SLIPORT_STAUS RDY bit to be set
b) set the SLIPORT_CONTROL IP bit
c) repeat step "a"

The code needed for this sequence is already covered by the be_func_init()
routine (with minor modifications.) So, get rid of the
lancer_test_and_set_rdy_state() and lancer_provisioning_error() routines
that unnecessarily duplicate this code. Also fixed the error recovery
function to take care of these changes

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# ca3de6b2 23-Feb-2015 Sathya Perla <sathya.perla@emulex.com>

be2net: refactor function initalization sequence into be_func_init()

Function initialization sequence is executed in be_probe(), be_resume
and be_eeh_resume(). Move this code to a new routine called be_func_init()
to prevent code duplication.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 21252377 06-Feb-2015 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: process port misconfig async event

This patch adds support for processing the port misconfigure async
event generated by the FW. This event is generated typically when an
optical module is incorrectly installed or is faulty.

This patch also moves the port_name field to the adapter struct for
logging the event. As the be_cmd_query_port_name() call is now moved
to be_get_config(), it is modified to use the mailbox instead of MCCQ

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# ac34b743 06-Feb-2015 Sathya Perla <sathya.perla@emulex.com>

be2net: remove duplicate code in be_cmd_rx_filter()

This patch passes BE_IF_FLAGS_XXX flags to be_cmd_rx_filter() routine
instead of the IFF_XXX flags. Doing this gets rid of the code to convert
the IFF_XXX flags to the BE_IF_FLAGS_XXX used by the FW cmd. The patch
also removes code for setting if_flags_mask that was duplicated for each
filter mode.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 70a7b525 06-Feb-2015 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: use offset based FW flashing for Skyhawk chip

While sending FW update cmds to the FW, the driver specifies the "type"
of each component that needs to be flashed. The FW then picks the offset
in the flash area at which the componnet is to be flashed. This doesn't work
when new components that the current FW doesn't recognize, need to be
flashed. Recent FWs (10.2 and above) support a scheme of FW-update wherein
the "offset" of the component in the flash area can be specified instead
of the "type". This patch uses the "offset" based FW-update mechanism and
only when it fails, it fallsback to the old "type" based update.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f7062ee5 06-Feb-2015 Sathya Perla <sathya.perla@emulex.com>

be2net: move un-exported routines from be.h to respective src files

Routines that are called only inside one src file must remain in that
file itself. Including them in a header file that is used for exporting
routine/struct definitions, causes unnecessary compilation of other
src files, when such a routine is modified.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bc0ee163 05-Feb-2015 Lad, Prabhakar <prabhakar.csengg@gmail.com>

be2net: fix sparse warning

this patch fixes following sparse warning:

be_cmds.c:2750:5: warning: symbol 'be_cmd_set_qos' was not declared. Should it be static?

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 58bdeaa6 20-Jan-2015 Kalesh AP <kalesh.purayil@emulex.com>

be2net: Fix TX rate limiting on Lancer/Skyhawk-R VFs

When max_tx_rate is set via bw_max in the NIC resource desc, bw_min must be
set to 0.
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e673244a 20-Jan-2015 Kalesh AP <kalesh.purayil@emulex.com>

be2net: add a log message for POST timeout in Lancer

This patch adds a log message in case of POST timeout in Lancer to
help debugging failure cases. It also logs sliport_status register value in
case of POST timeout.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 18fd6025 20-Jan-2015 Kalesh AP <kalesh.purayil@emulex.com>

be2net: fail VF link config change via ndo_set_vf_link_state() on BE3/Lancer

The support for this exists only in skyhawk FW.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# cd3307aa 19-Sep-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: fix alignment on line wrap

This patch fixes alignment whereever it doesn't match the open parenthesis
alignment.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 5f820b6c 19-Sep-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: remove multiple assignments on a single line

This patch removes multiple assignments on a single line as warned
by checkpatch.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 504fbf1e 19-Sep-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: remove space after typecasts

This patch removes unnecessary spaces after typecasts as per checkpatch warnings.
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 619f2d1a 19-Sep-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: remove unnecessary blank lines after an open brace

This patch fixes checkpatch warnings about blank lines after an open brace '{'.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d6f5473c 19-Sep-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: remove multiple blank lines

This patch removes multiple blank lines in the driver as per checkpatch
warnings.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 03d28ffe 19-Sep-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: add blank line after declarations

This patch fixes checkpatch warnings in be2net by adding a blank line
between declaration and code blocks.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# b502ae8d 19-Sep-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: fix a sparse warning in be_cmd_modify_eqd()

This patch fixes a sparse warning about missing static declaration that was
introduced by the following commit:

fixes: 936767039cdf ("be2net: send a max of 8 EQs to be_cmd_modify_eqd() on Lancer")

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 93676703 12-Sep-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: send a max of 8 EQs to be_cmd_modify_eqd() on Lancer

The MODIFY_EQ_DELAY FW cmd on Lancer is supported for a max of 8 EQs per cmd.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 6809cee0 12-Sep-2014 Ravikumar Nelavelli <ravikumar.nelavelli@emulex.com>

be2net: fix port-type reporting in get_settings

Report the ethtool port-type/supported/advertising values based on the
cable_type for QSFP and SFP+ interfaces. The cable_type is parsed from
the transceiver data fetched from the FW.

Signed-off-by: Ravikumar Nelavelli <ravikumar.nelavelli@emulex.com>
Signed-off-by: Suresh Reddy <Suresh.Reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e36edd9d 12-Sep-2014 Mark Leonard <mark.leonard@emulex.com>

be2net: add ethtool "-m" option support

This patch adds support for the dump-module-eeprom and module-info
ethtool options.

Signed-off-by: Mark Leonard <mark.leonard@emulex.com>
Signed-off-by: Suresh Reddy <Suresh.Reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# b29812c1 12-Sep-2014 Suresh Reddy <Suresh.Reddy@emulex.com>

be2net: use v1 of SET_FLOW_CONTROL command

In some configurations the FW doesn't allow changing flow control settings
of a link. Unless a v1 version of the SET_FLOW_CONTROL cmd is used, the FW
doesn't report an error to the driver.

Signed-off-by: Suresh Reddy <Suresh.Reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 242eb470 12-Sep-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: replace strcpy with strlcpy

Replace strcpy with strlcpy, as it avoids a possible buffer overflow.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 50762667 12-Sep-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: fix some log messages

This patch fixes the following minor issues with log messages in be2net:
1) Period is not required at the end of log message.
2) Remove "Unknown grp5 event" logs to reduce noise. The driver can safely
ignore async events from FW it's not interested in.
3) Reword a log message for better readability to say that SRIOV
"is disabled" rather than "not supported".

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# c5f156de 01-Sep-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: make be_cmd_get_regs() return a status

There are a few failure cases in be_cmd_get_regs() that ideally must return
an error value. This style is used across all the routines in be_cmds.c with
this routine being an exception. This patch fixes this.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# acbafeb1 01-Sep-2014 Sathya Perla <sathya.perla@emulex.com>

be2net: add a few log messages

This patch adds the following log messages to help debugging
failure cases:
1) log FW version number: this is useful when driver initialization
fails and the FW version number cannot be queried via ethtool
2) per function resource limits for BEx chips: these values are
currently being printed only for Skyhawk and Lancer
3) PCI BAR mapping failure
4) function_mode/caps queried from FW: this helps catch any FW bugs
that could advertise wrong capabilities to the driver

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f0613380 01-Aug-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: support deleting FW dump via ethtool (only for Lancer)

This patch adds support to delete an existing FW-dump in Lancer via ethtool.
Initiating a new dump is not allowed if a FW dump is already present in the
adapter. The existing dump has to be first explicitly deleted.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e97e3cda 17-Jul-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: reduce arguments passed to FW-cmd routines

A pointer to adapter struct is passed anyway to all of the FW-cmd routines
in be_cmds.c. For routines which query data from FW, the adapter pointer
is enough to return the queried fields.
There is no need to separately pass pointers to individual members of
the adapter structure. This patch fixes this for be_cmd_get_fw_ver()
and be_cmd_get_fw_cfg() routines.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# fd45160c 17-Jul-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: return -ETIMEDOUT when a FW-cmd times out

When the FW stops responding with completions, return -ETIMEDOUT error
(instead of -1) to the stack.
Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bec84e6b 30-Jun-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: create optimal number of queues on SR-IOV config

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

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 10cccf60 30-Jun-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: read VF's capabilities from GET_PROFILE_CONFIG cmd

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

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# ba48c0c9 30-Jun-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: remove be_cmd_get_profile_config_mbox/mccq() variants

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

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 3acf19d9 30-May-2014 Sathya Perla <sathya.perla@emulex.com>

be2net: cleanup MCC async event processing code

The MCC async event processing code has 2 issues:
a) because of long struct names the code indentation is badly broken
b) description and definitions of how an MCC completion is interpreted as
an async event are confusing (for e.g. the last word of an MCC event is
named "code", while "code" is just a sub-field of the last word.)

This patch fixes the structure definitions, comments and re-factors code
as needed.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 559b633f 30-May-2014 Sathya Perla <sathya.perla@emulex.com>

be2net: move async cmd processing to a separate routine

For some FW cmds, the caller just issues the cmd and doesn't wait for a
response. The response handling is done in the MCCQ compl processing context
only. Move this code into a separate routine to make be_mcc_compl_process()
more manageable.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 4c60005f 30-May-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: re-factor MCCQ error status handling code

This patch improves MCCQ error status handling in the following ways:
a) A MCC cmd completion returns a base-status and an addl-status.
So far, the routine be_mcc_compl_process() returned only the "status" value.
Now, embedd both statuses in the return value and let the caller routine access
the value of interest using base_status() and addl_status() macros.

b) Rename variables accordingly (base/addl) to avoid confusion while error
checking.

b) Some of the errors returned by FW are harmless and so an error msg is not
logged for such errors. Capture this logic in a separate routine to make the
code more readable.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 96c9b2e4 30-May-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: support flashing new regions on Skyhawk-R

Certain new flash regions have been added to Skyhawk-R FW image. The newer
FW images specify op_types for each region. A region is flashed only
when it's CRC doesn't match that of the region on the HW flash. While
upgrading to a new FW image the driver is expected to tolerate certain
errors.

This patch re-factors code under be_flash() to support the above scheme.
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 0f77ba73 30-May-2014 Ravikumar Nelavelli <ravikumar.nelavelli@emulex.com>

be2net: fixup TX-rate setting code for Skyhawk-R

Skyhawk-R FW supports TX-rate setting only as a % value of the link
speed, set via the SET_PROFILE_CONFIG cmd.

This patch makes the necessary changes to the FW cmd descriptors to support
the above change and also introduces checks in be_set_vf_tx_rate() to allow
only discrete values (that map to % of the link-speed).

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 33cb0fa7 14-May-2014 Ben Hutchings <ben@decadent.org.uk>

ethtool, be2net: constify array pointer parameters to ethtool_ops::set_rxfh

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>


# b51aa367 09-May-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: use MCCQ instead of MBOX in be_cmd_rss_config()

be_cmd_rss_config() is called after the MCCQ is created; so this cmd is
now modified to use the MCCQ instead of MBOX. Also fixed some indentation
problem in this routine.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 4d567d97 09-May-2014 Kalesh AP <kalesh.purayil@emulex.com>

be2net: remove unused code in be_cmd_vlan_config()

For putting interface into vlan promiscuous mode, we use be_cmd_rx_filter()
and not be_cmd_vlan_config(). So remove the "promiscuous" argument from
be_cmd_vlan_config().

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# a2cc4e0b 09-May-2014 Sathya Perla <sathya.perla@emulex.com>

be2net: fix function call indentation in be_cmds.c

When a funtion definition or a function call spans more than one
line, ensure that the first argument on the subsequent lines is
aligned to the first column after the opening paranthesis of the
function call.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e2557877 21-Apr-2014 Venkata Duvvuru <VenkatKumar.Duvvuru@Emulex.Com>

be2net: Support for configurable RSS hash key

This be2net patch implements the get/set_rxfh() ethtool hooks.
RSS_CONFIG device command is invoked to set hashkey and indirection table.
It also uses an initial random value for RSS hash key instead of a
hard-coded value as hard-coded values for a hash-key are usually
considered a security risk.

Signed-off-by: Venkat Duvvuru <VenkatKumar.Duvvuru@Emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# a401801c 26-Mar-2014 Sathya Perla <sathya.perla@emulex.com>

be2net: add FW cmds needed for VxLAN offloads

This patch adds support for the FW cmds needed for VxLAN offloads
on Skyhawk-R:
1) The VxLAN UDP port needs to be configured via the port-desc of
SET_PROFILE_CONFIG_v1 cmd.
This patch re-factors the be_set_profile_config() code (used so far
only for setting VF QoS) to be used to set any type of descriptor.
2) The MANAGE_IFACE_FILTERS cmds is needed to convert a normal interface
into a tunnel interface. This allows for RSS to work even on the inner
TCP/UDP headers of VxLAN traffic.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bdac85b5 11-Mar-2014 Ravikumar Nelavelli <ravikumar.nelavelli@emulex.com>

be2net: log LPVID used in multi-channel configs

Signed-off-by: Ravikumar Nelavelli <ravikumar.nelavelli@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bdce2ad7 11-Mar-2014 Suresh Reddy <suresh.reddy@emulex.com>

be2net: Add link state control for VFs

Add support to control VF's link state by implementing the
ndo_set_vf_link_state() hook.

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f93f160b 12-Feb-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: refactor multi-channel config code for Skyhawk-R chip

Currently multi-channel configuration is read via the QUERY_FW_CONFIG cmd.
This method has been deprecated by the Skyhawk-R FW. Instead,
GET_PROFILE_CONFIG::port-desc must be used to query this configuration.

This patch also:
a) introduces a few macros to identify certain categories of multi-channel
configs
2) re-factors the be_cmd_set_profile_config() code to be able to read any kind
of desc (and not just the nic-desc.)

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 40263820 12-Feb-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Update copyright year

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 76a9e08e 15-Jan-2014 Suresh Reddy <suresh.reddy@emulex.com>

be2net: cleanup wake-on-lan code

This patch cleans-up wake-on-lan code in the following ways:
1) Removes some driver hacks in be_cmd_get_acpi_wol_cap() that were based
on incorrect assumptions.
2) Uses the adapter->wol_en and wol_cap variables for checking if WoL
is supported and enabled on an interface instead of referring to the
exclusion list via the macro be_is_wol_supported()

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# b188f090 15-Jan-2014 Suresh Reddy <suresh.reddy@emulex.com>

be2net: use GET_MAC_LIST cmd to query mac-address from a pmac-id

The use of NTKW_MAC_QUERY cmd has been deprecated for Skyhawk-R.
Replace the last remaining usage in be_vfs_mac_query() routine.

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 02308d74 15-Jan-2014 Suresh Reddy <suresh.reddy@emulex.com>

be2net: fix incorrect setting of cmd_privileges for VFs

An earlier commit (f25b119c "Fix error messages while driver load for VFs")
incorrectly set the adapter->cmd_privileges value for VFs (in a
multi-channel config) to MAX_PRIVILEGES. This causes FW cmd failures
and avoidable error logs when certian cmds are issued by a VF.
Also, move the multi-channel hack to be_cmds.c inside
be_cmd_get_fn_privileges() routine.

Fixes: f25b119c "Fix error messages while driver load for VFs"

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# baaa08d1 15-Jan-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: do not call be_set/get_fw_log_level() on Skyhawk-R

Skyhawk-R FW does not support SET/GET_EXT_FAT_CAPABILITIES cmds via which
FW logging level can be controlled. Also, the hack used in BE3 to control
FW logging level via the ethtool interface is not needed in Skyhawk-R.

This patch also cleans up this code by moving be_set/get_fw_log_level()
routines to be_cmds.c where they belong.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>

remove new line
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 542963b7 15-Jan-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Log the profile-id used by FW during driver initialization

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 2c07c1d7 15-Jan-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: don't set "pport" field when querying "pvid"

In the GET_HSW_CONFIG cmd, the "pport" field must be set only while
querying the switch mode. When the "pport" field is set, the
"interface_id" field must be set to the port number, otherwise, it
must be set to adapter->if_handle.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 666d39c7 15-Jan-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Use MCC_CREATE_EXT_V1 cmd for Skyhawk-R

Currently this cmd is used only for Lancer.
MCC_CREATE_EXT_V1 supports larger CQ-ids and additional event codes for the
async_event_bitmap field.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 5eeff635 06-Jan-2014 Suresh Reddy <suresh.reddy@emulex.com>

be2net: increase the timeout value for loopback-test FW cmd

The loopback test FW cmd may need upto 15 seconds to complete on
certain PHYs. This patch also fixes the name of the completion variable
used to synchronize FW cmd completions as it not used by the flashing
cmd alone anymore.

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# da1388d6 06-Jan-2014 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: disable RSS when number of RXQs is reduced to 1 via set-channels

When *only* the default RXQ is used, the RSS policy must be disabled so
that all IP and no-IP traffic is placed into the default RXQ. If not,
IP traffic is dropped.

Also, issue the RSS_CONFIG cmd only if FW advertises RSS capability for
the interface.
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 09e83a9d 21-Nov-2013 Ajit Khaparde <ajit.khaparde@emulex.com>

be2net: set coalesce-wm in CQ_CREATE_V2 cmd

It is not being set currently. (This field is not applicable for Lancer)

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 012bd387 18-Nov-2013 Ajit Khaparde <ajit.khaparde@emulex.com>

be2net: Fix unconditional enabling of Rx interface options

The driver currently requests the firmware to enable rx_interface options
without considering if the interface was created with that capability.
This could cause commands to firmware to fail.

To avoid this, enable only those options on an interface if the interface
was created with that capability.

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 87f20c26 29-Oct-2013 Gavin Shan <shangw@linux.vnet.ibm.com>

net/benet: Make lancer_wait_ready() static

The function needn't to be public, so to make it as static.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 0fb88d61 17-Oct-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: pass if_id for v1 and V2 versions of TX_CREATE cmd

It is a required field for all TX_CREATE cmd versions > 0.
This fixes a driver initialization failure, caused by recent SH-R Firmwares
(versions > 10.0.639.0) failing the TX_CREATE cmd when if_id field is
not passed.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 61000861 03-Oct-2013 Ajit Khaparde <ajit.khaparde@emulex.com>

be2net: Call version 2 of GET_STATS ioctl for Skyhawk-R

Moving to version 2 of GET_STATS command as SkyHawk-R supports
higher number of rings.

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 2632bafd 01-Oct-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: fix adaptive interrupt coalescing

The current EQ delay calculation for AIC is based only on RX packet rate.
This fails to be effective when there's only TX and no RX.
This patch inclues:
- Calculating EQ-delay based on both RX and TX pps.
- Modifying EQ-delay of all EQs via one cmd, instead of issuing a separate
cmd for each EQ.
- A new structure to store interrupt coalescing parameters, in a separate
cache-line from the EQ-obj.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 0599863d 01-Oct-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: call ENABLE_VF cmd for Skyhawk-R too

This cmd needs to be sent to FW when enabling VFs (currently used only
for Lancer.) Also, avoid calling the cmd when driver loads and finds that
VFs are already enabled from a previous load.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 81b02655 01-Oct-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: pass if_id for v1 and V2 versions of TX_CREATE cmd

It is a required field for all TX_CREATE cmd versions > 0.
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d9d604f8 27-Sep-2013 Ajit Khaparde <ajit.khaparde@emulex.com>

be2net: Fix VLAN promiscuous mode programming

When the interface runs out of the allocated entries in VLAN table,
we program the interface in VLAN promiscuous mode.
Use OPCODE_COMMON_NTWK_RX_FILTER to set VLAN Promiscuous mode
instead of OPCODE_COMMON_NTWK_VLAN_CONFIG.

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# a77dcb8c 30-Aug-2013 Ajit Khaparde <ajit.khaparde@emulex.com>

be2net: set and query VEB/VEPA mode of the PF interface

SkyHawk-R can support VEB or VEPA mode.
This patch will allow the user to set/query this switch setting.

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 7707133c 27-Aug-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: refactor be_setup() to consolidate queue creation routines

1) Move be_cmd_if_create() above queue create routines to allow
TXQ creation (that requires if_handle) to be clubbed with TX-CQ creation.
2) Consolidate all queue create routines into be_setup_queues()

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bea50988 27-Aug-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: Fix be_cmd_if_create() to use MBOX if MCCQ is not created

Currently the IF_CREATE FW cmd is issued only *after* MCCQ is created as
it was coded to only use MCCQ. By fixing this, cmd_if_create() can be
called before MCCQ is created and the same routine for VF provisioning
can be called after.
This allows for consolidating all the queue create routines by moving
the be_cmd_if_create() call above all queue create calls in be_setup().

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 92bf14ab 27-Aug-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: refactor be_get_resources() code

1) use be_resources{} struct to query/store HW resource limits
2) The HW queue/resource limits for BE2/BE3 chips are mostly called out
in driver as constants. Code to handle this is scattered across various
places in be_setup(). Consolidate this code into BEx_get_resources().
For Lancer-R, Skyhawk-R, these limits are queried from FW.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 150d58c7 27-Aug-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Fixup profile management routines

1) Parse PCIe descriptor for max-VFs supported by HW
2) Cleanup NIC descriptor parsing in get_func/profile_config() routines
3) Use common struct definitions for v0 and v1 versions of GET_FUNC_CONFIG
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f2f781a7 27-Aug-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: use EQ_CREATEv2 for SH-R

EQ_CREATEv2 explicitly returns the msix-index associated with a EQ.
For SH-R this is needed if EQs need to be deleted and re-created without
resetting a function.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 3da988c9 14-Aug-2013 Sarveshwar Bandi <sarveshwar.bandi@emulex.com>

be2net: Clear any capability flags that driver is not interested in.

It is possible for some versions of firmware to advertise capabilities that driver
is not ready to handle. This may lead to controller stall. Since the driver is
interested only in subset of flags, clearing the rest.

Signed-off-by: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 117affe3 05-Aug-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Initialize "status" in be_cmd_get_die_temperature()

Uninitialized value was being returned in the non-failure case.
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 05ccaa2b 05-Aug-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: fixup log msgs for async events

Log the event type for unknown async events

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 68cb7e47 05-Aug-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Fix displaying supported speeds for BE2

The BE2 FW GET_PHY_DETAILS cmd does not return fixed speeds supported.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# b971f847 05-Aug-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Adding more speeds reported by get_settings

The new speeds are supported by variants of the Skyhawk-R chip.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 4188e7df 05-Aug-2013 Jingoo Han <jg1.han@samsung.com>

be2net: Staticize local functions

These local functions are used only in this file.
Fix the following sparse warnings:

drivers/net/ethernet/emulex/benet/be_main.c:475:6: warning: symbol 'populate_erx_stats' was not declared. Should it be static?
drivers/net/ethernet/emulex/benet/be_main.c:1485:6: warning: symbol 'be_rx_compl_process_gro' was not declared. Should it be static?
drivers/net/ethernet/emulex/benet/be_main.c:2262:5: warning: symbol 'be_poll' was not declared. Should it be static?
drivers/net/ethernet/emulex/benet/be_main.c:3223:6: warning: symbol 'flash_cookie' was not declared. Should it be static?
drivers/net/ethernet/emulex/benet/be_main.c:3280:27: warning: symbol 'get_fsec_info' was not declared. Should it be static?
drivers/net/ethernet/emulex/benet/be_cmds.c:1013:5: warning: symbol 'be_cmd_mccq_ext_create' was not declared. Should it be static?
drivers/net/ethernet/emulex/benet/be_cmds.c:1071:5: warning: symbol 'be_cmd_mccq_org_create' was not declared. Should it be static?
drivers/net/ethernet/emulex/benet/be_cmds.c:3166:5: warning: symbol 'be_cmd_get_profile_config_mbox' was not declared. Should it be
static?
drivers/net/ethernet/emulex/benet/be_cmds.c:3194:5: warning: symbol 'be_cmd_get_profile_config_mccq' was not declared. Should it be
static?
drivers/net/ethernet/emulex/benet/be_roce.c:96:6: warning: symbol '_be_roce_dev_remove' was not declared. Should it be static?
drivers/net/ethernet/emulex/benet/be_roce.c:113:6: warning: symbol '_be_roce_dev_open' was not declared. Should it be static?
drivers/net/ethernet/emulex/benet/be_roce.c:129:6: warning: symbol '_be_roce_dev_close' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 3175d8c2 23-Jul-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: use SET/GET_MAC_LIST for SH-R

On SH-R and Lancer-R, GET_MAC_LIST cmd is better supported
(instead of NTWK_MAC_QUERY cmd) to query provisioned MAC addresses.
Similiarly, (on SH-R and Lancer-R) SET_MAC_LIST must be used by the PF to
provision a permanent MAC addresses to the VF.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 95046b92 23-Jul-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: refactor MAC-addr setup code

The code to configure the permanent MAC in be_setup() has become quite
complicated, with different FW cmds being used for BEx, SH-R and Lancer.
Simplify the logic by moving some of this complexity to be_cmds.c. This
makes the code in be_setup() a little more readable.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# b5bb9776 23-Jul-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: fix pmac_id for BE3 VFs

For BE3 VFs, the permanent MAC is added by its PF. The VF can retrieve its
pmac_id only via the IFACE_CREATE cmd. This is not true for Lancer and SH-R
VFs which get the pmac_id by issuing a ADD_IFACE_MAC cmd. So, use this
hack only for BE3 VFs.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 04a06028 23-Jul-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: allow VFs to program MAC and VLAN filters

In the current design VFs were not allowed to program MAC/VLAN filters.
Only the PF driver was allowed to configure/provision MAC and transparent
VLANs to a VF. Change this to support MAC/VLAN filtering on a VF by a VM.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 5a712c13 23-Jul-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: fix MAC address modification for VF

Currently, the VFs by default don't have the privilege to modify MAC address.
This will change in a subsequent fix wherein VFs will have the ability to
modify MAC/VLAN filters.

Fix be_mac_addr_set() logic to support MAC address modification on a
privileged VF too.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 5c510811 29-May-2013 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Implement initiate FW dump feature for Lancer

Added code to initiate FW dump via ethtool. Driver checks if the previous dump
has been cleared before initiating the dump. It doesn't initiate the dump
if it is not cleared.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 01e5b2c4 29-May-2013 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Fix crash on 2nd invocation of PCI AER/EEH error_detected hook

During a PCI EEH/AER error recovery flow, if the device did not successfully
restart, the error_detected() hook may be called a second time with a
"perm_failure" state. This patch skips over driver cleanup for the second
invocation of the callback.

Also, Lancer error recovery code is fixed-up to handle these changes.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Somnath kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 950e2958 22-May-2013 Wei Yang <weiyang@linux.vnet.ibm.com>

be2net: bug fix on returning an invalid nic descriptor

In function be_get_nic_desc(), it will go through the descriptor array
returned from f/w. By comparing the desc_type field, it determines whether
there is a nic descriptor in the array or not. In the case of no nic
descriptor, this function should return NULL.

The code may return an invalide descriptor, when there is no nic descriptor
in the array and the desc_count is less than MAX_RESOURCE_DESC. In this case,
even there is no nic descriptor, it will still return the lase descriptor
since the i doesn't equal to MAX_RESOURCE_DESC.

This patch fix this issue by returning the descriptor when find it and return
NULL for other cases.

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Reviewed-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Acked-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bf591f51 07-May-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: fix payload_len value for GET_MAC_LIST cmd req

The buffer size for a FW cmd request must be big enough to fit the response,
else the cmd fails. For GET_MAC_LIST cmd, though the memory allocated for
the cmd is big enough to fit the response, the payload_len value in the
WRB hdr is being set to the request length only.
Fix this for GET_MAC_LIST cmd.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 701962d0 01-May-2013 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Fix firmware download for Lancer

Increasing the timeout value of write_object command to 60 seconds as
30 second timeout was found to be not enough for the command to complete.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# c5dae588 01-May-2013 Ajit Khaparde <ajit.khaparde@emulex.com>

be2net: Fix to receive Multicast Packets when Promiscuous mode is enabled on certain devices

When a user requests Promiscuous mode on SkyHawk-R devices,
the FW enables Desparate Promiscuous mode.
Due to this, we need to explicitly enable Multicast Promiscuous mode
so that Multicast packets are received as well.

This patch fixes that.

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bbdc42f8 01-May-2013 Ajit Khaparde <ajit.khaparde@emulex.com>

be2net: Fix to use version 2 of cq_create for SkyHawk-R devices

SkyHawk-R devices should use v2 of cq_create command.
BE3/BE2 devices can use version 0 of the command to create a CQ.

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 28710c55 28-Apr-2013 Kalesh AP <kalesh.purayil@emulex.com>

be2net: Use GET_FUNCTION_CONFIG V1 cmd

Skyhawk-R requires V1 version of GET_FUNCTION_CONFIG cmd to be used for
querrying resources available per function.

Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com>
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d98ef50f 24-Apr-2013 Suresh Reddy <suresh.reddy@emulex.com>

be2net: Fixed memory leak

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 594ad54a 25-Apr-2013 Suresh Reddy <suresh.reddy@emulex.com>

be2net: Add support for setting and getting rx flow hash options

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bc0c3405 24-Apr-2013 Ajit Khaparde <ajit.khaparde@emulex.com>

be2net: fix a Tx stall bug caused by a specific ipv6 packet

The ASIC could lockup in the transmit path when it tries
to insert VLAN in a specific ipv6 packet.
1) Identify the packet which can cause this.
2) Check if the firmware provides a workaround to prevent this.
3) If workaround is not present, drop the packet.
4) If the firmware provides a workaround, insert the VLAN tag in the
packet and inform the firmware to skip further VLAN insertions.

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# a05f99db 21-Apr-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Use GET_PROFILE_CONFIG V1 cmd for BE3-R

Use GET_PROFILE_CONFIG_V1 cmd for BE3-R, to query the maximum number of
TX rings available per function. On SH-R the same is queried via the
GET_FUNCTION_CONFIG cmd.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 0ad3157e 21-Apr-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Avoid flashing BE3 UFI on BE3-R chip.

Avoid flashing BE3 UFI on BE3-R chip by verifying asic_revision
number of the chip.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 4d277125 21-Apr-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Don't log "Out of MCCQ wrbs" error

Don't log "Out of MCCQ wrbs" msg. When the driver doesn't receive any
response from the FW it already logs a "FW not responding" message.
The driver runs out of MCCQ wrbs much later. Also, this message can
swamp the kernel log in HW/FW error scenarios.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 94d73aaa 21-Apr-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Use TXQ_CREATE_V2 cmd

Skyhawk-R and BE3-R (SuperNIC profile) require V2 version
of TXQ_CREATE cmd to be used.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f9725c03 10-Apr-2013 Ivan Vecera <ivecera@redhat.com>

be2net: remove unused variable 'sge'

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d0320f75 14-Mar-2013 Joe Perches <joe@perches.com>

drivers:net: Remove dma_alloc_coherent OOM messages

I believe these error messages are already logged
on allocation failure by warn_alloc_failed and so
get a dump_stack on OOM.

Remove the unnecessary additional error logging.

Around these deletions:

o Alignment neatening.
o Remove unnecessary casts of dma_alloc_coherent.
o Hoist assigns from ifs.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 68c45a2d 13-Mar-2013 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Use new F/W mailbox cmd to manipulate interrupts.

This is needed as the earlier method of manipulating this register via PCI
Config space is disallowed by certain Hypervisors.

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# c7bb15a6 06-Mar-2013 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Update copyright year

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sarveshwar Bandi <sarveshwar.bandi@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# c5b3ad4c 05-Mar-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: use CSR-BAR SEMAPHORE reg for BE2/BE3

The SLIPORT_SEMAPHORE register shadowed in the
config-space may not reflect the correct POST stage after
an EEH reset in BE2/3; it may return FW_READY state even though
FW is not ready. This causes the driver to prematurely
poll the FW mailbox and fail.

For BE2/3 use the CSR-BAR/0xac instead.

Reported-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 66d29cbc 03-Mar-2013 Gavin Shan <shangw@linux.vnet.ibm.com>

benet: Wait f/w POST until timeout

While PCI card faces EEH errors, reset (usually hot reset) is
expected to recover from the EEH errors. After EEH core finishes
the reset, the driver callback (be_eeh_reset) is called and wait
the firmware to complete POST successfully. The original code would
return with error once detecting failure during POST stage. That
seems not enough.

The patch forces the driver (be_eeh_reset) to wait the firmware
completes POST until timeout, instead of returning error upon
detection POST failure immediately. Also, it would improve the
reliability of the EEH funtionality of the driver.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Acked-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 9e9ff4b7 12-Feb-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: remove BUG_ON() in be_mcc_compl_is_new()

The current code expects that the last word (with valid bit)
of an MCC compl is DMAed in one shot. This may not be the case.
Remove this assertion.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 4c876616 03-Feb-2013 Sathya Perla <sathya.perla@emulex.com>

be2net: fix re-loaded PF driver to re-gain control of its VFs

Currently, when the PF driver is unloaded and re-loaded while VFs are attached
to VMs, it loses control of its VFs.

The PF driver now uses the newly defined/created GET_IFACE_LIST cmd
(available in FW ver >= 4.6) to query the if_id of the VFs
(enabled in its previous life). The PF driver then uses the if_id for
further VF configuration.

The GET_IFACE_MAC_LIST cmd has also implemented in BE3 FW for PF to
query pmac-ids used by its VFs.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# a323d9bf 17-Dec-2012 Sathya Perla <sathya.perla@emulex.com>

be2net: fix be_close() to ensure all events are ack'ed

In be_close(), be_eq_clean() must be called after all RX/TX/MCC queues
have been cleaned to ensure that any events caused while cleaning up
completions are notified/acked. Not clearing all events can cause
upredictable behaviour when RX rings are re-created in the subsequent
be_open().

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 1bc8e7e4 06-Nov-2012 Sathya Perla <sathya.perla@emulex.com>

be2net: fix access to SEMAPHORE reg

The SEMAPHORE register was being accessed from the csr BAR space. This BAR
may not be available in some Skyhawk-R configurations. Instead, access this
register via the PCI config space (it's available there too).

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# ca34fe38 06-Nov-2012 Sathya Perla <sathya.perla@emulex.com>

be2net: fix wrong usage of adapter->generation

adapter->generation was being incorrectly set as BE_GEN3 for Skyhawk-R.
Replace generation usage with XXX_chip() macros to identify the chip.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# be716446 22-Oct-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix smatch warnings in be_main.c

FW flashing code, even though it works correctly, makes some hidden
assumptions about buffer sizes. This is causing code analysers to
report error. Cleanup FW flashing code to remove these hidden assumptions.

Reported-by: Yuanhan Liu <yuanhan.liu@intel.com>
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# dcf7ebba 20-Oct-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix VF driver load on newer Lancer FW

PF driver should enable VF so that VF goes to ready state in
new Lancer FW.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# aa790db9 20-Oct-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix issues in error recovery due to wrong queue state

During recovery from a FW error, destroy queue operation may fail.
Queue should be marked as destroyed so that recovery code can recreate
the queue. Also fix queue created state not getting checked at one instance.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f25b119c 20-Oct-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix error messages while driver load for VFs

VF does not have privileges to execute many commands. When VFs try
to execute those commands there are unnecessary error messages.
Fix this by executing only those commands for which VF has privilege.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 67297ad8 20-Oct-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Wait till resources are available for VF in error recovery

After FW error, driver should wait for NO_RESOURCE error to disappear before
proceeding with recovery.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d5c18473 20-Oct-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix setting QoS for VF for Lancer

Use Lancer specific command to set QoS for VF.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# abb93951 20-Oct-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix driver load failure for different FW configs in Lancer

Driver assumes FW resource counts and capabilities while creating queues and
using functionality like RSS. This causes driver load to fail in FW configs
where resources and capabilities are reduced. Fix this by querying FW
configuration during probe and using resources and capabilities accordingly.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d379142b 27-Sep-2012 Sathya Perla <sathya.perla@emulex.com>

be2net: fixup log messages

Added and modified a few log messages mostly in probe path.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 323ff71e 27-Sep-2012 Sathya Perla <sathya.perla@emulex.com>

be2net: cleanup code related to be_link_status_query()

1) link_status_query() is always called to query the link-speed (speed
after applying qos). When there is no qos setting, link-speed is derived from
port-speed. Do all this inside this routine and hide this from the callers.

2) adpater->phy.forced_port_speed is not being set anywhere after being
initialized. Get rid of this variable.

3) Ignore async link_speed notifications till the initial value has been
fetched from FW.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 5ee4979b 27-Sep-2012 Sathya Perla <sathya.perla@emulex.com>

be2net: remove type argument of be_cmd_mac_addr_query()

All invocations of this routine use the same type value.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 522609f2 28-Aug-2012 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: modify log msg for lack of privilege error

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 072a9c48 24-Aug-2012 Amerigo Wang <amwang@redhat.com>

netpoll: revert 6bdb7fe3104 and fix be_poll() instead

Against -net.

In the patch "netpoll: re-enable irq in poll_napi()", I tried to
fix the following warning:

[100718.051041] ------------[ cut here ]------------
[100718.051048] WARNING: at kernel/softirq.c:159 local_bh_enable_ip+0x7d/0xb0()
(Not tainted)
[100718.051049] Hardware name: ProLiant BL460c G7
...
[100718.051068] Call Trace:
[100718.051073] [<ffffffff8106b747>] ? warn_slowpath_common+0x87/0xc0
[100718.051075] [<ffffffff8106b79a>] ? warn_slowpath_null+0x1a/0x20
[100718.051077] [<ffffffff810747ed>] ? local_bh_enable_ip+0x7d/0xb0
[100718.051080] [<ffffffff8150041b>] ? _spin_unlock_bh+0x1b/0x20
[100718.051085] [<ffffffffa00ee974>] ? be_process_mcc+0x74/0x230 [be2net]
[100718.051088] [<ffffffffa00ea68c>] ? be_poll_tx_mcc+0x16c/0x290 [be2net]
[100718.051090] [<ffffffff8144fe76>] ? netpoll_poll_dev+0xd6/0x490
[100718.051095] [<ffffffffa01d24a5>] ? bond_poll_controller+0x75/0x80 [bonding]
[100718.051097] [<ffffffff8144fde5>] ? netpoll_poll_dev+0x45/0x490
[100718.051100] [<ffffffff81161b19>] ? ksize+0x19/0x80
[100718.051102] [<ffffffff81450437>] ? netpoll_send_skb_on_dev+0x157/0x240

by reenabling IRQ before calling ->poll, but it seems more
problems are introduced after that patch:

http://ozlabs.org/~akpm/stuff/IMG_20120824_122054.jpg
http://marc.info/?l=linux-netdev&m=134563282530588&w=2

So it is safe to fix be2net driver code directly.

This patch reverts the offending commit and fixes be_poll() by
avoid disabling BH there, this is okay because be_poll()
can be called either by poll_napi() which already disables
IRQ, or by net_rx_action() which already disables BH.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Sylvain Munaut <s.munaut@whatever-company.com>
Cc: Sylvain Munaut <s.munaut@whatever-company.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Miller <davem@davemloft.net>
Cc: Sathya Perla <sathya.perla@emulex.com>
Cc: Subbu Seetharaman <subbu.seetharaman@emulex.com>
Cc: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
Tested-by: Sylvain Munaut <s.munaut@whatever-company.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 2e177a5c 17-Jul-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Ignore physical link async event for Lancer

The ability of driver to transmit packets depends on logical state
of the link. Ignore physical link status.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 0b13fb45 17-Jul-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix VF driver load for Lancer

Lancer FW has added new capability checks for VFs.
Driver should only use those capabilities which are allowed for VFs.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d3bd3a5e 11-Jul-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Enable RSS UDP hashing for Lancer and Skyhawk

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# b4e32a71 11-Jul-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix port name in message during driver load

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f67ef7ba 11-Jul-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Activate new FW after FW download for Lancer

After FW download, activate new FW by invoking FW reset.
Recreate rings once new FW is operational.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# bf99e50d 11-Jul-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix initialization sequence for Lancer

Invoke only required initialization routines for Lancer.
Remove invocation of unnecessary routines.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 7aeb2156 11-Jul-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net : Fix die temperature stat for Lancer

Query die temperature stat for Lancer to report it correctly
in ethtool.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 97f1d8cd 13-Jun-2012 Vasundhara Volam <vasundhara.volam@emulex.com>

be2net: Modify error message to incorporate subsystem

Modify IOCTL error message to print subsystem also.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 1578e777 06-Jun-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix driver load for VFs for Lancer

Permanent MAC is wrongly supplied in create iface command. Call the
command with no MAC address and then MAC address should be later queried
and applied.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 941a77d5 17-May-2012 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Fix to allow get/set of debug levels in the firmware.

Patch re-spin.
Incorporated review comments by Ben Hutchings.

Signed-off-by: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 6a4ab669 26-Mar-2012 Parav Pandit <parav.pandit@emulex.com>

be2net: Add function to issue mailbox cmd on MQ

- Add generic function to issue mailbox cmd on MQ as export function.
- RoCE driver will use this before it setups its own MQ.

Signed-off-by: Parav Pandit <parav.pandit@emulex.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Roland Dreier <roland@purestorage.com>


# c165541e 24-Apr-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix FW download for BE

Skip flashing a FW component if that component is not present in a
particular FW UFI image.

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 652bf646 24-Apr-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix wrong status getting returned for MCC commands

MCC Response CQEs are processed as part of NAPI poll routine and
also synchronously. If MCC completions are consumed by NAPI poll
routine, wrong status is returned to synchronously waiting routine.
Fix this by getting status of MCC command from command response
instead of response CQEs.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d51ebd33 24-Apr-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix Lancer statistics

Fix port num sent in command to get stats. Also skip unnecessary
parsing of stats for Lancer.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 804c7515 24-Apr-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix FW download in Lancer

Increase time given by driver to adapter for completing FW download
to 30 seconds. Also return correct status when FW download times out.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 42f11cf2 21-Apr-2012 Ajit Khaparde <ajitkhaparde@gmail.com>

be2net: fix ethtool get settings

ethtool get settings was not displaying all the settings correctly.
use the get_phy_info to get more information about the PHY to fix this.

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f1f3ee1b 18-Mar-2012 Ajit Khaparde <ajit.khaparde@emulex.com>

be2net: fix programming of VLAN tags for VF

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 4762f6ce 18-Mar-2012 Ajit Khaparde <ajit.khaparde@emulex.com>

be2net: enable WOL by default if h/w supports it

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 1ca7ba92 23-Feb-2012 Sathya Perla <sathya.perla@emulex.com>

be2net: enable RSS for ipv6 pkts

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 10ef9ab4 09-Feb-2012 Sathya Perla <sathya.perla@emulex.com>

be2net: event queue re-design

v2: Fixed up the bad typecasting pointed out by David...

In the current design 8 TXQs are serviced by 1 EQ, while each RSS queue
is serviced by a separate EQ. This is being changed as follows:

- Upto 8 EQs will be used (based on the availabilty of msix vectors).
Each EQ will handle 1 RSS and 1 TX ring. The default non-RSS RX queue and
MCC queue are handled by the last EQ.

- On cards which provide support, upto 8 RSS rings will be used, instead
of the current limit of 4.

The new design allows spreading the TX multi-queue completion processing
across multiple CPUs unlike the previous design.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e5e1ee89 03-Feb-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Use new implementation of get mac list command

VFs use get mac list command to get their mac address. The format of
this command has changed. Update driver to use the new format.

Signed-off-by: Mammatha Edhala <mammatha.edhala@emulex.com>
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 57cd80d4 03-Feb-2012 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix link status query command

Version number in query link status command is getting overwritten in
be_wrb_cmd_hdr_prepare() routine. Move the initialization to fix this
issue. Also initialize the domain field.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# b236916a 29-Dec-2011 Ajit Khaparde <ajit.khaparde@emulex.com>

be2net: query link status in be_open()

be2net gets an async link status notification from the FW when it creates
an MCC queue. There are some cases in which this gratuitous notification
is not received from FW. To cover this explicitly query the link status
in be_open().

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 65f8584e 24-Nov-2011 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Use new hash key

This new hash key gives better distribution of packets across RX
queues.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 590c391d 24-Nov-2011 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Move to new SR-IOV implementation in Lancer

SR-IOV implementation is Lancer has changed in following ways -
1)PF driver assigns one MAC addresses for VF using COMMON_SET_IFACE_MAC_LIST.
2)VF driver queries its MAC address using COMMON_GET_IFACE_MAC_LIST command
and assigns it to its interface.

Signed-off-by: Mammatha Edhala <mammatha.edhala@emulex.com>
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# daad6167 15-Nov-2011 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Use V1 query link status command for lancer

Use V1 version of query link status command for Lancer.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# de49bd5a 15-Nov-2011 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: add register dump feature for Lancer

Implement register dump using ethtool for Lancer.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 293c4a7d 15-Nov-2011 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix TX queue create for Lancer

Lancer uses V1 version of TXQ create. This command needs interface
id for TX queue creation. Rearrange code such that tx queue create
is after interface create. As TXQ create is now called after MCC
ring create use MCC instead of MBOX.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 6589ade0 10-Nov-2011 Sathya Perla <sathya.perla@emulex.com>

be2net: stop issuing FW cmds if any cmd times out

A FW cmd timeout (with a sufficiently large timeout value in the
order of tens of seconds) indicates an unresponsive FW. In this state
issuing further cmds and waiting for a completion will only stall the process.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 434b3648 10-Nov-2011 Sathya Perla <sathya.perla@emulex.com>

be2net: don't log more than one error on detecting EEH/UE errors

Currently we're spamming error messages each time a FW cmd call is made
while in EEH/UE error state. One log msg on error detection is enough.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 30128031 10-Nov-2011 Sathya Perla <sathya.perla@emulex.com>

be2net: init (vf)_if_handle/vf_pmac_id to handle failure scenarios

Initialize if_handle, vf_if_handle and vf_pmac_id with "-1" so that in
failure cases when be_clear() is called, we can skip over
if_destroy/pmac_del cmds if they have not been created.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e1cfb67a 02-Nov-2011 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Add detect UE feature for Lancer

Add code to detect UE in case of Lancer.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 1610c79f 02-Nov-2011 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix disabling multicast promiscous mode

If user tries to disable multicast promiscous mode, the adapter remains
in this mode as resetting the multicast promiscous mode was missing
in RX filter command. Fixed this.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 016f97b1 02-Nov-2011 Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>

be2net: Fix endian issue in RX filter command

Use cpu_to_le32() for mcast_num field in RX filter command as this
field is of type u32.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e3a7ae2c 27-Oct-2011 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Changing MAC Address of a VF was broken.

Allow for MAC Address change of VF(SR-IOV case) on the fly- First add and then
delete MAC Address to allow for 'out of pool' errors.
When MAC Addr configured from a VM, the MAC on the NIC will aleady have
the supplied MAC,so just copy the supplied MAC to the netdev structure
before returning success to the stack

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 106df1e3 27-Oct-2011 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Refactored be_cmds.c file.

Moved the .sge. field's population inside be_cmd_hdr_prepare.
Populating wrb->tag0 and tag1 inside be_cmd_hdr_prepare

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f9449ab7 23-Oct-2011 Sathya Perla <sathya.perla@emulex.com>

be2net: refactor VF setup/teardown code into be_vf_setup/clear()

Currently the code for VF setup/teardown done by a PF (if_create,
mac_add_config, link_status_query etc) is scattered; this patch
refactors this code into be_vf_setup() and be_vf_clear(). The
if_create/if_destroy/mac_addr_query cmds are now called after the MCCQ
is created; so these cmds are now modified to use the MCCQ instead of
MBOX.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 3de09455 30-Sep-2011 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Making die temperature ioctl call async

Also changing it's frequency to once every 64s instead of existing 32s as
it was shown to affect performance

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 92aa9214 30-Sep-2011 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Fixed Endianness issues in the response read log length field while retrieving FAT data

This was manifesting as a crash when FAT Dump extraction was attempted on a PPC machine.

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 3ab81b5f 03-Oct-2011 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Add 60 second delay to allow FAT dump completion on recovery from EEH

Add 60s delay before timeout on polling Bit 31 so that FAT dump can
complete when reset occurs.

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 04b71175 27-Sep-2011 Sathya Perla <sathya.perla@emulex.com>

be2net: Show newly flashed FW ver in ethtool

This fix provides a newly flashed FW version (appended, in braces)
along with the currently running FW version via ethtool. The newly
flashed version runs only after a system reset.

Signed-off-by: Suresh Reddy <Suresh.Reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 8e7d3f68 27-Sep-2011 Sathya Perla <sathya.perla@emulex.com>

be2net: fix multicast filter programming

Re-posting with subject fixed!

Multicast programming has been broken since commit 5b8821b7. Setting the
MULTICAST flag while sending the cmd to the FW was missing. Fixed this.

Also fixed-up some indentation in the adjacent lines.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e2edb7d5 22-Aug-2011 Sathya Perla <sathya.perla@emulex.com>

be2net: increase FW update completion timeout

Flashing some of the PHYs can take longer thus increasing the total flash
update time to a max of 40s.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 939cf306 18-Aug-2011 Somnath Kotur <somnath.kotur@emulex.com>

be2net: Storing the 'vid' got by the grp5 event instead of storing the vlan_tag

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 9aebddd1 13-May-2011 Jeff Kirsher <jeffrey.t.kirsher@intel.com>

be2net: Move the Emulex driver

Moves the Emulex driver into drivers/net/ethernet/emulex/ and
make the necessary Kconfig and Makefile changes.

CC: Sathya Perla <sathya.perla@emulex.com>
CC: Subbu Seetharaman <subbu.seetharaman@emulex.com>
CC: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>