From patchwork Thu Aug 15 12:27:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sucheta Chakraborty X-Patchwork-Id: 267377 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2E32B2C0169 for ; Thu, 15 Aug 2013 23:09:33 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756189Ab3HONJ3 (ORCPT ); Thu, 15 Aug 2013 09:09:29 -0400 Received: from mx0b-0016ce01.pphosted.com ([67.231.156.153]:41496 "EHLO mx0b-0016ce01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753248Ab3HONJ3 (ORCPT ); Thu, 15 Aug 2013 09:09:29 -0400 Received: from pps.filterd (m0000643.ppops.net [127.0.0.1]) by mx0b-0016ce01.pphosted.com (8.14.5/8.14.5) with SMTP id r7FCu9kB014271; Thu, 15 Aug 2013 05:56:11 -0700 Received: from avcashub1.qlogic.com (avcashub2.qlogic.com [198.70.193.116]) by mx0b-0016ce01.pphosted.com with ESMTP id 1e5gq0gagp-3 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Thu, 15 Aug 2013 05:56:10 -0700 Received: from dut6217.mv.qlogic.com (172.29.56.217) by qlc.com (10.1.4.191) with Microsoft SMTP Server id 14.2.318.1; Thu, 15 Aug 2013 05:55:56 -0700 Received: by dut6217.mv.qlogic.com (Postfix, from userid 0) id D454E5221A2; Thu, 15 Aug 2013 08:27:48 -0400 (EDT) From: Sucheta Chakraborty To: CC: , , Manish Chopra Subject: [PATCH net-next 2/5] qlcnic: Flush mailbox command list when mailbox is not available Date: Thu, 15 Aug 2013 08:27:26 -0400 Message-ID: <1376569649-565-3-git-send-email-sucheta.chakraborty@qlogic.com> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1376569649-565-1-git-send-email-sucheta.chakraborty@qlogic.com> References: <1376569649-565-1-git-send-email-sucheta.chakraborty@qlogic.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5400 definitions=7167 signatures=668609 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1305240000 definitions=main-1308150057 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Manish Chopra o Driver was hitting a panic at the time of adapter reset due to invalid command access from the list which had been already freed by the queuing thread. Flush all the pending commands from the list before proceeding with adapter reset Signed-off-by: Manish Chopra Signed-off-by: Sucheta Chakraborty --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 55a5977..43b51a0 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c @@ -3515,6 +3515,8 @@ static inline void qlcnic_83xx_flush_mbx_queue(struct qlcnic_adapter *adapter) while (!list_empty(head)) { cmd = list_entry(head->next, struct qlcnic_cmd_args, list); + dev_info(&adapter->pdev->dev, "%s: Mailbox command 0x%x\n", + __func__, cmd->cmd_op); list_del(&cmd->list); mbx->num_cmds--; qlcnic_83xx_notify_cmd_completion(adapter, cmd); @@ -3534,6 +3536,7 @@ static inline int qlcnic_83xx_check_mbx_status(struct qlcnic_adapter *adapter) host_mbx_ctrl = QLCRDX(ahw, QLCNIC_HOST_MBX_CTRL); if (host_mbx_ctrl) { + clear_bit(QLC_83XX_MBX_READY, &mbx->status); ahw->idc.collect_dump = 1; return -EIO; } @@ -3704,8 +3707,10 @@ static void qlcnic_83xx_mailbox_worker(struct work_struct *work) ahw = adapter->ahw; while (true) { - if (qlcnic_83xx_check_mbx_status(adapter)) + if (qlcnic_83xx_check_mbx_status(adapter)) { + qlcnic_83xx_flush_mbx_queue(adapter); return; + } atomic_set(rsp_status, QLC_83XX_MBX_RESPONSE_WAIT);