From patchwork Mon Oct 21 12:42:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13844087 Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (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 B0CE41E6DFC for ; Mon, 21 Oct 2024 12:42:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729514557; cv=none; b=ipEcNggpFn8rYZhGqQXJ/ZasX/GsFKBFpjoQut63wTyaV/EMnqeWL6QdcYle8pFs2FmpBvp9hf7NSFmSygz+5dcmEJd+tjBlYgNWVp3Ac3Se6ca2kbXSeeaYIT1tbnQ5TQYX+9jAaqLrCtNWFKaPWGgk6tjR6vAJKLTN8ipsZB0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729514557; c=relaxed/simple; bh=zSVYF9l/Ta+jiHdLZZFCc7ShXdxzsNGTpeoacApvsuQ=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=L49Unr4E8XlT4iy33KxJABrt4OCD9Z5PGi37cfa828JelVHUlulXqHuaKA1bE6SguNiyBnlHSuTi+DbrjSh4WzaskcHX+hgyuh8+a+acqz/uCM4C0CYS1K23kb3ouNxHlag8iHIJomANDIQ09hhRBC4WovI3GWa825AQ2X5t3jE= 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=lhDpAbxw; arc=none smtp.client-ip=209.85.219.53 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="lhDpAbxw" Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-6cbd1ae26a6so27935776d6.1 for ; Mon, 21 Oct 2024 05:42:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729514554; x=1730119354; 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=p0TNcHPu/qjDPiDPqm+Ndqr3W8h2jWCENfx7iK+20iE=; b=lhDpAbxwecayoAZs03AIyf73npLoKAaCOw/0z+6fRssUmV2PqbV+TMq78AQtykKhVz Qc+essZk7x7VBaZ3uTLiSvKvLo2H5Rz6Bx+IcpBNppNI33kfmts5XxDxsT3O25JuELGM Ia22MCW43nOWQKaODuFXthB7xddubMkyGGf5rMyvLdQjbnTv5UOK6y1Ssknvqol1tddD NF3WVW3ChaQlZfFhAhWGI9vZF5rEO/tfZWpKdB5FhZuJw1a+03alIVl93c4mlNgEZOsk Au0LqfkCk6pFhaKZxy9GehSLzqE+RGA0ndgZWTvUj/gqQs9LmsvW6BOljngXoxS6ZTbY A9yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729514554; x=1730119354; 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=p0TNcHPu/qjDPiDPqm+Ndqr3W8h2jWCENfx7iK+20iE=; b=Z6Fq2L/Hfdjagy3C6zMuX+v29YIxQW4osIGmohVLowSZHOfLehG1eAhCehUploQ3W3 Y4WJ1VjFyJy9tqQ1Q+UYZQT3SxQLQAZRFuDhX0d29lvS6lsEZakXnUXTHgOVFlZAXNVS P6ThqaJep4KD3PvgmCVYImyW3T+VVujeaMnZU70KFO69Ss7vScBNwAR+PYZSQYZyAzWw cZJumwB2bR1KJDsZ3G9VODNyVK3R2nuf67Va0NPJO3y4Vx/F/oR2sFHMLASOBevRYWa4 1AT32mZ8EkhAbXXkiYIShHyRZl1ybeagQSNVEU7toNFMajP1S33DZ+tMkGkQEdBRPYJP 3aWQ== X-Gm-Message-State: AOJu0YxwOFYA7IyJqeE3oxMXimbZ8B3GFFOu7hQ1qZSyLjddKK7iTebX GMtouMjEP1vUij4IVbOAwoEIZ7WbLO5leyDEoy5ej9R0U8TnPMj/QLateQ== X-Google-Smtp-Source: AGHT+IFQmykAu5PW3eYJ34nqrGhfZMnUMDv6bubk1J4HbBMm37X11afMX4doG1o7wITp7dXwY/HcEQ== X-Received: by 2002:a05:6214:2f87:b0:6cb:ffd6:3ed8 with SMTP id 6a1803df08f44-6cde14bdef5mr171746286d6.10.1729514554292; Mon, 21 Oct 2024 05:42:34 -0700 (PDT) Received: from LOCLAP699.localdomain ([72.46.116.182]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6ce00999ab0sm17006586d6.93.2024.10.21.05.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 05:42:33 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/3] frame-xchg: add multicast RX flag argument Date: Mon, 21 Oct 2024 05:42:26 -0700 Message-Id: <20241021124228.145516-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 DPP optionally uses the multicast RX flag for frame registrations but since frame-xchg did not support that, it used its own registration internally. To avoid code re-use within DPP add a flag to frame_watch_add in order to allow DPP to utilize frame-xchg. --- src/ap.c | 12 ++++++------ src/dpp.c | 4 ++-- src/frame-xchg.c | 7 ++++++- src/frame-xchg.h | 1 + src/netdev.c | 14 +++++++------- src/p2p.c | 5 +++-- src/rrm.c | 2 +- src/station.c | 2 +- 8 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/ap.c b/src/ap.c index 6650f0af..562e00c8 100644 --- a/src/ap.c +++ b/src/ap.c @@ -3914,34 +3914,34 @@ struct ap_state *ap_start(struct netdev *netdev, struct l_settings *config, if (!frame_watch_add(wdev_id, 0, 0x0000 | (MPDU_MANAGEMENT_SUBTYPE_ASSOCIATION_REQUEST << 4), - NULL, 0, ap_assoc_req_cb, ap, NULL)) + NULL, 0, false, ap_assoc_req_cb, ap, NULL)) goto error; if (!frame_watch_add(wdev_id, 0, 0x0000 | (MPDU_MANAGEMENT_SUBTYPE_REASSOCIATION_REQUEST << 4), - NULL, 0, ap_reassoc_req_cb, ap, NULL)) + NULL, 0, false, ap_reassoc_req_cb, ap, NULL)) goto error; if (!wiphy_supports_probe_resp_offload(wiphy)) { if (!frame_watch_add(wdev_id, 0, 0x0000 | (MPDU_MANAGEMENT_SUBTYPE_PROBE_REQUEST << 4), - NULL, 0, ap_probe_req_cb, ap, NULL)) + NULL, 0, false, ap_probe_req_cb, ap, NULL)) goto error; } if (!frame_watch_add(wdev_id, 0, 0x0000 | (MPDU_MANAGEMENT_SUBTYPE_DISASSOCIATION << 4), - NULL, 0, ap_disassoc_cb, ap, NULL)) + NULL, 0, false, ap_disassoc_cb, ap, NULL)) goto error; if (!frame_watch_add(wdev_id, 0, 0x0000 | (MPDU_MANAGEMENT_SUBTYPE_AUTHENTICATION << 4), - NULL, 0, ap_auth_cb, ap, NULL)) + NULL, 0, false, ap_auth_cb, ap, NULL)) goto error; if (!frame_watch_add(wdev_id, 0, 0x0000 | (MPDU_MANAGEMENT_SUBTYPE_DEAUTHENTICATION << 4), - NULL, 0, ap_deauth_cb, ap, NULL)) + NULL, 0, false, ap_deauth_cb, ap, NULL)) goto error; ap->mlme_watch = l_genl_family_register(ap->nl80211, "mlme", diff --git a/src/dpp.c b/src/dpp.c index 03e2a7a6..004b431d 100644 --- a/src/dpp.c +++ b/src/dpp.c @@ -3861,11 +3861,11 @@ static void dpp_create(struct netdev *netdev) frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0, dpp_conf_response_prefix, - sizeof(dpp_conf_response_prefix), + sizeof(dpp_conf_response_prefix), false, dpp_handle_config_response_frame, dpp, NULL); frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0, dpp_conf_request_prefix, - sizeof(dpp_conf_request_prefix), + sizeof(dpp_conf_request_prefix), false, dpp_handle_config_request_frame, dpp, NULL); dpp->known_network_watch = known_networks_watch_add( diff --git a/src/frame-xchg.c b/src/frame-xchg.c index 158befd0..42d9a3ae 100644 --- a/src/frame-xchg.c +++ b/src/frame-xchg.c @@ -575,6 +575,7 @@ drop: bool frame_watch_add(uint64_t wdev_id, uint32_t group_id, uint16_t frame_type, const uint8_t *prefix, size_t prefix_len, + bool multicast_rx, frame_watch_cb_t handler, void *user_data, frame_xchg_destroy_func_t destroy) { @@ -614,6 +615,10 @@ bool frame_watch_add(uint64_t wdev_id, uint32_t group_id, uint16_t frame_type, l_genl_msg_append_attr(msg, NL80211_ATTR_FRAME_MATCH, prefix_len, prefix); + if (multicast_rx) + l_genl_msg_append_attr(msg, NL80211_ATTR_RECEIVE_MULTICAST, + 0, NULL); + if (group->id == 0) l_genl_family_send(nl80211, msg, frame_watch_register_cb, L_UINT_TO_PTR(frame_type), NULL); @@ -1194,7 +1199,7 @@ uint32_t frame_xchg_startv(uint64_t wdev_id, struct iovec *frame, uint32_t freq, watch->prefix = prefix; watch->cb = va_arg(resp_args, void *); frame_watch_add(wdev_id, group_id, prefix->frame_type, - prefix->data, prefix->len, + prefix->data, prefix->len, false, frame_xchg_resp_cb, fx, NULL); if (!fx->rx_watches) diff --git a/src/frame-xchg.h b/src/frame-xchg.h index 9e250e3f..3f1e0e55 100644 --- a/src/frame-xchg.h +++ b/src/frame-xchg.h @@ -45,6 +45,7 @@ enum frame_xchg_group { bool frame_watch_add(uint64_t wdev_id, uint32_t group, uint16_t frame_type, const uint8_t *prefix, size_t prefix_len, + bool multicast_rx, frame_watch_cb_t handler, void *user_data, frame_xchg_destroy_func_t destroy); bool frame_watch_group_remove(uint64_t wdev_id, uint32_t group); diff --git a/src/netdev.c b/src/netdev.c index 8379a598..2eebf457 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -5720,35 +5720,35 @@ static void netdev_add_station_frame_watches(struct netdev *netdev) /* Subscribe to Management -> Action -> RM -> Neighbor Report frames */ frame_watch_add(wdev, 0, 0x00d0, action_neighbor_report_prefix, - sizeof(action_neighbor_report_prefix), + sizeof(action_neighbor_report_prefix), false, netdev_neighbor_report_frame_event, netdev, NULL); frame_watch_add(wdev, 0, 0x00d0, action_sa_query_resp_prefix, - sizeof(action_sa_query_resp_prefix), + sizeof(action_sa_query_resp_prefix), false, netdev_sa_query_resp_frame_event, netdev, NULL); frame_watch_add(wdev, 0, 0x00d0, action_sa_query_req_prefix, - sizeof(action_sa_query_req_prefix), + sizeof(action_sa_query_req_prefix), false, netdev_sa_query_req_frame_event, netdev, NULL); frame_watch_add(wdev, 0, 0x00d0, action_ft_response_prefix, - sizeof(action_ft_response_prefix), + sizeof(action_ft_response_prefix), false, netdev_ft_response_frame_event, netdev, NULL); frame_watch_add(wdev, 0, 0x00b0, auth_ft_response_prefix, - sizeof(auth_ft_response_prefix), + sizeof(auth_ft_response_prefix), false, netdev_ft_auth_response_frame_event, netdev, NULL); if (wiphy_supports_qos_set_map(netdev->wiphy)) frame_watch_add(wdev, 0, 0x00d0, action_qos_map_prefix, - sizeof(action_qos_map_prefix), + sizeof(action_qos_map_prefix), false, netdev_qos_map_frame_event, netdev, NULL); if (!wiphy_supports_cmds_auth_assoc(netdev->wiphy) && wiphy_has_feature(netdev->wiphy, NL80211_FEATURE_SAE)) frame_watch_add(wdev, 0, 0x00b0, auth_sae_prefix, sizeof(auth_sae_prefix), - netdev_sae_external_auth_frame_event, + false, netdev_sae_external_auth_frame_event, netdev, NULL); } diff --git a/src/p2p.c b/src/p2p.c index e8c7c5de..e55cb76a 100644 --- a/src/p2p.c +++ b/src/p2p.c @@ -4163,10 +4163,11 @@ static void p2p_device_discovery_start(struct p2p_device *dev) L_ARRAY_SIZE(channels_social)]; frame_watch_add(dev->wdev_id, FRAME_GROUP_P2P_LISTEN, 0x0040, - (uint8_t *) "", 0, p2p_device_probe_cb, dev, NULL); + (uint8_t *) "", 0, false, + p2p_device_probe_cb, dev, NULL); frame_watch_add(dev->wdev_id, FRAME_GROUP_P2P_LISTEN, 0x00d0, p2p_frame_go_neg_req.data, p2p_frame_go_neg_req.len, - p2p_device_go_negotiation_req_cb, dev, NULL); + false, p2p_device_go_negotiation_req_cb, dev, NULL); p2p_device_scan_start(dev); } diff --git a/src/rrm.c b/src/rrm.c index a11a6532..e5118a99 100644 --- a/src/rrm.c +++ b/src/rrm.c @@ -798,7 +798,7 @@ static void rrm_add_frame_watches(struct rrm_state *rrm) l_debug(""); frame_watch_add(rrm->wdev_id, 0, frame_type, prefix, sizeof(prefix), - rrm_frame_watch_cb, rrm, NULL); + false, rrm_frame_watch_cb, rrm, NULL); } static struct rrm_state *rrm_new_state(struct netdev *netdev) diff --git a/src/station.c b/src/station.c index b7905c4f..cef6c66a 100644 --- a/src/station.c +++ b/src/station.c @@ -5698,7 +5698,7 @@ static void add_frame_watches(struct netdev *netdev) */ frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0, action_ap_roam_prefix, sizeof(action_ap_roam_prefix), - ap_roam_frame_event, + false, ap_roam_frame_event, L_UINT_TO_PTR(netdev_get_ifindex(netdev)), NULL); } From patchwork Mon Oct 21 12:42:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13844088 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (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 D30E71F4FCF for ; Mon, 21 Oct 2024 12:42:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729514558; cv=none; b=VwBnC8ZAEB1NPtyHvaOb5xGuhSm+lwFSY/iAf1pni5II2Eo7yuAb33IPw3Bb8szsLmFsahumMaB3hoeruhEynEu1NuURbzZ9vux8RjocXu/bbid/6HBp9GFqcjOe3ViMmM4rCz7mRWQ4P/Wr77778b48j2gMbrLNOIKx5oW9EV4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729514558; c=relaxed/simple; bh=4DOtYiMfCbG1A38aiVlei5pT0CL+e8Gcpgz+b7PcmRU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RC7fa09nLu74oimfZWFN05RY8SHDFZRf/TgVLuY5ao8X4s5yPFDNspFB6ca6C4zbURO5miDFBg+zZaIAiipWfiZ4+90BuA5kJH5PgWiBLpoxMgF9L6IQR7dpviokLvIF0UZtTe50rzYvU5dEwfuoxSsi6noU0Ib/Mv49q6I/Ako= 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=JSSD+8+r; arc=none smtp.client-ip=209.85.210.43 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="JSSD+8+r" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-7181285c7c4so1871089a34.0 for ; Mon, 21 Oct 2024 05:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729514555; x=1730119355; 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=rHLsa4gcU83rgazUAcF5LIdA4oeDmboQeAARMvulF9E=; b=JSSD+8+rKokueiZlP0MEkwKtGbz893CKu5rd/hAC0qgBHQAzQFIecQOr2aFiToOH3Z cFfougkMJjk46tQxWMPXQUfo2j0tlHLO2XCpCRZRFOdRJh+o3XaSco9Oa+ktnaA4YB5u 4waIy17yZZknXcJEE1me7EtpUnjg8KBLwWAepj7+RAZ5zKph9IEGkie8C0coPnERW7C9 OwB9j5fyJhwYcAQSSUfRpBxVDC8xUz8YUZTOhw9X94M0etANOzXqrU0K2etzkEkkDBI+ Y3RgyFLtbYwcya5cc0Ry552/ZICeD+bbz+kyqp6+S3x2WMSiH2I5kkB0hhmuYTHydZSH IlcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729514555; x=1730119355; 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=rHLsa4gcU83rgazUAcF5LIdA4oeDmboQeAARMvulF9E=; b=IhVASbVZtbqiRYaW5VeTQJmdG/ygjGQ9FStsy4I5tY4rSkHmCoG9fUWGZNeeuBLTeP 9nLI+mEyg1mNNO8xhEfj8BwHUdxkn/ZCpfU/undBxFV9OCwWd7e1sN3BkuEk/zupZTAf 3e13XMTcl59frlZr+dBxg8SLgCfvliT/jrfZyLhbeB+tr5b0Rho35h6StDIsj5nVVNFn LOTBcy2KK/9bceFcEBd3Hs8zhRyaKaiI+XdnKgFHsBz7VeFgK7qxGDvbKQTxlpXhJF6H z6VlZQEkTIZETNRGm+eNW72GFhBgQ7zP+q17V4SL2jUOROmcU82BEYQ3NU98eGGkfJxN +wqQ== X-Gm-Message-State: AOJu0YxKg1kNsJRCcA4y9KgdwjbCpvg5mrCVdwHl+QkVAup0Oz727iaJ xqec/5PhLPqj7/2NnpKwoCNpYqHeyghpYP1lVMkeNwEo3WTzRbhsXIS41w== X-Google-Smtp-Source: AGHT+IGpMyDSXWrtV4vqBlLPNn7un73F5tbAdpGeKGBMDCvKekCa4MdOQPfTNi1mg0qSOC9nwls/hQ== X-Received: by 2002:a05:6830:6504:b0:709:396c:f295 with SMTP id 46e09a7af769-7181a8d8097mr7553769a34.32.1729514555462; Mon, 21 Oct 2024 05:42:35 -0700 (PDT) Received: from LOCLAP699.localdomain ([72.46.116.182]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6ce00999ab0sm17006586d6.93.2024.10.21.05.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 05:42:35 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/3] frame-xchg: add DPP frame group Date: Mon, 21 Oct 2024 05:42:27 -0700 Message-Id: <20241021124228.145516-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021124228.145516-1-prestwoj@gmail.com> References: <20241021124228.145516-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- src/frame-xchg.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frame-xchg.h b/src/frame-xchg.h index 3f1e0e55..7ca6e9b7 100644 --- a/src/frame-xchg.h +++ b/src/frame-xchg.h @@ -41,6 +41,7 @@ enum frame_xchg_group { FRAME_GROUP_DEFAULT = 0, FRAME_GROUP_P2P_LISTEN, FRAME_GROUP_P2P_CONNECT, + FRAME_GROUP_DPP, }; bool frame_watch_add(uint64_t wdev_id, uint32_t group, uint16_t frame_type, From patchwork Mon Oct 21 12:42:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13844089 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (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 E01EB1F4FA1 for ; Mon, 21 Oct 2024 12:42:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729514560; cv=none; b=uj5RIJafKVIABY198fJghEaFEeW+aWtWpqLMeIY9u6GSsZ3uHeZ4Auq+etDyMvkk3dPP7lt/oFF3cX3fEqbuB/HnZvKIyoD3gKS+CPRT5JP9PJHHEwP8Ce/g0ImyYwaH3fKUGts/d/BlofyQ51dUZNRetz5bMRRl2DpfnxpwwwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729514560; c=relaxed/simple; bh=Wm0n8XYvElWvSP91YZYfuwKwtgHHzChMOQ8QVE+Y0Z4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QvOiHt6G5k01p0IncgTjluiwjB2mwCTl4zjOXeRghYX2uNsr9WH7RSMxv+3Sx2RD35aOi6DNJLACKbL3KrXtZAIow+W88RdXmdVFdYsegfnpv2j6ue++Dcjlk95VKbIGve/qU15h+uzrOSlxZ7/zxazM4cq5Ig4X/UTS0tSKYSo= 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=NzaRdgAd; arc=none smtp.client-ip=209.85.167.181 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="NzaRdgAd" Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3e60f6ea262so591202b6e.1 for ; Mon, 21 Oct 2024 05:42:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729514557; x=1730119357; 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=ifUILBcVGHThmeBEsolYHrYcMP3CfuCaq5wCJ3iBQkM=; b=NzaRdgAdvu2aKxsbbx2xVRTa+tymHVGxGdjIaFtTn/41vedG6TdlPek1RA3kfRJ1g/ 4YSh9CB56fSdcKTkZhDgCqCj9dFSkfTCpLd+stLykvH7V5YBXr3elE7RKJJAG5sCtrHo ZGOEKtUQhXYOcojNe3lUmRkYlEb9bA9cucPFYdz5JINEF3HYvTIIR4oln9fTTMd5AS+U MvlPJnT3GqtSSSzWUmSdFe5r1rTqzeW8ohZmISbBPaNWGKkbV57n4910hX3WD/9qY5/2 UJ1qwlw1k1lHKdeMQK3a38lJLIvUNU5VBG8jVmAjoJfydq/4PspIHmcIh+ymiTr4gaDj x6BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729514557; x=1730119357; 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=ifUILBcVGHThmeBEsolYHrYcMP3CfuCaq5wCJ3iBQkM=; b=DZzGTf0uri2QDLeWO1o8hCcKiD8LGKZ/1DBch049+P/4gL/CiqdVWa/0rYh2SZsab0 N8gDrLIinIkRlRO1OZkZZaH7q4p+jjif7ezSfTODu/g6eRUOuHOamFDSkHjhLBHIolgR wsSrm9DBBbF1ANZBYeXzps76d93LQvppofRcKIXVGAa8udgZYifxH6HMTyPQ3spWKhyk NJ7roIBc8r/xoKQsU9hRVUgTCFkXzXnqNnXipM5zYasymyUMe2+LQ33QhwNt7Y2FPdZY pEmxPeTUXDq0dTIvcBVv24VbGz2NGkLJbqxMPqgM51kTqnXuzFXI3NUdhDDBSc+JrTJf S/GA== X-Gm-Message-State: AOJu0YyMQQ0EtRyLJduLRoZ09tZQoetMZacmplFEp6PRzW/Yr4ZSRxPJ isIT9dOwSKiYqOsnzCNuA3bBVUiLF/jOm2oFPiQWa6doFVj+oY/RyriK0w== X-Google-Smtp-Source: AGHT+IHj2eemCipDP0pP+MFXJO5tcsI3ZHvAjIDhJ5wQamhwlTfIHHlp7Mij+vVlod6R2scGhbMs9A== X-Received: by 2002:a05:6808:318e:b0:3e5:f4f9:3280 with SMTP id 5614622812f47-3e602c50eb6mr8541204b6e.10.1729514556706; Mon, 21 Oct 2024 05:42:36 -0700 (PDT) Received: from LOCLAP699.localdomain ([72.46.116.182]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6ce00999ab0sm17006586d6.93.2024.10.21.05.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 05:42:36 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 3/3] dpp: tie frame registration to DPP state Date: Mon, 21 Oct 2024 05:42:28 -0700 Message-Id: <20241021124228.145516-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241021124228.145516-1-prestwoj@gmail.com> References: <20241021124228.145516-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Similar to several other modules DPP registers for its frame watches on init then ignores anything is receives unless DPP is actually running. Due to some recent issues surrounding ath10k and multicast frames it was discovered that simply registering for multicast RX frames causes a significant performance impact depending on the current channel load. Regardless of the impact to a single driver, it is actually more efficient to only register for the DPP frames when DPP starts rather than when IWD initializes. This prevents any of the frames from hitting userspace which would otherwise be ignored. Using the frame-xchg group ID's we can only register for DPP frames when needed, then close that group and the associated frame watches. --- src/dpp.c | 150 ++++++++++++------------------------------------------ 1 file changed, 33 insertions(+), 117 deletions(-) diff --git a/src/dpp.c b/src/dpp.c index 004b431d..f7989d2b 100644 --- a/src/dpp.c +++ b/src/dpp.c @@ -66,7 +66,6 @@ static struct l_genl_family *nl80211; static uint8_t broadcast[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static struct l_queue *dpp_list; static uint32_t mlme_watch; -static uint32_t unicast_watch; static uint8_t dpp_prefix[] = { 0x04, 0x09, 0x50, 0x6f, 0x9a, 0x1a, 0x01 }; @@ -552,6 +551,8 @@ static void dpp_reset(struct dpp_sm *dpp) dpp_property_changed_notify(dpp); + frame_watch_group_remove(dpp->wdev_id, FRAME_GROUP_DPP); + dpp->interface = DPP_INTERFACE_UNBOUND; if (station) { @@ -3475,10 +3476,11 @@ failed: dpp_reset(dpp); } -static void dpp_handle_frame(struct dpp_sm *dpp, - const struct mmpdu_header *frame, - const void *body, size_t body_len) +static void dpp_handle_frame(const struct mmpdu_header *frame, + const void *body, size_t body_len, + int rssi, void *user_data) { + struct dpp_sm *dpp = user_data; const uint8_t *ptr; /* @@ -3638,99 +3640,6 @@ retransmit: dpp_frame_timeout, dpp, NULL); } -static void dpp_unicast_notify(struct l_genl_msg *msg, void *user_data) -{ - struct dpp_sm *dpp; - const uint64_t *wdev_id = NULL; - struct l_genl_attr attr; - uint16_t type, len, frame_len; - const void *data; - const struct mmpdu_header *mpdu = NULL; - const uint8_t *body; - size_t body_len; - - if (l_genl_msg_get_command(msg) != NL80211_CMD_FRAME) - return; - - if (!l_genl_attr_init(&attr, msg)) - return; - - while (l_genl_attr_next(&attr, &type, &len, &data)) { - switch (type) { - case NL80211_ATTR_WDEV: - if (len != 8) - break; - - wdev_id = data; - break; - - case NL80211_ATTR_FRAME: - mpdu = mpdu_validate(data, len); - if (!mpdu) { - l_warn("Frame didn't validate as MMPDU"); - return; - } - - frame_len = len; - break; - } - } - - if (!wdev_id) { - l_warn("Bad wdev attribute"); - return; - } - - dpp = l_queue_find(dpp_list, match_wdev, wdev_id); - if (!dpp) - return; - - if (!mpdu) { - l_warn("Missing frame data"); - return; - } - - body = mmpdu_body(mpdu); - body_len = (const uint8_t *) mpdu + frame_len - body; - - if (body_len < sizeof(dpp_prefix) || - memcmp(body, dpp_prefix, sizeof(dpp_prefix)) != 0) - return; - - dpp_handle_frame(dpp, mpdu, body, body_len); -} - -static void dpp_frame_watch_cb(struct l_genl_msg *msg, void *user_data) -{ - if (l_genl_msg_get_error(msg) < 0) - l_error("Could not register frame watch type %04x: %i", - L_PTR_TO_UINT(user_data), l_genl_msg_get_error(msg)); -} - -/* - * Special case the frame watch which includes the presence frames since they - * require multicast support. This is only supported by ath9k, so adding - * general support to frame-xchg isn't desireable. - */ -static void dpp_frame_watch(struct dpp_sm *dpp, uint16_t frame_type, - const uint8_t *prefix, size_t prefix_len) -{ - struct l_genl_msg *msg; - - msg = l_genl_msg_new_sized(NL80211_CMD_REGISTER_FRAME, 32 + prefix_len); - - l_genl_msg_append_attr(msg, NL80211_ATTR_WDEV, 8, &dpp->wdev_id); - l_genl_msg_append_attr(msg, NL80211_ATTR_FRAME_TYPE, 2, &frame_type); - l_genl_msg_append_attr(msg, NL80211_ATTR_FRAME_MATCH, - prefix_len, prefix); - if (dpp->mcast_support) - l_genl_msg_append_attr(msg, NL80211_ATTR_RECEIVE_MULTICAST, - 0, NULL); - - l_genl_family_send(nl80211, msg, dpp_frame_watch_cb, - L_UINT_TO_PTR(frame_type), NULL); -} - static void dpp_start_enrollee(struct dpp_sm *dpp); static bool dpp_start_pkex_enrollee(struct dpp_sm *dpp); @@ -3820,8 +3729,6 @@ static void dpp_create(struct netdev *netdev) { struct l_dbus *dbus = dbus_get_bus(); struct dpp_sm *dpp = l_new(struct dpp_sm, 1); - uint8_t dpp_conf_response_prefix[] = { 0x04, 0x0b }; - uint8_t dpp_conf_request_prefix[] = { 0x04, 0x0a }; uint64_t wdev_id = netdev_get_wdev_id(netdev); dpp->netdev = netdev; @@ -3857,17 +3764,6 @@ static void dpp_create(struct netdev *netdev) */ dpp->refcount = 2; - dpp_frame_watch(dpp, 0x00d0, dpp_prefix, sizeof(dpp_prefix)); - - frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0, - dpp_conf_response_prefix, - sizeof(dpp_conf_response_prefix), false, - dpp_handle_config_response_frame, dpp, NULL); - frame_watch_add(netdev_get_wdev_id(netdev), 0, 0x00d0, - dpp_conf_request_prefix, - sizeof(dpp_conf_request_prefix), false, - dpp_handle_config_request_frame, dpp, NULL); - dpp->known_network_watch = known_networks_watch_add( dpp_known_network_watch, dpp, NULL); @@ -4012,6 +3908,26 @@ done: return 0; } +static void dpp_add_frame_watches(struct dpp_sm *dpp, bool multicast_rx) +{ + uint8_t dpp_conf_response_prefix[] = { 0x04, 0x0b }; + uint8_t dpp_conf_request_prefix[] = { 0x04, 0x0a }; + + frame_watch_add(dpp->wdev_id, FRAME_GROUP_DPP, 0x00d0, + dpp_prefix, sizeof(dpp_prefix), multicast_rx, + dpp_handle_frame, dpp, NULL); + + frame_watch_add(dpp->wdev_id, FRAME_GROUP_DPP, 0x00d0, + dpp_conf_response_prefix, + sizeof(dpp_conf_response_prefix), false, + dpp_handle_config_response_frame, dpp, NULL); + + frame_watch_add(dpp->wdev_id, FRAME_GROUP_DPP, 0x00d0, + dpp_conf_request_prefix, + sizeof(dpp_conf_request_prefix), false, + dpp_handle_config_request_frame, dpp, NULL); +} + static void dpp_start_enrollee(struct dpp_sm *dpp) { uint32_t freq = band_channel_to_freq(6, BAND_FREQ_2_4_GHZ); @@ -4051,6 +3967,8 @@ static struct l_dbus_message *dpp_dbus_start_enrollee(struct l_dbus *dbus, dpp->role = DPP_CAPABILITY_ENROLLEE; dpp->interface = DPP_INTERFACE_DPP; + dpp_add_frame_watches(dpp, false); + ret = dpp_try_disconnect_station(dpp, &wait_for_disconnect); if (ret < 0) { dpp_reset(dpp); @@ -4188,6 +4106,8 @@ static struct l_dbus_message *dpp_start_configurator_common( } else dpp->current_freq = bss->frequency; + dpp_add_frame_watches(dpp, responder); + dpp->uri = dpp_generate_uri(dpp->own_asn1, dpp->own_asn1_len, 2, netdev_get_address(dpp->netdev), &bss->frequency, 1, NULL, NULL); @@ -4517,6 +4437,8 @@ static struct l_dbus_message *dpp_dbus_pkex_start_enrollee(struct l_dbus *dbus, dpp->state = DPP_STATE_PKEX_EXCHANGE; dpp->interface = DPP_INTERFACE_PKEX; + dpp_add_frame_watches(dpp, false); + ret = dpp_try_disconnect_station(dpp, &wait_for_disconnect); if (ret < 0) { dpp_reset(dpp); @@ -4613,6 +4535,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_reset_protocol_timer(dpp, DPP_PKEX_PROTO_TIMEOUT); dpp_property_changed_notify(dpp); @@ -4741,11 +4664,6 @@ static int dpp_init(void) mlme_watch = l_genl_family_register(nl80211, "mlme", dpp_mlme_notify, NULL, NULL); - unicast_watch = l_genl_add_unicast_watch(iwd_get_genl(), - NL80211_GENL_NAME, - dpp_unicast_notify, - NULL, NULL); - dpp_list = l_queue_new(); return 0; @@ -4760,8 +4678,6 @@ static void dpp_exit(void) netdev_watch_remove(netdev_watch); - l_genl_remove_unicast_watch(iwd_get_genl(), unicast_watch); - l_genl_family_unregister(nl80211, mlme_watch); mlme_watch = 0;