From patchwork Tue May 26 17:18:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 218501 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49A02C433E0 for ; Tue, 26 May 2020 17:19:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D43A2073B for ; Tue, 26 May 2020 17:19:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="HXKvEoFZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389135AbgEZRTZ (ORCPT ); Tue, 26 May 2020 13:19:25 -0400 Received: from mail-bn8nam11on2083.outbound.protection.outlook.com ([40.107.236.83]:48578 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388874AbgEZRTT (ORCPT ); Tue, 26 May 2020 13:19:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XCZrc7yv4RENxcbg01cUSfVLI+OZN/0VfoUI+gwFoyKSE1wcql1fSq4WeNMW/ZkDxo6ZURwDBc+XeQHtfSBkPA2cGNhtFeDHu5OIClkfAHYIAtD3Glfar7Og22noa6rpk9RWJAL4WQfy0nv+RQGQPYIyDEPPcZbI5uupPcTVtxS+jWxxcIjbKVT7IEQ2FGgyJ34+2Iqrc3KrL281iIZX278l/i3nn4c61rSXCZ4OTbLuOrgdFOedoPp6ndttya0GXfR7Ht1HPl5dX//E53iCYFVZAjq7diQviZy4aOxGdpsAuK3iiWe6O5mN/8fNeaqvUJDOQunjJPaE/83aWxPIZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GElZCByPklEnoQ8Cdo2ms75WRk4lBT8yiCJV32eEMDs=; b=kKs6NnNWHtfUPvFsRUitGYjtWGivR/1phAFAfeWGT+vHjAK2I8sAqL/Vi81+hMYs95XyiI2hrTlOx1Eyw+gIh6LMuvFMUq2tvAQep51j8GmKOkrRnQ1QVkIjVZxLdiPqcPFywW1eXCMil6l15tPImH9QIZkTKeKHO6eJFFCU/c7QvuRPv+fZzN2ZbLqj7zezNLlEFxgRb1xbtRj+g8FKp9VstzHTuqZAB3vmNCAZZIsxDPMOgDAvsFemWrZWyHT7gPAd5K+Da9Ktu8UsB8EB5y4ULZ1zH42YOm6pMJyov1MhSYzngsJmzDixET+P5tHJa+v4X9B0DqCnw0lP3F58RQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GElZCByPklEnoQ8Cdo2ms75WRk4lBT8yiCJV32eEMDs=; b=HXKvEoFZ+DmgbaEwvrEPUdzvSarppuPxF9Ylc5IqxVATXZ52Hw2+jZdhXP/xC0ZoEZWVvrAUq3Nu1cnSpjpCz4axCJq0AjCSAftP/zQGWikn23w/i/b3dyhqvzeTmAG6rciZwxDBLNpbDdt1VrqpNXWGQlVYXjuaBnpGAPkFf9A= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none; driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) by SN6PR11MB2750.namprd11.prod.outlook.com (2603:10b6:805:54::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.25; Tue, 26 May 2020 17:18:57 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::c504:2d66:a8f7:2336]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::c504:2d66:a8f7:2336%7]) with mapi id 15.20.3021.029; Tue, 26 May 2020 17:18:57 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH 10/10] staging: wfx: allow to run nl80211 vendor commands with 'iw' Date: Tue, 26 May 2020 19:18:21 +0200 Message-Id: <20200526171821.934581-11-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526171821.934581-1-Jerome.Pouiller@silabs.com> References: <20200526171821.934581-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR1PR01CA0007.eurprd01.prod.exchangelabs.com (2603:10a6:102::20) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.home (2a01:e35:2435:66a0:544b:f17b:7ae8:fb7) by PR1PR01CA0007.eurprd01.prod.exchangelabs.com (2603:10a6:102::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.17 via Frontend Transport; Tue, 26 May 2020 17:18:55 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [2a01:e35:2435:66a0:544b:f17b:7ae8:fb7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 469e27ff-2d0a-4bdb-287f-08d80198df6c X-MS-TrafficTypeDiagnostic: SN6PR11MB2750: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:220; X-Forefront-PRVS: 041517DFAB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 36udSgpgpoOqIZ8zH9GZ+plAMD9dD8KsbqJkbww7Iw4e+uCIc4o2VRqncR8JbizYmpvR/r9FetdLJis4sMMBK/v0nkplhQehpOx89JttHNwrUU2ZMLjqfKepPDOzx2PiaJJhkvUGDWPljLNC7Aec1g+BL0PdwnEFpUGPQTd6PuS3slPrv4H6a19NEy9lzhtkAu7i4b1PrcFQfWYFbNiNOhmIVnn7Z+HCF1ErTQyyAocId+PO54Bie1CUEplPCE5x2iLXxACKMdxOPSQntwwLoGn1qtXEJ0vHgE68biN2hYgYCP4atCqRfrT5OfjWkJUv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB2718.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(396003)(376002)(366004)(39860400002)(136003)(346002)(4326008)(6512007)(316002)(8676002)(8936002)(2616005)(6486002)(2906002)(107886003)(1076003)(86362001)(6666004)(186003)(16526019)(5660300002)(66574014)(36756003)(54906003)(66556008)(478600001)(8886007)(6506007)(66946007)(66476007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eW0X11/5NdJVp/L4tPsi5E49ykg/A4QckvE3A9nCGKT2P4aDXu6pzFOAneEH9IDSaXSKJsJDnSJXRTg2TxxNHkDTKd21kD0LKlHj0W6KhNfgqv+qh2A3Pj1UBFL964NIPXKd4bYSZQ+KiQcxR9c4nInOmSN++ic2oJlth1LtxCjY1L6gbv3tZ7veHsmhn7kFLBDPl/6fA9LomakmHds0vrJ8cRVuzfjcMbHWR5Ij/LpA86H7Dvdwvzs4l0ELzjnRDE5105LWzfERdshGxirwdQY7/hU+HKyyW759CMPQfu4SHvNLmyXHF8Xf+pSBub75+zibUyf/v4PCg21lTS46Ng0aFv4U8Z0iAwyyS93zQmjsIrEDzU/1yyXJ6E0W3V5hk66ZqRKJOR59oYvhyWIzBTd2UmCToChhotg6+fo1louMHgAOCt90rirKOdtCW82xkp0GmyCF9+RWG4V/shv3VYAV3puH4foOGd591X2EMp5AqVZXlG2Nxh23VBxUzX7DeqHX/tPGnCmJk/iuL+opsaLkBLR9p+Y69i3pNS6BA54= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 469e27ff-2d0a-4bdb-287f-08d80198df6c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 May 2020 17:18:56.9508 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QS6X02ty43r+ZuKDqxZ7ukRsJnf6Zf6CT41EZyDxkfDUCENdsCjmPp5wnGT07rkbuOpGOJVelJA1rOwqsGF4Bg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2750 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller In current code, the nl80211 vendor extensions provided by the driver use the new API[1]. It requires to pack the netlink attributes into a NLA_NESTED. Unfortunately, it is not the way the command 'iw vendor' works. This patch, add extra vendor commands that can be called with 'iw vendor'. [1] see commit 901bb989185516 ("nl80211: require and validate vendor command policy") Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/nl80211_vendor.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/staging/wfx/nl80211_vendor.h b/drivers/staging/wfx/nl80211_vendor.h index 0ff3bf73f0ad3..b805b4aa951a0 100644 --- a/drivers/staging/wfx/nl80211_vendor.h +++ b/drivers/staging/wfx/nl80211_vendor.h @@ -23,8 +23,11 @@ int wfx_nl_pta_params(struct wiphy *wiphy, struct wireless_dev *widev, enum { WFX_NL80211_SUBCMD_PS_TIMEOUT = 0x10, + WFX_NL80211_SUBCMD_PS_TIMEOUT_COMPAT = 0x11, WFX_NL80211_SUBCMD_BURN_PREVENT_ROLLBACK = 0x20, + WFX_NL80211_SUBCMD_BURN_PREVENT_ROLLBACK_COMPAT = 0x21, WFX_NL80211_SUBCMD_PTA_PARMS = 0x30, + WFX_NL80211_SUBCMD_PTA_PARMS_COMPAT = 0x31, }; enum { @@ -53,18 +56,37 @@ static const struct wiphy_vendor_command wfx_nl80211_vendor_commands[] = { .policy = wfx_nl_policy, .doit = wfx_nl_ps_timeout, .maxattr = WFX_NL80211_ATTR_MAX - 1, + }, { + // Compat with iw + .info.vendor_id = WFX_NL80211_ID, + .info.subcmd = WFX_NL80211_SUBCMD_PS_TIMEOUT_COMPAT, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV, + .policy = VENDOR_CMD_RAW_DATA, + .doit = wfx_nl_ps_timeout, }, { .info.vendor_id = WFX_NL80211_ID, .info.subcmd = WFX_NL80211_SUBCMD_BURN_PREVENT_ROLLBACK, .policy = wfx_nl_policy, .doit = wfx_nl_burn_antirollback, .maxattr = WFX_NL80211_ATTR_MAX - 1, + }, { + // Compat with iw + .info.vendor_id = WFX_NL80211_ID, + .info.subcmd = WFX_NL80211_SUBCMD_BURN_PREVENT_ROLLBACK_COMPAT, + .policy = VENDOR_CMD_RAW_DATA, + .doit = wfx_nl_burn_antirollback, }, { .info.vendor_id = WFX_NL80211_ID, .info.subcmd = WFX_NL80211_SUBCMD_PTA_PARMS, .policy = wfx_nl_policy, .doit = wfx_nl_pta_params, .maxattr = WFX_NL80211_ATTR_MAX - 1, + }, { + // Compat with iw + .info.vendor_id = WFX_NL80211_ID, + .info.subcmd = WFX_NL80211_SUBCMD_PTA_PARMS_COMPAT, + .policy = VENDOR_CMD_RAW_DATA, + .doit = wfx_nl_pta_params, }, };