feat(wifi): join Wi-Fi 7 networks on BE200 and BE201
This commit is contained in:
1 parent
49bf1db188
commit
5ff04c8961
23 files changed
+761
-115
No files matched your search
@@ -21,7 +21,9 @@ pub mod owned;
|
||||
pub mod power;
|
||||
pub mod regs;
|
||||
pub mod requester;
|
||||
pub use aspm::{aspm_control, disable_aspm_l1_2_link, disable_aspm_link, native as native_aspm};
|
||||
pub use aspm::{
|
||||
aspm_control, disable_aspm_l1_2_link, disable_aspm_link, link_speed, native as native_aspm,
|
||||
};
|
||||
pub use capability::{
|
||||
Capabilities, Capability, CapabilityError, ExtendedCapabilities, ExtendedCapability, Layout,
|
||||
};
|
||||
|
||||
@@ -225,6 +225,12 @@ pub fn aspm_control<C: ConfigSpace>(function: &Function<C>) -> u16 {
|
||||
link_control(function).map_or(0, |at| function.config.read16(at) & PCIE_ASPM)
|
||||
}
|
||||
|
||||
/// The Current Link Speed field of the function's PCIe Link Status: zero
|
||||
/// without a link, as `pcie_capability_read_word` reads a missing register.
|
||||
pub fn link_speed<C: ConfigSpace>(function: &Function<C>) -> u8 {
|
||||
link_control(function).map_or(0, |at| (function.config.read16(at + 2) & 0xf) as u8)
|
||||
}
|
||||
|
||||
fn upstream<C: ConfigSpace>(
|
||||
function: &Function<C>,
|
||||
functions: &[Function<C>],
|
||||
|
||||
@@ -124,6 +124,16 @@ fn a_root_bus_endpoint_disables_its_own_link_control() {
|
||||
assert!(writes.borrow().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn link_speed_reads_the_status_or_zero_without_a_link() {
|
||||
let writes = Writes::default();
|
||||
let mut endpoint = device(address(0, 8, 0), None, &writes);
|
||||
endpoint.config.words[20] = 0x0043_0000;
|
||||
assert_eq!(link_speed(&endpoint), 3);
|
||||
endpoint.config.words[16] = (1 | 9 << 4) << 16 | u32::from(CAPABILITY_PCIE);
|
||||
assert_eq!(link_speed(&endpoint), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn aspm_control_reads_the_link_or_zero_without_one() {
|
||||
let writes = Writes::default();
|
||||
|
||||
@@ -18,7 +18,7 @@ use crate::{
|
||||
station::{
|
||||
AssociationContext,
|
||||
operations::MuEdcaRecord,
|
||||
phy::{AccessCategory, He, Mode, Negotiated, Width},
|
||||
phy::{AccessCategory, Eht, He, Mode, Negotiated, Width},
|
||||
power_envelope::PowerEnvelope,
|
||||
},
|
||||
},
|
||||
@@ -406,6 +406,9 @@ const EXTENSION_NONE: u8 = 7;
|
||||
/// `IWL_HE_PKT_EXT_BPSK`.
|
||||
const EXTENSION_BPSK: u8 = 0;
|
||||
|
||||
/// `IWL_HE_PKT_EXT_4096QAM`.
|
||||
const EXTENSION_4096QAM: u8 = 6;
|
||||
|
||||
/// `iwl_mvm_he_get_ppe_val`: three bits at `position`, which may straddle a byte.
|
||||
fn threshold(ppe: &[u8], position: usize) -> u8 {
|
||||
let byte = |index: usize| u16::from(ppe.get(index).copied().unwrap_or(0));
|
||||
@@ -413,40 +416,90 @@ fn threshold(ppe: &[u8], position: usize) -> u8 {
|
||||
((pair >> (position % 8)) & 7) as u8
|
||||
}
|
||||
|
||||
/// `iwl_mvm_set_sta_pkt_ext` for an HE AP: its PPE thresholds, or else what its
|
||||
/// nominal padding implies.
|
||||
pub fn packet_extension(he: &He) -> [u8; PACKET_EXTENSION_BYTES] {
|
||||
const THRESHOLDS_PRESENT: u8 = 0x80;
|
||||
const PADDING_RESERVED: u8 = 3;
|
||||
let mut table = [EXTENSION_NONE; PACKET_EXTENSION_BYTES];
|
||||
if he.phy[6] & THRESHOLDS_PRESENT != 0 {
|
||||
let ppe = he.ppe.as_slice();
|
||||
let header = ppe.first().copied().unwrap_or(0);
|
||||
let streams = (usize::from(header & 7) + 1).min(STREAMS);
|
||||
let widths = (header >> 3) & 0xf;
|
||||
let mut position = 7;
|
||||
for stream in 0..streams {
|
||||
for width in 0..WIDTHS {
|
||||
if widths >> width & 1 == 0 {
|
||||
continue;
|
||||
}
|
||||
let at = (stream * WIDTHS + width) * 2;
|
||||
table[at + 1] = threshold(ppe, position);
|
||||
table[at] = threshold(ppe, position + 3);
|
||||
/// `iwl_mld_parse_ppe`: a table's thresholds, from `position` in `ppe`. EHT
|
||||
/// lets a width without its own keep the last width's; HE leaves it unset.
|
||||
fn parsed_thresholds(
|
||||
table: &mut [u8; PACKET_EXTENSION_BYTES],
|
||||
ppe: &[u8],
|
||||
(streams, widths): (usize, u8),
|
||||
mut position: usize,
|
||||
inherit: bool,
|
||||
) {
|
||||
for stream in 0..streams.min(STREAMS) {
|
||||
let (mut low, mut high) = (EXTENSION_NONE, EXTENSION_NONE);
|
||||
for width in 0..WIDTHS {
|
||||
if widths >> width & 1 != 0 {
|
||||
high = threshold(ppe, position);
|
||||
low = threshold(ppe, position + 3);
|
||||
position += 6;
|
||||
} else if !inherit {
|
||||
continue;
|
||||
}
|
||||
let at = (stream * WIDTHS + width) * 2;
|
||||
table[at..at + 2].copy_from_slice(&[low, high]);
|
||||
}
|
||||
return table;
|
||||
}
|
||||
let (low, high) = match he.phy[9] >> 6 {
|
||||
}
|
||||
|
||||
/// HE's own thresholds: a seven-bit header of streams and widths.
|
||||
fn he_thresholds(table: &mut [u8; PACKET_EXTENSION_BYTES], he: &He, inherit: bool) {
|
||||
let ppe = he.ppe.as_slice();
|
||||
let header = ppe.first().copied().unwrap_or(0);
|
||||
let shape = (usize::from(header & 7) + 1, (header >> 3) & 0xf);
|
||||
parsed_thresholds(table, ppe, shape, 7, inherit);
|
||||
}
|
||||
|
||||
/// `iwl_mld_set_pkt_ext_from_nominal_padding`, whose cases EHT and HE share.
|
||||
fn padded_thresholds(table: &mut [u8; PACKET_EXTENSION_BYTES], padding: u8) {
|
||||
let (low, high) = match padding {
|
||||
0 => (EXTENSION_NONE, EXTENSION_NONE),
|
||||
1 => (EXTENSION_BPSK, EXTENSION_NONE),
|
||||
2 => (EXTENSION_NONE, EXTENSION_BPSK),
|
||||
PADDING_RESERVED.. => return table,
|
||||
_ => (EXTENSION_NONE, EXTENSION_BPSK),
|
||||
};
|
||||
for pair in table.as_chunks_mut::<2>().0 {
|
||||
*pair = [low, high];
|
||||
}
|
||||
}
|
||||
|
||||
/// `iwl_mld_fill_pkt_ext` for an AP: EHT's thresholds, then HE's with the
|
||||
/// padding MCS 12 and 13 need, then what the nominal padding implies. The EHT
|
||||
/// header's nine bits name five widths; Linux reads only its first byte, which
|
||||
/// loses 320 MHz's own thresholds.
|
||||
pub fn packet_extension(he: &He, eht: Option<&Eht>) -> [u8; PACKET_EXTENSION_BYTES] {
|
||||
const EHT_THRESHOLDS: u8 = 0x08;
|
||||
const HE_THRESHOLDS: u8 = 0x80;
|
||||
const PADDING_8US: u8 = 1;
|
||||
const PADDING_RESERVED: u8 = 3;
|
||||
let mut table = [EXTENSION_NONE; PACKET_EXTENSION_BYTES];
|
||||
let Some(eht) = eht else {
|
||||
if he.phy[6] & HE_THRESHOLDS != 0 {
|
||||
he_thresholds(&mut table, he, false);
|
||||
} else if he.phy[9] >> 6 != PADDING_RESERVED {
|
||||
padded_thresholds(&mut table, he.phy[9] >> 6);
|
||||
}
|
||||
return table;
|
||||
};
|
||||
let padding = (eht.phy[5] >> 4) & 3;
|
||||
if eht.phy[5] & EHT_THRESHOLDS != 0 {
|
||||
let ppe = eht.ppe.as_slice();
|
||||
let header = u16::from_le_bytes([
|
||||
ppe.first().copied().unwrap_or(0),
|
||||
ppe.get(1).copied().unwrap_or(0),
|
||||
]);
|
||||
let shape = (usize::from(header & 0xf) + 1, ((header >> 4) & 0x1f) as u8);
|
||||
parsed_thresholds(&mut table, ppe, shape, 9, true);
|
||||
} else if he.phy[6] & HE_THRESHOLDS != 0 {
|
||||
he_thresholds(&mut table, he, true);
|
||||
for pair in table.as_chunks_mut::<2>().0 {
|
||||
if padding > PADDING_8US && pair[1] == EXTENSION_NONE {
|
||||
pair[1] = EXTENSION_4096QAM;
|
||||
} else if padding == PADDING_8US && *pair == [EXTENSION_NONE; 2] {
|
||||
pair[0] = EXTENSION_4096QAM;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
padded_thresholds(&mut table, padding);
|
||||
}
|
||||
table
|
||||
}
|
||||
|
||||
@@ -479,13 +532,17 @@ pub fn control_flags(mac: &[u8; 6]) -> u32 {
|
||||
flags
|
||||
}
|
||||
|
||||
/// `iwl_mvm_get_sta_ampdu_dens`' size: the base exponent and the HE extension,
|
||||
/// bounded by the firmware's 4 MB.
|
||||
/// `iwl_mld_fill_ampdu_size_and_dens`' size: the base exponent and the HE and
|
||||
/// EHT extensions, bounded by the firmware's 4 MB.
|
||||
pub fn ampdu_exponent(negotiated: &Negotiated) -> u8 {
|
||||
/// `STA_FLG_MAX_AGG_SIZE_4M`, 8 KB being zero.
|
||||
const LIMIT_4M: u8 = 9;
|
||||
let extension = negotiated.he.as_ref().map_or(0, |he| (he.mac[3] >> 3) & 3);
|
||||
(negotiated.peer_ampdu_base_exponent + extension).min(LIMIT_4M)
|
||||
let he = negotiated.he.as_ref().map_or(0, |he| (he.mac[3] >> 3) & 3);
|
||||
let eht = match negotiated.eht {
|
||||
Some(_) => negotiated.peer().eht().map_or(0, |eht| eht.mac[1] & 1),
|
||||
None => 0,
|
||||
};
|
||||
(negotiated.peer_ampdu_base_exponent + he + eht).min(LIMIT_4M)
|
||||
}
|
||||
|
||||
/// `iwl_mvm_mld_cfg_sta` for station 0 on link 0. `version` is the firmware's
|
||||
@@ -559,9 +616,9 @@ pub struct RateShape {
|
||||
/// Where `max_ch_width` lies.
|
||||
pub head: usize,
|
||||
/// Width classes per stream.
|
||||
classes: usize,
|
||||
pub classes: usize,
|
||||
/// One class's rate bitmap.
|
||||
rate_bytes: usize,
|
||||
pub rate_bytes: usize,
|
||||
}
|
||||
|
||||
impl RateShape {
|
||||
@@ -620,7 +677,7 @@ pub fn rate_config(
|
||||
Mode::Ht => 1,
|
||||
Mode::Vht => 2,
|
||||
Mode::He => 3,
|
||||
Mode::Eht => return None,
|
||||
Mode::Eht => 4,
|
||||
};
|
||||
out[head + 2] = antennas;
|
||||
let (ht, vht, he) = (&negotiated.ht, &negotiated.vht, &negotiated.he);
|
||||
@@ -645,10 +702,16 @@ pub fn rate_config(
|
||||
|| vht_cap & 0x10 != 0
|
||||
|| he.as_ref().is_some_and(|he| he.phy[1] & 0x20 != 0);
|
||||
// Dual carrier modulation needs the peer to receive it; every admitted
|
||||
// device can send it.
|
||||
// device can send it. The extra LTF needs both ends.
|
||||
let dcm = he.as_ref().is_some_and(|he| he.phy[3] & 0x18 != 0);
|
||||
let flags =
|
||||
u16::from(stbc && antennas.count_ones() > 1) | u16::from(ldpc) << 1 | u16::from(dcm) << 3;
|
||||
let extra_ltf = negotiated.mode == Mode::Eht
|
||||
&& [negotiated.local(), negotiated.peer()]
|
||||
.iter()
|
||||
.all(|side| side.eht().is_some_and(|eht| eht.phy[5] & 0x40 != 0));
|
||||
let flags = u16::from(stbc && antennas.count_ones() > 1)
|
||||
| u16::from(ldpc) << 1
|
||||
| u16::from(dcm) << 3
|
||||
| u16::from(extra_ltf) << 6;
|
||||
half(&mut out, head + 4, flags);
|
||||
half(
|
||||
&mut out,
|
||||
@@ -661,7 +724,7 @@ pub fn rate_config(
|
||||
half(&mut out, at, bits);
|
||||
};
|
||||
match negotiated.mode {
|
||||
Mode::Legacy | Mode::Eht => {}
|
||||
Mode::Legacy => {}
|
||||
Mode::Ht => {
|
||||
let mcs = ht.as_ref()?.peer_rx_mcs;
|
||||
set(0, 0, u16::from(mcs[0]));
|
||||
@@ -690,6 +753,26 @@ pub fn rate_config(
|
||||
}
|
||||
}
|
||||
}
|
||||
Mode::Eht => {
|
||||
// `iwl_mld_fill_eht_rates`: 80 MHz's class always, then those the
|
||||
// width reaches. A range's low nibble is what the device sends
|
||||
// and the peer receives.
|
||||
const RANGES: [u16; 4] = [0xff, 0x300, 0xc00, 0x3000];
|
||||
let common = &negotiated.eht.as_ref()?.common;
|
||||
let classes = usize::from(width.max(2) - 1).min(shape.classes);
|
||||
let maps = [common.bw80, common.bw160, common.bw320];
|
||||
for (class, map) in maps.into_iter().enumerate().take(classes) {
|
||||
let Some(map) = map else { continue };
|
||||
for nss in 0..2 {
|
||||
let bits = RANGES
|
||||
.into_iter()
|
||||
.zip(map)
|
||||
.filter(|&(_, streams)| usize::from(streams & 15) > nss)
|
||||
.fold(0, |bits, (range, _)| bits | range);
|
||||
set(nss, class, bits);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(out)
|
||||
}
|
||||
@@ -1060,7 +1143,7 @@ mod tests {
|
||||
let mut phy = [0; 11];
|
||||
phy[6] = 0x80;
|
||||
let capabilities = ap([0; 6], phy, &[0x61, 0x1c, 0xc7, 0x71]);
|
||||
let table = packet_extension(capabilities.he().unwrap());
|
||||
let table = packet_extension(capabilities.he().unwrap(), None);
|
||||
assert_eq!(table[..4], [7; 4], "narrower widths stay unset");
|
||||
assert_eq!(table[4..8], [7, 0, 7, 0]);
|
||||
assert_eq!(table[8..10], [7, 7]);
|
||||
@@ -1073,7 +1156,7 @@ mod tests {
|
||||
let padded = |value: u8| {
|
||||
let mut phy = [0; 11];
|
||||
phy[9] = value << 6;
|
||||
packet_extension(ap([0; 6], phy, &[]).he().unwrap())
|
||||
packet_extension(ap([0; 6], phy, &[]).he().unwrap(), None)
|
||||
};
|
||||
assert_eq!(padded(0), [7; 20]);
|
||||
assert_eq!(padded(1)[..2], [EXTENSION_BPSK, EXTENSION_NONE]);
|
||||
@@ -1081,6 +1164,63 @@ mod tests {
|
||||
assert_eq!(padded(3), [7; 20], "reserved");
|
||||
}
|
||||
|
||||
fn eht(phy5: u8, ppe: &[u8]) -> Eht {
|
||||
let mut elements = alloc::vec![1, 1, 0x8c];
|
||||
elements.extend([255, 22, 35]);
|
||||
elements.extend([0; 17]);
|
||||
elements.extend([0xfa, 0xff, 0xfa, 0xff]);
|
||||
let mut element = alloc::vec![108, 0, 0];
|
||||
element.extend([0, 0, 0, 0, 0, phy5, 0, 0, 0]);
|
||||
element.extend([0x22; 3]);
|
||||
element.extend(ppe);
|
||||
elements.extend([255, element.len() as u8]);
|
||||
elements.extend(element);
|
||||
crate::wifi::station::phy::Capabilities::parse(
|
||||
Band::Ghz5,
|
||||
crate::wifi::station::phy::Role::AccessPoint,
|
||||
&elements,
|
||||
)
|
||||
.unwrap()
|
||||
.eht()
|
||||
.unwrap()
|
||||
.clone()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn eht_thresholds_pass_to_the_widths_without_their_own() {
|
||||
// One stream, widths 0 and 2 of the nine-bit header, then 320 MHz's
|
||||
// bit from its second byte. Each pair reads PPET16 then PPET8.
|
||||
let header: u16 = 0x150;
|
||||
let mut bits: u64 = u64::from(header);
|
||||
for (at, value) in [(9, 1), (12, 2), (15, 3), (18, 4), (21, 5), (24, 6)] {
|
||||
bits |= value << at;
|
||||
}
|
||||
let ppe = &bits.to_le_bytes()[..4];
|
||||
let he = ap([0; 6], [0; 11], &[]);
|
||||
let table = packet_extension(he.he().unwrap(), Some(&eht(0x08, ppe)));
|
||||
assert_eq!(table[..2], [2, 1]);
|
||||
assert_eq!(table[2..4], [2, 1], "inherited");
|
||||
assert_eq!(table[4..6], [4, 3]);
|
||||
assert_eq!(table[6..8], [4, 3], "inherited");
|
||||
assert_eq!(table[8..10], [6, 5], "320 MHz's own");
|
||||
assert_eq!(table[10..], [7; 10], "a second stream stays unset");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn eht_padding_tops_up_he_thresholds_and_stands_in_for_absent_ones() {
|
||||
let mut phy = [0; 11];
|
||||
phy[6] = 0x80;
|
||||
let he = ap([0; 6], phy, &[0x61, 0x1c, 0xc7, 0x71]);
|
||||
let table = packet_extension(he.he().unwrap(), Some(&eht(2 << 4, &[])));
|
||||
assert_eq!(table[..2], [7, 6], "no threshold of its own");
|
||||
assert_eq!(table[4..6], [7, 0], "kept");
|
||||
let table = packet_extension(he.he().unwrap(), Some(&eht(1 << 4, &[])));
|
||||
assert_eq!(table[..2], [6, 7]);
|
||||
let plain = ap([0; 6], [0; 11], &[]);
|
||||
let table = packet_extension(plain.he().unwrap(), Some(&eht(3 << 4, &[])));
|
||||
assert_eq!(table[18..], [EXTENSION_NONE, EXTENSION_BPSK]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn control_flags_follow_the_peer_mac_capabilities() {
|
||||
assert_eq!(control_flags(&[0; 6]), 0);
|
||||
|
||||
@@ -35,6 +35,8 @@ pub struct Pci {
|
||||
pub subsystem_vendor: u16,
|
||||
pub subsystem_device: u16,
|
||||
pub revision: u8,
|
||||
/// PCI_EXP_LNKSTA's current speed.
|
||||
pub link_speed: u8,
|
||||
}
|
||||
|
||||
/// Why the function did not reach ROM boot.
|
||||
@@ -116,6 +118,7 @@ pub unsafe fn attach<Q: BootIo, B: BiosIo>(
|
||||
subsystem_vendor: pci.subsystem_vendor,
|
||||
subsystem_device: pci.subsystem_device,
|
||||
pci_revision: pci.revision,
|
||||
link_speed: pci.link_speed,
|
||||
hardware_revision,
|
||||
radio_id,
|
||||
silicon,
|
||||
|
||||
@@ -321,6 +321,8 @@ pub struct RomBoot<'a, Q: BootIo> {
|
||||
domain: Arc<dyn DmaDomain>,
|
||||
platform: Option<PlatformPhase<'a>>,
|
||||
alive_sku: Option<[u32; 3]>,
|
||||
/// `step_urm`, which the STEP says once firmware runs.
|
||||
step_urm: bool,
|
||||
sb_configuration: Option<u32>,
|
||||
product_reset_policy: Option<ProductResetPolicy>,
|
||||
context: Chunk,
|
||||
@@ -349,6 +351,11 @@ struct Ax210Memory<'a> {
|
||||
}
|
||||
/// Compatibility name for the original AX200 `start` constructor. New family
|
||||
/// consumers can name `RomBoot` and choose its explicit family constructor.
|
||||
/// `CNVI_PMU_STEP_FLOW_BZ`, `CNVI_PMU_STEP_FLOW_SC` and what `step_urm` reads.
|
||||
const STEP_FLOW_BZ: u32 = 0xa2_d588;
|
||||
const STEP_FLOW_SC: u32 = 0xa2_d688;
|
||||
const STEP_FORCE_URM: u32 = 1 << 2;
|
||||
|
||||
pub type Ax200Boot<'a, Q> = RomBoot<'a, Q>;
|
||||
impl<'a, Q: BootIo> RomBoot<'a, Q> {
|
||||
/// The device family this boot runs.
|
||||
@@ -359,6 +366,10 @@ impl<'a, Q: BootIo> RomBoot<'a, Q> {
|
||||
pub fn radio(&self) -> super::identity::Rf {
|
||||
self.profile.radio()
|
||||
}
|
||||
/// What limits a radio with EHT, from ALIVE on.
|
||||
pub fn eht_limits(&self) -> Option<super::identity::EhtLimits> {
|
||||
self.profile.eht_limits(self.alive_sku?, self.step_urm)
|
||||
}
|
||||
/// Start the standalone AX200 context protocol.
|
||||
/// # Safety
|
||||
/// PCI Memory Space is enabled and bus mastering has been enabled only
|
||||
@@ -569,6 +580,7 @@ impl<'a, Q: BootIo> RomBoot<'a, Q> {
|
||||
domain,
|
||||
platform: None,
|
||||
alive_sku: None,
|
||||
step_urm: false,
|
||||
sb_configuration: None,
|
||||
product_reset_policy,
|
||||
context,
|
||||
@@ -916,6 +928,11 @@ impl<'a, Q: BootIo> RomBoot<'a, Q> {
|
||||
}
|
||||
self.alive_sku = Some(report.sku);
|
||||
self.state = State::Alive;
|
||||
self.step_urm = match self.profile.family() {
|
||||
Family::Ax200 | Family::Ax210 => false,
|
||||
Family::Bz => self.prph_read(STEP_FLOW_BZ)? & STEP_FORCE_URM != 0,
|
||||
Family::Sc => self.prph_read(STEP_FLOW_SC)? & STEP_FORCE_URM != 0,
|
||||
};
|
||||
observed = Some(report);
|
||||
}
|
||||
if observed.is_some() {
|
||||
|
||||
@@ -285,6 +285,20 @@ impl<Q: BootIo, B: BiosIo, O: CountryIo + OsPolicy> Ax200Scan<'_, Q, B, O> {
|
||||
let information = &self.mac.initialized_nvm().information;
|
||||
(information.tx_chains, information.rx_chains)
|
||||
}
|
||||
/// What limits a radio with EHT.
|
||||
pub fn eht_limits(&self) -> Option<crate::wifi::intel::identity::EhtLimits> {
|
||||
self.mac
|
||||
.country
|
||||
.board
|
||||
.scan
|
||||
.mcc
|
||||
.setup
|
||||
.lari
|
||||
.radio
|
||||
.initialized
|
||||
.boot
|
||||
.eht_limits()
|
||||
}
|
||||
pub fn command_bytes(&self) -> Option<&[u8]> {
|
||||
self.command_bytes.as_deref()
|
||||
}
|
||||
|
||||
@@ -164,6 +164,7 @@ impl<'a, Q: BootIo, B: BiosIo, O: CountryIo + OsPolicy> Ax200Phy<'a, Q, B, O> {
|
||||
pub(in crate::wifi::intel::boot) fn changed(
|
||||
&mut self,
|
||||
definition: &ChannelDefinition,
|
||||
wide_ofdma: Option<&ChannelDefinition>,
|
||||
) -> Option<Vec<PhyCommand>> {
|
||||
let firmware = &self.boot().firmware;
|
||||
let ultra_high_band = firmware.supports_capability(48);
|
||||
@@ -171,7 +172,7 @@ impl<'a, Q: BootIo, B: BiosIo, O: CountryIo + OsPolicy> Ax200Phy<'a, Q, B, O> {
|
||||
.command_version(PHY.wire().group, PHY.opcode)?
|
||||
.command_version;
|
||||
let add = self.commands.first()?;
|
||||
let modified = modified(add, definition, version, ultra_high_band)?;
|
||||
let modified = modified(add, definition, wide_ofdma, version, ultra_high_band)?;
|
||||
let chains = self.commands.get(1).cloned();
|
||||
Some(core::iter::once(modified).chain(chains).collect())
|
||||
}
|
||||
@@ -524,20 +525,26 @@ fn control_position(offset_mhz: i32) -> u8 {
|
||||
|
||||
/// `iwl_mvm_phy_ctxt_cmd_data`: `add` moved to `definition`'s width. 80+80 MHz
|
||||
/// has no firmware width and no Intel capability offers it.
|
||||
/// `iwl_mld_nl80211_width_to_fw`.
|
||||
fn width_code(width: Width) -> Option<u8> {
|
||||
match width {
|
||||
Width::Mhz20 => Some(0),
|
||||
Width::Mhz40 => Some(1),
|
||||
Width::Mhz80 => Some(2),
|
||||
Width::Mhz160 => Some(3),
|
||||
Width::Mhz320 => Some(4),
|
||||
Width::Mhz80P80 => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn modified(
|
||||
add: &PhyCommand,
|
||||
definition: &ChannelDefinition,
|
||||
wide_ofdma: Option<&ChannelDefinition>,
|
||||
version: u8,
|
||||
ultra_high_band: bool,
|
||||
) -> Option<PhyCommand> {
|
||||
let width = match definition.width {
|
||||
Width::Mhz20 => 0,
|
||||
Width::Mhz40 => 1,
|
||||
Width::Mhz80 => 2,
|
||||
Width::Mhz160 => 3,
|
||||
Width::Mhz320 => 4,
|
||||
Width::Mhz80P80 => return None,
|
||||
};
|
||||
let width = width_code(definition.width)?;
|
||||
let mut bytes = add.bytes;
|
||||
bytes[4..8].copy_from_slice(&2u32.to_le_bytes());
|
||||
let at = if ultra_high_band { 13 } else { 10 };
|
||||
@@ -549,6 +556,10 @@ fn modified(
|
||||
}
|
||||
if version >= SECONDARY_CONTROL {
|
||||
bytes[28] = position ^ CONTROL_ABOVE;
|
||||
if let Some(ap) = wide_ofdma {
|
||||
bytes[20] = width_code(ap.width)?;
|
||||
bytes[21] = control_position(ap.control_offset_mhz());
|
||||
}
|
||||
}
|
||||
Some(PhyCommand {
|
||||
kind: PhyCommandKind::Modify,
|
||||
@@ -600,7 +611,7 @@ mod tests {
|
||||
center2_mhz: None,
|
||||
punctured: 0,
|
||||
};
|
||||
let command = modified(&commands[0], &definition, 4, true).unwrap();
|
||||
let command = modified(&commands[0], &definition, None, 4, true).unwrap();
|
||||
assert_eq!(command.kind, PhyCommandKind::Modify);
|
||||
assert_eq!(command.bytes[4], 2);
|
||||
assert_eq!(command.bytes[8], 36);
|
||||
@@ -608,7 +619,9 @@ mod tests {
|
||||
assert_eq!(command.bytes[16..], commands[0].bytes[16..]);
|
||||
// Without the capability a channel info is four bytes shorter.
|
||||
assert_eq!(
|
||||
modified(&commands[0], &definition, 4, false).unwrap().bytes[10..12],
|
||||
modified(&commands[0], &definition, None, 4, false)
|
||||
.unwrap()
|
||||
.bytes[10..12],
|
||||
[2, 1]
|
||||
);
|
||||
let unsupported = ChannelDefinition {
|
||||
@@ -616,7 +629,7 @@ mod tests {
|
||||
center2_mhz: Some(5530),
|
||||
..definition
|
||||
};
|
||||
assert!(modified(&commands[0], &unsupported, 4, true).is_none());
|
||||
assert!(modified(&commands[0], &unsupported, None, 4, true).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -639,7 +652,7 @@ mod tests {
|
||||
center2_mhz: None,
|
||||
punctured: 4,
|
||||
};
|
||||
let command = modified(&commands[0], &definition, 6, true).unwrap();
|
||||
let command = modified(&commands[0], &definition, None, 6, true).unwrap();
|
||||
assert_eq!(command.bytes[22..24], [4, 0]);
|
||||
assert_eq!(command.bytes[28], 5);
|
||||
}
|
||||
|
||||
+11
-2
@@ -46,8 +46,17 @@ impl<'a, Q: BootIo, B: BiosIo, O: CountryIo + OsPolicy> Ax200ManagementQueue<'a,
|
||||
|
||||
/// `iwl_mvm_phy_ctxt_changed`: the commands that move the PHY context to
|
||||
/// the channel `definition` association negotiated.
|
||||
pub fn phy_changed(&mut self, definition: &ChannelDefinition) -> Option<Vec<(Id, Vec<u8>)>> {
|
||||
let commands = self.peer().binding.power.phy.changed(definition)?;
|
||||
pub fn phy_changed(
|
||||
&mut self,
|
||||
definition: &ChannelDefinition,
|
||||
wide_ofdma: Option<&ChannelDefinition>,
|
||||
) -> Option<Vec<(Id, Vec<u8>)>> {
|
||||
let commands = self
|
||||
.peer()
|
||||
.binding
|
||||
.power
|
||||
.phy
|
||||
.changed(definition, wide_ofdma)?;
|
||||
Some(
|
||||
commands
|
||||
.iter()
|
||||
|
||||
@@ -6,6 +6,7 @@ use super::*;
|
||||
|
||||
pub(super) fn profile() -> Profile {
|
||||
Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
silicon: Default::default(),
|
||||
vendor: 0x8086,
|
||||
device: 0x2723,
|
||||
|
||||
@@ -275,6 +275,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
let profile = Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
silicon: Default::default(),
|
||||
vendor: 0x8086,
|
||||
device: 0x2725,
|
||||
|
||||
@@ -184,6 +184,7 @@ mod tests {
|
||||
|
||||
fn profile(device: u16) -> Profile {
|
||||
Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
silicon: Default::default(),
|
||||
vendor: 0x8086,
|
||||
device,
|
||||
|
||||
@@ -9,6 +9,7 @@ use sha2::{Digest, Sha256};
|
||||
|
||||
fn profile() -> Profile {
|
||||
Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
silicon: Default::default(),
|
||||
vendor: 0x8086,
|
||||
device: 0x2725,
|
||||
|
||||
@@ -35,6 +35,9 @@ const BZ_SUBDEVICES: [u16; 35] = [
|
||||
0x1791, 0x1792, 0x4090, 0x40c4, 0x40e0, 0x4110, 0x4314, 0x1775, 0x1776, 0x1735, 0x1736,
|
||||
];
|
||||
const BZ_LISTED: u16 = 0xa840;
|
||||
/// The BE1730x, the one Killer product `iwl_rf_fm_160mhz` holds to 160 MHz.
|
||||
const KILLER_1730: u16 = 0x1730;
|
||||
const KILLER_1731: u16 = 0x1731;
|
||||
const RF_HR2: u32 = 0x10a;
|
||||
const RF_GF: u32 = 0x10d;
|
||||
const RF_FM: u32 = 0x112;
|
||||
@@ -46,6 +49,10 @@ const CRF_GF: u32 = 0x410;
|
||||
const CRF_FM: u32 = 0x910;
|
||||
/// CNVI_AUX_MISC_CHIP_PROD_TYPE_BZ_U.
|
||||
const BZ_U: u32 = 0x930;
|
||||
/// `PCI_EXP_LNKSTA_CLS_8_0GB`.
|
||||
const SPEED_8GT: u8 = 3;
|
||||
/// `IWL_PNVM_REDUCED_CAP_BIT` of ALIVE's first SKU word.
|
||||
const REDUCED_CAPABILITY: u32 = 1 << 25;
|
||||
/// `IWL_SUBDEVICE_BW_LIM`, which makes an integrated HR2 an 80 MHz AX203.
|
||||
const BANDWIDTH_LIMITED: u16 = 0x0200;
|
||||
/// The subdevice of AX231, whose radio configuration is not GF's.
|
||||
@@ -63,6 +70,26 @@ pub enum Rf {
|
||||
Fm,
|
||||
}
|
||||
|
||||
/// What `iwl_nvm_fixup_sband_iftd` reads of a device whose radio has EHT.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub struct EhtLimits {
|
||||
/// `bw_limit` of `iwl_rf_fm_160mhz`.
|
||||
pub stops_at_160: bool,
|
||||
/// `reduced_cap_sku`, which also drops 320 MHz and MCS 12 and 13.
|
||||
pub reduced: bool,
|
||||
/// `step_urm`: the STEP has no MCS above 9 at 320 MHz.
|
||||
pub urm: bool,
|
||||
/// `slow_pcie`: a discrete link under 8 GT/s cannot carry two streams of
|
||||
/// MCS above 9 at 320 MHz.
|
||||
pub slow_bus: bool,
|
||||
}
|
||||
|
||||
impl EhtLimits {
|
||||
pub const fn reaches_320(self) -> bool {
|
||||
!self.stops_at_160 && !self.reduced
|
||||
}
|
||||
}
|
||||
|
||||
/// What a device's `iwl_mac_cfg` says of the platform around its MAC.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct Platform {
|
||||
@@ -199,6 +226,8 @@ pub struct Observed {
|
||||
pub subsystem_vendor: u16,
|
||||
pub subsystem_device: u16,
|
||||
pub pci_revision: u8,
|
||||
/// PCI_EXP_LNKSTA's current speed, or zero without PCI Express.
|
||||
pub link_speed: u8,
|
||||
/// CSR_HW_REV and CSR_HW_RF_ID values, before normalization.
|
||||
pub hardware_revision: u32,
|
||||
pub radio_id: u32,
|
||||
@@ -227,6 +256,15 @@ pub struct Profile {
|
||||
pnvm: Option<&'static str>,
|
||||
}
|
||||
|
||||
/// The Killer subdevices pcie/drv.c lists after BE202's bandwidth limit, which
|
||||
/// have that subdevice bit and are their own products.
|
||||
const fn killer(device: u16, subdevice: u16) -> bool {
|
||||
matches!(
|
||||
subdevice,
|
||||
KILLER_1730 | KILLER_1731 | 0x1771 | 0x1772 | 0x1791 | 0x1792
|
||||
) || (device == BE200 && matches!(subdevice, 0x1773 | 0x1774))
|
||||
}
|
||||
|
||||
/// CSR_HW_RF_ID, or `map_crf_id`'s reading of the silicon on a blank OTP.
|
||||
fn radio_id(observed: Observed) -> Result<u32, IdentityError> {
|
||||
if observed.radio_id & 0x00ff_f000 != 0 {
|
||||
@@ -278,7 +316,7 @@ impl Profile {
|
||||
let another_product = match radio {
|
||||
RF_HR2 => platform.integrated && limited,
|
||||
RF_GF => platform.integrated && observed.subsystem_device == AX231,
|
||||
_ => limited,
|
||||
_ => limited && !killer(observed.device, observed.subsystem_device),
|
||||
};
|
||||
if !fitted || another_product || radio_id & CDB != 0 {
|
||||
// A CDB radio chooses a distinct gf4 image or is BE401, and AX203,
|
||||
@@ -332,6 +370,16 @@ impl Profile {
|
||||
pub fn radio(&self) -> Rf {
|
||||
self.radio
|
||||
}
|
||||
/// A radio with EHT's limits. `sku` is ALIVE's, whose word Linux reads
|
||||
/// while matching a PNVM section, and `urm` is the STEP's state.
|
||||
pub fn eht_limits(&self, sku: [u32; 3], urm: bool) -> Option<EhtLimits> {
|
||||
(self.radio == Rf::Fm).then_some(EhtLimits {
|
||||
stops_at_160: matches!(self.observed.subsystem_device, KILLER_1730 | KILLER_1731),
|
||||
reduced: sku[0] & REDUCED_CAPABILITY != 0,
|
||||
urm,
|
||||
slow_bus: !self.platform.integrated && self.observed.link_speed < SPEED_8GT,
|
||||
})
|
||||
}
|
||||
/// CSR_HW_REV with the step `get_crf_id` found, as firmware is told it.
|
||||
pub fn revision(&self) -> u32 {
|
||||
self.revision
|
||||
@@ -464,6 +512,7 @@ mod tests {
|
||||
|
||||
fn observed(device: u16) -> Observed {
|
||||
Observed {
|
||||
link_speed: 3,
|
||||
vendor: INTEL,
|
||||
device,
|
||||
subsystem_vendor: INTEL,
|
||||
@@ -679,6 +728,50 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn killer_subdevices_are_their_own_products_despite_the_limit_bit() {
|
||||
let radio = RF_FM << 12 | STEP_C << 8;
|
||||
let be200 = |subsystem_device| Observed {
|
||||
radio_id: radio,
|
||||
subsystem_device,
|
||||
..integrated(BE200, 0x472, RF_FM, 0x0020)
|
||||
};
|
||||
for subdevice in [0x1771, 0x1772, 0x1773, 0x1774, 0x1791, 0x1792] {
|
||||
let limits = Profile::select(be200(subdevice))
|
||||
.unwrap()
|
||||
.eht_limits([0; 3], false)
|
||||
.unwrap();
|
||||
assert!(limits.reaches_320(), "{subdevice:x}");
|
||||
}
|
||||
for subdevice in [KILLER_1730, KILLER_1731] {
|
||||
let profile = Profile::select(be200(subdevice)).unwrap();
|
||||
assert!(profile.eht_limits([0; 3], false).unwrap().stops_at_160);
|
||||
}
|
||||
assert!(Profile::select(be200(0x1775)).is_err(), "named BE202");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_wifi_7_device_reports_what_limits_it() {
|
||||
let radio = RF_FM << 12 | STEP_C << 8;
|
||||
let slow = Observed {
|
||||
radio_id: radio,
|
||||
link_speed: 2,
|
||||
..integrated(BE200, 0x472, RF_FM, 0x0020)
|
||||
};
|
||||
let profile = Profile::select(slow).unwrap();
|
||||
let limits = profile.eht_limits([1 << 25, 0, 0], true).unwrap();
|
||||
assert!(limits.reduced && limits.urm);
|
||||
assert!(limits.slow_bus, "a discrete link at 5 GT/s");
|
||||
let fast = Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
..slow
|
||||
})
|
||||
.unwrap();
|
||||
assert!(!fast.eht_limits([0; 3], false).unwrap().slow_bus);
|
||||
let wifi_6 = Profile::select(observed(AX210)).unwrap();
|
||||
assert_eq!(wifi_6.eht_limits([0; 3], false), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_blank_otp_names_its_radio_through_the_silicon() {
|
||||
let mut blank = integrated(0x06f0, 0x332, 0, 0x0070);
|
||||
|
||||
@@ -183,6 +183,8 @@ pub struct Wifi<Q: BootIo, B: BiosIo> {
|
||||
chains: (u32, u32),
|
||||
family: Family,
|
||||
radio: super::identity::Rf,
|
||||
/// What limits a radio with EHT, once firmware is up.
|
||||
eht: Option<super::identity::EhtLimits>,
|
||||
save_power: bool,
|
||||
address: Mac,
|
||||
error: Option<Error>,
|
||||
@@ -234,6 +236,7 @@ impl<Q: BootIo, B: BiosIo> Wifi<Q, B> {
|
||||
let wifi = Self {
|
||||
family: boot.family(),
|
||||
radio: boot.radio(),
|
||||
eht: None,
|
||||
stage: Stage::Rom(Box::new(boot)),
|
||||
firmware: inputs.firmware,
|
||||
observations: inputs.observations,
|
||||
@@ -484,6 +487,7 @@ impl<Q: BootIo, B: BiosIo> Wifi<Q, B> {
|
||||
Ok(mut scan) => {
|
||||
self.client.channels = scan.regulated_channels();
|
||||
self.chains = scan.chains();
|
||||
self.eht = scan.eht_limits();
|
||||
Ok(Stage::Scan(Box::new(scan)))
|
||||
}
|
||||
Err(mac) => Err((Error::Refused("scan"), mac as Box<dyn Any>)),
|
||||
|
||||
@@ -15,7 +15,7 @@ use super::*;
|
||||
use crate::wifi::{
|
||||
Channel,
|
||||
connection::keeper::{self, Advertisement, Peer, Radio, Stage as Standing},
|
||||
frame::{MAX_AMPDU_BUF_HE, Mpdu},
|
||||
frame::{MAX_AMPDU_BUF_EHT, Mpdu},
|
||||
intel::{
|
||||
association::{self as commands, LinkHe, LinkState, MacState, PeerHe, PeerState},
|
||||
command,
|
||||
@@ -55,7 +55,9 @@ use alloc::collections::VecDeque;
|
||||
|
||||
mod he;
|
||||
mod reception;
|
||||
use super::super::identity::EhtLimits;
|
||||
use reception::{MAX_SESSIONS, Parent, Reception};
|
||||
mod eht;
|
||||
|
||||
type Queue<Q, B> = Ax200ManagementQueue<'static, Q, B, Regulatory>;
|
||||
|
||||
@@ -196,6 +198,9 @@ pub struct ManagementKey {
|
||||
/// The association's state beside the kept chain.
|
||||
/// `IEEE80211_SCAN_RESULT_EXPIRE`.
|
||||
const BSS_EXPIRY_US: u64 = 30_000_000;
|
||||
/// `max_rx_aggregation_subframes`, half of what EHT names until Linux takes
|
||||
/// the full window. A session's mode bounds it further.
|
||||
const RECEIVE_WINDOW: u16 = MAX_AMPDU_BUF_EHT / 2;
|
||||
|
||||
/// A BSS and when it was last heard, a `cfg80211_internal_bss`.
|
||||
pub(super) struct Heard {
|
||||
@@ -521,7 +526,7 @@ impl<Q: BootIo, B: BiosIo> Wifi<Q, B> {
|
||||
let Some(bss) = self.selected.as_ref().map(|selected| &selected.bss) else {
|
||||
return;
|
||||
};
|
||||
let wide = self.wide(bss.channel.band);
|
||||
let widest = self.widest(bss.channel.band);
|
||||
let flags = self
|
||||
.client
|
||||
.channels
|
||||
@@ -542,15 +547,13 @@ impl<Q: BootIo, B: BiosIo> Wifi<Q, B> {
|
||||
return;
|
||||
};
|
||||
let mut envelope = PowerEnvelope::parse(&bss.elements);
|
||||
match operations.channel(bss.channel, phy::Mode::He, None) {
|
||||
Ok(ap) => {
|
||||
let widest = if wide {
|
||||
phy::Width::Mhz160
|
||||
} else {
|
||||
phy::Width::Mhz80
|
||||
};
|
||||
envelope.fit(&ap, &ap.narrowed_to(widest));
|
||||
}
|
||||
let ap = operations
|
||||
.channel(bss.channel, phy::Mode::Eht, None)
|
||||
.ok()
|
||||
.filter(|_| self.eht.is_some())
|
||||
.map_or_else(|| operations.channel(bss.channel, phy::Mode::He, None), Ok);
|
||||
match ap {
|
||||
Ok(ap) => envelope.fit(&ap, &ap.narrowed_to(widest)),
|
||||
Err(_) => envelope = PowerEnvelope::none(),
|
||||
}
|
||||
let bytes = commands::power_constraints(ap_type, &envelope);
|
||||
@@ -595,11 +598,26 @@ impl<Q: BootIo, B: BiosIo> Wifi<Q, B> {
|
||||
let he = negotiated.he.is_some();
|
||||
let antennas = queue.antennas();
|
||||
let definition = context.definition();
|
||||
let phy = if definition.width == phy::Width::Mhz20 {
|
||||
let eht = negotiated.eht.is_some();
|
||||
// `ieee80211_set_chanreq_ap`: wider OFDMA follows the AP's own channel.
|
||||
let wide_ofdma = eht
|
||||
.then(|| {
|
||||
let vht = negotiated
|
||||
.local()
|
||||
.vht()
|
||||
.zip(negotiated.peer().vht())
|
||||
.map(|(own, ap)| (own.capability, ap.capability));
|
||||
context
|
||||
.operations()
|
||||
.channel(bss.channel, phy::Mode::Eht, vht)
|
||||
.ok()
|
||||
})
|
||||
.flatten();
|
||||
let phy = if definition.width == phy::Width::Mhz20 && !eht {
|
||||
Vec::new()
|
||||
} else {
|
||||
queue
|
||||
.phy_changed(&definition)
|
||||
.phy_changed(&definition, wide_ofdma.as_ref())
|
||||
.ok_or(Error::Refused("channel width"))?
|
||||
};
|
||||
let firmware = queue.firmware();
|
||||
@@ -621,7 +639,7 @@ impl<Q: BootIo, B: BiosIo> Wifi<Q, B> {
|
||||
let mac = MacState {
|
||||
address: local,
|
||||
he,
|
||||
eht: false,
|
||||
eht,
|
||||
aid: None,
|
||||
high_priority,
|
||||
};
|
||||
@@ -776,9 +794,8 @@ impl<Q: BootIo, B: BiosIo> Wifi<Q, B> {
|
||||
.map_err(Error::Station)?;
|
||||
if !queue.firmware().supports_capability(BLOCK_ACK_ALLOCATION) {
|
||||
client.unsupported("receive Block Ack on firmware without session allocation");
|
||||
} else if let Err(ba::Error::Station(_) | ba::Error::Stale) = client
|
||||
.station
|
||||
.configure_rx_block_ack(MAX_AMPDU_BUF_HE, true)
|
||||
} else if let Err(ba::Error::Station(_) | ba::Error::Stale) =
|
||||
client.station.configure_rx_block_ack(RECEIVE_WINDOW, true)
|
||||
{
|
||||
client.unsupported("receive Block Ack on this association");
|
||||
}
|
||||
@@ -1478,6 +1495,13 @@ fn ap_he(context: &AssociationContext) -> Option<&phy::He> {
|
||||
negotiated.peer().he()
|
||||
}
|
||||
|
||||
/// The AP's EHT capabilities, where EHT was negotiated.
|
||||
fn ap_eht(context: &AssociationContext) -> Option<&phy::Eht> {
|
||||
let negotiated = context.negotiated();
|
||||
negotiated.eht.as_ref()?;
|
||||
negotiated.peer().eht()
|
||||
}
|
||||
|
||||
/// `ieee80211_assoc_config_link`'s HE half, for a link.
|
||||
fn link_he(context: &AssociationContext) -> Option<LinkHe> {
|
||||
let he = ap_he(context)?;
|
||||
@@ -1500,23 +1524,28 @@ fn peer_he(context: &AssociationContext) -> Option<PeerHe> {
|
||||
Some(PeerHe {
|
||||
ack_enabled: he.mac[2] & ACK_ENABLED != 0,
|
||||
random_access: context.operations().uora.is_some(),
|
||||
packet_extension: commands::packet_extension(he),
|
||||
packet_extension: commands::packet_extension(he, ap_eht(context)),
|
||||
control: commands::control_flags(&he.mac),
|
||||
})
|
||||
}
|
||||
|
||||
/// What a station's capability elements read of the device.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
struct Device {
|
||||
family: Family,
|
||||
radio: Rf,
|
||||
/// The transmit and receive antennas.
|
||||
chains: (u32, u32),
|
||||
/// A radio with EHT's limits.
|
||||
eht: Option<EhtLimits>,
|
||||
}
|
||||
|
||||
/// `iwl_init_ht_hw_capab`, `iwl_init_vht_hw_capab` and mac80211's SMPS-off
|
||||
/// HT capabilities for a device of `tx`, `rx` chains, as an association names
|
||||
/// them.
|
||||
fn capability_elements(
|
||||
band: Band,
|
||||
family: Family,
|
||||
radio: Rf,
|
||||
chains: (u32, u32),
|
||||
wide: bool,
|
||||
) -> Vec<u8> {
|
||||
let mut elements = probe_elements(band, family, radio, chains, wide);
|
||||
if family == Family::Ax200 {
|
||||
fn capability_elements(band: Band, device: Device, widest: phy::Width) -> Vec<u8> {
|
||||
let mut elements = probe_elements(band, device, widest);
|
||||
if device.family == Family::Ax200 {
|
||||
// `iwl_vendor_caps`: Intel's capabilities, with improved HE feedback.
|
||||
elements.extend_from_slice(&[221, 6, 0x00, 0x17, 0x35, 8, 1, 0]);
|
||||
}
|
||||
@@ -1526,13 +1555,15 @@ fn capability_elements(
|
||||
}
|
||||
|
||||
/// The rates and capabilities a probe names, `ieee80211_build_preq_ies_band`.
|
||||
fn probe_elements(
|
||||
band: Band,
|
||||
family: Family,
|
||||
radio: Rf,
|
||||
chains: (u32, u32),
|
||||
wide: bool,
|
||||
) -> Vec<u8> {
|
||||
fn probe_elements(band: Band, device: Device, widest: phy::Width) -> Vec<u8> {
|
||||
let Device {
|
||||
family,
|
||||
radio,
|
||||
chains,
|
||||
eht,
|
||||
} = device;
|
||||
let wide = widest != phy::Width::Mhz80;
|
||||
let two_streams = chains.0 & chains.1 == 3;
|
||||
let (tx, rx) = (chains.0.count_ones(), chains.1.count_ones());
|
||||
let mut elements = Vec::new();
|
||||
let mut element = |id: u8, body: &[u8]| {
|
||||
@@ -1590,22 +1621,46 @@ fn probe_elements(
|
||||
band,
|
||||
family,
|
||||
radio,
|
||||
chains.0 & chains.1 == 3,
|
||||
two_streams,
|
||||
wide,
|
||||
eht.is_some(),
|
||||
));
|
||||
if band == Band::Ghz6 {
|
||||
elements.extend(he::six_ghz_capability(tx, rx));
|
||||
}
|
||||
if let Some(limits) = eht {
|
||||
elements.extend(eht::capability(band, limits, two_streams, widest));
|
||||
}
|
||||
elements
|
||||
}
|
||||
|
||||
impl<Q: BootIo, B: BiosIo> Wifi<Q, B> {
|
||||
/// Whether a channel of `band` takes 160 MHz.
|
||||
fn wide(&self, band: Band) -> bool {
|
||||
self.client
|
||||
.channels
|
||||
.iter()
|
||||
.any(|(channel, flags)| channel.band == band && flags & NO_160MHZ == 0)
|
||||
fn device(&self) -> Device {
|
||||
Device {
|
||||
family: self.family,
|
||||
radio: self.radio,
|
||||
chains: self.chains,
|
||||
eht: self.eht,
|
||||
}
|
||||
}
|
||||
|
||||
/// The widest channel `band` offers this device. 320 MHz is EHT's, and
|
||||
/// 6 GHz's alone.
|
||||
fn widest(&self, band: Band) -> phy::Width {
|
||||
let open = |closed: u32| {
|
||||
self.client
|
||||
.channels
|
||||
.iter()
|
||||
.any(|(channel, flags)| channel.band == band && flags & closed == 0)
|
||||
};
|
||||
let eht = self.eht.is_some_and(EhtLimits::reaches_320);
|
||||
if !open(NO_160MHZ) {
|
||||
phy::Width::Mhz80
|
||||
} else if eht && band == Band::Ghz6 && open(NO_160MHZ | NO_320MHZ) {
|
||||
phy::Width::Mhz320
|
||||
} else {
|
||||
phy::Width::Mhz160
|
||||
}
|
||||
}
|
||||
|
||||
/// What firmware's probes radiate: its lowest legacy rate of each band,
|
||||
@@ -1639,8 +1694,7 @@ impl<Q: BootIo, B: BiosIo> Wifi<Q, B> {
|
||||
.regulatory
|
||||
.as_ref()
|
||||
.ok_or(Error::Refused("scan"))?;
|
||||
let elements =
|
||||
|band| probe_elements(band, self.family, self.radio, self.chains, self.wide(band));
|
||||
let elements = |band| probe_elements(band, self.device(), self.widest(band));
|
||||
Ok(boot::Probe {
|
||||
elements: [Band::Ghz2, Band::Ghz5, Band::Ghz6].map(elements),
|
||||
profiles: self.probe_profiles(country),
|
||||
@@ -1760,8 +1814,7 @@ impl<Q: BootIo, B: BiosIo> Radio for Wifi<Q, B> {
|
||||
}
|
||||
|
||||
fn advertisement(&self, band: Band) -> Result<Advertisement, Error> {
|
||||
let elements =
|
||||
capability_elements(band, self.family, self.radio, self.chains, self.wide(band));
|
||||
let elements = capability_elements(band, self.device(), self.widest(band));
|
||||
let capabilities = Capabilities::parse(band, Role::Station, &elements)
|
||||
.map_err(|_| Error::Refused("advertisement"))?;
|
||||
Ok(Advertisement {
|
||||
@@ -2149,7 +2202,7 @@ impl<Q: BootIo, B: BiosIo> Wifi<Q, B> {
|
||||
let mac = MacState {
|
||||
address: self.address,
|
||||
he: negotiated.he.is_some(),
|
||||
eht: false,
|
||||
eht: negotiated.eht.is_some(),
|
||||
aid: Some(context.response().aid),
|
||||
high_priority: false,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,250 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
||||
// Copyright (C) 2005-2014, 2018-2026 Intel Corporation
|
||||
// Copyright (C) 2013-2015 Intel Mobile Communications GmbH
|
||||
// Copyright (C) 2016-2017 Intel Deutschland GmbH
|
||||
//! A station's EHT capabilities, `iwl_iftype_cap` as `iwl_nvm_fixup_sband_iftd`
|
||||
//! fixes it up for a band and device, narrowed as `ieee80211_put_eht_cap`
|
||||
//! writes it to the widths the country leaves.
|
||||
use crate::wifi::{Band, intel::identity::EhtLimits, station::phy::Width};
|
||||
use alloc::vec::Vec;
|
||||
|
||||
const EXTENSION: u8 = 255;
|
||||
const EHT_CAPABILITIES: u8 = 108;
|
||||
|
||||
/// The element for `band`. `two_streams` is both directions having both
|
||||
/// antennas; `widest` is the widest channel this device has on the band.
|
||||
pub(super) fn capability(
|
||||
band: Band,
|
||||
limits: EhtLimits,
|
||||
two_streams: bool,
|
||||
widest: Width,
|
||||
) -> Vec<u8> {
|
||||
let (wide, widest_320) = (widest != Width::Mhz80, widest == Width::Mhz320);
|
||||
// OM control.
|
||||
let mut mac = [0x02, 0];
|
||||
// 242-tone RUs above 20 MHz, four-LTF NDPs, SU beamformee of four streams;
|
||||
// triggered SU feedback; four LTFs at 0.8 us; 16 us padding, transmit and
|
||||
// receive below 242 tones, extra LTFs; 1024- and 4096-QAM in wider OFDMA.
|
||||
let mut phy = [0xcc, 0x1f, 0, 0x20, 0x08, 0x66, 0, 0, 0x03];
|
||||
if band == Band::Ghz2 {
|
||||
// 11454-byte MPDUs, which 2.4 GHz has no VHT to name.
|
||||
mac[0] |= 2 << 6;
|
||||
}
|
||||
if widest_320 {
|
||||
phy[0] |= 0x02;
|
||||
phy[1] |= 0xe0;
|
||||
}
|
||||
if two_streams {
|
||||
// One sounding dimension at each width, and feedback of two.
|
||||
phy[2] |= if widest_320 { 0x49 } else { 0x09 };
|
||||
phy[4] |= 0x10;
|
||||
}
|
||||
if !wide {
|
||||
phy[1] &= !0x1c;
|
||||
phy[2] &= !0x38;
|
||||
}
|
||||
if limits.reduced {
|
||||
phy[8] &= !0x02;
|
||||
}
|
||||
let streams = if two_streams { 0x22 } else { 0x11 };
|
||||
let top = if limits.reduced { 0 } else { streams };
|
||||
let fast_320 = !limits.urm && !(limits.slow_bus && two_streams);
|
||||
let high_320 = if fast_320 { streams } else { 0 };
|
||||
let mut element = alloc::vec![EXTENSION, 0, EHT_CAPABILITIES];
|
||||
element.extend_from_slice(&mac);
|
||||
element.extend_from_slice(&phy);
|
||||
element.extend_from_slice(&[streams, streams, top]);
|
||||
if wide && band != Band::Ghz2 {
|
||||
element.extend_from_slice(&[streams, streams, top]);
|
||||
}
|
||||
if widest_320 {
|
||||
element.extend_from_slice(&[streams, high_320, high_320]);
|
||||
}
|
||||
element[1] = (element.len() - 2) as u8;
|
||||
element
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::wifi::{
|
||||
intel::{
|
||||
association::{self as commands, RateShape},
|
||||
firmware::Family,
|
||||
identity::Rf,
|
||||
},
|
||||
station::phy::{Capabilities, Mode, Negotiated, Role},
|
||||
};
|
||||
|
||||
fn device(eht: EhtLimits) -> super::super::Device {
|
||||
super::super::Device {
|
||||
family: Family::Bz,
|
||||
radio: Rf::Fm,
|
||||
chains: (3, 3),
|
||||
eht: Some(eht),
|
||||
}
|
||||
}
|
||||
|
||||
fn negotiated(limits: EhtLimits, width: Width) -> Negotiated {
|
||||
let band = Band::Ghz6;
|
||||
let own = |limits| super::super::probe_elements(band, device(limits), Width::Mhz320);
|
||||
let mut station = own(limits);
|
||||
station.extend([221, 7, 0, 0x50, 0xf2, 2, 0, 1, 0]);
|
||||
let mut ap = own(EhtLimits::default());
|
||||
ap.extend([221, 24, 0, 0x50, 0xf2, 2, 1, 1, 0x80, 0]);
|
||||
for category in 0..4 {
|
||||
ap.extend([category << 5 | 3, 0xa4, 0, 0]);
|
||||
}
|
||||
let parsed = |role, elements: &[u8]| Capabilities::parse(band, role, elements).unwrap();
|
||||
let station = parsed(Role::Station, &station);
|
||||
Negotiated::between(&station, &parsed(Role::AccessPoint, &ap), Mode::Eht, width).unwrap()
|
||||
}
|
||||
|
||||
fn rates(negotiated: &Negotiated, authorized: bool) -> (Vec<u8>, RateShape) {
|
||||
let shape = RateShape::of(6).unwrap();
|
||||
let rates = commands::rate_config(negotiated, Band::Ghz6, 3, shape, authorized, 0).unwrap();
|
||||
(rates, shape)
|
||||
}
|
||||
|
||||
fn class(rates: &[u8], shape: RateShape, nss: usize, width: usize) -> u32 {
|
||||
let at = shape.head + 8 + (nss * shape.classes + width) * shape.rate_bytes;
|
||||
u32::from_le_bytes(rates[at..at + 4].try_into().unwrap())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_band_names_what_linux_names() {
|
||||
let limits = EhtLimits::default();
|
||||
let low = capability(Band::Ghz2, limits, true, Width::Mhz80);
|
||||
assert_eq!(low[3..5], [0x82, 0]);
|
||||
assert_eq!(low[5..14], [0xcc, 0x03, 0x01, 0x20, 0x18, 0x66, 0, 0, 0x03]);
|
||||
assert_eq!(low[14..], [0x22; 3]);
|
||||
let middle = capability(Band::Ghz5, limits, true, Width::Mhz160);
|
||||
assert_eq!(middle[3..5], [0x02, 0]);
|
||||
assert_eq!(middle[5..8], [0xcc, 0x1f, 0x09]);
|
||||
assert_eq!(middle[14..], [0x22; 6]);
|
||||
let high = capability(Band::Ghz6, limits, true, Width::Mhz320);
|
||||
assert_eq!(high[5..8], [0xce, 0xff, 0x49]);
|
||||
assert_eq!(high[14..], [0x22; 9]);
|
||||
assert_eq!(high[1] as usize, high.len() - 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn one_chain_names_one_stream_without_sounding() {
|
||||
let single = capability(Band::Ghz6, EhtLimits::default(), false, Width::Mhz320);
|
||||
assert_eq!(single[7], 0);
|
||||
assert_eq!(single[9], 0x08);
|
||||
assert_eq!(single[14..], [0x11; 9]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_device_limits_narrow_320_mhz_and_the_top_rates() {
|
||||
let widest = Width::Mhz320;
|
||||
let urm = EhtLimits {
|
||||
urm: true,
|
||||
..EhtLimits::default()
|
||||
};
|
||||
assert_eq!(
|
||||
capability(Band::Ghz6, urm, false, widest)[20..],
|
||||
[0x11, 0, 0]
|
||||
);
|
||||
let slow = EhtLimits {
|
||||
slow_bus: true,
|
||||
..EhtLimits::default()
|
||||
};
|
||||
assert_eq!(
|
||||
capability(Band::Ghz6, slow, true, widest)[20..],
|
||||
[0x22, 0, 0]
|
||||
);
|
||||
assert_eq!(
|
||||
capability(Band::Ghz6, slow, false, widest)[20..],
|
||||
[0x11; 3],
|
||||
"one stream fits the link"
|
||||
);
|
||||
let reduced = EhtLimits {
|
||||
reduced: true,
|
||||
..EhtLimits::default()
|
||||
};
|
||||
assert!(!reduced.reaches_320());
|
||||
let element = capability(Band::Ghz6, reduced, true, Width::Mhz160);
|
||||
assert_eq!(element[13], 0x01, "no 4096-QAM in wider OFDMA");
|
||||
assert_eq!(element[14..], [0x22, 0x22, 0, 0x22, 0x22, 0]);
|
||||
assert!(
|
||||
!EhtLimits {
|
||||
stops_at_160: true,
|
||||
..EhtLimits::default()
|
||||
}
|
||||
.reaches_320()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_narrower_channel_drops_its_widths_and_their_maps() {
|
||||
let eighty = capability(Band::Ghz5, EhtLimits::default(), true, Width::Mhz80);
|
||||
assert_eq!(eighty[6], 0x03);
|
||||
assert_eq!(eighty[7], 0x01);
|
||||
assert_eq!(eighty[14..], [0x22; 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn firmware_takes_every_rate_the_width_reaches() {
|
||||
let negotiated = negotiated(EhtLimits::default(), Width::Mhz320);
|
||||
assert_eq!(commands::ampdu_exponent(&negotiated), 9, "4 MB");
|
||||
let (config, shape) = rates(&negotiated, true);
|
||||
assert_eq!(config[shape.head], 4);
|
||||
assert_eq!(config[shape.head + 1], 4);
|
||||
assert_eq!(config[shape.head + 4] & 0x40, 0x40, "extra LTFs");
|
||||
for nss in 0..2 {
|
||||
for width in 0..3 {
|
||||
assert_eq!(class(&config, shape, nss, width), 0x3fff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn until_the_port_opens_firmware_stays_in_the_lowest_class() {
|
||||
let negotiated = negotiated(EhtLimits::default(), Width::Mhz320);
|
||||
let (config, shape) = rates(&negotiated, false);
|
||||
assert_eq!(config[shape.head], 0);
|
||||
assert_eq!(class(&config, shape, 0, 0), 0x3fff);
|
||||
assert_eq!(class(&config, shape, 0, 1), 0);
|
||||
assert_eq!(class(&config, shape, 1, 2), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_limited_device_keeps_its_rates_below_the_limit() {
|
||||
let slow = EhtLimits {
|
||||
slow_bus: true,
|
||||
..EhtLimits::default()
|
||||
};
|
||||
let negotiated = negotiated(slow, Width::Mhz320);
|
||||
let (config, shape) = rates(&negotiated, true);
|
||||
assert_eq!(class(&config, shape, 0, 1), 0x3fff);
|
||||
assert_eq!(class(&config, shape, 0, 2), 0x3ff);
|
||||
assert_eq!(class(&config, shape, 1, 2), 0x3ff);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn six_ghz_with_eht_takes_a_longer_he_aggregate() {
|
||||
let elements =
|
||||
|eht| super::super::he::capability(Band::Ghz6, Family::Bz, Rf::Fm, true, true, eht);
|
||||
assert_eq!(elements(true)[6] >> 3 & 3, 2);
|
||||
assert_eq!(elements(false)[6] >> 3 & 3, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn its_elements_parse_as_a_station_and_fit_a_probe() {
|
||||
let bands = [
|
||||
(Band::Ghz2, Width::Mhz80),
|
||||
(Band::Ghz5, Width::Mhz160),
|
||||
(Band::Ghz6, Width::Mhz320),
|
||||
];
|
||||
let mut bytes = 0;
|
||||
for (band, widest) in bands {
|
||||
let elements = super::super::probe_elements(band, device(EhtLimits::default()), widest);
|
||||
let parsed = Capabilities::parse(band, Role::Station, &elements).unwrap();
|
||||
assert!(parsed.eht().is_some());
|
||||
bytes += elements.len();
|
||||
}
|
||||
assert!(bytes < 400);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@ use alloc::vec::Vec;
|
||||
|
||||
const EXTENSION: u8 = 255;
|
||||
const HE_CAPABILITIES: u8 = 35;
|
||||
/// `IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_*`'s shift.
|
||||
const AMPDU_EXTENSION: u8 = 3;
|
||||
const HE_6GHZ_CAPABILITIES: u8 = 59;
|
||||
/// PPET16 at 0 and PPET8 at 7, for two streams.
|
||||
const THRESHOLDS: [u8; 4] = [0x61, 0x1c, 0xc7, 0x71];
|
||||
@@ -50,13 +52,14 @@ pub(super) fn six_ghz_capability(tx: u32, rx: u32) -> [u8; 5] {
|
||||
}
|
||||
|
||||
/// The element for `band`. `two_streams` is both directions having both
|
||||
/// antennas; `wide` is 160 MHz being usable.
|
||||
/// antennas; `wide` is 160 MHz being usable; `eht` is an EHT element following.
|
||||
pub(super) fn capability(
|
||||
band: Band,
|
||||
family: Family,
|
||||
radio: Rf,
|
||||
two_streams: bool,
|
||||
wide: bool,
|
||||
eht: bool,
|
||||
) -> Vec<u8> {
|
||||
// HTC-HE; 16 us trigger padding and eight receive TIDs; 32-bit bitmaps;
|
||||
// OM control and control frames to the multiple BSSID set; A-MSDU in
|
||||
@@ -69,10 +72,11 @@ pub(super) fn capability(
|
||||
// reserved nominal padding; M-1 RU LTF.
|
||||
let mut phy = [0, 0x3f, 0x0a, 0x09, 0xfd, 0, 0x8c, 0x06, 0x0f, 0xfc, 0x01];
|
||||
if band == Band::Ghz2 {
|
||||
mac[3] |= 3 << 3;
|
||||
mac[3] |= 3 << AMPDU_EXTENSION;
|
||||
phy[0] |= 0x02;
|
||||
} else {
|
||||
mac[3] |= 1 << 3;
|
||||
let extension = if band == Band::Ghz6 && eht { 2 } else { 1 };
|
||||
mac[3] |= extension << AMPDU_EXTENSION;
|
||||
phy[0] |= 0x04 | if wide { 0x08 } else { 0 };
|
||||
}
|
||||
if two_streams {
|
||||
@@ -115,6 +119,15 @@ mod tests {
|
||||
station::phy::{Capabilities, Mode, Negotiated, Role, Width},
|
||||
};
|
||||
|
||||
fn ax210() -> super::super::Device {
|
||||
super::super::Device {
|
||||
family: Family::Ax210,
|
||||
radio: Rf::Gf,
|
||||
chains: (3, 3),
|
||||
eht: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn parsed(band: Band, family: Family, two_streams: bool, wide: bool) -> Capabilities {
|
||||
let mut elements = if band == Band::Ghz2 {
|
||||
alloc::vec![1, 1, 0x82]
|
||||
@@ -126,12 +139,12 @@ mod tests {
|
||||
} else {
|
||||
Rf::Gf
|
||||
};
|
||||
elements.extend(capability(band, family, radio, two_streams, wide));
|
||||
elements.extend(capability(band, family, radio, two_streams, wide, false));
|
||||
Capabilities::parse(band, Role::Station, &elements).unwrap()
|
||||
}
|
||||
|
||||
fn negotiated(band: Band, mode: Mode, width: Width) -> Negotiated {
|
||||
let own = || super::super::probe_elements(band, Family::Ax210, Rf::Gf, (3, 3), true);
|
||||
let own = || super::super::probe_elements(band, ax210(), Width::Mhz160);
|
||||
let mut station = own();
|
||||
station.extend([221, 7, 0, 0x50, 0xf2, 2, 0, 1, 0]);
|
||||
let mut ap = own();
|
||||
@@ -166,15 +179,21 @@ mod tests {
|
||||
#[test]
|
||||
fn an_hr_radio_on_an_ax210_family_mac_takes_each_from_its_own_side() {
|
||||
let phy = |element: &[u8]| element[9..20].to_vec();
|
||||
let so = phy(&capability(Band::Ghz5, Family::Ax210, Rf::Hr, true, true));
|
||||
let so = phy(&capability(
|
||||
Band::Ghz5,
|
||||
Family::Ax210,
|
||||
Rf::Hr,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
));
|
||||
assert_eq!(so[9] & 0x0c, 0);
|
||||
assert_ne!(so[2] & 0x40, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn six_ghz_names_he_and_its_own_band_capabilities_alone() {
|
||||
let elements =
|
||||
super::super::capability_elements(Band::Ghz6, Family::Ax210, Rf::Gf, (3, 3), true);
|
||||
let elements = super::super::capability_elements(Band::Ghz6, ax210(), Width::Mhz160);
|
||||
let capabilities = Capabilities::parse(Band::Ghz6, Role::Station, &elements).unwrap();
|
||||
assert_eq!(capabilities.he_6ghz(), Some(0x6bd));
|
||||
assert!(capabilities.ht().is_none() && capabilities.vht().is_none());
|
||||
@@ -183,22 +202,22 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn the_band_sets_its_widths_and_its_ampdu_extension() {
|
||||
let low = capability(Band::Ghz2, Family::Ax210, Rf::Gf, true, true);
|
||||
let low = capability(Band::Ghz2, Family::Ax210, Rf::Gf, true, true, false);
|
||||
assert_eq!(low[3..9], [0x01, 0x78, 0x20, 0x9a, 0xc0, 0xab]);
|
||||
assert_eq!(low[9], 0x02);
|
||||
assert_eq!(low.len(), 3 + 17 + 4 + 4, "2.4 GHz names no 160 MHz map");
|
||||
let high = capability(Band::Ghz5, Family::Ax210, Rf::Gf, true, true);
|
||||
let high = capability(Band::Ghz5, Family::Ax210, Rf::Gf, true, true, false);
|
||||
assert_eq!(high[6], 0x8a);
|
||||
assert_eq!(high[9], 0x0c);
|
||||
assert_eq!(high.len(), 3 + 17 + 8 + 4);
|
||||
let narrow = capability(Band::Ghz5, Family::Ax210, Rf::Gf, true, false);
|
||||
let narrow = capability(Band::Ghz5, Family::Ax210, Rf::Gf, true, false, false);
|
||||
assert_eq!(narrow[9], 0x04);
|
||||
assert_eq!(narrow.len(), 3 + 17 + 4 + 4);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_single_chain_names_one_stream() {
|
||||
let single = capability(Band::Ghz5, Family::Ax210, Rf::Gf, false, true);
|
||||
let single = capability(Band::Ghz5, Family::Ax210, Rf::Gf, false, true, false);
|
||||
assert_eq!(single[9 + 2] & 0x04, 0);
|
||||
assert_eq!(single[9 + 5], 0);
|
||||
assert_eq!(single[9 + 7], 0x0e);
|
||||
@@ -207,10 +226,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn the_radio_decides_small_rus_and_full_mu_mimo() {
|
||||
let hr = capability(Band::Ghz5, Family::Ax200, Rf::Hr, true, true);
|
||||
let hr = capability(Band::Ghz5, Family::Ax200, Rf::Hr, true, true, false);
|
||||
assert_eq!(hr[9 + 9], 0xf0);
|
||||
assert_eq!(hr[9 + 2] & 0x40, 0);
|
||||
let gf = capability(Band::Ghz5, Family::Ax210, Rf::Gf, true, true);
|
||||
let gf = capability(Band::Ghz5, Family::Ax210, Rf::Gf, true, true, false);
|
||||
assert_eq!(gf[9 + 9], 0xfc);
|
||||
assert_ne!(gf[9 + 2] & 0x40, 0);
|
||||
}
|
||||
|
||||
@@ -225,6 +225,7 @@ fn borrowed_permanent_capture_keeps_the_byte_pointer_and_provenance() {
|
||||
}
|
||||
fn profile(ax210: bool) -> Profile {
|
||||
Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
silicon: Default::default(),
|
||||
vendor: 0x8086,
|
||||
device: if ax210 { 0x2725 } else { 0x2723 },
|
||||
|
||||
@@ -2,6 +2,7 @@ use super::super::identity::Observed;
|
||||
use super::*;
|
||||
fn profile() -> Profile {
|
||||
Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
silicon: Default::default(),
|
||||
vendor: 0x8086,
|
||||
device: 0x2725,
|
||||
|
||||
@@ -16,6 +16,7 @@ fn pnvm_skus_preserve_payloads_in_both_layouts() {
|
||||
"9697e327f8171454b3c19b1ec9449753d5b934d4e91722f469616818a6d477b0"
|
||||
);
|
||||
let profile = Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
silicon: Default::default(),
|
||||
vendor: 0x8086,
|
||||
device: 0x2725,
|
||||
@@ -95,6 +96,7 @@ fn pnvm_and_reduced_power_tables_match_linux_for_both_layouts() {
|
||||
);
|
||||
let pnvm = pnvm::Pnvm::parse(&bytes).unwrap();
|
||||
let profile = Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
silicon: Default::default(),
|
||||
vendor: 0x8086,
|
||||
device: 0x2725,
|
||||
|
||||
@@ -120,6 +120,7 @@ impl Csr for Model {
|
||||
}
|
||||
fn profile(family: Family) -> Profile {
|
||||
Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
silicon: Default::default(),
|
||||
vendor: 0x8086,
|
||||
device: if family == Family::Ax200 {
|
||||
@@ -445,6 +446,7 @@ fn an_integrated_22000_device_gates_power_between_its_reset_and_power_up() {
|
||||
let mut model = Model::new(Family::Ax200);
|
||||
model.registers.insert(HW_REV, 0x332);
|
||||
let profile = Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
device: 0x06f0,
|
||||
hardware_revision: 0x332,
|
||||
subsystem_device: 0x70,
|
||||
@@ -481,6 +483,7 @@ fn wifi_7(model: &mut Model) -> Profile {
|
||||
model.registers.insert(HW_REV, 0x472);
|
||||
model.registers.insert(RF_ID, 0x112200);
|
||||
Profile::select(Observed {
|
||||
link_speed: 3,
|
||||
device: 0x272b,
|
||||
hardware_revision: 0x472,
|
||||
radio_id: 0x112200,
|
||||
|
||||
@@ -429,6 +429,7 @@ pub(super) unsafe fn intel_wifi<B: wifi::intel::radio::bios::service::BiosIo>(
|
||||
.map_err(|error| refused(ServiceError::Mapping(error)))?;
|
||||
let vendor = function.vendor;
|
||||
let device = function.device;
|
||||
let link_speed = crate::bus::pci::link_speed(&function);
|
||||
let config = function.config();
|
||||
let pci = Pci {
|
||||
vendor,
|
||||
@@ -436,6 +437,7 @@ pub(super) unsafe fn intel_wifi<B: wifi::intel::radio::bios::service::BiosIo>(
|
||||
subsystem_vendor: config.read16(0x2c),
|
||||
subsystem_device: config.read16(0x2e),
|
||||
revision: config.read8(0x08),
|
||||
link_speed,
|
||||
};
|
||||
// iwl_pci_probe: memory decoding and bus mastering, polled.
|
||||
function.enable_polled();
|
||||
|
||||
Reference in new issue
Block a user