From patchwork Thu Jan 8 11:12:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5592191 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 A663D9F357 for ; Thu, 8 Jan 2015 11:24:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B84442037F for ; Thu, 8 Jan 2015 11:24:23 +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 664922037D for ; Thu, 8 Jan 2015 11:24:22 +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 1Y9BCK-0004CG-Ur; Thu, 08 Jan 2015 11:24:17 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y9BCH-0004B7-Cp for ath10k@bombadil.infradead.org; Thu, 08 Jan 2015 11:24:13 +0000 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y9B1k-00008A-Bh for ath10k@lists.infradead.org; Thu, 08 Jan 2015 11:13:21 +0000 Received: by mail-wi0-f170.google.com with SMTP id bs8so2347038wib.1 for ; Thu, 08 Jan 2015 03:12:57 -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=lQIAY2b3wOi2kWXurUH9Lyi46LIoZYDgEMKfYHf1fhQ=; b=f8eFAiMLFPIfVWjURBj+rTvvPznVqq+keFewNy1Wwcs4WK7K4rmXb3lVrMyzHHB+kl ZN8zPl/4kPjVHGJ/NbL5+RN+i6rM2PNLyCThhZkTChTao9MvNfWxq68m3S518We3t+9n v1/F65wU/KLH4SSbkgc6jbSTfA5yHejtkoyrY= 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=lQIAY2b3wOi2kWXurUH9Lyi46LIoZYDgEMKfYHf1fhQ=; b=EN5DXd4eSwBPxw8kd6Yvm2m6VXXp4LlBNFiqVCRGTgsbKkjA36EHqCQMIisT9Txdus j8uxBlTQitl2zOfa6SXuse4oGJP0zuFDrwsvjNjjyxgletJcNC+5N2zeS1qhW/jUfMnu +ierwmwMUN/KRnU8zlJT9pKu6lA/fj3+MeJc/C0yklYCXKfOZSFwm67Cz7qZbz6VP/Qm aNvsIryblDTqFGDrjpGDK2FxVdHl7l5fW8Nr4HfJT17Xzq2Hx052vdgufZCndIGyBLmN Iw5eSlG+bAPEhVHN5GLREu22kOvjKaHXDOhCd1ZUNvXqc6tT7L5KrjSTKeyN5ziHrC6F zjJQ== X-Gm-Message-State: ALoCoQnWZ0M/9EBDj93ooFC0zxLX/fhNlKUESqLXHv/vD6YwJWlj8DzYQ6NDxiXA8r15bNqYXboCJa3Dt4uoQ7Q0GCKh6oilxSHwUkf7p4BxXDT05kZyg+ufV6mVKqVRn6llz6eEMJRtxKewhFh33WzdP4IIcMfBWHYcXny+hTkM42vmw7GjFFs= X-Received: by 10.180.90.34 with SMTP id bt2mr32605014wib.36.1420715577143; Thu, 08 Jan 2015 03:12:57 -0800 (PST) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id td6sm6123479wic.15.2015.01.08.03.12.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jan 2015 03:12:56 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH v2 4/5] ath10k: implement p2p bcn ie command Date: Thu, 8 Jan 2015 12:12:29 +0100 Message-Id: <1420715550-16017-5-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_111320_435265_4B0DEE23 X-CRM114-Status: GOOD ( 12.50 ) 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 Along beacon template host is expected to setup p2p information elements as well. Implement wmi interface for it. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/wmi-ops.h | 17 +++++++++++++ drivers/net/wireless/ath/ath10k/wmi-tlv.c | 41 +++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/wmi-tlv.h | 5 ++++ drivers/net/wireless/ath/ath10k/wmi.c | 3 +++ 4 files changed, 66 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h b/drivers/net/wireless/ath/ath10k/wmi-ops.h index 148a44a..8e815d4 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-ops.h +++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h @@ -125,6 +125,8 @@ struct wmi_ops { void *prb_ies, size_t prb_ies_len); struct sk_buff *(*gen_prb_tmpl)(struct ath10k *ar, u32 vdev_id, struct sk_buff *bcn); + struct sk_buff *(*gen_p2p_go_bcn_ie)(struct ath10k *ar, u32 vdev_id, + const u8 *p2p_ie); }; int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); @@ -897,4 +899,19 @@ ath10k_wmi_prb_tmpl(struct ath10k *ar, u32 vdev_id, struct sk_buff *prb) return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->prb_tmpl_cmdid); } +static inline int +ath10k_wmi_p2p_go_bcn_ie(struct ath10k *ar, u32 vdev_id, const u8 *p2p_ie) +{ + struct sk_buff *skb; + + if (!ar->wmi.ops->gen_p2p_go_bcn_ie) + return -EOPNOTSUPP; + + skb = ar->wmi.ops->gen_p2p_go_bcn_ie(ar, vdev_id, p2p_ie); + if (IS_ERR(skb)) + return PTR_ERR(skb); + + return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->p2p_go_set_beacon_ie); +} + #endif diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index 1713f8c..7c4297e 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -2085,6 +2085,46 @@ ath10k_wmi_tlv_op_gen_prb_tmpl(struct ath10k *ar, u32 vdev_id, return skb; } +static struct sk_buff * +ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie(struct ath10k *ar, u32 vdev_id, + const u8 *p2p_ie) +{ + struct wmi_tlv_p2p_go_bcn_ie *cmd; + struct wmi_tlv *tlv; + struct sk_buff *skb; + void *ptr; + size_t len; + + len = sizeof(*tlv) + sizeof(*cmd) + + sizeof(*tlv) + roundup(p2p_ie[1] + 2, 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_P2P_GO_SET_BEACON_IE); + tlv->len = __cpu_to_le16(sizeof(*cmd)); + cmd = (void *)tlv->value; + cmd->vdev_id = __cpu_to_le32(vdev_id); + cmd->ie_len = __cpu_to_le32(p2p_ie[1] + 2); + + ptr += sizeof(*tlv); + ptr += sizeof(*cmd); + + tlv = ptr; + tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_BYTE); + tlv->len = __cpu_to_le16(roundup(p2p_ie[1] + 2, 4)); + memcpy(tlv->value, p2p_ie, p2p_ie[1] + 2); + + ptr += sizeof(*tlv); + ptr += roundup(p2p_ie[1] + 2, 4); + + ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv p2p go bcn ie for vdev %i\n", + vdev_id); + return skb; +} + /****************/ /* TLV mappings */ /****************/ @@ -2372,6 +2412,7 @@ static const struct wmi_ops wmi_tlv_ops = { /* .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, + .gen_p2p_go_bcn_ie = ath10k_wmi_tlv_op_gen_p2p_go_bcn_ie, }; /************/ diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h b/drivers/net/wireless/ath/ath10k/wmi-tlv.h index 5772519..eb02290 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h @@ -1404,6 +1404,11 @@ struct wmi_tlv_prb_tmpl_cmd { __le32 buf_len; } __packed; +struct wmi_tlv_p2p_go_bcn_ie { + __le32 vdev_id; + __le32 ie_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 8c46de1..2a1a98f 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -4930,6 +4930,7 @@ static const struct wmi_ops wmi_ops = { /* .gen_pdev_get_temperature not implemented */ /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ + /* .gen_p2p_go_bcn_ie not implemented */ }; static const struct wmi_ops wmi_10_1_ops = { @@ -4986,6 +4987,7 @@ static const struct wmi_ops wmi_10_1_ops = { .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ + /* .gen_p2p_go_bcn_ie not implemented */ }; static const struct wmi_ops wmi_10_2_ops = { @@ -5098,6 +5100,7 @@ static const struct wmi_ops wmi_10_2_4_ops = { .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode, /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ + /* .gen_p2p_go_bcn_ie not implemented */ }; int ath10k_wmi_attach(struct ath10k *ar)