From patchwork Thu Mar 28 13:47:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13608587 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 607BD7E118 for ; Thu, 28 Mar 2024 13:47:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711633651; cv=none; b=hGOVIlv0ELrFaRts8LsvBfdhw3rcxwP8s4uaIQ/0CX7VlAPBBTi1cO1eIDwaxsDL5deuV5SQftVxdJTu+Z5SQrTM6FqrtqrLXC/wM9Us3nMKH/BZrm6bsBKGNaG5YhX631WK1xnSls+XfqHz+aoVAFV4nKlFdoeuNhmQE4rloQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711633651; c=relaxed/simple; bh=jgeUEzg2kaUgbJEfU4Qff6iM+sLQ4Ep0ug7ZdG2tQPQ=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=GEsr8j2Jp/OG+ETviq8+5ILSZE2DMovOChkW9D6ByDvfPEXAanmNR2BynkxWAqYbqaEBUdV5cLzeZgbe2yfKrZ/KfTJG2pFs19XP0NoGAzMAu5qcA5itIAGycgYoc/R9w7vIWaw/QVQ94dpQsvw/thDTW0M71dGwEQ5Kl5tBaeA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=S9wLGnXV; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S9wLGnXV" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1def2a1aafaso7582925ad.3 for ; Thu, 28 Mar 2024 06:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711633649; x=1712238449; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=u6/LQEbj47XgO1NSTRnIcQMXt+T1PN8lsmLYGnxkXkg=; b=S9wLGnXViS9HRBvIS37LyEHEXpLoljhBf+0K/enLv0iRwhwOpFb/BbmjMwRxPrM01V 4vjW/EG1geOJT4UN9EScadZxh82p3KkDBwKRdJ5NaLJv3Ov7JOMe8W79Bu+kXBuHNn+x w34Jln5x1DI49deXvu/39VNdnI3flw+gAuBs6avZxNLa/vRPw2EZOKUbQxiqcboi6kLJ PaKZ/OQa9azjH2Rd9Oz79890Kdoj8oq/CXU4VPSotvzGDawLesIzZVXIW6l5+rRI2tYC KCnoRR6j+cOEGHlMabEo3PSE2CfSHNP1t40bLs4IyRDE7xjcRvkUAqTJvy3VAyIJ8R2c Lnkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711633649; x=1712238449; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=u6/LQEbj47XgO1NSTRnIcQMXt+T1PN8lsmLYGnxkXkg=; b=Um813cT/T1h9vAhY40+/Fw+TAX+7WgyezBfgR7xUv5tWsDw2Srsvmq68Exx3aYStL2 04EaDZSKtIrnXRHM+2F4Uj6+dC7gVrKVHdEtu11eFX6WaLk2ZYmIHNZufASiNa90xNBN r6k+LUCW4WbNKitD2gCNVZlKe1XENixJUcWocmgCjaZzXrD/Ecos5BxL0w4qnRhf1RZE mdCC0zhN4w3O0/3Nesy4Tmqbkb1cO9C32upm+96UOyUr6pLixWUVhOsh36wv3I9NDeyR r04Rx5JJqCZGoO1/G4UP+1kASZoFLUac1/ouU4Ff/ZMs8Yqpn6D8pbgAeckSZ2Hw37Sm c7KA== X-Gm-Message-State: AOJu0YyMdvmnC5gAI0S/yaxuFrZuv2yGzCcJ+AsFGWxBM55RGx1KieWl HYvJq/bEL/p7Bblw6lo7OuEnpBHG+sT2I02Wq9+kHmPU3Z0H0IUEIrorl04X X-Google-Smtp-Source: AGHT+IEpY4JfmbNfWW7ZrKmF3RW89G1pUPwaKMz9GShMSh6EgGWM7FPq0wdhtLODkdxI8npTirj1hw== X-Received: by 2002:a17:902:6908:b0:1dd:6eba:c592 with SMTP id j8-20020a170902690800b001dd6ebac592mr2582676plk.56.1711633649245; Thu, 28 Mar 2024 06:47:29 -0700 (PDT) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id kx5-20020a170902f94500b001e10b6f45dasm1568838plb.295.2024.03.28.06.47.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 06:47:28 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/2] band: make HE/no-HT rate estimators return more descriptive Date: Thu, 28 Mar 2024 06:47:24 -0700 Message-Id: <20240328134725.1484257-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If the IEs were not provided return -ENOTSUP rather than -EINVAL or -EBADMSG since this just means the AP doesn't support those capabilities. --- src/band.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/band.c b/src/band.c index bf40f789..11cd965e 100644 --- a/src/band.c +++ b/src/band.c @@ -90,7 +90,7 @@ int band_estimate_nonht_rate(const struct band *band, int i; if (!supported_rates && !ext_supported_rates) - return -EINVAL; + return -ENOTSUP; /* * Start at the back of the array. Rates are generally given in @@ -607,7 +607,7 @@ int band_estimate_he_rx_rate(const struct band *band, const uint8_t *hec, uint8_t width_set; if (!hec || !band->he_capabilities) - return -EBADMSG; + return -ENOTSUP; for (entry = l_queue_get_entries(band->he_capabilities); entry; entry = entry->next) { From patchwork Thu Mar 28 13:47:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13608588 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D995156B77 for ; Thu, 28 Mar 2024 13:47:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711633652; cv=none; b=jwr7a01ip3Yt5DS5ZXMrAKMw2494KJb9Nx0csXwuOC17s8oQCKxJMrUSzdVgd+ifHYmPtBzB5c8dRt7+jxcuIDwuFKkA05tk2CnooXC2HaJ7duwpfbM3ou3BhGQcag9pUrNMNpw0VEK/XMY5gu5YW8oy5Cw3SXrnAZEZpTZckjA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711633652; c=relaxed/simple; bh=KOSndVOPk/AIggXmWzeUkI2McatGtRaQB0bRXHRSYPg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YEmhOXIF/YOZ4sNQbZ60DdaUq6NFvJeLyJaIeqmvMGugfBs1NPtL9eXFNrJrnb06uXOXPWAiA82tkzPhsOZuMVm6pLOL1PEqXmp3maAUSAVcG/ZxKqdDpBbRpVaRLC3KEuVlHKAqpJIIQe2QPB7l9sDLY2EstE4KVqRnbOb00NM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=I3on0a4E; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I3on0a4E" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1e21d1e8307so2895555ad.2 for ; Thu, 28 Mar 2024 06:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711633650; x=1712238450; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PqCiX7tfeOR0T/dGmE9vFayKUanKH/+IRm+jn3vnZuE=; b=I3on0a4EqZuG0z0DsKDY1Qpe00my6k63kG3Aj9ZrDoCiOkc+DbAnjGKhrcXTsGnSY+ 1UXTWKdAqvx6+nJltaTg3mU6FGpCLIV6/gBVuT48fu1OhNHUcZkQwWjyL4nnT3B9WgFn DwuFaHMfzRDO2/Ea+vr4DpNZ8cZzrN3EeUG5NckV4LDC1gYSu9gliWMpwixwYvfOIlxH +HUB9LaxSudskTBJOX/1SgIgw4C1wQ0WTWLez+tBbPont3BqY3FS6jCyxw1UELx7pL4d gMULGO7yn56v6C2gb6OU4g/Xkd3+YE7g9QM8RqdHGquY/1JplDxFgDj5X/o4XY6xQxMC WXBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711633650; x=1712238450; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PqCiX7tfeOR0T/dGmE9vFayKUanKH/+IRm+jn3vnZuE=; b=NG2WlJEpf5NBWU8UcwZ77y3gIH/o50BxBuAXOgwcrib8jttvvIJSb2T8/gV18uTj97 2pNGiGus1qIGOLhnYvAJjAiYuv4wVwMN4j2Fh8Mb7gCQ6Pu+Ax/50ZhCe6p9tNZ6OYVX q0k4hWVlZOe7nUaBIAiG9ViUfpr6xwwtUbxtslatO/M9p35FiVOlSxC0ANnlpyIItqKX HeiBbLZxR2rwJ2tWNof7g7F8I5RNq6ye8neAzDbjO+pgUxUAIboOJkxkrClNIY1A26iJ 11j2D8irOx+Kc63UcezvgpBeIO2JspZn1wKEbAyFB6PspvpUCFW/fWrWWbG01BnY4ObB WM0Q== X-Gm-Message-State: AOJu0Yx5x/htn6SAzQd9BZX+qx29sUrJBKrVm4jjrOcf59fcr3GGhQvY kn+ev635WAH/f8LsCUlEzaCudQe9iLXfGzbHm9lAck4RB5Gw4hYZ8AIpq5NY X-Google-Smtp-Source: AGHT+IHejvinc6WmAHQuIj3ggvRcjKdnREFS9khaUQdrIVq6tx/yv28ZTC6KIuMle9ekw1nZ6QD8wA== X-Received: by 2002:a17:903:32cb:b0:1e0:b629:b009 with SMTP id i11-20020a17090332cb00b001e0b629b009mr3621177plr.20.1711633649784; Thu, 28 Mar 2024 06:47:29 -0700 (PDT) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id kx5-20020a170902f94500b001e10b6f45dasm1568838plb.295.2024.03.28.06.47.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 06:47:29 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/2] wiphy: add better handling for rate estimation errors Date: Thu, 28 Mar 2024 06:47:25 -0700 Message-Id: <20240328134725.1484257-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328134725.1484257-1-prestwoj@gmail.com> References: <20240328134725.1484257-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In most cases any failure here is likely just due to the AP not supporting the feature, whether its HE/VHT/HE. This should result in the estimation returning -ENOTSUP in which case we move down the list. Any other non-zero return we will now warn to make it clear the IEs did exist, but were not properly formatted. In addition HE specifically has an extra validation function which, if failed, was bailing out of the estimation function entirely. Instead this is now treated as if there was no HE capabilities and the logic can move down to VHT, HT, or basic rates. --- src/wiphy.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/wiphy.c b/src/wiphy.c index 0d64b1b3..705fb9cc 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -989,6 +989,7 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy, const void *he_capabilities = NULL; const struct band *bandp; enum band_freq band; + int ret; if (band_freq_to_channel(bss->frequency, &band) == 0) return -ENOTSUP; @@ -1037,8 +1038,10 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy, vht_operation = iter.data - 2; break; case IE_TYPE_HE_CAPABILITIES: - if (!ie_validate_he_capabilities(iter.data, iter.len)) - return -EBADMSG; + if (!ie_validate_he_capabilities(iter.data, iter.len)) { + l_warn("invalid HE capabilities"); + continue; + } he_capabilities = iter.data; break; @@ -1047,26 +1050,39 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy, } } - if (!band_estimate_he_rx_rate(bandp, he_capabilities, + ret = band_estimate_he_rx_rate(bandp, he_capabilities, bss->signal_strength / 100, - out_data_rate)) + out_data_rate); + if (!ret) return 0; + else if (ret != -ENOTSUP) + l_warn("error parsing HE capabilities"); - if (!band_estimate_vht_rx_rate(bandp, vht_capabilities, vht_operation, + ret = band_estimate_vht_rx_rate(bandp, vht_capabilities, vht_operation, ht_capabilities, ht_operation, bss->signal_strength / 100, - out_data_rate)) + out_data_rate); + if (!ret) return 0; + else if (ret != -ENOTSUP) + l_warn("error parsing VHT capabilities"); - if (!band_estimate_ht_rx_rate(bandp, ht_capabilities, ht_operation, + ret = band_estimate_ht_rx_rate(bandp, ht_capabilities, ht_operation, bss->signal_strength / 100, - out_data_rate)) + out_data_rate); + if (!ret) return 0; + else if (ret != -ENOTSUP) + l_warn("error parsing HT capabilities"); - return band_estimate_nonht_rate(bandp, supported_rates, + ret = band_estimate_nonht_rate(bandp, supported_rates, ext_supported_rates, bss->signal_strength / 100, out_data_rate); + if (ret != 0 && ret != -ENOTSUP) + l_warn("error parsing non-HT rates"); + + return ret; } bool wiphy_regdom_is_updating(struct wiphy *wiphy)