From patchwork Wed Nov 22 09:11:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wright Feng X-Patchwork-Id: 10069953 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E84AE60375 for ; Wed, 22 Nov 2017 09:07:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC32429B97 for ; Wed, 22 Nov 2017 09:07:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0B5A29B9C; Wed, 22 Nov 2017 09:07:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D09C129B97 for ; Wed, 22 Nov 2017 09:07:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751900AbdKVJHJ (ORCPT ); Wed, 22 Nov 2017 04:07:09 -0500 Received: from mail-bl2nam02on0101.outbound.protection.outlook.com ([104.47.38.101]:4849 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751867AbdKVJEt (ORCPT ); Wed, 22 Nov 2017 04:04:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cycorp.onmicrosoft.com; s=selector1-cypress-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fIOz2ldha+a6GcoB4hQGzWkAdM5V5i1eLPNejDnLFKQ=; b=rftuOM+sbf0FIH7tmjGart5SYtp5x+lj4CIQzr2CsNM79sXNICWb2R8a0WczMBuAr3Z58cqBLBjRVOk3lYU/TgYhSlgteDHad5k4yAUcRB3p8lwMvLvhBY6qLKT0IcHT//i4Wuhr9yZmjAVPepELAueN740ihnXbjlFnWvsau0c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Wright.Feng@cypress.com; Received: from localhost (61.222.14.99) by MWHPR0601MB3593.namprd06.prod.outlook.com (2603:10b6:301:7b::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Wed, 22 Nov 2017 09:04:46 +0000 From: Wright Feng To: arend.vanspriel@broadcom.com, franky.lin@broadcom.com, hante.meuleman@broadcom.com, kvalo@codeaurora.org, chi-hsien.lin@cypress.com Cc: wright.feng@cypress.com, linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com Subject: [PATCH] brcmfmac: transfer firmware error to Linux error code in fwil Date: Wed, 22 Nov 2017 17:11:16 +0800 Message-Id: <1511341876-10198-1-git-send-email-wright.feng@cypress.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [61.222.14.99] X-ClientProxiedBy: HK2PR02CA0147.apcprd02.prod.outlook.com (2603:1096:202:16::31) To MWHPR0601MB3593.namprd06.prod.outlook.com (2603:10b6:301:7b::36) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4182bed1-710f-4439-cc0e-08d531881432 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:MWHPR0601MB3593; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0601MB3593; 3:Qmad2pjT8nCSAx+B5C9DwUwfurn5bUD85yA9hd7LRlRPu1QZHxd4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n3u/FvtYA4bNPDD8IhTxSvopngClzscJRRRDitXkJUB+6vVl62y1YHPpeA+tRsf17LYG2tcY+r0mUV1c9pXDoMD+WsZp4HD2noU5NYdByg0jQkkoncOcI9QzGRbsqADMv/0hKV7N+V43A4eUFWZSuDj8anKWXS2i2xw3kDHH+8iwVUVlJ72WCI9xRtmUbryxby5I48A8AdeHvoO/+DiNcM+wW9HQccEu3Xo42Ei55SlWdboWA5zHvV0Faapj5VSzUKmTUnDZFJda7P0c2/pset4D+dpGGazySVfHiur; 4:2K/+Wa6r9/JEVPdi/h3RDpVMeFmplqtBQAryi069hPiAJ+TQgejIyja3yijngX8ja8H9PKMcknat5jbX3NirdneVYYvrccfUmklTibcXOGg8qbvMrahAV+ZqRnpnJ8HHwKmK3dUQZ4sxsEwJeRmSdmhNHMyJh4wHY5rVQGAQ/l92AWvebJxXJlniWftzRTjncvJjybwrLSp3dK8+ohngQanKmxhkxdWcQQBV0qzeNiKYT1K6buCofpOhAuS1WAw05hBStdoDXauSpaQQn8YhmFcc017cuAHSrrS7n/eKP0Ls3EV0D5X6PKAIIXvioxv2 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(258095267146985); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3231022)(3002001)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(6055026)(6041248)(20161123564025)(20161123555025)(20161123558100)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR0601MB3593; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR0601MB3593; X-Forefront-PRVS: 0499DAF22A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(6009001)(376002)(39860400002)(346002)(189002)(199003)(2906002)(66066001)(7736002)(305945005)(6636002)(8676002)(3846002)(6666003)(53936002)(81156014)(6116002)(48376002)(6496006)(217423001)(72206003)(478600001)(575784001)(86362001)(5003940100001)(50986999)(101416001)(50466002)(316002)(76506005)(81166006)(50226002)(36756003)(8936002)(105586002)(47776003)(97736004)(16586007)(33646002)(25786009)(106356001)(16526018)(4326008)(189998001)(6486002)(5660300001)(68736007); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR0601MB3593; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cypress.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR0601MB3593; 23:REopJ6oO8emHjErAAf3tdcnXoMjIvIPu6Vp/TLD?= =?us-ascii?Q?s2za/lbQZeHSyVyHdAJQ/VGkvyaF/mQ53hG/AXeQpvQDJwY+rM6x4YBh0sHU?= =?us-ascii?Q?xzDy6rKEkSzB6WHE+lVSLpRkvqarkDIU+0BL0a5gUKx0Ct1UxVZIFDN60Ujq?= =?us-ascii?Q?0hzKoJ/L3OkOM558+imS8MIrM/MOAhIGzy8AjEsA2PJ/tDvGkm5JHftjGEl6?= =?us-ascii?Q?ktBf2Ha+MkPaTm1IN6uD0WX7pEPrTQpiQYVNbuDCS91FNo9i4fsDfUuH/CWn?= =?us-ascii?Q?L36kQZjGH3RGarnS6kbQ2aLdKxPf+r7JVLDSyQBrl8yOqUcd3/DTipXhrdNQ?= =?us-ascii?Q?teg1DxFKL8+OBkp2zXgNS0wk4BOJmJzLBG5zF7YxUCiS9Q1mRN0IXjlhr2rM?= =?us-ascii?Q?PFFQvARgCd2E9QNbQcQLHOSyaGnFnXM5TISQ1dUNrK7m3IG5wsGa2QlpR7Dr?= =?us-ascii?Q?7HZEjx7+g4y+pF3iRDWwRJy4RuzJuswR0vP38z1aua6CRthYBhu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toO9jLYIP4B+tIrujtSOTl1xCXZCzTL2ik10W5we4/D+VwOJCbQBVt8WQDXn0fceRnDPxqlcLmdmmFCnJ5XSuelZOseekA/hv6yOf+ZY58aDwnZtu4iCU=; 5:TY0bmFwxX32Ni9k0GN+SvJxSCfykY7Ijg1wmwD5tg+UFuQ21YzyeXIN04X5iR+HYH0XyASE72hQc0VjUiuJvBOD8FZQjkW/3uwIsSIcInB/t1SKaCea1T8lxVODe3dJNAosAqEiKbE1DEAYlg5QF2HZGxyImi6qZiBifLUY2abM=; 24:8/XZiQRo4yE4lGGORDJsWcKrzD7e1IwMJ1qdzmROBfZD0oWqSKRV1Geg7tACyjYDX3NywRBpI7Sub8q6TYxbiVcQt7WVoNkVQtXst3FTong=; 7:jArjgZ7Dw9efkulwgM61QBc/gyXvBzirRHjXDryiKD6PTj+LlU0qe/C7xcuwJADphymP/tm7l9Sadh409wMEylP1yjuHDv6MeS4COeKU2LSsTRsoQ1MyoebSdJPS35kE6nta+MUQR7tQ7FHdqzA8ekOSRECMQ/8ZgkJPqDgCSA1VmcWPwHfHQY/NO6tKgKbaycSFuY50lOyvcK7SSCN3BB4gA16ZvAaH3bQsXS7DOcvWsdfjH5UJ9tZiahO0Pp3f SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2017 09:04:46.2761 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4182bed1-710f-4439-cc0e-08d531881432 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0601MB3593 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP fil_cmd_data_set and fil_cmd_data_get return proprietary error code when getting error from firmware layer. The vendor tools or utilities that uses libnl may stuck in some commands when wl is down. For example, issue "scan" command after issuing "down" command, the "scan" command will be the blocking call and stuck as no response from libnl. It is caused by that firmware returns BCME_NOTUP(-4) when wl is down, but the -4 is -EINTR in Linux kernel, so libnl catches the error and not passes to upper layer. Because of that, the fwil should return Linux error code instead of the proprietary error code, and the tools or utilities should get the real firmware error code by command "bcmerror" or "bcmerrorstr" after receiving the error from libnl. Signed-off-by: Wright Feng --- .../wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 12 ++-- .../wireless/broadcom/brcm80211/brcmfmac/fwil.c | 80 ++++++++++++++++++++-- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 13 ++-- .../wireless/broadcom/brcm80211/brcmfmac/proto.h | 14 ++-- 4 files changed, 101 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c index 9f2d0b0..44faae4 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c @@ -165,7 +165,7 @@ static int brcmf_proto_bcdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len) static int brcmf_proto_bcdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, - void *buf, uint len) + void *buf, uint len, bool *is_fwerr) { struct brcmf_bcdc *bcdc = (struct brcmf_bcdc *)drvr->proto->pd; struct brcmf_proto_bcdc_dcmd *msg = &bcdc->msg; @@ -212,8 +212,10 @@ static int brcmf_proto_bcdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len) } /* Check the ERROR flag */ - if (flags & BCDC_DCMD_ERROR) + if (flags & BCDC_DCMD_ERROR) { + *is_fwerr = true; ret = le32_to_cpu(msg->status); + } done: return ret; @@ -221,7 +223,7 @@ static int brcmf_proto_bcdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len) static int brcmf_proto_bcdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, - void *buf, uint len) + void *buf, uint len, bool *is_fwerr) { struct brcmf_bcdc *bcdc = (struct brcmf_bcdc *)drvr->proto->pd; struct brcmf_proto_bcdc_dcmd *msg = &bcdc->msg; @@ -250,8 +252,10 @@ static int brcmf_proto_bcdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len) } /* Check the ERROR flag */ - if (flags & BCDC_DCMD_ERROR) + if (flags & BCDC_DCMD_ERROR) { + *is_fwerr = true; ret = le32_to_cpu(msg->status); + } done: return ret; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c index f6a2df9..1a1beaa 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c @@ -32,6 +32,70 @@ #define MAX_HEX_DUMP_LEN 64 +static u32 brcmf_fil_errormap[] = { + 0, /* BCME_OK */ + EIO, /* BCME_ERROR */ + EINVAL, /* BCME_BADARG */ + EINVAL, /* BCME_BADOPTION */ + ENETDOWN, /* BCME_NOTUP */ + EIO, /* BCME_NOTDOWN */ + EIO, /* BCME_NOTAP */ + EIO, /* BCME_NOTSTA */ + EINVAL, /* BCME_BADKEYIDX */ + EIO, /* BCME_RADIOOFF */ + EIO, /* BCME_NOTBANDLOCKED */ + EIO, /* BCME_NOCLK */ + EINVAL, /* BCME_BADRATESET */ + EINVAL, /* BCME_BADBAND */ + EINVAL, /* BCME_BUFTOOSHORT */ + EINVAL, /* BCME_BUFTOOLONG */ + EBUSY, /* BCME_BUSY */ + ENOTCONN, /* BCME_NOTASSOCIATED */ + EINVAL, /* BCME_BADSSIDLEN */ + EINVAL, /* BCME_OUTOFRANGECHAN */ + EINVAL, /* BCME_BADCHAN */ + EFAULT, /* BCME_BADADDR */ + ENOMEM, /* BCME_NORESOURCE */ + ENOTSUPP, /* BCME_UNSUPPORTED */ + EINVAL, /* BCME_BADLEN */ + EIO, /* BCME_NOTREADY */ + EPERM, /* BCME_EPERM */ + ENOMEM, /* BCME_NOMEM */ + ENOTCONN, /* BCME_ASSOCIATED */ + EINVAL, /* BCME_RANGE */ + ENXIO, /* BCME_NOTFOUND */ + EIO, /* BCME_WME_NOT_ENABLED */ + ENXIO, /* BCME_TSPEC_NOTFOUND */ + ENOTSUPP, /* BCME_ACM_NOTSUPPORTED */ + ENOTCONN, /* BCME_NOT_WME_ASSOCIATION */ + EIO, /* BCME_SDIO_ERROR */ + ENETDOWN, /* BCME_DONGLE_DOWN */ + EIO, /* BCME_VERSION */ + EIO, /* BCME_TXFAIL */ + EIO, /* BCME_RXFAIL */ + ENXIO, /* BCME_NODEVICE */ + EIO, /* BCME_NMODE_DISABLED */ + EIO, /* BCME_NONRESIDENT */ + EIO, /* BCME_SCANREJECT */ + EINVAL, /* BCME_USAGE_ERROR */ + EIO, /* BCME_IOCTL_ERROR */ + EIO, /* BCME_SERIAL_PORT_ERR */ + EIO, /* BCME_DISABLED */ + EIO, /* BCME_DECERR */ + EIO, /* BCME_ENCERR */ + EIO, /* BCME_MICERR */ + EIO, /* BCME_REPLAY */ + ENXIO, /* BCME_IE_NOTFOUND */ +}; + +static s32 brcmf_fil_transfer_linuxerr(s32 fw_err) +{ + if (-fw_err >= ARRAY_SIZE(brcmf_fil_errormap)) + return -EIO; + + return -brcmf_fil_errormap[-fw_err]; +} + #ifdef DEBUG static const char * const brcmf_fil_errstr[] = { "BCME_OK", @@ -107,6 +171,7 @@ static const char *brcmf_fil_get_errstr(u32 err) brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set) { struct brcmf_pub *drvr = ifp->drvr; + bool is_fwerr = false; s32 err; if (drvr->bus_if->state != BRCMF_BUS_UP) { @@ -117,15 +182,22 @@ static const char *brcmf_fil_get_errstr(u32 err) if (data != NULL) len = min_t(uint, len, BRCMF_DCMD_MAXLEN); if (set) - err = brcmf_proto_set_dcmd(drvr, ifp->ifidx, cmd, data, len); + err = brcmf_proto_set_dcmd(drvr, ifp->ifidx, cmd, data, len, + &is_fwerr); else - err = brcmf_proto_query_dcmd(drvr, ifp->ifidx, cmd, data, len); + err = brcmf_proto_query_dcmd(drvr, ifp->ifidx, cmd, data, len, + &is_fwerr); if (err >= 0) return 0; - brcmf_dbg(FIL, "Failed: %s (%d)\n", - brcmf_fil_get_errstr((u32)(-err)), err); + if (is_fwerr) { + brcmf_dbg(FIL, "Failed: %s (%d)\n", + brcmf_fil_get_errstr((u32)(-err)), err); + err = brcmf_fil_transfer_linuxerr(err); + } else { + brcmf_dbg(FIL, "Failed: err (%d)\n", err); + } return err; } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c index d2c834c..ce90871 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c @@ -477,7 +477,8 @@ static void brcmf_msgbuf_ioctl_resp_wake(struct brcmf_msgbuf *msgbuf) static int brcmf_msgbuf_query_dcmd(struct brcmf_pub *drvr, int ifidx, - uint cmd, void *buf, uint len) + uint cmd, void *buf, uint len, + bool *is_fwerr) { struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd; struct sk_buff *skb = NULL; @@ -508,14 +509,18 @@ static int brcmf_msgbuf_query_dcmd(struct brcmf_pub *drvr, int ifidx, } brcmu_pkt_buf_free_skb(skb); - return msgbuf->ioctl_resp_status; + err = msgbuf->ioctl_resp_status; + if (err < 0) + *is_fwerr = true; + + return err; } static int brcmf_msgbuf_set_dcmd(struct brcmf_pub *drvr, int ifidx, - uint cmd, void *buf, uint len) + uint cmd, void *buf, uint len, bool *is_fwerr) { - return brcmf_msgbuf_query_dcmd(drvr, ifidx, cmd, buf, len); + return brcmf_msgbuf_query_dcmd(drvr, ifidx, cmd, buf, len, is_fwerr); } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h index 2404f8a..7bd0f63 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h @@ -30,9 +30,9 @@ struct brcmf_proto { int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, struct sk_buff *skb, struct brcmf_if **ifp); int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, - void *buf, uint len); + void *buf, uint len, bool *is_fwerr); int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf, - uint len); + uint len, bool *is_fwerr); int (*tx_queue_data)(struct brcmf_pub *drvr, int ifidx, struct sk_buff *skb); int (*txdata)(struct brcmf_pub *drvr, int ifidx, u8 offset, @@ -71,14 +71,16 @@ static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws, return drvr->proto->hdrpull(drvr, do_fws, skb, ifp); } static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx, - uint cmd, void *buf, uint len) + uint cmd, void *buf, uint len, + bool *is_fwerr) { - return drvr->proto->query_dcmd(drvr, ifidx, cmd, buf, len); + return drvr->proto->query_dcmd(drvr, ifidx, cmd, buf, len, is_fwerr); } static inline int brcmf_proto_set_dcmd(struct brcmf_pub *drvr, int ifidx, - uint cmd, void *buf, uint len) + uint cmd, void *buf, uint len, + bool *is_fwerr) { - return drvr->proto->set_dcmd(drvr, ifidx, cmd, buf, len); + return drvr->proto->set_dcmd(drvr, ifidx, cmd, buf, len, is_fwerr); } static inline int brcmf_proto_tx_queue_data(struct brcmf_pub *drvr, int ifidx,