From nobody Wed Sep 21 14:01:29 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MXg7Z2Fqdz4cY7W; Wed, 21 Sep 2022 14:01:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MXg7Z0FjBz4BFl; Wed, 21 Sep 2022 14:01:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663768890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4q60FhkWa8QADDnAMSSpzcZ8gN6tzja16L7+mVj0DEg=; b=eQndVmXttkk0B3n67m1MctQNY6l6a30yk5z7PjjGlAeewzjbIZXvjPWRs45Za3ubdaOfhQ MYdSNFXplxJqhwMll6R6T/FeCOTWbHP8J1RGNbEAGxlJNF2n2yZUzyjPyKq7h3Rl5KP/8J u5h9xRz3/IQTdyRHPUbaDkRmsTvY0gNXkOKBmwhqyXWgSWrNfHM0vtzcj16CNyu8+lwsSj CnqbeR3U1/gMW4pt7eUd5UuRoP2k7gJ8paB36wGJwPClkLBH5+guhrXdLQMBQ6SSXmCIxw nBE8Uz64ZKh9t9A5TwpoREZ96A6PJ55vX69i0q1lZp9AQSBpryNZf/OM0UsPag== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MXg7Y6Tgfz14xx; Wed, 21 Sep 2022 14:01:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28LE1Tcw000237; Wed, 21 Sep 2022 14:01:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28LE1T6W000233; Wed, 21 Sep 2022 14:01:29 GMT (envelope-from git) Date: Wed, 21 Sep 2022 14:01:29 GMT Message-Id: <202209211401.28LE1T6W000233@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 1a8315228fff - stable/13 - LinuxKPI: 80211: improve linuxkpi_ieee80211_get_tid() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1a8315228fff747c9bb0a2e639d94505c7ac22d8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663768890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4q60FhkWa8QADDnAMSSpzcZ8gN6tzja16L7+mVj0DEg=; b=oVYpWp72VvpcMqzKdmgBpARdyMWHj4MqN/87ijlLAC3az/hPOYlNupLEpsBQSxbpYi09sg pa4+IPEYPoyT0J6eAoz85bmwkNF0De35q/JoiI9cQ1T2IFVx4mDQFfBMq0Rz3+3IEkXniD rMj8ScKkwOQKV027Fd2sGlu9EkYd7L+bChhaN64CNF0noDNm5I0GTHDtuajoCmo9KZWg+w N6z7mILjZ1bammmMUCWNUvkIl3gdbb3jFzdkVCfLaZMnOUiMuKXA0tdR9UbDhJQN7TPncM QOqfyHQWELw4Hy07XaUbyhpmOXLgqWHE04zlB70EZW5SivCmYNOmb7hMXYWv5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663768890; a=rsa-sha256; cv=none; b=hBpnnqpiDbmRflf2eRP50RSRJVK/99SfSwb0N2MFAkSvQRvj8pnd26PwdXdJaoHOvB8s6J gt8rucADi9XQvZXYG0qBayuSxCxsHiTmYGUB6CqrgiiASwN46z18mjDvejp0UI9JLZogDV kVrUU1/aDdP/sZOZwjcehEI7ViY0JVVyi3L9teK/bHtfzdKtQcFDmCBU+ppY/S/+N6TLI3 8Bwt0NWbxoD+GaCHdIKmmePGF4UaB3xwJkX3enKEN4CfCDRaUUD6GivCIdU+pQ5daczSGq VVGoi0mq59rRtuf/B7mqLD72SDDNT/IUf2AL5xRsoJJUR9QCICTlDis3szcLyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=1a8315228fff747c9bb0a2e639d94505c7ac22d8 commit 1a8315228fff747c9bb0a2e639d94505c7ac22d8 Author: Bjoern A. Zeeb AuthorDate: 2022-09-05 20:57:17 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-09-21 11:46:46 +0000 LinuxKPI: 80211: improve linuxkpi_ieee80211_get_tid() Continue what was started in 26a36948331bd08d9afaddfc0da724eacdb953dd in iwlwifi and extend out internal implementation of linuxkpi_ieee80211_get_tid() by an argument as to whether "no-QoS" answers are acceptable. For the LinuxKPI ieee80211_get_tid() set this to false as the Linux derived drivers seem to do extra checks for the QoS-Data frame before acquiring the tid. Add KASSERTs to enforce the extra argument. This allows us to use the net80211 variant in LinuxKPI for other means explicitly documenting that we do accept a IEEE80211_NONQOS_TID. Sponsored by: The FreeBSD Foundation (cherry picked from commit ec190d91500676614feaf6456084369325ddcaa0) --- sys/compat/linuxkpi/common/include/net/mac80211.h | 6 +++--- sys/compat/linuxkpi/common/src/linux_80211.c | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index 13ae7bb99376..03bef9fbb97d 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2020-2021 The FreeBSD Foundation + * Copyright (c) 2020-2022 The FreeBSD Foundation * Copyright (c) 2020-2022 Bjoern A. Zeeb * * This software was developed by Björn Zeeb under sponsorship from @@ -967,7 +967,7 @@ void linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *, struct cfg80211_scan_info *); void linuxkpi_ieee80211_rx(struct ieee80211_hw *, struct sk_buff *, struct ieee80211_sta *, struct napi_struct *); -uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *); +uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *, bool); struct ieee80211_sta *linuxkpi_ieee80211_find_sta(struct ieee80211_vif *, const u8 *); struct ieee80211_sta *linuxkpi_ieee80211_find_sta_by_ifaddr( @@ -1452,7 +1452,7 @@ static __inline uint8_t ieee80211_get_tid(struct ieee80211_hdr *hdr) { - return (linuxkpi_ieee80211_get_tid(hdr)); + return (linuxkpi_ieee80211_get_tid(hdr, false)); } static __inline struct sk_buff * diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 3381218b2623..282ed2d99dd5 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -4056,12 +4056,22 @@ err: } uint8_t -linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *hdr) +linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *hdr, bool nonqos_ok) { const struct ieee80211_frame *wh; + uint8_t tid; + + /* Linux seems to assume this is a QOS-Data-Frame */ + KASSERT(nonqos_ok || ieee80211_is_data_qos(hdr->frame_control), + ("%s: hdr %p fc %#06x not qos_data\n", __func__, hdr, + hdr->frame_control)); wh = (const struct ieee80211_frame *)hdr; - return (ieee80211_gettid(wh)); + tid = ieee80211_gettid(wh); + KASSERT(nonqos_ok || tid == (tid & IEEE80211_QOS_TID), ("%s: tid %u " + "not expected (%u?)\n", __func__, tid, IEEE80211_NONQOS_TID)); + + return (tid); } struct wiphy *