From patchwork Thu Mar 27 14:28:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: clsoto@linux.vnet.ibm.com X-Patchwork-Id: 3898101 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 181499F2B6 for ; Thu, 27 Mar 2014 14:33:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4293E20256 for ; Thu, 27 Mar 2014 14:32:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79D2D20253 for ; Thu, 27 Mar 2014 14:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756899AbaC0Ocr (ORCPT ); Thu, 27 Mar 2014 10:32:47 -0400 Received: from [32.97.110.57] ([32.97.110.57]:60985 "HELO jupiter1-lp2.austin.ibm.com" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with SMTP id S1756893AbaC0Ocp (ORCPT ); Thu, 27 Mar 2014 10:32:45 -0400 Received: by jupiter1-lp2.austin.ibm.com (Postfix, from userid 0) id 44DD31209B9; Thu, 27 Mar 2014 09:29:39 -0500 (CDT) Message-Id: <20140327142939.072593482@linux.vnet.ibm.com> References: <20140327142813.535289178@linux.vnet.ibm.com> User-Agent: quilt/0.46-1 Date: Thu, 27 Mar 2014 09:28:14 -0500 From: clsoto@linux.vnet.ibm.com To: clsoto@linux.vnet.ibm.com, roland@kernel.org, sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-rdma@vger.kernel.org, netdev@vger.kernel.org Cc: brking@linux.vnet.ibm.com Subject: [Patch 1/3] IB/mlx4: send a IB_EVENT_DEVICE_FATAL to users during PCI error injection Content-Disposition: inline; filename=mlx4_send_device_fatal_event.patch Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 If the cards hits a pci error, then notify users that the device is not in good shape. Send IB_EVENT_DEVICE_FATAL to IB users. Signed-off-by: Carol Soto --- drivers/net/ethernet/mellanox/mlx4/main.c | 6 ++++++ 1 file changed, 6 insertions(+) Index: b/drivers/net/ethernet/mellanox/mlx4/main.c =================================================================== --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -2673,6 +2673,12 @@ MODULE_DEVICE_TABLE(pci, mlx4_pci_table) static pci_ers_result_t mlx4_pci_err_detected(struct pci_dev *pdev, pci_channel_state_t state) { + struct mlx4_dev *dev = pci_get_drvdata(pdev); + int i; + + for (i = 1; i <= dev->caps.num_ports; ++i) + mlx4_dispatch_event(dev, MLX4_DEV_EVENT_CATASTROPHIC_ERROR, i); + mlx4_remove_one(pdev); return state == pci_channel_io_perm_failure ?