[APR-2987]wlbt: NAN datapath logs
authorJaya Prakash Sangaru <j.sangaru@samsung.com>
Fri, 18 Oct 2019 14:49:24 +0000 (20:19 +0530)
committerchenyt9 <chenyt9@lenovo.com>
Tue, 17 Nov 2020 09:15:04 +0000 (17:15 +0800)
print command and event names

Change-Id: I2a8ba3361b2bdd649e4c6c952055e566ea3139cc
SCSC-Bug-Id: HOST-11235
Signed-off-by: Jaya Prakash Sangaru <j.sangaru@samsung.com>
nan_data.h
wifi_nan.cpp
wifi_nan_data_path.cpp

index 4b93d970777ef8d3ef9bf49dfc50d2fedc2d5f0f..5cd3bd7f96cf633257a1a2d26ab5a27ec2682276 100755 (executable)
@@ -49,5 +49,6 @@ public:
     int getResponseTransactionId(NanResponseMsg *res);
     static int putSecurityInfo(u32 cipher, NanSecurityKeyInfo *key_info, u32 scid_len,
                                u8 *scid, WifiRequest *request);
+    static const u8 *getCmdName(int cmd);
 };
 #endif
index 8ef1ebf68830467a42f735ff71dc6ac2842f822e..ebb0762ecee6243332b82e5feeffaa69b410ceae 100755 (executable)
@@ -72,6 +72,38 @@ class NanCommand : public WifiCommand {
         unregisterVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_NDP_END);
     }
 
+    static const u8 *getEventName(int event) {
+        switch(event) {
+        case SLSI_NAN_EVENT_RESPONSE:
+            return (const u8 *)"SLSI_NAN_EVENT_RESPONSE";
+        case SLSI_NAN_EVENT_PUBLISH_TERMINATED:
+            return (const u8 *)"SLSI_NAN_EVENT_PUBLISH_TERMINATED";
+        case SLSI_NAN_EVENT_MATCH:
+            return (const u8 *)"SLSI_NAN_EVENT_MATCH";
+        case SLSI_NAN_EVENT_MATCH_EXPIRED:
+            return (const u8 *)"SLSI_NAN_EVENT_MATCH_EXPIRED";
+        case SLSI_NAN_EVENT_SUBSCRIBE_TERMINATED:
+            return (const u8 *)"SLSI_NAN_EVENT_SUBSCRIBE_TERMINATED";
+        case SLSI_NAN_EVENT_FOLLOWUP:
+            return (const u8 *)"SLSI_NAN_EVENT_FOLLOWUP";
+        case SLSI_NAN_EVENT_DISCOVERY_ENGINE:
+            return (const u8 *)"SLSI_NAN_EVENT_DISCOVERY_ENGINE";
+        case SLSI_NAN_EVENT_DISABLED:
+            return (const u8 *)"SLSI_NAN_EVENT_DISABLED";
+        case SLSI_NAN_EVENT_TRANSMIT_FOLLOWUP_STATUS:
+            return (const u8 *)"SLSI_NAN_EVENT_TRANSMIT_FOLLOWUP_STATUS";
+        case SLSI_NAN_EVENT_NDP_REQ:
+            return (const u8 *)"SLSI_NAN_EVENT_NDP_REQ";
+        case SLSI_NAN_EVENT_NDP_CFM:
+            return (const u8 *)"SLSI_NAN_EVENT_NDP_CFM";
+        case SLSI_NAN_EVENT_NDP_END:
+            return (const u8 *)"SLSI_NAN_EVENT_NDP_END";
+        default:
+            return (const u8 *)"UNKNOWN event";
+        }
+        return (const u8 *)"UNKNOWN event";
+    }
+
     int processResponse(WifiEvent &reply, NanResponseMsg *response) {
         NanCapabilities *capabilities = &response->body.nan_capabilities;
         nlattr *vendor_data = reply.get_attribute(NL80211_ATTR_VENDOR_DATA);
@@ -1286,7 +1318,7 @@ public:
         int id = event.get_vendor_id();
         int subcmd = event.get_vendor_subcmd();
 
-        ALOGI("NAN %s Id = 0x%x, subcmd = 0x%x", __func__, id, subcmd);
+        ALOGI("NAN %s Id = 0x%x, subcmd = %s(0x%x)", __func__, id, getEventName(subcmd), subcmd);
 
         switch(subcmd) {
         case SLSI_NAN_EVENT_MATCH:
@@ -1384,7 +1416,7 @@ public:
         int result;
         WifiRequest request(familyId(), ifaceId());
 
-        ALOGI("NAN DATA-PATH req subcmd:0x%x transaction_id:%d", subcmd, id);
+        ALOGI("NAN DATA-PATH req subcmd:%s(0x%x) transaction_id:%d", datacmd.getCmdName(subcmd), subcmd, id);
 
         result = datacmd.getDataPathNLMsg(id, data, subcmd, request);
         if (result != WIFI_SUCCESS) {
@@ -1392,11 +1424,11 @@ public:
         }
         result = requestResponse(request);
         if (result != WIFI_SUCCESS) {
-            ALOGE("failed DATA-PATH req; result = %d", result);
+            ALOGE("NAN DATA-PATH req subcmd:%s(0x%x)...failed(%d)", datacmd.getCmdName(subcmd), subcmd, result);
             unregisterNanEvents();
         } else {
             datacmd.requestSuccess(id, data, subcmd);
-            ALOGD("NAN DATA-PATH req(subcmd:0x%x)...success", subcmd);
+            ALOGD("NAN DATA-PATH req subcmd:%s(0x%x)...success", datacmd.getCmdName(subcmd), subcmd);
         }
         return result;
     }
index a5a31bf4b7b277d754a6ccbd7d5b3d5ca01c4945..fbc48dfb6ae3100ee9b628559567f970c6c07a04 100755 (executable)
@@ -422,4 +422,22 @@ int NanDataCommand::putSecurityInfo(u32 cipher, NanSecurityKeyInfo *key_info, u3
         CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put scid");
     }
     return result;
+}
+
+const u8 *NanDataCommand::getCmdName(int cmd){
+    switch(cmd) {
+    case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_CREATE:
+        return (const u8 *)"SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_CREATE";
+    case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_DELETE:
+        return (const u8 *)"SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_DELETE";
+    case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_REQUEST_INITIATOR:
+        return (const u8 *)"SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_REQUEST_INITIATOR";
+    case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INDICATION_RESPONSE:
+        return (const u8 *)"SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INDICATION_RESPONSE";
+    case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_END:
+        return (const u8 *)"SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_END";
+    default:
+        return (const u8 *)"UNKNOWN CMD";
+    }
+    return (const u8 *)"UNKNOWN CMD";
 }
\ No newline at end of file