소스 검색

qcacld-3.0: Send proper control mode value to upper layer

1. Upper layer sends QCA_WLAN_VENDOR_ATTR_LINK_STATE_CONTROL_MODE
vendor command to configure control mode in host/fw.
2. Host receives GET_ML_LINK_STATE driver command to return
control mode (configured at step 1) to upper layer.

Host should reply as a response of GET_ML_LINK_STATE with same
value of control mode configured at step 1 to upper layer.

Change-Id: I6ae82c2a1c0e4ff13cea678bf27916a3cda8ad81
CRs-Fixed: 3595730
Abhinav Kumar 1 년 전
부모
커밋
663120a684

+ 37 - 0
components/mlme/dispatcher/inc/wlan_mlme_api.h

@@ -4105,6 +4105,30 @@ QDF_STATUS wlan_mlme_set_sta_mlo_conn_max_num(struct wlan_objmgr_psoc *psoc,
 QDF_STATUS wlan_mlme_set_user_set_link_num(struct wlan_objmgr_psoc *psoc,
 					   uint8_t value);
 
+/**
+ * wlan_mlme_set_ml_link_control_mode() - set ml_link_control_mode
+ * @psoc: pointer to psoc object
+ * @vdev_id: vdev id
+ * @value: value to set
+ *
+ * API get call when host receives vendor command
+ * QCA_NL80211_VENDOR_SUBCMD_MLO_LINK_STATE to configure link control mode.
+ *
+ * Return: none
+ */
+void wlan_mlme_set_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
+					uint8_t vdev_id, uint8_t value);
+
+/**
+ * wlan_mlme_get_ml_link_control_mode() - get ml_link_control_mode
+ * @psoc: pointer to psoc object
+ * @vdev_id: vdev id
+ *
+ * Return: value of ml_link_control_mode in success
+ */
+uint8_t wlan_mlme_get_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
+					   uint8_t vdev_id);
+
 /**
  * wlan_mlme_restore_user_set_link_num() - restore link num when SSR happens
  * @psoc: pointer to psoc object
@@ -4168,6 +4192,19 @@ QDF_STATUS wlan_mlme_set_sta_mlo_conn_band_bmp(struct wlan_objmgr_psoc *psoc,
  */
 bool wlan_mlme_get_sta_same_link_mld_addr(struct wlan_objmgr_psoc *psoc);
 #else
+static inline
+void wlan_mlme_set_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
+					uint8_t vdev_id, uint8_t value)
+{
+}
+
+static inline
+uint8_t wlan_mlme_get_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
+					   uint8_t vdev_id)
+{
+	return 0;
+}
+
 static inline QDF_STATUS
 wlan_mlme_set_user_set_link_num(struct wlan_objmgr_psoc *psoc,
 				uint8_t value)

+ 24 - 0
components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h

@@ -80,6 +80,30 @@ void ucfg_mlme_psoc_close(struct wlan_objmgr_psoc *psoc);
  */
 QDF_STATUS ucfg_mlme_pdev_open(struct wlan_objmgr_pdev *pdev);
 
+/**
+ * ucfg_mlme_set_ml_link_control_mode() - set ml_link_control_mode
+ * @psoc: pointer to psoc object
+ * @vdev_id: vdev id
+ * @value: value to set
+ *
+ * API get call when host receives vendor command
+ * QCA_NL80211_VENDOR_SUBCMD_MLO_LINK_STATE to configure link control mode.
+ *
+ * Return: none
+ */
+void ucfg_mlme_set_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
+					uint8_t vdev_id, uint8_t value);
+
+/**
+ * ucfg_mlme_get_ml_link_control_mode() - get ml_link_control_mode
+ * @psoc: pointer to psoc object
+ * @vdev_id: vdev id
+ *
+ * Return: value of ml_link_control_mode in success
+ */
+uint8_t ucfg_mlme_get_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
+					   uint8_t vdev_id);
+
 /**
  * ucfg_mlme_pdev_close() - MLME component pdev close
  * @pdev: pointer to pdev object

+ 66 - 0
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -1471,6 +1471,72 @@ QDF_STATUS wlan_mlme_set_user_set_link_num(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+void wlan_mlme_set_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
+					uint8_t vdev_id, uint8_t value)
+{
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+	struct wlan_objmgr_vdev *vdev;
+
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+	if (!mlme_obj)
+		return;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_MLME_SB_ID);
+	if (!vdev)
+		return;
+
+	if (!wlan_vdev_mlme_is_mlo_vdev(vdev)) {
+		mlme_legacy_debug("not mlo vdev");
+		goto release_ref;
+	}
+
+	if (!vdev->mlo_dev_ctx || !vdev->mlo_dev_ctx->sta_ctx) {
+		mlme_legacy_debug("mlo dev/sta ctx is null");
+		goto release_ref;
+	}
+
+	vdev->mlo_dev_ctx->sta_ctx->ml_link_control_mode = value;
+	mlme_legacy_debug("set ml_link_control_mode %d", value);
+
+release_ref:
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_SB_ID);
+	return;
+}
+
+uint8_t wlan_mlme_get_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
+					   uint8_t vdev_id)
+{
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+	struct wlan_objmgr_vdev *vdev;
+	uint8_t value = 0;
+
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+	if (!mlme_obj)
+		return 0;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_MLME_SB_ID);
+	if (!vdev)
+		return 0;
+
+	if (!wlan_vdev_mlme_is_mlo_vdev(vdev)) {
+		mlme_legacy_debug("not mlo vdev");
+		goto release_ref;
+	}
+
+	if (!vdev->mlo_dev_ctx || !vdev->mlo_dev_ctx->sta_ctx) {
+		mlme_legacy_debug("mlo dev/sta ctx is null");
+		goto release_ref;
+	}
+
+	value = vdev->mlo_dev_ctx->sta_ctx->ml_link_control_mode;
+	mlme_legacy_debug("get ml_link_control_mode %d", value);
+release_ref:
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_SB_ID);
+	return value;
+}
+
 void wlan_mlme_restore_user_set_link_num(struct wlan_objmgr_psoc *psoc)
 {
 	struct wlan_mlme_psoc_ext_obj *mlme_obj;

+ 13 - 0
components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c

@@ -128,6 +128,19 @@ QDF_STATUS ucfg_mlme_pdev_close(struct wlan_objmgr_pdev *pdev)
 	return QDF_STATUS_SUCCESS;
 }
 
+void ucfg_mlme_set_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
+					uint8_t vdev_id, uint8_t value)
+{
+	wlan_mlme_set_ml_link_control_mode(psoc, vdev_id, value);
+}
+
+uint8_t ucfg_mlme_get_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
+					   uint8_t vdev_id)
+{
+	return wlan_mlme_get_ml_link_control_mode(psoc, vdev_id);
+}
+
+
 /**
  * ucfg_mlme_convert_power_cfg_chan_to_freq() - converts channel numbers to
  * frequencies and copies the triplets to power_freq_data array

+ 2 - 0
core/hdd/src/wlan_hdd_cm_disconnect.c

@@ -581,6 +581,8 @@ hdd_cm_disconnect_complete_post_user_update(struct wlan_objmgr_vdev *vdev,
 	__hdd_cm_disconnect_handler_post_user_update(link_info, vdev);
 	wlan_twt_concurrency_update(hdd_ctx);
 	hdd_cm_reset_udp_qos_upgrade_config(adapter);
+	ucfg_mlme_set_ml_link_control_mode(hdd_ctx->psoc,
+					   vdev->vdev_objmgr.vdev_id, 0);
 
 	return QDF_STATUS_SUCCESS;
 }

+ 8 - 5
core/hdd/src/wlan_hdd_mlo.c

@@ -704,6 +704,7 @@ hdd_get_ml_link_state_response_len(const struct ml_link_state_info_event *event)
 
 static int
 hdd_ml_generate_link_state_resp_nlmsg(struct sk_buff *skb,
+				      struct wlan_objmgr_psoc *psoc,
 				      struct ml_link_state_info_event *params,
 				      uint32_t num_link_info)
 {
@@ -713,9 +714,7 @@ hdd_ml_generate_link_state_resp_nlmsg(struct sk_buff *skb,
 	uint32_t value;
 
 	attr = QCA_WLAN_VENDOR_ATTR_LINK_STATE_CONTROL_MODE;
-
-	/* Default control mode is only supported */
-	value = QCA_WLAN_VENDOR_LINK_STATE_CONTROL_MODE_DEFAULT;
+	value = ucfg_mlme_get_ml_link_control_mode(psoc, params->vdev_id);
 	errno = nla_put_u32(skb, attr, value);
 	if (errno)
 		return errno;
@@ -761,6 +760,7 @@ hdd_ml_generate_link_state_resp_nlmsg(struct sk_buff *skb,
 }
 
 static QDF_STATUS wlan_hdd_link_state_request(struct wiphy *wiphy,
+					      struct wlan_objmgr_psoc *psoc,
 					      struct wlan_objmgr_vdev *vdev)
 {
 	int errno;
@@ -838,7 +838,7 @@ static QDF_STATUS wlan_hdd_link_state_request(struct wiphy *wiphy,
 	}
 
 	status = hdd_ml_generate_link_state_resp_nlmsg(
-			reply_skb, link_state_event,
+			reply_skb, psoc, link_state_event,
 			link_state_event->num_mlo_vdev_link_info);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		hdd_err("Failed to pack nl response");
@@ -894,7 +894,7 @@ int wlan_handle_mlo_link_state_operation(struct wiphy *wiphy,
 	ml_link_op = nla_get_u8(link_oper_attr);
 	switch (ml_link_op) {
 	case QCA_WLAN_VENDOR_LINK_STATE_OP_GET:
-		return wlan_hdd_link_state_request(wiphy, vdev);
+		return wlan_hdd_link_state_request(wiphy, hdd_ctx->psoc, vdev);
 	case QCA_WLAN_VENDOR_LINK_STATE_OP_SET:
 		break;
 	default:
@@ -998,6 +998,9 @@ int wlan_handle_mlo_link_state_operation(struct wiphy *wiphy,
 		return -EINVAL;
 	}
 
+	ucfg_mlme_set_ml_link_control_mode(hdd_ctx->psoc, vdev_id,
+					   ml_link_control_mode);
+
 	hdd_debug("vdev: %d, processed link state command successfully",
 		  vdev_id);
 	return 0;