Skip to content

Commit

Permalink
drivers: nrfwifi: Get RTS threshold
Browse files Browse the repository at this point in the history
Add api support to get RTS threshold.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
  • Loading branch information
kapbh committed Aug 30, 2024
1 parent 887d09a commit f0fbc69
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/wifi/nrfwifi/inc/fmac_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct nrf_wifi_vif_ctx_zep {
#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY
struct k_work nrf_wifi_rpu_recovery_work;
#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */
unsigned int rts_threshold_value;
};

struct nrf_wifi_vif_ctx_map {
Expand Down
3 changes: 3 additions & 0 deletions drivers/wifi/nrfwifi/inc/wifi_mgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ int nrf_wifi_filter(const struct device *dev,

int nrf_wifi_set_rts_threshold(const struct device *dev,
unsigned int rts_threshold);

int nrf_wifi_get_rts_threshold(const struct device *dev,
unsigned int *rts_threshold);
#endif /* __ZEPHYR_WIFI_MGMT_H__ */

Check notice on line 78 in drivers/wifi/nrfwifi/inc/wifi_mgmt.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrfwifi/inc/wifi_mgmt.h:78 -int nrf_wifi_get_rts_threshold(const struct device *dev, - unsigned int *rts_threshold); +int nrf_wifi_get_rts_threshold(const struct device *dev, unsigned int *rts_threshold);
1 change: 1 addition & 0 deletions drivers/wifi/nrfwifi/src/fmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,7 @@ static struct wifi_mgmt_ops nrf_wifi_mgmt_ops = {
.reg_domain = nrf_wifi_reg_domain,
.get_power_save_config = nrf_wifi_get_power_save_config,
.set_rts_threshold = nrf_wifi_set_rts_threshold,
.get_rts_threshold = nrf_wifi_get_rts_threshold,
#endif /* CONFIG_NRF70_STA_MODE */
#ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES
.mode = nrf_wifi_mode,
Expand Down
25 changes: 25 additions & 0 deletions drivers/wifi/nrfwifi/src/wifi_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1007,9 +1007,34 @@ int nrf_wifi_set_rts_threshold(const struct device *dev,
goto out;
}

vif_ctx_zep->rts_threshold_value = (int)rts_threshold;

ret = 0;
out:
k_mutex_unlock(&vif_ctx_zep->vif_lock);

return ret;
}

int nrf_wifi_get_rts_threshold(const struct device *dev,
unsigned int *rts_threshold)
{

Check notice on line 1021 in drivers/wifi/nrfwifi/src/wifi_mgmt.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/nrfwifi/src/wifi_mgmt.c:1021 -int nrf_wifi_get_rts_threshold(const struct device *dev, - unsigned int *rts_threshold) +int nrf_wifi_get_rts_threshold(const struct device *dev, unsigned int *rts_threshold)
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL;
int ret = -1;

if (!dev) {
LOG_ERR("%s: dev is NULL", __func__);
return ret;
}

vif_ctx_zep = dev->data;
if (!vif_ctx_zep) {
LOG_ERR("%s: vif_ctx_zep is NULL", __func__);
return ret;
}

*rts_threshold = (int)vif_ctx_zep->rts_threshold_value;
ret = 0;

return ret;
}

0 comments on commit f0fbc69

Please sign in to comment.