From patchwork Thu Jan 8 11:12:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5592111 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2CD519F443 for ; Thu, 8 Jan 2015 11:18:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 40FEB2037D for ; Thu, 8 Jan 2015 11:17:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 47A4B2035B for ; Thu, 8 Jan 2015 11:17:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y9B66-0007Ys-1C; Thu, 08 Jan 2015 11:17:51 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y9B1o-0003eu-J9 for ath10k@bombadil.infradead.org; Thu, 08 Jan 2015 11:13:24 +0000 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y9B1k-0006Vu-Ux for ath10k@lists.infradead.org; Thu, 08 Jan 2015 11:13:23 +0000 Received: by mail-wi0-f178.google.com with SMTP id em10so2508601wid.5 for ; Thu, 08 Jan 2015 03:12:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hO9/E/qI4X8vkjcgwyEJt4N3FZTIqNQoZiBX8Z5DLsE=; b=f7GZYfNVyaaSY1jnDS22pKpiEb9aGjDUVfrin6VxWvCLRsAXo+5HmbdDko4z1BK1XV pOyBbMkZNMTwPiTXbGfRL2BaVlxJqsrXZXQNsuPPLRdVbhIUsHYqz0Fs1mBsQVITTgQD 35xIAsO+SWB+CGG6CyN8pEPbpXHR1J9kQ60Go= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hO9/E/qI4X8vkjcgwyEJt4N3FZTIqNQoZiBX8Z5DLsE=; b=M3JI9JvbyKGwflcNWfVGzU3tLEBjz3WKm6nts+bFLISSyPqvO4OFmhWjgga2jRwFMs HuAVYAK4Iu/6bp58SEoCES2PX3MKFZxIxw1s4kCQYIU4GanATKSel2zPy9VAwBdw1lYK SMeuKTwi3izs9y8B1EZtxEZGDWAS1GJn1ThRyYbKQmSm7PtqhBShKERy09o0NXCQWn5d 4e941zYx60wycL45Sd/J/wHKqtlzIx2hlV/bQStyQBeaIJNaIN+GjTtcpfEQVf5aGvf9 VbPyUu/SvIh9vp0fH8OMRO742uoALXbcxlyxYPERE7kCwPcAl6LHqJ22smAY+NC5QTbT CdhA== X-Gm-Message-State: ALoCoQmhfjb3WoBE3Ht+FtIOwxpSXIFLL5mIYhkbGG4ul3ew9R4wcM1DKFXsCc+Wx/1EDSgY6kUBQtVIup04SYdXjfFZG84aEcirpSJZ4fK0jqRbS3UCFzNJLsKvo3uoDRkcegXJQI9oHcqgpxb+3j2fzj0yY5wJq3haEfK2F2t8MmpHi3dDzTU= X-Received: by 10.180.74.15 with SMTP id p15mr18544405wiv.29.1420715576161; Thu, 08 Jan 2015 03:12:56 -0800 (PST) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id td6sm6123479wic.15.2015.01.08.03.12.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jan 2015 03:12:55 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH v2 3/5] ath10k: implement prb tmpl wmi command Date: Thu, 8 Jan 2015 12:12:28 +0100 Message-Id: <1420715550-16017-4-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1420715550-16017-1-git-send-email-michal.kazior@tieto.com> References: <1420715550-16017-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150108_061321_130310_B7846FDC X-CRM114-Status: GOOD ( 13.21 ) X-Spam-Score: -2.7 (--) Cc: linux-wireless@vger.kernel.org, Michal Kazior X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/net/wireless/ath/ath10k/wmi-ops.h | 17 +++++++++++ drivers/net/wireless/ath/ath10k/wmi-tlv.c | 50 +++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/wmi-tlv.h | 5 ++++ drivers/net/wireless/ath/ath10k/wmi.c | 3 ++ 4 files changed, 75 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h b/drivers/net/wireless/ath/ath10k/wmi-ops.h index 2ef75ef..148a44a 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-ops.h +++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h @@ -123,6 +123,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); @@ -880,4 +882,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 diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index 11be2d5..1713f8c 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -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 */ /****************/ @@ -2322,6 +2371,7 @@ static const struct wmi_ops wmi_tlv_ops = { /* .gen_pdev_set_quiet_mode not implemented */ /* .gen_pdev_get_temperature not implemented */ .gen_bcn_tmpl = ath10k_wmi_tlv_op_gen_bcn_tmpl, + .gen_prb_tmpl = ath10k_wmi_tlv_op_gen_prb_tmpl, }; /************/ diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h b/drivers/net/wireless/ath/ath10k/wmi-tlv.h index c477365..5772519 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h @@ -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 diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 491c18c..8c46de1 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -4929,6 +4929,7 @@ static const struct wmi_ops wmi_ops = { .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, /* .gen_pdev_get_temperature not implemented */ /* .gen_bcn_tmpl not implemented */ + /* .gen_prb_tmpl not implemented */ }; static const struct wmi_ops wmi_10_1_ops = { @@ -4984,6 +4985,7 @@ static const struct wmi_ops wmi_10_1_ops = { .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable, .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, /* .gen_bcn_tmpl not implemented */ + /* .gen_prb_tmpl not implemented */ }; static const struct wmi_ops wmi_10_2_ops = { @@ -5095,6 +5097,7 @@ static const struct wmi_ops wmi_10_2_4_ops = { .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable, .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, /* .gen_bcn_tmpl not implemented */ + /* .gen_prb_tmpl not implemented */ }; int ath10k_wmi_attach(struct ath10k *ar)