From patchwork Mon Apr 25 12:57:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 8927781 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 189FB9F441 for ; Mon, 25 Apr 2016 12:58:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39EDC201EF for ; Mon, 25 Apr 2016 12:58:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BFA6201EC for ; Mon, 25 Apr 2016 12:58:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932596AbcDYM6Y (ORCPT ); Mon, 25 Apr 2016 08:58:24 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:40766 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932440AbcDYM6P (ORCPT ); Mon, 25 Apr 2016 08:58:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1461589095; x=1493125095; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=zU5UkgqUDMCRR7wCCvjHULykvzjmlSQfpF2UwVJp+7Y=; b=j7ViC8hfKFQMxgpjlkiC418G1WpagHtk6ini1EMjzZ6+GrArm692I6t/ j9aPoLh/eMXcD9f2V5crxoB9Gx/P9HNgx6rpE14u6tk7WpFKir4iAdfp6 xfqBwF2lvQAalfEItOYtRGL7A8eO+oxOclhBbAKeNdt1lzfSBv8lzs6+N c=; X-IronPort-AV: E=Sophos;i="5.24,532,1455004800"; d="scan'208";a="283189182" Received: from ironmsg04-r-new.qualcomm.com (HELO Ironmsg04-R.qualcomm.com) ([10.53.140.108]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 25 Apr 2016 05:58:06 -0700 X-IronPort-AV: E=McAfee;i="5700,7163,8145"; a="1182497943" Received: from lx-merez.mea.qualcomm.com ([10.18.173.103]) by Ironmsg04-R.qualcomm.com with ESMTP; 25 Apr 2016 05:58:04 -0700 From: Maya Erez To: Kalle Valo Cc: Lior David , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com, Maya Erez Subject: [PATCH v2 2/7] wil6210: support regular scan on P2P_DEVICE interface Date: Mon, 25 Apr 2016 15:57:53 +0300 Message-Id: <1461589078-29854-3-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1461589078-29854-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1461589078-29854-1-git-send-email-qca_merez@qca.qualcomm.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lior David P2P search can only run on the social channel (channel 2). When issuing a scan request on the P2P_DEVICE interface, driver ignored the channels argument and always performed a P2P search. Fix this by checking the channels argument, if it is not specified (meaning full scan) or if a non-social channel was specified, perform a regular scan and not a P2P search. Signed-off-by: Lior David Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/cfg80211.c | 5 +++-- drivers/net/wireless/ath/wil6210/p2p.c | 6 ++++++ drivers/net/wireless/ath/wil6210/wil6210.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index 12cae3c..49eb2e2 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -375,8 +375,9 @@ static int wil_cfg80211_scan(struct wiphy *wiphy, return -EBUSY; } - /* scan on P2P_DEVICE is handled as p2p search */ - if (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE) { + /* social scan on P2P_DEVICE is handled as p2p search */ + if (wdev->iftype == NL80211_IFTYPE_P2P_DEVICE && + wil_p2p_is_social_scan(request)) { wil->scan_request = request; wil->radio_wdev = wdev; rc = wil_p2p_search(wil, request); diff --git a/drivers/net/wireless/ath/wil6210/p2p.c b/drivers/net/wireless/ath/wil6210/p2p.c index 2c1b895..1c91538 100644 --- a/drivers/net/wireless/ath/wil6210/p2p.c +++ b/drivers/net/wireless/ath/wil6210/p2p.c @@ -22,6 +22,12 @@ #define P2P_SEARCH_DURATION_MS 500 #define P2P_DEFAULT_BI 100 +bool wil_p2p_is_social_scan(struct cfg80211_scan_request *request) +{ + return (request->n_channels == 1) && + (request->channels[0]->hw_value == P2P_DMG_SOCIAL_CHANNEL); +} + void wil_p2p_discovery_timer_fn(ulong x) { struct wil6210_priv *wil = (void *)x; diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index 5dee909..b6fc256 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h @@ -776,6 +776,7 @@ void wil_disable_irq(struct wil6210_priv *wil); void wil_enable_irq(struct wil6210_priv *wil); /* P2P */ +bool wil_p2p_is_social_scan(struct cfg80211_scan_request *request); void wil_p2p_discovery_timer_fn(ulong x); int wil_p2p_search(struct wil6210_priv *wil, struct cfg80211_scan_request *request);