From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Jacob Keller <jacob.e.keller@intel.com>,
netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 04/17] fm10k: drop transmitted messages in Tx FIFO as part of reset_work
Date: Tue, 22 Sep 2015 16:54:23 -0700 [thread overview]
Message-ID: <1442966076-14359-5-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1442966076-14359-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Jacob Keller <jacob.e.keller@intel.com>
This patch fixes a corner case issue with the PF/VF mailbox code.
Currently, fm10k_mbx_reset_work clears various state about the mailbox.
However, it does not clear the Tx FIFO head/tail pointers. We can't
simply clear these pointers as we unintentionally drop untransmitted
messages without error.
Doing nothing results in a possible phantom re-transmission of messages,
since we leave tx.head and tx.tail intact, but clear the tx_pulled and
tail_len values. This means that the PF could continuously re-send a
message which triggers a reset in the VF. Upon reset, the VF will
re-receive the same message after a reconnect.
If we reset the tx.head and tx.tail pointers completely, we end up
dropping some messages that were pending before connect. This results in
missing LPORT_MSG_READY bits, and VFs will end up reporting no link.
However, we can resolve both issues by simply incrementing head to
account for the already transmitted messages, before we reset tx_pulled.
We do this via the same logic as fm10k_mbx_head_pull.
We account for the tail_len which includes all data not yet transmitted,
once we account for the acked data which means re-reading the HEAD
variable from the message header. Then, we drop messages until we've
dropped more than the new tx_pulled value. At this point, resetting
tail_len and tx_pulled, but not tx.head and tx.tail will result in
prevention of the phantom message. It also prevents us from dropping
untransmitted messages upon attempting to Tx into a connect or
disconnect header.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/fm10k/fm10k_mbx.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
index 1a4b526..0ff21d1 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
@@ -1046,9 +1046,26 @@ static s32 fm10k_mbx_create_reply(struct fm10k_hw *hw,
**/
static void fm10k_mbx_reset_work(struct fm10k_mbx_info *mbx)
{
+ u16 len, head, ack;
+
/* reset our outgoing max size back to Rx limits */
mbx->max_size = mbx->rx.size - 1;
+ /* update mbx->pulled to account for tail_len and ack */
+ head = FM10K_MSG_HDR_FIELD_GET(mbx->mbx_hdr, HEAD);
+ ack = fm10k_mbx_index_len(mbx, head, mbx->tail);
+ mbx->pulled += mbx->tail_len - ack;
+
+ /* now drop any messages which have started or finished transmitting */
+ while (fm10k_fifo_head_len(&mbx->tx) && mbx->pulled) {
+ len = fm10k_fifo_head_drop(&mbx->tx);
+ mbx->tx_dropped++;
+ if (mbx->pulled >= len)
+ mbx->pulled -= len;
+ else
+ mbx->pulled = 0;
+ }
+
/* just do a quick resysnc to start of message */
mbx->pushed = 0;
mbx->pulled = 0;
@@ -1725,7 +1742,7 @@ static void fm10k_sm_mbx_disconnect(struct fm10k_hw *hw,
mbx->state = FM10K_STATE_CLOSED;
mbx->remote = 0;
fm10k_mbx_reset_work(mbx);
- fm10k_mbx_update_max_size(mbx, 0);
+ fm10k_fifo_drop_all(&mbx->tx);
fm10k_write_reg(hw, mbx->mbmem_reg, 0);
}
--
2.4.3
next prev parent reply other threads:[~2015-09-22 23:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-22 23:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2015-09-22 Jeff Kirsher
2015-09-22 23:54 ` [net-next 01/17] fm10k: remove comment about rtnl_lock around mbx operations Jeff Kirsher
2015-09-22 23:54 ` [net-next 02/17] ixgbe: Add SFP+ detection for X550 hardware Jeff Kirsher
2015-09-22 23:54 ` [net-next 03/17] ixgbe: Add fdir support for SCTP on X550 Jeff Kirsher
2015-09-22 23:54 ` Jeff Kirsher [this message]
2015-09-22 23:54 ` [net-next 05/17] fm10k: create "correct" header for the remote end on connect Jeff Kirsher
2015-09-22 23:54 ` [net-next 06/17] fm10k: TRIVIAL remove unnecessary comma Jeff Kirsher
2015-09-22 23:54 ` [net-next 07/17] fm10k: add support for extra debug statistics Jeff Kirsher
2015-09-22 23:54 ` [net-next 08/17] e1000: remove dead e1000_init_eeprom_params calls Jeff Kirsher
2015-09-22 23:54 ` [net-next 09/17] igbvf: Enable TSO for stacked VLAN Jeff Kirsher
2015-09-22 23:54 ` [net-next 10/17] e1000e: " Jeff Kirsher
2015-09-22 23:54 ` [net-next 11/17] ixgbevf: Enables " Jeff Kirsher
2015-09-22 23:54 ` [net-next 12/17] ixgbe: Accept SFP not present errors on all devices Jeff Kirsher
2015-09-22 23:54 ` [net-next 13/17] ixgbe: Add X550EM support for SFP insertion interrupt Jeff Kirsher
2015-09-22 23:54 ` [net-next 14/17] ixgbe: Provide I2C combined on X550EM Jeff Kirsher
2015-09-22 23:54 ` [net-next 15/17] ixgbe: Provide unlocked I2C methods Jeff Kirsher
2015-09-22 23:54 ` [net-next 16/17] ixgbe: Set lan_id before first I2C eeprom access Jeff Kirsher
2015-09-22 23:54 ` [net-next 17/17] ixgbe: Enable bit-banging mode on X550 Jeff Kirsher
2015-09-23 21:52 ` [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2015-09-22 David Miller
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=1442966076-14359-5-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=jacob.e.keller@intel.com \
--cc=jogreene@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=sassmann@redhat.com \
/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).