Skip to content

Commit

Permalink
nrf_wifi: Support for DMS
Browse files Browse the repository at this point in the history
Directed multicast service(DMS) support.

Signed-off-by: Ajay Parida <[email protected]>
  • Loading branch information
ajayparida committed Jun 8, 2024
1 parent 269f560 commit ef0f5eb
Show file tree
Hide file tree
Showing 5 changed files with 280 additions and 1 deletion.
48 changes: 48 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 @@ -1052,6 +1052,54 @@ enum nrf_wifi_status nrf_wifi_check_mode_validity(unsigned char mode);
enum nrf_wifi_status nrf_wifi_fmac_set_quiet_period(void *fmac_dev_ctx,
unsigned char if_idx,
unsigned int quiet_period);

/**
* @brief DMS add 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);

/**
* @brief DMS change 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:
* - change an existing DMS session parameter.
*
*@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_change_dms(void *fmac_dev_ctx,
unsigned char if_idx,
struct nrf_wifi_umac_config_dms_info *dms_info);
/**
* @}
*/
Expand Down
5 changes: 5 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,11 @@ 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 event is received. */
void (*dms_callbk_fn)(void *if_priv,
struct nrf_wifi_umac_dms_op *dms_event_info,
unsigned int event_len);
};

#if defined(CONFIG_NRF700X_STA_MODE) || defined(__DOXYGEN__)
Expand Down
79 changes: 78 additions & 1 deletion 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 @@ -146,6 +146,12 @@ enum nrf_wifi_umac_commands {
NRF_WIFI_UMAC_CMD_CONFIG_EXTENDED_PS,
/** Configure quiet period @ref nrf_wifi_umac_cmd_config_quiet_period */
NRF_WIFI_UMAC_CMD_CONFIG_QUIET_PERIOD,
/** 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 @@ -242,7 +248,9 @@ 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_dms_op */
NRF_WIFI_UMAC_EVENT_DMS,
};

/**
Expand Down Expand Up @@ -3512,4 +3520,73 @@ struct nrf_wifi_umac_cmd_config_quiet_period {
unsigned int quiet_period_in_sec;
} __NRF_WIFI_PKD;

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

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

/**
* @brief The RPU can send the following DMS events to host.
*
*/
enum nrf_wifi_dms_event_type {
NRF_WIFI_DMS_EVENT_ACCEPT,
NRF_WIFI_DMS_EVENT_REJECT,
NRF_WIFI_DMS_EVENT_TERMINATE,
NRF_WIFI_DMS_EVENT_INVALID
};

/**
* @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;
/** Event type received */
enum nrf_wifi_dms_event_type event_type;
/** 0->not received 1->received */
unsigned char dms_resp_status;
} __NRF_WIFI_PKD;

/**
* @brief This structure defines the parameters required for DMS operation.
*
*/

struct nrf_wifi_umac_dms_op {
/** 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;

#endif /* __HOST_RPU_UMAC_IF_H */
138 changes: 138 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 @@ -3160,4 +3160,142 @@ enum nrf_wifi_status nrf_wifi_fmac_set_quiet_period(void *dev_ctx,

return status;
}


enum nrf_wifi_status nrf_wifi_fmac_req_add_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_dms_op *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_fmac_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_dms_op *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;
}


enum nrf_wifi_status nrf_wifi_fmac_req_change_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_dms_op *req_change_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_change_dms_cmd = nrf_wifi_osal_mem_zalloc(fmac_dev_ctx->fpriv->opriv,
sizeof(*req_change_dms_cmd));

if (!req_change_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_change_dms_cmd->info,
dms_info,
sizeof(req_change_dms_cmd->info));

req_change_dms_cmd->umac_hdr.cmd_evnt = NRF_WIFI_UMAC_CMD_REQ_CHANGE_DMS;
req_change_dms_cmd->umac_hdr.ids.wdev_id = if_idx;
req_change_dms_cmd->umac_hdr.ids.valid_fields |= NRF_WIFI_INDEX_IDS_WDEV_ID_VALID;

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

return status;
}
#endif /* CONFIG_NRF700X_STA_MODE */
11 changes: 11 additions & 0 deletions nrf_wifi/fw_if/umac_if/src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,17 @@ static enum nrf_wifi_status umac_event_ctrl_process(struct nrf_wifi_fmac_dev_ctx
__func__,
umac_hdr->cmd_evnt);
break;
case NRF_WIFI_UMAC_EVENT_DMS:
if (callbk_fns->dms_callbk_fn)
callbk_fns->dms_callbk_fn(vif_ctx->os_vif_ctx,
event_data,
event_len);
else
nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv,
"%s: No callback registered for event %d",
__func__,
umac_hdr->cmd_evnt);
break;
#endif /* CONFIG_NRF700X_STA_MODE */
default:
nrf_wifi_osal_log_dbg(fmac_dev_ctx->fpriv->opriv,
Expand Down

0 comments on commit ef0f5eb

Please sign in to comment.