2007-05-03 23:42:03

by Jiri Benc

[permalink] [raw]
Subject: [PATCH] mac80211: don't break without 802.11 qdisc

Jan, could you test if this patch fixes your problems with removing of
802.11 qdisc? (It applies on top of the patch
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-dev.git;a=commitdiff_plain;h=00a908826e778b39a802013729f7826c2d575360 )

Thanks,

Jiri

---

This patch prevents things from going crazy when the 802.11 qdisc is not
installed (because it is removed using tc or because CONFIG_NET_SCHED is not
set).

Co-author: Michael Wu <[email protected]>
Signed-off-by: Jiri Benc <[email protected]>

---
net/mac80211/ieee80211.c | 30 +++++++++++++++++++++---------
net/mac80211/wme.h | 2 +-
2 files changed, 22 insertions(+), 10 deletions(-)

--- mac80211.orig/net/mac80211/ieee80211.c
+++ mac80211/net/mac80211/ieee80211.c
@@ -1215,6 +1215,11 @@ static int __ieee80211_tx(struct ieee802
struct ieee80211_tx_control *control = tx->u.tx.control;
int ret, i;

+ if (!ieee80211_qdisc_installed(local->mdev) &&
+ __ieee80211_queue_stopped(local, 0)) {
+ netif_stop_queue(local->mdev);
+ return IEEE80211_TX_AGAIN;
+ }
if (skb) {
ieee80211_dump_frame(local->mdev->name, "TX to low-level driver", skb);
ret = local->ops->tx(local_to_hw(local), skb, control);
@@ -1404,8 +1409,13 @@ static void ieee80211_tx_pending(unsigne
}
}
netif_tx_unlock_bh(dev);
- if (reschedule)
- netif_schedule(dev);
+ if (reschedule) {
+ if (!ieee80211_qdisc_installed(dev)) {
+ if (!__ieee80211_queue_stopped(local, 0))
+ netif_wake_queue(dev);
+ } else
+ netif_schedule(dev);
+ }
}

static void ieee80211_clear_tx_pending(struct ieee80211_local *local)
@@ -2304,12 +2314,6 @@ static int ieee80211_master_open(struct
struct ieee80211_sub_if_data *sdata;
int res = -EOPNOTSUPP;

- if (!ieee80211_qdisc_installed(dev)) {
- printk(KERN_ERR "%s: ieee80211 qdisc not installed\n",
- dev->name);
- return res;
- }
-
read_lock(&local->sub_if_lock);
list_for_each_entry(sdata, &local->sub_if_list, list) {
if (sdata->dev != dev && netif_running(sdata->dev)) {
@@ -5026,7 +5030,11 @@ void ieee80211_wake_queue(struct ieee802
&local->state[queue]))
tasklet_schedule(&local->tx_pending_tasklet);
else
- __netif_schedule(local->mdev);
+ if (!ieee80211_qdisc_installed(local->mdev)) {
+ if (queue == 0)
+ netif_wake_queue(local->mdev);
+ } else
+ __netif_schedule(local->mdev);
}
}
EXPORT_SYMBOL(ieee80211_wake_queue);
@@ -5035,6 +5043,8 @@ void ieee80211_stop_queue(struct ieee802
{
struct ieee80211_local *local = hw_to_local(hw);

+ if (!ieee80211_qdisc_installed(local->mdev) && queue == 0)
+ netif_stop_queue(local->mdev);
set_bit(IEEE80211_LINK_STATE_XOFF, &local->state[queue]);
}
EXPORT_SYMBOL(ieee80211_stop_queue);
@@ -5046,6 +5056,8 @@ void ieee80211_start_queues(struct ieee8

for (i = 0; i < local->hw.queues; i++)
clear_bit(IEEE80211_LINK_STATE_XOFF, &local->state[i]);
+ if (!ieee80211_qdisc_installed(local->mdev))
+ netif_start_queue(local->mdev);
}
EXPORT_SYMBOL(ieee80211_start_queues);

--- mac80211.orig/net/mac80211/wme.h
+++ mac80211/net/mac80211/wme.h
@@ -42,7 +42,7 @@ static inline void ieee80211_install_qdi
}
static inline int ieee80211_qdisc_installed(struct net_device *dev)
{
- return 1;
+ return 0;
}

static inline int ieee80211_wme_register(void)


--
Jiri Benc
SUSE Labs


2007-05-04 17:43:44

by Michael Wu

[permalink] [raw]
Subject: Re: [PATCH] mac80211: don't break without 802.11 qdisc

On Friday 04 May 2007 13:22, Jan Kiszka wrote:
> What should be the effect of the patch? Catch, revert, or even prevent
> this qdisc change of a shutdown and/or running wlan device?
>
It merely makes it so that it is safe to not use the ieee80211 qdisc.

-Michael Wu


Attachments:
(No filename) (267.00 B)
(No filename) (189.00 B)
Download all attachments

2007-05-04 17:23:12

by Jan Kiszka

[permalink] [raw]
Subject: Re: [PATCH] mac80211: don't break without 802.11 qdisc

Jiri Benc wrote:
> Jan, could you test if this patch fixes your problems with removing of
> 802.11 qdisc? (It applies on top of the patch
> http://git.kernel.org/?p=linux/kernel/git/linville/wireless-dev.git;a=commitdiff_plain;h=00a908826e778b39a802013729f7826c2d575360 )

Depends on how we define "fix": I'm still able to tweak the qdisc of
wmaster0 (and so will shorewall). That may or may not lead to some BUG
(WARN_ON) of the 80211 stack later on as it used to, I need to watch a
bit longer.

What should be the effect of the patch? Catch, revert, or even prevent
this qdisc change of a shutdown and/or running wlan device?

Jan


Attachments:
signature.asc (250.00 B)
OpenPGP digital signature

2007-05-04 19:05:36

by Jan Kiszka

[permalink] [raw]
Subject: Re: [PATCH] mac80211: don't break without 802.11 qdisc

Michael Wu wrote:
> On Friday 04 May 2007 13:22, Jan Kiszka wrote:
>> What should be the effect of the patch? Catch, revert, or even prevent
>> this qdisc change of a shutdown and/or running wlan device?
>>
> It merely makes it so that it is safe to not use the ieee80211 qdisc.

So I would just run my device(s) in a suboptimal mode from that point on?

Is it possible to establish the deleted qdisc again? tc tells me
"ieee80211" is an unknown discipline. Well, this still sounds a bit...
suboptimal.

Jan


Attachments:
signature.asc (249.00 B)
OpenPGP digital signature