All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 06/15] mac80211: make ieee80211_vif_to_wdev work when the vif isn't in the driver
Date: Fri,  9 Apr 2021 12:40:19 +0300	[thread overview]
Message-ID: <iwlwifi.20210409123755.6078d3517095.I1907a45f267a62dab052bcc44428aa7a2005ffc9@changeid> (raw)
In-Reply-To: <20210409094028.356611-1-luca@coelho.fi>

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

This will allow the low level driver to get the wdev during
the add_interface flow.
In order to do that, remove a few checks from there and do
not return NULL for vifs that were not yet added to the
driver. Note that all the current callers of this helper
function assume that the vif already exists:
 - The callers from the drivers already have a vif pointer.
 Before this change, ieee80211_vif_to_wdev would return NULL
 in some cases, but those callers don't even check they
 get a non-NULL pointer from ieee80211_vif_to_wdev.
 - The callers from net/mac80211/cfg.c assume the vif is
 already added to the driver as well.

So, this change has no impact on existing callers of this
helper function.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 include/net/mac80211.h |  5 +----
 net/mac80211/util.c    | 10 +---------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 2d1d629e5d14..d28f5087c8fa 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1768,10 +1768,7 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
  *
  * This can be used by mac80211 drivers with direct cfg80211 APIs
  * (like the vendor commands) that needs to get the wdev for a vif.
- *
- * Note that this function may return %NULL if the given wdev isn't
- * associated with a vif that the driver knows about (e.g. monitor
- * or AP_VLAN interfaces.)
+ * This can also be useful to get the netdev associated to a vif.
  */
 struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif);
 
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index f080fcf60e45..7e36b7363564 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -888,18 +888,10 @@ EXPORT_SYMBOL_GPL(wdev_to_ieee80211_vif);
 
 struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif)
 {
-	struct ieee80211_sub_if_data *sdata;
-
 	if (!vif)
 		return NULL;
 
-	sdata = vif_to_sdata(vif);
-
-	if (!ieee80211_sdata_running(sdata) ||
-	    !(sdata->flags & IEEE80211_SDATA_IN_DRIVER))
-		return NULL;
-
-	return &sdata->wdev;
+	return &vif_to_sdata(vif)->wdev;
 }
 EXPORT_SYMBOL_GPL(ieee80211_vif_to_wdev);
 
-- 
2.31.0


  parent reply	other threads:[~2021-04-09  9:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09  9:40 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2021-04-09 Luca Coelho
2021-04-09  9:40 ` [PATCH 01/15] mac80211: drop the connection if firmware crashed while in CSA Luca Coelho
2021-04-09  9:40 ` [PATCH 02/15] nl80211: Add new RSNXE related nl80211 extended features Luca Coelho
2021-04-09  9:40 ` [PATCH 03/15] mac80211: properly drop the connection in case of invalid CSA IE Luca Coelho
2021-04-09  9:40 ` [PATCH 04/15] wireless: align some HE capabilities with the spec Luca Coelho
2021-04-09 12:24   ` kernel test robot
2021-04-09 12:24     ` kernel test robot
2021-04-09 23:31   ` kernel test robot
2021-04-09 23:31     ` kernel test robot
2021-04-09  9:40 ` [PATCH 05/15] cfg80211: don't WARN if a self-managed device doesn't have a regdom Luca Coelho
2021-04-09  9:40 ` Luca Coelho [this message]
2021-04-09  9:40 ` [PATCH 07/15] wireless: align HE capabilities A-MPDU Length Exponent Extension Luca Coelho
2021-04-09 13:39   ` kernel test robot
2021-04-09 13:39     ` kernel test robot
2021-04-10  9:20   ` kernel test robot
2021-04-10  9:20     ` kernel test robot
2021-04-09  9:40 ` [PATCH 08/15] cfg80211: allow to specifying a reason for hw_rfkill Luca Coelho
2021-04-09  9:47   ` Johannes Berg
2021-04-09  9:55     ` Luca Coelho
2021-04-09  9:40 ` [PATCH 09/15] cfg80211: Remove wrong RNR IE validation check Luca Coelho
2021-04-09  9:40 ` [PATCH 10/15] mac80211: bail out if cipher schemes are invalid Luca Coelho
2021-04-09  9:40 ` [PATCH 11/15] wireless: fix spelling of A-MSDU in HE capabilities Luca Coelho
2021-04-09 19:02   ` kernel test robot
2021-04-09 19:02     ` kernel test robot
2021-04-09  9:40 ` [PATCH 12/15] nl80211/cfg80211: add a flag to negotiate for LMR feedback in NDP ranging Luca Coelho
2021-04-09  9:40 ` [PATCH 13/15] ieee80211: add the values of ranging parameters max LTF total field Luca Coelho
2021-04-09  9:40 ` [PATCH 14/15] mac80211: clear the beacon's CRC after channel switch Luca Coelho
2021-04-09  9:40 ` [PATCH 15/15] mac80211: aes_cmac: check crypto_shash_setkey() return value Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iwlwifi.20210409123755.6078d3517095.I1907a45f267a62dab052bcc44428aa7a2005ffc9@changeid \
    --to=luca@coelho.fi \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.