static int
stp_dbg_add_pkt (
    MTKSTP_DBG_T*stp_dbg,
    struct stp_dbg_pkt_hdr *hdr,
    const unsigned char *body
)
{
    //fix the frame size large issues.
    static struct stp_dbg_pkt stp_pkt;
    uint32_t hdr_sz = sizeof(struct stp_dbg_pkt_hdr);
    uint32_t body_sz = 0;

    BUG_ON(!stp_dbg);

    if(hdr->dbg_type == STP_DBG_PKT) {
        body_sz = (hdr->len <= STP_PKT_SZ)?(hdr->len):(STP_PKT_SZ);
    } else {
        body_sz = (hdr->len <= STP_DMP_SZ)?(hdr->len):(STP_DMP_SZ);
    }

    hdr->no = stp_dbg->pkt_trace_no++;
    memcpy((uint8_t *)&stp_pkt.hdr, (uint8_t*)hdr, hdr_sz);
    if(body != NULL) {
        memcpy((uint8_t *)&stp_pkt.raw[0], body, body_sz);
    }
    _stp_dbg_dmp_in(stp_dbg, (char *) &stp_pkt, hdr_sz + body_sz);
    //Only FW DMP MSG should inform BTM-CORE to dump packet to native process
    if(hdr->dbg_type == STP_DBG_FW_DMP)
    {
        stp_gdb_notify_btm_dmp_wq(stp_dbg);
    }

    return 0;
}
INT32 stp_gdb_notify_btm_dmp_wq(MTKSTP_DBG_T *stp_dbg, CHAR *buf, INT32 len)
{
    INT32 retval = 0;

    retval = _stp_dbg_dmp_in(stp_dbg, buf, len);

#ifndef CONFIG_LOG_STP_INTERNAL
    if (stp_dbg->btm != NULL){
        retval += stp_btm_notify_wmt_dmp_wq((MTKSTP_BTM_T *)stp_dbg->btm);
    }
#endif

    return retval;
}
int stp_dbg_dmp_in(MTKSTP_DBG_T *stp_dbg, char *buf, int len) {
    return _stp_dbg_dmp_in(stp_dbg, buf, len);
}
INT32 stp_dbg_dmp_in (MTKSTP_DBG_T *stp_dbg, CHAR *buf, INT32 len)
{
    return _stp_dbg_dmp_in(stp_dbg, buf, len);
}