Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp974664pxb; Tue, 14 Sep 2021 13:02:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/e//fVz/6R8NuotOAlfzTTPuJ+iobG4kR+aqXYdJ/KIOsH5Su6VXQEH/jkuuwpshRGvR7 X-Received: by 2002:a02:630f:: with SMTP id j15mr16112051jac.62.1631649721895; Tue, 14 Sep 2021 13:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631649721; cv=none; d=google.com; s=arc-20160816; b=BM/IyACSPWEEu9JDwGHbAyqXImC6+uZEZ3mWJkeYSlm22xRcZINOgnkslXGBZ0PPjB e09fSzUKtjT+hSm12VJ7xxUAi/01m61cW2KS3C7qTjzi7qx4YdphWAveUInoTSIfyVDQ A+6z5/wCULbwyhVJXOpiS/JSgnli8o4dUSem7t0BBDfRVidE6nawQIQc4Vdlwu75so3B 0f9uBpqm4FiUoac+xPQup++h56zrf9ENz7pLQxgVRjULAILe8VTZlbCsOiPKPZL/tt8+ L4J8t8XQ6CPCjFGy/YFerspGDpZrwid8XShAIc9VqYXeOBF/csrz2nYPQnfk/ctsjXLO 6RGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=KBApnIGZPckyOohQ+oceFTDeuYkZC67j2ksjPpZYP8U=; b=tB60E6ROusjvXCLi+fqvPCAhSyAnCGcHMs5rvNL/H077Mcqm+gv86n8WhGvILPuyiP Mw17UBPxKWwuNL78lxTUDX5O9JmdO/GNXQQ4b0pyLnsl9PQKsI5QPBd/EGBJCMnXhEwm hNylGKaoA7LOUh2jL9Xn9ppuXcVWzTS2q3pIn8F7VfkhMc9AJJarh027bGNY3g6qUZhB hy2XSMu39989yn9HvHRoDouN1SCh4JrYaaiQOF7smBAxQOcXYrHyWwsumZRI7behAg6V xMDHlnmLgwNUrYO63XFDFOwLuaTJL7ziA6OdircpeWtoOfihyIoE1jjZu1jfyWQH+HiG 2y+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si13263807jak.6.2021.09.14.13.01.25; Tue, 14 Sep 2021 13:02:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233716AbhINUCG (ORCPT + 99 others); Tue, 14 Sep 2021 16:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233763AbhINUA6 (ORCPT ); Tue, 14 Sep 2021 16:00:58 -0400 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050::465:201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20595C0613D8; Tue, 14 Sep 2021 12:59:40 -0700 (PDT) Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4H8DhV5yNyzQjgH; Tue, 14 Sep 2021 21:59:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= To: Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , Kalle Valo , "David S. Miller" , Jakub Kicinski Cc: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= , Tsuchiya Yuto , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maximilian Luz , Andy Shevchenko , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH 6/9] mwifiex: Allow switching interface type from P2P_CLIENT to P2P_GO Date: Tue, 14 Sep 2021 21:59:06 +0200 Message-Id: <20210914195909.36035-7-verdre@v0yd.nl> In-Reply-To: <20210914195909.36035-1-verdre@v0yd.nl> References: <20210914195909.36035-1-verdre@v0yd.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EE06E188C Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org It's possible to change virtual interface type between P2P_CLIENT and P2P_GO, the card supports that just fine, and it happens for example when using miracast with the miraclecast software. So allow type changes between P2P_CLIENT and P2P_GO and simply call into mwifiex_change_vif_to_p2p(), which handles this just fine. We have to call mwifiex_cfg80211_deinit_p2p() before though to make sure the old p2p mode is properly uninitialized. Signed-off-by: Jonas Dreßler --- .../net/wireless/marvell/mwifiex/cfg80211.c | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index f2797102c5a2..ed4041ff9c89 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -990,11 +990,26 @@ is_vif_type_change_allowed(struct mwifiex_adapter *adapter, } case NL80211_IFTYPE_P2P_CLIENT: + switch (new_iftype) { + case NL80211_IFTYPE_ADHOC: + case NL80211_IFTYPE_STATION: + return true; + case NL80211_IFTYPE_P2P_GO: + return true; + case NL80211_IFTYPE_AP: + return adapter->curr_iface_comb.uap_intf != + adapter->iface_limit.uap_intf; + default: + return false; + } + case NL80211_IFTYPE_P2P_GO: switch (new_iftype) { case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_STATION: return true; + case NL80211_IFTYPE_P2P_CLIENT: + return true; case NL80211_IFTYPE_AP: return adapter->curr_iface_comb.uap_intf != adapter->iface_limit.uap_intf; @@ -1265,6 +1280,24 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, } case NL80211_IFTYPE_P2P_CLIENT: + if (mwifiex_cfg80211_deinit_p2p(priv)) + return -EFAULT; + + switch (type) { + case NL80211_IFTYPE_ADHOC: + case NL80211_IFTYPE_STATION: + return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype, + type, params); + case NL80211_IFTYPE_P2P_GO: + return mwifiex_change_vif_to_p2p(dev, curr_iftype, + type, params); + case NL80211_IFTYPE_AP: + return mwifiex_change_vif_to_ap(dev, curr_iftype, type, + params); + default: + goto errnotsupp; + } + case NL80211_IFTYPE_P2P_GO: if (mwifiex_cfg80211_deinit_p2p(priv)) return -EFAULT; @@ -1274,6 +1307,9 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, case NL80211_IFTYPE_STATION: return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype, type, params); + case NL80211_IFTYPE_P2P_CLIENT: + return mwifiex_change_vif_to_p2p(dev, curr_iftype, + type, params); case NL80211_IFTYPE_AP: return mwifiex_change_vif_to_ap(dev, curr_iftype, type, params); -- 2.31.1