Skip to contentSkip to conversation

wiphy: make "wiphy" const in wiphy_has_ext_feature

PATCH In review James Prestwood 2 participants 5 messages Nov 25, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 wiphy: make "wiphy" const in wiphy_has_ext_feature

---
 src/wiphy.c | 2 +-
 src/wiphy.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
src/wiphy.c +1 -1
index c286bb48..ecc345e9 100644
@@ -643,7 +643,7 @@ bool wiphy_rrm_capable(struct wiphy *wiphy)
 	return false;
 }
 
-bool wiphy_has_ext_feature(struct wiphy *wiphy, uint32_t feature)
+bool wiphy_has_ext_feature(const struct wiphy *wiphy, uint32_t feature)
 {
 	return feature < sizeof(wiphy->ext_features) * 8 &&
 		test_bit(wiphy->ext_features, feature);
src/wiphy.h +1 -1
index 43e4aeb3..c527c79d 100644
@@ -119,7 +119,7 @@ bool wiphy_can_randomize_mac_addr(struct wiphy *wiphy);
 bool wiphy_rrm_capable(struct wiphy *wiphy);
 bool wiphy_supports_ext_key_id(struct wiphy *wiphy);
 bool wiphy_has_feature(struct wiphy *wiphy, uint32_t feature);
-bool wiphy_has_ext_feature(struct wiphy *wiphy, uint32_t feature);
+bool wiphy_has_ext_feature(const struct wiphy *wiphy, uint32_t feature);
 uint8_t wiphy_get_max_num_ssids_per_scan(struct wiphy *wiphy);
 uint16_t wiphy_get_max_scan_ie_len(struct wiphy *wiphy);
 uint32_t wiphy_get_max_roc_duration(struct wiphy *wiphy);
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/4 wiphy: add driver quirk for disabling multicast rx (and helper)

This driver quirk and associated helper API lets other modules both check if multicast RX is supported, and if its been disabled via the driver quirk setting.

---
 src/wiphy.c | 17 +++++++++++++----
 src/wiphy.h |  1 +
 2 files changed, 14 insertions(+), 4 deletions(-)
src/wiphy.c +13 -4
index ecc345e9..5e958d65 100644
@@ -73,6 +73,7 @@ enum driver_flag {
 	FORCE_PAE = 0x2,
 	POWER_SAVE_DISABLE = 0x4,
 	OWE_DISABLE = 0x8,
+	MULTICAST_RX_DISABLE = 0x10,
 };
 
 struct driver_flag_name {
@@ -101,10 +102,11 @@ static const struct driver_info driver_infos[] = {
 };
 
 static const struct driver_flag_name driver_flag_names[] = {
-	{ "DefaultInterface", DEFAULT_IF },
-	{ "ForcePae",         FORCE_PAE },
-	{ "PowerSaveDisable", POWER_SAVE_DISABLE },
-	{ "OweDisable",       OWE_DISABLE },
+	{ "DefaultInterface",   DEFAULT_IF },
+	{ "ForcePae",           FORCE_PAE },
+	{ "PowerSaveDisable",   POWER_SAVE_DISABLE },
+	{ "OweDisable",         OWE_DISABLE },
+	{ "MulticastRxDisable", MULTICAST_RX_DISABLE }
 };
 
 struct wiphy {
@@ -949,6 +951,13 @@ bool wiphy_supports_cmd_offchannel(const struct wiphy *wiphy)
 	return wiphy->supports_cmd_offchannel;
 }
 
+bool wiphy_supports_multicast_rx(const struct wiphy *wiphy)
+{
+	return wiphy_has_ext_feature(wiphy,
+				NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS) &&
+				!(wiphy->driver_flags & MULTICAST_RX_DISABLE);
+}
+
 const uint8_t *wiphy_get_ht_capabilities(const struct wiphy *wiphy,
 						enum band_freq band,
 						size_t *size)
src/wiphy.h +1 -0
index c527c79d..9fcbdcd2 100644
@@ -143,6 +143,7 @@ void wiphy_get_reg_domain_country(struct wiphy *wiphy, char *out);
 bool wiphy_country_is_unknown(struct wiphy *wiphy);
 bool wiphy_supports_uapsd(const struct wiphy *wiphy);
 bool wiphy_supports_cmd_offchannel(const struct wiphy *wiphy);
+bool wiphy_supports_multicast_rx(const struct wiphy *wiphy);
 
 const uint8_t *wiphy_get_ht_capabilities(const struct wiphy *wiphy,
 						enum band_freq band,
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/4 dpp: use wiphy_supports_multicast_rx

In reply to James Prestwood

The ath10k driver has shown some performance issues, specifically packet loss, when frame watches are registered with the multicast RX flag set. This is relevant for DPP which registers for these when DPP starts (if the driver supports it). This has only been observed when there are large groups of clients all using the same wifi channel so its unlikely to be much of an issue for those using IWD/ath10k and DPP unless you run large deployments of clients.

But for large deployments with IWD/ath10k we need a way to disable the multicast RX registrations. Now, with the addition of wiphy_supports_multicast_rx we can both check that the driver supports this as well as if its been disabled by the driver quirk.

---
 src/dpp.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
src/dpp.c +4 -5
index 95c11f00..ac56e55d 100644
@@ -3739,9 +3739,8 @@ static void dpp_create(struct netdev *netdev)
 	dpp->key_len = l_ecc_curve_get_scalar_bytes(dpp->curve);
 	dpp->nonce_len = dpp_nonce_len_from_key_len(dpp->key_len);
 	dpp->max_roc = wiphy_get_max_roc_duration(wiphy_find_by_wdev(wdev_id));
-	dpp->mcast_support = wiphy_has_ext_feature(
-				wiphy_find_by_wdev(dpp->wdev_id),
-				NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS);
+	dpp->mcast_support = wiphy_supports_multicast_rx(
+				wiphy_find_by_wdev(dpp->wdev_id));
 
 	l_ecdh_generate_key_pair(dpp->curve, &dpp->boot_private,
 					&dpp->boot_public);
@@ -4106,7 +4105,7 @@ static struct l_dbus_message *dpp_start_configurator_common(
 	} else
 		dpp->current_freq = bss->frequency;
 
-	dpp_add_frame_watches(dpp, responder);
+	dpp_add_frame_watches(dpp, responder && dpp->mcast_support);
 
 	dpp->uri = dpp_generate_uri(dpp->own_asn1, dpp->own_asn1_len, 2,
 					netdev_get_address(dpp->netdev),
@@ -4535,7 +4534,7 @@ static struct l_dbus_message *dpp_start_pkex_configurator(struct dpp_sm *dpp,
 	dpp->config = dpp_configuration_new(network_get_settings(network),
 						network_get_ssid(network),
 						hs->akm_suite);
-	dpp_add_frame_watches(dpp, true);
+	dpp_add_frame_watches(dpp, dpp->mcast_support);
 
 	dpp_reset_protocol_timer(dpp, DPP_PKEX_PROTO_TIMEOUT);
 	dpp_property_changed_notify(dpp);
Signature · 1 line
2.34.1
#3 lore raw

PATCH 4/4 doc: document [DriverQuirks].MulticastRxDisable

In reply to James Prestwood
---
 src/iwd.config.rst | 6 ++++++
 1 file changed, 6 insertions(+)
src/iwd.config.rst +6 -0
index 1cb4b05d..c031b8dc 100644
@@ -454,6 +454,12 @@ are buggy or just don't behave similar enough to the majority of other drivers.
 
        If a driver in user matches one in this list power save will be disabled.
 
+   * - MulticastRxDisable
+     - Values: comma-separated list of drivers or glob matches
+
+       If a driver in use matches one in this list, multicast RX will be
+       disabled.
+
 SEE ALSO
 ========
 
Signature · 1 line
2.34.1