diff mbox

[RFC] mac80211: take reserved vif into account when calculating the min_def

Message ID 1417091446-16308-1-git-send-email-emmanuel.grumbach@intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Emmanuel Grumbach Nov. 27, 2014, 12:30 p.m. UTC
When we want to calculate the minimal bandwidth needed for
a channel context, we need to take into account vifs that
have reserved the channel context.
I hit an issue with iwlwifi and channel switch as a client.

We would allocate a virgin channel context and reserve it.
At that stage, the min_def was 20MHz.
Then we would use it after CSA, and start transmitting, but
the channel context was still 20MHz even if the GO was in
40MHz. This made the firmware unhappy.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 net/mac80211/chan.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Michal Kazior Nov. 28, 2014, 6:54 a.m. UTC | #1
On 27 November 2014 at 13:30, Emmanuel Grumbach
<emmanuel.grumbach@intel.com> wrote:
> When we want to calculate the minimal bandwidth needed for
> a channel context, we need to take into account vifs that
> have reserved the channel context.
> I hit an issue with iwlwifi and channel switch as a client.
>
> We would allocate a virgin channel context and reserve it.
> At that stage, the min_def was 20MHz.
> Then we would use it after CSA, and start transmitting, but
> the channel context was still 20MHz even if the GO was in
> 40MHz. This made the firmware unhappy.
>
> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> ---
>  net/mac80211/chan.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
> index 4c74e8d..769e0c5 100644
> --- a/net/mac80211/chan.c
> +++ b/net/mac80211/chan.c
> @@ -256,7 +256,8 @@ ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local,
>                 if (!ieee80211_sdata_running(sdata))
>                         continue;
>
> -               if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf)
> +               if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf &&
> +                   &sdata->reserved_chanctx->conf != conf)
>                         continue;
>
>                 switch (vif->type) {
> @@ -271,6 +272,7 @@ ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local,
>                 case NL80211_IFTYPE_WDS:
>                 case NL80211_IFTYPE_MESH_POINT:
>                         width = vif->bss_conf.chandef.width;
> +                       width = max(width, sdata->reserved_chandef.width);

Not really sure why this is needed in this patch?


>                         break;
>                 case NL80211_IFTYPE_UNSPECIFIED:
>                 case NUM_NL80211_IFTYPES:
> @@ -899,6 +901,8 @@ int ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata,
>         sdata->reserved_radar_required = radar_required;
>         sdata->reserved_ready = false;
>
> +       ieee80211_recalc_chanctx_min_def(local, new_ctx);
> +

Hmm.. Wouldn't it make sense to recalc this in
ieee80211_vif_unreserve_ chanctx() as well?


Micha?
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Emmanuel Grumbach Nov. 30, 2014, 11:55 a.m. UTC | #2
> 

> On 27 November 2014 at 13:30, Emmanuel Grumbach

> <emmanuel.grumbach@intel.com> wrote:

> > When we want to calculate the minimal bandwidth needed for

> > a channel context, we need to take into account vifs that

> > have reserved the channel context.

> > I hit an issue with iwlwifi and channel switch as a client.

> >

> > We would allocate a virgin channel context and reserve it.

> > At that stage, the min_def was 20MHz.

> > Then we would use it after CSA, and start transmitting, but

> > the channel context was still 20MHz even if the GO was in

> > 40MHz. This made the firmware unhappy.

> >

> > Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

> > ---

> >  net/mac80211/chan.c | 6 +++++-

> >  1 file changed, 5 insertions(+), 1 deletion(-)

> >

> > diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c

> > index 4c74e8d..769e0c5 100644

> > --- a/net/mac80211/chan.c

> > +++ b/net/mac80211/chan.c

> > @@ -256,7 +256,8 @@ ieee80211_get_chanctx_max_required_bw(struct

> ieee80211_local *local,

> >                 if (!ieee80211_sdata_running(sdata))

> >                         continue;

> >

> > -               if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf)

> > +               if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf &&

> > +                   &sdata->reserved_chanctx->conf != conf)

> >                         continue;

> >

> >                 switch (vif->type) {

> > @@ -271,6 +272,7 @@ ieee80211_get_chanctx_max_required_bw(struct

> ieee80211_local *local,

> >                 case NL80211_IFTYPE_WDS:

> >                 case NL80211_IFTYPE_MESH_POINT:

> >                         width = vif->bss_conf.chandef.width;

> > +                       width = max(width, sdata->reserved_chandef.width);

> 

> Not really sure why this is needed in this patch?

> 


Hmm... You are right - I think I got confused here :)
I guess I need to verify that removing this hunk still solves my bug.
In general though, what option would you prefer?

Internally, we had different opinions here.

> 

> >                         break;

> >                 case NL80211_IFTYPE_UNSPECIFIED:

> >                 case NUM_NL80211_IFTYPES:

> > @@ -899,6 +901,8 @@ int ieee80211_vif_reserve_chanctx(struct

> ieee80211_sub_if_data *sdata,

> >         sdata->reserved_radar_required = radar_required;

> >         sdata->reserved_ready = false;

> >

> > +       ieee80211_recalc_chanctx_min_def(local, new_ctx);

> > +

> 

> Hmm.. Wouldn't it make sense to recalc this in

> ieee80211_vif_unreserve_ chanctx() as well?


Probably - I need to add this.

> 

> 

> Micha?
Emmanuel Grumbach Nov. 30, 2014, 1:07 p.m. UTC | #3
PiA+DQo+ID4gT24gMjcgTm92ZW1iZXIgMjAxNCBhdCAxMzozMCwgRW1tYW51ZWwgR3J1bWJhY2gN
Cj4gPiA8ZW1tYW51ZWwuZ3J1bWJhY2hAaW50ZWwuY29tPiB3cm90ZToNCj4gPiA+IFdoZW4gd2Ug
d2FudCB0byBjYWxjdWxhdGUgdGhlIG1pbmltYWwgYmFuZHdpZHRoIG5lZWRlZCBmb3IgYSBjaGFu
bmVsDQo+ID4gPiBjb250ZXh0LCB3ZSBuZWVkIHRvIHRha2UgaW50byBhY2NvdW50IHZpZnMgdGhh
dCBoYXZlIHJlc2VydmVkIHRoZQ0KPiA+ID4gY2hhbm5lbCB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7DQo+ID4gPiAgICAgICAgIHNkYXRhLT5yZXNl
cnZlZF9yZWFkeSA9IGZhbHNlOw0KPiA+ID4NCj4gPiA+ICsgICAgICAgaWVlZTgwMjExX3JlY2Fs
Y19jaGFuY3R4X21pbl9kZWYobG9jYWwsIG5ld19jdHgpOw0KPiA+ID4gKw0KPiA+DQo+ID4gSG1t
Li4gV291bGRuJ3QgaXQgbWFrZSBzZW5zZSB0byByZWNhbGMgdGhpcyBpbg0KPiA+IGllZWU4MDIx
MV92aWZfdW5yZXNlcnZlXyBjaGFuY3R4KCkgYXMgd2VsbD8NCj4gDQo+IFByb2JhYmx5IC0gSSBu
ZWVkIHRvIGFkZCB0aGlzLg0KPiANCj4gPg0KPiA+DQo+ID4gTWljaGHFgg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 4c74e8d..769e0c5 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -256,7 +256,8 @@  ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local,
 		if (!ieee80211_sdata_running(sdata))
 			continue;
 
-		if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf)
+		if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf &&
+		    &sdata->reserved_chanctx->conf != conf)
 			continue;
 
 		switch (vif->type) {
@@ -271,6 +272,7 @@  ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local,
 		case NL80211_IFTYPE_WDS:
 		case NL80211_IFTYPE_MESH_POINT:
 			width = vif->bss_conf.chandef.width;
+			width = max(width, sdata->reserved_chandef.width);
 			break;
 		case NL80211_IFTYPE_UNSPECIFIED:
 		case NUM_NL80211_IFTYPES:
@@ -899,6 +901,8 @@  int ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata,
 	sdata->reserved_radar_required = radar_required;
 	sdata->reserved_ready = false;
 
+	ieee80211_recalc_chanctx_min_def(local, new_ctx);
+
 	return 0;
 }