mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
qlcnic: Fix mailbox response handling.
o Fix mailbox response poll time to maximum 5 seconds which includes mailbox response time as well as time required for processing AEN if any. o Driver need to read firmware control mailbox register instead of host control mailbox register. Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com> Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
13a82b44fd
commit
9106e5db83
4 changed files with 10 additions and 15 deletions
|
@ -696,15 +696,14 @@ u32 qlcnic_83xx_mac_rcode(struct qlcnic_adapter *adapter)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 qlcnic_83xx_mbx_poll(struct qlcnic_adapter *adapter)
|
u32 qlcnic_83xx_mbx_poll(struct qlcnic_adapter *adapter, u32 *wait_time)
|
||||||
{
|
{
|
||||||
u32 data;
|
u32 data;
|
||||||
unsigned long wait_time = 0;
|
|
||||||
struct qlcnic_hardware_context *ahw = adapter->ahw;
|
struct qlcnic_hardware_context *ahw = adapter->ahw;
|
||||||
/* wait for mailbox completion */
|
/* wait for mailbox completion */
|
||||||
do {
|
do {
|
||||||
data = QLCRDX(ahw, QLCNIC_FW_MBX_CTRL);
|
data = QLCRDX(ahw, QLCNIC_FW_MBX_CTRL);
|
||||||
if (++wait_time > QLCNIC_MBX_TIMEOUT) {
|
if (++(*wait_time) > QLCNIC_MBX_TIMEOUT) {
|
||||||
data = QLCNIC_RCODE_TIMEOUT;
|
data = QLCNIC_RCODE_TIMEOUT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -720,8 +719,8 @@ int qlcnic_83xx_mbx_op(struct qlcnic_adapter *adapter,
|
||||||
u16 opcode;
|
u16 opcode;
|
||||||
u8 mbx_err_code;
|
u8 mbx_err_code;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
u32 rsp, mbx_val, fw_data, rsp_num, mbx_cmd;
|
|
||||||
struct qlcnic_hardware_context *ahw = adapter->ahw;
|
struct qlcnic_hardware_context *ahw = adapter->ahw;
|
||||||
|
u32 rsp, mbx_val, fw_data, rsp_num, mbx_cmd, wait_time = 0;
|
||||||
|
|
||||||
opcode = LSW(cmd->req.arg[0]);
|
opcode = LSW(cmd->req.arg[0]);
|
||||||
if (!test_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status)) {
|
if (!test_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status)) {
|
||||||
|
@ -754,15 +753,13 @@ int qlcnic_83xx_mbx_op(struct qlcnic_adapter *adapter,
|
||||||
/* Signal FW about the impending command */
|
/* Signal FW about the impending command */
|
||||||
QLCWRX(ahw, QLCNIC_HOST_MBX_CTRL, QLCNIC_SET_OWNER);
|
QLCWRX(ahw, QLCNIC_HOST_MBX_CTRL, QLCNIC_SET_OWNER);
|
||||||
poll:
|
poll:
|
||||||
rsp = qlcnic_83xx_mbx_poll(adapter);
|
rsp = qlcnic_83xx_mbx_poll(adapter, &wait_time);
|
||||||
if (rsp != QLCNIC_RCODE_TIMEOUT) {
|
if (rsp != QLCNIC_RCODE_TIMEOUT) {
|
||||||
/* Get the FW response data */
|
/* Get the FW response data */
|
||||||
fw_data = readl(QLCNIC_MBX_FW(ahw, 0));
|
fw_data = readl(QLCNIC_MBX_FW(ahw, 0));
|
||||||
if (fw_data & QLCNIC_MBX_ASYNC_EVENT) {
|
if (fw_data & QLCNIC_MBX_ASYNC_EVENT) {
|
||||||
__qlcnic_83xx_process_aen(adapter);
|
__qlcnic_83xx_process_aen(adapter);
|
||||||
mbx_val = QLCRDX(ahw, QLCNIC_HOST_MBX_CTRL);
|
goto poll;
|
||||||
if (mbx_val)
|
|
||||||
goto poll;
|
|
||||||
}
|
}
|
||||||
mbx_err_code = QLCNIC_MBX_STATUS(fw_data);
|
mbx_err_code = QLCNIC_MBX_STATUS(fw_data);
|
||||||
rsp_num = QLCNIC_MBX_NUM_REGS(fw_data);
|
rsp_num = QLCNIC_MBX_NUM_REGS(fw_data);
|
||||||
|
|
|
@ -620,7 +620,7 @@ int qlcnic_83xx_flash_test(struct qlcnic_adapter *);
|
||||||
int qlcnic_83xx_enable_flash_write(struct qlcnic_adapter *);
|
int qlcnic_83xx_enable_flash_write(struct qlcnic_adapter *);
|
||||||
int qlcnic_83xx_disable_flash_write(struct qlcnic_adapter *);
|
int qlcnic_83xx_disable_flash_write(struct qlcnic_adapter *);
|
||||||
u32 qlcnic_83xx_mac_rcode(struct qlcnic_adapter *);
|
u32 qlcnic_83xx_mac_rcode(struct qlcnic_adapter *);
|
||||||
u32 qlcnic_83xx_mbx_poll(struct qlcnic_adapter *);
|
u32 qlcnic_83xx_mbx_poll(struct qlcnic_adapter *, u32 *);
|
||||||
void qlcnic_83xx_enable_mbx_poll(struct qlcnic_adapter *);
|
void qlcnic_83xx_enable_mbx_poll(struct qlcnic_adapter *);
|
||||||
void qlcnic_83xx_disable_mbx_poll(struct qlcnic_adapter *);
|
void qlcnic_83xx_disable_mbx_poll(struct qlcnic_adapter *);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -134,7 +134,7 @@ struct qlcnic_mailbox_metadata {
|
||||||
|
|
||||||
#define QLCNIC_SET_OWNER 1
|
#define QLCNIC_SET_OWNER 1
|
||||||
#define QLCNIC_CLR_OWNER 0
|
#define QLCNIC_CLR_OWNER 0
|
||||||
#define QLCNIC_MBX_TIMEOUT 10000
|
#define QLCNIC_MBX_TIMEOUT 5000
|
||||||
|
|
||||||
#define QLCNIC_MBX_RSP_OK 1
|
#define QLCNIC_MBX_RSP_OK 1
|
||||||
#define QLCNIC_MBX_PORT_RSP_OK 0x1a
|
#define QLCNIC_MBX_PORT_RSP_OK 0x1a
|
||||||
|
|
|
@ -280,9 +280,9 @@ void qlcnic_sriov_cleanup(struct qlcnic_adapter *adapter)
|
||||||
static int qlcnic_sriov_post_bc_msg(struct qlcnic_adapter *adapter, u32 *hdr,
|
static int qlcnic_sriov_post_bc_msg(struct qlcnic_adapter *adapter, u32 *hdr,
|
||||||
u32 *pay, u8 pci_func, u8 size)
|
u32 *pay, u8 pci_func, u8 size)
|
||||||
{
|
{
|
||||||
|
u32 rsp, mbx_val, fw_data, rsp_num, mbx_cmd, val, wait_time = 0;
|
||||||
struct qlcnic_hardware_context *ahw = adapter->ahw;
|
struct qlcnic_hardware_context *ahw = adapter->ahw;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
u32 rsp, mbx_val, fw_data, rsp_num, mbx_cmd, val;
|
|
||||||
u16 opcode;
|
u16 opcode;
|
||||||
u8 mbx_err_code;
|
u8 mbx_err_code;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -330,15 +330,13 @@ static int qlcnic_sriov_post_bc_msg(struct qlcnic_adapter *adapter, u32 *hdr,
|
||||||
* assume something is wrong.
|
* assume something is wrong.
|
||||||
*/
|
*/
|
||||||
poll:
|
poll:
|
||||||
rsp = qlcnic_83xx_mbx_poll(adapter);
|
rsp = qlcnic_83xx_mbx_poll(adapter, &wait_time);
|
||||||
if (rsp != QLCNIC_RCODE_TIMEOUT) {
|
if (rsp != QLCNIC_RCODE_TIMEOUT) {
|
||||||
/* Get the FW response data */
|
/* Get the FW response data */
|
||||||
fw_data = readl(QLCNIC_MBX_FW(ahw, 0));
|
fw_data = readl(QLCNIC_MBX_FW(ahw, 0));
|
||||||
if (fw_data & QLCNIC_MBX_ASYNC_EVENT) {
|
if (fw_data & QLCNIC_MBX_ASYNC_EVENT) {
|
||||||
__qlcnic_83xx_process_aen(adapter);
|
__qlcnic_83xx_process_aen(adapter);
|
||||||
mbx_val = QLCRDX(ahw, QLCNIC_HOST_MBX_CTRL);
|
goto poll;
|
||||||
if (mbx_val)
|
|
||||||
goto poll;
|
|
||||||
}
|
}
|
||||||
mbx_err_code = QLCNIC_MBX_STATUS(fw_data);
|
mbx_err_code = QLCNIC_MBX_STATUS(fw_data);
|
||||||
rsp_num = QLCNIC_MBX_NUM_REGS(fw_data);
|
rsp_num = QLCNIC_MBX_NUM_REGS(fw_data);
|
||||||
|
|
Loading…
Reference in a new issue