mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: Cristian Papa <pcristian292@gmail.com>
Cc: lorenzo@kernel.org, ryder.lee@mediatek.com,
	shayne.chen@mediatek.com, sean.wang@mediatek.com,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wifi: mt76: mt7603: discard power-save loopbacks after wakeup
Date: Tue, 20 Oct 2026 18:44:13 +0200	[thread overview]
Message-ID: <8e57a7f2-6495-4535-af99-9abf5bcaa1f9@nbd.name> (raw)
In-Reply-To: <20261020161545.9330-1-pcristian292@gmail.com>

On 20.10.26 18:15, Cristian Papa wrote:
> On 20.10.26 11:48, Felix Fietkau wrote:
>> On 14.10.26 08:22, Cristian Papa wrote:
>>> Discard late frames rather than retransmitting their old sequence and
>>> packet numbers after newer traffic or a wakeup BAR. This loses the late
>>> frame; it does not recover delivery. Use the station's sleep state, not
>>> the temporary hardware PS bypass used during U-APSD service periods.
>> Why did you decide to drop them instead of pushing them to immediate tx?
> 
> Hi Felix, thanks for looking at it.
> 
> Because the looped-back frame keeps the TXD it was first queued with.
> mt7603_mac_write_txwi() puts the 802.11 sequence number in the TXD with
> SN_VALID, and with a hardware key it also takes the PN from key->tx_pn at
> that point. mt7603_rx_loopback_skb() only rewrites Q_IDX, so a late frame
> pushed to immediate TX would go out with its original SN and PN.
> 
> On wakeup, mt7603_sta_ps() sends the psq ahead of the newer traffic, so
> the order holds there. A loopback that arrives after that drain is older
> than frames that may already have gone out with newer SN/PN. With CCMP the
> peer's replay check would drop it, in an aggregation session it can fall
> behind the window after the newer frames or the BAR, and on an open link
> it would arrive out of order. So I expected immediate TX to mostly spend
> airtime on a frame the peer discards.
> 
> I haven't measured how late these loopbacks arrive, though. One that
> arrives before the newer frames go out would still be delivered in order.
> If you'd rather push them to immediate TX, I can send a v2 that does that.
I'm not 100% sure which approach is the right one either way, I just 
wanted it considered.

Not rewriting SN and PN is intentional. If the frame with its SN was 
part of an active aggregation session, receiver side reordering should 
ensure that it arrives in the right order.

It all depends on whether the receiver has moved on and considers the 
frame lost, or if there is value in sending it to avoid the reorder 
timeout (which would cause some jitter). Either way, we should likely 
only allow immediate-tx if aggregation is enabled.

If you have some time, could you test, which variant works better?

Thanks,

- Felix

  reply	other threads:[~2026-10-20 16:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  6:22 Cristian Papa
2026-10-20  9:48 ` Felix Fietkau
2026-10-20 16:15   ` Cristian Papa
2026-10-20 16:44     ` Felix Fietkau [this message]
2026-10-20 18:03       ` Cristian Papa

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=8e57a7f2-6495-4535-af99-9abf5bcaa1f9@nbd.name \
    --to=nbd@nbd.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=pcristian292@gmail.com \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    /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

all inboxes | Powered by JetHome®