Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp362992ybg; Fri, 12 Jun 2020 03:38:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5InFsAhVa/SagJYOM/vKQonyF58wFAKVM04tgjIQ/MMK5b5mGhbrq7wzV38IdJ04fYruE X-Received: by 2002:a05:6402:149:: with SMTP id s9mr10706746edu.375.1591958333842; Fri, 12 Jun 2020 03:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591958333; cv=none; d=google.com; s=arc-20160816; b=O3uhZhS0EJqZZfSHgrTCEzldcP4EhkWQFQQsnoEJXLLSKa3VfH/FqZ7/w2El8L3a8b 9+57JJ21AXYG2nMiUzExc4P8sPrQimAf81OV1dtH4Km7AflG0C5gmai1LchvGESvSeDX OlqprFivSUTHo07awi1RZ1FJxLHC7L1Ys/gOJHczi4wnLMKMBUroyrkgCfP37n3EYnP8 Qtf0vh1bjELXz6bACaOH0bz/YY0RhOAN/maBm8AGP0JlfvIIHSVBglW3rzFRBZzNPeh3 6StMTPftLOguPLkcAnrYXM5kcfWm7DQ9UvPhYJN/pzI2G3thocL6qhsQy15M0xyr1krd 8FXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:to:from:date:dkim-signature; bh=r3r/LlifhXssd71MGB+AGz0k2Z7U7mZc45nMA5vvgKY=; b=sBkxi5qRl0K1J7Xizp/WSU0C/0A3R9YxsH7Ka8J0kjg3WMNY9iU2yso6KZN0riiQ0i RaSMet7qEvgDHAoffeWv4y5KnvMe4VoXVaO1V/1yXPFDPOgIWyP04LUt6r2NoIUV5IXF qqp2v1PGlrHcMQ6BuRbqYD0LE9faj8VpRkm6hk33wdA0S3+6yIGzc3JwETEYsgpzaicL yQX3USfzfW2BcA6VBB4GuWCUhEFbyeAxAFNC04OZ4Z85tNRZovjTJzfUROcQ/SxxSF/1 NalCjkHH+z0hXCwEtPVY9b6AjS9SZnEDf3Hs9ZeGaSTbamUh46jho0gE+Rb8NNPERm3y wbkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iMBnMmou; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si3244625edj.537.2020.06.12.03.38.17; Fri, 12 Jun 2020 03:38:53 -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; dkim=pass header.i=@kernel.org header.s=default header.b=iMBnMmou; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726296AbgFLKfJ (ORCPT + 99 others); Fri, 12 Jun 2020 06:35:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:45506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726259AbgFLKfJ (ORCPT ); Fri, 12 Jun 2020 06:35:09 -0400 Received: from pali.im (pali.im [31.31.79.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 654EF207D8; Fri, 12 Jun 2020 10:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591958108; bh=r3r/LlifhXssd71MGB+AGz0k2Z7U7mZc45nMA5vvgKY=; h=Date:From:To:Subject:From; b=iMBnMmoux0UsnSN+qp+LjkKMGblrRfo3Fd9UgSk1GRJlPtWSKGisWYNPpgTMNIZmb e2rUSRJOi383nF+M+ndL9wbGbjEVtXcY2Yc26DxQUU/gO2EHEbi377icqvqCH+HLqt vvk9rALw0evOY4e62PUCzYUZaPtE6UJez9l1QH0o= Received: by pali.im (Postfix) id 28ED7582; Fri, 12 Jun 2020 12:35:06 +0200 (CEST) Date: Fri, 12 Jun 2020 12:35:01 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Ganapathi Bhat , Amitkumar Karwar , Xinming Hu , linux-wireless@vger.kernel.org, Marek =?utf-8?B?QmVow7pu?= Subject: mwifiex: Initialization of FW and net interface Message-ID: <20200612103501.vhwo3skvzt2243gz@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: NeoMutt/20180716 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hello! I was looking at mwifiex code which initialize card firmware and linux network interface and I think that there are some issues with this code path. There is a function mwifiex_sta_init_cmd() which basically doing two different things: * initial card firmware initialization * configuration of interface parameters via card firmware That function has following definition: int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init); 'first_sta' and 'init' is FALSE when doing just configuration of interface parameters (by cfg80211 callbacks). 'init' is TRUE when doing initial card firmware initialization and it is called when mwifiex driver is doing setup of card. But this function is called with 'init' set to TRUE multiple times when card driver was configured to create multiple linux network interfaces. In this case 'first_sta' is TRUE only for the first call of this function. And now the first suspicious thing is: Why mwifiex driver calls that initial card firmware initialization multiple times when network interfaces are created during driver setup, and not when they are created later by "iw phy phyX interface add ..."? Next, looking at code of that function mwifiex_sta_init_cmd() it looks like that all commands send to firmware are "global" and affects all existing mwifiex network interfaces. Why then it is needed to call this function when creating a new interface? (E.g. second bssid for AP mode). Also if it really affects all existing interfaces, it means that creating a new interface changes configured cfg80211 parameters of all existing interfaces to some default values. This also affects power save settings which I described in previous email: https://lore.kernel.org/linux-wireless/20200609111544.v7u5ort3yk4s7coy@pali/ And the last and the most suspicious thing in that mwifiex_sta_init_cmd function is that some AP related code is executed only during initial card firmware initialization and only if initial interface is AP mode ('init' = TRUE, 'first_sta' = TRUE, mode = 'AP'). Seems that driver behaves differently if interfaces are created by standard 'iw phy phyX interface add ..." command (via cfg80211 layer) and differently if interfaces are created automatically during driver setup function. Are there any reasons for these differences? And what to do with the fact that most firmware commands which affects all interfaces and not just one which is initializing? These issues which I described makes it hard for me to understand what is driver really doing and what should be correct behavior. By the way, do you have documentation for firmware commands?