OSDN Git Service

ath10k: implement prb tmpl wmi command
authorMichal Kazior <michal.kazior@tieto.com>
Tue, 13 Jan 2015 14:30:11 +0000 (16:30 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 15 Jan 2015 10:30:21 +0000 (12:30 +0200)
New firmware revisions with beacon templates need
probe templates as well because they don't forward
probe requests to host at all.

This is required for new firmware to work with
direct probe requests (notably required by hidden
ssid AP).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/wmi-ops.h
drivers/net/wireless/ath/ath10k/wmi-tlv.c
drivers/net/wireless/ath/ath10k/wmi-tlv.h
drivers/net/wireless/ath/ath10k/wmi.c

index 5469702..7084096 100644 (file)
@@ -133,6 +133,8 @@ struct wmi_ops {
                                        u32 tim_ie_offset, struct sk_buff *bcn,
                                        u32 prb_caps, u32 prb_erp,
                                        void *prb_ies, size_t prb_ies_len);
+       struct sk_buff *(*gen_prb_tmpl)(struct ath10k *ar, u32 vdev_id,
+                                       struct sk_buff *bcn);
 };
 
 int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
@@ -958,4 +960,19 @@ ath10k_wmi_bcn_tmpl(struct ath10k *ar, u32 vdev_id, u32 tim_ie_offset,
        return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->bcn_tmpl_cmdid);
 }
 
+static inline int
+ath10k_wmi_prb_tmpl(struct ath10k *ar, u32 vdev_id, struct sk_buff *prb)
+{
+       struct sk_buff *skb;
+
+       if (!ar->wmi.ops->gen_prb_tmpl)
+               return -EOPNOTSUPP;
+
+       skb = ar->wmi.ops->gen_prb_tmpl(ar, vdev_id, prb);
+       if (IS_ERR(skb))
+               return PTR_ERR(skb);
+
+       return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->prb_tmpl_cmdid);
+}
+
 #endif
index 08a9b2b..29dc094 100644 (file)
@@ -2036,6 +2036,55 @@ ath10k_wmi_tlv_op_gen_bcn_tmpl(struct ath10k *ar, u32 vdev_id,
        return skb;
 }
 
+static struct sk_buff *
+ath10k_wmi_tlv_op_gen_prb_tmpl(struct ath10k *ar, u32 vdev_id,
+                              struct sk_buff *prb)
+{
+       struct wmi_tlv_prb_tmpl_cmd *cmd;
+       struct wmi_tlv_bcn_prb_info *info;
+       struct wmi_tlv *tlv;
+       struct sk_buff *skb;
+       void *ptr;
+       size_t len;
+
+       len = sizeof(*tlv) + sizeof(*cmd) +
+             sizeof(*tlv) + sizeof(*info) +
+             sizeof(*tlv) + roundup(prb->len, 4);
+       skb = ath10k_wmi_alloc_skb(ar, len);
+       if (!skb)
+               return ERR_PTR(-ENOMEM);
+
+       ptr = (void *)skb->data;
+       tlv = ptr;
+       tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PRB_TMPL_CMD);
+       tlv->len = __cpu_to_le16(sizeof(*cmd));
+       cmd = (void *)tlv->value;
+       cmd->vdev_id = __cpu_to_le32(vdev_id);
+       cmd->buf_len = __cpu_to_le32(prb->len);
+
+       ptr += sizeof(*tlv);
+       ptr += sizeof(*cmd);
+
+       tlv = ptr;
+       tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_BCN_PRB_INFO);
+       tlv->len = __cpu_to_le16(sizeof(*info));
+       info = (void *)tlv->value;
+       info->caps = 0;
+       info->erp = 0;
+
+       ptr += sizeof(*tlv);
+       ptr += sizeof(*info);
+
+       tlv = ptr;
+       tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE);
+       tlv->len = __cpu_to_le16(roundup(prb->len, 4));
+       memcpy(tlv->value, prb->data, prb->len);
+
+       ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv prb tmpl vdev_id %i\n",
+                  vdev_id);
+       return skb;
+}
+
 /****************/
 /* TLV mappings */
 /****************/
@@ -2326,6 +2375,7 @@ static const struct wmi_ops wmi_tlv_ops = {
        /* .gen_addba_set_resp not implemented */
        /* .gen_delba_send not implemented */
        .gen_bcn_tmpl = ath10k_wmi_tlv_op_gen_bcn_tmpl,
+       .gen_prb_tmpl = ath10k_wmi_tlv_op_gen_prb_tmpl,
 };
 
 /************/
index c477365..5772519 100644 (file)
@@ -1399,6 +1399,11 @@ struct wmi_tlv_bcn_tmpl_cmd {
        __le32 buf_len;
 } __packed;
 
+struct wmi_tlv_prb_tmpl_cmd {
+       __le32 vdev_id;
+       __le32 buf_len;
+} __packed;
+
 void ath10k_wmi_tlv_attach(struct ath10k *ar);
 
 #endif
index d37a485..bfa3862 100644 (file)
@@ -5039,6 +5039,7 @@ static const struct wmi_ops wmi_ops = {
        .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp,
        .gen_delba_send = ath10k_wmi_op_gen_delba_send,
        /* .gen_bcn_tmpl not implemented */
+       /* .gen_prb_tmpl not implemented */
 };
 
 static const struct wmi_ops wmi_10_1_ops = {
@@ -5098,6 +5099,7 @@ static const struct wmi_ops wmi_10_1_ops = {
        .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp,
        .gen_delba_send = ath10k_wmi_op_gen_delba_send,
        /* .gen_bcn_tmpl not implemented */
+       /* .gen_prb_tmpl not implemented */
 };
 
 static const struct wmi_ops wmi_10_2_ops = {
@@ -5217,6 +5219,7 @@ static const struct wmi_ops wmi_10_2_4_ops = {
        .gen_addba_set_resp = ath10k_wmi_op_gen_addba_set_resp,
        .gen_delba_send = ath10k_wmi_op_gen_delba_send,
        /* .gen_bcn_tmpl not implemented */
+       /* .gen_prb_tmpl not implemented */
 };
 
 int ath10k_wmi_attach(struct ath10k *ar)