Revert "[Feature][T106_eSDK]update from T106-V2.01.01.02P56U06.AP.15.11_CAP.15.11.01 to T106-V2.01.01.02P56U06.AP.16.08_CAP.16.08.01 -- code"

This reverts commit 39d99118f249054d01992819702e0612dfdfe3b9.

Reason for revert:revert 16.08_patch

Change-Id: Ib9848be6d113db9be3378524981a30d0c3a0c1a5
diff --git a/upstream/linux-5.10/drivers/misc/zcat/debug_info.c b/upstream/linux-5.10/drivers/misc/zcat/debug_info.c
index 52a2146..d23e340 100755
--- a/upstream/linux-5.10/drivers/misc/zcat/debug_info.c
+++ b/upstream/linux-5.10/drivers/misc/zcat/debug_info.c
@@ -5,7 +5,10 @@
 #include <linux/cdev.h>
 #include <linux/semaphore.h>
 #include <linux/timer.h>
+
+// #include <linux/fs.h>
 #include <linux/ioport.h>
+// #include <linux/serial_reg.h>
 #include <linux/poll.h>
 #include <linux/delay.h>
 #include <linux/wait.h>
@@ -15,94 +18,88 @@
 #include <linux/types.h>
 #include <linux/device.h>
 #include <linux/miscdevice.h>
+// #include <linux/spinlock.h>
 #include <linux/list.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
+// #include <linux/kthread.h>
 #include <asm/io.h>
+
 #include <linux/vmalloc.h>
 #include <linux/soc/zte/rpmsg.h>
+// #include <linux/syscalls.h>
+
+// #include "debuginfo.h"
 #include "pub_debug_info.h"
 #include "ringbuf.h"
-#include "ram_config.h"
-#include "ZspTrace.h"
-#include <linux/proc_fs.h>
-#include <asm/barrier.h>
-#include <asm/cache.h>
-#include <asm/cacheflush.h>
-#include <linux/seq_file.h>
-#include <linux/ktime.h>
-#include <linux/time.h>
 
-#if defined(_USE_ZXIC_DEBUG_INFO)
+
+#if defined(_USE_ZXIC_DEBUG_INFO) && !defined(CONFIG_SYSTEM_RECOVERY)
 /*******************************************************************************
  *                                   宏定义                                     *
  *******************************************************************************/
-#define DEBUG_INFO_AP_MEM_LEN       (0x2000)
+#define DEBUG_INFO_SHARE_MEM_LEN    (0x2000)
 #define DEBUG_INFO_READABLE_LEN     (0x1400)
+#define DEBUG_INFO_MAX_DATA_LEN     (128)
+#define DEBUG_INFO_MAX_TOTAL_LEN    (140) // 8 + 128 + 4
 #define DEBUG_INFO_READ_TIME_MSECS  (10000)
 
+#define DEBUG_INFO_CHANNEL          (9)
+#define DEBUG_INFO_MSG_CAP_SIZE     (2 * 1024)
+
 #define DEBUG_INFO_OK               (0)
 #define DEBUG_INFO_ERROR            (-1)
-#define DEBUG_READ_NOBLOCK          (11)
 
-#define DEBUG_INFO_MAX_ID_LEN       (16+3)
-#define DEBUG_INFO_MAX_DATA_LEN     (128)
-#define DEBUG_INFO_MAX_TIME_LEN     (0)//(20+3)
-#define DEBUG_INFO_MAX_DATE_LEN     (19+3)
-#define DEBUG_INFO_MAX_TOTAL_LEN    (DEBUG_INFO_MAX_ID_LEN + DEBUG_INFO_MAX_DATA_LEN + DEBUG_INFO_MAX_TIME_LEN)
-
-#define DEBUG_INFO_CORE_NUM          (2)
+#define DEBUG_INFO_IOCTL_SET_DISABLE  (0x1001)
 
 /*******************************************************************************
  *                                结构体定义                                     *
  *******************************************************************************/
-typedef unsigned int   UINT32;
+typedef unsigned int UINT32;
 typedef unsigned short UINT16;
-typedef unsigned char  UINT8;
-typedef unsigned long  UINT64; 
-typedef struct{
-    unsigned int head;                               /* 0x010a0a0a */
-    unsigned int datalen[DEBUG_INFO_CORE_NUM];       /* 数据内容长度 */ 
+typedef unsigned char UINT8;
+
+typedef struct
+{
+    UINT16 module_id; // 模块id
+    UINT16 sub_len;   // 用户数据长度
+    UINT32 time;
+    char sub_data[]; // 用户数据
+} T_SHARED_MEM_DATA;
+
+typedef struct
+{
+    UINT32 head;                  // 0x010a0a0a
+    UINT32 total_len;             // 数据内容长度
+    long long time;               // time()函数获取
 } T_SAVE_FILE_DATA;
 
 /*******************************************************************************
  *                                  全局变量                                     *
  *******************************************************************************/
+volatile T_RINGBUFFER *g_debug_info_buf = NULL;
 static struct semaphore debug_sem;
+static DEFINE_RAW_SPINLOCK(debugWr_lock);
 static int g_init_flag = 0;
-UINT32 *g_ps_debug_write_cnt;
-UINT32 *g_ps_debug_full_cnt;
-UINT32 g_ps_debug_read_cnt;
-UINT32 g_ps_debug_read_full_cnt;
-unsigned long  g_debug_read_cnt;
-unsigned long  g_ap_debug_write_cnt;
-unsigned long  g_ap_debug_read_cnt;
-UINT8 *g_ap_debug_buffer_start;
-UINT8 *g_ap_debug_buffer_read;
-UINT8 *g_ap_debug_buffer_write;
-UINT8 *g_ap_debug_buffer_end;
-UINT8 *g_ps_debug_buffer_start;
-UINT8 *g_ps_debug_buffer_end;
-UINT8 *g_ps_debug_buffer_read;
-static DEFINE_SPINLOCK(debug_info_lock);
-static char  g_ap_debug_buffer[DEBUG_INFO_AP_MEM_LEN];
-unsigned long  g_debug_read_state = 0; 
 
 /*******************************************************************************
  *                              内部函数定义                                     *
  *******************************************************************************/
-static int sc_debug_info_read_to_user(char *buf, size_t count);
-static int sc_debug_info_record_from_user(const char *info, size_t count);
-static void sc_debug_info_from_ps(void *buf, unsigned int len);
+static int sc_debug_info_read_to_user(char *buf, unsigned short count);
+static int sc_debug_info_record_from_user(const char *info, unsigned short count);
+static int sc_debug_info_write(UINT32 flag, const UINT8 *buf, UINT32 len);
+static void sc_debug_info_from_ap(void *buf, unsigned int len);
+
 static void kernel_timer_timeout(struct timer_list *t);
 static ssize_t debug_info_read(struct file *fp, char __user *buf, size_t count, loff_t *pos);
 static ssize_t debug_info_write(struct file *fp, const char __user *buf, size_t count, loff_t *pos);
 static int debug_info_open(struct inode *ip, struct file *fp);
 static long debug_info_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
 static int debug_info_release(struct inode *ip, struct file *fp);
-extern u64 cop_time_get_value64(void);
-extern int seq_write(struct seq_file *seq, const void *data, size_t len); 
+
+//初始化timer
 static DEFINE_TIMER(timer, kernel_timer_timeout);
+
 static const struct file_operations debug_info_fops = {
     .owner = THIS_MODULE,
     .read = debug_info_read,
@@ -117,36 +114,35 @@
     .name = "debug_info",
     .fops = &debug_info_fops,
 };
+
 static void kernel_timer_timeout(struct timer_list *t)
-{    
+{
     if (debug_sem.count == 0)
-    {        
+    {
         up(&debug_sem);
     }
+    /* 因为内核定时器是一个单次的定时器,所以如果想要多次重复定时需要在定时器绑定的函数结尾重新装载时间,并启动定时 */
     /* Kernel Timer restart */
-    mod_timer(&timer, jiffies + msecs_to_jiffies(DEBUG_INFO_READ_TIME_MSECS));
+    mod_timer(&timer, jiffies + msecs_to_jiffies(DEBUG_INFO_READ_TIME_MSECS));    
 }
 
-/* Started by AICoder, pid:y6ffbg9a06ieda114a190b4cb0ff4417bd78c0f4 */
 static ssize_t debug_info_read(struct file *fp, char __user *buf, size_t count, loff_t *pos)
 {
     int ret;
     int rd_len;
 
-    if (g_debug_read_state != DEBUG_READ_NOBLOCK)
+    ret = down_interruptible(&debug_sem);
+    if(ret < 0)
     {
-        ret = down_interruptible(&debug_sem);
-        if (ret < 0)
-        {
-            return ret;
-        }
+        return ret;
     }
-
-    rd_len = sc_debug_info_read_to_user(buf, count);
+    else
+    {
+        rd_len = sc_debug_info_read_to_user(buf, count);
+    }
 
     return rd_len;
 }
-/* Ended by AICoder, pid:y6ffbg9a06ieda114a190b4cb0ff4417bd78c0f4 */
 
 static ssize_t debug_info_write(struct file *fp, const char __user *buf, size_t count, loff_t *pos)
 {
@@ -160,425 +156,241 @@
     return 0;
 }
 
-/* Started by AICoder, pid:u635ed463ce5ab2145a109c3c0f54d149e6386b3 */
-static long debug_info_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) {
-    if (cmd == DEBUG_READ_NOBLOCK) {
-        g_debug_read_state = DEBUG_READ_NOBLOCK;
-    } else {
-        // 如果命令不匹配,返回错误码
-        return -EINVAL;
+static long debug_info_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
+{
+    switch(cmd)
+    {
+        case DEBUG_INFO_IOCTL_SET_DISABLE:
+            *(volatile UINT32 *)ZCAT_DEBUG_INFO_DISABLE = arg;
+            break;
+
+        default:
+            break;
     }
-
-    // 记录调试信息
-    sc_debug_info_record("debug_info", "read noblock!\n");
-
     return 0;
 }
-/* Ended by AICoder, pid:u635ed463ce5ab2145a109c3c0f54d149e6386b3 */
 
 static int debug_info_release(struct inode *ip, struct file *fp)
 {
     return 0;
 }
 
-static int ap_log_proc_show(struct seq_file *m, void *v)
+static void sc_debug_info_from_ap(void *buf, unsigned int len)
 {
-    unsigned long writecnt = g_ap_debug_write_cnt;
+    T_SHARED_MEM_DATA *debug_msg = (T_SHARED_MEM_DATA *)buf;
+    debug_msg->time = jiffies;
 
-    if (writecnt > DEBUG_INFO_AP_MEM_LEN)
-    {
-        writecnt = DEBUG_INFO_AP_MEM_LEN;
-    }
-   
-    seq_write(m, g_ap_debug_buffer_start, writecnt);
-
-	return 0;
-}
-
-static int ps_log_proc_show(struct seq_file *m, void *v)
-{
-    unsigned long writecnt = 0;
-    unsigned long fulllcnt = 0;
-    
-    writecnt = *(UINT32 *)g_ps_debug_write_cnt;
-    fulllcnt = *(UINT32 *)g_ps_debug_full_cnt;
-
-    if (fulllcnt > 0)
-    {
-       writecnt = PS_DEBUG_INFO_SIZE;
-    }
-
-    //__inval_dcache_area((void *)g_ps_debug_buffer_start, writecnt);
-    seq_write(m, g_ps_debug_buffer_start, writecnt);
-
-	return 0;
-}
-
-UINT32 skip_end_null(char *buf, size_t count)
-{
-    UINT32 len   = 0;
-    char *tmpbuf = buf;
- 
-    while (count > 0)
-    {
-        if (*tmpbuf == '\0')
-        {
-            ++len;
-            tmpbuf -= 1;
-            count  -= 1;
-        }
-        else
-        {
-            break;
-        }
-    }
-
-    return len;
-}
-
-int sc_debug_info_read_ap(char *buf, size_t count)
-{
-    UINT32 readLen       = 0;
-    UINT32 updatelen     = 0;
-    UINT32 readremainLen = 0;
-    UINT8 *readbuffaddr  = 0;
-    UINT32 nullLen       = 0;
-    char *tmpbuf         = buf;
-
-    updatelen = g_ap_debug_write_cnt - g_ap_debug_read_cnt;
-    if (updatelen > DEBUG_INFO_AP_MEM_LEN)
-        updatelen = DEBUG_INFO_AP_MEM_LEN;
-
-    if(g_ap_debug_buffer_end - g_ap_debug_buffer_read >= updatelen)
-    {
-        readbuffaddr = g_ap_debug_buffer_read;
-        readLen      = updatelen;
-        if (copy_to_user(tmpbuf , readbuffaddr, readLen))
-        {
-            return -EFAULT;
-        }
-        g_ap_debug_buffer_read += readLen;
-    }
-    else if(g_ap_debug_buffer_end - g_ap_debug_buffer_read < updatelen)
-    {
-        readbuffaddr  = g_ap_debug_buffer_read;
-        readLen       = g_ap_debug_buffer_end - readbuffaddr;
-        readremainLen = updatelen - readLen;
-        nullLen = skip_end_null(g_ap_debug_buffer_end - 1, readLen);
-        readLen = readLen - nullLen;
-        if (copy_to_user(tmpbuf, readbuffaddr, readLen))
-        {
-            return -EFAULT;
-        }
-        if (copy_to_user(tmpbuf + readLen, g_ap_debug_buffer_start, readremainLen))
-        {
-            return -EFAULT;
-        }
-        g_ap_debug_buffer_read = g_ap_debug_buffer_start + readremainLen;
-    }
-    else
-    {
-        panic("gaohf sc_debug_info_read_to_user error");
-    }
-    g_ap_debug_read_cnt  = g_ap_debug_write_cnt;
-
-    return (readLen + readremainLen);
-}
-
-int sc_debug_info_read_ps(char *buf, size_t count)
-{
-    UINT32 readLen         = 0;
-    UINT32 readremainLen   = 0;
-    UINT8 *readbuffaddr    = 0;      
-    UINT32 fulllcnt        = 0;
-    UINT32 fulllcntdiff    = 0;
-    unsigned long writecnt = 0;
-    UINT32 nullLen         = 0;
-    char *tmpbuf           = buf;
-
-    writecnt  = *(volatile UINT32 *)g_ps_debug_write_cnt;
-    fulllcnt  = *(volatile UINT32 *)g_ps_debug_full_cnt;
-   
-    if (fulllcnt >= g_ps_debug_read_full_cnt)
-    {
-        fulllcntdiff  = fulllcnt - g_ps_debug_read_full_cnt;
-    }
-    else
-    {
-        fulllcntdiff  = 0xFFFFFFFF - g_ps_debug_read_full_cnt + fulllcnt;
-    }
-    if(fulllcntdiff >= 2)
-    {
-        readbuffaddr  = g_ps_debug_buffer_start + writecnt;
-        readLen       = g_ps_debug_buffer_end - readbuffaddr;
-        readremainLen = writecnt;
-        nullLen       = skip_end_null(g_ps_debug_buffer_end - 1, readLen);
-        readLen = readLen - nullLen;
-        if (copy_to_user(tmpbuf, readbuffaddr, readLen))
-        {
-            return -EFAULT;
-        }
-        if (copy_to_user(tmpbuf + readLen, g_ps_debug_buffer_start, readremainLen))
-        {
-            return -EFAULT;
-        }
-        g_ps_debug_buffer_read = g_ps_debug_buffer_start + readremainLen;
-    }
-    else if(fulllcntdiff == 0)
-    {
-        readbuffaddr = g_ps_debug_buffer_read;
-        readLen      = writecnt - g_ps_debug_read_cnt;;
-        if (copy_to_user(tmpbuf , readbuffaddr, readLen))
-        {
-            return -EFAULT;
-        }    
-        g_ps_debug_buffer_read += readLen;
-    }
-    else if(fulllcntdiff == 1)
-    {
-        readLen  = writecnt >=  g_ps_debug_read_cnt ? writecnt : g_ps_debug_read_cnt;
-        readLen  = PS_DEBUG_INFO_SIZE - readLen;
-        readbuffaddr  = g_ps_debug_buffer_read;
-        nullLen       = skip_end_null(g_ps_debug_buffer_end - 1, readLen);
-        readLen = readLen - nullLen;
-        if (copy_to_user(tmpbuf, readbuffaddr, readLen))
-        {
-            return -EFAULT;
-        }    
-        readremainLen = writecnt;
-        if (copy_to_user(tmpbuf + readLen , g_ps_debug_buffer_start, readremainLen))
-        {
-            return -EFAULT;
-        } 
-        g_ps_debug_buffer_read = g_ps_debug_buffer_start + readremainLen;
-    }
-    else
-    {
-        panic("gaohf sc_debug_info_read_to_user error");
-    }
-    g_ps_debug_read_cnt      = writecnt;
-    g_ps_debug_read_full_cnt = fulllcnt;
-
-    return (readLen + readremainLen);
-}
-
-int sc_debug_info_read_to_user(char *buf, size_t count)
-{
-    char *tmpbuf = 0;
-    int ret      = 0;
-    int ap_len   = 0;
-    int ps_len   = 0;
-    T_SAVE_FILE_DATA fileDataHead;
-    
-    if (g_init_flag == 0)
-    {
-        printk("debug_info not init.\n");
-        return DEBUG_INFO_ERROR;
-    }
-    
-    if (count == 0 || buf == NULL )
-    {
-        printk("sc_debug_info_read_to_user count == 0 || buf == NULL \n");
-        return DEBUG_INFO_ERROR;
-    }
-    tmpbuf = buf + sizeof(T_SAVE_FILE_DATA);
-    ap_len = sc_debug_info_read_ap(tmpbuf, DEBUG_INFO_AP_MEM_LEN);
-    tmpbuf += ap_len;
-    ps_len = sc_debug_info_read_ps(tmpbuf, PS_DEBUG_INFO_SIZE);
-
-    fileDataHead.head       = 0x010a0a0a; 
-    fileDataHead.datalen[0] = ap_len;
-    fileDataHead.datalen[1] = ps_len;
-    
-    if (copy_to_user(buf, &fileDataHead, sizeof(T_SAVE_FILE_DATA)))
-    {        
-        printk("sc_debug_info_read_to_user  copy_to_user error \n");
-        return -EFAULT;
-    }
-    return  sizeof(T_SAVE_FILE_DATA) + ap_len + ps_len;
-}
-
-static int sc_debug_info_record_from_user(const char *info, size_t count)
-{
-    UINT32 cnt = 0;
-    int spacelen;
-    int msg_len =  0;
-    struct tm tm;
-    time64_t time;
-    unsigned long used_space;
-    char buffer[DEBUG_INFO_MAX_TOTAL_LEN];
-    unsigned long flags;
-    UINT8 *tmp_write_addr = buffer;
- 
-    if (g_init_flag == 0 || info == NULL)
-    {
-        printk("debug_info not init or sc_debug_info_record_from_user info is NULL\n");
-        return DEBUG_INFO_ERROR;
-    }
-
-    if(count > DEBUG_INFO_MAX_DATA_LEN + DEBUG_INFO_MAX_ID_LEN)
-    {
-        printk("debug_info data too long\n");
-        return DEBUG_INFO_ERROR;
-    }
-
-    time = ktime_get_real_seconds();
-    time64_to_tm(time, 0, &tm);
-    cnt = snprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_DATE_LEN, "[%ld-%02d-%02d %d:%02d:%02d]", \
-          tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
-    tmp_write_addr += cnt;
-    msg_len = cnt;
-
-    spin_lock_irqsave(&debug_info_lock, flags);
-    spacelen = g_ap_debug_buffer_end - g_ap_debug_buffer_write;
-    if (spacelen < msg_len + count)
-    {
-        g_ap_debug_write_cnt += spacelen;
-        memset(g_ap_debug_buffer_write, '\0', spacelen);
-        g_ap_debug_buffer_write = g_ap_debug_buffer_start;
-    }
-    memcpy(g_ap_debug_buffer_write, buffer, msg_len);
-    if (copy_from_user(g_ap_debug_buffer_write + msg_len, info, count))
-        return -EFAULT;
-    msg_len += count;
-    g_ap_debug_buffer_write += msg_len;
-    g_ap_debug_write_cnt  += msg_len;
-    used_space = g_ap_debug_write_cnt - g_ap_debug_read_cnt;
-    spin_unlock_irqrestore(&debug_info_lock, flags);
-    if (used_space > DEBUG_INFO_READABLE_LEN)
-    {        
-        if (debug_sem.count == 0)
-        {
-            up(&debug_sem);
-        }
-    }
-    return msg_len;
-}
-
-int sc_debug_info_vrecord(char *id, const char *format, va_list args)
-{
-    int spacelen;
-    int msg_len =  0;
-    int cnt =  0;
-    unsigned long used_space;
-    struct tm tm;
-    time64_t time;
-    char buffer[DEBUG_INFO_MAX_TOTAL_LEN];
-    unsigned long flags;
-    UINT8 *tmp_write_addr = buffer;
-
-    time = ktime_get_real_seconds();
-    time64_to_tm(time, 0, &tm);
-    cnt = snprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_DATE_LEN, "[%ld-%02d-%02d %d:%02d:%02d]", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
-    tmp_write_addr += cnt;
-    msg_len = cnt; 
-
-    cnt = snprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_ID_LEN, "[%s]",id);
-    tmp_write_addr += cnt;
-    msg_len += cnt;
-    msg_len += vsnprintf((char *)tmp_write_addr, DEBUG_INFO_MAX_DATA_LEN, format, args);
-
-    spin_lock_irqsave(&debug_info_lock, flags);
-    spacelen = g_ap_debug_buffer_end  - g_ap_debug_buffer_write;
-    if (spacelen <  DEBUG_INFO_MAX_TOTAL_LEN)
-    {
-        g_ap_debug_write_cnt += spacelen;
-        memset(g_ap_debug_buffer_write, '\0', spacelen);
-        g_ap_debug_buffer_write = g_ap_debug_buffer_start;
-    }
-
-    memcpy(g_ap_debug_buffer_write, buffer, msg_len);
-    g_ap_debug_buffer_write += msg_len;
-    g_ap_debug_write_cnt    += msg_len;
-    used_space = g_ap_debug_write_cnt - g_ap_debug_read_cnt;
-    spin_unlock_irqrestore(&debug_info_lock, flags);
-    if (used_space > DEBUG_INFO_READABLE_LEN)     
-    {        
-        if (debug_sem.count == 0)
-        {
-            up(&debug_sem);
-        }
-    }
-    return msg_len;
-}
-EXPORT_SYMBOL(sc_debug_info_vrecord);
-
-int sc_debug_info_record(char *id, const char *format, ...)
-{
-    va_list args;
-    int r;
-    
-    if (g_init_flag == 0)
-    {
-        printk("debug_info not init.\n");
-        return DEBUG_INFO_ERROR;
-    }
-    
-    va_start(args, format);
-    r = sc_debug_info_vrecord(id, format, args);
-    va_end(args);
-
-    return r;
-}
-EXPORT_SYMBOL(sc_debug_info_record);
-
-void  early_debug_info_init(void)
-{
-    g_ap_debug_buffer_start = g_ap_debug_buffer;
-    g_ap_debug_buffer_write = g_ap_debug_buffer_start;
-    g_ap_debug_buffer_read  = g_ap_debug_buffer_start;
-    g_ap_debug_buffer_end   = g_ap_debug_buffer + DEBUG_INFO_AP_MEM_LEN;
-    g_ap_debug_read_cnt     = 0;
-    g_ap_debug_write_cnt    = 0;
-
-    g_init_flag = 1;
-    printk("cap early_debug_info_init  success \n");
+    sc_debug_info_write(ZCAT_MEM_TYPE_KERNEL, buf, len);
 }
 
 static int __init debug_info_init(void)
 {
-    int ret;
-
-    ret = misc_register(&debug_info_device);
+    int ret = misc_register(&debug_info_device);
     if (ret)
     {
-        printk("debug_info_init init.\n");
+        printk("debug_info_device init.\n");
         return DEBUG_INFO_ERROR;
     }
 
-    g_ps_debug_write_cnt     = (UINT32 *)ioremap(PS_DEBUG_INFO_LEN_ADDR_PA, PS_DEBUG_INFO_LEN_SIZE);
-   // printf("PS_DEBUG_INFO_LEN_ADDR_PA \n",)
-    g_ps_debug_full_cnt      = (UINT32 *)((char *)g_ps_debug_write_cnt + 4);
-    g_ps_debug_buffer_start  = (unsigned long)ioremap(PS_DEBUG_INFO_ADDR_PA, PS_DEBUG_INFO_SIZE);
-    g_ps_debug_buffer_read   = g_ps_debug_buffer_start;
-    g_ps_debug_buffer_end    = g_ps_debug_buffer_start + PS_DEBUG_INFO_SIZE;
-    g_ps_debug_read_cnt      = 0;
-    g_ps_debug_read_full_cnt = 0;
+    void *mem;
+    mem = vmalloc(DEBUG_INFO_SHARE_MEM_LEN);
+    if (!mem)
+    {
+        printk("vmalloc failed.\n");
+        return DEBUG_INFO_ERROR;
+    }
+
+    g_debug_info_buf = CreateRingBuffer((UINT8 *)mem, DEBUG_INFO_SHARE_MEM_LEN);
+    if (g_debug_info_buf == NULL)
+    {
+        printk("CreateRingBuffer failed.\n");
+        return DEBUG_INFO_ERROR;
+    }
+#if 1
+    ret = rpmsgCreateChannel(
+        CORE_PS0, 
+        DEBUG_INFO_CHANNEL,
+        DEBUG_INFO_MSG_CAP_SIZE);
+    if (ret != DEBUG_INFO_OK) 
+    {
+        printk("rpmsgCreateChannel failed, ret = %d\n", ret);
+        return DEBUG_INFO_ERROR;
+    }  
+    
+    ret = rpmsgRegCallBack(
+            CORE_PS0,
+            DEBUG_INFO_CHANNEL, 
+            sc_debug_info_from_ap);
+    if (ret != DEBUG_INFO_OK) 
+    {
+        printk("rpmsgRegCallBack failed,ret = %d\n", ret);
+        return DEBUG_INFO_ERROR;
+    } 
+#endif
     sema_init(&debug_sem, 0);
-    proc_create_single("debug_info_cap", 0, NULL, ap_log_proc_show);
-    proc_create_single("debug_info_ap", 0, NULL,  ps_log_proc_show);
-    mod_timer(&timer, jiffies + 1); 
-    printk("cap debug_info_init success \n");
- //   g_init_flag = 1;
+    /* 添加并启动定时器, 10ms */
+    mod_timer(&timer, jiffies + 1);    
+
+    g_init_flag = 1;
+
     return 0;
 }
 
 static void __exit debug_info_exit(void)
 {
     misc_deregister(&debug_info_device);
+
     del_timer(&timer);
 }
 
+static int sc_debug_info_write(UINT32 flag, const UINT8 *buf, UINT32 len)
+{
+    UINT32 writelen;
+    UINT32 used_space;
+    unsigned long flags;
+
+    if (len == 0 || g_debug_info_buf == NULL)
+    {
+        printk("sc_debug_info_write:: (len == 0 || g_debug_info_buf == NULL).\n");
+        return DEBUG_INFO_ERROR;
+    }
+
+    raw_spin_lock_irqsave(&debugWr_lock, flags);
+    writelen = WriteRingBuffer(g_debug_info_buf, buf, len, flag);
+    raw_spin_unlock_irqrestore(&debugWr_lock, flags);
+    used_space = GetRingBufferSize(g_debug_info_buf);
+    if (used_space > DEBUG_INFO_READABLE_LEN)
+    {
+        if (debug_sem.count == 0)
+        {
+            up(&debug_sem);
+        }
+    }
+
+    return writelen;
+}
+
+static int sc_debug_info_read_to_user(char *buf, unsigned short count)
+{
+    unsigned int bufSize_used = 0;
+    unsigned int readLen = 0;
+    unsigned int bufLen = 0;
+    T_SAVE_FILE_DATA fileDataHead;
+
+    if (g_init_flag == 0)
+    {
+        printk("debug_info not init.\n");
+        return DEBUG_INFO_ERROR;
+    }
+    if (count == 0 || buf == NULL || g_debug_info_buf == NULL)
+    {
+        printk("sc_debug_info_read_to_user:: (count == 0 || buf == NULL || g_debug_info_buf == NULL).\n");
+        return DEBUG_INFO_ERROR;
+    }
+
+    bufSize_used = GetRingBufferSize(g_debug_info_buf);
+    if (bufSize_used == 0)
+    {
+        // printk("sc_debug_info_read_to_user:: ringBuf is empty.\n");
+        return 0;
+    }
+
+    fileDataHead.head = 0x010a0a0a;
+    fileDataHead.time = 0;
+    fileDataHead.total_len = bufSize_used;
+
+    copy_to_user(buf, &fileDataHead, sizeof(T_SAVE_FILE_DATA));
+
+    readLen = ReadRingBuffer(g_debug_info_buf, (buf + sizeof(T_SAVE_FILE_DATA)), bufSize_used, ZCAT_MEM_TYPE_USER);
+    if (readLen == 0)
+    {
+        // printk("ReadRingBuffer failed.\n");
+        return 0;
+    }
+
+    return (readLen + sizeof(T_SAVE_FILE_DATA));
+}
+
+static int sc_debug_info_record_from_user(const char *info, unsigned short count)
+{
+    unsigned int cnt = 0;
+    unsigned int my_jiffies = jiffies;
+
+    if (g_init_flag == 0)
+    {
+        printk("debug_info not init.\n");
+        return DEBUG_INFO_ERROR;
+    }
+    if (info == NULL)
+    {
+        printk("sc_debug_info_record_from_user:: info is NULL.\n");
+        return DEBUG_INFO_ERROR;
+    }
+
+    copy_to_user(info + 4, &my_jiffies, sizeof(my_jiffies));
+    cnt = sc_debug_info_write(ZCAT_MEM_TYPE_USER, (UINT8 *)info, count);
+
+    return cnt;
+}
+
 module_init(debug_info_init);
 module_exit(debug_info_exit);
+
+MODULE_AUTHOR("jcw");
 MODULE_DESCRIPTION("debug_info driver");
 MODULE_LICENSE("GPL");
 
-#else
-int sc_debug_info_record(char *id, const char *format, ...)
+
+int sc_debug_info_vrecord(unsigned int id, const char *format, va_list args)
 {
-    return 0;
+    int len;
+    UINT32 writelen;
+    // va_list args;
+    char str_buf[DEBUG_INFO_MAX_TOTAL_LEN] __attribute__((aligned(4)));
+    T_SHARED_MEM_DATA *shareMemData = (T_SHARED_MEM_DATA *)str_buf;
+
+    if (g_init_flag == 0)
+    {
+        printk("debug_info not init.\n");
+        return DEBUG_INFO_ERROR;
+    }
+
+    /* args是一个char*类型指针,指向format之后的第一个参数*/
+    // va_start(args, format);
+    len = vsnprintf(shareMemData->sub_data, DEBUG_INFO_MAX_DATA_LEN, format, args);
+    // va_end(args);
+    if (len < 0)
+    {
+        printk("vsnprintf format error.\n");
+        return DEBUG_INFO_ERROR;
+    }
+
+    shareMemData->module_id = (UINT16)(id & 0xFFFF);
+    shareMemData->sub_len = len;
+    shareMemData->time = jiffies;
+
+    writelen = sc_debug_info_write(ZCAT_MEM_TYPE_KERNEL, (UINT8 *)shareMemData, len + sizeof(T_SHARED_MEM_DATA));
+    return writelen;
+}
+EXPORT_SYMBOL(sc_debug_info_vrecord);
+
+int sc_debug_info_record(unsigned int id, const char *format, ...)
+{
+    va_list args;
+	int r;
+
+	va_start(args, format);
+	r = sc_debug_info_vrecord(id, format, args);
+	va_end(args);
+
+
+    return r;
+}
+EXPORT_SYMBOL(sc_debug_info_record);
+#else
+int sc_debug_info_record(unsigned int id, const char *format, ...)
+{
+	return 0;
 }
 #endif   /*  _USE_ZXIC_DEBUG_INFO */
 
-
diff --git a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
index c7da7a4..2a8fcc3 100755
--- a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
+++ b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.c
@@ -8,7 +8,7 @@
 #include "zvnet_dev.h"

 #include "ram_config.h"

 #include <net/netfilter/nf_conntrack.h>

-#include <net/SI/fast_common.h>

+

 /*******************************************************************************

  *                             Macro definitions                               *

  ******************************************************************************/

@@ -72,8 +72,10 @@
 module_param(g_wrap_num, int, 0644);

 unsigned int g_wrap_timeout = 10;

 module_param(g_wrap_timeout, int, 0644);

+/*jb.qi add for debug network package on 20240806 start*/

 unsigned int g_trace_limit = 0;

 module_param(g_trace_limit, int, 0644);

+/*jb.qi add for debug network package on 20240806 end*/

 #endif

 

 /*******************************************************************************

@@ -83,6 +85,7 @@
 extern void v7_dma_map_area(const void *, size_t, int);

 extern void *get_ct_for_ap(struct sk_buff *skb);

 extern void put_ct_for_ap(void *ct);

+extern spinlock_t fast_fw_spinlock;

 /*******************************************************************************

  *					   Local function declarations						*

  ******************************************************************************/

@@ -125,41 +128,38 @@
 	return NULL;

 }

 

-/* Started by AICoder, pid:2fa080381bb2e3d14fbc0aa44091291a60d78e35 */

 void check_skb_test(struct sk_buff *skb)

 {

-    if (skb && vir_addr_ap) {

-        struct sk_buff *tmp_skb;

-        if ((skb->capHead && (virt_to_phys_ap(skb->head) == NULL))

-        || ((skb->capHead == NULL) && virt_to_phys_ap(skb->head))) {

-            dump_stack();

-            panic("capHead err");

-        }

-        skb_queue_walk(&g_zvnet_skb_queue, tmp_skb) {

-            if (tmp_skb == skb) {

-                dump_stack();

-                panic("dup free");

-            }

-        }

-    }

+	if(skb && vir_addr_ap){

+		struct sk_buff *tmp_skb;

+		if((skb->capHead && (virt_to_phys_ap(skb->head) == NULL))

+		|| ((skb->capHead == NULL) && virt_to_phys_ap(skb->head))){

+			dump_stack();

+			msleep(1000);

+			panic("capHead err");

+		}

+		skb_queue_walk(&g_zvnet_skb_queue, tmp_skb) {

+			if(tmp_skb == skb){

+				dump_stack();

+				msleep(1000);

+				panic("dup free");

+			}

+		}

+	}

 }

-/* Ended by AICoder, pid:2fa080381bb2e3d14fbc0aa44091291a60d78e35 */

-

-/* Started by AICoder, pid:z5702yf8bad07ad1448a083e806dc31250b2418f */

+/*jb.qi add for debug network package on 20240806 start*/

 void zvnet_dump_packet(unsigned char * data, int len, int limit_len)

 {

     int i = 0;

-    unsigned char *p = data;

-    for(i = 0; i < len && i < limit_len; i+=16)

+

+    for(i = 0; i < len && i < limit_len; i=i+16)

     {

-        printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,

-            p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],

-            p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]);

-        p += 16;

+        printk("0x%04x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",i,

+            *(data+i),*(data+i+1),*(data+i+2),*(data+i+3),*(data+i+4),*(data+i+5),*(data+i+6),*(data+i+7),

+            *(data+i+8),*(data+i+9),*(data+i+10),*(data+i+11),*(data+i+12),*(data+i+13),*(data+i+14),*(data+i+15));

     }

 }

-/* Ended by AICoder, pid:z5702yf8bad07ad1448a083e806dc31250b2418f */

-

+/*jb.qi add for debug network package on 20240806 end*/

 int zvnet_get_index_by_netdev(struct net_device *net)

 {

     int i;

@@ -304,11 +304,13 @@
 	/* make sure we initialize shinfo sequentially */

 	skb_reset_network_header(skb);

 	skb_set_kcov_handle(skb, kcov_common_handle());

+	/*jb.qi add for debug network package on 20240806 start*/

 	if(unlikely(g_trace_limit > 0)){

-		printk("-%s-dump_packet-start-%d\n", skb->dev->name, skb->len);

-		zvnet_dump_packet(skb->data, skb->len, g_trace_limit);

-		printk("-%s-dump_packet-end-\n", skb->dev->name);

-	}

+        	printk("-%s-dump_packet-start-%d\n", skb->dev->name, skb->len);

+        	zvnet_dump_packet(skb->data, skb->len, g_trace_limit);

+        	printk("-%s-dump_packet-end-\n", skb->dev->name);

+        }

+	/*jb.qi add for debug network package on 20240806 end*/

 	return skb;

 }

 

@@ -319,38 +321,33 @@
     return 0;

 }

 

-/* Started by AICoder, pid:b001dtf2551fd53146790a57201be3321cf0a682 */

 static void skb_debug_test(struct sk_buff *skb)

 {

     int i;

-    int vcount = skb->len / 10;

-    int rcount = skb->len % 10;

+    int vcount = skb->len/10;

+    int rcount = skb->len%10;

     char tmp[64] = {0};

     char strbuf[64] = {0};

-    const unsigned char *data = skb->data;

 

     zv_info("\n");

-    for (i = 0; i < vcount; i++) {

-        zv_info("%d---%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n", i,

-                data[0 + 10 * i], data[1 + 10 * i], data[2 + 10 * i], data[3 + 10 * i],

-                data[4 + 10 * i], data[5 + 10 * i], data[6 + 10 * i], data[7 + 10 * i],

-                data[8 + 10 * i], data[9 + 10 * i]);

+    for(i=0; i<vcount; i++) {

+        zv_info("%d---0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x\n",i,skb->data[0+10*i],skb->data[1+10*i],skb->data[2+10*i],

+                skb->data[3+10*i],skb->data[4+10*i],skb->data[5+10*i],skb->data[6+10*i],skb->data[7+10*i],skb->data[8+10*i],skb->data[9+10*i]);

     }

-    if (vcount > 0) {

-        memset(tmp, 0, sizeof(tmp));

-        sprintf(strbuf, "%d---", vcount);

-        char *p = strbuf + strlen(strbuf);

+    if(vcount > 0) {

+        memset(tmp,0,sizeof(tmp));

+        memset(strbuf,0,sizeof(strbuf));

+        sprintf(strbuf,"%d---",vcount);

 

-        for (i = 0; i < rcount; i++) {

-            sprintf(p, "%02x,", data[10 * vcount + i]);

-            p += strlen(p);

+        for(i=0; i<rcount; i++)

+        {

+            sprintf(tmp,"0x%x,",skb->data[10*vcount + i]);

+            strcat(strbuf,tmp);

         }

-        *(p - 1) = '\0'; // ÒÆ³ý×îºóÒ»¸ö¶ººÅ

-        zv_info("%s ", strbuf);

+        zv_info("%s ",strbuf);

     }

     zv_info("\n");

 }

-/* Ended by AICoder, pid:b001dtf2551fd53146790a57201be3321cf0a682 */

 

 static int zvnet_open(struct net_device *net)

 {

@@ -476,8 +473,8 @@
 		return NET_XMIT_SUCCESS;

 	}

 		

-	if(unlikely(skb->next//|| skb->capHead || skb_headroom(skb) < NET_SKB_PAD

-		|| skb->fclone || skb->cloned || (skb_shinfo(skb)->nr_frags) || skb->sk || (skb->indev == NULL)

+	if(unlikely(skb_headroom(skb) < NET_SKB_PAD || skb->next//|| skb->capHead

+		|| skb->fclone || skb->cloned || (skb_shinfo(skb)->nr_frags) || skb->sk || (skb->indev == NULL) 

 		|| (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) || (skb_has_frag_list(skb)))){

 		int ret_len = skb->len;

 

@@ -635,7 +632,6 @@
     .ndo_get_stats  = zvnet_get_stats,

     .ndo_change_mtu = eth_change_mtu,

     .ndo_validate_addr = eth_validate_addr,

-    .ndo_set_mac_address = eth_mac_addr,

 };

 

 static void v2xnet_init_netdev(struct net_device *net)

@@ -806,32 +802,30 @@
 {

     struct sk_buff *skb;

 #if 0

-/* Started by AICoder, pid:sd1cfsbc2eu87c41445f09652039f525fa147687 */

-int ret_len = 0;

-struct sk_buff *skb;

+    char skb_data[ZVNET_TMP_BUFF_LEN];

+    int ret_len = 0;

 

-ret_len = zvnet_channel_read(chninfo, NULL, 0); // »ñÈ¡ÐèÒª¶ÁÈ¡µÄÊý¾Ý³¤¶È

-if(ret_len <= 0) {

-    zv_err("zvnet_channel_read fail.\n");

-    return NULL;

-}

+    if(NULL == chninfo || NULL == dev) {

+        zv_err("zvnet_channel_read null.\n");

+        return NULL;

+    }

 

-skb = dev_alloc_skb(ret_len + ZVNET_SKB_PAD);

-if (unlikely(!skb)) {

-    zv_err("netdev_alloc_skb fail,len %d",ret_len);

-    return NULL;

-}

+    ret_len = zvnet_channel_read(chninfo, (void *)skb_data, sizeof(skb_data));

 

-ret_len = zvnet_channel_read(chninfo, skb->data, ret_len); // ¶ÁÈ¡Êý¾Ýµ½skb->data

-if(ret_len <= 0) {

-    kfree_skb(skb); // Èç¹û¶Áȡʧ°Ü£¬ÊÍ·ÅÒÑ·ÖÅäµÄskb

-    zv_err("zvnet_channel_read fail.\n");

-    return NULL;

-}

+    if(ret_len <= 0) {

+        zv_err("zvnet_channel_read fail.\n");

+        return NULL;

+    }

 

-skb_put(skb,ret_len);

-skb_reserve(skb, ZVNET_SKB_PAD);

-/* Ended by AICoder, pid:sd1cfsbc2eu87c41445f09652039f525fa147687 */

+    skb = dev_alloc_skb(ret_len + ZVNET_SKB_PAD);

+    if (unlikely(!skb)) {

+        zv_err("netdev_alloc_skb fail,len %d",ret_len);

+        return NULL;

+    }

+

+    skb_put(skb,ret_len);

+    skb_reserve(skb, ZVNET_SKB_PAD);

+    memcpy(skb->data, &skb_data[0], ret_len);

 #else

 	struct T_zvnet_rpmsg buff = {0};

 	int ret_len = 0;

@@ -1105,9 +1099,6 @@
 							.flag = 0};

 	int ret_len = 0;

 	struct nf_conn *ct;

-	fast_entry_t *entry;

-	struct net_device *in;

-	struct net_device *out;

 	

 	while(1) {

 		struct T_zvnet_rpmsg_ctstat buff = {0};

@@ -1124,104 +1115,33 @@
 			panic("err, ret:%d!!!!!!", ret_len);	

 		}

 		ct = (struct nf_conn *)buff.cap_nfct;

+		

 		WARN_ON(atomic_read(&ct->ct_general.use) == 0);

 		if(buff.flag){

-			if(!(buff.pkt[0].pkt || buff.pkt[0].len || buff.pkt[1].pkt || buff.pkt[1].len))

-				continue;

 			BUG_ON(buff.in <= 0 || buff.out <= 0);

-			in = zvnet_dev[buff.in-1].net;

-			out = zvnet_dev[buff.out-1].net;

 			if(buff.pkt[0].pkt && buff.pkt[0].len){

 				zv_info("nf_update %x %s %s %d %d", buff.cap_nfct, ct->indev[0]->name, ct->outdev[0]->name, buff.in, buff.out);

-				in->stats.rx_packets += buff.pkt[0].pkt;

-				in->stats.rx_bytes += buff.pkt[0].len;

-				out->stats.tx_packets += buff.pkt[0].pkt;

-				out->stats.tx_bytes += buff.pkt[0].len;

+				zvnet_dev[buff.in-1].net->stats.rx_packets += buff.pkt[0].pkt;

+				zvnet_dev[buff.in-1].net->stats.rx_bytes += buff.pkt[0].len;

+				zvnet_dev[buff.out-1].net->stats.tx_packets += buff.pkt[0].pkt;

+				zvnet_dev[buff.out-1].net->stats.tx_bytes += buff.pkt[0].len;

 			}

 			if(buff.pkt[1].pkt && buff.pkt[1].len){

 				zv_info("nf_update %x %s %s %d %d", buff.cap_nfct, ct->indev[1]->name, ct->outdev[1]->name, buff.out, buff.in);

-				out->stats.rx_packets += buff.pkt[1].pkt;

-				out->stats.rx_bytes += buff.pkt[1].len;

-				in->stats.tx_packets += buff.pkt[1].pkt;

-				in->stats.tx_bytes += buff.pkt[1].len;

+				zvnet_dev[buff.out-1].net->stats.rx_packets += buff.pkt[1].pkt;

+				zvnet_dev[buff.out-1].net->stats.rx_bytes += buff.pkt[1].len;

+				zvnet_dev[buff.in-1].net->stats.tx_packets += buff.pkt[1].pkt;

+				zvnet_dev[buff.in-1].net->stats.tx_bytes += buff.pkt[1].len;

 			}

 			spin_lock_bh(&fast_fw_spinlock);

-			/*¸üÐÂÁ´½Ó³¬Ê±*/

-			if (IPPROTO_TCP == nf_ct_protonum(ct))

-			{

-				ct->timeout = jiffies + tcp_timeouts[ct->proto.tcp.state];

-			}else if (IPPROTO_UDP == nf_ct_protonum(ct)){

-				/*udp*/

-				if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)){

-					ct->timeout = jiffies + fast_udp_timeout_stream;

-				}else{

-					ct->timeout = jiffies + fast_udp_timeout;

-				}

-			}

-			entry = (fast_entry_t *)ct->fast_entry;

-			if(entry){

-				WARN_ON(entry->ct != ct);

-				mod_timer(&entry->timeout, ct->timeout);

-			}

 			ct->packet_info[IP_CT_DIR_ORIGINAL].bytes += buff.pkt[IP_CT_DIR_ORIGINAL].len;

 			ct->packet_info[IP_CT_DIR_ORIGINAL].packets += buff.pkt[IP_CT_DIR_ORIGINAL].pkt;

 			ct->packet_info[IP_CT_DIR_REPLY].bytes += buff.pkt[IP_CT_DIR_REPLY].len;

 			ct->packet_info[IP_CT_DIR_REPLY].packets += buff.pkt[IP_CT_DIR_REPLY].pkt;

-			if(ct->indev[0] && is_vlan_dev(ct->indev[0])){

-				struct net_device *tmp = vlan_dev_real_dev(ct->indev[0]);

-				struct vlan_pcpu_stats *stats = this_cpu_ptr(vlan_dev_priv(ct->indev[0])->vlan_pcpu_stats);

-

-				if(tmp == in){

-/* Started by AICoder, pid:tbef0151bf4135d1479d0a5d108c870bc756e858 */

-u64_stats_update_begin(&stats->syncp);

-stats->rx_packets += buff.pkt[0].pkt;

-stats->rx_bytes += buff.pkt[0].len;

-stats->tx_packets += buff.pkt[1].pkt;

-stats->tx_bytes += buff.pkt[1].len;

-u64_stats_update_end(&stats->syncp);

-/* Ended by AICoder, pid:tbef0151bf4135d1479d0a5d108c870bc756e858 */

-				}else if(tmp == out){

-/* Started by AICoder, pid:y34f7id6bcs049f144f10bb8a05c9703b196635b */

-u64_stats_update_begin(&stats->syncp);

-stats->tx_packets += buff.pkt[0].pkt;

-stats->tx_bytes += buff.pkt[0].len;

-stats->rx_packets += buff.pkt[1].pkt;

-stats->rx_bytes += buff.pkt[1].len;

-u64_stats_update_end(&stats->syncp);

-/* Ended by AICoder, pid:y34f7id6bcs049f144f10bb8a05c9703b196635b */

-				}else

-					zv_err("nf_update0 %s->%s!=%s-%s", in->name, out->name, tmp->name, ct->indev[0]->name);

-			}

-			if(ct->indev[1] && is_vlan_dev(ct->indev[1])){

-				struct net_device *tmp = vlan_dev_real_dev(ct->indev[1]);

-				struct vlan_pcpu_stats *stats = this_cpu_ptr(vlan_dev_priv(ct->indev[1])->vlan_pcpu_stats);

-

-				if(tmp == in){

-/* Started by AICoder, pid:8bef0t51bfu135d1479d0a5d108c870bc756e858 */

-u64_stats_update_begin(&stats->syncp);

-stats->rx_packets += buff.pkt[0].pkt;

-stats->rx_bytes += buff.pkt[0].len;

-stats->tx_packets += buff.pkt[1].pkt;

-stats->tx_bytes += buff.pkt[1].len;

-u64_stats_update_end(&stats->syncp);

-/* Ended by AICoder, pid:8bef0t51bfu135d1479d0a5d108c870bc756e858 */

-				}else if(tmp == out){

-/* Started by AICoder, pid:934f7zd6bcl049f144f10bb8a05c9703b196635b */

-u64_stats_update_begin(&stats->syncp);

-stats->tx_packets += buff.pkt[0].pkt;

-stats->tx_bytes += buff.pkt[0].len;

-stats->rx_packets += buff.pkt[1].pkt;

-stats->rx_bytes += buff.pkt[1].len;

-u64_stats_update_end(&stats->syncp);

-/* Ended by AICoder, pid:934f7zd6bcl049f144f10bb8a05c9703b196635b */

-				}else

-					zv_err("nf_update1 %s->%s!=%s-%s", in->name, out->name, tmp->name, ct->indev[1]->name);

-			}

 			spin_unlock_bh(&fast_fw_spinlock);

 			zv_info("nf_update %x %d %d %d %d", buff.cap_nfct, buff.pkt[0].pkt, buff.pkt[0].len, buff.pkt[1].pkt, buff.pkt[1].len);

 		}else{

 			zv_info("nf_put %x", buff.cap_nfct);

-			WRITE_ONCE(ct->timeout, nfct_time_stamp);

 			nf_conntrack_put(buff.cap_nfct);

 		}

 	}

@@ -1259,11 +1179,11 @@
             return err;

         }

 

-        //net->needed_headroom += ZVNET_SKB_PAD;//NET_SKB_PAD;

+        net->needed_headroom += ZVNET_SKB_PAD;//NET_SKB_PAD;

         sprintf(net->name, "%s%d", ZVNET_IFNAME_PREFIX, i);

         dev = v2xnet_dev_init(net, zvnetdev);

         v2xnet_init_netdev(net);

-		if(0 == i || i > 8){

+		if(0 == i){

 			net->flags = (net->flags & (~IFF_NOARP));

 		}

         err = register_netdev(net);

diff --git a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.h b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.h
index 7c46dd3..d1feaa5 100755
--- a/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.h
+++ b/upstream/linux-5.10/drivers/net/zvnet/zvnet_dev.h
@@ -27,7 +27,7 @@
 	__func__ , ## arg)

 

 //zvnetÉ豸×î´óÊý

-#define DDR_ZVNET_DEV_MAX 16

+#define DDR_ZVNET_DEV_MAX 10

 #define ZVNET_IFNAME_PREFIX "zvnet"

 

 #define  ICP_CHN_ZVNET1 20 //ICP_CHANNEL_WAN1

diff --git a/upstream/linux-5.10/drivers/rtc/class.c b/upstream/linux-5.10/drivers/rtc/class.c
index 87310ce..625effe 100755
--- a/upstream/linux-5.10/drivers/rtc/class.c
+++ b/upstream/linux-5.10/drivers/rtc/class.c
@@ -19,7 +19,6 @@
 #include <linux/workqueue.h>
 
 #include "rtc-core.h"
-#include "pub_debug_info.h"
 
 static DEFINE_IDA(rtc_ida);
 struct class *rtc_class;
@@ -81,7 +80,7 @@
 #endif
 
 	err = do_settimeofday64(&tv64);
-	sc_debug_info_record("hctosys", "time synchronization successful!\r\n");
+
 	dev_info(rtc->dev.parent, "setting system clock to %ptR UTC (%lld)\n",
 		 &tm, (long long)tv64.tv_sec);
 
diff --git a/upstream/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c b/upstream/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
index f9b23d7..66c8cf3 100755
--- a/upstream/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
+++ b/upstream/linux-5.10/drivers/soc/sc/pcu/pcu-zx297520v3.c
@@ -37,7 +37,6 @@
 #include <linux/soc/sc/rpmsg.h>
 #include <dt-bindings/soc/zx297520v3-irq.h>
 #include <uapi/linux/sc_bsp/bsp_api.h>
-#include <pub_debug_info.h>
 
 #include "pcu-common.h"
 
@@ -706,7 +705,6 @@
 	if(index_found != 0xff)
 	{
 		pm_ram_log(" wake: %d  [%s]\n", zx297520v3_pcu_int_info[index_found].gic_index, zx297520v3_pcu_int_info[index_found].int_name);
-		sc_debug_info_record(MODULE_ID_CAP_PM, " wake: %d  [%s]\n", zx297520v3_pcu_int_info[index_found].gic_index, zx297520v3_pcu_int_info[index_found].int_name);
 
 		if(zx297520v3_pcu_int_info[index_found].gic_index ==ICP_PS2AP_INT) {
 			show_icp_state(CORE_PS0);
diff --git a/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c b/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
index 3c5ba58..aae42a2 100755
--- a/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
+++ b/upstream/linux-5.10/drivers/soc/sc/rpmsg/zx29_icp.c
@@ -15,7 +15,6 @@
 #include <linux/pm_runtime.h>
 #include <linux/soc/sc/common.h>
 #include <linux/soc/sc/spinlock.h>
-#include <pub_debug_info.h>
 
 #include "icp_dev.h"
 #include "zx29_icp.h"
@@ -335,7 +334,6 @@
 
 	icp_get_int_info(actorID, &hw, &lw);
 	pr_info("[SLP] icpwake: 0x%x 0x%x\n", hw, lw);
-	sc_debug_info_record(MODULE_ID_CAP_PM, " icpwake: 0x%x 0x%x\n", hw, lw);
 
 	for (i=0; i<32; i++)
 		if (lw&BIT(i))
diff --git a/upstream/linux-5.10/drivers/spi/spi-zx29.c b/upstream/linux-5.10/drivers/spi/spi-zx29.c
index 57600dc..fd49fd6 100755
--- a/upstream/linux-5.10/drivers/spi/spi-zx29.c
+++ b/upstream/linux-5.10/drivers/spi/spi-zx29.c
@@ -2341,9 +2341,7 @@
 	.iface = SPI_INTERFACE_MOTOROLA_SPI,
 	.hierarchy = SPI_MASTER,
 	.slave_tx_disable = DO_NOT_DRIVE_TX,
-	/* yu.dong@20240521 [T106BUG-616] SPI set to slave mode for read will get stuck start */
 	.rx_lev_trig = SPI_RX_8_OR_MORE_ELEM,
-	/* yu.dong@20240521 [T106BUG-616] SPI set to slave mode for read will get stuck end */
 	.tx_lev_trig = SPI_TX_4_OR_MORE_EMPTY_LOC,
 //	.ctrl_len = SSP_BITS_8,
 //	.wait_state = SSP_MWIRE_WAIT_ZERO,
diff --git a/upstream/linux-5.10/drivers/tty/tty_io.c b/upstream/linux-5.10/drivers/tty/tty_io.c
index 8591d06..669aef7 100755
--- a/upstream/linux-5.10/drivers/tty/tty_io.c
+++ b/upstream/linux-5.10/drivers/tty/tty_io.c
@@ -771,12 +771,6 @@
 	if (tty->stopped)
 		return;
 	tty->stopped = 1;
-	
-	//l.yang add log for bug T106-134 start
-	if(tty->index == 1){
-		printk("__stop_tty got stop cmd\n");
-	}
-	//l.yang add log for bug T106-134 end
 	if (tty->ops->stop)
 		tty->ops->stop(tty);
 }