]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
8 years agobnxt_en: Refactor tx completion path.
Michael Chan [Mon, 6 Feb 2017 21:55:41 +0000 (16:55 -0500)]
bnxt_en: Refactor tx completion path.

Orabug: 25645429

XDP_TX requires a different function to handle completion.  Add a
function pointer to handle tx completion logic.  Regular TX rings
will be assigned the current bnxt_tx_int() for the ->tx_int()
function pointer.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fa3e93e86cc3d1809fba67cb138883ed4bb74a5f)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Add a set of TX rings to support XDP.
Michael Chan [Mon, 6 Feb 2017 21:55:40 +0000 (16:55 -0500)]
bnxt_en: Add a set of TX rings to support XDP.

Orabug: 25645429

Add logic for an extra set of TX rings for XDP.  If enabled, this
set of TX rings equals the number of RX rings and shares the same
IRQ as the RX ring set.  A new field bp->tx_nr_rings_xdp is added
to keep track of these TX XDP rings.  Adjust all other relevant functions
to handle bp->tx_nr_rings_xdp.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5f4492493e75dafc5cbb96eabe0f146c2ffb1e3d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Add tx ring mapping logic.
Michael Chan [Mon, 6 Feb 2017 21:55:39 +0000 (16:55 -0500)]
bnxt_en: Add tx ring mapping logic.

Orabug: 25645429

To support XDP_TX, we need to add a set of dedicated TX rings, each
associated with the NAPI of an RX ring.  To assign XDP rings and regular
rings in a flexible way, we add a bp->tx_ring_map[] array to do the
remapping.  The netdev txq index is stored in the new field txq_index
so that we can retrieve the netdev txq when handling TX completions.
In this patch, before we introduce XDP_TX, the mapping is 1:1.

v2: Fixed a bug in bnxt_tx_int().

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a960dec98861b009b4227d2ae3b94a142c83eb96)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Centralize logic to reserve rings.
Michael Chan [Mon, 6 Feb 2017 21:55:38 +0000 (16:55 -0500)]
bnxt_en: Centralize logic to reserve rings.

Orabug: 25645429

Currently, bnxt_setup_tc() and bnxt_set_channels() have similar and
duplicated code to check and reserve rx and tx rings.  Add a new
function bnxt_reserve_rings() to centralize the logic.  This will
make it easier to add XDP_TX support which requires allocating a
new set of TX rings.

Also, the tx ring checking logic in bnxt_setup_msix() can be removed.
The rings have been reserved before hand.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d1e7925e6d80ce5f9ef6deb8f3cec7526f5c443c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Use event bit map in RX path.
Michael Chan [Mon, 6 Feb 2017 21:55:37 +0000 (16:55 -0500)]
bnxt_en: Use event bit map in RX path.

Orabug: 25645429

In the current code, we have separate rx_event and agg_event parameters
to keep track of rx and aggregation events.  Combine these events into
an u8 event mask with different bits defined for different events.  This
way, it is easier to expand the logic to include XDP tx events.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4e5dbbda4c40a239e2ed4bbc98f2aa320e4dcca2)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Add RX page mode support.
Michael Chan [Mon, 6 Feb 2017 21:55:36 +0000 (16:55 -0500)]
bnxt_en: Add RX page mode support.

Orabug: 25645429

This mode is to support XDP.  In this mode, each rx ring is configured
with page sized buffers for linear placement of each packet.  MTU will be
restricted to what the page sized buffers can support.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c61fb99cae51958a9096d8540c8c05e74cfa7e59)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/broadcom/bnxt/bnxt.c

8 years agobnxt_en: Parameterize RX buffer offsets.
Michael Chan [Mon, 6 Feb 2017 21:55:35 +0000 (16:55 -0500)]
bnxt_en: Parameterize RX buffer offsets.

Orabug: 25645429

Convert the global constants BNXT_RX_OFFSET and BNXT_RX_DMA_OFFSET to
device parameters.  This will make it easier to support XDP with
headroom support which requires different RX buffer offsets.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b3dba77cf0acb6e44b368979026df975658332bc)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Add bp->rx_dir field for rx buffer DMA direction.
Michael Chan [Mon, 6 Feb 2017 21:55:34 +0000 (16:55 -0500)]
bnxt_en: Add bp->rx_dir field for rx buffer DMA direction.

Orabug: 25645429

When driver is running in XDP mode, rx buffers are DMA mapped as
DMA_BIDIRECTIONAL.  Add a field so the code will map/unmap rx buffers
according to this field.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 745fc05c9db1f17da076861c7f57507e13f28a3a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Don't use DEFINE_DMA_UNMAP_ADDR to store DMA address in RX path.
Michael Chan [Mon, 6 Feb 2017 21:55:33 +0000 (16:55 -0500)]
bnxt_en: Don't use DEFINE_DMA_UNMAP_ADDR to store DMA address in RX path.

Orabug: 25645429

To support XDP_TX, we need the RX buffer's DMA address to transmit the
packet.  Convert the DMA address field to a permanent field in
bnxt_sw_rx_bd.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 11cd119d31a71b37c2362fc621f225e2aa12aea1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Refactor rx SKB function.
Michael Chan [Mon, 6 Feb 2017 21:55:32 +0000 (16:55 -0500)]
bnxt_en: Refactor rx SKB function.

Orabug: 25645429

Minor refactoring of bnxt_rx_skb() so that it can easily be replaced by
a new function that handles packets in a single page.  Also, use a
function pointer bp->rx_skb_func() to switch to a new function when
we add the new mode in the next patch.

Add a new field data_ptr that points to the packet data in the
bnxt_sw_rx_bd structure.  The original data field is changed to void
pointer so that it can either hold the kmalloc'ed data or a page
pointer.

The last parameter of bnxt_rx_skb() which was the length parameter is
changed to include the payload offset of the packet in the upper 16 bit.
The offset is needed to support the rx page mode and is not used in
this existing function.

v3: Added a new data_ptr parameter to bp->rx_skb_func().  The caller
has the option to modify the starting address of the packet.  This
will be needed when XDP with headroom support is added.

v2: Changed the name of the last parameter to offset_and_len to make the
code more clear.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6bb19474391d17954fee9a9997ecca25b35dfd46)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Fix RTNL lock usage on bnxt_get_port_module_status().
Michael Chan [Wed, 25 Jan 2017 07:55:09 +0000 (02:55 -0500)]
bnxt_en: Fix RTNL lock usage on bnxt_get_port_module_status().

Orabug: 25645429

bnxt_get_port_module_status() calls bnxt_update_link() which expects
RTNL to be held.  In bnxt_sp_task() that does not hold RTNL, we need to
call it with a prior call to bnxt_rtnl_lock_sp() and the call needs to
be moved to the end of bnxt_sp_task().

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 90c694bb71819fb5bd3501ac397307d7e41ddeca)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Fix RTNL lock usage on bnxt_update_link().
Michael Chan [Wed, 25 Jan 2017 07:55:08 +0000 (02:55 -0500)]
bnxt_en: Fix RTNL lock usage on bnxt_update_link().

Orabug: 25645429

bnxt_update_link() is called from multiple code paths.  Most callers,
such as open, ethtool, already hold RTNL.  Only the caller bnxt_sp_task()
does not.  So it is a bug to take RTNL inside bnxt_update_link().

Fix it by removing the RTNL inside bnxt_update_link().  The function
now expects the caller to always hold RTNL.

In bnxt_sp_task(), call bnxt_rtnl_lock_sp() before calling
bnxt_update_link().  We also need to move the call to the end of
bnxt_sp_task() since it will be clearing the BNXT_STATE_IN_SP_TASK bit.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0eaa24b971ae251ae9d3be23f77662a655532063)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Fix bnxt_reset() in the slow path task.
Michael Chan [Wed, 25 Jan 2017 07:55:07 +0000 (02:55 -0500)]
bnxt_en: Fix bnxt_reset() in the slow path task.

Orabug: 25645429

In bnxt_sp_task(), we set a bit BNXT_STATE_IN_SP_TASK so that bnxt_close()
will synchronize and wait for bnxt_sp_task() to finish.  Some functions
in bnxt_sp_task() require us to clear BNXT_STATE_IN_SP_TASK and then
acquire rtnl_lock() to prevent race conditions.

There are some bugs related to this logic. This patch refactors the code
to have common bnxt_rtnl_lock_sp() and bnxt_rtnl_unlock_sp() to handle
the RTNL and the clearing/setting of the bit.  Multiple functions will
need the same logic.  We also need to move bnxt_reset() to the end of
bnxt_sp_task().  Functions that clear BNXT_STATE_IN_SP_TASK must be the
last functions to be called in bnxt_sp_task().  The common scheme will
handle the condition properly.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a551ee94ea723b4af9b827c7460f108bc13425ee)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Fix "uninitialized variable" bug in TPA code path.
Michael Chan [Wed, 18 Jan 2017 03:07:19 +0000 (22:07 -0500)]
bnxt_en: Fix "uninitialized variable" bug in TPA code path.

Orabug: 25645429

In the TPA GRO code path, initialize the tcp_opt_len variable to 0 so
that it will be correct for packets without TCP timestamps.  The bug
caused the SKB fields to be incorrectly set up for packets without
TCP timestamps, leading to these packets being rejected by the stack.

Reported-by: Andy Gospodarek <andrew.gospodarek@broadocm.com>
Acked-by: Andy Gospodarek <andrew.gospodarek@broadocm.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 719ca8111402aa6157bd83a3c966d184db0d8956)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Add the ulp_sriov_cfg hooks for bnxt_re RDMA driver.
Michael Chan [Fri, 13 Jan 2017 06:32:04 +0000 (01:32 -0500)]
bnxt_en: Add the ulp_sriov_cfg hooks for bnxt_re RDMA driver.

Orabug: 25645429

Add the ulp_sriov_cfg callbacks when the number of VFs is changing.  This
allows the RDMA driver to provision RDMA resources for the VFs.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2f5938467bd7f34e59a1d6d3809f5970f62e194b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Add support for ethtool -p.
Michael Chan [Fri, 13 Jan 2017 06:32:03 +0000 (01:32 -0500)]
bnxt_en: Add support for ethtool -p.

Orabug: 25645429

Add LED blinking code to support ethtool -p on the PF.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5ad2cbeed74bd1e89ac4ba14288158ec7eb167da)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Update to firmware interface spec to 1.6.1.
Michael Chan [Fri, 13 Jan 2017 06:32:02 +0000 (01:32 -0500)]
bnxt_en: Update to firmware interface spec to 1.6.1.

Orabug: 25645429

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f183886c0d798ca3cf0a51e8cab3c1902fbd1e8b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Clear TPA flags when BNXT_FLAG_NO_AGG_RINGS is set.
Michael Chan [Fri, 13 Jan 2017 06:32:01 +0000 (01:32 -0500)]
bnxt_en: Clear TPA flags when BNXT_FLAG_NO_AGG_RINGS is set.

Orabug: 25645429

Commit bdbd1eb59c56 ("bnxt_en: Handle no aggregation ring gracefully.")
introduced the BNXT_FLAG_NO_AGG_RINGS flag.  For consistency,
bnxt_set_tpa_flags() should also clear TPA flags when there are no
aggregation rings.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 341138c3e6afa8e77f9f3e773d72b37022dbcee8)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Fix compiler warnings when CONFIG_RFS_ACCEL is not defined.
Michael Chan [Fri, 13 Jan 2017 06:32:00 +0000 (01:32 -0500)]
bnxt_en: Fix compiler warnings when CONFIG_RFS_ACCEL is not defined.

Orabug: 25645429

CC [M]  drivers/net/ethernet/broadcom/bnxt/bnxt.o
drivers/net/ethernet/broadcom/bnxt/bnxt.c:4947:21: warning: ‘bnxt_get_max_func_rss_ctxs’ defined but not used [-Wunused-function]
 static unsigned int bnxt_get_max_func_rss_ctxs(struct bnxt *bp)
                     ^
  CC [M]  drivers/net/ethernet/broadcom/bnxt/bnxt.o
drivers/net/ethernet/broadcom/bnxt/bnxt.c:4956:21: warning: ‘bnxt_get_max_func_vnics’ defined but not used [-Wunused-function]
 static unsigned int bnxt_get_max_func_vnics(struct bnxt *bp)
                     ^

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b742995445fbac874f5fe19ce2afc76c7a6ac2cf)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoMAINTAINERS: Add bnxt_en maintainer info.
Michael Chan [Thu, 29 Dec 2016 17:13:44 +0000 (12:13 -0500)]
MAINTAINERS: Add bnxt_en maintainer info.

Orabug: 25645429

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3f0d80b6d228f11117244a16d2e17ea684b540f5)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Handle no aggregation ring gracefully.
Michael Chan [Thu, 29 Dec 2016 17:13:43 +0000 (12:13 -0500)]
bnxt_en: Handle no aggregation ring gracefully.

Orabug: 25645429

The current code assumes that we will always have at least 2 rx rings, 1
will be used as an aggregation ring for TPA and jumbo page placements.
However, it is possible, especially on a VF, that there is only 1 rx
ring available.  In this scenario, the current code will fail to initialize.
To handle it, we need to properly set up only 1 ring without aggregation.
Set a new flag BNXT_FLAG_NO_AGG_RINGS for this condition and add logic to
set up the chip to place RX data linearly into a single buffer per packet.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit bdbd1eb59c565c56a74d21076e2ae8706de00ecd)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Set default completion ring for async events.
Michael Chan [Thu, 29 Dec 2016 17:13:42 +0000 (12:13 -0500)]
bnxt_en: Set default completion ring for async events.

Orabug: 25645429

With the added support for the bnxt_re RDMA driver, both drivers can be
allocating completion rings in any order.  The firmware does not know
which completion ring should be receiving async events.  Add an
extra step to tell firmware the completion ring number for receiving
async events after bnxt_en allocates the completion rings.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 486b5c22ea1d35e00e90dd79a32a9ee530b18915)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Implement new scheme to reserve tx rings.
Michael Chan [Thu, 29 Dec 2016 17:13:41 +0000 (12:13 -0500)]
bnxt_en: Implement new scheme to reserve tx rings.

Orabug: 25645429

In order to properly support TX rate limiting in SRIOV VF functions or
NPAR functions, firmware needs better control over tx ring allocations.
The new scheme requires the driver to reserve the number of tx rings
and to query to see if the requested number of tx rings is reserved.
The driver will use the new scheme when the firmware interface spec is
1.6.1 or newer.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 391be5c2736456f032fe0265031ecfe17aee84a0)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Add IPV6 hardware RFS support.
Michael Chan [Thu, 29 Dec 2016 17:13:40 +0000 (12:13 -0500)]
bnxt_en: Add IPV6 hardware RFS support.

Orabug: 25645429

Accept ipv6 flows in .ndo_rx_flow_steer() and support ETHTOOL_GRXCLSRULE
ipv6 flows.

Signed-off-by: Michael Chan <michael.chan@broadocm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit dda0e7465f040ed814d4a5c98c6bf042e59cba69)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

8 years agobnxt_en: Assign additional vnics to VFs.
Michael Chan [Thu, 29 Dec 2016 17:13:39 +0000 (12:13 -0500)]
bnxt_en: Assign additional vnics to VFs.

Orabug: 25645429

Assign additional vnics to VFs whenever possible so that NTUPLE can be
supported on the VFs.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8427af811a2fcbbf0c71a4b1f904f2442abdcf39)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Add new hardware RFS mode.
Michael Chan [Thu, 29 Dec 2016 17:13:38 +0000 (12:13 -0500)]
bnxt_en: Add new hardware RFS mode.

Orabug: 25645429

The existing hardware RFS mode uses one hardware RSS context block
per ring just to calculate the RSS hash.  This is very wasteful and
prevents VF functions from using it.  The new hardware mode shares
the same hardware RSS context for RSS placement and RFS steering.
This allows VFs to enable RFS.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ae10ae740ad2befd92b6f5b2ab39220bce6e5da2)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Refactor code that determines RFS capability.
Michael Chan [Thu, 29 Dec 2016 17:13:37 +0000 (12:13 -0500)]
bnxt_en: Refactor code that determines RFS capability.

Orabug: 25645429

Add function bnxt_rfs_supported() that determines if the chip supports
RFS.  Refactor the existing function bnxt_rfs_capable() that determines
if run-time conditions support RFS.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8079e8f107bf02e1e5ece89239dd2fb475a4735f)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Add function to get vnic capability.
Michael Chan [Thu, 29 Dec 2016 17:13:36 +0000 (12:13 -0500)]
bnxt_en: Add function to get vnic capability.

Orabug: 25645429

The new vnic RSS capability will enhance NTUPLE support, to be added
in subsequent patches.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8fdefd63c203d9b2955d679704f4ed92bf40752c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Refactor TPA code path.
Michael Chan [Thu, 29 Dec 2016 17:13:35 +0000 (12:13 -0500)]
bnxt_en: Refactor TPA code path.

Orabug: 25645429

Call tcp_gro_complete() in the common code path instead of the chip-
specific method.  The newer 5731x method is missing the call.

Signed-off-by: Michael Chan <michael.chan@broadcmo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5910906ca9ee32943f67db24917f78a9ad1087db)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Fix and clarify link_info->advertising.
Michael Chan [Thu, 29 Dec 2016 17:13:34 +0000 (12:13 -0500)]
bnxt_en: Fix and clarify link_info->advertising.

Orabug: 25645429

The advertising field is closely related to the auto_link_speeds field.
The former is the user setting while the latter is the firmware setting.
Both should be u16.  We should use the advertising field in
bnxt_get_link_ksettings because the auto_link_speeds field may not
be updated with the latest from the firmware yet.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 68515a186cf8a8f97956eaea5829277752399f58)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Improve the IRQ disable sequence during shutdown.
Michael Chan [Thu, 29 Dec 2016 17:13:33 +0000 (12:13 -0500)]
bnxt_en: Improve the IRQ disable sequence during shutdown.

Orabug: 25645429

The IRQ is disabled by writing to the completion ring doorbell.  This
should be done before the hardware completion ring is freed for correctness.
The current code disables IRQs after all the completion rings are freed.

Fix it by calling bnxt_disable_int_sync() before freeing the completion
rings.  Rearrange the code to avoid forward declaration.

Signed-off-by: Michael Chan <michael.chan@broadocm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9d8bc09766f1a229b2d204c713a1cfc6c7fa1bb1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnxt_en: Remove busy poll logic in the driver.
Michael Chan [Thu, 29 Dec 2016 17:13:31 +0000 (12:13 -0500)]
bnxt_en: Remove busy poll logic in the driver.

Orabug: 25645429

Use native NAPI polling instead.  The next patch will complete the work
by switching to use napi_complete_done()

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b356a2e729cec145a648d22ba5686357c009da25)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/broadcom/bnxt/bnxt.c

8 years agovmxnet3: prevent building with 64K pages
Arnd Bergmann [Fri, 17 Feb 2017 15:08:30 +0000 (16:08 +0100)]
vmxnet3: prevent building with 64K pages

Orabug: 25639933

I got a warning about broken code on ARM64 with 64K pages:

drivers/net/vmxnet3/vmxnet3_drv.c: In function 'vmxnet3_rq_init':
drivers/net/vmxnet3/vmxnet3_drv.c:1679:29: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
    rq->buf_info[0][i].len = PAGE_SIZE;

'len' here is a 16-bit integer, so this clearly won't work. I don't think
this driver is used much on anything other than x86, so there is no need
to fix this properly and we can work around it with a Kconfig dependency
to forbid known-broken configurations. qemu in theory supports it on
other architectures too, but presumably only for compatibility with x86
guests that also run on vmware.

CONFIG_PAGE_SIZE_64KB is used on hexagon, mips, sh and tile, the other
symbols are architecture-specific names for the same thing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fbdf0e28d061708cf18ba0f8e0db5360dc9a15b9)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: Move PCI Id to pci_ids.h
Adit Ranadive [Mon, 3 Oct 2016 02:10:21 +0000 (19:10 -0700)]
vmxnet3: Move PCI Id to pci_ids.h

Orabug: 25639933

The VMXNet3 PCI Id will be shared with our paravirtual RDMA driver.
Moved it to the shared location in pci_ids.h.

Suggested-by: Leon Romanovsky <leon@kernel.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Adit Ranadive <aditr@vmware.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
(cherry picked from commit b1226c7db1d997fa6955cd3b54ba333bd0d8a29c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: avoid assumption about invalid dma_pa in vmxnet3_set_mc()
Alexey Khoroshilov [Fri, 14 Oct 2016 21:01:20 +0000 (00:01 +0300)]
vmxnet3: avoid assumption about invalid dma_pa in vmxnet3_set_mc()

Orabug: 25639933

vmxnet3_set_mc() checks new_table_pa returned by dma_map_single()
with dma_mapping_error(), but even there it assumes zero is invalid pa
(it assumes dma_mapping_error(...,0) returns true if new_table is NULL).

The patch adds an explicit variable to track status of new_table_pa.

Found by Linux Driver Verification project (linuxtesting.org).

v2: use "bool" and "true"/"false" for boolean variables.
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fb5c6cfaec126d9a96b9dd471d4711bf4c737a6f)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: Wake queue from reset work
Benjamin Poirier [Mon, 3 Oct 2016 02:47:50 +0000 (10:47 +0800)]
vmxnet3: Wake queue from reset work

Orabug: 25639933

vmxnet3_reset_work() expects tx queues to be stopped (via
vmxnet3_quiesce_dev -> netif_tx_disable). However, this races with the
netif_wake_queue() call in netif_tx_timeout() such that the driver's
start_xmit routine may be called unexpectedly, triggering one of the BUG_ON
in vmxnet3_map_pkt with a stack trace like this:

RIP: 0010:[<ffffffffa00cf4bc>] vmxnet3_map_pkt+0x3ac/0x4c0 [vmxnet3]
 [<ffffffffa00cf7e0>] vmxnet3_tq_xmit+0x210/0x4e0 [vmxnet3]
 [<ffffffff813ab144>] dev_hard_start_xmit+0x2e4/0x4c0
 [<ffffffff813c956e>] sch_direct_xmit+0x17e/0x1e0
 [<ffffffff813c96a7>] __qdisc_run+0xd7/0x130
 [<ffffffff813a6a7a>] net_tx_action+0x10a/0x200
 [<ffffffff810691df>] __do_softirq+0x11f/0x260
 [<ffffffff81472fdc>] call_softirq+0x1c/0x30
 [<ffffffff81004695>] do_softirq+0x65/0xa0
 [<ffffffff81069b89>] local_bh_enable_ip+0x99/0xa0
 [<ffffffffa031ff36>] destroy_conntrack+0x96/0x110 [nf_conntrack]
 [<ffffffff813d65e2>] nf_conntrack_destroy+0x12/0x20
 [<ffffffff8139c6d5>] skb_release_head_state+0xb5/0xf0
 [<ffffffff8139d299>] skb_release_all+0x9/0x20
 [<ffffffff8139cfe9>] __kfree_skb+0x9/0x90
 [<ffffffffa00d0069>] vmxnet3_quiesce_dev+0x209/0x340 [vmxnet3]
 [<ffffffffa00d020a>] vmxnet3_reset_work+0x6a/0xa0 [vmxnet3]
 [<ffffffff8107d7cc>] process_one_work+0x16c/0x350
 [<ffffffff810804fa>] worker_thread+0x17a/0x410
 [<ffffffff810848c6>] kthread+0x96/0xa0
 [<ffffffff81472ee4>] kernel_thread_helper+0x4/0x10

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 277964e19e1416ca31301e113edb2580c81a8b66)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: fix non static symbol warning
Wei Yongjun [Wed, 24 Aug 2016 15:07:26 +0000 (15:07 +0000)]
vmxnet3: fix non static symbol warning

Orabug: 25639933

Fixes the following sparse warning:

drivers/net/vmxnet3/vmxnet3_drv.c:1645:1: warning:
 symbol 'vmxnet3_rq_destroy_all_rxdataring' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit bb40aca7cf153e3e2941140d3850a4b6c4205ccb)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: fix tx data ring copy for variable size
Shrikrishna Khare [Fri, 19 Aug 2016 17:33:42 +0000 (10:33 -0700)]
vmxnet3: fix tx data ring copy for variable size

Orabug: 25639933

'Commit 3c8b3efc061a ("vmxnet3: allow variable length transmit data ring
buffer")' changed the size of the buffers in the tx data ring from a
fixed size of 128 bytes to a variable size.

However, while copying data to the data ring, vmxnet3_copy_hdr continues
to carry the old code that assumes fixed buffer size of 128. This patch
fixes it by adding correct offset based on the actual data ring buffer
size.

Signed-off-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ff2e7d5d51469e98196f7933c83b781e96517e7c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: update to version 3
Shrikrishna Khare [Thu, 16 Jun 2016 17:51:59 +0000 (10:51 -0700)]
vmxnet3: update to version 3

Orabug: 25639933

With all vmxnet3 version 3 changes incorporated in the vmxnet3 driver,
the driver can configure emulation to run at vmxnet3 version 3, provided
the emulation advertises support for version 3.

Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6af9d787459e3ea32da446fe0aa76cff65fd2f8c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: introduce command to register memory region
Shrikrishna Khare [Thu, 16 Jun 2016 17:51:58 +0000 (10:51 -0700)]
vmxnet3: introduce command to register memory region

Orabug: 25639933

In vmxnet3 version 3, the emulation added support for the vmxnet3 driver
to communicate information about the memory regions the driver will use
for rx/tx buffers. The driver can also indicate which rx/tx queue the
memory region is applicable for. If this information is communicated
to the emulation, the emulation will always keep these memory regions
mapped, thereby avoiding the mapping/unmapping overhead for every packet.

Currently, Linux vmxnet3 driver does not leverage this capability. The
feasibility of using this approach for the Linux vmxnet3 driver will be
investigated independently and if possible, will be part of a different
patch. This patch only exposes the emulation capability to the driver
(vmxnet3_defs.h is identical between the driver and the emulation).

Signed-off-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 474432229f9482f0f4a2732f2e130dc48247f1d7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: add support for get_coalesce, set_coalesce ethtool operations
Shrikrishna Khare [Thu, 16 Jun 2016 17:51:57 +0000 (10:51 -0700)]
vmxnet3: add support for get_coalesce, set_coalesce ethtool operations

Orabug: 25639933

The emulation supports a variety of coalescing modes viz. disabled
(no coalescing), adaptive, static (number of packets to batch before
raising an interrupt), rate based (number of interrupts per second).

This patch implements get_coalesce and set_coalesce methods to allow
querying and configuring different coalescing modes.

Signed-off-by: Keyong Sun <sunk@vmware.com>
Signed-off-by: Manoj Tammali <tammalim@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4edef40ef5f8d09a0b1ded4d1d9b0e988cd98e97)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: add receive data ring support
Shrikrishna Khare [Thu, 16 Jun 2016 17:51:56 +0000 (10:51 -0700)]
vmxnet3: add receive data ring support

Orabug: 25639933

vmxnet3 driver preallocates buffers for receiving packets and posts the
buffers to the emulation. In order to deliver a received packet to the
guest, the emulation must map buffer(s) and copy the packet into it.

To avoid this memory mapping overhead, this patch introduces the receive
data ring - a set of small sized buffers that are always mapped by
the emulation. If a packet fits into the receive data ring buffer, the
emulation delivers the packet via the receive data ring (which must be
copied by the guest driver), or else the usual receive path is used.

Receive Data Ring buffer length is configurable via ethtool -G ethX rx-mini

Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 50a5ce3e7116a70edb7a1d1d209e3bc537752427)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: allow variable length transmit data ring buffer
Shrikrishna Khare [Thu, 16 Jun 2016 17:51:55 +0000 (10:51 -0700)]
vmxnet3: allow variable length transmit data ring buffer

Orabug: 25639933

vmxnet3 driver supports transmit data ring viz. a set of fixed size
buffers used by the driver to copy packet headers. Small packets that
fit these buffers are copied into these buffers entirely.

Currently this buffer size of fixed at 128 bytes. This patch extends
transmit data ring implementation to allow variable length transmit
data ring buffers. The length of the buffer is read from the emulation
during initialization.

Signed-off-by: Sriram Rangarajan <rangarajans@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3c8b3efc061a745d888869dc3462ac4f7dd582d9)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: introduce generalized command interface to configure the device
Shrikrishna Khare [Thu, 16 Jun 2016 17:51:54 +0000 (10:51 -0700)]
vmxnet3: introduce generalized command interface to configure the device

Orabug: 25639933

Shared memory is used to exchange information between the vmxnet3 driver
and the emulation. In order to request emulation to perform a task, the
driver first populates specific fields in this shared memory and then
issues corresponding command by writing to the command register(CMD). The
layout of the shared memory was defined by vmxnet3 version 1 and cannot
be extended for every new command without breaking backward compatibility.

To address this problem, in vmxnet3 version 3, the emulation repurposed
a reserved field in the shared memory to represent command information
instead. For new commands, the driver first populates the command
information field in the shared memory and then issues the command. The
emulation interprets the data written to the command information depending
on the type of the command. This patch exposes this capability to the driver.

Signed-off-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f35c7480f81b70f9c3030d96a3807e8faba34cf7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: prepare for version 3 changes
Shrikrishna Khare [Thu, 16 Jun 2016 17:51:53 +0000 (10:51 -0700)]
vmxnet3: prepare for version 3 changes

Orabug: 25639933

vmxnet3 is currently at version 2, but some command definitions from
previous vmxnet3 versions are missing. Add those definitions before
moving to version 3.

Also, introduce utility macros for vmxnet3 version comparison and update
Copyright information and Maintained by.

Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 190af10f0b5a07140ec4ce8e6ef04b7cb238dde1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: segCnt can be 1 for LRO packets
Shrikrishna Khare [Wed, 8 Jun 2016 14:40:53 +0000 (07:40 -0700)]
vmxnet3: segCnt can be 1 for LRO packets

Orabug: 25639933

The device emulation may send segCnt of 1 for LRO packets.

Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: Jin Heo <heoj@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 50219538ffc0493a2b451a3aa0191138ef8bfe9d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoDriver: Vmxnet3: set CHECKSUM_UNNECESSARY for IPv6 packets
Shrikrishna Khare [Thu, 21 Apr 2016 01:12:29 +0000 (18:12 -0700)]
Driver: Vmxnet3: set CHECKSUM_UNNECESSARY for IPv6 packets

Orabug: 25639933

For IPv6, if the device indicates that the checksum is correct, set
CHECKSUM_UNNECESSARY.

Reported-by: Subbarao Narahari <snarahari@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: Jin Heo <heoj@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f0d437809d23999cb25207cfbe80c61e5703fdc1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: fix lock imbalance in vmxnet3_tq_xmit()
Arnd Bergmann [Mon, 14 Mar 2016 14:53:57 +0000 (15:53 +0100)]
vmxnet3: fix lock imbalance in vmxnet3_tq_xmit()

Orabug: 25639933

A recent bug fix rearranged the code in vmxnet3_tq_xmit() in a
way that left the error handling for oversized headers unlock
a lock that had not been taken yet. Gcc warns about the incorrect
use of the 'flags' variable because of that:

drivers/net/vmxnet3/vmxnet3_drv.c: In function 'vmxnet3_tq_xmit.constprop':
include/linux/spinlock.h:246:3: error: 'flags' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This changes the error handling path to 'goto' the end of the function
beyond the lock/unlock pair.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: cec05562fb1d ("vmxnet3: avoid calling pskb_may_pull with interrupts disabled")
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit efc21d95067f658a20e51e24c4c86d68f23b7f7f)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agovmxnet3: avoid calling pskb_may_pull with interrupts disabled
Neil Horman [Fri, 4 Mar 2016 18:40:48 +0000 (13:40 -0500)]
vmxnet3: avoid calling pskb_may_pull with interrupts disabled

Orabug: 25639933

vmxnet3 has a function vmxnet3_parse_and_copy_hdr which, among other operations,
uses pskb_may_pull to linearize the header portion of an skb.  That operation
eventually uses local_bh_disable/enable to ensure that it doesn't race with the
drivers bottom half handler.  Unfortunately, vmxnet3 preforms this
parse_and_copy operation with a spinlock held and interrupts disabled.  This
causes us to run afoul of the WARN_ON_ONCE(irqs_disabled()) warning in
local_bh_enable, resulting in this:

WARNING: at kernel/softirq.c:159 local_bh_enable+0x59/0x90() (Not tainted)
Hardware name: VMware Virtual Platform
Modules linked in: ipv6 ppdev parport_pc parport microcode e1000 vmware_balloon
vmxnet3 i2c_piix4 sg ext4 jbd2 mbcache sd_mod crc_t10dif sr_mod cdrom mptspi
mptscsih mptbase scsi_transport_spi pata_acpi ata_generic ata_piix vmwgfx ttm
drm_kms_helper drm i2c_core dm_mirror dm_region_hash dm_log dm_mod [last
unloaded: mperf]
Pid: 6229, comm: sshd Not tainted 2.6.32-616.el6.i686 #1
Call Trace:
 [<c04624d9>] ? warn_slowpath_common+0x89/0xe0
 [<c0469e99>] ? local_bh_enable+0x59/0x90
 [<c046254b>] ? warn_slowpath_null+0x1b/0x20
 [<c0469e99>] ? local_bh_enable+0x59/0x90
 [<c07bb936>] ? skb_copy_bits+0x126/0x210
 [<f8d1d9fe>] ? ext4_ext_find_extent+0x24e/0x2d0 [ext4]
 [<c07bc49e>] ? __pskb_pull_tail+0x6e/0x2b0
 [<f95a6164>] ? vmxnet3_xmit_frame+0xba4/0xef0 [vmxnet3]
 [<c05d15a6>] ? selinux_ip_postroute+0x56/0x320
 [<c0615988>] ? cfq_add_rq_rb+0x98/0x110
 [<c0852df8>] ? packet_rcv+0x48/0x350
 [<c07c5839>] ? dev_queue_xmit_nit+0xc9/0x140
...

Fix it by splitting vmxnet3_parse_and_copy_hdr into two functions:

vmxnet3_parse_hdr, which sets up the internal/on stack ctx datastructure, and
pulls the skb (both of which can be done without holding the spinlock with irqs
disabled

and

vmxnet3_copy_header, which just copies the skb to the tx ring under the lock
safely.

tested and shown to correct the described problem.  Applies cleanly to the head
of the net tree

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Shrikrishna Khare <skhare@vmware.com>
CC: "VMware, Inc." <pv-drivers@vmware.com>
CC: "David S. Miller" <davem@davemloft.net>
Acked-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit cec05562fb1dcdf09ef7b46e1e3eade98e488893)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoDriver: Vmxnet3: Update Rx ring 2 max size
Shrikrishna Khare [Fri, 19 Feb 2016 19:19:52 +0000 (11:19 -0800)]
Driver: Vmxnet3: Update Rx ring 2 max size

Orabug: 25639933

Device emulation supports max size of 4096.

Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: Bhavesh Davda <bhavesh@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 14112ca5625db8a7fbdc724783510751577a8a1b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoDriver: Vmxnet3: Fix regression caused by 5738a09
Shrikrishna Khare [Wed, 6 Jan 2016 18:44:27 +0000 (10:44 -0800)]
Driver: Vmxnet3: Fix regression caused by 5738a09

Orabug: 25639933

Reported-by: Bingkuo Liu <bingkuol@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 58caf637365fef97c8e84ea5699a8e34d68fce93)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/vmxnet3/vmxnet3_int.h

8 years agovmxnet3: fix checks for dma mapping errors
Alexey Khoroshilov [Fri, 27 Nov 2015 22:29:30 +0000 (01:29 +0300)]
vmxnet3: fix checks for dma mapping errors

Orabug: 25639933

vmxnet3_drv does not check dma_addr with dma_mapping_error()
after mapping dma memory. The patch adds the checks and
tries to handle failures.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5738a09d58d5ad2871f1f9a42bf6a3aa9ece5b3c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoDriver: Vmxnet3: Fix use of mfTableLen for big endian architectures
Shrikrishna Khare [Fri, 13 Nov 2015 23:42:10 +0000 (15:42 -0800)]
Driver: Vmxnet3: Fix use of mfTableLen for big endian architectures

Orabug: 25639933

Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Reported-by: Masao Uebayashi <uebayasi@gmail.com>
Signed-off-by: Bhavesh Davda <bhavesh@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d37d5ec861b0d937c0bdd70f0138e2750aacccdb)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/vmxnet3/vmxnet3_int.h

8 years agoDriver: Vmxnet3: Extend register dump support
Shrikrishna Khare [Tue, 22 Sep 2015 03:01:29 +0000 (20:01 -0700)]
Driver: Vmxnet3: Extend register dump support

Orabug: 25639933

Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: Bhavesh Davda <bhavesh@vmware.com>
Acked-by: Srividya Murali <smurali@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b6bd9b5448a9362e3ca33b21f1461baa5500520f)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/vmxnet3/vmxnet3_int.h

8 years agovmxnet3: prevent receive getting out of sequence on napi poll
Neil Horman [Tue, 7 Jul 2015 18:02:18 +0000 (14:02 -0400)]
vmxnet3: prevent receive getting out of sequence on napi poll

Orabug: 25639933

vmxnet3's current napi path is built to count every rx descriptor we recieve,
and use that as a count of the napi budget.  That means its possible to return
from a napi poll halfway through recieving a fragmented packet accross multiple
dma descriptors.  If that happens, the next napi poll will start with the
descriptor ring in an improper state (e.g. the first descriptor we look at may
have the end-of-packet bit set), which will cause a BUG halt in the driver.

Fix the issue by only counting whole received packets in the napi poll and
returning that value, rather than the descriptor count.

Tested by the reporter and myself, successfully

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Shreyas Bhatewara <sbhatewara@vmware.com>
CC: "David S. Miller" <davem@davemloft.net>
Acked-by: Andy Gospodarek <gospo@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0769636cb5b95665ebadcd1a41c46f331f5a397d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Bump driver version as "14.101.00.00"
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:42 +0000 (13:34 +0530)]
scsi: mpt3sas: Bump driver version as "14.101.00.00"

Orabug: 25639713

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 6b64b286c8b6329e053941367a9c788f3e268a1d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Fix for Endianness issue.
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:41 +0000 (13:34 +0530)]
scsi: mpt3sas: Fix for Endianness issue.

Orabug: 25639713

Use le16_to_cpu only for accessing two byte data provided by controller.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit aa53bb89522fa3536faebf7e6b7275c84c4f9148)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Use the new MPI 2.6 32-bit Atomic Request Descriptors for SAS35 devices.
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:40 +0000 (13:34 +0530)]
scsi: mpt3sas: Use the new MPI 2.6 32-bit Atomic Request Descriptors for SAS35 devices.

Orabug: 25639713

Support Atomic Request Descriptors for Ventura/SAS35 devices.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 81c16f83231a92eca246cb91649c4726899a704d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: set EEDP-escape-flags for SAS35 devices.
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:39 +0000 (13:34 +0530)]
scsi: mpt3sas: set EEDP-escape-flags for SAS35 devices.

Orabug: 25639713

An UNMAP command on a PI formatted device will leave the Logical Block
Application Tag and Logical Block Reference Tag as all F's (for those LBAs
that are unmapped). To avoid IO errors if those LBAs are subsequently read
before they are written with valid tag fields, the MPI SCSI IO requests
need to set the EEDPFlags element EEDP Escape Mode field, Bits [7:6]
appropriately. A value of 2 should be set to disable all PI checks if the
Logical Block Application Tag is 0xFFFF for PI types 1 and 2.  A value
of 3 should be set to disable all PI checks if the Logical Block
Application Tag is 0xFFFF and the Logical Block Reference Tag is
0xFFFFFFFF for PI type 3.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 186a18e51db08d51011fc4bd2aa773e173f632c9)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Increased/Additional MSIX support for SAS35 devices.
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:38 +0000 (13:34 +0530)]
scsi: mpt3sas: Increased/Additional MSIX support for SAS35 devices.

Orabug: 25639713

For SAS35 devices MSIX vectors are inceased to 128 from 96. To support this
Reply post host index register count is increased to 16. Also variable
msix96_vector is replaced with combined_reply_queue and variable
combined_reply_index_count is added to set different values for SAS3 and
SAS35 devices.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 0bb337c97c2cdc9c0215205a81406f968c1dcae0)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Added Device ID's for SAS35 devices and updated MPI header.
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:37 +0000 (13:34 +0530)]
scsi: mpt3sas: Added Device ID's for SAS35 devices and updated MPI header.

Orabug: 25639713

Added Device ID's for SAS35 devices (Ventura, Crusader, Harpoon &
Tomcat) and updated mpi header file for the same. Also added
"is_gen35_ioc" to MPT3SAS_ADAPTER structure for identifying SAS35 adapters.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 998f26aedf41bc5cdce3b3c9233ac0e0672fa307)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: disable ASPM for MPI2 controllers
ojab [Wed, 28 Dec 2016 11:05:24 +0000 (11:05 +0000)]
scsi: mpt3sas: disable ASPM for MPI2 controllers

Orabug: 25639713

MPI2 controllers sometimes got lost (i.e. disappear from
/sys/bus/pci/devices) if ASMP is enabled.

Signed-off-by: Slava Kardakov <ojab@ojab.ru>
Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=60644
Cc: <stable@vger.kernel.org>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit ffdadd68af5a397b8a52289ab39d62e1acb39e63)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Force request partial completion alignment
Ram Pai [Thu, 26 Jan 2017 18:37:01 +0000 (16:37 -0200)]
scsi: mpt3sas: Force request partial completion alignment

Orabug: 25639713

The firmware or device, possibly under a heavy I/O load, can return on a
partial unaligned boundary. Scsi-ml expects these requests to be
completed on an alignment boundary. Scsi-ml blindly requeues the I/O
without checking the alignment boundary of the I/O request for the
remaining bytes. This leads to errors, since devices cannot perform
non-aligned read/write operations.

This patch fixes the issue in the driver. It aligns unaligned
completions of FS requests, by truncating them to the nearest alignment
boundary.

[mkp: simplified if statement]

Reported-by: Mauricio Faria De Oliveira <mauricfo@linux.vnet.ibm.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit f2e767bb5d6ee0d988cb7d4e54b0b21175802b6b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: fix hang on ata passthrough commands
James Bottomley [Sun, 1 Jan 2017 17:39:24 +0000 (09:39 -0800)]
scsi: mpt3sas: fix hang on ata passthrough commands

Orabug: 25639713

mpt3sas has a firmware failure where it can only handle one pass through
ATA command at a time.  If another comes in, contrary to the SAT
standard, it will hang until the first one completes (causing long
commands like secure erase to timeout).  The original fix was to block
the device when an ATA command came in, but this caused a regression
with

commit 669f044170d8933c3d66d231b69ea97cb8447338
Author: Bart Van Assche <bart.vanassche@sandisk.com>
Date:   Tue Nov 22 16:17:13 2016 -0800

    scsi: srp_transport: Move queuecommand() wait code to SCSI core

So fix the original fix of the secure erase timeout by properly
returning SAM_STAT_BUSY like the SAT recommends.  The original patch
also had a concurrency problem since scsih_qcmd is lockless at that
point (this is fixed by using atomic bitops to set and test the flag).

[mkp: addressed feedback wrt. test_bit and fixed whitespace]

Fixes: 18f6084a989ba1b (mpt3sas: Fix secure erase premature termination)
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reported-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit ffb58456589443ca572221fabbdef3db8483a779)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Recognize and act on iopriority info
Adam Manzanares [Wed, 1 Mar 2017 18:18:10 +0000 (13:18 -0500)]
scsi: mpt3sas: Recognize and act on iopriority info

Orabug: 25639713

This patch adds support for request iopriority handling in the mpt3sas
layer. This works only when a ATA device is behind the SATL. The ATA
device also has to indicate that it supports command priorities in the
identify information that is pulled from the SATL.

Signed-off-by: Adam Manzanares <adam.manzanares@wdc.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 307d9075a02b696e817b775c565e45c4fa3c32f2)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Unblock device after controller reset
Suganath Prabu S [Thu, 17 Nov 2016 10:45:58 +0000 (16:15 +0530)]
scsi: mpt3sas: Unblock device after controller reset

Orabug: 25639713

While issuing any ATA passthrough command to firmware the driver will
block the device. But it will unblock the device only if the I/O
completes through the ISR path. If a controller reset occurs before
command completion the device will remain in blocked state.

Make sure we unblock the device following a controller reset if an ATA
passthrough command was queued.

[mkp: clarified patch description]

Cc: <stable@vger.kernel.org> # v4.4+
Fixes: ac6c2a93bd07 ("mpt3sas: Fix for SATA drive in blocked state, after diag reset")
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 7ff723ad0f87feba43dda45fdae71206063dd7d4)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Fix secure erase premature termination
Andrey Grodzovsky [Thu, 10 Nov 2016 14:35:27 +0000 (09:35 -0500)]
scsi: mpt3sas: Fix secure erase premature termination

Orabug: 25639713

This is a work around for a bug with LSI Fusion MPT SAS2 when perfoming
secure erase. Due to the very long time the operation takes, commands
issued during the erase will time out and will trigger execution of the
abort hook. Even though the abort hook is called for the specific
command which timed out, this leads to entire device halt
(scsi_state terminated) and premature termination of the secure erase.

Set device state to busy while ATA passthrough commands are in progress.

[mkp: hand applied to 4.9/scsi-fixes, tweaked patch description]

Signed-off-by: Andrey Grodzovsky <andrey2805@gmail.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Cc: <linux-scsi@vger.kernel.org>
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Chaitra P B <chaitra.basappa@broadcom.com>
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Cc: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 18f6084a989ba1b38702f9af37a2e4049a924be6)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Unblock device after controller reset
Suganath Prabu S [Thu, 17 Nov 2016 10:45:58 +0000 (16:15 +0530)]
scsi: mpt3sas: Unblock device after controller reset

Orabug: 25639713

While issuing any ATA passthrough command to firmware the driver will
block the device. But it will unblock the device only if the I/O
completes through the ISR path. If a controller reset occurs before
command completion the device will remain in blocked state.

Make sure we unblock the device following a controller reset if an ATA
passthrough command was queued.

[mkp: clarified patch description]

Cc: <stable@vger.kernel.org> # v4.4+
Fixes: ac6c2a93bd07 ("mpt3sas: Fix for SATA drive in blocked state, after diag reset")
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 7ff723ad0f87feba43dda45fdae71206063dd7d4)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/scsi/mpt3sas/mpt3sas_scsih.c

8 years agoscsi: mpt3sas: fix some spelling mistakes in message and comments
Colin Ian King [Mon, 31 Oct 2016 15:34:46 +0000 (09:34 -0600)]
scsi: mpt3sas: fix some spelling mistakes in message and comments

Orabug: 25639713

Trivial fixes, minor spelling mistakes in comments and in a KERN_INFO
message.

[mkp: fixed spelling mistake in patch description]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 6c7abffc7ff0125106fb79e0520b501c759aa9ed)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Bump driver version as "14.100.00.00"
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:36 +0000 (13:34 +0530)]
scsi: mpt3sas: Bump driver version as "14.100.00.00"

Orabug: 25535122

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit e270263ec1e14b835890cbc32cf32db8b661bd3b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Remove unused macro "MPT_DEVICE_TLR_ON"
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:35 +0000 (13:34 +0530)]
scsi: mpt3sas: Remove unused macro "MPT_DEVICE_TLR_ON"

Orabug: 25535122

Removing macro "MPT_DEVICE_TLR_ON" defined in header file as its unused

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 58e2fe7afe2194be1dab12fdaf4d51cc6f109de8)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Implement device_remove_in_progress check in IOCTL path
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:34 +0000 (13:34 +0530)]
scsi: mpt3sas: Implement device_remove_in_progress check in IOCTL path

Orabug: 25535122

When device missing event arrives, device_remove_in_progress bit will be
set and hence driver has to stop sending IOCTL commands.Now the check has
been added in IOCTL path to test device_remove_in_progress bit is set, if
so then IOCTL will be failed printing failure message.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit c696f7b83edeac804e898952058089143f49ca0a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Fix for incorrect numbers for MSIX vectors enabled when non RDPQ card...
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:33 +0000 (13:34 +0530)]
scsi: mpt3sas: Fix for incorrect numbers for MSIX vectors enabled when non RDPQ card is enumerated first.

Orabug: 25535122

No. of MSIX vectors supported = min (Total no. of CPU cores,
MSIX vectors supported by card)

when RDPQ is disabled "max_msix_vectors" module parameter which was
declared as global was set to '8' and hence if there are more than one card
in system among which if RDPQ disabled card is enumerated first then only 8
MSIX vectors was getting enabled for all the cards(including RDPQ enabled
card,which can support more than 8 MSIX vectors).

Used local variable instead of global variable ,if RDPQ is disabled this
local variable is set to '8' else it is set to "max_msix_vectors" (by
default this is set to -1, whose value can be set by user during driver
load time).So now regardless of whether RDPQ disabled card is enumerated
first or RDPQ enabled card is enumerated first , MSIX vectors enabled
depends on the cards capability.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit bb3506612346c2e54bb71717d9b8cf7a7d188ead)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Fix for improper info displayed in var log, while blocking or unblocki...
Suganath Prabu Subramani [Wed, 26 Oct 2016 08:04:32 +0000 (13:34 +0530)]
scsi: mpt3sas: Fix for improper info displayed in var log, while blocking or unblocking the device.

Orabug: 25535122

Return value and Device_handle Arguments passed in correct order
 to match with its format string.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit b2fe6be798754a222ee5f22b90d175739c75c8c1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: mpt3sas: Fix for block device of raid exists even after deleting raid disk
Sreekanth Reddy [Fri, 28 Oct 2016 04:39:12 +0000 (10:09 +0530)]
scsi: mpt3sas: Fix for block device of raid exists even after deleting raid disk

Orabug: 25535122

While merging mpt3sas & mpt2sas code, we added the is_warpdrive check
condition on the wrong line

---------------------------------------------------------------------------
 scsih_target_alloc(struct scsi_target *starget)
                        sas_target_priv_data->handle = raid_device->handle;
                        sas_target_priv_data->sas_address = raid_device->wwid;
                        sas_target_priv_data->flags |= MPT_TARGET_FLAGS_VOLUME;
-                       raid_device->starget = starget;
+                       sas_target_priv_data->raid_device = raid_device;
+                       if (ioc->is_warpdrive)
+                               raid_device->starget = starget;
                }
                spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
                return 0;
------------------------------------------------------------------------------

That check should be for the line sas_target_priv_data->raid_device =
raid_device;

Due to above hunk, we are not initializing raid_device's starget for
raid volumes, and so during raid disk deletion driver is not calling
scsi_remove_target() API as driver observes starget field of
raid_device's structure as NULL.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Cc: <stable@vger.kernel.org> # v4.4+
Fixes: 7786ab6aff9 ("mpt3sas: Ported WarpDrive product SSS6200 support")
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 6d3a56ed098566bc83d6c2afa74b4199c12ea074)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agompt3sas: Fix resume on WarpDrive flash cards
Greg Edwards [Sat, 30 Jul 2016 16:06:26 +0000 (10:06 -0600)]
mpt3sas: Fix resume on WarpDrive flash cards

Orabug: 25535122

mpt3sas crashes on resume after suspend with WarpDrive flash cards.  The
reply_post_host_index array is not set back up after the resume, and we
deference a stale pointer in _base_interrupt().

[   47.309711] BUG: unable to handle kernel paging request at ffffc90001f8006c
[   47.318289] IP: [<ffffffffc00863ef>] _base_interrupt+0x49f/0xa30 [mpt3sas]
[   47.326749] PGD 41ccaa067 PUD 41ccab067 PMD 3466c067 PTE 0
[   47.333848] Oops: 0002 [#1] SMP
...
[   47.452708] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.7.0 #6
[   47.460506] Hardware name: Dell Inc. OptiPlex 990/06D7TR, BIOS A18 09/24/2013
[   47.469629] task: ffffffff81c0d500 ti: ffffffff81c00000 task.ti: ffffffff81c00000
[   47.479112] RIP: 0010:[<ffffffffc00863ef>]  [<ffffffffc00863ef>] _base_interrupt+0x49f/0xa30 [mpt3sas]
[   47.490466] RSP: 0018:ffff88041d203e30  EFLAGS: 00010002
[   47.497801] RAX: 0000000000000001 RBX: ffff880033f4c000 RCX: 0000000000000001
[   47.506973] RDX: ffffc90001f8006c RSI: 0000000000000082 RDI: 0000000000000082
[   47.516141] RBP: ffff88041d203eb0 R08: ffff8804118e2820 R09: 0000000000000001
[   47.525300] R10: 0000000000000001 R11: 00000000100c0000 R12: 0000000000000000
[   47.534457] R13: ffff880412c487e0 R14: ffff88041a8987d8 R15: 0000000000000001
[   47.543632] FS:  0000000000000000(0000) GS:ffff88041d200000(0000) knlGS:0000000000000000
[   47.553796] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   47.561632] CR2: ffffc90001f8006c CR3: 0000000001c06000 CR4: 00000000000406f0
[   47.570883] Stack:
[   47.575015]  000000001d211228 ffff88041d2100c0 ffff8800c47d8130 0000000000000100
[   47.584625]  ffff8804100c0000 100c000000000000 ffff88041a8992a0 ffff88041a8987f8
[   47.594230]  ffff88041d203e00 ffffffff81111e55 000000000000038c ffff880414ad4280
[   47.603862] Call Trace:
[   47.608474]  <IRQ>
[   47.610413]  [<ffffffff81111e55>] ? call_timer_fn+0x35/0x120
[   47.620539]  [<ffffffff81100a1f>] handle_irq_event_percpu+0x7f/0x1c0
[   47.629061]  [<ffffffff81100b8c>] handle_irq_event+0x2c/0x50
[   47.636859]  [<ffffffff81103fff>] handle_edge_irq+0x6f/0x130
[   47.644654]  [<ffffffff8102fbf3>] handle_irq+0x73/0x120
[   47.652011]  [<ffffffff810c6ada>] ? atomic_notifier_call_chain+0x1a/0x20
[   47.660854]  [<ffffffff817e374b>] do_IRQ+0x4b/0xd0
[   47.667777]  [<ffffffff817e160c>] common_interrupt+0x8c/0x8c
[   47.675635]  <EOI>

Move the reply_post_host_index array setup into
mpt3sas_base_map_resources(), which is also in the resume path.

Cc: stable@vger.kernel.org
Signed-off-by: Greg Edwards <gedwards@fireweed.org>
Acked-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit ce7c6c9e1d997a2670aead3a7b87f4df32c11118)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agompt3sas: Fix warnings exposed by W=1
Calvin Owens [Fri, 29 Jul 2016 04:38:22 +0000 (21:38 -0700)]
mpt3sas: Fix warnings exposed by W=1

Orabug: 25535122

Trivial non-functional changes for a couple annoying things:

  1) Functions local to files are not declared static, which is
  frustrating when reading the code because it's non-obvious at first
  glance what's actually called from other files.

  2) Set-but-unused variables abound, presumably to mask -Wunused-result
  errors in the past. None of these are flagged today though (with one
  exception noted below), so remove them.

Fixing (2) exposed the fact that we improperly ignore the return value
of scsi_device_reprobe() in _scsih_reprobe_lun(). Fixing the calling
code to deal with the potential error is non-trivial, so for now just
WARN().

Signed-off-by: Calvin Owens <calvinowens@fb.com>
Acked-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 8bbb1cf63f5e345685d42749606d0474cfde6def)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agompt3sas: Eliminate dead sleep_flag code
Calvin Owens [Fri, 29 Jul 2016 04:38:21 +0000 (21:38 -0700)]
mpt3sas: Eliminate dead sleep_flag code

Orabug: 25535122

With the exception of a single call to wait_for_doorbell_int(), all this
conditional sleeping code is dead. So delete it.

Signed-off-by: Calvin Owens <calvinowens@fb.com>
Acked-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 98c56ad32c33f0fd6742502bafe7003e4b8c80ed)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agompt3sas: Eliminate conditional locking in mpt3sas_scsih_issue_tm()
Calvin Owens [Fri, 29 Jul 2016 04:38:20 +0000 (21:38 -0700)]
mpt3sas: Eliminate conditional locking in mpt3sas_scsih_issue_tm()

Orabug: 25535122

This flag that conditionally acquires the mutex is confusing and prone
to bugginess: refactor it into two separate function calls, and make the
unlocked one complain if it's called outside the mutex.

Signed-off-by: Calvin Owens <calvinowens@fb.com>
Acked-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 96902835e7e2c7bf59db28ffd550852610169a2d)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agompt3sas: Ensure the connector_name string is NUL-terminated
Calvin Owens [Thu, 28 Jul 2016 04:45:51 +0000 (21:45 -0700)]
mpt3sas: Ensure the connector_name string is NUL-terminated

Orabug: 25535122

We blindly trust the hardware to give us NUL-terminated strings, which
is a bad idea because it doesn't always do that. For example:

  [  481.184784] mpt3sas_cm0:  enclosure level(0x0000), connector name(     \x3)

In this case, connector_name is four spaces. We got lucky here because
the 2nd byte beyond our character array happens to be a NUL. Fix this by
explicitly writing '\0' to the end of the string to ensure we don't run
off the edge of the world in printk().

Signed-off-by: Calvin Owens <calvinowens@fb.com>
Acked-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 310c8e40d5cd2512b6d46177563460726cc6166a)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agompt3sas: Fix panic when aer correct error occurred
Kefeng Wang [Tue, 12 Jul 2016 09:43:25 +0000 (17:43 +0800)]
mpt3sas: Fix panic when aer correct error occurred

Orabug: 25535122

The _scsih_pci_mmio_enabled called if scsih_pci_error_detected returns
PCI_ERS_RESULT_CAN_RECOVER, at this point, read/write to the device
still works, no need to reset slot.

Or the mpt3sas_base_map_resources in scsih_pci_slot_reset will fail,
and iounamp ioc->chip, then we will meet issue when read ioc->chip
in mpt3sas_base_get_iocstate from _base_fault_reset_work.

Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Chaitra P B <chaitra.basappa@broadcom.com>
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Acked-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 83c3d3400c87d6d943bf97fce4b30f4fe6870253)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agompt3sas: avoid mpt3sas_transport_port_add NULL parent_dev
Joe Lawrence [Wed, 25 May 2016 19:14:29 +0000 (15:14 -0400)]
mpt3sas: avoid mpt3sas_transport_port_add NULL parent_dev

Orabug: 25535122

If _scsih_sas_host_add's call to mpt3sas_config_get_sas_iounit_pg0
fails, ioc->sas_hba.parent_dev may be left uninitialized.  A later
device probe could invoke mpt3sas_transport_port_add which will call
sas_port_alloc_num [scsi_transport_sas] with a NULL parent_dev pointer.

Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com>
Acked-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit ad2bf16543622594432439cd16e90e22cc965964)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agompt3sas: set num_phys after allocating phy[] space
Joe Lawrence [Wed, 25 May 2016 19:14:28 +0000 (15:14 -0400)]
mpt3sas: set num_phys after allocating phy[] space

Orabug: 25535122

In _scsih_sas_host_add, the number of HBA phys are determined and then
later used to allocate an array of struct _sas_phy's.  If the routine
sets ioc->sas_hba.num_phys, but then fails to allocate the
ioc->sas_hba.phy array (by kcalloc error or other intermediate
error/exit path), ioc->sas_hba is left in a dangerous state: all readers
of ioc->sas_hba.phy[] do so by indexing it from 0..ioc->sas_hba.num_phys
without checking that the space was ever allocated.

Modify _scsih_sas_host_add to set ioc->sas_hba.num_phys only after
successfully allocating ioc->sas_hba.phy[].

Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com>
Acked-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 87aa95d4bb77613acaed9724efe07dde9e9bacd7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agompt3sas: add missing curly braces
Dan Carpenter [Thu, 12 May 2016 20:37:38 +0000 (23:37 +0300)]
mpt3sas: add missing curly braces

Orabug: 25639713

There are some missing curly braces on this if statement, so we end up
printing when we shouldn't.

Fixes: a470a51cd648 ('mpt3sas: Handle active cable exception event')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 7ebd67e0dece0ec53e5541fc600eda4e050fab72)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agobnx2i: fix spelling mistake "complection" -> "completion"
Colin Ian King [Sat, 4 Jun 2016 19:14:30 +0000 (20:14 +0100)]
bnx2i: fix spelling mistake "complection" -> "completion"

Trivial fix to spelling mistake in printk message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 25606037
(cherry picked from commit 09d2a4e7fca62369b6ad018fb03ac8df96c93823)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agobnx2i: silence uninitialized variable warnings
Dan Carpenter [Thu, 14 Apr 2016 09:40:06 +0000 (12:40 +0300)]
bnx2i: silence uninitialized variable warnings

Presumably it isn't possible to have empty lists here, but my static
checker doesn't know that and complains that "ep" can be used
uninitialized.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Nilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 25606037
(cherry picked from commit 9c8a76d5f00dbfd1da6ea242a9263a47133e4053)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agoqlcnic: Update version to 5.3.65
Manish Chopra [Wed, 3 Aug 2016 08:02:04 +0000 (04:02 -0400)]
qlcnic: Update version to 5.3.65

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605962
(cherry picked from commit b8b2372de9cc00d5ed667c7b8db29b6cfbf037f5)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agoqlcnic: fix napi budget alteration
Manish Chopra [Wed, 3 Aug 2016 08:02:03 +0000 (04:02 -0400)]
qlcnic: fix napi budget alteration

Driver modifies the supplied NAPI budget in qlcnic_83xx_msix_tx_poll()
function. Instead, it should use the budget as it is.

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605962
(cherry picked from commit fc4ca987f7cc0cb7ea8cb8bb673447939a84bb07)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agoqlcnic: fix data structure corruption in async mbx command handling
Manish Chopra [Wed, 3 Aug 2016 08:02:02 +0000 (04:02 -0400)]
qlcnic: fix data structure corruption in async mbx command handling

This patch fixes a data structure corruption bug in the SRIOV VF mailbox
handler code. While handling mailbox commands from the atomic context,
driver is accessing and updating qlcnic_async_work_list_struct entry fields
in the async work list. These fields could be concurrently accessed by the
work function resulting in data corruption.

This patch restructures async mbx command handling by using a separate
async command list instead of using a list of work_struct structures.
A single work_struct is used to schedule and handle the async commands
with proper locking mechanism.

Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605962
(cherry picked from commit 2b10d3ecf2dac737653828889ff85f614318f01a)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agonet: qlcnic: avoid superfluous assignement
xypron.glpk@gmx.de [Sun, 31 Jul 2016 10:07:37 +0000 (12:07 +0200)]
net: qlcnic: avoid superfluous assignement

Assigning NULL to parmeter dcb has no effect outside of the
inlined function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605962
(cherry picked from commit 43dcff349f091b6a2f5f491c35d89b173df41acf)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agoqlcnic: add wmb() call in transmit data path.
Sony Chacko [Wed, 29 Jun 2016 21:51:34 +0000 (17:51 -0400)]
qlcnic: add wmb() call in transmit data path.

Call wmb() to ensure writes are complete before
hardware fetches updated Tx descriptors.

Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605962
(cherry picked from commit 9216a97a12b069c62f0e927a9f54be4883648a0f)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agoqlcnic: use the correct ring in qlcnic_83xx_process_rcv_ring_diag()
Dan Carpenter [Mon, 27 Jun 2016 20:50:29 +0000 (23:50 +0300)]
qlcnic: use the correct ring in qlcnic_83xx_process_rcv_ring_diag()

There is a static checker warning here "warn: mask and shift to zero"
and the code sets "ring" to zero every time.  From looking at how
QLCNIC_FETCH_RING_ID() is used in qlcnic_83xx_process_rcv_ring() the
qlcnic_83xx_hndl() should be removed.

Fixes: 4be41e92f7c6 ('qlcnic: 83xx data path routines')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605962
(cherry picked from commit 5b4d10f5e0369ed79434593b7cd8e85eebbe473f)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agonet: qlcnic: don't set unused function argument
Arnd Bergmann [Thu, 16 Jun 2016 11:38:22 +0000 (13:38 +0200)]
net: qlcnic: don't set unused function argument

We get a warning for qlcnic_83xx_get_mac_address when building with
"make W=1":

drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c: In function 'qlcnic_83xx_get_mac_address':
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2156:8: error: parameter 'function' set but not used [-Werror=unused-but-set-parameter]

Clearly this is harmless, but there is also no point for setting
the variable, so we can simply remove the assignment.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605962
(cherry picked from commit 287debd6aac5b9f60113d45931a53da0cd4adc94)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agonet: qlge: remove superfluous statement
xypron.glpk@gmx.de [Sun, 31 Jul 2016 10:19:28 +0000 (12:19 +0200)]
net: qlge: remove superfluous statement

Variable length is not used after the deleted line.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605959
(cherry picked from commit 4fb482f73703d69ce23f9ddfa1c55acdb3cf49a6)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agonet/qlge: Avoids recursive EEH error
Gavin Shan [Mon, 23 May 2016 01:58:28 +0000 (11:58 +1000)]
net/qlge: Avoids recursive EEH error

One timer, whose handler keeps reading on MMIO register for EEH
core to detect error in time, is started when the PCI device driver
is loaded. MMIO register can't be accessed during PE reset in EEH
recovery. Otherwise, the unexpected recursive error is triggered.
The timer isn't closed that time if the interface isn't brought
up. So the unexpected recursive error is seen during EEH recovery
when the interface is down.

This avoids the unexpected recursive EEH error by closing the timer
in qlge_io_error_detected() before EEH PE reset unconditionally. The
timer is started unconditionally after EEH PE reset in qlge_io_resume().
Also, the timer should be closed unconditionally when the device is
removed from the system permanently in qlge_io_error_detected().

Reported-by: Shriya R. Kulkarni <shriyakul@in.ibm.com>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605959
(cherry picked from commit 3275c0c6c522ab04afa14f80efdac6213c3883d6)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agoqlge: Replace create_singlethread_workqueue with alloc_ordered_workqueue
Amitoj Kaur Chawla [Sat, 9 Apr 2016 11:57:45 +0000 (17:27 +0530)]
qlge: Replace create_singlethread_workqueue with alloc_ordered_workqueue

Replace deprecated create_singlethread_workqueue with
alloc_ordered_workqueue.

Work items include getting tx/rx frame sizes, resetting MPI processor,
setting asic recovery bit so ordering seems necessary as only one work
item should be in queue/executing at any given time, hence the use of
alloc_ordered_workqueue.

WQ_MEM_RECLAIM flag has been set since ethernet devices seem to sit in
memory reclaim path, so to guarantee forward progress regardless of
memory pressure.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605959
(cherry picked from commit ac18dd9e842294377dbaf1e8d169493567a81fa1)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agoqlge: Update version to 1.00.00.35
Manish Chopra [Fri, 25 Mar 2016 11:14:09 +0000 (07:14 -0400)]
qlge: Update version to 1.00.00.35

Just updating version as many fixes got
accumulated over 1.00.00.34

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605959
(cherry picked from commit d31fecd1af991e39cbe27a59f290cdcefb7ba6ae)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agoqlge: Fix receive packets drop.
Manish Chopra [Tue, 15 Mar 2016 11:13:45 +0000 (07:13 -0400)]
qlge: Fix receive packets drop.

When running small packets [length < 256 bytes] traffic, packets were
being dropped due to invalid data in those packets which were
delivered by the driver upto the stack. Using pci_dma_sync_single_for_cpu
ensures copying latest and updated data into skb from the receive buffer.

Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605959
(cherry picked from commit 2c9a266afefe137bff06bbe0fc48b4d3b3cb348c)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agoqlge: fix a timeout loop in ql_change_rx_buffers()
Dan Carpenter [Tue, 15 Dec 2015 10:52:36 +0000 (13:52 +0300)]
qlge: fix a timeout loop in ql_change_rx_buffers()

The problem here is that after the loop we test for "if (!i) " but
because "i--" is a post-op we exit with i set to -1.  I have fixed this
by changing it to a pre-op instead.  I had to change the starting value
from 3 to 4 so that we still iterate 3 times.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605959
(cherry picked from commit 351434c6ba92e1fe7799a0c33c1412584a0fb3de)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
8 years agoqlge: Move jiffies_to_usecs immediately before loop
Joe Perches [Wed, 20 May 2015 04:44:52 +0000 (21:44 -0700)]
qlge: Move jiffies_to_usecs immediately before loop

30 usecs (or really, 1 jiffy) can go by pretty fast.

Move the set of the timeout immediately before the loop.

Remove the unnecessary max(1ul, usecs_to_jiffies(30)) as
usecs_to_jiffies with a non-zero constant is guaranteed
to be non-zero.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 25605959
(cherry picked from commit 3f6e785fe113febd037af6351fc375eb428ff65b)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>