From patchwork Sun May 20 08:15:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10413253 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5085B602A0 for ; Sun, 20 May 2018 08:16:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4523E28703 for ; Sun, 20 May 2018 08:16:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37E7828714; Sun, 20 May 2018 08:16:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB1BC28703 for ; Sun, 20 May 2018 08:16:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751555AbeETIP4 (ORCPT ); Sun, 20 May 2018 04:15:56 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:45764 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751410AbeETIPp (ORCPT ); Sun, 20 May 2018 04:15:45 -0400 Received: by mail-wr0-f194.google.com with SMTP id w3-v6so5323990wrl.12 for ; Sun, 20 May 2018 01:15:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=K7flrgMJNnYTgB/4LcBapC/6QIY7ALc4a06uiFqPDi4=; b=n/Gt2tHhwj445392ICeJwHXrAVuP/khHQpZwsObfVw0Apt5Im1TWJCnxb4XGIrGceF xS6ma10S9pm/IFGARPyKYLHRYVFgT7JW8iSJWz4iktrDINR5W8a+6GeiDQsEP9K8ol0R jKbdi7fYhdQHscQ0p2pDsY9fJyQESPppmUK1yhctmSlwfmSZxfH6yf44gmat+Dom3mIb GHMXGAKXSd/1NO6WihYL18oQfTFey4eKbO85V141dip0KO+aR+y96qEJhwyjZI4MSVUw IcPa6V2GjLRbvoAEBEu5ySGZ+yCsMGk2GGl86vdxoHyeR3AQauub499TUqQXPY+mQZ7D nXQg== X-Gm-Message-State: ALKqPwdU6CVymUFksj27H58/ECAgmaCyMBI+ClGUxt3Uv3pBJF7WKm2W 5u0SeGn5knuvGZDk8r4dZlGL+w== X-Google-Smtp-Source: AB8JxZrpzbNgZJkQrk4E5j9UQaUCPMThSWptV4XLrTvZT+hiCyfb1yeSC7VL6Rtx95UC+4HyDi61pg== X-Received: by 2002:adf:8ec7:: with SMTP id q65-v6mr12528671wrb.261.1526804144776; Sun, 20 May 2018 01:15:44 -0700 (PDT) Received: from localhost.localdomain ([151.66.25.157]) by smtp.gmail.com with ESMTPSA id z7-v6sm13981716wrg.56.2018.05.20.01.15.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 May 2018 01:15:44 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, sgruszka@redhat.com Subject: [RFC v2 08/18] mt76x2: add buffer len to mt76x2_mac_write_txwi signature Date: Sun, 20 May 2018 10:15:12 +0200 Message-Id: <20180520081522.10163-9-lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.16.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add frame length to mt76x2_mac_write_txwi routine signature and do not fetch it from skb since txwi data structure is added at the beginning of the skb for usb based devices and mt76x2_mac_write_txwi will be shared between pci and usb related code Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 6 +++--- drivers/net/wireless/mediatek/mt76/mt76x2_mac.h | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2_tx.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c index 3f24756b1b6c..21f0b1536401 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c @@ -167,7 +167,7 @@ void mt76x2_mac_wcid_set_rate(struct mt76x2_dev *dev, struct mt76_wcid *wcid, void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x2_txwi *txwi, struct sk_buff *skb, struct mt76_wcid *wcid, - struct ieee80211_sta *sta) + struct ieee80211_sta *sta, int len) { struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_rate *rate = &info->control.rates[0]; @@ -254,7 +254,7 @@ void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x2_txwi *txwi, txwi_flags |= MT_TXWI_FLAGS_TS; txwi->flags |= cpu_to_le16(txwi_flags); - txwi->len_ctl = cpu_to_le16(skb->len); + txwi->len_ctl = cpu_to_le16(len); } static void mt76x2_remove_hdr_pad(struct sk_buff *skb, int len) @@ -717,7 +717,7 @@ mt76_write_beacon(struct mt76x2_dev *dev, int offset, struct sk_buff *skb) if (WARN_ON_ONCE(beacon_len < skb->len + sizeof(struct mt76x2_txwi))) return -ENOSPC; - mt76x2_mac_write_txwi(dev, &txwi, skb, NULL, NULL); + mt76x2_mac_write_txwi(dev, &txwi, skb, NULL, NULL, skb->len); mt76_wr_copy(dev, offset, &txwi, sizeof(txwi)); offset += sizeof(txwi); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h index c048cd06df6b..5af0107ba748 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.h @@ -166,7 +166,7 @@ int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb, void *rxi); void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x2_txwi *txwi, struct sk_buff *skb, struct mt76_wcid *wcid, - struct ieee80211_sta *sta); + struct ieee80211_sta *sta, int len); void mt76x2_mac_wcid_setup(struct mt76x2_dev *dev, u8 idx, u8 vif_idx, u8 *mac); int mt76x2_mac_wcid_set_key(struct mt76x2_dev *dev, u8 idx, struct ieee80211_key_conf *key); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c b/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c index e46eafc4c436..d16d438173e4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_tx.c @@ -159,7 +159,7 @@ int mt76x2_tx_prepare_skb(struct mt76_dev *mdev, void *txwi, if (q == &dev->mt76.q_tx[MT_TXQ_PSD] && wcid && wcid->idx < 128) mt76x2_mac_wcid_set_drop(dev, wcid->idx, false); - mt76x2_mac_write_txwi(dev, txwi, skb, wcid, sta); + mt76x2_mac_write_txwi(dev, txwi, skb, wcid, sta, skb->len); ret = mt76x2_insert_hdr_pad(skb); if (ret < 0)