Commit 1b34d1c1 authored by Alexander Duyck's avatar Alexander Duyck Committed by Paolo Abeni
Browse files

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: 20d2e88c ("eth: fbnic: Add initial messaging to notify FW of our presence")
Signed-off-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/174654721876.499179.9839651602256668493.stgit@ahduyck-xeon-server.home.arpa


Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent ab064f60
Loading
Loading
Loading
Loading
+16 −27
Original line number Diff line number Diff line
@@ -352,24 +352,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];
@@ -393,15 +375,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;
	}
}
@@ -907,6 +880,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) {
@@ -928,7 +902,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;
}

static void __fbnic_fw_evict_cmpl(struct fbnic_fw_completion *cmpl_data)