ソースを参照

qcacld-3.0: Check peer TWT capabilities

In TWT component, for TWT setup request added below checks:
1. For individual TWT setup command, if peer does not support
   TWT responder capability then host will reject individual
   TWT  setup request.
2. For broadcast TWT setup request, if peer does not support
   TWT broadcast capability then host will reject broadcast
   TWT setup request.

Change-Id: I7265520b1bdceab67b121ba2250d374b1c284275
CRs-Fixed: 3131628
Deeksha Gupta 3 年 前
コミット
a4febcf3f4
1 ファイル変更17 行追加0 行削除
  1. 17 0
      os_if/twt/src/osif_twt_ext_req.c

+ 17 - 0
os_if/twt/src/osif_twt_ext_req.c

@@ -933,6 +933,8 @@ int osif_twt_setup_req(struct wlan_objmgr_vdev *vdev,
 	uint8_t vdev_id, pdev_id;
 	struct twt_add_dialog_param params = {0};
 	uint32_t congestion_timeout = 0;
+	uint8_t peer_cap;
+	QDF_STATUS qdf_status;
 
 	psoc = wlan_vdev_get_psoc(vdev);
 	if (!psoc) {
@@ -968,6 +970,21 @@ int osif_twt_setup_req(struct wlan_objmgr_vdev *vdev,
 	if (ret)
 		return ret;
 
+	qdf_status = ucfg_twt_get_peer_capabilities(psoc, &params.peer_macaddr,
+						    &peer_cap);
+	if (QDF_IS_STATUS_ERROR(qdf_status))
+		return -EINVAL;
+
+	if (params.flag_bcast && !(peer_cap & WLAN_TWT_CAPA_BROADCAST)) {
+		osif_err_rl("TWT setup reject: TWT Broadcast not supported");
+		return -EOPNOTSUPP;
+	}
+
+	if (!params.flag_bcast && !(peer_cap & WLAN_TWT_CAPA_RESPONDER)) {
+		osif_err_rl("TWT setup reject: TWT responder not supported");
+		return -EOPNOTSUPP;
+	}
+
 	ucfg_twt_cfg_get_congestion_timeout(psoc, &congestion_timeout);
 
 	if (congestion_timeout) {