|
@@ -71,202 +71,6 @@ enum qca_wlan_vendor_tdls_trigger_mode_hdd_map {
|
|
|
QCA_WLAN_VENDOR_TDLS_TRIGGER_MODE_IMPLICIT) << 1),
|
|
|
};
|
|
|
|
|
|
-/**
|
|
|
- * dump_tdls_state_param_setting() - print tdls state & parameters to send to fw
|
|
|
- * @info: tdls setting to be sent to fw
|
|
|
- *
|
|
|
- * Return: void
|
|
|
- */
|
|
|
-static void dump_tdls_state_param_setting(tdlsInfo_t *info)
|
|
|
-{
|
|
|
- if (!info)
|
|
|
- return;
|
|
|
-
|
|
|
- hdd_debug("Setting tdls state and param in fw: vdev_id: %d, tdls_state: %d, notification_interval_ms: %d, tx_discovery_threshold: %d, tx_teardown_threshold: %d, rssi_teardown_threshold: %d, rssi_delta: %d, tdls_options: 0x%x, peer_traffic_ind_window: %d, peer_traffic_response_timeout: %d, puapsd_mask: 0x%x, puapsd_inactivity_time: %d, puapsd_rx_frame_threshold: %d, teardown_notification_ms: %d, tdls_peer_kickout_threshold: %d",
|
|
|
- info->vdev_id,
|
|
|
- info->tdls_state,
|
|
|
- info->notification_interval_ms,
|
|
|
- info->tx_discovery_threshold,
|
|
|
- info->tx_teardown_threshold,
|
|
|
- info->rssi_teardown_threshold,
|
|
|
- info->rssi_delta,
|
|
|
- info->tdls_options,
|
|
|
- info->peer_traffic_ind_window,
|
|
|
- info->peer_traffic_response_timeout,
|
|
|
- info->puapsd_mask,
|
|
|
- info->puapsd_inactivity_time,
|
|
|
- info->puapsd_rx_frame_threshold,
|
|
|
- info->teardown_notification_ms,
|
|
|
- info->tdls_peer_kickout_threshold);
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * wlan_hdd_tdls_check_config() - validate tdls configuration parameters
|
|
|
- * @config: tdls configuration parameter structure
|
|
|
- *
|
|
|
- * Return: 0 if all parameters are valid; -EINVAL otherwise
|
|
|
- */
|
|
|
-static int wlan_hdd_tdls_check_config(struct hdd_tdls_config_params *config)
|
|
|
-{
|
|
|
- if (config->tdls > 2) {
|
|
|
- hdd_err("Invalid 1st argument %d. <0...2>",
|
|
|
- config->tdls);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- if (config->tx_period_t < CFG_TDLS_TX_STATS_PERIOD_MIN ||
|
|
|
- config->tx_period_t > CFG_TDLS_TX_STATS_PERIOD_MAX) {
|
|
|
- hdd_err("Invalid 2nd argument %d. <%d...%ld>",
|
|
|
- config->tx_period_t, CFG_TDLS_TX_STATS_PERIOD_MIN,
|
|
|
- CFG_TDLS_TX_STATS_PERIOD_MAX);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- if (config->tx_packet_n < CFG_TDLS_TX_PACKET_THRESHOLD_MIN ||
|
|
|
- config->tx_packet_n > CFG_TDLS_TX_PACKET_THRESHOLD_MAX) {
|
|
|
- hdd_err("Invalid 3rd argument %d. <%d...%ld>",
|
|
|
- config->tx_packet_n, CFG_TDLS_TX_PACKET_THRESHOLD_MIN,
|
|
|
- CFG_TDLS_TX_PACKET_THRESHOLD_MAX);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- if (config->discovery_tries_n < CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MIN ||
|
|
|
- config->discovery_tries_n > CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MAX) {
|
|
|
- hdd_err("Invalid 5th argument %d. <%d...%d>",
|
|
|
- config->discovery_tries_n,
|
|
|
- CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MIN,
|
|
|
- CFG_TDLS_MAX_DISCOVERY_ATTEMPT_MAX);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- if (config->idle_packet_n < CFG_TDLS_IDLE_PACKET_THRESHOLD_MIN ||
|
|
|
- config->idle_packet_n > CFG_TDLS_IDLE_PACKET_THRESHOLD_MAX) {
|
|
|
- hdd_err("Invalid 7th argument %d. <%d...%d>",
|
|
|
- config->idle_packet_n,
|
|
|
- CFG_TDLS_IDLE_PACKET_THRESHOLD_MIN,
|
|
|
- CFG_TDLS_IDLE_PACKET_THRESHOLD_MAX);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- if (config->rssi_trigger_threshold < CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MIN
|
|
|
- || config->rssi_trigger_threshold >
|
|
|
- CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MAX) {
|
|
|
- hdd_err("Invalid 9th argument %d. <%d...%d>",
|
|
|
- config->rssi_trigger_threshold,
|
|
|
- CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MIN,
|
|
|
- CFG_TDLS_RSSI_TRIGGER_THRESHOLD_MAX);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- if (config->rssi_teardown_threshold <
|
|
|
- CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MIN
|
|
|
- || config->rssi_teardown_threshold >
|
|
|
- CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MAX) {
|
|
|
- hdd_err("Invalid 10th argument %d. <%d...%d>",
|
|
|
- config->rssi_teardown_threshold,
|
|
|
- CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MIN,
|
|
|
- CFG_TDLS_RSSI_TEARDOWN_THRESHOLD_MAX);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- if (config->rssi_delta < CFG_TDLS_RSSI_DELTA_MIN
|
|
|
- || config->rssi_delta > CFG_TDLS_RSSI_DELTA_MAX) {
|
|
|
- hdd_err("Invalid 11th argument %d. <%d...%d>",
|
|
|
- config->rssi_delta,
|
|
|
- CFG_TDLS_RSSI_DELTA_MIN,
|
|
|
- CFG_TDLS_RSSI_DELTA_MAX);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * wlan_hdd_tdls_set_params() - set TDLS parameters
|
|
|
- * @dev: net device
|
|
|
- * @config: TDLS configuration parameters
|
|
|
- *
|
|
|
- * Return: 0 if success or negative errno otherwise
|
|
|
- */
|
|
|
-int wlan_hdd_tdls_set_params(struct net_device *dev,
|
|
|
- struct hdd_tdls_config_params *config)
|
|
|
-{
|
|
|
- struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
|
|
|
- struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
|
|
- enum tdls_feature_mode req_tdls_mode;
|
|
|
- tdlsInfo_t *tdlsParams;
|
|
|
- QDF_STATUS qdf_ret_status = QDF_STATUS_E_FAILURE;
|
|
|
- struct tdls_set_mode_params set_mode_params;
|
|
|
-
|
|
|
- if (wlan_hdd_tdls_check_config(config) != 0)
|
|
|
- return -EINVAL;
|
|
|
-
|
|
|
- /* config->tdls is mapped to 0->1, 1->2, 2->3 */
|
|
|
- req_tdls_mode = config->tdls + 1;
|
|
|
-
|
|
|
- /* Copy the configuration only when given tdls mode
|
|
|
- * is implicit trigger enable
|
|
|
- */
|
|
|
- if (TDLS_SUPPORT_IMP_MODE == req_tdls_mode ||
|
|
|
- TDLS_SUPPORT_EXT_CONTROL == req_tdls_mode) {
|
|
|
- /* TODO update threshold config to tdls vdev */
|
|
|
- }
|
|
|
-
|
|
|
- hdd_debug("iw set tdls params: %d %d %d %d %d %d %d",
|
|
|
- config->tdls,
|
|
|
- config->tx_period_t,
|
|
|
- config->tx_packet_n,
|
|
|
- config->discovery_tries_n,
|
|
|
- config->idle_packet_n,
|
|
|
- config->rssi_trigger_threshold,
|
|
|
- config->rssi_teardown_threshold);
|
|
|
-
|
|
|
- set_mode_params.source = TDLS_SET_MODE_SOURCE_USER;
|
|
|
- set_mode_params.tdls_mode = req_tdls_mode;
|
|
|
- set_mode_params.update_last = true;
|
|
|
- set_mode_params.vdev = adapter->hdd_vdev;
|
|
|
-
|
|
|
- ucfg_tdls_set_operating_mode(&set_mode_params);
|
|
|
-
|
|
|
- tdlsParams = qdf_mem_malloc(sizeof(tdlsInfo_t));
|
|
|
- if (NULL == tdlsParams) {
|
|
|
- hdd_err("qdf_mem_malloc failed for tdlsParams");
|
|
|
- return -ENOMEM;
|
|
|
- }
|
|
|
-
|
|
|
- tdlsParams->vdev_id = adapter->session_id;
|
|
|
- tdlsParams->tdls_state = config->tdls;
|
|
|
- tdlsParams->notification_interval_ms = config->tx_period_t;
|
|
|
- tdlsParams->tx_discovery_threshold = config->tx_packet_n;
|
|
|
- tdlsParams->tx_teardown_threshold = config->idle_packet_n;
|
|
|
- tdlsParams->rssi_teardown_threshold = config->rssi_teardown_threshold;
|
|
|
- tdlsParams->rssi_delta = config->rssi_delta;
|
|
|
- tdlsParams->tdls_options = 0;
|
|
|
- if (hdd_ctx->config->fEnableTDLSOffChannel)
|
|
|
- tdlsParams->tdls_options |= ENA_TDLS_OFFCHAN;
|
|
|
- if (hdd_ctx->config->fEnableTDLSBufferSta)
|
|
|
- tdlsParams->tdls_options |= ENA_TDLS_BUFFER_STA;
|
|
|
- if (hdd_ctx->config->fEnableTDLSSleepSta)
|
|
|
- tdlsParams->tdls_options |= ENA_TDLS_SLEEP_STA;
|
|
|
- tdlsParams->peer_traffic_ind_window =
|
|
|
- hdd_ctx->config->fTDLSPuapsdPTIWindow;
|
|
|
- tdlsParams->peer_traffic_response_timeout =
|
|
|
- hdd_ctx->config->fTDLSPuapsdPTRTimeout;
|
|
|
- tdlsParams->puapsd_mask = hdd_ctx->config->fTDLSUapsdMask;
|
|
|
- tdlsParams->puapsd_inactivity_time =
|
|
|
- hdd_ctx->config->fTDLSPuapsdInactivityTimer;
|
|
|
- tdlsParams->puapsd_rx_frame_threshold =
|
|
|
- hdd_ctx->config->fTDLSRxFrameThreshold;
|
|
|
- tdlsParams->teardown_notification_ms =
|
|
|
- hdd_ctx->config->tdls_idle_timeout;
|
|
|
- tdlsParams->tdls_peer_kickout_threshold =
|
|
|
- hdd_ctx->config->tdls_peer_kickout_threshold;
|
|
|
-
|
|
|
- dump_tdls_state_param_setting(tdlsParams);
|
|
|
-
|
|
|
- qdf_ret_status = sme_update_fw_tdls_state(hdd_ctx->hHal,
|
|
|
- tdlsParams, true);
|
|
|
- if (QDF_STATUS_SUCCESS != qdf_ret_status) {
|
|
|
- qdf_mem_free(tdlsParams);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* wlan_hdd_tdls_get_all_peers() - dump all TDLS peer info into output string
|
|
|
* @adapter: HDD adapter
|