From patchwork Wed Jul 1 15:07:01 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: 1320613 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=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; 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=jJFP0WAM; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl4n4kytz9sTY for ; Thu, 2 Jul 2020 01:09:29 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731859AbgGAPIc (ORCPT ); Wed, 1 Jul 2020 11:08:32 -0400 Received: from mail-bn8nam12on2072.outbound.protection.outlook.com ([40.107.237.72]:60865 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731822AbgGAPIY (ORCPT ); Wed, 1 Jul 2020 11:08:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oVHR03frRMjauhD5R0fOgoU4a6YK0ZFf17f5lHQ8WWK3Ne81vg7mOd4kWwi8Msym6IqPmV+R1QjcYOMKF6xugiGxkXbjZdmSMvL54HwVhWl8B7CULy6O62SlkTYsvYThHHiGnfgWV3VokbkTTcxwI5n25exLdP6wybp+0lobHzUgVLruEzwigL/rffhXWe/tUBObu1ZqPtaG4JxkZ8y6IB1atiKgiRWVfJ3yJB6l7zHxVERrmbBSJfqkWri62kXr9fmIRZ8sPZEn5IdwI4NephXg1+0yn0VxwbN9bqzMtC0Mhod4hq4DbY8I+p9qezl/Glg653L0+8BwA2pzm2Bq1Q== 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=hB/6Xa6eeRnTz1L+897aJzexVnayVWpXMV1KfAnJI7E=; b=liDkTAuvaSa0jhXCUwTBEbQACiYTiqna6EUhdHRmmNKo4jzqAdFoF0QmF/maMJinVo1HELf4/KZBKPKDYt94zTpLpMwzUu4mufwSkRxyO6Zn4MnkplEGHL9ce6/LQIfGzdMlHzGydTEfFyS3STliJc3arfeuI21D+DohmjnzDK9S0QVU1LwXrDiMc8014f2t6cyKj/faF0rpYB7mUdsmE75LZyKh3N9GSYsNpWLd6C0WENahVHSsmdCySIAbD2+3F7ODZ271hegZrmzq7ctKO/q1NTqxCgQ3trGLHl0AethR6vjJFyfW/46Bvo0J5CCBwO1+n032PG3R1/423VdouQ== 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=hB/6Xa6eeRnTz1L+897aJzexVnayVWpXMV1KfAnJI7E=; b=jJFP0WAMUaRBb4V8Tw8nHX61dotOaB6K1saLvhhTCg35HowWYXc856ShfIg5umuLrZW9T5iMu8SVa2ww7Axj6lEaor8URV6coLGCLX0xrV/CkiOfdtSwjK6/1D+1a+O1A1nQY0TREIEvdVUOaTl4AJ2d9HYdU2gNZiPdvn4+Ty8= 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 SA0PR11MB4736.namprd11.prod.outlook.com (2603:10b6:806:9f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Wed, 1 Jul 2020 15:08:14 +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.3131.033; Wed, 1 Jul 2020 15:08:14 +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 07/13] staging: wfx: fix unexpected calls to ieee80211_sta_set_buffered() Date: Wed, 1 Jul 2020 17:07:01 +0200 Message-Id: <20200701150707.222985-8-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701150707.222985-1-Jerome.Pouiller@silabs.com> References: <20200701150707.222985-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: DM5PR07CA0143.namprd07.prod.outlook.com (2603:10b6:3:13e::33) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.silabs.com (2a01:e35:2435:66a0:544b:f17b:7ae8:fb7) by DM5PR07CA0143.namprd07.prod.outlook.com (2603:10b6:3:13e::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21 via Frontend Transport; Wed, 1 Jul 2020 15:08:13 +0000 X-Mailer: git-send-email 2.27.0 X-Originating-IP: [2a01:e35:2435:66a0:544b:f17b:7ae8:fb7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eeb401ad-bf63-4981-74b4-08d81dd093dd X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XPQpSyuN2akS9BlpB14TBMDOtq6c8LcNAg8n3vshyAFiXEfR63UuHyb7HEY99Io/NHzMr4QM09bDU5VK97dKqDv2IQKg1jNBRZlxqK2nphAYFXFiStA+8mIgErnOyhjGJJs0mF07s1T2146uGR6srrRDmFBj+uQKX9AurB0HtJuAGVw9c5q9yK183hVueVHQZO6IkhGz0Xu9GbWgrfrNeKMzLVihZn4FP6PoLoTG+jR4qx9kpRzWvxwpNKBJaLsXNSDU/38oDA2l0tjk2ZYQJFBvEHQrxRzhZ47wdtbBkAqITpNjaCEp0S7D+3iuBjYjCA6vPemyWV0WA97tjcQ3Xw== 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:(39850400004)(366004)(346002)(376002)(396003)(136003)(5660300002)(6486002)(86362001)(6666004)(66574015)(36756003)(2906002)(186003)(83380400001)(16526019)(8936002)(66556008)(66476007)(107886003)(4326008)(8676002)(2616005)(1076003)(478600001)(316002)(54906003)(66946007)(52116002)(7696005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: oljQrsq0FdVWeAwooJyuI7F5NTfEtVxBt8Bzl1JsiMrTCGShC6Y88LxUtJigihf/uQgh097E6lmAhiOzi15sRSZidpQec8GPDpIF5IYxlQ6cZYNPFTXzCfLl53vQJlfWivb+dedy/7QiMrmTG0/Mfpgmaiuz9MCi2kci1G301RjaDqbmxEguBeTaQaHKoXWIxAEi2ItqZZxD2Mb+PddFwWf1UgRs4WTroP9dlBhrW1TPgcGNa1qIT/ZlcVHmGe+AUcHJw8EbBuRhgIyVXHpEKUmeWwf2U5Gp055m9+jAHS1nIh9nqB3OVpcUd/Cb0rQUvkoxQ71bOS3RvccuYJlsmGRrvCz+nlNFxjbE5Dnf6oHfYEqSPkXjFijxyx6K406bFl9PHyD8QSUD+InDG8/z15/5LFeCej06HMXNF2ebNVlzIO+5GjOgFeoe1vRFHDXVGGIrYjThhEoZQzLPL4MPMvi1LEXwAQoCtS4qD969AMtHdl3w/3+0iR9B273EikAhH9dAp2RFVmEEalQ4kZXldwTlZGFaunVj7SEFMav6eqs= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: eeb401ad-bf63-4981-74b4-08d81dd093dd X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2020 15:08:14.8030 (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: u5tCI/GPyv6VQROsWbCV/qZrtG6huFxYwnirNIcFjvL6RalwsLApCJ9wPgdRBWO51WoVWT7qNi880vO5De9CDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4736 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller When a station go to sleep, the driver receive the status REQUEUE and forward this answer to mac80211. So, neither the driver, neither the hardware buffer the frames. So the call to ieee80211_sta_set_buffered is useless. In add, it seems that mac80211 does not expect to receive ieee80211_sta_set_buffered(false) after the station is asleep(). When the device send data to a station, the following sequence can be observed: - Mac80211 call wfx_sta_notify(awake). - The driver calls ieee80211_sta_set_buffered(true). Since the station is awake, its TIM is not set. - Mac80211 receive a power save notification from the station, so it calls wfx_sta_notify(asleep). - Then, since the driver has declared it has buffered some frames, the TIM of the station should be set. This action is delayed by mac80211. - The device also notice the station go to sleep. It replies the REQUEUE status for the buffered frames. The driver forward this status to mac80211. - There is no more frames in queues, so the driver call ieee80211_sta_set_buffered(false). - Mac80211 updates the TIM but since there is no frames buffered by the driver, it set the TIM for the station to 0. Anyway, correctly use the ieee80211_sta_set_buffered() API solves the problem. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index dcec722afb174..3244a768345c5 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -225,7 +225,6 @@ static void wfx_tx_manage_pm(struct wfx_vif *wvif, struct ieee80211_hdr *hdr, sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; spin_lock_bh(&sta_priv->lock); sta_priv->buffered[tid]++; - ieee80211_sta_set_buffered(sta, tid, true); spin_unlock_bh(&sta_priv->lock); } } @@ -471,8 +470,6 @@ static void wfx_tx_update_sta(struct wfx_vif *wvif, struct ieee80211_hdr *hdr) spin_lock_bh(&sta_priv->lock); WARN(!sta_priv->buffered[tid], "inconsistent notification"); sta_priv->buffered[tid]--; - if (!sta_priv->buffered[tid]) - ieee80211_sta_set_buffered(sta, tid, false); spin_unlock_bh(&sta_priv->lock); } else { dev_dbg(wvif->wdev->dev, "%s: sta does not exist anymore\n",