Example #1
0
extern "C" void
ar6000_dbglog_event(void *dev, A_UINT32 dropped, A_INT8 *buffer, A_UINT32 length)
{

#if 0 //bluebird
#ifdef REPORT_DEBUG_LOGS_TO_APP
    #define MAX_WIRELESS_EVENT_SIZE 252
    /*
     * Break it up into chunks of MAX_WIRELESS_EVENT_SIZE bytes of messages.
     * There seems to be a limitation on the length of message that could be
     * transmitted to the user app via this mechanism.
     */
    A_UINT32 send, sent;

    sent = 0;
    send = dbglog_get_debug_fragment(&buffer[sent], length - sent,
                                     MAX_WIRELESS_EVENT_SIZE);
    while (send) {
        ar6000_send_event_to_app(ar, WMIX_DBGLOG_EVENTID, &buffer[sent], send);
        sent += send;
        send = dbglog_get_debug_fragment(&buffer[sent], length - sent,
                                         MAX_WIRELESS_EVENT_SIZE);
    }
#else
    AR_DEBUG_PRINTF("Dropped logs: 0x%x\nDebug info length: %d\n",
                    dropped, length);

    /* Interpret the debug logs */
    dbglog_parse_debug_logs(buffer, length);
#endif /* REPORT_DEBUG_LOGS_TO_APP */
#else
	NDIS_DEBUG_PRINTF(DBG_TRACE, " %s() is not ready yet~ \r\n", __FUNCTION__);
#endif //bluebird
}
/*
 * Process FW debug, FW event and FW log messages
 * Read the payload and process accordingly.
 *
 */
void process_cnss_diag_msg(tAniNlHdr *wnl)
{
    uint8_t *dbgbuf;
    uint8_t *eventbuf = (uint8_t *)NLMSG_DATA(wnl);
    uint16_t diag_type = 0;
    uint32_t event_id = 0;
    uint16_t length = 0;
    struct dbglog_slot *slot;
    uint32_t dropped = 0;

    dbgbuf = eventbuf;

    diag_type = *(uint16_t *)eventbuf;
    eventbuf += sizeof(uint16_t);

    length = *(uint16_t *)eventbuf;
    eventbuf += sizeof(uint16_t);

    if (wnl->nlh.nlmsg_type == WLAN_NL_MSG_CNSS_HOST_MSG
        && (wnl->wmsg.type == ANI_NL_MSG_LOG_HOST_MSG_TYPE)) {
          process_cnss_host_message(wnl, optionflag, log_out, &record, max_records);
    } else if (wnl->nlh.nlmsg_type == WLAN_NL_MSG_CNSS_HOST_EVENT_LOG
        && (wnl->wmsg.type == ANI_NL_MSG_LOG_HOST_EVENT_LOG_TYPE)) {
        process_cnss_host_diag_events_log((char *)((char *)&wnl->wmsg.length
        + sizeof(wnl->wmsg.length)), optionflag);
    } else {
        if (diag_type == DIAG_TYPE_FW_EVENT) {
            eventbuf += sizeof(uint32_t);
            event_id = *(uint32_t *)eventbuf;
            eventbuf += sizeof(uint32_t);
            if (optionflag & QXDM_FLAG) {
                if (length)
                    event_report_payload(event_id, length, eventbuf);
                else
                    event_report(event_id);
            }
        } else if (diag_type == DIAG_TYPE_FW_LOG) {
           /* Do nothing for now */
        } else if (diag_type == DIAG_TYPE_FW_DEBUG_MSG) {
            slot =(struct dbglog_slot *)dbgbuf;
            length = get_le32((uint8_t *)&slot->length);
            dropped = get_le32((uint8_t *)&slot->dropped);
            if (optionflag & LOGFILE_FLAG)
                process_cnss_log_file(dbgbuf);
            else if (optionflag & (CONSOLE_FLAG | QXDM_FLAG))
                dbglog_parse_debug_logs(&slot->payload[0], length, dropped);
        } else if (diag_type == DIAG_TYPE_FW_MSG) {
            uint32_t version = 0;
            slot = (struct dbglog_slot *)dbgbuf;
            length = get_32((uint8_t *)&slot->length);
            version = get_le32((uint8_t *)&slot->dropped);
            process_diagfw_msg(&slot->payload[0], length, optionflag, log_out,
                               &record, max_records, version, sock_fd);
        } else if (diag_type == DIAG_TYPE_HOST_MSG) {
            slot = (struct dbglog_slot *)dbgbuf;
            length = get_32((uint8_t *)&slot->length);
            process_diaghost_msg(slot->payload, length);
        } else {
           /* Do nothing for now */
        }
    }

}