diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/wmi-tlv.c')
-rw-r--r-- | drivers/net/wireless/ath/ath10k/wmi-tlv.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index 67138a69bb42..08a9b2b35d06 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c | |||
@@ -1972,6 +1972,70 @@ ath10k_wmi_tlv_op_gen_pktlog_disable(struct ath10k *ar) | |||
1972 | return skb; | 1972 | return skb; |
1973 | } | 1973 | } |
1974 | 1974 | ||
1975 | static struct sk_buff * | ||
1976 | ath10k_wmi_tlv_op_gen_bcn_tmpl(struct ath10k *ar, u32 vdev_id, | ||
1977 | u32 tim_ie_offset, struct sk_buff *bcn, | ||
1978 | u32 prb_caps, u32 prb_erp, void *prb_ies, | ||
1979 | size_t prb_ies_len) | ||
1980 | { | ||
1981 | struct wmi_tlv_bcn_tmpl_cmd *cmd; | ||
1982 | struct wmi_tlv_bcn_prb_info *info; | ||
1983 | struct wmi_tlv *tlv; | ||
1984 | struct sk_buff *skb; | ||
1985 | void *ptr; | ||
1986 | size_t len; | ||
1987 | |||
1988 | if (WARN_ON(prb_ies_len > 0 && !prb_ies)) | ||
1989 | return ERR_PTR(-EINVAL); | ||
1990 | |||
1991 | len = sizeof(*tlv) + sizeof(*cmd) + | ||
1992 | sizeof(*tlv) + sizeof(*info) + prb_ies_len + | ||
1993 | sizeof(*tlv) + roundup(bcn->len, 4); | ||
1994 | skb = ath10k_wmi_alloc_skb(ar, len); | ||
1995 | if (!skb) | ||
1996 | return ERR_PTR(-ENOMEM); | ||
1997 | |||
1998 | ptr = (void *)skb->data; | ||
1999 | tlv = ptr; | ||
2000 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_BCN_TMPL_CMD); | ||
2001 | tlv->len = __cpu_to_le16(sizeof(*cmd)); | ||
2002 | cmd = (void *)tlv->value; | ||
2003 | cmd->vdev_id = __cpu_to_le32(vdev_id); | ||
2004 | cmd->tim_ie_offset = __cpu_to_le32(tim_ie_offset); | ||
2005 | cmd->buf_len = __cpu_to_le32(bcn->len); | ||
2006 | |||
2007 | ptr += sizeof(*tlv); | ||
2008 | ptr += sizeof(*cmd); | ||
2009 | |||
2010 | /* FIXME: prb_ies_len should be probably aligned to 4byte boundary but | ||
2011 | * then it is then impossible to pass original ie len. | ||
2012 | * This chunk is not used yet so if setting probe resp template yields | ||
2013 | * problems with beaconing or crashes firmware look here. | ||
2014 | */ | ||
2015 | tlv = ptr; | ||
2016 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_BCN_PRB_INFO); | ||
2017 | tlv->len = __cpu_to_le16(sizeof(*info) + prb_ies_len); | ||
2018 | info = (void *)tlv->value; | ||
2019 | info->caps = __cpu_to_le32(prb_caps); | ||
2020 | info->erp = __cpu_to_le32(prb_erp); | ||
2021 | memcpy(info->ies, prb_ies, prb_ies_len); | ||
2022 | |||
2023 | ptr += sizeof(*tlv); | ||
2024 | ptr += sizeof(*info); | ||
2025 | ptr += prb_ies_len; | ||
2026 | |||
2027 | tlv = ptr; | ||
2028 | tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE); | ||
2029 | tlv->len = __cpu_to_le16(roundup(bcn->len, 4)); | ||
2030 | memcpy(tlv->value, bcn->data, bcn->len); | ||
2031 | |||
2032 | /* FIXME: Adjust TSF? */ | ||
2033 | |||
2034 | ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv bcn tmpl vdev_id %i\n", | ||
2035 | vdev_id); | ||
2036 | return skb; | ||
2037 | } | ||
2038 | |||
1975 | /****************/ | 2039 | /****************/ |
1976 | /* TLV mappings */ | 2040 | /* TLV mappings */ |
1977 | /****************/ | 2041 | /****************/ |
@@ -2261,6 +2325,7 @@ static const struct wmi_ops wmi_tlv_ops = { | |||
2261 | /* .gen_addba_send not implemented */ | 2325 | /* .gen_addba_send not implemented */ |
2262 | /* .gen_addba_set_resp not implemented */ | 2326 | /* .gen_addba_set_resp not implemented */ |
2263 | /* .gen_delba_send not implemented */ | 2327 | /* .gen_delba_send not implemented */ |
2328 | .gen_bcn_tmpl = ath10k_wmi_tlv_op_gen_bcn_tmpl, | ||
2264 | }; | 2329 | }; |
2265 | 2330 | ||
2266 | /************/ | 2331 | /************/ |