From patchwork Tue Dec 1 12:39:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghava Aditya Renukunta X-Patchwork-Id: 7740361 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 19F0FBEEE5 for ; Tue, 1 Dec 2015 19:34:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D2942010F for ; Tue, 1 Dec 2015 19:34:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42E5B200E3 for ; Tue, 1 Dec 2015 19:34:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754203AbbLATeV (ORCPT ); Tue, 1 Dec 2015 14:34:21 -0500 Received: from bby1mta03.pmc-sierra.com ([216.241.235.118]:55980 "EHLO bby1mta03.pmc-sierra.bc.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753760AbbLATeT (ORCPT ); Tue, 1 Dec 2015 14:34:19 -0500 Received: from bby1mta03.pmc-sierra.bc.ca (localhost.pmc-sierra.bc.ca [127.0.0.1]) by localhost (Postfix) with SMTP id 6828A1070921; Tue, 1 Dec 2015 11:34:19 -0800 (PST) Received: from smtp.pmcs.com (bby1cas04.pmc-sierra.internal [216.241.227.182]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by bby1mta03.pmc-sierra.bc.ca (Postfix) with ESMTP id 551BA1070908; Tue, 1 Dec 2015 11:34:19 -0800 (PST) Received: from localhost (216.241.227.4) by bby1cas04.pmc-sierra.internal (216.241.227.182) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 1 Dec 2015 11:34:18 -0800 From: Raghava Aditya Renukunta To: , CC: , , , , , , Subject: [PATCH 05/10] aacraid: Set correct msix count for EEH recovery Date: Tue, 1 Dec 2015 04:39:43 -0800 Message-ID: <1448973589-9216-6-git-send-email-RaghavaAditya.Renukunta@pmcs.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448973589-9216-1-git-send-email-RaghavaAditya.Renukunta@pmcs.com> References: <1448973589-9216-1-git-send-email-RaghavaAditya.Renukunta@pmcs.com> MIME-Version: 1.0 X-Originating-IP: [216.241.227.4] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pmcs.com; h=from:to:cc:subject:date:message-id:in-reply-to:references:mime-version:content-type; s=default; bh=FntvzetoNTMGesrbcUuoLqE47nQvntSuvm54UXm+eW4=; b=RO7KjNo4xg6mUgctW8tKhr/s4o2FhwKIVH8nnTXrb2uLLnoh5iurs/dH9haHiNclA8x7xmLPM1KsyXD1dW3DVJjIdOjfaL+FbE2KpscUVtG/zPDKn/XTqpj7hK4AL3Quvp9Tyvsua51mbw1PjVnqAvYsZcnnNECvxlYme3dNHrk= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIM_SIGNED,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Raghava Aditya Renukunta During EEH recovery number of online CPU's might change thereby changing the number of MSIx vectors. Since each fib is allocated to a vector, changes in the number of vectors causes fib to be sent thru invalid vectors.In addition the correct number of MSIx vectors is not updated in the INIT struct sent to the controller, when it is reinitialized. Fixed by reassigning vectors to fibs based on the updated number of MSIx vectors and updating the INIT structure before sending to controller. Signed-off-by: Raghava Aditya Renukunta --- drivers/scsi/aacraid/linit.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 0147210..f88f1132 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -1355,6 +1355,7 @@ static int aac_acquire_resources(struct aac_dev *dev) int i, j; int instance = dev->id; const char *name = dev->name; + int vector = 0; unsigned long status; /* * First clear out all interrupts. Then enable the one's that we @@ -1409,9 +1410,31 @@ static int aac_acquire_resources(struct aac_dev *dev) } aac_adapter_enable_int(dev); + /*max msix may change after EEH + * Re-assign vectors to fibs + */ + for (i = 0; + i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); + i++) { + if ((dev->max_msix == 1) || + (i > ((dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB - 1) + - dev->vector_cap))) { + dev->fibs[i].vector_no = 0; + } else { + dev->fibs[i].vector_no = vector; + vector++; + if (vector == dev->max_msix) + vector = 1; + } + } - if (!dev->sync_mode) + if (!dev->sync_mode) { + /* After EEH recovery or suspend resume, max_msix count + * may change, therfore updating in init as well. + */ aac_adapter_start(dev); + dev->init->Sa_MSIXVectors = cpu_to_le32(dev->max_msix); + } return 0; error_iounmap: