Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp130740pxj; Thu, 27 May 2021 23:33:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCALw8KciDLIxn2ZQswj0hGUf/7w4JjxIsIt/JTGCW2elbPTpzTU7H4a/+eny5Q2/Uj9Op X-Received: by 2002:a17:906:eb0c:: with SMTP id mb12mr7525166ejb.109.1622183605030; Thu, 27 May 2021 23:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622183605; cv=none; d=google.com; s=arc-20160816; b=e9vzU9vpz3dSzxmywxXhiM6xCOefkz7W0WHQH18AdsKv8u7yBFIA63EfLgggY98Hts p4d3aNlp3gqCxVqBO6CUzdKlJ4Y/g3l3TZ/IRlBlTqpFnUWUrqA/YLV1DbklNVfyVvBz H4kpELQguTzeaLZNuBZzd0ENzDrhZr6EzhOvLoYhzQGyp6FGfPX6aznRm5YLWXV15cwk 4mdFKrSXsLI93tFYqezFbLhmDNGTbCmKIeP8rahw/Noqf2ObBfdxK0o7Utfj4e/HaVVj xukedcx2KORufo4ynEbv6HXKKYLMTsEs3mGZO3xQWwGH0Q4vVTEB8yUB6QLtnZsN4MvJ H1ww== 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=DMwwPMY6AU5BWcvn/YjsT6O5cM3KpDbROgtUb8roM4w=; b=W+0XhRBMmcQ03utsp3OLpwFUy3sqSzFNN2SDsNSQEcCjOifY1GfaKg59ZqbWohiYNU CkalRv14320d1BOlOh4j64C+61DUNSvtVANqsAP2yQk0aA1jABGtc0KEcJMKlg4A3TaY 7Ai2opIuqpO82ZoXdkTBhk/Fld/a8VX+Jqo9wVJ3O6bPX9JM6wVz0bNglWLzLhLgj1WJ c6AEhvMmAK5GJ7C/qeAKymm5he981V4eu01Ibb1ZdpUWfDps0ZXWx6hkwQtbGI1k/Q5A 0pI1HVWEwYilw6gCWGcQirjFJvFF6RTSDOAV+VCo3nGzeP71k+zw3ukou8gi2Ghh7wif 9GDA== 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 kk3si4114596ejc.121.2021.05.27.23.33.02; Thu, 27 May 2021 23:33:25 -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 S235494AbhE1GLN (ORCPT + 99 others); Fri, 28 May 2021 02:11:13 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:41210 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S234288AbhE1GLM (ORCPT ); Fri, 28 May 2021 02:11:12 -0400 X-UUID: 0c4953406652420e82ff630c6757085e-20210528 X-UUID: 0c4953406652420e82ff630c6757085e-20210528 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 307835176; Fri, 28 May 2021 14:09:36 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 28 May 2021 14:09:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 28 May 2021 14:09:34 +0800 From: Ryder Lee To: Felix Fietkau , Johannes Berg CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , Bo Jiao , Sujuan Chen , , , Ryder Lee Subject: [PATCH v2 1/4] mac80211: call ieee80211_tx_h_rate_ctrl() when dequeue Date: Fri, 28 May 2021 14:05:41 +0800 Message-ID: <2176023d8f13d82d093452e1c105609396c30622.1622164961.git.ryder.lee@mediatek.com> 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 --- change since v2 - roll ieee80211_tx_h_rate_ctrl checks into one condition --- 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..d3016c3a3069 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) && + 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