Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[linux-2.6.git] / net / wireless / nl80211.c
index 4e78e3f..b15eb77 100644 (file)
@@ -166,7 +166,13 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
 
        [NL80211_ATTR_WIPHY_TX_POWER_SETTING] = { .type = NLA_U32 },
        [NL80211_ATTR_WIPHY_TX_POWER_LEVEL] = { .type = NLA_U32 },
+
        [NL80211_ATTR_FRAME_TYPE] = { .type = NLA_U16 },
+
+       [NL80211_ATTR_WIPHY_ANTENNA_TX] = { .type = NLA_U32 },
+       [NL80211_ATTR_WIPHY_ANTENNA_RX] = { .type = NLA_U32 },
+
+       [NL80211_ATTR_MCAST_RATE] = { .type = NLA_U32 },
 };
 
 /* policy for the key attributes */
@@ -526,7 +532,6 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
                    dev->wiphy.rts_threshold);
        NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS,
                    dev->wiphy.coverage_class);
-
        NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
                   dev->wiphy.max_scan_ssids);
        NLA_PUT_U16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN,
@@ -545,6 +550,16 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
        if (dev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL)
                NLA_PUT_FLAG(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE);
 
+       if (dev->ops->get_antenna) {
+               u32 tx_ant = 0, rx_ant = 0;
+               int res;
+               res = dev->ops->get_antenna(&dev->wiphy, &tx_ant, &rx_ant);
+               if (!res) {
+                       NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_TX, tx_ant);
+                       NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_RX, rx_ant);
+               }
+       }
+
        nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES);
        if (!nl_modes)
                goto nla_put_failure;
@@ -1024,6 +1039,22 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
                        goto bad_res;
        }
 
+       if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
+           info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
+               u32 tx_ant, rx_ant;
+               if (!rdev->ops->set_antenna) {
+                       result = -EOPNOTSUPP;
+                       goto bad_res;
+               }
+
+               tx_ant = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX]);
+               rx_ant = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]);
+
+               result = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
+               if (result)
+                       goto bad_res;
+       }
+
        changed = 0;
 
        if (info->attrs[NL80211_ATTR_WIPHY_RETRY_SHORT]) {
@@ -3652,6 +3683,9 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
                                return -EINVAL;
                }
        }
+       if (info->attrs[NL80211_ATTR_MCAST_RATE])
+               ibss.mcast_rate =
+                       nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]);
 
        if (ibss.privacy && info->attrs[NL80211_ATTR_KEYS]) {
                connkeys = nl80211_parse_connkeys(rdev,