diff options
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index f7cb12178bd2..c2a40a2e56bd 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -7562,14 +7562,12 @@ static int nl80211_set_cqm_txe(struct genl_info *info, | |||
7562 | u32 rate, u32 pkts, u32 intvl) | 7562 | u32 rate, u32 pkts, u32 intvl) |
7563 | { | 7563 | { |
7564 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 7564 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
7565 | struct wireless_dev *wdev; | ||
7566 | struct net_device *dev = info->user_ptr[1]; | 7565 | struct net_device *dev = info->user_ptr[1]; |
7566 | struct wireless_dev *wdev = dev->ieee80211_ptr; | ||
7567 | 7567 | ||
7568 | if (rate > 100 || intvl > NL80211_CQM_TXE_MAX_INTVL) | 7568 | if (rate > 100 || intvl > NL80211_CQM_TXE_MAX_INTVL) |
7569 | return -EINVAL; | 7569 | return -EINVAL; |
7570 | 7570 | ||
7571 | wdev = dev->ieee80211_ptr; | ||
7572 | |||
7573 | if (!rdev->ops->set_cqm_txe_config) | 7571 | if (!rdev->ops->set_cqm_txe_config) |
7574 | return -EOPNOTSUPP; | 7572 | return -EOPNOTSUPP; |
7575 | 7573 | ||
@@ -7584,13 +7582,15 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, | |||
7584 | s32 threshold, u32 hysteresis) | 7582 | s32 threshold, u32 hysteresis) |
7585 | { | 7583 | { |
7586 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 7584 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
7587 | struct wireless_dev *wdev; | ||
7588 | struct net_device *dev = info->user_ptr[1]; | 7585 | struct net_device *dev = info->user_ptr[1]; |
7586 | struct wireless_dev *wdev = dev->ieee80211_ptr; | ||
7589 | 7587 | ||
7590 | if (threshold > 0) | 7588 | if (threshold > 0) |
7591 | return -EINVAL; | 7589 | return -EINVAL; |
7592 | 7590 | ||
7593 | wdev = dev->ieee80211_ptr; | 7591 | /* disabling - hysteresis should also be zero then */ |
7592 | if (threshold == 0) | ||
7593 | hysteresis = 0; | ||
7594 | 7594 | ||
7595 | if (!rdev->ops->set_cqm_rssi_config) | 7595 | if (!rdev->ops->set_cqm_rssi_config) |
7596 | return -EOPNOTSUPP; | 7596 | return -EOPNOTSUPP; |
@@ -7609,36 +7609,33 @@ static int nl80211_set_cqm(struct sk_buff *skb, struct genl_info *info) | |||
7609 | int err; | 7609 | int err; |
7610 | 7610 | ||
7611 | cqm = info->attrs[NL80211_ATTR_CQM]; | 7611 | cqm = info->attrs[NL80211_ATTR_CQM]; |
7612 | if (!cqm) { | 7612 | if (!cqm) |
7613 | err = -EINVAL; | 7613 | return -EINVAL; |
7614 | goto out; | ||
7615 | } | ||
7616 | 7614 | ||
7617 | err = nla_parse_nested(attrs, NL80211_ATTR_CQM_MAX, cqm, | 7615 | err = nla_parse_nested(attrs, NL80211_ATTR_CQM_MAX, cqm, |
7618 | nl80211_attr_cqm_policy); | 7616 | nl80211_attr_cqm_policy); |
7619 | if (err) | 7617 | if (err) |
7620 | goto out; | 7618 | return err; |
7621 | 7619 | ||
7622 | if (attrs[NL80211_ATTR_CQM_RSSI_THOLD] && | 7620 | if (attrs[NL80211_ATTR_CQM_RSSI_THOLD] && |
7623 | attrs[NL80211_ATTR_CQM_RSSI_HYST]) { | 7621 | attrs[NL80211_ATTR_CQM_RSSI_HYST]) { |
7624 | s32 threshold; | 7622 | s32 threshold = nla_get_s32(attrs[NL80211_ATTR_CQM_RSSI_THOLD]); |
7625 | u32 hysteresis; | 7623 | u32 hysteresis = nla_get_u32(attrs[NL80211_ATTR_CQM_RSSI_HYST]); |
7626 | threshold = nla_get_u32(attrs[NL80211_ATTR_CQM_RSSI_THOLD]); | ||
7627 | hysteresis = nla_get_u32(attrs[NL80211_ATTR_CQM_RSSI_HYST]); | ||
7628 | err = nl80211_set_cqm_rssi(info, threshold, hysteresis); | ||
7629 | } else if (attrs[NL80211_ATTR_CQM_TXE_RATE] && | ||
7630 | attrs[NL80211_ATTR_CQM_TXE_PKTS] && | ||
7631 | attrs[NL80211_ATTR_CQM_TXE_INTVL]) { | ||
7632 | u32 rate, pkts, intvl; | ||
7633 | rate = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_RATE]); | ||
7634 | pkts = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_PKTS]); | ||
7635 | intvl = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_INTVL]); | ||
7636 | err = nl80211_set_cqm_txe(info, rate, pkts, intvl); | ||
7637 | } else | ||
7638 | err = -EINVAL; | ||
7639 | 7624 | ||
7640 | out: | 7625 | return nl80211_set_cqm_rssi(info, threshold, hysteresis); |
7641 | return err; | 7626 | } |
7627 | |||
7628 | if (attrs[NL80211_ATTR_CQM_TXE_RATE] && | ||
7629 | attrs[NL80211_ATTR_CQM_TXE_PKTS] && | ||
7630 | attrs[NL80211_ATTR_CQM_TXE_INTVL]) { | ||
7631 | u32 rate = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_RATE]); | ||
7632 | u32 pkts = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_PKTS]); | ||
7633 | u32 intvl = nla_get_u32(attrs[NL80211_ATTR_CQM_TXE_INTVL]); | ||
7634 | |||
7635 | return nl80211_set_cqm_txe(info, rate, pkts, intvl); | ||
7636 | } | ||
7637 | |||
7638 | return -EINVAL; | ||
7642 | } | 7639 | } |
7643 | 7640 | ||
7644 | static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) | 7641 | static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) |