From patchwork Fri May 6 08:59:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitra P B X-Patchwork-Id: 9030501 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 90C9F9F372 for ; Fri, 6 May 2016 09:01:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3A2A2035D for ; Fri, 6 May 2016 09:01:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC16420221 for ; Fri, 6 May 2016 09:01:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758022AbcEFJAH (ORCPT ); Fri, 6 May 2016 05:00:07 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:34942 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757971AbcEFI77 (ORCPT ); Fri, 6 May 2016 04:59:59 -0400 Received: by mail-pf0-f171.google.com with SMTP id 77so47595664pfv.2 for ; Fri, 06 May 2016 01:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=psN82QbMjSyJUUuNRKcd1gH+aMXVKBfR/lzEeVlMc1A=; b=ailhYyO0ZUexPcYCUSG8I8CLBseSbvOr40mLrvKSUq1LTC0TLWfOWDp2tXAFoOKqmB h5nSkMdB6sRySPFIdS55lzcsfVOCdShpNKnu4XYuQLTs+sDa0Y/KkEtQJT8Nqp35B0JA b8huEOEAxkwYGe+s/T2HKHcEKo4SRZlEDeACU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=psN82QbMjSyJUUuNRKcd1gH+aMXVKBfR/lzEeVlMc1A=; b=icpqsrjZRLGBE3DB96jnJr+uniOEl33wf1r/kdevyJSswUXvXiNmu16imqoJvSQ909 q4rYPxQzMw5HX3AbmHVTkUjOJ4PwzRyFzL82XBwGmIWLrurRooWE/gTElj9WRH4KkbiE C9SZ7WwOyWi2EzqYC+9xAAd3mx8IXN2Q0j4w/jRSBuwt1EFvSKeRQh++KohZe0gAN7TO EwaU5PrU9lfw6CxsD5UUV2/UI8OcrO6mi5eRpJgod4amkmKExiiihKIx6WgGvnX2Vkhi aFFdgOqjxFpnK11gJMdihLxH/3jVVkf/OxQoOWKAls2H7PgQUHHAUrrC66r3kba+Aqo2 Nk1Q== X-Gm-Message-State: AOPr4FXzswGwR/DuncEj/uxeGQRfSWaj5DLnbYaUhvJ3iGaZhEmjbJdkre4NAkL/RGs202Jx X-Received: by 10.98.21.131 with SMTP id 125mr27226221pfv.92.1462525198467; Fri, 06 May 2016 01:59:58 -0700 (PDT) Received: from host1.dhcp.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id b64sm19272399pfa.48.2016.05.06.01.59.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 May 2016 01:59:57 -0700 (PDT) From: Chaitra P B To: jejb@kernel.org, hch@infradead.org Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, JBottomley@Parallels.com, Sathya.Prakash@broadcom.com, suganath-prabu.subramani@broadcom.com, linux-kernel@vger.kernel.org, Chaitra P B Subject: [PATCH 2/6] mpt3sas: Handle active cable exception event Date: Fri, 6 May 2016 14:29:27 +0530 Message-Id: <1462525171-6877-3-git-send-email-chaitra.basappa@broadcom.com> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1462525171-6877-1-git-send-email-chaitra.basappa@broadcom.com> References: <1462525171-6877-1-git-send-email-chaitra.basappa@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 In-order to handle this 'MPI2_EVENT_ACTIVE_CABLE_EXCEPTION' event, driver need to follow below steps, 1. Unmask the 'MPI2_EVENT_ACTIVE_CABLE_EXCEPTION' event, so that FW can notify this event to host driver. 2. After receiving this event, add this event to AEN event queue, for notifying this event to applications. 3. Then Print below message in kernel logs if the event data's reason code is zero, "Currently an active cable with ReceptacleID cannot be powered and devices connected to this active cable will not be seen. This active cable requires of power" This event is only for Intruder/Cutlass HBAs. Signed-off-by: Chaitra P B Reviewed-by: Tomas Henzl --- drivers/scsi/mpt3sas/mpt3sas_base.c | 5 +++++ drivers/scsi/mpt3sas/mpt3sas_scsih.c | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 8c44b9c..4e9142f 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -654,6 +654,9 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc, case MPI2_EVENT_TEMP_THRESHOLD: desc = "Temperature Threshold"; break; + case MPI2_EVENT_ACTIVE_CABLE_EXCEPTION: + desc = "Active cable exception"; + break; } if (!desc) @@ -5424,6 +5427,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) _base_unmask_events(ioc, MPI2_EVENT_IR_OPERATION_STATUS); _base_unmask_events(ioc, MPI2_EVENT_LOG_ENTRY_ADDED); _base_unmask_events(ioc, MPI2_EVENT_TEMP_THRESHOLD); + if (ioc->hba_mpi_version_belonged == MPI26_VERSION) + _base_unmask_events(ioc, MPI2_EVENT_ACTIVE_CABLE_EXCEPTION); r = _base_make_ioc_operational(ioc, CAN_SLEEP); if (r) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index e0e4920..221f8bf 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -7850,6 +7850,7 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, Mpi2EventNotificationReply_t *mpi_reply; u16 event; u16 sz; + Mpi26EventDataActiveCableExcept_t *ActiveCableEventData; /* events turned off due to host reset or driver unloading */ if (ioc->remove_host || ioc->pci_error_recovery) @@ -7962,6 +7963,18 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, (Mpi2EventDataTemperature_t *) mpi_reply->EventData); break; + case MPI2_EVENT_ACTIVE_CABLE_EXCEPTION: + ActiveCableEventData = + (Mpi26EventDataActiveCableExcept_t *) mpi_reply->EventData; + if (ActiveCableEventData->ReasonCode == + MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER) + pr_info(MPT3SAS_FMT "Currently an active cable with ReceptacleID %d", + ioc->name, ActiveCableEventData->ReceptacleID); + pr_info("cannot be powered and devices connected to this active cable"); + pr_info("will not be seen. This active cable"); + pr_info("requires %d mW of power", + ActiveCableEventData->ActiveCablePowerRequirement); + break; default: /* ignore the rest */ return 1;