From: Wang Xiao W Date: Thu, 10 Sep 2015 04:38:15 +0000 (+0800) Subject: fm10k/base: avoid Tx drop increment during mailbox negotiation X-Git-Tag: spdx-start~8411 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=400f3c18fa9e11f0eabc043fd639924a2f4c8f20;p=dpdk.git fm10k/base: avoid Tx drop increment during mailbox negotiation After shutting down the mailbox by force, we then go about resetting max size to 0, and clearing all messages in the FIFO. However, we should just reset the head pointer so that the FIFO will become empty, rather than changing the max size to 0. This helps prevent increment in tx_dropped counter during mailbox negotiation, which is confusing to viewers of Linux ethtool statistics output. Signed-off-by: Wang Xiao W --- diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c index d65af212d0..a0b7930d5a 100644 --- a/drivers/net/fm10k/base/fm10k_mbx.c +++ b/drivers/net/fm10k/base/fm10k_mbx.c @@ -138,6 +138,18 @@ STATIC u16 fm10k_fifo_head_drop(struct fm10k_mbx_fifo *fifo) return len; } +/** + * fm10k_fifo_drop_all - Drop all messages in FIFO + * @fifo: pointer to FIFO + * + * This function resets the head pointer to drop all messages in the FIFO, + * and ensure the FIFO is empty. + **/ +STATIC void fm10k_fifo_drop_all(struct fm10k_mbx_fifo *fifo) +{ + fifo->head = fifo->tail; +} + /** * fm10k_mbx_index_len - Convert a head/tail index into a length value * @mbx: pointer to mailbox @@ -1402,9 +1414,11 @@ STATIC void fm10k_mbx_disconnect(struct fm10k_hw *hw, timeout -= FM10K_MBX_POLL_DELAY; } while ((timeout > 0) && (mbx->state != FM10K_STATE_CLOSED)); - /* in case we didn't close just force the mailbox into shutdown */ + /* in case we didn't close, just force the mailbox into shutdown and + * drop all left over messages in the FIFO. + */ fm10k_mbx_connect_reset(mbx); - fm10k_mbx_update_max_size(mbx, 0); + fm10k_fifo_drop_all(&mbx->tx); FM10K_WRITE_MBX(hw, mbx->mbmem_reg, 0); }