From patchwork Sun Jun 7 23:58:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ron Mercer X-Patchwork-Id: 28213 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 33D0AB70B4 for ; Mon, 8 Jun 2009 10:06:52 +1000 (EST) Received: by ozlabs.org (Postfix) id 27C75DDD1C; Mon, 8 Jun 2009 10:06:52 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id B761CDDD0B for ; Mon, 8 Jun 2009 10:06:51 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753310AbZFHAG3 (ORCPT ); Sun, 7 Jun 2009 20:06:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753281AbZFHAG1 (ORCPT ); Sun, 7 Jun 2009 20:06:27 -0400 Received: from avexch1.qlogic.com ([198.70.193.115]:19996 "EHLO avexch1.qlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752976AbZFHAGW (ORCPT ); Sun, 7 Jun 2009 20:06:22 -0400 Received: from linux-ox1b.qlogic.com ([172.17.161.157]) by avexch1.qlogic.com with Microsoft SMTPSVC(6.0.3790.1830); Sun, 7 Jun 2009 17:05:36 -0700 Received: by linux-ox1b.qlogic.com (Postfix, from userid 1000) id 4E7892C6A0; Sun, 7 Jun 2009 16:58:29 -0700 (PDT) From: Ron Mercer To: davem@davemloft.net Cc: netdev@vger.kernel.org, ron.mercer@qlogic.com Subject: [net-2.6 PATCH 2/5] qlge: Fix bug in firmware event handler. Date: Sun, 7 Jun 2009 16:58:26 -0700 Message-Id: <1244419109-355-3-git-send-email-ron.mercer@qlogic.com> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1244419109-355-1-git-send-email-ron.mercer@qlogic.com> References: <1244419109-355-1-git-send-email-ron.mercer@qlogic.com> X-OriginalArrivalTime: 08 Jun 2009 00:05:36.0664 (UTC) FILETIME=[D9969980:01C9E7CC] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Each firmware mailbox command can have a different number of valid data elements. When waiting for a mailbox command to complete it the process passes it's element count and waits for the completion. It is possible that while waiting an unrelated firmware async event (AE) can arrive. When this happens, the handler will over write the element count with the value for the newly arrived AE. This can cause the mailbox command to not get all of it's data. This patch restores original mailbox count at the end of the handler. Signed-off-by: Ron Mercer --- drivers/net/qlge/qlge_mpi.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index 7cb30fd..ff84243 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c @@ -453,6 +453,13 @@ static int ql_mpi_handler(struct ql_adapter *qdev, struct mbox_params *mbcp) } end: ql_write32(qdev, CSR, CSR_CMD_CLR_R2PCI_INT); + /* Restore the original mailbox count to + * what the caller asked for. This can get + * changed when a mailbox command is waiting + * for a response and an AEN arrives and + * is handled. + * */ + mbcp->out_count = orig_count; return status; }