diff options
author | Antonio Quartulli <ordex@autistici.org> | 2012-11-02 08:27:48 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-11-05 09:54:45 -0500 |
commit | f4e583c8935c6f52f9385ee7cfbea8f65c66a737 (patch) | |
tree | 84b709ae313211a2296adce2b4de569a63cbc43a /net/wireless/nl80211.c | |
parent | ba350fbc53b5798104b3fc245bb3c3461a4ef8dc (diff) |
nl/cfg80211: add the NL80211_CMD_SET_MCAST_RATE command
This command triggers a new callback: set_mcast_rate(). It enables
the user to change the rate used to send multicast frames for vif
configured as IBSS or MESH_POINT
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 87d4670ee53a..9b0a3b8fd20a 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -1110,6 +1110,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flag | |||
1110 | goto nla_put_failure; | 1110 | goto nla_put_failure; |
1111 | } | 1111 | } |
1112 | CMD(start_p2p_device, START_P2P_DEVICE); | 1112 | CMD(start_p2p_device, START_P2P_DEVICE); |
1113 | CMD(set_mcast_rate, SET_MCAST_RATE); | ||
1113 | 1114 | ||
1114 | #ifdef CONFIG_NL80211_TESTMODE | 1115 | #ifdef CONFIG_NL80211_TESTMODE |
1115 | CMD(testmode_cmd, TESTMODE); | 1116 | CMD(testmode_cmd, TESTMODE); |
@@ -5448,6 +5449,36 @@ static int nl80211_leave_ibss(struct sk_buff *skb, struct genl_info *info) | |||
5448 | return cfg80211_leave_ibss(rdev, dev, false); | 5449 | return cfg80211_leave_ibss(rdev, dev, false); |
5449 | } | 5450 | } |
5450 | 5451 | ||
5452 | static int nl80211_set_mcast_rate(struct sk_buff *skb, struct genl_info *info) | ||
5453 | { | ||
5454 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | ||
5455 | struct net_device *dev = info->user_ptr[1]; | ||
5456 | int mcast_rate[IEEE80211_NUM_BANDS]; | ||
5457 | u32 nla_rate; | ||
5458 | int err; | ||
5459 | |||
5460 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && | ||
5461 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) | ||
5462 | return -EOPNOTSUPP; | ||
5463 | |||
5464 | if (!rdev->ops->set_mcast_rate) | ||
5465 | return -EOPNOTSUPP; | ||
5466 | |||
5467 | memset(mcast_rate, 0, sizeof(mcast_rate)); | ||
5468 | |||
5469 | if (!info->attrs[NL80211_ATTR_MCAST_RATE]) | ||
5470 | return -EINVAL; | ||
5471 | |||
5472 | nla_rate = nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]); | ||
5473 | if (!nl80211_parse_mcast_rate(rdev, mcast_rate, nla_rate)) | ||
5474 | return -EINVAL; | ||
5475 | |||
5476 | err = rdev->ops->set_mcast_rate(&rdev->wiphy, dev, mcast_rate); | ||
5477 | |||
5478 | return err; | ||
5479 | } | ||
5480 | |||
5481 | |||
5451 | #ifdef CONFIG_NL80211_TESTMODE | 5482 | #ifdef CONFIG_NL80211_TESTMODE |
5452 | static struct genl_multicast_group nl80211_testmode_mcgrp = { | 5483 | static struct genl_multicast_group nl80211_testmode_mcgrp = { |
5453 | .name = "testmode", | 5484 | .name = "testmode", |
@@ -7629,6 +7660,14 @@ static struct genl_ops nl80211_ops[] = { | |||
7629 | .internal_flags = NL80211_FLAG_NEED_WDEV_UP | | 7660 | .internal_flags = NL80211_FLAG_NEED_WDEV_UP | |
7630 | NL80211_FLAG_NEED_RTNL, | 7661 | NL80211_FLAG_NEED_RTNL, |
7631 | }, | 7662 | }, |
7663 | { | ||
7664 | .cmd = NL80211_CMD_SET_MCAST_RATE, | ||
7665 | .doit = nl80211_set_mcast_rate, | ||
7666 | .policy = nl80211_policy, | ||
7667 | .flags = GENL_ADMIN_PERM, | ||
7668 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
7669 | NL80211_FLAG_NEED_RTNL, | ||
7670 | }, | ||
7632 | }; | 7671 | }; |
7633 | 7672 | ||
7634 | static struct genl_multicast_group nl80211_mlme_mcgrp = { | 7673 | static struct genl_multicast_group nl80211_mlme_mcgrp = { |