Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp1585034lkv; Wed, 19 May 2021 13:23:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjxmKB8ComgaDbIv1zkznqqbzwYQXfrdL8qfEoxxWFym52QCe50GGWkjCpGAfSNKRhPkUs X-Received: by 2002:a02:cac6:: with SMTP id f6mr1088945jap.142.1621455812328; Wed, 19 May 2021 13:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621455812; cv=none; d=google.com; s=arc-20160816; b=YqV0QMOj6p9SNF1y0pZDVwsplOaihpeSn9MNu1+VM3W7yBqgA2J+Ji3vLSsgOEaas6 XK9ueAUiBT+qpQ5Mw0fjogqLI8uR/ULzI4/YULE31XjKIZ/GZlTGAa+tBDmCtRiMEpvZ nMS4/6qqyuVZvjQCoHRiDXg1sIKjKSvk9TgQD/HjOTUkGCfEtf3kyR6QeI0FcIv6aKPC QJ40eWaGreG6XUnRRRk17LLInP4Xy2ikEC4QlpMYbj7iTjkEFjV0PKQ8hSkMmYu1WEc4 SBAqOg/bad83BnnL2EE3y2H6Kg3Zu/DDIYXzWY437fUTCr2ruoy0IDaby77JUh9ciL3I NmdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=bjYUAMU000nqZ13wocCQiZ4j9qcLiDJGrJkuL2QHJcY=; b=izUf98g6Y11GrA+WvebhGxudA+3NQslDoor5+xdoOnim5D0Mm2EzXQZVzG+Rnix2OG WAb45xTLDlNgCVXD9xl/OFRSRAnq3kDPt4zFZD1VvzSvtyqwucFTAXI2jlYYmVdFiPMg 22CXN94FPwHUHG7fpPmdUEIFItyBQqa5DSG1rVa3HRurmBz6MuzETmRvfCR5fHkNwRVT kZeyqBQE+k6MveCgunno7e9YkkxTbbXU4RB/W/75S6NGLaKXDAYyYveFTp4H9Ep68UAg 25u2xfJuRhq9nB5/DtIQh24Rqd3o+BSLxyJss9RjpzweMxaW1DCTDWLqXZ4KLJAiF8rX nprA== 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 r18si621578ilm.131.2021.05.19.13.23.18; Wed, 19 May 2021 13:23:32 -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 S232373AbhEST5u (ORCPT + 99 others); Wed, 19 May 2021 15:57:50 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:49437 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232233AbhEST5t (ORCPT ); Wed, 19 May 2021 15:57:49 -0400 X-UUID: cf9bc010a74e4cbe81bd1664d6cabf0c-20210520 X-UUID: cf9bc010a74e4cbe81bd1664d6cabf0c-20210520 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 294613297; Thu, 20 May 2021 03:56:27 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 20 May 2021 03:56:25 +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; Thu, 20 May 2021 03:56:25 +0800 From: Ryder Lee To: Felix Fietkau , Johannes Berg CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , Bo Jiao , Sujuan Chen , , , Ryder Lee Subject: [RFC PATCH 1/4] mac80211: call ieee80211_tx_h_rate_ctrl() when dequeue Date: Thu, 20 May 2021 03:56:21 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Make ieee80211_tx_h_rate_ctrl() get called on dequeue to improve performance since it reduces the turnaround time for rate control. Signed-off-by: Ryder Lee --- net/mac80211/tx.c | 52 ++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 0b719f3d2dec..b3ef6aaece31 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1768,8 +1768,6 @@ static int invoke_tx_handlers_early(struct ieee80211_tx_data *tx) CALL_TXH(ieee80211_tx_h_ps_buf); CALL_TXH(ieee80211_tx_h_check_control_port_protocol); CALL_TXH(ieee80211_tx_h_select_key); - if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) - CALL_TXH(ieee80211_tx_h_rate_ctrl); txh_done: if (unlikely(res == TX_DROP)) { @@ -1802,6 +1800,9 @@ static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx) goto txh_done; } + if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) + CALL_TXH(ieee80211_tx_h_rate_ctrl); + CALL_TXH(ieee80211_tx_h_michael_mic_add); CALL_TXH(ieee80211_tx_h_sequence); CALL_TXH(ieee80211_tx_h_fragment); @@ -3369,15 +3370,21 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, * Can be called while the sta lock is held. Anything that can cause packets to * be generated will cause deadlock! */ -static void ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata, - struct sta_info *sta, u8 pn_offs, - struct ieee80211_key *key, - struct sk_buff *skb) +static ieee80211_tx_result +ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata, + struct sta_info *sta, u8 pn_offs, + struct ieee80211_key *key, + struct ieee80211_tx_data *tx) { + struct sk_buff *skb = tx->skb; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_hdr *hdr = (void *)skb->data; u8 tid = IEEE80211_NUM_TIDS; + if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) + if (ieee80211_tx_h_rate_ctrl(tx) != TX_CONTINUE) + return TX_DROP; + if (key) info->control.hw_key = &key->conf; @@ -3426,6 +3433,8 @@ static void ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata, break; } } + + return TX_CONTINUE; } static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, @@ -3529,24 +3538,17 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, tx.sta = sta; tx.key = fast_tx->key; - if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) { - tx.skb = skb; - r = ieee80211_tx_h_rate_ctrl(&tx); - skb = tx.skb; - tx.skb = NULL; - - if (r != TX_CONTINUE) { - if (r != TX_QUEUED) - kfree_skb(skb); - return true; - } - } - if (ieee80211_queue_skb(local, sdata, sta, skb)) return true; - ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs, - fast_tx->key, skb); + tx.skb = skb; + r = ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs, + fast_tx->key, &tx); + tx.skb = NULL; + if (r == TX_DROP) { + kfree_skb(skb); + return true; + } if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) sdata = container_of(sdata->bss, @@ -3663,8 +3665,12 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) pn_offs = ieee80211_hdrlen(hdr->frame_control); - ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, - tx.key, skb); + r = ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, + tx.key, &tx); + if (r != TX_CONTINUE) { + ieee80211_free_txskb(&local->hw, skb); + goto begin; + } } else { if (invoke_tx_handlers_late(&tx)) goto begin; -- 2.18.0