From patchwork Wed Jan 15 12:13:27 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: 11333935 X-Patchwork-Delegate: johannes@sipsolutions.net 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 C3981138D for ; Wed, 15 Jan 2020 12:14:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A87124671 for ; Wed, 15 Jan 2020 12:14:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="Md8ezmzL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731015AbgAOMOb (ORCPT ); Wed, 15 Jan 2020 07:14:31 -0500 Received: from mail-co1nam11on2064.outbound.protection.outlook.com ([40.107.220.64]:28929 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730768AbgAOMOa (ORCPT ); Wed, 15 Jan 2020 07:14:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fOWwIz/yItcWai/D+jqCjDW5Lyq3GUnRTCc4bYv8CdBL56OT0Gjasmjt6iScVLosc7lw1KJXVKyR11rc2nbxgOFuvjJHpfcikFQ8j0o8H/pOLLay8b046AgZpo0M7UwYm681hbWGfz77t4MhaTRHQZIimpnHUvyzuRCng+ImjUQhmoeZpaofTFaUasuv+AQ3lxmPNWb7PxuVxr5ynEdIFV0YoNSlg6NWcOfLFLxy278bbEBG+FJYLJiqaJRd19RdgCyrH1OE/YPh+i33/vg6xm21DE3PpfQAgqWX0cHwo4o/1Y/HhBg0HJ5QhWZRa0K/fGRtRxBO2w3O+erBPTxjNA== 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=NV6i8iFSi16VOyb/8DY1eR4/NhyYerJyThLKXln0oV0=; b=XPD7eGgGJB8SnYnyWjnpE8bnLBOVfH2V64n0iQMBjHBBLS3sC06HPXbrzvRhJ1TaB68ZQifLyBigU0ae54RhBzhPdA9lu7CQAPQMGrZU/BEFnOfbxf2L0JjfZRd0FMf66hSL+nJgKXh/YZM5upYZrUj/WTL1Annowh8wnAh8IhsOqWYEXWWjIsqPQJaQtyCdy+sj0S7cPupht+8tb0utH0uln4Pq3jZzBsVdiZngtD9MCh6lPkrCJcAJ7E0Q761XeKlj7BoiLC0FtwYpjiMrY3LGbuFjJOoDRbFTzq3diHbn4zyjxlxHEdrmb95HSPEFt/BOW9jhxNEMZv0wkvUDqQ== 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=NV6i8iFSi16VOyb/8DY1eR4/NhyYerJyThLKXln0oV0=; b=Md8ezmzLb3VrPsDPer2OczEMomSCJTd09QasSMk85RyIXwOkYSKQl7TyVpZA88W4Act7/6q/HvAYPE9CxKNuoqgxVC5ARuKUFTa6D5FUg65eAhc24mm59K396+qTYe/5tH2zDDTaVAAbfdkmXHSxyTugYnV6JSlogv4DATzAk+s= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (10.255.180.22) by MN2PR11MB3934.namprd11.prod.outlook.com (10.255.180.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Wed, 15 Jan 2020 12:13:37 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::f46c:e5b4:2a85:f0bf]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::f46c:e5b4:2a85:f0bf%4]) with mapi id 15.20.2623.018; Wed, 15 Jan 2020 12:13:37 +0000 Received: from pc-42.silabs.com (37.71.187.125) by PR2PR09CA0009.eurprd09.prod.outlook.com (2603:10a6:101:16::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18 via Frontend Transport; Wed, 15 Jan 2020 12:13:26 +0000 From: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= 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 59/65] staging: wfx: ensure that packet_id is unique Thread-Topic: [PATCH 59/65] staging: wfx: ensure that packet_id is unique Thread-Index: AQHVy50xnP1XCgggU0yByloZoEVwtg== Date: Wed, 15 Jan 2020 12:13:27 +0000 Message-ID: <20200115121041.10863-60-Jerome.Pouiller@silabs.com> References: <20200115121041.10863-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20200115121041.10863-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR2PR09CA0009.eurprd09.prod.outlook.com (2603:10a6:101:16::21) To MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.25.0 x-originating-ip: [37.71.187.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 719e2ba5-2756-4a2e-19e0-08d799b453e3 x-ms-traffictypediagnostic: MN2PR11MB3934: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 02830F0362 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39850400004)(396003)(136003)(376002)(366004)(346002)(199004)(189003)(54906003)(110136005)(86362001)(956004)(107886003)(2616005)(316002)(36756003)(71200400001)(52116002)(7696005)(478600001)(8936002)(81156014)(8676002)(4326008)(81166006)(6486002)(2906002)(26005)(66946007)(16526019)(186003)(5660300002)(66574012)(1076003)(66556008)(64756008)(66446008)(85182001)(66476007)(85202003);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3934;H:MN2PR11MB4063.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: silabs.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: SkDaqEicunoEpjBJodALyj6uvC17gLYAt+/y/m3RT3Y3LxVWhobDneKusaNrlTot0LF8AYbfKxwGdysk29D9G/3ufqM59izY7FfClM81/b2PyrYDc4f63yGIaMcIEuS8r1x0F3Lo7k58kRr6OnEQXE6VtzQkCchq8XznnzfPs7Sv+GFYLb+oJ8hWjbGhBsUoBEw6TAefpDl5PYHA2/5we/p/YnRdcIH7gzJ8FZASHZpE9tjJab8hInXRKxOLAcA302T+yM9LsgyeQqFiBwBhouTq12uMwHeHrjbMj6STupzlWPMkbUa6nRe8LPAfejJt/EX9lOqnjTlfHrI5FKHqG+0vtH1iRq0XRi7iEDtmhUQ3esBmv+w3Pwjmc/iN/Oxsjm/tz2HtkSW5gTDMRAUk23+MXsJfJJLumwmONSRFNxWiCEePbVC1XZAJuPqTQQcq Content-ID: <2E2E1E9D06C44042AC13A8C067BEC5E5@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 719e2ba5-2756-4a2e-19e0-08d799b453e3 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 12:13:27.8818 (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: tKa55qBrvxqBf5/Jbu9FTy4yVDqv96VrhNZUhs7scy/PhUjRIjsPux0eUkaX5MKCF+GuxDdR9tS6F7wKNQ76ag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3934 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller In current code, packet_id is derivated from mac802.11 packet sequence number, but this number is only unique for a station. It is not sufficient. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 8 ++++++-- drivers/staging/wfx/wfx.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index c32994553633..20f4740734f2 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -469,8 +469,12 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, // Fill tx request req = (struct hif_req_tx *)hif_msg->body; - req->packet_id = queue_id << 16 | - IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); + // packet_id just need to be unique on device. 32bits are more than + // necessary for that task, so we tae advantage of it to add some extra + // data for debug. + req->packet_id = queue_id << 28 | + IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)) << 16 | + (atomic_add_return(1, &wvif->wdev->packet_id) & 0xFFFF); req->data_flags.fc_offset = offset; if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) req->data_flags.after_dtim = 1; diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 5d61946e33e0..8b85bb1abb9c 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -54,6 +54,7 @@ struct wfx_dev { int tx_burst_idx; atomic_t tx_lock; + atomic_t packet_id; u32 key_map; struct hif_req_add_key keys[MAX_KEY_ENTRIES];