fbnic: Pull fbnic_fw_xmit_cap_msg use out of interrupt context
[ Upstream commit 1b34d1c1dc8384884febd83140c9afbc7c4b9eb8 ]
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: 20d2e88cc7 ("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
9d9010879d
commit
650e283b4c
@@ -295,24 +295,6 @@ static int fbnic_fw_xmit_simple_msg(struct fbnic_dev *fbd, u32 msg_type)
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
* fbnic_fw_xmit_cap_msg - Allocate and populate a FW capabilities message
|
||||
* @fbd: FBNIC device structure
|
||||
*
|
||||
* Return: NULL on failure to allocate, error pointer on error, or pointer
|
||||
* to new TLV test message.
|
||||
*
|
||||
* Sends a single TLV header indicating the host wants the firmware to
|
||||
* confirm the capabilities and version.
|
||||
**/
|
||||
static int fbnic_fw_xmit_cap_msg(struct fbnic_dev *fbd)
|
||||
{
|
||||
int err = fbnic_fw_xmit_simple_msg(fbd, FBNIC_TLV_MSG_ID_HOST_CAP_REQ);
|
||||
|
||||
/* Return 0 if we are not calling this on ASIC */
|
||||
return (err == -EOPNOTSUPP) ? 0 : err;
|
||||
}
|
||||
|
||||
static void fbnic_mbx_init_desc_ring(struct fbnic_dev *fbd, int mbx_idx)
|
||||
{
|
||||
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)
|
||||
/* Enable DMA reads from the device */
|
||||
wr32(fbd, FBNIC_PUL_OB_TLP_HDR_AR_CFG,
|
||||
FBNIC_PUL_OB_TLP_HDR_AR_CFG_BME);
|
||||
|
||||
/* Force version to 1 if we successfully requested an update
|
||||
* from the firmware. This should be overwritten once we get
|
||||
* the actual version from the firmware in the capabilities
|
||||
* request message.
|
||||
*/
|
||||
if (!fbnic_fw_xmit_cap_msg(fbd) &&
|
||||
!fbd->fw_cap.running.mgmt.version)
|
||||
fbd->fw_cap.running.mgmt.version = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -774,6 +747,7 @@ int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd)
|
||||
{
|
||||
unsigned long timeout = jiffies + 10 * HZ + 1;
|
||||
struct fbnic_fw_mbx *tx_mbx;
|
||||
int err;
|
||||
|
||||
tx_mbx = &fbd->mbx[FBNIC_IPC_MBX_TX_IDX];
|
||||
while (!tx_mbx->ready) {
|
||||
@@ -795,7 +769,22 @@ int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd)
|
||||
fbnic_mbx_poll(fbd);
|
||||
}
|
||||
|
||||
/* Request an update from the firmware. This should overwrite
|
||||
* mgmt.version once we get the actual version from the firmware
|
||||
* in the capabilities request message.
|
||||
*/
|
||||
err = fbnic_fw_xmit_simple_msg(fbd, FBNIC_TLV_MSG_ID_HOST_CAP_REQ);
|
||||
if (err)
|
||||
goto clean_mbx;
|
||||
|
||||
/* Use "1" to indicate we entered the state waiting for a response */
|
||||
fbd->fw_cap.running.mgmt.version = 1;
|
||||
|
||||
return 0;
|
||||
clean_mbx:
|
||||
/* Cleanup Rx buffers and disable mailbox */
|
||||
fbnic_mbx_clean(fbd);
|
||||
return err;
|
||||
}
|
||||
|
||||
void fbnic_mbx_flush_tx(struct fbnic_dev *fbd)
|
||||
|
||||
Reference in New Issue
Block a user