Skip to content

Commit 7406353

Browse files
ordexjmberg-intel
authored andcommitted
cfg80211: implement cfg80211_get_station cfg80211 API
Implement and export the new cfg80211_get_station() API. This utility can be used by other kernel modules to obtain detailed information about a given wireless station. It will be in particular useful to batman-adv which will implement a wireless rate based metric. Signed-off-by: Antonio Quartulli <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent cca674d commit 7406353

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

include/net/cfg80211.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,19 @@ struct station_info {
10741074
*/
10751075
};
10761076

1077+
/**
1078+
* cfg80211_get_station - retrieve information about a given station
1079+
* @dev: the device where the station is supposed to be connected to
1080+
* @mac_addr: the mac address of the station of interest
1081+
* @sinfo: pointer to the structure to fill with the information
1082+
*
1083+
* Returns 0 on success and sinfo is filled with the available information
1084+
* otherwise returns a negative error code and the content of sinfo has to be
1085+
* considered undefined.
1086+
*/
1087+
int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1088+
struct station_info *sinfo);
1089+
10771090
/**
10781091
* enum monitor_flags - monitor flags
10791092
*

net/wireless/rdev-ops.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static inline int rdev_change_station(struct cfg80211_registered_device *rdev,
199199
}
200200

201201
static inline int rdev_get_station(struct cfg80211_registered_device *rdev,
202-
struct net_device *dev, u8 *mac,
202+
struct net_device *dev, const u8 *mac,
203203
struct station_info *sinfo)
204204
{
205205
int ret;

net/wireless/util.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,24 @@ unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy)
15461546
}
15471547
EXPORT_SYMBOL(ieee80211_get_num_supported_channels);
15481548

1549+
int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1550+
struct station_info *sinfo)
1551+
{
1552+
struct cfg80211_registered_device *rdev;
1553+
struct wireless_dev *wdev;
1554+
1555+
wdev = dev->ieee80211_ptr;
1556+
if (!wdev)
1557+
return -EOPNOTSUPP;
1558+
1559+
rdev = wiphy_to_rdev(wdev->wiphy);
1560+
if (!rdev->ops->get_station)
1561+
return -EOPNOTSUPP;
1562+
1563+
return rdev_get_station(rdev, dev, mac_addr, sinfo);
1564+
}
1565+
EXPORT_SYMBOL(cfg80211_get_station);
1566+
15491567
/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
15501568
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
15511569
const unsigned char rfc1042_header[] __aligned(2) =

0 commit comments

Comments
 (0)