Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e9402eb authored by Michael Chan's avatar Michael Chan Committed by David S. Miller
Browse files

cnic, bnx2i: Fix bug on some bnx2x devices that don't support iSCSI



On some bnx2x devices, iSCSI is determined to be unsupported only after
firmware is downloaded.  We need to check max_iscsi_conn again after
NETDEV_UP and block iSCSI init operations.  Without this fix, iscsiadm
can hang as the firmware will not respond to the iSCSI init message.

Signed-off-by: default avatarEddie Wai <eddie.wai@broadcom.com>
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4b42df5d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -5276,6 +5276,13 @@ static int cnic_register_netdev(struct cnic_dev *dev)
	if (err)
		netdev_err(dev->netdev, "register_cnic failed\n");

	/* Read iSCSI config again.  On some bnx2x device, iSCSI config
	 * can change after firmware is downloaded.
	 */
	dev->max_iscsi_conn = ethdev->max_iscsi_conn;
	if (ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI)
		dev->max_iscsi_conn = 0;

	return err;
}

+5 −7
Original line number Diff line number Diff line
@@ -172,16 +172,14 @@ void bnx2i_start(void *handle)
	struct bnx2i_hba *hba = handle;
	int i = HZ;

	/*
	 * We should never register devices that don't support iSCSI
	 * (see bnx2i_init_one), so something is wrong if we try to
	 * start a iSCSI adapter on hardware with 0 supported iSCSI
	 * connections
	/* On some bnx2x devices, it is possible that iSCSI is no
	 * longer supported after firmware is downloaded.  In that
	 * case, the iscsi_init_msg will return failure.
	 */
	BUG_ON(!hba->cnic->max_iscsi_conn);

	bnx2i_send_fw_iscsi_init_msg(hba);
	while (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state) && i--)
	while (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state) &&
	       !test_bit(ADAPTER_STATE_INIT_FAILED, &hba->adapter_state) && i--)
		msleep(BNX2I_INIT_POLL_TIME);
}