]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: add set_mcast_rate command support
authorAntonio Quartulli <ordex@autistici.org>
Wed, 7 Nov 2012 09:58:03 +0000 (10:58 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 19 Nov 2012 14:41:15 +0000 (15:41 +0100)
This patch adds the support to run the set_mcast_rate() command on
adhoc and mesh_point vifs. With this command it is possible to tune
the bitrate to use when sending group frames. This command can be used
even if the vifs has already joint the ibss/mesh network.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
interface.c

index 28626dc49a6abe5c498572cf07099bc418ad2afa..5a7647a9c7f019f39a9f13ae69929e3018badfa8 100644 (file)
@@ -499,3 +499,32 @@ static int handle_interface_wds_peer(struct nl80211_state *state,
 COMMAND(set, peer, "<MAC address>",
        NL80211_CMD_SET_WDS_PEER, 0, CIB_NETDEV, handle_interface_wds_peer,
        "Set interface WDS peer.");
+
+static int set_mcast_rate(struct nl80211_state *state,
+                         struct nl_cb *cb,
+                         struct nl_msg *msg,
+                         int argc, char **argv,
+                         enum id_input id)
+{
+       float rate;
+       char *end;
+
+       if (argc != 1) {
+               printf("Invalid parameters!\n");
+               return 2;
+       }
+
+       rate = strtod(argv[0], &end);
+       if (*end != '\0')
+               return 1;
+
+       NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, (int)(rate * 10));
+
+       return 0;
+nla_put_failure:
+       return -ENOBUFS;
+}
+
+COMMAND(set, mcast_rate, "<rate in Mbps>",
+       NL80211_CMD_SET_MCAST_RATE, 0, CIB_NETDEV, set_mcast_rate,
+       "Set the multicast bitrate.");