From patchwork Wed Jul 1 15:06:55 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: 1320602 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=bBbuc2uz; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl3H5tBGz9sTY for ; Thu, 2 Jul 2020 01:08:11 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731784AbgGAPII (ORCPT ); Wed, 1 Jul 2020 11:08:08 -0400 Received: from mail-bn8nam12on2056.outbound.protection.outlook.com ([40.107.237.56]:52640 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731505AbgGAPIG (ORCPT ); Wed, 1 Jul 2020 11:08:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f3N0xfmAo2VSAK0oEkCaZ7XhYerd0NTbmlNwzv7Ntbx0ZXfhopyvaxDIpvdmmMH7VaI3M4lmkA0+zP3NDSbr4Z8bFbixCLHYzOV+33/AW5CGlqQH/thwKxUsTOtB2kFruiS3ChU039Ik5D2qNA4Q396vTz689pX0qzByssvhvHhJX5oR9nHdKstRKTeC2izfOYzBwRpwg4uU6wjQL7ayayW0UGOXxkouk1njaPs15wvdoYodxzVLJLorrhB5dLeJ4I+IfegGHpbLpJj5760miUjcmQA7BUMSNdA3IWUEb2OO2ytRlHZa+dval598lmGpWRuBqnJYFnDA9s+tetDt2g== 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=UtD0cyg1AwDPlfHg4FnZVxekirUg22mwS3DkXlRmuyQ=; b=WJ63vbK4CaMAZP/JBbKBGBSCOs+EmTGYrVibbCRGKr5P1agQfd6sgMLiVebYLl15RqDGWmr+BPVN12vxeJ2foeBQUDSB1aO2Twn0MYF01QSjBaPYuBwrBmBUQhNjipeAtmROYGSjhfA7iLa4snWSMcsfjGmfEsBDKxSjn6EVxeGoBZMUeT2JAP5kcwnL+XmEy/ib2b+YigkZERMGENTctPvx0GZrylBkepJQKl57gTah6qq3dx/x/gCUXhGW3ih+u3AP2wNGns+077rQIKoIjyY5mfx4G8qhx3l0ooIeEWAsdijPOXnZhbkW1FPNttdMsUPGwaR4GiBKLJjtzAUcTw== 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=UtD0cyg1AwDPlfHg4FnZVxekirUg22mwS3DkXlRmuyQ=; b=bBbuc2uzrlMuwcKEzoD1g6oEa4yk29Os0XDospeQCvzYWpsHs9aEtTJpqD3N+1BPtfHlu0aNzCgove43RgNJ9v9ltZq2XV+rILL6sh503cPN2LiutUIkYn5FPeEIyL2A30VQ6y0PV83ly1/lk8LUBBsILsGO5n+2Gbc/3RX7Zys= 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:01 +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:01 +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 01/13] staging: wfx: associate tx_queues to vifs Date: Wed, 1 Jul 2020 17:06:55 +0200 Message-Id: <20200701150707.222985-2-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:07:59 +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: 4cbc051a-6dde-4b79-5f82-08d81dd08b87 X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: meqVVAlpX5sR0XOIRvEVsng322DN0aZWvW2NwwtPMKdfp/3ZNH7OTi+VS+t9ZmFCha98cfcpSVxys0f5N6CKxXpO4JsdySv88JhtoQtDxmFOGd24UaxvseVf+ILfaTnqemIm6UPF7ndGmEZ6G6fwWbLpUKW2evL2MqtjWsSPUs0KdmQSrSuao84l8G0THsW4bn5qzwyUfuAWyl/5lBPesgkFDFWOnV80G4tibeLRVi1w0NOlBTQVcm7pIm+K4nqXyY3pX3maWNgkk8ElbTjjecMkULtKkrESgxKsL5UAqjHVBCzQei/NSXcwYSe9T6al2VQXeF+X8qjvLLrln9Z1Eg== 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)(30864003)(8936002)(66556008)(66476007)(107886003)(4326008)(8676002)(2616005)(1076003)(478600001)(316002)(54906003)(66946007)(52116002)(7696005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eH/2rMKUkIJ0rBVKV97oHCcx28XGNPoo92DRovCXq6avmidMKSCgGNWtfk5sGS07WLTF7s61wHNUVJYX5ol8SyOTHf6ocjbDt96cd4AYABPfrHh2J3vevaj5oAbQr+5uvyyWWLkg7uIgyOdM5IZykYg01IVLvbE0mytI0xbZcA4kJHqWI/UVNrpMrxPUXDQmnbf43t9AQE6FAd/GzvfZYtQpBXag+Rx7WsfLknPRtpL8xZoVoQYTFRdyDIT4BARDEptpthTF+rVlm3svH0BPox/wMnk4T4daya9zz6LXW/U6lPW5nCbqpPFQQkloD6n0ebLJ2WoVNa1VsM4G4i8tdR9Jrlr+ZHLFyVhcwCvsdYGYpplJKgV24pDUT/Hhe5G87SsNguYvZ8whVe8poVOONHTPXsxnyQFOuZ8GRejN6SmMKloUHdCATAB5XC4gJ3yeYLxfKjqrgIAbDaalekclzcS4/cj/DMfmoHsrmugZ3FoH6GqDgLmukMf0HYXeayTWKdrSxG3uhoZT3m6DqLawpibX/3y2qrOV9+8jeYwchdc= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4cbc051a-6dde-4b79-5f82-08d81dd08b87 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:01.0109 (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: mmY6j64hEaL1Fd7C29ZpnAE9c5w9JADVz7O6/fYIN2sujaKsqR087+DJZawhuaUm69obUrwPY0iM0MhXv+da+Q== 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 The device handles 4 queues (one per AC) for each virtual interface (and maximum 4 virtual interfaces). Until now the driver unified the queue of all interfaces and handled only 4 queues for whole device. This architecture did not allow to balance the traffic between the vif. So, this patch relocate the queues into the vif and change the API accordingly. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 57 +++++++++----- drivers/staging/wfx/main.c | 3 +- drivers/staging/wfx/queue.c | 141 +++++++++++++++------------------- drivers/staging/wfx/queue.h | 15 ++-- drivers/staging/wfx/sta.c | 4 +- drivers/staging/wfx/wfx.h | 2 +- 6 files changed, 111 insertions(+), 111 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index f042ef36b408e..ce3048c94961c 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -408,7 +408,7 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, // Auxiliary operations wfx_tx_manage_pm(wvif, hdr, tx_priv, sta); - wfx_tx_queues_put(wvif->wdev, skb); + wfx_tx_queues_put(wvif, skb); if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) schedule_work(&wvif->update_tim_work); wfx_bh_request_tx(wvif->wdev); @@ -539,7 +539,7 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg) const struct wfx_tx_priv *tx_priv; struct sk_buff *skb; - skb = wfx_pending_get(wvif->wdev, arg->packet_id); + skb = wfx_pending_get(wvif, arg->packet_id); if (!skb) { dev_warn(wvif->wdev->dev, "received unknown packet_id (%#.8x) from chip\n", arg->packet_id); @@ -582,34 +582,50 @@ void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg) wfx_skb_dtor(wvif, skb); } +static void wfx_flush_vif(struct wfx_vif *wvif, u32 queues, + struct sk_buff_head *dropped) +{ + struct wfx_queue *queue; + int i; + + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + if (!(BIT(i) & queues)) + continue; + queue = &wvif->tx_queue[i]; + if (dropped) + wfx_tx_queue_drop(wvif, queue, dropped); + } + if (wvif->wdev->chip_frozen) + return; + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + if (!(BIT(i) & queues)) + continue; + queue = &wvif->tx_queue[i]; + if (wait_event_timeout(wvif->wdev->tx_dequeue, + wfx_tx_queue_empty(wvif, queue), + msecs_to_jiffies(1000)) <= 0) + dev_warn(wvif->wdev->dev, + "frames queued while flushing tx queues?"); + } +} + void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop) { struct wfx_dev *wdev = hw->priv; struct sk_buff_head dropped; - struct wfx_queue *queue; struct wfx_vif *wvif; struct hif_msg *hif; struct sk_buff *skb; - int vif_id = -1; - int i; - if (vif) - vif_id = ((struct wfx_vif *)vif->drv_priv)->id; skb_queue_head_init(&dropped); - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - if (!(BIT(i) & queues)) - continue; - queue = &wdev->tx_queue[i]; - if (drop) - wfx_tx_queue_drop(wdev, queue, vif_id, &dropped); - if (wdev->chip_frozen) - continue; - if (wait_event_timeout(wdev->tx_dequeue, - wfx_tx_queue_empty(wdev, queue, vif_id), - msecs_to_jiffies(1000)) <= 0) - dev_warn(wdev->dev, - "frames queued while flushing tx queues?"); + if (vif) { + wvif = (struct wfx_vif *)vif->drv_priv; + wfx_flush_vif(wvif, queues, drop ? &dropped : NULL); + } else { + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + wfx_flush_vif(wvif, queues, drop ? &dropped : NULL); } wfx_tx_flush(wdev); if (wdev->chip_frozen) @@ -623,4 +639,3 @@ void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wfx_skb_dtor(wvif, skb); } } - diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 6bd96f4763884..80e4474cc3314 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -349,8 +349,9 @@ struct wfx_dev *wfx_init_common(struct device *dev, init_completion(&wdev->firmware_ready); INIT_DELAYED_WORK(&wdev->cooling_timeout_work, wfx_cooling_timeout_work); + skb_queue_head_init(&wdev->tx_pending); + init_waitqueue_head(&wdev->tx_dequeue); wfx_init_hif_cmd(&wdev->hif_cmd); - wfx_tx_queues_init(wdev); if (devm_add_action_or_reset(dev, wfx_free_common, wdev)) return NULL; diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 93ea2b72febd0..7ec36598d9a83 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -57,84 +57,57 @@ void wfx_tx_lock_flush(struct wfx_dev *wdev) wfx_tx_flush(wdev); } -void wfx_tx_queues_init(struct wfx_dev *wdev) +void wfx_tx_queues_init(struct wfx_vif *wvif) { int i; - skb_queue_head_init(&wdev->tx_pending); - init_waitqueue_head(&wdev->tx_dequeue); for (i = 0; i < IEEE80211_NUM_ACS; ++i) { - skb_queue_head_init(&wdev->tx_queue[i].normal); - skb_queue_head_init(&wdev->tx_queue[i].cab); + skb_queue_head_init(&wvif->tx_queue[i].normal); + skb_queue_head_init(&wvif->tx_queue[i].cab); } } -void wfx_tx_queues_check_empty(struct wfx_dev *wdev) +void wfx_tx_queues_check_empty(struct wfx_vif *wvif) { int i; - WARN_ON(!skb_queue_empty_lockless(&wdev->tx_pending)); for (i = 0; i < IEEE80211_NUM_ACS; ++i) { - WARN_ON(atomic_read(&wdev->tx_queue[i].pending_frames)); - WARN_ON(!skb_queue_empty_lockless(&wdev->tx_queue[i].normal)); - WARN_ON(!skb_queue_empty_lockless(&wdev->tx_queue[i].cab)); + WARN_ON(atomic_read(&wvif->tx_queue[i].pending_frames)); + WARN_ON(!skb_queue_empty_lockless(&wvif->tx_queue[i].normal)); + WARN_ON(!skb_queue_empty_lockless(&wvif->tx_queue[i].cab)); } } -static bool __wfx_tx_queue_empty(struct wfx_dev *wdev, - struct sk_buff_head *skb_queue, int vif_id) +bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue) { - struct hif_msg *hif_msg; - struct sk_buff *skb; - - spin_lock_bh(&skb_queue->lock); - skb_queue_walk(skb_queue, skb) { - hif_msg = (struct hif_msg *)skb->data; - if (vif_id < 0 || hif_msg->interface == vif_id) { - spin_unlock_bh(&skb_queue->lock); - return false; - } - } - spin_unlock_bh(&skb_queue->lock); - return true; -} - -bool wfx_tx_queue_empty(struct wfx_dev *wdev, - struct wfx_queue *queue, int vif_id) -{ - return __wfx_tx_queue_empty(wdev, &queue->normal, vif_id) && - __wfx_tx_queue_empty(wdev, &queue->cab, vif_id); + return skb_queue_empty(&queue->normal) && skb_queue_empty(&queue->cab); } -static void __wfx_tx_queue_drop(struct wfx_dev *wdev, - struct sk_buff_head *skb_queue, int vif_id, +static void __wfx_tx_queue_drop(struct wfx_vif *wvif, + struct sk_buff_head *skb_queue, struct sk_buff_head *dropped) { struct sk_buff *skb, *tmp; - struct hif_msg *hif_msg; spin_lock_bh(&skb_queue->lock); skb_queue_walk_safe(skb_queue, skb, tmp) { - hif_msg = (struct hif_msg *)skb->data; - if (vif_id < 0 || hif_msg->interface == vif_id) { - __skb_unlink(skb, skb_queue); - skb_queue_head(dropped, skb); - } + __skb_unlink(skb, skb_queue); + skb_queue_head(dropped, skb); } spin_unlock_bh(&skb_queue->lock); } -void wfx_tx_queue_drop(struct wfx_dev *wdev, struct wfx_queue *queue, - int vif_id, struct sk_buff_head *dropped) +void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue, + struct sk_buff_head *dropped) { - __wfx_tx_queue_drop(wdev, &queue->cab, vif_id, dropped); - __wfx_tx_queue_drop(wdev, &queue->normal, vif_id, dropped); - wake_up(&wdev->tx_dequeue); + __wfx_tx_queue_drop(wvif, &queue->cab, dropped); + __wfx_tx_queue_drop(wvif, &queue->normal, dropped); + wake_up(&wvif->wdev->tx_dequeue); } -void wfx_tx_queues_put(struct wfx_dev *wdev, struct sk_buff *skb) +void wfx_tx_queues_put(struct wfx_vif *wvif, struct sk_buff *skb) { - struct wfx_queue *queue = &wdev->tx_queue[skb_get_queue_mapping(skb)]; + struct wfx_queue *queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) @@ -146,39 +119,45 @@ void wfx_tx_queues_put(struct wfx_dev *wdev, struct sk_buff *skb) void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped) { struct wfx_queue *queue; + struct wfx_vif *wvif; + struct hif_msg *hif; struct sk_buff *skb; WARN(!wdev->chip_frozen, "%s should only be used to recover a frozen device", __func__); while ((skb = skb_dequeue(&wdev->tx_pending)) != NULL) { - queue = &wdev->tx_queue[skb_get_queue_mapping(skb)]; - WARN_ON(skb_get_queue_mapping(skb) > 3); - WARN_ON(!atomic_read(&queue->pending_frames)); - atomic_dec(&queue->pending_frames); + hif = (struct hif_msg *)skb->data; + wvif = wdev_to_wvif(wdev, hif->interface); + if (wvif) { + queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; + WARN_ON(skb_get_queue_mapping(skb) > 3); + WARN_ON(!atomic_read(&queue->pending_frames)); + atomic_dec(&queue->pending_frames); + } skb_queue_head(dropped, skb); } } -struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id) +struct sk_buff *wfx_pending_get(struct wfx_vif *wvif, u32 packet_id) { struct wfx_queue *queue; struct hif_req_tx *req; struct sk_buff *skb; - spin_lock_bh(&wdev->tx_pending.lock); - skb_queue_walk(&wdev->tx_pending, skb) { + spin_lock_bh(&wvif->wdev->tx_pending.lock); + skb_queue_walk(&wvif->wdev->tx_pending, skb) { req = wfx_skb_txreq(skb); if (req->packet_id == packet_id) { - spin_unlock_bh(&wdev->tx_pending.lock); - queue = &wdev->tx_queue[skb_get_queue_mapping(skb)]; + spin_unlock_bh(&wvif->wdev->tx_pending.lock); + queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; WARN_ON(skb_get_queue_mapping(skb) > 3); WARN_ON(!atomic_read(&queue->pending_frames)); atomic_dec(&queue->pending_frames); - skb_unlink(skb, &wdev->tx_pending); + skb_unlink(skb, &wvif->wdev->tx_pending); return skb; } } - spin_unlock_bh(&wdev->tx_pending.lock); + spin_unlock_bh(&wvif->wdev->tx_pending.lock); WARN(1, "cannot find packet in pending queue"); return NULL; } @@ -221,7 +200,6 @@ unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, bool wfx_tx_queues_has_cab(struct wfx_vif *wvif) { - struct wfx_dev *wdev = wvif->wdev; int i; if (wvif->vif->type != NL80211_IFTYPE_AP) @@ -229,33 +207,39 @@ bool wfx_tx_queues_has_cab(struct wfx_vif *wvif) for (i = 0; i < IEEE80211_NUM_ACS; ++i) // Note: since only AP can have mcast frames in queue and only // one vif can be AP, all queued frames has same interface id - if (!skb_queue_empty_lockless(&wdev->tx_queue[i].cab)) + if (!skb_queue_empty_lockless(&wvif->tx_queue[i].cab)) return true; return false; } static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) { - struct wfx_queue *sorted_queues[IEEE80211_NUM_ACS]; + struct wfx_queue *queues[IEEE80211_NUM_ACS * ARRAY_SIZE(wdev->vif)]; + int i, j, num_queues = 0; struct wfx_vif *wvif; struct hif_msg *hif; struct sk_buff *skb; - int i, j; - // bubble sort - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - sorted_queues[i] = &wdev->tx_queue[i]; - for (j = i; j > 0; j--) - if (atomic_read(&sorted_queues[j]->pending_frames) < - atomic_read(&sorted_queues[j - 1]->pending_frames)) - swap(sorted_queues[j - 1], sorted_queues[j]); + // sort the queues + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + WARN_ON(num_queues >= ARRAY_SIZE(queues)); + queues[num_queues] = &wvif->tx_queue[i]; + for (j = num_queues; j > 0; j--) + if (atomic_read(&queues[j]->pending_frames) < + atomic_read(&queues[j - 1]->pending_frames)) + swap(queues[j - 1], queues[j]); + num_queues++; + } } + wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { if (!wvif->after_dtim_tx_allowed) continue; - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - skb = skb_dequeue(&sorted_queues[i]->cab); + for (i = 0; i < num_queues; i++) { + skb = skb_dequeue(&queues[i]->cab); if (!skb) continue; // Note: since only AP can have mcast frames in queue @@ -263,21 +247,20 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) // same interface id hif = (struct hif_msg *)skb->data; WARN_ON(hif->interface != wvif->id); - WARN_ON(sorted_queues[i] != - &wdev->tx_queue[skb_get_queue_mapping(skb)]); - atomic_inc(&sorted_queues[i]->pending_frames); + WARN_ON(queues[i] != + &wvif->tx_queue[skb_get_queue_mapping(skb)]); + atomic_inc(&queues[i]->pending_frames); return skb; } // No more multicast to sent wvif->after_dtim_tx_allowed = false; schedule_work(&wvif->update_tim_work); } - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - skb = skb_dequeue(&sorted_queues[i]->normal); + + for (i = 0; i < num_queues; i++) { + skb = skb_dequeue(&queues[i]->normal); if (skb) { - WARN_ON(sorted_queues[i] != - &wdev->tx_queue[skb_get_queue_mapping(skb)]); - atomic_inc(&sorted_queues[i]->pending_frames); + atomic_inc(&queues[i]->pending_frames); return skb; } } diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h index 0c3b7244498e3..dfbbe4b111113 100644 --- a/drivers/staging/wfx/queue.h +++ b/drivers/staging/wfx/queue.h @@ -25,18 +25,17 @@ void wfx_tx_unlock(struct wfx_dev *wdev); void wfx_tx_flush(struct wfx_dev *wdev); void wfx_tx_lock_flush(struct wfx_dev *wdev); -void wfx_tx_queues_init(struct wfx_dev *wdev); -void wfx_tx_queues_check_empty(struct wfx_dev *wdev); +void wfx_tx_queues_init(struct wfx_vif *wvif); +void wfx_tx_queues_check_empty(struct wfx_vif *wvif); bool wfx_tx_queues_has_cab(struct wfx_vif *wvif); -void wfx_tx_queues_put(struct wfx_dev *wdev, struct sk_buff *skb); +void wfx_tx_queues_put(struct wfx_vif *wvif, struct sk_buff *skb); struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev); -bool wfx_tx_queue_empty(struct wfx_dev *wdev, struct wfx_queue *queue, - int vif_id); -void wfx_tx_queue_drop(struct wfx_dev *wdev, struct wfx_queue *queue, - int vif_id, struct sk_buff_head *dropped); +bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue); +void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue, + struct sk_buff_head *dropped); -struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id); +struct sk_buff *wfx_pending_get(struct wfx_vif *wvif, u32 packet_id); void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped); unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index d855d87c21028..85d4bc2949882 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -805,6 +805,7 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) hif_set_macaddr(wvif, vif->addr); + wfx_tx_queues_init(wvif); wfx_tx_policy_init(wvif); wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { @@ -823,6 +824,7 @@ void wfx_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; wait_for_completion_timeout(&wvif->set_pm_mode_complete, msecs_to_jiffies(300)); + wfx_tx_queues_check_empty(wvif); mutex_lock(&wdev->conf_mutex); WARN(wvif->link_id_map != 1, "corrupted state"); @@ -855,5 +857,5 @@ void wfx_stop(struct ieee80211_hw *hw) { struct wfx_dev *wdev = hw->priv; - wfx_tx_queues_check_empty(wdev); + WARN_ON(!skb_queue_empty_lockless(&wdev->tx_pending)); } diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 73e216733ce4f..0c44b733ef6fe 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -48,7 +48,6 @@ struct wfx_dev { struct mutex conf_mutex; struct wfx_hif_cmd hif_cmd; - struct wfx_queue tx_queue[4]; struct sk_buff_head tx_pending; wait_queue_head_t tx_dequeue; atomic_t tx_lock; @@ -75,6 +74,7 @@ struct wfx_vif { struct delayed_work beacon_loss_work; + struct wfx_queue tx_queue[4]; struct tx_policy_cache tx_policy_cache; struct work_struct tx_policy_upload_work; From patchwork Wed Jul 1 15:06:56 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: 1320603 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=EiewfaC3; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl3P6J0Zz9sTY for ; Thu, 2 Jul 2020 01:08:17 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731806AbgGAPIO (ORCPT ); Wed, 1 Jul 2020 11:08:14 -0400 Received: from mail-bn8nam12on2056.outbound.protection.outlook.com ([40.107.237.56]:52640 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731343AbgGAPII (ORCPT ); Wed, 1 Jul 2020 11:08:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dLtVOTIyxNjfZ97B5IDP1E8on7lY4OqCW04YfDR1iCWOJWODDnSjY5bgAmprZcDObnW2qcX/jyH6LTcxzScHVtn4d93aTREu3Fc02O+jJmBe4tTx8JRgV+FVMD/QaT+Vd45d/4ojwkcf1S/9QG0aUSahop7w8BWCki9ZurYOddyPfLLfIezSWO46RYZCak1FOEq8OIm8j2C0IfqxjOKS8lYeTVRlJiZem5e/PVAXXoGfFNvaVemCqnb0MVqB8h9KlYiB3ETFvyLK+qr3xH+FItIo/Vk9BgSz5lgHE4I/2CA3bfJHZbZHfaqVgMt4ReI4ox7Oj3Xb9HrWM1O2K68mHg== 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=aimN+AaiepU4T6Nj1hRXGIK/xOM4dQ1aepcJh7YyftI=; b=Z2qhlTLaP/LoVZ7kr1/1xHQl9aWnZQtRcqxe/J/a8RyNpZQlDwQqJUkXlSPNx0uiVaZI0NyK0BApJoW4m+nBdw4R4xVGMr1qVY7oF//v4drJ6eTEvt4eOlVD+l/hIc8DHWd//AWVLqaU6A92NRwcWxKgIS9Iu7g3e3uEXjCZiP1nxxilIhyMP+ekF3j0VlYxTXyZbXc0pZZkM2NBeGbEbJjfK0vR+UnZWN72GHZgIalXs2XTgldSTJxAtBbrzBPeGueL16dH8gP5uiu1tnOCYWvB2jSFX8eSNXJZ0Iq62VYNMWoQCmPEvJT/2IKPWxTkVa71ucVIhzoraJuicZHInQ== 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=aimN+AaiepU4T6Nj1hRXGIK/xOM4dQ1aepcJh7YyftI=; b=EiewfaC3tMrj6aWlCvQW5Adnz90T8b3Nj7OW6NHWyQUzjH8Ib22mFNV8yKtEhWp1tq959UQTN6FF3jjNW4SrKfXr0OIA1/RRHj9l6j+A6sCxr5QMHkzCFhs3CxMH4J4m48WJghDpQTpVzwwr7qAI+Yvw2qYWbBLDCm1lliZskGQ= 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:03 +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:03 +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/13] staging: wfx: check the vif ID of the Tx confirmations Date: Wed, 1 Jul 2020 17:06:56 +0200 Message-Id: <20200701150707.222985-3-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:01 +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: 77499cb5-5cf3-4a1d-4e23-08d81dd08cf4 X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vgPRTnkyouHPk4MH3/TrDiLzKM0ZOlM1noE9eDdZ3FcX4TZKB2XPfkpQq31u8RH7EzKAxUWRLt8bzhdPyHGGdM92tkXcN8D7tRfVgrJasaHr5MZ3kZoJG0LjmQ7i3YEFYo6WXhYnXiibKq2GDor0a5SQi6HTtpSEJ0RChmtF+tssDfFAz8qmDocNE5dWEzA6oC+bPMQ/7kJMwxnrPUe2yyv7gEj2oA//7KJqoyFzcvinG+K/bqFWpOfkqJfnBjOZm7cX0ft557YIc9wHbIQoE6JP/9HsiZizCAyOoRkGCynpQ6OqBuqqhQc9Smo1SObzHLpyoaCTSs/xUiXIp1rkgw== 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: BR5Y/f71hKQ7+i+gIqQVGKi9zhoG5h5B2UmvB9h24Gg7rYg2ULj1mlQa5OW9jLOU/8qgltnjOBZEtickmPl4f64dskd5sklqgRib/RB6T7GNcCmYCRduB6uPCoq4djXlIThAx3+LM9OSaIAzK0J8O6NaK2yCeGmOztTjDtBu0eklpASMkeAigvg0naKvBz3+f33wuYUw+AWkPUmgp35npQE89QjBmlaC19DyqibAbRTHSY7ecktZhxCJZ+TBw8bMKEyXTDYTAq9wyrCAzJsWzhL99RCTktRlcNKW3Uv4yqvN7T5G5+YtYOLUFBceonQXbhi8r9jirPV4GJVcXDmZImF/PflgSsAm+Rpf7gQ8PtM7i7h+9kXYN6gAMy1jcPAihPf+shdTNO72N9zmfcFhN13EBRotyyU4dzSQUXL6KG7sDxkNXbi0SFuEFtvPATJGF/NEskwWyKRdT5OoSTIcBwZDj/7RZuDXRUB25lnzMKGCHo5EBhmegSFMw0C3WYKeKGc0zVHi9J6cBdtJ9NrMVVdaa0WVIKmVlPwgBLRFQUM= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77499cb5-5cf3-4a1d-4e23-08d81dd08cf4 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:03.0577 (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: JL65GMtsHQRajph+Be1S3+AWoo3JkoRaT+6DslkZKKWQDvZjoe1x93cLPC7ZdgsW7om/Ueoj0J2RKwwLpXdUAw== 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 the driver has sent a frame on a virtual interface (vif), it expects to receive the confirmation on the same vif. This patch add a check for that. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/queue.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 7ec36598d9a83..6069143369f30 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -142,14 +142,18 @@ struct sk_buff *wfx_pending_get(struct wfx_vif *wvif, u32 packet_id) { struct wfx_queue *queue; struct hif_req_tx *req; + struct hif_msg *hif; struct sk_buff *skb; spin_lock_bh(&wvif->wdev->tx_pending.lock); skb_queue_walk(&wvif->wdev->tx_pending, skb) { - req = wfx_skb_txreq(skb); + hif = (struct hif_msg *)skb->data; + req = (struct hif_req_tx *)hif->body; if (req->packet_id == packet_id) { spin_unlock_bh(&wvif->wdev->tx_pending.lock); queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; + WARN(hif->interface != wvif->id, "sent frame %08x on vif %d, but get reply on vif %d", + req->packet_id, hif->interface, wvif->id); WARN_ON(skb_get_queue_mapping(skb) > 3); WARN_ON(!atomic_read(&queue->pending_frames)); atomic_dec(&queue->pending_frames); From patchwork Wed Jul 1 15:06:57 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: 1320605 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=YFJM2Fh7; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl3Z3yXyz9sTb for ; Thu, 2 Jul 2020 01:08:26 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731837AbgGAPIY (ORCPT ); Wed, 1 Jul 2020 11:08:24 -0400 Received: from mail-bn8nam12on2056.outbound.protection.outlook.com ([40.107.237.56]:52640 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731787AbgGAPIM (ORCPT ); Wed, 1 Jul 2020 11:08:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A2avvME+nOjwc5jQtUPyVKwhvWFVVV0+QfXeRFWMGyJNPKWTG4bLbsyYCs7bRr48TXWOXI7zPJlk8N7fDe7xm7R4YMS8S+BuScPc47Mza3dHsPQ0cduhwI0p42ynUjWO9WVXuKfjvfKxxWsJ4+aOajQeLkcO2FQQk7Q+26XUe2Trjcoi7wAh7YvwlqXmxteCF1nBuIgUjRo0v4bFDZdFMEBZFywgUw4uo3eJ7tnIYn6y2D3crcM3nvGsGF/y/25Q4ob+cC1CkYmBDzYuIanRw1AQ63znct6NFRgvup+zinN5KTIsYBrKBJYSASchS/DQTi7+xHsfE/p+P7jGZ8vw2w== 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=VNBkTpAfHPJyt4bgHDYKWshZzX+zwJScGMgyhbBEL+U=; b=JMzSLwGYV2G8L3IqmZIu+qD/aa/zyShMJyuNMkQdI8AHY/HBdXoaXyEr3wioas7p2u13Q0DD6/paTsQkQdYXv6NnypQ6QiKXYrF/XfQxIovZ63CKbFCfIsGnQMnW7iD/HJIxv2z0ZqVRDdzVnO2G/NPWD8afMsh4U9z/QSRQPOhe/yOldM2jafmqUr8Q6p6hbSwcCWNYsMDnq4KsLsrS74sB1tyu53H4wl/Zhru2BtKStX5cuMaD0ul3npBA04+Dkkl5S/bdn70B0o9OqzfA8Q7HSjuuFloGzP+rnSSwLu/gsOVKgaBkUZeNIVDYp7eBcQVte873eSqwT2GCr2+QDQ== 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=VNBkTpAfHPJyt4bgHDYKWshZzX+zwJScGMgyhbBEL+U=; b=YFJM2Fh77eSLEKDyUvZLvVwWoTsVe2c71fdhu9TALpH7bbYZifHw9hRBLrGQC1CPGZWqfSJpd9fLgq/YgsUL1VtCGg7zjk3CR5xms7r/Tgp6YC+NBO8+PMJiLx4KZpaphH9HVxYIulzFu75BwWMwbL5Lkxzf5yRNqHjbxQumHhE= 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:05 +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:05 +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 03/13] staging: wfx: correctly retrieve vif ID from Tx confirmation Date: Wed, 1 Jul 2020 17:06:57 +0200 Message-Id: <20200701150707.222985-4-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:03 +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: 61ce94be-83b0-4da4-f8f4-08d81dd08e0d X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u4mJ4NYYmaXHrt15/WNuOkzCXubx6oocPAH7bCPe1ug/fn2oKT/onndBGn84+qHNKJOHXTMvdAOKGvTHQkCYpVVkZP21su96cfwpL19RXkiqixJdHeJc2fbDvMmVfsh/0tGNkIBsWsqMY+VHGv/2jHvRwCBP9aMwpBrq0GOBa9Xy3YsslGk6EOzYv0AuU0WDb9yotWYaxIsempSUrGRs+ebFWevooezR1Mc6JWVPzjFSknY50hhxRPNt2+28arsWKgYIoDsQI7ZxAA953WTv+L1lHt4mp7C/AhWpppShDeyc2Ukag7SChPmHnklqzGlx 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: mjI630kvkSYorw3tnOeuKGU7eStzgRRg4/EW+6PH98hsIdv0D5pHywFpyNHNYa1n1tuZDHYMx3NvJXsKnu84DhzyqhNMyn2CcMmyvoGnVnvh0Ldo3f6nH8AA0gaL2DZSRmkGw4QS8/LmdRLlhOI3Jfrb7VDeU5X+ac+cJ3PIefJZoF35QFi33aejOzsHYysQR9ZKzq0gzezNZ56d4WDzD5rhVrxplNGmfFZvQu9YnDOxRTUjHRlwdyeK2RXHT/yoKTkjOuWorlTiCN30Kd8Wnv+Rh7i8RbrYDX99trJOIlVlWw2xlWJrpNlwZaFgCXWOjbA/xn80EI0MM5E8L0TTpiLAe27zZay6W+h0mw6txde7J/hAlCL4js9ufDqeHUWEaD97mFaeRQnXackG0ZvIoJeIM744mdYUrQ435j2RXXJMB7uRe7sL9ZRZ2RaRpqyg1z9rPehQ6ZxPvbaFhPhY3PfftXOnBmU0fZleGyEHck/E3OBDnL/BNLtAr1tyZF1vCFpPa/7uvxay/YuFNTI/0DHnUxLeyoHjakHAR1m8sU0= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61ce94be-83b0-4da4-f8f4-08d81dd08e0d 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:05.3094 (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: KczwUX4CbmEKYaYB0RNHV6NudcCe0dvswV6WfXWsYGRYEKA8dIca10ChxZjA3W/7bj1TFkmtNLEidakm+6+P3Q== 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 The device is able to send multiple Tx confirmations in the one reply. In this case, there is only one vif identifier for all the confirmations. Unfortunately, to generate this kind of messages the device squashes all the confirmations whatever their vif ID and use the vif ID of the first confirmation. So, the driver cannot rely on the vif ID mentioned in the header. Fortunately, using the packet_id, the driver can retrieve the Tx request and the associated vif. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 16 ++++++++++------ drivers/staging/wfx/data_tx.h | 2 +- drivers/staging/wfx/hif_rx.c | 14 ++------------ drivers/staging/wfx/queue.c | 22 ++++++++++++---------- drivers/staging/wfx/queue.h | 2 +- 5 files changed, 26 insertions(+), 30 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index ce3048c94961c..dcec722afb174 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -533,25 +533,29 @@ static void wfx_tx_fill_rates(struct wfx_dev *wdev, dev_dbg(wdev->dev, "%d more retries than expected\n", tx_count); } -void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg) +void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg) { struct ieee80211_tx_info *tx_info; const struct wfx_tx_priv *tx_priv; + struct wfx_vif *wvif; struct sk_buff *skb; - skb = wfx_pending_get(wvif, arg->packet_id); + skb = wfx_pending_get(wdev, arg->packet_id); if (!skb) { - dev_warn(wvif->wdev->dev, "received unknown packet_id (%#.8x) from chip\n", + dev_warn(wdev->dev, "received unknown packet_id (%#.8x) from chip\n", arg->packet_id); return; } + wvif = wdev_to_wvif(wdev, ((struct hif_msg *)skb->data)->interface); + WARN_ON(!wvif); + if (!wvif) + return; tx_info = IEEE80211_SKB_CB(skb); tx_priv = wfx_skb_tx_priv(skb); - _trace_tx_stats(arg, skb, - wfx_pending_get_pkt_us_delay(wvif->wdev, skb)); + _trace_tx_stats(arg, skb, wfx_pending_get_pkt_us_delay(wdev, skb)); // You can touch to tx_priv, but don't touch to tx_info->status. - wfx_tx_fill_rates(wvif->wdev, tx_info, arg); + wfx_tx_fill_rates(wdev, tx_info, arg); if (tx_priv->has_sta) wfx_tx_update_sta(wvif, wfx_skb_hdr80211(skb)); skb_trim(skb, skb->len - wfx_tx_get_icv_len(tx_priv->hw_key)); diff --git a/drivers/staging/wfx/data_tx.h b/drivers/staging/wfx/data_tx.h index 54fff24508fb9..b1727ddecd5e2 100644 --- a/drivers/staging/wfx/data_tx.h +++ b/drivers/staging/wfx/data_tx.h @@ -44,7 +44,7 @@ void wfx_tx_policy_upload_work(struct work_struct *work); void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb); -void wfx_tx_confirm_cb(struct wfx_vif *wvif, const struct hif_cnf_tx *arg); +void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg); void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u32 queues, bool drop); diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index bb156033d1e16..e3ebd910fabfd 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -63,13 +63,8 @@ static int hif_tx_confirm(struct wfx_dev *wdev, const struct hif_msg *hif, const void *buf) { const struct hif_cnf_tx *body = buf; - struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); - WARN_ON(!wvif); - if (!wvif) - return -EFAULT; - - wfx_tx_confirm_cb(wvif, body); + wfx_tx_confirm_cb(wdev, body); return 0; } @@ -77,16 +72,11 @@ static int hif_multi_tx_confirm(struct wfx_dev *wdev, const struct hif_msg *hif, const void *buf) { const struct hif_cnf_multi_transmit *body = buf; - struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); int i; WARN(body->num_tx_confs <= 0, "corrupted message"); - WARN_ON(!wvif); - if (!wvif) - return -EFAULT; - for (i = 0; i < body->num_tx_confs; i++) - wfx_tx_confirm_cb(wvif, &body->tx_conf_payload[i]); + wfx_tx_confirm_cb(wdev, &body->tx_conf_payload[i]); return 0; } diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 6069143369f30..678f622639093 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -138,30 +138,32 @@ void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped) } } -struct sk_buff *wfx_pending_get(struct wfx_vif *wvif, u32 packet_id) +struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id) { struct wfx_queue *queue; struct hif_req_tx *req; + struct wfx_vif *wvif; struct hif_msg *hif; struct sk_buff *skb; - spin_lock_bh(&wvif->wdev->tx_pending.lock); - skb_queue_walk(&wvif->wdev->tx_pending, skb) { + spin_lock_bh(&wdev->tx_pending.lock); + skb_queue_walk(&wdev->tx_pending, skb) { hif = (struct hif_msg *)skb->data; req = (struct hif_req_tx *)hif->body; - if (req->packet_id == packet_id) { - spin_unlock_bh(&wvif->wdev->tx_pending.lock); + if (req->packet_id != packet_id) + continue; + spin_unlock_bh(&wdev->tx_pending.lock); + wvif = wdev_to_wvif(wdev, hif->interface); + if (wvif) { queue = &wvif->tx_queue[skb_get_queue_mapping(skb)]; - WARN(hif->interface != wvif->id, "sent frame %08x on vif %d, but get reply on vif %d", - req->packet_id, hif->interface, wvif->id); WARN_ON(skb_get_queue_mapping(skb) > 3); WARN_ON(!atomic_read(&queue->pending_frames)); atomic_dec(&queue->pending_frames); - skb_unlink(skb, &wvif->wdev->tx_pending); - return skb; } + skb_unlink(skb, &wdev->tx_pending); + return skb; } - spin_unlock_bh(&wvif->wdev->tx_pending.lock); + spin_unlock_bh(&wdev->tx_pending.lock); WARN(1, "cannot find packet in pending queue"); return NULL; } diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h index dfbbe4b111113..22d7c936907f4 100644 --- a/drivers/staging/wfx/queue.h +++ b/drivers/staging/wfx/queue.h @@ -35,7 +35,7 @@ bool wfx_tx_queue_empty(struct wfx_vif *wvif, struct wfx_queue *queue); void wfx_tx_queue_drop(struct wfx_vif *wvif, struct wfx_queue *queue, struct sk_buff_head *dropped); -struct sk_buff *wfx_pending_get(struct wfx_vif *wvif, u32 packet_id); +struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id); void wfx_pending_drop(struct wfx_dev *wdev, struct sk_buff_head *dropped); unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb); From patchwork Wed Jul 1 15:06:58 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: 1320604 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=J1CE14Pa; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl3W6Hwpz9sTd for ; Thu, 2 Jul 2020 01:08:23 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731826AbgGAPIW (ORCPT ); Wed, 1 Jul 2020 11:08:22 -0400 Received: from mail-bn8nam12on2056.outbound.protection.outlook.com ([40.107.237.56]:52640 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731798AbgGAPIR (ORCPT ); Wed, 1 Jul 2020 11:08:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NgqV6/1iT2/iyYcbp6DNJe474OX7XSS2RDb/e16YGt8sOSxZq8ZYyxgIj0YEhpgPP5Cb6LHAuCfqjZq2VY/JNZRVIexH/0HC9CigHkgstoNk00JVT2YmOyTOfIGmQhoBj+9PdQ7HISM3z+iti4hFkxdrh5hVbing4s13kQ2OgHy8pL8IutVsW+t6Wv81i+ryTjh1KpxS/DCp50AG5d2nhugJdul2MVVrOu9r+/X76Chq/qam0KHobF5GyoBJ3zZ4kOjpQ+BgKBv39EGvrd9hzr7vEZccIr0ERuIqBKwQq0I5wPvzuKsYD81UitTmQPDmWRtzjD2Rrei8ohwhO7nHiA== 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=BoUXTUzrL9Wlx5IeUEgnWIpwJ+//CCk86Mp9ROVa9WQ=; b=RdKTte+krGwS7QmE2SjWG5wmFPn9ybHggqapHb65+yXgcNqBGNBdJR36nxsRxEcbeRBQgffSksfKR4BrKMIR3Hz846zcCOYGOBS04UklJFeA5BEzoHTtdxplqb8Ys7tHd58AbULszb8/iNnN8bbQ/nfHu+VEy1a4LdkuP9tvuy/qJ+bPiwAmxX7uO82p8ZMJu2Q2Xwg3PfbmcI/gGxLpv2g+2l7l29A1g/n4dZQ8lElMHukgh6Jm6iWMdkFuU+1XZBAluKsaqh2I9NHbY9ApUnZl9XJv45fSxysrUf4lgDvoPBWflcpSLQTOBmvX3aYivvq50zpUFH2HWZ3kFGC6Eg== 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=BoUXTUzrL9Wlx5IeUEgnWIpwJ+//CCk86Mp9ROVa9WQ=; b=J1CE14PaDS2/LvPENGR1qpb+82YDT2GDuHAqnmFdrmG5CoTb/z3mxgCVqumdoXj/imDJ5u6wkvbdy+wjkshgKKc2x8H9m3diMg2tudqsv4A2+2ioxBl6bTAQVCtey+N75rK+SH8NcTsq0QPXWNz0w6cpQxBSXbJ7EqdqSJ2aY5U= 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:08 +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:08 +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 04/13] staging: wfx: add tracepoint "queues_stats" Date: Wed, 1 Jul 2020 17:06:58 +0200 Message-Id: <20200701150707.222985-5-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:06 +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: d3389e50-2e1a-452f-e6de-08d81dd0903a X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2nR6khtdnSqw6CGIZL9275ji09M0gGbnvwGYp12bUKWtprwrL/0wYQ/JU56OSpMa+6Du4B0yV/ntlWeXO00o+47fbwVe6ReVmN3zycX4uA9JGkayOsqULOT1Lw5a7ywH+yEwvXbO7V+fxLhzC3G1Q9EJn4p7E5icu91s/TVzjglfTSPP6Sm3Iwumj7davUIhKH6rdiv6349O4gHdBo4Tjsj0VNtC1N0tkAOi26sSCsk/bzCOapXn0CQBINb3gIXMFsPxRVrEBXL8F3tQyo5zabWYDZ2BZVjGjaT/QuJ2SeusZVg1jMNX4E+GxM0ulr9KA3whY576nGY3/+VCvTGpnw== 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: ak0YOdFGxcXrJoOkFPuQQ7xP9UMtzbxD9jBYKrZDYR7ImU/xjc6WwaTWiKQ/wiSG8PL9+uXR68mLf6ZPTvkcU9qyvmrZpY8siCZmVhoQbxtf4+T+AaShwupm9yvCvLSwkAJ71JO624V7Y4ZHBZ1JeT21w0RNQw9hqjTJXXKgeojfsFoaEBp8p6quOTI+2QsLqV4Xiwne3N3gqxNUD7OgqvXEPkcnjBx5C6MfpsWzma97SG15xgTsbrRJLbrXCvPxScJDVssspr9rs/QHHDdK1zptd+/mFh9STFeGzZ5uaCmcKcF/o4AkKVf/omKxIyp90bKU55fyZZOHZD/lQtUvpgEkxVbhcS4gIfrEZPK9yX9Yqh3nCCKb9JB1D9yB1Awf2J3mQtI7qWdOAAUOIvDYVejIHtRsAK/jojuxpT4zoGQuNHiQVkVelH8CKvMQqmNOXKEXzwVKitN9FBwltzkcPvvapGMDw5X+r3XRu3jCCqV9zk3JzDjr4i7WelE0vzMTTA78NU2gL8qaNKjXB3wwncOpy0khDY6eF2KNVgMESik= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3389e50-2e1a-452f-e6de-08d81dd0903a 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:08.5426 (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: WWnuLFKkq14MDgN75Kw1lfNn5a3ZFDOWczAj1TNuPkNFOZ6srw0LEXAmweMBoJsp5hcuBeU9bbEwaAV04zOlPQ== 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 It is useful to check which queue the driver choose to send to the hardware. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/queue.c | 3 +++ drivers/staging/wfx/traces.h | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index 678f622639093..6e31591651432 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -12,6 +12,7 @@ #include "wfx.h" #include "sta.h" #include "data_tx.h" +#include "traces.h" void wfx_tx_lock(struct wfx_dev *wdev) { @@ -256,6 +257,7 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) WARN_ON(queues[i] != &wvif->tx_queue[skb_get_queue_mapping(skb)]); atomic_inc(&queues[i]->pending_frames); + trace_queues_stats(wdev, queues[i]); return skb; } // No more multicast to sent @@ -267,6 +269,7 @@ static struct sk_buff *wfx_tx_queues_get_skb(struct wfx_dev *wdev) skb = skb_dequeue(&queues[i]->normal); if (skb) { atomic_inc(&queues[i]->pending_frames); + trace_queues_stats(wdev, queues[i]); return skb; } } diff --git a/drivers/staging/wfx/traces.h b/drivers/staging/wfx/traces.h index 0b6fbd5186381..d376db2f1891b 100644 --- a/drivers/staging/wfx/traces.h +++ b/drivers/staging/wfx/traces.h @@ -439,6 +439,57 @@ TRACE_EVENT(tx_stats, ); #define _trace_tx_stats(tx_cnf, skb, delay) trace_tx_stats(tx_cnf, skb, delay) +TRACE_EVENT(queues_stats, + TP_PROTO(struct wfx_dev *wdev, const struct wfx_queue *elected_queue), + TP_ARGS(wdev, elected_queue), + TP_STRUCT__entry( + __field(int, vif_id) + __field(int, queue_id) + __array(int, hw, IEEE80211_NUM_ACS * 2) + __array(int, drv, IEEE80211_NUM_ACS * 2) + __array(int, cab, IEEE80211_NUM_ACS * 2) + ), + TP_fast_assign( + const struct wfx_queue *queue; + struct wfx_vif *wvif; + int i, j; + + for (j = 0; j < IEEE80211_NUM_ACS * 2; j++) { + __entry->hw[j] = -1; + __entry->drv[j] = -1; + __entry->cab[j] = -1; + } + __entry->vif_id = -1; + __entry->queue_id = -1; + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + j = wvif->id * IEEE80211_NUM_ACS + i; + WARN_ON(j >= IEEE80211_NUM_ACS * 2); + queue = &wvif->tx_queue[i]; + __entry->hw[j] = atomic_read(&queue->pending_frames); + __entry->drv[j] = skb_queue_len(&queue->normal); + __entry->cab[j] = skb_queue_len(&queue->cab); + if (queue == elected_queue) { + __entry->vif_id = wvif->id; + __entry->queue_id = i; + } + } + } + ), + TP_printk("got skb from %d/%d, pend. hw/norm/cab: [ %d/%d/%d %d/%d/%d %d/%d/%d %d/%d/%d ] [ %d/%d/%d %d/%d/%d %d/%d/%d %d/%d/%d ]", + __entry->vif_id, __entry->queue_id, + __entry->hw[0], __entry->drv[0], __entry->cab[0], + __entry->hw[1], __entry->drv[1], __entry->cab[1], + __entry->hw[2], __entry->drv[2], __entry->cab[2], + __entry->hw[3], __entry->drv[3], __entry->cab[3], + __entry->hw[4], __entry->drv[4], __entry->cab[4], + __entry->hw[5], __entry->drv[5], __entry->cab[5], + __entry->hw[6], __entry->drv[6], __entry->cab[6], + __entry->hw[7], __entry->drv[7], __entry->cab[7] + ) +); + #endif /* This part must be outside protection */ From patchwork Wed Jul 1 15:06:59 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: 1320615 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=kNaaxRXW; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl5974zyz9sTg for ; Thu, 2 Jul 2020 01:09:49 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731992AbgGAPJs (ORCPT ); Wed, 1 Jul 2020 11:09:48 -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 S1731733AbgGAPIV (ORCPT ); Wed, 1 Jul 2020 11:08:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FWehFp4clvN3xOP1vh6nmytlDvSn8nUxuniNzu9FQWxBU9olxcYMt7Hr/JioFwF79jekroQiJDJUxbSKzIIRPCBPlu3dAKbWvre5FWOKdGBzogKYXx/aAXgmZkyGak7i8/uC+96/0zbli3sJrKuSsu22D2aMYZymwzeMiV9xj/1Tdt8+FMI1/gRASp8Yk5l1kuA8A82P960/luL5Z8OCsyMHojaCbpXeyHv2V4LBkM/wr+pbLLnfyKcUmPTtsiLWAQT1fWJqOuCbSFKjZCtYORZixTLX13ciMFrhmR4ee+C4vJ/GCx0d9iIPYQoYlWadeMQ0wdOTzO7mnzlLymmeWg== 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=aXpNpMygO/KPLne8WsJxsDwp8Ia385m8ResSG8rBl5Q=; b=AOUI3c7PPRKmf8uEtY1YpufTcJvEPn2nl05VAMchvvnHTLaYzR3VKczs+B5fTXkRBRWRccBDIjiZbtWL6jk9NXNElAOUmcCp2hrp9hRRutbLd5o86Z5aJHbNZVEjwMhgfChJ2cJKIR+XMJSIwS14e6ZbFOpg8yW3ml9g/Ng0zGekCiDnjXX22T7kFZXfnrxuczYDD9lCtkvCFiVbA1RVHqmpkg7HtxodEvHfy4OkUOKcjhCinJ1H6moPxpoZuSIa6oyhEPt3QWqek55++KFUFQcAdMYUdxX1juMcVy7U8eNzECHhJfh5Kn+bc9dHUHNvQugUkYgNRYvoVmPTViO6kg== 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=aXpNpMygO/KPLne8WsJxsDwp8Ia385m8ResSG8rBl5Q=; b=kNaaxRXWLdKwJqRcbW/Ly6LPZ4c45zlT+i0cZswiaWopCNxmCHCtb2mbYBw7giI9sBaYnasIDLSwRVgwplyY1BUjHIoA1ZaXBIHYrwCPmlLJHfXeHNI1JtH1UCPv1urMv1Jsc+W33AtpYNK7fCslYyNXPR0Pyygt4CA7RbA/+Kc= 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:10 +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:10 +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 05/13] staging: wfx: load the firmware faster Date: Wed, 1 Jul 2020 17:06:59 +0200 Message-Id: <20200701150707.222985-6-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:08 +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: f42951af-6a5d-401d-bbe8-08d81dd09164 X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sBZWOlsYLJSqTfRR5g1qT8KUPqM6LKt9VKnjsKUVIkoZlZZwX1y5zeyFl8xUBGLRSGR5zOGycdTflFI/36QI06pwGlaTxL9OCp0ABYI98dzLSDYBWZHiKTUEoDjPui5s9WzxWXHSiRiTFnW3AmCv3I+1KBDbMrv+bCQ5FuK+NCSGsatLkdAdeO7mYaKFSlZKoElKXmyIdQEG2/zK5Fk92h25wD02ZYIfUVvfvSItta41bIQeiMqp7NqNgY49rEyza7rxYJ2CWUDskPB2sKvkUf86roRarA/i1uLuDsSMNqhgkuNRMLyqu0/9mDyvGvkWrgTtT579gKFm1Uw3sjwItg== 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: 3bWFuyGlUSW2/tGfgR1l8YLSFNc9PEN3jY7pNrVq1utUvIz1lQuefYCuwKPnDUea7WOBy2VwR8B+QqedHCZ0cqgf3x8tgAT9ylmzASaxaqUOwREdxE7Ry7T/Sdhq3AHPh8QU1bX37qpL06wWvc7sV7nlKa7gn/DABoXCpvAmXGMk7dGmzS8AjFv+vPE4dq4ZW+6ENRGopl8SiOCE3ZCgqUCi0/gmIokfE2vlHH923oLMyN1Z8bsN7qkEsjVj9DDtOdP4SoxycidY34i5xaBa7XCxppq0RRctNydnPO4dlP/aAIjeQhp6JiGCngiA2KyUTBGe8i503lya7MDuOmpp2Ej/Y3ZDDw3pLTejobmS0zirmhYJQnoSlVC1SWg85aqIEjoN3pD+590qu6KgU6IvaCqnlpfWqBADhFJaF1ZLsfSj1AzFArc6hElDdcIZ4llfM+HJRrIDV70vjzjpX8LTdH/hdDsl7KcuMdsiWQQuU7BAnMMK4wmJYGvpi1ouQbq0nhGp9k6wgQW5aX8VESNFUU4/m+c4PJ/9e72uAcYTgPI= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: f42951af-6a5d-401d-bbe8-08d81dd09164 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:10.6234 (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: DQUaFbVTZ3Nakx6JSo3Zr38I/Vwo7ASBvB9/tOg84r3tK4Zvjh3KcA+Vyn+W16O4i/UILinXbP/XOhzNIrJVSA== 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 During the loading of the firmware, the WFX_DCA_GET register provide the number available bytes in the receiving buffer. It is not necessary to access to the WFX_DCA_GET after sent of each firmware fragment. This patch allows to send the firmware: - in 64ms instead of 130ms using SDIO bus - in 78ms instead of 115ms using SPI bus Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/fwio.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c index 72bb3d2a96138..d9a886f3e64be 100644 --- a/drivers/staging/wfx/fwio.c +++ b/drivers/staging/wfx/fwio.c @@ -188,15 +188,14 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) while (offs < len) { start = ktime_get(); for (;;) { - ret = sram_reg_read(wdev, WFX_DCA_GET, &bytes_done); - if (ret < 0) - return ret; now = ktime_get(); - if (offs + - DNLD_BLOCK_SIZE - bytes_done < DNLD_FIFO_SIZE) + if (offs + DNLD_BLOCK_SIZE - bytes_done < DNLD_FIFO_SIZE) break; if (ktime_after(now, ktime_add_ms(start, DCA_TIMEOUT))) return -ETIMEDOUT; + ret = sram_reg_read(wdev, WFX_DCA_GET, &bytes_done); + if (ret < 0) + return ret; } if (ktime_compare(now, start)) dev_dbg(wdev->dev, "answer after %lldus\n", From patchwork Wed Jul 1 15:07:00 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: 1320608 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=SRa5UyIK; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl3q0xYDz9sTb for ; Thu, 2 Jul 2020 01:08:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731888AbgGAPIg (ORCPT ); Wed, 1 Jul 2020 11:08:36 -0400 Received: from mail-bn8nam12on2056.outbound.protection.outlook.com ([40.107.237.56]:52640 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731811AbgGAPIX (ORCPT ); Wed, 1 Jul 2020 11:08:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lbHVrVOIsbuB/SHLRIj5oAmgWj7ogtM0gsr6NIoRDhlr1WgPMOJ2BwevMjBYgmhzGQBEbv42FWeGUgagOpqsl1R0rMEgbOZurDafMNS5Bb8tzmmFhI/ld8Gp49Sb0BZig1t2UzymGzbnH1r/gGahLuHg3lIMq8xXj75IPorNdEU6SecMmTZP7Ja9ZxD21leLTw3IsHVpEBkLbHebN/Plvv2xqfp2PGB6b6HtN5U/UQc7QNZvcsCadtQZn2MelnkcT7L7D+jL42iRkYBPnoXhkf7jC0//7f9rgMpBrbptntZLd73q+nBEkg59kl+YnejqZ6UpX8xjThgByyxXlXzQhg== 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=k0WYfDeM/2vOHp34XrR8eW4auaR/xAu4eeyVN3zjOvA=; b=GozECPuVJ/UFREoZAGBXZ7SNSUHUB+a1AhfPqKoWG+gBZjVa720ZMZaC2O8nbEWpoUQiDwsggaiii995Vo1QA+ildZaA/OF+5Ojz+Gdb+sMkLkF2y5sJNlYp6vIIGC3hBomlOOBJx6zYZKJvV3425Eyp2zWxEH+Z/aJD1q6vHanC672fTyUh/awynBlSxIgji63aKxy+9C24fynCV4zFgWGRRPjc1iYHNw0jsjnzq3jTkwKTFGwTZivf6Cnj66wPOsex+q8MwYjiz+Eq1ctBMR+fWpWusglex0nPdAWNoFas86NcNZ2BaCZLE8p5ceMJnUjc7iZWLFAat9lqYofdtg== 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=k0WYfDeM/2vOHp34XrR8eW4auaR/xAu4eeyVN3zjOvA=; b=SRa5UyIKyAoXsubsL90j/wdNwtxPecSs/f4ylUvv2h9+wBrcei+EY14bq2vrYWQn8fcNIICrset0vQGBNWEiy0SerKfes4Lt14lVscz836wp17u6YykTo+pCeHL3y4I6KUoNsrxZUEJeRtNFynC7rBco5XcDL9PVRdGegH4rBiQ= 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:12 +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:12 +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 06/13] staging: wfx: improve protection against malformed HIF messages Date: Wed, 1 Jul 2020 17:07:00 +0200 Message-Id: <20200701150707.222985-7-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:11 +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: c11d379e-9ead-40ea-b9e9-08d81dd092b0 X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5QYgg2RoPGPR1x18EAFYbwOmnMpkLwy/aHnPl3r647fjOPUPib096624pKai78YCpnzDg0iwhO6WArdy9XOp2PdSJmymFWWJEVOU1oOxZqdlK+Nae6l2wQHwu32oAAGVr1Zco7z+N5k8YQlL0vymuhGIZvy91B//nwVrvXJe1M9BjA52DPLgh2M9qHjSTp2/cgR3BYlRRxKT/qTsA1qvOHKODpcwt/kshTZTEfep34UKPaY1W3Yws7FZbKV1y8l02PhcQ4R3R6PjXBX19CcdOHyptVBmHOtcKP9Jeb+1Nn1ZXm5b55RiIRWSMuIYGo+LAN+l4rfgZQuFHJOOG2HBd0VEwaP68mRWHv0DS/ntcX4gOvkK9R+VVAiaASHBzYcgnhcgepx6apa2qJX8AqVxK/dXV89dZ8Khv6ZEjoWY0DtrK/+mWqVSn3lf5NmCELzqhf4/8K7ReYPQ/FkPj7NKAw== 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)(15650500001)(86362001)(6666004)(66574015)(36756003)(2906002)(43170500006)(186003)(83380400001)(16526019)(8936002)(66556008)(66476007)(107886003)(4326008)(8676002)(2616005)(1076003)(478600001)(316002)(966005)(54906003)(66946007)(52116002)(7696005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Dv9ro+k0oyQoP1fWqd9tkzoOoT0I0/iTPZb6/CmrSRuYH2KPCm2cwPzugnzLPAfAh3IVdaXHI+PZQJzzevolb4DxXjOqUTNxemqaTnnY8SE48QlU6+No8bI0dBWijqEKyruA8RhjjmRykgMdF69UcdXxaLYuKHSXx59qhPScPgt0qNNuBozNQiGtivLBG+3DV5weW6ezogu0lQp38AxUhC6yEgd1P5HVbN4cFjbt0PcaMi3ELUvFhn8us/7oN2XAyB4PwOQvErlLQzsw5TFJZc/OOC+dsSC5f2Y8udaOdX7qr5HEqBe8Apy/gU+oy2sZLOf/4EuUIQ14H8eFvR93j9n8RIFPDROqR+Y0Eue7PjSf8MH5elTk7rR+Nc6BpPnvuIDhL+/phemVh4pfzgkmbkg5Iv3mXJV/pbpPPIhTAjVQSuiPuy1khhbheEurrqLd6WuKCfELIuUNFsWnlzJbHrvW2g1dPypTbHOBW6sB44SE0Vebj9O7SG06Ibfh88WLcgQeDvY1RAw+6G5T9D9ijzbCok8x24/DnpW245K4zAY= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: c11d379e-9ead-40ea-b9e9-08d81dd092b0 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:12.7102 (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: eYoMifO+MuLMW11K5+kskinhYhX4aOwuVwTbCjqZlQLh9lGHp85liDDI9dVhxGVrBl8pbNtAAZR1pGbBstWJJA== 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 As discussed here[1], if a message was smaller than the size of the message header, it could be incorrectly processed. [1] https://lore.kernel.org/driverdev-devel/2302785.6C7ODC2LYm@pc-42/ Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/bh.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index 1cbaf8bb4fa38..53ae0b5abcdd8 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -57,7 +57,6 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) int release_count; int piggyback = 0; - WARN(read_len < 4, "corrupted read"); WARN(read_len > round_down(0xFFF, 2) * sizeof(u16), "%s: request exceed WFx capability", __func__); @@ -76,7 +75,27 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) hif = (struct hif_msg *)skb->data; WARN(hif->encrypted & 0x1, "unsupported encryption type"); if (hif->encrypted == 0x2) { - if (wfx_sl_decode(wdev, (void *)hif)) { + if (WARN(read_len < sizeof(struct hif_sl_msg), "corrupted read")) + goto err; + computed_len = le16_to_cpu(((struct hif_sl_msg *)hif)->len); + computed_len = round_up(computed_len - sizeof(u16), 16); + computed_len += sizeof(struct hif_sl_msg); + computed_len += sizeof(struct hif_sl_tag); + } else { + if (WARN(read_len < sizeof(struct hif_msg), "corrupted read")) + goto err; + computed_len = le16_to_cpu(hif->len); + computed_len = round_up(computed_len, 2); + } + if (computed_len != read_len) { + dev_err(wdev->dev, "inconsistent message length: %zu != %zu\n", + computed_len, read_len); + print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, 16, 1, + hif, read_len, true); + goto err; + } + if (hif->encrypted == 0x2) { + if (wfx_sl_decode(wdev, (struct hif_sl_msg *)hif)) { dev_kfree_skb(skb); // If frame was a confirmation, expect trouble in next // exchange. However, it is harmless to fail to decode @@ -84,19 +103,6 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) // piggyback is probably correct. return piggyback; } - computed_len = - round_up(le16_to_cpu(hif->len) - sizeof(hif->len), 16) + - sizeof(struct hif_sl_msg) + - sizeof(struct hif_sl_tag); - } else { - computed_len = round_up(le16_to_cpu(hif->len), 2); - } - if (computed_len != read_len) { - dev_err(wdev->dev, "inconsistent message length: %zu != %zu\n", - computed_len, read_len); - print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET, 16, 1, - hif, read_len, true); - goto err; } if (!(hif->id & HIF_ID_IS_INDICATION)) { 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", From patchwork Wed Jul 1 15:07:02 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: 1320614 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=PVHp4wgR; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl501Yznz9sTg for ; Thu, 2 Jul 2020 01:09:40 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731972AbgGAPJc (ORCPT ); Wed, 1 Jul 2020 11:09:32 -0400 Received: from mail-bn8nam12on2056.outbound.protection.outlook.com ([40.107.237.56]:52640 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731843AbgGAPIa (ORCPT ); Wed, 1 Jul 2020 11:08:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oWXfQ+dyPq6nn/84lC1n6QxQKNwxYE13n7NDKySWMsPjp6Hp56JeMa9/SzPi+9fkXrrraxE7EfO2h0zodh/bK0zHau9+PQJatyRXqGXCuSGYl6nkcORQ5izTxh1ISH0ulNL+jEtlDANhnrfRCj6RGL2/JLY89hTzh17WODaJa+F/wwGxmb9jWveFGJNPJyct/+1xnDe9yLcAPva6t5MtBw5ITIANrmuaNwq2HYoINxF1ilc0/1JUNFQNzi1uDvC8VXQ74nX/aaozj3y98LJb0Ve1caCRKX8R9wdGDYHfnFLO4aNOREv18NHllfJ2UOffsU/KSdi2V9xTdS2EpyC02Q== 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=7pEYsHPpbXvzL6FnSTWAELx9kwwDtV4QGWMWXcbdw48=; b=StAJwQcIJcD7YCLfo/Lek+xTyl9S3nrE/AbvcLCmjFs1SedMGtRCn1egCaOXJEdsnkMycNMdMtqG3rJP7c6ATqCoUpuXFJyI2NsfbrmE16UvzvGOlzdqBMtHOe92oTPc81XZvcdvQkDp4C9KLOWANiluTcisq3jwQsR35iaoGSftECtJY6i1QYgzlK7ZTTyhduMe+V2qWV6BuHW6d9xi4vkIhcwJV4I3+sJMmIi6hm0z7FQbm9+hwgnMeVna+X3KzDLhkRTRrWmSheKwLtlajDUi6auOAFH+x/jd16uZ00BVrzsiNOdFAf+bQvvM6g21ZOlTfuF6kDF0qfX6FEliwA== 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=7pEYsHPpbXvzL6FnSTWAELx9kwwDtV4QGWMWXcbdw48=; b=PVHp4wgR6YqF5eTaaU8kOUfT/s91JSfpMaUnhQIZGJepTHpwiMKDmT74VZ/c+wL/1b8aYJmbusyXxbsQ7ufBFkGoMKxqq0XgPeDQ696X42RW4mbMiUXZTETqImQ9iPpxd0DYDhCJBakSxeIOGlr1++VJQEftjD/BXoNVgInNquc= 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:16 +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:16 +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/13] staging: wfx: drop counter of buffered frames Date: Wed, 1 Jul 2020 17:07:02 +0200 Message-Id: <20200701150707.222985-9-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:15 +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: 7457a744-0560-4351-37d2-08d81dd0950f X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4VkvSWqgCkqm0A7Cfp8oUU2xEfnB60kihPgG47viZsCo9Cr/a1xUglJ3ATaXl5BdTv39CWIoCY008FuhOa60qpXZIpwFyw7MFNZnOS8A0YbbXeZAKqDtnuo2WWyOx5+YH05Fgn0eA8hVgw1klfjq+NiaK+aWFoW5XjwseAq6+IJtgiexlwyccAcTBlezpwEzJ3dY4PF4QUdeKGGCjUYkApAmmRsC7BWZvX12ppQsXzUPCUDA1fcXconjHtH/t7ksQ9zmQ2NrvYjiP24fm0Rwt5Ql6sHZYaP0/w/JgMz/0e0J9D52jYz+vChR1wjNbxyuvd4Gc3mZFf+02YR1xoo5Xg== 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: iPiUrPr6yGm9wUEriqgzw6oo2GK5LNkdgQiS0qXkwkXnWZzqrvBij6IPM+4Q+3LW5wOJib6+ZzbStkyb3J3Dpw8OOIqhYJaBgb8gPynRdh6qUNUiY6wrpvul3GYPdcX0Ry/KPbtRTTBLRyaYRheWz3e/M/0cwHXqt1ZCs8H7g2Ef1FFS8HdB+u2nRbAeidTCXdv6Bn6w1BntoL1j08Y33ix1UTwbHabPK11jCCKFvdB86zSytvopxTbTMvLZFOjPiW7ayYx6H/nck5rtifh4dWityRtuOcQ0i6AwPnt8stvSIPrSlOkuabCc9Rt0vGH5kxH6fbXqNF8U4d77JNhlM2wcZ1fCM3Dr7hiPG2LX7Fp3K2FY9QkvVE6CE5lMpWf2/ZA8ntqG23g7iAOkgZshQbziVmmeNS9PbMTWHbAlGczDXLEDmlj5vsaj9uR5QucqdbUxPQtgtfspngd5poq4szr1cxKWENQNjnqvAtZ+moOEkKrTSsYS39dCwpgd1uIFjC9x2AKuOhujwGO0MpUetR/A9NrW3ybUvRecCFS8inY= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7457a744-0560-4351-37d2-08d81dd0950f 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:16.7109 (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: AVi/vUHFoqoOYGRj5HNMF5P6uVT9lI8YlAOcP/vG7RfoLGxuTlPSP5/rO22waW9k7d8pjwRWQeq+VW5i2jJg2g== 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 Since the driver does not call ieee80211_sta_set_buffered() anymore, it is no more necessary to maintain a counter of buffered frames for each stations. This change allows to simplify the processing in multiple places in the driver. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 50 ----------------------------------- drivers/staging/wfx/data_tx.h | 1 - drivers/staging/wfx/sta.c | 8 ------ drivers/staging/wfx/sta.h | 3 --- 4 files changed, 62 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 3244a768345c5..5c744d9c8c114 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -213,22 +213,6 @@ static bool ieee80211_is_action_back(struct ieee80211_hdr *hdr) return true; } -static void wfx_tx_manage_pm(struct wfx_vif *wvif, struct ieee80211_hdr *hdr, - struct wfx_tx_priv *tx_priv, - struct ieee80211_sta *sta) -{ - struct wfx_sta_priv *sta_priv; - int tid = ieee80211_get_tid(hdr); - - if (sta) { - tx_priv->has_sta = true; - sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; - spin_lock_bh(&sta_priv->lock); - sta_priv->buffered[tid]++; - spin_unlock_bh(&sta_priv->lock); - } -} - static u8 wfx_tx_get_link_id(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct ieee80211_hdr *hdr) { @@ -406,7 +390,6 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, req->tx_flags.retry_policy_index = wfx_tx_get_rate_id(wvif, tx_info); // Auxiliary operations - wfx_tx_manage_pm(wvif, hdr, tx_priv, sta); wfx_tx_queues_put(wvif, skb); if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) schedule_work(&wvif->update_tim_work); @@ -449,35 +432,6 @@ void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, ieee80211_tx_status_irqsafe(wdev->hw, skb); } -static struct ieee80211_hdr *wfx_skb_hdr80211(struct sk_buff *skb) -{ - struct hif_msg *hif = (struct hif_msg *)skb->data; - struct hif_req_tx *req = (struct hif_req_tx *)hif->body; - - return (struct ieee80211_hdr *)(req->frame + req->data_flags.fc_offset); -} - -static void wfx_tx_update_sta(struct wfx_vif *wvif, struct ieee80211_hdr *hdr) -{ - int tid = ieee80211_get_tid(hdr); - struct wfx_sta_priv *sta_priv; - struct ieee80211_sta *sta; - - rcu_read_lock(); // protect sta - sta = ieee80211_find_sta(wvif->vif, hdr->addr1); - if (sta) { - sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; - spin_lock_bh(&sta_priv->lock); - WARN(!sta_priv->buffered[tid], "inconsistent notification"); - sta_priv->buffered[tid]--; - spin_unlock_bh(&sta_priv->lock); - } else { - dev_dbg(wvif->wdev->dev, "%s: sta does not exist anymore\n", - __func__); - } - rcu_read_unlock(); -} - static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb) { struct hif_msg *hif = (struct hif_msg *)skb->data; @@ -553,8 +507,6 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg) // You can touch to tx_priv, but don't touch to tx_info->status. wfx_tx_fill_rates(wdev, tx_info, arg); - if (tx_priv->has_sta) - wfx_tx_update_sta(wvif, wfx_skb_hdr80211(skb)); skb_trim(skb, skb->len - wfx_tx_get_icv_len(tx_priv->hw_key)); // From now, you can touch to tx_info->status, but do not touch to @@ -634,8 +586,6 @@ void wfx_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, while ((skb = skb_dequeue(&dropped)) != NULL) { hif = (struct hif_msg *)skb->data; wvif = wdev_to_wvif(wdev, hif->interface); - if (wfx_skb_tx_priv(skb)->has_sta) - wfx_tx_update_sta(wvif, wfx_skb_hdr80211(skb)); ieee80211_tx_info_clear_status(IEEE80211_SKB_CB(skb)); wfx_skb_dtor(wvif, skb); } diff --git a/drivers/staging/wfx/data_tx.h b/drivers/staging/wfx/data_tx.h index b1727ddecd5e2..cff7b9ff99a99 100644 --- a/drivers/staging/wfx/data_tx.h +++ b/drivers/staging/wfx/data_tx.h @@ -36,7 +36,6 @@ struct tx_policy_cache { struct wfx_tx_priv { ktime_t xmit_timestamp; struct ieee80211_key_conf *hw_key; - bool has_sta; } __packed; void wfx_tx_policy_init(struct wfx_vif *wvif); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 85d4bc2949882..2c0ab51fc92da 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -430,7 +430,6 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; - spin_lock_init(&sta_priv->lock); sta_priv->vif_id = wvif->id; // In station mode, the firmware interprets new link-id as a TDLS peer. @@ -450,14 +449,7 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; - int i; - for (i = 0; i < ARRAY_SIZE(sta_priv->buffered); i++) - if (sta_priv->buffered[i]) - // Not an error if paired with trace in - // wfx_tx_update_sta() - dev_dbg(wvif->wdev->dev, "release station while %d pending frame on queue %d", - sta_priv->buffered[i], i); // See note in wfx_sta_add() if (!sta_priv->link_id) return 0; diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h index 8a20ad9ae017e..43808cef4785c 100644 --- a/drivers/staging/wfx/sta.h +++ b/drivers/staging/wfx/sta.h @@ -16,9 +16,6 @@ struct wfx_vif; struct wfx_sta_priv { int link_id; int vif_id; - int buffered[IEEE80211_NUM_TIDS]; - // Ensure atomicity of "buffered" and calls to ieee80211_sta_set_buffered() - spinlock_t lock; }; // mac80211 interface From patchwork Wed Jul 1 15:07: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: 1320606 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=g2iuQ/4i; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl3k70s6z9sTb for ; Thu, 2 Jul 2020 01:08:34 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731875AbgGAPId (ORCPT ); Wed, 1 Jul 2020 11:08:33 -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 S1731845AbgGAPI3 (ORCPT ); Wed, 1 Jul 2020 11:08:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MypLRVA1DHmlwop3EhZLGIbLDif79yXOGCyxsOVPg6RORZphBoviyJvD+lyioqw3NtZD8QmU0JDdTDH2av4lBF7cJRAh37huvJSjIpGP12fnvjYcDV2PnVPXB6wQEvEzkkD2gjjX39tm/EDIqmHh6983yQE1+xZBz/L19wp63gPqW4r0kjM0ZhDhhq1J73AnuoYzLbmwN+d9OBPSrHZXr+KyRPQ1Y38eikuArnGa2EzMBoEfVWqkCDBgCaaxGDKnmkPC18YniJq7R1Dskx0JujH1jbpZgbCTD7t5C8sK62vi6RTUemsSHAsrwwPsdsHf1K9oMAOe/plilBm7NCkPow== 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=O2NKDaQe/6CFDqZHeggRlniPaBmOJuP7JnQFWnZub9k=; b=geZgIrdfo/FEfBGZRpB1eEz9IVbSS6yAFUySbkCM/Jy+FoAZ08z5Ee8IrpdeP4c3wP7tLrd95GVd/ddBaRtu8yKox+hVA4jWdsgC2tj+I4UvOMIngdarelNWTNxiTK/ocWSxardYAcxVnOSZ4kNGvWLL8fT/w6Ez7yctAWIbC+Yffq1CsrpzBv6nFYNZ1wLLuiCf1eUqAinaFX6ZZ432kNnEW8SC2e4ciq2qDzrGvGA/EAX+I17fuCU8mDvSSEnZWCddgbvySI5oLSoTJXGsYIrnwFsHoFdTnTYGpLgZ2lDk1GlBVxZGMmucSyVvPW7cKacPRLzSp7VfV+AnDS/krg== 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=O2NKDaQe/6CFDqZHeggRlniPaBmOJuP7JnQFWnZub9k=; b=g2iuQ/4ieQPH+9ymq1dFhieyZLrj5jZP34DwSg74zSzXrU+zYccSHRBcxphyAHd43COK5aXDag9FQVnxTSFrWemFXQDnTHk67oUni+ifxGTVki1F3fKBA6+1eee8Ng3IK/M3hg708R3k3+FKnZaHd/yhGfIxVRBL10FIkk8cXas= 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:18 +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:18 +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 09/13] staging: wfx: fix handling of frames without RSSI data Date: Wed, 1 Jul 2020 17:07:03 +0200 Message-Id: <20200701150707.222985-10-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:16 +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: a6780273-4365-4b9a-7e23-08d81dd09632 X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CT3etVr8Cjo8YGJM+lNHOpRIrWE1eC3aO8gdgRf1qGCDqef+JRe1jIXgCGy4Nke3aHYcT/JjRm+GtLVA8/7uTY3KFTXcwNAXqrqErr3bvbp4Zyf4o9nQOifeIrjApLSZk3tQUEicIzqmC/9zhWtQJ1zNa0zEDdHofTsSwE+jWdeqaIyiU1gpql0Z7N9BeMGiEh2goGJE3uLFU1LPs3IaXW2933s0HeCZudgLf4FYoEHf2w/7XOyr+58ddgJZA/mq+taUBmS2CjMEP/hAWV/rLJRe9MGZvgoUusanBrnFGMFLn/d82PgEt+uDCXv3NxQvRy13kOpcNzIjdLt6n/ohqw== 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: oOXCePgE8ZN0aG9e+Bp8nnnKMjZzLFrR8vfP18Vny4Tjpn6AvNMPGxpaQXyEFC68kXzK1NJThDRMTCEPpfjMO3jlNM31VWL8J1ZvZ2PUoqs5/tYSXsEG1ULKaczwWKOHbrcY4xpLefxUtg2VBaat0OHfCyXDUWX9+aTYgkEPBmBUP/yX8MbB/M1LsmbBGoTbeVjjBnH74Us2/jAUlOWchM8I75j0hAcYR/zBSnU4ntDn3iWoxC/UZoUNnLEBWgVHLLrEzeRJlwE0YwavGe2RksmVw2pY3DUAh4Ij2jGf4UBaojzQxpk6QHTKBnUF+DGScEx6n2QCyBkNNXSc6ojvZ9bsH5fYVgNMCo1GHHLwIS8chvPGkf7Td9lgpR/7TsLPHr1WUS2jL2Zw0usOOuVfptB0mrm4ua18JYwoBV8+vlDMrRP+8KwPC+y+93v/nFCuJeuJmd/FoGRjiSc1h6uWFiDSzQ1hLHnXUPWu9kS9Dt7j9QulNxzUP4QPv8Or/HmrGWcsD6hUy6VeN8EMSRXuFEmxA036PfY8kiO1Xr7ECCc= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6780273-4365-4b9a-7e23-08d81dd09632 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:18.5868 (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: IOXIUmDcId3PRzOKXUWxfv32vR1Y5LOdzizuSZ5cn3k6B7tMtZ9HXG9KyS/MaNcBuUU/4bECkM5p4bIlZcc8JA== 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 It seems that in the old days, the RSSI information could be missing. In this case, in order to not pollute the RSSI stats, the frame was dropped (!). It is far better to mark the frame with the flag RX_FLAG_NO_SIGNAL_VAL. In add, the problem seems now fixed in the firmware (at least, it has not been encountered with recent firmwares). Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_rx.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c index 0e959ebc38b56..316c2f1537fe5 100644 --- a/drivers/staging/wfx/data_rx.c +++ b/drivers/staging/wfx/data_rx.c @@ -73,12 +73,6 @@ void wfx_rx_cb(struct wfx_vif *wvif, memset(hdr, 0, sizeof(*hdr)); - // FIXME: Why do we drop these frames? - if (!arg->rcpi_rssi && - (ieee80211_is_probe_resp(frame->frame_control) || - ieee80211_is_beacon(frame->frame_control))) - goto drop; - if (arg->status == HIF_STATUS_RX_FAIL_MIC) hdr->flag |= RX_FLAG_MMIC_ERROR; else if (arg->status) @@ -102,6 +96,10 @@ void wfx_rx_cb(struct wfx_vif *wvif, hdr->rate_idx = arg->rxed_rate; } + if (!arg->rcpi_rssi) { + hdr->flag |= RX_FLAG_NO_SIGNAL_VAL; + dev_info(wvif->wdev->dev, "received frame without RSSI data\n"); + } hdr->signal = arg->rcpi_rssi / 2 - 110; hdr->antenna = 0; From patchwork Wed Jul 1 15:07:04 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: 1320612 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=PESL5l14; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl4T2GRTz9sTd for ; Thu, 2 Jul 2020 01:09:13 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731963AbgGAPJM (ORCPT ); Wed, 1 Jul 2020 11:09:12 -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 S1731780AbgGAPIe (ORCPT ); Wed, 1 Jul 2020 11:08:34 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S68QMCsToCvYzqlnINJY+6L6yb5TS+vlvaHc1vVRynLKZvNtMBp9pyD30dByIKE1SvN6P7V+mSz+rViXKaGjpmMSnuq55t7JSPu7aWbGnTkM3znD1IflzSNlfdunstKT1uhljvSq4GTdd/ytuCQb9ezXz1oLlkn0j+9u372PmhYFy8QV+TB/0rdPHd5t6lrTgjTiF7CJNzKXv4NllYqsgec6BiW5dNn2v1PNlew2N3oEBUIIEXOwF+btRufJmxGeZt/KD6/i+E0HagL95TcqJfiU5FPPWeCfyqwIzA2fozdFu7sUK2AEXg24Mzdu9YZFKhQIJDlDtm7btOVY0vD2Jg== 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=R6b7vknL1fmLF2G45nV1ZuX4yW8ngc6jD/djmpaSsGo=; b=N0XAP0HcMqtZkb9+bclAVcxxzo0ITLUvou8Hdd0frhAswSsKjlzc5fQw2JGAUb6HAFiJWY5fC4YBCQBRFUuCHC0UxFyAJjylGDPrJ531/z4dVBsA8L+nLGSabB6nc63vEZshmw1fu4tDZZRWHoZ9RVvuwP7jfp+dXS/dP3f+xDW0z309vHjwvfoYXdYa/JkxV1Z2y0xAIdvRkcVrX51Q2N2Chx0zhgYFbVY7/avaMDT1sHiZEgewwKVvrWRS8I0LCKGsHEQo1lvvvN4O5muCJMOZCiXbyZ1Pll9ZBowz45WVqxKbm/HxZrGQpllh8i27bRH6yCfUn+HjNSPJ8y0rcw== 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=R6b7vknL1fmLF2G45nV1ZuX4yW8ngc6jD/djmpaSsGo=; b=PESL5l14KSrMK/b0kwEzJdRYgHLJ282X7PmsI2xn1Jpi3LBds2asJIAEEX0Nllwjk5xLYQo1hl5I8BEvqMP8RAJTMXKywFelIz0CAVYs+MvDMg+pOVZPod7+iMS3/ZSdHvY9e9A1uhr/iFrGaMJy/GW5bhV7dRHuhpLm3kI6Lbg= 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:20 +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:20 +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/13] staging: wfx: simplify handling of encrypted frames Date: Wed, 1 Jul 2020 17:07:04 +0200 Message-Id: <20200701150707.222985-11-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:18 +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: cfce7e93-f286-4fe7-fd6d-08d81dd0974d X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xyoaaWMzB8yML1Av7vf5WlIQdyH2lYiACo8UWyKlfSwrQgBjogxft9jKRDFtMYsbRRA9Amy7LAxF6NuUs0CLm1wLNY/UA/ife3Qnyq2LC6NgmuzPbmj8ya0OICh8eUw72BbXsy672eGcOtbyHMcYb3a+RlWbdpgjJn4RgA8U8p5ID3ErtA+Wk6rOE5WVjKE0BKJNMVU2NNk7d2IBFLDqGClynqM0bB1b696Z1XbARCGe04237yIZS4plB7rIisggy+/ssL4d4ziCVWnlQF9DQMwMhF7ig58C8uCN4uQpQZf1KULqRFkRcAnqbrj0Csxm4oa/67L+GCgB2bB3y5Ym8Q== 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: lzCiDyUbt6pmgFrZks+GLAfgb86XMc95iz/B5x0y3kw+jT0w53MTXN229bX+A/tG5uvH1QnuG4y554yPTcQJkb0/6o+so0ZZdKu1H1Ro9hxvaoSRQNv66yu2slBsGsc6zGoIISWjiijdISoV7DSpoKIUZDKQkDc6Hy/jZYpsOS6PRZXTEiCxARhdeJcanOLphLwHoA2nssHtcFeSnx5UZ6DIHkp6UoLi23hRmUJUpYOxKpi7ZF0H9aUNmLD6h1/VlCtZxAZwY/2Z4CM5PdGs9qGtDbB+9P8c+nmWzXJCABBsvZsDDjcTN2JCt3D1bk9K/5obZdDaDCMMF3p5GPOjTymPtneeSp69lFExjH0Pr9IBETd4nsLGIM139vWHQPdrhswIwqKenBP+gMmDhb9ij5Qg5bw+yJm/SAqNS3HeQDAYsbNpGyEa6RDEHq59s7DFM+tC/xlvL/eS+DRrQgGRjOHsPyP7j7eXOaVVcihxl3Qoc1O0V3FsTqZvags6Ep3CjFjbOZfN8OHK5Ul+KYJHyrx/SfCAvM39uR55WEFCQOw= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: cfce7e93-f286-4fe7-fd6d-08d81dd0974d 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:20.4207 (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: dPYS8KUGYq1340NlcQQjho7HEEYeKxnWectYjoZxjCUvoVWZovEKYgXdIyrDwVtmDsQOR00w2SXIUytY4cbhvg== 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 We don't want mac80211 try to check MMIC and other security mechanisms. So, the driver remove all the data related to the encryption (IV, ICV, MMIC). However, enabling RX_FLAG_PN_VALIDATED is sufficient for that. So, drop the useless function wfx_drop_encrypt_data() and enable RX_FLAG_PN_VALIDATED. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_rx.c | 60 ++--------------------------------- 1 file changed, 2 insertions(+), 58 deletions(-) diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c index 316c2f1537fe5..60e2e5cb4656a 100644 --- a/drivers/staging/wfx/data_rx.c +++ b/drivers/staging/wfx/data_rx.c @@ -13,57 +13,6 @@ #include "bh.h" #include "sta.h" -static int wfx_drop_encrypt_data(struct wfx_dev *wdev, - const struct hif_ind_rx *arg, - struct sk_buff *skb) -{ - struct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb->data; - size_t hdrlen = ieee80211_hdrlen(frame->frame_control); - size_t iv_len, icv_len; - - /* Oops... There is no fast way to ask mac80211 about - * IV/ICV lengths. Even defineas are not exposed. - */ - switch (arg->rx_flags.encryp) { - case HIF_RI_FLAGS_WEP_ENCRYPTED: - iv_len = 4 /* WEP_IV_LEN */; - icv_len = 4 /* WEP_ICV_LEN */; - break; - case HIF_RI_FLAGS_TKIP_ENCRYPTED: - iv_len = 8 /* TKIP_IV_LEN */; - icv_len = 4 /* TKIP_ICV_LEN */ - + 8 /*MICHAEL_MIC_LEN*/; - break; - case HIF_RI_FLAGS_AES_ENCRYPTED: - iv_len = 8 /* CCMP_HDR_LEN */; - icv_len = 8 /* CCMP_MIC_LEN */; - break; - case HIF_RI_FLAGS_WAPI_ENCRYPTED: - iv_len = 18 /* WAPI_HDR_LEN */; - icv_len = 16 /* WAPI_MIC_LEN */; - break; - default: - dev_err(wdev->dev, "unknown encryption type %d\n", - arg->rx_flags.encryp); - return -EIO; - } - - /* Firmware strips ICV in case of MIC failure. */ - if (arg->status == HIF_STATUS_RX_FAIL_MIC) - icv_len = 0; - - if (skb->len < hdrlen + iv_len + icv_len) { - dev_warn(wdev->dev, "malformed SDU received\n"); - return -EIO; - } - - /* Remove IV, ICV and MIC */ - skb_trim(skb, skb->len - icv_len); - memmove(skb->data + iv_len, skb->data, hdrlen); - skb_pull(skb, iv_len); - return 0; -} - void wfx_rx_cb(struct wfx_vif *wvif, const struct hif_ind_rx *arg, struct sk_buff *skb) { @@ -103,13 +52,8 @@ void wfx_rx_cb(struct wfx_vif *wvif, hdr->signal = arg->rcpi_rssi / 2 - 110; hdr->antenna = 0; - if (arg->rx_flags.encryp) { - if (wfx_drop_encrypt_data(wvif->wdev, arg, skb)) - goto drop; - hdr->flag |= RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED; - if (arg->rx_flags.encryp == HIF_RI_FLAGS_TKIP_ENCRYPTED) - hdr->flag |= RX_FLAG_MMIC_STRIPPED; - } + if (arg->rx_flags.encryp) + hdr->flag |= RX_FLAG_DECRYPTED | RX_FLAG_PN_VALIDATED; /* Filter block ACK negotiation: fully controlled by firmware */ if (ieee80211_is_action(frame->frame_control) && From patchwork Wed Jul 1 15:07: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: 1320611 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=CCLp7rUk; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl4H0Rd5z9sV6 for ; Thu, 2 Jul 2020 01:09:03 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731944AbgGAPI6 (ORCPT ); Wed, 1 Jul 2020 11:08:58 -0400 Received: from mail-bn8nam12on2056.outbound.protection.outlook.com ([40.107.237.56]:52640 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731724AbgGAPIf (ORCPT ); Wed, 1 Jul 2020 11:08:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e19KJhKS8yZJ0FiTiz1TGhknut11msWmg0WVTIhe3ZuwgtqoR8iF+r/DYhRm8/iBP3XQlTk8w8Z6egP+tfrx9EXulAqafIw+pNoGa/2R35qPSU9j3AMZJDsH50+kjHKCAxruqpv6tZFwwq51pFtkH9yuZ90WHiiYfVMlzn3ipTotKCI+Zh3qz1ApYkyzEeikBgURXawIQoHp3RCfx4esfC0pYnvwGyUxY31+PTCv4vDBcvWQvgs45toqi3Y/Zgsxpa6ORuKBfViKk7sqULDF7aUmQjC07Z05H/cvzrdyXhKQ2TE2O+Q51B2L3kMiAwQZFI+zavC+Jje5Xvmeqtgg5Q== 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=p7qhSZGDaIuv3wC9nAfoolTg6r6BTwjMVpN6rCLAOHU=; b=Xj9z9ql1FgoxxpoFVW7Ml2ualadJgzX5JzHnJ4286sk16iQMoH7Kw2+qLmbYj/uh+CeZ65I5hWRoxbX8w6GsNlPEPe6epl8TWG0Xu3BriKILKjUYCwueXADXjbUvPlYWgglhU4U6DWS0idEOuxqzX0IRI7HvTfA0nNJVZIwHIZs/SYfCyMF/aOomVl3Hnwmzx7EBwWjrncX6aFjRa3E9YhUcuP96uu4wDE5lSxCe8+f++TNFxIBF7kGY+cZ/kG1uwXPd7ZC6qFFUSBLh6XP7yHXanNV03K0e+BrbQSTElBzzQsMEgtr1rDun2G0X/ZIFmG2aDyi6psK+iQxi1U/xUw== 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=p7qhSZGDaIuv3wC9nAfoolTg6r6BTwjMVpN6rCLAOHU=; b=CCLp7rUkfOYZb3F45h287vTd4hY5XhJxAXF03taY1Badkto95iAj/rsjB65mGfR/XbhThcI0RuzD10c1jl2wFkfTrx1gKuhdwOkJXFCRVBChXyvDdaGmFmQUzIw+ntTDXwupJ9jLA0jW8pYVJce7qd45ny5anykGBOpN6rA6LEA= 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:22 +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:22 +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 11/13] staging: wfx: fix CCMP/TKIP replay protection Date: Wed, 1 Jul 2020 17:07:05 +0200 Message-Id: <20200701150707.222985-12-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:20 +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: efa75f7b-2a47-41c3-2984-08d81dd09874 X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tgSxdpnY65M8YbytWEX9uZW/I2/KYKkhZKOkBQyRdKXQYAPfARzsps3JiVriiUzIWt7wdpFGrdgC/NLeWlAb+A8nWRQACRfdGsXU0z1jBtVJfsUxyPkb+7emABGtOw4mHNu/eWe+5AM1vHrPaSbQBA8i0BmFYMNdpxIdDmUNCnMTsVlbz20jGKTfqTf24d+IJPikzZCLb/0vAfxVySAs7IeZlpprnXmf+lRJPO1QSboyLD1zj0XZSWnMe3tA9NmQ9kxXAa0Gkh4XSMgf/F/+57S0qp7ipdZuXAYqLR3n/WGBP7/Gjvel8B9bdEJj0qt2RjW+70EryoPGTGW0RPv+Iw== 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: ZDDlVKgCpX0L7tmz0Sf8NK7Gyv/kkYoKz5ieoyJCfHUK1urcbfdxerQKp6x2ohfd8lc4Val7UNZdLaEpXUY8kw4W7uUWk7HiXf2J4tJF7b8UUCIvVj12727piseUbikJTAteJBwRed9fG+/Ld/ImRxbQouPAN531MtzN/d73BsoOOdEjPsHVrPl+FANkPV2+Ds2VOTlNo27ppkmI3nAMAYuwmT1mD2Dvtd52ETF7O5nkbgSEZBmx+Ef+bxKPwCQTJlL6p3AGUcxXveMl94dOjL2qVkJOCISXMBRH82L221yF2Ef1+xy1mzZTA0SJlyjX4XkLdKW/pxo5LKsLKIRr9Diu3yh4o03Mm41c8hu8/V851Ot9FvJwq4clUw5d42cTfCsZ/zXvi/B35dcOuw3hGS3zOfXkgPcXOjEsRLuVWkeU5Io5TP0sfMfCJ/i0Xj4sImZMYqZdKkKM5IbEV0FJt4ZLCp5dkr1MetRYrpV3rr9HYpML0cA8DByDr+nDCbHeP+m9Ld0As5o1M+269RF4fA4cl4lMwK2ys63lCeyzWDY= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: efa75f7b-2a47-41c3-2984-08d81dd09874 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:22.3366 (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: xUtjOB4eR+WPE6GEqNXYHTYCYSgmZxnSfKk5thReaxKWYsKqjrjdn7kJxaJOG9Hu8lFe2T87zU9UqSk5Ee92UA== 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 To enable the TKIP/CCMP replay protection, the frames has to be processed in the right order. However, the device is not able to re-order the frames during BlockAck sessions. Mac80211 is able to reorder the frames, but it need the information about the BlockAck sessions start and stop. Unfortunately, since the BlockAck is fully handled by the hardware, these frames were not forwarded to the host. So, if the driver ask to mac80211 to apply the replay protection, it drop all misordered frames. So, until now, the driver explicitly asked to mac80211 to not apply the CCMP/TKIP replay protection. The situation has changed with the API 3.4 of the device firmware. The firmware forward the BlockAck information. Mac80211 is now able to correctly reorder the frames. There is no more reasons to drop cryptographic data. This patch also impact the older firmwares. There will be a performance impact on these firmware (since the misordered frames will dropped). However, we can't keep the replay protection disabled. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_rx.c | 31 ++++++++++++++++++++++++++----- drivers/staging/wfx/data_tx.c | 3 ++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c index 60e2e5cb4656a..6fb0788807426 100644 --- a/drivers/staging/wfx/data_rx.c +++ b/drivers/staging/wfx/data_rx.c @@ -13,6 +13,24 @@ #include "bh.h" #include "sta.h" +static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt) +{ + int params, tid; + + switch (mgmt->u.action.u.addba_req.action_code) { + case WLAN_ACTION_ADDBA_REQ: + params = le16_to_cpu(mgmt->u.action.u.addba_req.capab); + tid = (params & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; + ieee80211_start_rx_ba_session_offl(wvif->vif, mgmt->sa, tid); + break; + case WLAN_ACTION_DELBA: + params = le16_to_cpu(mgmt->u.action.u.delba.params); + tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12; + ieee80211_stop_rx_ba_session_offl(wvif->vif, mgmt->sa, tid); + break; + } +} + void wfx_rx_cb(struct wfx_vif *wvif, const struct hif_ind_rx *arg, struct sk_buff *skb) { @@ -53,15 +71,18 @@ void wfx_rx_cb(struct wfx_vif *wvif, hdr->antenna = 0; if (arg->rx_flags.encryp) - hdr->flag |= RX_FLAG_DECRYPTED | RX_FLAG_PN_VALIDATED; + hdr->flag |= RX_FLAG_DECRYPTED; - /* Filter block ACK negotiation: fully controlled by firmware */ + // Block ack negociation is offloaded by the firmware. However, + // re-ordering must be done by the mac80211. if (ieee80211_is_action(frame->frame_control) && - arg->rx_flags.match_uc_addr && - mgmt->u.action.category == WLAN_CATEGORY_BACK) + mgmt->u.action.category == WLAN_CATEGORY_BACK && + skb->len > IEEE80211_MIN_ACTION_SIZE) { + wfx_rx_handle_ba(wvif, mgmt); goto drop; + } + ieee80211_rx_irqsafe(wvif->wdev->hw, skb); - return; drop: diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 5c744d9c8c114..3acf4eb0214dc 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -418,7 +418,8 @@ void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, wvif = wvif_iterate(wdev, NULL); if (WARN_ON(!wvif)) goto drop; - // FIXME: why? + // Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any + // BlockAck session management frame. The check below exist just in case. if (ieee80211_is_action_back(hdr)) { dev_info(wdev->dev, "drop BA action\n"); goto drop; From patchwork Wed Jul 1 15:07:06 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: 1320609 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=ZRSlMnM+; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl3x3KXdz9sTb for ; Thu, 2 Jul 2020 01:08:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731922AbgGAPIn (ORCPT ); Wed, 1 Jul 2020 11:08:43 -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 S1731845AbgGAPIj (ORCPT ); Wed, 1 Jul 2020 11:08:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DFBogDMMFXwTuUF1Qnxe8rrv4Edm/knT06fHnA/vOyl3D0khVdhjGvAdkg5VAl8y9gWG8VAp/5ZV/lVAY7846V4XX9wLFlQdnzC2Nln67ZDZehvZdtZNJAF0c47c4/jA3OlB8Uwo9A0qux1pRLyIQeHdkE+Eo4SEdRU+XK1vYMO2+smpX6xh6RH57GmM/YIPpKDJAkFyPBOTq6pgaq1lROksG7TZxDjbdSiYsePuvN9nEugjiuFLN/j9Ba2bed3EkdxgR6oSaxMVZrOCHlEDZ6G97x1p9m5GoFqucNOWBfJb4QPyMTBlT5RSeoTZUTQLw4A5biHgkt3hoXBoA4Y+SQ== 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=rU4jZR9bH7uW5J9DSSlLvc4DQzujrGowUAW5IFxdmQk=; b=RSftfAtF+9GqpTStdREQ2a6Qx0mmD+zeO6rCdL0mEGyfPdqRtD9APS5oH6frOEXwt0cSUEjIuzW/vXjBIBNc4Q3M/O0zxuB3p2sUlLChF/w3edPvRhsuplNKJGK9SUUukW7ZM2kaMzEnxZ3PAk507wlh7Kqcgz29SBoxY9n1RyCvTRh91OeioimStQkJ/216QW5l+xWnFxEymaTTV3G0y6VcoHSAnFMxn2X8DD6FittpXmNoRodw0Cun23ieQNbz5xgF9z8t6VFGAgoKYuAjJhovpm59VVVmYQoz9BwDkF4sTLa/9eDBvbgVzg+JtQcgSULbFlU/P6hX7+diQHdAlA== 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=rU4jZR9bH7uW5J9DSSlLvc4DQzujrGowUAW5IFxdmQk=; b=ZRSlMnM+N9NOPGeC8b+ox1q/6zM6afqvIpctDfrgb+I8na0iUffnXOWehDllZQx8FPV7rlQ9YSBu/Y3TQYw5gTcOOQ/IKw8UTx/4IUube9bgNBG6WpM7HerND7uZ9frCfg+j4+K2kW7ljJrIU4Z+ah0O4geGnaGAekIRlg5fnKM= 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:24 +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:24 +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/13] staging: wfx: add a debugfs entry to force ps_timeout Date: Wed, 1 Jul 2020 17:07:06 +0200 Message-Id: <20200701150707.222985-13-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:22 +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: 833902b0-7bfc-4da3-7974-08d81dd0998a 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: lRBGuYQUi0B3MUbdGz9/U3WfM0pF1LWMC9f6E+Cgn67NyMO+e12zCVNff2mvBVZcoKwmgJttdRS6+GSLV4/CHI9fE9wyL+5FTQFLJqxSS6B3z0AwQL2FzKiK5SFXohqDJgmjnrJTes8VqnkiGw0XaDsyPuKFMMx12IPpmPCMIVqZXkp5A23inWKtYh73BN/2fi5ztDKhRLszNJGqMQwefz7qBi4tWqa3uQOSZSigs/CTZqmGJnwwnsQZ8jmYfncg41Hi5qpxv5psJv9b0t5Uqzm7kvEvIHT2nopcuykeJSGY0qjEeSPml9+aZ1d8hoiucBqiVllpp3J6g6HEvRPvuQ== 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: 1RggAmDyEPn204D8Tx7uFYM5Va1B0j0jTYs4fNprp8MLtejMGbWE/qXRJYv453P3yMFT1HkUtkgjfUtYu05wapPZV8ApqSm3a56pbUWuOUKiB4i2fKuLJU7fCDQR4OhN40xEWVKV1TWac0ws8aPZeg7cGvs9+sYcrtOKvYDCpM+3sUeKlVxsi7hOrbYvXRgT4Lyec+yebILZZZW+Btnu/lBVvgM999ob8gJZOO4SvNLJQGiptchh63LYLYshkiHaQL3jFh5MwSLJHV0wJo4LjtbGX+uFam9uXA0hwahEg+Vz+Nhrzl56aQYroxSJ8XoSXcmtw+cv5AwrQRnkf7YUQYbqulJnqzV6ydPZE65WllcrmwR2eoHaN6dV9EdNFgiUurgOTKqGGHXKvoKJkDAWC7aYb7WkGXQ27l+KViVnW9jTztH1SJQo4GoChAkcpezcC1fV/6g0Xlkfnc0Fjv0geXqu1pv/J10pOoK2N9PjcivNd60slnPe7rfvOiKgrvtBDq4AmUk5kUsmmGGipymKsk8BehAiAEprUabw9BAnDeA= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 833902b0-7bfc-4da3-7974-08d81dd0998a 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:24.1656 (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: ObCltJhF3HmpZ/trJINRXlxguRsBC/1AyCDr1Ak7Hfsy4kgyvPMSNfF0qpJ/wDDYuLXC5BfdHjUTQZHwqzvZvA== 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 In some advanced usage or debug scenarios, it could interesting to change the value of ps_timeout or eventually to force use of PS-Poll frames. The wext API (used by iwconfig) provide a way to change ps_timeout. However, this API is obsolete and it seems a little weird to use (it seems it does apply the change, so the user have to disable then re-enable de power save) On side of nl80211, there is no way to change the ps_timeout. This patch provides a file in debugfs to change the value of ps_timeout. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/debug.c | 23 +++++++++++++++++++++++ drivers/staging/wfx/main.c | 1 + drivers/staging/wfx/sta.c | 10 +++++++--- drivers/staging/wfx/sta.h | 1 + drivers/staging/wfx/wfx.h | 1 + 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index 10d649985696a..3f1712b7c919d 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -334,6 +334,28 @@ static const struct file_operations wfx_send_hif_msg_fops = { .read = wfx_send_hif_msg_read, }; +static int wfx_ps_timeout_set(void *data, u64 val) +{ + struct wfx_dev *wdev = (struct wfx_dev *)data; + struct wfx_vif *wvif; + + wdev->force_ps_timeout = val; + wvif = NULL; + while ((wvif = wvif_iterate(wdev, wvif)) != NULL) + wfx_update_pm(wvif); + return 0; +} + +static int wfx_ps_timeout_get(void *data, u64 *val) +{ + struct wfx_dev *wdev = (struct wfx_dev *)data; + + *val = wdev->force_ps_timeout; + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(wfx_ps_timeout_fops, wfx_ps_timeout_get, wfx_ps_timeout_set, "%lld\n"); + int wfx_debug_init(struct wfx_dev *wdev) { struct dentry *d; @@ -348,6 +370,7 @@ int wfx_debug_init(struct wfx_dev *wdev) &wfx_burn_slk_key_fops); debugfs_create_file("send_hif_msg", 0600, d, wdev, &wfx_send_hif_msg_fops); + debugfs_create_file("ps_timeout", 0600, d, wdev, &wfx_ps_timeout_fops); return 0; } diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 80e4474cc3314..62e3634556ec0 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -352,6 +352,7 @@ struct wfx_dev *wfx_init_common(struct device *dev, skb_queue_head_init(&wdev->tx_pending); init_waitqueue_head(&wdev->tx_dequeue); wfx_init_hif_cmd(&wdev->hif_cmd); + wdev->force_ps_timeout = -1; if (devm_add_action_or_reset(dev, wfx_free_common, wdev)) return NULL; diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 2c0ab51fc92da..fdf4f48ddc2ce 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -217,20 +217,24 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps) // are differents. if (enable_ps) *enable_ps = true; - if (wvif->bss_not_support_ps_poll) + if (wvif->wdev->force_ps_timeout > -1) + return wvif->wdev->force_ps_timeout; + else if (wvif->bss_not_support_ps_poll) return 30; else return 0; } if (enable_ps) *enable_ps = wvif->vif->bss_conf.ps; - if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps) + if (wvif->wdev->force_ps_timeout > -1) + return wvif->wdev->force_ps_timeout; + else if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps) return conf->dynamic_ps_timeout; else return -1; } -static int wfx_update_pm(struct wfx_vif *wvif) +int wfx_update_pm(struct wfx_vif *wvif) { int ps_timeout; bool ps; diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h index 43808cef4785c..6b15a64ac9e28 100644 --- a/drivers/staging/wfx/sta.h +++ b/drivers/staging/wfx/sta.h @@ -66,6 +66,7 @@ void wfx_cooling_timeout_work(struct work_struct *work); void wfx_suspend_hot_dev(struct wfx_dev *wdev, enum sta_notify_cmd cmd); void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd cmd); void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi); +int wfx_update_pm(struct wfx_vif *wvif); // Other Helpers void wfx_reset(struct wfx_vif *wvif); diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 0c44b733ef6fe..477c08fc713fa 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -59,6 +59,7 @@ struct wfx_dev { struct mutex rx_stats_lock; struct hif_tx_power_loop_info tx_power_loop_info; struct mutex tx_power_loop_info_lock; + int force_ps_timeout; }; struct wfx_vif { From patchwork Wed Jul 1 15:07:07 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: 1320610 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=mEkzev59; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49xl445HwLz9sTj for ; Thu, 2 Jul 2020 01:08:52 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731910AbgGAPIm (ORCPT ); Wed, 1 Jul 2020 11:08:42 -0400 Received: from mail-bn8nam12on2056.outbound.protection.outlook.com ([40.107.237.56]:52640 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731894AbgGAPIk (ORCPT ); Wed, 1 Jul 2020 11:08:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hDaBIpifOQRyC+dV7neHvPHVDo5V3fdnuMB/MAjg0Bxs4OBbbRWu7tzf1Nh0dc/2SJvvPOiZ/FxzdsQKn8ZoCoLVn0NQwBmjQrf/qe3saqJgFW5om+BYfIAiemnJfJBMph02ec38aD+WDq4KjfCrznsXi6VByULisxTuALFJTDrej+yL+o3fz//a9U8ydGetU1/lMYaWDkLFIBoqOocZpydGnSnrx3YHJfkeorgdEXJg3HYi5faetyLkS0CbLxCNvnADkCSMm89NyE7SqEZ71DmB/DDz6v80M05fVpUYVEawf4HVWyWZY30QCxwypf0w1EK9Xp7kD2euaYiM+3dfYQ== 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=/tFsZywwSyc+AP6p6DjdgN/d574t4Q2WgeJIgrywvdw=; b=UD+dWBp5EpL097MwGwCj42qMQqX1xkrFRC7qE7Fq1axlymldnjmE4OboH8UHKG8LZi4a4+dwM7WIWt8isgU9AFMEuC/ni0wYre+Bu+xGB9mH3o+UI0WlApMMTW4+r3ZV2VlTNAq4qUV84GOOWZdbeIsu9/iUhApmUUv4PEK7tgUEeuHAXzzXx3rFBvfwgoxN1wHF00PgN5guzz9K9sUGueUOGhjnAHOnOGbRJqkjCqJJrbVasRcZNf7EueEJBLIfJ4zsxop8HyQdSg3wv3kW/bZ3XnRbXaLKJWHq1KMSTTP9x6Xmui+271OMLUDVBjNsEvREygYrBfrxOCV+f25+yg== 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=/tFsZywwSyc+AP6p6DjdgN/d574t4Q2WgeJIgrywvdw=; b=mEkzev59kiz/jQIlQQ6Xg0mhpk0JWkZ0Zn89V/fo1NtoLedLYUsRwyyvc6FoUu84hPf2G4e7PJ9djHOrFzgtUV4Z6bUCKAXxCKatcM7+Pxq2lznshZ7HrDksGCbCshMgEYw+ivf7mgxESjoIIuv89f84eUXeqSN/QdWfNWa1WBU= 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:26 +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:26 +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 13/13] staging: wfx: always enable FastPs in combo with new firmwares Date: Wed, 1 Jul 2020 17:07:07 +0200 Message-Id: <20200701150707.222985-14-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:24 +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: 0b5f5ab2-27ca-4028-0a00-08d81dd09aa7 X-MS-TrafficTypeDiagnostic: SA0PR11MB4736: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1388; X-Forefront-PRVS: 04519BA941 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V9vHIZFE/Cke8VZOAgjzr9tiatQXjNUZA267rfJ/hfRGXrQ9cCQLZXhRvCxav0oz67X0MeEFeikhbd708aChDd+4b9Uq7IxFmEDX5ikXaVpst3uDbv5vgmGtrBeHK8AbXLGH5PmfTClo7JIyLj3SJH7RrtYlcN0l9+U6A9XMTPiNgU+qTHL5eHW8P/BItrwVl3NbiW+DLzD6qAu8ByD3tgoxVJNA30zn3b0pFlOx/E8Vj+9FZCj1wBxYU1AZiRXJOx/sTtf/ZwL4utoGTha7gWRLxua2RAVOqae0JaLHJr5qwO+RbxBByzLIgOrzItfnS/NUnmbZIEgMcIbrWLZ8sA== 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: z5vKuWNgOGebDIFzr/TuK5f3VWsnYDDxjMve2HlhYocRHZmS1OV3+jdYb42pNja1Ft1iTLQ0zgYIBY/MYUQx6mjcieFDc05aevQAT9nzoIzRREzDCukNMsx15rB5eTw6ysTO+ID679Ccl/Cf1a/pSN2GkNk49rzyOedVGYHvhe7plrL5zhnEOHYsvtKN6ARHMeBnyxn9QCpOxfopgRxsHIrZ6zI0pUT1DjSwVwPRil9NhaCzhEg6ZRpl8rVeruBRWPDj4nNDcehmZL7Vy/vBsa7BQ2UhyDQYgDma0f5Zp7UURlKErg3XaiphuoymiUbospodgcnt3csn5afRjaOmdIUrU17WBXYU6bt6BJ92s6ZhrcYXoBsDj/HD+H2dGMys1S9+hNtzERy0tMK71qxJs8B9/1dzCNB5ibciXvsxy00WD3ymmO5WdUUpMDEwLEmM5bIZ7xays78fZF0TTxhMjvX+6up0im3SqkssEW0Dg6Fl7sp7v0FPT+tmg0X0lbQn+/cupOWqh2RfWRbPzjCZ5oQoNYt9yjw5ywYOmFn7bsI= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b5f5ab2-27ca-4028-0a00-08d81dd09aa7 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:26.0395 (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: qe65E8kDruc3BLLvdwDKZ7wJT8FJLkN6Bj71LuyQVWv8HfYfcN/F3vv0FYvfJQN0aRZchkhjHcc7lXTu8sgBgA== 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 multiple interface on different channels are in use. It is necessary to advertise the AP that the device is no more awake before to switch to the other channel. Until now, PS-Poll was the preferred mechanism for that. However. The new firmwares (>= 3.7) now nicely support FastPS. FastPS improves bandwidth and compatibility with AP. This patch drop the complex and rarely used mechanism introduced in the commit dd5eba1bb5b4f ("staging: wfx: fix support for AP that do not support PS-Poll") and use FastPS as soon as it is possible. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_rx.c | 8 +------- drivers/staging/wfx/sta.c | 16 +++------------- drivers/staging/wfx/wfx.h | 2 -- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index e3ebd910fabfd..cc7c0cf226ba1 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -149,7 +149,6 @@ static int hif_event_indication(struct wfx_dev *wdev, struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); const struct hif_ind_event *body = buf; int type = le32_to_cpu(body->event_id); - int cause; if (!wvif) { dev_warn(wdev->dev, "received event for non-existent vif\n"); @@ -168,13 +167,8 @@ static int hif_event_indication(struct wfx_dev *wdev, dev_dbg(wdev->dev, "ignore BSSREGAINED indication\n"); break; case HIF_EVENT_IND_PS_MODE_ERROR: - cause = le32_to_cpu(body->event_data.ps_mode_error); dev_warn(wdev->dev, "error while processing power save request: %d\n", - cause); - if (cause == HIF_PS_ERROR_AP_NOT_RESP_TO_POLL) { - wvif->bss_not_support_ps_poll = true; - schedule_work(&wvif->update_pm_work); - } + le32_to_cpu(body->event_data.ps_mode_error)); break; default: dev_warn(wdev->dev, "unhandled event indication: %.2x\n", diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index fdf4f48ddc2ce..4e30ab17a93d4 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -219,10 +219,10 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps) *enable_ps = true; if (wvif->wdev->force_ps_timeout > -1) return wvif->wdev->force_ps_timeout; - else if (wvif->bss_not_support_ps_poll) - return 30; - else + else if (wfx_api_older_than(wvif->wdev, 3, 2)) return 0; + else + return 30; } if (enable_ps) *enable_ps = wvif->vif->bss_conf.ps; @@ -255,14 +255,6 @@ int wfx_update_pm(struct wfx_vif *wvif) return hif_set_pm(wvif, ps, ps_timeout); } -static void wfx_update_pm_work(struct work_struct *work) -{ - struct wfx_vif *wvif = container_of(work, struct wfx_vif, - update_pm_work); - - wfx_update_pm(wvif); -} - int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, const struct ieee80211_tx_queue_params *params) { @@ -372,7 +364,6 @@ void wfx_reset(struct wfx_vif *wvif) hif_set_block_ack_policy(wvif, 0xFF, 0xFF); wfx_tx_unlock(wdev); wvif->join_in_progress = false; - wvif->bss_not_support_ps_poll = false; cancel_delayed_work_sync(&wvif->beacon_loss_work); wvif = NULL; while ((wvif = wvif_iterate(wdev, wvif)) != NULL) @@ -790,7 +781,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) init_completion(&wvif->set_pm_mode_complete); complete(&wvif->set_pm_mode_complete); - INIT_WORK(&wvif->update_pm_work, wfx_update_pm_work); INIT_WORK(&wvif->tx_policy_upload_work, wfx_tx_policy_upload_work); mutex_init(&wvif->scan_lock); diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 477c08fc713fa..38e24d7f72f24 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -93,8 +93,6 @@ struct wfx_vif { bool scan_abort; struct ieee80211_scan_request *scan_req; - bool bss_not_support_ps_poll; - struct work_struct update_pm_work; struct completion set_pm_mode_complete; };