Skip to content

Commit eb7dc47

Browse files
ahduyckSasha Levin
authored andcommitted
fbnic: Pull fbnic_fw_xmit_cap_msg use out of interrupt context
[ Upstream commit 1b34d1c ] This change pulls the call to fbnic_fw_xmit_cap_msg out of fbnic_mbx_init_desc_ring and instead places it in the polling function for getting the Tx ready. Doing that we can avoid the potential issue with an interrupt coming in later from the firmware that causes it to get fired in interrupt context. Fixes: 20d2e88 ("eth: fbnic: Add initial messaging to notify FW of our presence") Signed-off-by: Alexander Duyck <alexanderduyck@fb.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/174654721876.499179.9839651602256668493.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 11d9e22 commit eb7dc47

File tree

1 file changed

+16
-27
lines changed

1 file changed

+16
-27
lines changed

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

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -295,24 +295,6 @@ static int fbnic_fw_xmit_simple_msg(struct fbnic_dev *fbd, u32 msg_type)
295295
return err;
296296
}
297297

298-
/**
299-
* fbnic_fw_xmit_cap_msg - Allocate and populate a FW capabilities message
300-
* @fbd: FBNIC device structure
301-
*
302-
* Return: NULL on failure to allocate, error pointer on error, or pointer
303-
* to new TLV test message.
304-
*
305-
* Sends a single TLV header indicating the host wants the firmware to
306-
* confirm the capabilities and version.
307-
**/
308-
static int fbnic_fw_xmit_cap_msg(struct fbnic_dev *fbd)
309-
{
310-
int err = fbnic_fw_xmit_simple_msg(fbd, FBNIC_TLV_MSG_ID_HOST_CAP_REQ);
311-
312-
/* Return 0 if we are not calling this on ASIC */
313-
return (err == -EOPNOTSUPP) ? 0 : err;
314-
}
315-
316298
static void fbnic_mbx_init_desc_ring(struct fbnic_dev *fbd, int mbx_idx)
317299
{
318300
struct fbnic_fw_mbx *mbx = &fbd->mbx[mbx_idx];
@@ -336,15 +318,6 @@ static void fbnic_mbx_init_desc_ring(struct fbnic_dev *fbd, int mbx_idx)
336318
/* Enable DMA reads from the device */
337319
wr32(fbd, FBNIC_PUL_OB_TLP_HDR_AR_CFG,
338320
FBNIC_PUL_OB_TLP_HDR_AR_CFG_BME);
339-
340-
/* Force version to 1 if we successfully requested an update
341-
* from the firmware. This should be overwritten once we get
342-
* the actual version from the firmware in the capabilities
343-
* request message.
344-
*/
345-
if (!fbnic_fw_xmit_cap_msg(fbd) &&
346-
!fbd->fw_cap.running.mgmt.version)
347-
fbd->fw_cap.running.mgmt.version = 1;
348321
break;
349322
}
350323
}
@@ -774,6 +747,7 @@ int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd)
774747
{
775748
unsigned long timeout = jiffies + 10 * HZ + 1;
776749
struct fbnic_fw_mbx *tx_mbx;
750+
int err;
777751

778752
tx_mbx = &fbd->mbx[FBNIC_IPC_MBX_TX_IDX];
779753
while (!tx_mbx->ready) {
@@ -795,7 +769,22 @@ int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd)
795769
fbnic_mbx_poll(fbd);
796770
}
797771

772+
/* Request an update from the firmware. This should overwrite
773+
* mgmt.version once we get the actual version from the firmware
774+
* in the capabilities request message.
775+
*/
776+
err = fbnic_fw_xmit_simple_msg(fbd, FBNIC_TLV_MSG_ID_HOST_CAP_REQ);
777+
if (err)
778+
goto clean_mbx;
779+
780+
/* Use "1" to indicate we entered the state waiting for a response */
781+
fbd->fw_cap.running.mgmt.version = 1;
782+
798783
return 0;
784+
clean_mbx:
785+
/* Cleanup Rx buffers and disable mailbox */
786+
fbnic_mbx_clean(fbd);
787+
return err;
799788
}
800789

801790
void fbnic_mbx_flush_tx(struct fbnic_dev *fbd)

0 commit comments

Comments
 (0)