Skip to content

Commit cb17cb5

Browse files
committed
wifi: nxp: add dedicated P2P (WFD) net device for Wi-Fi Direct
Register a new Zephyr net_if instance for P2P interface - Add NXP_WIFI_P2P_SUPPORT Kconfig; increase heap pool to 100 KB - Defer wlan init via atomic counter until all net_if callbacks fire - Add nxp_wifi_p2p_init() and register iface as WIFI_TYPE_P2P - Add net_get_if_by_bss_type() to replace direct g_mlan/g_uap refs - Extend net_wlan_set_mac_address() with wfd_mac parameter - Wire up register_frame, deinit_ap, set_p2p_powersave ops - Fix LLC-header removal: use net_pkt_data() after net_buf_pull() Signed-off-by: Hui Bai <hui.bai@nxp.com>
1 parent 5e17141 commit cb17cb5

6 files changed

Lines changed: 390 additions & 113 deletions

File tree

drivers/wifi/nxp/Kconfig.nxp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if WIFI_NXP
2020
module = WIFI_NXP
2121

2222
config HEAP_MEM_POOL_ADD_SIZE_NXP_WIFI
23+
def_int 102400 if WIFI_NM_WPA_SUPPLICANT_P2P
2324
def_int 25984 if WIFI_NM_WPA_SUPPLICANT
2425
def_int 51200
2526

@@ -454,6 +455,14 @@ config NXP_WIFI_SCAN_TASK_STACK_SIZE
454455
help
455456
This option specifies the size of the stack used by the wifi scan task.
456457

458+
config NXP_WIFI_P2P_SUPPORT
459+
bool "Wi-Fi P2P (Wi-Fi Direct) Support"
460+
default y if WIFI_NM_WPA_SUPPLICANT_P2P
461+
help
462+
Registers a dedicated Zephyr net_if for Wi-Fi P2P (Wi-Fi Direct).
463+
This enables IP networking over a P2P group interface and allows
464+
P2P shell commands to target the P2P iface directly.
465+
457466
endmenu
458467

459468
menu "Wi-Fi thread priority configurations"

drivers/wifi/nxp/incl/nxp_wifi_net.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ static inline uint32_t net_inet_aton(const char *cp)
268268
* \param[in] uapmac uap MAC address.
269269
*
270270
*/
271-
void net_wlan_set_mac_address(unsigned char *stamac, unsigned char *uapmac);
271+
void net_wlan_set_mac_address(unsigned char *sta_mac,
272+
unsigned char *uap_mac,
273+
unsigned char *wfd_mac);
272274

273275
/* Skip a number of bytes at the start of a stack buffer
274276
*
@@ -475,6 +477,15 @@ struct netif *net_get_sta_interface(void);
475477
struct netif *net_get_uap_interface(void);
476478
#endif
477479

480+
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_P2P
481+
/* Get P2P interface netif structure pointer
482+
*
483+
* \rerurn A pointer to P2P interface netif structure
484+
*
485+
*/
486+
struct netif *net_get_wfd_interface(void);
487+
#endif
488+
478489
/* NXP wrapper to get network interface name.
479490
*
480491
* @details If interface name support is not enabled, empty string is returned.
@@ -877,4 +888,15 @@ void nxp_wifi_internal_register_rx_cb(int (*rx_cb_fn)(struct net_if *iface, stru
877888
* @return Pointer to net_iface if found; NULL otherwise
878889
*/
879890
const struct netif *net_if_get_binding(const char *ifname);
891+
892+
/* Get net interface by BSS type
893+
*
894+
* This API searches for a network interface based on the bss type
895+
* and returns the corresponding net_if instance.
896+
*
897+
* @param interface BSS type of the network interface
898+
*
899+
* @return pointer to net_if when found; NULL otherwise
900+
*/
901+
struct net_if *net_get_if_by_bss_type(int interface);
880902
#endif /* _NXP_WIFI_NET_H_ */

0 commit comments

Comments
 (0)