From patchwork Tue May 29 11:59:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10435105 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 686EB601E9 for ; Tue, 29 May 2018 12:00:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57C2A28724 for ; Tue, 29 May 2018 12:00:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4ADFC28733; Tue, 29 May 2018 12:00:42 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, 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 A7DE928724 for ; Tue, 29 May 2018 12:00:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933391AbeE2MAk (ORCPT ); Tue, 29 May 2018 08:00:40 -0400 Received: from mail-by2nam03on0088.outbound.protection.outlook.com ([104.47.42.88]:23410 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933532AbeE2MA3 (ORCPT ); Tue, 29 May 2018 08:00:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=14rD+aBfTzApDPAxUMrJAPcjWZFOY+La4cAmNDiFZRs=; b=27wNQs06KDrHGXMP3A4RjWykbN11Z01qBR0OhRnetmcTAO+pdZXf4WqB+L1M2vOIGYBDrcN06qzmri64owiV7MsdwzpSe/Yza5y/DpCO0KE5lMX9P+WNoj7TZpB0iojH9Ffa1hw4DUYrI8EF7EsNBMi5paqMluDa+QrqUk9iKdw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BLUPR05MB1923.namprd05.prod.outlook.com (2a01:111:e400:52ad::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.5; Tue, 29 May 2018 12:00:23 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Andrey Shevchenko , Sergei Maksimenko , Dmitry Lebed Subject: [PATCH 3/9] qtnfmac: decode error codes from firmware replies Date: Tue, 29 May 2018 14:59:59 +0300 Message-Id: <20180529120005.21498-4-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180529120005.21498-1-sergey.matyukevich.os@quantenna.com> References: <20180529120005.21498-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM6PR03CA0031.eurprd03.prod.outlook.com (2603:10a6:20b::44) To BLUPR05MB1923.namprd05.prod.outlook.com (2a01:111:e400:52ad::13) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BLUPR05MB1923; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1923; 3:cb3ncujc4sx7TZBDvAVFkGeoEpZQHEbSm4xnrUfOiYA0Bz9sQO6bnmZGoMa6h+aJNKcZDU2nW1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WKHsHZZE69hVT9YWVLVElokXORwNZKBYp14g7MLWEuRDxIx5vNIfFjREzQaqokdZpG4J6GL6wXtCEWCzEWF3lOGsje2YCvXBluToZfhkujw2+hsz0mKGkFlQqunJqJnwf5MZRKQ2mOwDoG15OykLuQfNyqdyir12xclkeXC7PzyXKoIi/cPU8Lod0g6qKuNBH8mvI91c2rQj4Y6BnVkBwKKv6BCZ1vvHt1NsbqZ5m/RKw5kYlGm7iRTia/AAvkGVns5wnpcO2DTlL5etdrL7bAkDNDldfLt9DNF3XSXWk5BejqJCf; 4:ahgrbHca+OmzbjNR0eh2IgG1toJACc79hdnEjsv2eEp9Z4xTgz3BS4T6ETToKjvd8hWewKO1rHwz+PSjI+qRD8E5rkaWRXtJCOybCCRE9qS61v6guKmxT7DlPpWC42elRLZeza2E4uXZnsoD2hJFE0m/zJteylSk0UmdfMnfIqx9Q2OOhU+ZJuhe1pswi1stvhLwObpnOzPcNTE9XGUiNS5ZxlgIU/RBTRCnecBUO8Sfjc2sP3N2v38plOpDh+12yNv/ezfjataiHn0RmrMqFuW6E5RYBc2SzDI+/grLaXsG6Rdkd2bGSDNHvp23zbyc X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(211171220733660); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:BLUPR05MB1923; BCL:0; PCL:0; RULEID:; SRVR:BLUPR05MB1923; X-Forefront-PRVS: 0687389FB0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39840400004)(396003)(366004)(39380400002)(376002)(346002)(199004)(189003)(2361001)(2616005)(11346002)(51416003)(956004)(50466002)(107886003)(50226002)(48376002)(97736004)(446003)(478600001)(2906002)(476003)(86362001)(106356001)(81166006)(76176011)(66066001)(105586002)(3846002)(47776003)(6116002)(7696005)(486006)(81156014)(316002)(186003)(1076002)(53416004)(36756003)(25786009)(26005)(16526019)(103116003)(68736007)(54906003)(52116002)(6916009)(5660300001)(7736002)(69596002)(6666003)(305945005)(8676002)(16586007)(4326008)(386003)(2351001)(53936002)(8936002)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB1923; H:bars.quantenna.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR05MB1923; 23:4o2ho6mkqi3o6iPuRqz6gw0coOx22RqN1YrpKjXN+?= =?us-ascii?Q?7sInB/YbaCj5gVfPqRRjkNpDFVG2EH2N6YGYvaJ07mf+5qb9SUz+qTo2Exoc?= =?us-ascii?Q?USPQOReRy/92MyTOxVYbU9NxRebLPqspeHDpTFpgCz40NYWfLJ/tZjTGzywZ?= =?us-ascii?Q?pCkXMbFop9/i3OiRtKDsZjqMavCjywQ54+Oziw2Q5HKGRSnhI9Qt55LJspZY?= =?us-ascii?Q?FfX7dHdeDdxPhndqxXzdaZ7xx/108ao7k0EWgaG4N1LP9dYgI5s5QDtR4P8M?= =?us-ascii?Q?Vm2Kum1Kj/hx5re84XVXeVl/69Jyn89WK0vJZri1oNLFaT/UqvsT7w9XOdLT?= =?us-ascii?Q?ZdkcyTk/YGEu+s5n5USyPChePg3fWILXNUaNgUL9eAhENrUib15f7AETwPK8?= =?us-ascii?Q?XG9eCar+8Z/k62DJtq2IR1dUhMw/6kghCMVUJfLXng2E/LXytSwiGqWWb8FU?= =?us-ascii?Q?JH2LzhjJ0RXB4gGIRHKsGFNOQQWFDc3S9y1PEXOhmpRfozNLcAMzPmZU2Ey5?= =?us-ascii?Q?enm+MgS3duyOEVy9AOz7EaiL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7PixeAFimGYVozPHTaETctRE34ypxxbJU1QNckQ9/dIsGyZ4ZzhMpe3NTs63857qZYEjAhQG1FCBWVpnYHLb2uPHL7b19IxGPA7vjE7uJ6ymFFwhvtFIUV06DIt6NVNK5lxh2EtguwvOQxD/siQx2B+7o/xHnNhFmKnfsHBNMn1n X-MS-Office365-Filtering-Correlation-Id: 1c2fcd14-f970-438b-ca25-08d5c55bc311 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2018 12:00:23.8543 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c2fcd14-f970-438b-ca25-08d5c55bc311 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB1923 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 From: Igor Mitsyanko Introduce a function that will map an error code reported in reply to a firmware command, into one of standard errno codes. Use additional error codes to improve error reporting for MAC address changes. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/commands.c | 26 +++++++++++++++++++++-- drivers/net/wireless/quantenna/qtnfmac/qlink.h | 2 ++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index deca0060eb27..9dc4560be5d8 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -55,6 +55,28 @@ static int qtnf_cmd_check_reply_header(const struct qlink_resp *resp, return 0; } +static int qtnf_cmd_resp_result_decode(enum qlink_cmd_result qcode) +{ + switch (qcode) { + case QLINK_CMD_RESULT_OK: + return 0; + case QLINK_CMD_RESULT_INVALID: + return -EINVAL; + case QLINK_CMD_RESULT_ENOTSUPP: + return -ENOTSUPP; + case QLINK_CMD_RESULT_ENOTFOUND: + return -ENOENT; + case QLINK_CMD_RESULT_EALREADY: + return -EALREADY; + case QLINK_CMD_RESULT_EADDRINUSE: + return -EADDRINUSE; + case QLINK_CMD_RESULT_EADDRNOTAVAIL: + return -EADDRNOTAVAIL; + default: + return -EFAULT; + } +} + static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus, struct sk_buff *cmd_skb, struct sk_buff **response_skb, @@ -810,10 +832,10 @@ static int qtnf_cmd_send_add_change_intf(struct qtnf_vif *vif, if (unlikely(ret)) goto out; - if (unlikely(res_code != QLINK_CMD_RESULT_OK)) { + ret = qtnf_cmd_resp_result_decode(res_code); + if (ret) { pr_err("VIF%u.%u: CMD %d failed: %u\n", vif->mac->macid, vif->vifid, cmd_type, res_code); - ret = -EFAULT; goto out; } diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index 9ab27e158023..f85deda703fb 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -674,6 +674,8 @@ enum qlink_cmd_result { QLINK_CMD_RESULT_ENOTSUPP, QLINK_CMD_RESULT_ENOTFOUND, QLINK_CMD_RESULT_EALREADY, + QLINK_CMD_RESULT_EADDRINUSE, + QLINK_CMD_RESULT_EADDRNOTAVAIL, }; /**