[Feature][T106][task-view-124]add debug log for network package data

Only Configure: No
Affected branch: master
Affected module: network
Is it affected on both ZXIC and MTK: only zxic
Self-test: Yes
Doc Update: No]add debug log for network package data

Change-Id: I79476c5a28be090d8fd766a6f87bee2a7303cf4d
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
index ffdba06..2a8fcc3 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/zvnet/zvnet_dev.c
@@ -72,6 +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

 

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

@@ -143,7 +147,19 @@
 		}

 	}

 }

+/*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;

 

+    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 %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));

+    }

+}

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

 int zvnet_get_index_by_netdev(struct net_device *net)

 {

     int i;

@@ -288,6 +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);

+        }

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

 	return skb;

 }