From patchwork Fri Mar 13 10:50:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chi-Hsien Lin X-Patchwork-Id: 11436667 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C6DB36CA for ; Fri, 13 Mar 2020 10:51:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C3FA20746 for ; Fri, 13 Mar 2020 10:51:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="NOljt5ZA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726598AbgCMKvI (ORCPT ); Fri, 13 Mar 2020 06:51:08 -0400 Received: from mail-dm6nam12on2096.outbound.protection.outlook.com ([40.107.243.96]:56545 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726414AbgCMKvH (ORCPT ); Fri, 13 Mar 2020 06:51:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UPBYUifSyLYPZDFfjRZ0Adygyud6nJ2MKBJkS+8Na4HRRGWyAMrlvj5YsPqntVf5aMORm8dJMcxZh/tQ3fJ0YTXpFBmwWtDVwKWeoyV+v7IYnaRdFB2n/vCv6WhiaAZUNMJuUQgHlw8uyctcLYQ0OTEQxoSo8Y2pQrhkWnPP8x+k6Q9aZhil7dpv5FD7dOy1EKwS51sb4sL8E41ZI2fDDF3mzfIfKfFWpkFUCCfzXqHxQsYSIOImzYm31+hloVNFdMyWHfbF4kOk9WqDFHvMxKvya1wfS6Tmv7MVGZe6t8p9tFNIzN23htOYL9478LRjUguc1NByL1751opCjsUnuw== 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=8jhe+/iEp3wP27V/WKNDbaMb5SGw0eXT8zY1Gkxc0lc=; b=Flw1Jc0+/H29pkwbke+mxrjbEdj0j+t2SAp/e3tWhGP0CRFhA6HyRu4f932srr0+nKfHaOW9y4bWqc1VzRgmpFBXi4eXAQbMi2KAJZGPD+6+vaVSBLE0GjbpYX4VQyybHqcLwAz5G0q1CmTLREengj9EPWeYUCJYz5gNei+upJUlUip1mPByAB4AqlBfi7AMmlRHi4cwJ/4Hztvl5p2L2C+GSAvQvWSZPNCQYnLW8CkseiAeNS78bNEW2fQMU9Go3rzSj2lFGCmXeWgO1X9JFJxYtS59oKrOvoBEJL5IxejndNCGZ0xuF957S/P08xWY2RDiJTUfksZZbH6M3BIr2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cypress.com; dmarc=pass action=none header.from=cypress.com; dkim=pass header.d=cypress.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cypress.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8jhe+/iEp3wP27V/WKNDbaMb5SGw0eXT8zY1Gkxc0lc=; b=NOljt5ZAhehMK+5kSA3Kd73psS1DYVeYL70IIv4t4TGEja32O2CQKTLDak5vPWw8waxKUnRdejmiOPZJ5NPMHpof6wkamQ2sZ4SFwfeTKYr7Htl1TqIHG+VT9iDQqvQqiw0KvRdV8xd2z7imCK+8Dlmq55D074iRKbBCCbJaWYs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Chi-Hsien.Lin@cypress.com; Received: from BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) by BYAPR06MB5303.namprd06.prod.outlook.com (2603:10b6:a03:cf::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17; Fri, 13 Mar 2020 10:51:04 +0000 Received: from BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9]) by BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9%5]) with mapi id 15.20.2793.021; Fri, 13 Mar 2020 10:51:04 +0000 From: Chi-Hsien Lin To: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Arend van Spriel , Franky Lin , Hante Meuleman , Wright Feng , Kalle Valo , Raveendran Somu , Chi-hsien Lin Subject: [PATCH V2 1/6] brcmfmac: Fix driver crash on USB control transfer timeout Date: Fri, 13 Mar 2020 05:50:15 -0500 Message-Id: <1584096620-101123-2-git-send-email-chi-hsien.lin@cypress.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> References: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> X-ClientProxiedBy: BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) To BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from aremote02.aus.cypress.com (12.110.209.245) by BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17 via Frontend Transport; Fri, 13 Mar 2020 10:51:02 +0000 X-Mailer: git-send-email 2.1.0 X-Originating-IP: [12.110.209.245] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 47e980b6-d371-4b25-50e5-08d7c73c6cee X-MS-TrafficTypeDiagnostic: BYAPR06MB5303:|BYAPR06MB5303: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-Forefront-PRVS: 034119E4F6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(136003)(199004)(6486002)(2906002)(54906003)(107886003)(4326008)(5660300002)(6666004)(316002)(2616005)(66946007)(66556008)(956004)(66476007)(6916009)(8936002)(81156014)(8676002)(81166006)(478600001)(26005)(36756003)(86362001)(52116002)(7696005)(186003)(16526019);DIR:OUT;SFP:1102;SCL:1;SRVR:BYAPR06MB5303;H:BYAPR06MB4901.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1; Received-SPF: None (protection.outlook.com: cypress.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WdJfxdNM5ueQ2i/4EVs1zE58T9GYR7lQahFwHbiEUKwqhjWO9XLK0SW8g0mJ21NB64PM/yzCjeaYj4Orz+mm8UIZpilMGsYs1iftnroln6nF3h67Wwfowez1Wfvmzd/EB5x0Jqem97AlczqUO58VFXkbHqsbvROghPiZb+9aQVVDLxvmj9S056qdJwtnZ7+WuMdvyexpAZzYHmhY9zTg/AlEDbbrkRh8g7vhbVoR3TarYcnCHvTYF7uSTbvtFAnwNN2HCTFmiXfYuGX1WtvgXhYBZVzu61UxVyer+gkD0WV9uiGZJYG/dO2fkJViJ8wl512nmCZj3ow/V/dAJ/kEG2Gue8sKuPlGMdvE4SygS4b/O1lqgv//0WDvVf9BmJSnHrlyzFiAJMUE50wv5eJt3YdH634nhGdotYAxuLwBZwlxv2nqlUUGEzyX9SA7WCW0 X-MS-Exchange-AntiSpam-MessageData: z/BM7UqwHCN3yK3Y9PjvV9xglsDD43KwURFBCWx/CCj5IksBC6vHWwRZLCw2PdmnSJIzom3JIWbc/hvIh4tKynfMxc/ASNe0ypzlkrgCHBUM/P1IAeU9JQks52aO/2AvlgXW7hK5F7gxfWCId8VD7w== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47e980b6-d371-4b25-50e5-08d7c73c6cee X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2020 10:51:04.1723 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qWeY2KB8LYR1azp4no2ZdenFWySdYcytfBPFcY7x/KYLmjl/Y15HwB2GP30SaXoQdav6iUjUuNL9efis8oXdxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR06MB5303 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Raveendran Somu When the control transfer gets timed out, the error status was returned without killing that urb, this leads to using the same urb. This issue causes the kernel crash as the same urb is sumbitted multiple times. The fix is to kill the urb for timeout transfer before returning error Signed-off-by: Raveendran Somu Signed-off-by: Chi-hsien Lin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c index 575ed19e9195..10387a7f5d56 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c @@ -328,11 +328,12 @@ static int brcmf_usb_tx_ctlpkt(struct device *dev, u8 *buf, u32 len) return err; } timeout = brcmf_usb_ioctl_resp_wait(devinfo); - clear_bit(0, &devinfo->ctl_op); if (!timeout) { brcmf_err("Txctl wait timed out\n"); + usb_kill_urb(devinfo->ctl_urb); err = -EIO; } + clear_bit(0, &devinfo->ctl_op); return err; } @@ -358,11 +359,12 @@ static int brcmf_usb_rx_ctlpkt(struct device *dev, u8 *buf, u32 len) } timeout = brcmf_usb_ioctl_resp_wait(devinfo); err = devinfo->ctl_urb_status; - clear_bit(0, &devinfo->ctl_op); if (!timeout) { brcmf_err("rxctl wait timed out\n"); + usb_kill_urb(devinfo->ctl_urb); err = -EIO; } + clear_bit(0, &devinfo->ctl_op); if (!err) return devinfo->ctl_urb_actual_length; else From patchwork Fri Mar 13 10:50:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chi-Hsien Lin X-Patchwork-Id: 11436669 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 59D246CA for ; Fri, 13 Mar 2020 10:51:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 38B4020746 for ; Fri, 13 Mar 2020 10:51:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="LRMwv2L3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726605AbgCMKvJ (ORCPT ); Fri, 13 Mar 2020 06:51:09 -0400 Received: from mail-dm6nam12on2096.outbound.protection.outlook.com ([40.107.243.96]:56545 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726475AbgCMKvI (ORCPT ); Fri, 13 Mar 2020 06:51:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jNsRQwppupq2UznSR4uNRKhHzwMKHtJ1mL523fJtGXE1ePU8E3YNQLh8EcHvv01voAvc3hsr0s1bv78/MrDDpi4yn87LUCbcplPQRlOljjH1n/3IbfYmGHsBOSGNJx+6Ed0KS7aClRsZwjG8ePQZ4sXtAVYzZEVtkYTJcUTGCHPgNWHSvhrKh6PWyswjPi2Dz3Up+9ToZ/AZPt5u+fpFKWJC+Ttkn/nAzMoa+QQVfPVK4VGXq9HEFgmJjNXlWge0PHloZy/ZKJs6rY/p7rMhrPC2O8ls5dfOXwE2Ti5RR6RrVIgZW4P/0y3NCzEoGYZXPIjJJiPJT2IYCdBL75986g== 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=vHjIAUP8pch+iU7C2NvkHDOGwlDOkgTnRp9+Y5FR1pg=; b=n+B7TDL+VVyyEko4fbMsrfah/92jakQHw/V6nitglZ8fRM0YPRgq/LOkd0BTxHB6kyNePHz7nZ9HhEpivfWRz+yyG9HiWL/S+405TnA2ma09tEJXE876UoDliXltzO9YIwJHMbML3y4fGoiYmILE53sd5/Pc4uIdC65vnazF5E1NI2xnKrcPJQn670RTd1dRGqRs9+ejXFySIFRrxE1wR0wDlBwPPKcDSTeJhWl0xD3fXFxTBta63Alm5WqRFCHrzqh+adnk2H3BsgqymxfZToP/96SdJ4KG9nyPFhI560NjbGZKqkoLIbGx5fYGGmXcYLlK7hj/cRpb11p9wUMRdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cypress.com; dmarc=pass action=none header.from=cypress.com; dkim=pass header.d=cypress.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cypress.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vHjIAUP8pch+iU7C2NvkHDOGwlDOkgTnRp9+Y5FR1pg=; b=LRMwv2L3rmA3yE+G3Q9/rHVhvqf5yMKMQx1YHkI/QS5ZP98vLmz3KdBJjIct0M9OQ5mG9xAC0hzg8HyMIcIA3z6jlSRYDIWolVUX3fA6/VEz4PEQ8xBlYNqX/A+FrGw/U7gPpu/eLD47Oc981BYCvGYP6bFZYiuYfxIWJYBeTqM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Chi-Hsien.Lin@cypress.com; Received: from BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) by BYAPR06MB5303.namprd06.prod.outlook.com (2603:10b6:a03:cf::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17; Fri, 13 Mar 2020 10:51:06 +0000 Received: from BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9]) by BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9%5]) with mapi id 15.20.2793.021; Fri, 13 Mar 2020 10:51:06 +0000 From: Chi-Hsien Lin To: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Arend van Spriel , Franky Lin , Hante Meuleman , Wright Feng , Kalle Valo , Raveendran Somu , Chi-hsien Lin Subject: [PATCH V2 2/6] brcmfmac: Fix double freeing in the fmac usb data path Date: Fri, 13 Mar 2020 05:50:16 -0500 Message-Id: <1584096620-101123-3-git-send-email-chi-hsien.lin@cypress.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> References: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> X-ClientProxiedBy: BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) To BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from aremote02.aus.cypress.com (12.110.209.245) by BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17 via Frontend Transport; Fri, 13 Mar 2020 10:51:04 +0000 X-Mailer: git-send-email 2.1.0 X-Originating-IP: [12.110.209.245] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d29ed669-5008-444a-4837-08d7c73c6e2c X-MS-TrafficTypeDiagnostic: BYAPR06MB5303:|BYAPR06MB5303: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 034119E4F6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(136003)(199004)(6486002)(2906002)(54906003)(107886003)(4326008)(5660300002)(6666004)(316002)(2616005)(66946007)(66556008)(956004)(66476007)(6916009)(8936002)(81156014)(8676002)(81166006)(478600001)(26005)(36756003)(86362001)(52116002)(7696005)(186003)(16526019);DIR:OUT;SFP:1102;SCL:1;SRVR:BYAPR06MB5303;H:BYAPR06MB4901.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1; Received-SPF: None (protection.outlook.com: cypress.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xLSL6lMHe4VR1yVy1GRbyTPBG/BzYFm7MSN2NKCVcO+WZywqJS6iHbGS+PRxxIGAlLrrzbFijd4D4ErHQIFgCa3HH/NxPOAGXM1xdisrwQ0wkKRH1WFBxbGcJrItb6A11VAP3dn+pAuZ6j7iQSxs8J0KGvS6lAorA94cBfLpMiZ+pf8a/d2td3//OmZJ5+DV8JXYNPXOX6zkxzWtuoUCEkgQRhGVwoXW36UixEGkTNkY1+p75ENaYMbmJ8R8mDdFX7EDi5q0NgTd/GazbKe7FrrbVwvj1BYYTPODVQViXxtjRt2nWDjHV6Ttq/HsBFgInCEUUq3avGbg/gdTNZGJK/iHLeyC+EOnRj/DWHOiodgbR1WbRjnjlX3tDodlQBFI/32m9kcVabmG/Vp6udGMnFHQtLT9DwnXeZr/mEaBBIVBNPZYUKtjCIY/AEyMWHW+ X-MS-Exchange-AntiSpam-MessageData: D6xdpGrEdzb5+Mv6ZCKUbd0NuhkGhTlVgtJCgy/Cn5Gt8+Sk5k8T4Wt5Lsun86XEXMb4QtqEz7SatNS2E7aHyKL6olBpS5rHuT6+vKIa0/ZT4ZGMcRA+MeN0JtUaLnxmEkaNUYInqfrLigZAh1FNrQ== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: d29ed669-5008-444a-4837-08d7c73c6e2c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2020 10:51:06.1522 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: b7q76BHBM5WxCnUeLrArM3lF1X+uYhaz3WzN5ivWoDvhXp68eltw9v5gq9Re480k3jxFLzovrXm490ZISxR4aA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR06MB5303 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Raveendran Somu When the brcmf_fws_process_skb() fails to get hanger slot for queuing the skb, it tries to free the skb. But the caller brcmf_netdev_start_xmit() of that funciton frees the packet on error return value. This causes the double freeing and which caused the kernel crash. Signed-off-by: Raveendran Somu Signed-off-by: Chi-hsien Lin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c index 5e1a11c07551..10022c765354 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c @@ -2145,8 +2145,7 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_DELAYED, fifo, skb); brcmf_fws_schedule_deq(fws); } else { - bphy_err(drvr, "drop skb: no hanger slot\n"); - brcmf_txfinalize(ifp, skb, false); + bphy_err(drvr, "no hanger slot available\n"); rc = -ENOMEM; } brcmf_fws_unlock(fws); From patchwork Fri Mar 13 10:50:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chi-Hsien Lin X-Patchwork-Id: 11436671 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BFE786CA for ; Fri, 13 Mar 2020 10:51:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 95A2D20746 for ; Fri, 13 Mar 2020 10:51:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="D7rMb3zE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726595AbgCMKvL (ORCPT ); Fri, 13 Mar 2020 06:51:11 -0400 Received: from mail-dm6nam12on2096.outbound.protection.outlook.com ([40.107.243.96]:56545 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726414AbgCMKvK (ORCPT ); Fri, 13 Mar 2020 06:51:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ah1jOqkaoKlvH3h8/D8dg1AXmywPSW5hyNo4TB+WbzmveooLgy9EvI86Ia4riZkBDxPzv/qih5hsmg7uXh8rsVRcE5xASNzW4ErACw/Ib9vvDlac7JzHkuSMUERI9Fkt4HWZrQY97tma2SDeDqIHGqQo6pl7eHmMz3Er82jjGJDICesgd8tUiFxGHfcrkjEjdgzteMZi4aaUNrlZHCiLYbVpL6P29sIptDAyY+f+eL+juXYjW73P+gmokL+/4T7UZv3jEg0DM5AnLhemyz98QVYz1WOIXzM9iYFJIQg3/6Y+U0FTN0SEYDDo/o131PsWTrDOF/MObbDoo2ENigHjNA== 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=tp/XWRTwvr80437RcBtCuvYDovgnHn+kzgYBZ3/mbyk=; b=dQ6Ut8Ra/KSFJUE7GjWK9rz0zqaiol/UBmX5pS66cscaudSX4aU3lwy/MVdejJDBvFa48Wbl7LPSzyxqa7ULgI4tMIQEQze3c5t3LSAwYzqSvHNvyBtPN3saR6/ormTV4O8xB7NVIb/Pm2gIGJxBkNYw4avThqTJJXZCsPnZpWevkuhIUdnfg7aIX1dAK0iwtxvdgSDcJqgk4aRlKPVZaLGgj1j+o7WCorDjZG1AQhVGg3cSuDL4BX6hQiLx8fR9ALDhI8plhM2xxB3m3lISGaX0uAhZewBDHR1KBmvPsmKbqj8/4B5day5whBfRpIXotwxvANanw4htQfiBnhyr9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cypress.com; dmarc=pass action=none header.from=cypress.com; dkim=pass header.d=cypress.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cypress.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tp/XWRTwvr80437RcBtCuvYDovgnHn+kzgYBZ3/mbyk=; b=D7rMb3zEc04v5oL6alBVrnqR6aD/cQUyuh+sJfnEt9QzOv8JJjE9F0paBwjwi6tqL7DwkfdgiIuF9KQMsWbS89eroYx6cHUuxJSOm0EETNNSosxRci6nMlN681aJaCACLebV8b6RyubeXV0kDk4JSA9eLokyYcdgweDohEnmhF4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Chi-Hsien.Lin@cypress.com; Received: from BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) by BYAPR06MB5303.namprd06.prod.outlook.com (2603:10b6:a03:cf::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17; Fri, 13 Mar 2020 10:51:08 +0000 Received: from BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9]) by BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9%5]) with mapi id 15.20.2793.021; Fri, 13 Mar 2020 10:51:08 +0000 From: Chi-Hsien Lin To: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Arend van Spriel , Franky Lin , Hante Meuleman , Wright Feng , Kalle Valo , Raveendran Somu , Chi-hsien Lin Subject: [PATCH V2 3/6] brcmfmac: fix the incorrect return value in brcmf_inform_single_bss(). Date: Fri, 13 Mar 2020 05:50:17 -0500 Message-Id: <1584096620-101123-4-git-send-email-chi-hsien.lin@cypress.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> References: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> X-ClientProxiedBy: BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) To BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from aremote02.aus.cypress.com (12.110.209.245) by BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17 via Frontend Transport; Fri, 13 Mar 2020 10:51:06 +0000 X-Mailer: git-send-email 2.1.0 X-Originating-IP: [12.110.209.245] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e3c678c7-debf-4dc9-9ba6-08d7c73c6f5b X-MS-TrafficTypeDiagnostic: BYAPR06MB5303:|BYAPR06MB5303: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-Forefront-PRVS: 034119E4F6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(136003)(199004)(6486002)(2906002)(54906003)(107886003)(4326008)(5660300002)(6666004)(316002)(2616005)(66946007)(66556008)(956004)(66476007)(6916009)(8936002)(81156014)(8676002)(81166006)(478600001)(26005)(36756003)(86362001)(52116002)(7696005)(186003)(16526019);DIR:OUT;SFP:1102;SCL:1;SRVR:BYAPR06MB5303;H:BYAPR06MB4901.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1; Received-SPF: None (protection.outlook.com: cypress.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mG2F4QG571QrG5oIcZ1YjLPAfed3OjYVuVTO+8ngUgtWWyJwChMVZjqr9RahzLxL3tM+VFyChNARB9II6hDxJpABVpsHPKOuY0A0+fgHTfPD9+PRM8sGnfN+2cS7Lb7dOnSsSvd5oodD2P5AWc63GdEpaIlDk5UDojZ6SUcjhzETiUf7Z9iam4xOq9k+BDPESPOsj9fTZzpkRxOmHyy7CnLdwQeTwBrbq3OFrTbc/sElAsjECyRWaiyagqp2NBbhh1KOqf1RKYxsuYM/hJ+aCqiwLMNH2JrzKaMUO7FXvVc0Yo5AFRik9q2CaBnWoTcWjvndcJT0ifwp1MMAKjHZWAgVexnvDM5awxZjDC1F3bi0blHDHl0RpqFOa9rJ89ubgYmfSFLJf5SaAhn5jJHcvouh5R/ATeqUjUG7W3xwb1/E/fElo6WF5O3yyKWqziTl X-MS-Exchange-AntiSpam-MessageData: BmGUrwlM3zIiKZeX5aT6nR5nWU83F36PeghlRa4C9o0v1HXlKV7MejuXl8gcfIlfZFWy5o0oaXZtjKqX2FOQJUT0vNjRbWdjX6BrzFKyKnydfybRL/yE1RNJQ/RydZK0MEoDWrL+tYBL91++Zrzm5A== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3c678c7-debf-4dc9-9ba6-08d7c73c6f5b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2020 10:51:08.1511 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XXuyK7ZbVfMIb1kmTZRgpZ1BOCMxyO3uC3OS1TI3fD+Gzid0plahuZdebB1cVAQGUo6u+/G0a+7xp3YX2KVYHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR06MB5303 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Raveendran Somu The function brcmf_inform_single_bss returns the value as success, even when the length exceeds the maximum value. The fix is to send appropriate code on this error. This issue is observed when Cypress test group reported random fmac crashes when running their tests and the path was identified from the crash logs. With this fix the random failure issue in Cypress test group was resolved. Reviewed-by: Arend van Spriel Signed-off-by: Raveendran Somu Signed-off-by: Chi-hsien Lin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index a2328d3eee03..2ba165330038 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -2953,7 +2953,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg, if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { bphy_err(drvr, "Bss info is larger than buffer. Discarding\n"); - return 0; + return -EINVAL; } if (!bi->ctl_ch) { From patchwork Fri Mar 13 10:50:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chi-Hsien Lin X-Patchwork-Id: 11436673 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CD8F514B4 for ; Fri, 13 Mar 2020 10:51:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ACF5220746 for ; Fri, 13 Mar 2020 10:51:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="VlmlSkhx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726616AbgCMKvN (ORCPT ); Fri, 13 Mar 2020 06:51:13 -0400 Received: from mail-dm6nam12on2102.outbound.protection.outlook.com ([40.107.243.102]:56420 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726414AbgCMKvM (ORCPT ); Fri, 13 Mar 2020 06:51:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JERAecs64pb2DMsKgYYPpJcXJP3YOBR5ZuuSMAvD4HlP3Q1+ZhAvSe4WOMtl2FxcKoskewJC6J2ukcbGCMjKVFoDqTfjVC/yuh+oRG6XsklCAmsOaaSW37trLEqEn7vrcnxj7+naJMynE3GNK7hpgPqNPXdWptZ/QJ2eJoltl21FKbShqQt/wT6q8/wVSqhwWX6vauO/0ZKOCMooaECZb2dZ8qN3OxYzg4fFodGsH6UN0LUde0RN+Hp9t8JUP6wQLc9sTisSQ1akPv67GcKOiMbF5XoYC7ce6Vf1+K0pLPxBs1/LcfKVNR80fd9UQkcVd0vjnHu9ERd6GvH9TvT7/Q== 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=wVwKgTRJ+ZGENUgkjH6k1eLuK8rNyFEdHOaSWhrh/ZY=; b=RXsMxhQjJtrp5GgT2Qgksh60E+nx1hFasD0hjCkDIZ2dEQ6ZvjfNQQgP0gtgBUtdyL+mYZQ5UBtK0tdyfO4+D0Xh78YhD9zbiwxVcjLQ2x+ZL4TvnyO8u/F+e9/fotD+yFU5Uleeq+NYpDLuH8fAUuPZJMEBlhH0x7Fw9POxp6TdHFhgXB1dNkjbPpK7BHVj3/JtxsvT69A5cV0JniQWOOLBMxqzr1wLozSz8i4dCRLu8jhhq8t6LnWQbR3DCGKqQaMTjdzdbNZKEimr+bqjgUo3iI6dAHVggowoWi8mB1y0J03RppZx97T6oceXJZSgrCwPgc8AylVCXADz8KRNtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cypress.com; dmarc=pass action=none header.from=cypress.com; dkim=pass header.d=cypress.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cypress.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wVwKgTRJ+ZGENUgkjH6k1eLuK8rNyFEdHOaSWhrh/ZY=; b=VlmlSkhx5+UYu2CJK2QRuXghnpODr9GU0+HuYagB2rRbPKFYn1yoXtoKsib2D5TzA8di3TvVqOd3hymsxWwDeSgFEjA+j2afldJj3u/IPlg3NXwYPbHbZQmkijjUeel6m40OWTxfpY8jaNfxW257DRthWJZInOVe5luMPwF65rM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Chi-Hsien.Lin@cypress.com; Received: from BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) by BYAPR06MB5303.namprd06.prod.outlook.com (2603:10b6:a03:cf::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17; Fri, 13 Mar 2020 10:51:10 +0000 Received: from BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9]) by BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9%5]) with mapi id 15.20.2793.021; Fri, 13 Mar 2020 10:51:10 +0000 From: Chi-Hsien Lin To: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Arend van Spriel , Franky Lin , Hante Meuleman , Wright Feng , Kalle Valo , Madhan Mohan R , Madhan Mohan R , Chi-hsien Lin Subject: [PATCH V2 4/6] brcmfmac: increase max hanger slots from 1K to 3K in fws layer Date: Fri, 13 Mar 2020 05:50:18 -0500 Message-Id: <1584096620-101123-5-git-send-email-chi-hsien.lin@cypress.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> References: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> X-ClientProxiedBy: BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) To BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from aremote02.aus.cypress.com (12.110.209.245) by BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17 via Frontend Transport; Fri, 13 Mar 2020 10:51:08 +0000 X-Mailer: git-send-email 2.1.0 X-Originating-IP: [12.110.209.245] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cc41ef87-4fab-4b65-b588-08d7c73c709b X-MS-TrafficTypeDiagnostic: BYAPR06MB5303:|BYAPR06MB5303: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-Forefront-PRVS: 034119E4F6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(136003)(199004)(6486002)(2906002)(54906003)(107886003)(4326008)(5660300002)(6666004)(316002)(2616005)(66946007)(66556008)(956004)(66476007)(6916009)(8936002)(81156014)(8676002)(81166006)(478600001)(26005)(36756003)(86362001)(52116002)(7696005)(186003)(16526019);DIR:OUT;SFP:1102;SCL:1;SRVR:BYAPR06MB5303;H:BYAPR06MB4901.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1; Received-SPF: None (protection.outlook.com: cypress.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pkj8xQdt4gzXD4jh93Eh3jI+Rq1jRVahW0CYsnelpbqKvfjqbAa2rGS71Y8GmsT3/FDLzB0elz93bSUuAedm+dxsWoUWKooqLlllG/9UBzzWDVD64/Wh6oolwjLODIer/iKeVi+8injhPs7xz3mcXv41PtEAJPYcZe8Hv59NG2k4EUCo2yMqJgJw3CRlE9qn0v/LQfM3LJ5MLt//DQ0j8zlGZVCp8NEohYlrcNbagcKPBsxpphX+D+9b2FOk9b6mfHQ8C/rlNgmYbLTR2eQAK8S98wBfrmDjU43HPpc32GZBifeA9XedgtN9Gh3YjsnCodfCb6YJwpkr4nAEzl6BG+SnSuxd2DPA1ebqGzDphtWuNYkkh8YZ3GBktgdxXN2AUgGFtsmpWQvudoQ9/7RjIC237l7FjMhRzFHSDBb53PS24Ncr/6UpBVq3eCvGSTPH X-MS-Exchange-AntiSpam-MessageData: Ty/B2zfmbsuZCw8mZvU5oV9cih71lfaLFIR0Y6hCIk2hLTAAe5bwXCc1SXwOzfmG0dtgPTvhLb4VaTWGgMCmLcRhie9Fn1sVPGvr/TyaBFIUaTOcX3IPL0hbwaOqqMgGoV/LtDkN/8qlHhM3qQcJug== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc41ef87-4fab-4b65-b588-08d7c73c709b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2020 10:51:10.1919 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: c2vMu++tPblok3uEA528NtrWp7/lonrDk/cLF2kzF7vBN8f7eAApFyqFvK9gaXSls8NZoo/JJeMvNETVAyKuWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR06MB5303 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Madhan Mohan R Will enable FMAC to push more packets to bus tx queue and help improve throughput when fws queuing is enabled. This change is required to tune the throughput for passing WMM CERT tests. Signed-off-by: Madhan Mohan R Signed-off-by: Chi-hsien Lin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c index 10022c765354..8cc52935fd41 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c @@ -404,7 +404,7 @@ struct brcmf_fws_mac_descriptor { u8 traffic_lastreported_bmp; }; -#define BRCMF_FWS_HANGER_MAXITEMS 1024 +#define BRCMF_FWS_HANGER_MAXITEMS 3072 /** * enum brcmf_fws_hanger_item_state - state of hanger item. From patchwork Fri Mar 13 10:50:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chi-Hsien Lin X-Patchwork-Id: 11436675 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4533C14B4 for ; Fri, 13 Mar 2020 10:51:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 10AEA20724 for ; Fri, 13 Mar 2020 10:51:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="CG/jS0ah" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726622AbgCMKvQ (ORCPT ); Fri, 13 Mar 2020 06:51:16 -0400 Received: from mail-dm6nam12on2136.outbound.protection.outlook.com ([40.107.243.136]:24880 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726414AbgCMKvQ (ORCPT ); Fri, 13 Mar 2020 06:51:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hG1JbywjlP1KSyh2FOCDRX6fo0Nxt7W6TCDyFIYrFbnky4D4z1BqhcBgTom883fx5kvf7r/e6JINraj+szSNB35lac+w7jxgxHqDBTo3KRq/Pmfp5SK5Lfk8gxCnvQ67J+Si4/J9GMPLzrV9B9ermOQ6GgTJKXeP2MWH3q8k0w5o/8+D4ncfvBDAR7nv3ncwp26SrSffmZuwAlSuEATZ6CVTi66CEY5ORAQ7t6ZCId4sxZZeB9c7QcFdqv8FuD7JfuWmGSqGnWgitVZWAn2mLVWgpBystEtp8qwVnQ5Y0+1z9FQbGTYlnVZfksDJ1KfyRqD8rSecpnhnYQYyWpDzxQ== 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=ltqeSPDyMhPoe6y58G6GBj3pDzqVbwk5BNeNhQ+8eP4=; b=Z0K6zru2LLqNpYy1P0r+xjGKjUeS9wFKM6SjFQXpxDqqM200J0JbJ/7qEv7Z+CeO0D77ezwWspo6mcKOsFhopO3TYqWBHKQMMEG1qJawoDehFWSDlmqIORJdanETjrJ/J0yxb63JeDdAjACvaWthfPe2ucS99yiRDSlZkEthyWMnKgjpQuM+a8VK8xrt/nqH5va4swSZ0DFYHKFdHytR+lZkM6AL0lHzl48YabRcvMZQhkyaGoYM/0jInCcCyAw/8mMXfGwmjmCGpI9bXtfTbCeQ0UZcklIlnkj0PYnrMSHUvxRQ6iHxf2xf2da0uxCf+BgEHE3w4hvhblvWHfWS0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cypress.com; dmarc=pass action=none header.from=cypress.com; dkim=pass header.d=cypress.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cypress.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ltqeSPDyMhPoe6y58G6GBj3pDzqVbwk5BNeNhQ+8eP4=; b=CG/jS0ahyMnqKw0dqieYLg+DCPLYUWWEOb4FTPN0D+746SXNcqpxEZe5771LEOs9AG0UMLjuvVdRCxdSAtevlKXnPkYcKo31lrX+QnhWLMnLnTqAEUfmo9BH7gzjBWklG+e5aMRZm+bgS7m+GiT+/iZfdzMKwz97GsYceEJ0B1U= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Chi-Hsien.Lin@cypress.com; Received: from BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) by BYAPR06MB5303.namprd06.prod.outlook.com (2603:10b6:a03:cf::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17; Fri, 13 Mar 2020 10:51:12 +0000 Received: from BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9]) by BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9%5]) with mapi id 15.20.2793.021; Fri, 13 Mar 2020 10:51:12 +0000 From: Chi-Hsien Lin To: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Arend van Spriel , Franky Lin , Hante Meuleman , Wright Feng , Kalle Valo , Chi-Hsien Lin Subject: [PATCH V2 5/6] brcmfmac: add USB autosuspend feature support Date: Fri, 13 Mar 2020 05:50:19 -0500 Message-Id: <1584096620-101123-6-git-send-email-chi-hsien.lin@cypress.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> References: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> X-ClientProxiedBy: BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) To BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from aremote02.aus.cypress.com (12.110.209.245) by BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17 via Frontend Transport; Fri, 13 Mar 2020 10:51:10 +0000 X-Mailer: git-send-email 2.1.0 X-Originating-IP: [12.110.209.245] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7f45370f-9bee-41b9-23ce-08d7c73c71bf X-MS-TrafficTypeDiagnostic: BYAPR06MB5303:|BYAPR06MB5303: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:241; X-Forefront-PRVS: 034119E4F6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(136003)(199004)(6486002)(2906002)(54906003)(107886003)(4326008)(5660300002)(316002)(2616005)(66946007)(66556008)(956004)(66476007)(6916009)(8936002)(81156014)(8676002)(81166006)(478600001)(26005)(36756003)(86362001)(52116002)(7696005)(186003)(16526019);DIR:OUT;SFP:1102;SCL:1;SRVR:BYAPR06MB5303;H:BYAPR06MB4901.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1; Received-SPF: None (protection.outlook.com: cypress.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P3FHZGkUvF5+1v96r823HsJcFsdDyTMHiG0BXaSpZViQTJtMR5DnuRnUyrMkTXGPeYbvijOHXkhdGevNIXa5Vxxss7oahhCQEyqVeFBOxpJhYoWDaRM+qe69gLMXRRfeYmN9iTL1mFoNnmi9PgyY8MiCjr/h349diSBJQYjjnB/HCUTOGouKjwkwVAD/4nzYOkmnxb+sP2Ak2FsHAZxqnFVcW4xTTI+y1O8vralY3KTwOUVzAjxOzTreN3tllA5eJjl1rN6Y7MrebTmdnBHJuTelS7C0S2McBapfWNBZusNBamS980h/2/IlYSCOvBSV6P0pK1a9GPWAUiv/QOAynRKk5WHias83Wa9Gr5h79Gm5Myg4/5mIrWYgYDkz/L11IUxBSdODEobi/tXw+PP82GadTx261fcip5O8B629VCErCEyTqg0lLAkQ5egcLoTR X-MS-Exchange-AntiSpam-MessageData: egMhr7E/8Dp0iYUibA6+DhwnX2sHTpIwF3w8Q0p03G9PqLvliRrYL40c0EyOZapxUaZsIF0n0Z/RMJwsL48XKn5eEnketAuu/egImM61OtFdsdLHRgBj+ud65Apha2ExUz8pZpmNXU3GEHN7VKD10A== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f45370f-9bee-41b9-23ce-08d7c73c71bf X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2020 10:51:12.1478 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DrvDwcPXe0bJMQYaB3006oqwI8+A0Nm22D9ZKUNZDh1Ztx9x9evuCAmkHK17dMY/6xfT5dBN3p3HMYt5kIl04Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR06MB5303 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Wright Feng We add enable dynamic suspend (autosuspend) support in host driver, and it can let platform cut down idle power consumption. To support autosuspend feature in host driver, kernel need to be built with CONFIG_USB_SUSPEND and autosuspend need to be turn on. And we also replace wowl feature with adding "needs_remote_wakeup", so that host still can be waken by wireless device. Signed-off-by: Wright Feng Signed-off-by: Chi-Hsien Lin --- .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 120 ++++++++++++--------- 1 file changed, 70 insertions(+), 50 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c index 10387a7f5d56..1108414c4c8f 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c @@ -164,7 +164,6 @@ struct brcmf_usbdev_info { struct urb *bulk_urb; /* used for FW download */ - bool wowl_enabled; struct brcmf_mp_device *settings; }; @@ -312,28 +311,43 @@ static int brcmf_usb_tx_ctlpkt(struct device *dev, u8 *buf, u32 len) int err = 0; int timeout = 0; struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); + struct usb_interface *intf = to_usb_interface(dev); brcmf_dbg(USB, "Enter\n"); - if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) - return -EIO; - if (test_and_set_bit(0, &devinfo->ctl_op)) - return -EIO; + err = usb_autopm_get_interface(intf); + if (err) + goto out; + + if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) { + err = -EIO; + goto fail; + } + + if (test_and_set_bit(0, &devinfo->ctl_op)) { + err = -EIO; + goto fail; + } devinfo->ctl_completed = false; err = brcmf_usb_send_ctl(devinfo, buf, len); if (err) { brcmf_err("fail %d bytes: %d\n", err, len); clear_bit(0, &devinfo->ctl_op); - return err; + goto fail; } timeout = brcmf_usb_ioctl_resp_wait(devinfo); if (!timeout) { brcmf_err("Txctl wait timed out\n"); usb_kill_urb(devinfo->ctl_urb); err = -EIO; + goto fail; } clear_bit(0, &devinfo->ctl_op); + +fail: + usb_autopm_put_interface(intf); +out: return err; } @@ -342,20 +356,30 @@ static int brcmf_usb_rx_ctlpkt(struct device *dev, u8 *buf, u32 len) int err = 0; int timeout = 0; struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); + struct usb_interface *intf = to_usb_interface(dev); brcmf_dbg(USB, "Enter\n"); - if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) - return -EIO; - if (test_and_set_bit(0, &devinfo->ctl_op)) - return -EIO; + err = usb_autopm_get_interface(intf); + if (err) + goto out; + + if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) { + err = -EIO; + goto fail; + } + + if (test_and_set_bit(0, &devinfo->ctl_op)) { + err = -EIO; + goto fail; + } devinfo->ctl_completed = false; err = brcmf_usb_recv_ctl(devinfo, buf, len); if (err) { brcmf_err("fail %d bytes: %d\n", err, len); clear_bit(0, &devinfo->ctl_op); - return err; + goto fail; } timeout = brcmf_usb_ioctl_resp_wait(devinfo); err = devinfo->ctl_urb_status; @@ -363,12 +387,14 @@ static int brcmf_usb_rx_ctlpkt(struct device *dev, u8 *buf, u32 len) brcmf_err("rxctl wait timed out\n"); usb_kill_urb(devinfo->ctl_urb); err = -EIO; + goto fail; } clear_bit(0, &devinfo->ctl_op); + usb_autopm_put_interface(intf); if (!err) return devinfo->ctl_urb_actual_length; - else - return err; +out: + return err; } static struct brcmf_usbreq *brcmf_usb_deq(struct brcmf_usbdev_info *devinfo, @@ -502,10 +528,12 @@ static void brcmf_usb_rx_complete(struct urb *urb) return; } - if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) { + if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP || + devinfo->bus_pub.state == BRCMFMAC_USB_STATE_SLEEP) { skb_put(skb, urb->actual_length); brcmf_rx_frame(devinfo->dev, skb, true); brcmf_usb_rx_refill(devinfo, req); + usb_mark_last_busy(urb->dev); } else { brcmu_pkt_buf_free_skb(skb); brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL); @@ -589,6 +617,11 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb) struct brcmf_usbreq *req; int ret; unsigned long flags; + struct usb_interface *intf = to_usb_interface(dev); + + ret = usb_autopm_get_interface(intf); + if (ret) + goto out; brcmf_dbg(USB, "Enter, skb=%p\n", skb); if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) { @@ -627,9 +660,10 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb) devinfo->tx_flowblock = true; } spin_unlock_irqrestore(&devinfo->tx_flowblock_lock, flags); - return 0; fail: + usb_autopm_put_interface(intf); +out: return ret; } @@ -993,20 +1027,32 @@ static int brcmf_usb_fw_download(struct brcmf_usbdev_info *devinfo) { int err; + struct usb_interface *intf; brcmf_dbg(USB, "Enter\n"); - if (devinfo == NULL) - return -ENODEV; + if (!devinfo) { + err = -ENODEV; + goto out; + } if (!devinfo->image) { brcmf_err("No firmware!\n"); - return -ENOENT; + err = -ENOENT; + goto out; } + intf = to_usb_interface(devinfo->dev); + err = usb_autopm_get_interface(intf); + if (err) + goto out; + err = brcmf_usb_dlstart(devinfo, (u8 *)devinfo->image, devinfo->image_len); if (err == 0) err = brcmf_usb_dlrun(devinfo); + + usb_autopm_put_interface(intf); +out: return err; } @@ -1107,18 +1153,6 @@ struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo, return NULL; } -static void brcmf_usb_wowl_config(struct device *dev, bool enabled) -{ - struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); - - brcmf_dbg(USB, "Configuring WOWL, enabled=%d\n", enabled); - devinfo->wowl_enabled = enabled; - if (enabled) - device_set_wakeup_enable(devinfo->dev, true); - else - device_set_wakeup_enable(devinfo->dev, false); -} - static int brcmf_usb_get_fwname(struct device *dev, const char *ext, u8 *fw_name) { @@ -1145,7 +1179,6 @@ static const struct brcmf_bus_ops brcmf_usb_bus_ops = { .txdata = brcmf_usb_tx, .txctl = brcmf_usb_tx_ctlpkt, .rxctl = brcmf_usb_rx_ctlpkt, - .wowl_config = brcmf_usb_wowl_config, .get_fwname = brcmf_usb_get_fwname, }; @@ -1334,6 +1367,8 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) usb_set_intfdata(intf, devinfo); + intf->needs_remote_wakeup = 1; + /* Check that the device supports only one configuration */ if (usb->descriptor.bNumConfigurations != 1) { brcmf_err("Number of configurations: %d not supported\n", @@ -1447,12 +1482,8 @@ static int brcmf_usb_suspend(struct usb_interface *intf, pm_message_t state) brcmf_dbg(USB, "Enter\n"); devinfo->bus_pub.state = BRCMFMAC_USB_STATE_SLEEP; - if (devinfo->wowl_enabled) { - brcmf_cancel_all_urbs(devinfo); - } else { - brcmf_detach(&usb->dev); - brcmf_free(&usb->dev); - } + brcmf_cancel_all_urbs(devinfo); + device_set_wakeup_enable(devinfo->dev, true); return 0; } @@ -1465,22 +1496,10 @@ static int brcmf_usb_resume(struct usb_interface *intf) struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); brcmf_dbg(USB, "Enter\n"); - if (!devinfo->wowl_enabled) { - int err; - - err = brcmf_alloc(&usb->dev, devinfo->settings); - if (err) - return err; - - err = brcmf_attach(devinfo->dev); - if (err) { - brcmf_free(devinfo->dev); - return err; - } - } devinfo->bus_pub.state = BRCMFMAC_USB_STATE_UP; brcmf_usb_rx_fill_all(devinfo); + device_set_wakeup_enable(devinfo->dev, false); return 0; } @@ -1537,6 +1556,7 @@ static struct usb_driver brcmf_usbdrvr = { .suspend = brcmf_usb_suspend, .resume = brcmf_usb_resume, .reset_resume = brcmf_usb_reset_resume, + .supports_autosuspend = true, .disable_hub_initiated_lpm = 1, }; From patchwork Fri Mar 13 10:50:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chi-Hsien Lin X-Patchwork-Id: 11436677 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7402D6CA for ; Fri, 13 Mar 2020 10:51:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B42C20746 for ; Fri, 13 Mar 2020 10:51:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cypress.com header.i=@cypress.com header.b="nNgwrQpo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726553AbgCMKvR (ORCPT ); Fri, 13 Mar 2020 06:51:17 -0400 Received: from mail-dm6nam12on2136.outbound.protection.outlook.com ([40.107.243.136]:24880 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726528AbgCMKvR (ORCPT ); Fri, 13 Mar 2020 06:51:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cm+RlDkhiv7PDp8mRJPToAlRX4U/AgehPiyBVAp+Y2pvMDNiQ67GfBo8GQwxwCavoUa4cFKD2w1zg/+yhtzeDgQzkB8UHlr0WXiRfBV4cPp6xGB5ReQWxfo2Ly3kzg+Ug1Ohxg/GIpmvK3r1aoeORC4ubGeOEpl48jvJ3vtwGau+az+9S0tAbioZ1pICjc4TjeOi0Z/KCgd9ln0VrbcScxnuBe2QvdZGlsqQijRgvtf9wd9OsUmwmsePW2JebQkR24o5MKn4Y8WmQMbTPNiBF03OZt8KfsqJ9J5Co2r1iPxgjnFM7CoN6pMJ0NGgooa+egL3GjsLMVi7tshEFAiXxg== 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=79EVXAVp3rOPASPlMccRmPR5sV0rZ/Pn7DBUJqEpEiY=; b=EVnrNd8I3ooZTgC3kh9ZIDEAUr9LD9v8U5es7JcAdE5TZkxFMt4yK7ja+7yVW6+1P+2AM5rCKPiDJ0KZyAAdneZY3rmFB0IopqvfdK7jGo0LGolGFw8GceNyrxgi+ZxQrWCtuBFRO/ZerFCIMU0bFlEwNO/ogKVWg5t5E1PSxEZFdnJ6vGsWZzVKUg9G+9SFSE8pXqviQPBkzDEI4U2JgwDb8U/shkl8giJ+W1bddM3QkiBXm6v+C3z2hyU0YuoONnqdROIKWlsfGJzpgycRjZDm7l6A5JjhHYkERk5/nOqnKvvQkiVc0WzHfU+ujCiPPUCzYkj6Bc8LwUvgVbgzXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cypress.com; dmarc=pass action=none header.from=cypress.com; dkim=pass header.d=cypress.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cypress.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=79EVXAVp3rOPASPlMccRmPR5sV0rZ/Pn7DBUJqEpEiY=; b=nNgwrQpo/ZqEjWtve3/LsKc7CCzfCCgK4g0vG4Ttjh9arRNq06jO6fvZrNcwYPLDMGc4J39Pivw1RpirG2/UBX4KyodopEoQ3LJdQo50DeAQQK5mGAsio4kpUIn6AWS/mdtyqcrAfYcLvEfx6iTGTUD0jU1xKxuxEELqWDqrTts= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Chi-Hsien.Lin@cypress.com; Received: from BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) by BYAPR06MB5303.namprd06.prod.outlook.com (2603:10b6:a03:cf::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17; Fri, 13 Mar 2020 10:51:14 +0000 Received: from BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9]) by BYAPR06MB4901.namprd06.prod.outlook.com ([fe80::3cc3:7b1a:bd7b:a0a9%5]) with mapi id 15.20.2793.021; Fri, 13 Mar 2020 10:51:14 +0000 From: Chi-Hsien Lin To: linux-wireless@vger.kernel.org Cc: brcm80211-dev-list@broadcom.com, brcm80211-dev-list@cypress.com, Arend van Spriel , Franky Lin , Hante Meuleman , Wright Feng , Kalle Valo , Raveendran Somu , Chi-hsien Lin Subject: [PATCH V2 6/6] brcmfmac: To support printing USB console messages Date: Fri, 13 Mar 2020 05:50:20 -0500 Message-Id: <1584096620-101123-7-git-send-email-chi-hsien.lin@cypress.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> References: <1584096620-101123-1-git-send-email-chi-hsien.lin@cypress.com> X-ClientProxiedBy: BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) To BYAPR06MB4901.namprd06.prod.outlook.com (2603:10b6:a03:7a::30) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from aremote02.aus.cypress.com (12.110.209.245) by BL0PR02CA0054.namprd02.prod.outlook.com (2603:10b6:207:3d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17 via Frontend Transport; Fri, 13 Mar 2020 10:51:12 +0000 X-Mailer: git-send-email 2.1.0 X-Originating-IP: [12.110.209.245] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 448eb51c-e953-4c2b-d699-08d7c73c72ef X-MS-TrafficTypeDiagnostic: BYAPR06MB5303:|BYAPR06MB5303: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-Forefront-PRVS: 034119E4F6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(136003)(199004)(6486002)(2906002)(54906003)(107886003)(4326008)(5660300002)(6666004)(316002)(15650500001)(2616005)(66946007)(66556008)(956004)(66476007)(6916009)(8936002)(81156014)(8676002)(81166006)(478600001)(26005)(36756003)(86362001)(52116002)(7696005)(186003)(16526019);DIR:OUT;SFP:1102;SCL:1;SRVR:BYAPR06MB5303;H:BYAPR06MB4901.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1; Received-SPF: None (protection.outlook.com: cypress.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BI9j0bKYOCPtan1GlU5n98C0ULIN1GTtdUxyY4NVIiDTRNRV8S5MzhgqZDoFM0AaSLJif+e6VQOv+yKNnWQ7tAYaO2/32qZJGgdLysGLAzBDNkM6SHJer+ht72+aNy8ZlHxQrrq1gQp8dy/hVCDUSgf9hk81g/JaufJMME4jJ9Wv6y6GcCPgZyN1YHxBM2DI6+wvb24nVWmhBKMzf1rcQYyvIe5Uz7O/WqLHS0rOZI6vBG9zvbhWQDms5puUHDdXwzTsY28cn2c3GJvmI6eM6WBal21Gsgb+Qk8z40ISkiKLtb8EAqVsU3nebNWLE3Fmq5jWOtfRG1rYZvNoshpA2FjEeV+2jXUSvF09/hEb2ZSqS15MreNwNEU+EuZgD6T3ZlW++SHuUuK7JyRnpwwFaTgNWwpzcnHfNkicY1FgA3Rg1HSPS3QA0bIfJECShPMv X-MS-Exchange-AntiSpam-MessageData: C4TIxQNJcxWDViinmfaOQkIhEDsWvncLDiHhWrHPArMS4QPYmky009awkkw5jbnwmj7e6TZsyhnf7mNJBe76A6alotf9NLktdkacRULdgqyDij8PPAvIUc/AdstZT0hZ0ZyIWg3h+FKCcjeaOOigGQ== X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: 448eb51c-e953-4c2b-d699-08d7c73c72ef X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2020 10:51:14.1487 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A0+Am3g4YObGQA6uLfwS6ohzzoZqM02a2dXwXYbbpCQhbwfuthQiikqbMitrkxcQ02nU37hnHi8eU8ebPnHhRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR06MB5303 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Raveendran Somu This change is to add support for printing the firmware console messges of a USB interface chip to the host. To enable this feature, build option '-msgtrace' should be enabled in the firmware. And in the host, debug=0x100000 should be provided as a module parameter. Signed-off-by: Raveendran Somu Signed-off-by: Chi-hsien Lin --- .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 1 + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 8 +++ .../wireless/broadcom/brcm80211/brcmfmac/debug.c | 82 ++++++++++++++++++++++ .../wireless/broadcom/brcm80211/brcmfmac/debug.h | 24 +++++++ .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 14 ++++ 5 files changed, 129 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h index 623c0168da79..c8063ca50611 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h @@ -271,6 +271,7 @@ void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state); s32 brcmf_iovar_data_set(struct device *dev, char *name, void *data, u32 len); void brcmf_bus_add_txhdrlen(struct device *dev, uint len); +int brcmf_fwlog_attach(struct device *dev); #ifdef CONFIG_BRCMFMAC_SDIO void brcmf_sdio_exit(void); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 23627c953a5e..fab852461cf1 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -1117,6 +1117,14 @@ static int brcmf_inet6addr_changed(struct notifier_block *nb, } #endif +int brcmf_fwlog_attach(struct device *dev) +{ + struct brcmf_bus *bus_if = dev_get_drvdata(dev); + struct brcmf_pub *drvr = bus_if->drvr; + + return brcmf_debug_fwlog_init(drvr); +} + static int brcmf_revinfo_read(struct seq_file *s, void *data) { struct brcmf_bus *bus_if = dev_get_drvdata(s->private); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c index 120515fe8250..64c8ba0ef8af 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c @@ -14,6 +14,82 @@ #include "fweh.h" #include "debug.h" +static int +brcmf_debug_msgtrace_seqchk(u32 *prev, u32 cur) +{ + if ((cur == 0 && *prev == 0xFFFFFFFF) || ((cur - *prev) == 1)) { + goto done; + } else if (cur == *prev) { + brcmf_dbg(FWCON, "duplicate trace\n"); + return -1; + } else if (cur > *prev) { + brcmf_dbg(FWCON, "lost %d packets\n", cur - *prev); + } else { + brcmf_dbg(FWCON, "seq out of order, host %d, dongle %d\n", + *prev, cur); + } +done: + *prev = cur; + return 0; +} + +static int +brcmf_debug_msg_parser(void *event_data) +{ + int err = 0; + struct msgtrace_hdr *hdr; + char *data, *s; + static u32 seqnum_prev; + + hdr = (struct msgtrace_hdr *)event_data; + data = (char *)event_data + MSGTRACE_HDRLEN; + + /* There are 2 bytes available at the end of data */ + data[ntohs(hdr->len)] = '\0'; + + if (ntohl(hdr->discarded_bytes) || ntohl(hdr->discarded_printf)) { + brcmf_dbg(FWCON, "Discarded_bytes %d discarded_printf %d\n", + ntohl(hdr->discarded_bytes), + ntohl(hdr->discarded_printf)); + } + + err = brcmf_debug_msgtrace_seqchk(&seqnum_prev, ntohl(hdr->seqnum)); + if (err) + return err; + + while (*data != '\0' && (s = strstr(data, "\n")) != NULL) { + *s = '\0'; + brcmf_dbg(FWCON, "CONSOLE: %s\n", data); + data = s + 1; + } + if (*data) + brcmf_dbg(FWCON, "CONSOLE: %s", data); + + return err; +} + +static int +brcmf_debug_trace_parser(struct brcmf_if *ifp, + const struct brcmf_event_msg *evtmsg, + void *event_data) +{ + int err = 0; + struct msgtrace_hdr *hdr; + + hdr = (struct msgtrace_hdr *)event_data; + if (hdr->version != MSGTRACE_VERSION) { + brcmf_dbg(FWCON, "trace version mismatch host %d dngl %d\n", + MSGTRACE_VERSION, hdr->version); + err = -EPROTO; + return err; + } + + if (hdr->trace_type == MSGTRACE_HDR_TYPE_MSG) + err = brcmf_debug_msg_parser(event_data); + + return err; +} + int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, size_t len) { @@ -42,6 +118,12 @@ int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, return 0; } +int brcmf_debug_fwlog_init(struct brcmf_pub *drvr) +{ + return brcmf_fweh_register(drvr, BRCMF_E_TRACE, + brcmf_debug_trace_parser); +} + struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) { return drvr->wiphy->debugfsdir; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h index 9b221b509ade..d61508b62d2c 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h @@ -103,6 +103,10 @@ do { \ #endif /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */ +#define MSGTRACE_VERSION 1 +#define MSGTRACE_HDR_TYPE_MSG 0 +#define MSGTRACE_HDR_TYPE_LOG 1 + #define brcmf_dbg_hex_dump(test, data, len, fmt, ...) \ do { \ trace_brcmf_hexdump((void *)data, len); \ @@ -120,6 +124,7 @@ int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, int (*read_fn)(struct seq_file *seq, void *data)); int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, size_t len); +int brcmf_debug_fwlog_init(struct brcmf_pub *drvr); #else static inline struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) { @@ -137,6 +142,25 @@ int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, { return 0; } + +static inline +int brcmf_debug_fwlog_init(struct brcmf_pub *drvr) +{ + return 0; +} #endif +/* Message trace header */ +struct msgtrace_hdr { + u8 version; + u8 trace_type; + u16 len; /* Len of the trace */ + u32 seqnum; /* Sequence number of message */ + /* Number of discarded bytes because of trace overflow */ + u32 discarded_bytes; + /* Number of discarded printf because of trace overflow */ + u32 discarded_printf; +}; + +#define MSGTRACE_HDRLEN sizeof(struct msgtrace_hdr) #endif /* BRCMFMAC_DEBUG_H */ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c index 1108414c4c8f..6051657a9628 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c @@ -1218,6 +1218,12 @@ static void brcmf_usb_probe_phase2(struct device *dev, int ret, if (ret) goto error; + if (BRCMF_FWCON_ON()) { + ret = brcmf_fwlog_attach(devinfo->dev); + if (ret) + goto error; + } + /* Attach to the common driver interface */ ret = brcmf_attach(devinfo->dev); if (ret) @@ -1294,9 +1300,17 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) ret = brcmf_alloc(devinfo->dev, devinfo->settings); if (ret) goto fail; + + if (BRCMF_FWCON_ON()) { + ret = brcmf_fwlog_attach(devinfo->dev); + if (ret) + goto fail; + } + ret = brcmf_attach(devinfo->dev); if (ret) goto fail; + /* we are done */ complete(&devinfo->dev_init_done); return 0;