Skip to content

Commit 6dd8c0a

Browse files
ahduyckgregkh
authored andcommitted
fbnic: Cleanup handling of completions
[ Upstream commit cdbb2dc ] There was an issue in that if we were to shutdown we could be left with a completion in flight as the mailbox went away. To address that I have added an fbnic_mbx_evict_all_cmpl function that is meant to essentially create a "broken pipe" type response so that all callers will receive an error indicating that the connection has been broken as a result of us shutting down the mailbox. Fixes: 378e5cc ("eth: fbnic: hwmon: Add completion infrastructure for firmware requests") Signed-off-by: Alexander Duyck <alexanderduyck@fb.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/174654720578.499179.380252598204530873.stgit@ahduyck-xeon-server.home.arpa Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0adbc1a commit 6dd8c0a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/net/ethernet/meta/fbnic/fbnic_fw.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,20 @@ int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd)
933933
return attempts ? 0 : -ETIMEDOUT;
934934
}
935935

936+
static void __fbnic_fw_evict_cmpl(struct fbnic_fw_completion *cmpl_data)
937+
{
938+
cmpl_data->result = -EPIPE;
939+
complete(&cmpl_data->done);
940+
}
941+
942+
static void fbnic_mbx_evict_all_cmpl(struct fbnic_dev *fbd)
943+
{
944+
if (fbd->cmpl_data) {
945+
__fbnic_fw_evict_cmpl(fbd->cmpl_data);
946+
fbd->cmpl_data = NULL;
947+
}
948+
}
949+
936950
void fbnic_mbx_flush_tx(struct fbnic_dev *fbd)
937951
{
938952
unsigned long timeout = jiffies + 10 * HZ + 1;
@@ -950,6 +964,9 @@ void fbnic_mbx_flush_tx(struct fbnic_dev *fbd)
950964
/* Read tail to determine the last tail state for the ring */
951965
tail = tx_mbx->tail;
952966

967+
/* Flush any completions as we are no longer processing Rx */
968+
fbnic_mbx_evict_all_cmpl(fbd);
969+
953970
spin_unlock_irq(&fbd->fw_tx_lock);
954971

955972
/* Give firmware time to process packet,

0 commit comments

Comments
 (0)