return -ENOMEM;
}
memcpy(freq_list, nla_data(attr), nla_len(attr));
- freq_list_len = nla_len(attr);
+ freq_list_len = nla_len(attr) / sizeof(u32);
+ SLSI_INFO(sdev, "ACS freq_list_len: %d\n", freq_list_len);
break;
}
default:
- SLSI_ERR(sdev, "Invalid type : %d\n", type);
+ if (type > SLSI_ACS_ATTR_MAX)
+ SLSI_ERR(sdev, "Invalid type : %d\n", type);
break;
}
}
struct slsi_acs_selected_channels *acs_selected_channels,
struct slsi_acs_chan_info *ch_info)
{
- int i = 0, j = 0, adjacent_rssi, avg_load, total_num_ap, total_rssi;
+ int i = 0, j = 0, avg_load, total_num_ap, total_rssi, adjacent_rssi;
bool all_bss_load = true, none_bss_load = true;
int min_avg_chan_utilization = INT_MAX, min_adjacent_rssi = INT_MAX;
int ch_idx_min_load = 0, ch_idx_min_rssi = 0;
return ret;
}
+int slsi_acs_get_rssi_factor(struct slsi_dev *sdev, int rssi, int ch_util)
+{
+ int frac_pow_val[10] = {10, 12, 15, 19, 25, 31, 39, 50, 63, 79};
+ int res = 1;
+ int i;
+
+ if (rssi < 0)
+ rssi = 0 - rssi;
+ else
+ return INT_MAX;
+ for (i = 0; i < rssi / 10; i++)
+ res *= 10;
+ res = (10000000 * ch_util / res) / frac_pow_val[rssi % 10];
+
+ SLSI_DBG3(sdev, SLSI_MLME, "ch_util:%d\n", ch_util);
+ return res;
+}
+
struct slsi_acs_chan_info *slsi_acs_scan_results(struct slsi_dev *sdev, struct netdev_vif *ndev_vif, u16 scan_id)
{
struct sk_buff *scan_res;
ch_info[idx].total_chan_utilization += ch_util;
}
}
- if (idx == scan_channel->hw_value - 1) /*if 2.4GHZ channel */
- ch_info[idx].rssi_factor += 10 ^ (fapi_get_s16(scan_res,
- u.mlme_scan_ind.rssi) / 10) * ch_util;
+ if (idx == scan_channel->hw_value - 1) { /*if 2.4GHZ channel */
+ int res = 0;
+
+ res = slsi_acs_get_rssi_factor(sdev, fapi_get_s16(scan_res, u.mlme_scan_ind.rssi),
+ ch_util);
+ ch_info[idx].rssi_factor += res;
+ SLSI_DBG3(sdev, SLSI_MLME, "ch_info[idx].rssi_factor:%d\n", ch_info[idx].rssi_factor);
+ }
} else {
goto next_scan;
}