From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Fontenot Subject: Re: [PATCH net-next 2/2] ibmvnic: Update firmware error reporting with cause string Date: Mon, 6 Aug 2018 22:48:49 -0500 Message-ID: <4c6e57db-b5b7-fa9d-d3ef-9016dfe0be21@linux.vnet.ibm.com> References: <1533609599-10188-1-git-send-email-tlfalcon@linux.vnet.ibm.com> <1533609599-10188-3-git-send-email-tlfalcon@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: jallen@linux.vnet.ibm.com To: Thomas Falcon , netdev@vger.kernel.org Return-path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35206 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbeHGGBN (ORCPT ); Tue, 7 Aug 2018 02:01:13 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w773hq7N000614 for ; Mon, 6 Aug 2018 23:48:55 -0400 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kq1r03xgr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 06 Aug 2018 23:48:54 -0400 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Aug 2018 23:48:53 -0400 In-Reply-To: <1533609599-10188-3-git-send-email-tlfalcon@linux.vnet.ibm.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: 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 > + 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); >