From patchwork Fri Nov 22 17:06:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 11258173 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 6A26D109A for ; Fri, 22 Nov 2019 17:09:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 49A1120714 for ; Fri, 22 Nov 2019 17:09:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FSB9ixAD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727016AbfKVRJN (ORCPT ); Fri, 22 Nov 2019 12:09:13 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:41161 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbfKVRJN (ORCPT ); Fri, 22 Nov 2019 12:09:13 -0500 Received: by mail-pj1-f65.google.com with SMTP id gc1so3285124pjb.8 for ; Fri, 22 Nov 2019 09:09:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=6+LL8qsLHJX2/gsW2qsgwafSTmgjosS9b/ig7Inn4hU=; b=FSB9ixAD74wEJscfeuQGF2SI89/+bdBgZ/bNswr7AjGjIE1qDolwxuck1XIs7wf8vJ ka0UApVgmwdjcxrPxnvm+x4l6fkhedHqYZJ6qZKQSfOJxjle97oL99guJXjmhY+4A0Sw vteWXcOLKt51duo8bLktBPp9SEka/J0bHJqjXFjNczlLYZI2d/yZ4SX88shYSHI31QhM HjEUqYY0+NiUd2pOhpxD/k1xDPa5X1B+tGJahV6rpbgjciVaz3KIwr1Q+XyTZ2X9TqPE bPuZG8qvGKJskVjzHT89HM7ur9/n/WostnkeG9Rxnn6RBt6f2TvnvnsRMO8eq8qzJ9IS SuLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6+LL8qsLHJX2/gsW2qsgwafSTmgjosS9b/ig7Inn4hU=; b=AOOH+2zw1KIHnRUGD70BfqExcmsNQmOxpa2jA+FTBvnmj4jWmMbVVP6Y9OFsXJpsJ6 86DS5D0Zpu0KeVYqrmnP8fuzV/yhqWwdVo0kBY8unFSXuVBld+2WTyCbbuHY+y8oXoBr fbjg/xLQ5tF6MNnzv1RSFRmSAUuUpQPtST3wYhyIWtGCsEUht4yQ8Y8Md07dH4yAhAzU JVd7OeocXFpywnoS4Peb1FF1ks0CLClAtyv5j9yRkLrWnNZnCDipscfu6HG3DuUg2rdb 1Vk2nuQr8Wd+tt6iDNcSMpJRbzbddqGLNzaS9dv4kjq6u2Wf9eM4lfvtFi4O34pVNJHT /Zsw== X-Gm-Message-State: APjAAAUXvzk88tUBAqdkXJOokCB20JSW4/VGMhwDur4F5jkeXuejRzvn KiRMW6Ce+WxnHbC2OQB1M/T/R+SB X-Google-Smtp-Source: APXvYqwSl2kAOwhVgFwviFUELZX+XBMxnyUJUe6o1+ngl6RmjTtx5dhIc81BJ21ib7LuNJOSEqYHyw== X-Received: by 2002:a17:90a:1446:: with SMTP id j64mr20559449pja.142.1574442551843; Fri, 22 Nov 2019 09:09:11 -0800 (PST) Received: from jprestwo-test.jf.intel.com ([134.134.139.76]) by smtp.gmail.com with ESMTPSA id c2sm7834386pfn.55.2019.11.22.09.09.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2019 09:09:11 -0800 (PST) From: James Prestwood To: linux-wireless@vger.kernel.org Cc: James Prestwood Subject: [PATCH v2 1/2] mac80211_hwsim: enable parent TSF feature Date: Fri, 22 Nov 2019 09:06:11 -0800 Message-Id: <20191122170612.8123-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Support for this is already in nl80211, and some code paths in mac80211_hwsim already set the rx_status to allow the parent TSF value to be sent to user space. Signed-off-by: James Prestwood --- drivers/net/wireless/mac80211_hwsim.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 772e54f0696f..e9bc599481d4 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -2825,6 +2825,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, NL80211_FEATURE_DYNAMIC_SMPS | NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); + wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_BSS_PARENT_TSF); hw->wiphy->interface_modes = param->iftypes; From patchwork Fri Nov 22 17:06:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 11258175 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 69C5F13A4 for ; Fri, 22 Nov 2019 17:09:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 49FF520714 for ; Fri, 22 Nov 2019 17:09:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Otz1x5SZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727340AbfKVRJP (ORCPT ); Fri, 22 Nov 2019 12:09:15 -0500 Received: from mail-pj1-f67.google.com ([209.85.216.67]:37504 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbfKVRJP (ORCPT ); Fri, 22 Nov 2019 12:09:15 -0500 Received: by mail-pj1-f67.google.com with SMTP id f3so3296126pjg.4 for ; Fri, 22 Nov 2019 09:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B9Jv/xAwTMBr/SQQOmML2Im6jUVdZ8hkN/604W9MSNM=; b=Otz1x5SZr4Ai4oe618yeoJtEUqcNl6T2x+sPkbyjFGhdufiMyR4qnEDfLosMF/jMS5 KOQdJaSgAsknJFLwAMBn8ydfGWQgAEDgHlkFAYyfYSboq7hOp7hv6B7EMScnza7+ysQm jdKNfIJHdDWoJ3Uo5If+7bexsoochJMo6HcO+Lb3XwMaJZpuYbK+ezR+NfiyIDC+sYG6 E8VcscIUqx9VOgovYnnGSZeaW/NgyBwVCnOXLxxz0+KGaMOLxM10DZxdvyTIW8JtnmMN GUNs3/6fo3noEhQtf+PimP8WNaqgkPVUM3isvE/ek84YbjbITsIGPfnsSepGH7D7T0sh GPrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B9Jv/xAwTMBr/SQQOmML2Im6jUVdZ8hkN/604W9MSNM=; b=cyozt/njtBfuVaCZed7G0dcyna02DjxxszsRxFwdmcefcr+ypwaGseXXJk0XanKlUP WUYlxp1C3tb0AeFj4dfZYS6z8PrIB4flOsfqRgriMZTetCc3q8mOnJjdaecfAAE7FTRh OopPyPxkPupMA2puNHBug6MzsLjf0trGX33a5rPI7ZeNGp0J9l5GRs1mACz6hPq47tx5 8XoAlyv76Sed6ZZBBRrAI/UNZAS7hyIkuJBioMUzXaP4XCvEa9Q/KDctOWLyt96jouJu OzPvVNwkgW5yrWZvRRD3MBa2mpeDmXymxfujvvx+ejdKKXM6BIJx7MNkPebEJtpuyMOU 4nlg== X-Gm-Message-State: APjAAAVQz6ueJWG40fk2ozOfHnOio3LDnAvnKHqfIUiuSwQ3U1gFz1pN 2vl/mEyZO709QAcnpbMoQHoLEbrs X-Google-Smtp-Source: APXvYqy8iOInsv2Xi21sBpFzRihKzdOHRvkE+eYK6IpgE/r3NQZTDgiJHqd/V+tjcYnzDFSqOcBUew== X-Received: by 2002:a17:90a:ab98:: with SMTP id n24mr20264104pjq.96.1574442552579; Fri, 22 Nov 2019 09:09:12 -0800 (PST) Received: from jprestwo-test.jf.intel.com ([134.134.139.76]) by smtp.gmail.com with ESMTPSA id c2sm7834386pfn.55.2019.11.22.09.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2019 09:09:12 -0800 (PST) From: James Prestwood To: linux-wireless@vger.kernel.org Cc: James Prestwood Subject: [PATCH v2 2/2] mac80211_hwsim: set rx_status mactime/flag for wmediumd path Date: Fri, 22 Nov 2019 09:06:12 -0800 Message-Id: <20191122170612.8123-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191122170612.8123-1-prestwoj@gmail.com> References: <20191122170612.8123-1-prestwoj@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This patch sets the required rx_status mactime and flags in order for the parent TSF value to be calculated and sent to userspace. This is already done elsewhere, but this patch allows this to work for the wmediumd code path. --- drivers/net/wireless/mac80211_hwsim.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index e9bc599481d4..01b2ac9707cc 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -3238,6 +3238,8 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, int frame_data_len; void *frame_data; struct sk_buff *skb = NULL; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb_2->data; + u64 now; if (!info->attrs[HWSIM_ATTR_ADDR_RECEIVER] || !info->attrs[HWSIM_ATTR_FRAME] || @@ -3300,6 +3302,18 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); + if (ieee80211_is_beacon(hdr->frame_control) || + ieee80211_is_probe_resp(hdr->frame_control)) { + rx_status.boottime_ns = ktime_get_boottime_ns(); + now = data2->abs_bcn_ts; + } else { + now = mac80211_hwsim_get_tsf_raw(); + } + + rx_status.mactime = now + data2->tsf_offset; + + rx_status.flag |= RX_FLAG_MACTIME_START; + memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); data2->rx_pkts++; data2->rx_bytes += skb->len;