From patchwork Mon Apr 20 16:03:03 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: 220941 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, 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 46367C54FCB for ; Mon, 20 Apr 2020 16:04:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1EE9C20775 for ; Mon, 20 Apr 2020 16:04:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="emiCZB7Q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729389AbgDTQDx (ORCPT ); Mon, 20 Apr 2020 12:03:53 -0400 Received: from mail-mw2nam10on2061.outbound.protection.outlook.com ([40.107.94.61]:6055 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729034AbgDTQDu (ORCPT ); Mon, 20 Apr 2020 12:03:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pu6rmvG9FngW2RMdYdVCT1tYOsax5Tb3irHutRrpqpk65hT29ZWp9vZs5SYo1QeqmPth5eeMXaSe9Yz7fG6NZnCB6FMkOVBDZTkOCjJoWHeP9X7G1OpP3YhFWJTbwfKkwXC4R7bO+iZlC8DM3o/A0pL7CheBj7JVJxQJEuRbKIImC8NjEExTCn3MsENK9Qc59u2wPEdf2gyZ7pokYi8SOxFdad0fDFkEmpXJyoiCQJC4cTGgOkD7KK9Qo5PfdM3c9b/SjIvN9pMvKfvHQKX1GrVBB1JOU0K1Q5JCIu/IJQdrBFac5IZeUt2FK1PcGzXRE7i5J8OBBt65HLFufHNaUA== 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=l70JogB9AaE6R6l9OLobf5gNGV2JilUclRV6+SgLLhM=; b=XPABDJ7nfioAaMokHF4JlQPBnUEiMYWO6j7XtGM9e9sjGj1Lf3gph6xRsHjWRCrhyGM4mR+Mbj+IhNDhrYrcpePg0pkJYgSoX9ekBrywLsylFCiUJLEjQGL0kcFr3JVSK4i0G2DMkiQSz44lfkxpGBnpagAPqxxwzJKjpWnqPagC0GddoOHApC+ex+IKp6fN4llIFC2ihyAXFKlazfDRMQ4unsl0qQ59pV3KgfDNHQlx8W8WmurX6ruaqVq2rMs8YdYHK6k9Jb+C93otkZ+U5wKyk1eiDXpUptz/ECs+QTrdsO3C28kAbX7TlOgofJBbogg+sRyqnjA6diS+hRx7nA== 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=l70JogB9AaE6R6l9OLobf5gNGV2JilUclRV6+SgLLhM=; b=emiCZB7Q8NVP/ZI2ycPpiaKnzzjcOgx1Tvj71BcYUS3R77r1jTGKNlcgx93YDU4Gh3RnpAXcnca1HLnDzPrHmAbXPXxZ59YtaGgEMugGj71xOlbSaW4OsvGOsdsg0vgm62iErpM26u67wajBQUYUml7OyhdqOBbCBfw6IBV+r1Q= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; Received: from MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) by MWHSPR00MB249.namprd11.prod.outlook.com (2603:10b6:300:68::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25; Mon, 20 Apr 2020 16:03:45 +0000 Received: from MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::81d5:b62b:3770:ffbe]) by MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::81d5:b62b:3770:ffbe%10]) with mapi id 15.20.2921.030; Mon, 20 Apr 2020 16:03:45 +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 08/16] staging: wfx: simplify hif_set_bss_params() Date: Mon, 20 Apr 2020 18:03:03 +0200 Message-Id: <20200420160311.57323-9-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200420160311.57323-1-Jerome.Pouiller@silabs.com> References: <20200420160311.57323-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: DM6PR07CA0065.namprd07.prod.outlook.com (2603:10b6:5:74::42) To MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.silabs.com (2a01:e35:2435:66a0:544b:f17b:7ae8:fb7) by DM6PR07CA0065.namprd07.prod.outlook.com (2603:10b6:5:74::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.26 via Frontend Transport; Mon, 20 Apr 2020 16:03:43 +0000 X-Mailer: git-send-email 2.26.1 X-Originating-IP: [2a01:e35:2435:66a0:544b:f17b:7ae8:fb7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b811b26b-b4bc-4264-25d8-08d7e544676b X-MS-TrafficTypeDiagnostic: MWHSPR00MB249: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-Forefront-PRVS: 03793408BA X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1775.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(136003)(366004)(376002)(396003)(39850400004)(346002)(8676002)(7696005)(52116002)(6666004)(4326008)(8936002)(81156014)(66556008)(66476007)(66946007)(36756003)(186003)(54906003)(16526019)(107886003)(478600001)(2906002)(316002)(66574012)(1076003)(86362001)(6486002)(2616005)(5660300002); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: silabs.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9An8SdGPqyeOGQtmpiowlgVhnWGL4VnT0YcP1Rgx83NJY8P2hGzyylxgfcNoAvyWliYygQ1XOru6/LkXYfK+VBIin25aRIXpybmdw4l5SpvQvEBS7TD4OqlkCOhbB0rAO+065WbPBXdz0ibID1t4i1vlW35ZpJneh8DW1bIW02B4AqTMNdXQtZAuCNsFeyraffffc4ql0d3pbAxggzQasgiQsgxYVJuVdYo1DSLMST77zSWPCE+Tm7GiC8IQOR0WjxtKCdoAuHbm3xY8vH7MBpmVAh1V2W6NMwj38FYXqiU0OhzKHplMiAP9KJqt5o408c5sa0MoiDXeUoEyPADZAY3qrqSe98hPBuhFm+wqRbZWH8HZHeJkiKlrxTOgbQRdjcjMR2fsF1jn32JZh7WeiV/JP+di7okbWM3RAXjXVXtpRWgUzL9hRJHmXvXnumwD X-MS-Exchange-AntiSpam-MessageData: NK+rS6zkyaWLH2XfPf++3e3QsgruV99K+PijUrDL73l7cV79CSefjxyaJLtx9P8E6twuC32ZreEJDFI//6Sm3WJPeWcLc5KUUSJSZsT0xtmWbSSVOwxk0aoDHjwwgEIxyum+bhz0Ouo8frfj2NPrUFRW1n4fF+CZfFEgRq9rZjxRkB04HDoSWiexCRFPil52AfscxdTtdjMqbILVTp7W3UGsrG1+hUu9dG17BVY9a+pKLisoH4o+APejO+dC7twOQfk05RrjnsKehmZOJ0stc0bIz2JfvfGm6T7TiMC+iKH+cAnhe0+kppRnPx3qMD4VkfGIN8tkEQKco9yhiiD1hLaEg878faOznhIqqTeaVB6xpnbjKuB8wC6m08tBxnF3r2vjyXuKfPMIjamp8CqEY3YBfELdtNSc5dyPSqcbyFNu1FwnsZAuK8yjxQSwYKUni9+AFONj7Ve+FK1jrmV44Mwk1t/PNb1Vot4HPV6p0HWEd7m4dylm1ymByhxPhoa603lTyxvPOdo7Na7FmpgP64Rwfb2kNbtngxm3F1Y9l4TX0dliBRiV1X0pV4HdXCh8+9acgTzQaCdcLBxNTbKWJRhDQ9tbUAQAHALNI0EjJTXbc2JDTFNObeJMih5y9gO2C/2qS6pS24T9I1jxxcxI/ODiICH4d7QNWsYK8VUL5CSWK+zNHvT8MNZX3aqUNM8NJfCEZ2yYtlUTJjjjsN6O1ReMxFaLxkeKWqv6Rqdherx6cFRRG3U8X8bxrsBYQAylPIypDdv7UWncx9Iq2VxLyaKXRF166txqSU+RLwyOPVc47819YnHE8jgY5l62/Epbh6OlOFgVoLfXzjUF/wP/s4MXBnudsbjf2XqFNKB4WYY= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: b811b26b-b4bc-4264-25d8-08d7e544676b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2020 16:03:45.5464 (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: LUpqtIRDnyPAbUEQrOahzkJQrO4pdApRcsbEP3X7ARNm/gZ2cpaAIm/vTq0U7JR94DEk7TgE79f4AUR0EIracw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHSPR00MB249 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller The structure hif_req_set_bss_params come from hardware API. It is not intended to be manipulated in upper layers of the driver. In add, current code for hif_req_set_bss_params() is too dumb. It should pack data with hardware representation instead of leaving all work to the caller. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_tx.c | 12 +++++------- drivers/staging/wfx/hif_tx.h | 3 +-- drivers/staging/wfx/sta.c | 11 +++-------- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index f49ab67e1a6d..17721cf9e2a3 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -321,17 +321,15 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, return ret; } -int hif_set_bss_params(struct wfx_vif *wvif, - const struct hif_req_set_bss_params *arg) +int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count) { int ret; struct hif_msg *hif; - struct hif_req_set_bss_params *body = wfx_alloc_hif(sizeof(*body), - &hif); + struct hif_req_set_bss_params *body = + wfx_alloc_hif(sizeof(*body), &hif); - memcpy(body, arg, sizeof(*body)); - cpu_to_le16s(&body->aid); - cpu_to_le32s(&body->operational_rate_set); + body->aid = cpu_to_le16(aid); + body->beacon_lost_count = beacon_lost_count; wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_BSS_PARAMS, 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 f8520a14c14c..038ea54e2574 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -48,8 +48,7 @@ int hif_stop_scan(struct wfx_vif *wvif); int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, struct ieee80211_channel *channel, const u8 *ssid, int ssidlen); int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout); -int hif_set_bss_params(struct wfx_vif *wvif, - const struct hif_req_set_bss_params *arg); +int hif_set_bss_params(struct wfx_vif *wvif, int aid, int beacon_lost_count); int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg); int hif_remove_key(struct wfx_dev *wdev, int idx); int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue, diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 6cdb40a05991..1cc437f0bc81 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -470,16 +470,11 @@ void wfx_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) static void wfx_join_finalize(struct wfx_vif *wvif, struct ieee80211_bss_conf *info) { - struct hif_req_set_bss_params bss_params = { - // beacon_loss_count is defined to 7 in net/mac80211/mlme.c. - // Let's use the same value. - .beacon_lost_count = 7, - .aid = info->aid, - }; - hif_set_association_mode(wvif, info); hif_keep_alive_period(wvif, 0); - hif_set_bss_params(wvif, &bss_params); + // beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use + // the same value. + hif_set_bss_params(wvif, info->aid, 7); hif_set_beacon_wakeup_period(wvif, 1, 1); wfx_update_pm(wvif);