ath10k: make peer type configurable
authorMarek Puzyniak <marek.puzyniak@tieto.com>
Mon, 30 Mar 2015 06:51:52 +0000 (09:51 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Mon, 30 Mar 2015 12:00:33 +0000 (15:00 +0300)
Peer type was hardcoded to default value.
For future implementation it is required
to make is configurable.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Marek Kwaczynski <marek.kwaczynski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/mac.c
drivers/net/wireless/ath/ath10k/wmi-ops.h
drivers/net/wireless/ath/ath10k/wmi-tlv.c
drivers/net/wireless/ath/ath10k/wmi.c
drivers/net/wireless/ath/ath10k/wmi.h

index 7a21aee204f42694945a899c81e2f60b670dc039..e8f95949d2236eab7000344e0e7a2942b6c2488a 100644 (file)
@@ -429,7 +429,8 @@ static u8 ath10k_parse_mpdudensity(u8 mpdudensity)
        }
 }
 
-static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr)
+static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr,
+                             enum wmi_peer_type peer_type)
 {
        int ret;
 
@@ -438,7 +439,7 @@ static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr)
        if (ar->num_peers >= ar->max_num_peers)
                return -ENOBUFS;
 
-       ret = ath10k_wmi_peer_create(ar, vdev_id, addr);
+       ret = ath10k_wmi_peer_create(ar, vdev_id, addr, peer_type);
        if (ret) {
                ath10k_warn(ar, "failed to create wmi peer %pM on vdev %i: %i\n",
                            addr, vdev_id, ret);
@@ -1291,7 +1292,8 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif,
                return;
        }
 
-       ret = ath10k_peer_create(arvif->ar, arvif->vdev_id, self_peer);
+       ret = ath10k_peer_create(arvif->ar, arvif->vdev_id, self_peer,
+                                WMI_PEER_TYPE_DEFAULT);
        if (ret) {
                ath10k_warn(ar, "failed to create IBSS self peer %pM for vdev %d: %d\n",
                            self_peer, arvif->vdev_id, ret);
@@ -2756,7 +2758,8 @@ void ath10k_offchan_tx_work(struct work_struct *work)
                                   peer_addr, vdev_id);
 
                if (!peer) {
-                       ret = ath10k_peer_create(ar, vdev_id, peer_addr);
+                       ret = ath10k_peer_create(ar, vdev_id, peer_addr,
+                                                WMI_PEER_TYPE_DEFAULT);
                        if (ret)
                                ath10k_warn(ar, "failed to create peer %pM on vdev %d: %d\n",
                                            peer_addr, vdev_id, ret);
@@ -3675,7 +3678,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
        }
 
        if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
-               ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr);
+               ret = ath10k_peer_create(ar, arvif->vdev_id, vif->addr,
+                                        WMI_PEER_TYPE_DEFAULT);
                if (ret) {
                        ath10k_warn(ar, "failed to create vdev %i peer for AP: %d\n",
                                    arvif->vdev_id, ret);
@@ -4471,7 +4475,8 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,
                        goto exit;
                }
 
-               ret = ath10k_peer_create(ar, arvif->vdev_id, sta->addr);
+               ret = ath10k_peer_create(ar, arvif->vdev_id, sta->addr,
+                                        WMI_PEER_TYPE_DEFAULT);
                if (ret) {
                        ath10k_warn(ar, "failed to add peer %pM for vdev %d when adding a new sta: %i\n",
                                    sta->addr, arvif->vdev_id, ret);
index 684b632fe75c3d15058712739e20b7ec41f6283d..9a40e992203943e3a826b8632e59c38ba5518bb0 100644 (file)
@@ -85,7 +85,8 @@ struct wmi_ops {
        struct sk_buff *(*gen_vdev_wmm_conf)(struct ath10k *ar, u32 vdev_id,
                                             const struct wmi_wmm_params_all_arg *arg);
        struct sk_buff *(*gen_peer_create)(struct ath10k *ar, u32 vdev_id,
-                                          const u8 peer_addr[ETH_ALEN]);
+                                          const u8 peer_addr[ETH_ALEN],
+                                          enum wmi_peer_type peer_type);
        struct sk_buff *(*gen_peer_delete)(struct ath10k *ar, u32 vdev_id,
                                           const u8 peer_addr[ETH_ALEN]);
        struct sk_buff *(*gen_peer_flush)(struct ath10k *ar, u32 vdev_id,
@@ -661,14 +662,15 @@ ath10k_wmi_vdev_wmm_conf(struct ath10k *ar, u32 vdev_id,
 
 static inline int
 ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id,
-                      const u8 peer_addr[ETH_ALEN])
+                      const u8 peer_addr[ETH_ALEN],
+                      enum wmi_peer_type peer_type)
 {
        struct sk_buff *skb;
 
        if (!ar->wmi.ops->gen_peer_create)
                return -EOPNOTSUPP;
 
-       skb = ar->wmi.ops->gen_peer_create(ar, vdev_id, peer_addr);
+       skb = ar->wmi.ops->gen_peer_create(ar, vdev_id, peer_addr, peer_type);
        if (IS_ERR(skb))
                return PTR_ERR(skb);
 
index afb822caca94566b269f100fbfd2ccb3d3f9d847..02d59cce3b6da44d755498b00453adf705468423 100644 (file)
@@ -1892,7 +1892,8 @@ ath10k_wmi_tlv_op_gen_sta_keepalive(struct ath10k *ar,
 
 static struct sk_buff *
 ath10k_wmi_tlv_op_gen_peer_create(struct ath10k *ar, u32 vdev_id,
-                                 const u8 peer_addr[ETH_ALEN])
+                                 const u8 peer_addr[ETH_ALEN],
+                                 enum wmi_peer_type peer_type)
 {
        struct wmi_tlv_peer_create_cmd *cmd;
        struct wmi_tlv *tlv;
@@ -1907,7 +1908,7 @@ ath10k_wmi_tlv_op_gen_peer_create(struct ath10k *ar, u32 vdev_id,
        tlv->len = __cpu_to_le16(sizeof(*cmd));
        cmd = (void *)tlv->value;
        cmd->vdev_id = __cpu_to_le32(vdev_id);
-       cmd->peer_type = __cpu_to_le32(WMI_TLV_PEER_TYPE_DEFAULT); /* FIXME */
+       cmd->peer_type = __cpu_to_le32(peer_type);
        ether_addr_copy(cmd->peer_addr.addr, peer_addr);
 
        ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv peer create\n");
index a5ed54959a10a11b8d95658b8143df379f53e06d..ae6a038f04abd474b1de629db1eb8fd3fada4a14 100644 (file)
@@ -4522,7 +4522,8 @@ ath10k_wmi_op_gen_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id,
 
 static struct sk_buff *
 ath10k_wmi_op_gen_peer_create(struct ath10k *ar, u32 vdev_id,
-                             const u8 peer_addr[ETH_ALEN])
+                             const u8 peer_addr[ETH_ALEN],
+                             enum wmi_peer_type peer_type)
 {
        struct wmi_peer_create_cmd *cmd;
        struct sk_buff *skb;
index f95b6982af92377fb9f034817981c9dd4d32240b..72ab3dad8ee113b55c058588a7bb188173e6238e 100644 (file)
@@ -4333,6 +4333,12 @@ struct wmi_peer_create_cmd {
        struct wmi_mac_addr peer_macaddr;
 } __packed;
 
+enum wmi_peer_type {
+       WMI_PEER_TYPE_DEFAULT = 0,
+       WMI_PEER_TYPE_BSS = 1,
+       WMI_PEER_TYPE_TDLS = 2,
+};
+
 struct wmi_peer_delete_cmd {
        __le32 vdev_id;
        struct wmi_mac_addr peer_macaddr;