* Question on ath10k_mgmt_tx_flush @ 2014-04-10 13:41 Ben Greear 2014-04-11 5:21 ` Michal Kazior 0 siblings, 1 reply; 9+ messages in thread From: Ben Greear @ 2014-04-10 13:41 UTC (permalink / raw) To: ath10k@lists.infradead.org Can we optimize this method to return early if the tx-credits are fully replenished (ie, == 2) instead of just sleeping the 2 x beacon-interval? That would indicate all messages have been flushed, right? Thanks, Ben -- Ben Greear <greearb@candelatech.com> Candela Technologies Inc http://www.candelatech.com _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question on ath10k_mgmt_tx_flush 2014-04-10 13:41 Question on ath10k_mgmt_tx_flush Ben Greear @ 2014-04-11 5:21 ` Michal Kazior 2014-04-11 13:25 ` Ben Greear 0 siblings, 1 reply; 9+ messages in thread From: Michal Kazior @ 2014-04-11 5:21 UTC (permalink / raw) To: Ben Greear; +Cc: ath10k@lists.infradead.org On 10 April 2014 15:41, Ben Greear <greearb@candelatech.com> wrote: > Can we optimize this method to return early if the tx-credits > are fully replenished (ie, == 2) instead of just sleeping the > 2 x beacon-interval? That would indicate all messages > have been flushed, right? Yeah. You're _almost_ right. Every odd mgmt frame will trigger tx credit replenishment, even if you set NEEDS_CREDITS htc tx flag for all packets. It seems that tx credits aren't replenished until you submit an even number of mgmt tx: [tx credits =2] vdev create [-1, =1] [replenish +1, =2] mgmt tx [-1, =1] [frame is seen on air, means it left tx queue, but no replenishment] vdev set param [-1, =0] [replenish +1, =1] mgmt tx [-1, =0] [frame seen on air] [replenish +2, =2] However once you flush peer tids you get the tx credit immediately. This means you don't ever reach having 2 mgmt tx consuming 2 tx credits (unless things go terribly terribly wrong at which point it's probably already beyond help). A very ugly hack would be to try and send out mgmt tx in pairs - a requested frame and a dummy frame (such that firmware will not buffer it) so that you use tx credit replenishment as tx completion indication. Michał _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question on ath10k_mgmt_tx_flush 2014-04-11 5:21 ` Michal Kazior @ 2014-04-11 13:25 ` Ben Greear 2014-04-14 6:31 ` Michal Kazior 0 siblings, 1 reply; 9+ messages in thread From: Ben Greear @ 2014-04-11 13:25 UTC (permalink / raw) To: Michal Kazior; +Cc: ath10k@lists.infradead.org On 04/10/2014 10:21 PM, Michal Kazior wrote: > On 10 April 2014 15:41, Ben Greear <greearb@candelatech.com> wrote: >> Can we optimize this method to return early if the tx-credits >> are fully replenished (ie, == 2) instead of just sleeping the >> 2 x beacon-interval? That would indicate all messages >> have been flushed, right? > > Yeah. You're _almost_ right. Every odd mgmt frame will trigger tx > credit replenishment, even if you set NEEDS_CREDITS htc tx flag for > all packets. It seems that tx credits aren't replenished until you > submit an even number of mgmt tx: > > [tx credits =2] > vdev create [-1, =1] > [replenish +1, =2] > mgmt tx [-1, =1] > [frame is seen on air, means it left tx queue, but no replenishment] > vdev set param [-1, =0] > [replenish +1, =1] > mgmt tx [-1, =0] > [frame seen on air] > [replenish +2, =2] > > However once you flush peer tids you get the tx credit immediately. > This means you don't ever reach having 2 mgmt tx consuming 2 tx > credits (unless things go terribly terribly wrong at which point it's > probably already beyond help). > > A very ugly hack would be to try and send out mgmt tx in pairs - a > requested frame and a dummy frame (such that firmware will not buffer > it) so that you use tx credit replenishment as tx completion > indication. If you ignore how firmware replenishes the tx-credits for now, is it safe to assume that if you have 2 tx-credits while in the flush routine, then everything is indeed flushed and we can skip the sleep? I imagine both I and the QCA firmware guys can make the firmware properly replenish tx-credits one at a time instead of the only-on-even/odd behaviour you found. But even without that, we might be able to speed up the flush 1/2 of the time? Thanks, Ben -- Ben Greear <greearb@candelatech.com> Candela Technologies Inc http://www.candelatech.com _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question on ath10k_mgmt_tx_flush 2014-04-11 13:25 ` Ben Greear @ 2014-04-14 6:31 ` Michal Kazior 2014-04-14 15:45 ` Ben Greear 0 siblings, 1 reply; 9+ messages in thread From: Michal Kazior @ 2014-04-14 6:31 UTC (permalink / raw) To: Ben Greear; +Cc: ath10k@lists.infradead.org On 11 April 2014 15:25, Ben Greear <greearb@candelatech.com> wrote: > On 04/10/2014 10:21 PM, Michal Kazior wrote: >> >> On 10 April 2014 15:41, Ben Greear <greearb@candelatech.com> wrote: >>> >>> Can we optimize this method to return early if the tx-credits >>> are fully replenished (ie, == 2) instead of just sleeping the >>> 2 x beacon-interval? That would indicate all messages >>> have been flushed, right? >> >> >> Yeah. You're _almost_ right. Every odd mgmt frame will trigger tx >> credit replenishment, even if you set NEEDS_CREDITS htc tx flag for >> all packets. It seems that tx credits aren't replenished until you >> submit an even number of mgmt tx: >> >> [tx credits =2] >> vdev create [-1, =1] >> [replenish +1, =2] >> mgmt tx [-1, =1] >> [frame is seen on air, means it left tx queue, but no replenishment] >> vdev set param [-1, =0] >> [replenish +1, =1] >> mgmt tx [-1, =0] >> [frame seen on air] >> [replenish +2, =2] >> >> However once you flush peer tids you get the tx credit immediately. >> This means you don't ever reach having 2 mgmt tx consuming 2 tx >> credits (unless things go terribly terribly wrong at which point it's >> probably already beyond help). >> >> A very ugly hack would be to try and send out mgmt tx in pairs - a >> requested frame and a dummy frame (such that firmware will not buffer >> it) so that you use tx credit replenishment as tx completion >> indication. > > > If you ignore how firmware replenishes the tx-credits for now, > is it safe to assume that if you have 2 tx-credits while in > the flush routine, then everything is indeed flushed and > we can skip the sleep? You want to always skip the sleep between mgmt tx and flush commands? I'm afraid this won't work because tx flush command can end up with queued frame being dropped or transmitted regardless of destination station powersave state if submitted too soon. > I imagine both I and the QCA firmware guys can make the > firmware properly replenish tx-credits one at a time instead > of the only-on-even/odd behaviour you found. That would be nice. > But even without that, we might be able to speed up the > flush 1/2 of the time? Yes, although I'm not very fond of the idea of applying a hack on top of another hack. Michał _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question on ath10k_mgmt_tx_flush 2014-04-14 6:31 ` Michal Kazior @ 2014-04-14 15:45 ` Ben Greear 2014-04-15 6:41 ` Michal Kazior 0 siblings, 1 reply; 9+ messages in thread From: Ben Greear @ 2014-04-14 15:45 UTC (permalink / raw) To: Michal Kazior; +Cc: ath10k@lists.infradead.org On 04/13/2014 11:31 PM, Michal Kazior wrote: > On 11 April 2014 15:25, Ben Greear <greearb@candelatech.com> wrote: >> On 04/10/2014 10:21 PM, Michal Kazior wrote: >>> >>> On 10 April 2014 15:41, Ben Greear <greearb@candelatech.com> wrote: >>>> >>>> Can we optimize this method to return early if the tx-credits >>>> are fully replenished (ie, == 2) instead of just sleeping the >>>> 2 x beacon-interval? That would indicate all messages >>>> have been flushed, right? >>> >>> >>> Yeah. You're _almost_ right. Every odd mgmt frame will trigger tx >>> credit replenishment, even if you set NEEDS_CREDITS htc tx flag for >>> all packets. It seems that tx credits aren't replenished until you >>> submit an even number of mgmt tx: >>> >>> [tx credits =2] >>> vdev create [-1, =1] >>> [replenish +1, =2] >>> mgmt tx [-1, =1] >>> [frame is seen on air, means it left tx queue, but no replenishment] >>> vdev set param [-1, =0] >>> [replenish +1, =1] >>> mgmt tx [-1, =0] >>> [frame seen on air] >>> [replenish +2, =2] >>> >>> However once you flush peer tids you get the tx credit immediately. >>> This means you don't ever reach having 2 mgmt tx consuming 2 tx >>> credits (unless things go terribly terribly wrong at which point it's >>> probably already beyond help). >>> >>> A very ugly hack would be to try and send out mgmt tx in pairs - a >>> requested frame and a dummy frame (such that firmware will not buffer >>> it) so that you use tx credit replenishment as tx completion >>> indication. >> >> >> If you ignore how firmware replenishes the tx-credits for now, >> is it safe to assume that if you have 2 tx-credits while in >> the flush routine, then everything is indeed flushed and >> we can skip the sleep? > > You want to always skip the sleep between mgmt tx and flush commands? > I'm afraid this won't work because tx flush command can end up with > queued frame being dropped or transmitted regardless of destination > station powersave state if submitted too soon. I just want to know if I can skip the sleep if we currently have 2 tx-credits. From your answer below, that seems to be a yes. So, 1/2 of the time (on avg) is worth the hack to me, and if/when I fix the firmware (and/or if QCA fixes the firmware), then we should have 2 tx-credits more often and only sleep when there really is work to do. >> I imagine both I and the QCA firmware guys can make the >> firmware properly replenish tx-credits one at a time instead >> of the only-on-even/odd behaviour you found. > > That would be nice. > > >> But even without that, we might be able to speed up the >> flush 1/2 of the time? > > Yes, although I'm not very fond of the idea of applying a hack on top > of another hack. What is your preferred fix for this? Thanks, Ben > > > Michał > -- Ben Greear <greearb@candelatech.com> Candela Technologies Inc http://www.candelatech.com _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question on ath10k_mgmt_tx_flush 2014-04-14 15:45 ` Ben Greear @ 2014-04-15 6:41 ` Michal Kazior 2014-04-17 1:03 ` Ben Greear 0 siblings, 1 reply; 9+ messages in thread From: Michal Kazior @ 2014-04-15 6:41 UTC (permalink / raw) To: Ben Greear; +Cc: ath10k@lists.infradead.org On 14 April 2014 17:45, Ben Greear <greearb@candelatech.com> wrote: > On 04/13/2014 11:31 PM, Michal Kazior wrote: >> On 11 April 2014 15:25, Ben Greear <greearb@candelatech.com> wrote: >>> On 04/10/2014 10:21 PM, Michal Kazior wrote: >>>> >>>> On 10 April 2014 15:41, Ben Greear <greearb@candelatech.com> wrote: >>>>> >>>>> Can we optimize this method to return early if the tx-credits >>>>> are fully replenished (ie, == 2) instead of just sleeping the >>>>> 2 x beacon-interval? That would indicate all messages >>>>> have been flushed, right? >>>> >>>> >>>> Yeah. You're _almost_ right. Every odd mgmt frame will trigger tx >>>> credit replenishment, even if you set NEEDS_CREDITS htc tx flag for >>>> all packets. It seems that tx credits aren't replenished until you >>>> submit an even number of mgmt tx: >>>> >>>> [tx credits =2] >>>> vdev create [-1, =1] >>>> [replenish +1, =2] >>>> mgmt tx [-1, =1] >>>> [frame is seen on air, means it left tx queue, but no replenishment] >>>> vdev set param [-1, =0] >>>> [replenish +1, =1] >>>> mgmt tx [-1, =0] >>>> [frame seen on air] >>>> [replenish +2, =2] >>>> >>>> However once you flush peer tids you get the tx credit immediately. >>>> This means you don't ever reach having 2 mgmt tx consuming 2 tx >>>> credits (unless things go terribly terribly wrong at which point it's >>>> probably already beyond help). >>>> >>>> A very ugly hack would be to try and send out mgmt tx in pairs - a >>>> requested frame and a dummy frame (such that firmware will not buffer >>>> it) so that you use tx credit replenishment as tx completion >>>> indication. >>> >>> >>> If you ignore how firmware replenishes the tx-credits for now, >>> is it safe to assume that if you have 2 tx-credits while in >>> the flush routine, then everything is indeed flushed and >>> we can skip the sleep? >> >> You want to always skip the sleep between mgmt tx and flush commands? >> I'm afraid this won't work because tx flush command can end up with >> queued frame being dropped or transmitted regardless of destination >> station powersave state if submitted too soon. > > I just want to know if I can skip the sleep if we currently have 2 tx-credits. No, not really. At least not in any sane way I can think of. Problem 1: If you submit a frame that gets stuck for 10 seconds and you don't flush it (and you have no idea when it is safe to flush other than timing this with arbitrary numbers like beacon intervals) and you try to queue another frame that gets stuck you end up with 0 tx credits. Problem 2: If you submit a frame and immediately call tx flush you can end up not sending out the frame at all or ignoring client power save state I'm afraid. I was thinking of a more clever hack that would involve sending dummy frames (i.e. spurious probe responses) to tickle firmware and force it replenish tx credit after sending the actual requested mgmt frame. This is ugly, intrusive, wrong and I'm not even sure if this can even work. > From your answer below, that seems to be a yes. So, 1/2 of the time (on avg) > is worth the hack to me, and if/when I fix the firmware (and/or if QCA fixes > the firmware), then we should have 2 tx-credits more often and only sleep when > there really is work to do. The problem is you don't have a way of knowing if mgmt tx is stuck or not both because there is no tx completion and tx credits aren't replenished in a sane way. If any of those were ok, we could have a wait_for_completion() instead of a msleep() and thus cut down wait times for frames that don't get stuck. >>> I imagine both I and the QCA firmware guys can make the >>> firmware properly replenish tx-credits one at a time instead >>> of the only-on-even/odd behaviour you found. >> >> That would be nice. >> >> >>> But even without that, we might be able to speed up the >>> flush 1/2 of the time? >> >> Yes, although I'm not very fond of the idea of applying a hack on top >> of another hack. > > What is your preferred fix for this? Fix the firmware, obviously. 999.999.0.636 uses htt for mgmt tx so the problem doesn't exist there. That's solely a 10.1 branch issue and I doubt this will be ever fixed in this branch... Michał _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question on ath10k_mgmt_tx_flush 2014-04-15 6:41 ` Michal Kazior @ 2014-04-17 1:03 ` Ben Greear 2014-04-17 6:04 ` Michal Kazior 0 siblings, 1 reply; 9+ messages in thread From: Ben Greear @ 2014-04-17 1:03 UTC (permalink / raw) To: Michal Kazior; +Cc: ath10k@lists.infradead.org On 04/14/2014 11:41 PM, Michal Kazior wrote: > On 14 April 2014 17:45, Ben Greear <greearb@candelatech.com> wrote: >> On 04/13/2014 11:31 PM, Michal Kazior wrote: >>> On 11 April 2014 15:25, Ben Greear <greearb@candelatech.com> wrote: >>>> On 04/10/2014 10:21 PM, Michal Kazior wrote: >>>>> >>>>> On 10 April 2014 15:41, Ben Greear <greearb@candelatech.com> wrote: >>>>>> >>>>>> Can we optimize this method to return early if the tx-credits >>>>>> are fully replenished (ie, == 2) instead of just sleeping the >>>>>> 2 x beacon-interval? That would indicate all messages >>>>>> have been flushed, right? >>>>> >>>>> >>>>> Yeah. You're _almost_ right. Every odd mgmt frame will trigger tx >>>>> credit replenishment, even if you set NEEDS_CREDITS htc tx flag for >>>>> all packets. It seems that tx credits aren't replenished until you >>>>> submit an even number of mgmt tx: >>>>> >>>>> [tx credits =2] >>>>> vdev create [-1, =1] >>>>> [replenish +1, =2] >>>>> mgmt tx [-1, =1] >>>>> [frame is seen on air, means it left tx queue, but no replenishment] >>>>> vdev set param [-1, =0] >>>>> [replenish +1, =1] >>>>> mgmt tx [-1, =0] >>>>> [frame seen on air] >>>>> [replenish +2, =2] >>>>> >>>>> However once you flush peer tids you get the tx credit immediately. >>>>> This means you don't ever reach having 2 mgmt tx consuming 2 tx >>>>> credits (unless things go terribly terribly wrong at which point it's >>>>> probably already beyond help). >>>>> >>>>> A very ugly hack would be to try and send out mgmt tx in pairs - a >>>>> requested frame and a dummy frame (such that firmware will not buffer >>>>> it) so that you use tx credit replenishment as tx completion >>>>> indication. >>>> >>>> >>>> If you ignore how firmware replenishes the tx-credits for now, >>>> is it safe to assume that if you have 2 tx-credits while in >>>> the flush routine, then everything is indeed flushed and >>>> we can skip the sleep? >>> >>> You want to always skip the sleep between mgmt tx and flush commands? >>> I'm afraid this won't work because tx flush command can end up with >>> queued frame being dropped or transmitted regardless of destination >>> station powersave state if submitted too soon. >> >> I just want to know if I can skip the sleep if we currently have 2 tx-credits. > > No, not really. At least not in any sane way I can think of. I managed to hack the firmware and ath10k today so I can get tx rate reported (perhaps at least mostly correctly, even). Since this can only work with my firmware, patch was not sent to the list. So, I'm back to working on this tx-flush issue again. I may not have been clear in my question above, as your answer makes no sense to me :) My question is: If the driver/firmware supports max of 2 tx-credits, and we currently have 2 tx-credits available (ie, there are no pending things in firmware because we have all credits available), then can we skip the sleep when flushing? Second question: Assuming this is true, if I just make sure the firmware returns all credits as soon as they are freed up, should that be good enough to not waste any time sleeping during flush when we do not need to flush? And even with stock firmware, we should be able to skip the sleep at least when we get lucky with current tx-credits-available count... Thanks, Ben > > Problem 1: > If you submit a frame that gets stuck for 10 seconds and you don't > flush it (and you have no idea when it is safe to flush other than > timing this with arbitrary numbers like beacon intervals) and you try > to queue another frame that gets stuck you end up with 0 tx credits. > > Problem 2: > If you submit a frame and immediately call tx flush you can end up not > sending out the frame at all or ignoring client power save state I'm > afraid. > > I was thinking of a more clever hack that would involve sending dummy > frames (i.e. spurious probe responses) to tickle firmware and force it > replenish tx credit after sending the actual requested mgmt frame. > This is ugly, intrusive, wrong and I'm not even sure if this can even > work. > > >> From your answer below, that seems to be a yes. So, 1/2 of the time (on avg) >> is worth the hack to me, and if/when I fix the firmware (and/or if QCA fixes >> the firmware), then we should have 2 tx-credits more often and only sleep when >> there really is work to do. > > The problem is you don't have a way of knowing if mgmt tx is stuck or > not both because there is no tx completion and tx credits aren't > replenished in a sane way. If any of those were ok, we could have a > wait_for_completion() instead of a msleep() and thus cut down wait > times for frames that don't get stuck. > > >>>> I imagine both I and the QCA firmware guys can make the >>>> firmware properly replenish tx-credits one at a time instead >>>> of the only-on-even/odd behaviour you found. >>> >>> That would be nice. >>> >>> >>>> But even without that, we might be able to speed up the >>>> flush 1/2 of the time? >>> >>> Yes, although I'm not very fond of the idea of applying a hack on top >>> of another hack. >> >> What is your preferred fix for this? > > Fix the firmware, obviously. > > 999.999.0.636 uses htt for mgmt tx so the problem doesn't exist there. > That's solely a 10.1 branch issue and I doubt this will be ever fixed > in this branch... > > > Michał > > _______________________________________________ > ath10k mailing list > ath10k@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/ath10k > -- Ben Greear <greearb@candelatech.com> Candela Technologies Inc http://www.candelatech.com _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question on ath10k_mgmt_tx_flush 2014-04-17 1:03 ` Ben Greear @ 2014-04-17 6:04 ` Michal Kazior 2014-04-17 6:35 ` Ben Greear 0 siblings, 1 reply; 9+ messages in thread From: Michal Kazior @ 2014-04-17 6:04 UTC (permalink / raw) To: Ben Greear; +Cc: ath10k@lists.infradead.org On 17 April 2014 03:03, Ben Greear <greearb@candelatech.com> wrote: > On 04/14/2014 11:41 PM, Michal Kazior wrote: >> On 14 April 2014 17:45, Ben Greear <greearb@candelatech.com> wrote: >>> On 04/13/2014 11:31 PM, Michal Kazior wrote: >>>> On 11 April 2014 15:25, Ben Greear <greearb@candelatech.com> wrote: >>>>> On 04/10/2014 10:21 PM, Michal Kazior wrote: >>>>>> >>>>>> On 10 April 2014 15:41, Ben Greear <greearb@candelatech.com> wrote: >>>>>>> >>>>>>> Can we optimize this method to return early if the tx-credits >>>>>>> are fully replenished (ie, == 2) instead of just sleeping the >>>>>>> 2 x beacon-interval? That would indicate all messages >>>>>>> have been flushed, right? >>>>>> >>>>>> >>>>>> Yeah. You're _almost_ right. Every odd mgmt frame will trigger tx >>>>>> credit replenishment, even if you set NEEDS_CREDITS htc tx flag for >>>>>> all packets. It seems that tx credits aren't replenished until you >>>>>> submit an even number of mgmt tx: >>>>>> >>>>>> [tx credits =2] >>>>>> vdev create [-1, =1] >>>>>> [replenish +1, =2] >>>>>> mgmt tx [-1, =1] >>>>>> [frame is seen on air, means it left tx queue, but no replenishment] >>>>>> vdev set param [-1, =0] >>>>>> [replenish +1, =1] >>>>>> mgmt tx [-1, =0] >>>>>> [frame seen on air] >>>>>> [replenish +2, =2] >>>>>> >>>>>> However once you flush peer tids you get the tx credit immediately. >>>>>> This means you don't ever reach having 2 mgmt tx consuming 2 tx >>>>>> credits (unless things go terribly terribly wrong at which point it's >>>>>> probably already beyond help). >>>>>> >>>>>> A very ugly hack would be to try and send out mgmt tx in pairs - a >>>>>> requested frame and a dummy frame (such that firmware will not buffer >>>>>> it) so that you use tx credit replenishment as tx completion >>>>>> indication. >>>>> >>>>> >>>>> If you ignore how firmware replenishes the tx-credits for now, >>>>> is it safe to assume that if you have 2 tx-credits while in >>>>> the flush routine, then everything is indeed flushed and >>>>> we can skip the sleep? >>>> >>>> You want to always skip the sleep between mgmt tx and flush commands? >>>> I'm afraid this won't work because tx flush command can end up with >>>> queued frame being dropped or transmitted regardless of destination >>>> station powersave state if submitted too soon. >>> >>> I just want to know if I can skip the sleep if we currently have 2 tx-credits. >> >> No, not really. At least not in any sane way I can think of. > > I managed to hack the firmware and ath10k today so I can get tx > rate reported (perhaps at least mostly correctly, even). Since this > can only work with my firmware, patch was not sent to the list. > > > So, I'm back to working on this tx-flush issue again. > > I may not have been clear in my question above, as your answer makes no > sense to me :) > > My question is: If the driver/firmware supports max of 2 tx-credits, and we currently > have 2 tx-credits available (ie, there are no pending things in firmware > because we have all credits available), then can we skip the sleep when > flushing? If you do mgmt_tx+flush without any wait you'll end up disregarding station powersave or drop frame before it is actually transmitted. With stock firmware there's no way to wait for wmi mgmt tx completion other than to sleep because tx credits are replenished in pairs. If you send a mgmt tx and don't flush you risk getting stuck with next mgmt tx at which point you can't even flush because you're out of credits. > Second question: Assuming this is true, if I just make sure the firmware > returns all credits as soon as they are freed up, should that be good > enough to not waste any time sleeping during flush when we do not need > to flush? Yes, this is sufficient as a tx completion but is the most hacky way to do it. > And even with stock firmware, we should be able to skip the sleep at > least when we get lucky with current tx-credits-available count... I don't think you can do that. Even if you have 2 tx credits available and submit mgmt tx - what do you do from then on? You won't receive tx credit replenishment when the tx completes unless you submit flush or another mgmt tx. Flush can drop frames/disregard powersave and next mgmt tx can get stuck. You could try pushing dummy mgmt tx (spurious probe resp?) assuming it never gets stuck but that's way beyond an acceptable workaround.. There really isn't any way other than to have a reliable tx completion indication so that wmi tx worker can flush mgmt frames if they take too long to complete. I'd be happy to proven wrong though. Michał _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question on ath10k_mgmt_tx_flush 2014-04-17 6:04 ` Michal Kazior @ 2014-04-17 6:35 ` Ben Greear 0 siblings, 0 replies; 9+ messages in thread From: Ben Greear @ 2014-04-17 6:35 UTC (permalink / raw) To: Michal Kazior; +Cc: ath10k@lists.infradead.org On 04/16/2014 11:04 PM, Michal Kazior wrote: > On 17 April 2014 03:03, Ben Greear <greearb@candelatech.com> wrote: >> On 04/14/2014 11:41 PM, Michal Kazior wrote: >>> On 14 April 2014 17:45, Ben Greear <greearb@candelatech.com> wrote: >>>> On 04/13/2014 11:31 PM, Michal Kazior wrote: >>>>> On 11 April 2014 15:25, Ben Greear <greearb@candelatech.com> wrote: >>>>>> On 04/10/2014 10:21 PM, Michal Kazior wrote: >>>>>>> >>>>>>> On 10 April 2014 15:41, Ben Greear <greearb@candelatech.com> wrote: >>>>>>>> >>>>>>>> Can we optimize this method to return early if the tx-credits >>>>>>>> are fully replenished (ie, == 2) instead of just sleeping the >>>>>>>> 2 x beacon-interval? That would indicate all messages >>>>>>>> have been flushed, right? >>>>>>> >>>>>>> >>>>>>> Yeah. You're _almost_ right. Every odd mgmt frame will trigger tx >>>>>>> credit replenishment, even if you set NEEDS_CREDITS htc tx flag for >>>>>>> all packets. It seems that tx credits aren't replenished until you >>>>>>> submit an even number of mgmt tx: >>>>>>> >>>>>>> [tx credits =2] >>>>>>> vdev create [-1, =1] >>>>>>> [replenish +1, =2] >>>>>>> mgmt tx [-1, =1] >>>>>>> [frame is seen on air, means it left tx queue, but no replenishment] >>>>>>> vdev set param [-1, =0] >>>>>>> [replenish +1, =1] >>>>>>> mgmt tx [-1, =0] >>>>>>> [frame seen on air] >>>>>>> [replenish +2, =2] >>>>>>> >>>>>>> However once you flush peer tids you get the tx credit immediately. >>>>>>> This means you don't ever reach having 2 mgmt tx consuming 2 tx >>>>>>> credits (unless things go terribly terribly wrong at which point it's >>>>>>> probably already beyond help). >>>>>>> >>>>>>> A very ugly hack would be to try and send out mgmt tx in pairs - a >>>>>>> requested frame and a dummy frame (such that firmware will not buffer >>>>>>> it) so that you use tx credit replenishment as tx completion >>>>>>> indication. >>>>>> >>>>>> >>>>>> If you ignore how firmware replenishes the tx-credits for now, >>>>>> is it safe to assume that if you have 2 tx-credits while in >>>>>> the flush routine, then everything is indeed flushed and >>>>>> we can skip the sleep? >>>>> >>>>> You want to always skip the sleep between mgmt tx and flush commands? >>>>> I'm afraid this won't work because tx flush command can end up with >>>>> queued frame being dropped or transmitted regardless of destination >>>>> station powersave state if submitted too soon. >>>> >>>> I just want to know if I can skip the sleep if we currently have 2 tx-credits. >>> >>> No, not really. At least not in any sane way I can think of. >> >> I managed to hack the firmware and ath10k today so I can get tx >> rate reported (perhaps at least mostly correctly, even). Since this >> can only work with my firmware, patch was not sent to the list. >> >> >> So, I'm back to working on this tx-flush issue again. >> >> I may not have been clear in my question above, as your answer makes no >> sense to me :) >> >> My question is: If the driver/firmware supports max of 2 tx-credits, and we currently >> have 2 tx-credits available (ie, there are no pending things in firmware >> because we have all credits available), then can we skip the sleep when >> flushing? > > If you do mgmt_tx+flush without any wait you'll end up disregarding > station powersave or drop frame before it is actually transmitted. > With stock firmware there's no way to wait for wmi mgmt tx completion > other than to sleep because tx credits are replenished in pairs. If > you send a mgmt tx and don't flush you risk getting stuck with next > mgmt tx at which point you can't even flush because you're out of > credits. Ok, I will try to fix that issue of credits being replenished in pairs. I have been following the twisty paths of the firmware, but so far I cannot see why the problem should exist... Thanks for the patience and details below..I think I'm getting and understanding of the problem now... Thanks, Ben > > >> Second question: Assuming this is true, if I just make sure the firmware >> returns all credits as soon as they are freed up, should that be good >> enough to not waste any time sleeping during flush when we do not need >> to flush? > > Yes, this is sufficient as a tx completion but is the most hacky way to do it. > > >> And even with stock firmware, we should be able to skip the sleep at >> least when we get lucky with current tx-credits-available count... > > I don't think you can do that. > > Even if you have 2 tx credits available and submit mgmt tx - what do > you do from then on? You won't receive tx credit replenishment when > the tx completes unless you submit flush or another mgmt tx. Flush can > drop frames/disregard powersave and next mgmt tx can get stuck. You > could try pushing dummy mgmt tx (spurious probe resp?) assuming it > never gets stuck but that's way beyond an acceptable workaround.. > > There really isn't any way other than to have a reliable tx completion > indication so that wmi tx worker can flush mgmt frames if they take > too long to complete. > > I'd be happy to proven wrong though. > > > Michał > -- Ben Greear <greearb@candelatech.com> Candela Technologies Inc http://www.candelatech.com _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-04-17 6:35 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-04-10 13:41 Question on ath10k_mgmt_tx_flush Ben Greear 2014-04-11 5:21 ` Michal Kazior 2014-04-11 13:25 ` Ben Greear 2014-04-14 6:31 ` Michal Kazior 2014-04-14 15:45 ` Ben Greear 2014-04-15 6:41 ` Michal Kazior 2014-04-17 1:03 ` Ben Greear 2014-04-17 6:04 ` Michal Kazior 2014-04-17 6:35 ` Ben Greear
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.