Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrf_wifi: Support for DMS #1348

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions nrf_wifi/fw_if/umac_if/inc/default/fmac_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,38 @@ enum nrf_wifi_status nrf_wifi_fmac_set_ps_wakeup_mode(void *fmac_dev_ctx,
unsigned char if_idx,
bool ps_wakeup_mode);

/**
* @brief TWT setup command
* @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
* @param if_idx Index of the interface on which the DMS parameters be set.
* @param dms_info DMS parameters.
*
* This function is used to send a command to the RPU firmware to:
* - Configure DMS add request specific parameters.
*
*@retval NRF_WIFI_STATUS_SUCCESS On success
*@retval NRF_WIFI_STATUS_FAIL On failure to execute command
*/
enum nrf_wifi_status nrf_wifi_fmac_req_add_dms(void *fmac_dev_ctx,
unsigned char if_idx,
struct nrf_wifi_umac_config_dms_info *dms_info);

/**
* @brief DMS remove command
* @param fmac_dev_ctx Pointer to the UMAC IF context for a RPU WLAN device.
* @param if_idx Index of the interface on which the DMS parameters are to be set.
* @param dms_info DMS parameters.
*
* This function is used to send a command to the RPU firmware to:
* - Tear down an existing DMS session.
*
*@retval NRF_WIFI_STATUS_SUCCESS On success
*@retval NRF_WIFI_STATUS_FAIL On failure to execute command
*/
enum nrf_wifi_status nrf_wifi_fmac_req_remove_dms(void *fmac_dev_ctx,
unsigned char if_idx,
struct nrf_wifi_umac_config_dms_info *dms_info);

#ifdef CONFIG_NRF700X_RAW_DATA_TX
/**
* @brief Transmit a raw unaltered frame to the RPU.
Expand Down
9 changes: 9 additions & 0 deletions nrf_wifi/fw_if/umac_if/inc/default/fmac_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,15 @@ struct nrf_wifi_fmac_callbk_fns {
void (*reg_change_callbk_fn)(void *os_vif_ctx,
struct nrf_wifi_event_regulatory_change *reg_change,
unsigned int event_len);
/** Callback function to be called when a DMS add request response is received. */
void (*req_add_dms_callbk_fn)(void *if_priv,
struct nrf_wifi_umac_cmd_req_add_dms *add_config_event_info,
unsigned int event_len);

/** Callback function to be called when a DMS remove response is received. */
void (*req_remove_dms_callbk_fn)(void *if_priv,
struct nrf_wifi_umac_cmd_req_remove_dms *remove_dms_event_info,
unsigned int event_len);
};

#if defined(CONFIG_NRF700X_STA_MODE) || defined(__DOXYGEN__)
Expand Down
125 changes: 123 additions & 2 deletions nrf_wifi/fw_if/umac_if/inc/fw/host_rpu_umac_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ enum nrf_wifi_umac_commands {
/** Set listen interval @ref nrf_wifi_umac_cmd_set_listen_interval */
NRF_WIFI_UMAC_CMD_SET_LISTEN_INTERVAL,
/** Configure extended power save @ref nrf_wifi_umac_cmd_config_extended_ps */
NRF_WIFI_UMAC_CMD_CONFIG_EXTENDED_PS
NRF_WIFI_UMAC_CMD_CONFIG_EXTENDED_PS,
/** Add DMS @ref nrf_wifi_umac_cmd_req_add_dms */
NRF_WIFI_UMAC_CMD_REQ_ADD_DMS,
/** Remove DMS @ref nrf_wifi_umac_cmd_req_remove_dms */
NRF_WIFI_UMAC_CMD_REQ_REMOVE_DMS,
/** Change DMS @ref nrf_wifi_umac_cmd_req_change_dms */
NRF_WIFI_UMAC_CMD_REQ_CHANGE_DMS,
};

/**
Expand Down Expand Up @@ -240,7 +246,14 @@ enum nrf_wifi_umac_events {
/** send connection information @ref nrf_wifi_umac_event_conn_info. */
NRF_WIFI_UMAC_EVENT_GET_CONNECTION_INFO,
/** @ref nrf_wifi_umac_event_power_save_info */
NRF_WIFI_UMAC_EVENT_GET_POWER_SAVE_INFO
NRF_WIFI_UMAC_EVENT_GET_POWER_SAVE_INFO,
/** Send DMS response information @ref nrf_wifi_umac_cmd_req_add_dms */
NRF_WIFI_UMAC_EVENT_REQ_ADD_DMS,
/** Send DMS remove information @ref nrf_wifi_umac_cmd_req_remove_dms */
NRF_WIFI_UMAC_EVENT_REQ_REMOVE_DMS,
/** Send DMS change information @ref nrf_wifi_umac_cmd_req_change_dms */
NRF_WIFI_UMAC_EVENT_TERMINATE_DMS,
/** Send DMS terminate information @ref nrf_wifi_umac_event_terminate_dms */
};

/**
Expand Down Expand Up @@ -3499,4 +3512,112 @@ struct nrf_wifi_umac_event_cmd_status {
unsigned int cmd_status;
} __NRF_WIFI_PKD;


/**
* @brief DMS add commands and events.
*
*/

enum nrf_wifi_dms_setup_cmd_type {
/** STA requests to add a multicast address */
NRF_WIFI_REQUEST_ADD_DMS,
/** AP accept the STA requested params */
NRF_WIFI_ACCEPT_DMS,
/** AP may suggest the params, these may be different from STA requested */
NRF_WIFI_ALTERNATE_DMS,
/** AP may reject the STA requested params */
NRF_WIFI_REJECT_DMS,
};


#define NRF_WIFI_DMS_RESP_RECEIVED 0
#define NRF_WIFI_DMS_RESP_NOT_RECEIVED 1
#define NRF_WIFI_INVALID_DMS_PARAM 3

/**
* @brief This structure describes the DMS information.
*
*/

struct nrf_wifi_umac_config_dms_info {
/** Dialog token, used to map requests to responses */
unsigned char dialog_token;
/** DMSID, used to identifying the DMS for the group addressed frame */
unsigned char dmsid;
/** User priority */
unsigned char up;
/** Tclas type */
unsigned char tclas_type;
/** Tclas mask */
unsigned char tclas_mask;
/** Tclas category 4 elements */
/** Version */
unsigned char version;
/** Source ip address */
unsigned int src_ip_addr;
/** Destination ip address */
unsigned int dest_ip_addr;
/** Source port */
unsigned short src_port;
/** Destination port */
unsigned short dest_port;
/** DSCP */
unsigned char dscp;
/** Protocol */
unsigned char protocol;
/** 0->not received 1->received */
unsigned char dms_resp_status;
} __NRF_WIFI_PKD;

/**
* @brief This structure defines the parameters required for setting up TWT session.
*
*/

struct nrf_wifi_umac_cmd_req_add_dms {
/** Header @ref nrf_wifi_umac_hdr */
struct nrf_wifi_umac_hdr umac_hdr;
/** DMS add info @ref nrf_wifi_umac_config_dms_info */
struct nrf_wifi_umac_config_dms_info info;
} __NRF_WIFI_PKD;

#define INVALID_TIME 1
#define TRIGGER_NOT_RECEIVED 2

/**
* @brief This structure represents the DMS remove information.
*
*/

struct nrf_wifi_umac_cmd_req_remove_dms {
/** DMS Id */
unsigned char dms_id;
/** reason for teardown */
unsigned char reason_code;
} __NRF_WIFI_PKD;

/**
* @brief This structure defines the command used to change a DMS session
*
*/

struct nrf_wifi_umac_cmd_req_change_dms {
/** Header @ref nrf_wifi_umac_hdr */
struct nrf_wifi_umac_hdr umac_hdr;
/** DMS info @ref nrf_wifi_umac_config_dms_info */
struct nrf_wifi_umac_config_dms_info info;
} __NRF_WIFI_PKD;

/**
* @brief This structure defines an event used to indicate to the host
* when terminate event is received.
*
*/

struct nrf_wifi_umac_event_terminate_dms {
/** Header @ref nrf_wifi_umac_hdr */
struct nrf_wifi_umac_hdr umac_hdr;
/** DMS info @ref nrf_wifi_umac_config_dms_info */
struct nrf_wifi_umac_config_dms_info info;
} __NRF_WIFI_PKD;
#endif /* __HOST_RPU_UMAC_IF_H */
94 changes: 94 additions & 0 deletions nrf_wifi/fw_if/umac_if/src/default/fmac_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -3118,4 +3118,98 @@ enum nrf_wifi_status nrf_wifi_fmac_set_ps_wakeup_mode(void *dev_ctx,

return status;
}

enum nrf_wifi_status nrf_wifi_fmac_req_dms_add(void *dev_ctx,
unsigned char if_idx,
struct nrf_wifi_umac_config_dms_info *dms_info)
{

enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
struct nrf_wifi_umac_cmd_req_add_dms *req_dms_add_cmd = NULL;
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL;

if (!dev_ctx || !dms_info) {
goto out;
}

fmac_dev_ctx = dev_ctx;

req_dms_add_cmd = nrf_wifi_osal_mem_zalloc(fmac_dev_ctx->fpriv->opriv,
sizeof(*req_dms_add_cmd));

if (!req_dms_add_cmd) {
nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv,
"%s: Unable to allocate memory",
__func__);
goto out;
}

nrf_wifi_osal_mem_cpy(fmac_dev_ctx->fpriv->opriv,
&req_dms_add_cmd->info,
dms_info,
sizeof(req_dms_add_cmd->info));

req_dms_add_cmd->umac_hdr.cmd_evnt = NRF_WIFI_UMAC_CMD_REQ_ADD_DMS;
req_dms_add_cmd->umac_hdr.ids.wdev_id = if_idx;
req_dms_add_cmd->umac_hdr.ids.valid_fields |= NRF_WIFI_INDEX_IDS_WDEV_ID_VALID;

status = umac_cmd_cfg(fmac_dev_ctx,
req_dms_add_cmd,
sizeof(*req_dms_add_cmd));
out:
if (req_dms_add_cmd) {
nrf_wifi_osal_mem_free(fmac_dev_ctx->fpriv->opriv,
req_dms_add_cmd);
}

return status;
}


enum nrf_wifi_status nrf_wifi_req_remove_dms(void *dev_ctx,
unsigned char if_idx,
struct nrf_wifi_umac_config_dms_info *dms_info)
{

enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
struct nrf_wifi_umac_cmd_req_remove_dms *req_remove_dms_cmd = NULL;
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL;

if (!dev_ctx || !dms_info) {
goto out;
}

fmac_dev_ctx = dev_ctx;

req_remove_dms_cmd = nrf_wifi_osal_mem_zalloc(fmac_dev_ctx->fpriv->opriv,
sizeof(*req_remove_dms_cmd));

if (!req_remove_dms_cmd) {
nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv,
"%s: Unable to allocate memory",
__func__);
goto out;
}

nrf_wifi_osal_mem_cpy(fmac_dev_ctx->fpriv->opriv,
&req_remove_dms_cmd->info,
dms_info,
sizeof(req_remove_dms_cmd->info));

req_remove_dms_cmd->umac_hdr.cmd_evnt = NRF_WIFI_UMAC_CMD_REQ_REMOVE_DMS;
req_remove_dms_cmd->umac_hdr.ids.wdev_id = if_idx;
req_remove_dms_cmd->umac_hdr.ids.valid_fields |= NRF_WIFI_INDEX_IDS_WDEV_ID_VALID;

status = umac_cmd_cfg(fmac_dev_ctx,
req_remove_dms_cmd,
sizeof(*req_remove_dms_cmd));
out:
if (req_remove_dms_cmd) {
nrf_wifi_osal_mem_free(fmac_dev_ctx->fpriv->opriv,
req_remove_dms_cmd);
}

return status;
}

#endif /* CONFIG_NRF700X_STA_MODE */
Loading