From nobody Mon Sep 05 21:12:23 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 4MM1S741L8z4bj46; Mon, 5 Sep 2022 21:12:23 +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 4MM1S73Yvpz3fdy; Mon, 5 Sep 2022 21:12:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662412343; 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=vBvAbSLei9+V9vPYJBNd5HXxJujmm8kF005mY+p3WUM=; b=ZwNBQQjUZ3D5c/L0xX2bgfkAtWsmr42yXvUdPMc33xb7+CvOPC1RklUKnyi7DmuvEi9Wvc 9Et+giUyG4k5+lyG4M1EPGnJtTJLdbqpIUhrQuG1hIhdQzU5CrRIqZbFM6sypOEVZE4vak BSjldAyFkmvMyRGdHN/G5Vfc3RryVTxVGQ3VcXU7/7quFy/wgoHNxKcj+0/hG+kSFflMIC hYu3cHfURVKFISSvRfWLzWZeTV7T3jvnG2xoFPcgYt8eoBcIQi7SjPoEXCZhZ/p29Ds80s YUjXGnnj6sFAlcd6mbKMYjBe7epKv5YewsADvyUL/DMyhYsLHXDttsJlpTxnJQ== 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 4MM1S72dSLzxZP; Mon, 5 Sep 2022 21:12:23 +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 285LCNm7081545; Mon, 5 Sep 2022 21:12:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 285LCNuC081544; Mon, 5 Sep 2022 21:12:23 GMT (envelope-from git) Date: Mon, 5 Sep 2022 21:12:23 GMT Message-Id: <202209052112.285LCNuC081544@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ec190d915006 - main - 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/main X-Git-Reftype: branch X-Git-Commit: ec190d91500676614feaf6456084369325ddcaa0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662412343; 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=vBvAbSLei9+V9vPYJBNd5HXxJujmm8kF005mY+p3WUM=; b=npJ6SZ3aiaQHa/fH2Sdj8OEHRYG1pi3XFIkxn77O+HN0w4RDCuG1wYnt42Yb/2l484mPsO 26yPQ5/IBczbZxLKuMehJecECnXq688wXwpeVwiLh/FjlXmUgtDRivXz76QAAdV2HeF0wm Wv82yjQXIv4KNwm/NO09o2iDItqJGH4iPiVGS+RpVfNBXszdQgzVn02yLQdYfEh12a3Ix+ cJZhqEKIjtkQ359E4/WDyIDavTYuwIezTUySpsNRWpw9G1637MHzTklXMRsau1Px+IiG8L bHLpjQUp+V5k75VyQJsyl539izuQpTUYi99fTUWIQNb7TEWMIFQEZU2I8iLnaw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662412343; a=rsa-sha256; cv=none; b=qKCmlG6De+vwyKPnpQpfdGYRul2w0HA+oY0k6EGWPDgVhMGNShCxYBwW4rC5dQOGAMCj+7 2VtM0nD8R14oTZznE2oAzxFyFft2lJlfEDl3Hf2oieONkjXZRoAibNIrXCzzhmtvCn1nPW WtzeePpcaECj9zHfoobLnAgxXXPKefiEMkedblvnd9rpxQqDOvSAZK9EgMrnw8XcNKXUyQ xjDaJBFFiPThxu4doLX25D1JQ0nZS81cKsVFcSfc720q+2XYECpKPdZ6RoeK5HdFHY+Iqt 6iGaU5x/0i6Ks9x1kYu/O7qGJIw7BZyhoSerqR6PXvgAPgsLiyuD2oLtBzcHfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ec190d91500676614feaf6456084369325ddcaa0 commit ec190d91500676614feaf6456084369325ddcaa0 Author: Bjoern A. Zeeb AuthorDate: 2022-09-05 20:57:17 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-09-05 20:57:17 +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 MFC after: 3 days --- 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 197973cf5163..7f8e07dee048 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 *