From patchwork Wed May 19 12:20:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Borgers X-Patchwork-Id: 443022 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3F33C433B4 for ; Wed, 19 May 2021 12:20:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD52B61353 for ; Wed, 19 May 2021 12:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346464AbhESMV7 (ORCPT ); Wed, 19 May 2021 08:21:59 -0400 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]:54411 "EHLO outpost1.zedat.fu-berlin.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346469AbhESMV6 (ORCPT ); Wed, 19 May 2021 08:21:58 -0400 Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.94) with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (envelope-from ) id 1ljLBm-000386-JW; Wed, 19 May 2021 14:20:38 +0200 Received: from a36t-ffs1.berlin.freifunk.net ([77.87.51.11] helo=mi.fu-berlin.de) by inpost2.zedat.fu-berlin.de (Exim 4.94) with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (envelope-from ) id 1ljLBl-000PK0-E8; Wed, 19 May 2021 14:20:38 +0200 Received: by mi.fu-berlin.de (sSMTP sendmail emulation); Wed, 19 May 2021 14:20:37 +0200 From: Philipp Borgers To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Philipp Borgers Subject: [PATCH v2 1/3] mac80211: add ieee80211_is_tx_data helper function Date: Wed, 19 May 2021 14:20:17 +0200 Message-Id: <20210519122019.92359-2-borgers@mi.fu-berlin.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210519122019.92359-1-borgers@mi.fu-berlin.de> References: <20210519122019.92359-1-borgers@mi.fu-berlin.de> MIME-Version: 1.0 X-Original-Sender: borgers@mi.fu-berlin.de X-Originating-IP: 77.87.51.11 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add a helper function that checks if a frame is a data frame. Frames with hardware encapsulation enabled are data frames. Signed-off-by: Philipp Borgers --- include/net/mac80211.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 445b66c6eb7e..a2a88c545561 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -6747,4 +6747,22 @@ struct sk_buff *ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw, struct sk_buff * ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, struct ieee80211_vif *vif); + +/** + * ieee80211_is_tx_data - check if frame is a data frame + * + * The function is used to check if a frame is a data frame. Frames with + * hardware encapsulation enabled are data frames. + * + * @skb: the frame to be transmitted. + */ +static inline bool ieee80211_is_tx_data(struct sk_buff *skb) +{ + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr = (void *) skb->data; + + return (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP || + ieee80211_is_data(hdr->frame_control)); +} + #endif /* MAC80211_H */ From patchwork Wed May 19 12:20:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Borgers X-Patchwork-Id: 443021 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3391C433B4 for ; Wed, 19 May 2021 12:20:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D23B461353 for ; Wed, 19 May 2021 12:20:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346511AbhESMWE (ORCPT ); Wed, 19 May 2021 08:22:04 -0400 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]:54567 "EHLO outpost1.zedat.fu-berlin.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346486AbhESMWD (ORCPT ); Wed, 19 May 2021 08:22:03 -0400 Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.94) with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (envelope-from ) id 1ljLBr-00039K-Lf; Wed, 19 May 2021 14:20:43 +0200 Received: from a36t-ffs1.berlin.freifunk.net ([77.87.51.11] helo=mi.fu-berlin.de) by inpost2.zedat.fu-berlin.de (Exim 4.94) with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (envelope-from ) id 1ljLBq-000PKX-G7; Wed, 19 May 2021 14:20:43 +0200 Received: by mi.fu-berlin.de (sSMTP sendmail emulation); Wed, 19 May 2021 14:20:42 +0200 From: Philipp Borgers To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Philipp Borgers Subject: [PATCH v2 3/3] mac80211: refactor rc_no_data_or_no_ack_use_min function Date: Wed, 19 May 2021 14:20:19 +0200 Message-Id: <20210519122019.92359-4-borgers@mi.fu-berlin.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210519122019.92359-1-borgers@mi.fu-berlin.de> References: <20210519122019.92359-1-borgers@mi.fu-berlin.de> MIME-Version: 1.0 X-Original-Sender: borgers@mi.fu-berlin.de X-Originating-IP: 77.87.51.11 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Use newly introduced helper function ieee80211_is_tx_data to check if frame is a data frame. Takes into account that hardware encapsulation can be enabled for a frame and therefore no ieee80211 header is present. Signed-off-by: Philipp Borgers --- net/mac80211/rate.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index fa1c73d0ceff..208bd0c2b671 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c @@ -297,15 +297,11 @@ void ieee80211_check_rate_mask(struct ieee80211_sub_if_data *sdata) static bool rc_no_data_or_no_ack_use_min(struct ieee80211_tx_rate_control *txrc) { struct sk_buff *skb = txrc->skb; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - __le16 fc; - - fc = hdr->frame_control; return (info->flags & (IEEE80211_TX_CTL_NO_ACK | IEEE80211_TX_CTL_USE_MINRATE)) || - !ieee80211_is_data(fc); + !ieee80211_is_tx_data(skb); } static void rc_send_low_basicrate(struct ieee80211_tx_rate *rate,