From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Falcon Subject: Re: [PATCH net-next 2/2] ibmvnic: Update firmware error reporting with cause string Date: Mon, 6 Aug 2018 23:34:55 -0500 Message-ID: References: <1533609599-10188-1-git-send-email-tlfalcon@linux.vnet.ibm.com> <1533609599-10188-3-git-send-email-tlfalcon@linux.vnet.ibm.com> <4c6e57db-b5b7-fa9d-d3ef-9016dfe0be21@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Cc: jallen@linux.vnet.ibm.com To: Nathan Fontenot , netdev@vger.kernel.org Return-path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46300 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727533AbeHGGw1 (ORCPT ); Tue, 7 Aug 2018 02:52:27 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w774YBY4172912 for ; Tue, 7 Aug 2018 00:40:00 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0b-001b2d01.pphosted.com with ESMTP id 2kq3dgj9f0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 07 Aug 2018 00:39:59 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Aug 2018 22:34:59 -0600 In-Reply-To: <4c6e57db-b5b7-fa9d-d3ef-9016dfe0be21@linux.vnet.ibm.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 08/06/2018 10:48 PM, Nathan Fontenot wrote: > > On 08/06/2018 09:39 PM, Thomas Falcon wrote: >> Print a string instead of the error code. Since there is a >> possibility that the driver can recover, classify it as a >> warning instead of an error. >> >> Signed-off-by: Thomas Falcon >> --- >>   drivers/net/ethernet/ibm/ibmvnic.c | 34 >> ++++++++++++++++++++++++++++++---- >>   1 file changed, 30 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c >> b/drivers/net/ethernet/ibm/ibmvnic.c >> index 109e4a58efad..dafdd4ade705 100644 >> --- a/drivers/net/ethernet/ibm/ibmvnic.c >> +++ b/drivers/net/ethernet/ibm/ibmvnic.c >> @@ -3825,15 +3825,41 @@ static void >> handle_query_ip_offload_rsp(struct ibmvnic_adapter *adapter) >>       ibmvnic_send_crq(adapter, &crq); >>   } >> >> +static const char *ibmvnic_fw_err_cause(u16 cause) >> +{ >> +    switch (cause) { >> +    case ADAPTER_PROBLEM: >> +        return "adapter problem"; >> +    case BUS_PROBLEM: >> +        return "bus problem"; >> +    case FW_PROBLEM: >> +        return "firmware problem"; >> +    case DD_PROBLEM: >> +        return "device driver problem"; >> +    case EEH_RECOVERY: >> +        return "EEH recovery"; >> +    case FW_UPDATED: >> +        return "firmware updated"; >> +    case LOW_MEMORY: >> +        return "low Memory"; >> +    default: >> +        return "unknown"; >> +    } >> +} >> + >>   static void handle_error_indication(union ibmvnic_crq *crq, >>                       struct ibmvnic_adapter *adapter) >>   { >>       struct device *dev = &adapter->vdev->dev; >> +    u16 cause; >> + >> +    cause = be16_to_cpu(crq->error_indication.error_cause); >> >> -    dev_err(dev, "Firmware reports %serror, cause %d\n", >> -        crq->error_indication.flags >> -            & IBMVNIC_FATAL_ERROR ? "FATAL " : "", >> -        be16_to_cpu(crq->error_indication.error_cause)); >> +    dev_warn_ratelimited(dev, >> +                 "Firmware reports %serror, cause: %s. Starting >> recovery...\n", > >                                                ^^^^^^^ > > You're going to want a space between after the %s here. > > -Nathan > It does look odd at first glance, but there is a space after "FATAL" below. Thanks, Tom >> + crq->error_indication.flags >> +                & IBMVNIC_FATAL_ERROR ? "FATAL " : "", >> +                 ibmvnic_fw_err_cause(cause)); >> >>       if (crq->error_indication.flags & IBMVNIC_FATAL_ERROR) >>           ibmvnic_reset(adapter, VNIC_RESET_FATAL); >>