From patchwork Tue Aug 6 06:42:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreenath X-Patchwork-Id: 264880 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id 55B1D2C007A for ; Tue, 6 Aug 2013 16:43:20 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 8F82617C03A; Tue, 6 Aug 2013 02:43:17 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I1cikHoT4zCw; Tue, 6 Aug 2013 02:43:17 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id BF40E17C014; Tue, 6 Aug 2013 02:43:12 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id A304517C008 for ; Tue, 6 Aug 2013 02:43:11 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3hdQkidkATOp for ; Tue, 6 Aug 2013 02:43:06 -0400 (EDT) Received: from mms1.broadcom.com (mms1.broadcom.com [216.31.210.17]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 6BC4417C014 for ; Tue, 6 Aug 2013 02:43:06 -0400 (EDT) Received: from [10.9.208.53] by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Mon, 05 Aug 2013 23:39:10 -0700 X-Server-Uuid: 06151B78-6688-425E-9DE2-57CB27892261 Received: from IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.1.438.0; Mon, 5 Aug 2013 23:43:00 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) with Microsoft SMTP Server id 14.1.438.0; Mon, 5 Aug 2013 23:43:00 -0700 Received: from sreenath-Precision-M4700 (sreenats-linux.ban.broadcom.com [10.132.21.138]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id E4A2BF2D74 for ; Mon, 5 Aug 2013 23:42:59 -0700 (PDT) Date: Tue, 6 Aug 2013 12:12:58 +0530 From: "Sreenath Sharma" To: hostap@lists.shmoo.com Subject: [PATCH v3] nl80211: Driver capability retrieval only once the interface is UP Message-ID: <20130806064258.GA14505@sreenath-Precision-M4700> MIME-Version: 1.0 User-Agent: Mutt/1.5.21 (2010-09-15) X-WSS-ID: 7E1E458431W81101585-01-01 Content-Disposition: inline X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com The main intention of this patch is to retrieve driver capabilities only once the interface is UP, similar to the older approach before P2P_DEVICE integration. This approach will help devices which can retrieve the capabilities from firmware only once the interface is UP. v3: Applied v2 changes on top of v1 v2: Fixed hostapd compilation issue Please discard v2 and v1 patches. Signed-hostap: Sreenath Sharma --- src/drivers/driver_nl80211.c | 44 +++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index e674d9d..06e5b4f 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4011,6 +4011,30 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv) dynamic_if = dynamic_if || drv->global->if_add_wdevid_set; drv->global->if_add_wdevid_set = 0; +#ifndef HOSTAPD + if (dynamic_if) + nlmode = nl80211_get_ifmode(bss); + + if (nlmode != NL80211_IFTYPE_P2P_DEVICE) { + if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) { + if (rfkill_is_blocked(drv->rfkill)) { + wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " + "interface '%s' due to rfkill", + bss->ifname); + drv->if_disabled = 1; + send_rfkill_event = 1; + } else { + wpa_printf(MSG_ERROR, "nl80211: Could not set " + "interface '%s' UP", bss->ifname); + return -1; + } + } + + netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, + 1, IF_OPER_DORMANT); + } +#endif /* HOSTAPD */ + if (wpa_driver_nl80211_capa(drv)) return -1; @@ -4018,9 +4042,6 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv) bss->ifname, drv->phyname); #ifndef HOSTAPD - if (dynamic_if) - nlmode = nl80211_get_ifmode(bss); - /* * Make sure the interface starts up in station mode unless this is a * dynamically added interface (e.g., P2P) that was already configured @@ -4039,23 +4060,6 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv) nl80211_get_macaddr(bss); return ret; } - - if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) { - if (rfkill_is_blocked(drv->rfkill)) { - wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " - "interface '%s' due to rfkill", - bss->ifname); - drv->if_disabled = 1; - send_rfkill_event = 1; - } else { - wpa_printf(MSG_ERROR, "nl80211: Could not set " - "interface '%s' UP", bss->ifname); - return -1; - } - } - - netlink_send_oper_ifla(drv->global->netlink, drv->ifindex, - 1, IF_OPER_DORMANT); #endif /* HOSTAPD */ if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname,