Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1765201ybh; Thu, 16 Jul 2020 23:53:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2oxRJ4WZh+Ro29447pl7PyvH7cNgKKR8bfOFGuJBDJe/AtGKTh9a6H7qLjRhqNQm4SUqU X-Received: by 2002:a17:906:f911:: with SMTP id lc17mr5073374ejb.330.1594968821051; Thu, 16 Jul 2020 23:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594968821; cv=none; d=google.com; s=arc-20160816; b=0+m3f4B/30Ii8Q06pxDNAsOzOVnSfsd17VHFfUg65R9OuGrsChvmXPWRh72wtB82hW F7pkInzQbc8Ka1zLV3ILamC0dHktMlzKknP3ijNyVntwcLz9uQIgTPPvmNlXcMGs5HEK NJo9rmTYBvggr1v2K1F7bCS1a56G4ZNQwXllV0akcQGu8xj7drx6WMlR+q3h5Vwlh0ca RSNrRygipr2UPj1Xy5e4SlfQue/milYdXNBZrIu1v5JOwOs2Z6HqhJLHVgXDCP3Jg7U2 FRlB3JrnYNFFgwODAmldeSs8QLopD+BOCBWF5TL1F0NVR9/GDqy/YMLs3fsnJhab6gDC XUNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=tPWyb7wSuKlvVsBD5z1zYh+YTSmDakFubpPRZVU8J0g=; b=a1OzrsWmFaBbqOBjEKZbJkRcxu2tSrToaUm0/KwVza2lSNcB1KLo2R3V+2kV5iIJIP xlfMARfnGRhfjlIdDbowMa/lpmb0uHzrHp4F8oXVtiUOUekMtLoXzInDfD+xhUmi0p5X SN6u3Or94ue36x7UiUlamgo3QETlZ2T8qH1HOBR+7EMS3HqsiZIuFjVHJ34uyP0eA+KW D5feyqfwueaSfBY5newik7zJj8mfJsePsZqrVgHnYits2P6PhH4QwA5Cf3qtHJH6GKC0 r+3UO7M0+3RxQTZR3zSCBVtLxr/hWmdVQMUMB59wv0WB5aE5ckTpaaO7rx6vj8O4ALGC g2KQ== 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 k2si4619254eds.173.2020.07.16.23.53.17; Thu, 16 Jul 2020 23:53:41 -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 S1726863AbgGQGuF (ORCPT + 99 others); Fri, 17 Jul 2020 02:50:05 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:55019 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726635AbgGQGuF (ORCPT ); Fri, 17 Jul 2020 02:50:05 -0400 Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.69 with qID 06H6o0My9028960, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexmb06.realtek.com.tw[172.21.6.99]) by rtits2.realtek.com.tw (8.15.2/2.66/5.86) with ESMTPS id 06H6o0My9028960 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 17 Jul 2020 14:50:00 +0800 Received: from RTEXMB04.realtek.com.tw (172.21.6.97) by RTEXMB06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Fri, 17 Jul 2020 14:50:00 +0800 Received: from localhost.localdomain (172.21.68.128) by RTEXMB04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Fri, 17 Jul 2020 14:50:00 +0800 From: To: CC: Subject: [PATCH 5/7] rtw88: add ieee80211_ops::change_interface Date: Fri, 17 Jul 2020 14:49:35 +0800 Message-ID: <20200717064937.27966-6-yhchuang@realtek.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200717064937.27966-1-yhchuang@realtek.com> References: <20200717064937.27966-1-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.128] X-ClientProxiedBy: RTEXMB02.realtek.com.tw (172.21.6.95) To RTEXMB04.realtek.com.tw (172.21.6.97) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang Sometimes mac80211 will just ask driver to change the interface instead of to remove and then add a new one. And for driver, to change the interface is just simply to remove and add a new one but change the type of it. Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/mac80211.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c index c412bc54efde..bb82b044ff82 100644 --- a/drivers/net/wireless/realtek/rtw88/mac80211.c +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c @@ -231,6 +231,23 @@ static void rtw_ops_remove_interface(struct ieee80211_hw *hw, mutex_unlock(&rtwdev->mutex); } +static int rtw_ops_change_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + enum nl80211_iftype type, bool p2p) +{ + struct rtw_dev *rtwdev = hw->priv; + + rtw_info(rtwdev, "change vif %pM (%d)->(%d), p2p (%d)->(%d)\n", + vif->addr, vif->type, type, vif->p2p, p2p); + + rtw_ops_remove_interface(hw, vif); + + vif->type = type; + vif->p2p = p2p; + + return rtw_ops_add_interface(hw, vif); +} + static void rtw_ops_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *new_flags, @@ -827,6 +844,7 @@ const struct ieee80211_ops rtw_ops = { .config = rtw_ops_config, .add_interface = rtw_ops_add_interface, .remove_interface = rtw_ops_remove_interface, + .change_interface = rtw_ops_change_interface, .configure_filter = rtw_ops_configure_filter, .bss_info_changed = rtw_ops_bss_info_changed, .conf_tx = rtw_ops_conf_tx, -- 2.17.1