Skip to content

Commit 1b34d1c

Browse files
ahduyckPaolo Abeni
authored andcommitted
fbnic: Pull fbnic_fw_xmit_cap_msg use out of interrupt context
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>
1 parent ab064f6 commit 1b34d1c

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
@@ -352,24 +352,6 @@ static int fbnic_fw_xmit_simple_msg(struct fbnic_dev *fbd, u32 msg_type)
352352
return err;
353353
}
354354

355-
/**
356-
* fbnic_fw_xmit_cap_msg - Allocate and populate a FW capabilities message
357-
* @fbd: FBNIC device structure
358-
*
359-
* Return: NULL on failure to allocate, error pointer on error, or pointer
360-
* to new TLV test message.
361-
*
362-
* Sends a single TLV header indicating the host wants the firmware to
363-
* confirm the capabilities and version.
364-
**/
365-
static int fbnic_fw_xmit_cap_msg(struct fbnic_dev *fbd)
366-
{
367-
int err = fbnic_fw_xmit_simple_msg(fbd, FBNIC_TLV_MSG_ID_HOST_CAP_REQ);
368-
369-
/* Return 0 if we are not calling this on ASIC */
370-
return (err == -EOPNOTSUPP) ? 0 : err;
371-
}
372-
373355
static void fbnic_mbx_init_desc_ring(struct fbnic_dev *fbd, int mbx_idx)
374356
{
375357
struct fbnic_fw_mbx *mbx = &fbd->mbx[mbx_idx];
@@ -393,15 +375,6 @@ static void fbnic_mbx_init_desc_ring(struct fbnic_dev *fbd, int mbx_idx)
393375
/* Enable DMA reads from the device */
394376
wr32(fbd, FBNIC_PUL_OB_TLP_HDR_AR_CFG,
395377
FBNIC_PUL_OB_TLP_HDR_AR_CFG_BME);
396-
397-
/* Force version to 1 if we successfully requested an update
398-
* from the firmware. This should be overwritten once we get
399-
* the actual version from the firmware in the capabilities
400-
* request message.
401-
*/
402-
if (!fbnic_fw_xmit_cap_msg(fbd) &&
403-
!fbd->fw_cap.running.mgmt.version)
404-
fbd->fw_cap.running.mgmt.version = 1;
405378
break;
406379
}
407380
}
@@ -907,6 +880,7 @@ int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd)
907880
{
908881
unsigned long timeout = jiffies + 10 * HZ + 1;
909882
struct fbnic_fw_mbx *tx_mbx;
883+
int err;
910884

911885
tx_mbx = &fbd->mbx[FBNIC_IPC_MBX_TX_IDX];
912886
while (!tx_mbx->ready) {
@@ -928,7 +902,22 @@ int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd)
928902
fbnic_mbx_poll(fbd);
929903
}
930904

905+
/* Request an update from the firmware. This should overwrite
906+
* mgmt.version once we get the actual version from the firmware
907+
* in the capabilities request message.
908+
*/
909+
err = fbnic_fw_xmit_simple_msg(fbd, FBNIC_TLV_MSG_ID_HOST_CAP_REQ);
910+
if (err)
911+
goto clean_mbx;
912+
913+
/* Use "1" to indicate we entered the state waiting for a response */
914+
fbd->fw_cap.running.mgmt.version = 1;
915+
931916
return 0;
917+
clean_mbx:
918+
/* Cleanup Rx buffers and disable mailbox */
919+
fbnic_mbx_clean(fbd);
920+
return err;
932921
}
933922

934923
static void __fbnic_fw_evict_cmpl(struct fbnic_fw_completion *cmpl_data)

0 commit comments

Comments
 (0)