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: Edge backoff support using RF params #1234

Merged
merged 2 commits into from
Feb 29, 2024
Merged
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
Binary file modified nrf_wifi/fw_bins/default/nrf70.bin
Binary file not shown.
Binary file modified nrf_wifi/fw_bins/radio_test/nrf70.bin
Binary file not shown.
Binary file modified nrf_wifi/fw_bins/scan_only/nrf70.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion nrf_wifi/fw_if/umac_if/inc/fmac_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ enum nrf_wifi_status umac_cmd_cfg(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
int len);

enum nrf_wifi_status umac_cmd_init(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
#ifndef CONFIG_NRF700X_RADIO_TEST
struct nrf_wifi_phy_rf_params *rf_params,
bool rf_params_valid,
#ifndef CONFIG_NRF700X_RADIO_TEST
struct nrf_wifi_data_config_params *config,
#endif /* !CONFIG_NRF700X_RADIO_TEST */
#ifdef CONFIG_NRF_WIFI_LOW_POWER
Expand Down
78 changes: 53 additions & 25 deletions nrf_wifi/fw_if/umac_if/inc/fw/host_rpu_sys_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -741,11 +741,11 @@ struct nrf_wifi_sys_params {
#ifndef CONFIG_NRF700X_RADIO_TEST
/** MAC address of the interface */
unsigned char mac_addr[NRF_WIFI_ETH_ADDR_LEN];
#endif /* !CONFIG_NRF700X_RADIO_TEST */
/** An array containing RF & baseband control params */
unsigned char rf_params[NRF_WIFI_RF_PARAMS_SIZE];
/** Indicates whether the rf_params has a valid value */
unsigned char rf_params_valid;
#endif /* !CONFIG_NRF700X_RADIO_TEST */
} __NRF_WIFI_PKD;


Expand All @@ -763,30 +763,58 @@ struct nrf_wifi_tx_pwr_ctrl_params {
unsigned char ant_gain_5g_band2;
/** Antenna gain for 5 GHz band (5730 MHz - 5895 MHz) */
unsigned char ant_gain_5g_band3;
/** Transmit power backoff (in dB) for lower edge of 2.4 GHz frequency band */
unsigned char band_edge_2g_lo;
/** Transmit power backoff (in dB) for upper edge of 2.4 GHz frequency band */
unsigned char band_edge_2g_hi;
/** Transmit power backoff (in dB) for lower edge of UNII-1 frequency band */
unsigned char band_edge_5g_unii_1_lo;
/** Transmit power backoff (in dB) for upper edge of UNII-1 frequency band */
unsigned char band_edge_5g_unii_1_hi;
/** Transmit power backoff (in dB) for lower edge of UNII-2A frequency band */
unsigned char band_edge_5g_unii_2a_lo;
/** Transmit power backoff (in dB) for upper edge of UNII-2A frequency band */
unsigned char band_edge_5g_unii_2a_hi;
/** Transmit power backoff (in dB) for lower edge of UNII-2C frequency band */
unsigned char band_edge_5g_unii_2c_lo;
/** Transmit power backoff (in dB) for upper edge of UNII-2C frequency band */
unsigned char band_edge_5g_unii_2c_hi;
/** Transmit power backoff (in dB) for lower edge of UNII-3 frequency band */
unsigned char band_edge_5g_unii_3_lo;
/** Transmit power backoff (in dB) for upper edge of UNII-3 frequency band */
unsigned char band_edge_5g_unii_3_hi;
/** Transmit power backoff (in dB) for lower edge of UNII-4 frequency band */
unsigned char band_edge_5g_unii_4_lo;
/** Transmit power backoff (in dB) for upper edge of UNII-4 frequency band */
unsigned char band_edge_5g_unii_4_hi;
/** DSSS Transmit power backoff (in dB) for lower edge of 2.4 GHz frequency band */
unsigned char band_edge_2g_lo_dss;
/** HT/VHT Transmit power backoff (in dB) for lower edge of 2.4 GHz frequency band */
unsigned char band_edge_2g_lo_ht;
/** HE Transmit power backoff (in dB) for lower edge of 2.4 GHz frequency band */
unsigned char band_edge_2g_lo_he;
/** DSSS Transmit power backoff (in dB) for upper edge of 2.4 GHz frequency band */
unsigned char band_edge_2g_hi_dsss;
/** HT/VHT Transmit power backoff (in dB) for upper edge of 2.4 GHz frequency band */
unsigned char band_edge_2g_hi_ht;
/** HE Transmit power backoff (in dB) for upper edge of 2.4 GHz frequency band */
unsigned char band_edge_2g_hi_he;
/** HT Transmit power backoff (in dB) for lower edge of UNII-1 frequency band */
unsigned char band_edge_5g_unii_1_lo_ht;
/** HE Transmit power backoff (in dB) for lower edge of UNII-1 frequency band */
unsigned char band_edge_5g_unii_1_lo_he;
/** HT/VHT Transmit power backoff (in dB) for upper edge of UNII-1 frequency band */
unsigned char band_edge_5g_unii_1_hi_ht;
/** HE Transmit power backoff (in dB) for upper edge of UNII-1 frequency band */
unsigned char band_edge_5g_unii_1_hi_he;
/** HT/VHT Transmit power backoff (in dB) for lower edge of UNII-2A frequency band */
unsigned char band_edge_5g_unii_2a_lo_ht;
/** HE Transmit power backoff (in dB) for lower edge of UNII-2A frequency band */
unsigned char band_edge_5g_unii_2a_lo_he;
/** HT/VHT Transmit power backoff (in dB) for upper edge of UNII-2A frequency band */
unsigned char band_edge_5g_unii_2a_hi_ht;
/** HE Transmit power backoff (in dB) for upper edge of UNII-2A frequency band */
unsigned char band_edge_5g_unii_2a_hi_he;
/** HT/VHT Transmit power backoff (in dB) for lower edge of UNII-2C frequency band */
unsigned char band_edge_5g_unii_2c_lo_ht;
/** HE Transmit power backoff (in dB) for lower edge of UNII-2C frequency band */
unsigned char band_edge_5g_unii_2c_lo_he;
/** HT/VHT Transmit power backoff (in dB) for upper edge of UNII-2C frequency band */
unsigned char band_edge_5g_unii_2c_hi_ht;
/** HE Transmit power backoff (in dB) for upper edge of UNII-2C frequency band */
unsigned char band_edge_5g_unii_2c_hi_he;
/** HT/VHT Transmit power backoff (in dB) for lower edge of UNII-3 frequency band */
unsigned char band_edge_5g_unii_3_lo_ht;
/** HE Transmit power backoff (in dB) for lower edge of UNII-3 frequency band */
unsigned char band_edge_5g_unii_3_lo_he;
/** HT/VHT Transmit power backoff (in dB) for upper edge of UNII-3 frequency band */
unsigned char band_edge_5g_unii_3_hi_ht;
/** HE Transmit power backoff (in dB) for upper edge of UNII-3 frequency band */
unsigned char band_edge_5g_unii_3_hi_he;
/** HT/VHT Transmit power backoff (in dB) for lower edge of UNII-4 frequency band */
unsigned char band_edge_5g_unii_4_lo_ht;
/** HE Transmit power backoff (in dB) for lower edge of UNII-4 frequency band */
unsigned char band_edge_5g_unii_4_lo_he;
/** HT/VHT Transmit power backoff (in dB) for upper edge of UNII-4 frequency band */
unsigned char band_edge_5g_unii_4_hi_ht;
/** HE Transmit power backoff (in dB) for upper edge of UNII-4 frequency band */
unsigned char band_edge_5g_unii_4_hi_he;
} __NRF_WIFI_PKD;

/**
Expand Down
4 changes: 2 additions & 2 deletions nrf_wifi/fw_if/umac_if/inc/fw/patch_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct nrf70_fw_image_info {

#define RPU_FAMILY (1)
#define RPU_MAJOR_VERSION (2)
#define RPU_MINOR_VERSION (9)
#define RPU_PATCH_VERSION (25)
#define RPU_MINOR_VERSION (10)
#define RPU_PATCH_VERSION (0)
imapa marked this conversation as resolved.
Show resolved Hide resolved

#endif /* _PATCH_INFO_H */
22 changes: 16 additions & 6 deletions nrf_wifi/fw_if/umac_if/src/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ enum nrf_wifi_status umac_cmd_cfg(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,


enum nrf_wifi_status umac_cmd_init(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
#ifndef CONFIG_NRF700X_RADIO_TEST
struct nrf_wifi_phy_rf_params *rf_params,
bool rf_params_valid,
#ifndef CONFIG_NRF700X_RADIO_TEST
struct nrf_wifi_data_config_params *config,
#endif /* !CONFIG_NRF700X_RADIO_TEST */
#ifdef CONFIG_NRF_WIFI_LOW_POWER
Expand Down Expand Up @@ -126,7 +126,7 @@ enum nrf_wifi_status umac_cmd_init(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
umac_cmd_data->sys_head.cmd_event = NRF_WIFI_CMD_INIT;
umac_cmd_data->sys_head.len = len;

#ifndef CONFIG_NRF700X_RADIO_TEST

umac_cmd_data->sys_params.rf_params_valid = rf_params_valid;

if (rf_params_valid) {
Expand All @@ -135,7 +135,7 @@ enum nrf_wifi_status umac_cmd_init(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
rf_params,
NRF_WIFI_RF_PARAMS_SIZE);
}
#endif /* !CONFIG_NRF700X_RADIO_TEST */


umac_cmd_data->sys_params.phy_calib = phy_calib;
umac_cmd_data->sys_params.hw_bringup_time = HW_DELAY;
Expand Down Expand Up @@ -175,15 +175,25 @@ enum nrf_wifi_status umac_cmd_init(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,

umac_cmd_data->op_band = op_band;

nrf_wifi_osal_mem_cpy(fmac_dev_ctx->fpriv->opriv,
&umac_cmd_data->sys_params.rf_params[ANT_GAIN_2G_OFST],
&tx_pwr_ctrl_params->ant_gain_2g,
NUM_ANT_GAIN);

nrf_wifi_osal_mem_cpy(fmac_dev_ctx->fpriv->opriv,
&umac_cmd_data->sys_params.rf_params[BAND_2G_LW_ED_BKF_DSSS_OFST],
&tx_pwr_ctrl_params->band_edge_2g_lo_dss,
NUM_EDGE_BACKOFF);

nrf_wifi_osal_mem_cpy(fmac_dev_ctx->fpriv->opriv,
&umac_cmd_data->tx_pwr_ctrl_params,
tx_pwr_ctrl_params,
sizeof(umac_cmd_data->tx_pwr_ctrl_params));

nrf_wifi_osal_mem_cpy(fmac_dev_ctx->fpriv->opriv,
umac_cmd_data->country_code,
CONFIG_NRF700X_REG_DOMAIN,
NRF_WIFI_COUNTRY_CODE_LEN);
umac_cmd_data->country_code,
CONFIG_NRF700X_REG_DOMAIN,
NRF_WIFI_COUNTRY_CODE_LEN);

#ifdef CONFIG_NRF700X_RPU_EXTEND_TWT_SP
umac_cmd_data->feature_flags |= TWT_EXTEND_SP_EDCA;
Expand Down
33 changes: 33 additions & 0 deletions nrf_wifi/fw_if/umac_if/src/fmac_api_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ int nrf_wifi_phy_rf_params_init(struct nrf_wifi_osal_priv *opriv,
unsigned char *str)
{
int ret = -1;
unsigned int rf_param_offset = BAND_2G_LW_ED_BKF_DSSS_OFST - NRF_WIFI_RF_PARAMS_CONF_SIZE;
/* Initilaize reserved bytes */
nrf_wifi_osal_mem_set(opriv,
&prf->reserved,
Expand Down Expand Up @@ -1046,6 +1047,38 @@ int nrf_wifi_phy_rf_params_init(struct nrf_wifi_osal_priv *opriv,
(unsigned char *)&prf->phy_params,
sizeof(prf->phy_params),
str);

prf->phy_params[rf_param_offset] = CONFIG_NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_DSSS;
prf->phy_params[rf_param_offset + 1] = CONFIG_NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 2] = CONFIG_NRF700X_BAND_2G_LOWER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 3] = CONFIG_NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_DSSS;
prf->phy_params[rf_param_offset + 4] = CONFIG_NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 5] = CONFIG_NRF700X_BAND_2G_UPPER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 6] = CONFIG_NRF700X_BAND_UNII_1_LOWER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 7] = CONFIG_NRF700X_BAND_UNII_1_LOWER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 8] = CONFIG_NRF700X_BAND_UNII_1_UPPER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 9] = CONFIG_NRF700X_BAND_UNII_1_UPPER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 10] = CONFIG_NRF700X_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 11] = CONFIG_NRF700X_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 12] = CONFIG_NRF700X_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 13] = CONFIG_NRF700X_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 14] = CONFIG_NRF700X_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 15] = CONFIG_NRF700X_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 16] = CONFIG_NRF700X_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 17] = CONFIG_NRF700X_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 18] = CONFIG_NRF700X_BAND_UNII_3_LOWER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 19] = CONFIG_NRF700X_BAND_UNII_3_LOWER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 20] = CONFIG_NRF700X_BAND_UNII_3_UPPER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 21] = CONFIG_NRF700X_BAND_UNII_3_UPPER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 22] = CONFIG_NRF700X_BAND_UNII_4_LOWER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 23] = CONFIG_NRF700X_BAND_UNII_4_LOWER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 24] = CONFIG_NRF700X_BAND_UNII_4_UPPER_EDGE_BACKOFF_HT;
prf->phy_params[rf_param_offset + 25] = CONFIG_NRF700X_BAND_UNII_4_UPPER_EDGE_BACKOFF_HE;
prf->phy_params[rf_param_offset + 26] = CONFIG_NRF700X_ANT_GAIN_2G;
prf->phy_params[rf_param_offset + 27] = CONFIG_NRF700X_ANT_GAIN_5G_BAND1;
prf->phy_params[rf_param_offset + 28] = CONFIG_NRF700X_ANT_GAIN_5G_BAND2;
prf->phy_params[rf_param_offset + 29] = CONFIG_NRF700X_ANT_GAIN_5G_BAND3;

return(ret);
}

Expand Down
51 changes: 45 additions & 6 deletions nrf_wifi/fw_if/umac_if/src/radio_test/fmac_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@


static enum nrf_wifi_status nrf_wifi_fmac_fw_init_rt(struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx,
struct nrf_wifi_phy_rf_params *rf_params,
bool rf_params_valid,
#ifdef CONFIG_NRF_WIFI_LOW_POWER
int sleep_type,
int sleep_type,
#endif /* CONFIG_NRF_WIFI_LOW_POWER */
unsigned int phy_calib,
enum op_band op_band,
bool beamforming,
struct nrf_wifi_tx_pwr_ctrl_params *tx_pwr_ctrl)
unsigned int phy_calib,
enum op_band op_band,
bool beamforming,
struct nrf_wifi_tx_pwr_ctrl_params *tx_pwr_ctrl)
{
unsigned long start_time_us = 0;
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
Expand All @@ -48,6 +50,8 @@ static enum nrf_wifi_status nrf_wifi_fmac_fw_init_rt(struct nrf_wifi_fmac_dev_ct
}

status = umac_cmd_init(fmac_dev_ctx,
rf_params,
rf_params_valid,
#ifdef CONFIG_NRF_WIFI_LOW_POWER
sleep_type,
#endif /* CONFIG_NRF_WIFI_LOW_POWER */
Expand Down Expand Up @@ -107,9 +111,11 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_init_rt(struct nrf_wifi_fmac_dev_ctx *fma
enum op_band op_band,
bool beamforming,
struct nrf_wifi_tx_pwr_ctrl_params *tx_pwr_ctrl_params,
struct nrf_wifi_tx_pwr_ceil_params *tx_pwr_ceil_params)
struct nrf_wifi_tx_pwr_ceil_params *tx_pwr_ceil_params)
{
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
struct nrf_wifi_fmac_otp_info otp_info;
struct nrf_wifi_phy_rf_params phy_rf_params;

if (!fmac_dev_ctx) {
nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv,
Expand All @@ -134,7 +140,40 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_init_rt(struct nrf_wifi_fmac_dev_ctx *fma
tx_pwr_ceil_params,
sizeof(*tx_pwr_ceil_params));

nrf_wifi_osal_mem_set(fmac_dev_ctx->fpriv->opriv,
&otp_info,
0xFF,
sizeof(otp_info));

status = nrf_wifi_hal_otp_info_get(fmac_dev_ctx->hal_dev_ctx,
&otp_info.info,
&otp_info.flags);

if (status != NRF_WIFI_STATUS_SUCCESS) {
nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv,
"%s: Fetching of RPU OTP information failed",
__func__);
goto out;
}

nrf_wifi_osal_mem_set(fmac_dev_ctx->fpriv->opriv,
&phy_rf_params,
0xFF,
sizeof(phy_rf_params));

status = nrf_wifi_fmac_rf_params_get(fmac_dev_ctx,
&phy_rf_params);

if (status != NRF_WIFI_STATUS_SUCCESS) {
nrf_wifi_osal_log_err(fmac_dev_ctx->fpriv->opriv,
"%s: RF parameters get failed",
__func__);
goto out;
}

status = nrf_wifi_fmac_fw_init_rt(fmac_dev_ctx,
&phy_rf_params,
true,
#ifdef CONFIG_NRF_WIFI_LOW_POWER
sleep_type,
#endif /* CONFIG_NRF_WIFI_LOW_POWER */
Expand Down
45 changes: 45 additions & 0 deletions nrf_wifi/hw_if/hal/inc/fw/phy_rf_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,51 @@ enum MAX_POWER_OFFSETS {
NRF_WIFI_MAX_OP_PWR_5GHZ_HI_MCS0
};

/** The byte offsets of RF parameters indicate the start offset
* of antenna gain for 2.4 GHz and 5 GHz bands.
*/
enum ANT_GAIN_OFFSETS {
ANT_GAIN_2G_OFST = 181,
ANT_GAIN_5G_BAND1_OFST,
ANT_GAIN_5G_BAND2_OFST,
ANT_GAIN_5G_BAND3_OFST,
NUM_ANT_GAIN = 4
};

/** The byte offsets of RF parameters indicate the start offset
* of band edge backoffs for different frame formats and
* different sub-bands of 2.4 GHz and 5 GHz frequency band.
*/
enum EDGE_BACKOFF_OFFSETS {
BAND_2G_LW_ED_BKF_DSSS_OFST = 155,
BAND_2G_LW_ED_BKF_HT_OFST,
BAND_2G_LW_ED_BKF_HE_OFST,
BAND_2G_UW_ED_BKF_DSSS_OFST,
BAND_2G_UW_ED_BKF_HT_OFST,
BAND_2G_UW_ED_BKF_HE_OFST,
BAND_UNII_1_LW_ED_BKF_HT_OFST,
BAND_UNII_1_LW_ED_BKF_HE_OFST,
BAND_UNII_1_UW_ED_BKF_HT_OFST,
BAND_UNII_1_UW_ED_BKF_HE_OFST,
BAND_UNII_2A_LW_ED_BKF_HT_OFST,
BAND_UNII_2A_LW_ED_BKF_HE_OFST,
BAND_UNII_2A_UW_ED_BKF_HT_OFST,
BAND_UNII_2A_UW_ED_BKF_HE_OFST,
BAND_UNII_2C_LW_ED_BKF_HT_OFST,
BAND_UNII_2C_LW_ED_BKF_HE_OFST,
BAND_UNII_2C_UW_ED_BKF_HT_OFST,
BAND_UNII_2C_UW_ED_BKF_HE_OFST,
BAND_UNII_3_LW_ED_BKF_HT_OFST,
BAND_UNII_3_LW_ED_BKF_HE_OFST,
BAND_UNII_3_UW_ED_BKF_HT_OFST,
BAND_UNII_3_UW_ED_BKF_HE_OFST,
BAND_UNII_4_LW_ED_BKF_HT_OFST,
BAND_UNII_4_LW_ED_BKF_HE_OFST,
BAND_UNII_4_UW_ED_BKF_HT_OFST,
BAND_UNII_4_UW_ED_BKF_HE_OFST,
NUM_EDGE_BACKOFF = 26
};

#ifdef CONFIG_NRF700X_RADIO_TEST
enum nrf_wifi_rf_test {
NRF_WIFI_RF_TEST_RX_ADC_CAP,
Expand Down
Loading