From patchwork Thu May 31 09:10:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10440557 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 6F6CF6035E for ; Thu, 31 May 2018 09:11:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 697ED290A1 for ; Thu, 31 May 2018 09:11:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DEFE291B9; Thu, 31 May 2018 09:11:23 +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 E5B1E290A1 for ; Thu, 31 May 2018 09:11:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754092AbeEaJLV (ORCPT ); Thu, 31 May 2018 05:11:21 -0400 Received: from mail-by2nam01on0071.outbound.protection.outlook.com ([104.47.34.71]:24955 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754093AbeEaJLS (ORCPT ); Thu, 31 May 2018 05:11:18 -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=5FwwTugS+X+ApDeMBxh9U5d6XPataxVJ0oaWzwWp7Os=; b=I3woDXkC6NU2pk8j3NneU0/Z/HKNSFathYQAf7Ms6897zRPnj5G5YAHk6IREujLA23wsCiaF9zrPtOVHDPZNeyFJUALj3eYxESr1ovy5vNlowqTXRBrI7M1RvpXUkNpgMAX9FksOA6IsqJcf1lMZ63RBd19i177p6a93ASH0Qjs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BY2PR05MB1926.namprd05.prod.outlook.com (2a01:111:e400:58f7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.5; Thu, 31 May 2018 09:11:15 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Andrey Shevchenko , Sergei Maksimenko Subject: [PATCH 1/6] qtnfmac: implement net_device_ops callback to set MAC address Date: Thu, 31 May 2018 12:10:57 +0300 Message-Id: <20180531091102.28666-2-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180531091102.28666-1-sergey.matyukevich.os@quantenna.com> References: <20180531091102.28666-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM6PR0102CA0019.eurprd01.prod.exchangelabs.com (2603:10a6:209:14::32) To BY2PR05MB1926.namprd05.prod.outlook.com (2a01:111:e400:58f7::12) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BY2PR05MB1926; X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB1926; 3:iG/+epux9lDtBkSsJaYUqYGiPw1vh7hKA9SEo6s4eMV4mBVW7vQ4jROeL5LZkqrVKSyVNrqb9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vCM/z2Ep+GLuqKYORgw/DD5AILhITM9YnmAbGSvw9pszOeWgzOSS56WOPK4LxuC0fDE7lfmtb3YMCDRYBESsf3zjDoCHqwiKT4+G/v80CLXm9E0oyv+3VqndP98wPqi+XCZ4bvw3nJ7TQVnNJ72tM+49sKGynDW/eTNC4ELS2/1GiFLfwux8Ox+xsJoTz3HK6/3adB1IFafNgMQMwGZWd0h8pLztgKvluMi1FMfNwIXCYlHL+j9kHL+d6h2epMpJdsXH+gSP1XqJbdITn7anPx1hb53UqHxhPO; 4:plrhYyOusX28xJLODW0L/hf7kYCTaMkFKjlzE/Ll95brJ9jo+fZI+hevkjz1Gq8H17KS7xq2LQTmuso7nHTMtGiobk4caxhIaTlQDmIc8KbD2sxs4ttinbyV8MbfZG5xmTIZtArfGfvf7rG7ziAG0nYcsV5CRCXUDS722xSNavafyQUlb5aWgxnxkrBM3tWWkqAZ50moOFZ2cK8CQo7Y91MIiSh77ycmbIV9lUpqnrKqWfxFa4Ku4Cr2bIqlWY0Qa0WOWd9cFI183WzfA5nPPQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:BY2PR05MB1926; BCL:0; PCL:0; RULEID:; SRVR:BY2PR05MB1926; X-Forefront-PRVS: 06891E23FB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39850400004)(396003)(39380400002)(346002)(199004)(189003)(52116002)(2906002)(68736007)(6116002)(6916009)(48376002)(3846002)(11346002)(2351001)(106356001)(7696005)(2616005)(476003)(81156014)(53936002)(76176011)(105586002)(956004)(2361001)(1076002)(26005)(16526019)(186003)(386003)(6666003)(36756003)(5660300001)(81166006)(51416003)(8936002)(478600001)(8676002)(54906003)(16586007)(86362001)(6486002)(50226002)(316002)(53416004)(446003)(25786009)(50466002)(69596002)(7736002)(47776003)(486006)(305945005)(107886003)(4326008)(97736004)(103116003)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR05MB1926; 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; BY2PR05MB1926; 23:j+xopT13qSSPJToJ+SaR/uCi/cLJ9f2nk7ePicHaP?= =?us-ascii?Q?ls2cFBNcWdr79vO46Ni1GMoLVvItI5hi4/o5CKA96YilTMAsKFvVuwaa9ifX?= =?us-ascii?Q?qMiXiBaStrjKmGq+swYjRaR7zRVCRA8pYmyfkGWuuZobbXWvJbNjcxxr9rlq?= =?us-ascii?Q?DZ2445Hugfb12px2lYYbg7e/JoQrrxikTiPmHOp3acwcM87cEgZdKVLsJuL/?= =?us-ascii?Q?9fXIQEAcPOgXun/zKl2CBIC6RrdtwmMlZzTck2oiswkUVBVAT65GNQ5BmNGY?= =?us-ascii?Q?Z/wJVE9Ts1EPkSlEhTw3xRMWzmkjI3ICR3MMQ1F9OEFsR5JwSsUsyOjDx+eM?= =?us-ascii?Q?SBbKpHpe+SqBn9S472LdqBAEywBtnrAV87CuAfuk+0+tZstqKQtF+bbPO8hl?= =?us-ascii?Q?W3mtw8QeIxmb7TGj68/WEeKYLoseGJduZsImjItmtcOn9w+ZURNVhn38Lk6q?= =?us-ascii?Q?qTlb11rfFyxI/4RHNnGf8OEM4nPTQtfyGWkip0GROP+EghKAuZZU5NJ5HZHo?= =?us-ascii?Q?whL/4/7HWHdngWxSDYmPZ0NJreCjCNLwIG+cA/o0ZVYl2rLsqO8o2bxM3Zbz?= =?us-ascii?Q?hhmXswk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McekkJDj1OllC7yTUpeV11hXEI+DacOxfHtC9B5HP4MRNOfxeKRWn2SeqfipGQwt+875loYsoHs5DbzIURKa1eZaCkF6pjGLE8OXktAghlQxck6l9p2s X-MS-Office365-Filtering-Correlation-Id: 94d4c505-e397-4ce8-f46a-08d5c6d67722 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2018 09:11:15.5134 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94d4c505-e397-4ce8-f46a-08d5c6d67722 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR05MB1926 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 Implement net_device_ops::ndo_set_mac_address callback to allow for setting interface MAC address. Implementation is done through existing CHANGE_INTF firmware command. All validation is to be done by firmware. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/core.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index a6a450984f9a..c318340e1bd5 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -179,6 +179,30 @@ static void qtnf_netdev_tx_timeout(struct net_device *ndev) } } +static int qtnf_netdev_set_mac_address(struct net_device *ndev, void *addr) +{ + struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev); + struct sockaddr *sa = addr; + int ret; + unsigned char old_addr[ETH_ALEN]; + + memcpy(old_addr, sa->sa_data, sizeof(old_addr)); + + ret = eth_mac_addr(ndev, sa); + if (ret) + return ret; + + qtnf_scan_done(vif->mac, true); + + ret = qtnf_cmd_send_change_intf_type(vif, vif->wdev.iftype, + sa->sa_data); + + if (ret) + memcpy(ndev->dev_addr, old_addr, ETH_ALEN); + + return ret; +} + /* Network device ops handlers */ const struct net_device_ops qtnf_netdev_ops = { .ndo_open = qtnf_netdev_open, @@ -186,6 +210,7 @@ const struct net_device_ops qtnf_netdev_ops = { .ndo_start_xmit = qtnf_netdev_hard_start_xmit, .ndo_tx_timeout = qtnf_netdev_tx_timeout, .ndo_get_stats64 = qtnf_netdev_get_stats64, + .ndo_set_mac_address = qtnf_netdev_set_mac_address, }; static int qtnf_mac_init_single_band(struct wiphy *wiphy,