mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
This commit is contained in:
commit
c64557d666
151 changed files with 5272 additions and 6383 deletions
|
|
@ -178,10 +178,26 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
|
|||
char *newname)
|
||||
{
|
||||
struct cfg80211_registered_device *rdev2;
|
||||
int result;
|
||||
int wiphy_idx, taken = -1, result, digits;
|
||||
|
||||
assert_cfg80211_lock();
|
||||
|
||||
/* prohibit calling the thing phy%d when %d is not its number */
|
||||
sscanf(newname, PHY_NAME "%d%n", &wiphy_idx, &taken);
|
||||
if (taken == strlen(newname) && wiphy_idx != rdev->wiphy_idx) {
|
||||
/* count number of places needed to print wiphy_idx */
|
||||
digits = 1;
|
||||
while (wiphy_idx /= 10)
|
||||
digits++;
|
||||
/*
|
||||
* deny the name if it is phy<idx> where <idx> is printed
|
||||
* without leading zeroes. taken == strlen(newname) here
|
||||
*/
|
||||
if (taken == strlen(PHY_NAME) + digits)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
/* Ignore nop renames */
|
||||
if (strcmp(newname, dev_name(&rdev->wiphy.dev)) == 0)
|
||||
return 0;
|
||||
|
|
@ -189,7 +205,7 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
|
|||
/* Ensure another device does not already have this name. */
|
||||
list_for_each_entry(rdev2, &cfg80211_rdev_list, list)
|
||||
if (strcmp(newname, dev_name(&rdev2->wiphy.dev)) == 0)
|
||||
return -EEXIST;
|
||||
return -EINVAL;
|
||||
|
||||
result = device_rename(&rdev->wiphy.dev, newname);
|
||||
if (result)
|
||||
|
|
@ -304,11 +320,9 @@ static void cfg80211_event_work(struct work_struct *work)
|
|||
struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
|
||||
{
|
||||
static int wiphy_counter;
|
||||
int i;
|
||||
struct cfg80211_registered_device *rdev, *rdev2;
|
||||
|
||||
struct cfg80211_registered_device *rdev;
|
||||
int alloc_size;
|
||||
char nname[IFNAMSIZ + 1];
|
||||
bool found = false;
|
||||
|
||||
WARN_ON(ops->add_key && (!ops->del_key || !ops->set_default_key));
|
||||
WARN_ON(ops->auth && (!ops->assoc || !ops->deauth || !ops->disassoc));
|
||||
|
|
@ -332,37 +346,17 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
|
|||
|
||||
if (unlikely(!wiphy_idx_valid(rdev->wiphy_idx))) {
|
||||
wiphy_counter--;
|
||||
goto too_many_devs;
|
||||
}
|
||||
|
||||
/* 64k wiphy devices is enough for anyone! */
|
||||
for (i = 0; i < 0xFFFF; i++) {
|
||||
found = false;
|
||||
snprintf(nname, sizeof(nname)-1, PHY_NAME "%d", i);
|
||||
nname[sizeof(nname)-1] = 0;
|
||||
list_for_each_entry(rdev2, &cfg80211_rdev_list, list)
|
||||
if (strcmp(nname, dev_name(&rdev2->wiphy.dev)) == 0) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
break;
|
||||
}
|
||||
|
||||
if (unlikely(found)) {
|
||||
too_many_devs:
|
||||
mutex_unlock(&cfg80211_mutex);
|
||||
/* ugh, too many devices already! */
|
||||
/* ugh, wrapped! */
|
||||
kfree(rdev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* give it a proper name */
|
||||
dev_set_name(&rdev->wiphy.dev, "%s", nname);
|
||||
|
||||
mutex_unlock(&cfg80211_mutex);
|
||||
|
||||
/* give it a proper name */
|
||||
dev_set_name(&rdev->wiphy.dev, PHY_NAME "%d", rdev->wiphy_idx);
|
||||
|
||||
mutex_init(&rdev->mtx);
|
||||
mutex_init(&rdev->devlist_mtx);
|
||||
INIT_LIST_HEAD(&rdev->netdev_list);
|
||||
|
|
|
|||
|
|
@ -764,6 +764,8 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
|
|||
u16 frame_type, const u8 *match_data,
|
||||
int match_len)
|
||||
{
|
||||
struct wiphy *wiphy = wdev->wiphy;
|
||||
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
|
||||
struct cfg80211_mgmt_registration *reg, *nreg;
|
||||
int err = 0;
|
||||
u16 mgmt_type;
|
||||
|
|
@ -810,22 +812,37 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
|
|||
nreg->frame_type = cpu_to_le16(frame_type);
|
||||
list_add(&nreg->list, &wdev->mgmt_registrations);
|
||||
|
||||
if (rdev->ops->mgmt_frame_register)
|
||||
rdev->ops->mgmt_frame_register(wiphy, wdev->netdev,
|
||||
frame_type, true);
|
||||
|
||||
out:
|
||||
spin_unlock_bh(&wdev->mgmt_registrations_lock);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid)
|
||||
{
|
||||
struct wiphy *wiphy = wdev->wiphy;
|
||||
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
|
||||
struct cfg80211_mgmt_registration *reg, *tmp;
|
||||
|
||||
spin_lock_bh(&wdev->mgmt_registrations_lock);
|
||||
|
||||
list_for_each_entry_safe(reg, tmp, &wdev->mgmt_registrations, list) {
|
||||
if (reg->nlpid == nlpid) {
|
||||
list_del(®->list);
|
||||
kfree(reg);
|
||||
if (reg->nlpid != nlpid)
|
||||
continue;
|
||||
|
||||
if (rdev->ops->mgmt_frame_register) {
|
||||
u16 frame_type = le16_to_cpu(reg->frame_type);
|
||||
|
||||
rdev->ops->mgmt_frame_register(wiphy, wdev->netdev,
|
||||
frame_type, false);
|
||||
}
|
||||
|
||||
list_del(®->list);
|
||||
kfree(reg);
|
||||
}
|
||||
|
||||
spin_unlock_bh(&wdev->mgmt_registrations_lock);
|
||||
|
|
|
|||
|
|
@ -3153,6 +3153,21 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 pid, u32 seq,
|
|||
survey->noise);
|
||||
if (survey->filled & SURVEY_INFO_IN_USE)
|
||||
NLA_PUT_FLAG(msg, NL80211_SURVEY_INFO_IN_USE);
|
||||
if (survey->filled & SURVEY_INFO_CHANNEL_TIME)
|
||||
NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME,
|
||||
survey->channel_time);
|
||||
if (survey->filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
|
||||
NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY,
|
||||
survey->channel_time_busy);
|
||||
if (survey->filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
|
||||
NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY,
|
||||
survey->channel_time_ext_busy);
|
||||
if (survey->filled & SURVEY_INFO_CHANNEL_TIME_RX)
|
||||
NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_RX,
|
||||
survey->channel_time_rx);
|
||||
if (survey->filled & SURVEY_INFO_CHANNEL_TIME_TX)
|
||||
NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_TX,
|
||||
survey->channel_time_tx);
|
||||
|
||||
nla_nest_end(msg, infoattr);
|
||||
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ int ieee80211_radiotap_iterator_next(
|
|||
{
|
||||
while (1) {
|
||||
int hit = 0;
|
||||
int pad, align, size, subns, vnslen;
|
||||
int pad, align, size, subns;
|
||||
uint32_t oui;
|
||||
|
||||
/* if no more EXT bits, that's it */
|
||||
|
|
@ -261,6 +261,27 @@ int ieee80211_radiotap_iterator_next(
|
|||
if (pad)
|
||||
iterator->_arg += align - pad;
|
||||
|
||||
if (iterator->_arg_index % 32 == IEEE80211_RADIOTAP_VENDOR_NAMESPACE) {
|
||||
int vnslen;
|
||||
|
||||
if ((unsigned long)iterator->_arg + size -
|
||||
(unsigned long)iterator->_rtheader >
|
||||
(unsigned long)iterator->_max_length)
|
||||
return -EINVAL;
|
||||
|
||||
oui = (*iterator->_arg << 16) |
|
||||
(*(iterator->_arg + 1) << 8) |
|
||||
*(iterator->_arg + 2);
|
||||
subns = *(iterator->_arg + 3);
|
||||
|
||||
find_ns(iterator, oui, subns);
|
||||
|
||||
vnslen = get_unaligned_le16(iterator->_arg + 4);
|
||||
iterator->_next_ns_data = iterator->_arg + size + vnslen;
|
||||
if (!iterator->current_namespace)
|
||||
size += vnslen;
|
||||
}
|
||||
|
||||
/*
|
||||
* this is what we will return to user, but we need to
|
||||
* move on first so next call has something fresh to test
|
||||
|
|
@ -287,40 +308,25 @@ int ieee80211_radiotap_iterator_next(
|
|||
/* these special ones are valid in each bitmap word */
|
||||
switch (iterator->_arg_index % 32) {
|
||||
case IEEE80211_RADIOTAP_VENDOR_NAMESPACE:
|
||||
iterator->_bitmap_shifter >>= 1;
|
||||
iterator->_arg_index++;
|
||||
|
||||
iterator->_reset_on_ext = 1;
|
||||
|
||||
vnslen = get_unaligned_le16(iterator->this_arg + 4);
|
||||
iterator->_next_ns_data = iterator->_arg + vnslen;
|
||||
oui = (*iterator->this_arg << 16) |
|
||||
(*(iterator->this_arg + 1) << 8) |
|
||||
*(iterator->this_arg + 2);
|
||||
subns = *(iterator->this_arg + 3);
|
||||
|
||||
find_ns(iterator, oui, subns);
|
||||
|
||||
iterator->is_radiotap_ns = 0;
|
||||
/* allow parsers to show this information */
|
||||
/*
|
||||
* If parser didn't register this vendor
|
||||
* namespace with us, allow it to show it
|
||||
* as 'raw. Do do that, set argument index
|
||||
* to vendor namespace.
|
||||
*/
|
||||
iterator->this_arg_index =
|
||||
IEEE80211_RADIOTAP_VENDOR_NAMESPACE;
|
||||
iterator->this_arg_size += vnslen;
|
||||
if ((unsigned long)iterator->this_arg +
|
||||
iterator->this_arg_size -
|
||||
(unsigned long)iterator->_rtheader >
|
||||
(unsigned long)(unsigned long)iterator->_max_length)
|
||||
return -EINVAL;
|
||||
hit = 1;
|
||||
break;
|
||||
if (!iterator->current_namespace)
|
||||
hit = 1;
|
||||
goto next_entry;
|
||||
case IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE:
|
||||
iterator->_bitmap_shifter >>= 1;
|
||||
iterator->_arg_index++;
|
||||
|
||||
iterator->_reset_on_ext = 1;
|
||||
iterator->current_namespace = &radiotap_ns;
|
||||
iterator->is_radiotap_ns = 1;
|
||||
break;
|
||||
goto next_entry;
|
||||
case IEEE80211_RADIOTAP_EXT:
|
||||
/*
|
||||
* bit 31 was set, there is more
|
||||
|
|
|
|||
|
|
@ -35,6 +35,14 @@ SHOW_FMT(index, "%d", wiphy_idx);
|
|||
SHOW_FMT(macaddress, "%pM", wiphy.perm_addr);
|
||||
SHOW_FMT(address_mask, "%pM", wiphy.addr_mask);
|
||||
|
||||
static ssize_t name_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf) {
|
||||
struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy;
|
||||
return sprintf(buf, "%s\n", dev_name(&wiphy->dev));
|
||||
}
|
||||
|
||||
|
||||
static ssize_t addresses_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
|
|
@ -57,6 +65,7 @@ static struct device_attribute ieee80211_dev_attrs[] = {
|
|||
__ATTR_RO(macaddress),
|
||||
__ATTR_RO(address_mask),
|
||||
__ATTR_RO(addresses),
|
||||
__ATTR_RO(name),
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1366,6 +1366,10 @@ struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
|
|||
}
|
||||
|
||||
wstats.qual.updated |= IW_QUAL_NOISE_INVALID;
|
||||
if (sinfo.filled & STATION_INFO_RX_DROP_MISC)
|
||||
wstats.discard.misc = sinfo.rx_dropped_misc;
|
||||
if (sinfo.filled & STATION_INFO_TX_FAILED)
|
||||
wstats.discard.retries = sinfo.tx_failed;
|
||||
|
||||
return &wstats;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue