From 67011a392c017971b1c0e7b8f6621fd5613f6075 Mon Sep 17 00:00:00 2001 From: Yu Wang Date: Wed, 27 Jul 2022 14:33:31 +0800 Subject: [PATCH] qcacmn: add support for CoAP Add support for Constrained Application Protocol. Change-Id: I425206a990778cf946a4805192eff4d54562a945 CRs-Fixed: 3254128 --- .../dispatcher/src/dispatcher_init_deinit.c | 60 +++++++++++++++++++ target_if/core/src/target_if_main.c | 20 +++++++ umac/cmn_services/inc/wlan_cmn.h | 2 + .../obj_mgr/inc/wlan_objmgr_cmn.h | 5 +- .../lmac_if/inc/wlan_lmac_if_def.h | 37 ++++++++++++ wmi/inc/wmi_unified_param.h | 3 + wmi/inc/wmi_unified_priv.h | 37 ++++++++++++ wmi/src/wmi_unified_tlv.c | 5 ++ 8 files changed, 168 insertions(+), 1 deletion(-) diff --git a/init_deinit/dispatcher/src/dispatcher_init_deinit.c b/init_deinit/dispatcher/src/dispatcher_init_deinit.c index ff3f0da2e1..1c7404d99e 100644 --- a/init_deinit/dispatcher/src/dispatcher_init_deinit.c +++ b/init_deinit/dispatcher/src/dispatcher_init_deinit.c @@ -85,6 +85,10 @@ #include +#ifdef WLAN_FEATURE_COAP +#include +#endif + /** * DOC: This file provides various init/deinit trigger point for new * components. @@ -1051,6 +1055,48 @@ static QDF_STATUS mlo_mgr_psoc_disable(struct wlan_objmgr_psoc *psoc) } #endif +#ifdef WLAN_FEATURE_COAP +static QDF_STATUS dispatcher_coap_init(void) +{ + return wlan_coap_init(); +} + +static QDF_STATUS dispatcher_coap_deinit(void) +{ + return wlan_coap_deinit(); +} + +static QDF_STATUS coap_psoc_enable(struct wlan_objmgr_psoc *psoc) +{ + return wlan_coap_enable(psoc); +} + +static QDF_STATUS coap_psoc_disable(struct wlan_objmgr_psoc *psoc) +{ + return wlan_coap_disable(psoc); +} +#else +static QDF_STATUS dispatcher_coap_init(void) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS dispatcher_coap_deinit(void) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS coap_psoc_enable(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS coap_psoc_disable(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} +#endif + QDF_STATUS dispatcher_init(void) { if (QDF_STATUS_SUCCESS != wlan_objmgr_global_obj_init()) @@ -1137,6 +1183,9 @@ QDF_STATUS dispatcher_init(void) if (QDF_STATUS_SUCCESS != dispatcher_twt_init()) goto twt_init_fail; + if (QDF_STATUS_SUCCESS != dispatcher_coap_init()) + goto coap_init_fail; + /* * scheduler INIT has to be the last as each component's * initialization has to happen first and then at the end @@ -1148,6 +1197,8 @@ QDF_STATUS dispatcher_init(void) return QDF_STATUS_SUCCESS; scheduler_init_fail: + dispatcher_coap_deinit(); +coap_init_fail: dispatcher_twt_deinit(); twt_init_fail: wlan_gpio_deinit(); @@ -1215,6 +1266,8 @@ QDF_STATUS dispatcher_deinit(void) QDF_BUG(QDF_STATUS_SUCCESS == scheduler_deinit()); + QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_coap_deinit()); + QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_twt_deinit()); QDF_BUG(QDF_STATUS_SUCCESS == wlan_gpio_deinit()); @@ -1448,8 +1501,13 @@ QDF_STATUS dispatcher_psoc_enable(struct wlan_objmgr_psoc *psoc) if (QDF_STATUS_SUCCESS != dbam_psoc_enable(psoc)) goto dbam_psoc_enable_fail; + if (QDF_STATUS_SUCCESS != coap_psoc_enable(psoc)) + goto coap_psoc_enable_fail; + return QDF_STATUS_SUCCESS; +coap_psoc_enable_fail: + dbam_psoc_disable(psoc); dbam_psoc_enable_fail: dispatcher_twt_psoc_disable(psoc); twt_psoc_enable_fail: @@ -1491,6 +1549,8 @@ QDF_STATUS dispatcher_psoc_disable(struct wlan_objmgr_psoc *psoc) { QDF_STATUS status; + QDF_BUG(QDF_STATUS_SUCCESS == coap_psoc_disable(psoc)); + QDF_BUG(QDF_STATUS_SUCCESS == dbam_psoc_disable(psoc)); QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_twt_psoc_disable(psoc)); diff --git a/target_if/core/src/target_if_main.c b/target_if/core/src/target_if_main.c index e6d6c79b43..975b3896d4 100644 --- a/target_if/core/src/target_if_main.c +++ b/target_if/core/src/target_if_main.c @@ -115,6 +115,10 @@ #include #endif +#ifdef WLAN_FEATURE_COAP +#include +#endif + static struct target_if_ctx *g_target_if_ctx; struct target_if_ctx *target_if_get_ctx() @@ -430,6 +434,20 @@ target_if_dbam_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops) } #endif +#ifdef WLAN_FEATURE_COAP +static QDF_STATUS +target_if_coap_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops) +{ + return target_if_coap_register_tx_ops(tx_ops); +} +#else +static inline QDF_STATUS +target_if_coap_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops) +{ + return QDF_STATUS_SUCCESS; +} +#endif + static void target_if_target_tx_ops_register( struct wlan_lmac_if_tx_ops *tx_ops) { @@ -635,6 +653,8 @@ QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) target_if_dbam_tx_ops_register(tx_ops); + target_if_coap_tx_ops_register(tx_ops); + /* Converged UMAC components to register their TX-ops here */ return QDF_STATUS_SUCCESS; } diff --git a/umac/cmn_services/inc/wlan_cmn.h b/umac/cmn_services/inc/wlan_cmn.h index 310b928458..22068b3bba 100644 --- a/umac/cmn_services/inc/wlan_cmn.h +++ b/umac/cmn_services/inc/wlan_cmn.h @@ -295,6 +295,7 @@ * @WLAN_UMAC_COMP_TWT: Target Wake Time (TWT) Component * @WLAN_UMAC_COMP_PRE_CAC: PRE CAC component * @WLAN_COMP_DP: DP component + * @WLAN_UMAC_COMP_COAP: Constrained Application Protocol component * @WLAN_UMAC_COMP_ID_MAX: Maximum components in UMAC * * This id is static. @@ -349,6 +350,7 @@ enum wlan_umac_comp_id { WLAN_UMAC_COMP_PRE_CAC = 45, WLAN_COMP_DP = 46, WLAN_COMP_TELEMETRY_AGENT = 47, + WLAN_UMAC_COMP_COAP = 48, WLAN_UMAC_COMP_ID_MAX, }; diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h index 7abcb88fcd..10c5a91994 100644 --- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h +++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h @@ -288,6 +288,7 @@ typedef void (*wlan_objmgr_peer_status_handler)( * @WLAN_LITE_MON_ID: Lite monitor operations * @WLAN_PRE_CAC_ID: Pre-CAC operations * @WLAN_DP_ID: DP component + * @WLAN_COAP_ID: Constrained Application Protocol reference id * @WLAN_REF_ID_MAX: Max id used to generate ref count tracking array */ /* New value added to the enum must also be reflected in function @@ -394,6 +395,7 @@ typedef enum { WLAN_PRE_CAC_ID = 96, WLAN_DP_ID = 97, WLAN_UMAC_RESET_ID = 98, + WLAN_COAP_ID = 99, WLAN_REF_ID_MAX, } wlan_objmgr_ref_dbgid; @@ -504,7 +506,8 @@ static inline const char *string_from_dbgid(wlan_objmgr_ref_dbgid id) "WLAN_TWT_ID", "WLAN_LITE_MON_ID", "WLAN_PRE_CAC_ID", - "WLAN_DP_ID" + "WLAN_DP_ID", + "WLAN_COAP_ID" }; if (id >= WLAN_REF_ID_MAX) diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h index 268fdb3dc5..70bab7ba74 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h +++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h @@ -102,6 +102,10 @@ struct dbr_module_config; #include "wlan_coex_public_structs.h" #endif +#ifdef WLAN_FEATURE_COAP +#include "wlan_coap_public_structs.h" +#endif + /** * typedef cp_stats_event - Definition of cp stats event * Define stats_event from external cp stats component to cp_stats_event @@ -1471,6 +1475,35 @@ struct wlan_lmac_if_twt_rx_ops { struct wlan_lmac_if_spatial_reuse_tx_ops { QDF_STATUS (*send_cfg)(struct wlan_objmgr_vdev *vdev, uint8_t sr_ctrl, uint8_t non_srg_max_pd_offset); + }; +#endif + +#ifdef WLAN_FEATURE_COAP +/** + * struct wlan_lmac_if_coap_tx_ops - south bound tx function pointers for CoAP + * @attach: function pointer to attach CoAP component + * @detach: function pointer to detach CoAP component + * @offload_reply_enable: function pointer to enable CoAP offload reply + * @offload_reply_disable: function pointer to disable CoAP offload reply + * @offload_periodic_tx_enable: function pointer to enable CoAP offload + * periodic transmitting + * @offload_periodic_tx_disable: function pointer to disable CoAP offload + * periodic transmitting + * @offload_cache_get: function pointer to get cached CoAP messages + */ +struct wlan_lmac_if_coap_tx_ops { + QDF_STATUS (*attach)(struct wlan_objmgr_psoc *psoc); + QDF_STATUS (*detach)(struct wlan_objmgr_psoc *psoc); + QDF_STATUS (*offload_reply_enable)(struct wlan_objmgr_vdev *vdev, + struct coap_offload_reply_param *param); + QDF_STATUS (*offload_reply_disable)(struct wlan_objmgr_vdev *vdev, + uint32_t req_id); + QDF_STATUS (*offload_periodic_tx_enable)(struct wlan_objmgr_vdev *vdev, + struct coap_offload_periodic_tx_param *param); + QDF_STATUS (*offload_periodic_tx_disable)(struct wlan_objmgr_vdev *vdev, + uint32_t req_id); + QDF_STATUS (*offload_cache_get)(struct wlan_objmgr_vdev *vdev, + uint32_t req_id); }; #endif @@ -1586,6 +1619,10 @@ struct wlan_lmac_if_tx_ops { #if defined WLAN_FEATURE_11AX struct wlan_lmac_if_spatial_reuse_tx_ops spatial_reuse_tx_ops; #endif + +#ifdef WLAN_FEATURE_COAP + struct wlan_lmac_if_coap_tx_ops coap_ops; +#endif }; /** diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 02813f3c1e..fd1796f84e 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -5102,6 +5102,9 @@ typedef enum { wmi_coex_dbam_complete_event_id, #endif wmi_spectral_capabilities_eventid, +#ifdef WLAN_FEATURE_COAP + wmi_wow_coap_buf_info_eventid, +#endif wmi_events_max, } wmi_conv_event_id; diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index f53dd3a23f..62d2efc72c 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -107,6 +107,10 @@ #include "wlan_coex_public_structs.h" #endif +#ifdef WLAN_FEATURE_COAP +#include "wlan_coap_public_structs.h" +#endif + #define WMI_UNIFIED_MAX_EVENT 0x100 #ifdef WMI_EXT_DBG @@ -3086,6 +3090,31 @@ QDF_STATUS (*feature_set_cmd_send)(wmi_unified_t wmi_handle, struct target_feature_set *feature_set); #endif + +#ifdef WLAN_FEATURE_COAP +QDF_STATUS +(*send_coap_add_pattern_cmd)(wmi_unified_t wmi_handle, + struct coap_offload_reply_param *param); + +QDF_STATUS +(*send_coap_del_pattern_cmd)(wmi_unified_t wmi_handle, + uint8_t vdev_id, uint32_t pattern_id); + +QDF_STATUS +(*send_coap_add_keepalive_pattern_cmd)(wmi_unified_t wmi_handle, + struct coap_offload_periodic_tx_param *param); + +QDF_STATUS +(*send_coap_del_keepalive_pattern_cmd)(wmi_unified_t wmi_handle, + uint8_t vdev_id, uint32_t pattern_id); + +QDF_STATUS +(*send_coap_cache_get_cmd)(wmi_unified_t wmi_handle, + uint8_t vdev_id, uint32_t pattern_id); + +QDF_STATUS (*extract_coap_buf_info)(wmi_unified_t wmi_handle, void *evt_buf, + struct coap_buf_info *info); +#endif }; /* Forward declartion for psoc*/ @@ -3673,6 +3702,14 @@ static inline void wmi_mc_cp_stats_attach_tlv(struct wmi_unified *wmi_handle) } #endif /* QCA_SUPPORT_MC_CP_STATS */ +#ifdef WLAN_FEATURE_COAP +void wmi_coap_attach_tlv(wmi_unified_t wmi_handle); +#else +static inline void wmi_coap_attach_tlv(wmi_unified_t wmi_handle) +{ +} +#endif + /* * wmi_map_ch_width() - map wmi channel width to host channel width * @wmi_width: wmi channel width diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 0875790255..e66d53f560 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -19791,6 +19791,10 @@ static void populate_tlv_events_id(uint32_t *event_ids) #endif event_ids[wmi_spectral_capabilities_eventid] = WMI_SPECTRAL_CAPABILITIES_EVENTID; +#ifdef WLAN_FEATURE_COAP + event_ids[wmi_wow_coap_buf_info_eventid] = + WMI_WOW_COAP_BUF_INFO_EVENTID; +#endif } #ifdef WLAN_FEATURE_LINK_LAYER_STATS @@ -20366,6 +20370,7 @@ void wmi_tlv_attach(wmi_unified_t wmi_handle) wmi_cp_stats_attach_tlv(wmi_handle); wmi_gpio_attach_tlv(wmi_handle); wmi_11be_attach_tlv(wmi_handle); + wmi_coap_attach_tlv(wmi_handle); } qdf_export_symbol(wmi_tlv_attach);