From: Michal Kazior <michal.kazior@tieto.com>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, Michal Kazior <michal.kazior@tieto.com>
Subject: [RFC 08/21] mac80211: improve chanctx reservation lookup
Date: Tue, 18 Mar 2014 14:53:11 +0100 [thread overview]
Message-ID: <1395150804-24090-9-git-send-email-michal.kazior@tieto.com> (raw)
In-Reply-To: <1395150804-24090-1-git-send-email-michal.kazior@tieto.com>
Use a separate function to look for reservation
chanctx. For multi-interface/channel reservation
search sematics differ slightly.
The new routine allows reservations to be merged
with chanctx that are already reserved by other
interface(s).
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
net/mac80211/chan.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 90 insertions(+), 2 deletions(-)
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 08c7653..f6d8610 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -51,6 +51,95 @@ ieee80211_chanctx_reserved_chandef(struct ieee80211_local *local,
return compat;
}
+static const struct cfg80211_chan_def *
+ieee80211_chanctx_non_reserved_chandef(struct ieee80211_local *local,
+ struct ieee80211_chanctx *ctx,
+ const struct cfg80211_chan_def *compat)
+{
+ struct ieee80211_sub_if_data *sdata;
+
+ lockdep_assert_held(&local->chanctx_mtx);
+
+ list_for_each_entry(sdata, &ctx->assigned_vifs,
+ assigned_chanctx_list) {
+ if (rcu_access_pointer(sdata->reserved_chanctx) != NULL)
+ continue;
+
+ if (!compat)
+ compat = &sdata->vif.bss_conf.chandef;
+
+ compat = cfg80211_chandef_compatible(
+ &sdata->vif.bss_conf.chandef, compat);
+ if (!compat)
+ break;
+ }
+
+ return compat;
+}
+
+static const struct cfg80211_chan_def *
+ieee80211_chanctx_combined_chandef(struct ieee80211_local *local,
+ struct ieee80211_chanctx *ctx,
+ const struct cfg80211_chan_def *compat)
+{
+ lockdep_assert_held(&local->chanctx_mtx);
+
+ compat = ieee80211_chanctx_reserved_chandef(local, ctx, compat);
+ if (!compat)
+ return NULL;
+
+ compat = ieee80211_chanctx_non_reserved_chandef(local, ctx, compat);
+ if (!compat)
+ return NULL;
+
+ return compat;
+}
+
+static bool
+ieee80211_chanctx_can_reserve_chandef(struct ieee80211_local *local,
+ struct ieee80211_chanctx *ctx,
+ const struct cfg80211_chan_def *def)
+{
+ lockdep_assert_held(&local->chanctx_mtx);
+
+ if (ieee80211_chanctx_combined_chandef(local, ctx, NULL) &&
+ ieee80211_chanctx_combined_chandef(local, ctx, def))
+ return true;
+
+ if (!list_empty(&ctx->reserved_vifs) &&
+ ieee80211_chanctx_reserved_chandef(local, ctx, NULL) &&
+ ieee80211_chanctx_reserved_chandef(local, ctx, def))
+ return true;
+
+ return false;
+}
+
+static struct ieee80211_chanctx *
+ieee80211_find_reservation_chanctx(struct ieee80211_local *local,
+ const struct cfg80211_chan_def *chandef,
+ enum ieee80211_chanctx_mode mode)
+{
+ struct ieee80211_chanctx *ctx;
+
+ lockdep_assert_held(&local->chanctx_mtx);
+
+ if (mode == IEEE80211_CHANCTX_EXCLUSIVE)
+ return NULL;
+
+ list_for_each_entry(ctx, &local->chanctx_list, list) {
+ if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE)
+ continue;
+
+ if (!ieee80211_chanctx_can_reserve_chandef(local, ctx,
+ chandef))
+ continue;
+
+ return ctx;
+ }
+
+ return NULL;
+}
+
static enum nl80211_chan_width ieee80211_get_sta_bw(struct ieee80211_sta *sta)
{
switch (sta->bandwidth) {
@@ -771,8 +860,7 @@ int ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata,
curr_ctx = container_of(conf, struct ieee80211_chanctx, conf);
- /* try to find another context with the chandef we want */
- new_ctx = ieee80211_find_chanctx(local, chandef, mode);
+ new_ctx = ieee80211_find_reservation_chanctx(local, chandef, mode);
if (!new_ctx) {
if (curr_ctx->refcount == 1 &&
(local->hw.flags & IEEE80211_HW_CHANGE_RUNNING_CHANCTX)) {
--
1.8.5.3
next prev parent reply other threads:[~2014-03-18 13:59 UTC|newest]
Thread overview: 199+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-18 13:53 [RFC 00/21] cfg80211/mac80211: multi-vif csa Michal Kazior
2014-03-18 13:53 ` [RFC 01/21] mac80211: add support for radar detection for reservations Michal Kazior
2014-03-18 13:53 ` [RFC 02/21] cfg80211: allow drivers to iterate over matching combinations Michal Kazior
2014-03-18 13:53 ` [RFC 03/21] mac80211: add max channel calculation utility function Michal Kazior
2014-03-18 16:17 ` Eliad Peller
2014-03-19 8:32 ` Michal Kazior
2014-03-19 8:43 ` Eliad Peller
2014-03-19 8:54 ` Michal Kazior
2014-03-19 10:18 ` Eliad Peller
2014-03-18 13:53 ` [RFC 04/21] mac80211: prevent chanctx overcommit Michal Kazior
2014-03-18 16:25 ` Eliad Peller
2014-03-18 13:53 ` [RFC 05/21] mac80211: track assigned vifs in chanctx Michal Kazior
2014-03-18 13:53 ` [RFC 06/21] mac80211: track reserved " Michal Kazior
2014-03-18 13:53 ` [RFC 07/21] mac80211: improve find_chanctx() for reservations Michal Kazior
2014-03-18 16:42 ` Eliad Peller
2014-03-19 8:34 ` Michal Kazior
2014-03-19 8:47 ` Eliad Peller
2014-03-19 9:00 ` Michal Kazior
2014-03-19 10:53 ` Eliad Peller
2014-03-18 13:53 ` Michal Kazior [this message]
2014-03-18 16:57 ` [RFC 08/21] mac80211: improve chanctx reservation lookup Eliad Peller
2014-03-19 8:45 ` Michal Kazior
2014-03-18 13:53 ` [RFC 09/21] mac80211: split ieee80211_new_chanctx() Michal Kazior
2014-03-18 13:53 ` [RFC 10/21] mac80211: split ieee80211_free_chanctx() Michal Kazior
2014-03-18 13:53 ` [RFC 11/21] mac80211: fix racy usage of chanctx->refcount Michal Kazior
2014-03-18 13:53 ` [RFC 12/21] mac80211: compute chanctx refcount on-the-fly Michal Kazior
2014-03-18 13:53 ` [RFC 13/21] mac80211: implement multi-vif in-place reservations Michal Kazior
2014-03-19 18:35 ` Eliad Peller
2014-03-20 7:25 ` Michal Kazior
2014-03-18 13:53 ` [RFC 14/21] mac80211: fix CSA tx queue locking Michal Kazior
2014-03-18 13:53 ` [RFC 15/21] mac80211: split CSA finalize function Michal Kazior
2014-03-18 13:53 ` [RFC 16/21] mac80211: make check_combinations() aware of chanctx reservation Michal Kazior
2014-03-18 13:53 ` [RFC 17/21] mac80211: use chanctx reservation for AP CSA Michal Kazior
2014-03-18 13:53 ` [RFC 18/21] mac80211: use chanctx reservation for STA CSA Michal Kazior
2014-03-18 13:53 ` [RFC 19/21] mac80211: ignore cqm during csa Michal Kazior
2014-03-18 13:53 ` [RFC 20/21] mac80211: remove old unused channel switching code Michal Kazior
2014-03-18 13:53 ` [RFC 21/21] cfg80211: remove channel_switch combination check Michal Kazior
2014-03-18 15:52 ` [RFC 00/21] cfg80211/mac80211: multi-vif csa Eliad Peller
2014-03-19 9:34 ` Luca Coelho
2014-03-21 13:47 ` [PATCH v2 00/13] cfg80211/mac80211: implement multi-vif chanctx reservations Michal Kazior
2014-03-21 13:47 ` [PATCH v2 01/13] cfg80211: allow drivers to iterate over matching combinations Michal Kazior
2014-03-28 13:05 ` Johannes Berg
2014-03-28 13:21 ` Michal Kazior
2014-03-28 13:22 ` Johannes Berg
2014-03-28 13:42 ` Michal Kazior
2014-03-28 13:49 ` Johannes Berg
2014-03-21 13:47 ` [PATCH v2 02/13] mac80211: add max channel calculation utility function Michal Kazior
2014-03-21 13:47 ` [PATCH v2 03/13] mac80211: prevent chanctx overcommit Michal Kazior
2014-03-25 7:59 ` Luca Coelho
2014-03-25 8:13 ` Luca Coelho
2014-03-25 8:37 ` Michal Kazior
2014-03-25 9:45 ` Luca Coelho
2014-03-21 13:47 ` [PATCH v2 04/13] mac80211: add support for radar detection for reservations Michal Kazior
2014-03-21 13:47 ` [PATCH v2 05/13] mac80211: track assigned vifs in chanctx Michal Kazior
2014-03-28 13:06 ` Johannes Berg
2014-03-21 13:47 ` [PATCH v2 06/13] mac80211: track reserved " Michal Kazior
2014-03-28 13:07 ` Johannes Berg
2014-03-21 13:47 ` [PATCH v2 07/13] mac80211: improve find_chanctx() for reservations Michal Kazior
2014-03-28 13:08 ` Johannes Berg
2014-03-28 13:32 ` Michal Kazior
2014-03-21 13:47 ` [PATCH v2 08/13] mac80211: improve chanctx reservation lookup Michal Kazior
2014-03-21 13:47 ` [PATCH v2 09/13] mac80211: split ieee80211_new_chanctx() Michal Kazior
2014-03-21 13:47 ` [PATCH v2 10/13] mac80211: split ieee80211_free_chanctx() Michal Kazior
2014-03-21 13:47 ` [PATCH v2 11/13] mac80211: fix racy usage of chanctx->refcount Michal Kazior
2014-03-21 13:47 ` [PATCH v2 12/13] mac80211: compute chanctx refcount on-the-fly Michal Kazior
2014-03-28 13:11 ` Johannes Berg
2014-03-28 13:22 ` Michal Kazior
2014-03-28 13:25 ` Johannes Berg
2014-03-21 13:47 ` [PATCH v2 13/13] mac80211: implement multi-vif in-place reservations Michal Kazior
2014-03-31 10:39 ` [PATCH v3 00/13] cfg80211/mac80211: implement multi-vif chanctx reservations Michal Kazior
2014-03-31 10:39 ` [PATCH v3 01/13] cfg80211: allow drivers to iterate over matching combinations Michal Kazior
2014-03-31 10:39 ` [PATCH v3 02/13] mac80211: add max channel calculation utility function Michal Kazior
2014-04-08 13:23 ` Johannes Berg
2014-03-31 10:39 ` [PATCH v3 03/13] mac80211: prevent chanctx overcommit Michal Kazior
2014-03-31 10:39 ` [PATCH v3 04/13] mac80211: add support for radar detection for reservations Michal Kazior
2014-04-08 13:25 ` Johannes Berg
2014-04-09 7:05 ` Michal Kazior
2014-03-31 10:39 ` [PATCH v3 05/13] mac80211: track assigned vifs in chanctx Michal Kazior
2014-03-31 10:39 ` [PATCH v3 06/13] mac80211: track reserved " Michal Kazior
2014-03-31 10:39 ` [PATCH v3 07/13] mac80211: improve find_chanctx() for reservations Michal Kazior
2014-03-31 10:39 ` [PATCH v3 08/13] mac80211: improve chanctx reservation lookup Michal Kazior
2014-03-31 10:39 ` [PATCH v3 09/13] mac80211: split ieee80211_new_chanctx() Michal Kazior
2014-03-31 10:39 ` [PATCH v3 10/13] mac80211: split ieee80211_free_chanctx() Michal Kazior
2014-03-31 10:39 ` [PATCH v3 11/13] mac80211: fix racy usage of chanctx->refcount Michal Kazior
2014-03-31 10:39 ` [PATCH v3 12/13] mac80211: compute chanctx refcount on-the-fly Michal Kazior
2014-03-31 10:39 ` [PATCH v3 13/13] mac80211: implement multi-vif in-place reservations Michal Kazior
2014-03-31 16:15 ` Eliad Peller
2014-04-01 5:10 ` Michal Kazior
2014-04-01 7:46 ` Eliad Peller
2014-04-01 7:54 ` Michal Kazior
2014-04-01 8:10 ` Eliad Peller
2014-04-01 8:26 ` Michal Kazior
2014-04-08 13:30 ` [PATCH v3 00/13] cfg80211/mac80211: implement multi-vif chanctx reservations Johannes Berg
2014-04-08 14:00 ` Luca Coelho
2014-04-09 7:07 ` Michal Kazior
2014-04-09 13:29 ` [PATCH v4 " Michal Kazior
2014-04-09 13:29 ` [PATCH v4 01/13] cfg80211: allow drivers to iterate over matching combinations Michal Kazior
2014-04-09 13:29 ` [PATCH v4 02/13] mac80211: add max channel calculation utility function Michal Kazior
2014-04-09 13:29 ` [PATCH v4 03/13] mac80211: prevent chanctx overcommit Michal Kazior
2014-04-09 13:29 ` [PATCH v4 04/13] mac80211: add support for radar detection for reservations Michal Kazior
2014-04-09 13:29 ` [PATCH v4 05/13] mac80211: track assigned vifs in chanctx Michal Kazior
2014-04-09 13:29 ` [PATCH v4 06/13] mac80211: track reserved " Michal Kazior
2014-04-09 13:29 ` [PATCH v4 07/13] mac80211: improve find_chanctx() for reservations Michal Kazior
2014-04-09 13:29 ` [PATCH v4 08/13] mac80211: improve chanctx reservation lookup Michal Kazior
2014-04-09 13:29 ` [PATCH v4 09/13] mac80211: split ieee80211_new_chanctx() Michal Kazior
2014-04-09 13:29 ` [PATCH v4 10/13] mac80211: split ieee80211_free_chanctx() Michal Kazior
2014-04-09 13:29 ` [PATCH v4 11/13] mac80211: fix racy usage of chanctx->refcount Michal Kazior
2014-04-09 13:29 ` [PATCH v4 12/13] mac80211: compute chanctx refcount on-the-fly Michal Kazior
2014-04-09 13:29 ` [PATCH v4 13/13] mac80211: implement multi-vif in-place reservations Michal Kazior
2014-04-28 16:32 ` [v4 " Zhao, Gang
2014-04-29 6:10 ` Michal Kazior
2014-04-29 19:44 ` Johannes Berg
2014-04-30 9:21 ` [PATCH v5] " Michal Kazior
2014-05-06 10:41 ` Johannes Berg
2014-05-06 12:47 ` Michal Kazior
2014-05-06 14:05 ` Johannes Berg
2014-05-07 6:05 ` Michal Kazior
2014-05-07 8:07 ` Johannes Berg
2014-05-07 8:51 ` Michal Kazior
2014-05-07 9:41 ` Luca Coelho
2014-05-07 9:40 ` Luca Coelho
2014-05-07 10:02 ` Michal Kazior
2014-05-07 10:16 ` Luca Coelho
2014-05-07 10:38 ` Michal Kazior
2014-05-07 11:09 ` Johannes Berg
2014-05-07 11:19 ` Michal Kazior
2014-05-07 11:54 ` Johannes Berg
2014-05-07 12:08 ` Luca Coelho
2014-05-07 12:13 ` Johannes Berg
2014-05-07 12:20 ` Luca Coelho
2014-05-07 12:38 ` Johannes Berg
2014-05-07 12:44 ` Michal Kazior
2014-05-07 12:53 ` Johannes Berg
2014-05-07 13:03 ` Michal Kazior
2014-05-08 10:06 ` Johannes Berg
2014-05-08 10:41 ` Michal Kazior
2014-05-13 13:42 ` Johannes Berg
2014-05-13 13:56 ` Michal Kazior
2014-05-13 15:53 ` Johannes Berg
2014-05-14 5:14 ` Michal Kazior
2014-05-14 8:25 ` Johannes Berg
2014-05-14 8:51 ` Michal Kazior
2014-05-08 10:08 ` Johannes Berg
2014-05-07 12:53 ` Luca Coelho
2014-05-07 13:06 ` Johannes Berg
2014-05-07 13:10 ` Luca Coelho
2014-05-08 10:03 ` Johannes Berg
2014-05-07 12:27 ` Michal Kazior
2014-05-07 12:36 ` Johannes Berg
2014-05-07 12:20 ` Michal Kazior
2014-05-07 12:34 ` Johannes Berg
2014-05-07 11:48 ` Luca Coelho
2014-05-07 9:27 ` Luca Coelho
2014-05-07 11:09 ` Johannes Berg
2014-05-07 11:24 ` Luca Coelho
2014-04-25 15:20 ` [PATCH v4 00/13] cfg80211/mac80211: implement multi-vif chanctx reservations Johannes Berg
2014-04-28 6:16 ` Michal Kazior
2014-03-21 13:52 ` [PATCH v2 0/7] cfg80211/mac80211: implement multi-vif csa Michal Kazior
2014-03-21 13:52 ` [PATCH v2 1/7] cfg80211: fix radar_detect combination checking Michal Kazior
2014-03-28 12:59 ` Johannes Berg
2014-03-21 13:52 ` [PATCH v2 2/7] mac80211: make check_combinations() aware of chanctx reservation Michal Kazior
2014-03-28 13:00 ` Johannes Berg
2014-03-21 13:52 ` [PATCH v2 3/7] mac80211: use chanctx reservation for AP CSA Michal Kazior
2014-03-28 13:01 ` Johannes Berg
2014-03-21 13:52 ` [PATCH v2 4/7] mac80211: use chanctx reservation for STA CSA Michal Kazior
2014-03-21 13:52 ` [PATCH v2 5/7] mac80211: ignore cqm during csa Michal Kazior
2014-03-21 13:52 ` [PATCH v2 6/7] mac80211: remove old unused channel switching code Michal Kazior
2014-03-28 13:03 ` Johannes Berg
2014-03-21 13:52 ` [PATCH v2 7/7] cfg80211: remove channel_switch combination check Michal Kazior
2014-03-31 12:04 ` [PATCH v3 0/5] cfg80211/mac80211: implement multi-vif csa Michal Kazior
2014-03-31 12:04 ` [PATCH v3 1/5] mac80211: make check_combinations() aware of chanctx reservation Michal Kazior
2014-03-31 12:04 ` [PATCH v3 2/5] mac80211: use chanctx reservation for AP CSA Michal Kazior
2014-03-31 13:12 ` Michal Kazior
2014-03-31 12:04 ` [PATCH v3 3/5] mac80211: use chanctx reservation for STA CSA Michal Kazior
2014-03-31 12:04 ` [PATCH v3 4/5] mac80211: ignore cqm during csa Michal Kazior
2014-03-31 12:04 ` [PATCH v3 5/5] cfg80211: remove channel_switch combination check Michal Kazior
2014-04-09 13:45 ` [PATCH v4 0/5] cfg80211/mac80211: implement multi-vif csa Michal Kazior
2014-04-09 13:45 ` [PATCH v4 1/5] mac80211: make check_combinations() aware of chanctx reservation Michal Kazior
2014-04-09 13:45 ` [PATCH v4 2/5] mac80211: use chanctx reservation for AP CSA Michal Kazior
2014-05-06 14:42 ` Johannes Berg
2014-05-07 7:25 ` Michal Kazior
2014-05-07 8:05 ` Johannes Berg
2014-05-07 9:05 ` Michal Kazior
2014-05-07 9:06 ` Michal Kazior
2014-05-07 9:07 ` Johannes Berg
2014-05-07 9:41 ` Michal Kazior
2014-05-07 11:17 ` Johannes Berg
2014-05-07 11:43 ` Michal Kazior
2014-05-07 11:50 ` Johannes Berg
2014-05-07 12:12 ` Michal Kazior
2014-04-09 13:45 ` [PATCH v4 3/5] mac80211: use chanctx reservation for STA CSA Michal Kazior
2014-05-06 14:43 ` Johannes Berg
2014-05-07 7:35 ` Michal Kazior
2014-05-07 8:03 ` Johannes Berg
2014-04-09 13:45 ` [PATCH v4 4/5] mac80211: ignore cqm during csa Michal Kazior
2014-05-06 14:45 ` Johannes Berg
2014-04-09 13:45 ` [PATCH v4 5/5] cfg80211: remove channel_switch combination check Michal Kazior
2014-05-06 14:45 ` Johannes Berg
2014-05-07 7:40 ` Michal Kazior
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=1395150804-24090-9-git-send-email-michal.kazior@tieto.com \
--to=michal.kazior@tieto.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).