From nobody Sun Feb 16 22:40:45 2025 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 4Yx131668Sz5p39l; Sun, 16 Feb 2025 22:40:45 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yx1311jq7z4JFN; Sun, 16 Feb 2025 22:40:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739745645; 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=cA4JxnNjVr/782YCtvpQXWBRMOmWLJN+uth7Wf2+74E=; b=bYEsgJZUDlW97osXbdS6cQBPyCce9ajGbZnhp4kTFMpFpUIaYnQgfSSa8ci/JKjUNidtQx W2WAPF2gXtZHcxC7GSFACKuqQ1G9ohwh2RjNptSQwfG3kjoNc3RUqg26+w8QqbxHhGw+cB V1To8dWr2jYseqNPq+jZrDcVwyLV31SKrUIAC5DOXBZN5FYlJYL7tugqdlZ2iroWJa+NqH KWhkLQ5bHtBAz7/lrm8pWtbWLQh6fSSqAmiF6D1KQSd/riF/PEEKOnUcgd9iS3jvoB/fOt AlZYiN7t4/WJZ971x1+953SGSy3IMSlID6icNkVMpWvfTF2WRCLQfAlFAFOONA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1739745645; a=rsa-sha256; cv=none; b=eUzru2DN5vAIMtUsoB9EGCW4wpLmTZblRtHz7QNTQfA7rNgdWqDEBjKE8VYzZJGkRqgI6T IrhYUkRJLxQFNVWK4l28uVD10GRIxnr25Xp+CGyBSwaEurIbx6DFtaLZg4kWmX5M+Zk+0c YkpnWRk0qZzgHU3BkduBY5BG216iyNq+qKSFO6mpdeEE/YR1VxXpiKXOwt7lov65UHYk5+ 16uZWwJAQn3KjG3Po1oiyD36jyt8b4aROHchrYUSYsPbZ7TCXchai5aiEe3/KqALx/tzjS gCYhkYeTZY+rbLy28R5GxfcN2UyprznGG005IiPjgBCG2V1JMFE8TiQhj6MSBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739745645; 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=cA4JxnNjVr/782YCtvpQXWBRMOmWLJN+uth7Wf2+74E=; b=CuS3iTcAUIFKWc0O0VIj725+eHmx1jZ8s/PssHFU6cClBNgTcfVKf5Jra6kFHovd4RscUU jAIHUu1J22x1xdWIoRKAT3qouF8Zg3/iifPCdN2uPrtBU0mC/ar4u/eD2xoFWUL40X1N67 0TM9CQ0zcoiU2A2SiSuaqk+MrdeJideGvyh3VB1gvGsMbAyLgb0qKAUhREgIGinazRDdB9 2n7xRxglcrJBOaq8x37TT+ZfCTNWEiT2RBzRRrc645qCJ2jE013J2M2eFT1xweE9gHO92a LL4XJtaEiqmY4bdsDsv7Hhh6+4ezkV8eSTRR62xmkfrlsCVJ2fJc6sqn4w5Zew== 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 4Yx1310mygz15dk; Sun, 16 Feb 2025 22:40:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51GMejHB038449; Sun, 16 Feb 2025 22:40:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51GMejvv038446; Sun, 16 Feb 2025 22:40:45 GMT (envelope-from git) Date: Sun, 16 Feb 2025 22:40:45 GMT Message-Id: <202502162240.51GMejvv038446@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: a7c19b8a99a6 - main - LinuxKPI; 802.11: start implementing cfg80211_calculate_bitrate() 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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: a7c19b8a99a604e8940c7475220df5de7e295ffa Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a7c19b8a99a604e8940c7475220df5de7e295ffa commit a7c19b8a99a604e8940c7475220df5de7e295ffa Author: Bjoern A. Zeeb AuthorDate: 2024-12-28 10:10:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-02-16 22:33:03 +0000 LinuxKPI; 802.11: start implementing cfg80211_calculate_bitrate() For now we only return the legacy rate and have two TODOs for HT and VHT which still need to be implemented as needed. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/include/net/cfg80211.h | 6 ++--- sys/compat/linuxkpi/common/src/linux_80211.c | 30 +++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h index bcbf629abb2f..cf1e05dde7ea 100644 --- a/sys/compat/linuxkpi/common/include/net/cfg80211.h +++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h @@ -1304,6 +1304,7 @@ void linuxkpi_wiphy_delayed_work_cancel(struct wiphy *, int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, struct linuxkpi_ieee80211_regdomain *regd); +uint32_t linuxkpi_cfg80211_calculate_bitrate(struct rate_info *); uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band); uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t); struct linuxkpi_ieee80211_channel * @@ -1574,11 +1575,10 @@ cfg80211_find_vendor_ie(unsigned int oui, int oui_type, return (__DECONST(uint8_t *, elem)); } -static __inline uint32_t +static inline uint32_t cfg80211_calculate_bitrate(struct rate_info *rate) { - TODO(); - return (-1); + return (linuxkpi_cfg80211_calculate_bitrate(rate)); } static __inline uint32_t diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index f1738a30993c..1d834673fa74 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -5890,6 +5890,36 @@ linuxkpi_wiphy_free(struct wiphy *wiphy) kfree(lwiphy); } +static uint32_t +lkpi_cfg80211_calculate_bitrate_ht(struct rate_info *rate) +{ + TODO("cfg80211_calculate_bitrate_ht"); + return (rate->legacy); +} + +static uint32_t +lkpi_cfg80211_calculate_bitrate_vht(struct rate_info *rate) +{ + TODO("cfg80211_calculate_bitrate_vht"); + return (rate->legacy); +} + +uint32_t +linuxkpi_cfg80211_calculate_bitrate(struct rate_info *rate) +{ + + /* Beware: order! */ + if (rate->flags & RATE_INFO_FLAGS_MCS) + return (lkpi_cfg80211_calculate_bitrate_ht(rate)); + + if (rate->flags & RATE_INFO_FLAGS_VHT_MCS) + return (lkpi_cfg80211_calculate_bitrate_vht(rate)); + + IMPROVE("HE/EHT/..."); + + return (rate->legacy); +} + uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t channel, enum nl80211_band band)