aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonio Quartulli <ordex@autistici.org>2012-11-02 08:27:48 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-11-05 09:54:45 -0500
commitf4e583c8935c6f52f9385ee7cfbea8f65c66a737 (patch)
tree84b709ae313211a2296adce2b4de569a63cbc43a
parentba350fbc53b5798104b3fc245bb3c3461a4ef8dc (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>
-rw-r--r--include/net/cfg80211.h6
-rw-r--r--include/uapi/linux/nl80211.h5
-rw-r--r--net/wireless/nl80211.c39
3 files changed, 50 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 8034a4268fc..cee791fd4cf 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1545,6 +1545,9 @@ struct cfg80211_gtk_rekey_data {
1545 * to a merge. 1545 * to a merge.
1546 * @leave_ibss: Leave the IBSS. 1546 * @leave_ibss: Leave the IBSS.
1547 * 1547 *
1548 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
1549 * MESH mode)
1550 *
1548 * @set_wiphy_params: Notify that wiphy parameters have changed; 1551 * @set_wiphy_params: Notify that wiphy parameters have changed;
1549 * @changed bitfield (see &enum wiphy_params_flags) describes which values 1552 * @changed bitfield (see &enum wiphy_params_flags) describes which values
1550 * have changed. The actual parameter values are available in 1553 * have changed. The actual parameter values are available in
@@ -1749,6 +1752,9 @@ struct cfg80211_ops {
1749 struct cfg80211_ibss_params *params); 1752 struct cfg80211_ibss_params *params);
1750 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 1753 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
1751 1754
1755 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
1756 int rate[IEEE80211_NUM_BANDS]);
1757
1752 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 1758 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
1753 1759
1754 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, 1760 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 4c5f6748ed7..cbd2d6bb907 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -578,6 +578,9 @@
578 * station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON 578 * station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON
579 * is used for this. 579 * is used for this.
580 * 580 *
581 * @NL80211_CMD_SET_MCAST_RATE: Change the rate used to send multicast frames
582 * for IBSS or MESH vif.
583 *
581 * @NL80211_CMD_MAX: highest used command number 584 * @NL80211_CMD_MAX: highest used command number
582 * @__NL80211_CMD_AFTER_LAST: internal use 585 * @__NL80211_CMD_AFTER_LAST: internal use
583 */ 586 */
@@ -726,6 +729,8 @@ enum nl80211_commands {
726 729
727 NL80211_CMD_CONN_FAILED, 730 NL80211_CMD_CONN_FAILED,
728 731
732 NL80211_CMD_SET_MCAST_RATE,
733
729 /* add new commands above here */ 734 /* add new commands above here */
730 735
731 /* used to define NL80211_CMD_MAX below */ 736 /* used to define NL80211_CMD_MAX below */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 87d4670ee53..9b0a3b8fd20 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
5452static 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
5452static struct genl_multicast_group nl80211_testmode_mcgrp = { 5483static 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
7634static struct genl_multicast_group nl80211_mlme_mcgrp = { 7673static struct genl_multicast_group nl80211_mlme_mcgrp = {