void (* wifi_promiscuous_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type);"buf" point "Statitx Rx buffer" or "dynamic?

jason2
Posts: 44
Joined: Thu Oct 26, 2017 11:02 am

void (* wifi_promiscuous_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type);"buf" point "Statitx Rx buffer" or "dynamic?

Postby jason2 » Thu Apr 19, 2018 1:48 am

The callback function :void (* wifi_promiscuous_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type).If this callback function is registered,when received packet,The function will be called and the contents of packets will be pointed by *buf.

And I have read wifi driver from API guide from esp32 programming guide: http://esp-idf.readthedocs.io/en/latest ... /wifi.html
It is described:
The following diagram shows how buffer is allocated/freed in the RX direction:

------------- ------------- ------------- -------------
| Application | | LwIP | | Wi-Fi | | Wi-Fi |
| Task | <--------- | task | <--------- | task | <--------- | Interrupt |
------------- ------------- ------------- -------------
4> User data 3> Pbuf 2> Dynamic RX Buffer 1> Static RX Buffer
Description:

The Wi-Fi hardware receives a packet over the air and puts the packet content to the “Static Rx Buffer”, which is also called “RX DMA Buffer”.
The Wi-Fi driver allocates a “Dynamic Rx Buffer”, makes a copy of the “Static Rx Buffer”, and returns the “Static Rx Buffer” to hardware.
The Wi-Fi driver delivers the packet to the upper-layer (LwIP), and allocates a PBUF for holding the “Dynamic Rx Buffer”.
The application receives data from LwIP.


So when wifi_promiscuous_cb_t is called,where is "*buf" point?"Static Rx buffer" or "Dynamic Rx buffer"

Thanks!
Best regards!

jason2
Posts: 44
Joined: Thu Oct 26, 2017 11:02 am

Re: void (* wifi_promiscuous_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type);"buf" point "Statitx Rx buffer" or "dyna

Postby jason2 » Thu Apr 19, 2018 2:32 am

Please reply if you have seen ,thank you!

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: void (* wifi_promiscuous_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type);"buf" point "Statitx Rx buffer" or "dyna

Postby ESP_Angus » Thu Apr 19, 2018 6:24 am

Hi jason,

It's a WiFi dynamic RX buffer pointed to in the callback.

Please note that no guarantees are made about the continued validity of this buffer after the callback function returns. If you want to store the data for later use, copy it to a local buffer under your control.

jason2
Posts: 44
Joined: Thu Oct 26, 2017 11:02 am

Re: void (* wifi_promiscuous_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type);"buf" point "Statitx Rx buffer" or "dyna

Postby jason2 » Thu Apr 19, 2018 6:46 am

Thanks for your reply very much!

Who is online

Users browsing this forum: Baidu [Spider] and 79 guests