From patchwork Wed Oct 12 04:02:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wang X-Patchwork-Id: 1689024 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=VvFCVIlU; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=LqbxAz4f; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MnJsw3zcXz23k3 for ; Wed, 12 Oct 2022 15:03:32 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=BXMxm1Tjz/HPIRlHSQfa/ecMc36noKZGhNLPF5Jq5VE=; b=VvFCVIlUXNbbvz QHqgEYM7hOVkKIIKAKKHMpXwYIm3O88Mcgq157cyWXqIRRmcJADJ2wQdVLT2abE65cx8P2g5Qg2PW OuRL98inZady6ghUVTJWQykxjfIX/3PZWDR20ZNu8KdP7la7Twyv3geq7atdkeg7+grilKAI1msJM gzqxK9Vm6nDkefhmcYXcz3ijulMb+pqLlDdHnlDCTj7q8pAlyHtzWY3IxjoYFzP0O3gNGh1K4GvGe 1p/nBHwlm0VAHaRYspTxpCs8IN9Y92h37HIpv55MOMPngHqOxUaiL9IwzqoOcTgRdb3ufnrJkJDty COKzZpcUxwMPmsPIob8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiSwf-006j89-BW; Wed, 12 Oct 2022 04:02:13 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiSwb-006j5s-QW for hostap@lists.infradead.org; Wed, 12 Oct 2022 04:02:11 +0000 Received: by mail-pl1-x632.google.com with SMTP id n7so15151841plp.1 for ; Tue, 11 Oct 2022 21:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zUTE1/snTFcNgzwW4tmlQNexxGOjIwBcsVhGWQay4bk=; b=LqbxAz4fnpgiH4d5b6a4QngSX2hsxr359P7IzZYCPl04RO0I9m5kEHgVWE0RLI9XxX Nv/CNNo+yjjnpyNF/gmOZjzgF/F6bvGXJ0qreMABeBI/3381duwZL2t7erpKsOYmt5v7 Ma1skjkjjXvzlNibpcQ7cMJvBCuI9+7rwSpdc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=zUTE1/snTFcNgzwW4tmlQNexxGOjIwBcsVhGWQay4bk=; b=8B/xbiSbheCA6gD19/ItbCNZZ4Nwbq+14JEAyeBisj7uZlVxnRI2rg4aDFBqgEH349 cmY1Ai8E2NKNGIX9fKJklZPO4QKhzXRkEW6zsK2td7CpDv/18rSFevWP669h4yewQR8u DzT7i3r/YlYX2eKsDK1k5Tp5sTzKMp9W2OQK6/Nxqq0SHKlFnYdmP/ExDS2QwE6PEVjo x5ck/JEWsfiR+NjsfWyNy1iUMa+j1p7mYKt89m41/N4LURFMOR0CEFM6t/ELxzrLQEFL lgIVT+tkiX+U+8IE3hI4KMCgL4g8C6ir1vZcXUOv43ChCUb8BgWmD8zwZiCmFmr1WqbS 6iwQ== X-Gm-Message-State: ACrzQf0JUsOjmgt3ZR9KI01whr2D/aFYA4HLRWKBDXY0BOfQxERuF/yR xQ8rPoFIySRudWOtQ7FOdXiLymJQCkNIEg== X-Google-Smtp-Source: AMsMyM4d7VOVfxGvm4B6bbN28OcJ1CIJyHhPJNvYAqEr0NaiNPchHq7Xp1W9QUGqNjUECJnP67jxWA== X-Received: by 2002:a17:90b:3d8b:b0:20d:3e7f:32d3 with SMTP id pq11-20020a17090b3d8b00b0020d3e7f32d3mr2773154pjb.22.1665547325935; Tue, 11 Oct 2022 21:02:05 -0700 (PDT) Received: from matthewmwang2.mtv.corp.google.com ([2620:15c:9d:4:5552:2f2d:f879:3ded]) by smtp.gmail.com with ESMTPSA id a10-20020a1709027e4a00b001806f4fbf25sm8253818pln.182.2022.10.11.21.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 21:02:05 -0700 (PDT) From: Matthew Wang To: j@w1.fi Cc: hostap@lists.infradead.org, matthewmwang@chromium.org Subject: [PATCH] p2p: get cached scan results on iface creation to avoid scan Date: Tue, 11 Oct 2022 21:02:02 -0700 Message-Id: <20221012040202.208576-1-matthewmwang@chromium.org> X-Mailer: git-send-email 2.38.0.rc2.412.g84df46c1b4-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221011_210209_915093_523186AC X-CRM114-Status: GOOD ( 15.48 ) X-Spam-Score: -0.4 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This allows the p2p client to fast associate if the GO is already in the scan cache without doing a full scan. Signed-off-by: Matthew Wang --- wpa_supplicant/p2p_supplicant.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:632 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This allows the p2p client to fast associate if the GO is already in the scan cache without doing a full scan. Signed-off-by: Matthew Wang --- wpa_supplicant/p2p_supplicant.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index f6252b1aa..27ab710fe 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -6875,6 +6875,8 @@ static int wpas_start_p2p_client(struct wpa_supplicant *wpa_s, int freq, int force_scan) { struct wpa_ssid *ssid; + int other_iface_found = 0; + struct wpa_supplicant *ifs; wpa_s = wpas_p2p_get_group_iface(wpa_s, addr_allocated, 0); if (wpa_s == NULL) @@ -6919,6 +6921,26 @@ static int wpas_start_p2p_client(struct wpa_supplicant *wpa_s, wpa_s->p2p_go_group_formation_completed = 0; wpa_s->global->p2p_group_formation = wpa_s; + /* + * Get latest scan results from driver in case cached scan results from + * interfaces on the same wiphy allow us to skip the next scan by fast + * associating. Also update the scan time to the most recent scan result + * fetch time on the same radio so it reflects the actual time the last + * scan result event occurred. + */ + wpa_supplicant_update_scan_results(wpa_s); + dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant, + radio_list) { + if (ifs == wpa_s) + continue; + if (!other_iface_found || os_reltime_before(&wpa_s->last_scan, + &ifs->last_scan)) { + other_iface_found = 1; + wpa_s->last_scan.sec = ifs->last_scan.sec; + wpa_s->last_scan.usec = ifs->last_scan.usec; + } + } + eloop_cancel_timeout(wpas_p2p_group_formation_timeout, wpa_s->p2pdev, NULL); eloop_register_timeout(P2P_MAX_INITIAL_CONN_WAIT, 0,