net: conn_mgr: generic wifi_mgmt connectivity backend

As connectivity backends need to be bound in the same file that the
`net_if` is created in, define a common backend type for WiFi modems.
All WiFi modems should be controllable through the `wifi_mgmt` API, so
there should be no need for dedicated context.

When enabled, the particular implementation to be used is chosen through
`CONNECTIVITY_WIFI_MGMT_IMPL`. For now, the only choice is an
application defined backend.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
Jordan Yates 2024-01-27 12:59:03 +10:00 committed by Anas Nashif
parent 0dcb0518be
commit 9ff1fcf7e7
2 changed files with 59 additions and 0 deletions

View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2024 CSIRO
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Connectivity implementation for drivers exposing the wifi_mgmt API
*/
#ifndef ZEPHYR_INCLUDE_CONN_MGR_CONNECTIVITY_WIFI_MGMT_H_
#define ZEPHYR_INCLUDE_CONN_MGR_CONNECTIVITY_WIFI_MGMT_H_
#include <zephyr/net/conn_mgr_connectivity_impl.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Context type for generic WIFI_MGMT connectivity backend.
*/
#define CONNECTIVITY_WIFI_MGMT_CTX_TYPE void *
/**
* @brief Associate the generic WIFI_MGMT implementation with a network device
*
* @param dev_id Network device id.
*/
#define CONNECTIVITY_WIFI_MGMT_BIND(dev_id) \
IF_ENABLED(CONFIG_NET_CONNECTION_MANAGER_CONNECTIVITY_WIFI_MGMT, \
(CONN_MGR_CONN_DECLARE_PUBLIC(CONNECTIVITY_WIFI_MGMT); \
CONN_MGR_BIND_CONN(dev_id, CONNECTIVITY_WIFI_MGMT)))
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_INCLUDE_CONN_MGR_CONNECTIVITY_WIFI_MGMT_H_ */

View file

@ -39,4 +39,23 @@ config NET_CONNECTION_MANAGER_AUTO_IF_DOWN
bool "Automatically call net_if_down on ifaces that have given up on connecting"
default y
config NET_CONNECTION_MANAGER_CONNECTIVITY_WIFI_MGMT
bool "Generic WiFi management connectivity implementation"
depends on NET_L2_WIFI_MGMT
help
Enable CONNECTIVITY_WIFI_MGMT connectivity bindings on WiFi drivers.
Which implementation is compiled is controlled via CONNECTIVITY_WIFI_MGMT_IMPL.
choice CONNECTIVITY_WIFI_MGMT_IMPL
prompt "Implementation of the generic wifi_mgmt connectivity backend"
depends on NET_CONNECTION_MANAGER_CONNECTIVITY_WIFI_MGMT
default CONNECTIVITY_WIFI_MGMT_APPLICATION
config CONNECTIVITY_WIFI_MGMT_APPLICATION
bool "Application specific implementation of the connectivity backend"
help
The application defines its own implementation of CONNECTIVITY_WIFI_MGMT.
endchoice
endif # NET_CONNECTION_MANAGER