diff --git a/fw_if/umac_if/src/default/fmac_api.c b/fw_if/umac_if/src/default/fmac_api.c index cd6d4d9..c45a8ff 100644 --- a/fw_if/umac_if/src/default/fmac_api.c +++ b/fw_if/umac_if/src/default/fmac_api.c @@ -60,7 +60,7 @@ static enum nrf_wifi_status nrf_wifi_fmac_init_tx(struct nrf_wifi_fmac_dev_ctx * def_priv->data_config.max_tx_aggregation * sizeof(struct nrf_wifi_fmac_buf_map_info)); - def_dev_ctx->tx_buf_info = nrf_wifi_osal_mem_zalloc(size); + def_dev_ctx->tx_buf_info = nrf_wifi_osal_data_mem_zalloc(size); if (!def_dev_ctx->tx_buf_info) { nrf_wifi_osal_log_err("%s: No space for TX buf info", @@ -86,7 +86,7 @@ static void nrf_wifi_fmac_deinit_tx(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx) tx_deinit(fmac_dev_ctx); - nrf_wifi_osal_mem_free(def_dev_ctx->tx_buf_info); + nrf_wifi_osal_data_mem_free(def_dev_ctx->tx_buf_info); } #endif /* NRF70_DATA_TX */ @@ -106,7 +106,7 @@ static enum nrf_wifi_status nrf_wifi_fmac_init_rx(struct nrf_wifi_fmac_dev_ctx * size = (def_priv->num_rx_bufs * sizeof(struct nrf_wifi_fmac_buf_map_info)); - def_dev_ctx->rx_buf_info = nrf_wifi_osal_mem_zalloc(size); + def_dev_ctx->rx_buf_info = nrf_wifi_osal_data_mem_zalloc(size); if (!def_dev_ctx->rx_buf_info) { nrf_wifi_osal_log_err("%s: No space for RX buf info", @@ -182,7 +182,7 @@ static enum nrf_wifi_status nrf_wifi_fmac_deinit_rx(struct nrf_wifi_fmac_dev_ctx } } - nrf_wifi_osal_mem_free(def_dev_ctx->rx_buf_info); + nrf_wifi_osal_data_mem_free(def_dev_ctx->rx_buf_info); def_dev_ctx->rx_buf_info = NULL; out: diff --git a/os_if/inc/osal_api.h b/os_if/inc/osal_api.h index 5f17fb4..e20ba92 100644 --- a/os_if/inc/osal_api.h +++ b/os_if/inc/osal_api.h @@ -41,7 +41,7 @@ void nrf_wifi_osal_init(const struct nrf_wifi_osal_ops *ops); void nrf_wifi_osal_deinit(void); /** - * @brief Allocate memory. + * @brief Allocate memory for control path requests. * @param size Size of the memory to be allocated in bytes. * * Allocates memory of @p size bytes and returns a pointer to the start @@ -52,7 +52,7 @@ void nrf_wifi_osal_deinit(void); void *nrf_wifi_osal_mem_alloc(size_t size); /** - * @brief Allocated zero-initialized memory. + * @brief Allocated zero-initialized memory for control path requests. * @param size Size of the memory to be allocated in bytes. * * Allocates zero-initialized memory of @p size bytes and returns a pointer to the start @@ -63,7 +63,19 @@ void *nrf_wifi_osal_mem_alloc(size_t size); void *nrf_wifi_osal_mem_zalloc(size_t size); /** - * @brief Free previously allocated memory. + * @brief Allocated zero-initialized memory for data. + * + * @size: Size of the memory to be allocated in bytes. + * + * Allocates memory of @size bytes, zeroes it out and returns a pointer to the + * start of the memory allocated. + * + * @return: Pointer to start of allocated memory or NULL. + */ +void *nrf_wifi_osal_data_mem_zalloc(size_t size); + +/** + * @brief Free previously allocated memory for control path requests. * @param buf Pointer to the memory to be freed. * * Free up memory which has been allocated using nrf_wifi_osal_mem_alloc or @@ -71,6 +83,18 @@ void *nrf_wifi_osal_mem_zalloc(size_t size); */ void nrf_wifi_osal_mem_free(void *buf); +/** + * @brief Free previously allocated memory for data. + * + * @buf: Pointer to the memory to be freed. + * + * Free up memory which has been allocated using @nrf_wifi_osal_mem_alloc or + * @nrf_wifi_osal_mem_zalloc. + * + * @return: None. + */ +void nrf_wifi_osal_data_mem_free(void *buf); + /** * @brief Copy contents from one memory location to another. * diff --git a/os_if/inc/osal_ops.h b/os_if/inc/osal_ops.h index 9a78729..5f6e1c9 100644 --- a/os_if/inc/osal_ops.h +++ b/os_if/inc/osal_ops.h @@ -28,13 +28,13 @@ struct nrf_wifi_osal_ops { /** * @brief Allocate memory. * - * @param size The size of the memory to allocate. + * @param size The size of the memory to allocate for control messages. * @return A pointer to the start of the allocated memory. */ void *(*mem_alloc)(size_t size); /** - * @brief Allocate zero-initialized memory. + * @brief Allocate zero-initialized memory for control messages. * * @param size The size of the memory to allocate. * @return A pointer to the start of the allocated memory. @@ -42,12 +42,27 @@ struct nrf_wifi_osal_ops { void *(*mem_zalloc)(size_t size); /** - * @brief Free allocated memory. + * @brief Free memory allocated for control messages. * * @param buf A pointer to the memory to free. */ void (*mem_free)(void *buf); + /** + * @brief Allocate zero-initialized memory for data. + * + * @param size The size of the memory to allocate. + * @return A pointer to the start of the allocated memory. + */ + void *(*data_mem_zalloc)(size_t size); + + /** + * @brief Free memory allocated for data. + * + * @param buf A pointer to the memory to free. + */ + void (*data_mem_free)(void *buf); + /** * @brief Copy memory. * diff --git a/os_if/src/osal.c b/os_if/src/osal.c index 34a81de..1070331 100644 --- a/os_if/src/osal.c +++ b/os_if/src/osal.c @@ -37,12 +37,24 @@ void *nrf_wifi_osal_mem_zalloc(size_t size) } +void *nrf_wifi_osal_data_mem_zalloc(size_t size) +{ + return os_ops->data_mem_zalloc(size); +} + + void nrf_wifi_osal_mem_free(void *buf) { os_ops->mem_free(buf); } +void nrf_wifi_osal_data_mem_free(void *buf) +{ + os_ops->data_mem_free(buf); +} + + void *nrf_wifi_osal_mem_cpy(void *dest, const void *src, size_t count)