Skip to content

Commit b6a7ef1

Browse files
ahduyckgregkh
authored andcommitted
fbnic: Improve responsiveness of fbnic_mbx_poll_tx_ready
[ Upstream commit ab064f6 ] There were a couple different issues found in fbnic_mbx_poll_tx_ready. Among them were the fact that we were sleeping much longer than we actually needed to as the actual FW could respond in under 20ms. The other issue was that we would just keep polling the mailbox even if the device itself had gone away. To address the responsiveness issues we can decrease the sleeps to 20ms and use a jiffies based timeout value rather than just counting the number of times we slept and then polled. To address the hardware going away we can move the check for the firmware BAR being present from where it was and place it inside the loop after the mailbox descriptor ring is initialized and before we sleep so that we just abort and return an error if the device went away during initialization. With these two changes we see a significant improvement in boot times for the driver. Fixes: da3cde0 ("eth: fbnic: Add FW communication mechanism") Signed-off-by: Alexander Duyck <alexanderduyck@fb.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/174654721224.499179.2698616208976624755.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 8b8eb1b commit b6a7ef1

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -910,27 +910,30 @@ void fbnic_mbx_poll(struct fbnic_dev *fbd)
910910

911911
int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd)
912912
{
913+
unsigned long timeout = jiffies + 10 * HZ + 1;
913914
struct fbnic_fw_mbx *tx_mbx;
914-
int attempts = 50;
915-
916-
/* Immediate fail if BAR4 isn't there */
917-
if (!fbnic_fw_present(fbd))
918-
return -ENODEV;
919915

920916
tx_mbx = &fbd->mbx[FBNIC_IPC_MBX_TX_IDX];
921-
while (!tx_mbx->ready && --attempts) {
917+
while (!tx_mbx->ready) {
918+
if (!time_is_after_jiffies(timeout))
919+
return -ETIMEDOUT;
920+
922921
/* Force the firmware to trigger an interrupt response to
923922
* avoid the mailbox getting stuck closed if the interrupt
924923
* is reset.
925924
*/
926925
fbnic_mbx_reset_desc_ring(fbd, FBNIC_IPC_MBX_TX_IDX);
927926

928-
msleep(200);
927+
/* Immediate fail if BAR4 went away */
928+
if (!fbnic_fw_present(fbd))
929+
return -ENODEV;
930+
931+
msleep(20);
929932

930933
fbnic_mbx_poll(fbd);
931934
}
932935

933-
return attempts ? 0 : -ETIMEDOUT;
936+
return 0;
934937
}
935938

936939
static void __fbnic_fw_evict_cmpl(struct fbnic_fw_completion *cmpl_data)

0 commit comments

Comments
 (0)