Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1134736pxb; Wed, 6 Apr 2022 09:30:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQV/Rj3PsD9VDWehVMFEX2bMc32bCCwSo2+I0joKEnELqtbnHc65/JUQz6f83ZWkCa9abD X-Received: by 2002:a62:e404:0:b0:4fd:b97b:8bc9 with SMTP id r4-20020a62e404000000b004fdb97b8bc9mr9793455pfh.48.1649262654433; Wed, 06 Apr 2022 09:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649262654; cv=none; d=google.com; s=arc-20160816; b=na/E6l6/xsiydAvGS8R477gVw4hfQ4Gcn6nVcK032ASapeEl21Sl0/BAXDEv1oEB4b xWKpa4G8OCULu+eGgvzEMrdtpL5MqiupfFQCIDRFY1jQkAJZ2qOOhycMF4whU2IYG6+t NXGU9m3jZwEza1orpDdCN2fvMgxowpWLmS+vuETSkKW65g34VO32l4ZMFLJ1qP5tasN0 h269uXigd1+HoWdQa1WNHht8/RaRIlSxx8J1UJopcjEGUO7HdcxeZ6tEskL62+g2WdBz 8MFPm2SRWVpb1LQ4O8W94H8c0s+3ztHkPwvygVwEkSh5oZ9I0PpRvh+EoCr14xcja+au nZGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from; bh=f69fPxVYzYDzhYLSse6pY+yubI8uR756G1q43vTTM9Y=; b=ZguND75gygfDSZLhZ7/6d9kQctln5LnQTs83+g84WEifiatiCjLheDdMmFGqNiO1aj lTjZj1BfZlqKkx/m1KmGKdqOCrWc/eY+uNpO07Wdsa3HHcjvViP/qdIuv0ZEg1VhBjaS jsax0fU59bW2xE/gd4daK1YR6W3Rr/jfcOTy6qmHbEhxZtqviX+IHdaub6+y3MR2LwUg JvaUXfb6R/NDmRQQLNrQC81s5Pnc55BC4UQ1ZZEH0gdXcB+VfW+iQ42n8X8LhdQ9Q/Ve wmaP8udkVbechrs4zc00xHozylynzjkEa7Xcn1idMMm4XLWYuaB816HnPyJA01yZwFsb Ml1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y16-20020a170902b49000b0015636e142c9si15980017plr.80.2022.04.06.09.30.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 09:30:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 971B0E29F1; Wed, 6 Apr 2022 08:37:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236235AbiDFPjI (ORCPT + 69 others); Wed, 6 Apr 2022 11:39:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237093AbiDFPid (ORCPT ); Wed, 6 Apr 2022 11:38:33 -0400 Received: from farmhouse.coelho.fi (paleale.coelho.fi [176.9.41.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DB67DB2F1 for ; Wed, 6 Apr 2022 05:53:15 -0700 (PDT) Received: from 91-156-4-241.elisa-laajakaista.fi ([91.156.4.241] helo=kveik.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1nc4Td-000pov-FY; Wed, 06 Apr 2022 15:09:36 +0300 From: Luca Coelho To: johannes@sipsolutions.net, kvalo@kernel.org Cc: luca@coelho.fi, gregory.greenman@intel.com, linux-wireless@vger.kernel.org Date: Wed, 6 Apr 2022 15:09:21 +0300 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406120924.979792-1-luca@coelho.fi> References: <20220406120924.979792-1-luca@coelho.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Subject: [PATCH 4/7] cfg80211: add hardware timestamps to frame RX info Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Avraham Stern Add hardware timestamps to management frame RX info. This shall be used by drivers that support hardware timestamping for Timing measurement and Fine timing measurement action frames RX. Signed-off-by: Avraham Stern Signed-off-by: Luca Coelho --- include/net/cfg80211.h | 4 ++++ net/wireless/nl80211.c | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index ae20256c3243..b113fb86151c 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -7537,6 +7537,8 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, * @buf: Management frame (header + body) * @len: length of the frame data * @flags: flags, as defined in enum nl80211_rxmgmt_flags + * @rx_tstamp: Hardware timestamp of frame RX in nanoseconds + * @ack_tstamp: Hardware timestamp of ack TX in nanoseconds */ struct cfg80211_rx_info { int freq; @@ -7544,6 +7546,8 @@ struct cfg80211_rx_info { const u8 *buf; size_t len; u32 flags; + u64 rx_tstamp; + u64 ack_tstamp; }; /** diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index fe4b62b4715f..6b78577aa590 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -17447,7 +17447,15 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, info->sig_dbm)) || nla_put(msg, NL80211_ATTR_FRAME, info->len, info->buf) || (info->flags && - nla_put_u32(msg, NL80211_ATTR_RXMGMT_FLAGS, info->flags))) + nla_put_u32(msg, NL80211_ATTR_RXMGMT_FLAGS, info->flags)) || + (info->rx_tstamp && nla_put_u64_64bit(msg, + NL80211_ATTR_RX_HW_TIMESTAMP, + info->rx_tstamp, + NL80211_ATTR_PAD)) || + (info->ack_tstamp && nla_put_u64_64bit(msg, + NL80211_ATTR_TX_HW_TIMESTAMP, + info->ack_tstamp, + NL80211_ATTR_PAD))) goto nla_put_failure; genlmsg_end(msg, hdr); -- 2.35.1