From patchwork Tue Apr 19 05:00:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 8876911 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 03CADBF29F for ; Tue, 19 Apr 2016 05:07:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0982F20204 for ; Tue, 19 Apr 2016 05:07:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 23EAF200E5 for ; Tue, 19 Apr 2016 05:07:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751938AbcDSFHD (ORCPT ); Tue, 19 Apr 2016 01:07:03 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:34969 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752007AbcDSFBH (ORCPT ); Tue, 19 Apr 2016 01:01:07 -0400 Received: by mail-pf0-f179.google.com with SMTP id n1so2716412pfn.2 for ; Mon, 18 Apr 2016 22:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=z/2SajhnHy3/sJX8NzyvHOx0ABxHIGGPkOItCVfrahg=; b=jD0jopWrpmtDjJ6x3t/cOyI9yvHvqLh+hMki67nBBLzH+xtncYL72wTBnYLICWubQ9 95sBoRB5RDaf6A6bojuBVnxyuz2HK8dX5WWi7QnA+O3vk4kTXd+08qmYcdkQVT+i0dwQ u2qap6VU9mSNp+I4361WVD5khSfMoIheRqewE= 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=z/2SajhnHy3/sJX8NzyvHOx0ABxHIGGPkOItCVfrahg=; b=dSC6+h870aH0TQDzaOsWR+sU4q615Iw8hpflPjuqOnDQ/QcVebDvXt3Z2Y3Yp//Vnp FUZVKO8KH+atFb2N3M3KRm9R4bdSe7w/LvEaQ6sW8vFFl/MDEtZwPooERrbmHSNIkG+M p5X1KU5561Q/T9PKPPPFWRv0q1lwKZNdXmNx3B/r2Du/0QE2f9txHa6XwUkpuoj0I/0w iuJMV/qIXGDwYjwwcZlU3hrQj0Hab5hhZ/TS/L4151m009dcHHsOicLux6wT1wG2JN4b hX95vdBMgwzw2ryTnzrloF8PeSvJMFcHuHeRLjpyLeB4kHumZBr0xjp93stqXkYq2Zsp wTAA== X-Gm-Message-State: AOPr4FWXBa8XtOqHApeEEcSFGBNEPAxR7ikqvq2a0V0ybdohFXuCs3hRG4TQT6JAh19+e2uj X-Received: by 10.98.64.144 with SMTP id f16mr1267319pfd.159.1461042061067; Mon, 18 Apr 2016 22:01:01 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id kh2sm20274686pad.9.2016.04.18.22.00.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Apr 2016 22:01:00 -0700 (PDT) From: Bjorn Andersson To: Eugene Krasnikov , Kalle Valo Cc: Pontus Fuchs , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 01/18] wcn36xx: Clean up wcn36xx_smd_send_beacon Date: Mon, 18 Apr 2016 22:00:39 -0700 Message-Id: <1461042056-10607-2-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1461042056-10607-1-git-send-email-bjorn.andersson@linaro.org> References: <1461042056-10607-1-git-send-email-bjorn.andersson@linaro.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 From: Pontus Fuchs Needed for coming improvements. No functional changes. Signed-off-by: Pontus Fuchs [bjorn: restored BEACON_TEMPLATE_SIZE define to 0x180] Signed-off-by: Bjorn Andersson --- Changes since v2: - Subtract sizeof(beacon_length) instead of modifying BEACON_TEMPLATE_SIZE, which is used in other places as well. drivers/net/wireless/ath/wcn36xx/hal.h | 5 ++++- drivers/net/wireless/ath/wcn36xx/smd.c | 12 +++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index b947de0fb2e5..d713204f755d 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -2884,11 +2884,14 @@ struct update_beacon_rsp_msg { struct wcn36xx_hal_send_beacon_req_msg { struct wcn36xx_hal_msg_header header; + /* length of the template + 6. Only qcom knows why */ + u32 beacon_length6; + /* length of the template. */ u32 beacon_length; /* Beacon data. */ - u8 beacon[BEACON_TEMPLATE_SIZE]; + u8 beacon[BEACON_TEMPLATE_SIZE - sizeof(u32)]; u8 bssid[ETH_ALEN]; diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 74f56a81ad9a..ff3ed2461a69 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1380,19 +1380,17 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif, mutex_lock(&wcn->hal_mutex); INIT_HAL_MSG(msg_body, WCN36XX_HAL_SEND_BEACON_REQ); - /* TODO need to find out why this is needed? */ - msg_body.beacon_length = skb_beacon->len + 6; + msg_body.beacon_length = skb_beacon->len; + /* TODO need to find out why + 6 is needed */ + msg_body.beacon_length6 = msg_body.beacon_length + 6; - if (BEACON_TEMPLATE_SIZE > msg_body.beacon_length) { - memcpy(&msg_body.beacon, &skb_beacon->len, sizeof(u32)); - memcpy(&(msg_body.beacon[4]), skb_beacon->data, - skb_beacon->len); - } else { + if (msg_body.beacon_length > BEACON_TEMPLATE_SIZE) { wcn36xx_err("Beacon is to big: beacon size=%d\n", msg_body.beacon_length); ret = -ENOMEM; goto out; } + memcpy(msg_body.beacon, skb_beacon->data, skb_beacon->len); memcpy(msg_body.bssid, vif->addr, ETH_ALEN); /* TODO need to find out why this is needed? */