1 # Handoff queue demo plugin {#handoff_queue_demo_plugin}
3 This plugin provides a simplified example of how to hand off
4 packets between threads. I used it to debug packet-tracer handoff
7 # Packet generator input script
10 packet-generator new {
21 # Start vpp with 2 worker threads
23 The demo plugin hands packets from worker 1 to worker 2.
25 # Enable tracing, and start the packet generator
28 trace add pg-input 100
29 packet-generator enable
35 DBGvpp# ex /tmp/pg_input_script
39 5 handoffdemo-1 packets handed off processed
40 5 handoffdemo-2 completed packets
42 Thread 1 vpp_wk_0 (lcore 0)
43 Time 133.9, average vectors/node 5.00, last 128 main loops 0.00 per node 0.00
44 vector rates in 3.7331e-2, out 0.0000e0, drop 0.0000e0, punt 0.0000e0
45 Name State Calls Vectors Suspends Clocks Vectors/Call
46 handoffdemo-1 active 1 5 0 4.76e3 5.00
47 pg-input disabled 2 5 0 5.58e4 2.50
48 unix-epoll-input polling 22760 0 0 2.14e7 0.00
50 Thread 2 vpp_wk_1 (lcore 2)
51 Time 133.9, average vectors/node 5.00, last 128 main loops 0.00 per node 0.00
52 vector rates in 0.0000e0, out 0.0000e0, drop 3.7331e-2, punt 0.0000e0
53 Name State Calls Vectors Suspends Clocks Vectors/Call
54 drop active 1 5 0 1.35e4 5.00
55 error-drop active 1 5 0 2.52e4 5.00
56 handoffdemo-2 active 1 5 0 2.56e4 5.00
57 unix-epoll-input polling 22406 0 0 2.18e7 0.00
60 Enable the packet tracer and run it again...
63 DBGvpp# trace add pg-input 100
67 ------------------- Start of thread 0 vpp_main -------------------
68 No packets in trace buffer
69 ------------------- Start of thread 1 vpp_wk_0 -------------------
72 00:06:50:520688: pg-input
73 stream x, 128 bytes, 0 sw_if_index
74 current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000000
75 00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
76 00000020: 0000000000000000000000000000000000000000000000000000000000000000
77 00000040: 0000000000000000000000000000000000000000000000000000000000000000
78 00000060: 0000000000000000000000000000000000000000000000000000000000000000
79 00:06:50:520762: handoffdemo-1
80 HANDOFFDEMO: current thread 1
84 00:06:50:520688: pg-input
85 stream x, 128 bytes, 0 sw_if_index
86 current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000001
87 00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
88 00000020: 0000000000000000000000000000000000000000000000000000000000000000
89 00000040: 0000000000000000000000000000000000000000000000000000000000000000
90 00000060: 0000000000000000000000000000000000000000000000000000000000000000
91 00:06:50:520762: handoffdemo-1
92 HANDOFFDEMO: current thread 1
96 00:06:50:520688: pg-input
97 stream x, 128 bytes, 0 sw_if_index
98 current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000002
99 00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
100 00000020: 0000000000000000000000000000000000000000000000000000000000000000
101 00000040: 0000000000000000000000000000000000000000000000000000000000000000
102 00000060: 0000000000000000000000000000000000000000000000000000000000000000
103 00:06:50:520762: handoffdemo-1
104 HANDOFFDEMO: current thread 1
108 00:06:50:520688: pg-input
109 stream x, 128 bytes, 0 sw_if_index
110 current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000003
111 00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
112 00000020: 0000000000000000000000000000000000000000000000000000000000000000
113 00000040: 0000000000000000000000000000000000000000000000000000000000000000
114 00000060: 0000000000000000000000000000000000000000000000000000000000000000
115 00:06:50:520762: handoffdemo-1
116 HANDOFFDEMO: current thread 1
120 00:06:50:520688: pg-input
121 stream x, 128 bytes, 0 sw_if_index
122 current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000004
123 00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
124 00000020: 0000000000000000000000000000000000000000000000000000000000000000
125 00000040: 0000000000000000000000000000000000000000000000000000000000000000
126 00000060: 0000000000000000000000000000000000000000000000000000000000000000
127 00:06:50:520762: handoffdemo-1
128 HANDOFFDEMO: current thread 1
130 ------------------- Start of thread 2 vpp_wk_1 -------------------
133 00:06:50:520796: handoff_trace
134 HANDED-OFF: from thread 1 trace index 0
135 00:06:50:520796: handoffdemo-2
136 HANDOFFDEMO: current thread 2
137 00:06:50:520867: error-drop
139 00:06:50:520914: drop
140 handoffdemo-2: completed packets
144 00:06:50:520796: handoff_trace
145 HANDED-OFF: from thread 1 trace index 1
146 00:06:50:520796: handoffdemo-2
147 HANDOFFDEMO: current thread 2
148 00:06:50:520867: error-drop
150 00:06:50:520914: drop
151 handoffdemo-2: completed packets
155 00:06:50:520796: handoff_trace
156 HANDED-OFF: from thread 1 trace index 2
157 00:06:50:520796: handoffdemo-2
158 HANDOFFDEMO: current thread 2
159 00:06:50:520867: error-drop
161 00:06:50:520914: drop
162 handoffdemo-2: completed packets
166 00:06:50:520796: handoff_trace
167 HANDED-OFF: from thread 1 trace index 3
168 00:06:50:520796: handoffdemo-2
169 HANDOFFDEMO: current thread 2
170 00:06:50:520867: error-drop
172 00:06:50:520914: drop
173 handoffdemo-2: completed packets
177 00:06:50:520796: handoff_trace
178 HANDED-OFF: from thread 1 trace index 4
179 00:06:50:520796: handoffdemo-2
180 HANDOFFDEMO: current thread 2
181 00:06:50:520867: error-drop
183 00:06:50:520914: drop
184 handoffdemo-2: completed packets