<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Wi-Fi driver throws out packets if sent too fast.  How can we know when the driver queue is full so we can wait and not overload it?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/113036/wi-fi-driver-throws-out-packets-if-sent-too-fast-how-can-we-know-when-the-driver-queue-is-full-so-we-can-wait-and-not-overload-it</link><description>We need very fast Wi-Fi transfer rates at times. I have been able to tune the code and Wi-Fi driver settings to get up to 30-35 Mbps which is great. But if I don&amp;#39;t throttle the transmission then the faster the packets are sent, the higher the percentage</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 17 Jul 2024 12:53:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/113036/wi-fi-driver-throws-out-packets-if-sent-too-fast-how-can-we-know-when-the-driver-queue-is-full-so-we-can-wait-and-not-overload-it" /><item><title>RE: Wi-Fi driver throws out packets if sent too fast.  How can we know when the driver queue is full so we can wait and not overload it?</title><link>https://devzone.nordicsemi.com/thread/494366?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2024 12:53:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:244d8565-90c6-4597-abe8-275da5e3d63e</guid><dc:creator>Saxman58</dc:creator><description>&lt;p&gt;Thanks, Runar.&amp;nbsp; Have a good vacation.&lt;/p&gt;
&lt;p&gt;Glen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wi-Fi driver throws out packets if sent too fast.  How can we know when the driver queue is full so we can wait and not overload it?</title><link>https://devzone.nordicsemi.com/thread/494280?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2024 07:20:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:485ac26a-7e1e-43b8-adc3-209aee7fdc17</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;Sounds good,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will be out of office from Friday until mid august but I will hand this case over to co-worker.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wi-Fi driver throws out packets if sent too fast.  How can we know when the driver queue is full so we can wait and not overload it?</title><link>https://devzone.nordicsemi.com/thread/494232?ContentTypeID=1</link><pubDate>Tue, 16 Jul 2024 17:37:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08cdabbb-c0ee-4d2c-9b1b-e3eb62ddc0b8</guid><dc:creator>Saxman58</dc:creator><description>&lt;p&gt;Thanks Runar,&lt;/p&gt;
&lt;p&gt;I am examining the Zephyr and driver code and am hoping to find a way to know when I should pause sending to let the driver catch up.&amp;nbsp; The information you sent is helpful.&amp;nbsp; I&amp;#39;ll leave this open and will report back when I&amp;#39;ve figured out the best way to handle this.&lt;/p&gt;
&lt;p&gt;Glen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wi-Fi driver throws out packets if sent too fast.  How can we know when the driver queue is full so we can wait and not overload it?</title><link>https://devzone.nordicsemi.com/thread/494093?ContentTypeID=1</link><pubDate>Tue, 16 Jul 2024 10:21:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf4b5489-3637-4795-9b4b-f7588edf0b58</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;Update: Is really just on short what I wrote above. &lt;span&gt;&lt;span dir="ltr"&gt;we don&amp;#39;t have flow control in Zephyr to make sure not to overwhelm the queues and not cause packet drops&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wi-Fi driver throws out packets if sent too fast.  How can we know when the driver queue is full so we can wait and not overload it?</title><link>https://devzone.nordicsemi.com/thread/494050?ContentTypeID=1</link><pubDate>Tue, 16 Jul 2024 07:02:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b532fc69-f794-4dad-b2a4-2b81ad714c6a</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will just forward the information I got from the Wi-Fi team first and then I will do another check regarding your post&lt;/p&gt;
[quote user=""]Is there a function to call to get the low level driver queue state?[/quote]
&lt;p&gt;No public API, but we have this shell command &lt;code&gt;wifi_util tx_stats 0&lt;/code&gt; they can either use this command or call the code &lt;a title="https://github.com/nrfconnect/sdk-nrf/blob/main/drivers/wifi/nrf700x/src/wifi_util.c#l265" href="https://github.com/nrfconnect/sdk-nrf/blob/main/drivers/wifi/nrf700x/src/wifi_util.c#L265" rel="noopener noreferrer" target="_blank"&gt;https://github.com/nrfconnect/sdk-nrf/blob/main/drivers/wifi/nrf700x/src/wifi_util.c#L265&lt;/a&gt; from their program (please note that this isn&amp;#39;t supposed to be called publicly, so, appropriate locking is missing and needs to be taken care)&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;This gives insight in to &lt;code&gt;TX&lt;/code&gt; data path in the nRF70 driver.&lt;/li&gt;
&lt;/ol&gt;
[quote user=""]Is there a way to get a count of how many packets the tx_enqueue or tx_process functions are discarding?&amp;nbsp; Maybe I could poll that as a way to infer when overflow is occurring.&amp;nbsp; But I&amp;#39;d rather not have any overflow at all, because that means lost packets and I won&amp;#39;t know which ones.[/quote]
&lt;p&gt;These are part of the Wi-Fi statistics available via both SHELL &lt;code&gt;wifi statistics&lt;/code&gt; and net-mgmt API: &amp;nbsp;See the data structure &amp;nbsp;&lt;a title="https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/connectivity/networking/api/net_stats.html#c.net_stats_wifi" href="https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/connectivity/networking/api/net_stats.html#c.net_stats_wifi" rel="noopener noreferrer" target="_blank"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/connectivity/networking/api/net_stats.html#c.net_stats_wifi&lt;/a&gt; and SHELL/API code &lt;a title="https://github.com/nrfconnect/sdk-zephyr/blob/main/subsys/net/l2/wifi/wifi_shell.c#l881" href="https://github.com/nrfconnect/sdk-zephyr/blob/main/subsys/net/l2/wifi/wifi_shell.c#L881" rel="noopener noreferrer" target="_blank"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/main/subsys/net/l2/wifi/wifi_shell.c#L881&lt;/a&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;errors.tx/rx&lt;/code&gt; -&amp;gt; &lt;code&gt;Total dropped packets in nRF70 driver&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]Is there maybe a callback or something that can send an event when the queue is getting close to full?[/quote]
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;Zephyr doesn&amp;#39;t have a way for drivers to indicate to the networking stack (and there by applications) about the overflow on data queues and also ability stop/start (in Linux we have &lt;a title="https://docs.kernel.org/networking/multiqueue.html#intro-kernel-support-for-multiqueue-devices" href="https://docs.kernel.org/networking/multiqueue.html#intro-kernel-support-for-multiqueue-devices" rel="noopener noreferrer" target="_blank"&gt;https://docs.kernel.org/networking/multiqueue.html#intro-kernel-support-for-multiqueue-devices&lt;/a&gt; and once a certain watermark is reached driver stops/starts the queues).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
[quote user=""]Is there a way to make zsock_send() truly block if the downstream queue is full?[/quote]
&lt;p&gt;There is unfortunately no per-packet feedback so my understanding it is not possible. However I will do another check with your question just to verify.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;nRF70 driver does have a &lt;code&gt;pending_q&lt;/code&gt; i.e., Queue to be used when nRF70 is busy and doesn&amp;#39;t accept any further frames, but it has a build-time limit (for memory control), so, if Queue is full, it will start dropping packets.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;I will update again as soon as I have something&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wi-Fi driver throws out packets if sent too fast.  How can we know when the driver queue is full so we can wait and not overload it?</title><link>https://devzone.nordicsemi.com/thread/493997?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2024 21:55:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20337472-7323-4f3a-825d-ca92a79dad71</guid><dc:creator>Saxman58</dc:creator><description>&lt;p&gt;Thanks Runar.&amp;nbsp; I look forward to the responses.&amp;nbsp; It might help if I simplify or clarify my question a bit:&lt;/p&gt;
&lt;p&gt;I understand that the packet data is passed between different queues and different threads.&amp;nbsp; But it seems like the most direct way for this to work would be to have the application level zsock_send() block whenever the driver Wi-Fi queue is full if that is what the socket is connected to.&amp;nbsp; Then we&amp;#39;d be guaranteed to not overflow the Wi-Fi queue since zsock_send() wouldn&amp;#39;t execute until there was room for the packet to be sent.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wi-Fi driver throws out packets if sent too fast.  How can we know when the driver queue is full so we can wait and not overload it?</title><link>https://devzone.nordicsemi.com/thread/493873?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2024 11:03:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dce10687-9974-4cd0-bc0c-3a6f09eb95ea</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;Hi Glen&lt;/p&gt;
&lt;p&gt;I will have to ask internally regarding your questions and will get back to you when I have something&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>