xref: /openbmc/linux/Documentation/networking/pktgen.rst (revision 762f99f4f3cb41a775b5157dd761217beba65873)
1c1e4535fSMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
2c1e4535fSMauro Carvalho Chehab
3c1e4535fSMauro Carvalho Chehab====================================
4c1e4535fSMauro Carvalho ChehabHOWTO for the linux packet generator
5c1e4535fSMauro Carvalho Chehab====================================
6c1e4535fSMauro Carvalho Chehab
7c1e4535fSMauro Carvalho ChehabEnable CONFIG_NET_PKTGEN to compile and build pktgen either in-kernel
8c1e4535fSMauro Carvalho Chehabor as a module.  A module is preferred; modprobe pktgen if needed.  Once
9c1e4535fSMauro Carvalho Chehabrunning, pktgen creates a thread for each CPU with affinity to that CPU.
10c1e4535fSMauro Carvalho ChehabMonitoring and controlling is done via /proc.  It is easiest to select a
11c1e4535fSMauro Carvalho Chehabsuitable sample script and configure that.
12c1e4535fSMauro Carvalho Chehab
13c1e4535fSMauro Carvalho ChehabOn a dual CPU::
14c1e4535fSMauro Carvalho Chehab
15c1e4535fSMauro Carvalho Chehab    ps aux | grep pkt
16c1e4535fSMauro Carvalho Chehab    root       129  0.3  0.0     0    0 ?        SW    2003 523:20 [kpktgend_0]
17c1e4535fSMauro Carvalho Chehab    root       130  0.3  0.0     0    0 ?        SW    2003 509:50 [kpktgend_1]
18c1e4535fSMauro Carvalho Chehab
19c1e4535fSMauro Carvalho Chehab
20c1e4535fSMauro Carvalho ChehabFor monitoring and control pktgen creates::
21c1e4535fSMauro Carvalho Chehab
22c1e4535fSMauro Carvalho Chehab	/proc/net/pktgen/pgctrl
23c1e4535fSMauro Carvalho Chehab	/proc/net/pktgen/kpktgend_X
24c1e4535fSMauro Carvalho Chehab	/proc/net/pktgen/ethX
25c1e4535fSMauro Carvalho Chehab
26c1e4535fSMauro Carvalho Chehab
27c1e4535fSMauro Carvalho ChehabTuning NIC for max performance
28c1e4535fSMauro Carvalho Chehab==============================
29c1e4535fSMauro Carvalho Chehab
30c1e4535fSMauro Carvalho ChehabThe default NIC settings are (likely) not tuned for pktgen's artificial
31c1e4535fSMauro Carvalho Chehaboverload type of benchmarking, as this could hurt the normal use-case.
32c1e4535fSMauro Carvalho Chehab
33c1e4535fSMauro Carvalho ChehabSpecifically increasing the TX ring buffer in the NIC::
34c1e4535fSMauro Carvalho Chehab
35c1e4535fSMauro Carvalho Chehab # ethtool -G ethX tx 1024
36c1e4535fSMauro Carvalho Chehab
37c1e4535fSMauro Carvalho ChehabA larger TX ring can improve pktgen's performance, while it can hurt
38c1e4535fSMauro Carvalho Chehabin the general case, 1) because the TX ring buffer might get larger
39c1e4535fSMauro Carvalho Chehabthan the CPU's L1/L2 cache, 2) because it allows more queueing in the
40c1e4535fSMauro Carvalho ChehabNIC HW layer (which is bad for bufferbloat).
41c1e4535fSMauro Carvalho Chehab
42c1e4535fSMauro Carvalho ChehabOne should hesitate to conclude that packets/descriptors in the HW
43c1e4535fSMauro Carvalho ChehabTX ring cause delay.  Drivers usually delay cleaning up the
44c1e4535fSMauro Carvalho Chehabring-buffers for various performance reasons, and packets stalling
45c1e4535fSMauro Carvalho Chehabthe TX ring might just be waiting for cleanup.
46c1e4535fSMauro Carvalho Chehab
47c1e4535fSMauro Carvalho ChehabThis cleanup issue is specifically the case for the driver ixgbe
48c1e4535fSMauro Carvalho Chehab(Intel 82599 chip).  This driver (ixgbe) combines TX+RX ring cleanups,
49c1e4535fSMauro Carvalho Chehaband the cleanup interval is affected by the ethtool --coalesce setting
50c1e4535fSMauro Carvalho Chehabof parameter "rx-usecs".
51c1e4535fSMauro Carvalho Chehab
52c1e4535fSMauro Carvalho ChehabFor ixgbe use e.g. "30" resulting in approx 33K interrupts/sec (1/30*10^6)::
53c1e4535fSMauro Carvalho Chehab
54c1e4535fSMauro Carvalho Chehab # ethtool -C ethX rx-usecs 30
55c1e4535fSMauro Carvalho Chehab
56c1e4535fSMauro Carvalho Chehab
57c1e4535fSMauro Carvalho ChehabKernel threads
58c1e4535fSMauro Carvalho Chehab==============
59c1e4535fSMauro Carvalho ChehabPktgen creates a thread for each CPU with affinity to that CPU.
60c1e4535fSMauro Carvalho ChehabWhich is controlled through procfile /proc/net/pktgen/kpktgend_X.
61c1e4535fSMauro Carvalho Chehab
62c1e4535fSMauro Carvalho ChehabExample: /proc/net/pktgen/kpktgend_0::
63c1e4535fSMauro Carvalho Chehab
64c1e4535fSMauro Carvalho Chehab Running:
65c1e4535fSMauro Carvalho Chehab Stopped: eth4@0
66c1e4535fSMauro Carvalho Chehab Result: OK: add_device=eth4@0
67c1e4535fSMauro Carvalho Chehab
68c1e4535fSMauro Carvalho ChehabMost important are the devices assigned to the thread.
69c1e4535fSMauro Carvalho Chehab
70c1e4535fSMauro Carvalho ChehabThe two basic thread commands are:
71c1e4535fSMauro Carvalho Chehab
72c1e4535fSMauro Carvalho Chehab * add_device DEVICE@NAME -- adds a single device
73c1e4535fSMauro Carvalho Chehab * rem_device_all         -- remove all associated devices
74c1e4535fSMauro Carvalho Chehab
75c1e4535fSMauro Carvalho ChehabWhen adding a device to a thread, a corresponding procfile is created
76c1e4535fSMauro Carvalho Chehabwhich is used for configuring this device. Thus, device names need to
77c1e4535fSMauro Carvalho Chehabbe unique.
78c1e4535fSMauro Carvalho Chehab
79c1e4535fSMauro Carvalho ChehabTo support adding the same device to multiple threads, which is useful
80c1e4535fSMauro Carvalho Chehabwith multi queue NICs, the device naming scheme is extended with "@":
81c1e4535fSMauro Carvalho Chehabdevice@something
82c1e4535fSMauro Carvalho Chehab
83c1e4535fSMauro Carvalho ChehabThe part after "@" can be anything, but it is custom to use the thread
84c1e4535fSMauro Carvalho Chehabnumber.
85c1e4535fSMauro Carvalho Chehab
86c1e4535fSMauro Carvalho ChehabViewing devices
87c1e4535fSMauro Carvalho Chehab===============
88c1e4535fSMauro Carvalho Chehab
89c1e4535fSMauro Carvalho ChehabThe Params section holds configured information.  The Current section
90c1e4535fSMauro Carvalho Chehabholds running statistics.  The Result is printed after a run or after
91c1e4535fSMauro Carvalho Chehabinterruption.  Example::
92c1e4535fSMauro Carvalho Chehab
93c1e4535fSMauro Carvalho Chehab    /proc/net/pktgen/eth4@0
94c1e4535fSMauro Carvalho Chehab
95c1e4535fSMauro Carvalho Chehab    Params: count 100000  min_pkt_size: 60  max_pkt_size: 60
96c1e4535fSMauro Carvalho Chehab	frags: 0  delay: 0  clone_skb: 64  ifname: eth4@0
97c1e4535fSMauro Carvalho Chehab	flows: 0 flowlen: 0
98c1e4535fSMauro Carvalho Chehab	queue_map_min: 0  queue_map_max: 0
99c1e4535fSMauro Carvalho Chehab	dst_min: 192.168.81.2  dst_max:
100c1e4535fSMauro Carvalho Chehab	src_min:   src_max:
101c1e4535fSMauro Carvalho Chehab	src_mac: 90:e2:ba:0a:56:b4 dst_mac: 00:1b:21:3c:9d:f8
102c1e4535fSMauro Carvalho Chehab	udp_src_min: 9  udp_src_max: 109  udp_dst_min: 9  udp_dst_max: 9
103c1e4535fSMauro Carvalho Chehab	src_mac_count: 0  dst_mac_count: 0
104c1e4535fSMauro Carvalho Chehab	Flags: UDPSRC_RND  NO_TIMESTAMP  QUEUE_MAP_CPU
105c1e4535fSMauro Carvalho Chehab    Current:
106c1e4535fSMauro Carvalho Chehab	pkts-sofar: 100000  errors: 0
107c1e4535fSMauro Carvalho Chehab	started: 623913381008us  stopped: 623913396439us idle: 25us
108c1e4535fSMauro Carvalho Chehab	seq_num: 100001  cur_dst_mac_offset: 0  cur_src_mac_offset: 0
109c1e4535fSMauro Carvalho Chehab	cur_saddr: 192.168.8.3  cur_daddr: 192.168.81.2
110c1e4535fSMauro Carvalho Chehab	cur_udp_dst: 9  cur_udp_src: 42
111c1e4535fSMauro Carvalho Chehab	cur_queue_map: 0
112c1e4535fSMauro Carvalho Chehab	flows: 0
113c1e4535fSMauro Carvalho Chehab    Result: OK: 15430(c15405+d25) usec, 100000 (60byte,0frags)
114c1e4535fSMauro Carvalho Chehab    6480562pps 3110Mb/sec (3110669760bps) errors: 0
115c1e4535fSMauro Carvalho Chehab
116c1e4535fSMauro Carvalho Chehab
117c1e4535fSMauro Carvalho ChehabConfiguring devices
118c1e4535fSMauro Carvalho Chehab===================
119c1e4535fSMauro Carvalho ChehabThis is done via the /proc interface, and most easily done via pgset
120c1e4535fSMauro Carvalho Chehabas defined in the sample scripts.
121c1e4535fSMauro Carvalho ChehabYou need to specify PGDEV environment variable to use functions from sample
122c1e4535fSMauro Carvalho Chehabscripts, i.e.::
123c1e4535fSMauro Carvalho Chehab
124c1e4535fSMauro Carvalho Chehab    export PGDEV=/proc/net/pktgen/eth4@0
125c1e4535fSMauro Carvalho Chehab    source samples/pktgen/functions.sh
126c1e4535fSMauro Carvalho Chehab
127c1e4535fSMauro Carvalho ChehabExamples::
128c1e4535fSMauro Carvalho Chehab
129c1e4535fSMauro Carvalho Chehab pg_ctrl start           starts injection.
130c1e4535fSMauro Carvalho Chehab pg_ctrl stop            aborts injection. Also, ^C aborts generator.
131c1e4535fSMauro Carvalho Chehab
132c1e4535fSMauro Carvalho Chehab pgset "clone_skb 1"     sets the number of copies of the same packet
133c1e4535fSMauro Carvalho Chehab pgset "clone_skb 0"     use single SKB for all transmits
134c1e4535fSMauro Carvalho Chehab pgset "burst 8"         uses xmit_more API to queue 8 copies of the same
135c1e4535fSMauro Carvalho Chehab			 packet and update HW tx queue tail pointer once.
136c1e4535fSMauro Carvalho Chehab			 "burst 1" is the default
137c1e4535fSMauro Carvalho Chehab pgset "pkt_size 9014"   sets packet size to 9014
138c1e4535fSMauro Carvalho Chehab pgset "frags 5"         packet will consist of 5 fragments
139c1e4535fSMauro Carvalho Chehab pgset "count 200000"    sets number of packets to send, set to zero
140c1e4535fSMauro Carvalho Chehab			 for continuous sends until explicitly stopped.
141c1e4535fSMauro Carvalho Chehab
142c1e4535fSMauro Carvalho Chehab pgset "delay 5000"      adds delay to hard_start_xmit(). nanoseconds
143c1e4535fSMauro Carvalho Chehab
144c1e4535fSMauro Carvalho Chehab pgset "dst 10.0.0.1"    sets IP destination address
145c1e4535fSMauro Carvalho Chehab			 (BEWARE! This generator is very aggressive!)
146c1e4535fSMauro Carvalho Chehab
147c1e4535fSMauro Carvalho Chehab pgset "dst_min 10.0.0.1"            Same as dst
148c1e4535fSMauro Carvalho Chehab pgset "dst_max 10.0.0.254"          Set the maximum destination IP.
149c1e4535fSMauro Carvalho Chehab pgset "src_min 10.0.0.1"            Set the minimum (or only) source IP.
150c1e4535fSMauro Carvalho Chehab pgset "src_max 10.0.0.254"          Set the maximum source IP.
151c1e4535fSMauro Carvalho Chehab pgset "dst6 fec0::1"     IPV6 destination address
152c1e4535fSMauro Carvalho Chehab pgset "src6 fec0::2"     IPV6 source address
153c1e4535fSMauro Carvalho Chehab pgset "dstmac 00:00:00:00:00:00"    sets MAC destination address
154c1e4535fSMauro Carvalho Chehab pgset "srcmac 00:00:00:00:00:00"    sets MAC source address
155c1e4535fSMauro Carvalho Chehab
156c1e4535fSMauro Carvalho Chehab pgset "queue_map_min 0" Sets the min value of tx queue interval
157c1e4535fSMauro Carvalho Chehab pgset "queue_map_max 7" Sets the max value of tx queue interval, for multiqueue devices
158c1e4535fSMauro Carvalho Chehab			 To select queue 1 of a given device,
159c1e4535fSMauro Carvalho Chehab			 use queue_map_min=1 and queue_map_max=1
160c1e4535fSMauro Carvalho Chehab
161c1e4535fSMauro Carvalho Chehab pgset "src_mac_count 1" Sets the number of MACs we'll range through.
162c1e4535fSMauro Carvalho Chehab			 The 'minimum' MAC is what you set with srcmac.
163c1e4535fSMauro Carvalho Chehab
164c1e4535fSMauro Carvalho Chehab pgset "dst_mac_count 1" Sets the number of MACs we'll range through.
165c1e4535fSMauro Carvalho Chehab			 The 'minimum' MAC is what you set with dstmac.
166c1e4535fSMauro Carvalho Chehab
167c1e4535fSMauro Carvalho Chehab pgset "flag [name]"     Set a flag to determine behaviour.  Current flags
168c1e4535fSMauro Carvalho Chehab			 are: IPSRC_RND # IP source is random (between min/max)
169c1e4535fSMauro Carvalho Chehab			      IPDST_RND # IP destination is random
170c1e4535fSMauro Carvalho Chehab			      UDPSRC_RND, UDPDST_RND,
171c1e4535fSMauro Carvalho Chehab			      MACSRC_RND, MACDST_RND
172c1e4535fSMauro Carvalho Chehab			      TXSIZE_RND, IPV6,
173c1e4535fSMauro Carvalho Chehab			      MPLS_RND, VID_RND, SVID_RND
174c1e4535fSMauro Carvalho Chehab			      FLOW_SEQ,
175c1e4535fSMauro Carvalho Chehab			      QUEUE_MAP_RND # queue map random
176c1e4535fSMauro Carvalho Chehab			      QUEUE_MAP_CPU # queue map mirrors smp_processor_id()
177c1e4535fSMauro Carvalho Chehab			      UDPCSUM,
178c1e4535fSMauro Carvalho Chehab			      IPSEC # IPsec encapsulation (needs CONFIG_XFRM)
179c1e4535fSMauro Carvalho Chehab			      NODE_ALLOC # node specific memory allocation
180c1e4535fSMauro Carvalho Chehab			      NO_TIMESTAMP # disable timestamping
181c1e4535fSMauro Carvalho Chehab pgset 'flag ![name]'    Clear a flag to determine behaviour.
182c1e4535fSMauro Carvalho Chehab			 Note that you might need to use single quote in
183c1e4535fSMauro Carvalho Chehab			 interactive mode, so that your shell wouldn't expand
184c1e4535fSMauro Carvalho Chehab			 the specified flag as a history command.
185c1e4535fSMauro Carvalho Chehab
186c1e4535fSMauro Carvalho Chehab pgset "spi [SPI_VALUE]" Set specific SA used to transform packet.
187c1e4535fSMauro Carvalho Chehab
188c1e4535fSMauro Carvalho Chehab pgset "udp_src_min 9"   set UDP source port min, If < udp_src_max, then
189c1e4535fSMauro Carvalho Chehab			 cycle through the port range.
190c1e4535fSMauro Carvalho Chehab
191c1e4535fSMauro Carvalho Chehab pgset "udp_src_max 9"   set UDP source port max.
192c1e4535fSMauro Carvalho Chehab pgset "udp_dst_min 9"   set UDP destination port min, If < udp_dst_max, then
193c1e4535fSMauro Carvalho Chehab			 cycle through the port range.
194c1e4535fSMauro Carvalho Chehab pgset "udp_dst_max 9"   set UDP destination port max.
195c1e4535fSMauro Carvalho Chehab
196c1e4535fSMauro Carvalho Chehab pgset "mpls 0001000a,0002000a,0000000a" set MPLS labels (in this example
197c1e4535fSMauro Carvalho Chehab					 outer label=16,middle label=32,
198c1e4535fSMauro Carvalho Chehab					 inner label=0 (IPv4 NULL)) Note that
199c1e4535fSMauro Carvalho Chehab					 there must be no spaces between the
200c1e4535fSMauro Carvalho Chehab					 arguments. Leading zeros are required.
201c1e4535fSMauro Carvalho Chehab					 Do not set the bottom of stack bit,
202c1e4535fSMauro Carvalho Chehab					 that's done automatically. If you do
203c1e4535fSMauro Carvalho Chehab					 set the bottom of stack bit, that
204c1e4535fSMauro Carvalho Chehab					 indicates that you want to randomly
205c1e4535fSMauro Carvalho Chehab					 generate that address and the flag
206c1e4535fSMauro Carvalho Chehab					 MPLS_RND will be turned on. You
207c1e4535fSMauro Carvalho Chehab					 can have any mix of random and fixed
208c1e4535fSMauro Carvalho Chehab					 labels in the label stack.
209c1e4535fSMauro Carvalho Chehab
210c1e4535fSMauro Carvalho Chehab pgset "mpls 0"		  turn off mpls (or any invalid argument works too!)
211c1e4535fSMauro Carvalho Chehab
212c1e4535fSMauro Carvalho Chehab pgset "vlan_id 77"       set VLAN ID 0-4095
213c1e4535fSMauro Carvalho Chehab pgset "vlan_p 3"         set priority bit 0-7 (default 0)
214c1e4535fSMauro Carvalho Chehab pgset "vlan_cfi 0"       set canonical format identifier 0-1 (default 0)
215c1e4535fSMauro Carvalho Chehab
216c1e4535fSMauro Carvalho Chehab pgset "svlan_id 22"      set SVLAN ID 0-4095
217c1e4535fSMauro Carvalho Chehab pgset "svlan_p 3"        set priority bit 0-7 (default 0)
218c1e4535fSMauro Carvalho Chehab pgset "svlan_cfi 0"      set canonical format identifier 0-1 (default 0)
219c1e4535fSMauro Carvalho Chehab
220c1e4535fSMauro Carvalho Chehab pgset "vlan_id 9999"     > 4095 remove vlan and svlan tags
221c1e4535fSMauro Carvalho Chehab pgset "svlan 9999"       > 4095 remove svlan tag
222c1e4535fSMauro Carvalho Chehab
223c1e4535fSMauro Carvalho Chehab
224c1e4535fSMauro Carvalho Chehab pgset "tos XX"           set former IPv4 TOS field (e.g. "tos 28" for AF11 no ECN, default 00)
225c1e4535fSMauro Carvalho Chehab pgset "traffic_class XX" set former IPv6 TRAFFIC CLASS (e.g. "traffic_class B8" for EF no ECN, default 00)
226c1e4535fSMauro Carvalho Chehab
227c1e4535fSMauro Carvalho Chehab pgset "rate 300M"        set rate to 300 Mb/s
228c1e4535fSMauro Carvalho Chehab pgset "ratep 1000000"    set rate to 1Mpps
229c1e4535fSMauro Carvalho Chehab
230c1e4535fSMauro Carvalho Chehab pgset "xmit_mode netif_receive"  RX inject into stack netif_receive_skb()
231c1e4535fSMauro Carvalho Chehab				  Works with "burst" but not with "clone_skb".
232c1e4535fSMauro Carvalho Chehab				  Default xmit_mode is "start_xmit".
233c1e4535fSMauro Carvalho Chehab
234c1e4535fSMauro Carvalho ChehabSample scripts
235c1e4535fSMauro Carvalho Chehab==============
236c1e4535fSMauro Carvalho Chehab
237c1e4535fSMauro Carvalho ChehabA collection of tutorial scripts and helpers for pktgen is in the
238c1e4535fSMauro Carvalho Chehabsamples/pktgen directory. The helper parameters.sh file support easy
239c1e4535fSMauro Carvalho Chehaband consistent parameter parsing across the sample scripts.
240c1e4535fSMauro Carvalho Chehab
241c1e4535fSMauro Carvalho ChehabUsage example and help::
242c1e4535fSMauro Carvalho Chehab
243c1e4535fSMauro Carvalho Chehab ./pktgen_sample01_simple.sh -i eth4 -m 00:1B:21:3C:9D:F8 -d 192.168.8.2
244c1e4535fSMauro Carvalho Chehab
245c1e4535fSMauro Carvalho ChehabUsage:::
246c1e4535fSMauro Carvalho Chehab
247c1e4535fSMauro Carvalho Chehab  ./pktgen_sample01_simple.sh [-vx] -i ethX
248c1e4535fSMauro Carvalho Chehab
249c1e4535fSMauro Carvalho Chehab  -i : ($DEV)       output interface/device (required)
250c1e4535fSMauro Carvalho Chehab  -s : ($PKT_SIZE)  packet size
251*246b184fSJuhee Kang  -d : ($DEST_IP)   destination IP. CIDR (e.g. 198.18.0.0/15) is also allowed
252c1e4535fSMauro Carvalho Chehab  -m : ($DST_MAC)   destination MAC-addr
253*246b184fSJuhee Kang  -p : ($DST_PORT)  destination PORT range (e.g. 433-444) is also allowed
254c1e4535fSMauro Carvalho Chehab  -t : ($THREADS)   threads to start
255*246b184fSJuhee Kang  -f : ($F_THREAD)  index of first thread (zero indexed CPU number)
256c1e4535fSMauro Carvalho Chehab  -c : ($SKB_CLONE) SKB clones send before alloc new SKB
257*246b184fSJuhee Kang  -n : ($COUNT)     num messages to send per thread, 0 means indefinitely
258c1e4535fSMauro Carvalho Chehab  -b : ($BURST)     HW level bursting of SKBs
259c1e4535fSMauro Carvalho Chehab  -v : ($VERBOSE)   verbose
260c1e4535fSMauro Carvalho Chehab  -x : ($DEBUG)     debug
261*246b184fSJuhee Kang  -6 : ($IP6)       IPv6
262*246b184fSJuhee Kang  -w : ($DELAY)     Tx Delay value (ns)
263*246b184fSJuhee Kang  -a : ($APPEND)    Script will not reset generator's state, but will append its config
264c1e4535fSMauro Carvalho Chehab
265c1e4535fSMauro Carvalho ChehabThe global variables being set are also listed.  E.g. the required
266c1e4535fSMauro Carvalho Chehabinterface/device parameter "-i" sets variable $DEV.  Copy the
267c1e4535fSMauro Carvalho Chehabpktgen_sampleXX scripts and modify them to fit your own needs.
268c1e4535fSMauro Carvalho Chehab
269c1e4535fSMauro Carvalho Chehab
270c1e4535fSMauro Carvalho ChehabInterrupt affinity
271c1e4535fSMauro Carvalho Chehab===================
272c1e4535fSMauro Carvalho ChehabNote that when adding devices to a specific CPU it is a good idea to
273c1e4535fSMauro Carvalho Chehabalso assign /proc/irq/XX/smp_affinity so that the TX interrupts are bound
274c1e4535fSMauro Carvalho Chehabto the same CPU.  This reduces cache bouncing when freeing skbs.
275c1e4535fSMauro Carvalho Chehab
276c1e4535fSMauro Carvalho ChehabPlus using the device flag QUEUE_MAP_CPU, which maps the SKBs TX queue
277c1e4535fSMauro Carvalho Chehabto the running threads CPU (directly from smp_processor_id()).
278c1e4535fSMauro Carvalho Chehab
279c1e4535fSMauro Carvalho ChehabEnable IPsec
280c1e4535fSMauro Carvalho Chehab============
281c1e4535fSMauro Carvalho ChehabDefault IPsec transformation with ESP encapsulation plus transport mode
282c1e4535fSMauro Carvalho Chehabcan be enabled by simply setting::
283c1e4535fSMauro Carvalho Chehab
284c1e4535fSMauro Carvalho Chehab    pgset "flag IPSEC"
285c1e4535fSMauro Carvalho Chehab    pgset "flows 1"
286c1e4535fSMauro Carvalho Chehab
287c1e4535fSMauro Carvalho ChehabTo avoid breaking existing testbed scripts for using AH type and tunnel mode,
288c1e4535fSMauro Carvalho Chehabyou can use "pgset spi SPI_VALUE" to specify which transformation mode
289c1e4535fSMauro Carvalho Chehabto employ.
290c1e4535fSMauro Carvalho Chehab
291c1e4535fSMauro Carvalho Chehab
292c1e4535fSMauro Carvalho ChehabCurrent commands and configuration options
293c1e4535fSMauro Carvalho Chehab==========================================
294c1e4535fSMauro Carvalho Chehab
295c1e4535fSMauro Carvalho Chehab**Pgcontrol commands**::
296c1e4535fSMauro Carvalho Chehab
297c1e4535fSMauro Carvalho Chehab    start
298c1e4535fSMauro Carvalho Chehab    stop
299c1e4535fSMauro Carvalho Chehab    reset
300c1e4535fSMauro Carvalho Chehab
301c1e4535fSMauro Carvalho Chehab**Thread commands**::
302c1e4535fSMauro Carvalho Chehab
303c1e4535fSMauro Carvalho Chehab    add_device
304c1e4535fSMauro Carvalho Chehab    rem_device_all
305c1e4535fSMauro Carvalho Chehab
306c1e4535fSMauro Carvalho Chehab
307c1e4535fSMauro Carvalho Chehab**Device commands**::
308c1e4535fSMauro Carvalho Chehab
309c1e4535fSMauro Carvalho Chehab    count
310c1e4535fSMauro Carvalho Chehab    clone_skb
311c1e4535fSMauro Carvalho Chehab    burst
312c1e4535fSMauro Carvalho Chehab    debug
313c1e4535fSMauro Carvalho Chehab
314c1e4535fSMauro Carvalho Chehab    frags
315c1e4535fSMauro Carvalho Chehab    delay
316c1e4535fSMauro Carvalho Chehab
317c1e4535fSMauro Carvalho Chehab    src_mac_count
318c1e4535fSMauro Carvalho Chehab    dst_mac_count
319c1e4535fSMauro Carvalho Chehab
320c1e4535fSMauro Carvalho Chehab    pkt_size
321c1e4535fSMauro Carvalho Chehab    min_pkt_size
322c1e4535fSMauro Carvalho Chehab    max_pkt_size
323c1e4535fSMauro Carvalho Chehab
324c1e4535fSMauro Carvalho Chehab    queue_map_min
325c1e4535fSMauro Carvalho Chehab    queue_map_max
326c1e4535fSMauro Carvalho Chehab    skb_priority
327c1e4535fSMauro Carvalho Chehab
328c1e4535fSMauro Carvalho Chehab    tos           (ipv4)
329c1e4535fSMauro Carvalho Chehab    traffic_class (ipv6)
330c1e4535fSMauro Carvalho Chehab
331c1e4535fSMauro Carvalho Chehab    mpls
332c1e4535fSMauro Carvalho Chehab
333c1e4535fSMauro Carvalho Chehab    udp_src_min
334c1e4535fSMauro Carvalho Chehab    udp_src_max
335c1e4535fSMauro Carvalho Chehab
336c1e4535fSMauro Carvalho Chehab    udp_dst_min
337c1e4535fSMauro Carvalho Chehab    udp_dst_max
338c1e4535fSMauro Carvalho Chehab
339c1e4535fSMauro Carvalho Chehab    node
340c1e4535fSMauro Carvalho Chehab
341c1e4535fSMauro Carvalho Chehab    flag
342c1e4535fSMauro Carvalho Chehab    IPSRC_RND
343c1e4535fSMauro Carvalho Chehab    IPDST_RND
344c1e4535fSMauro Carvalho Chehab    UDPSRC_RND
345c1e4535fSMauro Carvalho Chehab    UDPDST_RND
346c1e4535fSMauro Carvalho Chehab    MACSRC_RND
347c1e4535fSMauro Carvalho Chehab    MACDST_RND
348c1e4535fSMauro Carvalho Chehab    TXSIZE_RND
349c1e4535fSMauro Carvalho Chehab    IPV6
350c1e4535fSMauro Carvalho Chehab    MPLS_RND
351c1e4535fSMauro Carvalho Chehab    VID_RND
352c1e4535fSMauro Carvalho Chehab    SVID_RND
353c1e4535fSMauro Carvalho Chehab    FLOW_SEQ
354c1e4535fSMauro Carvalho Chehab    QUEUE_MAP_RND
355c1e4535fSMauro Carvalho Chehab    QUEUE_MAP_CPU
356c1e4535fSMauro Carvalho Chehab    UDPCSUM
357c1e4535fSMauro Carvalho Chehab    IPSEC
358c1e4535fSMauro Carvalho Chehab    NODE_ALLOC
359c1e4535fSMauro Carvalho Chehab    NO_TIMESTAMP
360c1e4535fSMauro Carvalho Chehab
361c1e4535fSMauro Carvalho Chehab    spi (ipsec)
362c1e4535fSMauro Carvalho Chehab
363c1e4535fSMauro Carvalho Chehab    dst_min
364c1e4535fSMauro Carvalho Chehab    dst_max
365c1e4535fSMauro Carvalho Chehab
366c1e4535fSMauro Carvalho Chehab    src_min
367c1e4535fSMauro Carvalho Chehab    src_max
368c1e4535fSMauro Carvalho Chehab
369c1e4535fSMauro Carvalho Chehab    dst_mac
370c1e4535fSMauro Carvalho Chehab    src_mac
371c1e4535fSMauro Carvalho Chehab
372c1e4535fSMauro Carvalho Chehab    clear_counters
373c1e4535fSMauro Carvalho Chehab
374c1e4535fSMauro Carvalho Chehab    src6
375c1e4535fSMauro Carvalho Chehab    dst6
376c1e4535fSMauro Carvalho Chehab    dst6_max
377c1e4535fSMauro Carvalho Chehab    dst6_min
378c1e4535fSMauro Carvalho Chehab
379c1e4535fSMauro Carvalho Chehab    flows
380c1e4535fSMauro Carvalho Chehab    flowlen
381c1e4535fSMauro Carvalho Chehab
382c1e4535fSMauro Carvalho Chehab    rate
383c1e4535fSMauro Carvalho Chehab    ratep
384c1e4535fSMauro Carvalho Chehab
385c1e4535fSMauro Carvalho Chehab    xmit_mode <start_xmit|netif_receive>
386c1e4535fSMauro Carvalho Chehab
387c1e4535fSMauro Carvalho Chehab    vlan_cfi
388c1e4535fSMauro Carvalho Chehab    vlan_id
389c1e4535fSMauro Carvalho Chehab    vlan_p
390c1e4535fSMauro Carvalho Chehab
391c1e4535fSMauro Carvalho Chehab    svlan_cfi
392c1e4535fSMauro Carvalho Chehab    svlan_id
393c1e4535fSMauro Carvalho Chehab    svlan_p
394c1e4535fSMauro Carvalho Chehab
395c1e4535fSMauro Carvalho Chehab
396c1e4535fSMauro Carvalho ChehabReferences:
397c1e4535fSMauro Carvalho Chehab
398c1e4535fSMauro Carvalho Chehab- ftp://robur.slu.se/pub/Linux/net-development/pktgen-testing/
399*246b184fSJuhee Kang- ftp://robur.slu.se/pub/Linux/net-development/pktgen-testing/examples/
400c1e4535fSMauro Carvalho Chehab
401c1e4535fSMauro Carvalho ChehabPaper from Linux-Kongress in Erlangen 2004.
402c1e4535fSMauro Carvalho Chehab- ftp://robur.slu.se/pub/Linux/net-development/pktgen-testing/pktgen_paper.pdf
403c1e4535fSMauro Carvalho Chehab
404c1e4535fSMauro Carvalho ChehabThanks to:
405c1e4535fSMauro Carvalho Chehab
406c1e4535fSMauro Carvalho ChehabGrant Grundler for testing on IA-64 and parisc, Harald Welte,  Lennert Buytenhek
407c1e4535fSMauro Carvalho ChehabStephen Hemminger, Andi Kleen, Dave Miller and many others.
408c1e4535fSMauro Carvalho Chehab
409c1e4535fSMauro Carvalho Chehab
410c1e4535fSMauro Carvalho ChehabGood luck with the linux net-development.
411