From: Tang Longjun <[email protected]>

introduces the building and running methods of virtnet_mon, and also
explains the key implementation points.

Signed-off-by: Tang Longjun <[email protected]>
---
 tools/virtio/virtnet_mon/README | 35 +++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 tools/virtio/virtnet_mon/README

diff --git a/tools/virtio/virtnet_mon/README b/tools/virtio/virtnet_mon/README
new file mode 100644
index 000000000000..a1f6a5ebd219
--- /dev/null
+++ b/tools/virtio/virtnet_mon/README
@@ -0,0 +1,35 @@
+virtnet_mon is used to monitor the data packets of the virtio_net driver and 
the related parameters of virtqueue, useful for tracking its status and 
troubleshooting faults.
+
+Build and Execution
+===============
+)Build and Execution
+$ make
+2)Load virtnet_mon
+$ insmod virtnet_mon.ko
+3)Obtain log
+$ tail -f /dev/virtnet_mon | tee -a log
+
+
+Example
+=======
+76748.877337321 cpu=5 dir=TX event_type=SKB_XMIT_DONE_PRE_EVENT 
vq=0xffff0000c43e0800 queue=output.2 num_free=255 num=256 avail_flags=0 
avail_idx=17411 avail_flags_shadow=0 avail_idx_shadow=17411 used_flags=0 
used_idx=17411 last_used_idx=17410 broken=0
+76749.357149745 cpu=4 dir=RX event_type=GRO_RECEIVE_SKB_PRE_EVENT 
vq=0xffff0000c43e0d00 queue=input.2 num_free=4 num=256 avail_flags=0 
avail_idx=57294 avail_flags_shadow=1 avail_idx_shadow=57294 used_flags=1 
used_idx=57042 last_used_idx=57042 broken=0
+76749.750030740 cpu=4 dir=TX event_type=START_XMIT_PRE_EVENT 
skb=0xffff0000d354f700 proto=Unknown seq=0 vq=0xffff0000c43e0800 queue=output.2 
num_free=256 num=256 avail_flags=0 avail_idx=17411 avail_flags_shadow=0 
avail_idx_shadow=17411 used_flags=0 used_idx=17411 last_used_idx=17411 broken=0
+
+
+Implementation Key Points of virtnet_mon
+================================
+1)Create a misc type driver for transferring log information between user 
space and kernel space.
+2)Introduce kfifo buffers to support more frequent log output or file writing.
+3)Use kprobe to trace the functional interfaces of virtio_net to obtain the 
relevant parameters of skb and virtqueue.
+
+
+Next Steps
+========
+1)Add real-time monitor of skb and virtqueue parameters to promptly report 
faults, such as:
+    a) virtqueue.broken
+    b) virtqueue.num_free
+    c) vring used.idx
+    d) ...
+2)Support dynamic control to enable/disable functions through echo xxx > 
/dev/virtnet_mon.
+3)More comprehensive monitoring information virtnet_mon_pkt_info.
-- 
2.43.0


Reply via email to