From patchwork Mon Apr 20 16:03:05 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: 220940 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 03139C54FCB for ; Mon, 20 Apr 2020 16:04:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6DFF20775 for ; Mon, 20 Apr 2020 16:04:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="VAdgMxnA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729627AbgDTQEN (ORCPT ); Mon, 20 Apr 2020 12:04:13 -0400 Received: from mail-bn8nam11on2081.outbound.protection.outlook.com ([40.107.236.81]:58834 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729516AbgDTQEI (ORCPT ); Mon, 20 Apr 2020 12:04:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gz+Zn+oNBJL3CZHylf1NrXsxqPeH5yA0LU6ykHsHwFFd2rmGI7aj4Kvy7dosDcjRT/B3VozQy68Guz3sNPw84bdkrdKeQ/coMF9+++9++GtG4FbGQ3sJuxCk0SMGxSXyV7MCeTTU1BpPAK/QaUHQacCK+VzBwc80LY6VYJvkhpn/v6lebU5kL+db0M+tTQo90dgGONtkMwHL2XEY0Jf5SFZUfBvk+4mR1EfZTZYzuCMveQRXqjMtdbRUfDaKLEFtjth5alY0RIXtap6NV0KsUk9SZVJO8nVmJ8OTLnxGfamXAyVj4cIyaNyFKqSVKzrQe7ET3khGYs2rBDZELKL5pg== 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=s/fe2EPye3TxLdUjir7fkQWmAuOO7PeGw/P+52PQOIk=; b=f8xlZHiNxmj8e5rfAHx+IeyamegUrsIVZNr99xYLUQRU+I2I1EsosV0cILxyd1vHknq8Fgb21506K0Fz8Ocd163wwMbLAb92g271t5Kl0oPSiyC410oRlz284nRaTKV3wzif24UfyVv2ms8K/v3XLe81A8Jl33r56I/r+Xvs4Gr+LvPcOHd5p85Dmn1aY+juX1gRGIXDCOK5qLSxHGmsYaSmuq/PnT/sAUfPpNERMCxYkbmGrOaac9hunKJGDw8eUnhCUSQW/J2DNqN4fqhTeq02v7e/6X1maqYfDI5ZZwV/Xwf5NLDkAse8aR94iwuEwqNu9Ph6LBxWBLe+ECeBKQ== 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=s/fe2EPye3TxLdUjir7fkQWmAuOO7PeGw/P+52PQOIk=; b=VAdgMxnAgGb7VhmxU2IuawFx1Ama0KdEafY1G2+JjBhp7LWll8ja3HXUmOz0WT1WWP2WhTZsGjpXlkWc5jjCHipmcrKQZ0CSA23ZyhBky0ByL3TRG2C7cwmSuAHdHPIH/StzCbL2HbU/E3CZsb4BZ1fFkL5Ygv5SgnAM0NvPeKk= 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 MWHPR11MB1792.namprd11.prod.outlook.com (2603:10b6:300:10b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Mon, 20 Apr 2020 16:03:50 +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:50 +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/16] staging: wfx: introduce wfx_set_default_unicast_key() Date: Mon, 20 Apr 2020 18:03:05 +0200 Message-Id: <20200420160311.57323-11-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:48 +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: cc6a231f-9de3-4c87-ebe8-08d7e5446a09 X-MS-TrafficTypeDiagnostic: MWHPR11MB1792: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1728; 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)(39850400004)(346002)(376002)(366004)(396003)(136003)(66476007)(66556008)(186003)(66946007)(4326008)(86362001)(16526019)(107886003)(6666004)(81156014)(7696005)(478600001)(52116002)(8676002)(66574012)(54906003)(316002)(6486002)(1076003)(2616005)(36756003)(8936002)(5660300002)(2906002); 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: Zb7uyjdtE3mHKE/2Pw4ZFz8DkyzSN/L5hLKzUL3jaIaIYkkfoPSIsuIGfjYSg/P70wk71lJagl7SqPffG2jqsVnd/7xXTHnPtPzEaosDz+esYKz8D/apVkbCty5nIuGSa9k16xv4DqxyjZQGMUYeFWa5Fv6tfDrXJ0NTa0w1a+q0O2pXr/J0gZZfjmMtBNMkjQrDAoA7F8nfW9yw4vVAFjTIgqTLUCixgvAQXIbSWgJ7/usbsr73x6CT53BKCGcjLlxtISPyZVg1SiBmJ8yJbE+i0Q6PZd0itk7y+fpGDVMlXveWCjbBlAnel5yfjn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Network-Message-Id: cc6a231f-9de3-4c87-ebe8-08d7e5446a09 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2020 16:03:50.3952 (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: jetWrDLqWvD//sIfFVc6ZNB2EAOJZpwNvnRjgRANhF5MZ88+0rEtGdiKZ67qa7xNmnxBXN0vNa0tq7Gc3yHwsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1792 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller Currently code handle WEP keys manually. It is far easier to use the set_default_unicast_key() callback provided by mac80211. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/key.c | 10 ---------- drivers/staging/wfx/key.h | 1 - drivers/staging/wfx/main.c | 1 + drivers/staging/wfx/queue.c | 33 --------------------------------- drivers/staging/wfx/sta.c | 18 ++++++++---------- drivers/staging/wfx/sta.h | 2 ++ drivers/staging/wfx/wfx.h | 4 ---- 7 files changed, 11 insertions(+), 58 deletions(-) diff --git a/drivers/staging/wfx/key.c b/drivers/staging/wfx/key.c index 7b79b6175372..e3853cbf431c 100644 --- a/drivers/staging/wfx/key.c +++ b/drivers/staging/wfx/key.c @@ -257,13 +257,3 @@ int wfx_upload_keys(struct wfx_vif *wvif) return 0; } -void wfx_wep_key_work(struct work_struct *work) -{ - struct wfx_vif *wvif = container_of(work, struct wfx_vif, wep_key_work); - - wfx_tx_flush(wvif->wdev); - hif_wep_default_key_id(wvif, wvif->wep_default_key_id); - wfx_pending_requeue(wvif->wdev, wvif->wep_pending_skb); - wvif->wep_pending_skb = NULL; - wfx_tx_unlock(wvif->wdev); -} diff --git a/drivers/staging/wfx/key.h b/drivers/staging/wfx/key.h index 9436ccdf4d3b..2c334f9fb2a8 100644 --- a/drivers/staging/wfx/key.h +++ b/drivers/staging/wfx/key.h @@ -17,6 +17,5 @@ int wfx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key); int wfx_upload_keys(struct wfx_vif *wvif); -void wfx_wep_key_work(struct work_struct *work); #endif /* WFX_STA_H */ diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 8a2c96dacd63..cc7f924f3106 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -145,6 +145,7 @@ static const struct ieee80211_ops wfx_ops = { .set_tim = wfx_set_tim, .set_key = wfx_set_key, .set_rts_threshold = wfx_set_rts_threshold, + .set_default_unicast_key = wfx_set_default_unicast_key, .bss_info_changed = wfx_bss_info_changed, .prepare_multicast = wfx_prepare_multicast, .configure_filter = wfx_configure_filter, diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index e9573e9d009f..2f6f9faf15be 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -254,36 +254,6 @@ bool wfx_tx_queues_has_cab(struct wfx_vif *wvif) return false; } -static bool wfx_handle_tx_data(struct wfx_dev *wdev, struct sk_buff *skb) -{ - struct hif_req_tx *req = wfx_skb_txreq(skb); - struct ieee80211_key_conf *hw_key = wfx_skb_tx_priv(skb)->hw_key; - struct ieee80211_hdr *frame = - (struct ieee80211_hdr *)(req->frame + req->data_flags.fc_offset); - struct wfx_vif *wvif = - wdev_to_wvif(wdev, ((struct hif_msg *)skb->data)->interface); - - if (!wvif) - return false; - - // FIXME: identify the exact scenario matched by this condition. Does it - // happen yet? - if (ieee80211_has_protected(frame->frame_control) && - hw_key && hw_key->keyidx != wvif->wep_default_key_id && - (hw_key->cipher == WLAN_CIPHER_SUITE_WEP40 || - hw_key->cipher == WLAN_CIPHER_SUITE_WEP104)) { - wfx_tx_lock(wdev); - WARN_ON(wvif->wep_pending_skb); - wvif->wep_default_key_id = hw_key->keyidx; - wvif->wep_pending_skb = skb; - if (!schedule_work(&wvif->wep_key_work)) - wfx_tx_unlock(wdev); - return true; - } else { - return false; - } -} - static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) { struct wfx_queue *sorted_queues[IEEE80211_NUM_ACS]; @@ -348,9 +318,6 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) return NULL; skb_queue_tail(&wdev->tx_pending, skb); wake_up(&wdev->tx_dequeue); - // FIXME: is it useful? - if (wfx_handle_tx_data(wdev, skb)) - continue; tx_priv = wfx_skb_tx_priv(skb); tx_priv->xmit_timestamp = ktime_get(); return (struct hif_msg *)skb->data; diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 1cc437f0bc81..876952f39fc9 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -275,6 +275,14 @@ static void wfx_beacon_loss_work(struct work_struct *work) msecs_to_jiffies(bss_conf->beacon_int)); } +void wfx_set_default_unicast_key(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, int idx) +{ + struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; + + hif_wep_default_key_id(wvif, idx); +} + // Call it with wdev->conf_mutex locked static void wfx_do_unjoin(struct wfx_vif *wvif) { @@ -560,13 +568,6 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, wfx_filter_beacon(wvif, true); } - /* assoc/disassoc, or maybe AID changed */ - if (changed & BSS_CHANGED_ASSOC) { - wfx_tx_lock_flush(wdev); - wvif->wep_default_key_id = -1; - wfx_tx_unlock(wdev); - } - if (changed & BSS_CHANGED_ASSOC) { if (info->assoc || info->ibss_joined) wfx_join_finalize(wvif, info); @@ -757,9 +758,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) INIT_WORK(&wvif->update_tim_work, wfx_update_tim_work); INIT_DELAYED_WORK(&wvif->beacon_loss_work, wfx_beacon_loss_work); - wvif->wep_default_key_id = -1; - INIT_WORK(&wvif->wep_key_work, wfx_wep_key_work); - init_completion(&wvif->set_pm_mode_complete); complete(&wvif->set_pm_mode_complete); INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work); diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h index 767b794fa398..fe728e642cfc 100644 --- a/drivers/staging/wfx/sta.h +++ b/drivers/staging/wfx/sta.h @@ -36,6 +36,8 @@ int wfx_start(struct ieee80211_hw *hw); void wfx_stop(struct ieee80211_hw *hw); int wfx_config(struct ieee80211_hw *hw, u32 changed); int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value); +void wfx_set_default_unicast_key(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, int idx); u64 wfx_prepare_multicast(struct ieee80211_hw *hw, struct netdev_hw_addr_list *mc_list); void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 913b80d024a3..0fa88de64907 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -74,10 +74,6 @@ struct wfx_vif { bool after_dtim_tx_allowed; struct delayed_work beacon_loss_work; - s8 wep_default_key_id; - struct sk_buff *wep_pending_skb; - struct work_struct wep_key_work; - struct tx_policy_cache tx_policy_cache; struct work_struct tx_policy_upload_work;