Re: [PATCH 2/2] mac80211: put upper bound on txqi queue length.
On 5 December 2016 at 14:56, Johannes Bergwrote: > On Tue, 2016-11-29 at 10:05 -0800, gree...@candelatech.com wrote: >> From: Ben Greear >> >> This fixes OOM when using pktgen to drive a wifi station at more than >> the station can transmit. pktgen uses ndo_start_xmit instead of >> going >> through the queue layer, so it will not back off when the queues are >> stopped, and would thus cause packets to be added to the txqi->queue >> until the system goes OOM and crashes. >> >> Signed-off-by: Ben Greear >> --- >> >> This is against 4.7.10+, not sure if it is actually needed in latest >> kernel. > > One would hope that fq_tin_enqueue() does something like that, but > anyway the patch doesn't apply so I'm dropping it. fq_tin_enqueue() drops "fat" flow head packet upon reaching packet count limit (8192) or memory limit (4 or 16 mbytes depending on vht availability) whichever is hit first. Michał
Re: [PATCH 2/2] mac80211: put upper bound on txqi queue length.
On Tue, 2016-11-29 at 10:05 -0800, gree...@candelatech.com wrote: > From: Ben Greear> > This fixes OOM when using pktgen to drive a wifi station at more than > the station can transmit. pktgen uses ndo_start_xmit instead of > going > through the queue layer, so it will not back off when the queues are > stopped, and would thus cause packets to be added to the txqi->queue > until the system goes OOM and crashes. > > Signed-off-by: Ben Greear > --- > > This is against 4.7.10+, not sure if it is actually needed in latest > kernel. One would hope that fq_tin_enqueue() does something like that, but anyway the patch doesn't apply so I'm dropping it. johannes
[PATCH 2/2] mac80211: put upper bound on txqi queue length.
From: Ben GreearThis fixes OOM when using pktgen to drive a wifi station at more than the station can transmit. pktgen uses ndo_start_xmit instead of going through the queue layer, so it will not back off when the queues are stopped, and would thus cause packets to be added to the txqi->queue until the system goes OOM and crashes. Signed-off-by: Ben Greear --- This is against 4.7.10+, not sure if it is actually needed in latest kernel. net/mac80211/tx.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index fbcb5fc..0573ab9 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1293,6 +1293,16 @@ static void ieee80211_drv_tx(struct ieee80211_local *local, goto tx_normal; ac = txq->ac; + + if (atomic_read(>txqs_len[ac]) >= + (local->hw.txq_ac_max_pending * 2)) { + /* Must be that something is not paying attention to +* max-pending, like pktgen, so just drop this frame. +*/ + ieee80211_free_txskb(>hw, skb); + return; + } + txqi = to_txq_info(txq); atomic_inc(>txqs_len[ac]); if (atomic_read(>txqs_len[ac]) >= local->hw.txq_ac_max_pending) -- 2.4.11