|
@@ -3740,6 +3740,10 @@ wlan_hdd_cfg80211_get_features(struct wiphy *wiphy,
|
|
|
QCA_ATTR_ROAM_CONTROL_SCAN_FREQ_LIST
|
|
|
#define PARAM_SCAN_FREQ_LIST_TYPE \
|
|
|
QCA_ATTR_ROAM_CONTROL_SCAN_FREQ_LIST_TYPE
|
|
|
+#define PARAM_CAND_SEL_CRITERIA_MAX \
|
|
|
+ QCA_ATTR_ROAM_CAND_SEL_CRITERIA_RATE_MAX
|
|
|
+#define PARAM_CAND_SEL_SCORE_RSSI \
|
|
|
+ QCA_ATTR_ROAM_CAND_SEL_CRITERIA_SCORE_RSSI
|
|
|
|
|
|
|
|
|
static const struct nla_policy
|
|
@@ -4114,6 +4118,7 @@ roam_control_policy[QCA_ATTR_ROAM_CONTROL_MAX + 1] = {
|
|
|
[PARAM_FREQ_LIST_SCHEME] = {.type = NLA_NESTED},
|
|
|
[QCA_ATTR_ROAM_CONTROL_FULL_SCAN_PERIOD] = {.type = NLA_U32},
|
|
|
[QCA_ATTR_ROAM_CONTROL_TRIGGERS] = {.type = NLA_U32},
|
|
|
+ [QCA_ATTR_ROAM_CONTROL_SELECTION_CRITERIA] = {.type = NLA_NESTED},
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -4177,6 +4182,107 @@ hdd_send_roam_triggers_to_sme(struct hdd_context *hdd_ctx,
|
|
|
return status;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * Disable default scoring algorithm. This is intended to set all bits of the
|
|
|
+ * disable_bitmap in struct scoring_param.
|
|
|
+ */
|
|
|
+#define DISABLE_SCORING 0
|
|
|
+
|
|
|
+/*
|
|
|
+ * Enable scoring algorithm. This is intended to clear all bits of the
|
|
|
+ * disable_bitmap in struct scoring_param.
|
|
|
+ */
|
|
|
+#define ENABLE_SCORING 1
|
|
|
+
|
|
|
+/*
|
|
|
+ * Controlled roam candidate selection is enabled from userspace.
|
|
|
+ * Driver/firmware should honor the selection criteria
|
|
|
+ */
|
|
|
+#define CONTROL_ROAM_CAND_SEL_ENABLE 1
|
|
|
+
|
|
|
+/*
|
|
|
+ * Controlled roam candidate selection is disabled from userspace.
|
|
|
+ * Driver/firmware can use its internal candidate selection criteria
|
|
|
+ */
|
|
|
+#define CONTROL_ROAM_CAND_SEL_DISABLE 0
|
|
|
+
|
|
|
+static const struct nla_policy
|
|
|
+roam_scan_cand_sel_policy[PARAM_CAND_SEL_CRITERIA_MAX + 1] = {
|
|
|
+ [PARAM_CAND_SEL_SCORE_RSSI] = {.type = NLA_U8},
|
|
|
+};
|
|
|
+
|
|
|
+/**
|
|
|
+ * hdd_send_roam_cand_sel_criteria_to_sme() - Send candidate sel criteria to SME
|
|
|
+ * @hdd_ctx: HDD context
|
|
|
+ * @vdev_id: vdev id
|
|
|
+ * @attr: Nested attribute carrying candidate selection criteria
|
|
|
+ *
|
|
|
+ * Extract different candidate sel criteria mentioned and convert it to
|
|
|
+ * driver/firmware understable format.
|
|
|
+ *
|
|
|
+ * Return: QDF_STATUS
|
|
|
+ */
|
|
|
+static QDF_STATUS
|
|
|
+hdd_send_roam_cand_sel_criteria_to_sme(struct hdd_context *hdd_ctx,
|
|
|
+ uint8_t vdev_id,
|
|
|
+ struct nlattr *attr)
|
|
|
+{
|
|
|
+ QDF_STATUS status;
|
|
|
+ struct nlattr *tb2[PARAM_CAND_SEL_CRITERIA_MAX + 1];
|
|
|
+ struct nlattr *curr_attr;
|
|
|
+ uint8_t sel_criteria = 0, rssi_score = 0, scoring;
|
|
|
+ int rem;
|
|
|
+
|
|
|
+ hdd_debug("Received Command to Set candidate selection criteria ");
|
|
|
+ nla_for_each_nested(curr_attr, attr, rem) {
|
|
|
+ sel_criteria++;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sel_criteria &&
|
|
|
+ wlan_cfg80211_nla_parse_nested(tb2, PARAM_CAND_SEL_CRITERIA_MAX,
|
|
|
+ attr, roam_scan_cand_sel_policy)) {
|
|
|
+ hdd_err("nla_parse failed");
|
|
|
+ return QDF_STATUS_E_INVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Firmware supports the below configurations currently,
|
|
|
+ * 1. Default selection criteria where all scoring params
|
|
|
+ * are enabled and different weightages/scores are given to
|
|
|
+ * different parameters.
|
|
|
+ * When userspace doesn't specify any candidate selection criteria,
|
|
|
+ * this will be enabled.
|
|
|
+ * 2. Legacy candidate selection criteria where scoring
|
|
|
+ * algorithm is disabled and only RSSI is considered for
|
|
|
+ * roam candidate selection.
|
|
|
+ * When userspace specify 100% weightage for RSSI, this will
|
|
|
+ * be enabled.
|
|
|
+ * Rest of the combinations are not supported for now.
|
|
|
+ */
|
|
|
+ if (sel_criteria == CONTROL_ROAM_CAND_SEL_ENABLE) {
|
|
|
+ /* Legacy selection criteria: 100% weightage to RSSI */
|
|
|
+ if (tb2[PARAM_CAND_SEL_SCORE_RSSI])
|
|
|
+ rssi_score = nla_get_u8(tb2[PARAM_CAND_SEL_SCORE_RSSI]);
|
|
|
+
|
|
|
+ if (rssi_score != 100) {
|
|
|
+ hdd_debug("Ignore the candidate selection criteria");
|
|
|
+ return QDF_STATUS_E_INVAL;
|
|
|
+ }
|
|
|
+ scoring = DISABLE_SCORING;
|
|
|
+ } else {
|
|
|
+ /* Default selection criteria */
|
|
|
+ scoring = ENABLE_SCORING;
|
|
|
+ }
|
|
|
+
|
|
|
+ status = sme_modify_roam_cand_sel_criteria(hdd_ctx->mac_handle, vdev_id,
|
|
|
+ !!scoring);
|
|
|
+ if (QDF_IS_STATUS_ERROR(status))
|
|
|
+ hdd_err("Failed to disable scoring");
|
|
|
+
|
|
|
+ return status;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* hdd_set_roam_with_control_config() - Set roam control configuration
|
|
|
* @hdd_ctx: HDD context
|
|
@@ -4251,6 +4357,16 @@ hdd_set_roam_with_control_config(struct hdd_context *hdd_ctx,
|
|
|
hdd_err("failed to enable/disable roam control config");
|
|
|
}
|
|
|
|
|
|
+ /* Scoring and roam candidate selection criteria */
|
|
|
+ attr = tb2[QCA_ATTR_ROAM_CONTROL_SELECTION_CRITERIA];
|
|
|
+ if (attr) {
|
|
|
+ hdd_debug("Send candidate selection criteria to firmware");
|
|
|
+ status = hdd_send_roam_cand_sel_criteria_to_sme(hdd_ctx,
|
|
|
+ vdev_id, attr);
|
|
|
+ if (QDF_IS_STATUS_ERROR(status))
|
|
|
+ hdd_err("failed to set candidate selection criteria");
|
|
|
+ }
|
|
|
+
|
|
|
return qdf_status_to_os_return(status);
|
|
|
}
|
|
|
|
|
@@ -4259,6 +4375,8 @@ hdd_set_roam_with_control_config(struct hdd_context *hdd_ctx,
|
|
|
#undef PARAM_FREQ_LIST_SCHEME
|
|
|
#undef PARAM_SCAN_FREQ_LIST
|
|
|
#undef PARAM_SCAN_FREQ_LIST_TYPE
|
|
|
+#undef PARAM_CAND_SEL_CRITERIA_MAX
|
|
|
+#undef PARAM_CAND_SEL_SCORE_RSSI
|
|
|
|
|
|
/**
|
|
|
* hdd_set_ext_roam_params() - parse ext roam params
|