From patchwork Mon Nov 13 10:28:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10055533 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5CB246029B for ; Mon, 13 Nov 2017 10:28:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B3CC29368 for ; Mon, 13 Nov 2017 10:28:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E3F929363; Mon, 13 Nov 2017 10:28:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C48929363 for ; Mon, 13 Nov 2017 10:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752380AbdKMK2z (ORCPT ); Mon, 13 Nov 2017 05:28:55 -0500 Received: from mail-sn1nam01on0085.outbound.protection.outlook.com ([104.47.32.85]:59533 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752177AbdKMK2l (ORCPT ); Mon, 13 Nov 2017 05:28:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Hd5EiltmTlXh+1VHvJkRTfSgyerN7LDzYn4Uiz8vBhE=; b=CcrI8Puy4zMG3bnQSkXWTKvJxrx3yehe2oCrl0MzGtYgCLP5wEI6xM+XTI/5A2rvSnwtsJILBnfgBCvFecJRFvA15yzAFMmeA00I9sTtx/CdfH67kRiN0KKtSWeVaS6gVezlouv3S++ElJR2UEnWq1T31mkFLQpxx6k9I9zg1Cw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BLUPR05MB1924.namprd05.prod.outlook.com (10.162.224.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.239.4; Mon, 13 Nov 2017 10:28:38 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil , Vasily Ulyanov Subject: [PATCH 09/10] qtnfmac: keeping track of "generation" for STA info Date: Mon, 13 Nov 2017 13:28:14 +0300 Message-Id: <20171113102815.11254-10-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171113102815.11254-1-sergey.matyukevich.os@quantenna.com> References: <20171113102815.11254-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM5P190CA0007.EURP190.PROD.OUTLOOK.COM (10.161.47.148) To BLUPR05MB1924.namprd05.prod.outlook.com (10.162.224.14) X-MS-Office365-Filtering-Correlation-Id: 0dba34ab-010c-46f2-9137-08d52a814e08 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:BLUPR05MB1924; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1924; 3:r2Dj3wVsUk6czDLNgRl3McXjlKX9XNggVbp+pszHG7CEvAgZPMYlI/HDYHS02C7gWEeWD/xSrp8302B5cPuflkS7RuiU+eT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/seRRqO9mFXtjWv0vieCkIxQF1//bq3yDRCyDBc1URbxcCcfRLHd0zecpNyQYnWAlWLnjKCI9a56V89tQhy0iesLZXmoi1hHmgOfXY74tHYS8k0kIpdH9Y/3iWLd/I3N/vMH2+WE2wqzUNCgBDMR1Op7cnEIMV38IFM5i7NokZ/0A6pUXYZ9QMcc78gCu0MWlhZuAWj/myP6vMnEV2W9RcN5budg+WNduuVQDEq0ypE6FIo2KLyK7oBeukvfZ4Ymnlp4P1562WaYC5hs0B8ECVv5oCtV6jjN2RqtxVMhhpx1K3NqEV9r2eK; 4:JFwVTpRMtBwoDZAYEvOjScRgvLe4FEwjSyTiNtrgVk6XLFNG9k3yvH23hLvg++0C+bktBtzI76kndyQVI03EabtFQ/WZ/CyhV9+1WU51Z2EdQx/1F0M1WMM6tU6XT1fO/PTw/eGYvbHUF0H6aZtNVWbrkw25iVweiCf8Pn9TEo6YEYd5IM8kbJErlCE1qTSnVmqtP3JsKUZ7b4ByO9ZcMH2x9XwHR+skif2Wl1er1dOWAdUy5DewLrF9GM11Mw8OZHgKKsV5WxgQKMhqluMxtw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(3231022)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BLUPR05MB1924; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BLUPR05MB1924; X-Forefront-PRVS: 0490BBA1F0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(39830400002)(346002)(199003)(189002)(5660300001)(107886003)(47776003)(105586002)(50226002)(54906003)(66066001)(53936002)(2361001)(76176999)(316002)(6486002)(6916009)(50986999)(97736004)(4326008)(33646002)(5003940100001)(106356001)(2906002)(6666003)(2950100002)(25786009)(101416001)(16526018)(189998001)(81166006)(81156014)(86362001)(8676002)(6116002)(3846002)(478600001)(68736007)(53416004)(48376002)(7736002)(50466002)(2351001)(16586007)(103116003)(69596002)(36756003)(305945005)(1076002)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB1924; H:bars.quantenna.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR05MB1924; 23:PAicDvGqIPniFkI4RHxEOpwqtmBocaS3bVmh12TFG?= =?us-ascii?Q?4yab3Fw0xbZ9X7VI/AF/efCJsnd8+Owa4BueFaSDmHJZ43Q0BNJdNN/cjXrD?= =?us-ascii?Q?4GBkAAKiMTDRMG6M7xacRXSRvW2MbtsTskSwUNAzL1CEe1RIHW0kYGUvVv00?= =?us-ascii?Q?2zMM0+5lGVErtK6omOoss/TVe8E60I01gxnmFbN0WnOZtrnKB/yMQr4R/Npn?= =?us-ascii?Q?DsS1AVQwHKB61Ck+wanDbuggho4/Rn9AUqB+9xDtYoCDObRPstkye6Qi6/bN?= =?us-ascii?Q?mgeWSN6Sl5JnrMrc+AsG5wEFybxsUx3+nAJTisPWQelSAD4i2CBG0Ppo9KQD?= =?us-ascii?Q?P8Il0JYeZFVdEBnXwrEYU/AbS0UdBUqda6s5VtBy+w4TDdJAq0jWhyn4iqqc?= =?us-ascii?Q?uUBQHYim9XJGKS5qdNPtV2eE7zGXAavJz/+0UqbgLg39vG4KM7gDNoATMA7I?= =?us-ascii?Q?GI0FK+dU34cbt2Eqakhgfe3QwTfmxq81/epEn6s+eZlIz1FTWM1+/m7wkTSz?= =?us-ascii?Q?vqP6OfJVvC0dtgf+Z47KRK/ety3VjRveZDgqUF/oJKVdcllNAbcQDhOg99kc?= =?us-ascii?Q?iClOMLve+EVCGQ4tGx1vKPVcz3x4A9pJZ3Aum3ptMJNcqFLIsQ4SVAg7IA+1?= =?us-ascii?Q?JRPFPTpPC0X8bfdDjLFLoSBfPXHTXgh9u6ydp1aG1TnCKclzakr4coFCLWUE?= =?us-ascii?Q?3AHYMuzO3STOMsHHJlpb62ZkshVnHrbMtN6j4uG3klypwGeFKc/IqnOW7teE?= =?us-ascii?Q?yX3x5bNzzyKx/bhJ2e5HwnGnhtlZN/UIdTAsdBO3asbSfKSmmWrJN7DSLS3z?= =?us-ascii?Q?1tjuJdm/6uQ5seF1ibcjdnREo7PUcu49UAzbQv+FHeWnYI3WK+PbNy6mgQls?= =?us-ascii?Q?MFCN39fgFKGaBXYHLRrsieMow48zjTVSiokaSBSDwK1nAIwdj4BFpZUxdWgv?= =?us-ascii?Q?WK7CRY1EbUVjttk+YtQASRp0e0NMy/0VBvfZNwojbfRQSHAJ9qmnzLBcKWYC?= =?us-ascii?Q?LJI/xinrJTYgV95oCW/rtq5llfr+8P2Affn5fR5lPTa6qlprmF+wwv5Scwuu?= =?us-ascii?Q?IzUNk9QbjgleK3u9mGtOc7FaqWBjilITCmu11jW3MLsztQGUiOEZUasXUAmM?= =?us-ascii?Q?LHUlGqAwXH6hO5DI3RL90F7xU9g93HRNatwP8wOC+LClqY0iFcS0gxEL2mP3?= =?us-ascii?Q?qOjgJNMksnqWi7pP+N2hGcgWZgTYMlpq2TA?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1924; 6:mgveDt5lFmd9gibuIG9d/srM0MYvsuDzxk5wG88vtuklLif1tzoUSQrHNau7CSjEP/o18j2ix9RpBUjP4J4MMCkkKYBwXoLDESjAnlhubE+3Qp97DvcfNz8eHLA6aNAi2HPBO4mnp9qjvmGqbhZmVdKk//EDvlf/L4u7arE967BHiuhmuRrzKVrESjvaESkKDzv817C44Dy/xbsH4RYWiyfezDtZiFYJtzt9Vsn4sy/t8Tl12u1Zl1rqIdSipgbUfs6JMIE7g9/l/DnplUXsgwKMUyS7pMdsmArU+PXz7l3u9Y88cM48Ays79s4gRCeBLVeuqAimF5td087M1c2P970l2Y09VbeqxYEnLVe9zAM=; 5:eQiOoNU0O41mBrQw6iGNfcEHI0ySpVI1BftVKq/LX9B4tWllIRiqTeDCT3+U38TFoPJby6M+wnLgq6EIPOlLTyfFZzeTiEu5XlkzzxOYq+r0J35nEMvs0Rkz8RbnJ8gxy5LcR+omLuOGE2YFRaS1AQ3/2m3snuRB4RFGqNv4c9Q=; 24:16r/hhZ4sYmVpuUSoRFUIp7sgcQOJjWVMabQ01j0O0YDogPeSzouD8mmR/Rqg3BLNx4iC2nD4HVcF2xtyAq1HC9Y9hdHg23pNFB7Z1X9eLY=; 7:GIxQZ5SHZr8hSxN/mtCbpbxr6MPmk21TABr13TjhqDosg/x5H1MB199MUAtRCih1WXNYm7CMcyp9XLxoonxJgVOD6tzlCC3F3ElCYsDn2SaWi0p+yTPiNhN8wPCccWuy7UIMwMgNXi6uL6kL5FexvMO4lYSsbn9kULbwKqMz2/9rr24oenaddpdkCWvM0QuQZz5VpfqxsqAq7ftdvEXP1PKFn2TZrxXra6NCs4jYD3RTY8jY0Eht4aadHccB7Vo+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2017 10:28:38.2374 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0dba34ab-010c-46f2-9137-08d52a814e08 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB1924 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Igor Mitsyanko Keep generation in per-VIF data structure and increment it whenever STA list is changed. Use generation value to fill struct station_info when required. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 5 ++++- drivers/net/wireless/quantenna/qtnfmac/core.h | 1 + drivers/net/wireless/quantenna/qtnfmac/event.c | 5 +++-- drivers/net/wireless/quantenna/qtnfmac/util.c | 8 ++++++-- drivers/net/wireless/quantenna/qtnfmac/util.h | 4 ++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index f5eb2cdefae2..452def343ad3 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -418,6 +418,7 @@ qtnf_get_station(struct wiphy *wiphy, struct net_device *dev, { struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); + sinfo->generation = vif->generation; return qtnf_cmd_get_sta_info(vif, mac, sinfo); } @@ -439,11 +440,13 @@ qtnf_dump_station(struct wiphy *wiphy, struct net_device *dev, ret = qtnf_cmd_get_sta_info(vif, sta_node->mac_addr, sinfo); if (unlikely(ret == -ENOENT)) { - qtnf_sta_list_del(&vif->sta_list, mac); + qtnf_sta_list_del(vif, mac); cfg80211_del_sta(vif->netdev, mac, GFP_KERNEL); sinfo->filled = 0; } + sinfo->generation = vif->generation; + return ret; } diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.h b/drivers/net/wireless/quantenna/qtnfmac/core.h index d7e295efb07d..e7bd21ed371b 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.h +++ b/drivers/net/wireless/quantenna/qtnfmac/core.h @@ -88,6 +88,7 @@ struct qtnf_vif { struct work_struct reset_work; struct qtnf_sta_list sta_list; unsigned long cons_tx_timeout_cnt; + int generation; }; struct qtnf_mac_info { diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index b3489b5b5d9e..8a3d2b1194e4 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -59,10 +59,11 @@ qtnf_event_handle_sta_assoc(struct qtnf_wmac *mac, struct qtnf_vif *vif, pr_debug("VIF%u.%u: MAC:%pM FC:%x\n", mac->macid, vif->vifid, sta_addr, frame_control); - qtnf_sta_list_add(&vif->sta_list, sta_addr); + qtnf_sta_list_add(vif, sta_addr); sinfo.assoc_req_ies = NULL; sinfo.assoc_req_ies_len = 0; + sinfo.generation = vif->generation; payload_len = len - sizeof(*sta_assoc); tlv = (const struct qlink_tlv_hdr *)sta_assoc->ies; @@ -132,7 +133,7 @@ qtnf_event_handle_sta_deauth(struct qtnf_wmac *mac, struct qtnf_vif *vif, pr_debug("VIF%u.%u: MAC:%pM reason:%x\n", mac->macid, vif->vifid, sta_addr, reason); - if (qtnf_sta_list_del(&vif->sta_list, sta_addr)) + if (qtnf_sta_list_del(vif, sta_addr)) cfg80211_del_sta(vif->netdev, sta_deauth->sta_addr, GFP_KERNEL); diff --git a/drivers/net/wireless/quantenna/qtnfmac/util.c b/drivers/net/wireless/quantenna/qtnfmac/util.c index ed38e87471bf..e745733ba417 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/util.c +++ b/drivers/net/wireless/quantenna/qtnfmac/util.c @@ -57,9 +57,10 @@ struct qtnf_sta_node *qtnf_sta_list_lookup_index(struct qtnf_sta_list *list, return NULL; } -struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_sta_list *list, +struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_vif *vif, const u8 *mac) { + struct qtnf_sta_list *list = &vif->sta_list; struct qtnf_sta_node *node; if (unlikely(!mac)) @@ -77,13 +78,15 @@ struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_sta_list *list, ether_addr_copy(node->mac_addr, mac); list_add_tail(&node->list, &list->head); atomic_inc(&list->size); + ++vif->generation; done: return node; } -bool qtnf_sta_list_del(struct qtnf_sta_list *list, const u8 *mac) +bool qtnf_sta_list_del(struct qtnf_vif *vif, const u8 *mac) { + struct qtnf_sta_list *list = &vif->sta_list; struct qtnf_sta_node *node; bool ret = false; @@ -93,6 +96,7 @@ bool qtnf_sta_list_del(struct qtnf_sta_list *list, const u8 *mac) list_del(&node->list); atomic_dec(&list->size); kfree(node); + ++vif->generation; ret = true; } diff --git a/drivers/net/wireless/quantenna/qtnfmac/util.h b/drivers/net/wireless/quantenna/qtnfmac/util.h index 0359eae8c24b..0d4d92b11540 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/util.h +++ b/drivers/net/wireless/quantenna/qtnfmac/util.h @@ -26,9 +26,9 @@ struct qtnf_sta_node *qtnf_sta_list_lookup(struct qtnf_sta_list *list, const u8 *mac); struct qtnf_sta_node *qtnf_sta_list_lookup_index(struct qtnf_sta_list *list, size_t index); -struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_sta_list *list, +struct qtnf_sta_node *qtnf_sta_list_add(struct qtnf_vif *vif, const u8 *mac); -bool qtnf_sta_list_del(struct qtnf_sta_list *list, const u8 *mac); +bool qtnf_sta_list_del(struct qtnf_vif *vif, const u8 *mac); void qtnf_sta_list_free(struct qtnf_sta_list *list);