From patchwork Wed Apr 1 11:03:45 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: 1265143 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=silabs.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-silabs-onmicrosoft-com header.b=lAofxLOU; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48sk151wjsz9sT9 for ; Wed, 1 Apr 2020 22:07:05 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732427AbgDALFI (ORCPT ); Wed, 1 Apr 2020 07:05:08 -0400 Received: from mail-bn7nam10on2089.outbound.protection.outlook.com ([40.107.92.89]:6053 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732340AbgDALFD (ORCPT ); Wed, 1 Apr 2020 07:05:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dUggNedVJ+sVHIYFUlwo3g/wIPv75/NJvvRyuLgRtYOvwf/8Gp9HDZTJMCx4xj/AkG1hpK6eMndDt0WSeacGin/CVvVAzjYnik8HVxg/0N0grzr0OeBxJLndOWp1HTNKG4Ht43syfFpuRu3NL5ts8aOraKvHfIuq5KSQnKcxsIC4Ut9mhEVUHEOKKlHMz2II2TsJVPtp7qgbsUGUf7RCHI0Y8ajZfuS9IaIXDyr+tgM9gidkm1aep4o261b6Ii3cvpd/BKd1rEpeRbK0laMbrUZQqizt8z/8aqZaVhFvNWiYiYGEYpd99riyKmYgVfMa+UUv07ac1C+Dbjc4uY1F6g== 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=xGXthnG62b5pCXPBtCRPeBP56iQOekkiutIOkUU8cEM=; b=ZNEHN3QGLsv6O4tqQ9/6jCvUyFkTfMQaJAhqVlCUG8lFS7q0AeO9IbASjV6XnNTRn4y40fgf/cRrSkqtRi5oRJyj3iiAQhul03SIqxhXMP+MTouVy+J0K1/ShUBmQVGT9Im3/81THiW8oEiZ9w1oc9EkptEet4vkzI+hIsnKZg26tpoT/aZZ9egqgSNoGhiGeVVKnEUR+EQhkY1cVzAddZGQ2pvobrdAkKPTARy2jolOfnJtzk0M3e6FNrO8d8QPN4Wu7QatpC0JVwpb0uMVEkCWjIHo1NaNnAstqqJdo5cu5QpUzAgyoygOT+k3+m5feAUqVcXKuHOQ0rHP9qczbg== 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=xGXthnG62b5pCXPBtCRPeBP56iQOekkiutIOkUU8cEM=; b=lAofxLOUJZfB52BdnVokvr03BI32LZm5WyxztVTTHga+stpeaOVbqNg6+KW11S3LygOYqKRCFzBcPGj+mABXeANW8LLXtrpjNBC9lc4D3f8+zUO7VNW/FzaHAZUYRporetnNXcFfoCvsoL0WfsLhjVGGikHJmDedASfz5xHYUm4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; Received: from MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) by MN2PR11MB4285.namprd11.prod.outlook.com (2603:10b6:208:191::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Wed, 1 Apr 2020 11:04:44 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::ade4:5702:1c8b:a2b3]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::ade4:5702:1c8b:a2b3%7]) with mapi id 15.20.2856.019; Wed, 1 Apr 2020 11:04:44 +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 12/32] staging: wfx: drop useless sta_asleep_mask Date: Wed, 1 Apr 2020 13:03:45 +0200 Message-Id: <20200401110405.80282-13-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200401110405.80282-1-Jerome.Pouiller@silabs.com> References: <20200401110405.80282-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SN4PR0501CA0156.namprd05.prod.outlook.com (2603:10b6:803:2c::34) To MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.silabs.com (2a01:e35:2435:66a0:1265:30ff:fefd:6e7f) by SN4PR0501CA0156.namprd05.prod.outlook.com (2603:10b6:803:2c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.9 via Frontend Transport; Wed, 1 Apr 2020 11:04:42 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [2a01:e35:2435:66a0:1265:30ff:fefd:6e7f] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9e84e1fc-754c-4f3d-8df6-08d7d62c7bdd X-MS-TrafficTypeDiagnostic: MN2PR11MB4285: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 03607C04F0 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB4063.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(136003)(366004)(346002)(376002)(39850400004)(396003)(7696005)(8676002)(1076003)(16526019)(186003)(5660300002)(86362001)(4326008)(66574012)(52116002)(478600001)(66946007)(66476007)(54906003)(36756003)(8936002)(316002)(81156014)(6486002)(2906002)(66556008)(107886003)(81166006)(2616005); 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: l7a1zBzCVnUl7PWYqtXWEwvmbgjixFnZ5lHHQ5T3lzYAyTkmikqrdyYU6nlRiiF+9qFh5oBbVcKqfocQDxDpffB/BElRwf7mOci6wCtevMKPcBDRSSi+8rVkqyoG+0aFrMhTFIdVFMrxjbgh1HmAYPKNT9lKzDs4qQaCPtMBpttZTePzldbLRpFj4slM4HpyeXm6+fR0q7bl88v8F6vlkUS2OBxV0zhhpjqnXczxrHmEK9AdwJOzqN1J3Lfu8i5W8qeepzrjEla0Z1z3kWR4XffSd+Tvdq6scLCVSwP48Fm8rT5U0Pcm2CXnh8yzNMSIOa3yfAGTcfIAY2sG0LLsbU5tS2wSU8sZ6VdA1tQG6r1cUTmn/jKf/vJTvhf9FVCZOw1dwjw0Gh0jG3p9ZZofWoJcuYVjrsaBSg0wJRaeXvqMn0k5R9trVayQOZGNQQcM X-MS-Exchange-AntiSpam-MessageData: TPLUfsKFb/7RyfWQaQzQopQgmuOEFL+gNG4aiiq5iHCbpg9XbCYHJxX5sVns3Y3tOuE36UVpd8DIF5R/kiWx/bj4rhq6dAciXTegQ8dElX9RiT8QNi4Sw/LZNZC0lRSxuZ3QnogyJHIfV/GJNGpdgw68JGflz0yFEFTrHdkUvoTXBP/iSu+igYuiqj08Mav20NiiMHGP5Lj3ZW5nI6Dalg== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e84e1fc-754c-4f3d-8df6-08d7d62c7bdd X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2020 11:04:44.3435 (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: IZxojAp7k1O3dzuCQ+qqST8rUlZaDA4GTPNoIfiERxubuo3NiMoa+HLYwf/t6XJ7fotk+oCDpNwC31MV8/Aoig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4285 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller Currently, the driver tracks power save state of the stations with the variable sta_asleep_mask. Then, it takes care to not sent data to asleep stations. However, this work is already done by mac80211. Normally, there are no frames for asleep stations in our queues. So, driver do not have to filter frames in its queues (apart the frames marked "AFTER_DTIM"). Notice that there is a risk of race between state of the station and data send to the firmware. However, this risk is limited since the number of frame in queues are small. In add, this race also exists with the current code. Anyway, the firmware is able to detect the problem and driver will receive a 'REQUEUE' status (translated in TX_STAT_TX_FILTERED for mac80211). Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 6 ------ drivers/staging/wfx/main.c | 1 - drivers/staging/wfx/queue.c | 14 ++------------ drivers/staging/wfx/sta.c | 29 ----------------------------- drivers/staging/wfx/wfx.h | 2 -- 5 files changed, 2 insertions(+), 50 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 8e4c3e1aadfd..a53e6d15031b 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -275,15 +275,9 @@ static void wfx_tx_manage_pm(struct wfx_vif *wvif, struct ieee80211_hdr *hdr, struct wfx_tx_priv *tx_priv, struct ieee80211_sta *sta) { - u32 mask = ~BIT(tx_priv->raw_link_id); struct wfx_sta_priv *sta_priv; int tid = ieee80211_get_tid(hdr); - spin_lock_bh(&wvif->ps_state_lock); - if (ieee80211_is_auth(hdr->frame_control)) - wvif->sta_asleep_mask &= mask; - spin_unlock_bh(&wvif->ps_state_lock); - if (sta) { sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; spin_lock_bh(&sta_priv->lock); diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 3c4c240229ad..5e1a7a932b53 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -138,7 +138,6 @@ static const struct ieee80211_ops wfx_ops = { .cancel_hw_scan = wfx_cancel_hw_scan, .sta_add = wfx_sta_add, .sta_remove = wfx_sta_remove, - .sta_notify = wfx_sta_notify, .set_tim = wfx_set_tim, .set_key = wfx_set_key, .set_rts_threshold = wfx_set_rts_threshold, diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index c602496580f7..e66debd60e3f 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -388,13 +388,8 @@ static struct wfx_queue *wfx_tx_queue_mask_get(struct wfx_vif *wvif, int idx; u32 tx_allowed_mask; - /* Search for unicast traffic */ - tx_allowed_mask = ~wvif->sta_asleep_mask; - tx_allowed_mask |= BIT(WFX_LINK_ID_UAPSD); - if (wvif->sta_asleep_mask) - tx_allowed_mask &= ~BIT(WFX_LINK_ID_AFTER_DTIM); - else - tx_allowed_mask |= BIT(WFX_LINK_ID_AFTER_DTIM); + tx_allowed_mask = BIT(WFX_LINK_ID_MAX) - 1; + tx_allowed_mask &= ~BIT(WFX_LINK_ID_AFTER_DTIM); idx = wfx_get_prio_queue(wvif, tx_allowed_mask); if (idx < 0) return NULL; @@ -464,13 +459,8 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { - spin_lock_bh(&wvif->ps_state_lock); - vif_queue = wfx_tx_queue_mask_get(wvif, &vif_tx_allowed_mask); - - spin_unlock_bh(&wvif->ps_state_lock); - if (vif_queue) { if (queue && queue != vif_queue) dev_info(wdev->dev, "vifs disagree about queue priority\n"); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index be493b5f2b5d..5c5b52dc7bdd 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -590,11 +590,6 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, WARN_ON(sta_priv->link_id >= WFX_MAX_STA_IN_AP_MODE); hif_map_link(wvif, sta->addr, 0, sta_priv->link_id); - spin_lock_bh(&wvif->ps_state_lock); - if ((sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) == - IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) - wvif->sta_asleep_mask |= BIT(sta_priv->link_id); - spin_unlock_bh(&wvif->ps_state_lock); return 0; } @@ -841,28 +836,6 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, wfx_do_join(wvif); } -static void wfx_ps_notify_sta(struct wfx_vif *wvif, - enum sta_notify_cmd notify_cmd, int link_id) -{ - spin_lock_bh(&wvif->ps_state_lock); - if (notify_cmd == STA_NOTIFY_SLEEP) - wvif->sta_asleep_mask |= BIT(link_id); - else // notify_cmd == STA_NOTIFY_AWAKE - wvif->sta_asleep_mask &= ~BIT(link_id); - spin_unlock_bh(&wvif->ps_state_lock); - if (notify_cmd == STA_NOTIFY_AWAKE) - wfx_bh_request_tx(wvif->wdev); -} - -void wfx_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - enum sta_notify_cmd notify_cmd, struct ieee80211_sta *sta) -{ - struct wfx_vif *wvif = (struct wfx_vif *) vif->drv_priv; - struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *) &sta->drv_priv; - - wfx_ps_notify_sta(wvif, notify_cmd, sta_priv->link_id); -} - static int wfx_update_tim(struct wfx_vif *wvif) { struct sk_buff *skb; @@ -1019,7 +992,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) wvif->wdev = wdev; wvif->link_id_map = 1; // link-id 0 is reserved for multicast - spin_lock_init(&wvif->ps_state_lock); INIT_WORK(&wvif->update_tim_work, wfx_update_tim_work); memset(&wvif->bss_params, 0, sizeof(wvif->bss_params)); @@ -1083,7 +1055,6 @@ void wfx_remove_interface(struct ieee80211_hw *hw, wfx_tx_unlock(wdev); break; case WFX_STATE_AP: - wvif->sta_asleep_mask = 0; /* reset.link_id = 0; */ hif_reset(wvif, false); break; diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 116f456a5da2..61899cd7942b 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -85,8 +85,6 @@ struct wfx_vif { struct tx_policy_cache tx_policy_cache; struct work_struct tx_policy_upload_work; - u32 sta_asleep_mask; - spinlock_t ps_state_lock; struct work_struct update_tim_work; int beacon_int;