Browse Source

qcacmn: Use NDP vendor attribute from qca_vendor.h

Update qca_vendor.h with latest NDP vendor attribute definitions
and use those definitions in NAN component.

Change-Id: I43f0457690b1c4027adcd0abe4ef2ac2a8f9b068
CRs-Fixed: 2239047
Naveen Rawat 7 years ago
parent
commit
6b44ef3460
3 changed files with 125 additions and 93 deletions
  1. 0 85
      os_if/linux/nan/inc/os_if_nan.h
  2. 8 8
      os_if/linux/nan/src/os_if_nan.c
  3. 117 0
      os_if/linux/qca_vendor.h

+ 0 - 85
os_if/linux/nan/inc/os_if_nan.h

@@ -32,91 +32,6 @@ struct wlan_objmgr_vdev;
 
 #ifdef WLAN_FEATURE_NAN_CONVERGENCE
 
-/**
- * enum qca_wlan_vendor_attr_ndp_params - vendor attribute parameters
- * @QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD: NDP Sub command
- * @QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID: Transaction id reference
- * @QCA_WLAN_VENDOR_ATTR_NDP_STATUS_ID: NDP status id
- * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID: Service instance id
- * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL: Requested channel
- * @QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR: Peer discovery mac addr
- * @QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR: Iface name
- * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY: Security configuration
- * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS: Qos configuration
- * @QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO: Application info
- * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID: NDP instance id
- * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY: NDP instance id array
- * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE: Schedule response
- * @QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR: NDI mac address
- * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE: Driver return status
- * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE: Driver return value
- * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG: Channel config request type
- * @QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE: Cipher Suit ID
- * @QCA_WLAN_VENDOR_ATTR_NDP_PMK: Pairwise Master Key
- * @QCA_WLAN_VENDOR_ATTR_NDP_SCID: Security Context ID
- * @QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - pass phrase
- * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - service name
- */
-enum qca_wlan_vendor_attr_ndp_params {
-	QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID = 0,
-	QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD,
-	QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID,
-	QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID,
-	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL,
-	QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR,
-	QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR,
-	/* CONFIG_SECURITY is deprecated, use NCS_SK_TYPE/PMK/SCID instead */
-	QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY,
-	QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS,
-	QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO,
-	QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID,
-	QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY,
-	QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE,
-	QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR,
-	QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE,
-	QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
-	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG,
-	QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE,
-	QCA_WLAN_VENDOR_ATTR_NDP_PMK,
-	QCA_WLAN_VENDOR_ATTR_NDP_SCID,
-	QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE,
-	QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME,
-
-	QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST,
-	QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX =
-		QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST - 1,
-};
-
-/**
- * enum qca_wlan_vendor_attr_ndp_sub_cmd_value - NDP subcmd value
- * @QCA_WLAN_VENDOR_ATTR_NDP_INVALID: Unused subcmd value
- * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE: iface create
- * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE: iface delete
- * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST: NDP initiator request
- * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE: NDP initiator response
- * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST: NDP responder request
- * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE: NDP responder response
- * @QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST: NDP end request
- * @QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE: NDP end response
- * @QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND: NDP request indication
- * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND: NDP confirm indication
- * @QCA_WLAN_VENDOR_ATTR_NDP_END_IND: NDP End indication
- */
-enum qca_wlan_vendor_attr_ndp_sub_cmd_value {
-	QCA_WLAN_VENDOR_ATTR_NDP_INVALID = 0,
-	QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE = 1,
-	QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE = 2,
-	QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST = 3,
-	QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE = 4,
-	QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST = 5,
-	QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE = 6,
-	QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST = 7,
-	QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE = 8,
-	QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND = 9,
-	QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND = 10,
-	QCA_WLAN_VENDOR_ATTR_NDP_END_IND = 11
-};
-
 /**
  * os_if_nan_process_ndp_cmd: os_if api to handle nan request message
  * @psoc: pointer to psoc object

+ 8 - 8
os_if/linux/nan/src/os_if_nan.c

@@ -94,7 +94,7 @@ vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = {
 						.type = NLA_U32,
 						.len = sizeof(uint32_t)
 	},
-	[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE] = {
+	[QCA_WLAN_VENDOR_ATTR_NDP_CSID] = {
 						.type = NLA_U32,
 						.len = sizeof(uint32_t)
 	},
@@ -252,9 +252,9 @@ static int os_if_nan_parse_security_params(struct nlattr **tb,
 		return -EINVAL;
 	}
 
-	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]) {
+	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_CSID]) {
 		*ncs_sk_type =
-			nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]);
+			nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_CSID]);
 	}
 
 	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]) {
@@ -309,7 +309,7 @@ static int os_if_nan_parse_security_params(struct nlattr **tb,
  * QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_PMK - optional
- * QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE - optional
+ * QCA_WLAN_VENDOR_ATTR_NDP_CSID - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - optional
  *
@@ -441,7 +441,7 @@ initiator_req_failed:
  * QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_PMK - optional
- * QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE - optional
+ * QCA_WLAN_VENDOR_ATTR_NDP_CSID - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - optional
  *
@@ -866,7 +866,7 @@ static inline uint32_t osif_ndp_get_ndp_req_ind_len(
 	data_len += nla_total_size(vendor_attr_policy[
 			QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS].len);
 	data_len += nla_total_size(vendor_attr_policy[
-			QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE].len);
+			QCA_WLAN_VENDOR_ATTR_NDP_CSID].len);
 	/* allocate space including NULL terminator */
 	data_len += nla_total_size(vendor_attr_policy[
 			QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR].len + 1);
@@ -897,7 +897,7 @@ static inline uint32_t osif_ndp_get_ndp_req_ind_len(
  * QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID (4 bytes)
  * QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO (ndp_app_info_len size)
  * QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS (4 bytes)
- * QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE(4 bytes)
+ * QCA_WLAN_VENDOR_ATTR_NDP_CSID(4 bytes)
  * QCA_WLAN_VENDOR_ATTR_NDP_SCID(scid_len in size)
  *
  * Return: none
@@ -997,7 +997,7 @@ static void os_if_ndp_indication_handler(struct wlan_objmgr_vdev *vdev,
 
 	if (event->scid.scid_len) {
 		if (nla_put_u32(vendor_event,
-				QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE,
+				QCA_WLAN_VENDOR_ATTR_NDP_CSID,
 				event->ncs_sk_type))
 			goto ndp_indication_nla_failed;
 

+ 117 - 0
os_if/linux/qca_vendor.h

@@ -3557,6 +3557,123 @@ enum qca_wlan_vendor_attr_rssi_monitoring {
 		QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_AFTER_LAST - 1,
 };
 
+/**
+ * enum qca_wlan_vendor_attr_ndp_params - Used by the vendor command
+ * QCA_NL80211_VENDOR_SUBCMD_NDP.
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD: sub commands values in qca_wlan_ndp_sub_cmd
+ * @QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID:
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID: indicats a service info
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL: channel frequency in MHz
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR: Interface Discovery MAC
+ * address
+ * @QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR: Interface name on which NDP is being
+ * created
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY: CONFIG_SECURITY is deprecated, use
+ * NCS_SK_TYPE/PMK/SCID instead
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS: value for QoS
+ * @QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO: app info
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID: NDP instance Id
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY: Array of instance Ids
+ * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE: initiator/responder NDP response
+ * code: accept/reject
+ * @QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR: NDI MAC address
+ * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE: errors types returned by
+ * driver
+ * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE: value error values returned by
+ * driver
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG: Channel setup configuration
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CSID: Cipher Suite Shared Key Type
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PMK: PMK_INFO
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SCID: Security Context Identifier that contains the
+ * PMKID
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE: passphrase
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME: service name
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_REASON: bitmap indicating schedule
+ * update:
+ *     BIT_0: NSS Update
+ *     BIT_1: Channel list update
+ * @QCA_WLAN_VENDOR_ATTR_NDP_NSS: nss
+ * @QCA_WLAN_VENDOR_ATTR_NDP_NUM_CHANNELS: NUMBER NDP CHANNEL
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_WIDTH: CHANNEL BANDWIDTH:
+ *     0:20 MHz,
+ *     1:40 MHz,
+ *     2:80 MHz,
+ *     3:160 MHz
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_INFO: Array of channel/band width
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST: id after last valid attribute
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX: max value of this enum type
+*/
+enum qca_wlan_vendor_attr_ndp_params {
+	QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD,
+	QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID,
+	QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID,
+	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL,
+	QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR,
+	QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR,
+	QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY,
+	QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS,
+	QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO,
+	QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID,
+	QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY,
+	QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE,
+	QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR,
+	QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE,
+	QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
+	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG,
+	QCA_WLAN_VENDOR_ATTR_NDP_CSID,
+	QCA_WLAN_VENDOR_ATTR_NDP_PMK,
+	QCA_WLAN_VENDOR_ATTR_NDP_SCID,
+	QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE,
+	QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME,
+	QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_REASON,
+	QCA_WLAN_VENDOR_ATTR_NDP_NSS,
+	QCA_WLAN_VENDOR_ATTR_NDP_NUM_CHANNELS,
+	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_WIDTH,
+	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_INFO,
+
+	/* keep last */
+	QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST,
+	QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX =
+		QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST - 1,
+};
+
+/**
+ * enum qca_wlan_ndp_sub_cmd - NDP sub comands types for
+ * QCA_NL80211_VENDOR_SUBCMD_NDP.
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INVALID: invalid value
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE: create a ndi
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE: delete a ndi
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST: initiate a ndp session
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE: response for above
+ * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST: respond to ndp session
+ * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE: response for above
+ * @QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST: initiate a ndp end
+ * @QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE: response for above
+ * @QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND: notify the peer about the end request
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND: confirm the ndp session is complete
+ * @QCA_WLAN_VENDOR_ATTR_NDP_END_IND: indicate the peer about the end request
+ * being received
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_IND: indicate the peer of schedule
+ * update
+ */
+enum qca_wlan_ndp_sub_cmd {
+	QCA_WLAN_VENDOR_ATTR_NDP_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE = 1,
+	QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE = 2,
+	QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST = 3,
+	QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE = 4,
+	QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST = 5,
+	QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE = 6,
+	QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST = 7,
+	QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE = 8,
+	QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND = 9,
+	QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND = 10,
+	QCA_WLAN_VENDOR_ATTR_NDP_END_IND = 11,
+	QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_IND = 12
+};
+
 /**
  * qca_wlan_vendor_external_acs_event_chan_info_attr: Represents per channel
  * information. These attributes are sent as part of