From 706377360e5623acf81bbb4213fc1b9a222bf4ca Mon Sep 17 00:00:00 2001 From: Subrat Dash Date: Fri, 15 May 2020 10:25:09 +0530 Subject: [PATCH] qcacld-3.0: Parse device info nl attribute in the oem vendor cmd Userspace uses enum qca_vendor_oem_device_type to indicate device type as vdev or pdev in the oem data vendor nl command. This attribute is set to 1 to indicate that the oem data command is meant for pdev and it is 0 for vdev. The default is vdev when this nl attribute is not present. The host driver should update the pdev_id of the vdev and fill the pdev_vdev_flag to 1 for pdev commands. Change-Id: I8bdf436759e0935c52bb09c2865fcb4a7a5ee4fc CRs-Fixed: 2693892 --- core/hdd/src/wlan_hdd_oemdata.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/hdd/src/wlan_hdd_oemdata.c b/core/hdd/src/wlan_hdd_oemdata.c index 805d63dca434..e6a786f2a578 100644 --- a/core/hdd/src/wlan_hdd_oemdata.c +++ b/core/hdd/src/wlan_hdd_oemdata.c @@ -1126,6 +1126,7 @@ oem_data_attr_policy[QCA_WLAN_VENDOR_ATTR_OEM_DATA_PARAMS_MAX + 1] = { .len = OEM_DATA_MAX_SIZE }, + [QCA_WLAN_VENDOR_ATTR_OEM_DEVICE_INFO] = {.type = NLA_U8}, [QCA_WLAN_VENDOR_ATTR_OEM_DATA_RESPONSE_EXPECTED] = {.type = NLA_FLAG}, }; @@ -1235,6 +1236,7 @@ __wlan_hdd_cfg80211_oem_data_handler(struct wiphy *wiphy, { struct net_device *dev = wdev->netdev; QDF_STATUS status = QDF_STATUS_SUCCESS; + uint8_t mac_id; int ret; struct sk_buff *skb = NULL; struct oem_data oem_data = {0}; @@ -1274,6 +1276,21 @@ __wlan_hdd_cfg80211_oem_data_handler(struct wiphy *wiphy, return -EINVAL; } + if (tb[QCA_WLAN_VENDOR_ATTR_OEM_DEVICE_INFO]) + oem_data.pdev_vdev_flag = + nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_OEM_DEVICE_INFO]); + + if (oem_data.pdev_vdev_flag) { + status = policy_mgr_get_mac_id_by_session_id(hdd_ctx->psoc, + adapter->vdev_id, + &mac_id); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("get mac id failed"); + return -EINVAL; + } + oem_data.pdev_id = mac_id; + oem_data.is_host_pdev_id = true; + } oem_data.data_len = nla_len(tb[QCA_WLAN_VENDOR_ATTR_OEM_DATA_CMD_DATA]); if (!oem_data.data_len) {