aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/linuxkpi/common/src/linux_80211.c15
-rw-r--r--sys/contrib/dev/iwlwifi/mvm/rs.c133
-rw-r--r--sys/contrib/dev/iwlwifi/mvm/rs.h9
-rw-r--r--sys/netinet/tcp_stacks/rack.c30
4 files changed, 140 insertions, 47 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 63f6f5a182b5..894d0db39677 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -79,8 +79,8 @@
#define LKPI_80211_WME
#define LKPI_80211_HW_CRYPTO
-/* #define LKPI_80211_HT */
-/* #define LKPI_80211_VHT */
+#define LKPI_80211_HT
+#define LKPI_80211_VHT
#if defined(LKPI_80211_VHT) && !defined(LKPI_80211_HT)
#define LKPI_80211_HT
@@ -401,6 +401,8 @@ lkpi_sta_sync_ht_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni)
if ((sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) != 0)
sta->deflink.bandwidth = IEEE80211_STA_RX_BW_40;
+ else
+ sta->deflink.bandwidth = IEEE80211_STA_RX_BW_20;
/*
* 802.11n-2009 20.6 Parameters for HT MCSs gives the mandatory/
@@ -450,6 +452,13 @@ lkpi_sta_sync_vht_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni)
sta->deflink.vht_cap.cap = ni->ni_vhtcap;
sta->deflink.vht_cap.vht_mcs = ni->ni_vht_mcsinfo;
+ /*
+ * If VHT20/40 are selected do not update the bandwidth
+ * from HT but stya on VHT.
+ */
+ if (ni->ni_vht_chanwidth == IEEE80211_VHT_CHANWIDTH_USE_HT)
+ goto skip_bw;
+
width = (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK);
switch (width) {
#if 0
@@ -467,7 +476,7 @@ lkpi_sta_sync_vht_from_ni(struct ieee80211_sta *sta, struct ieee80211_node *ni)
#endif
sta->deflink.bandwidth = IEEE80211_STA_RX_BW_80;
}
-
+skip_bw:
rx_nss = 0;
rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map;
diff --git a/sys/contrib/dev/iwlwifi/mvm/rs.c b/sys/contrib/dev/iwlwifi/mvm/rs.c
index 981686e66920..f460624871ee 100644
--- a/sys/contrib/dev/iwlwifi/mvm/rs.c
+++ b/sys/contrib/dev/iwlwifi/mvm/rs.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2020-2021 The FreeBSD Foundation
+ * Copyright (c) 2020-2025 The FreeBSD Foundation
*
* This software was developed by Björn Zeeb under sponsorship from
* the FreeBSD Foundation.
@@ -33,42 +33,123 @@
* This file is left as a wrapper to make mvm compile and we will only
* deal with it on a need basis. Most newer chipsets do this in firmware.
*/
+#include <sys/param.h>
+#include <net/cfg80211.h> /* LinuxKPI 802.11 TODO() calls. */
-#include <sys/errno.h>
-
+#include "rs.h"
#include "mvm.h"
#ifdef CONFIG_IWLWIFI_DEBUGFS
+/*
+ * Fill struct iwl_mvm_frame_stats.
+ * Deal with various RATE_MCS_*_MSK. See rx.c, fw/api/rs.h, et al.
+ * XXX-BZ consider calling iwl_new_rate_from_v1() in rx.c so we can also
+ * use this in rxmq.c.
+ */
void
iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg)
{
-
+ uint8_t nss;
+
+ spin_lock_bh(&mvm->drv_stats_lock);
+ mvm->drv_rx_stats.success_frames++;
+
+ if (rate & RATE_MCS_HT_MSK_V1) {
+ mvm->drv_rx_stats.ht_frames++;
+ nss = 1 + ((rate & RATE_HT_MCS_NSS_MSK_V1) >> RATE_HT_MCS_NSS_POS_V1);
+ } else if (rate & RATE_MCS_VHT_MSK_V1) {
+ mvm->drv_rx_stats.vht_frames++;
+ nss = 1 + FIELD_GET(RATE_MCS_NSS_MSK, rate);
+ } else {
+ mvm->drv_rx_stats.legacy_frames++;
+ nss = 0;
+ }
+
+ switch (rate & RATE_MCS_CHAN_WIDTH_MSK_V1) {
+ case RATE_MCS_CHAN_WIDTH_20:
+ mvm->drv_rx_stats.bw_20_frames++;
+ break;
+ case RATE_MCS_CHAN_WIDTH_40:
+ mvm->drv_rx_stats.bw_40_frames++;
+ break;
+ case RATE_MCS_CHAN_WIDTH_80:
+ mvm->drv_rx_stats.bw_80_frames++;
+ break;
+ case RATE_MCS_CHAN_WIDTH_160:
+ mvm->drv_rx_stats.bw_160_frames++;
+ break;
+ }
+
+ if ((rate & RATE_MCS_CCK_MSK_V1) == 0 &&
+ (rate & RATE_MCS_SGI_MSK_V1) != 0)
+ mvm->drv_rx_stats.sgi_frames++;
+ else
+ mvm->drv_rx_stats.ngi_frames++;
+
+ switch (nss) {
+ case 1:
+ mvm->drv_rx_stats.siso_frames++;
+ break;
+ case 2:
+ mvm->drv_rx_stats.mimo2_frames++;
+ break;
+ }
+
+ if (agg)
+ mvm->drv_rx_stats.agg_frames++;
+
+ /* ampdu_count? */
+ /* fail_frames? */
+
+ mvm->drv_rx_stats.last_rates[mvm->drv_rx_stats.last_frame_idx] = rate;
+ mvm->drv_rx_stats.last_frame_idx++;
+ mvm->drv_rx_stats.last_frame_idx %=
+ ARRAY_SIZE(mvm->drv_rx_stats.last_rates);
+
+ spin_unlock_bh(&mvm->drv_stats_lock);
}
void
iwl_mvm_reset_frame_stats(struct iwl_mvm *mvm)
{
-
+ /* Apply same locking rx.c does; debugfs seems to read unloked? */
+ spin_lock_bh(&mvm->drv_stats_lock);
+ memset(&mvm->drv_rx_stats, 0, sizeof(mvm->drv_rx_stats));
+ spin_unlock_bh(&mvm->drv_stats_lock);
}
#endif
int
iwl_mvm_rate_control_register(void)
{
-
+ TODO("This likely has to call into net80211 unless we gain compat code in LinuxKPI");
return (0);
}
-int
-iwl_mvm_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *sta, bool enable)
+void
+iwl_mvm_rate_control_unregister(void)
{
+ TODO("This likely has to call into net80211 unless we gain compat code in LinuxKPI");
+}
- return (0);
+int
+iwl_mvm_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, bool enable)
+{
+ if (iwl_mvm_has_tlc_offload(mvm))
+ return (rs_fw_tx_protection(mvm, mvmsta, enable));
+ else {
+ TODO();
+ return (0);
+ }
}
-void
-iwl_mvm_rate_control_unregister(void)
+static void
+iwl_mvm_rs_sw_rate_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct ieee80211_bss_conf *link_conf, struct ieee80211_link_sta *link_sta,
+ enum nl80211_band band)
{
+ TODO();
}
void
@@ -77,18 +158,28 @@ iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf, struct ieee80211_link_sta *link_sta,
enum nl80211_band band)
{
+ if (iwl_mvm_has_tlc_offload(mvm))
+ iwl_mvm_rs_fw_rate_init(mvm, vif, sta, link_conf, link_sta, band);
+ else
+ iwl_mvm_rs_sw_rate_init(mvm, vif, sta, link_conf, link_sta, band);
}
void
iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, int tid,
struct ieee80211_tx_info *ba_info, bool t)
{
+ TODO();
}
void
-rs_update_last_rssi(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
+rs_update_last_rssi(struct iwl_mvm *mvm __unused, struct iwl_mvm_sta *mvmsta,
struct ieee80211_rx_status *rx_status)
{
+ struct iwl_lq_sta *lq_sta;
+ int i;
+
+ if (mvmsta == NULL || rx_status == NULL)
+ return;
/*
* Assumption based on mvm/sta.h is that this should update
@@ -96,12 +187,28 @@ rs_update_last_rssi(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
* access in that struct so nowhere to put rssi information.
* So the only thing would be if this is required internally
* to functions in this file.
+ * The "FW" version accesses more fields. We assume they
+ * are the same for now.
*/
+
+ lq_sta = &mvmsta->deflink.lq_sta.rs_drv;
+
+ lq_sta->pers.last_rssi = S8_MIN;
+ lq_sta->pers.chains = rx_status->chains;
+
+ for (i = 0; i < nitems(lq_sta->pers.chain_signal); i++) {
+ if ((rx_status->chains & BIT(i)) == 0)
+ continue;
+
+ lq_sta->pers.chain_signal[i] = rx_status->chain_signal[i];
+ if (rx_status->chain_signal[i] > lq_sta->pers.last_rssi)
+ lq_sta->pers.last_rssi = rx_status->chain_signal[i];
+ }
}
int
rs_pretty_print_rate_v1(char *buf, int bufsz, const u32 rate)
{
-
+ TODO();
return (0);
}
diff --git a/sys/contrib/dev/iwlwifi/mvm/rs.h b/sys/contrib/dev/iwlwifi/mvm/rs.h
index a9b10b841f95..71c0744f017c 100644
--- a/sys/contrib/dev/iwlwifi/mvm/rs.h
+++ b/sys/contrib/dev/iwlwifi/mvm/rs.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2020-2021 The FreeBSD Foundation
+ * Copyright (c) 2020-2025 The FreeBSD Foundation
*
* This software was developed by Björn Zeeb under sponsorship from
* the FreeBSD Foundation.
@@ -69,6 +69,13 @@ struct iwl_lq_sta {
struct {
spinlock_t lock;
uint16_t max_agg_bufsize;
+ /*
+ * Based on the assumption that these are in "FW" too and
+ * there is a f() to set last_rssi add them here too.
+ */
+ uint8_t chains;
+ uint8_t chain_signal[IEEE80211_MAX_CHAINS];
+ uint8_t last_rssi;
} pers;
};
diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c
index ab80ed9f4060..5a9171abeaf5 100644
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -18970,11 +18970,7 @@ rack_fast_rsm_output(struct tcpcb *tp, struct tcp_rack *rack, struct rack_sendma
crtsc = get_cyclecount();
if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[SND_OUT_DATA] += cnt_thru;
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_proc_time[SND_OUT_DATA] += (crtsc - ts_val);
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[CNT_OF_MSS_OUT] += ((len + segsiz - 1) / segsiz);
}
sched_unpin();
@@ -19525,11 +19521,7 @@ again:
crtsc = get_cyclecount();
if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[SND_OUT_DATA] += cnt_thru;
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_proc_time[SND_OUT_DATA] += (crtsc - ts_val);
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[CNT_OF_MSS_OUT] += ((tot_len + segsiz - 1) / segsiz);
}
sched_unpin();
@@ -19860,8 +19852,6 @@ rack_output(struct tcpcb *tp)
crtsc = get_cyclecount();
if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_proc_time[SND_BLOCKED] += (crtsc - ts_val);
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[SND_BLOCKED]++;
}
sched_unpin();
@@ -21070,19 +21060,13 @@ just_return_nolock:
crtsc = get_cyclecount();
if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[SND_OUT_DATA]++;
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_proc_time[SND_OUT_DATA] += (crtsc - ts_val);
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[CNT_OF_MSS_OUT] += ((tot_len_this_send + segsiz - 1) / segsiz);
}
} else {
crtsc = get_cyclecount();
if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[SND_LIMITED]++;
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_proc_time[SND_LIMITED] += (crtsc - ts_val);
}
}
@@ -21329,8 +21313,6 @@ send:
crtsc = get_cyclecount();
if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[SND_OUT_FAIL]++;
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_proc_time[SND_OUT_FAIL] += (crtsc - ts_val);
}
sched_unpin();
@@ -22348,8 +22330,6 @@ nomore:
crtsc = get_cyclecount();
if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[SND_OUT_FAIL]++;
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_proc_time[SND_OUT_FAIL] += (crtsc - ts_val);
}
sched_unpin();
@@ -22403,8 +22383,6 @@ nomore:
crtsc = get_cyclecount();
if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[SND_OUT_FAIL]++;
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_proc_time[SND_OUT_FAIL] += (crtsc - ts_val);
}
sched_unpin();
@@ -22428,8 +22406,6 @@ nomore:
crtsc = get_cyclecount();
if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[SND_OUT_FAIL]++;
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_proc_time[SND_OUT_FAIL] += (crtsc - ts_val);
}
sched_unpin();
@@ -22580,18 +22556,12 @@ skip_all_send:
if (tot_len_this_send) {
if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[SND_OUT_DATA]++;
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_proc_time[SND_OUT_DATA] += crtsc;
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[CNT_OF_MSS_OUT] += ((tot_len_this_send + segsiz - 1) /segsiz);
}
} else {
if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_cnt_counters[SND_OUT_ACK]++;
- }
- if (tp->t_flags2 & TF2_TCP_ACCOUNTING) {
tp->tcp_proc_time[SND_OUT_ACK] += crtsc;
}
}