From patchwork Thu Aug 20 15:58:48 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: 259560 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=-11.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP, 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 1B3CAC433E3 for ; Thu, 20 Aug 2020 15:59:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D51482054F for ; Thu, 20 Aug 2020 15:59:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="TLwMqfHy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729317AbgHTP7o (ORCPT ); Thu, 20 Aug 2020 11:59:44 -0400 Received: from mail-bn7nam10on2087.outbound.protection.outlook.com ([40.107.92.87]:47585 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728475AbgHTP7d (ORCPT ); Thu, 20 Aug 2020 11:59:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hyCCWfLnACE2aMgG5f0Simgf1INKdp+Cz2CMgiNQb8Vx5CIEFf0/++0jci0HXiM89qRUswrWWx91MgZdeEjDdXiTvyTAmVvpY8vMOL33COHE7i4juIbWR3a/vKEP5O2UFD3CwWtSWUSXFzeBcQBjMkw7GK+iCN7pAQq+jVCL7EYbbvGDAKBMN2d/sR74nnqU2yAjclLKM/7BEJuEV75DdIBUv+JUgyzcW9qPnMUpTcMnjaH82bT1DY7tpQ+aR1h/Uq08tHucO1/tIboqEgw/0ETEChrSGc5dFEWlsj/QKpK4IJ21XkXxbJ49zMpeBDKDO4wF6Rx3A+F4svqLz0isqQ== 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=t+vcLlWaLMlEF7GyLv2510d2MIxwweKs9ZMtIGYivEU=; b=FhQBjbaldU2Y5JHDA5Zxo6Bz9vVwzq1WRewbao3a9nxAape/A2cu7kJVgZQK/jWHe7f7doAQAOMomLVLk/9IRY3jgC0xbgHsy6huVf7xCJGbOl41bOoBCvNk0Ff5EkCWX+7nYEhcGPG6IbmGX4V/GRy3jD8Y8rb6+lLqcUbMm55UCdtxZFYEQOZ37PDiBUUhdLlDmUkalyIaQdEfYrCxIWAi4GFmq96hNV5FAS3oXoEygVoQb0n7pDNzrRrBJ2yTif5fn7u7bWFfGgogGV7fFR5wobbvpcMx68sqSDWzwCNm0FHLBRCrOqmdycntlXJQ/0a/01QsRHqNeTMKZE866Q== 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=t+vcLlWaLMlEF7GyLv2510d2MIxwweKs9ZMtIGYivEU=; b=TLwMqfHyuCSKB/URfmOuSnas/dlZrIX2goDzEpX/ROtoubBUBrfgiGn2L9k+XQ9eF2rEaoOsnH/CxNidCFTVry8tXCFmyDdJBBePY378VyDsmfhJg7KbEYUFO7Xk3A/sy2eMTyJ9oQTpQoP8pNZ+B/jnU1JhKa45ddqp7p18Vlo= 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 SA0PR11MB4541.namprd11.prod.outlook.com (2603:10b6:806:94::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.25; Thu, 20 Aug 2020 15:59:25 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6%4]) with mapi id 15.20.3305.026; Thu, 20 Aug 2020 15:59:25 +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 02/12] staging: wfx: improve usage of hif_map_link() Date: Thu, 20 Aug 2020 17:58:48 +0200 Message-Id: <20200820155858.351292-2-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820155858.351292-1-Jerome.Pouiller@silabs.com> References: <20200820155858.351292-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR0P264CA0122.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1a::14) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by PR0P264CA0122.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.24 via Frontend Transport; Thu, 20 Aug 2020 15:59:24 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [37.71.187.125] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2db31cc8-cec4-48b1-355e-08d8452202ee X-MS-TrafficTypeDiagnostic: SA0PR11MB4541: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IGrU4W4uExZlqSwxDuzL0GFdD67uPZ/aOuV1iydKill5/0PEY2xVP8YP2ufJD6zs0jXa5Ywlw4jVMKhLRab0q2jWAZCGBv/sovVALGdxAX9xyj3wYojtRCbWEij6EwY8y/jacLMe+EHbIkY/636I2yWTBZzrDjZahG4bZW+5TcGzptgwjuPyi8LLSe/XnXtQM5ZSRJSb8NuaWnd9rXqIBGh9Au3elzAC0Xn4gNuW0gtJMB3Vkzc9dps37GfMlyXnWKtrSXAsabMlVU/a2sDtf/0zlfoms31anOCGRXibyQSiQc9gLEG+5nBlkdYD4N9XVU0TtdXs4S2et1y0v7nAc2+KxIPmI3Nl+0PYx6OlJpvlmPgv5w0CePBtKeV3e0lL 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; SFS:(376002)(396003)(39850400004)(366004)(346002)(136003)(186003)(6666004)(2906002)(8676002)(316002)(16576012)(54906003)(956004)(26005)(66574015)(8936002)(2616005)(110011004)(52116002)(83380400001)(107886003)(1076003)(5660300002)(478600001)(36756003)(4326008)(66476007)(66556008)(66946007)(86362001)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: JXjtdR2szKhe9Sass+XD7+pcovkQZ23kt7D1TU9FqeZvRZRARr5pxwqASJz6XQ2JRE8hO2ZtIGpB38C2IpmH7c158Q6REV/gdWYi4TonzOXpK0SxKGVB0krjr8zZQ6pLO3Cs0ucmCQA1U1ZzmgHUexEf93f53yvKvErflRACEDsOlrlmGTeSA8pBIZ/QM06irONsKBve1v+UlGioCbHjk9jaMmb+juYTuKn5wW9XOqx3oktKYS27JvpADpLAMMe/n2c6d5u2ovysiAz3H2FM4SE1yoJDqnpEJHwaATu7Gho+Ad7LRdsqld9Qbv0bWYSmsCBxFjf6sJKMHne2DdawbkM+1yMi8hWCpwSm9Ottk95WWPwYQ9d66UIHZLNwfbVGKQzCcDkxDK4aLoa2bmPA6vFOhsrOxxfLU5x8FMWhneMUuAy88ophBA+T/61b46TxhhdsiIYkok5ymp54UIcURx278yx59/XXXXouh3ng9WWHTFfSZfCwICnyo2AChoCvrnlR/+ZUSi7jFbaALLlyqvj70HZ7J4RNWdPcZ7lEWvCch0skUdxUtLSzMO8RKEgntEaH1szrFnPKLAsVbjz8X3tbyv8B0A00f32eFQ53tugitpQlYosccW4k5TGq6citbJ/NUjs0SeQRV3ljnQ9XyQ== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2db31cc8-cec4-48b1-355e-08d8452202ee X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2020 15:59:25.4724 (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: S2g9K8M8cxOyM5yjqPdjT/YJMD2MprV0et7vmqQXSohblWfq9YzP5+E9eHN9KsvIgJcKTHpMpquobxONX0ESfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4541 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Until now, hif_map_link() get as argument the raw value for map_link_flags when map_link_flags is defined as a bitfield. It was error prone. Now hif_map_link() takes explicit value for every flags of the struct map_link_flags. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_tx.c | 5 +++-- drivers/staging/wfx/hif_tx.h | 3 ++- drivers/staging/wfx/sta.c | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 3b5f4dcc469c..6b89e55f03f4 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -499,7 +499,7 @@ int hif_beacon_transmit(struct wfx_vif *wvif, bool enable) return ret; } -int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id) +int hif_map_link(struct wfx_vif *wvif, bool unmap, u8 *mac_addr, int sta_id, bool mfp) { int ret; struct hif_msg *hif; @@ -509,7 +509,8 @@ int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id) return -ENOMEM; if (mac_addr) ether_addr_copy(body->mac_addr, mac_addr); - body->map_link_flags = *(struct hif_map_link_flags *)&flags; + body->map_link_flags.mfpc = mfp ? 1 : 0; + body->map_link_flags.map_direction = unmap ? 1 : 0; body->peer_sta_id = sta_id; wfx_fill_header(hif, wvif->id, HIF_REQ_ID_MAP_LINK, sizeof(*body)); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h index e1da28aef706..b371b3777a31 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -55,7 +55,8 @@ int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, const struct ieee80211_channel *channel); int hif_beacon_transmit(struct wfx_vif *wvif, bool enable); -int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id); +int hif_map_link(struct wfx_vif *wvif, + bool unmap, u8 *mac_addr, int sta_id, bool mfp); int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len); int hif_sl_set_mac_key(struct wfx_dev *wdev, const u8 *slk_key, int destination); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 9c1c8223a49f..d2e9cf651c81 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -434,7 +434,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wvif->link_id_map |= BIT(sta_priv->link_id); WARN_ON(!sta_priv->link_id); WARN_ON(sta_priv->link_id >= HIF_LINK_ID_MAX); - hif_map_link(wvif, sta->addr, sta->mfp ? 2 : 0, sta_priv->link_id); + hif_map_link(wvif, false, sta->addr, sta_priv->link_id, sta->mfp); return 0; } @@ -449,7 +449,7 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (!sta_priv->link_id) return 0; // FIXME add a mutex? - hif_map_link(wvif, sta->addr, 1, sta_priv->link_id); + hif_map_link(wvif, true, sta->addr, sta_priv->link_id, false); wvif->link_id_map &= ~BIT(sta_priv->link_id); return 0; }