Skip to content

Commit a44c3d4

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'bugfix/ndp_wait_events_issue' into 'master'
fix(esp_wifi): Fix false wait events during NAN datapath setup Closes WIFIBUG-1170 and WIFIBUG-1171 See merge request espressif/esp-idf!39151
2 parents 6efd36f + 5c73eef commit a44c3d4

File tree

4 files changed

+325
-228
lines changed

4 files changed

+325
-228
lines changed

components/esp_wifi/include/esp_private/wifi.h

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ typedef struct {
3939
void *storage; /**< storage for FreeRTOS queue */
4040
} wifi_static_queue_t;
4141

42+
struct nan_callbacks {
43+
void (* service_match)(uint8_t sub_id, uint8_t pub_id, uint8_t pub_mac[6], uint16_t capab,
44+
uint8_t ssi_ver, uint8_t *ssi, uint16_t ssi_len);
45+
void (* replied)(uint8_t pub_id, uint8_t sub_id, uint8_t pub_mac[6], uint8_t *ssi, uint16_t ssi_len);
46+
void (* receive)(uint8_t svc_id, uint8_t peer_svc_id, uint8_t peer_mac[6], uint8_t *ssi, uint16_t ssi_len);
47+
void (* ndp_indication)(uint8_t pub_id, uint8_t ndp_id, uint8_t peer_nmi[6], uint8_t peer_ndi[6],
48+
uint8_t *ssi, uint16_t ssi_len);
49+
void (* ndp_confirm)(uint8_t status, uint8_t ndp_id, uint8_t peer_nmi[6], uint8_t peer_ndi[6],
50+
uint8_t own_ndi[6], uint8_t *ssi, uint16_t ssi_len);
51+
void (* ndp_terminated)(uint8_t reason, uint8_t ndp_id, uint8_t init_ndi[6]);
52+
void (* action_txdone)(uint32_t context, bool tx_status);
53+
};
54+
4255
/**
4356
* @brief WiFi log level
4457
*
@@ -708,13 +721,14 @@ esp_err_t esp_nan_internal_subscribe_service(const wifi_nan_subscribe_cfg_t *sub
708721
*
709722
* @attention This API should be called after WIFI_EVENT_NAN_SVC_MATCH event is received.
710723
*
711-
* @param fup_params Configuration parameters for sending a Follow-up to the Peer.
724+
* @param[in] fup_params Configuration parameters for sending a Follow-up to the Peer.
725+
* @param[out] context Context returned for Follow-up frame to be matched in Tx done.
712726
*
713727
* @return
714728
* - ESP_OK: succeed
715729
* - others: failed
716730
*/
717-
esp_err_t esp_nan_internal_send_followup(const wifi_nan_followup_params_t *fup_params);
731+
esp_err_t esp_nan_internal_send_followup(const wifi_nan_followup_params_t *fup_params, uint32_t *context);
718732

719733
/**
720734
* @brief Send Datapath Request to the Publisher with matching service
@@ -755,6 +769,19 @@ esp_err_t esp_nan_internal_datapath_resp(wifi_nan_datapath_resp_t *resp);
755769
*/
756770
esp_err_t esp_nan_internal_datapath_end(wifi_nan_datapath_end_req_t *req);
757771

772+
/**
773+
* @brief End NAN Datapath that is active
774+
*
775+
* @attention This API should be called after receiving WIFI_EVENT_NDP_CONFIRM event.
776+
*
777+
* @param req NAN Datapath end request parameters.
778+
*
779+
* @return
780+
* - ESP_OK: succeed
781+
* - others: failed
782+
*/
783+
esp_err_t esp_nan_internal_register_callbacks(struct nan_callbacks *cb);
784+
758785
/**
759786
* @brief Connect WiFi station to the AP.
760787
*

components/esp_wifi/include/esp_wifi_types_generic.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ typedef struct {
13661366
uint32_t reserved_2; /**< Reserved */
13671367
uint8_t ssi_version; /**< Indicates version of SSI in Publish instance, 0 if not available */
13681368
uint16_t ssi_len; /**< Length of service specific info */
1369-
uint8_t *ssi; /**< Service specific info of Publisher */
1369+
uint8_t ssi[]; /**< Service specific info of Publisher */
13701370
} wifi_event_nan_svc_match_t;
13711371

13721372
/**
@@ -1379,7 +1379,7 @@ typedef struct {
13791379
uint32_t reserved_1; /**< Reserved */
13801380
uint32_t reserved_2; /**< Reserved */
13811381
uint16_t ssi_len; /**< Length of service specific info */
1382-
uint8_t *ssi; /**< Service specific info of Subscriber */
1382+
uint8_t ssi[]; /**< Service specific info of Subscriber */
13831383
} wifi_event_nan_replied_t;
13841384

13851385
/**
@@ -1392,7 +1392,7 @@ typedef struct {
13921392
uint32_t reserved_1; /**< Reserved */
13931393
uint32_t reserved_2; /**< Reserved */
13941394
uint16_t ssi_len; /**< Length of service specific info */
1395-
uint8_t *ssi; /**< Service specific info from Follow-up */
1395+
uint8_t ssi[]; /**< Service specific info from Follow-up */
13961396
} wifi_event_nan_receive_t;
13971397

13981398
/**
@@ -1406,7 +1406,7 @@ typedef struct {
14061406
uint32_t reserved_1; /**< Reserved */
14071407
uint32_t reserved_2; /**< Reserved */
14081408
uint16_t ssi_len; /**< Length of service specific info */
1409-
uint8_t *ssi; /**< Service specific info from NDP/NDPE Attribute */
1409+
uint8_t ssi[]; /**< Service specific info from NDP/NDPE Attribute */
14101410
} wifi_event_ndp_indication_t;
14111411

14121412
/**
@@ -1421,7 +1421,7 @@ typedef struct {
14211421
uint32_t reserved_1; /**< Reserved */
14221422
uint32_t reserved_2; /**< Reserved */
14231423
uint16_t ssi_len; /**< Length of Service Specific Info */
1424-
uint8_t *ssi; /**< Service specific info from NDP/NDPE Attribute */
1424+
uint8_t ssi[]; /**< Service specific info from NDP/NDPE Attribute */
14251425
} wifi_event_ndp_confirm_t;
14261426

14271427
/**

0 commit comments

Comments
 (0)