Skip to content

Commit

Permalink
wifi: cfg80211: add hardware timestamps to frame RX info
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
AviStern authored and jmberg-intel committed Jul 22, 2022
1 parent 00b3d84 commit 1ff715f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -7800,13 +7800,17 @@ 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;
int sig_dbm;
const u8 *buf;
size_t len;
u32 flags;
u64 rx_tstamp;
u64 ack_tstamp;
};

/**
Expand Down
10 changes: 9 additions & 1 deletion net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -18383,7 +18383,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);
Expand Down

0 comments on commit 1ff715f

Please sign in to comment.