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 14, 2024
1 parent 604e634 commit 2f63bcf
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 2 deletions.
16 changes: 16 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,22 @@ 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 request 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 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_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_cmd_config_dms *dms_event_info,
unsigned int event_len);
};

#if defined(CONFIG_NRF700X_STA_MODE) || defined(__DOXYGEN__)
Expand Down
88 changes: 87 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,8 @@ 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_config_dms */
NRF_WIFI_UMAC_CMD_REQ_CONFIG_DMS,
};

/**
Expand Down Expand Up @@ -242,7 +244,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_cmd_config_dms */
NRF_WIFI_UMAC_EVENT_DMS,
};

/**
Expand Down Expand Up @@ -3527,4 +3531,86 @@ 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 The Host can send the following DMS request type events to rpu.
*
*/
enum nrf_wifi_dms_req_type {
NRF_WIFI_DMS_REQ_ADD,
NRF_WIFI_DMS_REQ_REMOVE,
NRF_WIFI_DMS_REQ_CHANGE,
NRF_WIFI_DMS_REQ_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;
/** request type (0- ADD, 1-Remove, 2- Change) */
unsigned char req_type;
/** 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;
} __NRF_WIFI_PKD;

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

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

#endif /* __HOST_RPU_UMAC_IF_H */
2 changes: 1 addition & 1 deletion nrf_wifi/fw_if/umac_if/inc/fw/patch_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ struct nrf70_fw_image_info {
#define RPU_FAMILY (1)
#define RPU_MAJOR_VERSION (2)
#define RPU_MINOR_VERSION (10)
#define RPU_PATCH_VERSION (0)
#define RPU_PATCH_VERSION (5)

#endif /* _PATCH_INFO_H */
46 changes: 46 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 @@ -3165,4 +3165,50 @@ enum nrf_wifi_status nrf_wifi_fmac_set_quiet_period(void *dev_ctx,

return status;
}


enum nrf_wifi_status nrf_wifi_fmac_req_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_config_dms *req_dms = 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 = nrf_wifi_osal_mem_zalloc(fmac_dev_ctx->fpriv->opriv,
sizeof(*req_dms));

if (!req_dms) {
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->info,
dms_info,
sizeof(req_dms->info));

req_dms->umac_hdr.cmd_evnt = NRF_WIFI_UMAC_CMD_REQ_CONFIG_DMS;
req_dms->umac_hdr.ids.wdev_id = if_idx;
req_dms->umac_hdr.ids.valid_fields |= NRF_WIFI_INDEX_IDS_WDEV_ID_VALID;

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

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 2f63bcf

Please sign in to comment.