aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonio Quartulli <antonio@open-mesh.com>2014-05-19 15:53:21 -0400
committerJohannes Berg <johannes.berg@intel.com>2014-05-21 03:15:17 -0400
commit7406353d43c8e2faf478721e87aeb6f2f9685de0 (patch)
tree18a40be271902692ba38d8d93f71a3f85848fc60
parentcca674d47e59665630f3005291b61bb883015fc5 (diff)
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 <antonio@open-mesh.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/net/cfg80211.h13
-rw-r--r--net/wireless/rdev-ops.h2
-rw-r--r--net/wireless/util.c18
3 files changed, 32 insertions, 1 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 857d6476a128..a75fabd18502 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1075,6 +1075,19 @@ struct station_info {
1075}; 1075};
1076 1076
1077/** 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 */
1087int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1088 struct station_info *sinfo);
1089
1090/**
1078 * enum monitor_flags - monitor flags 1091 * enum monitor_flags - monitor flags
1079 * 1092 *
1080 * Monitor interface configuration flags. Note that these must be the bits 1093 * Monitor interface configuration flags. Note that these must be the bits
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 00cdf73ba6c4..d95bbe348138 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -199,7 +199,7 @@ static inline int rdev_change_station(struct cfg80211_registered_device *rdev,
199} 199}
200 200
201static inline int rdev_get_station(struct cfg80211_registered_device *rdev, 201static 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,
203 struct station_info *sinfo) 203 struct station_info *sinfo)
204{ 204{
205 int ret; 205 int ret;
diff --git a/net/wireless/util.c b/net/wireless/util.c
index fa61ac9c9b26..728f1c0dc70d 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1546,6 +1546,24 @@ unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy)
1546} 1546}
1547EXPORT_SYMBOL(ieee80211_get_num_supported_channels); 1547EXPORT_SYMBOL(ieee80211_get_num_supported_channels);
1548 1548
1549int 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}
1565EXPORT_SYMBOL(cfg80211_get_station);
1566
1549/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ 1567/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
1550/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ 1568/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
1551const unsigned char rfc1042_header[] __aligned(2) = 1569const unsigned char rfc1042_header[] __aligned(2) =