mac80211: unset FC retry bit in mesh fwding path
PATCH 1/6 mac80211: unset FC retry bit in mesh fwding path
Otherwise forwarded frames would keep the retry bit set from the previous link transmission.
--- net/mac80211/rx.c | 1 + 1 file changed, 1 insertion(+)
net/mac80211/rx.c +1 -0
@@ -2085,6 +2085,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) } fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; + fwd_hdr->frame_control &= ~cpu_to_le16 (IEEE80211_FCTL_RETRY ); info =IEEE80211_SKB_CB (fwd_skb);memset (info,0 ,sizeof (*info)); info->flags |=IEEE80211_TX_INTFL_NEED_TXPROCESSING ;
Signature · 1 line
1.7.10.4
PATCH 2/6 mac80211: exclude multicast frames from BA accounting
Since multicast aggregation is not currently supported by mac80211, we can safely ignore them when reordering aggregate MPDUs.
This fixes a bug where the expected sequence number might be reset after processing a multicast frame from a STA with an established aggregation session. The expected sequence number would then be incorrect and all aggregated frames until the sequence number rolled over would be dropped.
--- net/mac80211/rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/rx.c +2 -1
@@ -864,7 +864,8 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx,u16 sc;u8 tid, ack_policy; -if (!ieee80211_is_data_qos (hdr->frame_control)) +if (!ieee80211_is_data_qos (hdr->frame_control) || +is_multicast_ether_addr (hdr->addr1)) goto dont_reorder;/*
Signature · 1 line
1.7.10.4
Johannes Berg
maintainerRe: [PATCH 2/6] mac80211: exclude multicast frames from BA accounting
Subject should probably say "reordering" rather than "accounting"
Quoted 3 lines
Since multicast aggregation is not currently supported by mac80211, we can safely ignore them when reordering aggregate MPDUs.
Multicast may have a lower expectation of ordering than unicast, but is this really the right thing to do? It seems better to just fix it?
johannes
Re: [PATCH 2/6] mac80211: exclude multicast frames from BA accounting
Quoted 8 lines · Johannes Berg
Subject should probably say "reordering" rather than "accounting"
Quoted 3 lines
Since multicast aggregation is not currently supported by mac80211, we can safely ignore them when reordering aggregate MPDUs.
Multicast may have a lower expectation of ordering than unicast, but is this really the right thing to do? It seems better to just fix it?
It appears one of our changes actually introduced this bug! It is not reproducible with mac80211-next. Thanks for making me take a closer look at this.
Signature · 1 line
Thomas
PATCH 3/6 mac80211: ieee80211_queue_stopped returns reasons
In reply to Thomas PedersenHave ieee80211_queue_stopped() return a bitmap of enum queue_stop_reasons while checking queue status. This is handy when we care about the queue stop reason codes.
--- include/net/mac80211.h | 10 +++++++--- net/mac80211/util.c | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-)
include/net/mac80211.h +7 -3
@@ -3589,15 +3589,19 @@ void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);/** * ieee80211_queue_stopped - test status of the queue +* * @hw: pointer as obtained from ieee80211_alloc_hw(). * @queue: queue number (counted from zero). * * Drivers should use this function instead of netif_stop_queue. * -* Return: %true if the queue is stopped. %false otherwise. +* Return 0 if queue not stopped, or else a bitmap of +* queue_stop_reasons. +* +* If @queue doesn't exist, return -1UL. +* */ - -int ieee80211_queue_stopped (struct ieee80211_hw *hw,int queue); +unsigned long ieee80211_queue_stopped (struct ieee80211_hw *hw,int queue);/** * ieee80211_stop_queues - stop all queues
net/mac80211/util.c +4 -4
@@ -475,17 +475,17 @@ void ieee80211_stop_queues(struct ieee80211_hw *hw) }EXPORT_SYMBOL (ieee80211_stop_queues); -int ieee80211_queue_stopped (struct ieee80211_hw *hw,int queue) +unsigned long ieee80211_queue_stopped (struct ieee80211_hw *hw,int queue) {struct ieee80211_local *local =hw_to_local (hw);unsigned long flags; -int ret; +unsigned long ret;if (WARN_ON (queue >= hw->queues)) -return true; +return -1UL ;spin_lock_irqsave (&local->queue_stop_reason_lock, flags); - ret = !!local->queue_stop_reasons[queue]; + ret = local->queue_stop_reasons[queue];spin_unlock_irqrestore (&local->queue_stop_reason_lock, flags);return ret; }
Signature · 1 line
1.7.10.4
Re: [PATCH 3/6] mac80211: ieee80211_queue_stopped returns reasons
Hi Thomas,
Quoted 15 lines · Thomas Pedersen
Have
ieee80211_queue_stopped()return a bitmap of enumqueue_stop_reasonswhile checking queue status. This is handy when we care about the queue stop reason codes.Signed-off-by Thomas Pedersen <[email protected]>--- include/net/mac80211.h | 10 +++++++--- net/mac80211/util.c | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-)include/net/mac80211.h +0
-0
include/net/mac80211.h void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); · line 3592
Quoted 4 lines
include/net/mac80211.h +1
-0@@ -3589,15 +3589,19 @@ void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);/** * ieee80211_queue_stopped - test status of the queue +*
I think you added this new line by mistake.
Cheers,
Signature · 4 lines
Antonio Quartulli ..each of us alone is worth nothing.. Ernesto "Che" Guevara
Johannes Berg
maintainerRe: [PATCH 3/6] mac80211: ieee80211_queue_stopped returns reasons
In reply to Thomas PedersenQuoted 3 lines · Thomas Pedersen
Have
ieee80211_queue_stopped()return a bitmap of enumqueue_stop_reasonswhile checking queue status. This is handy when we care about the queue stop reason codes.
Nack. The driver must not care about the reasons, they're purely internal to mac80211.
johannes
Re: [PATCH 3/6] mac80211: ieee80211_queue_stopped returns reasons
Quoted 7 lines · Johannes Berg
Quoted 3 lines · Thomas Pedersen
Have
ieee80211_queue_stopped()return a bitmap of enumqueue_stop_reasonswhile checking queue status. This is handy when we care about the queue stop reason codes.Nack. The driver must not care about the reasons, they're purely internal to mac80211.
OK those functions are exported to the drivers. The 'enum queue_stop_reason' is defined in ieee80211_i.h, so the driver wouldn't be able to interpret them anyway?
Would you prefer a utility function internal to mac80211 which does return the reason, or just the following pattern?
if (ieee80211_queue_stopped(hw, queue)) {
qreason = hw_to_local(hw)->queue_stop_reasons[queue];
if (qreason & ~(ALLOWED_QUEUE_STOP_REASONS))
something;
}Thanks,
Signature · 1 line
Thomas
Johannes Berg
maintainerRe: [PATCH 3/6] mac80211: ieee80211_queue_stopped returns reasons
Quoted 3 lines · Thomas Pedersen
OK those functions are exported to the drivers. The 'enum
queue_stop_reason' is defined inieee80211_i.h, so the driver wouldn't be able to interpret them anyway?
Oh, you're way underestimating the creativity of driver authors :-)
Quoted 2 lines
Would you prefer a utility function internal to mac80211 which does return the reason,
That seems fine, although a bit more inefficient?
Quoted 7 lines
or just the following pattern?
if (ieee80211_queue_stopped(hw, queue)) { qreason = hw_to_local(hw)->queue_stop_reasons[queue]; if (qreason & ~(ALLOWED_QUEUE_STOP_REASONS)) something; }
That seems racy? Even asking whether it's stopped is racy though, what are you even trying to accomplish?
johannes
Re: [PATCH 3/6] mac80211: ieee80211_queue_stopped returns reasons
Quoted 15 lines · Johannes Berg
Quoted 3 lines · Thomas Pedersen
OK those functions are exported to the drivers. The 'enum
queue_stop_reason' is defined inieee80211_i.h, so the driver wouldn't be able to interpret them anyway?Oh, you're way underestimating the creativity of driver authors :-)
Quoted 2 lines
Would you prefer a utility function internal to mac80211 which does return the reason,
That seems fine, although a bit more inefficient?
Quoted 2 lines
or just the following pattern?
Quoted 8 lines
Quoted 5 lines
if (ieee80211_queue_stopped(hw, queue)) { qreason = hw_to_local(hw)->queue_stop_reasons[queue]; if (qreason & ~(ALLOWED_QUEUE_STOP_REASONS)) something; }That seems racy? Even asking whether it's stopped is racy though, what are you even trying to accomplish?
Yeah, that's why I'd like to get the reason the first time.
_h_mesh_fwding() checks whether the outgoing queue is stopped, to avoid piling frames on the pending queue if the outgoing medium is busy. I guess the idea was to avoid queueing frames faster than the hardware could unload them. Maybe this doesn't actually happen, but we can be a little bit smarter about when to drop forwarded frames. Like if skbs are just being added to the outgoing queue, we probably shouldn't.
This patch and the next one show a small improvement in throughput and loss % in the forwarding path.
Signature · 1 line
Thomas
Johannes Berg
maintainerRe: [PATCH 3/6] mac80211: ieee80211_queue_stopped returns reasons
Quoted 5 lines · Thomas Pedersen
Quoted 2 lines
That seems racy? Even asking whether it's stopped is racy though, what are you even trying to accomplish?
Yeah, that's why I'd like to get the reason the first time.
Quoted 7 lines
_h_mesh_fwding()checks whether the outgoing queue is stopped, to avoid piling frames on the pending queue if the outgoing medium is busy. I guess the idea was to avoid queueing frames faster than the hardware could unload them. Maybe this doesn't actually happen, but we can be a little bit smarter about when to drop forwarded frames. Like if skbs are just being added to the outgoing queue, we probably shouldn't.
Technically I guess that can happen if your inbound link is better than the outbound one? But it'll depend on the AC parameters etc. too.
However it seems that ieee80211_queue_stopped() is actually kinda broken and should only return the 'driver-stopped' reason to start with. If you fix that, it's probably good enough for you. I don't think in patch 4 you should drop frames for scanning, for example.
johannes
Re: [PATCH 3/6] mac80211: ieee80211_queue_stopped returns reasons
Quoted 15 lines · Johannes Berg
Quoted 5 lines · Thomas Pedersen
Quoted 2 lines
That seems racy? Even asking whether it's stopped is racy though, what are you even trying to accomplish?
Yeah, that's why I'd like to get the reason the first time.
Quoted 7 lines
_h_mesh_fwding()checks whether the outgoing queue is stopped, to avoid piling frames on the pending queue if the outgoing medium is busy. I guess the idea was to avoid queueing frames faster than the hardware could unload them. Maybe this doesn't actually happen, but we can be a little bit smarter about when to drop forwarded frames. Like if skbs are just being added to the outgoing queue, we probably shouldn't.
Quoted 7 lines
Technically I guess that can happen if your inbound link is better than the outbound one? But it'll depend on the AC parameters etc. too.
However it seems that
ieee80211_queue_stopped()is actually kinda broken and should only return the 'driver-stopped' reason to start with. If you fix that, it's probably good enough for you. I don't think in patch 4 you should drop frames for scanning, for example.
It looks like mac80211 already just checks local->queue_stop_reasons for being 0 (or not), so that check would still hold. I'm not 100% sure the driver calls to ieee80211_queue_stopped() only returning true for REASON_DRIVER are ok? What if the queues are being flushed, or say REASON_PS is set?
Signature · 1 line
Thomas
Johannes Berg
maintainerRe: [PATCH 3/6] mac80211: ieee80211_queue_stopped returns reasons
Quoted 10 lines · Thomas Pedersen
Quoted 4 lines
However it seems that
ieee80211_queue_stopped()is actually kinda broken and should only return the 'driver-stopped' reason to start with. If you fix that, it's probably good enough for you. I don't think in patch 4 you should drop frames for scanning, for example.It looks like mac80211 already just checks
local->queue_stop_reasonsfor being 0 (or not), so that check would still hold. I'm not 100% sure the driver calls toieee80211_queue_stopped()only returning true forREASON_DRIVERare ok? What if the queues are being flushed, or sayREASON_PSis set?
I looked at the drivers, and while (almost?) all of them use it incorrectly they really want only REASON_DRIVER. In fact, they'd be better off with just that even in the incorrect usages.
johannes
PATCH 4/6 mac80211: limit mesh forwarding drops
In reply to Thomas PedersenIn case of the HW asking mac80211 to back off, the queues would be stopped with reason DRIVER.
Limit dropping forwarded mesh data frames by putting them on the pending queue anyway if the outgoing HW queues appear to be only momentarily stopped.
--- net/mac80211/rx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/mac80211/rx.c +4 -1
@@ -1997,6 +1997,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;__le16 reason =cpu_to_le16 (WLAN_REASON_MESH_PATH_NOFORWARD );u16 q, hdrlen; +unsigned long qreason; hdr = (struct ieee80211_hdr *) skb->data; hdrlen =ieee80211_hdrlen (hdr->frame_control);
@@ -2064,7 +2065,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)return RX_CONTINUE ; q =ieee80211_select_queue_80211 (sdata, skb, hdr); -if (ieee80211_queue_stopped (&local->hw, q)) { + qreason =ieee80211_queue_stopped (&local->hw, q); +if (qreason & ~(IEEE80211_QUEUE_STOP_REASON_SKB_ADD | +IEEE80211_QUEUE_STOP_REASON_AGGREGATION )) {IEEE80211_IFSTA_MESH_CTR_INC (ifmsh, dropped_frames_congestion);return RX_DROP_MONITOR ; }
Signature · 1 line
1.7.10.4
PATCH 5/6 mac80211: stringify another plink state
In reply to Thomas PedersenThe patch "mac80211: stringify mesh peering events" missed an opportunity to print the peering state as a string.
--- net/mac80211/mesh_plink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mac80211/mesh_plink.c +2 -2
@@ -544,8 +544,8 @@ static void mesh_plink_timer(unsigned long data)return ; }mpl_dbg (sta->sdata, -"Mesh plink timer for %pM fired on state %d\n" , - sta->sta.addr, sta->plink_state); +"Mesh plink timer for %pM fired on state %s\n" , + sta->sta.addr, mplstates[sta->plink_state]); reason =0 ; llid = sta->llid; plid = sta->plid;
Signature · 1 line
1.7.10.4
Re: [PATCH 5/6] mac80211: stringify another plink state
Quoted 2 lines · Thomas Pedersen
The patch "mac80211: stringify mesh peering events" missed an opportunity to print the peering state as a string.
Applied.
johannes
PATCH 6/6 mac80211: avoid mesh peer rate update warning
In reply to Thomas PedersenSome drivers (like ath9k_htc) will take a mutex in rate_control_rate_update(), so drop the sta lock before we get there.
Can go towards 3.9.
--- net/mac80211/mesh_plink.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/mac80211/mesh_plink.c +5 -4
@@ -379,8 +379,10 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, sta->last_rx = jiffies;/* rates and capabilities don't change during peering */ -if (sta->plink_state ==NL80211_PLINK_ESTAB ) - goto out; +if (sta->plink_state ==NL80211_PLINK_ESTAB ) { +spin_unlock_bh (&sta->lock); +return ; + }if (sta->sta.supp_rates[band] != rates) changed |=IEEE80211_RC_SUPP_RATES_CHANGED ;
@@ -398,13 +400,12 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, changed |=IEEE80211_RC_BW_CHANGED ; sta->sta.bandwidth =IEEE80211_STA_RX_BW_20 ; } +spin_unlock_bh (&sta->lock);if (insert)rate_control_rate_init (sta);else rate_control_rate_update (local, sband, sta, changed); -out: -spin_unlock_bh (&sta->lock); } static struct sta_info *
Signature · 1 line
1.7.10.4
Johannes Berg
maintainerRe: [PATCH 6/6] mac80211: avoid mesh peer rate update warning
Quoted 3 lines · Thomas Pedersen
Some drivers (like
ath9k_htc) will take a mutex inrate_control_rate_update(), so drop the sta lock before we get there.
That driver is broken then. rate_control_rate_update() can be called from the RX path where this also isn't allowed.
johannes
Johannes Berg
maintainerRe: [PATCH 6/6] mac80211: avoid mesh peer rate update warning
Quoted 7 lines · Johannes Berg
Quoted 3 lines · Thomas Pedersen
Some drivers (like
ath9k_htc) will take a mutex inrate_control_rate_update(), so drop the sta lock before we get there.That driver is broken then.
rate_control_rate_update()can be called from the RX path where this also isn't allowed.
* @sta_rc_update: Notifies the driver of changes to the bitrates that
can be
* used to transmit to the station. The changes are advertised with
bits
* from &enum ieee80211_rate_control_changed and the values are
reflected
* in the station data. This callback should only be used when the
driver
* uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL)
since
* otherwise the rate control algorithm is notified directly.
* Must be atomic.
(note last line)
johannes
Re: [PATCH 6/6] mac80211: avoid mesh peer rate update warning
Quoted 22 lines · Johannes Berg
Quoted 7 lines · Johannes Berg
Quoted 3 lines · Thomas Pedersen
Some drivers (like
ath9k_htc) will take a mutex inrate_control_rate_update(), so drop the sta lock before we get there.That driver is broken then.
rate_control_rate_update()can be called from the RX path where this also isn't allowed.* @sta_rc_update: Notifies the driver of changes to the bitrates that
can be
* used to transmit to the station. The changes are advertised with
bits
* from &enumieee80211_rate_control_changedand the values are
reflected
* in the station data. This callback should only be used when the
driver
* uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL)
since
* otherwise the rate control algorithm is notified directly.
* Must be atomic.
Quoted 1 line
(note last line)
Ah alright. Thanks.
Signature · 1 line
Thomas
A message that is not in the archive (sent off-list or not yet received): 1782507887.154.1365455855469.JavaMail.mail@webmail12
Re: [PATCH 5/6] mac80211: stringify another plink state
Quoted 2 lines · Thomas Pedersen
The patch "mac80211: stringify mesh peering events" missed an opportunity to print the peering state as a string.
Perhaps it's better to use functions for these instead of indexing in case an index is somehow incorrectly set.
net/mac80211/mesh_plink.c
Quoted 1 line
net/mac80211/mesh_plink.c +0
-0
[]
Quoted 8 lines
net/mac80211/mesh_plink.c +2
-2@@ -544,8 +544,8 @@ static void mesh_plink_timer(unsigned long data)return ; }mpl_dbg (sta->sdata, -"Mesh plink timer for %pM fired on state %d\n" , - sta->sta.addr, sta->plink_state); +"Mesh plink timer for %pM fired on state %s\n" , + sta->sta.addr, mplstates[sta->plink_state]);
Re: [PATCH 5/6] mac80211: stringify another plink state
Quoted 6 lines · Joe Perches
Quoted 2 lines · Thomas Pedersen
The patch "mac80211: stringify mesh peering events" missed an opportunity to print the peering state as a string.
Perhaps it's better to use functions for these instead of indexing in case an index is somehow incorrectly set.
Maybe:
net/mac80211/mesh_plink.c | 73 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 22 deletions(-)
net/mac80211/mesh_plink.c +51 -22
@@ -37,27 +37,55 @@ enum plink_event {CLS_IGNR }; -static const char *const mplstates[] = { - [NL80211_PLINK_LISTEN ] ="LISTEN" , - [NL80211_PLINK_OPN_SNT ] ="OPN-SNT" , - [NL80211_PLINK_OPN_RCVD ] ="OPN-RCVD" , - [NL80211_PLINK_CNF_RCVD ] ="CNF_RCVD" , - [NL80211_PLINK_ESTAB ] ="ESTAB" , - [NL80211_PLINK_HOLDING ] ="HOLDING" , - [NL80211_PLINK_BLOCKED ] ="BLOCKED" -}; +static const char *mplstates (enum nl80211_plink_state state) +{ +switch (state) { +case NL80211_PLINK_LISTEN : +return "LISTEN" ; +case NL80211_PLINK_OPN_SNT : +return "OPN-SNT" ; +case NL80211_PLINK_OPN_RCVD : +return "OPN-RCVD" ; +case NL80211_PLINK_CNF_RCVD : +return "CNF_RCVD" ; +case NL80211_PLINK_ESTAB : +return "ESTAB" ; +case NL80211_PLINK_HOLDING : +return "HOLDING" ; +case NL80211_PLINK_BLOCKED : +return "BLOCKED" ; +default : +break ; + } +return "UNKNOWN_PLINK_STATE" ; +} -static const char *const mplevents[] = { - [PLINK_UNDEFINED ] ="NONE" , - [OPN_ACPT ] ="OPN_ACPT" , - [OPN_RJCT ] ="OPN_RJCT" , - [OPN_IGNR ] ="OPN_IGNR" , - [CNF_ACPT ] ="CNF_ACPT" , - [CNF_RJCT ] ="CNF_RJCT" , - [CNF_IGNR ] ="CNF_IGNR" , - [CLS_ACPT ] ="CLS_ACPT" , - [CLS_IGNR ] ="CLS_IGNR" -}; +static const char *mplevents (enum plink_event event) +{ +switch (event) { +case PLINK_UNDEFINED : +return "NONE" ; +case OPN_ACPT : +return "OPN_ACPT" ; +case OPN_RJCT : +return "OPN_RJCT" ; +case OPN_IGNR : +return "OPN_IGNR" ; +case CNF_ACPT : +return "CNF_ACPT" ; +case CNF_RJCT : +return "CNF_RJCT" ; +case CNF_IGNR : +return "CNF_IGNR" ; +case CLS_ACPT : +return "CLS_ACPT" ; +case CLS_IGNR : +return "CLS_IGNR" ; +default : +break ; + } +return "UNKNOWN_PLINK_EVENT" ; +} static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, enum ieee80211_self_protected_actioncode action,
@@ -841,8 +869,9 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, } } -mpl_dbg (sdata,"peer %pM in state %s got event %s\n" , mgmt->sa, - mplstates[sta->plink_state], mplevents[event]); +mpl_dbg (sdata,"peer %pM in state %d (%s) got event %d (%s)\n" , + mgmt->sa, sta->plink_state,mplstates (sta->plink_state), + event,mplevents (event)); reason =0 ;spin_lock_bh (&sta->lock);switch (sta->plink_state) {
Quoted 2 lines · Thomas Pedersen
Otherwise forwarded frames would keep the retry bit set from the previous link transmission.
Applied.
johannes