Skip to content

Commit

Permalink
cfg80211: implement cfg80211_get_station cfg80211 API
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ordex authored and jmberg-intel committed May 21, 2014
1 parent cca674d commit 7406353
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
13 changes: 13 additions & 0 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,19 @@ struct station_info {
*/
};

/**
* cfg80211_get_station - retrieve information about a given station
* @dev: the device where the station is supposed to be connected to
* @mac_addr: the mac address of the station of interest
* @sinfo: pointer to the structure to fill with the information
*
* Returns 0 on success and sinfo is filled with the available information
* otherwise returns a negative error code and the content of sinfo has to be
* considered undefined.
*/
int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
struct station_info *sinfo);

/**
* enum monitor_flags - monitor flags
*
Expand Down
2 changes: 1 addition & 1 deletion net/wireless/rdev-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ static inline int rdev_change_station(struct cfg80211_registered_device *rdev,
}

static inline int rdev_get_station(struct cfg80211_registered_device *rdev,
struct net_device *dev, u8 *mac,
struct net_device *dev, const u8 *mac,
struct station_info *sinfo)
{
int ret;
Expand Down
18 changes: 18 additions & 0 deletions net/wireless/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,24 @@ unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy)
}
EXPORT_SYMBOL(ieee80211_get_num_supported_channels);

int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
struct station_info *sinfo)
{
struct cfg80211_registered_device *rdev;
struct wireless_dev *wdev;

wdev = dev->ieee80211_ptr;
if (!wdev)
return -EOPNOTSUPP;

rdev = wiphy_to_rdev(wdev->wiphy);
if (!rdev->ops->get_station)
return -EOPNOTSUPP;

return rdev_get_station(rdev, dev, mac_addr, sinfo);
}
EXPORT_SYMBOL(cfg80211_get_station);

/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
const unsigned char rfc1042_header[] __aligned(2) =
Expand Down

0 comments on commit 7406353

Please sign in to comment.