From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Ben Hutchings <bhutchings@solarflare.com>
Subject: [ 13/49] sfc: Fix two causes of flush failure
Date: Tue, 26 Mar 2013 16:01:10 -0700 [thread overview]
Message-ID: <20130326225840.947395123@linuxfoundation.org> (raw)
In-Reply-To: <20130326225839.554028294@linuxfoundation.org>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <bhutchings@solarflare.com>
[ Upstream commits a606f4325dca6950996abbae452d33f2af095f39,
d5e8cc6c946e0857826dcfbb3585068858445bfe,
525d9e824018cd7cc8d8d44832ddcd363abfe6e1 ]
The TX DMA engine issues upstream read requests when there is room in
the TX FIFO for the completion. However, the fetches for the rest of
the packet might be delayed by any back pressure. Since a flush must
wait for an EOP, the entire flush may be delayed by back pressure.
Mitigate this by disabling flow control before the flushes are
started. Since PF and VF flushes run in parallel introduce
fc_disable, a reference count of the number of flushes outstanding.
The same principle could be applied to Falcon, but that
would bring with it its own testing.
We sometimes hit a "failed to flush" timeout on some TX queues, but the
flushes have completed and the flush completion events seem to go missing.
In this case, we can check the TX_DESC_PTR_TBL register and drain the
queues if the flushes had finished.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
[bwh: Backported to 3.0:
- Call efx_nic_type::finish_flush() on both success and failure paths
- Check the TX_DESC_PTR_TBL registers in the polling loop
- Declare efx_mcdi_set_mac() extern]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/sfc/falcon.c | 2 ++
drivers/net/sfc/mcdi.h | 1 +
drivers/net/sfc/mcdi_mac.c | 4 +++-
drivers/net/sfc/net_driver.h | 6 ++++++
drivers/net/sfc/nic.c | 21 ++++++++++++++++++---
drivers/net/sfc/nic.h | 2 ++
drivers/net/sfc/siena.c | 15 ++++++++++++++-
7 files changed, 46 insertions(+), 5 deletions(-)
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -1714,6 +1714,7 @@ const struct efx_nic_type falcon_a1_nic_
.remove_port = falcon_remove_port,
.handle_global_event = falcon_handle_global_event,
.prepare_flush = falcon_prepare_flush,
+ .finish_flush = efx_port_dummy_op_void,
.update_stats = falcon_update_nic_stats,
.start_stats = falcon_start_nic_stats,
.stop_stats = falcon_stop_nic_stats,
@@ -1755,6 +1756,7 @@ const struct efx_nic_type falcon_b0_nic_
.remove_port = falcon_remove_port,
.handle_global_event = falcon_handle_global_event,
.prepare_flush = falcon_prepare_flush,
+ .finish_flush = efx_port_dummy_op_void,
.update_stats = falcon_update_nic_stats,
.start_stats = falcon_start_nic_stats,
.stop_stats = falcon_stop_nic_stats,
--- a/drivers/net/sfc/mcdi.h
+++ b/drivers/net/sfc/mcdi.h
@@ -126,5 +126,6 @@ extern int efx_mcdi_wol_filter_set_magic
extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out);
extern int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id);
extern int efx_mcdi_wol_filter_reset(struct efx_nic *efx);
+extern int efx_mcdi_set_mac(struct efx_nic *efx);
#endif /* EFX_MCDI_H */
--- a/drivers/net/sfc/mcdi_mac.c
+++ b/drivers/net/sfc/mcdi_mac.c
@@ -13,7 +13,7 @@
#include "mcdi.h"
#include "mcdi_pcol.h"
-static int efx_mcdi_set_mac(struct efx_nic *efx)
+int efx_mcdi_set_mac(struct efx_nic *efx)
{
u32 reject, fcntl;
u8 cmdbytes[MC_CMD_SET_MAC_IN_LEN];
@@ -45,6 +45,8 @@ static int efx_mcdi_set_mac(struct efx_n
}
if (efx->wanted_fc & EFX_FC_AUTO)
fcntl = MC_CMD_FCNTL_AUTO;
+ if (efx->fc_disable)
+ fcntl = MC_CMD_FCNTL_OFF;
MCDI_SET_DWORD(cmdbytes, SET_MAC_IN_FCNTL, fcntl);
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -690,6 +690,9 @@ struct efx_filter_state;
* @promiscuous: Promiscuous flag. Protected by netif_tx_lock.
* @multicast_hash: Multicast hash table
* @wanted_fc: Wanted flow control flags
+ * @fc_disable: When non-zero flow control is disabled. Typically used to
+ * ensure that network back pressure doesn't delay dma queue flushes.
+ * Serialised by the rtnl lock.
* @mac_work: Work item for changing MAC promiscuity and multicast hash
* @loopback_mode: Loopback status
* @loopback_modes: Supported loopback mode bitmask
@@ -783,6 +786,7 @@ struct efx_nic {
bool promiscuous;
union efx_multicast_hash multicast_hash;
u8 wanted_fc;
+ unsigned fc_disable;
atomic_t rx_reset;
enum efx_loopback_mode loopback_mode;
@@ -834,6 +838,7 @@ static inline unsigned int efx_port_num(
* @remove_port: Free resources allocated by probe_port()
* @handle_global_event: Handle a "global" event (may be %NULL)
* @prepare_flush: Prepare the hardware for flushing the DMA queues
+ * @finish_flush: Clean up after flushing the DMA queues
* @update_stats: Update statistics not provided by event handling
* @start_stats: Start the regular fetching of statistics
* @stop_stats: Stop the regular fetching of statistics
@@ -879,6 +884,7 @@ struct efx_nic_type {
void (*remove_port)(struct efx_nic *efx);
bool (*handle_global_event)(struct efx_channel *channel, efx_qword_t *);
void (*prepare_flush)(struct efx_nic *efx);
+ void (*finish_flush)(struct efx_nic *efx);
void (*update_stats)(struct efx_nic *efx);
void (*start_stats)(struct efx_nic *efx);
void (*stop_stats)(struct efx_nic *efx);
--- a/drivers/net/sfc/nic.c
+++ b/drivers/net/sfc/nic.c
@@ -1260,13 +1260,27 @@ int efx_nic_flush_queues(struct efx_nic
}
efx_for_each_possible_channel_tx_queue(tx_queue, channel) {
if (tx_queue->initialised &&
- tx_queue->flushed != FLUSH_DONE)
- ++tx_pending;
+ tx_queue->flushed != FLUSH_DONE) {
+ efx_oword_t txd_ptr_tbl;
+
+ efx_reado_table(efx, &txd_ptr_tbl,
+ FR_BZ_TX_DESC_PTR_TBL,
+ tx_queue->queue);
+ if (EFX_OWORD_FIELD(txd_ptr_tbl,
+ FRF_AZ_TX_DESCQ_FLUSH) ||
+ EFX_OWORD_FIELD(txd_ptr_tbl,
+ FRF_AZ_TX_DESCQ_EN))
+ ++tx_pending;
+ else
+ tx_queue->flushed = FLUSH_DONE;
+ }
}
}
- if (rx_pending == 0 && tx_pending == 0)
+ if (rx_pending == 0 && tx_pending == 0) {
+ efx->type->finish_flush(efx);
return 0;
+ }
msleep(EFX_FLUSH_INTERVAL);
efx_poll_flush_events(efx);
@@ -1292,6 +1306,7 @@ int efx_nic_flush_queues(struct efx_nic
}
}
+ efx->type->finish_flush(efx);
return -ETIMEDOUT;
}
--- a/drivers/net/sfc/nic.h
+++ b/drivers/net/sfc/nic.h
@@ -211,6 +211,8 @@ extern void falcon_irq_ack_a1(struct efx
/* Global Resources */
extern int efx_nic_flush_queues(struct efx_nic *efx);
+extern void siena_prepare_flush(struct efx_nic *efx);
+extern void siena_finish_flush(struct efx_nic *efx);
extern void falcon_start_nic_stats(struct efx_nic *efx);
extern void falcon_stop_nic_stats(struct efx_nic *efx);
extern void falcon_setup_xaui(struct efx_nic *efx);
--- a/drivers/net/sfc/siena.c
+++ b/drivers/net/sfc/siena.c
@@ -135,6 +135,18 @@ static void siena_remove_port(struct efx
efx_nic_free_buffer(efx, &efx->stats_buffer);
}
+void siena_prepare_flush(struct efx_nic *efx)
+{
+ if (efx->fc_disable++ == 0)
+ efx_mcdi_set_mac(efx);
+}
+
+void siena_finish_flush(struct efx_nic *efx)
+{
+ if (--efx->fc_disable == 0)
+ efx_mcdi_set_mac(efx);
+}
+
static const struct efx_nic_register_test siena_register_tests[] = {
{ FR_AZ_ADR_REGION,
EFX_OWORD32(0x0003FFFF, 0x0003FFFF, 0x0003FFFF, 0x0003FFFF) },
@@ -590,7 +602,8 @@ const struct efx_nic_type siena_a0_nic_t
.reset = siena_reset_hw,
.probe_port = siena_probe_port,
.remove_port = siena_remove_port,
- .prepare_flush = efx_port_dummy_op_void,
+ .prepare_flush = siena_prepare_flush,
+ .finish_flush = siena_finish_flush,
.update_stats = siena_update_nic_stats,
.start_stats = siena_start_nic_stats,
.stop_stats = siena_stop_nic_stats,
next prev parent reply other threads:[~2013-03-26 23:01 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-26 23:00 [ 00/49] 3.0.71-stable review Greg Kroah-Hartman
2013-03-26 23:00 ` [ 01/49] Revert "USB: EHCI: dont check DMA values in QH overlays" Greg Kroah-Hartman
2013-03-26 23:00 ` [ 02/49] sunsu: Fix panic in case of nonexistent port at "console=ttySY" cmdline option Greg Kroah-Hartman
2013-03-26 23:01 ` [ 03/49] net/ipv4: Ensure that location of timestamp option is stored Greg Kroah-Hartman
2013-03-26 23:01 ` [ 04/49] netconsole: dont call __netpoll_cleanup() while atomic Greg Kroah-Hartman
2013-03-26 23:01 ` [ 05/49] sctp: dont break the loop while meeting the active_path so as to find the matched transport Greg Kroah-Hartman
2013-03-26 23:01 ` [ 06/49] ipv4: fix definition of FIB_TABLE_HASHSZ Greg Kroah-Hartman
2013-03-26 23:01 ` [ 07/49] rtnetlink: Mask the rta_type when range checking Greg Kroah-Hartman
2013-03-26 23:01 ` [ 08/49] inet: limit length of fragment queue hash table bucket lists Greg Kroah-Hartman
2013-03-26 23:01 ` [ 09/49] sfc: Fix loop condition for efx_filter_search() when !for_insert Greg Kroah-Hartman
2013-03-26 23:01 ` [ 10/49] sfc: Fix Siena mac statistics on big endian platforms Greg Kroah-Hartman
2013-03-26 23:01 ` [ 11/49] sfc: Do not attempt to flush queues if DMA is disabled Greg Kroah-Hartman
2013-03-26 23:01 ` [ 12/49] sfc: Convert firmware subtypes to native byte order in efx_mcdi_get_board_cfg() Greg Kroah-Hartman
2013-03-26 23:01 ` Greg Kroah-Hartman [this message]
2013-03-26 23:01 ` [ 14/49] sfc: lock TX queues when calling netif_device_detach() Greg Kroah-Hartman
2013-03-26 23:01 ` [ 15/49] sfc: Fix timekeeping in efx_mcdi_poll() Greg Kroah-Hartman
2013-03-26 23:01 ` [ 16/49] sfc: Properly sync RX DMA buffer when it is not the last in the page Greg Kroah-Hartman
2013-03-26 23:01 ` [ 17/49] sfc: Fix efx_rx_buf_offset() in the presence of swiotlb Greg Kroah-Hartman
2013-03-26 23:01 ` [ 18/49] sfc: Detach net device when stopping queues for reconfiguration Greg Kroah-Hartman
2013-03-26 23:01 ` [ 19/49] sfc: Disable soft interrupt handling during efx_device_detach_sync() Greg Kroah-Hartman
2013-03-26 23:01 ` [ 20/49] sfc: Only use TX push if a single descriptor is to be written Greg Kroah-Hartman
2013-03-26 23:01 ` [ 21/49] ALSA: hda - Fix typo in checking IEC958 emphasis bit Greg Kroah-Hartman
2013-03-26 23:01 ` [ 22/49] ALSA: snd-usb: mixer: propagate errors up the call chain Greg Kroah-Hartman
2013-03-26 23:01 ` [ 23/49] ALSA: snd-usb: mixer: ignore -EINVAL in snd_usb_mixer_controls() Greg Kroah-Hartman
2013-03-26 23:01 ` [ 24/49] drm/i915: restrict kernel address leak in debugfs Greg Kroah-Hartman
2013-03-26 23:01 ` [ 25/49] tracing: Fix race in snapshot swapping Greg Kroah-Hartman
2013-03-26 23:01 ` [ 26/49] tracing: Fix free of probe entry by calling call_rcu_sched() Greg Kroah-Hartman
2013-03-26 23:01 ` [ 27/49] mwifiex: fix potential out-of-boundary access to ibss rate table Greg Kroah-Hartman
2013-03-26 23:01 ` [ 28/49] drm/i915: bounds check execbuffer relocation count Greg Kroah-Hartman
2013-03-26 23:01 ` [ 29/49] KMS: fix EDID detailed timing vsync parsing Greg Kroah-Hartman
2013-03-26 23:01 ` [ 30/49] mm/hugetlb: fix total hugetlbfs pages count when using memory overcommit accouting Greg Kroah-Hartman
2013-03-26 23:01 ` [ 31/49] cifs: ignore everything in SPNEGO blob after mechTypes Greg Kroah-Hartman
2013-03-26 23:01 ` [ 32/49] ext4: fix the wrong number of the allocated blocks in ext4_split_extent() Greg Kroah-Hartman
2013-03-26 23:01 ` [ 33/49] usb-storage: add unusual_devs entry for Samsung YP-Z3 mp3 player Greg Kroah-Hartman
2013-03-26 23:01 ` [ 34/49] IPoIB: Fix send lockup due to missed TX completion Greg Kroah-Hartman
2013-03-26 23:01 ` [ 35/49] clockevents: Dont allow dummy broadcast timers Greg Kroah-Hartman
2013-03-26 23:01 ` [ 36/49] x86-64: Fix the failure case in copy_user_handle_tail() Greg Kroah-Hartman
2013-03-26 23:01 ` [ 37/49] USB: xhci - fix bit definitions for IMAN register Greg Kroah-Hartman
2013-03-26 23:01 ` [ 38/49] USB: serial: fix interface refcounting Greg Kroah-Hartman
2013-03-26 23:01 ` [ 39/49] udf: Fix bitmap overflow on large filesystems with small block size Greg Kroah-Hartman
2013-03-26 23:01 ` [ 40/49] USB: garmin_gps: fix memory leak on disconnect Greg Kroah-Hartman
2013-03-26 23:01 ` [ 41/49] USB: io_ti: fix get_icount for two port adapters Greg Kroah-Hartman
2013-03-26 23:01 ` [ 42/49] key: Fix resource leak Greg Kroah-Hartman
2013-03-26 23:01 ` [ 43/49] Fix: compat_rw_copy_check_uvector() misuse in aio, readv, writev, and security keys Greg Kroah-Hartman
2013-03-26 23:01 ` [ 44/49] isofs: avoid info leak on export Greg Kroah-Hartman
2013-03-26 23:01 ` [ 45/49] udf: " Greg Kroah-Hartman
2013-03-26 23:01 ` [ 46/49] i915: initialize CADL in opregion Greg Kroah-Hartman
2013-03-26 23:01 ` [ 47/49] exec: use -ELOOP for max recursion depth Greg Kroah-Hartman
2013-03-26 23:01 ` [ 48/49] rt2x00: error in configurations with mesh support disabled Greg Kroah-Hartman
2013-03-26 23:01 ` [ 49/49] asus-laptop: Do not call HWRS on init Greg Kroah-Hartman
2013-03-27 18:32 ` [ 00/49] 3.0.71-stable review Shuah Khan
2013-03-28 14:19 ` Satoru Takeuchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130326225840.947395123@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=bhutchings@solarflare.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).