Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1507537pxb; Sun, 11 Apr 2021 22:41:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypRDM1IP3btRFNaYFIXbHaGnNI29JLjSBzazl0xpHZNtEuW3jMNYS1j8wxf7uSZWs+IW1Z X-Received: by 2002:a17:902:8b81:b029:eb:5a4:9cae with SMTP id ay1-20020a1709028b81b02900eb05a49caemr1794167plb.13.1618206060892; Sun, 11 Apr 2021 22:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618206060; cv=none; d=google.com; s=arc-20160816; b=eHobAMlhE2ciQj94C5+DbQ0J7p19T9fOLZ07A9YLAmtBXV4xcI0tA4IhyMX3gTyMF3 AxwARUulHi4ucqZ27jFUWS+XpIRGca2w3NtSHQfExCvmfI1VF26AX6BxIf/evgZ7Q2XN zRX1lrJ6POOY+EurCTwwDRDD2fjZHdwoGuLGu4s8P2ZoPwZA9ntQMeWRHnlQAOyZmRMr 9HXDZeYz2RnnCDkmAaKoXQ5gXe8egsa+g6pVT8UpRdtIpE6j/WCvcNq14OSpqRff3F+f v8cq7VaWpt4fH6iGTQrtDutBKiaP0KgowrDnDmr1zDcYClSOEKPlMal9w1hpuizJctZD ZVYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Tx8lrO9gzUgyuUxVDAEifDvVtJoe3aQNjahGEewp2tg=; b=pK9Fb+V4+3w98qppyrk7DB1dftPkjxCVuFMCYlWwLp+Ps0+NuMDI5P37Fh/dAiJBLK b7UWwpJwhQQf9h8wcNcbt6vVQi/MPelRB844UG0XpjT7VKDNjM2V9G85P6+OcH+XMdsa 87oQow+N2JiD7SOLj27PVUAe00S/QsSElB81CDU3wBrHdBwIRpo1B6tPlwwGcoDTUu1J RD6AbCXHFS+o3ei/7GkSexqdZNLSPChu98mIq9C1HON8x2GEj2M3+fNTWUZszMrYO6N9 sMtA7rNjpuYU4gd8qsGqYn62ntiIdA48ztDOnuf437VHMG/mUUHio478U7LmgJhh3GYP utKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 7si12686087pgj.316.2021.04.11.22.40.42; Sun, 11 Apr 2021 22:41:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230082AbhDLFk5 (ORCPT + 99 others); Mon, 12 Apr 2021 01:40:57 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:55386 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229448AbhDLFk4 (ORCPT ); Mon, 12 Apr 2021 01:40:56 -0400 X-UUID: e7fab72f9f4e40188f4890a67e492898-20210412 X-UUID: e7fab72f9f4e40188f4890a67e492898-20210412 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 90478055; Mon, 12 Apr 2021 13:40:35 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Apr 2021 13:40:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 12 Apr 2021 13:40:33 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , linux-mediatek , Shayne Chen Subject: [PATCH 2/3] mt76: mt7915: rework mt7915_tm_set_tx_len() Date: Mon, 12 Apr 2021 13:39:53 +0800 Message-ID: <20210412053954.23544-2-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210412053954.23544-1-shayne.chen@mediatek.com> References: <20210412053954.23544-1-shayne.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Rework mt7915_tm_set_tx_len() with mt76_testmode_alloc_skb() to support larger packet based on a longer tx_time. Signed-off-by: Shayne Chen --- .../wireless/mediatek/mt76/mt7915/testmode.c | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c index bd798df..f9d81e3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c @@ -257,13 +257,13 @@ mt7915_tm_set_tx_len(struct mt7915_phy *phy, u32 tx_time) { struct mt76_phy *mphy = phy->mt76; struct mt76_testmode_data *td = &mphy->test; - struct sk_buff *old = td->tx_skb, *new; struct ieee80211_supported_band *sband; struct rate_info rate = {}; u16 flags = 0, tx_len; u32 bitrate; + int ret; - if (!tx_time || !old) + if (!tx_time) return 0; rate.mcs = td->tx_rate_idx; @@ -323,21 +323,9 @@ mt7915_tm_set_tx_len(struct mt7915_phy *phy, u32 tx_time) bitrate = cfg80211_calculate_bitrate(&rate); tx_len = bitrate * tx_time / 10 / 8; - if (tx_len < sizeof(struct ieee80211_hdr)) - tx_len = sizeof(struct ieee80211_hdr); - else if (tx_len > IEEE80211_MAX_FRAME_LEN) - tx_len = IEEE80211_MAX_FRAME_LEN; - - new = alloc_skb(tx_len, GFP_KERNEL); - if (!new) - return -ENOMEM; - - skb_copy_header(new, old); - __skb_put_zero(new, tx_len); - memcpy(new->data, old->data, sizeof(struct ieee80211_hdr)); - - dev_kfree_skb(old); - td->tx_skb = new; + ret = mt76_testmode_alloc_skb(phy->mt76, tx_len); + if (ret) + return ret; return 0; } -- 2.18.0