cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

util.h (1239B)


      1/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
      2/* Copyright(c) 2018-2019  Realtek Corporation
      3 */
      4
      5#ifndef __RTW_UTIL_H__
      6#define __RTW_UTIL_H__
      7
      8struct rtw_dev;
      9
     10#define rtw_iterate_vifs(rtwdev, iterator, data)                               \
     11	ieee80211_iterate_active_interfaces(rtwdev->hw,                        \
     12			IEEE80211_IFACE_ITER_NORMAL, iterator, data)
     13#define rtw_iterate_vifs_atomic(rtwdev, iterator, data)                        \
     14	ieee80211_iterate_active_interfaces_atomic(rtwdev->hw,                 \
     15			IEEE80211_IFACE_ITER_NORMAL, iterator, data)
     16#define rtw_iterate_stas_atomic(rtwdev, iterator, data)                        \
     17	ieee80211_iterate_stations_atomic(rtwdev->hw, iterator, data)
     18#define rtw_iterate_keys(rtwdev, vif, iterator, data)			       \
     19	ieee80211_iter_keys(rtwdev->hw, vif, iterator, data)
     20#define rtw_iterate_keys_rcu(rtwdev, vif, iterator, data)		       \
     21	ieee80211_iter_keys_rcu((rtwdev)->hw, vif, iterator, data)
     22
     23static inline u8 *get_hdr_bssid(struct ieee80211_hdr *hdr)
     24{
     25	__le16 fc = hdr->frame_control;
     26	u8 *bssid;
     27
     28	if (ieee80211_has_tods(fc))
     29		bssid = hdr->addr1;
     30	else if (ieee80211_has_fromds(fc))
     31		bssid = hdr->addr2;
     32	else
     33		bssid = hdr->addr3;
     34
     35	return bssid;
     36}
     37
     38#endif